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
u562935282
p02880
python
s921455218
s420546181
180
35
38,256
9,156
Accepted
Accepted
80.56
# import sys # # sys.setrecursionlimit(10 ** 7) # # input = sys.stdin.readline # rstrip() # int(input()) # map(int, input().split()) n = int(eval(input())) st = {i * j for i in range(1, 10) for j in range(1, 10)} if n in st: print('Yes') else: print('No')
def main(): N = int(eval(input())) def check(): for i in range(1, 10): for j in range(1, 10): if i * j == N: return True return False cond = check() print(('Yes' if cond else 'No')) if __name__ == '__main__': main()...
18
17
279
313
# import sys # # sys.setrecursionlimit(10 ** 7) # # input = sys.stdin.readline # rstrip() # int(input()) # map(int, input().split()) n = int(eval(input())) st = {i * j for i in range(1, 10) for j in range(1, 10)} if n in st: print("Yes") else: print("No")
def main(): N = int(eval(input())) def check(): for i in range(1, 10): for j in range(1, 10): if i * j == N: return True return False cond = check() print(("Yes" if cond else "No")) if __name__ == "__main__": main()
false
5.555556
[ "-# import sys", "-#", "-# sys.setrecursionlimit(10 ** 7)", "-#", "-# input = sys.stdin.readline", "-# rstrip()", "-# int(input())", "-# map(int, input().split())", "-n = int(eval(input()))", "-st = {i * j for i in range(1, 10) for j in range(1, 10)}", "-if n in st:", "- print(\"Yes\")", ...
false
0.052034
0.035739
1.455973
[ "s921455218", "s420546181" ]
u805332733
p02665
python
s492147416
s012371579
90
81
94,924
85,608
Accepted
Accepted
10
def resolve(): N = int(eval(input())) A = [int(x) for x in input().split(" ")] if N == 0 and A[0] != 1: print((-1)) return True min_maxs = {} min_maxs[len(A)-1] = [A[-1], A[-1]] for index in reversed(list(range(len(A)-1))): min_maxs[index] = [min_maxs[index+1][0] // 2 + A[index], mi...
def resolve(): N = int(eval(input())) A = [int(x) for x in input().split(" ")] if N == 0 and A[0] != 1: print((-1)) return True min_maxs = [0] * len(A) min_maxs[len(A)-1] = [A[-1], A[-1]] for index in reversed(list(range(len(A)-1))): min_maxs[index] = [min_maxs[index+1][0] // 2 + A[in...
44
27
1,233
704
def resolve(): N = int(eval(input())) A = [int(x) for x in input().split(" ")] if N == 0 and A[0] != 1: print((-1)) return True min_maxs = {} min_maxs[len(A) - 1] = [A[-1], A[-1]] for index in reversed(list(range(len(A) - 1))): min_maxs[index] = [ min_maxs[ind...
def resolve(): N = int(eval(input())) A = [int(x) for x in input().split(" ")] if N == 0 and A[0] != 1: print((-1)) return True min_maxs = [0] * len(A) min_maxs[len(A) - 1] = [A[-1], A[-1]] for index in reversed(list(range(len(A) - 1))): min_maxs[index] = [ mi...
false
38.636364
[ "- min_maxs = {}", "+ min_maxs = [0] * len(A)", "- # print(min_maxs)", "- # min_maxs.insert(0, [min_maxs[0][0] // 2 + a, min_maxs[0][1] + a])", "- # print(min_maxs)", "- # max_node_in_depth = [sum(A[i:]) for i in range(len(A))]", "- # # 各 depth における最小値", "- # min_node_in_depth ...
false
0.047447
0.048591
0.976464
[ "s492147416", "s012371579" ]
u258073778
p03416
python
s933850967
s008494538
85
74
6,516
2,940
Accepted
Accepted
12.94
A,B = list(map(int, input().split())) AB = list(range(A, B+1)) N = B-A+1 count = 0 for i in range(N): count += (1 if str(AB[i]) == str(AB[i])[::-1] else 0) print(count)
A,B = list(map(int, input().split())) count = 0 for i in range(A, B+1): count += (1 if str(i) == str(i)[::-1] else 0) print(count)
9
7
174
134
A, B = list(map(int, input().split())) AB = list(range(A, B + 1)) N = B - A + 1 count = 0 for i in range(N): count += 1 if str(AB[i]) == str(AB[i])[::-1] else 0 print(count)
A, B = list(map(int, input().split())) count = 0 for i in range(A, B + 1): count += 1 if str(i) == str(i)[::-1] else 0 print(count)
false
22.222222
[ "-AB = list(range(A, B + 1))", "-N = B - A + 1", "-for i in range(N):", "- count += 1 if str(AB[i]) == str(AB[i])[::-1] else 0", "+for i in range(A, B + 1):", "+ count += 1 if str(i) == str(i)[::-1] else 0" ]
false
0.074912
0.069908
1.071568
[ "s933850967", "s008494538" ]
u729133443
p02743
python
s737930456
s949856900
35
18
5,076
2,940
Accepted
Accepted
48.57
from decimal import* a,b,c=[Decimal(i).sqrt()for i in input().split()] print(('NYoe s'[a+b<c::2]))
a,b,c=list(map(int,input().split())) print(('YNeos'[4*a*b>=(c-a-b)**2or a+b>=c::2]))
3
2
98
77
from decimal import * a, b, c = [Decimal(i).sqrt() for i in input().split()] print(("NYoe s"[a + b < c :: 2]))
a, b, c = list(map(int, input().split())) print(("YNeos"[4 * a * b >= (c - a - b) ** 2 or a + b >= c :: 2]))
false
33.333333
[ "-from decimal import *", "-", "-a, b, c = [Decimal(i).sqrt() for i in input().split()]", "-print((\"NYoe s\"[a + b < c :: 2]))", "+a, b, c = list(map(int, input().split()))", "+print((\"YNeos\"[4 * a * b >= (c - a - b) ** 2 or a + b >= c :: 2]))" ]
false
0.070766
0.08834
0.801066
[ "s737930456", "s949856900" ]
u753803401
p02984
python
s029295560
s536921038
295
271
65,176
63,984
Accepted
Accepted
8.14
def main(): import sys input = sys.stdin.readline n = int(input().rstrip('\n')) a = list(map(int, input().rstrip('\n').split())) b = [sum(a) - sum(a[1::2]) * 2] for i in range(len(a)-1): b.append((a[i] - b[i] // 2) * 2) print((*b)) if __name__ == '__main__': main()
def slove(): import sys input = sys.stdin.readline n = int(input().rstrip('\n')) a = list(map(int, input().rstrip('\n').split())) ts = sum(a) - sum(a[1::2]) * 2 ls = [0] * n ls[0] = ts for i in range(1, n): ls[i] = (a[i-1] - ls[i-1] // 2) * 2 print((*ls)) if __...
13
15
318
353
def main(): import sys input = sys.stdin.readline n = int(input().rstrip("\n")) a = list(map(int, input().rstrip("\n").split())) b = [sum(a) - sum(a[1::2]) * 2] for i in range(len(a) - 1): b.append((a[i] - b[i] // 2) * 2) print((*b)) if __name__ == "__main__": main()
def slove(): import sys input = sys.stdin.readline n = int(input().rstrip("\n")) a = list(map(int, input().rstrip("\n").split())) ts = sum(a) - sum(a[1::2]) * 2 ls = [0] * n ls[0] = ts for i in range(1, n): ls[i] = (a[i - 1] - ls[i - 1] // 2) * 2 print((*ls)) if __name__ =...
false
13.333333
[ "-def main():", "+def slove():", "- b = [sum(a) - sum(a[1::2]) * 2]", "- for i in range(len(a) - 1):", "- b.append((a[i] - b[i] // 2) * 2)", "- print((*b))", "+ ts = sum(a) - sum(a[1::2]) * 2", "+ ls = [0] * n", "+ ls[0] = ts", "+ for i in range(1, n):", "+ ls[...
false
0.061196
0.040027
1.528865
[ "s029295560", "s536921038" ]
u951480280
p03013
python
s497295876
s736268111
505
391
462,692
460,364
Accepted
Accepted
22.57
n,m=list(map(int,input().split())) A={int(eval(input())) for _ in range(m)} dp=[1]+[0]*(n+1) for i in range(n): if i in A: continue dp[i+1] += dp[i] dp[i+2] += dp[i] print((dp[n]%(10**9 + 7)))
from collections import deque n,m=list(map(int,input().split())) A={int(eval(input())) for _ in range(m)} L=deque([1,1]) if 1 in A:L[1]=0 for i in range(2,n+1): if i in A: L.append(0) else: L.append(L[i-2]+L[i-1]) print((L[n]%(10**9 + 7)))
9
12
206
262
n, m = list(map(int, input().split())) A = {int(eval(input())) for _ in range(m)} dp = [1] + [0] * (n + 1) for i in range(n): if i in A: continue dp[i + 1] += dp[i] dp[i + 2] += dp[i] print((dp[n] % (10**9 + 7)))
from collections import deque n, m = list(map(int, input().split())) A = {int(eval(input())) for _ in range(m)} L = deque([1, 1]) if 1 in A: L[1] = 0 for i in range(2, n + 1): if i in A: L.append(0) else: L.append(L[i - 2] + L[i - 1]) print((L[n] % (10**9 + 7)))
false
25
[ "+from collections import deque", "+", "-dp = [1] + [0] * (n + 1)", "-for i in range(n):", "+L = deque([1, 1])", "+if 1 in A:", "+ L[1] = 0", "+for i in range(2, n + 1):", "- continue", "- dp[i + 1] += dp[i]", "- dp[i + 2] += dp[i]", "-print((dp[n] % (10**9 + 7)))", "+ ...
false
0.045935
0.045262
1.014866
[ "s497295876", "s736268111" ]
u080364835
p03607
python
s901176689
s066513988
202
173
13,216
20,620
Accepted
Accepted
14.36
n = int(eval(input())) al = list(int(eval(input())) for _ in range(n)) s = set() for a in al: s ^= {a} print((len(s)))
from collections import Counter n = int(eval(input())) al = list(int(eval(input())) for _ in range(n)) c = Counter(al) ans = 0 for k, v in list(c.items()): if v%2 != 0: ans += 1 print(ans)
10
11
122
194
n = int(eval(input())) al = list(int(eval(input())) for _ in range(n)) s = set() for a in al: s ^= {a} print((len(s)))
from collections import Counter n = int(eval(input())) al = list(int(eval(input())) for _ in range(n)) c = Counter(al) ans = 0 for k, v in list(c.items()): if v % 2 != 0: ans += 1 print(ans)
false
9.090909
[ "+from collections import Counter", "+", "-s = set()", "-for a in al:", "- s ^= {a}", "-print((len(s)))", "+c = Counter(al)", "+ans = 0", "+for k, v in list(c.items()):", "+ if v % 2 != 0:", "+ ans += 1", "+print(ans)" ]
false
0.036402
0.03433
1.06036
[ "s901176689", "s066513988" ]
u899975427
p03013
python
s116645737
s175242748
85
65
7,848
7,824
Accepted
Accepted
23.53
import sys input = sys.stdin.readline n,m = list(map(int,input().split())) num = 10**9+7 nots = [int(eval(input())) for i in range(m)] leng = len(nots) cnt = 0 dp = [0]*(n+1) dp[0] = 1 if leng > 0 and nots[0] == 1: dp[1] = 0 nots.pop(0) leng -= 1 else: dp[1] = 1 if n == 1: print((1)) exit()...
import sys input = sys.stdin.readline n,m = list(map(int,input().split())) num = 10**9+7 nots = [int(eval(input())) for i in range(m)] dp = [-1]*(n+1) dp[0] = 1 for i in nots: dp[i] = 0 if dp[1] == -1: dp[1] = 1 if n == 1: print((1)) exit() for i in range(2,n+1): if dp[i] == -1: dp...
27
23
490
363
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) num = 10**9 + 7 nots = [int(eval(input())) for i in range(m)] leng = len(nots) cnt = 0 dp = [0] * (n + 1) dp[0] = 1 if leng > 0 and nots[0] == 1: dp[1] = 0 nots.pop(0) leng -= 1 else: dp[1] = 1 if n == 1: print((1)) ex...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) num = 10**9 + 7 nots = [int(eval(input())) for i in range(m)] dp = [-1] * (n + 1) dp[0] = 1 for i in nots: dp[i] = 0 if dp[1] == -1: dp[1] = 1 if n == 1: print((1)) exit() for i in range(2, n + 1): if dp[i] == -1: ...
false
14.814815
[ "-leng = len(nots)", "-cnt = 0", "-dp = [0] * (n + 1)", "+dp = [-1] * (n + 1)", "-if leng > 0 and nots[0] == 1:", "- dp[1] = 0", "- nots.pop(0)", "- leng -= 1", "-else:", "+for i in nots:", "+ dp[i] = 0", "+if dp[1] == -1:", "- if leng > 0 and nots[cnt] == i:", "- dp[...
false
0.044279
0.080013
0.553392
[ "s116645737", "s175242748" ]
u790905630
p03222
python
s184383274
s637885637
41
19
3,192
3,320
Accepted
Accepted
53.66
import itertools def amida_counter(H_i_amida_list): counter = 0 for amida_bin in range(2**len(H_i_amida_list)): if (("11" in format(amida_bin, "b")) == False): counter += 1 return counter def amida_number(left_amida, right_amida): left_counter = amida_counter(left_ami...
import itertools def amida_counter(H_i_amida_list): counter = 0 for amida_bin in range(2**len(H_i_amida_list)): if (("11" in format(amida_bin, "b")) == False): counter += 1 return counter def amida_number(left_amida, right_amida): left_counter = amida_counter(left_ami...
55
69
2,009
2,390
import itertools def amida_counter(H_i_amida_list): counter = 0 for amida_bin in range(2 ** len(H_i_amida_list)): if ("11" in format(amida_bin, "b")) == False: counter += 1 return counter def amida_number(left_amida, right_amida): left_counter = amida_counter(left_amida) if (len(...
import itertools def amida_counter(H_i_amida_list): counter = 0 for amida_bin in range(2 ** len(H_i_amida_list)): if ("11" in format(amida_bin, "b")) == False: counter += 1 return counter def amida_number(left_amida, right_amida): left_counter = amida_counter(left_amida) if (len(...
false
20.289855
[ "+def amida_all(amida_list, W):", "+ for i, j in itertools.product(list(range(W)), list(range(3))):", "+ if j == 0:", "+ amida_list[i][j] = X_amida_number(W, i)", "+ elif j == 1:", "+ amida_list[i][j] = Y_amida_number(W, i)", "+ else:", "+ amida...
false
0.044189
0.042869
1.030789
[ "s184383274", "s637885637" ]
u186838327
p02762
python
s375432127
s202011590
1,399
291
92,568
84,580
Accepted
Accepted
79.2
def Find(x, par): if par[x] < 0: return x else: # 経路圧縮 par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: # rankの低い方を高い方につなげる if rank[x] < rank[y]: par[y] += par[x] par[x] = y else: ...
def Find(x, par): if par[x] < 0: return x else: par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: if rank[x] < rank[y]: par[y] += par[x] par[x] = y else: ...
55
56
985
1,052
def Find(x, par): if par[x] < 0: return x else: # 経路圧縮 par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: # rankの低い方を高い方につなげる if rank[x] < rank[y]: par[y] += par[x] ...
def Find(x, par): if par[x] < 0: return x else: par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: if rank[x] < rank[y]: par[y] += par[x] par[x] = y else: par[...
false
1.785714
[ "- # 経路圧縮", "- # rankの低い方を高い方につなげる", "+import sys", "+", "+input = sys.stdin.readline", "-F = [0] * n", "-B = [0] * n", "+C = [0] * n", "- F[a] += 1", "- F[b] += 1", "+ C[a] += 1", "+ C[b] += 1", "+ans = [0] * n", "+for i in range(n):", "+ ans[i] = Size(i, pa...
false
0.039962
0.061248
0.652467
[ "s375432127", "s202011590" ]
u072717685
p02597
python
s586641084
s290414703
59
48
10,804
13,540
Accepted
Accepted
18.64
import sys read = sys.stdin.read def main(): n = int(eval(input())) a = eval(input()) if not 'WR' in a: print((0)) sys.exit() a = list(a) rnum = a.count('R') rl = 0 rr = 0 for i1 in range(rnum): rl += a[i1] == 'W' for j1 in range(n - rnum): ...
import sys read = sys.stdin.read #readlines = sys.stdin.readlines def main(): n = int(eval(input())) rc = tuple(eval(input())) rc2 = [c == 'W' for c in rc] r1 = sum(rc2) # 白をすべて赤にした場合 r2 = n - r1 # 赤をすべて白にした場合。 r3 = sum(rc2[:r2]) # 赤を左につめるのに邪魔になる白の数 print((min(r1, r2, r3))) if ...
20
14
411
342
import sys read = sys.stdin.read def main(): n = int(eval(input())) a = eval(input()) if not "WR" in a: print((0)) sys.exit() a = list(a) rnum = a.count("R") rl = 0 rr = 0 for i1 in range(rnum): rl += a[i1] == "W" for j1 in range(n - rnum): rr += a[...
import sys read = sys.stdin.read # readlines = sys.stdin.readlines def main(): n = int(eval(input())) rc = tuple(eval(input())) rc2 = [c == "W" for c in rc] r1 = sum(rc2) # 白をすべて赤にした場合 r2 = n - r1 # 赤をすべて白にした場合。 r3 = sum(rc2[:r2]) # 赤を左につめるのに邪魔になる白の数 print((min(r1, r2, r3))) if __name_...
false
30
[ "-", "-", "+# readlines = sys.stdin.readlines", "- a = eval(input())", "- if not \"WR\" in a:", "- print((0))", "- sys.exit()", "- a = list(a)", "- rnum = a.count(\"R\")", "- rl = 0", "- rr = 0", "- for i1 in range(rnum):", "- rl += a[i1] == \"W\"", ...
false
0.0428
0.036112
1.185218
[ "s586641084", "s290414703" ]
u254871849
p03862
python
s451439377
s932977490
118
94
14,092
14,092
Accepted
Accepted
20.34
import sys n, x, *a = list(map(int, sys.stdin.read().split())) a = [0] + a def main(): tot = 0 for i in range(1, n + 1): tot += max(0, a[i] + a[i-1] - x) a[i] = min(a[i], x - a[i-1]) print(tot) if __name__ == '__main__': main()
import sys n, x, *a = list(map(int, sys.stdin.read().split())) a = [0] + a def main(): tot = 0 for i in range(1, n + 1): if a[i] + a[i-1] > x: tot += a[i] + a[i-1] - x a[i] = x - a[i-1] print(tot) if __name__ == '__main__': main()
14
15
270
266
import sys n, x, *a = list(map(int, sys.stdin.read().split())) a = [0] + a def main(): tot = 0 for i in range(1, n + 1): tot += max(0, a[i] + a[i - 1] - x) a[i] = min(a[i], x - a[i - 1]) print(tot) if __name__ == "__main__": main()
import sys n, x, *a = list(map(int, sys.stdin.read().split())) a = [0] + a def main(): tot = 0 for i in range(1, n + 1): if a[i] + a[i - 1] > x: tot += a[i] + a[i - 1] - x a[i] = x - a[i - 1] print(tot) if __name__ == "__main__": main()
false
6.666667
[ "- tot += max(0, a[i] + a[i - 1] - x)", "- a[i] = min(a[i], x - a[i - 1])", "+ if a[i] + a[i - 1] > x:", "+ tot += a[i] + a[i - 1] - x", "+ a[i] = x - a[i - 1]" ]
false
0.047493
0.04521
1.050511
[ "s451439377", "s932977490" ]
u489959379
p03018
python
s251562550
s624405346
47
41
3,500
9,356
Accepted
Accepted
12.77
s = eval(input()) s = s.replace('BC', 'D') ans = a = 0 for i in s: if i == "A": a += 1 elif i == "D": ans += a else: a = 0 print(ans)
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): S = input().replace("BC", "D") res = 0 cnt = 0 for s in S: if s == "A": cnt += 1 elif s == "D": res += cnt else: cnt = 0 ...
12
24
175
378
s = eval(input()) s = s.replace("BC", "D") ans = a = 0 for i in s: if i == "A": a += 1 elif i == "D": ans += a else: a = 0 print(ans)
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): S = input().replace("BC", "D") res = 0 cnt = 0 for s in S: if s == "A": cnt += 1 elif s == "D": res += cnt else: cnt = 0 print(res) if __name__...
false
50
[ "-s = eval(input())", "-s = s.replace(\"BC\", \"D\")", "-ans = a = 0", "-for i in s:", "- if i == \"A\":", "- a += 1", "- elif i == \"D\":", "- ans += a", "- else:", "- a = 0", "-print(ans)", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "+f_inf = flo...
false
0.043321
0.043132
1.004368
[ "s251562550", "s624405346" ]
u057109575
p02608
python
s666532088
s129737646
184
147
71,980
73,880
Accepted
Accepted
20.11
from collections import defaultdict N = int(eval(input())) ctr = defaultdict(int) for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): res = x**2 + y**2 + z**2 + x*y + y*z + z*x ctr[res] += 1 for n in range(1, N + 1): print((ctr[n]))
N = int(input()) ans = [0] * (N + 1) for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): n = x**2 + y**2 + z**2 + x*y + y*z + z*x if n <= N: ans[n] += 1 print(*ans[1:], sep="\n")
12
13
298
267
from collections import defaultdict N = int(eval(input())) ctr = defaultdict(int) for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): res = x**2 + y**2 + z**2 + x * y + y * z + z * x ctr[res] += 1 for n in range(1, N + 1): print((ctr[n]))
N = int(input()) ans = [0] * (N + 1) for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): n = x**2 + y**2 + z**2 + x * y + y * z + z * x if n <= N: ans[n] += 1 print(*ans[1:], sep="\n")
false
7.692308
[ "-from collections import defaultdict", "-", "-N = int(eval(input()))", "-ctr = defaultdict(int)", "+N = int(input())", "+ans = [0] * (N + 1)", "- res = x**2 + y**2 + z**2 + x * y + y * z + z * x", "- ctr[res] += 1", "-for n in range(1, N + 1):", "- print((ctr[n]))", "+ ...
false
1.603676
1.262091
1.27065
[ "s666532088", "s129737646" ]
u440566786
p02629
python
s878572573
s960171307
75
63
61,792
61,760
Accepted
Accepted
16
import sys INF = 1 << 60 MOD = 10**9 + 7 # 998244353 sys.setrecursionlimit(2147483647) input = lambda:sys.stdin.readline().rstrip() def resolve(): n = int(eval(input())) - 1 res = [] while 1: res.append(chr(ord('a') + n % 26)) n = n // 26 - 1 if n == -1: break...
n = int(eval(input())) ans = [] while n: n, r = divmod(n - 1, 26) ans.append(chr(ord('a') + r)) ans.reverse() print((''.join(ans)))
17
7
371
134
import sys INF = 1 << 60 MOD = 10**9 + 7 # 998244353 sys.setrecursionlimit(2147483647) input = lambda: sys.stdin.readline().rstrip() def resolve(): n = int(eval(input())) - 1 res = [] while 1: res.append(chr(ord("a") + n % 26)) n = n // 26 - 1 if n == -1: break re...
n = int(eval(input())) ans = [] while n: n, r = divmod(n - 1, 26) ans.append(chr(ord("a") + r)) ans.reverse() print(("".join(ans)))
false
58.823529
[ "-import sys", "-", "-INF = 1 << 60", "-MOD = 10**9 + 7 # 998244353", "-sys.setrecursionlimit(2147483647)", "-input = lambda: sys.stdin.readline().rstrip()", "-", "-", "-def resolve():", "- n = int(eval(input())) - 1", "- res = []", "- while 1:", "- res.append(chr(ord(\"a\")...
false
0.035886
0.036596
0.980604
[ "s878572573", "s960171307" ]
u460245024
p03416
python
s720626240
s770002751
105
51
2,940
2,940
Accepted
Accepted
51.43
A, B = list(map(int, input().split())) cnt = 0 for n in range(A, B+1): n_s = str(n) n_s_len = len(n_s) for i in range(n_s_len//2): if n_s[i] != n_s[n_s_len-i-1]: break else: cnt += 1 print(cnt)
A, B = list(map(int, input().split())) cnt = 0 for n in range(A, B+1): n_s = str(n) n_s_rvs = n_s[::-1] if n_s == n_s_rvs: cnt += 1 print(cnt)
13
10
246
168
A, B = list(map(int, input().split())) cnt = 0 for n in range(A, B + 1): n_s = str(n) n_s_len = len(n_s) for i in range(n_s_len // 2): if n_s[i] != n_s[n_s_len - i - 1]: break else: cnt += 1 print(cnt)
A, B = list(map(int, input().split())) cnt = 0 for n in range(A, B + 1): n_s = str(n) n_s_rvs = n_s[::-1] if n_s == n_s_rvs: cnt += 1 print(cnt)
false
23.076923
[ "- n_s_len = len(n_s)", "- for i in range(n_s_len // 2):", "- if n_s[i] != n_s[n_s_len - i - 1]:", "- break", "- else:", "+ n_s_rvs = n_s[::-1]", "+ if n_s == n_s_rvs:" ]
false
0.051803
0.124359
0.416557
[ "s720626240", "s770002751" ]
u062147869
p03576
python
s700220997
s239828704
1,707
32
79,068
3,064
Accepted
Accepted
98.13
from itertools import product,combinations N,K=list(map(int,input().split())) L=[tuple(map(int,input().split())) for i in range(N)] ans=10**37 def f(i,j,k,l): n=0 s=min(L[j][0],L[i][0]) t=max(L[j][0],L[i][0]) u=min(L[k][1],L[l][1]) w=max(L[k][1],L[l][1]) for e in L: if s<=e[0]...
N,K=list(map(int,input().split())) L=[tuple(map(int,input().split())) for i in range(N)] L.sort() ans=10**37 for i in range(N): for j in range(i+1,N): t=L[j][0]-L[i][0] S=sorted(x[1] for x in L[i:j+1]) for k in range(len(S)-K+1): u=S[K+k-1]-S[k] ans=min(ans,...
21
12
562
330
from itertools import product, combinations N, K = list(map(int, input().split())) L = [tuple(map(int, input().split())) for i in range(N)] ans = 10**37 def f(i, j, k, l): n = 0 s = min(L[j][0], L[i][0]) t = max(L[j][0], L[i][0]) u = min(L[k][1], L[l][1]) w = max(L[k][1], L[l][1]) for e in L:...
N, K = list(map(int, input().split())) L = [tuple(map(int, input().split())) for i in range(N)] L.sort() ans = 10**37 for i in range(N): for j in range(i + 1, N): t = L[j][0] - L[i][0] S = sorted(x[1] for x in L[i : j + 1]) for k in range(len(S) - K + 1): u = S[K + k - 1] - S[k] ...
false
42.857143
[ "-from itertools import product, combinations", "-", "+L.sort()", "-", "-", "-def f(i, j, k, l):", "- n = 0", "- s = min(L[j][0], L[i][0])", "- t = max(L[j][0], L[i][0])", "- u = min(L[k][1], L[l][1])", "- w = max(L[k][1], L[l][1])", "- for e in L:", "- if s <= e[0] ...
false
0.048339
0.046538
1.0387
[ "s700220997", "s239828704" ]
u496744988
p03061
python
s357896627
s949417586
1,778
365
85,352
86,888
Accepted
Accepted
79.47
from collections import Counter from functools import reduce import bisect import copy import fractions import math # import statistics import sys import time sys.setrecursionlimit(10**7) INF = 10 ** 18 MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LF(): return [floa...
from collections import Counter from functools import reduce # import statistics import bisect import copy import fractions import math import random import string import sys import time sys.setrecursionlimit(10**7) INF = 10 ** 18 MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().sp...
55
58
1,450
1,438
from collections import Counter from functools import reduce import bisect import copy import fractions import math # import statistics import sys import time sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LF(): return [float(x...
from collections import Counter from functools import reduce # import statistics import bisect import copy import fractions import math import random import string import sys import time sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] d...
false
5.172414
[ "+", "+# import statistics", "-", "-# import statistics", "+import random", "+import string", "- return map(int, sys.stdin.readline().split())", "+ return list(map(int, sys.stdin.readline().split()))", "- return input()", "-", "-", "-def P(x):", "- return print(x)", "+ retur...
false
0.046209
0.04322
1.069146
[ "s357896627", "s949417586" ]
u203843959
p03096
python
s224723784
s811454698
1,518
1,038
766,616
761,712
Accepted
Accepted
31.62
import bisect MOD=10**9+7 N=int(eval(input())) clist=[] for i in range(N): c=int(eval(input())) clist.append(c) #print(clist) c2list=clist[:1] for i in range(1,N): if clist[i]!=c2list[-1]: c2list.append(clist[i]) #print(c2list) N2=len(c2list) cdic={} for i in range(N2): c=c2list[i]...
import bisect MOD=10**9+7 N=int(eval(input())) clist=[] for i in range(N): c=int(eval(input())) clist.append(c) #print(clist) c2list=clist[:1] for i in range(1,N): if clist[i]!=c2list[-1]: c2list.append(clist[i]) #print(c2list) N2=len(c2list) cldic={} dp=[0]*(N2-1)+[1] for i in range...
40
29
647
445
import bisect MOD = 10**9 + 7 N = int(eval(input())) clist = [] for i in range(N): c = int(eval(input())) clist.append(c) # print(clist) c2list = clist[:1] for i in range(1, N): if clist[i] != c2list[-1]: c2list.append(clist[i]) # print(c2list) N2 = len(c2list) cdic = {} for i in range(N2): c =...
import bisect MOD = 10**9 + 7 N = int(eval(input())) clist = [] for i in range(N): c = int(eval(input())) clist.append(c) # print(clist) c2list = clist[:1] for i in range(1, N): if clist[i] != c2list[-1]: c2list.append(clist[i]) # print(c2list) N2 = len(c2list) cldic = {} dp = [0] * (N2 - 1) + [1] ...
false
27.5
[ "-cdic = {}", "+cldic = {}", "+dp = [0] * (N2 - 1) + [1]", "- if not c in cdic:", "- cdic[c] = [i]", "- else:", "- cdic[c].append(i)", "-# print(cdic)", "-dp = [1] + [0] * (N2 - 1)", "-for i in range(1, N2):", "- c = c2list[i]", "- if len(cdic[c]) > 0:", "- i...
false
0.048532
0.080877
0.600077
[ "s224723784", "s811454698" ]
u638282348
p03401
python
s768305457
s852130372
1,759
711
21,416
22,552
Accepted
Accepted
59.58
import numpy as np N = int(eval(input())) A = np.array(["0"] + input().split() + ["0"], dtype=np.int64) B = np.abs(A[1:] - A[:-1]) C = np.abs(A[2:] - A[:-2]) total = B.sum() for i in range(N): print((total - B[i:i + 2].sum() + C[i]))
import numpy as np N = int(eval(input())) A = np.array(["0"] + input().split() + ["0"], dtype=np.int64) B = np.abs(A[1:] - A[:-1]) C = np.abs(A[2:] - A[:-2]) D = B[1:] + B[:-1] total = B.sum() for i in range(N): print((total - D[i] + C[i]))
8
9
236
244
import numpy as np N = int(eval(input())) A = np.array(["0"] + input().split() + ["0"], dtype=np.int64) B = np.abs(A[1:] - A[:-1]) C = np.abs(A[2:] - A[:-2]) total = B.sum() for i in range(N): print((total - B[i : i + 2].sum() + C[i]))
import numpy as np N = int(eval(input())) A = np.array(["0"] + input().split() + ["0"], dtype=np.int64) B = np.abs(A[1:] - A[:-1]) C = np.abs(A[2:] - A[:-2]) D = B[1:] + B[:-1] total = B.sum() for i in range(N): print((total - D[i] + C[i]))
false
11.111111
[ "+D = B[1:] + B[:-1]", "- print((total - B[i : i + 2].sum() + C[i]))", "+ print((total - D[i] + C[i]))" ]
false
0.295361
0.284578
1.037894
[ "s768305457", "s852130372" ]
u952708174
p03206
python
s323457388
s930854003
19
17
3,316
2,940
Accepted
Accepted
10.53
D = int(eval(input())) if D == 25: print('Christmas') elif D == 24: print('Christmas Eve') elif D == 23: print('Christmas Eve Eve') elif D == 22: print('Christmas Eve Eve Eve')
D = int(eval(input())) _ans = ['Christmas'] for _ in range(25 - D): _ans.append('Eve') ans = ' '.join(_ans) print(ans)
9
6
194
121
D = int(eval(input())) if D == 25: print("Christmas") elif D == 24: print("Christmas Eve") elif D == 23: print("Christmas Eve Eve") elif D == 22: print("Christmas Eve Eve Eve")
D = int(eval(input())) _ans = ["Christmas"] for _ in range(25 - D): _ans.append("Eve") ans = " ".join(_ans) print(ans)
false
33.333333
[ "-if D == 25:", "- print(\"Christmas\")", "-elif D == 24:", "- print(\"Christmas Eve\")", "-elif D == 23:", "- print(\"Christmas Eve Eve\")", "-elif D == 22:", "- print(\"Christmas Eve Eve Eve\")", "+_ans = [\"Christmas\"]", "+for _ in range(25 - D):", "+ _ans.append(\"Eve\")", ...
false
0.037442
0.037218
1.006024
[ "s323457388", "s930854003" ]
u987164499
p03557
python
s588283127
s415030517
612
237
39,172
29,492
Accepted
Accepted
61.27
from sys import stdin import math import bisect import heapq import numpy as np from math import factorial n = int(stdin.readline().rstrip()) a = list(map(int,stdin.readline().rstrip().split())) b = list(map(int,stdin.readline().rstrip().split())) c = list(map(int,stdin.readline().rstrip().split())) a.sor...
import bisect n = int(eval(input())) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) a.sort() b.sort() c.sort() ans = 0 C = len(c) # Bを中心に考える for i in b: ans += (bisect.bisect_right(a,i-1))*(C-bisect.bisect_left(c,i+1)) print(ans)
23
18
484
306
from sys import stdin import math import bisect import heapq import numpy as np from math import factorial n = int(stdin.readline().rstrip()) a = list(map(int, stdin.readline().rstrip().split())) b = list(map(int, stdin.readline().rstrip().split())) c = list(map(int, stdin.readline().rstrip().split())) a.sort() b.sort...
import bisect n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort() b.sort() c.sort() ans = 0 C = len(c) # Bを中心に考える for i in b: ans += (bisect.bisect_right(a, i - 1)) * (C - bisect.bisect_left(c, i + 1)) print(ans)
false
21.73913
[ "-from sys import stdin", "-import math", "-import heapq", "-import numpy as np", "-from math import factorial", "-n = int(stdin.readline().rstrip())", "-a = list(map(int, stdin.readline().rstrip().split()))", "-b = list(map(int, stdin.readline().rstrip().split()))", "-c = list(map(int, stdin.readli...
false
0.040264
0.043045
0.935405
[ "s588283127", "s415030517" ]
u761320129
p03050
python
s526788834
s525007951
365
268
3,060
9,092
Accepted
Accepted
26.58
N = int(eval(input())) ans = 0 n = 1 while n*n < N: if (N-n)%n == 0: m = (N-n)//n if m <= n: break ans += m n += 1 print(ans)
N = int(eval(input())) m = 1 ans = 0 while m*m <= N: if (N-m)%m == 0: d = (N-m)//m if d <= m: break ans += d m += 1 print(ans)
10
11
160
163
N = int(eval(input())) ans = 0 n = 1 while n * n < N: if (N - n) % n == 0: m = (N - n) // n if m <= n: break ans += m n += 1 print(ans)
N = int(eval(input())) m = 1 ans = 0 while m * m <= N: if (N - m) % m == 0: d = (N - m) // m if d <= m: break ans += d m += 1 print(ans)
false
9.090909
[ "+m = 1", "-n = 1", "-while n * n < N:", "- if (N - n) % n == 0:", "- m = (N - n) // n", "- if m <= n:", "+while m * m <= N:", "+ if (N - m) % m == 0:", "+ d = (N - m) // m", "+ if d <= m:", "- ans += m", "- n += 1", "+ ans += d", "+ m ...
false
0.564122
1.131144
0.498719
[ "s526788834", "s525007951" ]
u729133443
p02711
python
s647122268
s054357263
288
22
80,176
9,016
Accepted
Accepted
92.36
print(('NYoe s'['7'in eval(input())::2]))
if'7'in eval(input()):print('Yes') else:print('No')
1
2
33
47
print(("NYoe s"["7" in eval(input()) :: 2]))
if "7" in eval(input()): print("Yes") else: print("No")
false
50
[ "-print((\"NYoe s\"[\"7\" in eval(input()) :: 2]))", "+if \"7\" in eval(input()):", "+ print(\"Yes\")", "+else:", "+ print(\"No\")" ]
false
0.083737
0.043661
1.917894
[ "s647122268", "s054357263" ]
u327466606
p03291
python
s241993345
s589259772
90
76
9,100
73,332
Accepted
Accepted
15.56
MOD = 10**9 + 7 S = eval(input()) res = 0 dp0 = 1 # '' dp1 = 0 # 'a' dp2 = 0 # 'ab' dp3 = 0 # 'abc' for c in S: if c == 'A': dp1 = (dp0+dp1)%MOD elif c == 'B': dp2 = (dp1+dp2)%MOD elif c == 'C': dp3 = (dp2+dp3)%MOD else: dp3 = (dp3*3+dp2)%MOD dp2...
MOD = 10**9 + 7 S = eval(input()) dp0 = 1 # '' dp1 = 0 # 'a' dp2 = 0 # 'ab' dp3 = 0 # 'abc' for c in S: if c == 'A': dp1 = (dp0+dp1)%MOD elif c == 'B': dp2 = (dp1+dp2)%MOD elif c == 'C': dp3 = (dp2+dp3)%MOD else: dp3 = (dp3*3+dp2)%MOD dp2 = (dp2...
21
21
403
396
MOD = 10**9 + 7 S = eval(input()) res = 0 dp0 = 1 # '' dp1 = 0 # 'a' dp2 = 0 # 'ab' dp3 = 0 # 'abc' for c in S: if c == "A": dp1 = (dp0 + dp1) % MOD elif c == "B": dp2 = (dp1 + dp2) % MOD elif c == "C": dp3 = (dp2 + dp3) % MOD else: dp3 = (dp3 * 3 + dp2) % MOD ...
MOD = 10**9 + 7 S = eval(input()) dp0 = 1 # '' dp1 = 0 # 'a' dp2 = 0 # 'ab' dp3 = 0 # 'abc' for c in S: if c == "A": dp1 = (dp0 + dp1) % MOD elif c == "B": dp2 = (dp1 + dp2) % MOD elif c == "C": dp3 = (dp2 + dp3) % MOD else: dp3 = (dp3 * 3 + dp2) % MOD dp2 = (...
false
0
[ "-res = 0" ]
false
0.118838
0.039811
2.985041
[ "s241993345", "s589259772" ]
u969850098
p03805
python
s163116474
s170460423
85
34
3,064
4,076
Accepted
Accepted
60
num_route = 0 num_node = 0 def func(unvisited_paths, visited_node, current_node): global num_route if len(visited_node) == num_node: num_route += 1 return for next_path in [path for path in unvisited_paths if (path[0] == current_node) and (path[1] not in visited_node)]: ...
import sys readline = sys.stdin.readline from collections import deque def main(): N, M = list(map(int, readline().rstrip().split())) path = [[False] * N for _ in range(N)] for _ in range(M): a, b = list(map(int, readline().rstrip().split())) path[a-1][b-1] = True path[b-1...
31
28
1,172
734
num_route = 0 num_node = 0 def func(unvisited_paths, visited_node, current_node): global num_route if len(visited_node) == num_node: num_route += 1 return for next_path in [ path for path in unvisited_paths if (path[0] == current_node) and (path[1] not in visited_no...
import sys readline = sys.stdin.readline from collections import deque def main(): N, M = list(map(int, readline().rstrip().split())) path = [[False] * N for _ in range(N)] for _ in range(M): a, b = list(map(int, readline().rstrip().split())) path[a - 1][b - 1] = True path[b - 1][...
false
9.677419
[ "-num_route = 0", "-num_node = 0", "+import sys", "-", "-def func(unvisited_paths, visited_node, current_node):", "- global num_route", "- if len(visited_node) == num_node:", "- num_route += 1", "- return", "- for next_path in [", "- path", "- for path in u...
false
0.100381
0.043384
2.313758
[ "s163116474", "s170460423" ]
u941407962
p03222
python
s119649850
s065689384
167
19
38,384
3,192
Accepted
Accepted
88.62
import sys mod = pow(10, 9) + 7 def mul(a, b): return ((a % mod) * (b % mod)) % mod def cmb(n, r, mod): if ( r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod NNN = (10**2) g1 = [1, 1] g2 = [1, 1] inverse = [0, 1] for i in range( 2, NNN + 1 ): g1...
import sys mod = pow(10, 9) + 7 def mul(a, b): return ((a % mod) * (b % mod)) % mod def cmb(n, r, mod): if ( r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod NNN = (10**2) g1 = [1, 1] g2 = [1, 1] inverse = [0, 1] for i in range( 2, NNN + 1 ): g1...
73
71
1,611
1,605
import sys mod = pow(10, 9) + 7 def mul(a, b): return ((a % mod) * (b % mod)) % mod def cmb(n, r, mod): if r < 0 or r > n: return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod NNN = 10**2 g1 = [1, 1] g2 = [1, 1] inverse = [0, 1] for i in range(2, NNN + 1): g1.append((g1[-...
import sys mod = pow(10, 9) + 7 def mul(a, b): return ((a % mod) * (b % mod)) % mod def cmb(n, r, mod): if r < 0 or r > n: return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod NNN = 10**2 g1 = [1, 1] g2 = [1, 1] inverse = [0, 1] for i in range(2, NNN + 1): g1.append((g1[-...
false
2.739726
[ "-d = [1] + [0 for x in range(W - 1)]", "+d = [[1] + [0 for x in range(W - 1)]] + [[0] * W for _ in range(N)]", "- newd = []", "+ i += 1", "- newd.append(0)", "+ d[i][j] = (d[i - 1][j] * cc[j]) % mod", "- newd[j] = (newd[j] + (d[j - 1] * cccl[j])) % mod", "+ d...
false
0.037363
0.085817
0.435374
[ "s119649850", "s065689384" ]
u559470386
p03006
python
s340719597
s523162010
841
21
3,064
3,444
Accepted
Accepted
97.5
def cal(dx,dy): cnt=0 for x in s: flag=False for y in s: if(x==y): continue if(x[0]+dx==y[0] and x[1]+dy==y[1]): flag=True if(flag==False): cnt+=1 return cnt n=int(eval(input())) s=[list(map(int,input(...
N = int(eval(input())) coodinates = [list(map(int, input().split())) for _ in range(N)] flag = True if N == 1: print((1)) flag = False if flag: # p, qを求める d = {} # [p, q]をkeyにもつ辞書 cnt=0 for a in coodinates: for b in coodinates: if a == b: c...
26
25
545
532
def cal(dx, dy): cnt = 0 for x in s: flag = False for y in s: if x == y: continue if x[0] + dx == y[0] and x[1] + dy == y[1]: flag = True if flag == False: cnt += 1 return cnt n = int(eval(input())) s = [list(map(i...
N = int(eval(input())) coodinates = [list(map(int, input().split())) for _ in range(N)] flag = True if N == 1: print((1)) flag = False if flag: # p, qを求める d = {} # [p, q]をkeyにもつ辞書 cnt = 0 for a in coodinates: for b in coodinates: if a == b: continue ...
false
3.846154
[ "-def cal(dx, dy):", "+N = int(eval(input()))", "+coodinates = [list(map(int, input().split())) for _ in range(N)]", "+flag = True", "+if N == 1:", "+ print((1))", "+ flag = False", "+if flag:", "+ # p, qを求める", "+ d = {} # [p, q]をkeyにもつ辞書", "- for x in s:", "- flag = Fal...
false
0.042697
0.035993
1.186267
[ "s340719597", "s523162010" ]
u540761833
p03290
python
s247288657
s742454064
65
35
3,064
3,064
Accepted
Accepted
46.15
D,G = list(map(int,input().split())) pc = [] for i in range(D): p,c = list(map(int,input().split())) pc.append([i+1,p,c]) pc.sort(reverse = True) ansc = [] for i in range(2**D): count = 0 sumb = 0 pc2 = [] for j in range(D): if (i >> j) & 1 == 1: sumb += 100*pc[j...
D,G = list(map(int,input().split())) pc = [] for i in range(D): p,c = list(map(int,input().split())) pc.append([i+1,p,c]) pc.sort(reverse = True) ansc = [] for i in range(2**D): count = 0 sumb = 0 pc2 = [] for j in range(D): if (i >> j) & 1 == 1: sumb += 100*pc[j...
28
29
665
723
D, G = list(map(int, input().split())) pc = [] for i in range(D): p, c = list(map(int, input().split())) pc.append([i + 1, p, c]) pc.sort(reverse=True) ansc = [] for i in range(2**D): count = 0 sumb = 0 pc2 = [] for j in range(D): if (i >> j) & 1 == 1: sumb += 100 * pc[j][0] ...
D, G = list(map(int, input().split())) pc = [] for i in range(D): p, c = list(map(int, input().split())) pc.append([i + 1, p, c]) pc.sort(reverse=True) ansc = [] for i in range(2**D): count = 0 sumb = 0 pc2 = [] for j in range(D): if (i >> j) & 1 == 1: sumb += 100 * pc[j][0] ...
false
3.448276
[ "- while sumb < G:", "- sumb += 100 * pc2[0][0]", "- count += 1", "- c2 += 1", "- if c2 == pc2[0][1]:", "+ if sumb < G:", "+ c2 = (G - sumb) // (100 * pc2[0][0])", "+ if (G - sumb) % (100 * pc2[0][0]) != 0:", "+ c2 += 1", "+ if c2 >...
false
0.035229
0.034113
1.032714
[ "s247288657", "s742454064" ]
u480138356
p03607
python
s050732914
s173575234
1,842
80
7,844
15,076
Accepted
Accepted
95.66
import sys import bisect input = sys.stdin.readline def main(): N = int(eval(input())) a = [int(eval(input())) for i in range(N)] nums = [] for i in a: if len(nums) > 0: if i <= nums[-1]: ind = bisect.bisect_left(nums, i) if nums[ind] ...
import sys import bisect input = sys.stdin.readline def main(): N = int(eval(input())) dic = {} for i in range(N): a = int(eval(input())) if a in dic: dic[a] += 1 else: dic[a] = 1 ans = 0 for num, count in list(dic.items()): ...
28
24
578
400
import sys import bisect input = sys.stdin.readline def main(): N = int(eval(input())) a = [int(eval(input())) for i in range(N)] nums = [] for i in a: if len(nums) > 0: if i <= nums[-1]: ind = bisect.bisect_left(nums, i) if nums[ind] == i: ...
import sys import bisect input = sys.stdin.readline def main(): N = int(eval(input())) dic = {} for i in range(N): a = int(eval(input())) if a in dic: dic[a] += 1 else: dic[a] = 1 ans = 0 for num, count in list(dic.items()): if count & 1: ...
false
14.285714
[ "- a = [int(eval(input())) for i in range(N)]", "- nums = []", "- for i in a:", "- if len(nums) > 0:", "- if i <= nums[-1]:", "- ind = bisect.bisect_left(nums, i)", "- if nums[ind] == i:", "- nums.pop(ind)", "- ...
false
0.101474
0.037423
2.711548
[ "s050732914", "s173575234" ]
u810288681
p03102
python
s779852019
s691516863
167
17
38,384
3,064
Accepted
Accepted
89.82
n,m,c = list(map(int,input().split())) b = list(map(int,input().split())) cnt = 0 for i in range(n): a = list(map(int,input().split())) t = c for j in range(m): t+= a[j]*b[j] if t>0: cnt+=1 print(cnt)
n,m,c = list(map(int, input().split())) ans = 0 b = list(map(int,input().split())) for i in range(n): t = c a = list(map(int,input().split())) for j in range(m): t+=a[j]*b[j] if t>0: ans+=1 print(ans)
11
11
236
236
n, m, c = list(map(int, input().split())) b = list(map(int, input().split())) cnt = 0 for i in range(n): a = list(map(int, input().split())) t = c for j in range(m): t += a[j] * b[j] if t > 0: cnt += 1 print(cnt)
n, m, c = list(map(int, input().split())) ans = 0 b = list(map(int, input().split())) for i in range(n): t = c a = list(map(int, input().split())) for j in range(m): t += a[j] * b[j] if t > 0: ans += 1 print(ans)
false
0
[ "+ans = 0", "-cnt = 0", "+ t = c", "- t = c", "- cnt += 1", "-print(cnt)", "+ ans += 1", "+print(ans)" ]
false
0.122879
0.037726
3.257148
[ "s779852019", "s691516863" ]
u075595666
p02788
python
s569216917
s422455099
1,991
1,184
123,020
84,828
Accepted
Accepted
40.53
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline N,d,a = list(map(int,readline().split())) data0 = [0]*(N+1) data1 = [0]*(N+1) # 区間[l, r)に x を加算 def _add(data, k, x): while k <= N: data[k] += x k += k & -k def add(l, r, x): _add(data0, l, -x*(l-1)) ...
import sys,bisect read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): # 区間加算、上書き、一点取得 class SegmentTree: def __init__(self, n, ele, segfun): #####単位元######要設定0or1orinf self.ide_ele = ele self...
52
72
1,103
2,048
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline N, d, a = list(map(int, readline().split())) data0 = [0] * (N + 1) data1 = [0] * (N + 1) # 区間[l, r)に x を加算 def _add(data, k, x): while k <= N: data[k] += x k += k & -k def add(l, r, x): _add(data0, l, -x * (l - 1)) ...
import sys, bisect read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): # 区間加算、上書き、一点取得 class SegmentTree: def __init__(self, n, ele, segfun): #####単位元######要設定0or1orinf self.ide_ele = ele self.segfun ...
false
27.777778
[ "-import sys", "+import sys, bisect", "-N, d, a = list(map(int, readline().split()))", "-data0 = [0] * (N + 1)", "-data1 = [0] * (N + 1)", "-# 区間[l, r)に x を加算", "-def _add(data, k, x):", "- while k <= N:", "- data[k] += x", "- k += k & -k", "+readlines = sys.stdin.buffer.readlin...
false
0.124925
0.080918
1.543849
[ "s569216917", "s422455099" ]
u935184340
p00022
python
s930966343
s595366720
40
30
7,564
7,632
Accepted
Accepted
25
import sys for i in sys.stdin: n = int(i) if n == 0: break max = -100000 sum = int(eval(input())) for i in range(n-1): m = int(eval(input())) if sum < 0 and sum < m: sum = m elif m < 0 and max < sum: max = sum sum += ...
import sys s = "" for i in sys.stdin: n = int(i) if n == 0: break max = -100000 sum = int(input()) for i in range(n-1): m = int(input()) if sum < 0 and sum < m: sum = m else: if m < 0 and max < sum: max = sum ...
20
23
400
447
import sys for i in sys.stdin: n = int(i) if n == 0: break max = -100000 sum = int(eval(input())) for i in range(n - 1): m = int(eval(input())) if sum < 0 and sum < m: sum = m elif m < 0 and max < sum: max = sum sum += m el...
import sys s = "" for i in sys.stdin: n = int(i) if n == 0: break max = -100000 sum = int(input()) for i in range(n - 1): m = int(input()) if sum < 0 and sum < m: sum = m else: if m < 0 and max < sum: max = sum sum ...
false
13.043478
[ "+s = \"\"", "- sum = int(eval(input()))", "+ sum = int(input())", "- m = int(eval(input()))", "+ m = int(input())", "- elif m < 0 and max < sum:", "- max = sum", "- sum += m", "+ if m < 0 and max < sum:", "+ max = sum", ...
false
0.041911
0.03727
1.124508
[ "s930966343", "s595366720" ]
u760604008
p02936
python
s057745512
s230687072
1,996
1,498
132,760
107,544
Accepted
Accepted
24.95
def get_answer(ki): n = ki[0][0] q = ki[0][1] #n_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[1:-q]]] #q_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[-q:]]] n_data = ki[1:-q] #q_data = ki[-q:] q_index = [0] * n for qq in ki[-q:]: ...
def get_answer(ki): """ n = ki[0][0] q = ki[0][1] n_data = ki[1:-q] q_index = [0] * n for qq in ki[-q:]: q_index[qq[0] - 1] += qq[1] """ k0 = ki[0].split(" ") n = int(k0[0]) q = int(k0[1]) q_index = [0] * n for k in ki[-q:]: k = k.split(" ") ...
62
69
1,642
1,686
def get_answer(ki): n = ki[0][0] q = ki[0][1] # n_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[1:-q]]] # q_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[-q:]]] n_data = ki[1:-q] # q_data = ki[-q:] q_index = [0] * n for qq in ki[-q:]: q_ind...
def get_answer(ki): """ n = ki[0][0] q = ki[0][1] n_data = ki[1:-q] q_index = [0] * n for qq in ki[-q:]: q_index[qq[0] - 1] += qq[1] """ k0 = ki[0].split(" ") n = int(k0[0]) q = int(k0[1]) q_index = [0] * n for k in ki[-q:]: k = k.split(" ") q0 = i...
false
10.144928
[ "+ \"\"\"", "- # n_data = [[int(k[0]), int(k[1])] for k in [k.split(\" \") for k in ki[1:-q]]]", "- # q_data = [[int(k[0]), int(k[1])] for k in [k.split(\" \") for k in ki[-q:]]]", "- # q_data = ki[-q:]", "+ \"\"\"", "+ k0 = ki[0].split(\" \")", "+ n = int(k0[0])", "+ q = int(k...
false
0.043885
0.041519
1.057
[ "s057745512", "s230687072" ]
u477320129
p03061
python
s271944047
s502548963
109
98
30,932
29,768
Accepted
Accepted
10.09
#!/usr/bin/env python3 import sys from math import gcd from functools import reduce def f(A): ret = [A[0]] for a in A: ret.append(gcd(ret[-1], a)) ret[0] = reduce(gcd, A[1:]) return ret def solve(N: int, A: "List[int]"): return max(gcd(g0, g1) for g0, g1 in zip(f(A), f(A[...
#!/usr/bin/env python3 import sys from math import gcd def f(A): ret = [0] for a in A: ret.append(gcd(ret[-1], a)) return ret def solve(N: int, A: "List[int]"): return max(gcd(g0, g1) for g0, g1 in zip(f(A), f(A[::-1])[-2::-1])) # Generated by 1.1.7.1 https://github.com/kyur...
33
31
825
759
#!/usr/bin/env python3 import sys from math import gcd from functools import reduce def f(A): ret = [A[0]] for a in A: ret.append(gcd(ret[-1], a)) ret[0] = reduce(gcd, A[1:]) return ret def solve(N: int, A: "List[int]"): return max(gcd(g0, g1) for g0, g1 in zip(f(A), f(A[::-1])[-2::-1]))...
#!/usr/bin/env python3 import sys from math import gcd def f(A): ret = [0] for a in A: ret.append(gcd(ret[-1], a)) return ret def solve(N: int, A: "List[int]"): return max(gcd(g0, g1) for g0, g1 in zip(f(A), f(A[::-1])[-2::-1])) # Generated by 1.1.7.1 https://github.com/kyuridenamida/atcod...
false
6.060606
[ "-from functools import reduce", "- ret = [A[0]]", "+ ret = [0]", "- ret[0] = reduce(gcd, A[1:])" ]
false
0.047647
0.046945
1.014963
[ "s271944047", "s502548963" ]
u316584871
p02259
python
s549521569
s233547341
30
20
5,608
5,612
Accepted
Accepted
33.33
n = int(input()) nlist = list(map(int, input().split())) c= 0 for i in range(n): for k in range(i+1,n): j = n - 1 -k + i + 1 if nlist[j] < nlist[j-1]: m = nlist[j] nlist[j] = nlist[j-1] nlist[j-1] = m c += 1 for i in range(n): if (i == ...
n = int(input()) nlist = list(map(int, input().split())) def BubbleSort(C, n): c = 0 for i in range(n-1): for w in range(i+1, n): j = n-w+i if (C[j] < C[j-1]): a = C[j] C[j] = C[j-1] C[j-1] = a c += 1 ...
18
21
455
532
n = int(input()) nlist = list(map(int, input().split())) c = 0 for i in range(n): for k in range(i + 1, n): j = n - 1 - k + i + 1 if nlist[j] < nlist[j - 1]: m = nlist[j] nlist[j] = nlist[j - 1] nlist[j - 1] = m c += 1 for i in range(n): if i == n ...
n = int(input()) nlist = list(map(int, input().split())) def BubbleSort(C, n): c = 0 for i in range(n - 1): for w in range(i + 1, n): j = n - w + i if C[j] < C[j - 1]: a = C[j] C[j] = C[j - 1] C[j - 1] = a c += 1 ...
false
14.285714
[ "-c = 0", "-for i in range(n):", "- for k in range(i + 1, n):", "- j = n - 1 - k + i + 1", "- if nlist[j] < nlist[j - 1]:", "- m = nlist[j]", "- nlist[j] = nlist[j - 1]", "- nlist[j - 1] = m", "- c += 1", "+", "+", "+def BubbleSort(C...
false
0.043969
0.04401
0.999067
[ "s549521569", "s233547341" ]
u753803401
p04020
python
s883131855
s427687527
275
240
45,020
44,636
Accepted
Accepted
12.73
def slove(): import sys input = sys.stdin.readline N = int(input().rstrip('\n')) A = [int(input().rstrip('\n')) for _ in range(N)] t = 0 cnt = 0 for a in A: t += a if a == 0: cnt += (t // 2) t = 0 cnt += (t // 2) print(cnt) if...
def slove(): import sys input = sys.stdin.readline n = int(input().rstrip('\n')) a = [int(input().rstrip('\n')) for _ in range(n)] cnt = 0 t = 0 for v in a: if v == 0: cnt += (t // 2) t = 0 else: t += v cnt += (t // 2) ...
18
19
358
377
def slove(): import sys input = sys.stdin.readline N = int(input().rstrip("\n")) A = [int(input().rstrip("\n")) for _ in range(N)] t = 0 cnt = 0 for a in A: t += a if a == 0: cnt += t // 2 t = 0 cnt += t // 2 print(cnt) if __name__ == "__mai...
def slove(): import sys input = sys.stdin.readline n = int(input().rstrip("\n")) a = [int(input().rstrip("\n")) for _ in range(n)] cnt = 0 t = 0 for v in a: if v == 0: cnt += t // 2 t = 0 else: t += v cnt += t // 2 print(cnt) if ...
false
5.263158
[ "- N = int(input().rstrip(\"\\n\"))", "- A = [int(input().rstrip(\"\\n\")) for _ in range(N)]", "+ n = int(input().rstrip(\"\\n\"))", "+ a = [int(input().rstrip(\"\\n\")) for _ in range(n)]", "+ cnt = 0", "- cnt = 0", "- for a in A:", "- t += a", "- if a == 0:", ...
false
0.045049
0.041224
1.092786
[ "s883131855", "s427687527" ]
u589886885
p02268
python
s242730421
s627052057
300
40
18,356
20,388
Accepted
Accepted
86.67
import sys def binary_search(a, t, n): low = 0 high = n - 1 while low <= high: mid = (high + low) // 2 if a[mid] == t: return True elif a[mid] < t: low = mid + 1 else: high = mid - 1 return False def main(): n ...
import sys n = eval(input()) s = set([x for x in sys.stdin.readline().split()]) q = eval(input()) t = set([x for x in sys.stdin.readline().split()]) print((len(s & t)))
32
7
644
161
import sys def binary_search(a, t, n): low = 0 high = n - 1 while low <= high: mid = (high + low) // 2 if a[mid] == t: return True elif a[mid] < t: low = mid + 1 else: high = mid - 1 return False def main(): n = int(sys.stdin.re...
import sys n = eval(input()) s = set([x for x in sys.stdin.readline().split()]) q = eval(input()) t = set([x for x in sys.stdin.readline().split()]) print((len(s & t)))
false
78.125
[ "-", "-def binary_search(a, t, n):", "- low = 0", "- high = n - 1", "- while low <= high:", "- mid = (high + low) // 2", "- if a[mid] == t:", "- return True", "- elif a[mid] < t:", "- low = mid + 1", "- else:", "- high = mid...
false
0.041837
0.036173
1.156577
[ "s242730421", "s627052057" ]
u596276291
p03798
python
s430899009
s124831354
247
200
5,612
7,896
Accepted
Accepted
19.03
from collections import defaultdict def ok(l, s): for i in range(len(s) * 2): now = i % len(l) pre = now - 1 nex = (now + 1) % len(l) if (l[now] == -1 and s[now] == 'x') or (l[now] == 1 and s[now] == 'o'): if l[nex] is None: l[nex] = l[pre] ...
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys.se...
39
63
943
1,555
from collections import defaultdict def ok(l, s): for i in range(len(s) * 2): now = i % len(l) pre = now - 1 nex = (now + 1) % len(l) if (l[now] == -1 and s[now] == "x") or (l[now] == 1 and s[now] == "o"): if l[nex] is None: l[nex] = l[pre] e...
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys.setrecurs...
false
38.095238
[ "-from collections import defaultdict", "+from collections import defaultdict, Counter", "+from itertools import product, groupby, count, permutations, combinations", "+from math import pi, sqrt", "+from collections import deque", "+from bisect import bisect, bisect_left, bisect_right", "+from string im...
false
0.04581
0.04335
1.056748
[ "s430899009", "s124831354" ]
u580697892
p02726
python
s371760351
s033266483
2,000
1,711
148,744
147,464
Accepted
Accepted
14.45
# coding: utf-8 from collections import deque N, X, Y = map(int, input().split()) X -= 1 Y -= 1 D = [[0 for _ in range(N)] for _ in range(N)] for i in range(N): for j in range(N): if i == j: continue D[i][j] = abs(j-i) D[j][i] = abs(j-i) D[X][Y] = 1 D[Y][X] = 1 # pr...
# coding: utf-8 from collections import deque def main(): N, X, Y = map(int, input().split()) X -= 1 Y -= 1 D = [[0 for _ in range(N)] for _ in range(N)] for i in range(N): for j in range(N): if i == j: continue D[i][j] = abs(j-i) ...
40
38
1,052
1,118
# coding: utf-8 from collections import deque N, X, Y = map(int, input().split()) X -= 1 Y -= 1 D = [[0 for _ in range(N)] for _ in range(N)] for i in range(N): for j in range(N): if i == j: continue D[i][j] = abs(j - i) D[j][i] = abs(j - i) D[X][Y] = 1 D[Y][X] = 1 # print(*D, s...
# coding: utf-8 from collections import deque def main(): N, X, Y = map(int, input().split()) X -= 1 Y -= 1 D = [[0 for _ in range(N)] for _ in range(N)] for i in range(N): for j in range(N): if i == j: continue D[i][j] = abs(j - i) D[j][...
false
5
[ "-N, X, Y = map(int, input().split())", "-X -= 1", "-Y -= 1", "-D = [[0 for _ in range(N)] for _ in range(N)]", "-for i in range(N):", "- for j in range(N):", "- if i == j:", "- continue", "- D[i][j] = abs(j - i)", "- D[j][i] = abs(j - i)", "-D[X][Y] = 1", "-...
false
0.077643
0.112668
0.68913
[ "s371760351", "s033266483" ]
u111202730
p03610
python
s838811300
s991261564
29
17
3,188
3,188
Accepted
Accepted
41.38
s = eval(input()) answer = "" for i in range(0, len(s), 2): answer += s[i] print(answer)
s = eval(input()) print((s[0::2]))
6
2
92
27
s = eval(input()) answer = "" for i in range(0, len(s), 2): answer += s[i] print(answer)
s = eval(input()) print((s[0::2]))
false
66.666667
[ "-answer = \"\"", "-for i in range(0, len(s), 2):", "- answer += s[i]", "-print(answer)", "+print((s[0::2]))" ]
false
0.063803
0.076171
0.837628
[ "s838811300", "s991261564" ]
u415905784
p03700
python
s017750865
s602656768
1,468
1,259
10,944
125,888
Accepted
Accepted
14.24
import math N, A, B = list(map(int, input().split())) H = [0] * N H = [int(eval(input())) for i in range(N)] maxH = max(H) U = math.ceil(maxH / B) L = 0 def binsearch(U, L): m = (U + L) // 2 if m == L: print(U) else: if sum([math.ceil(max(h - B * m, 0) / (A - B)) for h in H]) <= m: bins...
import math N, A, B = list(map(int, input().split())) H = [0] * N maxh = 0 for i in range(N): h = int(eval(input())) H[i] = h maxh = max(h, maxh) lower = 0 upper = math.ceil(maxh / B) def search(upper, lower): if lower + 1 == upper: return upper else: mid = (upper + lower) // 2 _H =...
17
25
370
546
import math N, A, B = list(map(int, input().split())) H = [0] * N H = [int(eval(input())) for i in range(N)] maxH = max(H) U = math.ceil(maxH / B) L = 0 def binsearch(U, L): m = (U + L) // 2 if m == L: print(U) else: if sum([math.ceil(max(h - B * m, 0) / (A - B)) for h in H]) <= m: ...
import math N, A, B = list(map(int, input().split())) H = [0] * N maxh = 0 for i in range(N): h = int(eval(input())) H[i] = h maxh = max(h, maxh) lower = 0 upper = math.ceil(maxh / B) def search(upper, lower): if lower + 1 == upper: return upper else: mid = (upper + lower) // 2 ...
false
32
[ "-H = [int(eval(input())) for i in range(N)]", "-maxH = max(H)", "-U = math.ceil(maxH / B)", "-L = 0", "+maxh = 0", "+for i in range(N):", "+ h = int(eval(input()))", "+ H[i] = h", "+ maxh = max(h, maxh)", "+lower = 0", "+upper = math.ceil(maxh / B)", "-def binsearch(U, L):", "- ...
false
0.046271
0.045888
1.008327
[ "s017750865", "s602656768" ]
u375616706
p03475
python
s471506640
s881454388
1,107
81
3,188
3,188
Accepted
Accepted
92.68
n = (int)(eval(input())) # num of station cost = [] # list of costed timeto next s = [] # list of init train time freq = [] # list of freq of train departure for i in range(n-1): a, b, c = (list)(list(map(int, input().split()))) cost.append(a) s.append(b) freq.append(c) def t(num): # return ti...
n = (int)(eval(input())) # num of station cost = [] # list of costed timeto next s = [] # list of init train time freq = [] # list of freq of train departure for i in range(n-1): a, b, c = (list)(list(map(int, input().split()))) cost.append(a) s.append(b) freq.append(c) def t(num): # return ti...
32
33
821
861
n = (int)(eval(input())) # num of station cost = [] # list of costed timeto next s = [] # list of init train time freq = [] # list of freq of train departure for i in range(n - 1): a, b, c = (list)(list(map(int, input().split()))) cost.append(a) s.append(b) freq.append(c) def t(num): # return tim...
n = (int)(eval(input())) # num of station cost = [] # list of costed timeto next s = [] # list of init train time freq = [] # list of freq of train departure for i in range(n - 1): a, b, c = (list)(list(map(int, input().split()))) cost.append(a) s.append(b) freq.append(c) def t(num): # return tim...
false
3.030303
[ "- while 1:", "+ while 1 and False:", "- return now", "+ # return now", "+ return (now // freq + 1) * freq" ]
false
0.041214
0.035741
1.153129
[ "s471506640", "s881454388" ]
u604774382
p02257
python
s219901474
s265546179
1,050
810
6,720
4,540
Accepted
Accepted
22.86
def isPrime( x ): if 2 == x or 3 == x: return True if 0 == x%2: return False i = 3 while i*i <= x: if 0 == x%i: return False i += 1 return True n = int( eval(input( )) ) cnt = i = 0 while i < n: num = int( eval(input( )) ) if isPrime( num ): cnt += 1 i += 1 print( cnt )
def isPrime( x ): if 2 == x or 3 == x: return True if 0 == x%2: return False i = 3 while i*i <= x: if 0 == x%i: return False i += 1 return True n = int( input( ) ) nums = [] i = 0 while i < n: nums.append( int( input( ) ) ) i += 1 cnt = i = 0 for num in nums: if isPrime( num ...
23
26
308
368
def isPrime(x): if 2 == x or 3 == x: return True if 0 == x % 2: return False i = 3 while i * i <= x: if 0 == x % i: return False i += 1 return True n = int(eval(input())) cnt = i = 0 while i < n: num = int(eval(input())) if isPrime(num): ...
def isPrime(x): if 2 == x or 3 == x: return True if 0 == x % 2: return False i = 3 while i * i <= x: if 0 == x % i: return False i += 1 return True n = int(input()) nums = [] i = 0 while i < n: nums.append(int(input())) i += 1 cnt = i = 0 for num...
false
11.538462
[ "-n = int(eval(input()))", "+n = int(input())", "+nums = []", "+i = 0", "+while i < n:", "+ nums.append(int(input()))", "+ i += 1", "-while i < n:", "- num = int(eval(input()))", "+for num in nums:" ]
false
0.035828
0.037409
0.957738
[ "s219901474", "s265546179" ]
u606878291
p02695
python
s987736270
s138334622
1,074
576
9,204
9,208
Accepted
Accepted
46.37
from itertools import combinations_with_replacement N, M, Q = list(map(int, input().split(' '))) records = [tuple(map(int, input().split(' '))) for _ in range(Q)] max_score = 0 for A in combinations_with_replacement(list(range(1, M + 1)), r=N): score = 0 for a, b, c, d in records: if A[b - ...
N, M, Q = list(map(int, input().split(' '))) records = [tuple(map(int, input().split(' '))) for _ in range(Q)] max_score = 0 def dfs(start, end, depth, numbers): if depth == N: global max_score for n in range(start, end + 1): A = (*numbers, n) score = 0 ...
15
23
411
662
from itertools import combinations_with_replacement N, M, Q = list(map(int, input().split(" "))) records = [tuple(map(int, input().split(" "))) for _ in range(Q)] max_score = 0 for A in combinations_with_replacement(list(range(1, M + 1)), r=N): score = 0 for a, b, c, d in records: if A[b - 1] - A[a - 1...
N, M, Q = list(map(int, input().split(" "))) records = [tuple(map(int, input().split(" "))) for _ in range(Q)] max_score = 0 def dfs(start, end, depth, numbers): if depth == N: global max_score for n in range(start, end + 1): A = (*numbers, n) score = 0 for a, b...
false
34.782609
[ "-from itertools import combinations_with_replacement", "-", "-for A in combinations_with_replacement(list(range(1, M + 1)), r=N):", "- score = 0", "- for a, b, c, d in records:", "- if A[b - 1] - A[a - 1] == c:", "- score += d", "- max_score = max(max_score, score)", "+",...
false
0.046095
0.170179
0.270864
[ "s987736270", "s138334622" ]
u920438243
p03853
python
s193419178
s479546551
25
18
4,596
3,060
Accepted
Accepted
28
h,w = map(int,input().split()) rlists = [] for i in range(h): yoko = list(input()) rlists.append(yoko) rlists.append(yoko) for rlist in rlists: print(*rlist,sep="")
h,w = list(map(int,input().split())) for i in range(h): line = eval(input()) print(line) print(line)
8
5
188
105
h, w = map(int, input().split()) rlists = [] for i in range(h): yoko = list(input()) rlists.append(yoko) rlists.append(yoko) for rlist in rlists: print(*rlist, sep="")
h, w = list(map(int, input().split())) for i in range(h): line = eval(input()) print(line) print(line)
false
37.5
[ "-h, w = map(int, input().split())", "-rlists = []", "+h, w = list(map(int, input().split()))", "- yoko = list(input())", "- rlists.append(yoko)", "- rlists.append(yoko)", "-for rlist in rlists:", "- print(*rlist, sep=\"\")", "+ line = eval(input())", "+ print(line)", "+ pri...
false
0.071109
0.12373
0.574706
[ "s193419178", "s479546551" ]
u968166680
p03031
python
s043129719
s839910840
36
28
3,064
3,064
Accepted
Accepted
22.22
N, M = list(map(int, input().split())) s = [0] * M for i in range(M): s[i] = list(map(int, input().split()))[1:] s[i] = [v - 1 for v in s[i]] p = list(map(int, input().split())) ans = 0 for i in range(1 << N): all_lit = True for j in range(M): n = 0 for k in s[j]: ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 N, M = list(map(int, readline().split())) S = [[] for _ in range(M)] for i in range(M): _, *S[i] = [int(s) - 1 for s in readline().split()] P = list(map(int, read...
21
26
452
619
N, M = list(map(int, input().split())) s = [0] * M for i in range(M): s[i] = list(map(int, input().split()))[1:] s[i] = [v - 1 for v in s[i]] p = list(map(int, input().split())) ans = 0 for i in range(1 << N): all_lit = True for j in range(M): n = 0 for k in s[j]: n += bool(i...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 N, M = list(map(int, readline().split())) S = [[] for _ in range(M)] for i in range(M): _, *S[i] = [int(s) - 1 for s in readline().split()] P = list(map(int, readline().split())...
false
19.230769
[ "-N, M = list(map(int, input().split()))", "-s = [0] * M", "+import sys", "+", "+read = sys.stdin.read", "+readline = sys.stdin.readline", "+readlines = sys.stdin.readlines", "+sys.setrecursionlimit(10**9)", "+INF = 1 << 60", "+N, M = list(map(int, readline().split()))", "+S = [[] for _ in range...
false
0.038163
0.037474
1.018402
[ "s043129719", "s839910840" ]
u062484507
p03013
python
s523821020
s119771795
85
67
18,352
23,908
Accepted
Accepted
21.18
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9+7 n, m = list(map(int, readline().split())) a = list(map(int, read().split())) dp = [0] * (n + 1) ng = [0] * (n + 1) for i in a: ng[i] = 1 dp[0] = 1 if ng[1] != 1: ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9+7 n, m = list(map(int, readline().split())) a = set(map(int, read().split())) dp = [0] * (n + 1) dp[0] = 1 if 1 not in a: dp[1] = 1 cnt = 0 for i in range(2, n + 1): ...
33
24
646
502
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 n, m = list(map(int, readline().split())) a = list(map(int, read().split())) dp = [0] * (n + 1) ng = [0] * (n + 1) for i in a: ng[i] = 1 dp[0] = 1 if ng[1] != 1: dp[1] = 1 for i i...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 n, m = list(map(int, readline().split())) a = set(map(int, read().split())) dp = [0] * (n + 1) dp[0] = 1 if 1 not in a: dp[1] = 1 cnt = 0 for i in range(2, n + 1): if i not in a: ...
false
27.272727
[ "-a = list(map(int, read().split()))", "+a = set(map(int, read().split()))", "-ng = [0] * (n + 1)", "-for i in a:", "- ng[i] = 1", "-if ng[1] != 1:", "+if 1 not in a:", "+cnt = 0", "- if ng[i - 1] == 1 and ng[i - 2] == 1:", "- print((0))", "- exit()", "- elif ng[i - 1] =...
false
0.042133
0.048413
0.870274
[ "s523821020", "s119771795" ]
u462538484
p03729
python
s400273008
s232712303
23
18
3,060
2,940
Accepted
Accepted
21.74
s = input().split() a, b, c = s[0], s[1], s[2] if b.startswith(a[-1:]) and c.startswith(b[-1:]): print("YES") else: print("NO")
a, b, c = input().split() if a[-1:] == b[:1] and b[-1:] == c[:1]: print("YES") else: print("NO")
6
5
136
104
s = input().split() a, b, c = s[0], s[1], s[2] if b.startswith(a[-1:]) and c.startswith(b[-1:]): print("YES") else: print("NO")
a, b, c = input().split() if a[-1:] == b[:1] and b[-1:] == c[:1]: print("YES") else: print("NO")
false
16.666667
[ "-s = input().split()", "-a, b, c = s[0], s[1], s[2]", "-if b.startswith(a[-1:]) and c.startswith(b[-1:]):", "+a, b, c = input().split()", "+if a[-1:] == b[:1] and b[-1:] == c[:1]:" ]
false
0.046312
0.037879
1.222648
[ "s400273008", "s232712303" ]
u383025592
p02837
python
s961255562
s275282452
336
258
3,064
75,136
Accepted
Accepted
23.21
N = int(eval(input())) A = [0] * N X = [[] for _ in range(N)] for i in range(N): A[i] = int(eval(input())) for j in range(A[i]): X[i].append(list(map(int, input().split()))) Truth = 2 ** N ans = 0 while(bin(Truth) != bin(2 ** (N + 1))): for i in range(N): if(bin(Truth)[i+3] == "1"): for ...
N = int(eval(input())) x = [[0] * (N-1) for _ in range(N)] y = [[0] * (N-1) for _ in range(N)] A = [0] * N for i in range(N): A[i] = int(eval(input())) for j in range(A[i]): x[i][j], y[i][j] = list(map(int, input().split())) n = 2 ** N Flag = 0 ans = 0 while(n < 2 ** (N+1)): Flag = 0 for i in r...
23
25
553
582
N = int(eval(input())) A = [0] * N X = [[] for _ in range(N)] for i in range(N): A[i] = int(eval(input())) for j in range(A[i]): X[i].append(list(map(int, input().split()))) Truth = 2**N ans = 0 while bin(Truth) != bin(2 ** (N + 1)): for i in range(N): if bin(Truth)[i + 3] == "1": ...
N = int(eval(input())) x = [[0] * (N - 1) for _ in range(N)] y = [[0] * (N - 1) for _ in range(N)] A = [0] * N for i in range(N): A[i] = int(eval(input())) for j in range(A[i]): x[i][j], y[i][j] = list(map(int, input().split())) n = 2**N Flag = 0 ans = 0 while n < 2 ** (N + 1): Flag = 0 for i in...
false
8
[ "+x = [[0] * (N - 1) for _ in range(N)]", "+y = [[0] * (N - 1) for _ in range(N)]", "-X = [[] for _ in range(N)]", "- X[i].append(list(map(int, input().split())))", "-Truth = 2**N", "+ x[i][j], y[i][j] = list(map(int, input().split()))", "+n = 2**N", "+Flag = 0", "-while bin(Truth) != ...
false
0.037914
0.007184
5.277554
[ "s961255562", "s275282452" ]
u566428756
p02689
python
s074037650
s747142166
392
257
40,920
19,936
Accepted
Accepted
34.44
import heapq N,M=list(map(int,input().split())) H=list(map(int,input().split())) d={i:[0] for i in range(1,N+1)} for _ in range(M): a,b=list(map(int,input().split())) d[a].append(-(H[b-1])) d[b].append(-(H[a-1])) ans=0 for i in range(1,N+1): hq=d[i] heapq.heapify(hq) s=heapq....
N,M=list(map(int,input().split())) H=list(map(int,input().split())) L=[0]*(N+1) for i in range(M): a,b=list(map(int,input().split())) if H[a-1]>H[b-1]: L[b]=1 elif H[a-1]<H[b-1]: L[a]=1 else: L[a],L[b]=1,1 print((N-sum(L)))
21
12
371
261
import heapq N, M = list(map(int, input().split())) H = list(map(int, input().split())) d = {i: [0] for i in range(1, N + 1)} for _ in range(M): a, b = list(map(int, input().split())) d[a].append(-(H[b - 1])) d[b].append(-(H[a - 1])) ans = 0 for i in range(1, N + 1): hq = d[i] heapq.heapify(hq) ...
N, M = list(map(int, input().split())) H = list(map(int, input().split())) L = [0] * (N + 1) for i in range(M): a, b = list(map(int, input().split())) if H[a - 1] > H[b - 1]: L[b] = 1 elif H[a - 1] < H[b - 1]: L[a] = 1 else: L[a], L[b] = 1, 1 print((N - sum(L)))
false
42.857143
[ "-import heapq", "-", "-d = {i: [0] for i in range(1, N + 1)}", "-for _ in range(M):", "+L = [0] * (N + 1)", "+for i in range(M):", "- d[a].append(-(H[b - 1]))", "- d[b].append(-(H[a - 1]))", "-ans = 0", "-for i in range(1, N + 1):", "- hq = d[i]", "- heapq.heapify(hq)", "- s ...
false
0.091467
0.039644
2.307182
[ "s074037650", "s747142166" ]
u778814286
p03273
python
s409154154
s925102858
24
18
3,064
3,188
Accepted
Accepted
25
h, w = list(map(int, input().split())) rows = [] #最初のfor文で、..だけの行を除く行を格納 for i in range(h): row = eval(input()) for c in row: if c == '#': rows.append(row) break columns = [] column = '' for i in range(w): #各列に対して行う for j in range(len(rows)): #行の数、つまり列の長さ if rows[j][i:i...
h, w = list(map(int, input().split())) rs = [eval(input()) for _ in range(h)] rows = [] #.だけの行を省いてrowsに格納 for r in rs: if '#' in r: rows.append(r) ansrows = list(zip(*[c for c in zip(*rows) if '#' in c])) for r in list(ansrows): print((''.join(r)))
30
12
647
246
h, w = list(map(int, input().split())) rows = [] # 最初のfor文で、..だけの行を除く行を格納 for i in range(h): row = eval(input()) for c in row: if c == "#": rows.append(row) break columns = [] column = "" for i in range(w): # 各列に対して行う for j in range(len(rows)): # 行の数、つまり列の長さ if row...
h, w = list(map(int, input().split())) rs = [eval(input()) for _ in range(h)] rows = [] # .だけの行を省いてrowsに格納 for r in rs: if "#" in r: rows.append(r) ansrows = list(zip(*[c for c in zip(*rows) if "#" in c])) for r in list(ansrows): print(("".join(r)))
false
60
[ "-rows = [] # 最初のfor文で、..だけの行を除く行を格納", "-for i in range(h):", "- row = eval(input())", "- for c in row:", "- if c == \"#\":", "- rows.append(row)", "- break", "-columns = []", "-column = \"\"", "-for i in range(w): # 各列に対して行う", "- for j in range(len(rows))...
false
0.048113
0.047829
1.005944
[ "s409154154", "s925102858" ]
u671060652
p02777
python
s360342835
s306570343
287
168
66,028
38,256
Accepted
Accepted
41.46
import itertools import math import fractions import functools s, t = input().split() a, b = list(map(int,input().split())) u = eval(input()) if u == s: print((a-1,b)) else: print((a,b-1))
s, t = input().split() a, b = list(map(int, input().split())) u = eval(input()) if u == s: print((a-1,b)) else: print((a,b-1))
12
7
192
121
import itertools import math import fractions import functools s, t = input().split() a, b = list(map(int, input().split())) u = eval(input()) if u == s: print((a - 1, b)) else: print((a, b - 1))
s, t = input().split() a, b = list(map(int, input().split())) u = eval(input()) if u == s: print((a - 1, b)) else: print((a, b - 1))
false
41.666667
[ "-import itertools", "-import math", "-import fractions", "-import functools", "-" ]
false
0.060234
0.061179
0.98455
[ "s360342835", "s306570343" ]
u606045429
p02554
python
s993291965
s767948974
74
28
63,844
9,048
Accepted
Accepted
62.16
mod = 10 ** 9 + 7 N = int(eval(input())) s, n, z, e = 1, 0, 0, 0 for _ in range(N): s, n, z, e = 8 * s, s + n * 9, s + z * 9, n + z + e * 10 s %= mod n %= mod z %= mod e %= mod print(e)
mod = 10 ** 9 + 7 N = int(eval(input())) print(((pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)) % mod))
13
4
214
107
mod = 10**9 + 7 N = int(eval(input())) s, n, z, e = 1, 0, 0, 0 for _ in range(N): s, n, z, e = 8 * s, s + n * 9, s + z * 9, n + z + e * 10 s %= mod n %= mod z %= mod e %= mod print(e)
mod = 10**9 + 7 N = int(eval(input())) print(((pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)) % mod))
false
69.230769
[ "-s, n, z, e = 1, 0, 0, 0", "-for _ in range(N):", "- s, n, z, e = 8 * s, s + n * 9, s + z * 9, n + z + e * 10", "- s %= mod", "- n %= mod", "- z %= mod", "- e %= mod", "-print(e)", "+print(((pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)) % mod))" ]
false
0.191418
0.047003
4.072468
[ "s993291965", "s767948974" ]
u665452497
p03162
python
s396143966
s785522311
511
348
22,764
28,684
Accepted
Accepted
31.9
N = int(eval(input())) dp = [[0, 0, 0] for _ in range(N+1)] for i in range(N): a, b, c = list(map(int, input().split())) dp[i+1][0] = max(dp[i][1], dp[i][2]) + a dp[i+1][1] = max(dp[i][0], dp[i][2]) + b dp[i+1][2] = max(dp[i][0], dp[i][1]) + c print((max(dp[-1])))
N=int(eval(input())) dp=[[0,0,0] for _ in range(N+1)] for i in range(1,N+1): a,b,c=list(map(int,input().split())) dp[i][0]=max(dp[i-1][1]+b,dp[i-1][2]+c) dp[i][1]=max(dp[i-1][0]+a,dp[i-1][2]+c) dp[i][2]=max(dp[i-1][1]+b,dp[i-1][0]+a) print((max(dp[-1])))
12
8
293
263
N = int(eval(input())) dp = [[0, 0, 0] for _ in range(N + 1)] for i in range(N): a, b, c = list(map(int, input().split())) dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a dp[i + 1][1] = max(dp[i][0], dp[i][2]) + b dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c print((max(dp[-1])))
N = int(eval(input())) dp = [[0, 0, 0] for _ in range(N + 1)] for i in range(1, N + 1): a, b, c = list(map(int, input().split())) dp[i][0] = max(dp[i - 1][1] + b, dp[i - 1][2] + c) dp[i][1] = max(dp[i - 1][0] + a, dp[i - 1][2] + c) dp[i][2] = max(dp[i - 1][1] + b, dp[i - 1][0] + a) print((max(dp[-1])))
false
33.333333
[ "-for i in range(N):", "+for i in range(1, N + 1):", "- dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a", "- dp[i + 1][1] = max(dp[i][0], dp[i][2]) + b", "- dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c", "+ dp[i][0] = max(dp[i - 1][1] + b, dp[i - 1][2] + c)", "+ dp[i][1] = max(dp[i - 1][0] + a, ...
false
0.044795
0.04713
0.950456
[ "s396143966", "s785522311" ]
u970197315
p03472
python
s539998198
s878211694
558
480
20,784
21,192
Accepted
Accepted
13.98
# ABC085 D - Katana Thrower import numpy as np n,h = list(map(int,input().split())) A = [] B = [] ans = 0 for i in range(n): a,b = list(map(int,input().split())) A.append(a) B.append(b) B = np.array(B) a = max(A) B = B[B > a] B = np.sort(B)[::-1] for i in range(len(B)): if h <= 0: ...
n,h=list(map(int,input().split())) ab=[] ans=0 for i in range(n): aa,bb=list(map(int,input().split())) ab.append([aa,bb]) ab.sort(key=lambda x: x[0],reverse=True) katana=ab[0][0] ab.sort(key=lambda x: x[1],reverse=True) cnt=0 # print(ab) for a,b in ab: if b>katana: cnt+=1 for i in range(cnt)...
26
24
400
399
# ABC085 D - Katana Thrower import numpy as np n, h = list(map(int, input().split())) A = [] B = [] ans = 0 for i in range(n): a, b = list(map(int, input().split())) A.append(a) B.append(b) B = np.array(B) a = max(A) B = B[B > a] B = np.sort(B)[::-1] for i in range(len(B)): if h <= 0: break ...
n, h = list(map(int, input().split())) ab = [] ans = 0 for i in range(n): aa, bb = list(map(int, input().split())) ab.append([aa, bb]) ab.sort(key=lambda x: x[0], reverse=True) katana = ab[0][0] ab.sort(key=lambda x: x[1], reverse=True) cnt = 0 # print(ab) for a, b in ab: if b > katana: cnt += 1 for...
false
7.692308
[ "-# ABC085 D - Katana Thrower", "-import numpy as np", "-", "-A = []", "-B = []", "+ab = []", "- a, b = list(map(int, input().split()))", "- A.append(a)", "- B.append(b)", "-B = np.array(B)", "-a = max(A)", "-B = B[B > a]", "-B = np.sort(B)[::-1]", "-for i in range(len(B)):", "+...
false
0.206063
0.035204
5.853407
[ "s539998198", "s878211694" ]
u368796742
p03014
python
s306080749
s631025691
1,570
1,259
252,936
251,656
Accepted
Accepted
19.81
h,w = list(map(int,input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: n = 0 k = i while k...
def main(): h,w = list(map(int,input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: ...
36
39
888
1,069
h, w = list(map(int, input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: n = 0 k = i while k < h: ...
def main(): h, w = list(map(int, input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: n = 0 ...
false
7.692308
[ "-h, w = list(map(int, input().split()))", "-l = [list(eval(input())) for i in range(h)]", "-c1 = [[0 for i in range(w)] for i in range(h)]", "-c2 = [[0 for i in range(w)] for i in range(h)]", "-ans = 0", "-for i in range(h):", "- for j in range(w):", "- if c1[i][j] == 0:", "- n...
false
0.043576
0.107903
0.403845
[ "s306080749", "s631025691" ]
u945181840
p03014
python
s604606795
s124060001
1,036
896
247,280
126,100
Accepted
Accepted
13.51
import numpy as np import sys buf = sys.stdin.buffer H, W = list(map(int, buf.readline().split())) grid = np.zeros((H + 2, W + 2), np.int32) grid[1:-1, 1:-1] = (np.array(list(map(list, buf.read().decode('utf-8').split()))).reshape(H, W) == '.') * 1 grid_v = grid.T right = np.maximum.accumulate(np.where(grid ...
import numpy as np import sys line = sys.stdin.readline H, W = list(map(int, line().split())) grid = np.zeros((H + 2, W + 2), np.int32) grid[1:-1, 1:-1] = (np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == '.') * 1 left = np.zeros((H + 2, W + 2), np.int32) right = np.zeros((H + 2, W + 2), np...
15
31
714
902
import numpy as np import sys buf = sys.stdin.buffer H, W = list(map(int, buf.readline().split())) grid = np.zeros((H + 2, W + 2), np.int32) grid[1:-1, 1:-1] = ( np.array(list(map(list, buf.read().decode("utf-8").split()))).reshape(H, W) == "." ) * 1 grid_v = grid.T right = np.maximum.accumulate(np.where(grid < 1,...
import numpy as np import sys line = sys.stdin.readline H, W = list(map(int, line().split())) grid = np.zeros((H + 2, W + 2), np.int32) grid[1:-1, 1:-1] = ( np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == "." ) * 1 left = np.zeros((H + 2, W + 2), np.int32) right = np.zeros((H + 2, W + 2), np.i...
false
51.612903
[ "-buf = sys.stdin.buffer", "-H, W = list(map(int, buf.readline().split()))", "+line = sys.stdin.readline", "+H, W = list(map(int, line().split()))", "- np.array(list(map(list, buf.read().decode(\"utf-8\").split()))).reshape(H, W) == \".\"", "+ np.array([list(line().rstrip()) for _ in range(H)]).resh...
false
0.370622
0.248511
1.491369
[ "s604606795", "s124060001" ]
u600402037
p02788
python
s727928998
s278773929
1,215
1,051
67,812
67,692
Accepted
Accepted
13.5
import sys sys.setrecursionlimit(10 ** 7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, D, A = lr() XH = [lr() for _ in range(N)] XH.sort() over = [N] * N # over[i]はi番目のモンスターを攻撃した時影響のないモンスターの最小値(最大はNで対象なし) cur = 1 for i in range(N): w...
import sys sys.setrecursionlimit(10 ** 7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def main(): N, D, A = lr() XH = [lr() for _ in range(N)] XH.sort() over = [N] * N # over[i]はi番目のモンスターを攻撃した時影響のないモンスターの最小値(最大はNで対象なし) c...
32
36
725
867
import sys sys.setrecursionlimit(10**7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, D, A = lr() XH = [lr() for _ in range(N)] XH.sort() over = [N] * N # over[i]はi番目のモンスターを攻撃した時影響のないモンスターの最小値(最大はNで対象なし) cur = 1 for i in range(N): while cur < N and ...
import sys sys.setrecursionlimit(10**7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def main(): N, D, A = lr() XH = [lr() for _ in range(N)] XH.sort() over = [N] * N # over[i]はi番目のモンスターを攻撃した時影響のないモンスターの最小値(最大はNで対象なし) cur = 1 for...
false
11.111111
[ "-N, D, A = lr()", "-XH = [lr() for _ in range(N)]", "-XH.sort()", "-over = [N] * N # over[i]はi番目のモンスターを攻撃した時影響のないモンスターの最小値(最大はNで対象なし)", "-cur = 1", "-for i in range(N):", "- while cur < N and XH[i][0] + D + D >= XH[cur][0]:", "- cur += 1", "- over[i] = cur", "-damage = 0 # 今までの累計のダ...
false
0.098463
0.122799
0.801822
[ "s727928998", "s278773929" ]
u898109279
p02601
python
s377891306
s805849362
36
25
9,136
9,132
Accepted
Accepted
30.56
A, B, C = list(map(int, input().split())) K = int(eval(input())) def combinations(k): result = [] for b in range(k + 1): for c in range(k + 1 - b): result.append([b, c]) return result def magic(A, B, C, K): if A < B < C: return True for l in combina...
A, B, C = list(map(int, input().split())) K = int(eval(input())) def combinations(k): result = [] for b in range(k + 1): for c in range(k + 1 - b): result.append([b, c]) return result def magic(A, B, C, K): if A < B < C: return True for b_count, c_c...
35
34
628
613
A, B, C = list(map(int, input().split())) K = int(eval(input())) def combinations(k): result = [] for b in range(k + 1): for c in range(k + 1 - b): result.append([b, c]) return result def magic(A, B, C, K): if A < B < C: return True for l in combinations(K): a...
A, B, C = list(map(int, input().split())) K = int(eval(input())) def combinations(k): result = [] for b in range(k + 1): for c in range(k + 1 - b): result.append([b, c]) return result def magic(A, B, C, K): if A < B < C: return True for b_count, c_count in combination...
false
2.857143
[ "- for l in combinations(K):", "+ for b_count, c_count in combinations(K):", "- b_count, c_count = l" ]
false
0.035965
0.04252
0.845849
[ "s377891306", "s805849362" ]
u648212584
p03253
python
s951798095
s213912213
349
213
63,744
54,512
Accepted
Accepted
38.97
import sys input = sys.stdin.buffer.readline import copy def main(): N,M = list(map(int,input().split())) MOD = 10**9+7 def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 ...
import sys input = sys.stdin.buffer.readline def main(): K,M = list(map(int,input().split())) def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent while b * b <= n: while n % b == 0: n = n // b e = e + 1 if e > 0: fct.append((b, e)) b, e = b + 1, 0 i...
50
49
1,145
880
import sys input = sys.stdin.buffer.readline import copy def main(): N, M = list(map(int, input().split())) MOD = 10**9 + 7 def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 ...
import sys input = sys.stdin.buffer.readline def main(): K, M = list(map(int, input().split())) def factorize(n): fct = [] # prime factor b, e = 2, 0 # base, exponent while b * b <= n: while n % b == 0: n = n // b e = e + 1 if...
false
2
[ "-import copy", "- N, M = list(map(int, input().split()))", "+ K, M = list(map(int, input().split()))", "+", "+ def factorize(n):", "+ fct = [] # prime factor", "+ b, e = 2, 0 # base, exponent", "+ while b * b <= n:", "+ while n % b == 0:", "+ ...
false
0.128153
1.134619
0.112948
[ "s951798095", "s213912213" ]
u588341295
p03682
python
s667510882
s746681552
1,742
1,354
129,184
60,004
Accepted
Accepted
22.27
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) from operator import itemgetter # Union-Find木 class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK、その場合は[0]は未使用 self.par...
# -*- coding: utf-8 -*- """ ・最小全域木、Union-Find """ import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) from operator import itemgetter # Union-Find木 class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK...
74
83
1,767
1,888
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10**9) from operator import itemgetter # Union-Find木 class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK、その場合は[0]は未使用 self.par = [i for...
# -*- coding: utf-8 -*- """ ・最小全域木、Union-Find """ import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10**9) from operator import itemgetter # Union-Find木 class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK、その場合は[0]は未使用...
false
10.843373
[ "+\"\"\"", "+・最小全域木、Union-Find", "+\"\"\"", "+grp = N", "+ grp -= 1", "+ # グループが1つになれば、それ以上やる必要ない", "+ if grp == 1:", "+ break" ]
false
0.04886
0.283218
0.172516
[ "s667510882", "s746681552" ]
u644907318
p03248
python
s217721360
s439518334
339
118
59,128
78,892
Accepted
Accepted
65.19
from bisect import bisect_right s = list(map(int,list(eval(input())))) s.insert(0,-1) n = len(s)-1 flag = 0 if s[n]==1 or s[1]==0 or s[n-1]==0: flag = 1 else: for i in range(2,n-1): if s[i]!=s[n-i]: flag = 1 break if flag==1: print((-1)) else: print((n,n-1)...
s = input().strip() n = len(s) s = "0"+s flag = 0 if s[n]=="1" or s[1]=="0": flag = 1 else: for i in range(1,n): if s[i]!=s[n-i]: flag = 1 break if flag==1: print((-1)) else: A = [1] for i in range(2,n): if s[i]=="1": while A: ...
29
24
616
440
from bisect import bisect_right s = list(map(int, list(eval(input())))) s.insert(0, -1) n = len(s) - 1 flag = 0 if s[n] == 1 or s[1] == 0 or s[n - 1] == 0: flag = 1 else: for i in range(2, n - 1): if s[i] != s[n - i]: flag = 1 break if flag == 1: print((-1)) else: print(...
s = input().strip() n = len(s) s = "0" + s flag = 0 if s[n] == "1" or s[1] == "0": flag = 1 else: for i in range(1, n): if s[i] != s[n - i]: flag = 1 break if flag == 1: print((-1)) else: A = [1] for i in range(2, n): if s[i] == "1": while A: ...
false
17.241379
[ "-from bisect import bisect_right", "-", "-s = list(map(int, list(eval(input()))))", "-s.insert(0, -1)", "-n = len(s) - 1", "+s = input().strip()", "+n = len(s)", "+s = \"0\" + s", "-if s[n] == 1 or s[1] == 0 or s[n - 1] == 0:", "+if s[n] == \"1\" or s[1] == \"0\":", "- for i in range(2, n - ...
false
0.044528
0.036716
1.212746
[ "s217721360", "s439518334" ]
u001024152
p03434
python
s284191646
s713573570
20
17
2,940
2,940
Accepted
Accepted
15
n = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) # 降順 alice, bob = a[0::2], a[1::2] print((sum(alice) - sum(bob)))
N = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) ans = 0 for i,ai in enumerate(a): if i%2==0: ans += ai else: ans -= ai print(ans)
5
10
141
189
n = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) # 降順 alice, bob = a[0::2], a[1::2] print((sum(alice) - sum(bob)))
N = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) ans = 0 for i, ai in enumerate(a): if i % 2 == 0: ans += ai else: ans -= ai print(ans)
false
50
[ "-n = int(eval(input()))", "+N = int(eval(input()))", "-a.sort(reverse=True) # 降順", "-alice, bob = a[0::2], a[1::2]", "-print((sum(alice) - sum(bob)))", "+a.sort(reverse=True)", "+ans = 0", "+for i, ai in enumerate(a):", "+ if i % 2 == 0:", "+ ans += ai", "+ else:", "+ ans...
false
0.047947
0.052845
0.907328
[ "s284191646", "s713573570" ]
u386170566
p03035
python
s642574039
s579889989
20
17
2,940
2,940
Accepted
Accepted
15
#ABC127A - Ferris Wheel A, B = list(map(int,input().split())) if A >= 13: print(B) if 6 <= A <= 12: print((B//2)) if A <= 5: print((0))
#ABC127A - Ferris Wheel A, B = list(map(int,input().split())) if A >= 13: print(B) elif 6 <= A <= 12: print((B//2)) else: print((0))
8
8
150
147
# ABC127A - Ferris Wheel A, B = list(map(int, input().split())) if A >= 13: print(B) if 6 <= A <= 12: print((B // 2)) if A <= 5: print((0))
# ABC127A - Ferris Wheel A, B = list(map(int, input().split())) if A >= 13: print(B) elif 6 <= A <= 12: print((B // 2)) else: print((0))
false
0
[ "-if 6 <= A <= 12:", "+elif 6 <= A <= 12:", "-if A <= 5:", "+else:" ]
false
0.051202
0.051265
0.998766
[ "s642574039", "s579889989" ]
u094191970
p03112
python
s634651692
s400808207
1,717
1,139
12,800
17,556
Accepted
Accepted
33.66
import bisect A, B, Q = list(map(int, input().split())) INF = 10 ** 11 s_list = [-INF] + [int(eval(input())) for i in range(A)] + [INF] t_list = [-INF] + [int(eval(input())) for i in range(B)] + [INF] for q in range(Q): x = int(eval(input())) near_right_s = bisect.bisect_right(s_list, x) near_righ...
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from bisect import bisect a,b,q=nii() s=[-10**18]+[int(eval(input())) for i in range(a)]+[10**18] t=[-10**18]+[int(eval(input())) for i in range(b)]+[10**18] for i in range(q): x=in...
17
30
683
632
import bisect A, B, Q = list(map(int, input().split())) INF = 10**11 s_list = [-INF] + [int(eval(input())) for i in range(A)] + [INF] t_list = [-INF] + [int(eval(input())) for i in range(B)] + [INF] for q in range(Q): x = int(eval(input())) near_right_s = bisect.bisect_right(s_list, x) near_right_t = bisec...
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from bisect import bisect a, b, q = nii() s = [-(10**18)] + [int(eval(input())) for i in range(a)] + [10**18] t = [-(10**18)] + [int(eval(input())) for i in range(b)] + [10**18] for i i...
false
43.333333
[ "-import bisect", "+from sys import stdin", "-A, B, Q = list(map(int, input().split()))", "-INF = 10**11", "-s_list = [-INF] + [int(eval(input())) for i in range(A)] + [INF]", "-t_list = [-INF] + [int(eval(input())) for i in range(B)] + [INF]", "-for q in range(Q):", "+nii = lambda: list(map(int, stdi...
false
0.036794
0.05604
0.656561
[ "s634651692", "s400808207" ]
u094191970
p03944
python
s186965392
s720319018
132
30
3,188
9,216
Accepted
Accepted
77.27
w,h,n=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(n)] xy=[['.' for i in range(w)] for i in range(h)] for x,y,a in l: x-=1 y-=1 if a==1: for i in range(h): for j in range(w): if j<=x: xy[i][j]='#' if a==2: for i in range(h): ...
w, h, n = list(map(int,input().split())) y_min = 0 y_max = h x_min = 0 x_max = w for i in range(n): x, y, a = list(map(int,input().split())) if a == 1: x_min = max(x_min, x) if a == 2: x_max = min(x_max, x) if a == 3: y_min = max(y_min, y) if a == 4: y_max = min(y_m...
34
28
641
449
w, h, n = list(map(int, input().split())) l = [list(map(int, input().split())) for i in range(n)] xy = [["." for i in range(w)] for i in range(h)] for x, y, a in l: x -= 1 y -= 1 if a == 1: for i in range(h): for j in range(w): if j <= x: xy[i][j] = "#...
w, h, n = list(map(int, input().split())) y_min = 0 y_max = h x_min = 0 x_max = w for i in range(n): x, y, a = list(map(int, input().split())) if a == 1: x_min = max(x_min, x) if a == 2: x_max = min(x_max, x) if a == 3: y_min = max(y_min, y) if a == 4: y_max = min(y_m...
false
17.647059
[ "-l = [list(map(int, input().split())) for i in range(n)]", "-xy = [[\".\" for i in range(w)] for i in range(h)]", "-for x, y, a in l:", "- x -= 1", "- y -= 1", "+y_min = 0", "+y_max = h", "+x_min = 0", "+x_max = w", "+for i in range(n):", "+ x, y, a = list(map(int, input().split()))", ...
false
0.083993
0.04542
1.849273
[ "s186965392", "s720319018" ]
u690536347
p03213
python
s708628669
s920806235
31
23
3,436
3,316
Accepted
Accepted
25.81
from collections import Counter as c from itertools import permutations as p def fact(n): d=[] for i in range(2,int(n**0.5)+2): while n%i==0: n//=i d.append(i) if n!=1:d.append(n) return c(d) n=int(eval(input())) d=c() for i in range(1,n+1): d+=fact(i...
from collections import defaultdict as dd from itertools import permutations as p def factorize(n): d = dd(int) for i in range(2, int(n**0.5)+1): while n%i==0: d[i] += 1 n //= i if not n: break if n>1: d[n] += 1 return d N = in...
19
39
455
734
from collections import Counter as c from itertools import permutations as p def fact(n): d = [] for i in range(2, int(n**0.5) + 2): while n % i == 0: n //= i d.append(i) if n != 1: d.append(n) return c(d) n = int(eval(input())) d = c() for i in range(1, n + 1...
from collections import defaultdict as dd from itertools import permutations as p def factorize(n): d = dd(int) for i in range(2, int(n**0.5) + 1): while n % i == 0: d[i] += 1 n //= i if not n: break if n > 1: d[n] += 1 return d N = int(eva...
false
51.282051
[ "-from collections import Counter as c", "+from collections import defaultdict as dd", "-def fact(n):", "- d = []", "- for i in range(2, int(n**0.5) + 2):", "+def factorize(n):", "+ d = dd(int)", "+ for i in range(2, int(n**0.5) + 1):", "+ d[i] += 1", "- d.append(...
false
0.044917
0.042464
1.057764
[ "s708628669", "s920806235" ]
u014333473
p02707
python
s333287284
s017752635
233
194
38,724
48,704
Accepted
Accepted
16.74
N = int(eval(input())) A = list(map(int, input().split())) result = {} for i in range(N): result[i+1] = 0 for i in range(N-1): if A[i] in result: result[A[i]] += 1 for i in list(result.values()): print(i)
n={i:0 for i in range(int(input()))} for i in list(map(int,input().split())): n[i-1]+=1 [print(i) for i in n.values()]
10
4
211
123
N = int(eval(input())) A = list(map(int, input().split())) result = {} for i in range(N): result[i + 1] = 0 for i in range(N - 1): if A[i] in result: result[A[i]] += 1 for i in list(result.values()): print(i)
n = {i: 0 for i in range(int(input()))} for i in list(map(int, input().split())): n[i - 1] += 1 [print(i) for i in n.values()]
false
60
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-result = {}", "-for i in range(N):", "- result[i + 1] = 0", "-for i in range(N - 1):", "- if A[i] in result:", "- result[A[i]] += 1", "-for i in list(result.values()):", "- print(i)", "+n = {i: 0 for i in range(...
false
0.040375
0.079709
0.506534
[ "s333287284", "s017752635" ]
u260216890
p02837
python
s879225986
s757262487
686
310
3,064
3,064
Accepted
Accepted
54.81
N=int(eval(input())) table=[[None]*N for _ in range(N)] for i in range(N): a=int(eval(input())) for j in range(a): x,y=list(map(int, input().split())) table[i][x-1]=y def is_consistent(table,hito): flag=True for i in range(len(hito)): if hito[i]==0: conti...
N=int(eval(input())) shogen=[] for i in range(N): a=int(eval(input())) ash=[] for j in range(a): xy=tuple(map(int,input().split())) ash.append(xy) shogen.append(ash) cnt="0000" for i in range(1<<N): flag=True fact="0"*(N-len(bin(i)[2:]))+bin(i)[2:] for j in range(N): if fact[j]==...
36
27
908
512
N = int(eval(input())) table = [[None] * N for _ in range(N)] for i in range(N): a = int(eval(input())) for j in range(a): x, y = list(map(int, input().split())) table[i][x - 1] = y def is_consistent(table, hito): flag = True for i in range(len(hito)): if hito[i] == 0: ...
N = int(eval(input())) shogen = [] for i in range(N): a = int(eval(input())) ash = [] for j in range(a): xy = tuple(map(int, input().split())) ash.append(xy) shogen.append(ash) cnt = "0000" for i in range(1 << N): flag = True fact = "0" * (N - len(bin(i)[2:])) + bin(i)[2:] fo...
false
25
[ "-table = [[None] * N for _ in range(N)]", "+shogen = []", "+ ash = []", "- x, y = list(map(int, input().split()))", "- table[i][x - 1] = y", "-", "-", "-def is_consistent(table, hito):", "+ xy = tuple(map(int, input().split()))", "+ ash.append(xy)", "+ shogen.a...
false
0.039016
0.037486
1.040813
[ "s879225986", "s757262487" ]
u622011073
p03549
python
s328881278
s852936612
21
17
2,940
2,940
Accepted
Accepted
19.05
n,m=list(map(int,input().split()));print((1900*m+100*(n-m)<<m))
n,m=list(map(int,input().split()));print((100*(18*m+n)<<m))
1
1
57
51
n, m = list(map(int, input().split())) print((1900 * m + 100 * (n - m) << m))
n, m = list(map(int, input().split())) print((100 * (18 * m + n) << m))
false
0
[ "-print((1900 * m + 100 * (n - m) << m))", "+print((100 * (18 * m + n) << m))" ]
false
0.039982
0.039482
1.012673
[ "s328881278", "s852936612" ]
u644907318
p02773
python
s307370946
s908978652
1,560
511
113,516
147,888
Accepted
Accepted
67.24
N = int(eval(input())) C = {} for _ in range(N): s = input().strip() if s not in C: C[s] = 0 C[s] += 1 C = sorted(list(C.items()),key=lambda x:x[0]) C = sorted(C,key=lambda x:x[1],reverse=True) k = C[0][1] for i in range(len(C)): if C[i][1]==k: print((C[i][0])) else:brea...
N = int(eval(input())) C = {} for _ in range(N): s = input().strip() if s not in C: C[s]=0 C[s] += 1 cmax = 0 for s in C: cmax = max(cmax,C[s]) A = [] for s in C: if C[s]==cmax: A.append(s) A = sorted(A) for i in range(len(A)): print((A[i]))
14
17
313
289
N = int(eval(input())) C = {} for _ in range(N): s = input().strip() if s not in C: C[s] = 0 C[s] += 1 C = sorted(list(C.items()), key=lambda x: x[0]) C = sorted(C, key=lambda x: x[1], reverse=True) k = C[0][1] for i in range(len(C)): if C[i][1] == k: print((C[i][0])) else: b...
N = int(eval(input())) C = {} for _ in range(N): s = input().strip() if s not in C: C[s] = 0 C[s] += 1 cmax = 0 for s in C: cmax = max(cmax, C[s]) A = [] for s in C: if C[s] == cmax: A.append(s) A = sorted(A) for i in range(len(A)): print((A[i]))
false
17.647059
[ "-C = sorted(list(C.items()), key=lambda x: x[0])", "-C = sorted(C, key=lambda x: x[1], reverse=True)", "-k = C[0][1]", "-for i in range(len(C)):", "- if C[i][1] == k:", "- print((C[i][0]))", "- else:", "- break", "+cmax = 0", "+for s in C:", "+ cmax = max(cmax, C[s])", ...
false
0.040824
0.036289
1.124951
[ "s307370946", "s908978652" ]
u002459665
p03328
python
s770027302
s470627945
42
18
3,060
3,064
Accepted
Accepted
57.14
def main(): a, b = list(map(int, input().split())) l = [] for i in range(2, 1001): h = 0 for j in range(1, i): h = h + j l.append(h) for i in range(len(l) - 1): if l[i] - a == l[i + 1] - b: print((l[i] - a)) break if...
def main(): a, b = list(map(int, input().split())) l = [] for i in range(2, 1001): h = 0 for j in range(1, i): h = h + j l.append(h) for i in range(len(l) - 1): if l[i] - a == l[i + 1] - b: print((l[i] - a)) break de...
18
29
349
500
def main(): a, b = list(map(int, input().split())) l = [] for i in range(2, 1001): h = 0 for j in range(1, i): h = h + j l.append(h) for i in range(len(l) - 1): if l[i] - a == l[i + 1] - b: print((l[i] - a)) break if __name__ == "__ma...
def main(): a, b = list(map(int, input().split())) l = [] for i in range(2, 1001): h = 0 for j in range(1, i): h = h + j l.append(h) for i in range(len(l) - 1): if l[i] - a == l[i + 1] - b: print((l[i] - a)) break def main2(): a, ...
false
37.931034
[ "+def main2():", "+ a, b = list(map(int, input().split()))", "+ x = b - a", "+ s = 0", "+ for i in range(1, x):", "+ s = s + i", "+ print((s - a))", "+", "+", "- main()", "+ main2()" ]
false
0.113497
0.031861
3.562206
[ "s770027302", "s470627945" ]
u043048943
p02599
python
s393830342
s808270729
1,782
1,091
229,644
237,512
Accepted
Accepted
38.78
class BinaryIndexedTree: def __init__(self, size=10**7): self.size = size self.data = [0]*(size+1) def add(self, index, x): while index <= self.size: self.data[index] += x index += index & -index def prefix_sum(self, index): res = 0 ...
class BinaryIndexedTree: def __init__(self, size=10**7): self.size = size self.data = [0]*(size+1) def add(self, index, x): while index <= self.size: self.data[index] += x index += index & -index def prefix_sum(self, index): res = 0 ...
88
90
2,049
2,184
class BinaryIndexedTree: def __init__(self, size=10**7): self.size = size self.data = [0] * (size + 1) def add(self, index, x): while index <= self.size: self.data[index] += x index += index & -index def prefix_sum(self, index): res = 0 while...
class BinaryIndexedTree: def __init__(self, size=10**7): self.size = size self.data = [0] * (size + 1) def add(self, index, x): while index <= self.size: self.data[index] += x index += index & -index def prefix_sum(self, index): res = 0 while...
false
2.222222
[ "+ # クエリを保存するリストのリスト, r -> (l,クエリの順番)のリスト", "- # 順番と一緒にクエリを保存", "+ for i in range(N + 1):", "+ queries.append([])", "+ # クエリを保存", "- queries.append((i, l, r))", "- # rについてクエリをソート", "- queries.sort(key=lambda x: x[2])", "+ queries[r].append((l, i))", "- for...
false
0.047168
0.035922
1.313071
[ "s393830342", "s808270729" ]
u537782349
p03830
python
s360146812
s757143466
81
41
3,064
3,064
Accepted
Accepted
49.38
a = [True] * 1001 a[0] = False a[1] = False b = [] c = {} for i in range(2, 1001): if a[i]: b.append(i) for j in range(2, 1001, 2): a[j] = False d = int(eval(input())) for j in range(2, d + 1): temp_j = j for i in b: while True: if temp_j % i !=...
z = int(eval(input())) a = [True] * 1001 a[0] = False a[1] = False b = [] for i in range(2, 1001): if a[i]: b.append(i) for j in range(i, 1001, i): a[j] = False c = {} for i in range(1, z + 1): d = i while True: if d == 1: break else: ...
27
29
585
664
a = [True] * 1001 a[0] = False a[1] = False b = [] c = {} for i in range(2, 1001): if a[i]: b.append(i) for j in range(2, 1001, 2): a[j] = False d = int(eval(input())) for j in range(2, d + 1): temp_j = j for i in b: while True: if temp_j % i != 0: ...
z = int(eval(input())) a = [True] * 1001 a[0] = False a[1] = False b = [] for i in range(2, 1001): if a[i]: b.append(i) for j in range(i, 1001, i): a[j] = False c = {} for i in range(1, z + 1): d = i while True: if d == 1: break else: while...
false
6.896552
[ "+z = int(eval(input()))", "-c = {}", "- for j in range(2, 1001, 2):", "+ for j in range(i, 1001, i):", "-d = int(eval(input()))", "-for j in range(2, d + 1):", "- temp_j = j", "- for i in b:", "- while True:", "- if temp_j % i != 0:", "- brea...
false
0.17496
0.064596
2.708519
[ "s360146812", "s757143466" ]
u729133443
p03081
python
s135870659
s183950290
1,050
898
11,668
11,412
Accepted
Accepted
14.48
def main(): def solve(mid,g): for t,d in zip(x,y): if s[mid]==t: mid-=(d<'R')or-1 if mid==g: return 1 return 0 n,q,s,*z=open(0).read().split() x,y=z[::2],z[1::2] n,q=int(n),int(q) s=' %s '%s ok=0 ng=n+1 ...
def main(): def solve(mid,g): for t,d in zip(x,y): if s[mid]==t: mid-=(d<'R')or-1 return mid==g n,q,s,*z=open(0).read().split() x,y=z[::2],z[1::2] n,q=int(n),int(q) s=' %s '%s ok=0 ng=n+1 while abs(ok-ng)>1: mid=(ok+ng)//2 ...
32
30
673
628
def main(): def solve(mid, g): for t, d in zip(x, y): if s[mid] == t: mid -= (d < "R") or -1 if mid == g: return 1 return 0 n, q, s, *z = open(0).read().split() x, y = z[::2], z[1::2] n, q = int(n), int(q) s = " %s " % s ok...
def main(): def solve(mid, g): for t, d in zip(x, y): if s[mid] == t: mid -= (d < "R") or -1 return mid == g n, q, s, *z = open(0).read().split() x, y = z[::2], z[1::2] n, q = int(n), int(q) s = " %s " % s ok = 0 ng = n + 1 while abs(ok - ng) ...
false
6.25
[ "- if mid == g:", "- return 1", "- return 0", "+ return mid == g" ]
false
0.046332
0.116983
0.396057
[ "s135870659", "s183950290" ]
u800058906
p02881
python
s687874135
s599006288
170
144
9,796
9,328
Accepted
Accepted
15.29
n=int(eval(input())) def divisor(n): i = 1 table = [] while i * i <= n: if n%i == 0: table.append(i) table.append(n//i) i += 1 table = list(set(table)) return table a=divisor(n) a.sort() c=[] for i in range(len(a)//2+1): d=a[i]-1+a[-i...
import sys n=int(eval(input())) c=[] for i in range(2,int(n**(1/2))+1): if n%i==0: c.append(i+n//i-2) if len(c)==0: print((n-1)) sys.exit() print((min(c)))
22
15
353
188
n = int(eval(input())) def divisor(n): i = 1 table = [] while i * i <= n: if n % i == 0: table.append(i) table.append(n // i) i += 1 table = list(set(table)) return table a = divisor(n) a.sort() c = [] for i in range(len(a) // 2 + 1): d = a[i] - 1 + a[...
import sys n = int(eval(input())) c = [] for i in range(2, int(n ** (1 / 2)) + 1): if n % i == 0: c.append(i + n // i - 2) if len(c) == 0: print((n - 1)) sys.exit() print((min(c)))
false
31.818182
[ "+import sys", "+", "-", "-", "-def divisor(n):", "- i = 1", "- table = []", "- while i * i <= n:", "- if n % i == 0:", "- table.append(i)", "- table.append(n // i)", "- i += 1", "- table = list(set(table))", "- return table", "-", "-"...
false
0.049774
0.052897
0.940959
[ "s687874135", "s599006288" ]
u576917603
p03681
python
s790907573
s055083421
703
446
5,184
4,364
Accepted
Accepted
36.56
x,y=list(map(int,input().split())) import math xx=math.factorial(x) yy=math.factorial(y) if x==y: print((xx*yy*2%((10**9)+7))) elif abs(x-y)==1: print((xx*yy%((10**9)+7))) else: print((0))
n,m=list(map(int,input().split())) if abs(n-m)>1: print((0)) exit() mod=10**9+7 from math import factorial x=factorial(n) y=factorial(m) if n==m: print((((x%mod)*(y%mod)*2)%mod)) else: print((((x%mod)*(y%mod))%mod))
10
12
197
230
x, y = list(map(int, input().split())) import math xx = math.factorial(x) yy = math.factorial(y) if x == y: print((xx * yy * 2 % ((10**9) + 7))) elif abs(x - y) == 1: print((xx * yy % ((10**9) + 7))) else: print((0))
n, m = list(map(int, input().split())) if abs(n - m) > 1: print((0)) exit() mod = 10**9 + 7 from math import factorial x = factorial(n) y = factorial(m) if n == m: print((((x % mod) * (y % mod) * 2) % mod)) else: print((((x % mod) * (y % mod)) % mod))
false
16.666667
[ "-x, y = list(map(int, input().split()))", "-import math", "+n, m = list(map(int, input().split()))", "+if abs(n - m) > 1:", "+ print((0))", "+ exit()", "+mod = 10**9 + 7", "+from math import factorial", "-xx = math.factorial(x)", "-yy = math.factorial(y)", "-if x == y:", "- print((xx...
false
0.079878
0.043372
1.841674
[ "s790907573", "s055083421" ]
u130900604
p03069
python
s274204273
s897060519
89
81
11,260
11,260
Accepted
Accepted
8.99
n=int(eval(input())) s=eval(input()) w_cnt=s.count(".") ans=[w_cnt] b=0 w=w_cnt for i in range(n): if s[i]=="#": b+=1 else: w-=1 ans.append(b+w) print((min(ans)))
n=int(eval(input())) s=eval(input()) w_cnt=s.count(".") ans=[w_cnt] b=0 w=w_cnt for i in s: if i=="#": b+=1 else: w-=1 ans.append(b+w) print((min(ans)))
16
16
194
185
n = int(eval(input())) s = eval(input()) w_cnt = s.count(".") ans = [w_cnt] b = 0 w = w_cnt for i in range(n): if s[i] == "#": b += 1 else: w -= 1 ans.append(b + w) print((min(ans)))
n = int(eval(input())) s = eval(input()) w_cnt = s.count(".") ans = [w_cnt] b = 0 w = w_cnt for i in s: if i == "#": b += 1 else: w -= 1 ans.append(b + w) print((min(ans)))
false
0
[ "-for i in range(n):", "- if s[i] == \"#\":", "+for i in s:", "+ if i == \"#\":" ]
false
0.080936
0.047581
1.701021
[ "s274204273", "s897060519" ]
u732870425
p02659
python
s231878070
s577330060
25
23
9,876
9,160
Accepted
Accepted
8
from decimal import * a, b = list(map(float, input().split())) a = Decimal(str(a)) b = Decimal(str(b)) b *= Decimal(str(100)) ans = a * b ans //= Decimal(str(100)) print(ans)
a, b = input().split() a = int(a) b = int(b.replace(".", "")) ans = a * b // 100 print(ans)
11
5
182
95
from decimal import * a, b = list(map(float, input().split())) a = Decimal(str(a)) b = Decimal(str(b)) b *= Decimal(str(100)) ans = a * b ans //= Decimal(str(100)) print(ans)
a, b = input().split() a = int(a) b = int(b.replace(".", "")) ans = a * b // 100 print(ans)
false
54.545455
[ "-from decimal import *", "-", "-a, b = list(map(float, input().split()))", "-a = Decimal(str(a))", "-b = Decimal(str(b))", "-b *= Decimal(str(100))", "-ans = a * b", "-ans //= Decimal(str(100))", "+a, b = input().split()", "+a = int(a)", "+b = int(b.replace(\".\", \"\"))", "+ans = a * b // 10...
false
0.043735
0.088019
0.496884
[ "s231878070", "s577330060" ]
u413456759
p02393
python
s729144083
s908538630
20
10
4,240
4,204
Accepted
Accepted
50
#!/usr/bin/env python # coding: utf-8 def main(): values = [int(x) for x in input().split(" ")] if values[0] > values[1]: values[0], values[1] = values[1], values[0] if values[1] > values[2]: values[1], values[2] = values[2], values[1] if values[0] > values[1]: values[0], values[1] = values[1], val...
if __name__ == '__main__': a, b, c = list(map(int, input().split())) if a < b: if b < c: print(a, b, c) elif a < c: print(a, c, b) else: print(c, a, b) else: if a < c: print(b, a, c) elif b < c: ...
15
16
404
369
#!/usr/bin/env python # coding: utf-8 def main(): values = [int(x) for x in input().split(" ")] if values[0] > values[1]: values[0], values[1] = values[1], values[0] if values[1] > values[2]: values[1], values[2] = values[2], values[1] if values[0] > values[1]: values[0], values[...
if __name__ == "__main__": a, b, c = list(map(int, input().split())) if a < b: if b < c: print(a, b, c) elif a < c: print(a, c, b) else: print(c, a, b) else: if a < c: print(b, a, c) elif b < c: print(b, c, a...
false
6.25
[ "-#!/usr/bin/env python", "-# coding: utf-8", "-def main():", "- values = [int(x) for x in input().split(\" \")]", "- if values[0] > values[1]:", "- values[0], values[1] = values[1], values[0]", "- if values[1] > values[2]:", "- values[1], values[2] = values[2], values[1]", "-...
false
0.048322
0.039765
1.215167
[ "s729144083", "s908538630" ]
u156815136
p02995
python
s541162930
s942924198
48
35
5,480
5,076
Accepted
Accepted
27.08
#from statistics import median #import collections #aa = collections.Counter(a) # list to list #from itertools import combinations # (string,3) 3回 # # # pythonで無理なときは、pypyでやると正解するかも!! # # mod = 10**9 + 7 def readInts(): return list(map(int,input().split())) def main(): # 全体から、Cの倍数 + Dの倍数 - (CとDの倍...
a,b,c,d = list(map(int,input().split())) from fractions import gcd a -= 1 nya = c//gcd(c,d) * d # 最小公倍数 # オイラー関数 ca = a//c da = a//d #print(ca,da) cda = ca + da - a//nya ans_a = a - cda cb = b//c db = b//d #print("cddb",cb,db) cdb = cb + db - b//nya ans_b = b - cdb print((ans_b - ans_a)) #print(ans_a,an...
37
20
828
365
# from statistics import median # import collections # aa = collections.Counter(a) # list to list # from itertools import combinations # (string,3) 3回 # # # pythonで無理なときは、pypyでやると正解するかも!! # # mod = 10**9 + 7 def readInts(): return list(map(int, input().split())) def main(): # 全体から、Cの倍数 + Dの倍数 - (CとDの倍数でもあるや...
a, b, c, d = list(map(int, input().split())) from fractions import gcd a -= 1 nya = c // gcd(c, d) * d # 最小公倍数 # オイラー関数 ca = a // c da = a // d # print(ca,da) cda = ca + da - a // nya ans_a = a - cda cb = b // c db = b // d # print("cddb",cb,db) cdb = cb + db - b // nya ans_b = b - cdb print((ans_b - ans_a)) # print(...
false
45.945946
[ "-# from statistics import median", "-# import collections", "-# aa = collections.Counter(a) # list to list", "-# from itertools import combinations # (string,3) 3回", "-#", "-#", "-# pythonで無理なときは、pypyでやると正解するかも!!", "-#", "-#", "-mod = 10**9 + 7", "+a, b, c, d = list(map(int, input().split()))",...
false
0.18128
0.040732
4.450588
[ "s541162930", "s942924198" ]
u094191970
p02887
python
s585839341
s148793297
42
34
3,316
3,316
Accepted
Accepted
19.05
n=int(eval(input())) s=eval(input()) ans=1 for i in range(1,n): if s[i]!=s[i-1]: ans+=1 print(ans)
n=int(eval(input())) s=eval(input()) ans=1 b_c=s[0] for i in s[1:]: if b_c!=i: ans+=1 b_c=i print(ans)
7
9
104
106
n = int(eval(input())) s = eval(input()) ans = 1 for i in range(1, n): if s[i] != s[i - 1]: ans += 1 print(ans)
n = int(eval(input())) s = eval(input()) ans = 1 b_c = s[0] for i in s[1:]: if b_c != i: ans += 1 b_c = i print(ans)
false
22.222222
[ "-for i in range(1, n):", "- if s[i] != s[i - 1]:", "+b_c = s[0]", "+for i in s[1:]:", "+ if b_c != i:", "+ b_c = i" ]
false
0.078131
0.040553
1.926621
[ "s585839341", "s148793297" ]
u841568901
p03607
python
s538446255
s799883466
164
150
19,836
23,832
Accepted
Accepted
8.54
N = int(eval(input())) S = set() for _ in range(N): t = eval(input()) if t in S: S.discard(t) else: S.add(t) print((len(S)))
from collections import Counter N = int(eval(input())) c = Counter([eval(input()) for _ in range(N)]) print((sum(i%2 for i in list(c.values()))))
9
4
132
128
N = int(eval(input())) S = set() for _ in range(N): t = eval(input()) if t in S: S.discard(t) else: S.add(t) print((len(S)))
from collections import Counter N = int(eval(input())) c = Counter([eval(input()) for _ in range(N)]) print((sum(i % 2 for i in list(c.values()))))
false
55.555556
[ "+from collections import Counter", "+", "-S = set()", "-for _ in range(N):", "- t = eval(input())", "- if t in S:", "- S.discard(t)", "- else:", "- S.add(t)", "-print((len(S)))", "+c = Counter([eval(input()) for _ in range(N)])", "+print((sum(i % 2 for i in list(c.value...
false
0.040374
0.040183
1.004747
[ "s538446255", "s799883466" ]
u436519884
p03167
python
s873611936
s905937869
1,163
142
380,944
76,968
Accepted
Accepted
87.79
import sys sys.setrecursionlimit(10**9) mod=10**9+7 m,n=list(map(int,input().split())) grid=[eval(input()) for _ in range(m)] cache={} def dp(i,j): if i<0 or j<0 or i>=len(grid) or j>=len(grid[0]) or grid[i][j]=='#': return 0 elif (i,j) in cache: return cache[(i,j)] elif i==m-1 and j==n-1: ...
h,w=list(map(int,input().split())) grid=[eval(input()) for _ in range(h)] mod=10**9+7 dp=[0]*w for i in range(h): for j in range(w): if i==j==0: dp[j]=1 elif grid[i][j]=='#': dp[j]=0 elif j>0: dp[j]=dp[j]+dp[j-1] print((dp[w-1]%mod))
18
13
403
296
import sys sys.setrecursionlimit(10**9) mod = 10**9 + 7 m, n = list(map(int, input().split())) grid = [eval(input()) for _ in range(m)] cache = {} def dp(i, j): if i < 0 or j < 0 or i >= len(grid) or j >= len(grid[0]) or grid[i][j] == "#": return 0 elif (i, j) in cache: return cache[(i, j)] ...
h, w = list(map(int, input().split())) grid = [eval(input()) for _ in range(h)] mod = 10**9 + 7 dp = [0] * w for i in range(h): for j in range(w): if i == j == 0: dp[j] = 1 elif grid[i][j] == "#": dp[j] = 0 elif j > 0: dp[j] = dp[j] + dp[j - 1] print((dp[w...
false
27.777778
[ "-import sys", "-", "-sys.setrecursionlimit(10**9)", "+h, w = list(map(int, input().split()))", "+grid = [eval(input()) for _ in range(h)]", "-m, n = list(map(int, input().split()))", "-grid = [eval(input()) for _ in range(m)]", "-cache = {}", "-", "-", "-def dp(i, j):", "- if i < 0 or j < ...
false
0.044422
0.034422
1.290501
[ "s873611936", "s905937869" ]
u868701750
p02779
python
s471943850
s067922789
91
75
26,800
30,288
Accepted
Accepted
17.58
N = int(eval(input())) A = list(map(int, input().split())) _A = set(A) if len(A) == len(_A): print('YES') else: print('NO')
N = eval(input()) A = input().split() _A = set(A) if len(A) == len(_A): print('YES') else: print('NO')
9
9
136
115
N = int(eval(input())) A = list(map(int, input().split())) _A = set(A) if len(A) == len(_A): print("YES") else: print("NO")
N = eval(input()) A = input().split() _A = set(A) if len(A) == len(_A): print("YES") else: print("NO")
false
0
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "+N = eval(input())", "+A = input().split()" ]
false
0.048005
0.044736
1.073073
[ "s471943850", "s067922789" ]
u452337391
p03814
python
s776636946
s243325228
44
31
9,148
9,236
Accepted
Accepted
29.55
S = eval(input()) #Aの探索 for i in range(len(S)): if S[i] == "A": S = S[i:] break #Zの探索 if S[-1] == "Z": print((len(S))) exit() for i in range(1, len(S)+1): if S[-i] == "Z": S = S[:-i+1] break print((len(S)))
S = eval(input()) a_ind = S.find("A") z_ind = S.rfind("Z") print((z_ind - a_ind + 1))
16
4
260
80
S = eval(input()) # Aの探索 for i in range(len(S)): if S[i] == "A": S = S[i:] break # Zの探索 if S[-1] == "Z": print((len(S))) exit() for i in range(1, len(S) + 1): if S[-i] == "Z": S = S[: -i + 1] break print((len(S)))
S = eval(input()) a_ind = S.find("A") z_ind = S.rfind("Z") print((z_ind - a_ind + 1))
false
75
[ "-# Aの探索", "-for i in range(len(S)):", "- if S[i] == \"A\":", "- S = S[i:]", "- break", "-# Zの探索", "-if S[-1] == \"Z\":", "- print((len(S)))", "- exit()", "-for i in range(1, len(S) + 1):", "- if S[-i] == \"Z\":", "- S = S[: -i + 1]", "- break", "-pr...
false
0.04236
0.04181
1.013157
[ "s776636946", "s243325228" ]
u510829608
p02362
python
s544243552
s834167568
600
510
8,236
8,192
Accepted
Accepted
15
import sys INF = float('inf') def Bellmanford(n, edges, r): d = [INF] * n d[r] = 0 for i in range(n): flag = False for (u, v, c) in edges: if d[u] != INF and d[u] + c < d[v]: d[v] = d[u] + c flag = True ...
import sys INF = float('inf') def Bellmanford(n, edges, r): #r: ?§???? d = [INF] * n d[r] = 0 for i in range(n): for (u, v, c) in edges: if d[u] != INF and d[u] + c < d[v]: d[v] = d[u] + c if i == n-1: retu...
32
30
710
661
import sys INF = float("inf") def Bellmanford(n, edges, r): d = [INF] * n d[r] = 0 for i in range(n): flag = False for (u, v, c) in edges: if d[u] != INF and d[u] + c < d[v]: d[v] = d[u] + c flag = True if flag and i == n - 1: ...
import sys INF = float("inf") def Bellmanford(n, edges, r): # r: ?§???? d = [INF] * n d[r] = 0 for i in range(n): for (u, v, c) in edges: if d[u] != INF and d[u] + c < d[v]: d[v] = d[u] + c if i == n - 1: return ["NEGATIVE CYCLE"] ...
false
6.25
[ "-def Bellmanford(n, edges, r):", "+def Bellmanford(n, edges, r): # r: ?§????", "- flag = False", "- flag = True", "- if flag and i == n - 1:", "- return [\"NEGATIVE CYCLE\"]", "+ if i == n - 1:", "+ return [\"NEGATIVE CYCLE\"]...
false
0.05902
0.103358
0.571027
[ "s544243552", "s834167568" ]
u562935282
p03285
python
s329033625
s284799349
21
17
2,940
2,940
Accepted
Accepted
19.05
n = int(eval(input())) flg = False for i in range(n + 1): for j in range(n + 1): if 4 * i + 7 * j == n: flg = True break ans = 'Yes' if flg else 'No' print(ans)
''' (n - x) % 4 0 % 4 = 0 7 % 4 = 3 14 % 4 = 2 21 % 4 = 1 21以上なら7を0から3回引くことで4の倍数にできる ''' n = int(eval(input())) if n >= 21: flg = True else: flg = False for i in range(21 // 4 + 1): for j in range(21 // 7 + 1): if 4 * i + 7 * j == n: flg = True ...
9
21
199
360
n = int(eval(input())) flg = False for i in range(n + 1): for j in range(n + 1): if 4 * i + 7 * j == n: flg = True break ans = "Yes" if flg else "No" print(ans)
""" (n - x) % 4 0 % 4 = 0 7 % 4 = 3 14 % 4 = 2 21 % 4 = 1 21以上なら7を0から3回引くことで4の倍数にできる """ n = int(eval(input())) if n >= 21: flg = True else: flg = False for i in range(21 // 4 + 1): for j in range(21 // 7 + 1): if 4 * i + 7 * j == n: flg = True break print...
false
57.142857
[ "+\"\"\"", "+(n - x) % 4", "+0 % 4 = 0", "+7 % 4 = 3", "+14 % 4 = 2", "+21 % 4 = 1", "+21以上なら7を0から3回引くことで4の倍数にできる", "+\"\"\"", "-flg = False", "-for i in range(n + 1):", "- for j in range(n + 1):", "- if 4 * i + 7 * j == n:", "- flg = True", "- break", "-a...
false
0.042967
0.042441
1.01239
[ "s329033625", "s284799349" ]
u077291787
p03338
python
s249669772
s839890299
21
17
3,316
3,060
Accepted
Accepted
19.05
# ABC098B - Cut and Count import collections n = int(eval(input())) s = input().rstrip() count = 0 answer = 0 lst = [i for i in s] if collections.Counter(lst) == 1: print((1)) else: for i in range(1, n): count = 0 lst_sub1 = lst[:i] lst_sub2 = lst[i:] set_sub1...
# ABC098B - Cut and Count def main(): n = int(eval(input())) s = eval(input()) cnt = 0 for i in range(1, n): l, r = set(s[:i]), set(s[i:]) cnt = max(cnt, len(l & r)) print(cnt) if __name__ == "__main__": main()
26
13
509
252
# ABC098B - Cut and Count import collections n = int(eval(input())) s = input().rstrip() count = 0 answer = 0 lst = [i for i in s] if collections.Counter(lst) == 1: print((1)) else: for i in range(1, n): count = 0 lst_sub1 = lst[:i] lst_sub2 = lst[i:] set_sub1 = set(lst_sub1) ...
# ABC098B - Cut and Count def main(): n = int(eval(input())) s = eval(input()) cnt = 0 for i in range(1, n): l, r = set(s[:i]), set(s[i:]) cnt = max(cnt, len(l & r)) print(cnt) if __name__ == "__main__": main()
false
50
[ "-import collections", "+def main():", "+ n = int(eval(input()))", "+ s = eval(input())", "+ cnt = 0", "+ for i in range(1, n):", "+ l, r = set(s[:i]), set(s[i:])", "+ cnt = max(cnt, len(l & r))", "+ print(cnt)", "-n = int(eval(input()))", "-s = input().rstrip()", ...
false
0.046025
0.04621
0.995998
[ "s249669772", "s839890299" ]
u947883560
p02728
python
s353969379
s403897519
934
856
111,312
110,120
Accepted
Accepted
8.35
#!/usr/bin/env python3 import sys from collections import defaultdict from functools import lru_cache MOD = 1000000007 # type: int @lru_cache(maxsize=None) def div(a, b): return (a * pow(b, MOD-2, MOD)) % MOD class Combination(object): def __init__(self, N, mod=MOD): fac, finv, inv ...
#!/usr/bin/env python3 import sys from collections import defaultdict MOD = 1000000007 # type: int class Combination(object): def __init__(self, N, mod=MOD): fac, finv, inv = [0]*(N+1), [0]*(N+1), [0]*(N+1) fac[:2] = 1, 1 finv[:2] = 1, 1 inv[1] = 1 for i in r...
114
109
2,717
2,628
#!/usr/bin/env python3 import sys from collections import defaultdict from functools import lru_cache MOD = 1000000007 # type: int @lru_cache(maxsize=None) def div(a, b): return (a * pow(b, MOD - 2, MOD)) % MOD class Combination(object): def __init__(self, N, mod=MOD): fac, finv, inv = [0] * (N + ...
#!/usr/bin/env python3 import sys from collections import defaultdict MOD = 1000000007 # type: int class Combination(object): def __init__(self, N, mod=MOD): fac, finv, inv = [0] * (N + 1), [0] * (N + 1), [0] * (N + 1) fac[:2] = 1, 1 finv[:2] = 1, 1 inv[1] = 1 for i in ra...
false
4.385965
[ "-from functools import lru_cache", "-", "-", "-@lru_cache(maxsize=None)", "-def div(a, b):", "- return (a * pow(b, MOD - 2, MOD)) % MOD", "- curr = -1", "- downward = [0]", "+ front, back = -1, 1", "+ downward = [0] * N", "- while len(downward) < N:", "- curr += 1", ...
false
0.044147
0.033171
1.330906
[ "s353969379", "s403897519" ]
u777923818
p03051
python
s482341297
s746249917
925
851
76,180
73,360
Accepted
Accepted
8
from collections import defaultdict def inpl(): return list(map(int, input().split())) MOD = 10**9 + 7 N = int(eval(input())) S = [] x = 0 for a in map(int, input().split()): x ^= a S.append(x) A = defaultdict(int) B = defaultdict(int) L = defaultdict(int) Z = 0 if S[-1] != 0: sr = S[-1]...
from collections import defaultdict MOD = 10**9 + 7 N = int(eval(input())) S = [] x = 0 for a in map(int, input().split()): x ^= a S.append(x) A = defaultdict(int) B = defaultdict(int) L = defaultdict(int) Z = 0 for s in S: if s == 0: Z += 1 else: A[s] = (A[s] + (Z - ...
34
26
715
494
from collections import defaultdict def inpl(): return list(map(int, input().split())) MOD = 10**9 + 7 N = int(eval(input())) S = [] x = 0 for a in map(int, input().split()): x ^= a S.append(x) A = defaultdict(int) B = defaultdict(int) L = defaultdict(int) Z = 0 if S[-1] != 0: sr = S[-1] a, b = ...
from collections import defaultdict MOD = 10**9 + 7 N = int(eval(input())) S = [] x = 0 for a in map(int, input().split()): x ^= a S.append(x) A = defaultdict(int) B = defaultdict(int) L = defaultdict(int) Z = 0 for s in S: if s == 0: Z += 1 else: A[s] = (A[s] + (Z - L[s]) * B[s]) % MOD...
false
23.529412
[ "-", "-", "-def inpl():", "- return list(map(int, input().split()))", "-", "+for s in S:", "+ if s == 0:", "+ Z += 1", "+ else:", "+ A[s] = (A[s] + (Z - L[s]) * B[s]) % MOD", "+ B[s] = (A[s] + B[s] + 1) % MOD", "+ L[s] = Z", "- sr = S[-1]", "- a, ...
false
0.038877
0.037143
1.046684
[ "s482341297", "s746249917" ]
u034128150
p02559
python
s540677285
s835348895
617
546
125,412
169,428
Accepted
Accepted
11.51
class BIT(): __slots__ = ["n", "data"] def __init__(self, length_or_list): if isinstance(length_or_list, int): self.n = length_or_list + 1 self.data = [0] * self.n else: self.n = len(length_or_list) + 1 self.data = [0] + length_or_list ...
class BIT(): __slots__ = ["n", "data"] def __init__(self, length_or_list): if isinstance(length_or_list, int): self.n = length_or_list + 1 self.data = [0] * self.n else: self.n = len(length_or_list) + 1 self.data = [0] + length_or_list ...
53
56
1,489
1,515
class BIT: __slots__ = ["n", "data"] def __init__(self, length_or_list): if isinstance(length_or_list, int): self.n = length_or_list + 1 self.data = [0] * self.n else: self.n = len(length_or_list) + 1 self.data = [0] + length_or_list f...
class BIT: __slots__ = ["n", "data"] def __init__(self, length_or_list): if isinstance(length_or_list, int): self.n = length_or_list + 1 self.data = [0] * self.n else: self.n = len(length_or_list) + 1 self.data = [0] + length_or_list f...
false
5.357143
[ "- read = sys.stdin.buffer.read", "- seg = BIT(list(map(int, input().split())))", "+ bit = BIT(list(map(int, input().split())))", "+ ans = []", "- print((seg.folded(b, c)))", "+ ans.append(bit.folded(b, c))", "- seg.point_append(b, c)", "+ bit.po...
false
0.199316
0.04908
4.061039
[ "s540677285", "s835348895" ]
u179169725
p03178
python
s708665562
s726251212
1,536
882
132,376
131,312
Accepted
Accepted
42.58
import sys sys.setrecursionlimit(1 << 25) readline = sys.stdin.buffer.readline read = sys.stdin.readline # 文字列読み込む時はこっち import numpy as np from functools import partial array = partial(np.array, dtype=np.int64) zeros = partial(np.zeros, dtype=np.int64) full = partial(np.full, dtype=np.int64) ra = range e...
import sys sys.setrecursionlimit(1 << 25) readline = sys.stdin.buffer.readline read = sys.stdin.readline # 文字列読み込む時はこっち import numpy as np from functools import partial array = partial(np.array, dtype=np.int64) zeros = partial(np.zeros, dtype=np.int64) full = partial(np.full, dtype=np.int64) ra = range e...
71
74
1,938
1,979
import sys sys.setrecursionlimit(1 << 25) readline = sys.stdin.buffer.readline read = sys.stdin.readline # 文字列読み込む時はこっち import numpy as np from functools import partial array = partial(np.array, dtype=np.int64) zeros = partial(np.zeros, dtype=np.int64) full = partial(np.full, dtype=np.int64) ra = range enu = enumera...
import sys sys.setrecursionlimit(1 << 25) readline = sys.stdin.buffer.readline read = sys.stdin.readline # 文字列読み込む時はこっち import numpy as np from functools import partial array = partial(np.array, dtype=np.int64) zeros = partial(np.zeros, dtype=np.int64) full = partial(np.full, dtype=np.int64) ra = range enu = enumera...
false
4.054054
[ "-from collections import defaultdict, Counter, deque", "-from operator import itemgetter, xor, add", "-from itertools import product, permutations, combinations", "-from bisect import bisect_left, bisect_right # , insort_left, insort_right", "-from functools import reduce", "-", "- for l in...
false
0.225309
0.269749
0.835255
[ "s708665562", "s726251212" ]
u729133443
p03945
python
s903172158
s448532723
44
18
3,188
3,188
Accepted
Accepted
59.09
s=eval(input());print((sum([0,1][s[i]!=s[i-1]]for i in range(1,len(s)))))
s=eval(input());print((s.count('WB')+s.count('BW')))
1
1
65
44
s = eval(input()) print((sum([0, 1][s[i] != s[i - 1]] for i in range(1, len(s)))))
s = eval(input()) print((s.count("WB") + s.count("BW")))
false
0
[ "-print((sum([0, 1][s[i] != s[i - 1]] for i in range(1, len(s)))))", "+print((s.count(\"WB\") + s.count(\"BW\")))" ]
false
0.066247
0.037338
1.77425
[ "s903172158", "s448532723" ]
u600402037
p02971
python
s603599248
s542211437
534
452
14,208
58,816
Accepted
Accepted
15.36
n = int(input()) a = [int(input()) for i in range(n)] max_a = max(a) second_a = sorted(a)[-2] max_count = a.count(max_a) - 1 if max_count: [print(max_a) for _ in range(len(a))] else: [print(max_a) if a[i] != max_a else print(second_a) for i in range(len(a))]
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = [ir() for _ in range(N)] top = max(A) if A.count(top) == 1: second = sorted(A, reverse=True)[1] for i in range(N): if A[i] == top: print(second) ...
9
20
275
415
n = int(input()) a = [int(input()) for i in range(n)] max_a = max(a) second_a = sorted(a)[-2] max_count = a.count(max_a) - 1 if max_count: [print(max_a) for _ in range(len(a))] else: [print(max_a) if a[i] != max_a else print(second_a) for i in range(len(a))]
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = [ir() for _ in range(N)] top = max(A) if A.count(top) == 1: second = sorted(A, reverse=True)[1] for i in range(N): if A[i] == top: print(second) else: ...
false
55
[ "-n = int(input())", "-a = [int(input()) for i in range(n)]", "-max_a = max(a)", "-second_a = sorted(a)[-2]", "-max_count = a.count(max_a) - 1", "-if max_count:", "- [print(max_a) for _ in range(len(a))]", "+import sys", "+", "+sr = lambda: sys.stdin.readline().rstrip()", "+ir = lambda: int(s...
false
0.035787
0.05484
0.652582
[ "s603599248", "s542211437" ]
u386819480
p02814
python
s817644823
s220789217
888
626
26,812
26,824
Accepted
Accepted
29.5
#!/usr/bin/env python3 import sys from functools import reduce import numpy as np sys.setrecursionlimit(10000000) INF = 1<<32 def solve(N: int, M: int, a: "List[int]"): def gcd_base(a: int, b: int): while b: a, b = b, a%b return a def gcd(*numbers): return...
#!/usr/bin/env python3 import sys from functools import reduce import numpy as np sys.setrecursionlimit(10000000) INF = 1<<32 def solve(N: int, M: int, a: "List[int]"): def gcd_base(a: int, b: int): while b: a, b = b, a%b return a def gcd(*numbers): return...
61
61
1,228
1,226
#!/usr/bin/env python3 import sys from functools import reduce import numpy as np sys.setrecursionlimit(10000000) INF = 1 << 32 def solve(N: int, M: int, a: "List[int]"): def gcd_base(a: int, b: int): while b: a, b = b, a % b return a def gcd(*numbers): return reduce(gcd_...
#!/usr/bin/env python3 import sys from functools import reduce import numpy as np sys.setrecursionlimit(10000000) INF = 1 << 32 def solve(N: int, M: int, a: "List[int]"): def gcd_base(a: int, b: int): while b: a, b = b, a % b return a def gcd(*numbers): return reduce(gcd_...
false
0
[ "- x /= 2", "+ x //= 2", "- y = div_of_2(a[0])", "+ y = div_of_2(x)" ]
false
0.056226
0.092883
0.605346
[ "s817644823", "s220789217" ]
u729133443
p02596
python
s437060385
s899029292
1,569
242
9,136
9,156
Accepted
Accepted
84.58
k=int(input()) x=i=0 while i<7e6:i+=1;x=(x*10+7)%k;x<1>exit(print(i)) print(-1)
k=int(input()) x=i=0 while i<k:i+=1;x=(x*10+7)%k;x<1>exit(print(i)) print(-1)
4
4
82
80
k = int(input()) x = i = 0 while i < 7e6: i += 1 x = (x * 10 + 7) % k x < 1 > exit(print(i)) print(-1)
k = int(input()) x = i = 0 while i < k: i += 1 x = (x * 10 + 7) % k x < 1 > exit(print(i)) print(-1)
false
0
[ "-while i < 7e6:", "+while i < k:" ]
false
0.558532
0.081685
6.837615
[ "s437060385", "s899029292" ]
u729133443
p03474
python
s536669975
s558860027
170
19
38,512
2,940
Accepted
Accepted
88.82
a=int(input()[0]);s=eval(input());print(('YNeos'[s.count('-')!=1or'-'<s[a]::2]))
a,s=open(0);print(('YNeos'[s.count('-')!=1or'-'<s[int(a[0])]::2]))
1
1
72
64
a = int(input()[0]) s = eval(input()) print(("YNeos"[s.count("-") != 1 or "-" < s[a] :: 2]))
a, s = open(0) print(("YNeos"[s.count("-") != 1 or "-" < s[int(a[0])] :: 2]))
false
0
[ "-a = int(input()[0])", "-s = eval(input())", "-print((\"YNeos\"[s.count(\"-\") != 1 or \"-\" < s[a] :: 2]))", "+a, s = open(0)", "+print((\"YNeos\"[s.count(\"-\") != 1 or \"-\" < s[int(a[0])] :: 2]))" ]
false
0.052956
0.053035
0.998511
[ "s536669975", "s558860027" ]
u200887663
p02848
python
s646216082
s050351159
27
24
4,724
3,060
Accepted
Accepted
11.11
n=int(input()) s=input() l=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") ans=[] for st in s: ind=l.index(st) new_ind=ind+n if new_ind >25: new_ind-=26 ans.append(l[new_ind]) print(*ans,sep="")
n=int(eval(input())) sl=list(eval(input())) ch=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") ans="" for s in sl: ind=ch.index(s) ans+=ch[(ind+n)% 26] print(ans)
13
9
208
154
n = int(input()) s = input() l = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") ans = [] for st in s: ind = l.index(st) new_ind = ind + n if new_ind > 25: new_ind -= 26 ans.append(l[new_ind]) print(*ans, sep="")
n = int(eval(input())) sl = list(eval(input())) ch = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") ans = "" for s in sl: ind = ch.index(s) ans += ch[(ind + n) % 26] print(ans)
false
30.769231
[ "-n = int(input())", "-s = input()", "-l = list(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")", "-ans = []", "-for st in s:", "- ind = l.index(st)", "- new_ind = ind + n", "- if new_ind > 25:", "- new_ind -= 26", "- ans.append(l[new_ind])", "-print(*ans, sep=\"\")", "+n = int(eval(input()...
false
0.008029
0.040137
0.200037
[ "s646216082", "s050351159" ]