user_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
1 value
submission_id_v0
stringlengths
10
10
submission_id_v1
stringlengths
10
10
cpu_time_v0
int64
10
38.3k
cpu_time_v1
int64
0
24.7k
memory_v0
int64
2.57k
1.02M
memory_v1
int64
2.57k
869k
status_v0
stringclasses
1 value
status_v1
stringclasses
1 value
improvement_frac
float64
7.51
100
input
stringlengths
20
4.55k
target
stringlengths
17
3.34k
code_v0_loc
int64
1
148
code_v1_loc
int64
1
184
code_v0_num_chars
int64
13
4.55k
code_v1_num_chars
int64
14
3.34k
code_v0_no_empty_lines
stringlengths
21
6.88k
code_v1_no_empty_lines
stringlengths
20
4.93k
code_same
bool
1 class
relative_loc_diff_percent
float64
0
79.8
diff
list
diff_only_import_comment
bool
1 class
measured_runtime_v0
float64
0.01
4.45
measured_runtime_v1
float64
0.01
4.31
runtime_lift
float64
0
359
key
list
u654470292
p02802
python
s720452301
s186134431
318
152
73,564
114,824
Accepted
Accepted
52.2
import sys def input(): return sys.stdin.readline()[:-1] n,m=list(map(int,input().split())) ps=[list(input().split()) for i in range(m)] li=[[0,0] for i in range(n+1)] wa=0 ans=0 # print(ps) for i in range(m): if li[int(ps[i][0])][0]==0: if ps[i][1]=="AC": li[int(ps[i][0])][0]+=...
import bisect, copy, heapq, math, sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) def celi(a,b): return -(-a//b) sys....
25
35
529
795
import sys def input(): return sys.stdin.readline()[:-1] n, m = list(map(int, input().split())) ps = [list(input().split()) for i in range(m)] li = [[0, 0] for i in range(n + 1)] wa = 0 ans = 0 # print(ps) for i in range(m): if li[int(ps[i][0])][0] == 0: if ps[i][1] == "AC": li[int(ps[i]...
import bisect, copy, heapq, math, sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0] + list(accumulate(lst)) def celi(a, b): return -(-a // b) s...
false
28.571429
[ "-import sys", "+import bisect, copy, heapq, math, sys", "+from collections import *", "+from functools import lru_cache", "+from itertools import accumulate, combinations, permutations, product", "+def ruiseki(lst):", "+ return [0] + list(accumulate(lst))", "+", "+", "+def celi(a, b):", "+ ...
false
0.07459
0.058787
1.268803
[ "s720452301", "s186134431" ]
u869154953
p03609
python
s394887942
s553099737
26
24
9,132
9,144
Accepted
Accepted
7.69
X,t=list(map(int,input().split())) if (X-t)<0: print("0") else: print((X-t))
X,t=list(map(int,input().split())) print((max(X-t,0)))
7
3
80
49
X, t = list(map(int, input().split())) if (X - t) < 0: print("0") else: print((X - t))
X, t = list(map(int, input().split())) print((max(X - t, 0)))
false
57.142857
[ "-if (X - t) < 0:", "- print(\"0\")", "-else:", "- print((X - t))", "+print((max(X - t, 0)))" ]
false
0.047006
0.046684
1.00691
[ "s394887942", "s553099737" ]
u926412290
p03163
python
s306707840
s460175173
440
289
160,012
159,900
Accepted
Accepted
34.32
N, W = list(map(int, input().split())) item = [list(map(int, input().split())) for _ in range(N)] dp = [[0]*100100 for _ in range(110)] for i in range(N): for sum_w in range(W+1): weight, value = item[i] if sum_w - weight >= 0: dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][su...
N, W = list(map(int, input().split())) dp = [[0]*100100 for _ in range(110)] for i in range(N): weight, value = list(map(int, input().split())) for sum_w in range(W+1): if sum_w - weight >= 0: dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - weight] + value) dp[i + 1...
14
12
421
373
N, W = list(map(int, input().split())) item = [list(map(int, input().split())) for _ in range(N)] dp = [[0] * 100100 for _ in range(110)] for i in range(N): for sum_w in range(W + 1): weight, value = item[i] if sum_w - weight >= 0: dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - w...
N, W = list(map(int, input().split())) dp = [[0] * 100100 for _ in range(110)] for i in range(N): weight, value = list(map(int, input().split())) for sum_w in range(W + 1): if sum_w - weight >= 0: dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - weight] + value) dp[i + 1][sum_w...
false
14.285714
[ "-item = [list(map(int, input().split())) for _ in range(N)]", "+ weight, value = list(map(int, input().split()))", "- weight, value = item[i]" ]
false
0.647008
0.223214
2.898606
[ "s306707840", "s460175173" ]
u883040023
p03339
python
s630506395
s977586000
422
287
48,208
15,244
Accepted
Accepted
31.99
n = int(eval(input())) S = eval(input()) WE = [[] for _ in range(n)] w = 0 e = 0 for i in range(n): if S[i] == "W": w += 1 else: e += 1 WE[i].append(w) WE[i].append(e) ans = WE[n-1][1] - WE[0][1] for i in range(1,n): res = WE[i-1][0] + (WE[n-1][1] - WE[i...
n = int(eval(input())) S = eval(input()) W = [0] * (n+1) w = 0 ans = float("inf") for i in range(n): if S[i] == "W": w += 1 W[i+1] = w for i in range(n): res = W[i] + ((n-W[n]) - (i+1-W[i+1])) ans = min(ans,res) print(ans)
22
17
355
266
n = int(eval(input())) S = eval(input()) WE = [[] for _ in range(n)] w = 0 e = 0 for i in range(n): if S[i] == "W": w += 1 else: e += 1 WE[i].append(w) WE[i].append(e) ans = WE[n - 1][1] - WE[0][1] for i in range(1, n): res = WE[i - 1][0] + (WE[n - 1][1] - WE[i][1]) ans = min(ans...
n = int(eval(input())) S = eval(input()) W = [0] * (n + 1) w = 0 ans = float("inf") for i in range(n): if S[i] == "W": w += 1 W[i + 1] = w for i in range(n): res = W[i] + ((n - W[n]) - (i + 1 - W[i + 1])) ans = min(ans, res) print(ans)
false
22.727273
[ "-WE = [[] for _ in range(n)]", "+W = [0] * (n + 1)", "-e = 0", "+ans = float(\"inf\")", "- else:", "- e += 1", "- WE[i].append(w)", "- WE[i].append(e)", "-ans = WE[n - 1][1] - WE[0][1]", "-for i in range(1, n):", "- res = WE[i - 1][0] + (WE[n - 1][1] - WE[i][1])", "+ W[i...
false
0.148299
0.04017
3.691793
[ "s630506395", "s977586000" ]
u497596438
p03044
python
s445189276
s843954423
1,197
849
172,320
88,992
Accepted
Accepted
29.07
import sys sys.setrecursionlimit(100100) N=int(eval(input())) G=[[] for i in range(N)] for i in range(N-1): u,v,w=list(map(int,input().split())) u,v=u-1,v-1 G[u].append((v,w)) G[v].append((u,w)) res=[-1]*N def dfs(v,p,c): res[v]=c for nv,w in G[v]: if res[nv]>=0: ...
from collections import deque N=int(input()) G=[[] for i in range(N)] for i in range(N-1): u,v,w=map(int,input().split()) u,v=u-1,v-1 w%=2 G[u].append([u,v,w]) G[v].append([v,u,w]) color=[-1]*N color[0]=0 stack=deque(G[0]) while(stack): u,v,w=stack.pop() if color[v]!=-1: ...
26
22
500
464
import sys sys.setrecursionlimit(100100) N = int(eval(input())) G = [[] for i in range(N)] for i in range(N - 1): u, v, w = list(map(int, input().split())) u, v = u - 1, v - 1 G[u].append((v, w)) G[v].append((u, w)) res = [-1] * N def dfs(v, p, c): res[v] = c for nv, w in G[v]: if res...
from collections import deque N = int(input()) G = [[] for i in range(N)] for i in range(N - 1): u, v, w = map(int, input().split()) u, v = u - 1, v - 1 w %= 2 G[u].append([u, v, w]) G[v].append([v, u, w]) color = [-1] * N color[0] = 0 stack = deque(G[0]) while stack: u, v, w = stack.pop() ...
false
15.384615
[ "-import sys", "+from collections import deque", "-sys.setrecursionlimit(100100)", "-N = int(eval(input()))", "+N = int(input())", "- u, v, w = list(map(int, input().split()))", "+ u, v, w = map(int, input().split())", "- G[u].append((v, w))", "- G[v].append((u, w))", "-res = [-1] * N"...
false
0.042579
0.042974
0.990824
[ "s445189276", "s843954423" ]
u887207211
p03409
python
s481247860
s635910211
21
19
3,064
3,064
Accepted
Accepted
9.52
def ans(): N = int(eval(input())) AB = sorted([list(map(int,input().split())) for _ in range(N)], key = lambda x: -x[1]) CD = sorted([list(map(int,input().split())) for _ in range(N)]) cnt = 0 for c, d in CD: for a, b in AB: if(a < c and b < d): cnt += 1 AB.remove([a,b]) ...
N = int(eval(input())) AB = sorted([list(map(int,input().split())) for _ in range(N)], key = lambda x: -x[1]) CD = sorted([list(map(int,input().split())) for _ in range(N)]) cnt = 0 for c, d in CD: for a, b in AB: if(a < c and b < d): cnt += 1 AB.remove([a, b]) break print(cnt)
13
12
346
308
def ans(): N = int(eval(input())) AB = sorted( [list(map(int, input().split())) for _ in range(N)], key=lambda x: -x[1] ) CD = sorted([list(map(int, input().split())) for _ in range(N)]) cnt = 0 for c, d in CD: for a, b in AB: if a < c and b < d: cnt +...
N = int(eval(input())) AB = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: -x[1]) CD = sorted([list(map(int, input().split())) for _ in range(N)]) cnt = 0 for c, d in CD: for a, b in AB: if a < c and b < d: cnt += 1 AB.remove([a, b]) break print...
false
7.692308
[ "-def ans():", "- N = int(eval(input()))", "- AB = sorted(", "- [list(map(int, input().split())) for _ in range(N)], key=lambda x: -x[1]", "- )", "- CD = sorted([list(map(int, input().split())) for _ in range(N)])", "- cnt = 0", "- for c, d in CD:", "- for a, b in AB:...
false
0.035999
0.034486
1.043866
[ "s481247860", "s635910211" ]
u408071652
p03161
python
s010917311
s100168324
235
205
86,184
85,520
Accepted
Accepted
12.77
import sys #import numpy as np #from collections import defaultdict #import math #from collections import deque input = sys.stdin.readline def main(): N ,K= list(map(int,input().split())) H = list(map(int,input().split())) H = [0] + H dp= [0] *(N+1) dp = [10**5] * (N + 1) ...
import sys from collections import deque from operator import itemgetter def input(): return sys.stdin.readline().rstrip() def main(): N, K = list(map(int, input().split())) h = list(map(int, input().split())) h.insert(0,0) dp = [10 ** 9 + 7] * (N + 1) dp[1] = 0 for i in r...
36
23
589
519
import sys # import numpy as np # from collections import defaultdict # import math # from collections import deque input = sys.stdin.readline def main(): N, K = list(map(int, input().split())) H = list(map(int, input().split())) H = [0] + H dp = [0] * (N + 1) dp = [10**5] * (N + 1) dp[1] = 0...
import sys from collections import deque from operator import itemgetter def input(): return sys.stdin.readline().rstrip() def main(): N, K = list(map(int, input().split())) h = list(map(int, input().split())) h.insert(0, 0) dp = [10**9 + 7] * (N + 1) dp[1] = 0 for i in range(1, N + 1): ...
false
36.111111
[ "+from collections import deque", "+from operator import itemgetter", "-# import numpy as np", "-# from collections import defaultdict", "-# import math", "-# from collections import deque", "-input = sys.stdin.readline", "+", "+def input():", "+ return sys.stdin.readline().rstrip()", "- H...
false
0.04246
0.041266
1.028932
[ "s010917311", "s100168324" ]
u347600233
p02689
python
s152705799
s613605263
405
320
29,480
19,924
Accepted
Accepted
20.99
n, m = list(map(int, input().split())) h = list(map(int, input().split())) to = [[] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) to[a - 1] += [b - 1] to[b - 1] += [a - 1] print((sum(to[j] == [] or h[j] > max(h[i] for i in to[j]) for j in range(n))))
n, m = list(map(int, input().split())) h = list(map(int, input().split())) mh = [0] * n for i in range(m): a, b = list(map(int, input().split())) mh[a - 1] = max(mh[a - 1], h[b - 1]) mh[b - 1] = max(mh[b - 1], h[a - 1]) print((sum(h[i] > mh[i] for i in range(n))))
8
8
286
269
n, m = list(map(int, input().split())) h = list(map(int, input().split())) to = [[] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) to[a - 1] += [b - 1] to[b - 1] += [a - 1] print((sum(to[j] == [] or h[j] > max(h[i] for i in to[j]) for j in range(n))))
n, m = list(map(int, input().split())) h = list(map(int, input().split())) mh = [0] * n for i in range(m): a, b = list(map(int, input().split())) mh[a - 1] = max(mh[a - 1], h[b - 1]) mh[b - 1] = max(mh[b - 1], h[a - 1]) print((sum(h[i] > mh[i] for i in range(n))))
false
0
[ "-to = [[] for i in range(n)]", "+mh = [0] * n", "- to[a - 1] += [b - 1]", "- to[b - 1] += [a - 1]", "-print((sum(to[j] == [] or h[j] > max(h[i] for i in to[j]) for j in range(n))))", "+ mh[a - 1] = max(mh[a - 1], h[b - 1])", "+ mh[b - 1] = max(mh[b - 1], h[a - 1])", "+print((sum(h[i] > mh...
false
0.045605
0.044705
1.020145
[ "s152705799", "s613605263" ]
u977389981
p03317
python
s664444974
s292301969
53
46
13,880
13,880
Accepted
Accepted
13.21
n, k = list(map(int, input().split())) A = [int(i) for i in input().split()] n -= k count = 1 while n > 0: n -= k - 1 count += 1 print(count)
n, k = list(map(int, input().split())) A = [int(i) for i in input().split()] count = 1 n -= k count += n // (k - 1) if n % (k - 1) != 0: count += 1 print(count)
10
10
158
173
n, k = list(map(int, input().split())) A = [int(i) for i in input().split()] n -= k count = 1 while n > 0: n -= k - 1 count += 1 print(count)
n, k = list(map(int, input().split())) A = [int(i) for i in input().split()] count = 1 n -= k count += n // (k - 1) if n % (k - 1) != 0: count += 1 print(count)
false
0
[ "+count = 1", "-count = 1", "-while n > 0:", "- n -= k - 1", "+count += n // (k - 1)", "+if n % (k - 1) != 0:" ]
false
0.034016
0.033956
1.001756
[ "s664444974", "s292301969" ]
u729133443
p04034
python
s565008222
s095382322
589
367
53,976
5,348
Accepted
Accepted
37.69
i=lambda:list(map(int,input().split()));n,m=i();l=[0,1]+[0]*n;c=[0]+[1]*n for _ in[0]*m:x,y=i();l[y]|=l[x];c[y]+=1;c[x]-=1;l[x]=c[x]and l[x] print((sum(c[i]and l[i]for i in range(n+1))))
i=lambda:list(map(int,input().split()));n,m=i();a=[0]+[1]*n;b=[0,1]+[0]*n for _ in[0]*m:x,y=i();a[x]-=1;a[y]+=1;b[y]|=b[x];b[x]&=a[x]>0 print((sum(b)))
3
3
180
145
i = lambda: list(map(int, input().split())) n, m = i() l = [0, 1] + [0] * n c = [0] + [1] * n for _ in [0] * m: x, y = i() l[y] |= l[x] c[y] += 1 c[x] -= 1 l[x] = c[x] and l[x] print((sum(c[i] and l[i] for i in range(n + 1))))
i = lambda: list(map(int, input().split())) n, m = i() a = [0] + [1] * n b = [0, 1] + [0] * n for _ in [0] * m: x, y = i() a[x] -= 1 a[y] += 1 b[y] |= b[x] b[x] &= a[x] > 0 print((sum(b)))
false
0
[ "-l = [0, 1] + [0] * n", "-c = [0] + [1] * n", "+a = [0] + [1] * n", "+b = [0, 1] + [0] * n", "- l[y] |= l[x]", "- c[y] += 1", "- c[x] -= 1", "- l[x] = c[x] and l[x]", "-print((sum(c[i] and l[i] for i in range(n + 1))))", "+ a[x] -= 1", "+ a[y] += 1", "+ b[y] |= b[x]", "...
false
0.032843
0.039049
0.841062
[ "s565008222", "s095382322" ]
u923279197
p02813
python
s978984149
s865488519
186
138
43,376
3,064
Accepted
Accepted
25.81
from itertools import permutations n = int(eval(input())) P = tuple(map(int,input().split())) Q = tuple(map(int,input().split())) dict = {} d = [i for i in range(1,n+1)] i = 1 for x in permutations(d,n): dict[x] = i i += 1 print((abs(dict[P]-dict[Q])))
from itertools import permutations n = int(eval(input())) p = list(map(int,input().split())) q = list(map(int,input().split())) a,b = -1,-1 for i,x in enumerate(permutations([i+1 for i in range(n)])): c,d = True,True for j in range(n): if x[j] != p[j]: c = False if x[j] !...
13
16
266
397
from itertools import permutations n = int(eval(input())) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) dict = {} d = [i for i in range(1, n + 1)] i = 1 for x in permutations(d, n): dict[x] = i i += 1 print((abs(dict[P] - dict[Q])))
from itertools import permutations n = int(eval(input())) p = list(map(int, input().split())) q = list(map(int, input().split())) a, b = -1, -1 for i, x in enumerate(permutations([i + 1 for i in range(n)])): c, d = True, True for j in range(n): if x[j] != p[j]: c = False if x[j] != ...
false
18.75
[ "-P = tuple(map(int, input().split()))", "-Q = tuple(map(int, input().split()))", "-dict = {}", "-d = [i for i in range(1, n + 1)]", "-i = 1", "-for x in permutations(d, n):", "- dict[x] = i", "- i += 1", "-print((abs(dict[P] - dict[Q])))", "+p = list(map(int, input().split()))", "+q = lis...
false
0.047816
0.149506
0.319826
[ "s978984149", "s865488519" ]
u281610856
p02713
python
s212571335
s062091216
457
192
9,192
67,588
Accepted
Accepted
57.99
import math k = int(eval(input())) ans = 0 for a in range(1, k + 1): for b in range(a, k + 1): x = math.gcd(a, b) for c in range(b, k + 1): y = math.gcd(x, c) if a == b and b == c: ans += y elif a == b or b == c: ans += y...
import math ans = 0 k = int(eval(input())) for a in range(1, k + 1): for b in range(1, k + 1): x = math.gcd(a, b) for c in range(1, k + 1): y = math.gcd(x, c) ans += y print(ans)
15
10
379
226
import math k = int(eval(input())) ans = 0 for a in range(1, k + 1): for b in range(a, k + 1): x = math.gcd(a, b) for c in range(b, k + 1): y = math.gcd(x, c) if a == b and b == c: ans += y elif a == b or b == c: ans += y * 3 ...
import math ans = 0 k = int(eval(input())) for a in range(1, k + 1): for b in range(1, k + 1): x = math.gcd(a, b) for c in range(1, k + 1): y = math.gcd(x, c) ans += y print(ans)
false
33.333333
[ "+ans = 0", "-ans = 0", "- for b in range(a, k + 1):", "+ for b in range(1, k + 1):", "- for c in range(b, k + 1):", "+ for c in range(1, k + 1):", "- if a == b and b == c:", "- ans += y", "- elif a == b or b == c:", "- ans +=...
false
0.073659
0.044159
1.668034
[ "s212571335", "s062091216" ]
u347600233
p02802
python
s121539736
s425731544
337
289
20,272
25,620
Accepted
Accepted
14.24
n, m = list(map(int, input().split())) submission = [] for i in range(n): submission.append([]) for i in range(m): pi, si = input().split() submission[int(pi) - 1].append(si) n_ac = 0 n_penalty = 0 for i in range(n): if "AC" in submission[i]: n_ac += 1 ac_index = su...
n, m = map(int, input().split()) s = [[] for i in range(n)] for i in range(m): p, S = input().split() s[int(p) - 1] += [S] print(sum('AC' in si for si in s), end=' ') print(sum(si[:si.index('AC')].count('WA') if 'AC' in si else 0 for si in s))
18
7
392
257
n, m = list(map(int, input().split())) submission = [] for i in range(n): submission.append([]) for i in range(m): pi, si = input().split() submission[int(pi) - 1].append(si) n_ac = 0 n_penalty = 0 for i in range(n): if "AC" in submission[i]: n_ac += 1 ac_index = submission[i].index("AC"...
n, m = map(int, input().split()) s = [[] for i in range(n)] for i in range(m): p, S = input().split() s[int(p) - 1] += [S] print(sum("AC" in si for si in s), end=" ") print(sum(si[: si.index("AC")].count("WA") if "AC" in si else 0 for si in s))
false
61.111111
[ "-n, m = list(map(int, input().split()))", "-submission = []", "-for i in range(n):", "- submission.append([])", "+n, m = map(int, input().split())", "+s = [[] for i in range(n)]", "- pi, si = input().split()", "- submission[int(pi) - 1].append(si)", "-n_ac = 0", "-n_penalty = 0", "-for...
false
0.052655
0.052091
1.010828
[ "s121539736", "s425731544" ]
u047023156
p02744
python
s401635872
s573136728
228
124
15,564
14,172
Accepted
Accepted
45.61
import sys import copy input = sys.stdin.readline N = int(eval(input())) if N == 1: print('a') exit() if N == 2: print('aa') print('ab') exit() ans = ['aaa', 'aab', 'aba', 'abb', 'abc'] alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] length = 3 while length < N: ...
import sys import string input = sys.stdin.readline N = int(eval(input())) ans = ['a'] alph = list(string.ascii_lowercase[:10]) l = 1 while l < N: ans2 = [] for value in ans: for letter in alph: ans2.append(value + letter) if letter not in value: ...
30
22
571
400
import sys import copy input = sys.stdin.readline N = int(eval(input())) if N == 1: print("a") exit() if N == 2: print("aa") print("ab") exit() ans = ["aaa", "aab", "aba", "abb", "abc"] alph = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] length = 3 while length < N: ans2 = [] for valu...
import sys import string input = sys.stdin.readline N = int(eval(input())) ans = ["a"] alph = list(string.ascii_lowercase[:10]) l = 1 while l < N: ans2 = [] for value in ans: for letter in alph: ans2.append(value + letter) if letter not in value: break l += 1...
false
26.666667
[ "-import copy", "+import string", "-if N == 1:", "- print(\"a\")", "- exit()", "-if N == 2:", "- print(\"aa\")", "- print(\"ab\")", "- exit()", "-ans = [\"aaa\", \"aab\", \"aba\", \"abb\", \"abc\"]", "-alph = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\"]",...
false
0.059028
0.062734
0.940921
[ "s401635872", "s573136728" ]
u879870653
p03212
python
s822436073
s958497972
1,189
81
4,184
3,064
Accepted
Accepted
93.19
from bisect import bisect def convert(number) : if number == 0 : out = "0" else : out = "" while number > 0 : surplus = (number % 4) out = str(surplus) + out number //= 4 return out def seven_five_three(string) : string = string.replace("3","7...
from itertools import product element = [3,5,7] N = int(eval(input())) ans = 0 for i in range(3, len(str(N)) + 1) : L = product(element, repeat=i) for candidate in L : if ((3 not in candidate) or (5 not in candidate) or (7 not in candidate)) : continue l = int("".join(list...
29
14
641
391
from bisect import bisect def convert(number): if number == 0: out = "0" else: out = "" while number > 0: surplus = number % 4 out = str(surplus) + out number //= 4 return out def seven_five_three(string): string = string.replace("3", "7").replace("2", "5"...
from itertools import product element = [3, 5, 7] N = int(eval(input())) ans = 0 for i in range(3, len(str(N)) + 1): L = product(element, repeat=i) for candidate in L: if (3 not in candidate) or (5 not in candidate) or (7 not in candidate): continue l = int("".join(list(map(str, can...
false
51.724138
[ "-from bisect import bisect", "+from itertools import product", "-", "-def convert(number):", "- if number == 0:", "- out = \"0\"", "- else:", "- out = \"\"", "- while number > 0:", "- surplus = number % 4", "- out = str(surplus) + out", "- number //...
false
2.410712
0.049506
48.695479
[ "s822436073", "s958497972" ]
u858136677
p03575
python
s821923483
s763082403
22
20
3,444
3,444
Accepted
Accepted
9.09
n,m = list(map(int,input().split())) branch = dict() a = [] b = [] for i in range(n+1): branch[i] = [] for i in range(m): atemp,btemp = list(map(int,input().split())) a.append(atemp) b.append(btemp) branch[atemp].append(btemp) branch[btemp].append(atemp) counter = 0 for i in range(m): check = Tru...
def bfs(branch,n): arrival = [0 for i in range(n+1)] q = [1] arrival[q[0]]=1 while len(q) >= 1: for k in range(len(branch[q[0]])): if arrival[branch[q[0]][k]] == 0: arrival[branch[q[0]][k]] = arrival[q[0]] + 1 q.append(branch[q[0]][k]) q.pop(0) return arrival n,m = list(map(int,input()....
37
37
827
918
n, m = list(map(int, input().split())) branch = dict() a = [] b = [] for i in range(n + 1): branch[i] = [] for i in range(m): atemp, btemp = list(map(int, input().split())) a.append(atemp) b.append(btemp) branch[atemp].append(btemp) branch[btemp].append(atemp) counter = 0 for i in range(m): ...
def bfs(branch, n): arrival = [0 for i in range(n + 1)] q = [1] arrival[q[0]] = 1 while len(q) >= 1: for k in range(len(branch[q[0]])): if arrival[branch[q[0]][k]] == 0: arrival[branch[q[0]][k]] = arrival[q[0]] + 1 q.append(branch[q[0]][k]) q.p...
false
0
[ "+def bfs(branch, n):", "+ arrival = [0 for i in range(n + 1)]", "+ q = [1]", "+ arrival[q[0]] = 1", "+ while len(q) >= 1:", "+ for k in range(len(branch[q[0]])):", "+ if arrival[branch[q[0]][k]] == 0:", "+ arrival[branch[q[0]][k]] = arrival[q[0]] + 1", "...
false
0.150047
0.047816
3.138031
[ "s821923483", "s763082403" ]
u564589929
p02713
python
s463456622
s458827401
958
761
9,216
9,224
Accepted
Accepted
20.56
# import sys # sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LLI(rows_number): return [LI() for _ in range(...
import sys sys.setrecursionlimit(10 ** 6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1(): retur...
27
30
637
736
# import sys # sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LLI(rows_number): return [L...
import sys sys.setrecursionlimit(10**6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def...
false
10
[ "-# import sys", "-# sys.setrecursionlimit(10 ** 6)", "+import sys", "+", "+sys.setrecursionlimit(10**6)", "+# input = sys.stdin.readline ####", "+def LI1():", "+ return list(map(int1, input().split()))", "+", "+", "-import math", "+INF = float(\"inf\")", "+# from fractions import gcd"...
false
0.129792
0.115429
1.124431
[ "s463456622", "s458827401" ]
u168578024
p03061
python
s876146213
s101063526
1,204
1,062
107,040
104,992
Accepted
Accepted
11.79
import copy class SegmentTree: def __init__(self, N, func, I): self.sz = N self.func = func self.I = copy.deepcopy(I) self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)] def assign(self, k, x): self.seg[k + self.sz] = copy.deepcopy(x) def build(se...
import copy class SegmentTree: def __init__(self, N, func, I): self.sz = N self.func = func self.I = copy.deepcopy(I) self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)] def assign(self, k, x): self.seg[k + self.sz] = copy.deepcopy(x) def build(se...
52
55
1,448
1,527
import copy class SegmentTree: def __init__(self, N, func, I): self.sz = N self.func = func self.I = copy.deepcopy(I) self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)] def assign(self, k, x): self.seg[k + self.sz] = copy.deepcopy(x) def build(self): ...
import copy class SegmentTree: def __init__(self, N, func, I): self.sz = N self.func = func self.I = copy.deepcopy(I) self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)] def assign(self, k, x): self.seg[k + self.sz] = copy.deepcopy(x) def build(self): ...
false
5.454545
[ "-import sys", "+def main():", "+ import sys", "-read = sys.stdin.buffer.read", "-readline = sys.stdin.buffer.readline", "-from fractions import gcd", "+ read = sys.stdin.buffer.read", "+ readline = sys.stdin.buffer.readline", "+ from fractions import gcd", "-N = int(readline())", "-...
false
0.112645
0.093821
1.200637
[ "s876146213", "s101063526" ]
u691018832
p02688
python
s602079614
s651077945
58
23
67,512
9,108
Accepted
Accepted
60.34
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n, k = list(map(int, readline().split())) aa = [] for i in range(k): d = int(readline()) aa += list(map(int, readline().split())) aa = set(list(aa)) cnt...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n, k = list(map(int, readline().split())) aa = [] for i in range(k): readline() aa += list(map(int, readline().split())) cnt = 0 for i in range(1, n + 1...
17
16
397
368
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n, k = list(map(int, readline().split())) aa = [] for i in range(k): d = int(readline()) aa += list(map(int, readline().split())) aa = set(list(aa)) cnt = 0 for i in ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n, k = list(map(int, readline().split())) aa = [] for i in range(k): readline() aa += list(map(int, readline().split())) cnt = 0 for i in range(1, n + 1): if i no...
false
5.882353
[ "- d = int(readline())", "+ readline()", "-aa = set(list(aa))" ]
false
0.036565
0.036283
1.007792
[ "s602079614", "s651077945" ]
u698919163
p02657
python
s402399445
s147639840
23
21
9,156
8,976
Accepted
Accepted
8.7
A,B = list(map(int,input().split())) print((A*B))
A,B = list(map(float,input().split())) tmp = A*B*100 print((int(tmp/100)))
2
4
42
71
A, B = list(map(int, input().split())) print((A * B))
A, B = list(map(float, input().split())) tmp = A * B * 100 print((int(tmp / 100)))
false
50
[ "-A, B = list(map(int, input().split()))", "-print((A * B))", "+A, B = list(map(float, input().split()))", "+tmp = A * B * 100", "+print((int(tmp / 100)))" ]
false
0.03773
0.063463
0.594517
[ "s402399445", "s147639840" ]
u227020436
p02695
python
s383648748
s271656822
1,088
545
9,220
9,052
Accepted
Accepted
49.91
# C - Many Requirements n, m, q = list(map(int, input().split())) lst = [] for i in range(q): a, b, c, d = list(map(int, input().split())) lst.append((a, b, c, d)) # ๅพ—็‚นใ‚’ๅ…ˆ้ ญใซ def allseq(n, m): if n == 0: yield [] else: for rest in allseq(n - 1, m): for i in rang...
# C - Many Requirements from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) lst = [] for i in range(q): a, b, c, d = list(map(int, input().split())) lst.append((a, b, c, d)) x = max(sum(d for a, b, c, d in lst if seq[b-1] - seq[a-1] == c) for seq i...
25
13
547
369
# C - Many Requirements n, m, q = list(map(int, input().split())) lst = [] for i in range(q): a, b, c, d = list(map(int, input().split())) lst.append((a, b, c, d)) # ๅพ—็‚นใ‚’ๅ…ˆ้ ญใซ def allseq(n, m): if n == 0: yield [] else: for rest in allseq(n - 1, m): for i in range(rest[-1] if...
# C - Many Requirements from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) lst = [] for i in range(q): a, b, c, d = list(map(int, input().split())) lst.append((a, b, c, d)) x = max( sum(d for a, b, c, d in lst if seq[b - 1] - seq[a - 1] == c) for seq in combin...
false
48
[ "+from itertools import combinations_with_replacement", "+", "- lst.append((a, b, c, d)) # ๅพ—็‚นใ‚’ๅ…ˆ้ ญใซ", "-", "-", "-def allseq(n, m):", "- if n == 0:", "- yield []", "- else:", "- for rest in allseq(n - 1, m):", "- for i in range(rest[-1] if len(rest) > 0 else 1, m...
false
0.124493
0.092238
1.349695
[ "s383648748", "s271656822" ]
u106489129
p02724
python
s107332956
s116060327
477
425
2,940
2,940
Accepted
Accepted
10.9
money=int(eval(input())) happines=0 while money>=500: happines+=1000 money-=500 while money>=5: happines+=5 money-=5 print(happines)
money=int(eval(input())) happines=0 while money>=500: happines+=1000 money-=500 while money>=100: happines+=100 money-=100 while money>=5: happines+=5 money-=5 print(happines)
9
12
142
192
money = int(eval(input())) happines = 0 while money >= 500: happines += 1000 money -= 500 while money >= 5: happines += 5 money -= 5 print(happines)
money = int(eval(input())) happines = 0 while money >= 500: happines += 1000 money -= 500 while money >= 100: happines += 100 money -= 100 while money >= 5: happines += 5 money -= 5 print(happines)
false
25
[ "+while money >= 100:", "+ happines += 100", "+ money -= 100" ]
false
0.12191
0.121579
1.002726
[ "s107332956", "s116060327" ]
u450956662
p03044
python
s727957785
s289975840
698
503
84,440
76,464
Accepted
Accepted
27.94
import sys sys.setrecursionlimit(10 ** 6) def dfs(v): check[v] = True for u, w in T[v]: if check[u]: continue dist[u] = dist[v] + w dfs(u) N = int(input()) T = [[] for _ in range(N+1)] for _ in range(N-1): u, v, w = map(int, input().split()) T[u].appe...
import sys sys.setrecursionlimit(10 ** 6) input = sys.stdin.readline def dfs(d, v, p): if (d & 1): C[v] = 1 for w, u in E[v]: if u == p: continue dfs(d ^ w, u, v) N = int(input()) C = [0] * N E = [[] for _ in range(N)] for i in range(N-1): u, v, w = map(...
23
23
461
459
import sys sys.setrecursionlimit(10**6) def dfs(v): check[v] = True for u, w in T[v]: if check[u]: continue dist[u] = dist[v] + w dfs(u) N = int(input()) T = [[] for _ in range(N + 1)] for _ in range(N - 1): u, v, w = map(int, input().split()) T[u].append((v, w))...
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline def dfs(d, v, p): if d & 1: C[v] = 1 for w, u in E[v]: if u == p: continue dfs(d ^ w, u, v) N = int(input()) C = [0] * N E = [[] for _ in range(N)] for i in range(N - 1): u, v, w = map(int, input().sp...
false
0
[ "+input = sys.stdin.readline", "-def dfs(v):", "- check[v] = True", "- for u, w in T[v]:", "- if check[u]:", "+def dfs(d, v, p):", "+ if d & 1:", "+ C[v] = 1", "+ for w, u in E[v]:", "+ if u == p:", "- dist[u] = dist[v] + w", "- dfs(u)", "+ ...
false
0.042172
0.008092
5.211242
[ "s727957785", "s289975840" ]
u693953100
p03420
python
s299001390
s317962003
77
62
2,940
3,060
Accepted
Accepted
19.48
n,k = list(map(int,input().split())) ans =0 if k==0: print((n**2)) exit() for i in range(k+1,n+1): ans+=(n//i)*(i-k) + max(0,n%i-k+1) print(ans)
def solve(): n,k = list(map(int,input().split())) res = 0 for i in range(k+1,n+1): res+=(i-k)*(n//i) if n%i>=k: if k==0: res+=n%i else: res+=n%i-k+1 print(res) if __name__=='__main__': solve()
8
13
155
290
n, k = list(map(int, input().split())) ans = 0 if k == 0: print((n**2)) exit() for i in range(k + 1, n + 1): ans += (n // i) * (i - k) + max(0, n % i - k + 1) print(ans)
def solve(): n, k = list(map(int, input().split())) res = 0 for i in range(k + 1, n + 1): res += (i - k) * (n // i) if n % i >= k: if k == 0: res += n % i else: res += n % i - k + 1 print(res) if __name__ == "__main__": solve(...
false
38.461538
[ "-n, k = list(map(int, input().split()))", "-ans = 0", "-if k == 0:", "- print((n**2))", "- exit()", "-for i in range(k + 1, n + 1):", "- ans += (n // i) * (i - k) + max(0, n % i - k + 1)", "-print(ans)", "+def solve():", "+ n, k = list(map(int, input().split()))", "+ res = 0", ...
false
0.047469
0.135891
0.349319
[ "s299001390", "s317962003" ]
u072053884
p00484
python
s809311586
s564540026
400
310
5,652
5,724
Accepted
Accepted
22.5
import sys def solve(): file_input = sys.stdin N, K = list(map(int, file_input.readline().split())) G = [[] for i in range(10)] for line in file_input: c, g = list(map(int, line.split())) G[g - 1].append(c) for genre in G: genre.sort(reverse=True) ...
import sys def solve(): file_input = sys.stdin N, K = list(map(int, file_input.readline().split())) G = [[] for i in range(10)] for line in file_input: c, g = list(map(int, line.split())) G[g - 1].append(c) for genre in G: genre.sort(reverse=True) ...
28
28
748
765
import sys def solve(): file_input = sys.stdin N, K = list(map(int, file_input.readline().split())) G = [[] for i in range(10)] for line in file_input: c, g = list(map(int, line.split())) G[g - 1].append(c) for genre in G: genre.sort(reverse=True) for p, i in zip(ge...
import sys def solve(): file_input = sys.stdin N, K = list(map(int, file_input.readline().split())) G = [[] for i in range(10)] for line in file_input: c, g = list(map(int, line.split())) G[g - 1].append(c) for genre in G: genre.sort(reverse=True) for i, p in zip(li...
false
0
[ "- for p, i in zip(genre, list(range(1, len(genre)))):", "+ for i, p in zip(list(range(1, len(genre))), genre):", "- for n, p in enumerate(genre, start=1):", "+ for n, p in zip(list(range(len(genre), 0, -1)), genre[::-1]):" ]
false
0.067425
0.049208
1.370206
[ "s809311586", "s564540026" ]
u645250356
p02912
python
s900579191
s349246852
802
311
96,148
96,536
Accepted
Accepted
61.22
from collections import Counter,defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin.readline().split()) de...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
26
23
714
569
from collections import Counter, defaultdict, deque import sys, heapq, bisect, math, itertools, string, queue sys.setrecursionlimit(10**8) mod = 10**9 + 7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin....
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): ...
false
11.538462
[ "-import sys, heapq, bisect, math, itertools, string, queue", "+from heapq import heappop, heappush, heapify", "+from bisect import bisect_left, bisect_right", "+import sys, math, itertools, fractions, pprint", "+INF = float(\"inf\")", "-def inpl_str():", "- return list(sys.stdin.readline().split())"...
false
0.0698
0.049657
1.405634
[ "s900579191", "s349246852" ]
u623814058
p04031
python
s911055242
s064976781
37
31
9,152
9,120
Accepted
Accepted
16.22
N=int(eval(input())) *A,=list(map(int,input().split())) mx=max(A) mn=min(A) ans=float('inf') for i in range(mn,mx+1): ans=min(ans, sum([(k-i)**2 for k in A])) print(ans)
N=eval(input()) *A,=list(map(int,input().split())) a=float('inf') for i in range(min(A),max(A)+1):a=min(a, sum([(k-i)**2 for k in A])) print(a)
10
6
172
137
N = int(eval(input())) (*A,) = list(map(int, input().split())) mx = max(A) mn = min(A) ans = float("inf") for i in range(mn, mx + 1): ans = min(ans, sum([(k - i) ** 2 for k in A])) print(ans)
N = eval(input()) (*A,) = list(map(int, input().split())) a = float("inf") for i in range(min(A), max(A) + 1): a = min(a, sum([(k - i) ** 2 for k in A])) print(a)
false
40
[ "-N = int(eval(input()))", "+N = eval(input())", "-mx = max(A)", "-mn = min(A)", "-ans = float(\"inf\")", "-for i in range(mn, mx + 1):", "- ans = min(ans, sum([(k - i) ** 2 for k in A]))", "-print(ans)", "+a = float(\"inf\")", "+for i in range(min(A), max(A) + 1):", "+ a = min(a, sum([(k ...
false
0.104083
0.044268
2.351213
[ "s911055242", "s064976781" ]
u198440493
p03108
python
s456620229
s427269445
527
432
52,576
41,040
Accepted
Accepted
18.03
import sys sys.setrecursionlimit(100000) input = sys.stdin.readline n,m=list(map(int,input().split())) z=n*(n-1)//2 l=[-1]*n a=[1]*n b=[input().split() for _ in range(m)] c=[0]*m+[z] d=[i for i in range(n)] def r(s): t=l[s] if t<0: return s else: l[s]=r(t) return l[s] def f(s): ret...
import sys sys.setrecursionlimit(100000) input = sys.stdin.readline n,m=list(map(int,input().split())) z=n*(n-1)//2 l=[-1]*n a=[1]*n b=[input().split() for _ in range(m)] c=[0]*m+[z] def r(s): t=l[s] if t<0: return s else: l[s]=r(t) return l[s] def f(s): return r(int(s)-1) for i in...
29
32
488
515
import sys sys.setrecursionlimit(100000) input = sys.stdin.readline n, m = list(map(int, input().split())) z = n * (n - 1) // 2 l = [-1] * n a = [1] * n b = [input().split() for _ in range(m)] c = [0] * m + [z] d = [i for i in range(n)] def r(s): t = l[s] if t < 0: return s else: l[s] = r...
import sys sys.setrecursionlimit(100000) input = sys.stdin.readline n, m = list(map(int, input().split())) z = n * (n - 1) // 2 l = [-1] * n a = [1] * n b = [input().split() for _ in range(m)] c = [0] * m + [z] def r(s): t = l[s] if t < 0: return s else: l[s] = r(t) return l[s] ...
false
9.375
[ "-d = [i for i in range(n)]", "- l[x] = y", "- d[y] = d[x]", "- z -= a[x] * a[y]", "- a[y] += a[x]", "+ s, t = a[x], a[y]", "+ z -= s * t", "+ if s < t:", "+ l[x] = y", "+ a[y] += s", "+ else:", "+ l[y] = ...
false
0.034302
0.032544
1.054003
[ "s456620229", "s427269445" ]
u863370423
p03575
python
s113041823
s073373498
31
19
3,064
3,064
Accepted
Accepted
38.71
N, M = [int(a) for a in input().split()] adj = [[False] * N for _ in range(N)] edgelist = [] for i in range(M): a, b = [int(a) for a in input().split()] a-=1 b-=1 adj[a][b] = True adj[b][a] = True edgelist.append((a,b)) bridges = 0 for a,b in edgelist: adj[a][b] = False ad...
def f(a, b, nodes, visited): if (a in visited): return False if (a == b): return True visited.append(a) for e in nodes[a]: if (f(e, b, nodes, visited)): return True return False def main(): n, m = [int(x) for x in input().split(' ')] nodes ...
31
39
656
935
N, M = [int(a) for a in input().split()] adj = [[False] * N for _ in range(N)] edgelist = [] for i in range(M): a, b = [int(a) for a in input().split()] a -= 1 b -= 1 adj[a][b] = True adj[b][a] = True edgelist.append((a, b)) bridges = 0 for a, b in edgelist: adj[a][b] = False adj[b][a] =...
def f(a, b, nodes, visited): if a in visited: return False if a == b: return True visited.append(a) for e in nodes[a]: if f(e, b, nodes, visited): return True return False def main(): n, m = [int(x) for x in input().split(" ")] nodes = {} edges = [] ...
false
20.512821
[ "-N, M = [int(a) for a in input().split()]", "-adj = [[False] * N for _ in range(N)]", "-edgelist = []", "-for i in range(M):", "- a, b = [int(a) for a in input().split()]", "- a -= 1", "- b -= 1", "- adj[a][b] = True", "- adj[b][a] = True", "- edgelist.append((a, b))", "-bridg...
false
0.051881
0.116461
0.445483
[ "s113041823", "s073373498" ]
u580873239
p03073
python
s243385592
s493729828
81
70
5,512
3,188
Accepted
Accepted
13.58
s=list(eval(input())) s1=[] s2=[] for i in range(len(s)): if i%2==0: s1.append('0') s2.append('1') else: s1.append('1') s2.append('0') count1=0 count2=0 for i in range(len(s)): if s[i]!=s1[i]: count1+=1 if s[i]!=s2[i]: count2+=1 ...
s=eval(input()) count1=0 count2=0 for i,j in enumerate(s): if i%2==0: if j=='0': count1+=1 else: if j=='1': count1+=1 for i,j in enumerate(s): if i%2==0: if j=='1': count2+=1 else: if j=='0': count2+=1 ...
21
19
347
340
s = list(eval(input())) s1 = [] s2 = [] for i in range(len(s)): if i % 2 == 0: s1.append("0") s2.append("1") else: s1.append("1") s2.append("0") count1 = 0 count2 = 0 for i in range(len(s)): if s[i] != s1[i]: count1 += 1 if s[i] != s2[i]: count2 += 1 print...
s = eval(input()) count1 = 0 count2 = 0 for i, j in enumerate(s): if i % 2 == 0: if j == "0": count1 += 1 else: if j == "1": count1 += 1 for i, j in enumerate(s): if i % 2 == 0: if j == "1": count2 += 1 else: if j == "0": co...
false
9.52381
[ "-s = list(eval(input()))", "-s1 = []", "-s2 = []", "-for i in range(len(s)):", "- if i % 2 == 0:", "- s1.append(\"0\")", "- s2.append(\"1\")", "- else:", "- s1.append(\"1\")", "- s2.append(\"0\")", "+s = eval(input())", "-for i in range(len(s)):", "- if ...
false
0.043992
0.037772
1.164687
[ "s243385592", "s493729828" ]
u631277801
p03329
python
s302160847
s024605310
1,210
522
3,064
3,828
Accepted
Accepted
56.86
import math N = int(eval(input())) def Nsinpou(x, base): #้…ๅˆ—ใ‚’่ฟ”ใ™ Nsin[0]ใŒไธŠไฝๆก ex. 56(base=6) => [1,3,2] if x == 0: return [0] #log_n(0)ใฎๅ›ž้ฟ Nsin = [] for i in range((int(round(math.log(x,base))//1)+1)): ithdigit = x%(base**(i+1)) // (base ** i) Nsin.append(ithdigit) Nsin.rev...
MAX_N = 10**5 N = int(eval(input())) dp = [MAX_N]*(N+1) dp[0] = 0 dp[1] = 1 MONEY_LIST = [6**i for i in range(7)] MONEY_LIST.extend([9**i for i in range(1,6)]) MONEY_LIST.sort() for i in range(N+1): for m in MONEY_LIST: if m>i: break dp[i] = min(dp[i],dp[i-m...
20
20
503
342
import math N = int(eval(input())) def Nsinpou(x, base): # ้…ๅˆ—ใ‚’่ฟ”ใ™ Nsin[0]ใŒไธŠไฝๆก ex. 56(base=6) => [1,3,2] if x == 0: return [0] # log_n(0)ใฎๅ›ž้ฟ Nsin = [] for i in range((int(round(math.log(x, base)) // 1) + 1)): ithdigit = x % (base ** (i + 1)) // (base**i) Nsin.append(ithdigit) ...
MAX_N = 10**5 N = int(eval(input())) dp = [MAX_N] * (N + 1) dp[0] = 0 dp[1] = 1 MONEY_LIST = [6**i for i in range(7)] MONEY_LIST.extend([9**i for i in range(1, 6)]) MONEY_LIST.sort() for i in range(N + 1): for m in MONEY_LIST: if m > i: break dp[i] = min(dp[i], dp[i - m] + 1) print((dp[N...
false
0
[ "-import math", "-", "+MAX_N = 10**5", "-", "-", "-def Nsinpou(x, base):", "- # ้…ๅˆ—ใ‚’่ฟ”ใ™ Nsin[0]ใŒไธŠไฝๆก ex. 56(base=6) => [1,3,2]", "- if x == 0:", "- return [0] # log_n(0)ใฎๅ›ž้ฟ", "- Nsin = []", "- for i in range((int(round(math.log(x, base)) // 1) + 1)):", "- ithdigit = x %...
false
0.207959
0.269434
0.771838
[ "s302160847", "s024605310" ]
u835924161
p03107
python
s190526127
s901225673
34
18
3,188
3,188
Accepted
Accepted
47.06
s=eval(input()) ans=int(0) n=len(s) b=int(0) w=int(0) for i in range(n): if s[i]=='0': b+=1 else: w+=1 if b<w: print((2*b)) else: print((2*w))
s=str(eval(input())) n=len(s) b=s.count('0') A=[b,n-b] print((min(A)+min(A)))
15
5
179
73
s = eval(input()) ans = int(0) n = len(s) b = int(0) w = int(0) for i in range(n): if s[i] == "0": b += 1 else: w += 1 if b < w: print((2 * b)) else: print((2 * w))
s = str(eval(input())) n = len(s) b = s.count("0") A = [b, n - b] print((min(A) + min(A)))
false
66.666667
[ "-s = eval(input())", "-ans = int(0)", "+s = str(eval(input()))", "-b = int(0)", "-w = int(0)", "-for i in range(n):", "- if s[i] == \"0\":", "- b += 1", "- else:", "- w += 1", "-if b < w:", "- print((2 * b))", "-else:", "- print((2 * w))", "+b = s.count(\"0\")"...
false
0.036548
0.040784
0.896128
[ "s190526127", "s901225673" ]
u532966492
p03086
python
s308312850
s038743418
19
17
3,064
3,060
Accepted
Accepted
10.53
S = eval(input()) ls = list(S) ans = 0 for i in range(len(ls)): cnt = 0 for j in range(i,len(ls)): if S[j] in ['A','T','C','G']: cnt += 1 if j == len(ls) - 1: ans = max(ans,cnt) else: ans = max(ans,cnt) break print(ans)
S=eval(input()) cnt1=0 for i in range(len(S)): cnt2=0 for j in range(i,len(S)): if S[j] in ("A","C","G","T"): cnt2+=1 else: break cnt1=max(cnt1,cnt2) print(cnt1)
14
11
314
191
S = eval(input()) ls = list(S) ans = 0 for i in range(len(ls)): cnt = 0 for j in range(i, len(ls)): if S[j] in ["A", "T", "C", "G"]: cnt += 1 if j == len(ls) - 1: ans = max(ans, cnt) else: ans = max(ans, cnt) break print(ans)
S = eval(input()) cnt1 = 0 for i in range(len(S)): cnt2 = 0 for j in range(i, len(S)): if S[j] in ("A", "C", "G", "T"): cnt2 += 1 else: break cnt1 = max(cnt1, cnt2) print(cnt1)
false
21.428571
[ "-ls = list(S)", "-ans = 0", "-for i in range(len(ls)):", "- cnt = 0", "- for j in range(i, len(ls)):", "- if S[j] in [\"A\", \"T\", \"C\", \"G\"]:", "- cnt += 1", "- if j == len(ls) - 1:", "- ans = max(ans, cnt)", "+cnt1 = 0", "+for i in range(l...
false
0.039876
0.054558
0.730883
[ "s308312850", "s038743418" ]
u094999522
p02854
python
s638016289
s719783988
151
128
31,740
110,540
Accepted
Accepted
15.23
#!/usr/bin/env python3 n, *a = list(map(int, open(0).read().split())) s = sum(a) r = [a[0]] for i in range(1, n): r.append(r[i - 1] + a[i]) print((min(abs(2 * i - s) for i in r)))
#!/usr/bin/env python3 n, *a = list(map(int, open(0).read().split())) r = [a[0]] for i in range(1, n): r.append(r[i - 1] + a[i]) print((min(abs(2 * i - r[-1]) for i in r)))
7
6
182
174
#!/usr/bin/env python3 n, *a = list(map(int, open(0).read().split())) s = sum(a) r = [a[0]] for i in range(1, n): r.append(r[i - 1] + a[i]) print((min(abs(2 * i - s) for i in r)))
#!/usr/bin/env python3 n, *a = list(map(int, open(0).read().split())) r = [a[0]] for i in range(1, n): r.append(r[i - 1] + a[i]) print((min(abs(2 * i - r[-1]) for i in r)))
false
14.285714
[ "-s = sum(a)", "-print((min(abs(2 * i - s) for i in r)))", "+print((min(abs(2 * i - r[-1]) for i in r)))" ]
false
0.045502
0.044812
1.015395
[ "s638016289", "s719783988" ]
u119148115
p02612
python
s389894680
s820695615
87
73
61,768
61,732
Accepted
Accepted
16.09
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #็ฉบ็™ฝใ‚ใ‚Š def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #็ฉบ็™ฝใชใ— def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.st...
import sys def I(): return int(sys.stdin.readline().rstrip()) N = I() print((999-(N-1)%1000))
16
7
498
100
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # ็ฉบ็™ฝใ‚ใ‚Š def LI2(): return list(map(int, sys.stdin.readline().rstrip())) # ็ฉบ็™ฝใชใ— def S(): return sys.stdin.readline().rstrip() def L...
import sys def I(): return int(sys.stdin.readline().rstrip()) N = I() print((999 - (N - 1) % 1000))
false
56.25
[ "-", "-sys.setrecursionlimit(10**7)", "-def LI():", "- return list(map(int, sys.stdin.readline().rstrip().split())) # ็ฉบ็™ฝใ‚ใ‚Š", "-", "-", "-def LI2():", "- return list(map(int, sys.stdin.readline().rstrip())) # ็ฉบ็™ฝใชใ—", "-", "-", "-def S():", "- return sys.stdin.readline().rstrip()", "...
false
0.036529
0.036234
1.008123
[ "s389894680", "s820695615" ]
u471898432
p02923
python
s964551388
s778840439
130
57
14,252
14,528
Accepted
Accepted
56.15
def count_descending(nums, start): if start >= len(nums): return 0 count = 1 previous = nums[start] for i in range(start + 1, len(nums)): if previous < nums[i]: return count else: count += 1 previous = nums[i] return count ...
import itertools def count_chains(nums): it = iter(nums) try: previous = next(it) except StopIteration: return count = 1 for n in it: if previous < n: yield count count = 0 count += 1 previous = n yield count...
36
31
697
486
def count_descending(nums, start): if start >= len(nums): return 0 count = 1 previous = nums[start] for i in range(start + 1, len(nums)): if previous < nums[i]: return count else: count += 1 previous = nums[i] return count def max_move(nu...
import itertools def count_chains(nums): it = iter(nums) try: previous = next(it) except StopIteration: return count = 1 for n in it: if previous < n: yield count count = 0 count += 1 previous = n yield count def main(): n =...
false
13.888889
[ "-def count_descending(nums, start):", "- if start >= len(nums):", "- return 0", "- count = 1", "- previous = nums[start]", "- for i in range(start + 1, len(nums)):", "- if previous < nums[i]:", "- return count", "- else:", "- count += 1", "...
false
0.072778
0.082679
0.88024
[ "s964551388", "s778840439" ]
u873915460
p03700
python
s364228305
s031420202
330
215
57,948
80,748
Accepted
Accepted
34.85
import sys S=sys.stdin.readlines() N,A,B=list(map(int,S[0].split())) H=[int(S[i+1]) for i in range(N)] L,R=0,10**9 M=0 Z=0 A-=B while R>L: M=(L+R)//2 Z=0 for i in range(N): Z+=max((H[i]-B*M+A-1)//A,0) if Z>M: L=max(L+1,M) else: R=M print(R)
N,A,B=list(map(int,input().split())) H=[int(eval(input())) for i in range(N)] L,R,M=0,10**9,0 A-=B C=0 while L!=R: M=(L+R)//2 C=0 for i in range(N): C+=max(0,(H[i]-B*M+A-1)//A) if C>M: L=max(M,L+1) else: R=M print(L)
18
15
273
240
import sys S = sys.stdin.readlines() N, A, B = list(map(int, S[0].split())) H = [int(S[i + 1]) for i in range(N)] L, R = 0, 10**9 M = 0 Z = 0 A -= B while R > L: M = (L + R) // 2 Z = 0 for i in range(N): Z += max((H[i] - B * M + A - 1) // A, 0) if Z > M: L = max(L + 1, M) else: ...
N, A, B = list(map(int, input().split())) H = [int(eval(input())) for i in range(N)] L, R, M = 0, 10**9, 0 A -= B C = 0 while L != R: M = (L + R) // 2 C = 0 for i in range(N): C += max(0, (H[i] - B * M + A - 1) // A) if C > M: L = max(M, L + 1) else: R = M print(L)
false
16.666667
[ "-import sys", "-", "-S = sys.stdin.readlines()", "-N, A, B = list(map(int, S[0].split()))", "-H = [int(S[i + 1]) for i in range(N)]", "-L, R = 0, 10**9", "-M = 0", "-Z = 0", "+N, A, B = list(map(int, input().split()))", "+H = [int(eval(input())) for i in range(N)]", "+L, R, M = 0, 10**9, 0", ...
false
0.037459
0.095647
0.391636
[ "s364228305", "s031420202" ]
u102461423
p03216
python
s541001840
s590284737
1,568
1,034
59,984
60,472
Accepted
Accepted
34.06
import numpy as np I=input N = int(I()) S = np.fromiter('-'+I(),dtype='U1') Q = int(I()) query = list(map(int,I().split())) isD = S == 'D' isM = S == 'M' isC = S == 'C' cumD = isD.cumsum(dtype=np.int64) cumM = isM.cumsum(dtype=np.int64) for K in query: x = cumD.copy(); x[K:] -= cumD[:-K] x *=...
import numpy as np I=input N = int(I()) S = np.array(list('-'+I()),dtype='U1') Q = int(I()) query = list(map(int,I().split())) isD = S == 'D' isM = S == 'M' isC = S == 'C' cumD = isD.cumsum(dtype=np.int64) cumM = isM.cumsum(dtype=np.int64) for K in query: x = cumD.copy(); x[K:] -= cumD[:-K] x...
19
19
411
414
import numpy as np I = input N = int(I()) S = np.fromiter("-" + I(), dtype="U1") Q = int(I()) query = list(map(int, I().split())) isD = S == "D" isM = S == "M" isC = S == "C" cumD = isD.cumsum(dtype=np.int64) cumM = isM.cumsum(dtype=np.int64) for K in query: x = cumD.copy() x[K:] -= cumD[:-K] x *= isM ...
import numpy as np I = input N = int(I()) S = np.array(list("-" + I()), dtype="U1") Q = int(I()) query = list(map(int, I().split())) isD = S == "D" isM = S == "M" isC = S == "C" cumD = isD.cumsum(dtype=np.int64) cumM = isM.cumsum(dtype=np.int64) for K in query: x = cumD.copy() x[K:] -= cumD[:-K] x *= isM ...
false
0
[ "-S = np.fromiter(\"-\" + I(), dtype=\"U1\")", "+S = np.array(list(\"-\" + I()), dtype=\"U1\")" ]
false
0.294528
0.276123
1.066655
[ "s541001840", "s590284737" ]
u226108478
p03634
python
s694376930
s851969110
845
535
64,808
79,844
Accepted
Accepted
36.69
# -*- coding: utf-8 -*- def main(): from collections import defaultdict from collections import deque n = int(eval(input())) graph = [defaultdict(int) for _ in range(n)] visited = [False for _ in range(n)] dist = [float('inf') for _ in range(n)] for i in range(n - 1): ...
# -*- coding: utf-8 -*- def main(): from collections import defaultdict from collections import deque import sys n = int(eval(input())) graph = [defaultdict(int) for _ in range(n)] visited = [False for _ in range(n)] dist = [float('inf') for _ in range(n)] lines = sys.stdi...
49
51
1,043
1,105
# -*- coding: utf-8 -*- def main(): from collections import defaultdict from collections import deque n = int(eval(input())) graph = [defaultdict(int) for _ in range(n)] visited = [False for _ in range(n)] dist = [float("inf") for _ in range(n)] for i in range(n - 1): ai, bi, ci = l...
# -*- coding: utf-8 -*- def main(): from collections import defaultdict from collections import deque import sys n = int(eval(input())) graph = [defaultdict(int) for _ in range(n)] visited = [False for _ in range(n)] dist = [float("inf") for _ in range(n)] lines = sys.stdin.readlines() ...
false
3.921569
[ "+ import sys", "+ lines = sys.stdin.readlines()", "- ai, bi, ci = list(map(int, input().split()))", "+ ai, bi, ci = list(map(int, lines[i].split()))", "- q, k = list(map(int, input().split()))", "+ q, k = list(map(int, lines[n - 1].split()))", "- xi, yi = list(map(int, ...
false
0.048212
0.045948
1.049272
[ "s694376930", "s851969110" ]
u644778646
p03450
python
s293887958
s093077112
1,963
1,566
165,436
153,232
Accepted
Accepted
20.22
import sys sys.setrecursionlimit(100000000) def main(): N,M = list(map(int,input().split())) e = [[] for i in range(N)] t = 0 a = [] for i in range(M): r,l,d = list(map(int,input().split())) e[r-1].append([l-1,d]) e[l-1].append([r-1,-d]) a.append(r-1) ...
import sys sys.setrecursionlimit(100000000) def main(): N,M = list(map(int,input().split())) e = [[] for i in range(N)] t = 0 a = [] for i in range(M): r,l,d = list(map(int,input().split())) e[r-1].append((l-1,d)) e[l-1].append((r-1,-d)) a.append(r-1) ...
40
39
852
850
import sys sys.setrecursionlimit(100000000) def main(): N, M = list(map(int, input().split())) e = [[] for i in range(N)] t = 0 a = [] for i in range(M): r, l, d = list(map(int, input().split())) e[r - 1].append([l - 1, d]) e[l - 1].append([r - 1, -d]) a.append(r -...
import sys sys.setrecursionlimit(100000000) def main(): N, M = list(map(int, input().split())) e = [[] for i in range(N)] t = 0 a = [] for i in range(M): r, l, d = list(map(int, input().split())) e[r - 1].append((l - 1, d)) e[l - 1].append((r - 1, -d)) a.append(r -...
false
2.5
[ "- e[r - 1].append([l - 1, d])", "- e[l - 1].append([r - 1, -d])", "+ e[r - 1].append((l - 1, d))", "+ e[l - 1].append((r - 1, -d))" ]
false
0.048509
0.047051
1.030991
[ "s293887958", "s093077112" ]
u642883360
p03497
python
s055213786
s362949365
347
270
101,576
98,768
Accepted
Accepted
22.19
n, k = list(map(int, input().split())) A = list(map(int, input().split())) from collections import Counter C = Counter(A).most_common() dif = len(C) - k if dif <= 0: print((0)) else: s = 0 for i in range(dif): s += C[-(i + 1)][1] print(s)
n, k = list(map(int, input().split())) A = list(map(int, input().split())) from collections import Counter C = Counter(A) dif = len(C) - k if dif <= 0: print((0)) else: print((sum(sorted(C.values())[:dif])))
12
9
247
207
n, k = list(map(int, input().split())) A = list(map(int, input().split())) from collections import Counter C = Counter(A).most_common() dif = len(C) - k if dif <= 0: print((0)) else: s = 0 for i in range(dif): s += C[-(i + 1)][1] print(s)
n, k = list(map(int, input().split())) A = list(map(int, input().split())) from collections import Counter C = Counter(A) dif = len(C) - k if dif <= 0: print((0)) else: print((sum(sorted(C.values())[:dif])))
false
25
[ "-C = Counter(A).most_common()", "+C = Counter(A)", "- s = 0", "- for i in range(dif):", "- s += C[-(i + 1)][1]", "- print(s)", "+ print((sum(sorted(C.values())[:dif])))" ]
false
0.080531
0.066398
1.212849
[ "s055213786", "s362949365" ]
u596276291
p03805
python
s139848347
s145147215
132
32
3,444
3,316
Accepted
Accepted
75.76
from collections import defaultdict from itertools import permutations def main(): N, M = list(map(int, input().split())) g = defaultdict(list) for _ in range(M): a, b = list(map(int, input().split())) g[a].append(b) g[b].append(a) ans = 0 for route in permutati...
from collections import defaultdict from itertools import permutations def main(): N, M = list(map(int, input().split())) graph = defaultdict(list) for _ in range(M): a, b = list(map(int, input().split())) graph[a].append(b) graph[b].append(a) ans = 0 for rout...
28
28
599
607
from collections import defaultdict from itertools import permutations def main(): N, M = list(map(int, input().split())) g = defaultdict(list) for _ in range(M): a, b = list(map(int, input().split())) g[a].append(b) g[b].append(a) ans = 0 for route in permutations(list(ran...
from collections import defaultdict from itertools import permutations def main(): N, M = list(map(int, input().split())) graph = defaultdict(list) for _ in range(M): a, b = list(map(int, input().split())) graph[a].append(b) graph[b].append(a) ans = 0 for route in permutati...
false
0
[ "- g = defaultdict(list)", "+ graph = defaultdict(list)", "- g[a].append(b)", "- g[b].append(a)", "+ graph[a].append(b)", "+ graph[b].append(a)", "- for r in route:", "- if r in g[now]:", "- now = r", "+ for node in route:",...
false
0.073448
0.072475
1.013422
[ "s139848347", "s145147215" ]
u972591645
p02570
python
s413809989
s757896903
32
28
9,048
9,144
Accepted
Accepted
12.5
d, t, s = list(map(int, input().split())) print(('Yes' if d <= t*s else 'No'))
d, t, s = list(map(int, input().split())) print(('No' if d > t*s else 'Yes'))
2
2
71
70
d, t, s = list(map(int, input().split())) print(("Yes" if d <= t * s else "No"))
d, t, s = list(map(int, input().split())) print(("No" if d > t * s else "Yes"))
false
0
[ "-print((\"Yes\" if d <= t * s else \"No\"))", "+print((\"No\" if d > t * s else \"Yes\"))" ]
false
0.036303
0.036986
0.981518
[ "s413809989", "s757896903" ]
u124498235
p03993
python
s621752017
s841324148
79
66
14,008
14,008
Accepted
Accepted
16.46
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 chk = [False for i in range(n)] for i in range(n): if chk[i]: continue chk[i] = True if i+1 == a[a[i]-1]: chk[a[i]-1] = True cnt += 1 print (cnt)
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for i in range(n): if i+1 == a[a[i]-1]: cnt += 1 print((cnt//2))
13
8
228
135
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 chk = [False for i in range(n)] for i in range(n): if chk[i]: continue chk[i] = True if i + 1 == a[a[i] - 1]: chk[a[i] - 1] = True cnt += 1 print(cnt)
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for i in range(n): if i + 1 == a[a[i] - 1]: cnt += 1 print((cnt // 2))
false
38.461538
[ "-chk = [False for i in range(n)]", "- if chk[i]:", "- continue", "- chk[i] = True", "- chk[a[i] - 1] = True", "-print(cnt)", "+print((cnt // 2))" ]
false
0.082035
0.0424
1.934814
[ "s621752017", "s841324148" ]
u159994501
p03107
python
s535213290
s258119206
22
17
3,956
3,188
Accepted
Accepted
22.73
A = list(eval(input())) #print(A.count("1")) print((2 * min((A.count("1"),A.count("0")))))
S = eval(input()) n = S.count("0") print((min(n, len(S) - n) * 2))
3
3
85
61
A = list(eval(input())) # print(A.count("1")) print((2 * min((A.count("1"), A.count("0")))))
S = eval(input()) n = S.count("0") print((min(n, len(S) - n) * 2))
false
0
[ "-A = list(eval(input()))", "-# print(A.count(\"1\"))", "-print((2 * min((A.count(\"1\"), A.count(\"0\")))))", "+S = eval(input())", "+n = S.count(\"0\")", "+print((min(n, len(S) - n) * 2))" ]
false
0.116052
0.106179
1.09299
[ "s535213290", "s258119206" ]
u896741788
p02720
python
s426109235
s457399539
1,219
603
13,040
54,612
Accepted
Accepted
50.53
n=int(eval(input())) import queue q=queue.Queue() for i in range(1,10): q.put(i) while n!=1: x=q.get();k=x%10 for j in [10*x+i for i in range(max(0,k-1),min(10,k+2))] : q.put(j) n-=1 print((q.get()))
n=int(eval(input())) import queue q=queue.Queue() for i in range(1,10): q.put(i) while n!=1: x=q.get();k=x%10 for i in range(max(0,k-1),min(10,k+2)) : q.put(10*x+i) n-=1 print((q.get()))
11
11
225
212
n = int(eval(input())) import queue q = queue.Queue() for i in range(1, 10): q.put(i) while n != 1: x = q.get() k = x % 10 for j in [10 * x + i for i in range(max(0, k - 1), min(10, k + 2))]: q.put(j) n -= 1 print((q.get()))
n = int(eval(input())) import queue q = queue.Queue() for i in range(1, 10): q.put(i) while n != 1: x = q.get() k = x % 10 for i in range(max(0, k - 1), min(10, k + 2)): q.put(10 * x + i) n -= 1 print((q.get()))
false
0
[ "- for j in [10 * x + i for i in range(max(0, k - 1), min(10, k + 2))]:", "- q.put(j)", "+ for i in range(max(0, k - 1), min(10, k + 2)):", "+ q.put(10 * x + i)" ]
false
0.21623
0.415678
0.520186
[ "s426109235", "s457399539" ]
u086566114
p02264
python
s077132886
s172241776
600
540
26,484
26,340
Accepted
Accepted
10
import time as ti class MyQueue(object): """ My Queue class Attributes: queue: queue head tail """ def __init__(self): """Constructor """ self.length = 50010 self.queue = [0] * self.length # counter = 0 # ...
import time as ti class MyQueue(object): """ My Queue class Attributes: queue: queue head tail """ def __init__(self): """Constructor """ self.length = 50010 self.queue = [0] * self.length # counter = 0 # ...
136
136
3,127
3,131
import time as ti class MyQueue(object): """ My Queue class Attributes: queue: queue head tail """ def __init__(self): """Constructor """ self.length = 50010 self.queue = [0] * self.length # counter = 0 # while counter < self.le...
import time as ti class MyQueue(object): """ My Queue class Attributes: queue: queue head tail """ def __init__(self): """Constructor""" self.length = 50010 self.queue = [0] * self.length # counter = 0 # while counter < self.length: ...
false
0
[ "+", "+", "+", "- \"\"\"Constructor", "- \"\"\"", "+ \"\"\"Constructor\"\"\"", "+", "+", "+", "+", "+", "+", "- \"\"\"process class", "- \"\"\"", "+ \"\"\"process class\"\"\"", "+", "+", "-def time_forward(my_queue, interval, current_time,):", "+", ...
false
0.039986
0.043861
0.911634
[ "s077132886", "s172241776" ]
u971124021
p03545
python
s364092847
s955161912
19
17
3,188
3,060
Accepted
Accepted
10.53
import itertools, re abcd = eval(input()) abcd = [int(x) for x in abcd] p = list(itertools.product([1,-1], repeat=3)) f = abcd[0] fs = str(abcd[0]) for i in range(len(p)): for j in range(3): f += abcd[j+1]*p[i][j] if p[i][j] <0: fs += '-' + str(abcd[j+1]) else: fs += '+' + str(...
abcd = eval(input()) def dfs(i, f, sum): if i == 3: if sum ==7: print((f + '=7')) exit() else: dfs(i+1, f + '+' + abcd[i+1], sum + int(abcd[i+1])) dfs(i+1, f + '-' + abcd[i+1], sum - int(abcd[i+1])) dfs(0, abcd[0], int(abcd[0]))
21
15
422
271
import itertools, re abcd = eval(input()) abcd = [int(x) for x in abcd] p = list(itertools.product([1, -1], repeat=3)) f = abcd[0] fs = str(abcd[0]) for i in range(len(p)): for j in range(3): f += abcd[j + 1] * p[i][j] if p[i][j] < 0: fs += "-" + str(abcd[j + 1]) else: ...
abcd = eval(input()) def dfs(i, f, sum): if i == 3: if sum == 7: print((f + "=7")) exit() else: dfs(i + 1, f + "+" + abcd[i + 1], sum + int(abcd[i + 1])) dfs(i + 1, f + "-" + abcd[i + 1], sum - int(abcd[i + 1])) dfs(0, abcd[0], int(abcd[0]))
false
28.571429
[ "-import itertools, re", "+abcd = eval(input())", "-abcd = eval(input())", "-abcd = [int(x) for x in abcd]", "-p = list(itertools.product([1, -1], repeat=3))", "-f = abcd[0]", "-fs = str(abcd[0])", "-for i in range(len(p)):", "- for j in range(3):", "- f += abcd[j + 1] * p[i][j]", "- ...
false
0.038318
0.041333
0.927044
[ "s364092847", "s955161912" ]
u072053884
p02383
python
s975435344
s620412547
30
20
7,616
7,620
Accepted
Accepted
33.33
class Dice: def __init__(self, face_vals): self.faces = dict(list(zip(['top', 'south', 'east', 'west', 'north', 'bottom'], face_vals))) def roll(self, direction): if direction == 'N': self.faces['top'], self.faces['south'], self.faces['bottom'],...
class Dice: def __init__(self, face_vals): self.faces = dict(list(zip(['top', 'front', 'right', 'left', 'back', 'bottom'], face_vals))) def roll(self, direction): if direction == 'N': self.faces['top'], self.faces['front'], self.faces['bottom'],...
32
32
1,272
1,272
class Dice: def __init__(self, face_vals): self.faces = dict( list(zip(["top", "south", "east", "west", "north", "bottom"], face_vals)) ) def roll(self, direction): if direction == "N": ( self.faces["top"], self.faces["south"], ...
class Dice: def __init__(self, face_vals): self.faces = dict( list(zip(["top", "front", "right", "left", "back", "bottom"], face_vals)) ) def roll(self, direction): if direction == "N": ( self.faces["top"], self.faces["front"], ...
false
0
[ "- list(zip([\"top\", \"south\", \"east\", \"west\", \"north\", \"bottom\"], face_vals))", "+ list(zip([\"top\", \"front\", \"right\", \"left\", \"back\", \"bottom\"], face_vals))", "- self.faces[\"south\"],", "+ self.faces[\"front\"],", "- ...
false
0.040013
0.042
0.952685
[ "s975435344", "s620412547" ]
u606045429
p03241
python
s281352727
s154008626
26
24
3,060
3,060
Accepted
Accepted
7.69
def divisors(N): res = [] i = 1 while i * i <= N: q, r = divmod(N, i) if r == 0: res.append(i) if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M)...
def divisors(N): res = [] i = 1 while i * i <= N: q, r = N // i, N % i if r == 0: res.append(i) if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M...
15
15
330
331
def divisors(N): res = [] i = 1 while i * i <= N: q, r = divmod(N, i) if r == 0: res.append(i) if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M) if d * N <= ...
def divisors(N): res = [] i = 1 while i * i <= N: q, r = N // i, N % i if r == 0: res.append(i) if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M) if d * N <=...
false
0
[ "- q, r = divmod(N, i)", "+ q, r = N // i, N % i" ]
false
0.053716
0.048779
1.101213
[ "s281352727", "s154008626" ]
u119148115
p03315
python
s546625338
s629100621
74
65
61,780
61,912
Accepted
Accepted
12.16
import sys def LS2(): return list(sys.stdin.readline().rstrip()) #็ฉบ็™ฝใชใ— S = LS2() a = S.count('+') b = S.count('-') print((a-b))
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #็ฉบ็™ฝใ‚ใ‚Š def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #็ฉบ็™ฝใชใ— def ...
7
13
133
534
import sys def LS2(): return list(sys.stdin.readline().rstrip()) # ็ฉบ็™ฝใชใ— S = LS2() a = S.count("+") b = S.count("-") print((a - b))
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # ็ฉบ็™ฝใ‚ใ‚Š def LI2(): return list(map(int, sys.stdin.readline().r...
false
46.153846
[ "+", "+sys.setrecursionlimit(10**7)", "+", "+", "+def I():", "+ return int(sys.stdin.readline().rstrip())", "+", "+", "+def MI():", "+ return list(map(int, sys.stdin.readline().rstrip().split()))", "+", "+", "+def LI():", "+ return list(map(int, sys.stdin.readline().rstrip().split...
false
0.036218
0.098165
0.36895
[ "s546625338", "s629100621" ]
u806403461
p03251
python
s821239923
s671397265
20
18
3,060
2,940
Accepted
Accepted
10
N, M, X, Y = list(map(int, input().split())) x = list(map(int, input().split())) y = list(map(int, input().split())) ans = 'War' for z in range(X+1, Y+1): if len(list([x for x in x if x < z])) == N and len(list([x for x in y if x >= z])) == M: ans = 'No War' break print(ans)
N, M, X, Y = list(map(int, input().split())) x = list(map(int, input().split())) y = list(map(int, input().split())) ans = 'War' for z in range(X+1, Y+1): if max(x) < z and min(y) >= z: ans = 'No War' break print(ans)
12
12
310
246
N, M, X, Y = list(map(int, input().split())) x = list(map(int, input().split())) y = list(map(int, input().split())) ans = "War" for z in range(X + 1, Y + 1): if ( len(list([x for x in x if x < z])) == N and len(list([x for x in y if x >= z])) == M ): ans = "No War" break print(a...
N, M, X, Y = list(map(int, input().split())) x = list(map(int, input().split())) y = list(map(int, input().split())) ans = "War" for z in range(X + 1, Y + 1): if max(x) < z and min(y) >= z: ans = "No War" break print(ans)
false
0
[ "- if (", "- len(list([x for x in x if x < z])) == N", "- and len(list([x for x in y if x >= z])) == M", "- ):", "+ if max(x) < z and min(y) >= z:" ]
false
0.00732
0.078138
0.093683
[ "s821239923", "s671397265" ]
u038021590
p03160
python
s226826142
s806438043
134
123
13,928
20,440
Accepted
Accepted
8.21
N = int(eval(input())) High = list(map(int, input().split())) DP = [0]*N DP[1] = abs(High[0]-High[1]) for i in range(2, N): DP[i] = min(DP[i-2] + abs(High[i] - High[i - 2]), DP[i-1] + abs(High[i] - High[i - 1])) print((DP[N-1]))
N = int(eval(input())) H = [float('inf')] + list(map(int, input().split())) DP = [0] * (N+1) for i in range(2, N+1): DP[i] = min(abs(H[i] - H[i-1]) + DP[i-1], abs(H[i] - H[i-2]) + DP[i-2]) print((DP[N]))
9
7
234
207
N = int(eval(input())) High = list(map(int, input().split())) DP = [0] * N DP[1] = abs(High[0] - High[1]) for i in range(2, N): DP[i] = min( DP[i - 2] + abs(High[i] - High[i - 2]), DP[i - 1] + abs(High[i] - High[i - 1]) ) print((DP[N - 1]))
N = int(eval(input())) H = [float("inf")] + list(map(int, input().split())) DP = [0] * (N + 1) for i in range(2, N + 1): DP[i] = min(abs(H[i] - H[i - 1]) + DP[i - 1], abs(H[i] - H[i - 2]) + DP[i - 2]) print((DP[N]))
false
22.222222
[ "-High = list(map(int, input().split()))", "-DP = [0] * N", "-DP[1] = abs(High[0] - High[1])", "-for i in range(2, N):", "- DP[i] = min(", "- DP[i - 2] + abs(High[i] - High[i - 2]), DP[i - 1] + abs(High[i] - High[i - 1])", "- )", "-print((DP[N - 1]))", "+H = [float(\"inf\")] + list(map(...
false
0.036081
0.036942
0.976703
[ "s226826142", "s806438043" ]
u297801580
p03171
python
s649693804
s067230164
331
305
111,964
111,708
Accepted
Accepted
7.85
n = int(eval(input())) a = tuple(map(int, input().split())) dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]) print((dp[0][n - 1]))
def main(): n = int(eval(input())) a = list(map(int, input().split())) dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]) prin...
11
12
283
337
n = int(eval(input())) a = tuple(map(int, input().split())) dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]) print((dp[0][n - 1]))
def main(): n = int(eval(input())) a = list(map(int, input().split())) dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]) print((dp[0][n ...
false
8.333333
[ "-n = int(eval(input()))", "-a = tuple(map(int, input().split()))", "-dp = [[0] * n for _ in range(n)]", "-for i in range(n):", "- dp[i][i] = a[i]", "-for i in range(n - 2, -1, -1):", "- for j in range(i + 1, n):", "- dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1])", "-print((d...
false
0.041865
0.040522
1.033141
[ "s649693804", "s067230164" ]
u368780724
p03176
python
s545227161
s371022930
613
562
121,040
121,296
Accepted
Accepted
8.32
class SegTree: def __init__(self, A, intv, initialize = True): self.N = len(A) self.N0 = 2**(self.N-1).bit_length() self.dep = self.N0.bit_length() if initialize: self.data = [intv]*(self.N0-1) + A + [intv]*(self.N0 - self.N + 1) for i in range(se...
class Segtree: def __init__(self, A, intv, initialize = True, segf = max): self.N = len(A) self.N0 = 2**(self.N-1).bit_length() self.intv = intv self.segf = segf if initialize: self.data = [intv]*self.N0 + A + [intv]*(self.N0 - self.N) for i in...
47
43
1,332
1,269
class SegTree: def __init__(self, A, intv, initialize=True): self.N = len(A) self.N0 = 2 ** (self.N - 1).bit_length() self.dep = self.N0.bit_length() if initialize: self.data = [intv] * (self.N0 - 1) + A + [intv] * (self.N0 - self.N + 1) for i in range(self.N0...
class Segtree: def __init__(self, A, intv, initialize=True, segf=max): self.N = len(A) self.N0 = 2 ** (self.N - 1).bit_length() self.intv = intv self.segf = segf if initialize: self.data = [intv] * self.N0 + A + [intv] * (self.N0 - self.N) for i in ran...
false
8.510638
[ "-class SegTree:", "- def __init__(self, A, intv, initialize=True):", "+class Segtree:", "+ def __init__(self, A, intv, initialize=True, segf=max):", "- self.dep = self.N0.bit_length()", "+ self.intv = intv", "+ self.segf = segf", "- self.data = [intv] * (self.N0 ...
false
0.050976
0.108006
0.471973
[ "s545227161", "s371022930" ]
u628335443
p03073
python
s168843413
s761311526
968
47
10,488
8,972
Accepted
Accepted
95.14
S = eval(input()) ans = 0 for i in range(1, len(S)): if S[i] == S[i-1]: S = S[:i] + str(1 - int(S[i])) + S[i+1:] ans += 1 print(ans)
S = eval(input()) ans = 0 a = S[0] for i in range(1, len(S)): if S[i] == a: ans += 1 if a == '0': a = '1' else: a = '0' print(ans)
7
11
153
171
S = eval(input()) ans = 0 for i in range(1, len(S)): if S[i] == S[i - 1]: S = S[:i] + str(1 - int(S[i])) + S[i + 1 :] ans += 1 print(ans)
S = eval(input()) ans = 0 a = S[0] for i in range(1, len(S)): if S[i] == a: ans += 1 if a == "0": a = "1" else: a = "0" print(ans)
false
36.363636
[ "+a = S[0]", "- if S[i] == S[i - 1]:", "- S = S[:i] + str(1 - int(S[i])) + S[i + 1 :]", "+ if S[i] == a:", "+ if a == \"0\":", "+ a = \"1\"", "+ else:", "+ a = \"0\"" ]
false
0.040058
0.034568
1.158803
[ "s168843413", "s761311526" ]
u028973125
p03986
python
s371476518
s004149525
118
109
96,348
82,104
Accepted
Accepted
7.63
import sys from collections import deque X = list(sys.stdin.readline().strip()) s = [] q = deque(X) while q: char = q.popleft() if len(s) == 0: s.append(char) continue if char == "T" and s[-1] == "S": s.pop() else: s.append(char) print((len...
import sys X = sys.stdin.readline().strip() lx = len(X) stack = [] pop_n = 0 for c in X: if c == "S": stack.append(c) elif c == "T" and 0 < len(stack): stack.pop() pop_n += 1 print((lx - 2 * pop_n))
20
15
323
245
import sys from collections import deque X = list(sys.stdin.readline().strip()) s = [] q = deque(X) while q: char = q.popleft() if len(s) == 0: s.append(char) continue if char == "T" and s[-1] == "S": s.pop() else: s.append(char) print((len(s)))
import sys X = sys.stdin.readline().strip() lx = len(X) stack = [] pop_n = 0 for c in X: if c == "S": stack.append(c) elif c == "T" and 0 < len(stack): stack.pop() pop_n += 1 print((lx - 2 * pop_n))
false
25
[ "-from collections import deque", "-X = list(sys.stdin.readline().strip())", "-s = []", "-q = deque(X)", "-while q:", "- char = q.popleft()", "- if len(s) == 0:", "- s.append(char)", "- continue", "- if char == \"T\" and s[-1] == \"S\":", "- s.pop()", "- else:"...
false
0.043456
0.044204
0.983081
[ "s371476518", "s004149525" ]
u952708174
p03731
python
s918875641
s740375996
138
126
25,196
25,200
Accepted
Accepted
8.7
def c_Sentou(N, T, t): ans = 0 for i in range(N): if i == N - 1: ans += T continue ans += min(T, t[i + 1] - t[i]) return ans N,T = [int(i) for i in input().split()] t = [int(i) for i in input().split()] print((c_Sentou(N, T, t)))
def c_sentou(N, T, time): time.append(float('inf')) # ็•ชๅ…ต ans = 0 for i in range(N): ans += min(T, time[i + 1] - time[i]) return ans N,T = [int(i) for i in input().split()] time = [int(i) for i in input().split()] print((c_sentou(N, T, time)))
12
10
291
275
def c_Sentou(N, T, t): ans = 0 for i in range(N): if i == N - 1: ans += T continue ans += min(T, t[i + 1] - t[i]) return ans N, T = [int(i) for i in input().split()] t = [int(i) for i in input().split()] print((c_Sentou(N, T, t)))
def c_sentou(N, T, time): time.append(float("inf")) # ็•ชๅ…ต ans = 0 for i in range(N): ans += min(T, time[i + 1] - time[i]) return ans N, T = [int(i) for i in input().split()] time = [int(i) for i in input().split()] print((c_sentou(N, T, time)))
false
16.666667
[ "-def c_Sentou(N, T, t):", "+def c_sentou(N, T, time):", "+ time.append(float(\"inf\")) # ็•ชๅ…ต", "- if i == N - 1:", "- ans += T", "- continue", "- ans += min(T, t[i + 1] - t[i])", "+ ans += min(T, time[i + 1] - time[i])", "-t = [int(i) for i in input().s...
false
0.042347
0.070172
0.603475
[ "s918875641", "s740375996" ]
u910632349
p02754
python
s672902707
s385752957
31
28
9,100
9,068
Accepted
Accepted
9.68
n,a,b=list(map(int,input().split())) x=n//(a+b)*a y=n%(a+b) if y<a: print((x+y)) else: print((x+a))
n,a,b=list(map(int,input().split())) x=n//(a+b) y=n%(a+b) if y<=a: print((a*x+y)) else: print((a*x+a))
7
7
103
106
n, a, b = list(map(int, input().split())) x = n // (a + b) * a y = n % (a + b) if y < a: print((x + y)) else: print((x + a))
n, a, b = list(map(int, input().split())) x = n // (a + b) y = n % (a + b) if y <= a: print((a * x + y)) else: print((a * x + a))
false
0
[ "-x = n // (a + b) * a", "+x = n // (a + b)", "-if y < a:", "- print((x + y))", "+if y <= a:", "+ print((a * x + y))", "- print((x + a))", "+ print((a * x + a))" ]
false
0.047333
0.12879
0.367519
[ "s672902707", "s385752957" ]
u766477342
p00004
python
s845496598
s831686831
30
20
7,852
7,700
Accepted
Accepted
33.33
import math def saidai(x, y): x, y = math.fabs(x), math.fabs(y) y, x = max(x, y), min(x, y) if x == 0: return y return saidai(x, y % x) def saisyo(x, y): spam = saidai(x, y) return spam * (x / spam) * (y / spam) # a,b,c,d,e,f = list(map(int,'1 2 3 4 5 6'.split())) try: ...
import math def gcd(x, y): x, y = math.fabs(x), math.fabs(y) y, x = max(x, y), min(x, y) if x == 0: return y return gcd(x, y % x) try: while 1: a,b,c,d,e,f = list(map(int,input().split())) s = gcd(a, d) k1 = d / s * -1 k2 = a / s ...
28
23
615
462
import math def saidai(x, y): x, y = math.fabs(x), math.fabs(y) y, x = max(x, y), min(x, y) if x == 0: return y return saidai(x, y % x) def saisyo(x, y): spam = saidai(x, y) return spam * (x / spam) * (y / spam) # a,b,c,d,e,f = list(map(int,'1 2 3 4 5 6'.split())) try: while 1...
import math def gcd(x, y): x, y = math.fabs(x), math.fabs(y) y, x = max(x, y), min(x, y) if x == 0: return y return gcd(x, y % x) try: while 1: a, b, c, d, e, f = list(map(int, input().split())) s = gcd(a, d) k1 = d / s * -1 k2 = a / s y = (k1 * c ...
false
17.857143
[ "-def saidai(x, y):", "+def gcd(x, y):", "- return saidai(x, y % x)", "+ return gcd(x, y % x)", "-def saisyo(x, y):", "- spam = saidai(x, y)", "- return spam * (x / spam) * (y / spam)", "-", "-", "-# a,b,c,d,e,f = list(map(int,'1 2 3 4 5 6'.split()))", "- s = saidai(a, d)", ...
false
0.174478
0.048516
3.596277
[ "s845496598", "s831686831" ]
u263830634
p03493
python
s402859208
s494797584
19
17
3,060
2,940
Accepted
Accepted
10.53
A = list(eval(input())) print((A.count('1')))
S = list(eval(input())) print((S.count('1')))
3
3
41
41
A = list(eval(input())) print((A.count("1")))
S = list(eval(input())) print((S.count("1")))
false
0
[ "-A = list(eval(input()))", "-print((A.count(\"1\")))", "+S = list(eval(input()))", "+print((S.count(\"1\")))" ]
false
0.040024
0.039279
1.018967
[ "s402859208", "s494797584" ]
u371385198
p03645
python
s641701290
s668876523
393
317
59,456
37,724
Accepted
Accepted
19.34
import sys input = sys.stdin.readline def readstr(): return input().strip() def readint(): return int(eval(input())) def readnums(): return list(map(int, input().split())) def readstrs(): return input().split() def main(): N, M = readnums() ab = [list(readnums()) ...
import sys input = sys.stdin.readline def readstr(): return input().strip() def readint(): return int(eval(input())) def readnums(): return list(map(int, input().split())) def readstrs(): return input().split() def main(): N, M = readnums() ab = [tuple(readnums())...
35
31
548
514
import sys input = sys.stdin.readline def readstr(): return input().strip() def readint(): return int(eval(input())) def readnums(): return list(map(int, input().split())) def readstrs(): return input().split() def main(): N, M = readnums() ab = [list(readnums()) for _ in range(M)] ...
import sys input = sys.stdin.readline def readstr(): return input().strip() def readint(): return int(eval(input())) def readnums(): return list(map(int, input().split())) def readstrs(): return input().split() def main(): N, M = readnums() ab = [tuple(readnums()) for _ in range(M)] ...
false
11.428571
[ "- ab = [list(readnums()) for _ in range(M)]", "- s1 = {x[1] for x in ab if x[0] == 1}", "- s2 = {x[0] for x in ab if x[1] == N}", "- if len(s1 & s2):", "- print(\"POSSIBLE\")", "- else:", "- print(\"IMPOSSIBLE\")", "+ ab = [tuple(readnums()) for _ in range(M)]", "+ ...
false
0.10931
0.116166
0.94098
[ "s641701290", "s668876523" ]
u807028974
p02577
python
s735888968
s883771707
205
78
9,128
9,216
Accepted
Accepted
61.95
n = int(eval(input())) if n%9==0: print("Yes") else: print("No")
N = eval(input()) res = 0 for i in range(len(N)): res += int(N[i]) if res%9==0: print("Yes") else: print("No")
5
8
66
123
n = int(eval(input())) if n % 9 == 0: print("Yes") else: print("No")
N = eval(input()) res = 0 for i in range(len(N)): res += int(N[i]) if res % 9 == 0: print("Yes") else: print("No")
false
37.5
[ "-n = int(eval(input()))", "-if n % 9 == 0:", "+N = eval(input())", "+res = 0", "+for i in range(len(N)):", "+ res += int(N[i])", "+if res % 9 == 0:" ]
false
0.043503
0.036408
1.194872
[ "s735888968", "s883771707" ]
u399280934
p03351
python
s904934569
s865259089
84
17
3,316
2,940
Accepted
Accepted
79.76
a,b,c,d = list(map(int, input().split())) if (a-c)**2<=d**2 or ((a-b)**2<=d**2 and (b-c)**2<=d**2): print("Yes") else: print("No")
a,b,c,d=list(map(int, input().split())) print(("Yes" if abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d) else "No"))
5
2
137
106
a, b, c, d = list(map(int, input().split())) if (a - c) ** 2 <= d**2 or ((a - b) ** 2 <= d**2 and (b - c) ** 2 <= d**2): print("Yes") else: print("No")
a, b, c, d = list(map(int, input().split())) print(("Yes" if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d) else "No"))
false
60
[ "-if (a - c) ** 2 <= d**2 or ((a - b) ** 2 <= d**2 and (b - c) ** 2 <= d**2):", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print((\"Yes\" if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d) else \"No\"))" ]
false
0.084124
0.038204
2.201997
[ "s904934569", "s865259089" ]
u780364430
p03111
python
s303451249
s406278896
301
72
3,064
3,064
Accepted
Accepted
76.08
import itertools n, a, b, c = list(map(int, input().split())) _l = [int(eval(input())) for i in range(n)] cl = ('A', 'B', 'C', 'N') result = 1e10 for pattern in itertools.product(*[cl]*n): wands = {'A': 0, 'B': 0, 'C': 0} point = 0 for i, char in enumerate(pattern): if char != 'N': ...
n, a, b, c = list(map(int, input().split())) _l = [int(eval(input())) for i in range(n)] inf = 10**9 # DP def f(i, _a, _b, _c): # A,B,Cใซใ—ใ‚ˆใ†ใจใ—ใฆใ„ใ‚‹ๆžใฎ้•ทใ•ใŒ็พๅœจ_a,_b,_cใฎใจใ,i็•ช็›ฎไปฅ้™ใฎๆๆ–™ใ‚’ไฝฟใฃใฆ้”ๆˆใ•ใ‚Œใ‚‹็‚นๆ•ฐใฎๆœ€ๅฐๅ€ค if i == n: return abs(a - _a) + abs(b - _b) + abs(c - _c) if min(_a, _b, _c) > 0 else inf # i็•ช็›ฎใ‚’ไฝฟ...
22
22
591
629
import itertools n, a, b, c = list(map(int, input().split())) _l = [int(eval(input())) for i in range(n)] cl = ("A", "B", "C", "N") result = 1e10 for pattern in itertools.product(*[cl] * n): wands = {"A": 0, "B": 0, "C": 0} point = 0 for i, char in enumerate(pattern): if char != "N": if...
n, a, b, c = list(map(int, input().split())) _l = [int(eval(input())) for i in range(n)] inf = 10**9 # DP def f(i, _a, _b, _c): # A,B,Cใซใ—ใ‚ˆใ†ใจใ—ใฆใ„ใ‚‹ๆžใฎ้•ทใ•ใŒ็พๅœจ_a,_b,_cใฎใจใ,i็•ช็›ฎไปฅ้™ใฎๆๆ–™ใ‚’ไฝฟใฃใฆ้”ๆˆใ•ใ‚Œใ‚‹็‚นๆ•ฐใฎๆœ€ๅฐๅ€ค if i == n: return abs(a - _a) + abs(b - _b) + abs(c - _c) if min(_a, _b, _c) > 0 else inf # i็•ช็›ฎใ‚’ไฝฟใ‚ใชใ„ใจใ val1 =...
false
0
[ "-import itertools", "-", "-cl = (\"A\", \"B\", \"C\", \"N\")", "-result = 1e10", "-for pattern in itertools.product(*[cl] * n):", "- wands = {\"A\": 0, \"B\": 0, \"C\": 0}", "- point = 0", "- for i, char in enumerate(pattern):", "- if char != \"N\":", "- if wands[char] ...
false
0.24428
0.068627
3.559531
[ "s303451249", "s406278896" ]
u077536797
p02625
python
s672519189
s365299578
345
294
28,620
9,168
Accepted
Accepted
14.78
n,m=list(map(int,input().split())) i,d=0,[1]*(n+1) while i<n:d[i+1]=((m-i)*((m-n+i)*d[i]+i*d[i-1]*(m-i+1)))%(10**9+7);i+=1 print((d[-1]))
n,m=list(map(int,input().split())) i,a,b=0,1,0 while i<n:c=((m-i)*((m-n+i)*a+i*b*(m-i+1)))%(10**9+7);i+=1;a,b=c,a print(a)
4
4
132
119
n, m = list(map(int, input().split())) i, d = 0, [1] * (n + 1) while i < n: d[i + 1] = ((m - i) * ((m - n + i) * d[i] + i * d[i - 1] * (m - i + 1))) % ( 10**9 + 7 ) i += 1 print((d[-1]))
n, m = list(map(int, input().split())) i, a, b = 0, 1, 0 while i < n: c = ((m - i) * ((m - n + i) * a + i * b * (m - i + 1))) % (10**9 + 7) i += 1 a, b = c, a print(a)
false
0
[ "-i, d = 0, [1] * (n + 1)", "+i, a, b = 0, 1, 0", "- d[i + 1] = ((m - i) * ((m - n + i) * d[i] + i * d[i - 1] * (m - i + 1))) % (", "- 10**9 + 7", "- )", "+ c = ((m - i) * ((m - n + i) * a + i * b * (m - i + 1))) % (10**9 + 7)", "-print((d[-1]))", "+ a, b = c, a", "+print(a)" ]
false
0.229803
0.257397
0.892796
[ "s672519189", "s365299578" ]
u966207392
p02621
python
s393200354
s347191059
36
29
9,144
9,116
Accepted
Accepted
19.44
a = int(eval(input())) print(((a**3)+(a**2)+a))
a = int(eval(input())) print((a**3+a**2+a))
2
2
40
36
a = int(eval(input())) print(((a**3) + (a**2) + a))
a = int(eval(input())) print((a**3 + a**2 + a))
false
0
[ "-print(((a**3) + (a**2) + a))", "+print((a**3 + a**2 + a))" ]
false
0.071433
0.071987
0.992305
[ "s393200354", "s347191059" ]
u130900604
p03721
python
s286459890
s288811136
861
190
53,080
25,116
Accepted
Accepted
77.93
n,k=list(map(int,input().split())) ab=[] for _ in range(n): a,b=list(map(int,input().split())) ab.append((a,b)) ab.sort() for i,j in ab: k-=j if k<=0: print(i) exit()
n,k,*l=list(map(int,open(0).read().split())) for a,b in sorted(zip(l[::2],l[1::2])): k-=b if k<1:print(a);exit()
11
4
180
111
n, k = list(map(int, input().split())) ab = [] for _ in range(n): a, b = list(map(int, input().split())) ab.append((a, b)) ab.sort() for i, j in ab: k -= j if k <= 0: print(i) exit()
n, k, *l = list(map(int, open(0).read().split())) for a, b in sorted(zip(l[::2], l[1::2])): k -= b if k < 1: print(a) exit()
false
63.636364
[ "-n, k = list(map(int, input().split()))", "-ab = []", "-for _ in range(n):", "- a, b = list(map(int, input().split()))", "- ab.append((a, b))", "-ab.sort()", "-for i, j in ab:", "- k -= j", "- if k <= 0:", "- print(i)", "+n, k, *l = list(map(int, open(0).read().split()))", ...
false
0.123345
0.037456
3.293077
[ "s286459890", "s288811136" ]
u474232743
p02401
python
s703036757
s483337428
50
20
7,752
7,436
Accepted
Accepted
60
while True: line = input().split() if line[1] == '+': print((int(line[0]) + int(line[2]))) if line[1] == '-': print((int(line[0]) - int(line[2]))) if line[1] == '*': print((int(line[0]) * int(line[2]))) if line[1] == '/': print((int(line[0]) // int(line[2...
while True: line = eval(input()) if '?' in line: break print((eval(line.replace('/', '//'))))
12
5
355
109
while True: line = input().split() if line[1] == "+": print((int(line[0]) + int(line[2]))) if line[1] == "-": print((int(line[0]) - int(line[2]))) if line[1] == "*": print((int(line[0]) * int(line[2]))) if line[1] == "/": print((int(line[0]) // int(line[2]))) if l...
while True: line = eval(input()) if "?" in line: break print((eval(line.replace("/", "//"))))
false
58.333333
[ "- line = input().split()", "- if line[1] == \"+\":", "- print((int(line[0]) + int(line[2])))", "- if line[1] == \"-\":", "- print((int(line[0]) - int(line[2])))", "- if line[1] == \"*\":", "- print((int(line[0]) * int(line[2])))", "- if line[1] == \"/\":", "- ...
false
0.032849
0.034965
0.939498
[ "s703036757", "s483337428" ]
u844789719
p02889
python
s265136250
s376516434
591
339
32,520
37,276
Accepted
Accepted
42.64
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix N, M, L = [int(_) for _ in readline().split()] ABCQST = np.array(read().split(), dtype=np.i...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix N, M, L = [int(_) for _ in readline().split()] ABCQST = np.array(read().split(), dtype=np.i...
22
23
718
772
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix N, M, L = [int(_) for _ in readline().split()] ABCQST = np.array(read().split(), dtype=np.int64) AB...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix N, M, L = [int(_) for _ in readline().split()] ABCQST = np.array(read().split(), dtype=np.int64) AB...
false
4.347826
[ "-print(*(G4.astype(np.int64)[S, T] - 1), sep=\"\\n\")", "+# print(*(G4.astype(int)[S, T] - 1), sep='\\n')", "+print((\"\\n\".join((G4.astype(int)[S, T] - 1).astype(str))))" ]
false
0.421677
0.40083
1.052008
[ "s265136250", "s376516434" ]
u246401133
p02571
python
s729336337
s698651238
81
66
9,056
9,004
Accepted
Accepted
18.52
s = eval(input()) t = eval(input()) x = len(t) y = len(s) - len(t) + 1 z = 0 for i in range(y): a = 0 for j in range(x): if s[i + j] == t[j]: a += 1 z = max(z, a) print((x - z))
s = eval(input()) t = eval(input()) S = len(s) T = len(t) x = len(t) for i in range(S - T + 1): y = 0 for j in range(T): if t[j] != s[i + j]: y += 1 x = min(x, y) print(x)
13
15
208
208
s = eval(input()) t = eval(input()) x = len(t) y = len(s) - len(t) + 1 z = 0 for i in range(y): a = 0 for j in range(x): if s[i + j] == t[j]: a += 1 z = max(z, a) print((x - z))
s = eval(input()) t = eval(input()) S = len(s) T = len(t) x = len(t) for i in range(S - T + 1): y = 0 for j in range(T): if t[j] != s[i + j]: y += 1 x = min(x, y) print(x)
false
13.333333
[ "+S = len(s)", "+T = len(t)", "-y = len(s) - len(t) + 1", "-z = 0", "-for i in range(y):", "- a = 0", "- for j in range(x):", "- if s[i + j] == t[j]:", "- a += 1", "- z = max(z, a)", "-print((x - z))", "+for i in range(S - T + 1):", "+ y = 0", "+ for j in r...
false
0.041863
0.047459
0.882089
[ "s729336337", "s698651238" ]
u863442865
p02839
python
s100893455
s392228342
109
70
20,724
12,660
Accepted
Accepted
35.78
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush...
42
42
1,299
1,298
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left, bisect_right from heapq import heapify, heappop, heappush ...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left, bisect_right from heapq import heapify, heappop, heappush ...
false
0
[ "- mid = 12800", "+ mid = 3200" ]
false
0.114897
0.047391
2.424465
[ "s100893455", "s392228342" ]
u735335967
p02832
python
s002332221
s402241772
226
110
92,640
26,268
Accepted
Accepted
51.33
n = int(eval(input())) a = list(map(int, input().split())) x = [i for i in range(1,2000001)] ans = 0 cnt = 0 if 1 not in a: print((-1)) quit() for i in range(n): if x[cnt] != a[i]: ans += 1 else: cnt += 1 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 cnt = 1 if 1 not in a: print((-1)) quit() for i in range(n): if cnt == a[i]: cnt += 1 else: ans += 1 print(ans)
14
13
253
215
n = int(eval(input())) a = list(map(int, input().split())) x = [i for i in range(1, 2000001)] ans = 0 cnt = 0 if 1 not in a: print((-1)) quit() for i in range(n): if x[cnt] != a[i]: ans += 1 else: cnt += 1 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 cnt = 1 if 1 not in a: print((-1)) quit() for i in range(n): if cnt == a[i]: cnt += 1 else: ans += 1 print(ans)
false
7.142857
[ "-x = [i for i in range(1, 2000001)]", "-cnt = 0", "+cnt = 1", "- if x[cnt] != a[i]:", "+ if cnt == a[i]:", "+ cnt += 1", "+ else:", "- else:", "- cnt += 1" ]
false
0.391562
0.122532
3.195582
[ "s002332221", "s402241772" ]
u186838327
p02806
python
s649518709
s898541589
177
17
38,256
3,060
Accepted
Accepted
90.4
n = int(eval(input())) d = {} sum_ = 0 for i in range(n): s, t = list(map(str, input().split())) t = int(t) sum_ += t d[s] = sum_ x = str(eval(input())) print((d[s]-d[x]))
n = int(eval(input())) S = [] T = [] for i in range(n): s, t = list(map(str, input().split())) t = int(t) S.append(s) T.append(t) x = str(eval(input())) for i in range(n): if S[i] == x: j = i if j == n-1: print((0)) else: print((sum(T[j+1:])))
10
20
168
281
n = int(eval(input())) d = {} sum_ = 0 for i in range(n): s, t = list(map(str, input().split())) t = int(t) sum_ += t d[s] = sum_ x = str(eval(input())) print((d[s] - d[x]))
n = int(eval(input())) S = [] T = [] for i in range(n): s, t = list(map(str, input().split())) t = int(t) S.append(s) T.append(t) x = str(eval(input())) for i in range(n): if S[i] == x: j = i if j == n - 1: print((0)) else: print((sum(T[j + 1 :])))
false
50
[ "-d = {}", "-sum_ = 0", "+S = []", "+T = []", "- sum_ += t", "- d[s] = sum_", "+ S.append(s)", "+ T.append(t)", "-print((d[s] - d[x]))", "+for i in range(n):", "+ if S[i] == x:", "+ j = i", "+if j == n - 1:", "+ print((0))", "+else:", "+ print((sum(T[j + 1 :...
false
0.055295
0.034852
1.586581
[ "s649518709", "s898541589" ]
u156815136
p03147
python
s123931102
s367437879
93
34
3,064
3,064
Accepted
Accepted
63.44
N = int(eval(input())) h = list(map(int,input().split())) cnt = 0 while True: allzero = True for i in range(N): if(h[i] != 0): allzero = False if allzero: break l = 0 while h[l] == 0:l += 1 r = l while r <N-1 and h[r+1]!=0: r +=1 cnt += 1 ...
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)ใงๆœ€ๅคงใฎ2ๅ€‹ใจใ‚Šใ ใ›ใ‚‹ใŠ a[0][0] #from itertools import combinations # (string,3) 3ๅ›ž #from collections import deque #import collections.defaultdict #import bisect # # d = m - k[i] - k[j] # if kk[bisect.bi...
20
55
373
1,233
N = int(eval(input())) h = list(map(int, input().split())) cnt = 0 while True: allzero = True for i in range(N): if h[i] != 0: allzero = False if allzero: break l = 0 while h[l] == 0: l += 1 r = l while r < N - 1 and h[r + 1] != 0: r += 1 cnt +...
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)ใงๆœ€ๅคงใฎ2ๅ€‹ใจใ‚Šใ ใ›ใ‚‹ใŠ a[0][0] # from itertools import combinations # (string,3) 3ๅ›ž # from collections import deque # import collections.defaultdict # import bisect # # d = m - k[i] - k[j] # if kk[bisect.bise...
false
63.636364
[ "-N = int(eval(input()))", "-h = list(map(int, input().split()))", "-cnt = 0", "-while True:", "- allzero = True", "- for i in range(N):", "- if h[i] != 0:", "- allzero = False", "- if allzero:", "- break", "- l = 0", "- while h[l] == 0:", "- l ...
false
0.03476
0.034837
0.99779
[ "s123931102", "s367437879" ]
u960570220
p03610
python
s135079566
s569717205
31
26
10,068
9,084
Accepted
Accepted
16.13
s = list(eval(input())) print((''.join(s[0::2])))
s = eval(input()) print((s[0::2]))
3
3
44
29
s = list(eval(input())) print(("".join(s[0::2])))
s = eval(input()) print((s[0::2]))
false
0
[ "-s = list(eval(input()))", "-print((\"\".join(s[0::2])))", "+s = eval(input())", "+print((s[0::2]))" ]
false
0.050271
0.04917
1.022386
[ "s135079566", "s569717205" ]
u252828980
p04045
python
s778489503
s403135864
218
118
3,064
3,064
Accepted
Accepted
45.87
a,b = list(map(int,input().split())) li1 = set(map(int,input().split())) li2 = {1,2,3,4,5,6,7,8,9,0} nu = list(li1^li2) i = 1 while True: aa = list(str(a)) aa = [int(x) for x in aa] if set(aa).issubset(set(nu)): print(a) break a += i
n,k = list(map(int,input().split())) L = list(map(int,input().split())) num = [1,2,3,4,5,6,7,8,9,0] li = list(set(num).difference(set(L))) flag = False while True: n = str(n) for i in range(len(n)): if int(n[i]) in li: flag = True else: flag= False ...
13
19
273
397
a, b = list(map(int, input().split())) li1 = set(map(int, input().split())) li2 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0} nu = list(li1 ^ li2) i = 1 while True: aa = list(str(a)) aa = [int(x) for x in aa] if set(aa).issubset(set(nu)): print(a) break a += i
n, k = list(map(int, input().split())) L = list(map(int, input().split())) num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] li = list(set(num).difference(set(L))) flag = False while True: n = str(n) for i in range(len(n)): if int(n[i]) in li: flag = True else: flag = False ...
false
31.578947
[ "-a, b = list(map(int, input().split()))", "-li1 = set(map(int, input().split()))", "-li2 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}", "-nu = list(li1 ^ li2)", "-i = 1", "+n, k = list(map(int, input().split()))", "+L = list(map(int, input().split()))", "+num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]", "+li = list(set(...
false
0.043935
0.0398
1.103913
[ "s778489503", "s403135864" ]
u690442716
p03209
python
s422220026
s466957981
150
17
12,488
3,060
Accepted
Accepted
88.67
import numpy as np import collections N, X = list(map(int,input().split())) l = [1] p = [1] for i in range(N): l.append(2*l[i] + 3) p.append(2*p[i] + 1) def f(N, X): if N == 0 and X > 0: return 1 elif N == 0 and X <= 0: return 0 elif X <= l[N-1] + 1: return ...
N, X = list(map(int,input().split())) l = [1] p = [1] for i in range(N): l.append(2*l[i] + 3) p.append(2*p[i] + 1) def f(N, X): if N == 0 and X > 0: return 1 elif N == 0 and X <= 0: return 0 elif X <= l[N-1] + 1: return f(N-1, X-1) else: # X > l[N-1] + 2:...
23
21
491
451
import numpy as np import collections N, X = list(map(int, input().split())) l = [1] p = [1] for i in range(N): l.append(2 * l[i] + 3) p.append(2 * p[i] + 1) def f(N, X): if N == 0 and X > 0: return 1 elif N == 0 and X <= 0: return 0 elif X <= l[N - 1] + 1: return f(N - 1,...
N, X = list(map(int, input().split())) l = [1] p = [1] for i in range(N): l.append(2 * l[i] + 3) p.append(2 * p[i] + 1) def f(N, X): if N == 0 and X > 0: return 1 elif N == 0 and X <= 0: return 0 elif X <= l[N - 1] + 1: return f(N - 1, X - 1) else: # X > l[N-1] + 2: ...
false
8.695652
[ "-import numpy as np", "-import collections", "-" ]
false
0.119732
0.061537
1.945697
[ "s422220026", "s466957981" ]
u671060652
p03060
python
s674110887
s089643084
309
71
65,388
62,072
Accepted
Accepted
77.02
import itertools import math import fractions import functools import copy n = int(eval(input())) v = list(map(int, input().split())) c = list(map(int, input().split())) sum = 0 for i in range(n): if v[i] > c[i]: sum += v[i] - c[i] print(sum)
import math def main(): n = int(eval(input())) # a, b, t = map(int, input().split()) # h = list(map(int, input().split())) # s = input() # h = [int(input()) for _ in rane(n)] v = list(map(int, input().split())) c = list(map(int, input().split())) sub = [v[i]-c[i] for i i...
14
29
262
475
import itertools import math import fractions import functools import copy n = int(eval(input())) v = list(map(int, input().split())) c = list(map(int, input().split())) sum = 0 for i in range(n): if v[i] > c[i]: sum += v[i] - c[i] print(sum)
import math def main(): n = int(eval(input())) # a, b, t = map(int, input().split()) # h = list(map(int, input().split())) # s = input() # h = [int(input()) for _ in rane(n)] v = list(map(int, input().split())) c = list(map(int, input().split())) sub = [v[i] - c[i] for i in range(n)] ...
false
51.724138
[ "-import itertools", "-import fractions", "-import functools", "-import copy", "-n = int(eval(input()))", "-v = list(map(int, input().split()))", "-c = list(map(int, input().split()))", "-sum = 0", "-for i in range(n):", "- if v[i] > c[i]:", "- sum += v[i] - c[i]", "-print(sum)", "...
false
0.053047
0.052238
1.015482
[ "s674110887", "s089643084" ]
u340781749
p03142
python
s503518905
s796137028
673
497
121,516
43,336
Accepted
Accepted
26.15
import sys from collections import deque sys.setrecursionlimit(10 ** 5 + 100) n, m = list(map(int, input().split())) links = [set() for _ in range(n)] root = set(range(n)) for line in sys.stdin.readlines(): a, b = list(map(int, line.split())) a -= 1 b -= 1 links[a].add(b) root.discard...
import sys from collections import deque n, m = list(map(int, input().split())) links = [set() for _ in range(n)] in_counts = [0] * n for line in sys.stdin.readlines(): a, b = list(map(int, line.split())) a -= 1 b -= 1 links[a].add(b) in_counts[b] += 1 root = 0 for v, ic in enumerate...
40
30
828
653
import sys from collections import deque sys.setrecursionlimit(10**5 + 100) n, m = list(map(int, input().split())) links = [set() for _ in range(n)] root = set(range(n)) for line in sys.stdin.readlines(): a, b = list(map(int, line.split())) a -= 1 b -= 1 links[a].add(b) root.discard(b) root = root....
import sys from collections import deque n, m = list(map(int, input().split())) links = [set() for _ in range(n)] in_counts = [0] * n for line in sys.stdin.readlines(): a, b = list(map(int, line.split())) a -= 1 b -= 1 links[a].add(b) in_counts[b] += 1 root = 0 for v, ic in enumerate(in_counts): ...
false
25
[ "-sys.setrecursionlimit(10**5 + 100)", "-root = set(range(n))", "+in_counts = [0] * n", "- root.discard(b)", "-root = root.pop()", "-parents = [set() for _ in range(n)]", "-q = deque([(root, -1)])", "+ in_counts[b] += 1", "+root = 0", "+for v, ic in enumerate(in_counts):", "+ if ic == 0...
false
0.04431
0.145019
0.305543
[ "s503518905", "s796137028" ]
u631277801
p03806
python
s970506300
s430033236
499
444
97,756
98,524
Accepted
Accepted
11.02
# ๅ…ฅๅŠ› import sys stdin = sys.stdin def li(): return [int(x) for x in stdin.readline().split()] def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return [float(x) for x in stdin.readline().split()] def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc...
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.re...
40
43
1,020
1,204
# ๅ…ฅๅŠ› import sys stdin = sys.stdin def li(): return [int(x) for x in stdin.readline().split()] def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return [float(x) for x in stdin.readline().split()] def ls(): return stdin.readline().split() def ns(): return stdin.rea...
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
false
6.976744
[ "-# ๅ…ฅๅŠ›", "+sys.setrecursionlimit(10**5)", "- return [int(x) for x in stdin.readline().split()]", "+ return list(map(int, stdin.readline().split()))", "- return [float(x) for x in stdin.readline().split()]", "+ return list(map(float, stdin.readline().split()))", "- return int(ns())", "+ ...
false
0.043625
0.647866
0.067336
[ "s970506300", "s430033236" ]
u832039789
p02930
python
s583648082
s701210725
114
57
2,820
2,820
Accepted
Accepted
50
n=eval(input()) while n: n-=1 for j in range(n):print(bin(j+1)[::-1].find('1')+1)
n=eval(input()) while n: n-=1 for j in range(n):print(((j+1&~j).bit_length()))
4
4
79
75
n = eval(input()) while n: n -= 1 for j in range(n): print(bin(j + 1)[::-1].find("1") + 1)
n = eval(input()) while n: n -= 1 for j in range(n): print(((j + 1 & ~j).bit_length()))
false
0
[ "- print(bin(j + 1)[::-1].find(\"1\") + 1)", "+ print(((j + 1 & ~j).bit_length()))" ]
false
0.04828
0.120187
0.401706
[ "s583648082", "s701210725" ]
u562935282
p02781
python
s442685043
s737828959
176
20
38,256
3,064
Accepted
Accepted
88.64
def main(): NOT_DET = 0 SMALLER = 1 s = eval(input()) n = len(s) # ๆกๆ•ฐ k = int(eval(input())) dp = [[[0] * 2 for _ in range(k + 1)] for _ in range(n + 1)] # dp[ไธŠใ‹ใ‚‰ไฝ•ๆกๆฑบใ‚ใŸใ‹][0ใงใชใ„ๆ•ฐๅญ—ใฎๅ€‹ๆ•ฐ][smaller=1] dp[0][0][0] = 1 for i, ci in enumerate(s): for j in range(k + 1):...
# ่งฃ่ชฌๆ”พ้€ def main(): S = eval(input()) N = len(S) K = int(eval(input())) dp = [[[0] * 2 for _ in range(K + 1)] for _ in range(N + 1)] dp[0][0][0] = 1 # dp[i][j][k] # iๆก็›ฎใพใงๆฑบใ‚ใฆjๅ€‹ใฎ้ž0ใ‚’ไฝฟใฃใฆ # k=0: ใใ“ใพใงใฎๆกใฏSใจไธ€่‡ด # k=1: ใ™ใงใซSๆœชๆบ€ใŒ็ขบๅฎš for i, c in enumerate(S): # 100 for...
39
32
969
974
def main(): NOT_DET = 0 SMALLER = 1 s = eval(input()) n = len(s) # ๆกๆ•ฐ k = int(eval(input())) dp = [[[0] * 2 for _ in range(k + 1)] for _ in range(n + 1)] # dp[ไธŠใ‹ใ‚‰ไฝ•ๆกๆฑบใ‚ใŸใ‹][0ใงใชใ„ๆ•ฐๅญ—ใฎๅ€‹ๆ•ฐ][smaller=1] dp[0][0][0] = 1 for i, ci in enumerate(s): for j in range(k + 1): dp[i ...
# ่งฃ่ชฌๆ”พ้€ def main(): S = eval(input()) N = len(S) K = int(eval(input())) dp = [[[0] * 2 for _ in range(K + 1)] for _ in range(N + 1)] dp[0][0][0] = 1 # dp[i][j][k] # iๆก็›ฎใพใงๆฑบใ‚ใฆjๅ€‹ใฎ้ž0ใ‚’ไฝฟใฃใฆ # k=0: ใใ“ใพใงใฎๆกใฏSใจไธ€่‡ด # k=1: ใ™ใงใซSๆœชๆบ€ใŒ็ขบๅฎš for i, c in enumerate(S): # 100 for j in range(K + 1)...
false
17.948718
[ "+# ่งฃ่ชฌๆ”พ้€", "- NOT_DET = 0", "- SMALLER = 1", "- s = eval(input())", "- n = len(s) # ๆกๆ•ฐ", "- k = int(eval(input()))", "- dp = [[[0] * 2 for _ in range(k + 1)] for _ in range(n + 1)]", "- # dp[ไธŠใ‹ใ‚‰ไฝ•ๆกๆฑบใ‚ใŸใ‹][0ใงใชใ„ๆ•ฐๅญ—ใฎๅ€‹ๆ•ฐ][smaller=1]", "+ S = eval(input())", "+ N = len(S)", "+ ...
false
0.112751
0.037943
2.971558
[ "s442685043", "s737828959" ]
u187205913
p03095
python
s816133723
s638994631
26
21
3,444
3,188
Accepted
Accepted
19.23
n = int(eval(input())) s = eval(input()) from collections import Counter ans = 1 x = Counter(s) for i in list(x.values()): ans *= (i+1) ans %= 10**9+7 print((ans%(10**9+7)-1))
n = int(eval(input())) s = eval(input()) a = list('abcdefghijklmnopqrstuvwxyz') cnt = [0]*26 for i,a_ in enumerate(a): cnt[i] += s.count(a_)+1 ans = 1 for cnt_ in cnt: ans *= cnt_ print((ans%(10**9+7)-1))
9
10
167
207
n = int(eval(input())) s = eval(input()) from collections import Counter ans = 1 x = Counter(s) for i in list(x.values()): ans *= i + 1 ans %= 10**9 + 7 print((ans % (10**9 + 7) - 1))
n = int(eval(input())) s = eval(input()) a = list("abcdefghijklmnopqrstuvwxyz") cnt = [0] * 26 for i, a_ in enumerate(a): cnt[i] += s.count(a_) + 1 ans = 1 for cnt_ in cnt: ans *= cnt_ print((ans % (10**9 + 7) - 1))
false
10
[ "-from collections import Counter", "-", "+a = list(\"abcdefghijklmnopqrstuvwxyz\")", "+cnt = [0] * 26", "+for i, a_ in enumerate(a):", "+ cnt[i] += s.count(a_) + 1", "-x = Counter(s)", "-for i in list(x.values()):", "- ans *= i + 1", "-ans %= 10**9 + 7", "+for cnt_ in cnt:", "+ ans *...
false
0.038443
0.036628
1.049546
[ "s816133723", "s638994631" ]
u528470578
p02959
python
s793563554
s476262586
269
209
82,020
18,624
Accepted
Accepted
22.3
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) temp = 0 for i, j in enumerate(A): if i == N: break if j >= B[i]: temp += B[i] B[i] = 0 continue else: temp += j B[i] = B[i] - j if A[i + 1] ...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N): # i็•ช็›ฎใฎ่ก—ใฎใƒขใƒณใ‚นใ‚ฟใƒผใ‚’ๅ€’ใ™ ans += min(A[i], B[i]) nb = B[i] - min(A[i], B[i]) # i+1็•ช็›ฎใฎ่ก—ใฎใƒขใƒณใ‚นใ‚ฟใƒผใ‚’ๅ€’ใ™ ans += min(A[i+1], nb) A[i+1] -= min(A[i+1], nb) print(ans)
25
13
455
299
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) temp = 0 for i, j in enumerate(A): if i == N: break if j >= B[i]: temp += B[i] B[i] = 0 continue else: temp += j B[i] = B[i] - j if A[i + 1] >= B[i]: A[i...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N): # i็•ช็›ฎใฎ่ก—ใฎใƒขใƒณใ‚นใ‚ฟใƒผใ‚’ๅ€’ใ™ ans += min(A[i], B[i]) nb = B[i] - min(A[i], B[i]) # i+1็•ช็›ฎใฎ่ก—ใฎใƒขใƒณใ‚นใ‚ฟใƒผใ‚’ๅ€’ใ™ ans += min(A[i + 1], nb) A[i + 1] -= min(A[i + 1], nb) print(ans)
false
48
[ "-temp = 0", "-for i, j in enumerate(A):", "- if i == N:", "- break", "- if j >= B[i]:", "- temp += B[i]", "- B[i] = 0", "- continue", "- else:", "- temp += j", "- B[i] = B[i] - j", "- if A[i + 1] >= B[i]:", "- A[i + 1] = A[i + 1] ...
false
0.031222
0.079057
0.394927
[ "s793563554", "s476262586" ]
u347640436
p03045
python
s289378486
s312500133
443
296
6,212
11,724
Accepted
Accepted
33.18
# Union Find ๆœจ from sys import setrecursionlimit def find(parent, i): t = parent[i] if t < 0: return i t = find(parent, t) parent[i] = t return t def unite(parent, i, j): i = find(parent, i) j = find(parent, j) if i == j: return parent[j] += pare...
# Union Find ๆœจ from sys import setrecursionlimit def find(parent, i): t = parent[i] if t < 0: return i t = find(parent, t) parent[i] = t return t def unite(parent, i, j): i = find(parent, i) j = find(parent, j) if i == j: return parent[j] += pare...
31
31
570
570
# Union Find ๆœจ from sys import setrecursionlimit def find(parent, i): t = parent[i] if t < 0: return i t = find(parent, t) parent[i] = t return t def unite(parent, i, j): i = find(parent, i) j = find(parent, j) if i == j: return parent[j] += parent[i] parent[i...
# Union Find ๆœจ from sys import setrecursionlimit def find(parent, i): t = parent[i] if t < 0: return i t = find(parent, t) parent[i] = t return t def unite(parent, i, j): i = find(parent, i) j = find(parent, j) if i == j: return parent[j] += parent[i] parent[i...
false
0
[ "-setrecursionlimit(10**5)", "+setrecursionlimit(10**6)" ]
false
0.044186
0.044434
0.994427
[ "s289378486", "s312500133" ]
u285015144
p02412
python
s279123970
s926854503
530
40
7,664
7,652
Accepted
Accepted
92.45
while(True): n, x = list(map(int, input().split())) if(n == x == 0): break ans = 0 for i in range(1, n + 1): for j in range(i + 1, n + 1): for k in range(j + 1, n + 1): if(i + j + k == x): ans += 1 print(ans)
while(True): n, x = list(map(int, input().split())) if(n == x == 0): break ans = 0 for i in range(1, n + 1): for j in range(i + 1, n + 1): if(j < x - i - j < n + 1): ans += 1 print(ans)
11
10
296
252
while True: n, x = list(map(int, input().split())) if n == x == 0: break ans = 0 for i in range(1, n + 1): for j in range(i + 1, n + 1): for k in range(j + 1, n + 1): if i + j + k == x: ans += 1 print(ans)
while True: n, x = list(map(int, input().split())) if n == x == 0: break ans = 0 for i in range(1, n + 1): for j in range(i + 1, n + 1): if j < x - i - j < n + 1: ans += 1 print(ans)
false
9.090909
[ "- for k in range(j + 1, n + 1):", "- if i + j + k == x:", "- ans += 1", "+ if j < x - i - j < n + 1:", "+ ans += 1" ]
false
0.041846
0.035682
1.172777
[ "s279123970", "s926854503" ]
u739360929
p02629
python
s788450063
s986896427
31
28
9,196
9,120
Accepted
Accepted
9.68
def solve(): n = int(eval(input())) a = 97 tmp = 0 index = 0 ans = [] for i in range(1, 12): pre = tmp tmp += 26 ** i if n <= tmp: index = i n = n - pre break n = n - 1 for _ in range(0, index)[::-1]: ans....
def solve(): n = int(eval(input())) l = 0 ans = '' for i in range(1, 12): if n <= 26 ** i: l = i break n = n - 26 ** i k = n - 1 for i in range(l): ans = chr(k % 26 + 97) + ans k = k // 26 print(ans) ...
28
28
449
356
def solve(): n = int(eval(input())) a = 97 tmp = 0 index = 0 ans = [] for i in range(1, 12): pre = tmp tmp += 26**i if n <= tmp: index = i n = n - pre break n = n - 1 for _ in range(0, index)[::-1]: ans.append(chr((n % 2...
def solve(): n = int(eval(input())) l = 0 ans = "" for i in range(1, 12): if n <= 26**i: l = i break n = n - 26**i k = n - 1 for i in range(l): ans = chr(k % 26 + 97) + ans k = k // 26 print(ans) if __name__ == "__main__": solve()...
false
0
[ "- a = 97", "- tmp = 0", "- index = 0", "- ans = []", "+ l = 0", "+ ans = \"\"", "- pre = tmp", "- tmp += 26**i", "- if n <= tmp:", "- index = i", "- n = n - pre", "+ if n <= 26**i:", "+ l = i", "- n = n - 1"...
false
0.046594
0.046978
0.991839
[ "s788450063", "s986896427" ]
u469700628
p03807
python
s782553613
s359798186
72
56
14,108
14,108
Accepted
Accepted
22.22
N = int(eval(input())) numbers = list(map(int, input().split())) odds = list([x for x in numbers if x % 2 == 0]) evens = list([x for x in numbers if x % 2 == 1]) # evens_from_odds = sum(divmod(len(odds), 2)) # odds_from_evens = sum(divmod(len(evens), 2)) odds_from_evens = int(len(evens) / 2) evens_mod = len(...
N = int(eval(input())) numbers = list(map(int, input().split())) # ๅฅ‡ๆ•ฐ + ๅฅ‡ๆ•ฐ = ๅถๆ•ฐ # ๅถๆ•ฐ + ๅถๆ•ฐ = ๅถๆ•ฐ # ๅถๆ•ฐๅˆ—ใฏๆœ€็ต‚็š„ใซไธ€ใคใซใชใ‚‹ใพใงๆ“ไฝœๅฏ่ƒฝ # ๅฅ‡ๆ•ฐ1ไฝ™ใ‚‹ใ‹ไฝ™ใ‚‰ใชใ„ใ‹ใงๆฑบใพใ‚‹ evens = list([x for x in numbers if x % 2 == 1]) evens_mod = len(evens) % 2 if evens_mod == 1: print("NO") else: print("YES")
14
16
392
285
N = int(eval(input())) numbers = list(map(int, input().split())) odds = list([x for x in numbers if x % 2 == 0]) evens = list([x for x in numbers if x % 2 == 1]) # evens_from_odds = sum(divmod(len(odds), 2)) # odds_from_evens = sum(divmod(len(evens), 2)) odds_from_evens = int(len(evens) / 2) evens_mod = len(evens) % 2 ...
N = int(eval(input())) numbers = list(map(int, input().split())) # ๅฅ‡ๆ•ฐ + ๅฅ‡ๆ•ฐ = ๅถๆ•ฐ # ๅถๆ•ฐ + ๅถๆ•ฐ = ๅถๆ•ฐ # ๅถๆ•ฐๅˆ—ใฏๆœ€็ต‚็š„ใซไธ€ใคใซใชใ‚‹ใพใงๆ“ไฝœๅฏ่ƒฝ # ๅฅ‡ๆ•ฐ1ไฝ™ใ‚‹ใ‹ไฝ™ใ‚‰ใชใ„ใ‹ใงๆฑบใพใ‚‹ evens = list([x for x in numbers if x % 2 == 1]) evens_mod = len(evens) % 2 if evens_mod == 1: print("NO") else: print("YES")
false
12.5
[ "-odds = list([x for x in numbers if x % 2 == 0])", "+# ๅฅ‡ๆ•ฐ + ๅฅ‡ๆ•ฐ = ๅถๆ•ฐ", "+# ๅถๆ•ฐ + ๅถๆ•ฐ = ๅถๆ•ฐ", "+# ๅถๆ•ฐๅˆ—ใฏๆœ€็ต‚็š„ใซไธ€ใคใซใชใ‚‹ใพใงๆ“ไฝœๅฏ่ƒฝ", "+# ๅฅ‡ๆ•ฐ1ไฝ™ใ‚‹ใ‹ไฝ™ใ‚‰ใชใ„ใ‹ใงๆฑบใพใ‚‹", "-# evens_from_odds = sum(divmod(len(odds), 2))", "-# odds_from_evens = sum(divmod(len(evens), 2))", "-odds_from_evens = int(len(evens) / 2)" ]
false
0.040931
0.007958
5.143296
[ "s782553613", "s359798186" ]
u277104886
p02755
python
s926936495
s100564961
21
18
3,060
3,060
Accepted
Accepted
14.29
#Tax Increase import math a, b = list(map(int, input().split())) for i in range(10000): if a == math.floor(i*0.08) and b == math.floor(i*0.1): print(i) break else: print((-1))
#Tax Increase import math a, b = list(map(int, input().split())) for i in range(1251): if a == math.floor(i*0.08) and b == math.floor(i*0.1): print(i) break else: print((-1))
9
9
199
198
# Tax Increase import math a, b = list(map(int, input().split())) for i in range(10000): if a == math.floor(i * 0.08) and b == math.floor(i * 0.1): print(i) break else: print((-1))
# Tax Increase import math a, b = list(map(int, input().split())) for i in range(1251): if a == math.floor(i * 0.08) and b == math.floor(i * 0.1): print(i) break else: print((-1))
false
0
[ "-for i in range(10000):", "+for i in range(1251):" ]
false
0.045852
0.048729
0.940959
[ "s926936495", "s100564961" ]
u114641312
p02820
python
s448106521
s967855314
875
76
45,936
3,316
Accepted
Accepted
91.31
from collections import deque,Counter N,K = list(map(int,input().split())) R,S,P = list(map(int,input().split())) T = eval(input()) T = T.translate(str.maketrans({'r': 'p', 's': 'r','p': 's'})) cnt = Counter(T) dic = {"r":R, "s":S, "p":P} ans = cnt["r"]*R + cnt["s"]*S +cnt["p"]*P checked = [] for i in ra...
N,K = list(map(int,input().split())) R,S,P = list(map(int,input().split())) T = eval(input()) score = {"s":R, "p":S, "r":P} ans = 0 for i in range(K): j = i tmp = "" while j <N: if tmp != T[j]: ans += score[T[j]] tmp = T[j] else: tmp = "" ...
29
20
625
334
from collections import deque, Counter N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T = eval(input()) T = T.translate(str.maketrans({"r": "p", "s": "r", "p": "s"})) cnt = Counter(T) dic = {"r": R, "s": S, "p": P} ans = cnt["r"] * R + cnt["s"] * S + cnt["p"] * P checked = [] for i in...
N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T = eval(input()) score = {"s": R, "p": S, "r": P} ans = 0 for i in range(K): j = i tmp = "" while j < N: if tmp != T[j]: ans += score[T[j]] tmp = T[j] else: tmp = "" ...
false
31.034483
[ "-from collections import deque, Counter", "-", "-T = T.translate(str.maketrans({\"r\": \"p\", \"s\": \"r\", \"p\": \"s\"}))", "-cnt = Counter(T)", "-dic = {\"r\": R, \"s\": S, \"p\": P}", "-ans = cnt[\"r\"] * R + cnt[\"s\"] * S + cnt[\"p\"] * P", "-checked = []", "-for i in range(N - K + 1):", "- ...
false
0.036387
0.045457
0.800462
[ "s448106521", "s967855314" ]
u761320129
p04015
python
s883551549
s561285936
197
104
5,492
11,296
Accepted
Accepted
47.21
from collections import Counter N,A = list(map(int,input().split())) X = list(map(int,input().split())) dp = [Counter() for i in range(N+1)] dp[0][0] = 1 for i,x in enumerate(X): for j in range(i,-1,-1): for k,v in list(dp[j].items()): dp[j+1][k+x] += v ans = 0 for i in range(1,N...
N,A = list(map(int,input().split())) X = list(map(int,input().split())) from collections import defaultdict dp = [defaultdict(lambda: 0) for _ in range(N+1)] dp[0][0] = 1 for i,x in enumerate(X): for j in range(i,-1,-1): for k,v in list(dp[j].items()): dp[j+1][k+x] += v ans = 0 for...
16
15
347
362
from collections import Counter N, A = list(map(int, input().split())) X = list(map(int, input().split())) dp = [Counter() for i in range(N + 1)] dp[0][0] = 1 for i, x in enumerate(X): for j in range(i, -1, -1): for k, v in list(dp[j].items()): dp[j + 1][k + x] += v ans = 0 for i in range(1, N ...
N, A = list(map(int, input().split())) X = list(map(int, input().split())) from collections import defaultdict dp = [defaultdict(lambda: 0) for _ in range(N + 1)] dp[0][0] = 1 for i, x in enumerate(X): for j in range(i, -1, -1): for k, v in list(dp[j].items()): dp[j + 1][k + x] += v ans = 0 for...
false
6.25
[ "-from collections import Counter", "-", "-dp = [Counter() for i in range(N + 1)]", "+from collections import defaultdict", "+", "+dp = [defaultdict(lambda: 0) for _ in range(N + 1)]", "- ans += dp[i][A * i]", "+ ans += dp[i][i * A]" ]
false
0.03811
0.00683
5.580023
[ "s883551549", "s561285936" ]
u708019102
p03363
python
s349205929
s529255353
275
211
41,312
41,088
Accepted
Accepted
23.27
N = int(eval(input())) l = [int(x) for x in input().split()] s = [0] * (N+1) for i in range(N): s[i+1] = s[i] + l[i] s.sort() #count table= {} for i in range(N+1): if s[i] in table: table[s[i]] += 1 else: table[s[i]] = 1 ans = 0 for key,val in list(table.items()): if val...
N = int(eval(input())) l = [int(x) for x in input().split()] s = [0] * (N+1) for i in range(N): s[i+1] = s[i] + l[i] #count table= {} for i in range(N+1): if s[i] in table: table[s[i]] += 1 else: table[s[i]] = 1 ans = 0 for key,val in list(table.items()): if val >= 2: ...
19
17
357
345
N = int(eval(input())) l = [int(x) for x in input().split()] s = [0] * (N + 1) for i in range(N): s[i + 1] = s[i] + l[i] s.sort() # count table = {} for i in range(N + 1): if s[i] in table: table[s[i]] += 1 else: table[s[i]] = 1 ans = 0 for key, val in list(table.items()): if val >= 2: ...
N = int(eval(input())) l = [int(x) for x in input().split()] s = [0] * (N + 1) for i in range(N): s[i + 1] = s[i] + l[i] # count table = {} for i in range(N + 1): if s[i] in table: table[s[i]] += 1 else: table[s[i]] = 1 ans = 0 for key, val in list(table.items()): if val >= 2: an...
false
10.526316
[ "-s.sort()" ]
false
0.039639
0.045623
0.868823
[ "s349205929", "s529255353" ]
u673361376
p02691
python
s469520409
s198697612
256
222
50,884
42,604
Accepted
Accepted
13.28
from collections import Counter import bisect def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) # divisors.sort() return divisors if __na...
from collections import Counter import bisect def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) # divisors.sort() return divisors if __na...
32
30
723
676
from collections import Counter import bisect def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) # divisors.sort() return divisors if __name__ == "__main__":...
from collections import Counter import bisect def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) # divisors.sort() return divisors if __name__ == "__main__":...
false
6.25
[ "- idx_negA = []", "- idx_negA.append(i)" ]
false
0.03352
0.035526
0.943515
[ "s469520409", "s198697612" ]
u906428167
p03634
python
s690145416
s796795842
1,737
791
90,400
80,304
Accepted
Accepted
54.46
from heapq import heappop, heappush n = int(eval(input())) g = [[] for _ in range(n)] for _ in range(n-1): a, b, c = list(map(int, input().split())) g[a-1].append((b-1, c)) g[b-1].append((a-1, c)) def dijkstra(s,n,g): # g[i][j] : the cost of iโ†’j or g[i] = [(target, cost), ...] # must...
from heapq import heappop, heappush import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline n = int(eval(input())) g = [[] for _ in range(n)] for _ in range(n-1): a, b, c = list(map(int, input().split())) g[a-1].append((b-1, c)) g[b-1].append((a-1, c)) def dijkstra(s,n,g): ...
35
39
808
882
from heapq import heappop, heappush n = int(eval(input())) g = [[] for _ in range(n)] for _ in range(n - 1): a, b, c = list(map(int, input().split())) g[a - 1].append((b - 1, c)) g[b - 1].append((a - 1, c)) def dijkstra(s, n, g): # g[i][j] : the cost of iโ†’j or g[i] = [(target, cost), ...] # must...
from heapq import heappop, heappush import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline n = int(eval(input())) g = [[] for _ in range(n)] for _ in range(n - 1): a, b, c = list(map(int, input().split())) g[a - 1].append((b - 1, c)) g[b - 1].append((a - 1, c)) def dijkstra(s, n, g): # g[...
false
10.25641
[ "+import sys", "+sys.setrecursionlimit(10**7)", "+input = sys.stdin.readline" ]
false
0.03578
0.034354
1.041499
[ "s690145416", "s796795842" ]
u968404618
p02691
python
s444791603
s940959077
252
205
61,540
61,568
Accepted
Accepted
18.65
import sys input=lambda :sys.stdin.readline().rstrip() from collections import defaultdict n = int(eval(input())) A = list(map(int, input().split())) d = defaultdict(int) ans = 0 for j in range(n): Dif = j - A[j] ans += d[Dif] Sum = A[j] + j d[Sum] += 1 print(ans)
def main(): ## IMPORT MODULE #import sys #sys.setrecursionlimit(100000) #input=lambda :sys.stdin.readline().rstrip() from collections import defaultdict #f_inf=float("inf") #MOD=10**9+7 if 'get_ipython' in globals(): ## SAMPLE INPUT n = 6 A = [2, 3, 3, 1, 3, 1] else:...
15
32
290
585
import sys input = lambda: sys.stdin.readline().rstrip() from collections import defaultdict n = int(eval(input())) A = list(map(int, input().split())) d = defaultdict(int) ans = 0 for j in range(n): Dif = j - A[j] ans += d[Dif] Sum = A[j] + j d[Sum] += 1 print(ans)
def main(): ## IMPORT MODULE # import sys # sys.setrecursionlimit(100000) # input=lambda :sys.stdin.readline().rstrip() from collections import defaultdict # f_inf=float("inf") # MOD=10**9+7 if "get_ipython" in globals(): ## SAMPLE INPUT n = 6 A = [2, 3, 3, 1, 3,...
false
53.125
[ "-import sys", "+def main():", "+ ## IMPORT MODULE", "+ # import sys", "+ # sys.setrecursionlimit(100000)", "+ # input=lambda :sys.stdin.readline().rstrip()", "+ from collections import defaultdict", "-input = lambda: sys.stdin.readline().rstrip()", "-from collections import defaultdi...
false
0.046208
0.085191
0.542398
[ "s444791603", "s940959077" ]
u768896740
p03273
python
s690267225
s710792181
311
49
21,340
4,596
Accepted
Accepted
84.24
import numpy as np h, w = map(int, input().split()) li = [] for i in range(h): a = list(input()) li.append(a) count = 0 li_2 = [] for i in range(h): for j in range(w): if li[i][j] == '#': li_2.append(list(li[i][:])) count += 1 break li_3 = [] ...
import itertools h,w = map(int, input().split()) area = [] for i in range(h): array = list(input()) area.append(array) a = list(itertools.chain.from_iterable(area)) yoko = [] tate = [] for i in range(h): cnt = 0 for j in range(w): if area[i][j] == '#': cnt += 1...
37
39
714
751
import numpy as np h, w = map(int, input().split()) li = [] for i in range(h): a = list(input()) li.append(a) count = 0 li_2 = [] for i in range(h): for j in range(w): if li[i][j] == "#": li_2.append(list(li[i][:])) count += 1 break li_3 = [] li_2 = [list(x) for ...
import itertools h, w = map(int, input().split()) area = [] for i in range(h): array = list(input()) area.append(array) a = list(itertools.chain.from_iterable(area)) yoko = [] tate = [] for i in range(h): cnt = 0 for j in range(w): if area[i][j] == "#": cnt += 1 if cnt == 0: ...
false
5.128205
[ "-import numpy as np", "+import itertools", "-li = []", "+area = []", "- a = list(input())", "- li.append(a)", "-count = 0", "-li_2 = []", "+ array = list(input())", "+ area.append(array)", "+a = list(itertools.chain.from_iterable(area))", "+yoko = []", "+tate = []", "+ cnt ...
false
0.082355
0.071557
1.150898
[ "s690267225", "s710792181" ]
u226155577
p03850
python
s095205280
s885839572
170
155
20,724
20,724
Accepted
Accepted
8.82
n = eval(input()) code = input().split() # DP(N, <parentheses nested>) a = int(code[0]); b = c = -10**18 for op, v in zip(code[1::2], list(map(int,code[2::2]))): if op is "+": d = max(b-v, c+v) a,b,c = max(a+v, d), d, c+v else: d = max(b+v, c-v) a,b,c = max(a-v, d), max...
n = eval(input()) code = input().split() a = int(code[0]); b = c = -10**18 for op, v in zip(code[1::2], list(map(int,code[2::2]))): if op is "+": b = max(b-v, c+v) c += v a = max(a+v, b) else: c = max(b+v, c-v) a = b = max(a-v, c) print(max(a, b, c))
12
12
343
300
n = eval(input()) code = input().split() # DP(N, <parentheses nested>) a = int(code[0]) b = c = -(10**18) for op, v in zip(code[1::2], list(map(int, code[2::2]))): if op is "+": d = max(b - v, c + v) a, b, c = max(a + v, d), d, c + v else: d = max(b + v, c - v) a, b, c = max(a - ...
n = eval(input()) code = input().split() a = int(code[0]) b = c = -(10**18) for op, v in zip(code[1::2], list(map(int, code[2::2]))): if op is "+": b = max(b - v, c + v) c += v a = max(a + v, b) else: c = max(b + v, c - v) a = b = max(a - v, c) print(max(a, b, c))
false
0
[ "-# DP(N, <parentheses nested>)", "- d = max(b - v, c + v)", "- a, b, c = max(a + v, d), d, c + v", "+ b = max(b - v, c + v)", "+ c += v", "+ a = max(a + v, b)", "- d = max(b + v, c - v)", "- a, b, c = max(a - v, d), max(a - v, d), d", "+ c = m...
false
0.044386
0.047839
0.927809
[ "s095205280", "s885839572" ]
u598296382
p02625
python
s743398325
s100780044
1,251
509
68,288
99,196
Accepted
Accepted
59.31
def cmb(n, r, mod):#ใ‚ณใƒณใƒ“ใƒใƒผใ‚ทใƒงใƒณใฎ้ซ˜้€Ÿ่จˆ็ฎ—ใ€€ if ( r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod mod = 10**9+7 #ๅ‡บๅŠ›ใฎๅˆถ้™ N = 5*10**5 #Nใฎๆœ€ๅคงๅ€ค g1 = [1, 1] #ๅ…ƒใƒ†ใƒผใƒ–ใƒซ g2 = [1, 1] #้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ inverse = [0, 1] #้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ่จˆ็ฎ—็”จใƒ†ใƒผใƒ–ใƒซ for i in range( 2, N + 1 ): g1.append( ( g1[-1] * i ) % mo...
def cmb(n, r, mod):#ใ‚ณใƒณใƒ“ใƒใƒผใ‚ทใƒงใƒณใฎ้ซ˜้€Ÿ่จˆ็ฎ—ใ€€ if ( r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod mod = 10**9+7 #ๅ‡บๅŠ›ใฎๅˆถ้™ N = 5*10**5 #Nใฎๆœ€ๅคงๅ€ค g1 = [0]*(N+1) #ๅ…ƒใƒ†ใƒผใƒ–ใƒซ g1[0] = g1[1] = 1 g2 = [0]*(N+1) #้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ g2[0] = g2[1] = 1 inverse = [0]*(N+1) #้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ่จˆ็ฎ—็”จใƒ†ใƒผใƒ–ใƒซ inverse[0],inver...
21
24
599
652
def cmb(n, r, mod): # ใ‚ณใƒณใƒ“ใƒใƒผใ‚ทใƒงใƒณใฎ้ซ˜้€Ÿ่จˆ็ฎ— if r < 0 or r > n: return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod mod = 10**9 + 7 # ๅ‡บๅŠ›ใฎๅˆถ้™ N = 5 * 10**5 # Nใฎๆœ€ๅคงๅ€ค g1 = [1, 1] # ๅ…ƒใƒ†ใƒผใƒ–ใƒซ g2 = [1, 1] # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ inverse = [0, 1] # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ่จˆ็ฎ—็”จใƒ†ใƒผใƒ–ใƒซ for i in range(2, N + 1): g1.append((g1[-1] * i...
def cmb(n, r, mod): # ใ‚ณใƒณใƒ“ใƒใƒผใ‚ทใƒงใƒณใฎ้ซ˜้€Ÿ่จˆ็ฎ— if r < 0 or r > n: return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod mod = 10**9 + 7 # ๅ‡บๅŠ›ใฎๅˆถ้™ N = 5 * 10**5 # Nใฎๆœ€ๅคงๅ€ค g1 = [0] * (N + 1) # ๅ…ƒใƒ†ใƒผใƒ–ใƒซ g1[0] = g1[1] = 1 g2 = [0] * (N + 1) # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ g2[0] = g2[1] = 1 inverse = [0] * (N + 1) # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ่จˆ็ฎ—...
false
12.5
[ "-g1 = [1, 1] # ๅ…ƒใƒ†ใƒผใƒ–ใƒซ", "-g2 = [1, 1] # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ", "-inverse = [0, 1] # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ่จˆ็ฎ—็”จใƒ†ใƒผใƒ–ใƒซ", "+g1 = [0] * (N + 1) # ๅ…ƒใƒ†ใƒผใƒ–ใƒซ", "+g1[0] = g1[1] = 1", "+g2 = [0] * (N + 1) # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ", "+g2[0] = g2[1] = 1", "+inverse = [0] * (N + 1) # ้€†ๅ…ƒใƒ†ใƒผใƒ–ใƒซ่จˆ็ฎ—็”จใƒ†ใƒผใƒ–ใƒซ", "+inverse[0], inverse[1] = 0, 1", "- g1.append((g1[-...
false
1.492267
1.562749
0.954899
[ "s743398325", "s100780044" ]
u047796752
p03165
python
s378408855
s723345283
960
450
404,232
112,220
Accepted
Accepted
53.12
import sys input = sys.stdin.readline s = input()[:-1] t = input()[:-1] dp = [[0]*(len(t)+1) for _ in range(len(s)+1)] track = [[-1]*(len(t)+1) for _ in range(len(s)+1)] for i in range(len(s)): for j in range(len(t)): if s[i]==t[j]: dp[i+1][j+1] = dp[i][j]+1 track[i+1][...
import sys input = sys.stdin.readline s = input()[:-1] t = input()[:-1] dp = [[0]*(len(t)+1) for _ in range(len(s)+1)] for i in range(len(s)): for j in range(len(t)): if s[i]==t[j]: dp[i+1][j+1] = dp[i][j]+1 else: if dp[i+1][j]>dp[i][j+1]: dp[i+...
34
33
800
696
import sys input = sys.stdin.readline s = input()[:-1] t = input()[:-1] dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)] track = [[-1] * (len(t) + 1) for _ in range(len(s) + 1)] for i in range(len(s)): for j in range(len(t)): if s[i] == t[j]: dp[i + 1][j + 1] = dp[i][j] + 1 trac...
import sys input = sys.stdin.readline s = input()[:-1] t = input()[:-1] dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)] for i in range(len(s)): for j in range(len(t)): if s[i] == t[j]: dp[i + 1][j + 1] = dp[i][j] + 1 else: if dp[i + 1][j] > dp[i][j + 1]: ...
false
2.941176
[ "-track = [[-1] * (len(t) + 1) for _ in range(len(s) + 1)]", "- track[i + 1][j + 1] = (i, j)", "- track[i + 1][j + 1] = (i + 1, j)", "- track[i + 1][j + 1] = (i, j + 1)", "- ni, nj = track[ci][cj]", "- if ci - ni == 1 and cj - nj == 1:", "- ans.appen...
false
0.036561
0.034626
1.055886
[ "s378408855", "s723345283" ]