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
u692453235
p02844
python
s253149065
s512770839
446
27
69,100
9,220
Accepted
Accepted
93.95
N = int(eval(input())) S = [int(i) for i in eval(input())] ans = 0 for i in range(10): for j in range(10): for k in range(10): Flag1 = True Flag2 = False Flag3 = False for x in S: if Flag3: if x == k: ans += 1 break if Fla...
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): a = S.find(str(i)) if a == -1: continue for j in range(10): b = S.find(str(j), a+1) if b == -1: continue for k in range(10): c = S.find(str(k), b+1) if c != -1: ans += 1 print(ans)
26
19
494
306
N = int(eval(input())) S = [int(i) for i in eval(input())] ans = 0 for i in range(10): for j in range(10): for k in range(10): Flag1 = True Flag2 = False Flag3 = False for x in S: if Flag3: if x == k: ...
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): a = S.find(str(i)) if a == -1: continue for j in range(10): b = S.find(str(j), a + 1) if b == -1: continue for k in range(10): c = S.find(str(k), b + 1) if c != -1: ...
false
26.923077
[ "-S = [int(i) for i in eval(input())]", "+S = eval(input())", "+ a = S.find(str(i))", "+ if a == -1:", "+ continue", "+ b = S.find(str(j), a + 1)", "+ if b == -1:", "+ continue", "- Flag1 = True", "- Flag2 = False", "- Flag3 ...
false
0.05258
0.032102
1.637921
[ "s253149065", "s512770839" ]
u562935282
p03089
python
s766710276
s617756563
194
22
40,688
3,316
Accepted
Accepted
88.66
import sys sys.setrecursionlimit(10 ** 9) def rec(arr, l, lst): # lstは操作の逆順 # print(arr, l, lst[::-1]) if l == 0: for p in lst[::-1]: print(p) exit() return for i in sorted(list(range(1, l + 1)), reverse=True): # 1-indexed if arr[i-...
from collections import deque N = int(eval(input())) b = list(map(int, input().split())) # 最後に挿入した数字は # k番目のkとなる # 1 2 2 1 2 3 2 # 複数通り該当するときは # 最後の数が該当する # 0 0 3 0 0 6 # 3を取り除くと # 0 0 0 0 6 -> 矛盾 ans = deque() q = deque(enumerate(b, 1)) r = deque() flg = False while q: idx, bb = q.pop()...
32
39
627
618
import sys sys.setrecursionlimit(10**9) def rec(arr, l, lst): # lstは操作の逆順 # print(arr, l, lst[::-1]) if l == 0: for p in lst[::-1]: print(p) exit() return for i in sorted(list(range(1, l + 1)), reverse=True): # 1-indexed if arr[i - 1] == i: ...
from collections import deque N = int(eval(input())) b = list(map(int, input().split())) # 最後に挿入した数字は # k番目のkとなる # 1 2 2 1 2 3 2 # 複数通り該当するときは # 最後の数が該当する # 0 0 3 0 0 6 # 3を取り除くと # 0 0 0 0 6 -> 矛盾 ans = deque() q = deque(enumerate(b, 1)) r = deque() flg = False while q: idx, bb = q.pop() # print(idx, bb, r) ...
false
17.948718
[ "-import sys", "-", "-sys.setrecursionlimit(10**9)", "-", "-", "-def rec(arr, l, lst):", "- # lstは操作の逆順", "- # print(arr, l, lst[::-1])", "- if l == 0:", "- for p in lst[::-1]:", "- print(p)", "- exit()", "- return", "- for i in sorted(list(range...
false
0.042378
0.036386
1.164674
[ "s766710276", "s617756563" ]
u597374218
p03680
python
s927883186
s568377671
199
160
7,084
13,052
Accepted
Accepted
19.6
n=int(eval(input())) a=[int(eval(input())) for i in range(n)] c,s=1,a[0] while s!=2 and c<n:c,s=c+1,a[s-1] print((c if c<n else -1))
N=int(eval(input())) a=[int(eval(input())) for i in range(N)] count=1 button=a[0] while button!=2 and count<N: count+=1 button=a[button-1] print((count if count<N else -1))
5
8
122
174
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] c, s = 1, a[0] while s != 2 and c < n: c, s = c + 1, a[s - 1] print((c if c < n else -1))
N = int(eval(input())) a = [int(eval(input())) for i in range(N)] count = 1 button = a[0] while button != 2 and count < N: count += 1 button = a[button - 1] print((count if count < N else -1))
false
37.5
[ "-n = int(eval(input()))", "-a = [int(eval(input())) for i in range(n)]", "-c, s = 1, a[0]", "-while s != 2 and c < n:", "- c, s = c + 1, a[s - 1]", "-print((c if c < n else -1))", "+N = int(eval(input()))", "+a = [int(eval(input())) for i in range(N)]", "+count = 1", "+button = a[0]", "+whil...
false
0.041112
0.041163
0.998761
[ "s927883186", "s568377671" ]
u384679440
p03274
python
s745491989
s882686733
102
86
14,252
14,384
Accepted
Accepted
15.69
N, K = list(map(int, input().split())) x = list(map(int, input().split())) ans = pow(10, 10) for i in range(N-K+1): temp_l = abs(x[i]) + abs(x[i]-x[i+K-1]) temp_r = abs(x[i+K-1]) + abs(x[i]-x[i+K-1]) ans = min(ans, temp_l, temp_r) print(ans)
N, K = list(map(int, input().split())) a = list(map(int, input().split())) ans = 10 ** 9 for i in range(len(a) - K + 1): l = a[i] r = a[i+K-1] ans = min(ans, abs(l) + abs(r - l), abs(r) + abs(l - r)) print(ans)
8
8
255
217
N, K = list(map(int, input().split())) x = list(map(int, input().split())) ans = pow(10, 10) for i in range(N - K + 1): temp_l = abs(x[i]) + abs(x[i] - x[i + K - 1]) temp_r = abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1]) ans = min(ans, temp_l, temp_r) print(ans)
N, K = list(map(int, input().split())) a = list(map(int, input().split())) ans = 10**9 for i in range(len(a) - K + 1): l = a[i] r = a[i + K - 1] ans = min(ans, abs(l) + abs(r - l), abs(r) + abs(l - r)) print(ans)
false
0
[ "-x = list(map(int, input().split()))", "-ans = pow(10, 10)", "-for i in range(N - K + 1):", "- temp_l = abs(x[i]) + abs(x[i] - x[i + K - 1])", "- temp_r = abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1])", "- ans = min(ans, temp_l, temp_r)", "+a = list(map(int, input().split()))", "+ans = 10**9"...
false
0.060131
0.037532
1.602122
[ "s745491989", "s882686733" ]
u353797797
p02763
python
s524004198
s450615150
1,111
881
172,164
48,412
Accepted
Accepted
20.7
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in ...
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in ...
52
52
1,382
1,498
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [...
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [...
false
0
[ "-class BitSum:", "- def __init__(self, n):", "- self.n = n + 3", "- self.table = [0] * (self.n + 1)", "+class SegTree:", "+ def __init__(self, aa):", "+ n = 1 << (len(aa) - 1).bit_length()", "+ tree = [0] * (2 * n - 1)", "+ tree[n - 1 : n - 1 + len(aa)] = aa...
false
0.036667
0.03713
0.987515
[ "s524004198", "s450615150" ]
u855710796
p02973
python
s453916506
s969814949
417
168
14,608
15,216
Accepted
Accepted
59.71
from collections import deque import bisect N = int(eval(input())) A = [int(eval(input())) for i in range(N)] q = deque([A[0]]) for a in A[1:]: idx = bisect.bisect_left(q, a) if idx == 0: q.appendleft(a) else: q[idx-1] = a print((len(q)))
import bisect N = int(eval(input())) A = [int(eval(input())) for i in range(N)] def lis(S): from bisect import bisect_right L = [S[0]] for s in S[1:]: if s >= L[-1]: L.append(s) else: L[bisect_right(L, s)] = s return len(L) print((lis(A[::-1]))...
17
17
273
307
from collections import deque import bisect N = int(eval(input())) A = [int(eval(input())) for i in range(N)] q = deque([A[0]]) for a in A[1:]: idx = bisect.bisect_left(q, a) if idx == 0: q.appendleft(a) else: q[idx - 1] = a print((len(q)))
import bisect N = int(eval(input())) A = [int(eval(input())) for i in range(N)] def lis(S): from bisect import bisect_right L = [S[0]] for s in S[1:]: if s >= L[-1]: L.append(s) else: L[bisect_right(L, s)] = s return len(L) print((lis(A[::-1])))
false
0
[ "-from collections import deque", "-q = deque([A[0]])", "-for a in A[1:]:", "- idx = bisect.bisect_left(q, a)", "- if idx == 0:", "- q.appendleft(a)", "- else:", "- q[idx - 1] = a", "-print((len(q)))", "+", "+", "+def lis(S):", "+ from bisect import bisect_right", ...
false
0.072865
0.043023
1.693622
[ "s453916506", "s969814949" ]
u429029348
p02606
python
s948252413
s425995654
29
23
9,068
9,052
Accepted
Accepted
20.69
l,r,d=list(map(int,input().split())) cnt=0 for i in range(l,r+1): for j in range(1,101): if d*j==i: cnt+=1 break print(cnt)
l, r, d = list(map(int, input().split())) ans = r // d - (l - 1) // d print(ans)
9
5
148
81
l, r, d = list(map(int, input().split())) cnt = 0 for i in range(l, r + 1): for j in range(1, 101): if d * j == i: cnt += 1 break print(cnt)
l, r, d = list(map(int, input().split())) ans = r // d - (l - 1) // d print(ans)
false
44.444444
[ "-cnt = 0", "-for i in range(l, r + 1):", "- for j in range(1, 101):", "- if d * j == i:", "- cnt += 1", "- break", "-print(cnt)", "+ans = r // d - (l - 1) // d", "+print(ans)" ]
false
0.04101
0.040156
1.021285
[ "s948252413", "s425995654" ]
u557792847
p02633
python
s539137203
s463157818
29
26
8,948
9,156
Accepted
Accepted
10.34
import math X = int(eval(input())) lcm = 360 * X // math.gcd(360, X) print((lcm // X))
import math X = int(eval(input())) # lcm = 360 * X // math.gcd(360, X) print((360 // math.gcd(360, X)))
4
4
81
98
import math X = int(eval(input())) lcm = 360 * X // math.gcd(360, X) print((lcm // X))
import math X = int(eval(input())) # lcm = 360 * X // math.gcd(360, X) print((360 // math.gcd(360, X)))
false
0
[ "-lcm = 360 * X // math.gcd(360, X)", "-print((lcm // X))", "+# lcm = 360 * X // math.gcd(360, X)", "+print((360 // math.gcd(360, X)))" ]
false
0.039096
0.038391
1.018368
[ "s539137203", "s463157818" ]
u884323674
p04001
python
s016441119
s704874177
19
17
3,060
3,060
Accepted
Accepted
10.53
S = eval(input()) def div_plus(i, s): if i == len(S): s_list = [int(i) for i in s.split("+")] return sum(s_list) pos = i - len(S) # プラスを挿入しない場合 d1 = div_plus(i+1, s) # プラスを挿入する場合 d2 = div_plus(i+1, s[:pos]+"+"+s[pos:]) return d1 + d2 print((div_plus...
S = eval(input()) def rec(n, s): if n == 1: ans = 0 for i in s.split("+"): ans += int(i) return ans # 文字列の後ろからn番目に"+"を入れるか否か return rec(n-1, s) + rec(n-1, s[:-n+1]+"+"+s[-n+1:]) print((rec(len(S), S)))
16
13
320
260
S = eval(input()) def div_plus(i, s): if i == len(S): s_list = [int(i) for i in s.split("+")] return sum(s_list) pos = i - len(S) # プラスを挿入しない場合 d1 = div_plus(i + 1, s) # プラスを挿入する場合 d2 = div_plus(i + 1, s[:pos] + "+" + s[pos:]) return d1 + d2 print((div_plus(1, S)))
S = eval(input()) def rec(n, s): if n == 1: ans = 0 for i in s.split("+"): ans += int(i) return ans # 文字列の後ろからn番目に"+"を入れるか否か return rec(n - 1, s) + rec(n - 1, s[: -n + 1] + "+" + s[-n + 1 :]) print((rec(len(S), S)))
false
18.75
[ "-def div_plus(i, s):", "- if i == len(S):", "- s_list = [int(i) for i in s.split(\"+\")]", "- return sum(s_list)", "- pos = i - len(S)", "- # プラスを挿入しない場合", "- d1 = div_plus(i + 1, s)", "- # プラスを挿入する場合", "- d2 = div_plus(i + 1, s[:pos] + \"+\" + s[pos:])", "- ret...
false
0.04911
0.047358
1.037002
[ "s016441119", "s704874177" ]
u703528810
p02665
python
s381607703
s263731280
148
121
20,868
20,140
Accepted
Accepted
18.24
N=int(eval(input())) A=list(map(int,input().split())) node=[1 for _ in range(N+1)] Sn=sum(A) S=[Sn] for s in range(N): S.append(S[s]-A[s+1]) ans=1 for i in range(1,N+1): if node[i-1]*2<=S[i-1]: ans+=node[i-1]*2 node[i]=node[i-1]*2 elif node[i-1]<=S[i-1]<node[i-1]*2: no...
N=int(eval(input())) A=list(map(int,input().split())) node=[1 for _ in range(N+1)] #深さiで、葉にならない頂点の個数node[i] S=sum(A) #生産しなければならない葉の枚数の合計 ans=1 #深さ0である根は最初にカウントする #深さiの時点であと何枚の葉が必要か計算しつつ、必要な分だけノードを生産する #ノードの個数がその時点でのSまで届いたら、あとは各頂点が1つずつノードを生産し、 #各層でA[i]個のノードが生産を止めて葉となる for i in range(1,N+1): if node[i-1...
27
29
489
820
N = int(eval(input())) A = list(map(int, input().split())) node = [1 for _ in range(N + 1)] Sn = sum(A) S = [Sn] for s in range(N): S.append(S[s] - A[s + 1]) ans = 1 for i in range(1, N + 1): if node[i - 1] * 2 <= S[i - 1]: ans += node[i - 1] * 2 node[i] = node[i - 1] * 2 elif node[i - 1] <=...
N = int(eval(input())) A = list(map(int, input().split())) node = [1 for _ in range(N + 1)] # 深さiで、葉にならない頂点の個数node[i] S = sum(A) # 生産しなければならない葉の枚数の合計 ans = 1 # 深さ0である根は最初にカウントする # 深さiの時点であと何枚の葉が必要か計算しつつ、必要な分だけノードを生産する # ノードの個数がその時点でのSまで届いたら、あとは各頂点が1つずつノードを生産し、 # 各層でA[i]個のノードが生産を止めて葉となる for i in range(1, N + 1): ...
false
6.896552
[ "-node = [1 for _ in range(N + 1)]", "-Sn = sum(A)", "-S = [Sn]", "-for s in range(N):", "- S.append(S[s] - A[s + 1])", "-ans = 1", "+node = [1 for _ in range(N + 1)] # 深さiで、葉にならない頂点の個数node[i]", "+S = sum(A) # 生産しなければならない葉の枚数の合計", "+ans = 1 # 深さ0である根は最初にカウントする", "+# 深さiの時点であと何枚の葉が必要か計算しつつ、必要...
false
0.075782
0.107547
0.704642
[ "s381607703", "s263731280" ]
u327466606
p03460
python
s555762203
s262249417
1,451
995
78,820
153,100
Accepted
Accepted
31.43
N,K = list(map(int,input().split())) import numpy as np m = np.zeros((3*K,3*K), dtype=np.int32) offset = 0 for _ in range(N): x,y,c = input().split() x,y = int(x),int(y) x %= 2*K y %= 2*K if c == 'B': m[x,y] += 1 else: m[x,y] -= 1 offset += 1 K2 = 2*K m[K2:,:K2] = m[:K,:K2...
import numpy as np N,K=list(map(int,input().split())) m=np.zeros((3*K,3*K),dtype=int) L=2*K o=0 for _ in [0]*N: x,y,c=input().split() x,y=int(x)%L,int(y)%L t=c=='W' m[x,y]+=1-2*t o+=t for _ in [0,0]: m[L:]=m[:K] m=np.cumsum(m,axis=0) m[:L]=m[K:]-m[:L] m=m.T m=m[:L,:L] print((o+(m+np.roll(np.ro...
31
18
586
345
N, K = list(map(int, input().split())) import numpy as np m = np.zeros((3 * K, 3 * K), dtype=np.int32) offset = 0 for _ in range(N): x, y, c = input().split() x, y = int(x), int(y) x %= 2 * K y %= 2 * K if c == "B": m[x, y] += 1 else: m[x, y] -= 1 offset += 1 K2 = 2 * K ...
import numpy as np N, K = list(map(int, input().split())) m = np.zeros((3 * K, 3 * K), dtype=int) L = 2 * K o = 0 for _ in [0] * N: x, y, c = input().split() x, y = int(x) % L, int(y) % L t = c == "W" m[x, y] += 1 - 2 * t o += t for _ in [0, 0]: m[L:] = m[:K] m = np.cumsum(m, axis=0) m[...
false
41.935484
[ "-N, K = list(map(int, input().split()))", "-m = np.zeros((3 * K, 3 * K), dtype=np.int32)", "-offset = 0", "-for _ in range(N):", "+N, K = list(map(int, input().split()))", "+m = np.zeros((3 * K, 3 * K), dtype=int)", "+L = 2 * K", "+o = 0", "+for _ in [0] * N:", "- x, y = int(x), int(y)", "- ...
false
0.201327
0.392396
0.513071
[ "s555762203", "s262249417" ]
u255555420
p03611
python
s256534147
s741469110
93
76
30,024
13,964
Accepted
Accepted
18.28
from collections import Counter N=int(eval(input())) a=list(map(int,input().split())) b=[x+1for x in a] c=[x-1for x in a] d=a+b+c print((max(Counter(d).values())))
N=int(eval(input())) a_list=list(map(int,input().split())) count = [0]*100002 for a in a_list: count[a] += 1 count[a+1] += 1 count[a+2] += 1 print((max(count)))
11
11
169
182
from collections import Counter N = int(eval(input())) a = list(map(int, input().split())) b = [x + 1 for x in a] c = [x - 1 for x in a] d = a + b + c print((max(Counter(d).values())))
N = int(eval(input())) a_list = list(map(int, input().split())) count = [0] * 100002 for a in a_list: count[a] += 1 count[a + 1] += 1 count[a + 2] += 1 print((max(count)))
false
0
[ "-from collections import Counter", "-", "-a = list(map(int, input().split()))", "-b = [x + 1 for x in a]", "-c = [x - 1 for x in a]", "-d = a + b + c", "-print((max(Counter(d).values())))", "+a_list = list(map(int, input().split()))", "+count = [0] * 100002", "+for a in a_list:", "+ count[a]...
false
0.041305
0.048471
0.852162
[ "s256534147", "s741469110" ]
u281610856
p03161
python
s221720872
s936409390
493
427
56,320
56,228
Accepted
Accepted
13.39
INF = float('inf') dp = [INF] * (10**5 + 10) dp[0] = 0 h = [0] * (10 ** 4) N, K = list(map(int, input().split())) h = list(map(int, input().split())) + h for i in range(1, N+1): for k in range(1, K+1): if i - k >= 0: dp[i] = min(dp[i], dp[i-k] + abs(h[i] - h[i-k])) print((dp[N-1]))
INF = float('inf') dp = [INF] * (10**5 + 10) dp[0] = 0 h = [0] * (10 ** 4) N, K = list(map(int, input().split())) h = list(map(int, input().split())) + h for i in range(N): for k in range(1, K+1): if i + k < N: dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k])) else: ...
11
13
309
338
INF = float("inf") dp = [INF] * (10**5 + 10) dp[0] = 0 h = [0] * (10**4) N, K = list(map(int, input().split())) h = list(map(int, input().split())) + h for i in range(1, N + 1): for k in range(1, K + 1): if i - k >= 0: dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k])) print((dp[N - 1]))
INF = float("inf") dp = [INF] * (10**5 + 10) dp[0] = 0 h = [0] * (10**4) N, K = list(map(int, input().split())) h = list(map(int, input().split())) + h for i in range(N): for k in range(1, K + 1): if i + k < N: dp[i + k] = min(dp[i + k], dp[i] + abs(h[i] - h[i + k])) else: br...
false
15.384615
[ "-for i in range(1, N + 1):", "+for i in range(N):", "- if i - k >= 0:", "- dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k]))", "+ if i + k < N:", "+ dp[i + k] = min(dp[i + k], dp[i] + abs(h[i] - h[i + k]))", "+ else:", "+ break" ]
false
0.069813
0.071756
0.972919
[ "s221720872", "s936409390" ]
u309977459
p03201
python
s224731756
s871493970
561
501
39,868
39,868
Accepted
Accepted
10.7
import bisect from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) A.sort() two_bekis = [] tmp = 1 while tmp < 2*10**9: two_bekis.append(tmp) tmp *= 2 ans = 0 cnt = Counter(A) seta = set(A) for i, a in enumerate(reversed(A)): idx = bisect.bisect_ri...
import bisect from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) A.sort() two_bekis = [2**i for i in range(31)] ans = 0 cnt = Counter(A) seta = set(A) for i, a in enumerate(reversed(A)): b = two_bekis[bisect.bisect_right(two_bekis, a)] - a if b not in set...
32
25
621
530
import bisect from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) A.sort() two_bekis = [] tmp = 1 while tmp < 2 * 10**9: two_bekis.append(tmp) tmp *= 2 ans = 0 cnt = Counter(A) seta = set(A) for i, a in enumerate(reversed(A)): idx = bisect.bisect_right(two_bekis, a) ...
import bisect from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) A.sort() two_bekis = [2**i for i in range(31)] ans = 0 cnt = Counter(A) seta = set(A) for i, a in enumerate(reversed(A)): b = two_bekis[bisect.bisect_right(two_bekis, a)] - a if b not in seta: conti...
false
21.875
[ "-two_bekis = []", "-tmp = 1", "-while tmp < 2 * 10**9:", "- two_bekis.append(tmp)", "- tmp *= 2", "+two_bekis = [2**i for i in range(31)]", "- idx = bisect.bisect_right(two_bekis, a)", "- two_beki = two_bekis[idx]", "- b = two_beki - a", "+ b = two_bekis[bisect.bisect_right(two_...
false
0.09439
0.047149
2.001928
[ "s224731756", "s871493970" ]
u693953100
p02681
python
s939247437
s759700067
23
19
9,024
9,100
Accepted
Accepted
17.39
def solve(): s = eval(input()) t = eval(input()) if s == t[:-1]: print('Yes') else: print('No') if __name__ == '__main__': solve()
s = eval(input()) t = eval(input()) if s == t[:-1]: print('Yes') else: print('No')
11
6
167
84
def solve(): s = eval(input()) t = eval(input()) if s == t[:-1]: print("Yes") else: print("No") if __name__ == "__main__": solve()
s = eval(input()) t = eval(input()) if s == t[:-1]: print("Yes") else: print("No")
false
45.454545
[ "-def solve():", "- s = eval(input())", "- t = eval(input())", "- if s == t[:-1]:", "- print(\"Yes\")", "- else:", "- print(\"No\")", "-", "-", "-if __name__ == \"__main__\":", "- solve()", "+s = eval(input())", "+t = eval(input())", "+if s == t[:-1]:", "+ ...
false
0.043021
0.044666
0.963181
[ "s939247437", "s759700067" ]
u923279197
p03106
python
s153432483
s470743661
307
39
66,156
5,432
Accepted
Accepted
87.3
import fractions a,b,k = list(map(int,input().split())) q = fractions.gcd(a,b) count = 0 for i in range(q,-1,-1): if q%i == 0: count += 1 if count == k: print(i) exit()
from fractions import gcd a,b,k = list(map(int,input().split())) x = gcd(a,b) now = 1 if now == k: print(x) exit() for i in range(x-1,-1,-1): if x%i == 0:now += 1 if now == k: print(i) exit()
10
12
215
228
import fractions a, b, k = list(map(int, input().split())) q = fractions.gcd(a, b) count = 0 for i in range(q, -1, -1): if q % i == 0: count += 1 if count == k: print(i) exit()
from fractions import gcd a, b, k = list(map(int, input().split())) x = gcd(a, b) now = 1 if now == k: print(x) exit() for i in range(x - 1, -1, -1): if x % i == 0: now += 1 if now == k: print(i) exit()
false
16.666667
[ "-import fractions", "+from fractions import gcd", "-q = fractions.gcd(a, b)", "-count = 0", "-for i in range(q, -1, -1):", "- if q % i == 0:", "- count += 1", "- if count == k:", "- print(i)", "- exit()", "+x = gcd(a, b)", "+now = 1", "+if now == k:", ...
false
0.059232
0.044541
1.32982
[ "s153432483", "s470743661" ]
u094999522
p03341
python
s532345742
s718596348
143
130
9,748
9,696
Accepted
Accepted
9.09
#!/usr/bin/env python3 n = int(eval(input())) s = eval(input()) w = 0 e = s.count("E") ans = 10**6 for i in s: e -= i == "E" ans = min(ans, e + w) w += i == "W" print(ans)
n = int(eval(input())) s = eval(input()) e = s.count("E") ans = 10**6 for i in s: e -= i == "E" ans = min(ans, e) e += i == "W" print(ans)
11
9
182
147
#!/usr/bin/env python3 n = int(eval(input())) s = eval(input()) w = 0 e = s.count("E") ans = 10**6 for i in s: e -= i == "E" ans = min(ans, e + w) w += i == "W" print(ans)
n = int(eval(input())) s = eval(input()) e = s.count("E") ans = 10**6 for i in s: e -= i == "E" ans = min(ans, e) e += i == "W" print(ans)
false
18.181818
[ "-#!/usr/bin/env python3", "-w = 0", "- ans = min(ans, e + w)", "- w += i == \"W\"", "+ ans = min(ans, e)", "+ e += i == \"W\"" ]
false
0.062563
0.039747
1.574032
[ "s532345742", "s718596348" ]
u512212329
p02689
python
s994427662
s003697698
342
234
38,976
20,048
Accepted
Accepted
31.58
def main(): n, m = [int(x) for x in input().split()] heights = tuple(int(x) for x in input().split()) adjacents_heights = [set() for _ in range(n)] for i in range(m): a, b = [int(x) - 1 for x in input().split()] adjacents_heights[a].add(heights[b]) adjacents_heights[b].add...
def main(): n, m = [int(x) for x in input().split()] heights = tuple(int(x) for x in input().split()) checked = [1] * n for i in range(m): a, b = [int(x) - 1 for x in input().split()] h_a = heights[a] h_b = heights[b] if h_a < h_b: checked[a] = 0 ...
21
21
582
518
def main(): n, m = [int(x) for x in input().split()] heights = tuple(int(x) for x in input().split()) adjacents_heights = [set() for _ in range(n)] for i in range(m): a, b = [int(x) - 1 for x in input().split()] adjacents_heights[a].add(heights[b]) adjacents_heights[b].add(height...
def main(): n, m = [int(x) for x in input().split()] heights = tuple(int(x) for x in input().split()) checked = [1] * n for i in range(m): a, b = [int(x) - 1 for x in input().split()] h_a = heights[a] h_b = heights[b] if h_a < h_b: checked[a] = 0 elif ...
false
0
[ "- adjacents_heights = [set() for _ in range(n)]", "+ checked = [1] * n", "- adjacents_heights[a].add(heights[b])", "- adjacents_heights[b].add(heights[a])", "- ans = 0", "- for h, ahs in zip(heights, adjacents_heights):", "- if not ahs:", "- ans += 1", "-...
false
0.095046
0.077495
1.226472
[ "s994427662", "s003697698" ]
u618251217
p02708
python
s862948999
s423402076
108
71
9,016
9,112
Accepted
Accepted
34.26
N,K = list(map(int, input().split())) div = 10**9 + 7 ans = 0 for i in range(K, N+2): ans += i + N*i - i**2 + 1 print((ans%div))
N,K = list(map(int, input().split())) div = 10**9 + 7 ans = 0 for p in range(K,N+2): ans += p * (N - p + 1) + 1 print((ans%div))
6
7
129
135
N, K = list(map(int, input().split())) div = 10**9 + 7 ans = 0 for i in range(K, N + 2): ans += i + N * i - i**2 + 1 print((ans % div))
N, K = list(map(int, input().split())) div = 10**9 + 7 ans = 0 for p in range(K, N + 2): ans += p * (N - p + 1) + 1 print((ans % div))
false
14.285714
[ "-for i in range(K, N + 2):", "- ans += i + N * i - i**2 + 1", "+for p in range(K, N + 2):", "+ ans += p * (N - p + 1) + 1" ]
false
0.085213
0.053657
1.588107
[ "s862948999", "s423402076" ]
u065099501
p03449
python
s036782792
s692029938
33
30
9,184
9,184
Accepted
Accepted
9.09
n = int(eval(input())) a = [list(map(int,input().split())) for _ in range(2)] print((max((sum(a[0][:i+1] + a[1][i:])) for i in range(n))))
n = int(eval(input())) a = [list(map(int,input().split())) for _ in range(2)] print((max(sum(a[0][:i+1] + a[1][i:]) for i in range(n))))
3
3
132
130
n = int(eval(input())) a = [list(map(int, input().split())) for _ in range(2)] print((max((sum(a[0][: i + 1] + a[1][i:])) for i in range(n))))
n = int(eval(input())) a = [list(map(int, input().split())) for _ in range(2)] print((max(sum(a[0][: i + 1] + a[1][i:]) for i in range(n))))
false
0
[ "-print((max((sum(a[0][: i + 1] + a[1][i:])) for i in range(n))))", "+print((max(sum(a[0][: i + 1] + a[1][i:]) for i in range(n))))" ]
false
0.035189
0.045985
0.765223
[ "s036782792", "s692029938" ]
u903005414
p03731
python
s262805232
s198171158
398
125
34,144
26,832
Accepted
Accepted
68.59
import numpy as np N, T = list(map(int, input().split())) t = np.array(list(map(int, input().split()))) ends = t + T # print('t', t) # print('ends', ends) # print('ends > t', ends[:-1] > t[1:]) con = ends[:-1] > t[1:] v = 0 for i in range(N - 1): if con[i]: continue else: v += t[i...
N, T = list(map(int, input().split())) t = list(map(int, input().split())) v = 0 for i in range(N - 1): diff = t[i + 1] - (t[i] + T) if diff > 0: v += diff ans = t[-1] + T - v print(ans)
17
9
362
205
import numpy as np N, T = list(map(int, input().split())) t = np.array(list(map(int, input().split()))) ends = t + T # print('t', t) # print('ends', ends) # print('ends > t', ends[:-1] > t[1:]) con = ends[:-1] > t[1:] v = 0 for i in range(N - 1): if con[i]: continue else: v += t[i + 1] - ends[i...
N, T = list(map(int, input().split())) t = list(map(int, input().split())) v = 0 for i in range(N - 1): diff = t[i + 1] - (t[i] + T) if diff > 0: v += diff ans = t[-1] + T - v print(ans)
false
47.058824
[ "-import numpy as np", "-", "-t = np.array(list(map(int, input().split())))", "-ends = t + T", "-# print('t', t)", "-# print('ends', ends)", "-# print('ends > t', ends[:-1] > t[1:])", "-con = ends[:-1] > t[1:]", "+t = list(map(int, input().split()))", "- if con[i]:", "- continue", "-...
false
0.236438
0.036529
6.472548
[ "s262805232", "s198171158" ]
u952708174
p03053
python
s596942150
s713802353
463
362
111,080
47,808
Accepted
Accepted
21.81
def a_darker_and_darker(H, W, Grid): def is_in_field(row, col): return (0 <= row < H) and (0 <= col < W) grid, q = [[None] * W for _ in range(H)], [] # 黒マスがどこにあるかを調べる。ついでにgridを初期化 for row in range(H): for col in range(W): if Grid[row][col] == '#': gr...
# 参考: https://atcoder.jp/contests/agc033/submissions/5279051 def a_darker_and_darker(H, W, Grid): from scipy.ndimage import distance_transform_cdt # 2次元リストの各位置に対して、Falseとみなされる要素がある位置から # 最短の距離が格納された2次元リストを返す # 距離の測り方は、metricが'taxicab'だとマンハッタン距離に、 # 'chessboard'だとチェビシェフ距離に基づく grid = [[1 ...
33
14
1,073
554
def a_darker_and_darker(H, W, Grid): def is_in_field(row, col): return (0 <= row < H) and (0 <= col < W) grid, q = [[None] * W for _ in range(H)], [] # 黒マスがどこにあるかを調べる。ついでにgridを初期化 for row in range(H): for col in range(W): if Grid[row][col] == "#": grid[row][c...
# 参考: https://atcoder.jp/contests/agc033/submissions/5279051 def a_darker_and_darker(H, W, Grid): from scipy.ndimage import distance_transform_cdt # 2次元リストの各位置に対して、Falseとみなされる要素がある位置から # 最短の距離が格納された2次元リストを返す # 距離の測り方は、metricが'taxicab'だとマンハッタン距離に、 # 'chessboard'だとチェビシェフ距離に基づく grid = [[1 if c == ...
false
57.575758
[ "+# 参考: https://atcoder.jp/contests/agc033/submissions/5279051", "- def is_in_field(row, col):", "- return (0 <= row < H) and (0 <= col < W)", "+ from scipy.ndimage import distance_transform_cdt", "- grid, q = [[None] * W for _ in range(H)], []", "- # 黒マスがどこにあるかを調べる。ついでにgridを初期化", "- ...
false
0.032441
0.035592
0.911456
[ "s596942150", "s713802353" ]
u790710233
p03273
python
s627823357
s167579965
21
18
4,596
3,188
Accepted
Accepted
14.29
h, w = map(int, input().split()) m = [list(input()) for _ in range(h)] row_idx = [] for idx, row in enumerate(m): if not row.count('#'): row_idx.append(idx) col_idx = [] for idx, col in enumerate(zip(*m)): if not col.count('#'): col_idx.append(idx) for i, row in enumerate(m): ...
h, w = map(int, input().split()) m = [list(input()) for _ in range(h)] mr = [r for r in m if '#' in r] mrc = [c for c in zip(*mr) if '#' in c] print(*(''.join(row) for row in zip(*mrc)), sep='\n')
20
5
458
200
h, w = map(int, input().split()) m = [list(input()) for _ in range(h)] row_idx = [] for idx, row in enumerate(m): if not row.count("#"): row_idx.append(idx) col_idx = [] for idx, col in enumerate(zip(*m)): if not col.count("#"): col_idx.append(idx) for i, row in enumerate(m): if i in row_idx...
h, w = map(int, input().split()) m = [list(input()) for _ in range(h)] mr = [r for r in m if "#" in r] mrc = [c for c in zip(*mr) if "#" in c] print(*("".join(row) for row in zip(*mrc)), sep="\n")
false
75
[ "-row_idx = []", "-for idx, row in enumerate(m):", "- if not row.count(\"#\"):", "- row_idx.append(idx)", "-col_idx = []", "-for idx, col in enumerate(zip(*m)):", "- if not col.count(\"#\"):", "- col_idx.append(idx)", "-for i, row in enumerate(m):", "- if i in row_idx:", "...
false
0.037319
0.035353
1.05561
[ "s627823357", "s167579965" ]
u714300041
p03998
python
s876985419
s864183975
34
21
3,444
3,316
Accepted
Accepted
38.24
from collections import deque A = deque(list(eval(input()))) B = deque(list(eval(input()))) C = deque(list(eval(input()))) def main(A, B, C): u = A.popleft() while True: if u == "a": if len(A) == 0: return "A" u = A.popleft() elif u == "b": ...
from collections import deque A = deque(eval(input())) B = deque(eval(input())) C = deque(eval(input())) def main(A, B, C): u = A.popleft() while True: if u == "a": if len(A) == 0: return "A" u = A.popleft() elif u == "b": if le...
24
24
515
497
from collections import deque A = deque(list(eval(input()))) B = deque(list(eval(input()))) C = deque(list(eval(input()))) def main(A, B, C): u = A.popleft() while True: if u == "a": if len(A) == 0: return "A" u = A.popleft() elif u == "b": ...
from collections import deque A = deque(eval(input())) B = deque(eval(input())) C = deque(eval(input())) def main(A, B, C): u = A.popleft() while True: if u == "a": if len(A) == 0: return "A" u = A.popleft() elif u == "b": if len(B) == 0: ...
false
0
[ "-A = deque(list(eval(input())))", "-B = deque(list(eval(input())))", "-C = deque(list(eval(input())))", "+A = deque(eval(input()))", "+B = deque(eval(input()))", "+C = deque(eval(input()))" ]
false
0.04595
0.086458
0.53147
[ "s876985419", "s864183975" ]
u595375942
p02882
python
s268890773
s257280708
19
17
3,188
3,060
Accepted
Accepted
10.53
import math a, b, x = list(map(int, input().split())) c = (2*x)/(a**2)-b if c <= 0: c = (2*x)/(a*b) print((math.degrees(math.atan2(b, c)))) else: print((math.degrees(math.atan2(b-c, a))))
import math a, b, x = list(map(int, input().split())) if a**2*b >= 2*x: c = (2*x)/(a*b) print((math.degrees(math.atan(b/c)))) else: d = 2*(b-x/a/a) print((math.degrees(math.atan(d/a))))
8
8
196
198
import math a, b, x = list(map(int, input().split())) c = (2 * x) / (a**2) - b if c <= 0: c = (2 * x) / (a * b) print((math.degrees(math.atan2(b, c)))) else: print((math.degrees(math.atan2(b - c, a))))
import math a, b, x = list(map(int, input().split())) if a**2 * b >= 2 * x: c = (2 * x) / (a * b) print((math.degrees(math.atan(b / c)))) else: d = 2 * (b - x / a / a) print((math.degrees(math.atan(d / a))))
false
0
[ "-c = (2 * x) / (a**2) - b", "-if c <= 0:", "+if a**2 * b >= 2 * x:", "- print((math.degrees(math.atan2(b, c))))", "+ print((math.degrees(math.atan(b / c))))", "- print((math.degrees(math.atan2(b - c, a))))", "+ d = 2 * (b - x / a / a)", "+ print((math.degrees(math.atan(d / a))))" ]
false
0.101314
0.040554
2.498228
[ "s268890773", "s257280708" ]
u124605948
p03048
python
s199116426
s673947394
1,274
1,111
9,108
9,144
Accepted
Accepted
12.79
def main(): R, G, B, N = list(map(int, input().split())) cnt = 0 for r in range(N//R+1): for g in range(N//G+1): res = N - (r*R+g*G) if res >= 0 and res % B == 0: cnt += 1 print(cnt) main()
def main(): R, G, B, N = list(map(int, input().split())) cnt = 0 for r in range(N//R+1): if r*R > N: break for g in range(N//G+1): if r*R + g*G > N: break res = N - (r*R+g*G) if res % B == 0: cnt += 1 print(cnt) main()
12
14
260
311
def main(): R, G, B, N = list(map(int, input().split())) cnt = 0 for r in range(N // R + 1): for g in range(N // G + 1): res = N - (r * R + g * G) if res >= 0 and res % B == 0: cnt += 1 print(cnt) main()
def main(): R, G, B, N = list(map(int, input().split())) cnt = 0 for r in range(N // R + 1): if r * R > N: break for g in range(N // G + 1): if r * R + g * G > N: break res = N - (r * R + g * G) if res % B == 0: ...
false
14.285714
[ "+ if r * R > N:", "+ break", "+ if r * R + g * G > N:", "+ break", "- if res >= 0 and res % B == 0:", "+ if res % B == 0:" ]
false
0.168652
0.007966
21.171139
[ "s199116426", "s673947394" ]
u883048396
p04013
python
s115983268
s759057518
25
21
3,444
3,188
Accepted
Accepted
16
def 解(): iN,iA =[int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x ] aMinus = [-1 * x for x in aX if x < 0 ] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLenPlus - iLenMinus iCZero = 2**iLen0 - 1 #sum(k=...
#正負で分割 #dpの作り方はARCの方の人のロジックを参考にした。 #こんなんでええんや... def 解(): iN,iA =[int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x ] aMinus = [-1 * x for x in aX if x < 0 ] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLenP...
44
33
1,390
942
def 解(): iN, iA = [int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x] aMinus = [-1 * x for x in aX if x < 0] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLenPlus - iLenMinus iCZero = 2**iLen0 - 1 # sum(k=1..N){nCk...
# 正負で分割 # dpの作り方はARCの方の人のロジックを参考にした。 # こんなんでええんや... def 解(): iN, iA = [int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x] aMinus = [-1 * x for x in aX if x < 0] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLenPlus - iL...
false
25
[ "+# 正負で分割", "+# dpの作り方はARCの方の人のロジックを参考にした。", "+# こんなんでええんや...", "- iSumPlus = sum(aPlus)", "- iSumMinus = sum(aMinus)", "- iUlim = min(iSumPlus, iSumMinus)", "- iOlim = max(iSumPlus, iSumMinus)", "+ iUlim = min(sum(aPlus), sum(aMinus))", "- dp1 = [[0] * (iOlim + 1) for _ in ran...
false
0.255532
0.071717
3.563057
[ "s115983268", "s759057518" ]
u945181840
p02920
python
s009834602
s346096587
1,720
1,100
33,124
34,676
Accepted
Accepted
36.05
N = int(eval(input())) S = list(map(int, input().split())) INF = 10 ** 10 S.sort() parents = [S[-1]] S[-1] = INF from_here = 1 for _ in range(N): checking = from_here first = True parents.sort(reverse=True) for i in parents[:]: while True: if S[-checking] < i and f...
def main(): N = int(eval(input())) S = list(map(int, input().split())) INF = float('inf') S.sort() parents = [S[-1]] S[-1] = INF for _ in range(N): checking = 2 parents.sort(reverse=True) for i in parents[:]: while True: i...
33
30
806
690
N = int(eval(input())) S = list(map(int, input().split())) INF = 10**10 S.sort() parents = [S[-1]] S[-1] = INF from_here = 1 for _ in range(N): checking = from_here first = True parents.sort(reverse=True) for i in parents[:]: while True: if S[-checking] < i and first: ...
def main(): N = int(eval(input())) S = list(map(int, input().split())) INF = float("inf") S.sort() parents = [S[-1]] S[-1] = INF for _ in range(N): checking = 2 parents.sort(reverse=True) for i in parents[:]: while True: if S[-checking] < i...
false
9.090909
[ "-N = int(eval(input()))", "-S = list(map(int, input().split()))", "-INF = 10**10", "-S.sort()", "-parents = [S[-1]]", "-S[-1] = INF", "-from_here = 1", "-for _ in range(N):", "- checking = from_here", "- first = True", "- parents.sort(reverse=True)", "- for i in parents[:]:", "-...
false
0.047126
0.046192
1.02022
[ "s009834602", "s346096587" ]
u864197622
p02710
python
s089449294
s940481285
577
489
158,544
160,140
Accepted
Accepted
15.25
import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) C = [int(a) - 1 for a in input().split()] X = [[] for i in range(N)] for i in range(N-1): x, y = map(int, input().split()) x, y = x-1, y-1 X[x].append(y) X[y].append(x) def EulerTour(n, X, i0): def f(k): ...
import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) C = [int(a) - 1 for a in input().split()] X = [[] for i in range(N)] for i in range(N-1): x, y = map(int, input().split()) X[x-1].append(y-1) X[y-1].append(x-1) def EulerTour(n, X, i0): f = lambda k: k * (k + 1) // 2 ...
63
51
1,614
1,349
import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) C = [int(a) - 1 for a in input().split()] X = [[] for i in range(N)] for i in range(N - 1): x, y = map(int, input().split()) x, y = x - 1, y - 1 X[x].append(y) X[y].append(x) def EulerTour(n, X, i0): def f(k): retur...
import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) C = [int(a) - 1 for a in input().split()] X = [[] for i in range(N)] for i in range(N - 1): x, y = map(int, input().split()) X[x - 1].append(y - 1) X[y - 1].append(x - 1) def EulerTour(n, X, i0): f = lambda k: k * (k + 1) // 2 ...
false
19.047619
[ "- x, y = x - 1, y - 1", "- X[x].append(y)", "- X[y].append(x)", "+ X[x - 1].append(y - 1)", "+ X[y - 1].append(x - 1)", "- def f(k):", "- return k * (k + 1) // 2", "-", "+ f = lambda k: k * (k + 1) // 2", "- USEDORG = [0] * n", "- USEDTMP = [0] * n", "+ OR...
false
0.037866
0.058204
0.650583
[ "s089449294", "s940481285" ]
u612721349
p03337
python
s556576247
s358604609
19
17
3,060
2,940
Accepted
Accepted
10.53
print(((lambda x:max(eval(x[0]+c+x[1])for c in"*+-"))(input().split())))
x,y=input().split();print((max(eval(x+c+y)for c in"*+-")))
1
1
70
56
print(((lambda x: max(eval(x[0] + c + x[1]) for c in "*+-"))(input().split())))
x, y = input().split() print((max(eval(x + c + y) for c in "*+-")))
false
0
[ "-print(((lambda x: max(eval(x[0] + c + x[1]) for c in \"*+-\"))(input().split())))", "+x, y = input().split()", "+print((max(eval(x + c + y) for c in \"*+-\")))" ]
false
0.051331
0.051147
1.003601
[ "s556576247", "s358604609" ]
u864197622
p03685
python
s617261451
s605084444
883
671
120,916
88,280
Accepted
Accepted
24.01
import sys input = lambda: sys.stdin.readline().rstrip() R, C, N = list(map(int, input().split())) X = {0, R} Y = {0, C} Z = [] for i in range(N): x1, y1, x2, y2 = list(map(int, input().split())) if (x1 == 0 or x1 == R or y1 == 0 or y1 == C) and (x2 == 0 or x2 == R or y2 == 0 or y2 == C): Z.a...
import sys input = lambda: sys.stdin.readline().rstrip() def calc(a, b): if b == 0: return a if a == R: return b + R if b == C: return R + C + (R - a) if a == 0: return R + C + R + (C - b) R, C, N = list(map(int, input().split())) A = [] for i in range(N): x1, y1, x2, y2 = list(map(int...
47
28
1,117
721
import sys input = lambda: sys.stdin.readline().rstrip() R, C, N = list(map(int, input().split())) X = {0, R} Y = {0, C} Z = [] for i in range(N): x1, y1, x2, y2 = list(map(int, input().split())) if (x1 == 0 or x1 == R or y1 == 0 or y1 == C) and ( x2 == 0 or x2 == R or y2 == 0 or y2 == C ): ...
import sys input = lambda: sys.stdin.readline().rstrip() def calc(a, b): if b == 0: return a if a == R: return b + R if b == C: return R + C + (R - a) if a == 0: return R + C + R + (C - b) R, C, N = list(map(int, input().split())) A = [] for i in range(N): x1, y1...
false
40.425532
[ "-R, C, N = list(map(int, input().split()))", "-X = {0, R}", "-Y = {0, C}", "-Z = []", "-for i in range(N):", "- x1, y1, x2, y2 = list(map(int, input().split()))", "- if (x1 == 0 or x1 == R or y1 == 0 or y1 == C) and (", "- x2 == 0 or x2 == R or y2 == 0 or y2 == C", "- ):", "- ...
false
0.03761
0.037022
1.015861
[ "s617261451", "s605084444" ]
u706414019
p03821
python
s526418439
s905874051
254
173
34,696
27,368
Accepted
Accepted
31.89
import sys import numpy as np input = sys.stdin.readline N = int(eval(input())) A = [] B = [] for _ in range(N): a,b = list(map(int,input().split())) A.append(a) B.append(b) cnt = 0 for i in range(N-1,-1,-1): if (A[i]+cnt)%B[i] == 0: continue else: cnt += B[i] - (A[i...
import sys input = sys.stdin.readline N = int(eval(input())) AB = [list(map(int,input().split())) for _ in range(N)] cnt = 0 for i in range(N-1,-1,-1): if (AB[i][0]+cnt)%AB[i][1] == 0: continue else: cnt += AB[i][1] - (AB[i][0]+cnt)%AB[i][1] print(cnt)
18
11
338
284
import sys import numpy as np input = sys.stdin.readline N = int(eval(input())) A = [] B = [] for _ in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) cnt = 0 for i in range(N - 1, -1, -1): if (A[i] + cnt) % B[i] == 0: continue else: cnt += B[i] - (A[i] + cn...
import sys input = sys.stdin.readline N = int(eval(input())) AB = [list(map(int, input().split())) for _ in range(N)] cnt = 0 for i in range(N - 1, -1, -1): if (AB[i][0] + cnt) % AB[i][1] == 0: continue else: cnt += AB[i][1] - (AB[i][0] + cnt) % AB[i][1] print(cnt)
false
38.888889
[ "-import numpy as np", "-A = []", "-B = []", "-for _ in range(N):", "- a, b = list(map(int, input().split()))", "- A.append(a)", "- B.append(b)", "+AB = [list(map(int, input().split())) for _ in range(N)]", "- if (A[i] + cnt) % B[i] == 0:", "+ if (AB[i][0] + cnt) % AB[i][1] == 0:", ...
false
0.034842
0.030526
1.141378
[ "s526418439", "s905874051" ]
u508486691
p02782
python
s844479653
s357256644
1,708
426
120,076
71,920
Accepted
Accepted
75.06
import sys import math from collections import defaultdict sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def MI(N,num): if N<=0: return [[] for _ in range(num...
import sys import math from collections import defaultdict sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def LIR(row,col): if row <= 0: return [[] for _ in ra...
83
88
1,743
2,074
import sys import math from collections import defaultdict sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def MI(N, num): if N <= 0: return [[] for _ in rang...
import sys import math from collections import defaultdict sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def LIR(row, col): if row <= 0: return [[] for _ in...
false
5.681818
[ "-def MI(N, num):", "- if N <= 0:", "- return [[] for _ in range(num)]", "- elif num == 1:", "- return [I() for _ in range(N)]", "+def LIR(row, col):", "+ if row <= 0:", "+ return [[] for _ in range(col)]", "+ elif col == 1:", "+ return [I() for _ in range(r...
false
0.06529
0.042685
1.529572
[ "s844479653", "s357256644" ]
u802963389
p02899
python
s086603240
s426720032
268
148
22,852
24,748
Accepted
Accepted
44.78
N = int(eval(input())) A = list(map(int, input().split())) li = [] for itr, val in enumerate(A): li.append([val, itr + 1]) li.sort() print((*[i[1] for i in li]))
n = int(eval(input())) A = list(map(int, input().split())) B = [(a, i + 1) for i, a in enumerate(A)] B.sort() ans = [j for _, j in B] print((*ans))
7
9
162
150
N = int(eval(input())) A = list(map(int, input().split())) li = [] for itr, val in enumerate(A): li.append([val, itr + 1]) li.sort() print((*[i[1] for i in li]))
n = int(eval(input())) A = list(map(int, input().split())) B = [(a, i + 1) for i, a in enumerate(A)] B.sort() ans = [j for _, j in B] print((*ans))
false
22.222222
[ "-N = int(eval(input()))", "+n = int(eval(input()))", "-li = []", "-for itr, val in enumerate(A):", "- li.append([val, itr + 1])", "-li.sort()", "-print((*[i[1] for i in li]))", "+B = [(a, i + 1) for i, a in enumerate(A)]", "+B.sort()", "+ans = [j for _, j in B]", "+print((*ans))" ]
false
0.037301
0.145058
0.257145
[ "s086603240", "s426720032" ]
u225388820
p02558
python
s552126943
s706177656
291
247
75,256
74,880
Accepted
Accepted
15.12
class UnionFind: def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N def __repr__(self): return '\n'...
class UnionFind: def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N def __repr__(self): return '\n'...
76
81
2,020
2,103
class UnionFind: def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N def __repr__(self): return "\n".join("{}: {}...
class UnionFind: def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N def __repr__(self): return "\n".join("{}: {}...
false
6.17284
[ "- while self.root[x] >= 0:", "- x = self.root[x]", "- return x", "+ if self.root[x] < 0:", "+ return x", "+ else:", "+ while self.root[x] >= 0:", "+ x = self.root[x]", "+ return x" ]
false
0.035549
0.038038
0.934561
[ "s552126943", "s706177656" ]
u225388820
p03724
python
s165401556
s414948182
299
109
27,640
74,704
Accepted
Accepted
63.55
import numpy as np import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a = np.zeros(n + 1, dtype=int) for _ in range(m): x, y = list(map(int, input().split())) a[x] = (a[x] + 1) & 1 a[y] = (a[y] + 1) & 1 print(("YES" if np.sum(a) == 0 else "NO"))
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a = [0] * (n + 1) for _ in range(m): x, y = list(map(int, input().split())) a[x] = (a[x] + 1) & 1 a[y] = (a[y] + 1) & 1 print(("YES" if sum(a) == 0 else "NO"))
10
9
279
243
import numpy as np import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a = np.zeros(n + 1, dtype=int) for _ in range(m): x, y = list(map(int, input().split())) a[x] = (a[x] + 1) & 1 a[y] = (a[y] + 1) & 1 print(("YES" if np.sum(a) == 0 else "NO"))
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a = [0] * (n + 1) for _ in range(m): x, y = list(map(int, input().split())) a[x] = (a[x] + 1) & 1 a[y] = (a[y] + 1) & 1 print(("YES" if sum(a) == 0 else "NO"))
false
10
[ "-import numpy as np", "-a = np.zeros(n + 1, dtype=int)", "+a = [0] * (n + 1)", "-print((\"YES\" if np.sum(a) == 0 else \"NO\"))", "+print((\"YES\" if sum(a) == 0 else \"NO\"))" ]
false
0.334432
0.040727
8.211642
[ "s165401556", "s414948182" ]
u729133443
p03108
python
s581261705
s179469688
905
807
55,916
55,916
Accepted
Accepted
10.83
r=lambda x:x if u[x]<0else r(u[x]) (n,m),_,*e=[map(int,t.split())for t in open(0).readlines()] u=[-1]*-~n a=[n*~-n//2] for x,y in e[::-1]: t=a[-1];x,y=sorted((r(x),r(y))) if x!=y:t-=u[x]*u[y];u[x]+=u[y];u[y]=x a+=[t] print(*a[::-1],sep='\n')
r=lambda x:x if u[x]<0else r(u[x]) (n,m),_,*e=[map(int,t.split())for t in open(0).readlines()] u=[-1]*-~n t=n*~-n//2 a=[t] for x,y in e[::-1]: x,y=sorted((r(x),r(y))) if x!=y:t-=u[x]*u[y];u[x]+=u[y];u[y]=x a+=[t] print(*a[::-1],sep='\n')
9
10
252
249
r = lambda x: x if u[x] < 0 else r(u[x]) (n, m), _, *e = [map(int, t.split()) for t in open(0).readlines()] u = [-1] * -~n a = [n * ~-n // 2] for x, y in e[::-1]: t = a[-1] x, y = sorted((r(x), r(y))) if x != y: t -= u[x] * u[y] u[x] += u[y] u[y] = x a += [t] print(*a[::-1], sep=...
r = lambda x: x if u[x] < 0 else r(u[x]) (n, m), _, *e = [map(int, t.split()) for t in open(0).readlines()] u = [-1] * -~n t = n * ~-n // 2 a = [t] for x, y in e[::-1]: x, y = sorted((r(x), r(y))) if x != y: t -= u[x] * u[y] u[x] += u[y] u[y] = x a += [t] print(*a[::-1], sep="\n")
false
10
[ "-a = [n * ~-n // 2]", "+t = n * ~-n // 2", "+a = [t]", "- t = a[-1]" ]
false
0.096613
0.099694
0.969101
[ "s581261705", "s179469688" ]
u756782069
p03557
python
s560368969
s358664867
370
325
29,172
29,812
Accepted
Accepted
12.16
N = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) #A2 = sorted(A) #B2 = sorted(B) #C2 = sorted(C) def numadd(up, down): array = [] count = 0 last = 0 for i in range(0,N): while down[i] > up[count]: ...
N = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) A2 = sorted(A) B2 = sorted(B) C2 = sorted(C) A2.append(2000000000) B2.append(2000000000) def numadd(up, down): array = [] count = 0 for i in range(0,N): ...
38
36
752
657
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) # A2 = sorted(A) # B2 = sorted(B) # C2 = sorted(C) def numadd(up, down): array = [] count = 0 last = 0 for i in range(0, N): while down[i] > up[count]: c...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A2 = sorted(A) B2 = sorted(B) C2 = sorted(C) A2.append(2000000000) B2.append(2000000000) def numadd(up, down): array = [] count = 0 for i in range(0, N): while down[i]...
false
5.263158
[ "-# A2 = sorted(A)", "-# B2 = sorted(B)", "-# C2 = sorted(C)", "+A2 = sorted(A)", "+B2 = sorted(B)", "+C2 = sorted(C)", "+A2.append(2000000000)", "+B2.append(2000000000)", "+", "+", "- last = 0", "- if count == N:", "- count = count - 1", "- last...
false
0.080193
0.080555
0.995504
[ "s560368969", "s358664867" ]
u997521090
p03458
python
s829082622
s942209062
1,471
1,266
23,272
23,268
Accepted
Accepted
13.94
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) N, K = list(map(int, input().split())) DP = [[0] * (K + 1) for i in range(K + 1)] bias = 0 for i in range(N): x, y, c = input().split() x, y, c = int(x), int(y), (c...
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) N, K = list(map(int, input().split())) DP = [[0] * (K + 1) for i in range(K + 1)] bias = 0 for i in range(N): x, y, c = input().split() x, y, c = int(x), int(y), (c...
37
36
815
763
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) N, K = list(map(int, input().split())) DP = [[0] * (K + 1) for i in range(K + 1)] bias = 0 for i in range(N): x, y, c = input().split() x, y, c = int(x), int(y), (c == "W") p = (...
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) N, K = list(map(int, input().split())) DP = [[0] * (K + 1) for i in range(K + 1)] bias = 0 for i in range(N): x, y, c = input().split() x, y, c = int(x), int(y), (c == "W") p = (...
false
2.702703
[ "- S1 = DP[i][j] * 2 - DP[i][K] - DP[K][j] + DP[K][K]", "- S2 = DP[i][K] + DP[K][j] - DP[i][j] * 2", "- ans = max(ans, S1, S2)", "+ S = DP[i][K] + DP[K][j] - DP[i][j] * 2", "+ ans = max(ans, S, DP[K][K] - S)" ]
false
0.836463
0.658765
1.269745
[ "s829082622", "s942209062" ]
u119982147
p03478
python
s273698579
s172438718
31
26
3,064
3,060
Accepted
Accepted
16.13
n, a, b = list(map(int, input().split())) s = [0]*5 ans = 0 for i in range(n+1): s[0] = i // 10000 s[1] = (i % 10000) // 1000 s[2] = (i % 1000) // 100 s[3] = (i % 100) // 10 s[4] = (i % 10) // 1 temp = s[0]*10000+s[1]*1000+s[2]*100+s[3]*10+s[4] if a <= sum(s) and sum(s) <= b: ...
def sum_digits(n): sum = 0 while n > 0: sum += n % 10 n = n // 10 return sum n, a, b = list(map(int, input().split())) s = [0]*5 ans = 0 for i in range(n+1): temp = sum_digits(i) if a <= temp and temp <= b: ans += i print(ans)
14
16
343
281
n, a, b = list(map(int, input().split())) s = [0] * 5 ans = 0 for i in range(n + 1): s[0] = i // 10000 s[1] = (i % 10000) // 1000 s[2] = (i % 1000) // 100 s[3] = (i % 100) // 10 s[4] = (i % 10) // 1 temp = s[0] * 10000 + s[1] * 1000 + s[2] * 100 + s[3] * 10 + s[4] if a <= sum(s) and sum(s) <...
def sum_digits(n): sum = 0 while n > 0: sum += n % 10 n = n // 10 return sum n, a, b = list(map(int, input().split())) s = [0] * 5 ans = 0 for i in range(n + 1): temp = sum_digits(i) if a <= temp and temp <= b: ans += i print(ans)
false
12.5
[ "+def sum_digits(n):", "+ sum = 0", "+ while n > 0:", "+ sum += n % 10", "+ n = n // 10", "+ return sum", "+", "+", "- s[0] = i // 10000", "- s[1] = (i % 10000) // 1000", "- s[2] = (i % 1000) // 100", "- s[3] = (i % 100) // 10", "- s[4] = (i % 10) // 1",...
false
0.122118
0.036456
3.349722
[ "s273698579", "s172438718" ]
u222668979
p03013
python
s909340136
s198141933
522
191
57,688
83,832
Accepted
Accepted
63.41
n, m = list(map(int, input().split())) a = set([int(eval(input())) for _ in range(m)]) mod = 1000000007 dp = [1] + [0] * n for i in range(1, n + 1): if i == 1: dp[i] = 1 else: dp[i] = (dp[i - 1] + dp[i - 2]) % mod if i in a: dp[i] = 0 print((dp[-1] % mod))
n, m = list(map(int, input().split())) a = set(int(eval(input())) for _ in range(m)) mod = 10 ** 9 + 7 dp = [1] + [1] + [0] * (n - 1) for i in range(1, n + 1): if i >= 2: dp[i] = (dp[i - 1] + dp[i - 2]) % mod if i in a: dp[i] = 0 print((dp[-1] % mod))
14
12
293
275
n, m = list(map(int, input().split())) a = set([int(eval(input())) for _ in range(m)]) mod = 1000000007 dp = [1] + [0] * n for i in range(1, n + 1): if i == 1: dp[i] = 1 else: dp[i] = (dp[i - 1] + dp[i - 2]) % mod if i in a: dp[i] = 0 print((dp[-1] % mod))
n, m = list(map(int, input().split())) a = set(int(eval(input())) for _ in range(m)) mod = 10**9 + 7 dp = [1] + [1] + [0] * (n - 1) for i in range(1, n + 1): if i >= 2: dp[i] = (dp[i - 1] + dp[i - 2]) % mod if i in a: dp[i] = 0 print((dp[-1] % mod))
false
14.285714
[ "-a = set([int(eval(input())) for _ in range(m)])", "-mod = 1000000007", "-dp = [1] + [0] * n", "+a = set(int(eval(input())) for _ in range(m))", "+mod = 10**9 + 7", "+dp = [1] + [1] + [0] * (n - 1)", "- if i == 1:", "- dp[i] = 1", "- else:", "+ if i >= 2:" ]
false
0.045443
0.045006
1.009711
[ "s909340136", "s198141933" ]
u968166680
p02839
python
s002826276
s972634234
131
110
85,692
69,548
Accepted
Accepted
16.03
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): H, W = list(map(int, readline().split())) A = [list(map(int, readline().split())) for _ in range(H)] B = [list(map(int, rea...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): H, W = list(map(int, readline().split())) A = [list(map(int, readline().split())) for _ in range(H)] B = [list(map(int, rea...
45
45
1,170
1,117
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): H, W = list(map(int, readline().split())) A = [list(map(int, readline().split())) for _ in range(H)] B = [list(map(int, readline().split()...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): H, W = list(map(int, readline().split())) A = [list(map(int, readline().split())) for _ in range(H)] B = [list(map(int, readline().split()...
false
0
[ "- dp = [[0] * W for _ in range(H)]", "- dp[0][0] = 1 << (M + G[0][0]) | 1 << (M - G[0][0])", "+ dp = [0] * W", "+ dp[0] = 1 << (M + G[0][0]) | 1 << (M - G[0][0])", "+ if j + 1 < W:", "+ dp[j + 1] |= (dp[j] >> G[i][j + 1]) | (dp[j] << G[i][j + 1])", "- ...
false
0.039821
0.105052
0.379057
[ "s002826276", "s972634234" ]
u334712262
p03013
python
s019649815
s464912562
222
184
11,076
9,196
Accepted
Accepted
17.12
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(100000) # input = sys.stdin.readline def read_int(): return int(eval(input())) def read_int_n(): return list(map(int, input().split())) class Mod: def __init__(self, m): self.m = m def add(self, a, b): r...
104
47
1,971
819
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(100000) # input = sys.stdin.readline def read_int(): return int(eval(input())) def read_int_n(): return list(map(int, input().split())) class Mod: def __init__(self, m): self.m = m def add(self, a, b): return (a + b) % self.m...
false
54.807692
[ "-import bisect", "-import heapq", "-import math", "-import random", "-from collections import Counter, defaultdict, deque", "-from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal", "-from functools import lru_cache, reduce", "-from itertools import combinations, combinations_with_replacement, pr...
false
0.060906
0.037968
1.604163
[ "s019649815", "s464912562" ]
u534308356
p02819
python
s315456799
s420843662
176
19
38,896
3,060
Accepted
Accepted
89.2
import math number = int(eval(input())) def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True for i in range(10000000): if is_prime(number): print(number) break else: ...
import math def isPrime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True x = int(eval(input())) for i in range(10**5): if isPrime(x+i): print((x+i)) break
18
15
329
251
import math number = int(eval(input())) def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True for i in range(10000000): if is_prime(number): print(number) break else: number ...
import math def isPrime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True x = int(eval(input())) for i in range(10**5): if isPrime(x + i): print((x + i)) break
false
16.666667
[ "-number = int(eval(input()))", "-", "-def is_prime(n):", "+def isPrime(n):", "-for i in range(10000000):", "- if is_prime(number):", "- print(number)", "+x = int(eval(input()))", "+for i in range(10**5):", "+ if isPrime(x + i):", "+ print((x + i))", "- else:", "- ...
false
0.107557
0.037565
2.863208
[ "s315456799", "s420843662" ]
u156815136
p03352
python
s890886352
s993834597
40
34
10,344
10,300
Accepted
Accepted
15
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate, product # (string,3) 3回 #from collections import deque from collections import deque,defaultdi...
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate, product # (string,3) 3回 #from collections import deque from collections import deque,defaultdi...
46
47
1,082
1,112
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations, permutations, accumulate, product # (string,3) 3回 # from collections import deque from collections import deque, defaul...
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations, permutations, accumulate, product # (string,3) 3回 # from collections import deque from collections import deque, defaul...
false
2.12766
[ "+import bisect", "-ans = -1", "-for b in range(1, x + 2):", "- for p in range(2, x + 2):", "- if b**p > x:", "+ans = 1", "+for b in range(2, 1001):", "+ for p in range(2, 24):", "+ if b**p <= x:", "+ ans = max(ans, b**p)", "+ else:", "- ans = max(a...
false
0.038764
0.04847
0.799749
[ "s890886352", "s993834597" ]
u175034939
p03612
python
s121624821
s203189874
93
66
14,008
14,008
Accepted
Accepted
29.03
n = int(eval(input())) a = list(map(int,input().split())) t = 0 for i in range(n): if a[i] == i+1: t += 1 i = 0 cnt = 0 while i < n-1: if a[i] == i+1 and a[i+1] == i+2: cnt += 1 i += 2 else: i += 1 print((t-cnt))
n = int(eval(input())) a = list(map(int,input().split())) cnt = 0 i = 0 while i < n: if a[i] == i+1: cnt += 1 i += 2 else: i += 1 print(cnt)
18
13
269
181
n = int(eval(input())) a = list(map(int, input().split())) t = 0 for i in range(n): if a[i] == i + 1: t += 1 i = 0 cnt = 0 while i < n - 1: if a[i] == i + 1 and a[i + 1] == i + 2: cnt += 1 i += 2 else: i += 1 print((t - cnt))
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 i = 0 while i < n: if a[i] == i + 1: cnt += 1 i += 2 else: i += 1 print(cnt)
false
27.777778
[ "-t = 0", "-for i in range(n):", "+cnt = 0", "+i = 0", "+while i < n:", "- t += 1", "-i = 0", "-cnt = 0", "-while i < n - 1:", "- if a[i] == i + 1 and a[i + 1] == i + 2:", "-print((t - cnt))", "+print(cnt)" ]
false
0.096513
0.036467
2.646551
[ "s121624821", "s203189874" ]
u977389981
p02970
python
s361554990
s447724310
19
17
2,940
2,940
Accepted
Accepted
10.53
N, D = list(map(int, input().split())) print((- (- N // (1 + 2 * D))))
N, D = list(map(int, input().split())) if N % (D * 2 + 1) == 0: print((N // (D * 2 + 1))) else: print((N // (D * 2 + 1) + 1))
3
6
65
129
N, D = list(map(int, input().split())) print((-(-N // (1 + 2 * D))))
N, D = list(map(int, input().split())) if N % (D * 2 + 1) == 0: print((N // (D * 2 + 1))) else: print((N // (D * 2 + 1) + 1))
false
50
[ "-print((-(-N // (1 + 2 * D))))", "+if N % (D * 2 + 1) == 0:", "+ print((N // (D * 2 + 1)))", "+else:", "+ print((N // (D * 2 + 1) + 1))" ]
false
0.038137
0.04301
0.886713
[ "s361554990", "s447724310" ]
u644907318
p03136
python
s251399822
s005849286
164
59
38,384
61,852
Accepted
Accepted
64.02
N = int(eval(input())) L = list(map(int,input().split())) tot = sum(L) lmax = max(L) tot -= lmax if tot>lmax: print("Yes") else: print("No")
N = int(eval(input())) L = list(map(int,input().split())) lmax = max(L) ltot = sum(L) if ltot>2*lmax: print("Yes") else: print("No")
9
8
150
141
N = int(eval(input())) L = list(map(int, input().split())) tot = sum(L) lmax = max(L) tot -= lmax if tot > lmax: print("Yes") else: print("No")
N = int(eval(input())) L = list(map(int, input().split())) lmax = max(L) ltot = sum(L) if ltot > 2 * lmax: print("Yes") else: print("No")
false
11.111111
[ "-tot = sum(L)", "-tot -= lmax", "-if tot > lmax:", "+ltot = sum(L)", "+if ltot > 2 * lmax:" ]
false
0.038089
0.038621
0.986219
[ "s251399822", "s005849286" ]
u525065967
p03575
python
s041893159
s506843601
33
27
9,220
9,064
Accepted
Accepted
18.18
def dfs(a, b, f): if vis[f] == 1: return vis[f] = 1 for t in V[f]: if f!=a or t!=b: dfs(a, b, t) n, m = list(map(int, input().split())) E, V = [], [[] for _ in range(n)] for _ in range(m): a, b = [int(x)-1 for x in input().split()] E.append([a, b]) V[a].append(b); V[b].append...
def dfs(f): if vis[f] == 1: return vis[f] = 1 for t in V[f]: if f!=a or t!=b: dfs(t) n, m = list(map(int, input().split())) E = [[*[int(x)-1 for x in input().split()]] for _ in range(m)] V = [[] for _ in range(n)] for a, b in E: V[a].append(b); V[b].append(a) ans = 0 for a, b in E: ...
18
16
425
385
def dfs(a, b, f): if vis[f] == 1: return vis[f] = 1 for t in V[f]: if f != a or t != b: dfs(a, b, t) n, m = list(map(int, input().split())) E, V = [], [[] for _ in range(n)] for _ in range(m): a, b = [int(x) - 1 for x in input().split()] E.append([a, b]) V[a].append...
def dfs(f): if vis[f] == 1: return vis[f] = 1 for t in V[f]: if f != a or t != b: dfs(t) n, m = list(map(int, input().split())) E = [[*[int(x) - 1 for x in input().split()]] for _ in range(m)] V = [[] for _ in range(n)] for a, b in E: V[a].append(b) V[b].append(a) ans =...
false
11.111111
[ "-def dfs(a, b, f):", "+def dfs(f):", "- dfs(a, b, t)", "+ dfs(t)", "-E, V = [], [[] for _ in range(n)]", "-for _ in range(m):", "- a, b = [int(x) - 1 for x in input().split()]", "- E.append([a, b])", "+E = [[*[int(x) - 1 for x in input().split()]] for _ in range(m)]", ...
false
0.032555
0.086646
0.375729
[ "s041893159", "s506843601" ]
u189487046
p03416
python
s111504976
s718596035
64
45
2,940
2,940
Accepted
Accepted
29.69
a, b = list(map(int, input().split())) ans = 0 for i in range(a, b+1): if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]: ans += 1 print(ans)
a, b = list(map(int, input().split())) ans = 0 for i in range(a, b+1): s = str(i) if s[0] == s[4] and s[1] == s[3]: ans += 1 print(ans)
8
9
160
156
a, b = list(map(int, input().split())) ans = 0 for i in range(a, b + 1): if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]: ans += 1 print(ans)
a, b = list(map(int, input().split())) ans = 0 for i in range(a, b + 1): s = str(i) if s[0] == s[4] and s[1] == s[3]: ans += 1 print(ans)
false
11.111111
[ "- if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:", "+ s = str(i)", "+ if s[0] == s[4] and s[1] == s[3]:" ]
false
0.065333
0.045693
1.429826
[ "s111504976", "s718596035" ]
u173072656
p02688
python
s784564242
s290944476
65
55
68,004
68,412
Accepted
Accepted
15.38
n, k = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(2*k)] ans = [0]*n for i in range(k): for j in range(a[i*2][0]): s = a[i*2+1][j] ans[s-1] = 1 S = n - sum(ans) print(S)
n, k = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(2*k)] ans = [0]*n for i in range(k): for j in range(a[i*2][0]): s = a[i*2+1][j] ans[s-1] += 1 ans = [str(i) for i in ans] print((ans.count('0')))
9
9
231
256
n, k = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(2 * k)] ans = [0] * n for i in range(k): for j in range(a[i * 2][0]): s = a[i * 2 + 1][j] ans[s - 1] = 1 S = n - sum(ans) print(S)
n, k = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(2 * k)] ans = [0] * n for i in range(k): for j in range(a[i * 2][0]): s = a[i * 2 + 1][j] ans[s - 1] += 1 ans = [str(i) for i in ans] print((ans.count("0")))
false
0
[ "- ans[s - 1] = 1", "-S = n - sum(ans)", "-print(S)", "+ ans[s - 1] += 1", "+ans = [str(i) for i in ans]", "+print((ans.count(\"0\")))" ]
false
0.04555
0.0382
1.192409
[ "s784564242", "s290944476" ]
u598229387
p02996
python
s608814393
s493787098
883
581
42,712
42,732
Accepted
Accepted
34.2
#import sys #input = sys.stdin.readline n=int(eval(input())) ab=[[int(i) for i in input().split()] for j in range(n)] ab=sorted(ab,key=lambda x:x[1]) w=0 t=0 ans='Yes' for a,b in ab: w+=a if b<w: ans='No' print(ans)
import sys input = sys.stdin.readline n=int(eval(input())) ab=[[int(i) for i in input().split()] for j in range(n)] ab=sorted(ab,key=lambda x:x[1]) w=0 t=0 ans='Yes' for a,b in ab: w+=a if b<w: ans='No' print(ans)
16
16
247
245
# import sys # input = sys.stdin.readline n = int(eval(input())) ab = [[int(i) for i in input().split()] for j in range(n)] ab = sorted(ab, key=lambda x: x[1]) w = 0 t = 0 ans = "Yes" for a, b in ab: w += a if b < w: ans = "No" print(ans)
import sys input = sys.stdin.readline n = int(eval(input())) ab = [[int(i) for i in input().split()] for j in range(n)] ab = sorted(ab, key=lambda x: x[1]) w = 0 t = 0 ans = "Yes" for a, b in ab: w += a if b < w: ans = "No" print(ans)
false
0
[ "-# import sys", "-# input = sys.stdin.readline", "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.093895
0.041221
2.277856
[ "s608814393", "s493787098" ]
u028554976
p03265
python
s378485080
s380201778
29
25
9,032
9,112
Accepted
Accepted
13.79
a,b,c,d=list(map(int,input().split()));e=c-a;f=d-b;print((c-f,d+e,a-f,b+e))
a,b,c,d=list(map(int,input().split()));print((b+c-d,-a+c+d,a+b-d,-a+b+c))
1
1
67
65
a, b, c, d = list(map(int, input().split())) e = c - a f = d - b print((c - f, d + e, a - f, b + e))
a, b, c, d = list(map(int, input().split())) print((b + c - d, -a + c + d, a + b - d, -a + b + c))
false
0
[ "-e = c - a", "-f = d - b", "-print((c - f, d + e, a - f, b + e))", "+print((b + c - d, -a + c + d, a + b - d, -a + b + c))" ]
false
0.042358
0.042572
0.994969
[ "s378485080", "s380201778" ]
u167751176
p03074
python
s661708406
s668005758
84
76
4,092
7,884
Accepted
Accepted
9.52
def main(): N, K = list(map(int, input().split())) S = eval(input()) current = "1" current_len = 0 nums = [] for i in range(N): if S[i] != current: nums.append(current_len) current_len = 1 current = S[i] else: current_len += 1 nums.append(current_len) if len(nums) %2 == 0: num...
def main(): N, K = list(map(int, input().split())) S = eval(input()) current = "1" current_len = 0 nums = [] for i in range(N): if S[i] != current: nums.append(current_len) current_len = 1 current = S[i] else: current_len += 1 nums.append(current_len) if len(nums) %2 == 0: num...
40
35
719
642
def main(): N, K = list(map(int, input().split())) S = eval(input()) current = "1" current_len = 0 nums = [] for i in range(N): if S[i] != current: nums.append(current_len) current_len = 1 current = S[i] else: current_len += 1 n...
def main(): N, K = list(map(int, input().split())) S = eval(input()) current = "1" current_len = 0 nums = [] for i in range(N): if S[i] != current: nums.append(current_len) current_len = 1 current = S[i] else: current_len += 1 n...
false
12.5
[ "- left, right = 0, 0", "- tmp = 0", "+ sums = [0] * (len(nums) + 1)", "+ for i in range(len(nums)):", "+ sums[i + 1] = sums[i] + nums[i]", "- next_left = i", "- next_right = min(i + distance, len(nums))", "- # move left", "- while next_left > left:", ...
false
0.036483
0.036865
0.98963
[ "s661708406", "s668005758" ]
u585482323
p03634
python
s079950142
s798160758
1,084
777
102,960
85,552
Accepted
Accepted
28.32
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS():return list(map(list, ...
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS():return list(map(list, ...
107
105
1,609
1,535
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS(): return list(m...
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS(): return list(m...
false
1.869159
[ "-def dijkstra(k):", "- d[k] = 0", "- q = [[0, k]]", "- while q:", "- dx, x = heappop(q)", "- for y, c in v[x]:", "- if d[y] > dx + c:", "- d[y] = dx + c", "- heappush(q, [d[y], y])", "-", "-", "-q, k = LI()", "-d = [float(\"inf...
false
0.099179
0.038661
2.565334
[ "s079950142", "s798160758" ]
u489959379
p02792
python
s529992569
s213476470
378
165
3,060
3,064
Accepted
Accepted
56.35
n = int(eval(input())) ans = 0 numbers = [[0] * 10 for _ in range(10)] for i in range(1, n+1): ss = str(i) numbers[int(ss[0])][int(ss[-1])] += 1 for j in range(1, n+1): ss = str(j) ans += numbers[int(ss[-1])][int(ss[0])] print(ans)
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(eval(input())) res = 0 numbers = [[0] * 10 for _ in range(10)] for i in range(1, n + 1): ss = str(i) numbers[int(ss[0])][int(ss[-1])] += 1...
14
26
259
492
n = int(eval(input())) ans = 0 numbers = [[0] * 10 for _ in range(10)] for i in range(1, n + 1): ss = str(i) numbers[int(ss[0])][int(ss[-1])] += 1 for j in range(1, n + 1): ss = str(j) ans += numbers[int(ss[-1])][int(ss[0])] print(ans)
import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline f_inf = float("inf") mod = 10**9 + 7 def resolve(): n = int(eval(input())) res = 0 numbers = [[0] * 10 for _ in range(10)] for i in range(1, n + 1): ss = str(i) numbers[int(ss[0])][int(ss[-1])] += 1 for j in range(...
false
46.153846
[ "-n = int(eval(input()))", "-ans = 0", "-numbers = [[0] * 10 for _ in range(10)]", "-for i in range(1, n + 1):", "- ss = str(i)", "- numbers[int(ss[0])][int(ss[-1])] += 1", "-for j in range(1, n + 1):", "- ss = str(j)", "- ans += numbers[int(ss[-1])][int(ss[0])]", "-print(ans)", "+im...
false
0.060064
0.044383
1.353299
[ "s529992569", "s213476470" ]
u375616706
p03800
python
s175814355
s784630857
200
176
4,852
4,852
Accepted
Accepted
12
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N = int(eval(input())) s = input()[:-1] ans = [1]*(N+2) def print_ans(l: list): ret = "" for a in l[1:-1]: ret += "S" if a else "W" print(ret) def next(ind: int, isSame: bool, isSh...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N = int(eval(input())) s = input()[:-1] ans = [1]*(N+2) def print_ans(l: list): ret = "" for a in l[1:-1]: ret += "S" if a else "W" print(ret) def next(ind: int, isSame: bool, isSh...
47
36
985
752
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N = int(eval(input())) s = input()[:-1] ans = [1] * (N + 2) def print_ans(l: list): ret = "" for a in l[1:-1]: ret += "S" if a else "W" print(ret) def next(ind: int, isSame: bool, isSheep: bool) ->...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N = int(eval(input())) s = input()[:-1] ans = [1] * (N + 2) def print_ans(l: list): ret = "" for a in l[1:-1]: ret += "S" if a else "W" print(ret) def next(ind: int, isSame: bool, isSheep: bool) ->...
false
23.404255
[ "- if isSame:", "- if isSheep:", "- return ans[ind - 1]", "- else:", "- return not ans[ind - 1]", "- else:", "- if isSheep:", "- return not ans[ind - 1]", "- else:", "- return ans[ind - 1]" ]
false
0.03242
0.043722
0.741511
[ "s175814355", "s784630857" ]
u312025627
p02659
python
s622024996
s094437436
106
31
77,540
9,868
Accepted
Accepted
70.75
def main(): from decimal import Decimal as D N, M = (D(i) for i in input().split()) print((int(N*M))) if __name__ == '__main__': main()
def main(): from decimal import Decimal N, M = (Decimal(i) for i in input().split()) print((int(N * M))) if __name__ == '__main__': main()
8
8
159
162
def main(): from decimal import Decimal as D N, M = (D(i) for i in input().split()) print((int(N * M))) if __name__ == "__main__": main()
def main(): from decimal import Decimal N, M = (Decimal(i) for i in input().split()) print((int(N * M))) if __name__ == "__main__": main()
false
0
[ "- from decimal import Decimal as D", "+ from decimal import Decimal", "- N, M = (D(i) for i in input().split())", "+ N, M = (Decimal(i) for i in input().split())" ]
false
0.037488
0.037234
1.006825
[ "s622024996", "s094437436" ]
u271934630
p03127
python
s883090343
s749009049
383
66
88,428
14,668
Accepted
Accepted
82.77
from functools import reduce from fractions import gcd n = int(eval(input())) a = list(map(int, input().split())) print((reduce(gcd, a)))
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) from functools import reduce i_i = lambda: int(i_s()) i_l = lambda: list(map(int, stdin.readline().split())) i_s = lambda: stdin.readline().rstrip() def gcd(a,b): while b: a, b = b, a%b return a def gcd_list(l): return red...
7
21
138
377
from functools import reduce from fractions import gcd n = int(eval(input())) a = list(map(int, input().split())) print((reduce(gcd, a)))
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) from functools import reduce i_i = lambda: int(i_s()) i_l = lambda: list(map(int, stdin.readline().split())) i_s = lambda: stdin.readline().rstrip() def gcd(a, b): while b: a, b = b, a % b return a def gcd_list(l): return reduce(gcd, l)...
false
66.666667
[ "+import sys", "+", "+stdin = sys.stdin", "+sys.setrecursionlimit(10**7)", "-from fractions import gcd", "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-print((reduce(gcd, a)))", "+i_i = lambda: int(i_s())", "+i_l = lambda: list(map(int, stdin.readline().split()))", "+i_s = ...
false
0.089194
0.037329
2.389398
[ "s883090343", "s749009049" ]
u716043626
p03043
python
s998310703
s492188814
62
42
3,864
3,060
Accepted
Accepted
32.26
n, k = list(map(int, input().split())) result = 0 seq = [] for i in range(1,n+1): count = 0 temp = i while temp < k: temp *= 2 count += 1 seq.append(count) for i in range(n): result += 1/n * (0.5)**seq[i] print(result)
n,k = list(map(int,input().split())) ans = 0.0 for i in range(1,n+1): count = 0 while i < k: i *= 2 count +=1 ans += 1/n * (0.5** count) print(ans)
17
11
276
185
n, k = list(map(int, input().split())) result = 0 seq = [] for i in range(1, n + 1): count = 0 temp = i while temp < k: temp *= 2 count += 1 seq.append(count) for i in range(n): result += 1 / n * (0.5) ** seq[i] print(result)
n, k = list(map(int, input().split())) ans = 0.0 for i in range(1, n + 1): count = 0 while i < k: i *= 2 count += 1 ans += 1 / n * (0.5**count) print(ans)
false
35.294118
[ "-result = 0", "-seq = []", "+ans = 0.0", "- temp = i", "- while temp < k:", "- temp *= 2", "+ while i < k:", "+ i *= 2", "- seq.append(count)", "-for i in range(n):", "- result += 1 / n * (0.5) ** seq[i]", "-print(result)", "+ ans += 1 / n * (0.5**count)", ...
false
0.065031
0.072046
0.90263
[ "s998310703", "s492188814" ]
u389910364
p02815
python
s490580556
s222878349
1,611
421
23,372
23,316
Accepted
Accepted
73.87
import os import sys # from libs.debug import debug if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 N = int(sys.stdin.buffer.readline()) C = list(map(int, sys.stdin.buffer.readline().sp...
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 N = int(sys.stdin.buffer.readline()) C = list(map(int, sys.stdin.buffer.readline().split())) C.sort(reverse=True) a...
54
59
1,495
1,541
import os import sys # from libs.debug import debug if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 N = int(sys.stdin.buffer.readline()) C = list(map(int, sys.stdin.buffer.readline().split())) C.sort(reverse=Tru...
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 N = int(sys.stdin.buffer.readline()) C = list(map(int, sys.stdin.buffer.readline().split())) C.sort(reverse=True) assert pow(2, MOD - 2, MOD) ...
false
8.474576
[ "-# from libs.debug import debug", "+assert pow(2, MOD - 2, MOD) == 500000004", "-def div_mod(a, b, mod):", "- return a * pow(b, mod - 2, mod) % mod", "+def div2(a):", "+ return a % MOD * 500000004 % MOD", "+pow2 = [1]", "+for _ in range(N):", "+ pow2.append(pow2[-1] * 2 % MOD)", "- # ...
false
0.044142
0.037438
1.179078
[ "s490580556", "s222878349" ]
u831294922
p02731
python
s123750881
s856149068
163
17
38,256
3,060
Accepted
Accepted
89.57
d = int(eval(input())) print(((d / 3)**3))
L = int(eval(input())) print(((L/3)**3))
2
2
35
33
d = int(eval(input())) print(((d / 3) ** 3))
L = int(eval(input())) print(((L / 3) ** 3))
false
0
[ "-d = int(eval(input()))", "-print(((d / 3) ** 3))", "+L = int(eval(input()))", "+print(((L / 3) ** 3))" ]
false
0.092135
0.034981
2.633868
[ "s123750881", "s856149068" ]
u894258749
p03136
python
s872919387
s609635312
322
17
21,616
2,940
Accepted
Accepted
94.72
import numpy as np N = int(eval(input())) L = np.array(list(map(int,input().split()))) L[::-1].sort() if L[0] < L[1:].sum(): print('Yes') else: print('No')
def inpl(): return list(map(int,input().split())) N = int(eval(input())) L = sorted(inpl()) if L[-1] < sum(L[:-1]): print('Yes') else: print('No')
10
7
168
150
import numpy as np N = int(eval(input())) L = np.array(list(map(int, input().split()))) L[::-1].sort() if L[0] < L[1:].sum(): print("Yes") else: print("No")
def inpl(): return list(map(int, input().split())) N = int(eval(input())) L = sorted(inpl()) if L[-1] < sum(L[:-1]): print("Yes") else: print("No")
false
30
[ "-import numpy as np", "+def inpl():", "+ return list(map(int, input().split()))", "+", "-L = np.array(list(map(int, input().split())))", "-L[::-1].sort()", "-if L[0] < L[1:].sum():", "+L = sorted(inpl())", "+if L[-1] < sum(L[:-1]):" ]
false
0.391857
0.035805
10.944273
[ "s872919387", "s609635312" ]
u201234972
p02665
python
s120961871
s463194638
113
99
25,176
20,436
Accepted
Accepted
12.39
def main(): N = int( eval(input())) A = list( map( int, input().split())) root = 1 if A[0] == 1: if N == 0: print((1)) else: print((-1)) return B = A[::-1] low = high = B[0] # Low = [] Hight = [high] Low = [low] for b...
#import sys #input = sys.stdin.readline def main(): N = int( eval(input())) A = list( map( int, input().split())) root = 1 if A[0] == 1: if N == 0: print((1)) else: print((-1)) return B = A[::-1] low = high = B[0] # Low = [] ...
40
38
871
791
def main(): N = int(eval(input())) A = list(map(int, input().split())) root = 1 if A[0] == 1: if N == 0: print((1)) else: print((-1)) return B = A[::-1] low = high = B[0] # Low = [] Hight = [high] Low = [low] for b in B[1:]: ...
# import sys # input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) root = 1 if A[0] == 1: if N == 0: print((1)) else: print((-1)) return B = A[::-1] low = high = B[0] # Low = [] Hight = [high] ...
false
5
[ "+# import sys", "+# input = sys.stdin.readline", "- Low = [low]", "- Low.append(low)", "- BLow = Low[::-1]", "- high = BHight[i]", "- low = BLow[i]", "- if high < now or now * 2 < low:", "- print((-1))", "- return", "+ h = BHight[i]...
false
0.04633
0.068212
0.679195
[ "s120961871", "s463194638" ]
u192154323
p03161
python
s968238508
s158144618
424
193
56,928
85,804
Accepted
Accepted
54.48
n,k = list(map(int,input().split())) h_ls = list(map(int, input().split())) dp = [float('inf') for _ in range(n)] dp[0] = 0 for i in range(n): for j in range(1,k+1): if i + j < n: dp[i+j] = min(dp[i+j], dp[i] + abs(h_ls[i+j] - h_ls[i])) print((dp[-1]))
n,k = list(map(int,input().split())) h_ls = list(map(int, input().split())) mincost_ls = [float('inf')] * n mincost_ls[0] = 0 for i in range(n): for j in range(i+1,i+k+1): if j < n: mincost_ls[j] = min(mincost_ls[j], mincost_ls[i] + abs(h_ls[j]-h_ls[i])) print((mincost_ls[-1]))
10
10
278
305
n, k = list(map(int, input().split())) h_ls = list(map(int, input().split())) dp = [float("inf") for _ in range(n)] dp[0] = 0 for i in range(n): for j in range(1, k + 1): if i + j < n: dp[i + j] = min(dp[i + j], dp[i] + abs(h_ls[i + j] - h_ls[i])) print((dp[-1]))
n, k = list(map(int, input().split())) h_ls = list(map(int, input().split())) mincost_ls = [float("inf")] * n mincost_ls[0] = 0 for i in range(n): for j in range(i + 1, i + k + 1): if j < n: mincost_ls[j] = min(mincost_ls[j], mincost_ls[i] + abs(h_ls[j] - h_ls[i])) print((mincost_ls[-1]))
false
0
[ "-dp = [float(\"inf\") for _ in range(n)]", "-dp[0] = 0", "+mincost_ls = [float(\"inf\")] * n", "+mincost_ls[0] = 0", "- for j in range(1, k + 1):", "- if i + j < n:", "- dp[i + j] = min(dp[i + j], dp[i] + abs(h_ls[i + j] - h_ls[i]))", "-print((dp[-1]))", "+ for j in range(i ...
false
0.089081
0.05322
1.673828
[ "s968238508", "s158144618" ]
u241159583
p03673
python
s273739772
s119876463
164
93
34,628
33,184
Accepted
Accepted
43.29
from collections import deque n = int(eval(input())) a = list(map(int, input().split())) b = deque() ok = True for i in range(n): if ok: b.append(a[i]) ok = False else: b.appendleft(a[i]) ok = True b = list(map(str, list(b))) if ok: print((" ".join(b))) else: print((" ".join(...
from collections import deque n = int(eval(input())) a = list(input().split()) ans = deque() for i in range(n): if i%2==0: ans.append(a[i]) else: ans.appendleft(a[i]) ans = list(ans) if n%2==0: print((" ".join(ans))) else: print((" ".join(ans[::-1])))
19
12
320
269
from collections import deque n = int(eval(input())) a = list(map(int, input().split())) b = deque() ok = True for i in range(n): if ok: b.append(a[i]) ok = False else: b.appendleft(a[i]) ok = True b = list(map(str, list(b))) if ok: print((" ".join(b))) else: print((" "....
from collections import deque n = int(eval(input())) a = list(input().split()) ans = deque() for i in range(n): if i % 2 == 0: ans.append(a[i]) else: ans.appendleft(a[i]) ans = list(ans) if n % 2 == 0: print((" ".join(ans))) else: print((" ".join(ans[::-1])))
false
36.842105
[ "-a = list(map(int, input().split()))", "-b = deque()", "-ok = True", "+a = list(input().split())", "+ans = deque()", "- if ok:", "- b.append(a[i])", "- ok = False", "+ if i % 2 == 0:", "+ ans.append(a[i])", "- b.appendleft(a[i])", "- ok = True", "-b ...
false
0.093049
0.039262
2.369971
[ "s273739772", "s119876463" ]
u090225501
p03343
python
s177508750
s862738518
1,820
1,397
3,444
3,452
Accepted
Accepted
23.24
import heapq def main(): n, k, q = list(map(int, input().split())) a = tuple(map(int, input().split())) m = float('inf') for y in sorted(set(a)): x = find_x(a, y, k, q) if x is None: break m = min(m, x - y) print(m) def find_x(a, y, k, q): ...
import heapq def main(): _, k, q = list(map(int, input().split())) a = tuple(map(int, input().split())) gs = [a] m = float('inf') for y in sorted(set(a)): gs = groups(gs, y, k) x = find_x(gs, y, k, q) if x is None: break m = min(m, x - y) ...
49
56
895
1,039
import heapq def main(): n, k, q = list(map(int, input().split())) a = tuple(map(int, input().split())) m = float("inf") for y in sorted(set(a)): x = find_x(a, y, k, q) if x is None: break m = min(m, x - y) print(m) def find_x(a, y, k, q): gs = groups(a, y...
import heapq def main(): _, k, q = list(map(int, input().split())) a = tuple(map(int, input().split())) gs = [a] m = float("inf") for y in sorted(set(a)): gs = groups(gs, y, k) x = find_x(gs, y, k, q) if x is None: break m = min(m, x - y) print(m) ...
false
12.5
[ "- n, k, q = list(map(int, input().split()))", "+ _, k, q = list(map(int, input().split()))", "+ gs = [a]", "- x = find_x(a, y, k, q)", "+ gs = groups(gs, y, k)", "+ x = find_x(gs, y, k, q)", "-def find_x(a, y, k, q):", "- gs = groups(a, y, k)", "+def find_x(gs, y, k...
false
0.03854
0.079809
0.482902
[ "s177508750", "s862738518" ]
u607865971
p03252
python
s060243259
s516626707
172
149
3,632
4,136
Accepted
Accepted
13.37
S = eval(input()) T = eval(input()) d1 = dict() d2 = dict() ret = "Yes" for s, t in zip(S, T): #print("{}-->{}".format(s, t)) tmp1 = d1.get(s, None) tmp2 = d2.get(t, None) if (tmp1 == None or tmp1 == t) and (tmp2 == None or tmp2 == s): d1[s] = t d2[t] = s else: ...
import sys import collections import itertools import math import re from collections import Counter from collections import deque from collections import defaultdict S = eval(input()) T = eval(input()) N = len(S) def f(STR1, STR2): d = {} isOK = True for i in range(N): s = ...
19
36
338
565
S = eval(input()) T = eval(input()) d1 = dict() d2 = dict() ret = "Yes" for s, t in zip(S, T): # print("{}-->{}".format(s, t)) tmp1 = d1.get(s, None) tmp2 = d2.get(t, None) if (tmp1 == None or tmp1 == t) and (tmp2 == None or tmp2 == s): d1[s] = t d2[t] = s else: ret = "No" pr...
import sys import collections import itertools import math import re from collections import Counter from collections import deque from collections import defaultdict S = eval(input()) T = eval(input()) N = len(S) def f(STR1, STR2): d = {} isOK = True for i in range(N): s = STR1[i] t = ST...
false
47.222222
[ "+import sys", "+import collections", "+import itertools", "+import math", "+import re", "+from collections import Counter", "+from collections import deque", "+from collections import defaultdict", "+", "-d1 = dict()", "-d2 = dict()", "-ret = \"Yes\"", "-for s, t in zip(S, T):", "- # p...
false
0.077516
0.038098
2.034629
[ "s060243259", "s516626707" ]
u197457087
p03644
python
s303948390
s328003418
171
62
38,256
61,908
Accepted
Accepted
63.74
N = int(eval(input())) a = 1 while a*2<=N: a *= 2 print(a)
N = int(eval(input())) ans = 1 while ans*2 <= N: ans *= 2 print(ans)
7
5
62
68
N = int(eval(input())) a = 1 while a * 2 <= N: a *= 2 print(a)
N = int(eval(input())) ans = 1 while ans * 2 <= N: ans *= 2 print(ans)
false
28.571429
[ "-a = 1", "-while a * 2 <= N:", "- a *= 2", "-print(a)", "+ans = 1", "+while ans * 2 <= N:", "+ ans *= 2", "+print(ans)" ]
false
0.042731
0.043588
0.980336
[ "s303948390", "s328003418" ]
u223646582
p03088
python
s900163013
s374321293
241
125
42,588
3,872
Accepted
Accepted
48.13
from collections import defaultdict N = int(eval(input())) dp = [defaultdict(int) for _ in range(N+1)] MOD = 10**9 + 7 dp[0]['TTT'] = 1 def ok(last4): for i in range(4): l = list(last4) if i >= 1: l[i-1], l[i] = l[i], l[i-1] if 'AGC' in ''.join(l): retu...
# ABC122D - We Like AGC N, MOD = int(eval(input())), 10 ** 9 + 7 memo = [{} for i in range(N+1)] def ok(last4): for i in range(4): t = list(last4) if i >= 1: t[i-1], t[i] = t[i], t[i-1] if ''.join(t).count('AGC') >= 1: return False return True d...
25
29
571
624
from collections import defaultdict N = int(eval(input())) dp = [defaultdict(int) for _ in range(N + 1)] MOD = 10**9 + 7 dp[0]["TTT"] = 1 def ok(last4): for i in range(4): l = list(last4) if i >= 1: l[i - 1], l[i] = l[i], l[i - 1] if "AGC" in "".join(l): return Fal...
# ABC122D - We Like AGC N, MOD = int(eval(input())), 10**9 + 7 memo = [{} for i in range(N + 1)] def ok(last4): for i in range(4): t = list(last4) if i >= 1: t[i - 1], t[i] = t[i], t[i - 1] if "".join(t).count("AGC") >= 1: return False return True def dfs(cur,...
false
13.793103
[ "-from collections import defaultdict", "-", "-N = int(eval(input()))", "-dp = [defaultdict(int) for _ in range(N + 1)]", "-MOD = 10**9 + 7", "-dp[0][\"TTT\"] = 1", "+# ABC122D - We Like AGC", "+N, MOD = int(eval(input())), 10**9 + 7", "+memo = [{} for i in range(N + 1)]", "- l = list(last4...
false
0.105675
0.111179
0.950491
[ "s900163013", "s374321293" ]
u924691798
p03363
python
s856232090
s330349006
332
259
112,976
41,684
Accepted
Accepted
21.99
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) S = [0]*(N+1) dic = defaultdict(int) dic[0] = 1 for i in range(1,N+1): S[i] = S[i-1] + A[i-1] dic[S[i]] += 1 ans = 0 for _,v in list(dic.items()): if v > 0: ans += v*(v-1)//2 print(ans)
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) S = [0]*(N+1) for i in range(1,N+1): S[i] = S[i-1] + A[i-1] ans = 0 dic = defaultdict(int) for i in range(N+1): ans += dic[S[i]] dic[S[i]] += 1 print(ans)
15
13
304
269
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) S = [0] * (N + 1) dic = defaultdict(int) dic[0] = 1 for i in range(1, N + 1): S[i] = S[i - 1] + A[i - 1] dic[S[i]] += 1 ans = 0 for _, v in list(dic.items()): if v > 0: ans += v * (v - 1) // 2 print(ans)
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) S = [0] * (N + 1) for i in range(1, N + 1): S[i] = S[i - 1] + A[i - 1] ans = 0 dic = defaultdict(int) for i in range(N + 1): ans += dic[S[i]] dic[S[i]] += 1 print(ans)
false
13.333333
[ "-dic = defaultdict(int)", "-dic[0] = 1", "+ans = 0", "+dic = defaultdict(int)", "+for i in range(N + 1):", "+ ans += dic[S[i]]", "-ans = 0", "-for _, v in list(dic.items()):", "- if v > 0:", "- ans += v * (v - 1) // 2" ]
false
0.042056
0.045077
0.932985
[ "s856232090", "s330349006" ]
u022407960
p02378
python
s871902288
s325675326
50
40
9,224
9,248
Accepted
Accepted
20
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 3 4 6 0 0 0 2 0 3 1 1 2 1 2 3 output: 3 """ import sys def generate_adj_table(_edges): for edge in _edges: vx, vy = list(map(int, edge)) init_adj_table[vx].add(vy) return init_adj_table def graph_dfs(cur...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 3 4 6 0 0 0 2 0 3 1 1 2 1 2 3 output: 3 """ import sys def graph_dfs(current, matching, visited): for target in range(y_num): if (not visited[target]) and (target in adj_table[current]): visited[target] = True ...
60
50
1,414
1,091
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 3 4 6 0 0 0 2 0 3 1 1 2 1 2 3 output: 3 """ import sys def generate_adj_table(_edges): for edge in _edges: vx, vy = list(map(int, edge)) init_adj_table[vx].add(vy) return init_adj_table def graph_dfs(current, matching, visited): fo...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 3 4 6 0 0 0 2 0 3 1 1 2 1 2 3 output: 3 """ import sys def graph_dfs(current, matching, visited): for target in range(y_num): if (not visited[target]) and (target in adj_table[current]): visited[target] = True if matching[tar...
false
16.666667
[ "-def generate_adj_table(_edges):", "- for edge in _edges:", "- vx, vy = list(map(int, edge))", "- init_adj_table[vx].add(vy)", "- return init_adj_table", "-", "-", "- # matching[target] = -1: target not assigned to any of x", "- # graph_dfs(matching[target]...
false
0.045022
0.040603
1.108852
[ "s871902288", "s325675326" ]
u695811449
p02863
python
s514429322
s951986557
585
321
51,804
44,396
Accepted
Accepted
45.13
import sys input = sys.stdin.readline N,T=list(map(int,input().split())) D=[tuple(map(int,input().split())) for i in range(N)] D.sort(key=lambda x:x[1],reverse=True) DP=[[0,0] for i in range(T+1)] for ind,(x,y) in enumerate(D): for time in range(T,x-1,-1): if DP[time][0]<DP[time-x][0]+y: ...
import sys input = sys.stdin.readline N,T=list(map(int,input().split())) D=[tuple(map(int,input().split())) for i in range(N)] D.sort() DP=[0]*(T+1) ANS=0 for i in range(N): a,b=D[i] for j in range(T,a-1,-1): DP[j]=max(DP[j-a]+b,DP[j]) for j in range(i+1,N): ANS=max(ANS...
39
20
866
345
import sys input = sys.stdin.readline N, T = list(map(int, input().split())) D = [tuple(map(int, input().split())) for i in range(N)] D.sort(key=lambda x: x[1], reverse=True) DP = [[0, 0] for i in range(T + 1)] for ind, (x, y) in enumerate(D): for time in range(T, x - 1, -1): if DP[time][0] < DP[time - x][...
import sys input = sys.stdin.readline N, T = list(map(int, input().split())) D = [tuple(map(int, input().split())) for i in range(N)] D.sort() DP = [0] * (T + 1) ANS = 0 for i in range(N): a, b = D[i] for j in range(T, a - 1, -1): DP[j] = max(DP[j - a] + b, DP[j]) for j in range(i + 1, N): ...
false
48.717949
[ "-D.sort(key=lambda x: x[1], reverse=True)", "-DP = [[0, 0] for i in range(T + 1)]", "-for ind, (x, y) in enumerate(D):", "- for time in range(T, x - 1, -1):", "- if DP[time][0] < DP[time - x][0] + y:", "- if DP[time - x][1] == ind:", "- DP[time] = [DP[time - x][0] + ...
false
0.045387
0.081961
0.553765
[ "s514429322", "s951986557" ]
u186838327
p02728
python
s370181439
s991148125
2,730
2,050
175,916
128,312
Accepted
Accepted
24.91
import sys input = sys.stdin.readline def main(): n = int(eval(input())) g = [[] for _ in range(n)] for i in range(n-1): a, b = list(map(int, input().split())) a, b = a-1, b-1 g[a].append(b) g[b].append(a) mod = 10**9+7 #出力の制限 N = 10**6 g1 = [1, 1]...
n = int(eval(input())) mod = 10**9+7 #出力の制限 N = 10**6 g1 = [1, 1] # 元テーブル g2 = [1, 1] #逆元テーブル inverse = [0, 1] #逆元テーブル計算用テーブル for i in range( 2, N + 1 ): g1.append( ( g1[-1] * i ) % mod ) inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod ) g2.append( (g2[-1] * inverse[-1]) % mod ) g = [...
68
67
1,657
1,418
import sys input = sys.stdin.readline def main(): n = int(eval(input())) g = [[] for _ in range(n)] for i in range(n - 1): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 g[a].append(b) g[b].append(a) mod = 10**9 + 7 # 出力の制限 N = 10**6 g1 = [1, 1] #...
n = int(eval(input())) mod = 10**9 + 7 # 出力の制限 N = 10**6 g1 = [1, 1] # 元テーブル g2 = [1, 1] # 逆元テーブル inverse = [0, 1] # 逆元テーブル計算用テーブル for i in range(2, N + 1): g1.append((g1[-1] * i) % mod) inverse.append((-inverse[mod % i] * (mod // i)) % mod) g2.append((g2[-1] * inverse[-1]) % mod) g = [[] for _ in range...
false
1.470588
[ "-import sys", "-", "-input = sys.stdin.readline", "-", "-", "-def main():", "- n = int(eval(input()))", "- g = [[] for _ in range(n)]", "- for i in range(n - 1):", "- a, b = list(map(int, input().split()))", "- a, b = a - 1, b - 1", "- g[a].append(b)", "- ...
false
1.0956
1.355927
0.808008
[ "s370181439", "s991148125" ]
u361381049
p03112
python
s286406550
s648557253
322
284
82,616
82,904
Accepted
Accepted
11.8
import sys input = sys.stdin.readline INF = 10**11 A,B,Q = list(map(int,input().split())) s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] def binary_search(lis,x): ok = 0 ng = len(lis)-1 while ng-ok > 1: mid = (ok+ng)/...
import sys input = sys.stdin.readline INF = 10**11 A,B,Q = list(map(int,input().split())) s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] def binary_search(lis,x): ok = 0 ng = len(lis)-1 while ng-ok > 1: mid = (ok+ng)/...
34
28
917
731
import sys input = sys.stdin.readline INF = 10**11 A, B, Q = list(map(int, input().split())) s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] def binary_search(lis, x): ok = 0 ng = len(lis) - 1 while ng - ok > 1: mid = (ok + n...
import sys input = sys.stdin.readline INF = 10**11 A, B, Q = list(map(int, input().split())) s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] def binary_search(lis, x): ok = 0 ng = len(lis) - 1 while ng - ok > 1: mid = (ok + n...
false
17.647059
[ "- ds = x - s[i]", "- dt = x - t[j]", "- if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):", "- ans = min(ans, max(abs(ds), abs(dt)))", "- else:", "- ans = min(ans, abs(ds) + abs(dt) + min(abs(ds), abs(dt)))", "+ ans = min...
false
0.047103
0.066227
0.711239
[ "s286406550", "s648557253" ]
u334712262
p02955
python
s421731614
s595289815
478
251
6,216
41,560
Accepted
Accepted
47.49
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().spli...
103
92
1,970
1,616
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62 - 1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().split())) def r...
false
10.679612
[ "-import bisect", "-import heapq", "-import math", "-import random", "-from collections import Counter, defaultdict, deque", "-from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal", "-from functools import lru_cache, reduce", "-from itertools import combinations, combinations_with_replacement, pr...
false
0.037561
0.007414
5.066326
[ "s421731614", "s595289815" ]
u490642448
p04008
python
s558097404
s273974586
404
256
116,868
122,604
Accepted
Accepted
36.63
from heapq import heappop,heappush n,k = list(map(int,input().split())) a = [0] + list(map(int,input().split())) ans = 0 if(a[1] != 1): ans += 1 links_c = [set() for _ in range(n+1)] for i,ai in enumerate(a[2:],2): links_c[ai].add(i) depth = [-1] * (n+1) depth[1] = 0 stack = [1] hq = [] whi...
n,k = list(map(int,input().split())) a = [0] + list(map(int,input().split())) ans = 0 if(a[1] != 1): ans += 1 links_c = [set() for _ in range(n+1)] for i,ai in enumerate(a[2:],2): links_c[ai].add(i) depth = [-1] * (n+1) depth[1] = 0 stack = [1] ts = [(0,1)] while(stack): next = [] wh...
66
46
1,208
926
from heapq import heappop, heappush n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) ans = 0 if a[1] != 1: ans += 1 links_c = [set() for _ in range(n + 1)] for i, ai in enumerate(a[2:], 2): links_c[ai].add(i) depth = [-1] * (n + 1) depth[1] = 0 stack = [1] hq = [] while stack: ...
n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) ans = 0 if a[1] != 1: ans += 1 links_c = [set() for _ in range(n + 1)] for i, ai in enumerate(a[2:], 2): links_c[ai].add(i) depth = [-1] * (n + 1) depth[1] = 0 stack = [1] ts = [(0, 1)] while stack: next = [] while stack: ...
false
30.30303
[ "-from heapq import heappop, heappush", "-", "-hq = []", "+ts = [(0, 1)]", "- heappush(hq, (depth[j] * -1, j))", "+ ts.append((depth[j], j))", "-while hq[0][0] * -1 > k:", "- di, i = heappop(hq)", "+while ts[-1][0] > k:", "+ di, i = ts.pop()", "-\"\"\"", "-首都の自己ループを...
false
0.066151
0.048351
1.368141
[ "s558097404", "s273974586" ]
u475675023
p02743
python
s773285387
s005052176
36
18
5,332
2,940
Accepted
Accepted
50
import decimal a,b,c=list(map(int,input().split())) print((["No","Yes"][decimal.Decimal(a).sqrt()+decimal.Decimal(b).sqrt()<decimal.Decimal(c).sqrt()]))
a,b,c=list(map(int,input().split())) print((["No","Yes"][4*a*b<(c-a-b)**2 and c-a-b>0]))
3
2
146
81
import decimal a, b, c = list(map(int, input().split())) print( ( ["No", "Yes"][ decimal.Decimal(a).sqrt() + decimal.Decimal(b).sqrt() < decimal.Decimal(c).sqrt() ] ) )
a, b, c = list(map(int, input().split())) print((["No", "Yes"][4 * a * b < (c - a - b) ** 2 and c - a - b > 0]))
false
33.333333
[ "-import decimal", "-", "-print(", "- (", "- [\"No\", \"Yes\"][", "- decimal.Decimal(a).sqrt() + decimal.Decimal(b).sqrt()", "- < decimal.Decimal(c).sqrt()", "- ]", "- )", "-)", "+print(([\"No\", \"Yes\"][4 * a * b < (c - a - b) ** 2 and c - a - b > 0]))...
false
0.044924
0.095618
0.469824
[ "s773285387", "s005052176" ]
u677121387
p03262
python
s212268715
s681082402
109
96
14,252
14,252
Accepted
Accepted
11.93
def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) n,x = list(map(int,input().split())) lstx = [int(i) for i in input().split()] lstx.append(x) dx = [abs(lstx[i]-lstx[i-1]) for i in range(1,n+1)] g = dx[0] for i in range(1,n): g = gcd(g,dx[i]) print(g)
def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) n,x = list(map(int,input().split())) lstx = [int(i) for i in input().split()] g = abs(lstx[0]-x) for i in range(1,n): g = gcd(g,abs(lstx[i]-x)) print(g)
16
13
301
244
def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) n, x = list(map(int, input().split())) lstx = [int(i) for i in input().split()] lstx.append(x) dx = [abs(lstx[i] - lstx[i - 1]) for i in range(1, n + 1)] g = dx[0] for i in range(1, n): g = gcd(g, dx[i]) print(g)
def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) n, x = list(map(int, input().split())) lstx = [int(i) for i in input().split()] g = abs(lstx[0] - x) for i in range(1, n): g = gcd(g, abs(lstx[i] - x)) print(g)
false
18.75
[ "-lstx.append(x)", "-dx = [abs(lstx[i] - lstx[i - 1]) for i in range(1, n + 1)]", "-g = dx[0]", "+g = abs(lstx[0] - x)", "- g = gcd(g, dx[i])", "+ g = gcd(g, abs(lstx[i] - x))" ]
false
0.007973
0.032222
0.247433
[ "s212268715", "s681082402" ]
u241159583
p03151
python
s795726622
s376733587
136
110
18,356
24,692
Accepted
Accepted
19.12
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) if sum(a) < sum(b): print((-1)) else: cnt = 0 Abs = [] s = 0 for i in range(n): if a[i] < b[i]: cnt += 1 s += b[i]-a[i] elif a[i] > b[i]: Abs...
from collections import deque n = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) # Aの総和 = Cの総和 p = [] cnt_p = 0 cnt_m = 0 x = 0 for a,b in zip(A,B): if a > b: cnt_p += 1 p.append(a-b) elif a < b: cnt_m += 1 x += b-a if...
22
30
456
526
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) if sum(a) < sum(b): print((-1)) else: cnt = 0 Abs = [] s = 0 for i in range(n): if a[i] < b[i]: cnt += 1 s += b[i] - a[i] elif a[i] > b[i]: Abs.append(a[...
from collections import deque n = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) # Aの総和 = Cの総和 p = [] cnt_p = 0 cnt_m = 0 x = 0 for a, b in zip(A, B): if a > b: cnt_p += 1 p.append(a - b) elif a < b: cnt_m += 1 x += b - a if cnt_m == 0...
false
26.666667
[ "+from collections import deque", "+", "-a = list(map(int, input().split()))", "-b = list(map(int, input().split()))", "-if sum(a) < sum(b):", "+A = list(map(int, input().split()))", "+B = list(map(int, input().split()))", "+# Aの総和 = Cの総和", "+p = []", "+cnt_p = 0", "+cnt_m = 0", "+x = 0", "+...
false
0.114011
0.053418
2.134307
[ "s795726622", "s376733587" ]
u073549161
p03416
python
s532479961
s572562588
226
186
42,988
40,684
Accepted
Accepted
17.7
a,b = list(map(int, input().split())) c = 0 for i in range(a, b+1): s = str(i) sr = "".join(list(reversed(s))) if s== sr: c+=1 print(c)
a,b = list(map(int, input().split())) res = 0 for i in range(a, b + 1): s1 = str(i) s2 = s1[::-1] if s1 == s2: res += 1 print(res)
8
8
156
151
a, b = list(map(int, input().split())) c = 0 for i in range(a, b + 1): s = str(i) sr = "".join(list(reversed(s))) if s == sr: c += 1 print(c)
a, b = list(map(int, input().split())) res = 0 for i in range(a, b + 1): s1 = str(i) s2 = s1[::-1] if s1 == s2: res += 1 print(res)
false
0
[ "-c = 0", "+res = 0", "- s = str(i)", "- sr = \"\".join(list(reversed(s)))", "- if s == sr:", "- c += 1", "-print(c)", "+ s1 = str(i)", "+ s2 = s1[::-1]", "+ if s1 == s2:", "+ res += 1", "+print(res)" ]
false
0.212282
0.045166
4.700012
[ "s532479961", "s572562588" ]
u327466606
p02599
python
s878364374
s329851652
1,547
988
242,264
238,472
Accepted
Accepted
36.13
class BinaryIndexedTree: def __init__(self, size): self.data = [0] * (size+1) self.size = size+1 self.msb = 1 << (size.bit_length()-1) def _add(self, i, w): i += 1 while i < self.size: self.data[i] += w i += i & -i def _ge...
class BinaryIndexedTree: def __init__(self, size): self.data = [0] * (size+1) self.size = size+1 self.msb = 1 << (size.bit_length()-1) def _add(self, i, w): i += 1 while i < self.size: self.data[i] += w i += i & -i def _ge...
120
121
2,862
2,888
class BinaryIndexedTree: def __init__(self, size): self.data = [0] * (size + 1) self.size = size + 1 self.msb = 1 << (size.bit_length() - 1) def _add(self, i, w): i += 1 while i < self.size: self.data[i] += w i += i & -i def _get_sum(self, i)...
class BinaryIndexedTree: def __init__(self, size): self.data = [0] * (size + 1) self.size = size + 1 self.msb = 1 << (size.bit_length() - 1) def _add(self, i, w): i += 1 while i < self.size: self.data[i] += w i += i & -i def _get_sum(self, i)...
false
0.826446
[ "- sorted_qi = sorted(range(Q), key=lambda i: queries[i][1])", "- for qi in sorted_qi:", "+ MASK = (1 << 20) - 1", "+ for ri in sorted((r << 20) | i for i, (l, r) in enumerate(queries)):", "+ qi = ri & MASK" ]
false
0.107034
0.045127
2.371867
[ "s878364374", "s329851652" ]
u209299893
p02786
python
s434160264
s932482346
20
17
2,940
3,060
Accepted
Accepted
15
H = int(eval(input())) ans = 1 if H == 1: print((1)) exit() while True: tmp = ans*2 + 1 if H > ans and H <= tmp: print(tmp) exit() else: ans = tmp
H = int(eval(input())) def attackCount(hitpoint): if hitpoint == 1: return 1 elif hitpoint > 1: return 2*attackCount(hitpoint//2)+1 else: raise ValueError print((attackCount(H)))
15
14
199
224
H = int(eval(input())) ans = 1 if H == 1: print((1)) exit() while True: tmp = ans * 2 + 1 if H > ans and H <= tmp: print(tmp) exit() else: ans = tmp
H = int(eval(input())) def attackCount(hitpoint): if hitpoint == 1: return 1 elif hitpoint > 1: return 2 * attackCount(hitpoint // 2) + 1 else: raise ValueError print((attackCount(H)))
false
6.666667
[ "-ans = 1", "-if H == 1:", "- print((1))", "- exit()", "-while True:", "- tmp = ans * 2 + 1", "- if H > ans and H <= tmp:", "- print(tmp)", "- exit()", "+", "+", "+def attackCount(hitpoint):", "+ if hitpoint == 1:", "+ return 1", "+ elif hitpoint > ...
false
0.04902
0.048353
1.013794
[ "s434160264", "s932482346" ]
u952708174
p02684
python
s419754427
s746208509
318
131
56,804
32,332
Accepted
Accepted
58.81
def d_teleporter(): N, K = [int(i) for i in input().split()] A = [int(i) - 1 for i in input().split()] # 0-origin from collections import defaultdict visit = [0] visit_dict = defaultdict(list) visit_dict[0] = [0] current = 0 is_found_first = False for i in range(N): ...
def d_teleporter(): N, K = [int(i) for i in input().split()] A = [int(i) - 1 for i in input().split()] # 0-origin visit_list, visit_dict = list(), dict() current_city = 0 for i in range(min(K, N)): # N 回移動すればループはわかる current_city = A[current_city] if current_city in visit_d...
29
18
931
665
def d_teleporter(): N, K = [int(i) for i in input().split()] A = [int(i) - 1 for i in input().split()] # 0-origin from collections import defaultdict visit = [0] visit_dict = defaultdict(list) visit_dict[0] = [0] current = 0 is_found_first = False for i in range(N): current...
def d_teleporter(): N, K = [int(i) for i in input().split()] A = [int(i) - 1 for i in input().split()] # 0-origin visit_list, visit_dict = list(), dict() current_city = 0 for i in range(min(K, N)): # N 回移動すればループはわかる current_city = A[current_city] if current_city in visit_dict: # ル...
false
37.931034
[ "- from collections import defaultdict", "-", "- visit = [0]", "- visit_dict = defaultdict(list)", "- visit_dict[0] = [0]", "- current = 0", "- is_found_first = False", "- for i in range(N):", "- current = A[current]", "- if len(visit_dict[current]) == 1 and not ...
false
0.034829
0.034632
1.005673
[ "s419754427", "s746208509" ]
u934442292
p02804
python
s955076039
s284819372
185
162
24,628
24,824
Accepted
Accepted
12.43
import sys input = sys.stdin.readline P = 10 ** 9 + 7 def make_fac_tables_mod_p(n, p): fac = [0] * (n + 1) fac_inv = [0] * (n + 1) mod_inv = [0] * (n + 1) fac[0] = fac[1] = 1 fac_inv[0] = fac_inv[1] = 1 mod_inv[1] = 1 for i in range(2, n + 1): fac[i] = (fac[i - 1] * ...
import sys input = sys.stdin.readline P = 10 ** 9 + 7 class MODCombination: def __init__(self, n, p): self.n = n self.p = p # MOD self.fac, self.ifac = self.make_fac_tables_mod_p(n, p) @staticmethod def make_fac_tables_mod_p(n, p): assert n >= 1 fa...
58
51
1,304
1,307
import sys input = sys.stdin.readline P = 10**9 + 7 def make_fac_tables_mod_p(n, p): fac = [0] * (n + 1) fac_inv = [0] * (n + 1) mod_inv = [0] * (n + 1) fac[0] = fac[1] = 1 fac_inv[0] = fac_inv[1] = 1 mod_inv[1] = 1 for i in range(2, n + 1): fac[i] = (fac[i - 1] * i) % p m...
import sys input = sys.stdin.readline P = 10**9 + 7 class MODCombination: def __init__(self, n, p): self.n = n self.p = p # MOD self.fac, self.ifac = self.make_fac_tables_mod_p(n, p) @staticmethod def make_fac_tables_mod_p(n, p): assert n >= 1 fac = [0] * (n + 1)...
false
12.068966
[ "-def make_fac_tables_mod_p(n, p):", "- fac = [0] * (n + 1)", "- fac_inv = [0] * (n + 1)", "- mod_inv = [0] * (n + 1)", "- fac[0] = fac[1] = 1", "- fac_inv[0] = fac_inv[1] = 1", "- mod_inv[1] = 1", "- for i in range(2, n + 1):", "- fac[i] = (fac[i - 1] * i) % p", "- ...
false
0.050277
0.050285
0.99985
[ "s955076039", "s284819372" ]
u562935282
p03213
python
s079149803
s045346478
23
17
3,436
3,064
Accepted
Accepted
26.09
from collections import defaultdict def cand_count(v, d): return len(tuple([x for x in list(d.values()) if x >= v])) n = int(eval(input())) d = defaultdict(int) for i in range(2, n + 1): b = i j = 2 while j * j <= i: while b % j == 0: b //= j d[j] += ...
def num(v): return len(tuple([x for x in e if x >= v - 1])) n = int(eval(input())) e = [0] * (n + 1) for i in range(2, n + 1): b = i j = 2 while j * j <= i: while b % j == 0: b //= j e[j] += 1 j += 1 if b > 1: e[b] += 1 e = tuple([x...
29
25
628
494
from collections import defaultdict def cand_count(v, d): return len(tuple([x for x in list(d.values()) if x >= v])) n = int(eval(input())) d = defaultdict(int) for i in range(2, n + 1): b = i j = 2 while j * j <= i: while b % j == 0: b //= j d[j] += 1 j += 1 ...
def num(v): return len(tuple([x for x in e if x >= v - 1])) n = int(eval(input())) e = [0] * (n + 1) for i in range(2, n + 1): b = i j = 2 while j * j <= i: while b % j == 0: b //= j e[j] += 1 j += 1 if b > 1: e[b] += 1 e = tuple([x for x in e if x >...
false
13.793103
[ "-from collections import defaultdict", "-", "-", "-def cand_count(v, d):", "- return len(tuple([x for x in list(d.values()) if x >= v]))", "+def num(v):", "+ return len(tuple([x for x in e if x >= v - 1]))", "-d = defaultdict(int)", "+e = [0] * (n + 1)", "- d[j] += 1", "+ ...
false
0.034778
0.077347
0.449639
[ "s079149803", "s045346478" ]
u199588618
p02682
python
s229750487
s301237687
61
56
61,756
61,836
Accepted
Accepted
8.2
a,b,c,k = list(map(int, input().split())) count = 0 if a <= k: count += a else: count += k print(count) exit() k -= a if b <= k: k -= b else: print(count) exit() count -= k print(count)
A,B,C,K=list(map(int,input().split())) if (A+B)>=K and A<=K: print(A) elif (A+B)>=K and A>=K: print(K) elif (A+B)<K: print((A-(K-A-B)))
21
7
232
145
a, b, c, k = list(map(int, input().split())) count = 0 if a <= k: count += a else: count += k print(count) exit() k -= a if b <= k: k -= b else: print(count) exit() count -= k print(count)
A, B, C, K = list(map(int, input().split())) if (A + B) >= K and A <= K: print(A) elif (A + B) >= K and A >= K: print(K) elif (A + B) < K: print((A - (K - A - B)))
false
66.666667
[ "-a, b, c, k = list(map(int, input().split()))", "-count = 0", "-if a <= k:", "- count += a", "-else:", "- count += k", "- print(count)", "- exit()", "-k -= a", "-if b <= k:", "- k -= b", "-else:", "- print(count)", "- exit()", "-count -= k", "-print(count)", "+A...
false
0.09172
0.090911
1.008903
[ "s229750487", "s301237687" ]
u608088992
p02720
python
s039028698
s243759537
441
121
43,244
24,008
Accepted
Accepted
72.56
import sys from collections import deque def solve(): input = sys.stdin.readline K = int(eval(input())) low, high = 0, 3234566668 while high - low > 1: mid = (low + high) // 2 midS = str(mid) lenS = len(midS) q = deque() fo...
import sys from collections import deque def solve(): input = sys.stdin.readline K = int(eval(input())) q = deque() for i in range(9): q.append((i + 1, i + 1)) lunlun = 1 while lunlun < K: nowNum, lastNum = q.popleft() if lastNum > 0: q.append((nowNum * 10 + lastNum -...
44
22
1,607
587
import sys from collections import deque def solve(): input = sys.stdin.readline K = int(eval(input())) low, high = 0, 3234566668 while high - low > 1: mid = (low + high) // 2 midS = str(mid) lenS = len(midS) q = deque() for j in range(lenS): for i i...
import sys from collections import deque def solve(): input = sys.stdin.readline K = int(eval(input())) q = deque() for i in range(9): q.append((i + 1, i + 1)) lunlun = 1 while lunlun < K: nowNum, lastNum = q.popleft() if lastNum > 0: q.append((nowNum * 10 +...
false
50
[ "- low, high = 0, 3234566668", "- while high - low > 1:", "- mid = (low + high) // 2", "- midS = str(mid)", "- lenS = len(midS)", "- q = deque()", "- for j in range(lenS):", "- for i in range(1, 10):", "- q.append((i, i, j + 1))", ...
false
0.728572
0.046447
15.685965
[ "s039028698", "s243759537" ]
u912237403
p00002
python
s564856525
s604280708
20
10
4,180
4,184
Accepted
Accepted
50
import sys for s in sys.stdin: print(len(str(sum(map(int,s.split())))))
import sys for s in sys.stdin: x=len(str(sum(map(int,s.split())))) print(x)
3
4
76
86
import sys for s in sys.stdin: print(len(str(sum(map(int, s.split())))))
import sys for s in sys.stdin: x = len(str(sum(map(int, s.split())))) print(x)
false
25
[ "- print(len(str(sum(map(int, s.split())))))", "+ x = len(str(sum(map(int, s.split()))))", "+ print(x)" ]
false
0.046015
0.048099
0.956669
[ "s564856525", "s604280708" ]
u357751375
p02784
python
s019286989
s024711136
59
49
13,964
20,520
Accepted
Accepted
16.95
h,n = list(map(int,input().split())) a = list(map(int,input().split())) for i in range(n): h = h - a[i] if h <= 0: print('Yes') exit(0) print('No')
h,n = list(map(int,input().split())) a = list(map(int,input().split())) a = sum(a) if a >= h: print('Yes') else: print('No')
10
7
176
132
h, n = list(map(int, input().split())) a = list(map(int, input().split())) for i in range(n): h = h - a[i] if h <= 0: print("Yes") exit(0) print("No")
h, n = list(map(int, input().split())) a = list(map(int, input().split())) a = sum(a) if a >= h: print("Yes") else: print("No")
false
30
[ "-for i in range(n):", "- h = h - a[i]", "- if h <= 0:", "- print(\"Yes\")", "- exit(0)", "-print(\"No\")", "+a = sum(a)", "+if a >= h:", "+ print(\"Yes\")", "+else:", "+ print(\"No\")" ]
false
0.038817
0.036579
1.061187
[ "s019286989", "s024711136" ]
u969708690
p03998
python
s634973860
s021579756
32
25
9,132
8,956
Accepted
Accepted
21.88
a=eval(input()) b=eval(input()) c=eval(input()) a+="A" b+="B" c+="C" n=a while True: if len(n)>1: k=n[0] if n==a: a=a[1:] elif n==b: b=b[1:] else: c=c[1:] if k=="a": n=a elif k=="b": n=b else: n=c else: print((n[-1])) br...
A=eval(input()) B=eval(input()) C=eval(input()) moto=A suji="a" while True: if len(moto)==0: if suji=="a": print("A") exit() if suji=="b": print("B") exit() if suji=="c": print("C") exit() s=moto[0] if suji=="a": A=A[1:] if suji=="b": B...
25
32
303
458
a = eval(input()) b = eval(input()) c = eval(input()) a += "A" b += "B" c += "C" n = a while True: if len(n) > 1: k = n[0] if n == a: a = a[1:] elif n == b: b = b[1:] else: c = c[1:] if k == "a": n = a elif k == "b": ...
A = eval(input()) B = eval(input()) C = eval(input()) moto = A suji = "a" while True: if len(moto) == 0: if suji == "a": print("A") exit() if suji == "b": print("B") exit() if suji == "c": print("C") exit() s = moto[...
false
21.875
[ "-a = eval(input())", "-b = eval(input())", "-c = eval(input())", "-a += \"A\"", "-b += \"B\"", "-c += \"C\"", "-n = a", "+A = eval(input())", "+B = eval(input())", "+C = eval(input())", "+moto = A", "+suji = \"a\"", "- if len(n) > 1:", "- k = n[0]", "- if n == a:", "-...
false
0.048706
0.040548
1.201183
[ "s634973860", "s021579756" ]
u372144784
p03607
python
s619820309
s671322249
544
102
53,592
15,068
Accepted
Accepted
81.25
n = int(eval(input())) ans = 0 dic1 = dict() for i in range(n): a = int(eval(input())) if a in dic1: dic1[a] += 1 else: dic1[a] = 1 for i in list(dic1.values()): ans += i%2 print(ans)
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 dic1 = dict() n = int(readline()) for i in range(n): a = int(readline()) if a in dic1: dic1[a] += 1 else: dic1[a] = 1 ans = 0 for i in list(dic1.values()): if not even(i): a...
12
19
208
333
n = int(eval(input())) ans = 0 dic1 = dict() for i in range(n): a = int(eval(input())) if a in dic1: dic1[a] += 1 else: dic1[a] = 1 for i in list(dic1.values()): ans += i % 2 print(ans)
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n % 2 == 0 else 0 dic1 = dict() n = int(readline()) for i in range(n): a = int(readline()) if a in dic1: dic1[a] += 1 else: dic1[a] = 1 ans = 0 for i in list(dic1.values()): if not even(i): ans += 1...
false
36.842105
[ "-n = int(eval(input()))", "-ans = 0", "+import sys", "+", "+readline = sys.stdin.buffer.readline", "+", "+", "+def even(n):", "+ return 1 if n % 2 == 0 else 0", "+", "+", "+n = int(readline())", "- a = int(eval(input()))", "+ a = int(readline())", "+ans = 0", "- ans += i %...
false
0.035596
0.035559
1.001033
[ "s619820309", "s671322249" ]
u186838327
p02725
python
s399759239
s256756116
261
121
77,900
102,588
Accepted
Accepted
53.64
k, n = list(map(int, input().split())) A = list(map(int, input().split())) D = [0]*n for i in range(n): if i != n-1: D[i] = A[i+1]-A[i] if i == n-1: D[i] = A[0]+k-A[i] #print(D) ans = k - max(D) print(ans)
k, n = list(map(int, input().split())) A = list(map(int, input().split())) D = [] for i in range(n-1): D.append(A[i+1]-A[i]) else: D.append(k-(A[n-1]-A[0])) D.sort(reverse=True) print((k-D[0]))
12
9
236
202
k, n = list(map(int, input().split())) A = list(map(int, input().split())) D = [0] * n for i in range(n): if i != n - 1: D[i] = A[i + 1] - A[i] if i == n - 1: D[i] = A[0] + k - A[i] # print(D) ans = k - max(D) print(ans)
k, n = list(map(int, input().split())) A = list(map(int, input().split())) D = [] for i in range(n - 1): D.append(A[i + 1] - A[i]) else: D.append(k - (A[n - 1] - A[0])) D.sort(reverse=True) print((k - D[0]))
false
25
[ "-D = [0] * n", "-for i in range(n):", "- if i != n - 1:", "- D[i] = A[i + 1] - A[i]", "- if i == n - 1:", "- D[i] = A[0] + k - A[i]", "-# print(D)", "-ans = k - max(D)", "-print(ans)", "+D = []", "+for i in range(n - 1):", "+ D.append(A[i + 1] - A[i])", "+else:", "+...
false
0.062872
0.06428
0.978091
[ "s399759239", "s256756116" ]
u532966492
p03088
python
s156941885
s113816543
198
127
5,572
3,892
Accepted
Accepted
35.86
from functools import lru_cache N = int(eval(input())) mod = 10**9+7 def check(s): for i in range(4): l=list(s) if i>0: l[i-1],l[i]=l[i],l[i-1] if "".join(l).count("AGC"): return False else: return True @lru_cache(maxsize=None) def dfp(i,s...
N = int(eval(input())) mod = 10**9+7 def check(s): for i in range(4): l=list(s) if i>0: l[i-1],l[i]=l[i],l[i-1] if "".join(l).count("AGC"): return False else: return True memo=[dict() for _ in range(N)] def dfp(i,seq): if i==N: ...
25
27
505
556
from functools import lru_cache N = int(eval(input())) mod = 10**9 + 7 def check(s): for i in range(4): l = list(s) if i > 0: l[i - 1], l[i] = l[i], l[i - 1] if "".join(l).count("AGC"): return False else: return True @lru_cache(maxsize=None) def dfp(i...
N = int(eval(input())) mod = 10**9 + 7 def check(s): for i in range(4): l = list(s) if i > 0: l[i - 1], l[i] = l[i], l[i - 1] if "".join(l).count("AGC"): return False else: return True memo = [dict() for _ in range(N)] def dfp(i, seq): if i == N:...
false
7.407407
[ "-from functools import lru_cache", "-", "-@lru_cache(maxsize=None)", "+memo = [dict() for _ in range(N)]", "+", "+", "- ret = 0", "+ if seq in memo[i]:", "+ return memo[i][seq]", "+ ret = 0", "+ memo[i][seq] = ret" ]
false
0.096727
0.13464
0.718412
[ "s156941885", "s113816543" ]
u539692012
p02594
python
s302586221
s810766470
84
29
61,384
9,076
Accepted
Accepted
65.48
print(('Yes' if int(eval(input())) >= 30 else 'No'))
print(('YNeos'[int(eval(input()))<30::2]))
1
1
44
34
print(("Yes" if int(eval(input())) >= 30 else "No"))
print(("YNeos"[int(eval(input())) < 30 :: 2]))
false
0
[ "-print((\"Yes\" if int(eval(input())) >= 30 else \"No\"))", "+print((\"YNeos\"[int(eval(input())) < 30 :: 2]))" ]
false
0.05049
0.05221
0.96706
[ "s302586221", "s810766470" ]
u797016134
p03317
python
s425558591
s552463081
40
17
13,940
3,060
Accepted
Accepted
57.5
n,k = list(map(int, input().split())) a = list(map(int, input().split())) if (n-k)%(k-1) == 0: print(((n-k)//(k-1)+1)) else: print(((n-k)//(k-1)+2))
n,k = list(map(int, input().split())) if (n-k)%(k-1) == 0: print(((n-k)//(k-1)+1)) else: print(((n-k)//(k-1)+2))
7
5
153
114
n, k = list(map(int, input().split())) a = list(map(int, input().split())) if (n - k) % (k - 1) == 0: print(((n - k) // (k - 1) + 1)) else: print(((n - k) // (k - 1) + 2))
n, k = list(map(int, input().split())) if (n - k) % (k - 1) == 0: print(((n - k) // (k - 1) + 1)) else: print(((n - k) // (k - 1) + 2))
false
28.571429
[ "-a = list(map(int, input().split()))" ]
false
0.039727
0.065756
0.604152
[ "s425558591", "s552463081" ]
u605879293
p02397
python
s485442322
s068104009
60
50
7,596
7,604
Accepted
Accepted
16.67
while True: x, y = sorted(map(int, input().split())) if x == 0 and y == 0: break print((x, y))
while True: x, y = sorted(map(int, input().split())) if (x, y) == (0, 0): break print((x, y))
5
5
101
100
while True: x, y = sorted(map(int, input().split())) if x == 0 and y == 0: break print((x, y))
while True: x, y = sorted(map(int, input().split())) if (x, y) == (0, 0): break print((x, y))
false
0
[ "- if x == 0 and y == 0:", "+ if (x, y) == (0, 0):" ]
false
0.03813
0.038664
0.98619
[ "s485442322", "s068104009" ]
u597455618
p03200
python
s392218726
s313234066
232
90
14,472
3,500
Accepted
Accepted
61.21
from scipy.misc import comb s = eval(input()) n = len(s) r = s.count("B") ans = 0 for i in range(r): ans += n-i for i in range(len(s)): if s[i] == "B": ans -= i+1 print(ans)
s = eval(input()) n = len(s) r = s.count("B") ans = 0 for i in range(r): ans += n-i for i in range(n): if s[i] == "B": ans -= i+1 print(ans)
13
12
192
158
from scipy.misc import comb s = eval(input()) n = len(s) r = s.count("B") ans = 0 for i in range(r): ans += n - i for i in range(len(s)): if s[i] == "B": ans -= i + 1 print(ans)
s = eval(input()) n = len(s) r = s.count("B") ans = 0 for i in range(r): ans += n - i for i in range(n): if s[i] == "B": ans -= i + 1 print(ans)
false
7.692308
[ "-from scipy.misc import comb", "-", "-for i in range(len(s)):", "+for i in range(n):" ]
false
0.037667
0.113683
0.331332
[ "s392218726", "s313234066" ]
u648881683
p02642
python
s351283222
s326889347
345
304
45,296
45,304
Accepted
Accepted
11.88
import sys, collections input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**20 def I(): return int(eval(input())) def F(): return float(eval(input())) def S(): return eval(input()) def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().s...
import sys, collections input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**20 def I(): return int(eval(input())) def F(): return float(eval(input())) def S(): return eval(input()) def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().s...
38
35
878
839
import sys, collections input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**20 def I(): return int(eval(input())) def F(): return float(eval(input())) def S(): return eval(input()) def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x...
import sys, collections input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**20 def I(): return int(eval(input())) def F(): return float(eval(input())) def S(): return eval(input()) def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x...
false
7.894737
[ "- tmp = 0", "- tmp += 1", "- ans += tmp", "+ ans += 1" ]
false
0.037862
0.068186
0.55527
[ "s351283222", "s326889347" ]
u418149936
p02779
python
s306776544
s058278020
101
90
40,952
36,116
Accepted
Accepted
10.89
N = int(eval(input())) A_ls = list(map(int, input().split(' '))) rst = { i for i in A_ls } if len(rst) == N: print('YES') else: print('NO')
N = int(eval(input())) A_ls = input().split(' ') A_set = { i for i in A_ls } if len(A_set) == N: print('YES') else: print('NO')
7
7
141
135
N = int(eval(input())) A_ls = list(map(int, input().split(" "))) rst = {i for i in A_ls} if len(rst) == N: print("YES") else: print("NO")
N = int(eval(input())) A_ls = input().split(" ") A_set = {i for i in A_ls} if len(A_set) == N: print("YES") else: print("NO")
false
0
[ "-A_ls = list(map(int, input().split(\" \")))", "-rst = {i for i in A_ls}", "-if len(rst) == N:", "+A_ls = input().split(\" \")", "+A_set = {i for i in A_ls}", "+if len(A_set) == N:" ]
false
0.041662
0.0425
0.980272
[ "s306776544", "s058278020" ]