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
u562016607
p03286
python
s502840722
s725688626
19
17
3,060
2,940
Accepted
Accepted
10.53
N=int(eval(input()));S="" while(True): if N*N==N:S+=str(N);break S+=str(N%2);N=(N-N%2)//(-2) print((S[::-1]))
N=int(eval(input()));S="" while 1: if N*N==N:S+=str(N);break S+=str(N%2);N=(N-N%2)//(-2) print((S[::-1]))
5
5
109
104
N = int(eval(input())) S = "" while True: if N * N == N: S += str(N) break S += str(N % 2) N = (N - N % 2) // (-2) print((S[::-1]))
N = int(eval(input())) S = "" while 1: if N * N == N: S += str(N) break S += str(N % 2) N = (N - N % 2) // (-2) print((S[::-1]))
false
0
[ "-while True:", "+while 1:" ]
false
0.039146
0.038205
1.024628
[ "s502840722", "s725688626" ]
u659753499
p03339
python
s690552976
s369871948
246
152
39,160
3,700
Accepted
Accepted
38.21
N = int(eval(input())) S = eval(input()) e,w= [0]*N,[0]*N for i in range(N-1): e[i+1] = e[i] + (1 if S[i]=='W' else 0) for i in range(N-1,0,-1): w[i-1] = w[i] + (1 if S[i]=='E' else 0) print((min([w[i]+e[i] for i in range(N)])))
N = int(eval(input())) S = eval(input()) e,w = S.count('E'),0 ans = e+w for s in S: if s == 'E': e -= 1 else: w += 1 ans = min(ans, e+w) print(ans)
6
9
225
157
N = int(eval(input())) S = eval(input()) e, w = [0] * N, [0] * N for i in range(N - 1): e[i + 1] = e[i] + (1 if S[i] == "W" else 0) for i in range(N - 1, 0, -1): w[i - 1] = w[i] + (1 if S[i] == "E" else 0) print((min([w[i] + e[i] for i in range(N)])))
N = int(eval(input())) S = eval(input()) e, w = S.count("E"), 0 ans = e + w for s in S: if s == "E": e -= 1 else: w += 1 ans = min(ans, e + w) print(ans)
false
33.333333
[ "-e, w = [0] * N, [0] * N", "-for i in range(N - 1):", "- e[i + 1] = e[i] + (1 if S[i] == \"W\" else 0)", "-for i in range(N - 1, 0, -1):", "- w[i - 1] = w[i] + (1 if S[i] == \"E\" else 0)", "-print((min([w[i] + e[i] for i in range(N)])))", "+e, w = S.count(\"E\"), 0", "+ans = e + w", "+for s ...
false
0.047694
0.046346
1.029081
[ "s690552976", "s369871948" ]
u707124227
p02798
python
s529138620
s195736112
1,296
377
16,452
85,920
Accepted
Accepted
70.91
n=int(eval(input())) a=list(map(int,input().split())) b=list(map(int,input().split())) allpat=[] todo=[[]] while todo: pat=todo.pop() if len(pat)==n//2: allpat.append(pat) continue s=0 if pat:s=max(pat)+1 for i in range(s,n): todo.append(pat+[i]) def func(pat): # カードを最終的に偶奇どちらのi...
n=int(eval(input())) a=list(map(int,input().split())) b=list(map(int,input().split())) allpat=[] todo=[[]] while todo: pat=todo.pop() if len(pat)==n//2: allpat.append(pat) continue s=0 if pat:s=max(pat)+1 for i in range(s,n): todo.append(pat+[i]) def func(pat): # カードを最終的に偶奇どちらのi...
66
64
1,377
1,323
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) allpat = [] todo = [[]] while todo: pat = todo.pop() if len(pat) == n // 2: allpat.append(pat) continue s = 0 if pat: s = max(pat) + 1 for i in range(s, n): todo.append(pat ...
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) allpat = [] todo = [[]] while todo: pat = todo.pop() if len(pat) == n // 2: allpat.append(pat) continue s = 0 if pat: s = max(pat) + 1 for i in range(s, n): todo.append(pat ...
false
3.030303
[ "- for i in range(n):", "- for j in range(n - 1, i, -1):", "- if ary[j - 1] > ary[j]:", "- ary[j], ary[j - 1] = ary[j - 1], ary[j]", "+ for i in range(n - 1):", "+ for j in range(i + 1, n):", "+ if ary[i] > ary[j]:" ]
false
0.037367
0.040231
0.928823
[ "s529138620", "s195736112" ]
u732870425
p02796
python
s983321112
s385035996
591
444
43,560
32,296
Accepted
Accepted
24.87
N = int(eval(input())) XL = [list(map(int, input().split())) for _ in range(N)] length = [] for i in range(N): s = XL[i][0] - XL[i][1] f = XL[i][0] + XL[i][1] length.append([s, f]) length = sorted(length, key=lambda x:x[1]) ans = 0 f = - (10**9+7) for i in range(N): if f <= length[i][0]: ...
N = int(eval(input())) XL = [list(map(int, input().split())) for _ in range(N)] XL.sort(key=lambda x: sum(x)) f = -99999999999 ans = 0 for x, l in XL: if x - l >= f: ans += 1 f = x + l print(ans)
18
12
377
222
N = int(eval(input())) XL = [list(map(int, input().split())) for _ in range(N)] length = [] for i in range(N): s = XL[i][0] - XL[i][1] f = XL[i][0] + XL[i][1] length.append([s, f]) length = sorted(length, key=lambda x: x[1]) ans = 0 f = -(10**9 + 7) for i in range(N): if f <= length[i][0]: ans +...
N = int(eval(input())) XL = [list(map(int, input().split())) for _ in range(N)] XL.sort(key=lambda x: sum(x)) f = -99999999999 ans = 0 for x, l in XL: if x - l >= f: ans += 1 f = x + l print(ans)
false
33.333333
[ "-length = []", "-for i in range(N):", "- s = XL[i][0] - XL[i][1]", "- f = XL[i][0] + XL[i][1]", "- length.append([s, f])", "-length = sorted(length, key=lambda x: x[1])", "+XL.sort(key=lambda x: sum(x))", "+f = -99999999999", "-f = -(10**9 + 7)", "-for i in range(N):", "- if f <= le...
false
0.047768
0.046951
1.017414
[ "s983321112", "s385035996" ]
u334712262
p02814
python
s073991118
s345679376
512
204
16,628
100,824
Accepted
Accepted
60.16
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
# -*- coding: utf-8 -*- import bisect import heapq import math import random from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permutati...
88
92
1,644
1,707
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
# -*- coding: utf-8 -*- import bisect import heapq import math import random from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permutations from...
false
4.347826
[ "-import sys", "-from fractions import gcd", "+import sys", "-sys.setrecursionlimit(100000)", "-input = sys.stdin.readline", "+# sys.setrecursionlimit(10**6)", "+# buff_readline = sys.stdin.buffer.readline", "+buff_readline = sys.stdin.readline", "+readline = sys.stdin.readline", "- return int(...
false
0.084527
0.065392
1.292618
[ "s073991118", "s345679376" ]
u222668979
p02596
python
s033307411
s549758965
79
63
62,624
62,736
Accepted
Accepted
20.25
k = int(eval(input())) # 解説AC if k % 2 == 0 or k % 5 == 0: print((-1)) exit() num = 7 for i in range(k): if num % k == 0: print((i + 1)) break num = (num % k) * 10 + 7
def makedivisor(N): # 約数列挙 p, upper, lower = 1, [], [] while p * p <= N: if N % p == 0: lower.append(p) if p * p != N: upper.append(N // p) p += 1 return lower + upper[::-1] def totient(N): # オイラーのトーシェント関数 p, phi = 2, N while p...
13
38
204
780
k = int(eval(input())) # 解説AC if k % 2 == 0 or k % 5 == 0: print((-1)) exit() num = 7 for i in range(k): if num % k == 0: print((i + 1)) break num = (num % k) * 10 + 7
def makedivisor(N): # 約数列挙 p, upper, lower = 1, [], [] while p * p <= N: if N % p == 0: lower.append(p) if p * p != N: upper.append(N // p) p += 1 return lower + upper[::-1] def totient(N): # オイラーのトーシェント関数 p, phi = 2, N while p * p <= N: ...
false
65.789474
[ "-k = int(eval(input()))", "-# 解説AC", "+def makedivisor(N): # 約数列挙", "+ p, upper, lower = 1, [], []", "+ while p * p <= N:", "+ if N % p == 0:", "+ lower.append(p)", "+ if p * p != N:", "+ upper.append(N // p)", "+ p += 1", "+ return l...
false
0.070971
0.037623
1.886383
[ "s033307411", "s549758965" ]
u579699847
p03474
python
s025056650
s589519076
19
17
3,188
3,060
Accepted
Accepted
10.53
import re,sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() A,B = LI() S = S() print(('Yes' if re.fullmatch(pattern=r'\d{{{}}}-\d{{{}}}'.format(A,B),string=S) else 'No'))
import sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() A,B = LI() S = S() ans = 1 for i in range(A+B+1): if i==A: if S[i]!='-': ans = 0 break else: if not S[i] in '1234567890': ...
6
16
244
375
import re, sys def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() A, B = LI() S = S() print( ( "Yes" if re.fullmatch(pattern=r"\d{{{}}}-\d{{{}}}".format(A, B), string=S) else "No" ) )
import sys def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() A, B = LI() S = S() ans = 1 for i in range(A + B + 1): if i == A: if S[i] != "-": ans = 0 break else: if not S[i] in "1234567890":...
false
62.5
[ "-import re, sys", "+import sys", "-print(", "- (", "- \"Yes\"", "- if re.fullmatch(pattern=r\"\\d{{{}}}-\\d{{{}}}\".format(A, B), string=S)", "- else \"No\"", "- )", "-)", "+ans = 1", "+for i in range(A + B + 1):", "+ if i == A:", "+ if S[i] != \"-\":", ...
false
0.008239
0.04532
0.181802
[ "s025056650", "s589519076" ]
u033606236
p03680
python
s161250374
s408334215
242
196
19,044
7,084
Accepted
Accepted
19.01
import sys nums = int(eval(input())) bottom = list(range(nums)) check = {} count = 0 a = 0 for i in range(nums): bottom[i] = int(eval(input())) check[i] = 0 while True: if bottom[a] == 2: count += 1 break if check[a] == 1: print("-1") sys.exit() ch...
a = [int(eval(input())) for _ in range(int(eval(input())))] c,s = 1,a[0] for i in range(len(a)): if s ==2: print(c) break c,s = c+1, a[s-1] else:print((-1))
22
8
371
173
import sys nums = int(eval(input())) bottom = list(range(nums)) check = {} count = 0 a = 0 for i in range(nums): bottom[i] = int(eval(input())) check[i] = 0 while True: if bottom[a] == 2: count += 1 break if check[a] == 1: print("-1") sys.exit() check[a] = 1 a = ...
a = [int(eval(input())) for _ in range(int(eval(input())))] c, s = 1, a[0] for i in range(len(a)): if s == 2: print(c) break c, s = c + 1, a[s - 1] else: print((-1))
false
63.636364
[ "-import sys", "-", "-nums = int(eval(input()))", "-bottom = list(range(nums))", "-check = {}", "-count = 0", "-a = 0", "-for i in range(nums):", "- bottom[i] = int(eval(input()))", "- check[i] = 0", "-while True:", "- if bottom[a] == 2:", "- count += 1", "+a = [int(eval(in...
false
0.048252
0.049345
0.977844
[ "s161250374", "s408334215" ]
u879870653
p03548
python
s673205165
s008757371
31
19
2,940
3,060
Accepted
Accepted
38.71
X,Y,Z = list(map(int,input().split())) X -= Y+2*Z answer = 1 while X >= Y+Z : X -= Y+Z answer += 1 print(answer)
X,Y,Z = list(map(int,input().split())) answer = 0 X -= Y+2*Z answer += 1 answer += X//(Y+Z) print(answer)
7
6
121
105
X, Y, Z = list(map(int, input().split())) X -= Y + 2 * Z answer = 1 while X >= Y + Z: X -= Y + Z answer += 1 print(answer)
X, Y, Z = list(map(int, input().split())) answer = 0 X -= Y + 2 * Z answer += 1 answer += X // (Y + Z) print(answer)
false
14.285714
[ "+answer = 0", "-answer = 1", "-while X >= Y + Z:", "- X -= Y + Z", "- answer += 1", "+answer += 1", "+answer += X // (Y + Z)" ]
false
0.07881
0.0372
2.118529
[ "s673205165", "s008757371" ]
u581603131
p03680
python
s372974199
s058995551
209
193
7,852
7,084
Accepted
Accepted
7.66
n=int(eval(input())) a=[int(eval(input()))-1 for i in range(n)] now=0 x=[0]*n i=0 while x[now]==0: i+=1 x[now]=1 now=a[now] if now==1: print(i) break else: print((-1))
N = int(eval(input())) a = [int(eval(input())) for i in range(N)] anow = 1 count = 0 for i in range(N): anow = a[anow-1] count += 1 if anow == 2: break print((count if anow==2 else '-1'))
14
10
202
202
n = int(eval(input())) a = [int(eval(input())) - 1 for i in range(n)] now = 0 x = [0] * n i = 0 while x[now] == 0: i += 1 x[now] = 1 now = a[now] if now == 1: print(i) break else: print((-1))
N = int(eval(input())) a = [int(eval(input())) for i in range(N)] anow = 1 count = 0 for i in range(N): anow = a[anow - 1] count += 1 if anow == 2: break print((count if anow == 2 else "-1"))
false
28.571429
[ "-n = int(eval(input()))", "-a = [int(eval(input())) - 1 for i in range(n)]", "-now = 0", "-x = [0] * n", "-i = 0", "-while x[now] == 0:", "- i += 1", "- x[now] = 1", "- now = a[now]", "- if now == 1:", "- print(i)", "+N = int(eval(input()))", "+a = [int(eval(input())) for...
false
0.041399
0.040293
1.027457
[ "s372974199", "s058995551" ]
u732061897
p03074
python
s900175354
s778034905
130
114
8,604
10,408
Accepted
Accepted
12.31
q, k = list(map(int, input().split())) list = [int(i) for i in eval(input())] # 0 ,1 のまとまりを作る sum01 = [] pre = 1 cnt = 0 # 111010 # 001010 for i, e in enumerate(list): if e != pre: sum01.append(cnt) cnt = 1 pre = e else: cnt += 1 if cnt != 0: sum01.append(cn...
N,K = list(map(int,input().split())) S_list = ['0'] + list(eval(input())) + ['-1'] s_count_list =[] cnt = 1 for i in range(1,N+2) : if S_list[i] == S_list[i-1] : cnt +=1 else: s_count_list.append(cnt) cnt = 1 if S_list[1] == '0': s_count_list[0] = s_count_list[0] -1 ...
37
40
699
838
q, k = list(map(int, input().split())) list = [int(i) for i in eval(input())] # 0 ,1 のまとまりを作る sum01 = [] pre = 1 cnt = 0 # 111010 # 001010 for i, e in enumerate(list): if e != pre: sum01.append(cnt) cnt = 1 pre = e else: cnt += 1 if cnt != 0: sum01.append(cnt) if len(sum01) %...
N, K = list(map(int, input().split())) S_list = ["0"] + list(eval(input())) + ["-1"] s_count_list = [] cnt = 1 for i in range(1, N + 2): if S_list[i] == S_list[i - 1]: cnt += 1 else: s_count_list.append(cnt) cnt = 1 if S_list[1] == "0": s_count_list[0] = s_count_list[0] - 1 s_cou...
false
7.5
[ "-q, k = list(map(int, input().split()))", "-list = [int(i) for i in eval(input())]", "-# 0 ,1 のまとまりを作る", "-sum01 = []", "-pre = 1", "-cnt = 0", "-# 111010", "-# 001010", "-for i, e in enumerate(list):", "- if e != pre:", "- sum01.append(cnt)", "+N, K = list(map(int, input().split())...
false
0.039642
0.042745
0.927405
[ "s900175354", "s778034905" ]
u372550522
p03575
python
s114328993
s344712133
250
41
47,068
9,356
Accepted
Accepted
83.6
import copy n, m = list(map(int, input().split())) G = [[] for i in range(n)] #G(i): 頂点iと隣接する頂点のlist a = [0] * m b = [0] * m for i in range(m): a[i], b[i] = list(map(int, input().split())) G[a[i]-1].append(b[i]-1) #入力は 1-indexed とする G[b[i]-1].append(a[i]-1) #無向グラフの場合 seen = [0] * n #頂点iが訪問済みの場合...
import sys import copy sys.setrecursionlimit(10000) def root(x): if par[x] == x: return x else: par[x] = root(par[x]) return par[x] def unite(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry def same(x, y): return root(x) == root(y) ...
32
45
751
773
import copy n, m = list(map(int, input().split())) G = [[] for i in range(n)] # G(i): 頂点iと隣接する頂点のlist a = [0] * m b = [0] * m for i in range(m): a[i], b[i] = list(map(int, input().split())) G[a[i] - 1].append(b[i] - 1) # 入力は 1-indexed とする G[b[i] - 1].append(a[i] - 1) # 無向グラフの場合 seen = [0] * n # 頂点iが訪問済...
import sys import copy sys.setrecursionlimit(10000) def root(x): if par[x] == x: return x else: par[x] = root(par[x]) return par[x] def unite(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry def same(x, y): return root(x) == root(y) n, m = list(...
false
28.888889
[ "+import sys", "+sys.setrecursionlimit(10000)", "+", "+", "+def root(x):", "+ if par[x] == x:", "+ return x", "+ else:", "+ par[x] = root(par[x])", "+ return par[x]", "+", "+", "+def unite(x, y):", "+ rx = root(x)", "+ ry = root(y)", "+ if rx != ry:"...
false
0.03935
0.259581
0.151589
[ "s114328993", "s344712133" ]
u792720861
p02830
python
s234691992
s993204988
31
27
9,016
8,920
Accepted
Accepted
12.9
n = int(input()) s, t = input().split() for i in range(n): print(s[i], t[i], sep="", end="") print("")
n = int(input()) S, T = input().split() print(*[s+t for s, t in zip(S, T)], sep="")
6
3
113
86
n = int(input()) s, t = input().split() for i in range(n): print(s[i], t[i], sep="", end="") print("")
n = int(input()) S, T = input().split() print(*[s + t for s, t in zip(S, T)], sep="")
false
50
[ "-s, t = input().split()", "-for i in range(n):", "- print(s[i], t[i], sep=\"\", end=\"\")", "-print(\"\")", "+S, T = input().split()", "+print(*[s + t for s, t in zip(S, T)], sep=\"\")" ]
false
0.039222
0.038622
1.015533
[ "s234691992", "s993204988" ]
u729133443
p02760
python
s302462427
s076839438
177
19
38,256
3,060
Accepted
Accepted
89.27
a=open(0).read().split();print(('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2]))
a=open(0).read().split();print(('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2]))
1
1
148
140
a = open(0).read().split() print( ( "YNeos"[ all( t - set(map(a.index, a[10:])) for t in ( {0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, ...
a = open(0).read().split() print( ( "YNeos"[ all( t - set(map(a.index, a[10:])) for t in ( {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, ...
false
0
[ "- {0, 1, 2}," ]
false
0.037339
0.031973
1.167833
[ "s302462427", "s076839438" ]
u078042885
p00135
python
s727309529
s187608529
40
30
7,548
7,668
Accepted
Accepted
25
for _ in [0]*int(eval(input())): h,m=list(map(int,input().split(":"))) s=l=.0 l=m*6 s=30*(h+(m/60)) if l<s:l,s=s,l if l-s>180:d=360-l+s else:d=l-s if d<30: print('alert') elif d<90: print('warning') else: print('safe')
for _ in [0]*int(eval(input())): h,m=list(map(int,input().split(":"))) s=l=.0 l=m*6 s=30*(h+(m/60)) if l<s:l,s=s,l if l-s>180:d=360-l+s else:d=l-s b='safe' if d<30:b='alert' elif d<90: b='warning' print(b)
11
12
256
248
for _ in [0] * int(eval(input())): h, m = list(map(int, input().split(":"))) s = l = 0.0 l = m * 6 s = 30 * (h + (m / 60)) if l < s: l, s = s, l if l - s > 180: d = 360 - l + s else: d = l - s if d < 30: print("alert") elif d < 90: print("warni...
for _ in [0] * int(eval(input())): h, m = list(map(int, input().split(":"))) s = l = 0.0 l = m * 6 s = 30 * (h + (m / 60)) if l < s: l, s = s, l if l - s > 180: d = 360 - l + s else: d = l - s b = "safe" if d < 30: b = "alert" elif d < 90: ...
false
8.333333
[ "+ b = \"safe\"", "- print(\"alert\")", "+ b = \"alert\"", "- print(\"warning\")", "- else:", "- print(\"safe\")", "+ b = \"warning\"", "+ print(b)" ]
false
0.037277
0.03777
0.986959
[ "s727309529", "s187608529" ]
u832039789
p02761
python
s090443614
s674686828
20
18
3,060
3,060
Accepted
Accepted
10
n,m = list(map(int,input().split())) sc = [list(map(int,input().split())) for i in range(m)] for i in range(10000): s = str(i) if len(s) != n: continue ok = True for a, b in sc: if s[a - 1] != str(b): ok = False break if ok: print(i) ...
n,m = list(map(int,input().split())) sc = [list(map(int,input().split())) for _ in range(m)] for i in range(1000): s = str(i) if len(s) != n: continue if all(s[a - 1] == str(b) for a, b in sc): print(i) exit() print((-1))
17
11
339
254
n, m = list(map(int, input().split())) sc = [list(map(int, input().split())) for i in range(m)] for i in range(10000): s = str(i) if len(s) != n: continue ok = True for a, b in sc: if s[a - 1] != str(b): ok = False break if ok: print(i) exit() ...
n, m = list(map(int, input().split())) sc = [list(map(int, input().split())) for _ in range(m)] for i in range(1000): s = str(i) if len(s) != n: continue if all(s[a - 1] == str(b) for a, b in sc): print(i) exit() print((-1))
false
35.294118
[ "-sc = [list(map(int, input().split())) for i in range(m)]", "-for i in range(10000):", "+sc = [list(map(int, input().split())) for _ in range(m)]", "+for i in range(1000):", "- ok = True", "- for a, b in sc:", "- if s[a - 1] != str(b):", "- ok = False", "- break",...
false
0.039965
0.037214
1.07394
[ "s090443614", "s674686828" ]
u254886300
p02815
python
s288585403
s049771514
319
277
25,772
26,024
Accepted
Accepted
13.17
import sys INF=1e9 mod=1e9+7 n=int(eval(input())) lit=list(map(int,input().split())) lit.sort() ans=0 for i in range(n): ans=(ans+lit[i]*(n-i+1)%mod)%mod for i in range(2*(n-1)): ans=ans*2%mod ans=int(ans) print(ans)
import sys INF=1e9 mod=1e9+7 n=int(eval(input())) lit=list(map(int,input().split())) lit.sort() ans=0 for i in range(n): ans=(ans+lit[i]*(n-i+1)%mod)%mod for i in range((n-1)): ans=ans*4%mod ans=int(ans) print(ans)
13
13
231
229
import sys INF = 1e9 mod = 1e9 + 7 n = int(eval(input())) lit = list(map(int, input().split())) lit.sort() ans = 0 for i in range(n): ans = (ans + lit[i] * (n - i + 1) % mod) % mod for i in range(2 * (n - 1)): ans = ans * 2 % mod ans = int(ans) print(ans)
import sys INF = 1e9 mod = 1e9 + 7 n = int(eval(input())) lit = list(map(int, input().split())) lit.sort() ans = 0 for i in range(n): ans = (ans + lit[i] * (n - i + 1) % mod) % mod for i in range((n - 1)): ans = ans * 4 % mod ans = int(ans) print(ans)
false
0
[ "-for i in range(2 * (n - 1)):", "- ans = ans * 2 % mod", "+for i in range((n - 1)):", "+ ans = ans * 4 % mod" ]
false
0.041717
0.04266
0.977877
[ "s288585403", "s049771514" ]
u033606236
p03777
python
s726602772
s182999157
171
17
38,256
2,940
Accepted
Accepted
90.06
a, b = input().split() if a == b : print("H") else: print("D")
a, b= input().split() print(("H" if a == b else "D"))
5
2
70
52
a, b = input().split() if a == b: print("H") else: print("D")
a, b = input().split() print(("H" if a == b else "D"))
false
60
[ "-if a == b:", "- print(\"H\")", "-else:", "- print(\"D\")", "+print((\"H\" if a == b else \"D\"))" ]
false
0.077161
0.03509
2.198927
[ "s726602772", "s182999157" ]
u020091453
p02918
python
s331700590
s101777641
72
42
4,084
3,316
Accepted
Accepted
41.67
N,K = list(map(int,input().split(' '))) S = list(eval(input())) first = S[0] flg = False for index in range(1,N): if S[index] == first and flg: flg = False K -= 1 elif S[index] != first: S[index] = first flg = True if K == 0: break count = 0 f...
N,K = list(map(int,input().split())) B = eval(input()) happy = 0 for n in range(N - 1): if B[n] == B[n + 1]: happy += 1 print((N -1 if happy + K*2 > N-1 else happy + K*2))
25
10
411
190
N, K = list(map(int, input().split(" "))) S = list(eval(input())) first = S[0] flg = False for index in range(1, N): if S[index] == first and flg: flg = False K -= 1 elif S[index] != first: S[index] = first flg = True if K == 0: break count = 0 for index in range(1, N...
N, K = list(map(int, input().split())) B = eval(input()) happy = 0 for n in range(N - 1): if B[n] == B[n + 1]: happy += 1 print((N - 1 if happy + K * 2 > N - 1 else happy + K * 2))
false
60
[ "-N, K = list(map(int, input().split(\" \")))", "-S = list(eval(input()))", "-first = S[0]", "-flg = False", "-for index in range(1, N):", "- if S[index] == first and flg:", "- flg = False", "- K -= 1", "- elif S[index] != first:", "- S[index] = first", "- flg =...
false
0.039767
0.039687
1.002026
[ "s331700590", "s101777641" ]
u827202523
p02658
python
s726332063
s702956204
405
148
87,264
86,908
Accepted
Accepted
63.46
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) from collections import defaultdict, deque from sys import exit import math import copy from bisect import bisect_left, bisect_right from heapq import ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) from collections import defaultdict, deque from sys import exit import math import copy from bisect import bisect_left, bisect_right from hea...
72
85
1,472
1,502
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) from collections import defaultdict, deque from sys import exit import math import copy from bisect import bisect_left, bisect_right from heapq import * impor...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) from collections import defaultdict, deque from sys import exit import math import copy from bisect import bisect_left, bisect_right from heapq import * impor...
false
15.294118
[ "+MOD = 998244353", "+", "+", "- lim = 10**18", "- if ans > lim:", "+ if ans > 10**18:", "- # n = getN()", "- # for _ in range(n):", "- solve()", "+ n = getN()", "+ for _ in range(n):", "+ solve()" ]
false
0.080732
0.127792
0.631746
[ "s726332063", "s702956204" ]
u153665391
p02271
python
s138262063
s749645629
560
30
5,644
7,532
Accepted
Accepted
94.64
N = int(eval(input())) A = list(map(int, input().split())) Q = int(eval(input())) M = list(map(int, input().split())) combinations = {} def create_combinations(idx, sum): combinations[sum] = 1 if idx >= N: return create_combinations(idx+1, sum) create_combinations(idx+1, sum+A[idx]...
def solve(dp, a, i, m): if m in dp[i]: return dp[i][m] if m == 0: dp[i][m] = True elif i >= len(a): dp[i][m] = False elif solve(dp, a, i+1, m): dp[i][m] = True elif solve(dp, a, i+1, m-a[i]): dp[i][m] = True else: dp[i][m] = False return dp[i][m] N = int(eval(in...
22
31
464
546
N = int(eval(input())) A = list(map(int, input().split())) Q = int(eval(input())) M = list(map(int, input().split())) combinations = {} def create_combinations(idx, sum): combinations[sum] = 1 if idx >= N: return create_combinations(idx + 1, sum) create_combinations(idx + 1, sum + A[idx]) ...
def solve(dp, a, i, m): if m in dp[i]: return dp[i][m] if m == 0: dp[i][m] = True elif i >= len(a): dp[i][m] = False elif solve(dp, a, i + 1, m): dp[i][m] = True elif solve(dp, a, i + 1, m - a[i]): dp[i][m] = True else: dp[i][m] = False return ...
false
29.032258
[ "+def solve(dp, a, i, m):", "+ if m in dp[i]:", "+ return dp[i][m]", "+ if m == 0:", "+ dp[i][m] = True", "+ elif i >= len(a):", "+ dp[i][m] = False", "+ elif solve(dp, a, i + 1, m):", "+ dp[i][m] = True", "+ elif solve(dp, a, i + 1, m - a[i]):", "+ ...
false
0.073245
0.034556
2.119587
[ "s138262063", "s749645629" ]
u294520705
p02996
python
s206261715
s539610438
857
551
43,868
43,868
Accepted
Accepted
35.71
n = int(eval(input())) d = dict() for i in range(n): w, t = list(map(int, input().split())) if t in d: d[t] = d[t] + w else: d[t] = w d = sorted(list(d.items()), key=lambda x:x[0]) now = 0 ans = True for x in d: t, w = x now = now + w if now > t: ans = Fals...
import sys input = sys.stdin.readline n = int(eval(input())) d = dict() for i in range(n): w, t = list(map(int, input().split())) if t in d: d[t] = d[t] + w else: d[t] = w d = sorted(list(d.items()), key=lambda x:x[0]) now = 0 ans = True for x in d: t, w = x now = now ...
18
20
349
389
n = int(eval(input())) d = dict() for i in range(n): w, t = list(map(int, input().split())) if t in d: d[t] = d[t] + w else: d[t] = w d = sorted(list(d.items()), key=lambda x: x[0]) now = 0 ans = True for x in d: t, w = x now = now + w if now > t: ans = False brea...
import sys input = sys.stdin.readline n = int(eval(input())) d = dict() for i in range(n): w, t = list(map(int, input().split())) if t in d: d[t] = d[t] + w else: d[t] = w d = sorted(list(d.items()), key=lambda x: x[0]) now = 0 ans = True for x in d: t, w = x now = now + w if no...
false
10
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.150073
0.043208
3.473287
[ "s206261715", "s539610438" ]
u238084414
p03109
python
s345479969
s628798975
19
17
3,312
2,940
Accepted
Accepted
10.53
import time from datetime import date S = list(map(int, input().split("/"))) day = date(S[0], S[1], S[2]) border = date(2019, 4, 30) if day <= border: print("Heisei") else: print("TBD")
S = eval(input()) if int(S[5:7]) >= 5: print("TBD") else: print("Heisei")
9
6
197
77
import time from datetime import date S = list(map(int, input().split("/"))) day = date(S[0], S[1], S[2]) border = date(2019, 4, 30) if day <= border: print("Heisei") else: print("TBD")
S = eval(input()) if int(S[5:7]) >= 5: print("TBD") else: print("Heisei")
false
33.333333
[ "-import time", "-from datetime import date", "-", "-S = list(map(int, input().split(\"/\")))", "-day = date(S[0], S[1], S[2])", "-border = date(2019, 4, 30)", "-if day <= border:", "+S = eval(input())", "+if int(S[5:7]) >= 5:", "+ print(\"TBD\")", "+else:", "-else:", "- print(\"TBD\")...
false
0.082129
0.066369
1.237463
[ "s345479969", "s628798975" ]
u382423941
p03147
python
s983428610
s014712703
19
17
3,064
2,940
Accepted
Accepted
10.53
n = int(eval(input())) h = list(map(int, input().split())) ans = 0 hk = 0 for i in range(n): if hk == h[i]: continue elif hk < h[i]: while hk < h[i]: hk += 1 ans += 1 elif hk > h[i]: while hk > h[i]: hk -= 1 print(ans)
n = int(eval(input())) h = list(map(int, input().split())) ans = hk = 0 for i in range(n): if hk < h[i]: ans += h[i] - hk hk = h[i] print(ans)
16
8
300
159
n = int(eval(input())) h = list(map(int, input().split())) ans = 0 hk = 0 for i in range(n): if hk == h[i]: continue elif hk < h[i]: while hk < h[i]: hk += 1 ans += 1 elif hk > h[i]: while hk > h[i]: hk -= 1 print(ans)
n = int(eval(input())) h = list(map(int, input().split())) ans = hk = 0 for i in range(n): if hk < h[i]: ans += h[i] - hk hk = h[i] print(ans)
false
50
[ "-ans = 0", "-hk = 0", "+ans = hk = 0", "- if hk == h[i]:", "- continue", "- elif hk < h[i]:", "- while hk < h[i]:", "- hk += 1", "- ans += 1", "- elif hk > h[i]:", "- while hk > h[i]:", "- hk -= 1", "+ if hk < h[i]:", "+ ...
false
0.057827
0.080776
0.715899
[ "s983428610", "s014712703" ]
u104911888
p01140
python
s559724413
s412690187
6,910
5,110
53,220
59,308
Accepted
Accepted
26.05
from collections import defaultdict while True: N,M=list(map(int,input().split())) if N==M==0:break H=[eval(input()) for i in range(N)] W=[eval(input()) for i in range(M)] dh=defaultdict(int) dw=defaultdict(int) for i in range(N): s=H[i] dh[s]+=1 for j in r...
from collections import defaultdict def getDic(L,n): d=defaultdict(int) for i in range(n): s=L[i] d[s]+=1 for j in range(i+1,n): s+=L[j] d[s]+=1 return d while True: N,M=list(map(int,input().split())) if N==M==0:break H=[eval(input()...
21
19
545
458
from collections import defaultdict while True: N, M = list(map(int, input().split())) if N == M == 0: break H = [eval(input()) for i in range(N)] W = [eval(input()) for i in range(M)] dh = defaultdict(int) dw = defaultdict(int) for i in range(N): s = H[i] dh[s] += 1...
from collections import defaultdict def getDic(L, n): d = defaultdict(int) for i in range(n): s = L[i] d[s] += 1 for j in range(i + 1, n): s += L[j] d[s] += 1 return d while True: N, M = list(map(int, input().split())) if N == M == 0: break...
false
9.52381
[ "+", "+", "+def getDic(L, n):", "+ d = defaultdict(int)", "+ for i in range(n):", "+ s = L[i]", "+ d[s] += 1", "+ for j in range(i + 1, n):", "+ s += L[j]", "+ d[s] += 1", "+ return d", "+", "- dh = defaultdict(int)", "- dw = defaul...
false
0.036545
0.035927
1.017198
[ "s559724413", "s412690187" ]
u225388820
p02577
python
s976092832
s961822370
85
50
84,804
9,200
Accepted
Accepted
41.18
n = list(map(int, eval(input()))) print(("Yes" if sum(n) % 9 == 0 else "No"))
print(("Yes" if sum(map(int, eval(input()))) % 9 == 0 else "No"))
2
1
71
58
n = list(map(int, eval(input()))) print(("Yes" if sum(n) % 9 == 0 else "No"))
print(("Yes" if sum(map(int, eval(input()))) % 9 == 0 else "No"))
false
50
[ "-n = list(map(int, eval(input())))", "-print((\"Yes\" if sum(n) % 9 == 0 else \"No\"))", "+print((\"Yes\" if sum(map(int, eval(input()))) % 9 == 0 else \"No\"))" ]
false
0.150069
0.106219
1.412825
[ "s976092832", "s961822370" ]
u784022244
p03565
python
s060747526
s662089030
19
17
3,064
3,064
Accepted
Accepted
10.53
S=eval(input()) ls=len(S) T=eval(input()) lt=len(T) ans="z"*51 for i in range(ls-lt+1): s=S[i:i+lt] hamaru=True now="z"*51 for j in range(lt): if s[j]!="?" and s[j]!=T[j]: hamaru=False #print(hamaru) if hamaru: now="" for k in range(ls): if k in list(range(i,i+lt)): ...
S=eval(input()) T=eval(input()) N=len(S) TN=len(T) ans="z"*51 if N<TN: print("UNRESTORABLE") exit() for i in range(N-TN+1): #始点 ok=True for j in range(TN): if S[i+j]==T[j] or S[i+j]=="?": continue else: ok=False break if ok: ...
26
25
471
455
S = eval(input()) ls = len(S) T = eval(input()) lt = len(T) ans = "z" * 51 for i in range(ls - lt + 1): s = S[i : i + lt] hamaru = True now = "z" * 51 for j in range(lt): if s[j] != "?" and s[j] != T[j]: hamaru = False # print(hamaru) if hamaru: now = "" for k...
S = eval(input()) T = eval(input()) N = len(S) TN = len(T) ans = "z" * 51 if N < TN: print("UNRESTORABLE") exit() for i in range(N - TN + 1): # 始点 ok = True for j in range(TN): if S[i + j] == T[j] or S[i + j] == "?": continue else: ok = False break...
false
3.846154
[ "-ls = len(S)", "-lt = len(T)", "+N = len(S)", "+TN = len(T)", "-for i in range(ls - lt + 1):", "- s = S[i : i + lt]", "- hamaru = True", "- now = \"z\" * 51", "- for j in range(lt):", "- if s[j] != \"?\" and s[j] != T[j]:", "- hamaru = False", "- # print(hamar...
false
0.045857
0.045024
1.018509
[ "s060747526", "s662089030" ]
u130900604
p03835
python
s652169425
s323576297
1,489
91
3,060
67,192
Accepted
Accepted
93.89
k,s=list(map(int,input().split())) cnt=0 for x in range(0,k+1): for y in range(0,k+1): z=s-x-y if (0<=z<=k): cnt+=1 print(cnt)
k,s=list(map(int,input().split())) c=0 for x in range(k+1): for y in range(k+1): c+=0<=s-x-y<=k print(c)
9
6
151
106
k, s = list(map(int, input().split())) cnt = 0 for x in range(0, k + 1): for y in range(0, k + 1): z = s - x - y if 0 <= z <= k: cnt += 1 print(cnt)
k, s = list(map(int, input().split())) c = 0 for x in range(k + 1): for y in range(k + 1): c += 0 <= s - x - y <= k print(c)
false
33.333333
[ "-cnt = 0", "-for x in range(0, k + 1):", "- for y in range(0, k + 1):", "- z = s - x - y", "- if 0 <= z <= k:", "- cnt += 1", "-print(cnt)", "+c = 0", "+for x in range(k + 1):", "+ for y in range(k + 1):", "+ c += 0 <= s - x - y <= k", "+print(c)" ]
false
0.133008
0.036719
3.62228
[ "s652169425", "s323576297" ]
u977389981
p03001
python
s701758443
s300604686
173
29
39,884
9,172
Accepted
Accepted
83.24
W, H, x, y = list(map(int, input().split())) m2 = W * H * 0.5 ptn = 1 if W / 2 == x and H / 2 == y else 0 print((m2, ptn))
w, h, x, y = list(map(int, input().split())) ans = 0 if w / 2 == x and h / 2 == y: ans = 1 print(((w * h) / 2, ans))
6
7
121
124
W, H, x, y = list(map(int, input().split())) m2 = W * H * 0.5 ptn = 1 if W / 2 == x and H / 2 == y else 0 print((m2, ptn))
w, h, x, y = list(map(int, input().split())) ans = 0 if w / 2 == x and h / 2 == y: ans = 1 print(((w * h) / 2, ans))
false
14.285714
[ "-W, H, x, y = list(map(int, input().split()))", "-m2 = W * H * 0.5", "-ptn = 1 if W / 2 == x and H / 2 == y else 0", "-print((m2, ptn))", "+w, h, x, y = list(map(int, input().split()))", "+ans = 0", "+if w / 2 == x and h / 2 == y:", "+ ans = 1", "+print(((w * h) / 2, ans))" ]
false
0.055752
0.035495
1.570691
[ "s701758443", "s300604686" ]
u899975427
p03087
python
s058396875
s308198345
1,305
271
6,104
6,416
Accepted
Accepted
79.23
N,Q = (int(i) for i in input().split()) S = eval(input()) acl = [0 for i in range(N)] cnt = 0 for j in range(1,N): if S[j-1] == 'A' and S[j] == 'C': cnt += 1 acl[j] = cnt for k in range(Q): x,y = list(map(int, input().split())) print((acl[y-1]-acl[x-1]))
import sys input = sys.stdin.readline N,Q = (int(i) for i in input().split()) S = eval(input()) acl = [0 for i in range(N)] cnt = 0 for j in range(1,N): if S[j-1] == 'A' and S[j] == 'C': cnt += 1 acl[j] = cnt for k in range(Q): x,y = list(map(int, input().split())) print((acl[y-1]-acl[...
12
15
270
312
N, Q = (int(i) for i in input().split()) S = eval(input()) acl = [0 for i in range(N)] cnt = 0 for j in range(1, N): if S[j - 1] == "A" and S[j] == "C": cnt += 1 acl[j] = cnt for k in range(Q): x, y = list(map(int, input().split())) print((acl[y - 1] - acl[x - 1]))
import sys input = sys.stdin.readline N, Q = (int(i) for i in input().split()) S = eval(input()) acl = [0 for i in range(N)] cnt = 0 for j in range(1, N): if S[j - 1] == "A" and S[j] == "C": cnt += 1 acl[j] = cnt for k in range(Q): x, y = list(map(int, input().split())) print((acl[y - 1] - acl[...
false
20
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.035671
0.036164
0.98637
[ "s058396875", "s308198345" ]
u312025627
p03718
python
s398077747
s759431649
180
113
79,004
78,972
Accepted
Accepted
37.22
# 解説AC、辺の張り方が難しすぎる from collections import deque INF = 1 << 23 class Dinic: def __init__(self, N): self.N = N self.G = [[] for _ in range(self.N)] def add_edge(self, u, v, cap): self.G[u].append([v, cap, len(self.G[v])]) self.G[v].append([u, 0, len(self.G[u])-1]) ...
# 解説AC、辺の張り方が難しすぎる from collections import deque INF = 1 << 23 class Dinic: def __init__(self, N): self.N = N self.G = [[] for _ in range(self.N)] def add_edge(self, u, v, cap): self.G[u].append([v, cap, len(self.G[v])]) self.G[v].append([u, 0, len(self.G[u])-1]) ...
82
80
2,345
2,254
# 解説AC、辺の張り方が難しすぎる from collections import deque INF = 1 << 23 class Dinic: def __init__(self, N): self.N = N self.G = [[] for _ in range(self.N)] def add_edge(self, u, v, cap): self.G[u].append([v, cap, len(self.G[v])]) self.G[v].append([u, 0, len(self.G[u]) - 1]) def b...
# 解説AC、辺の張り方が難しすぎる from collections import deque INF = 1 << 23 class Dinic: def __init__(self, N): self.N = N self.G = [[] for _ in range(self.N)] def add_edge(self, u, v, cap): self.G[u].append([v, cap, len(self.G[v])]) self.G[v].append([u, 0, len(self.G[u]) - 1]) def b...
false
2.439024
[ "- A = [input() for i in range(H)]", "+ A = [eval(input()) for i in range(H)]", "- Sh, Sw = -1, -1", "- Th, Tw = -1, -1", "- Sh, Sw = h, w", "- Th, Tw = h, w", "- if Sh == Th or Sw == Tw:", "- return print(-1)", "- print(F.max_flow(s, t))", "+...
false
0.03738
0.0365
1.024125
[ "s398077747", "s759431649" ]
u310381103
p03455
python
s995014480
s222998768
177
25
38,256
8,960
Accepted
Accepted
85.88
a,b=list(map(int,input().split())) if a%2==0 or b%2==0: print('Even') else: print('Odd')
a,b=list(map(int,input().split())) a*=b print(("Even" if a%2 == 0 else "Odd"))
5
3
95
72
a, b = list(map(int, input().split())) if a % 2 == 0 or b % 2 == 0: print("Even") else: print("Odd")
a, b = list(map(int, input().split())) a *= b print(("Even" if a % 2 == 0 else "Odd"))
false
40
[ "-if a % 2 == 0 or b % 2 == 0:", "- print(\"Even\")", "-else:", "- print(\"Odd\")", "+a *= b", "+print((\"Even\" if a % 2 == 0 else \"Odd\"))" ]
false
0.038782
0.118762
0.326552
[ "s995014480", "s222998768" ]
u462831976
p00111
python
s796769857
s868926767
100
80
11,824
11,728
Accepted
Accepted
20
# -*- coding: utf-8 -*- import sys import os import math import re import random # copy of cima code # to confirm system is working correctly en='ABCDEFGHIJKLMNOPQRSTUVWXYZ'+' .,-\'?' de={ '101':' ','000000':'\'','000011':',','10010001':'-','010001':'.','000001':'?', '100101':'A','10011010':'B','0101':...
# -*- coding: utf-8 -*- import sys import os import math import re import random tableA = { "A": "00000", "B": "00001", "C": "00010", "D": "00011", "E": "00100", "F": "00101", "G": "00110", "H": "00111", "I": "01000", "J": "01001", "K": "01010", "L":...
29
116
828
2,542
# -*- coding: utf-8 -*- import sys import os import math import re import random # copy of cima code # to confirm system is working correctly en = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + " .,-'?" de = { "101": " ", "000000": "'", "000011": ",", "10010001": "-", "010001": ".", "000001": "?", "100101"...
# -*- coding: utf-8 -*- import sys import os import math import re import random tableA = { "A": "00000", "B": "00001", "C": "00010", "D": "00011", "E": "00100", "F": "00101", "G": "00110", "H": "00111", "I": "01000", "J": "01001", "K": "01010", "L": "01011", "M": "0...
false
75
[ "-# copy of cima code", "-# to confirm system is working correctly", "-en = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" + \" .,-'?\"", "-de = {", "+tableA = {", "+ \"A\": \"00000\",", "+ \"B\": \"00001\",", "+ \"C\": \"00010\",", "+ \"D\": \"00011\",", "+ \"E\": \"00100\",", "+ \"F\": \"001...
false
0.045834
0.045469
1.008026
[ "s796769857", "s868926767" ]
u723792785
p02678
python
s715479459
s465056034
1,436
807
59,188
45,084
Accepted
Accepted
43.8
n,m = list(map(int,input().split())) tuuro = [] for i in range(m): a,b = list(map(int,input().split())) tuuro.append((a-1,b-1)) #行ける部屋は.? ikeru = [[] for _ in range(n)] for i,j in tuuro: ikeru[i].append(j) ikeru[j].append(i) fukasa = [0 for _ in range(n)] fukasamoto = [0 for _ in range(n)] kaisuu = 0 ...
n, m = list(map(int, input().split())) ikeru = [[] for _ in range(n)] for i in range(m): a, b = list(map(int, input().split())) ikeru[a-1].append(b-1) ikeru[b-1].append(a-1) fukasa = [0 for _ in range(n)] fukasamoto = [0 for _ in range(n)] kaisuu = 0 settansaku = set([]) setmada = {0} kouho = 1 while...
35
31
730
643
n, m = list(map(int, input().split())) tuuro = [] for i in range(m): a, b = list(map(int, input().split())) tuuro.append((a - 1, b - 1)) # 行ける部屋は.? ikeru = [[] for _ in range(n)] for i, j in tuuro: ikeru[i].append(j) ikeru[j].append(i) fukasa = [0 for _ in range(n)] fukasamoto = [0 for _ in range(n)] ka...
n, m = list(map(int, input().split())) ikeru = [[] for _ in range(n)] for i in range(m): a, b = list(map(int, input().split())) ikeru[a - 1].append(b - 1) ikeru[b - 1].append(a - 1) fukasa = [0 for _ in range(n)] fukasamoto = [0 for _ in range(n)] kaisuu = 0 settansaku = set([]) setmada = {0} kouho = 1 whil...
false
11.428571
[ "-tuuro = []", "+ikeru = [[] for _ in range(n)]", "- tuuro.append((a - 1, b - 1))", "-# 行ける部屋は.?", "-ikeru = [[] for _ in range(n)]", "-for i, j in tuuro:", "- ikeru[i].append(j)", "- ikeru[j].append(i)", "+ ikeru[a - 1].append(b - 1)", "+ ikeru[b - 1].append(a - 1)", "-listmada =...
false
0.041536
0.053192
0.780872
[ "s715479459", "s465056034" ]
u408260374
p00730
python
s562212919
s594825990
90
80
7,572
7,632
Accepted
Accepted
11.11
def cut(d, w, s): s %= 2 * (d + w) sq = [] if 0 < s < w: sq = [(d, s), (d, w - s)] elif w < s < w + d: s -= w sq = [(s, w), (d - s, w)] elif w + d < s < 2 * w + d: s -= w + d sq = [(d, s), (d, w - s)] elif 2 * w + d < s < 2 * (w + d): s...
def cut(d, w, s): s %= d + w sq = [] if 0 < s < w: sq = [(d, s), (d, w - s)] elif w < s < w + d: s -= w sq = [(s, w), (d - s, w)] else: assert(False) p1, p2 = sq if p1[0] * p1[1] > p2[0] * p2[1]: p1, p2 = p2, p1 return [p1, p2] wh...
32
26
808
616
def cut(d, w, s): s %= 2 * (d + w) sq = [] if 0 < s < w: sq = [(d, s), (d, w - s)] elif w < s < w + d: s -= w sq = [(s, w), (d - s, w)] elif w + d < s < 2 * w + d: s -= w + d sq = [(d, s), (d, w - s)] elif 2 * w + d < s < 2 * (w + d): s -= 2 * w + ...
def cut(d, w, s): s %= d + w sq = [] if 0 < s < w: sq = [(d, s), (d, w - s)] elif w < s < w + d: s -= w sq = [(s, w), (d - s, w)] else: assert False p1, p2 = sq if p1[0] * p1[1] > p2[0] * p2[1]: p1, p2 = p2, p1 return [p1, p2] while True: N, ...
false
18.75
[ "- s %= 2 * (d + w)", "+ s %= d + w", "- sq = [(s, w), (d - s, w)]", "- elif w + d < s < 2 * w + d:", "- s -= w + d", "- sq = [(d, s), (d, w - s)]", "- elif 2 * w + d < s < 2 * (w + d):", "- s -= 2 * w + d" ]
false
0.042803
0.039911
1.07247
[ "s562212919", "s594825990" ]
u227082700
p03612
python
s035030741
s362237067
66
60
14,008
14,008
Accepted
Accepted
9.09
n=int(eval(input())) p=list(map(int,input().split())) ans=0 i=0 while i<n: if i+1==p[i]: i+=1 ans+=1 i+=1 print(ans)
n=int(eval(input())) p=list(map(int,input().split())) i=0 ans=0 while i<n: if p[i]==i+1: i+=1 ans+=1 i+=1 print(ans)
10
10
131
131
n = int(eval(input())) p = list(map(int, input().split())) ans = 0 i = 0 while i < n: if i + 1 == p[i]: i += 1 ans += 1 i += 1 print(ans)
n = int(eval(input())) p = list(map(int, input().split())) i = 0 ans = 0 while i < n: if p[i] == i + 1: i += 1 ans += 1 i += 1 print(ans)
false
0
[ "+i = 0", "-i = 0", "- if i + 1 == p[i]:", "+ if p[i] == i + 1:" ]
false
0.087879
0.038064
2.308736
[ "s035030741", "s362237067" ]
u645250356
p02755
python
s604289798
s626683059
344
281
65,644
65,896
Accepted
Accepted
18.31
from collections import Counter,defaultdict,deque from bisect import bisect_left import sys,math,itertools,pprint,fractions,time sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) a,b = inpl(...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
17
17
459
498
from collections import Counter, defaultdict, deque from bisect import bisect_left import sys, math, itertools, pprint, fractions, time sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split()))...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): ...
false
0
[ "-from bisect import bisect_left", "-import sys, math, itertools, pprint, fractions, time", "+from heapq import heappop, heappush, heapify", "+from bisect import bisect_left, bisect_right", "+import sys, math, itertools, fractions, pprint", "-res = INF", "-for i in range(1, 10**6):", "+res = -1", "+...
false
0.275861
0.519704
0.530803
[ "s604289798", "s626683059" ]
u347640436
p02973
python
s234351258
s221921706
1,572
1,159
44,340
44,040
Accepted
Accepted
26.27
from random import random from sys import setrecursionlimit setrecursionlimit(10 ** 5) class TreapNode: _value = None _priority = None _count = None _left = None _right = None def __init__(self, value): self._value = value self._priority = random() sel...
from random import random from sys import setrecursionlimit setrecursionlimit(10 ** 6) class TreapNode: _value = None _priority = None _count = None _left = None _right = None def __init__(self, value): self._value = value self._priority = random() sel...
148
148
3,218
3,218
from random import random from sys import setrecursionlimit setrecursionlimit(10**5) class TreapNode: _value = None _priority = None _count = None _left = None _right = None def __init__(self, value): self._value = value self._priority = random() self._count = 1 def...
from random import random from sys import setrecursionlimit setrecursionlimit(10**6) class TreapNode: _value = None _priority = None _count = None _left = None _right = None def __init__(self, value): self._value = value self._priority = random() self._count = 1 def...
false
0
[ "-setrecursionlimit(10**5)", "+setrecursionlimit(10**6)" ]
false
0.0481
0.046982
1.023785
[ "s234351258", "s221921706" ]
u981931040
p02947
python
s272978278
s961891875
942
751
27,428
19,820
Accepted
Accepted
20.28
#from Collections import Counter N = int(eval(input())) count = 0 word = {} def str_sort(str): f = lambda y: "".join(sorted([x.replace(' ', '').lower() for x in y])) return f(str) for _ in range(N): sorted_str = str_sort(eval(input())) if sorted_str not in word: word[sorted_str] = [0...
from collections import Counter from math import factorial #from scipy.special import comb def com(n , r): if n == 1: return 0 else: return factorial(n) // (factorial(n - r) * factorial(r)) N = int(eval(input())) S = [] for _ in range(N): s = eval(input()) S.append("".join(so...
25
18
696
406
# from Collections import Counter N = int(eval(input())) count = 0 word = {} def str_sort(str): f = lambda y: "".join(sorted([x.replace(" ", "").lower() for x in y])) return f(str) for _ in range(N): sorted_str = str_sort(eval(input())) if sorted_str not in word: word[sorted_str] = [0] ...
from collections import Counter from math import factorial # from scipy.special import comb def com(n, r): if n == 1: return 0 else: return factorial(n) // (factorial(n - r) * factorial(r)) N = int(eval(input())) S = [] for _ in range(N): s = eval(input()) S.append("".join(sorted(s)))...
false
28
[ "-# from Collections import Counter", "-N = int(eval(input()))", "-count = 0", "-word = {}", "+from collections import Counter", "+from math import factorial", "+", "+# from scipy.special import comb", "+def com(n, r):", "+ if n == 1:", "+ return 0", "+ else:", "+ return ...
false
0.085841
0.085681
1.00187
[ "s272978278", "s961891875" ]
u761320129
p03497
python
s721023600
s286269229
232
107
39,352
32,440
Accepted
Accepted
53.88
from collections import Counter N,K = list(map(int,input().split())) A = list(map(int,input().split())) ctr = Counter(A) ans = 0 for i,(k,v) in enumerate(ctr.most_common()): if i < K: continue ans += v print(ans)
N,K = list(map(int,input().split())) A = list(map(int,input().split())) from collections import Counter ctr = Counter(A) if len(ctr) <= K: print((0)) exit() l = len(ctr) - K ans = sum(sorted(ctr.values())[:l]) print(ans)
10
11
224
231
from collections import Counter N, K = list(map(int, input().split())) A = list(map(int, input().split())) ctr = Counter(A) ans = 0 for i, (k, v) in enumerate(ctr.most_common()): if i < K: continue ans += v print(ans)
N, K = list(map(int, input().split())) A = list(map(int, input().split())) from collections import Counter ctr = Counter(A) if len(ctr) <= K: print((0)) exit() l = len(ctr) - K ans = sum(sorted(ctr.values())[:l]) print(ans)
false
9.090909
[ "+N, K = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-N, K = list(map(int, input().split()))", "-A = list(map(int, input().split()))", "-ans = 0", "-for i, (k, v) in enumerate(ctr.most_common()):", "- if i < K:", "- continue", "- ans += v", "+if len(ctr)...
false
0.037542
0.037837
0.992204
[ "s721023600", "s286269229" ]
u914330401
p03448
python
s737386825
s616528451
57
52
3,064
3,064
Accepted
Accepted
8.77
a500 = int(eval(input())) b100 = int(eval(input())) c50 = int(eval(input())) X = int(eval(input())) ans = 0 goukei = 0 is_over = False for i in range(a500+1): for j in range(b100+1): for k in range(c50+1): goukei = i * 500 + j * 100 + k * 50 if goukei == X: ans += 1 print(ans)
a500 = int(eval(input())) b100 = int(eval(input())) c50 = int(eval(input())) X = int(eval(input())) ans = 0 goukei = 0 is_over = False for i in range(a500+1): for j in range(b100+1): for k in range(c50+1): goukei = i * 500 + j * 100 + k * 50 if goukei == X: ans += 1 break ...
14
15
292
307
a500 = int(eval(input())) b100 = int(eval(input())) c50 = int(eval(input())) X = int(eval(input())) ans = 0 goukei = 0 is_over = False for i in range(a500 + 1): for j in range(b100 + 1): for k in range(c50 + 1): goukei = i * 500 + j * 100 + k * 50 if goukei == X: ans ...
a500 = int(eval(input())) b100 = int(eval(input())) c50 = int(eval(input())) X = int(eval(input())) ans = 0 goukei = 0 is_over = False for i in range(a500 + 1): for j in range(b100 + 1): for k in range(c50 + 1): goukei = i * 500 + j * 100 + k * 50 if goukei == X: ans ...
false
6.666667
[ "+ break" ]
false
0.068296
0.068534
0.996532
[ "s737386825", "s616528451" ]
u573754721
p02995
python
s702758233
s961512358
38
35
5,304
5,048
Accepted
Accepted
7.89
import fractions a,b,c,d=list(map(int,input().split())) ac=(a-1)//c bc=b//c ad=(a-1)//d bd=b//d f=fractions.gcd(c,d) f=c*d//f af=(a-1)//f bf=b//f print(((b-a+1)-(bc-ac)-(bd-ad)+(bf-af)))
import fractions a,b,c,d=list(map(int,input().split())) a=a-1 ac=a//c ad=a//d bc=b//c bd=b//d f=fractions.gcd(c,d) f=c*d//f acd=a//f bcd=b//f print(((b-a)-(bc-ac)-(bd-ad)+(bcd-acd)))
18
16
202
194
import fractions a, b, c, d = list(map(int, input().split())) ac = (a - 1) // c bc = b // c ad = (a - 1) // d bd = b // d f = fractions.gcd(c, d) f = c * d // f af = (a - 1) // f bf = b // f print(((b - a + 1) - (bc - ac) - (bd - ad) + (bf - af)))
import fractions a, b, c, d = list(map(int, input().split())) a = a - 1 ac = a // c ad = a // d bc = b // c bd = b // d f = fractions.gcd(c, d) f = c * d // f acd = a // f bcd = b // f print(((b - a) - (bc - ac) - (bd - ad) + (bcd - acd)))
false
11.111111
[ "-ac = (a - 1) // c", "+a = a - 1", "+ac = a // c", "+ad = a // d", "-ad = (a - 1) // d", "-af = (a - 1) // f", "-bf = b // f", "-print(((b - a + 1) - (bc - ac) - (bd - ad) + (bf - af)))", "+acd = a // f", "+bcd = b // f", "+print(((b - a) - (bc - ac) - (bd - ad) + (bcd - acd)))" ]
false
0.099044
0.102163
0.96947
[ "s702758233", "s961512358" ]
u297574184
p02763
python
s219111615
s153682758
505
174
52,884
109,248
Accepted
Accepted
65.54
def solve(): import sys input = sys.stdin.readline ordA = ord('a') N = int(eval(input())) Ss = input().strip() nos = [ord(S)-ordA for S in Ss] Q = int(eval(input())) idEle = 0 def _binOpe(x, y): return x | y def makeSegTree(numEle): numPow2 = 2 *...
import sys input = sys.stdin.readline def solve(): ordA = ord('a') N = int(eval(input())) Ss = input().rstrip() Q = int(eval(input())) querys = [tuple(input().split()) for _ in range(Q)] idEle = 0 def _binOpe(x, y): return x | y def makeSegTree(numEle): ...
69
67
1,735
1,715
def solve(): import sys input = sys.stdin.readline ordA = ord("a") N = int(eval(input())) Ss = input().strip() nos = [ord(S) - ordA for S in Ss] Q = int(eval(input())) idEle = 0 def _binOpe(x, y): return x | y def makeSegTree(numEle): numPow2 = 2 ** (numEle - 1...
import sys input = sys.stdin.readline def solve(): ordA = ord("a") N = int(eval(input())) Ss = input().rstrip() Q = int(eval(input())) querys = [tuple(input().split()) for _ in range(Q)] idEle = 0 def _binOpe(x, y): return x | y def makeSegTree(numEle): numPow2 = 2 *...
false
2.898551
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "- import sys", "-", "- input = sys.stdin.readline", "- Ss = input().strip()", "- nos = [ord(S) - ordA for S in Ss]", "+ Ss = input().rstrip()", "+ querys = [tuple(input().split()) for _ in range(Q)]", "- As = ...
false
0.038479
0.046436
0.828645
[ "s219111615", "s153682758" ]
u933096856
p02257
python
s972877070
s165462382
730
470
7,948
7,960
Accepted
Accepted
35.62
import math n=int(eval(input())) s=0 for i in range(n): a=int(eval(input())) b=math.ceil(a**0.5) if a==2: s+=1 elif a%2==0 or a < 2: continue else: c=0 j=3 while j <= b: if a%j==0: c+=1 break ...
import math n=int(eval(input())) s=0 for i in range(n): a=int(eval(input())) b=math.ceil(a**0.5) if a==2: s+=1 elif a%2==0 or a < 2: continue else: c=0 for j in range(3,b+1,2): if a%j==0: c+=1 break i...
21
19
363
343
import math n = int(eval(input())) s = 0 for i in range(n): a = int(eval(input())) b = math.ceil(a**0.5) if a == 2: s += 1 elif a % 2 == 0 or a < 2: continue else: c = 0 j = 3 while j <= b: if a % j == 0: c += 1 bre...
import math n = int(eval(input())) s = 0 for i in range(n): a = int(eval(input())) b = math.ceil(a**0.5) if a == 2: s += 1 elif a % 2 == 0 or a < 2: continue else: c = 0 for j in range(3, b + 1, 2): if a % j == 0: c += 1 br...
false
9.52381
[ "- j = 3", "- while j <= b:", "+ for j in range(3, b + 1, 2):", "- j += 2" ]
false
0.036462
0.037277
0.978133
[ "s972877070", "s165462382" ]
u729133443
p02889
python
s174860395
s916679429
484
359
40,864
40,864
Accepted
Accepted
25.83
from scipy.sparse import* def main(): f=csgraph.floyd_warshall n,m,l,*t=map(int,open(0).read().split()) m*=3 *_,=map(print,f(f(csr_matrix((t[2:m:3],(t[:m:3],t[1:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n)%n-1) main()
from scipy.sparse import* def main(): f=csgraph.floyd_warshall n,m,l,*t=list(map(int,open(0).read().split())) m*=3 print(('\n'.join(map(str,list(map(int,f(f(csr_matrix((t[2:m:3],(t[:m:3],t[1:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n)%n-1)))))) main()
7
7
240
261
from scipy.sparse import * def main(): f = csgraph.floyd_warshall n, m, l, *t = map(int, open(0).read().split()) m *= 3 (*_,) = map( print, f(f(csr_matrix((t[2:m:3], (t[:m:3], t[1:m:3])), [n + 1] * 2), 0) <= l)[ t[m + 1 :: 2], t[m + 2 :: 2] ].clip(0, n) % n ...
from scipy.sparse import * def main(): f = csgraph.floyd_warshall n, m, l, *t = list(map(int, open(0).read().split())) m *= 3 print( ( "\n".join( map( str, list( map( int, ...
false
0
[ "- n, m, l, *t = map(int, open(0).read().split())", "+ n, m, l, *t = list(map(int, open(0).read().split()))", "- (*_,) = map(", "- print,", "- f(f(csr_matrix((t[2:m:3], (t[:m:3], t[1:m:3])), [n + 1] * 2), 0) <= l)[", "- t[m + 1 :: 2], t[m + 2 :: 2]", "- ].clip(0,...
false
0.35614
1.010263
0.352522
[ "s174860395", "s916679429" ]
u179304833
p02712
python
s922253867
s404094031
197
159
9,172
9,144
Accepted
Accepted
19.29
N = eval(input()) count :int=0 for k in range(int(N)): if (k+1)%3!=0 and (k+1)%5!=0: count+=(k+1) print(count)
n=int(eval(input())) ans=0 for i in range(1,n+1): if i%3!=0 and i%5!=0: ans+=i print(ans)
6
6
115
94
N = eval(input()) count: int = 0 for k in range(int(N)): if (k + 1) % 3 != 0 and (k + 1) % 5 != 0: count += k + 1 print(count)
n = int(eval(input())) ans = 0 for i in range(1, n + 1): if i % 3 != 0 and i % 5 != 0: ans += i print(ans)
false
0
[ "-N = eval(input())", "-count: int = 0", "-for k in range(int(N)):", "- if (k + 1) % 3 != 0 and (k + 1) % 5 != 0:", "- count += k + 1", "-print(count)", "+n = int(eval(input()))", "+ans = 0", "+for i in range(1, n + 1):", "+ if i % 3 != 0 and i % 5 != 0:", "+ ans += i", "+p...
false
0.247419
0.175068
1.413278
[ "s922253867", "s404094031" ]
u038408819
p02726
python
s421345982
s398639066
1,614
515
206,856
78,172
Accepted
Accepted
68.09
N, X, Y = list(map(int, input().split())) g = [[] for i in range(N)] for i in range(N): u = i v = i + 1 if v < N: g[u].append(v) g[v].append(u) g[X - 1].append(Y - 1) g[Y - 1].append(X - 1) from collections import deque dis = [[float('Inf')] * N for _ in range(N)] count = ...
N, X, Y = list(map(int, input().split())) g = [[] for _ in range(N)] for i in range(N - 1): u = i v = i + 1 g[u].append(v) g[v].append(u) g[X - 1].append(Y - 1) g[Y - 1].append(X - 1) from collections import deque dis = [[0] * N for _ in range(N)] def bfs(i): visited = [False] * N ...
44
36
943
794
N, X, Y = list(map(int, input().split())) g = [[] for i in range(N)] for i in range(N): u = i v = i + 1 if v < N: g[u].append(v) g[v].append(u) g[X - 1].append(Y - 1) g[Y - 1].append(X - 1) from collections import deque dis = [[float("Inf")] * N for _ in range(N)] count = [0] * (N - 1) de...
N, X, Y = list(map(int, input().split())) g = [[] for _ in range(N)] for i in range(N - 1): u = i v = i + 1 g[u].append(v) g[v].append(u) g[X - 1].append(Y - 1) g[Y - 1].append(X - 1) from collections import deque dis = [[0] * N for _ in range(N)] def bfs(i): visited = [False] * N que = deque...
false
18.181818
[ "-g = [[] for i in range(N)]", "-for i in range(N):", "+g = [[] for _ in range(N)]", "+for i in range(N - 1):", "- if v < N:", "- g[u].append(v)", "- g[v].append(u)", "+ g[u].append(v)", "+ g[v].append(u)", "-dis = [[float(\"Inf\")] * N for _ in range(N)]", "-count = [0] *...
false
0.048359
0.07935
0.609448
[ "s421345982", "s398639066" ]
u697386253
p02727
python
s570222511
s050429171
293
251
23,328
23,328
Accepted
Accepted
14.33
x,y,a,b,c = list(map(int ,input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p = p[:x] q = q[:y] pq = p+q pq.sort(reverse=True) pqr = pq + r pqr.sort(reverse=True...
x,y,a,b,c = list(map(int ,input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p = p[:x] q = q[:y] pq = p+q pq.sort(reverse=True) pqr = pq + r pqr.sort(reverse=True...
23
20
384
353
x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p = p[:x] q = q[:y] pq = p + q pq.sort(reverse=True) pqr = pq + r pqr.sort(reverse=True) yamm = 0 for...
x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p = p[:x] q = q[:y] pq = p + q pq.sort(reverse=True) pqr = pq + r pqr.sort(reverse=True) yamm = sum(p...
false
13.043478
[ "-yamm = 0", "-for i in range(x + y):", "- yamm += pqr[i]", "+yamm = sum(pqr[: x + y])" ]
false
0.045134
0.04847
0.931162
[ "s570222511", "s050429171" ]
u197300773
p03061
python
s094826143
s761935406
313
197
14,052
14,400
Accepted
Accepted
37.06
def gcd(a, b): (x, lastx) = (0, 1) (y, lasty) = (1, 0) while b != 0: q = a // b (a, b) = (b, a % b) (x, lastx) = (lastx - q * x, x) (y, lasty) = (lasty - q * y, y) return a N=int(eval(input())) a=list(map(int,input().split())) l=[0]*N l[0]=a[0] for i in r...
def gcd(x, y): if y > x: x, y = y, x while y: x, y = y, x % y return x N=int(eval(input())) a=list(map(int,input().split())) l=[0]*N l[0]=a[0] for i in range(1,N): l[i]=gcd(l[i-1],a[i]) r=[0]*N r[N-1]=a[N-1] for i in range(N-2,-1,-1): r[i]=gcd(r[i+1],a[i]) ans...
29
26
544
419
def gcd(a, b): (x, lastx) = (0, 1) (y, lasty) = (1, 0) while b != 0: q = a // b (a, b) = (b, a % b) (x, lastx) = (lastx - q * x, x) (y, lasty) = (lasty - q * y, y) return a N = int(eval(input())) a = list(map(int, input().split())) l = [0] * N l[0] = a[0] for i in range...
def gcd(x, y): if y > x: x, y = y, x while y: x, y = y, x % y return x N = int(eval(input())) a = list(map(int, input().split())) l = [0] * N l[0] = a[0] for i in range(1, N): l[i] = gcd(l[i - 1], a[i]) r = [0] * N r[N - 1] = a[N - 1] for i in range(N - 2, -1, -1): r[i] = gcd(r[i +...
false
10.344828
[ "-def gcd(a, b):", "- (x, lastx) = (0, 1)", "- (y, lasty) = (1, 0)", "- while b != 0:", "- q = a // b", "- (a, b) = (b, a % b)", "- (x, lastx) = (lastx - q * x, x)", "- (y, lasty) = (lasty - q * y, y)", "- return a", "+def gcd(x, y):", "+ if y > x:", ...
false
0.038497
0.045099
0.853606
[ "s094826143", "s761935406" ]
u596276291
p03543
python
s016981634
s305044592
41
26
4,080
3,960
Accepted
Accepted
36.59
import sys from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt, ceil, floor from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_...
#!/usr/bin/python3 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_cac...
30
34
747
796
import sys from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt, ceil, floor from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache, ...
#!/usr/bin/python3 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...
false
11.764706
[ "-import sys", "+#!/usr/bin/python3", "-from math import pi, sqrt, ceil, floor", "+from math import pi, sqrt", "-from functools import lru_cache, reduce", "-from operator import xor", "+from functools import lru_cache", "+import sys", "+sys.setrecursionlimit(10000)", "-sys.setrecursionlimit(10**7)...
false
0.084942
0.112945
0.752067
[ "s016981634", "s305044592" ]
u221505564
p02945
python
s915123381
s362326987
165
17
38,384
2,940
Accepted
Accepted
89.7
a, b = list(map(int, input().split())) print((max([a + b, a - b, a * b])))
a,b=list(map(int,input().split())) print((max(a+b,a-b,a*b)))
2
2
67
53
a, b = list(map(int, input().split())) print((max([a + b, a - b, a * b])))
a, b = list(map(int, input().split())) print((max(a + b, a - b, a * b)))
false
0
[ "-print((max([a + b, a - b, a * b])))", "+print((max(a + b, a - b, a * b)))" ]
false
0.040373
0.038597
1.046015
[ "s915123381", "s362326987" ]
u561231954
p02834
python
s346720486
s507021419
1,484
653
282,428
117,032
Accepted
Accepted
56
def main(): from functools import lru_cache import sys input=sys.stdin.readline sys.setrecursionlimit(100000000) n,u,v=list(map(int,input().split())) u-=1 v-=1 tree=[[] for i in range(n)] for i in range(n-1): a,b=list(map(int,input().split())) a-=1 ...
def main(): import sys input=sys.stdin.readline sys.setrecursionlimit(100000000) n,u,v=list(map(int,input().split())) u-=1 v-=1 tree=[[] for i in range(n)] for i in range(n-1): a,b=list(map(int,input().split())) a-=1 b-=1 tree[a].append(b) ...
60
42
1,358
938
def main(): from functools import lru_cache import sys input = sys.stdin.readline sys.setrecursionlimit(100000000) n, u, v = list(map(int, input().split())) u -= 1 v -= 1 tree = [[] for i in range(n)] for i in range(n - 1): a, b = list(map(int, input().split())) a -=...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(100000000) n, u, v = list(map(int, input().split())) u -= 1 v -= 1 tree = [[] for i in range(n)] for i in range(n - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 tree[a].ap...
false
30
[ "- from functools import lru_cache", "- depth = [0] * n", "- depth[v] = 0", "+ depth_u = [0] * n # uからの距離", "+ depth_v = [0] * n # vからの距離", "- def dfs(i, before=-1):", "+ def dfs1(i, before=-1):", "- depth[e] = depth[i] + 1", "- dfs(e, i)", "+ ...
false
0.042465
0.042498
0.999215
[ "s346720486", "s507021419" ]
u546285759
p00314
python
s051333550
s028605385
50
40
7,796
7,732
Accepted
Accepted
20
from itertools import takewhile as T N = int(eval(input())) p = list(map(int, input().split())) score = [0] * 101 for x in p: score[x] += 1 print((len(list(T(lambda i: sum(score[i:]) >= i, list(range(1, 101)))))))
N = int(eval(input())) p = list(map(int, input().split())) score = [0] * 101 for x in p: score[x] += 1 i = 1 while sum(score[i:]) >= i: i += 1 print((i-1))
9
10
213
169
from itertools import takewhile as T N = int(eval(input())) p = list(map(int, input().split())) score = [0] * 101 for x in p: score[x] += 1 print((len(list(T(lambda i: sum(score[i:]) >= i, list(range(1, 101)))))))
N = int(eval(input())) p = list(map(int, input().split())) score = [0] * 101 for x in p: score[x] += 1 i = 1 while sum(score[i:]) >= i: i += 1 print((i - 1))
false
10
[ "-from itertools import takewhile as T", "-", "-print((len(list(T(lambda i: sum(score[i:]) >= i, list(range(1, 101)))))))", "+i = 1", "+while sum(score[i:]) >= i:", "+ i += 1", "+print((i - 1))" ]
false
0.043009
0.192379
0.223564
[ "s051333550", "s028605385" ]
u580697892
p02982
python
s555933357
s857075957
20
17
3,316
3,188
Accepted
Accepted
15
# coding: utf-8 N, D = list(map(int, input().split())) X = [] ans = 0 for i in range(N): X.append(list(map(int, input().split()))) for i in range(N): for j in range(N): dist = 0 if i == j: continue for d in range(D): dist += ((X[i][d] - X[j][d])**2) ...
# coding: utf-8 N, D = list(map(int, input().split())) ans = 0 X = [] for i in range(N): x = list(map(int, input().split())) X.append(x[:]) for i in range(N - 1): for j in range(i+1, N): tmp = 0 for k in range(D): tmp += (X[i][k] - X[j][k]) ** 2 if int(tmp ** ...
16
15
389
367
# coding: utf-8 N, D = list(map(int, input().split())) X = [] ans = 0 for i in range(N): X.append(list(map(int, input().split()))) for i in range(N): for j in range(N): dist = 0 if i == j: continue for d in range(D): dist += (X[i][d] - X[j][d]) ** 2 if dis...
# coding: utf-8 N, D = list(map(int, input().split())) ans = 0 X = [] for i in range(N): x = list(map(int, input().split())) X.append(x[:]) for i in range(N - 1): for j in range(i + 1, N): tmp = 0 for k in range(D): tmp += (X[i][k] - X[j][k]) ** 2 if int(tmp**0.5) == tmp*...
false
6.25
[ "+ans = 0", "-ans = 0", "- X.append(list(map(int, input().split())))", "-for i in range(N):", "- for j in range(N):", "- dist = 0", "- if i == j:", "- continue", "- for d in range(D):", "- dist += (X[i][d] - X[j][d]) ** 2", "- if dist**0.5 ...
false
0.037989
0.043986
0.863682
[ "s555933357", "s857075957" ]
u077291787
p04019
python
s641344347
s960590186
21
18
3,316
2,940
Accepted
Accepted
14.29
# AGC003A - Wanna go back home from collections import Counter def main(): D = Counter(input().rstrip()) flg = True if ( (D["N"] != 0 and D["S"] == 0) or (D["N"] == 0 and D["S"] != 0) or (D["E"] != 0 and D["W"] == 0) or (D["E"] == 0 and D["W"] != 0) ): ...
# AGC003A - Wanna go back home def main(): S = input().rstrip() flg = (("N" in S) ^ ("S" in S) ^ 1) & (("E" in S) ^ ("W" in S) ^ 1) print(("Yes" if flg else "No")) if __name__ == "__main__": main()
19
9
414
221
# AGC003A - Wanna go back home from collections import Counter def main(): D = Counter(input().rstrip()) flg = True if ( (D["N"] != 0 and D["S"] == 0) or (D["N"] == 0 and D["S"] != 0) or (D["E"] != 0 and D["W"] == 0) or (D["E"] == 0 and D["W"] != 0) ): flg = Fal...
# AGC003A - Wanna go back home def main(): S = input().rstrip() flg = (("N" in S) ^ ("S" in S) ^ 1) & (("E" in S) ^ ("W" in S) ^ 1) print(("Yes" if flg else "No")) if __name__ == "__main__": main()
false
52.631579
[ "-from collections import Counter", "-", "-", "- D = Counter(input().rstrip())", "- flg = True", "- if (", "- (D[\"N\"] != 0 and D[\"S\"] == 0)", "- or (D[\"N\"] == 0 and D[\"S\"] != 0)", "- or (D[\"E\"] != 0 and D[\"W\"] == 0)", "- or (D[\"E\"] == 0 and D[\"W\...
false
0.037102
0.03712
0.999514
[ "s641344347", "s960590186" ]
u017810624
p02659
python
s331721313
s766972200
85
64
71,288
61,740
Accepted
Accepted
24.71
import decimal a,b=input().split() print((int(int(a)*decimal.Decimal(b))))
a,b=input().split() b=list(b) b.remove('.') b=''.join(b) print((int(a)*int(b)//100))
3
5
74
86
import decimal a, b = input().split() print((int(int(a) * decimal.Decimal(b))))
a, b = input().split() b = list(b) b.remove(".") b = "".join(b) print((int(a) * int(b) // 100))
false
40
[ "-import decimal", "-", "-print((int(int(a) * decimal.Decimal(b))))", "+b = list(b)", "+b.remove(\".\")", "+b = \"\".join(b)", "+print((int(a) * int(b) // 100))" ]
false
0.041823
0.047074
0.888451
[ "s331721313", "s766972200" ]
u063052907
p03796
python
s644419191
s753442679
42
35
2,940
2,940
Accepted
Accepted
16.67
# coding: utf-8 ans = 1 for i in range(1, int(eval(input()))+1): ans *= i ans %= (10**9 + 7) print(ans)
# coding: utf-8 ans = 1 n_mod = 10**9 + 7 for i in range(1, int(eval(input()))+1): ans = (ans * i) % n_mod print(ans)
6
6
110
121
# coding: utf-8 ans = 1 for i in range(1, int(eval(input())) + 1): ans *= i ans %= 10**9 + 7 print(ans)
# coding: utf-8 ans = 1 n_mod = 10**9 + 7 for i in range(1, int(eval(input())) + 1): ans = (ans * i) % n_mod print(ans)
false
0
[ "+n_mod = 10**9 + 7", "- ans *= i", "- ans %= 10**9 + 7", "+ ans = (ans * i) % n_mod" ]
false
0.049048
0.049352
0.993849
[ "s644419191", "s753442679" ]
u716530146
p02900
python
s997228232
s994358115
421
159
14,184
5,048
Accepted
Accepted
62.23
#!/usr/bin/env python3 import numpy as np def is_prime(n): if n == 1: return False for i in range(2, int(n**0.5)+1): if n % i == 0: return False return True def seachPrimeNum(N): max = int(np.sqrt(N)) seachList = [i for i in range(2, N+1)] primeNum =...
#!/usr/bin/env python3 from fractions import gcd def prime_factor(n): ass = [] for i in range(2,int(n**0.5)+1): count=0 while n % i==0: count+=1 n = n//i if count!=0: ass.append((i,count)) if n != 1: ass.append((n,1)) retur...
82
19
1,865
410
#!/usr/bin/env python3 import numpy as np def is_prime(n): if n == 1: return False for i in range(2, int(n**0.5) + 1): if n % i == 0: return False return True def seachPrimeNum(N): max = int(np.sqrt(N)) seachList = [i for i in range(2, N + 1)] primeNum = [] wh...
#!/usr/bin/env python3 from fractions import gcd def prime_factor(n): ass = [] for i in range(2, int(n**0.5) + 1): count = 0 while n % i == 0: count += 1 n = n // i if count != 0: ass.append((i, count)) if n != 1: ass.append((n, 1)) r...
false
76.829268
[ "-import numpy as np", "+from fractions import gcd", "-def is_prime(n):", "- if n == 1:", "- return False", "+def prime_factor(n):", "+ ass = []", "- if n % i == 0:", "- return False", "- return True", "-", "-", "-def seachPrimeNum(N):", "- max = int(np...
false
0.221254
0.048389
4.572375
[ "s997228232", "s994358115" ]
u040537497
p03013
python
s015247950
s287323814
224
116
46,808
11,884
Accepted
Accepted
48.21
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a_set = {int(eval(input())) for _ in range(m)} ans_list = [] ans_list = [0] * (n + 1) for index in range(n + 1): if index == 0: ans_list[index] += 1 continue if index == 1 and (index not in a_set): ...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a = {int(eval(input())) for _ in range(m)} count = 0 stair = [0] * (n + 1) for index, value in enumerate(stair): if index == 0: stair[index] = 1 continue if index == 1: if index - 1 not in...
28
29
691
620
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a_set = {int(eval(input())) for _ in range(m)} ans_list = [] ans_list = [0] * (n + 1) for index in range(n + 1): if index == 0: ans_list[index] += 1 continue if index == 1 and (index not in a_set): ans_list[ind...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) a = {int(eval(input())) for _ in range(m)} count = 0 stair = [0] * (n + 1) for index, value in enumerate(stair): if index == 0: stair[index] = 1 continue if index == 1: if index - 1 not in a: stair[...
false
3.448276
[ "-a_set = {int(eval(input())) for _ in range(m)}", "-ans_list = []", "-ans_list = [0] * (n + 1)", "-for index in range(n + 1):", "+a = {int(eval(input())) for _ in range(m)}", "+count = 0", "+stair = [0] * (n + 1)", "+for index, value in enumerate(stair):", "- ans_list[index] += 1", "+ ...
false
0.00723
0.037572
0.192433
[ "s015247950", "s287323814" ]
u860002137
p02880
python
s736303071
s246562622
28
25
9,168
9,168
Accepted
Accepted
10.71
n = int(eval(input())) print(("Yes" if any([n == x * y for x in range(1, 10) for y in range(1, 10)]) else "No"))
n = int(eval(input())) print(("Yes" if sum([n == x * y for x in range(1, 10) for y in range(1, 10)]) else "No"))
2
2
105
105
n = int(eval(input())) print( ("Yes" if any([n == x * y for x in range(1, 10) for y in range(1, 10)]) else "No") )
n = int(eval(input())) print( ("Yes" if sum([n == x * y for x in range(1, 10) for y in range(1, 10)]) else "No") )
false
0
[ "- (\"Yes\" if any([n == x * y for x in range(1, 10) for y in range(1, 10)]) else \"No\")", "+ (\"Yes\" if sum([n == x * y for x in range(1, 10) for y in range(1, 10)]) else \"No\")" ]
false
0.036434
0.038026
0.958117
[ "s736303071", "s246562622" ]
u825981710
p03061
python
s184881263
s118583453
192
174
14,584
16,132
Accepted
Accepted
9.38
def gcd(a,b): if b==0: return a return gcd(b,a%b) N=int(eval(input())) A=list(map(int,input().split())) L=[0,0]#why for ai in A: L.append(gcd(L[-1],ai)) #print(L) R=[0,0]#why for ai in A[::-1]: R.append(gcd(R[-1],ai)) #print(R) #下のやつの解明 max=0 for l,r in zip(L,reversed...
#coding:utf-8 import fractions def main(): N=int(eval(input())) num=list(map(int,input().split())) gcd=0 gcd_list_front=[] gcd_list_back=[] gcd_list_front.append(num[0]) gcd_list_back.append(num[-1]) for i in range(1,N-1): gcd_list_front.append(fractions.gcd(gcd_l...
23
27
378
700
def gcd(a, b): if b == 0: return a return gcd(b, a % b) N = int(eval(input())) A = list(map(int, input().split())) L = [0, 0] # why for ai in A: L.append(gcd(L[-1], ai)) # print(L) R = [0, 0] # why for ai in A[::-1]: R.append(gcd(R[-1], ai)) # print(R) # 下のやつの解明 max = 0 for l, r in z...
# coding:utf-8 import fractions def main(): N = int(eval(input())) num = list(map(int, input().split())) gcd = 0 gcd_list_front = [] gcd_list_back = [] gcd_list_front.append(num[0]) gcd_list_back.append(num[-1]) for i in range(1, N - 1): gcd_list_front.append(fractions.gcd(gcd_...
false
14.814815
[ "-def gcd(a, b):", "- if b == 0:", "- return a", "- return gcd(b, a % b)", "+# coding:utf-8", "+import fractions", "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-L = [0, 0] # why", "-for ai in A:", "- L.append(gcd(L[-1], ai))", "- # print(L)", "-R = ...
false
0.042543
0.150047
0.283532
[ "s184881263", "s118583453" ]
u391875425
p03425
python
s595002479
s580505276
180
85
9,776
9,904
Accepted
Accepted
52.78
import itertools N = int(eval(input())) S = [eval(input()) for _ in range(N)] caps = ['M', 'A', 'R', 'C', 'H'] a = [0] * 5 ans = 0 for s in S: if s[0] in caps: a[caps.index(s[0])] += 1 c = list(itertools.combinations((0, 1, 2, 3, 4), 3)) for i in range(len(c)): ans += a[c[i][0]] * a[c[i][1]] ...
import sys import itertools N = int(eval(input())) S = [sys.stdin.readline() for _ in range(N)] caps = ['M', 'A', 'R', 'C', 'H'] a = [0] * 5 ans = 0 for s in S: if s[0] in caps: a[caps.index(s[0])] += 1 c = list(itertools.combinations((0, 1, 2, 3, 4), 3)) for i in range(len(c)): ans += a[c[i...
13
14
332
357
import itertools N = int(eval(input())) S = [eval(input()) for _ in range(N)] caps = ["M", "A", "R", "C", "H"] a = [0] * 5 ans = 0 for s in S: if s[0] in caps: a[caps.index(s[0])] += 1 c = list(itertools.combinations((0, 1, 2, 3, 4), 3)) for i in range(len(c)): ans += a[c[i][0]] * a[c[i][1]] * a[c[i][2...
import sys import itertools N = int(eval(input())) S = [sys.stdin.readline() for _ in range(N)] caps = ["M", "A", "R", "C", "H"] a = [0] * 5 ans = 0 for s in S: if s[0] in caps: a[caps.index(s[0])] += 1 c = list(itertools.combinations((0, 1, 2, 3, 4), 3)) for i in range(len(c)): ans += a[c[i][0]] * a[c...
false
7.142857
[ "+import sys", "-S = [eval(input()) for _ in range(N)]", "+S = [sys.stdin.readline() for _ in range(N)]" ]
false
0.036358
0.036675
0.991359
[ "s595002479", "s580505276" ]
u716530146
p02793
python
s445753631
s752304836
573
386
131,596
52,700
Accepted
Accepted
32.64
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 class InverseTable: __slots__ = ['In', 'fac', 'Ifac'] def __init__(self, mod, maxnum):...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 class InverseTable: __slots__ = ['In', 'fac', 'Ifac'] def __init__(self, mod, maxnum):...
51
51
1,408
1,416
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 class InverseTable: __slots__ = ["In", "fac", "Ifac"] def __init__(self, mod, maxnum): ...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 class InverseTable: __slots__ = ["In", "fac", "Ifac"] def __init__(self, mod, maxnum): ...
false
0
[ "-invt = InverseTable(mod, 10**6)", "-", "-", "+# invt = InverseTable(mod, 10**6)", "- ans += invt.In[ai]", "+ ans += pow(ai, mod - 2, mod)" ]
false
2.766143
0.84932
3.25689
[ "s445753631", "s752304836" ]
u315485238
p03674
python
s295784426
s442133796
1,997
1,279
31,368
31,316
Accepted
Accepted
35.95
n = int(eval(input())) A= list(map(int, input().split())) mod = int(1e9+7) def powermod(p,n,mod): #if n==0: return 1 if n==1: return p%mod if n%2: return powermod(p,n//2,mod)**2 * p %mod else: return powermod(p,n//2,mod)**2 %mod memo={} for i, a in enumerate(A):...
n = int(eval(input())) A= list(map(int, input().split())) mod = int(1e9+7) def powermod(a, n, mod): r = 1 while n>=1: if n%2: r = (r*a)%mod a = (a*a)%mod n = n//2 return r memo={} for i, a in enumerate(A): if a in memo: L = memo[a] C = i - m...
61
60
1,280
1,232
n = int(eval(input())) A = list(map(int, input().split())) mod = int(1e9 + 7) def powermod(p, n, mod): # if n==0: return 1 if n == 1: return p % mod if n % 2: return powermod(p, n // 2, mod) ** 2 * p % mod else: return powermod(p, n // 2, mod) ** 2 % mod memo = {} for i, a in...
n = int(eval(input())) A = list(map(int, input().split())) mod = int(1e9 + 7) def powermod(a, n, mod): r = 1 while n >= 1: if n % 2: r = (r * a) % mod a = (a * a) % mod n = n // 2 return r memo = {} for i, a in enumerate(A): if a in memo: L = memo[a] ...
false
1.639344
[ "-def powermod(p, n, mod):", "- # if n==0: return 1", "- if n == 1:", "- return p % mod", "- if n % 2:", "- return powermod(p, n // 2, mod) ** 2 * p % mod", "- else:", "- return powermod(p, n // 2, mod) ** 2 % mod", "+def powermod(a, n, mod):", "+ r = 1", "+ ...
false
0.046958
0.062219
0.754713
[ "s295784426", "s442133796" ]
u670180528
p03273
python
s668699000
s794963221
30
19
4,468
3,188
Accepted
Accepted
36.67
h,w=map(int,input().split()) *l,=eval("input(),"*h) row=[any(l[i][j]=="#" for i in range(h)) for j in range(w)] col=["#" in l[i] for i in range(h)] for i in range(h): f=0 for j in range(w): if row[j]&col[i]: print(l[i][j],end="") f=1 if f: print("")
h,w=list(map(int,input().split())) g=[list(eval(input())) for _ in range(h)] gg=[] for l in zip(*g): if not all(x=="." for x in l): gg.append(l) ggg=[] for l in zip(*gg): if not all(x=="." for x in l): print(("".join(l)))
12
10
273
222
h, w = map(int, input().split()) (*l,) = eval("input()," * h) row = [any(l[i][j] == "#" for i in range(h)) for j in range(w)] col = ["#" in l[i] for i in range(h)] for i in range(h): f = 0 for j in range(w): if row[j] & col[i]: print(l[i][j], end="") f = 1 if f: print...
h, w = list(map(int, input().split())) g = [list(eval(input())) for _ in range(h)] gg = [] for l in zip(*g): if not all(x == "." for x in l): gg.append(l) ggg = [] for l in zip(*gg): if not all(x == "." for x in l): print(("".join(l)))
false
16.666667
[ "-h, w = map(int, input().split())", "-(*l,) = eval(\"input(),\" * h)", "-row = [any(l[i][j] == \"#\" for i in range(h)) for j in range(w)]", "-col = [\"#\" in l[i] for i in range(h)]", "-for i in range(h):", "- f = 0", "- for j in range(w):", "- if row[j] & col[i]:", "- prin...
false
0.040532
0.040029
1.012564
[ "s668699000", "s794963221" ]
u057109575
p02642
python
s350716498
s946007443
233
208
132,488
134,540
Accepted
Accepted
10.73
N = int(eval(input())) X = list(map(int, input().split())) MAX = 10 ** 6 + 1 prime = [True] * MAX counted = set() for v in X: if v in counted: prime[v] = False continue for j in range(2 * v, MAX, v): prime[j] = False counted.add(v) ans = 0 for v in X: ans += i...
from collections import Counter N = int(eval(input())) X = list(map(int, input().split())) lim = 10 ** 6 + 10 ok = [True] * (lim + 1) ans = 0 ctr = Counter(X) for n in sorted(X): if ok[n]: if ctr[n] == 1: ans += 1 for j in range(n, lim + 1, n): ok[j] = Fal...
19
19
339
331
N = int(eval(input())) X = list(map(int, input().split())) MAX = 10**6 + 1 prime = [True] * MAX counted = set() for v in X: if v in counted: prime[v] = False continue for j in range(2 * v, MAX, v): prime[j] = False counted.add(v) ans = 0 for v in X: ans += int(prime[v]) print(ans...
from collections import Counter N = int(eval(input())) X = list(map(int, input().split())) lim = 10**6 + 10 ok = [True] * (lim + 1) ans = 0 ctr = Counter(X) for n in sorted(X): if ok[n]: if ctr[n] == 1: ans += 1 for j in range(n, lim + 1, n): ok[j] = False print(ans)
false
0
[ "+from collections import Counter", "+", "-MAX = 10**6 + 1", "-prime = [True] * MAX", "-counted = set()", "-for v in X:", "- if v in counted:", "- prime[v] = False", "- continue", "- for j in range(2 * v, MAX, v):", "- prime[j] = False", "- counted.add(v)", "+li...
false
0.276382
0.155418
1.778309
[ "s350716498", "s946007443" ]
u094815239
p03244
python
s698032710
s404739761
144
124
15,588
15,588
Accepted
Accepted
13.89
from collections import Counter n = int(input().strip()) a = list(map(int, input().strip().split())) cnt1 = Counter(a[::2]).most_common(2) c11, c12 = (cnt1 if len(cnt1) == 2 else cnt1+[('', 0)]) cnt2 = Counter(a[1::2]).most_common(2) c21, c22 = (cnt2 if len(cnt2) == 2 else cnt2+[('', 0)]) if c11[0] != c21[0]: ...
from collections import Counter n = int(input().strip()) a = list(map(int, input().strip().split())) cnt1 = Counter(a[::2]).most_common(2) c11, c12 = (cnt1 if len(cnt1) == 2 else cnt1+[('', 0)]) cnt2 = Counter(a[1::2]).most_common(2) c21, c22 = (cnt2 if len(cnt2) == 2 else cnt2+[('', 0)]) if c11[0] != c21[0]: ...
12
13
408
417
from collections import Counter n = int(input().strip()) a = list(map(int, input().strip().split())) cnt1 = Counter(a[::2]).most_common(2) c11, c12 = cnt1 if len(cnt1) == 2 else cnt1 + [("", 0)] cnt2 = Counter(a[1::2]).most_common(2) c21, c22 = cnt2 if len(cnt2) == 2 else cnt2 + [("", 0)] if c11[0] != c21[0]: prin...
from collections import Counter n = int(input().strip()) a = list(map(int, input().strip().split())) cnt1 = Counter(a[::2]).most_common(2) c11, c12 = cnt1 if len(cnt1) == 2 else cnt1 + [("", 0)] cnt2 = Counter(a[1::2]).most_common(2) c21, c22 = cnt2 if len(cnt2) == 2 else cnt2 + [("", 0)] if c11[0] != c21[0]: prin...
false
7.692308
[ "+print()" ]
false
0.044092
0.089468
0.492824
[ "s698032710", "s404739761" ]
u644907318
p02756
python
s739800615
s009914291
316
289
103,828
96,536
Accepted
Accepted
8.54
from collections import deque S = deque(list(input().strip())) Q = int(eval(input())) P = 0 for _ in range(Q): q = list(input().split()) if q[0]=="1": P += 1 P = P%2 else: c = q[2] if q[1]=="1": if P==0: S.appendleft(c) el...
S = input().strip() Q = int(eval(input())) ind = 1 x = [] y = [] for i in range(Q): q = list(input().split()) if len(q)==1: ind = ind*(-1) else: if q[1]=="1": if ind>0: x.append(q[2]) else: y.append(q[2]) else: ...
25
28
527
562
from collections import deque S = deque(list(input().strip())) Q = int(eval(input())) P = 0 for _ in range(Q): q = list(input().split()) if q[0] == "1": P += 1 P = P % 2 else: c = q[2] if q[1] == "1": if P == 0: S.appendleft(c) else: ...
S = input().strip() Q = int(eval(input())) ind = 1 x = [] y = [] for i in range(Q): q = list(input().split()) if len(q) == 1: ind = ind * (-1) else: if q[1] == "1": if ind > 0: x.append(q[2]) else: y.append(q[2]) else: ...
false
10.714286
[ "-from collections import deque", "-", "-S = deque(list(input().strip()))", "+S = input().strip()", "-P = 0", "-for _ in range(Q):", "+ind = 1", "+x = []", "+y = []", "+for i in range(Q):", "- if q[0] == \"1\":", "- P += 1", "- P = P % 2", "+ if len(q) == 1:", "+ ...
false
0.036122
0.070239
0.514274
[ "s739800615", "s009914291" ]
u329565519
p02927
python
s093502363
s291524097
29
20
3,060
2,940
Accepted
Accepted
31.03
M, D = list(map(int, input().split())) count = 0 for m in range(1, M + 1): for d in range(1, D + 1): d1 = int(str(d).zfill(2)[1]) d10 = int(str(d).zfill(2)[0]) if d1 >= 2 and d10 >= 2 and d1 * d10 == m: count += 1 print(count)
M, D = list(map(int, input().split())) count = 0 for m in range(1, M + 1): for d in range(1, D + 1): d10, d1 = divmod(d, 10) if d1 >= 2 and d10 >= 2 and d1 * d10 == m: count += 1 print(count)
10
9
271
227
M, D = list(map(int, input().split())) count = 0 for m in range(1, M + 1): for d in range(1, D + 1): d1 = int(str(d).zfill(2)[1]) d10 = int(str(d).zfill(2)[0]) if d1 >= 2 and d10 >= 2 and d1 * d10 == m: count += 1 print(count)
M, D = list(map(int, input().split())) count = 0 for m in range(1, M + 1): for d in range(1, D + 1): d10, d1 = divmod(d, 10) if d1 >= 2 and d10 >= 2 and d1 * d10 == m: count += 1 print(count)
false
10
[ "- d1 = int(str(d).zfill(2)[1])", "- d10 = int(str(d).zfill(2)[0])", "+ d10, d1 = divmod(d, 10)" ]
false
0.035125
0.035678
0.984478
[ "s093502363", "s291524097" ]
u150984829
p00110
python
s425912735
s574983342
30
20
5,620
5,620
Accepted
Accepted
33.33
import sys for e in sys.stdin: for i in'0123456789'[(e[0]=='X')*(e[1]!='+')or('+X'in e)*('+X='not in e):]: l,r=e.replace('X',i).split('=') if eval(l)==int(r):print(i);break else:print('NA')
import sys p,t='+X' for e in sys.stdin: for i in'0123456789'[(e[0]==t)*(e[1]!=p)or(p+t in e)*('+X='not in e):]: l,r=e.replace(t,i).split('=') if sum(map(int,l.split(p)))==int(r):print(i);break else:print('NA')
6
7
201
222
import sys for e in sys.stdin: for i in "0123456789"[ (e[0] == "X") * (e[1] != "+") or ("+X" in e) * ("+X=" not in e) : ]: l, r = e.replace("X", i).split("=") if eval(l) == int(r): print(i) break else: print("NA")
import sys p, t = "+X" for e in sys.stdin: for i in "0123456789"[ (e[0] == t) * (e[1] != p) or (p + t in e) * ("+X=" not in e) : ]: l, r = e.replace(t, i).split("=") if sum(map(int, l.split(p))) == int(r): print(i) break else: print("NA")
false
14.285714
[ "+p, t = \"+X\"", "- (e[0] == \"X\") * (e[1] != \"+\") or (\"+X\" in e) * (\"+X=\" not in e) :", "+ (e[0] == t) * (e[1] != p) or (p + t in e) * (\"+X=\" not in e) :", "- l, r = e.replace(\"X\", i).split(\"=\")", "- if eval(l) == int(r):", "+ l, r = e.replace(t, i).split(...
false
0.043705
0.044104
0.990964
[ "s425912735", "s574983342" ]
u173148629
p02713
python
s516331409
s777168353
1,235
21
9,108
9,124
Accepted
Accepted
98.3
from math import gcd K=int(eval(input())) s=0 for i in range(1,K+1): for j in range(1,K+1): a=gcd(i,j) for k in range(1,K+1): s+=gcd(a,k) print(s)
from math import gcd K=int(eval(input())) A=[0]*K for i in range(K,0,-1): b=pow(K//i,3) A[i-1]=b for i in range(K,0,-1): for j in range(K//i-1): c=i*(j+2) A[i-1]-=A[c-1] s=0 for i in range(K): s+=A[i]*(i+1) print(s)
12
19
188
265
from math import gcd K = int(eval(input())) s = 0 for i in range(1, K + 1): for j in range(1, K + 1): a = gcd(i, j) for k in range(1, K + 1): s += gcd(a, k) print(s)
from math import gcd K = int(eval(input())) A = [0] * K for i in range(K, 0, -1): b = pow(K // i, 3) A[i - 1] = b for i in range(K, 0, -1): for j in range(K // i - 1): c = i * (j + 2) A[i - 1] -= A[c - 1] s = 0 for i in range(K): s += A[i] * (i + 1) print(s)
false
36.842105
[ "+A = [0] * K", "+for i in range(K, 0, -1):", "+ b = pow(K // i, 3)", "+ A[i - 1] = b", "+for i in range(K, 0, -1):", "+ for j in range(K // i - 1):", "+ c = i * (j + 2)", "+ A[i - 1] -= A[c - 1]", "-for i in range(1, K + 1):", "- for j in range(1, K + 1):", "- a...
false
0.182169
0.039958
4.559065
[ "s516331409", "s777168353" ]
u542863225
p03043
python
s263933667
s406704592
67
30
3,064
3,064
Accepted
Accepted
55.22
import sys n=eval(input()) num = n.split() a=int(num[0]) b=int(num[1]) def checkMultiNum(base, dst): num=0 while True: if base >= dst: break; num+=1 base = base * 2 if base >= dst: break; return num prob=1/a res=0 for v in range(a): num = checkMultiNum(v+1, b) tmp = prob * 0....
import sys n=eval(input()) num = n.split() a=int(num[0]) b=int(num[1]) def checkMultiNum(base, dst): num=0 while True: if base >= dst: break; num+=1 base = base * 2 if base >= dst: break; return num prob=1/a res=0 if a >= b: res=prob*(a-(b-1)) for v in range(a): if v+1 >= b:...
26
30
347
405
import sys n = eval(input()) num = n.split() a = int(num[0]) b = int(num[1]) def checkMultiNum(base, dst): num = 0 while True: if base >= dst: break num += 1 base = base * 2 if base >= dst: break return num prob = 1 / a res = 0 for v in range(a): ...
import sys n = eval(input()) num = n.split() a = int(num[0]) b = int(num[1]) def checkMultiNum(base, dst): num = 0 while True: if base >= dst: break num += 1 base = base * 2 if base >= dst: break return num prob = 1 / a res = 0 if a >= b: res ...
false
13.333333
[ "+if a >= b:", "+ res = prob * (a - (b - 1))", "+ if v + 1 >= b:", "+ break" ]
false
0.042262
0.1246
0.339182
[ "s263933667", "s406704592" ]
u687044304
p02995
python
s311406653
s312318664
40
35
5,240
5,076
Accepted
Accepted
12.5
# -*- coding:utf-8 -*- """解説 B以下の整数のうち、CでもDでも割り切れないものの個数をCountBとする A以下の整数のうち、CでもDでも割り切れないものの個数をCountAとする 求める答えは、CountB - CountA ・CountBの求め方 B以下の整数のうち、Cで割り切れるものの個数はCountB_C = B//C B以下の整数のうち、Dで割り切れるものの個数はCountB_D = B//D B以下の整数のうち、CでもDでも割り切れるものの個数はCountB_CD = B//lcm(C,D) CountB = B - (CountB_C + CountB_D - ...
# -*- coding:utf-8 -*- """解説 B以下の整数のうち、CでもDでも割り切れないものの個数をCountBとする A以下の整数のうち、CでもDでも割り切れないものの個数をCountAとする 求める答えは、CountB - CountA ・CountBの求め方 B以下の整数のうち、Cで割り切れるものの個数はCountB_C = B//C B以下の整数のうち、Dで割り切れるものの個数はCountB_D = B//D B以下の整数のうち、CでもDでも割り切れるものの個数はCountB_CD = B//lcm(C,D) CountB = B - (CountB_C + CountB_D - ...
34
36
724
811
# -*- coding:utf-8 -*- """解説 B以下の整数のうち、CでもDでも割り切れないものの個数をCountBとする A以下の整数のうち、CでもDでも割り切れないものの個数をCountAとする 求める答えは、CountB - CountA ・CountBの求め方 B以下の整数のうち、Cで割り切れるものの個数はCountB_C = B//C B以下の整数のうち、Dで割り切れるものの個数はCountB_D = B//D B以下の整数のうち、CでもDでも割り切れるものの個数はCountB_CD = B//lcm(C,D) CountB = B - (CountB_C + CountB_D - CountB_CD) """ ...
# -*- coding:utf-8 -*- """解説 B以下の整数のうち、CでもDでも割り切れないものの個数をCountBとする A以下の整数のうち、CでもDでも割り切れないものの個数をCountAとする 求める答えは、CountB - CountA ・CountBの求め方 B以下の整数のうち、Cで割り切れるものの個数はCountB_C = B//C B以下の整数のうち、Dで割り切れるものの個数はCountB_D = B//D B以下の整数のうち、CでもDでも割り切れるものの個数はCountB_CD = B//lcm(C,D) CountB = B - (CountB_C + CountB_D - CountB_CD) """ ...
false
5.555556
[ "+from math import floor", "+ # return x - (floor(x/C) + floor(x/D) - floor(x/lcm(C,D)))" ]
false
0.121955
0.095074
1.282734
[ "s311406653", "s312318664" ]
u777923818
p02912
python
s787866701
s054857987
806
422
92,696
24,848
Accepted
Accepted
47.64
# -*- coding: utf-8 -*- from heapq import heappop, heappush, heapify import sys #input = sys.stdin.readline def inpl(): return list(map(int, input().split())) N, M = inpl() A = inpl() Q = [[-A[i], A[i], 0] for i in range(N)] F = 2 heapify(Q) for _ in range(M): b, a, x = heappop(Q) if b: ...
from heapq import heappop, heappush def inpl(): return list(map(int, input().split())) N, M = inpl() A = inpl() Q = [] for a in A: heappush(Q, [-a, a, 0]) for i in range(M): x, a, d = heappop(Q) if x == 0: break heappush(Q, [-(a//pow(2, d+1)), a, d+1]) print((sum([-q[0] for q in ...
23
15
434
323
# -*- coding: utf-8 -*- from heapq import heappop, heappush, heapify import sys # input = sys.stdin.readline def inpl(): return list(map(int, input().split())) N, M = inpl() A = inpl() Q = [[-A[i], A[i], 0] for i in range(N)] F = 2 heapify(Q) for _ in range(M): b, a, x = heappop(Q) if b: b = a //...
from heapq import heappop, heappush def inpl(): return list(map(int, input().split())) N, M = inpl() A = inpl() Q = [] for a in A: heappush(Q, [-a, a, 0]) for i in range(M): x, a, d = heappop(Q) if x == 0: break heappush(Q, [-(a // pow(2, d + 1)), a, d + 1]) print((sum([-q[0] for q in Q]...
false
34.782609
[ "-# -*- coding: utf-8 -*-", "-from heapq import heappop, heappush, heapify", "-import sys", "+from heapq import heappop, heappush", "-# input = sys.stdin.readline", "+", "-Q = [[-A[i], A[i], 0] for i in range(N)]", "-F = 2", "-heapify(Q)", "-for _ in range(M):", "- b, a, x = heappop(Q)", "-...
false
0.049267
0.036894
1.335365
[ "s787866701", "s054857987" ]
u450956662
p03295
python
s761482240
s755966850
469
303
29,844
22,836
Accepted
Accepted
35.39
N, M = list(map(int, input().split())) B = [] for m in range(M): B.append(list(map(int, input().split()))) B = sorted(B, key=lambda x: x[1]) check = [B[0][1]-1] for a, b in B: if a <= check[-1]: continue check.append(b-1) print((len(check)))
N, M = list(map(int, input().split())) B = [tuple(map(int, input().split())) for _ in range(M)] B.sort() r = 0 res = 0 for a, b in B: if a >= r: res += 1 r = b else: r = min(r, b) print(res)
13
12
267
228
N, M = list(map(int, input().split())) B = [] for m in range(M): B.append(list(map(int, input().split()))) B = sorted(B, key=lambda x: x[1]) check = [B[0][1] - 1] for a, b in B: if a <= check[-1]: continue check.append(b - 1) print((len(check)))
N, M = list(map(int, input().split())) B = [tuple(map(int, input().split())) for _ in range(M)] B.sort() r = 0 res = 0 for a, b in B: if a >= r: res += 1 r = b else: r = min(r, b) print(res)
false
7.692308
[ "-B = []", "-for m in range(M):", "- B.append(list(map(int, input().split())))", "-B = sorted(B, key=lambda x: x[1])", "-check = [B[0][1] - 1]", "+B = [tuple(map(int, input().split())) for _ in range(M)]", "+B.sort()", "+r = 0", "+res = 0", "- if a <= check[-1]:", "- continue", "-...
false
0.034568
0.034389
1.005182
[ "s761482240", "s755966850" ]
u968166680
p02862
python
s070598216
s456458237
120
95
3,064
3,064
Accepted
Accepted
20.83
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 def mod_com_once(n, r, MOD): if n < r: return 0 if n < 0 or r < 0: return 0 r = min(r, n - r) numer = denom = 1 for i in rang...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 def mod_com_once(n, r, MOD): if n < r: return 0 if n < 0 or r < 0: return 0 r = min(r, n - r) numer = denom = 1 for i in rang...
39
40
768
797
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 def mod_com_once(n, r, MOD): if n < r: return 0 if n < 0 or r < 0: return 0 r = min(r, n - r) numer = denom = 1 for i in range(1, r + 1): ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 def mod_com_once(n, r, MOD): if n < r: return 0 if n < 0 or r < 0: return 0 r = min(r, n - r) numer = denom = 1 for i in range(n - r + 1, n + 1...
false
2.5
[ "+ for i in range(n - r + 1, n + 1):", "+ numer = numer * i % MOD", "- numer = numer * (n - r + i) % MOD" ]
false
0.054323
0.081579
0.665889
[ "s070598216", "s456458237" ]
u723792785
p02699
python
s217759207
s252622479
22
20
9,156
9,096
Accepted
Accepted
9.09
s,w = list(map(int,input().split())) print((["safe","unsafe"][w>=s]))
s,w=list(map(int,input().split()));print((["","un"][w>=s]+"safe"))
2
1
62
58
s, w = list(map(int, input().split())) print((["safe", "unsafe"][w >= s]))
s, w = list(map(int, input().split())) print((["", "un"][w >= s] + "safe"))
false
50
[ "-print(([\"safe\", \"unsafe\"][w >= s]))", "+print(([\"\", \"un\"][w >= s] + \"safe\"))" ]
false
0.037658
0.172217
0.218664
[ "s217759207", "s252622479" ]
u878545651
p02577
python
s120919550
s405798833
711
205
9,364
9,264
Accepted
Accepted
71.17
def main(): N = int(input()) sum = 0 for digit in str(N): sum += int(digit) print('Yes') if sum % 9 == 0 else print('No') if __name__ == '__main__': main()
def main(): N = int(input()) print('Yes') if N % 9 == 0 else print('No') if __name__ == '__main__': main()
11
7
196
126
def main(): N = int(input()) sum = 0 for digit in str(N): sum += int(digit) print("Yes") if sum % 9 == 0 else print("No") if __name__ == "__main__": main()
def main(): N = int(input()) print("Yes") if N % 9 == 0 else print("No") if __name__ == "__main__": main()
false
36.363636
[ "- sum = 0", "- for digit in str(N):", "- sum += int(digit)", "- print(\"Yes\") if sum % 9 == 0 else print(\"No\")", "+ print(\"Yes\") if N % 9 == 0 else print(\"No\")" ]
false
0.040876
0.095897
0.426254
[ "s120919550", "s405798833" ]
u672220554
p03317
python
s163460263
s216713569
176
162
42,864
38,256
Accepted
Accepted
7.95
n,k = list(map(int,input().split())) a=eval(input()) print(((n+k-3)//(k-1)))
n,k = list(map(int,input().split())) print(((n+k-3)//(k-1)))
3
2
64
53
n, k = list(map(int, input().split())) a = eval(input()) print(((n + k - 3) // (k - 1)))
n, k = list(map(int, input().split())) print(((n + k - 3) // (k - 1)))
false
33.333333
[ "-a = eval(input())" ]
false
0.044952
0.045266
0.993066
[ "s163460263", "s216713569" ]
u079022693
p03208
python
s156062064
s177816847
250
229
7,488
7,384
Accepted
Accepted
8.4
N,K=list(map(int,input().split())) H=[] count=10**9 for i in range(N): h=int(eval(input())) H.append(h) H.sort() for i in range(0,N-K+1): hmax_min=H[i+K-1]-H[i] count=min(count,hmax_min) print(count)
def main(): N,K=list(map(int,input().split())) h=[] for i in range(N): a=int(eval(input())) h.append(a) h.sort() result=10**10 count=0 for i in range(N-K+1): count=h[i+K-1]-h[i] result=min(result,count) print(result) if __name__=="__main...
13
16
213
324
N, K = list(map(int, input().split())) H = [] count = 10**9 for i in range(N): h = int(eval(input())) H.append(h) H.sort() for i in range(0, N - K + 1): hmax_min = H[i + K - 1] - H[i] count = min(count, hmax_min) print(count)
def main(): N, K = list(map(int, input().split())) h = [] for i in range(N): a = int(eval(input())) h.append(a) h.sort() result = 10**10 count = 0 for i in range(N - K + 1): count = h[i + K - 1] - h[i] result = min(result, count) print(result) if __name_...
false
18.75
[ "-N, K = list(map(int, input().split()))", "-H = []", "-count = 10**9", "-for i in range(N):", "- h = int(eval(input()))", "- H.append(h)", "-H.sort()", "-for i in range(0, N - K + 1):", "- hmax_min = H[i + K - 1] - H[i]", "- count = min(count, hmax_min)", "-print(count)", "+def ma...
false
0.048451
0.040675
1.191169
[ "s156062064", "s177816847" ]
u347640436
p02623
python
s743754767
s040242788
268
242
40,552
40,624
Accepted
Accepted
9.7
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) b_sum = 0 for i in range(M): b_sum += B[i] if b_sum > K: b_sum -= B[i] j = i - 1 break else: j = M - 1 result = j + 1 a_sum = 0 for i in range(N): ...
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) b_sum = sum(B) for i in range(M - 1, -1, -1): if b_sum <= K: j = i break b_sum -= B[i] else: j = -1 result = j + 1 a_sum = 0 for i in range(N): a_sum += A[i...
25
24
491
479
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) b_sum = 0 for i in range(M): b_sum += B[i] if b_sum > K: b_sum -= B[i] j = i - 1 break else: j = M - 1 result = j + 1 a_sum = 0 for i in range(N): a_sum += A[i] i...
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) b_sum = sum(B) for i in range(M - 1, -1, -1): if b_sum <= K: j = i break b_sum -= B[i] else: j = -1 result = j + 1 a_sum = 0 for i in range(N): a_sum += A[i] if a_sum > K...
false
4
[ "-b_sum = 0", "-for i in range(M):", "- b_sum += B[i]", "- if b_sum > K:", "- b_sum -= B[i]", "- j = i - 1", "+b_sum = sum(B)", "+for i in range(M - 1, -1, -1):", "+ if b_sum <= K:", "+ j = i", "+ b_sum -= B[i]", "- j = M - 1", "+ j = -1" ]
false
0.048035
0.045394
1.058188
[ "s743754767", "s040242788" ]
u136090046
p03631
python
s631297740
s004574416
19
17
2,940
2,940
Accepted
Accepted
10.53
import math num = int(eval(input())) print(("Yes" if math.floor(num/100) == num%10 else "No"))
n = eval(input()) print(("Yes" if n == n[::-1] else "No"))
4
2
90
52
import math num = int(eval(input())) print(("Yes" if math.floor(num / 100) == num % 10 else "No"))
n = eval(input()) print(("Yes" if n == n[::-1] else "No"))
false
50
[ "-import math", "-", "-num = int(eval(input()))", "-print((\"Yes\" if math.floor(num / 100) == num % 10 else \"No\"))", "+n = eval(input())", "+print((\"Yes\" if n == n[::-1] else \"No\"))" ]
false
0.062982
0.129548
0.486166
[ "s631297740", "s004574416" ]
u252828980
p03072
python
s489361599
s043312671
20
17
2,940
2,940
Accepted
Accepted
15
n = int(eval(input())) li = list(map(int,input().split())) num = 0 max1 = li[0] for i in range(n): if li[i] >=max1: max1 = li[i] num += 1 print(num)
n = int(eval(input())) L = list(map(int,input().split())) ans = 0 for i in range(1,n): if max(L[:i]) <= L[i]: ans += 1 print((ans+1))
11
7
174
143
n = int(eval(input())) li = list(map(int, input().split())) num = 0 max1 = li[0] for i in range(n): if li[i] >= max1: max1 = li[i] num += 1 print(num)
n = int(eval(input())) L = list(map(int, input().split())) ans = 0 for i in range(1, n): if max(L[:i]) <= L[i]: ans += 1 print((ans + 1))
false
36.363636
[ "-li = list(map(int, input().split()))", "-num = 0", "-max1 = li[0]", "-for i in range(n):", "- if li[i] >= max1:", "- max1 = li[i]", "- num += 1", "-print(num)", "+L = list(map(int, input().split()))", "+ans = 0", "+for i in range(1, n):", "+ if max(L[:i]) <= L[i]:", "+ ...
false
0.042667
0.049922
0.854666
[ "s489361599", "s043312671" ]
u419832736
p03777
python
s363442518
s109321013
19
17
3,060
2,940
Accepted
Accepted
10.53
a, b = input().split() if (a == "H") : if ((b == "H") or (b == "D")): print(b) if (a == "D") : if (b == "H"): print ("D") if (b == "D"): print ("H")
a, b = list(map(str, input().split())) if (a == "H") : if ((b == "H") or (b == "D")): print(b) if (a == "D") : if (b == "H"): print ("D") if (b == "D"): print ("H")
9
9
184
194
a, b = input().split() if a == "H": if (b == "H") or (b == "D"): print(b) if a == "D": if b == "H": print("D") if b == "D": print("H")
a, b = list(map(str, input().split())) if a == "H": if (b == "H") or (b == "D"): print(b) if a == "D": if b == "H": print("D") if b == "D": print("H")
false
0
[ "-a, b = input().split()", "+a, b = list(map(str, input().split()))" ]
false
0.048267
0.047529
1.015529
[ "s363442518", "s109321013" ]
u177132624
p03457
python
s527732743
s805701375
344
318
3,060
3,060
Accepted
Accepted
7.56
N = int(eval(input())) for i in range(N): a,b,c = list(map(int,input().split())) if abs(b)+abs(c)>a or (a+b+c)%2==1: print("No") exit() print("Yes")
n = int(eval(input())) for i in range(n): t,x,y=list(map(int,input().split())) if (x + y) > t or (x + y + t) % 2: print("No") exit() print("Yes")
7
7
166
164
N = int(eval(input())) for i in range(N): a, b, c = list(map(int, input().split())) if abs(b) + abs(c) > a or (a + b + c) % 2 == 1: print("No") exit() print("Yes")
n = int(eval(input())) for i in range(n): t, x, y = list(map(int, input().split())) if (x + y) > t or (x + y + t) % 2: print("No") exit() print("Yes")
false
0
[ "-N = int(eval(input()))", "-for i in range(N):", "- a, b, c = list(map(int, input().split()))", "- if abs(b) + abs(c) > a or (a + b + c) % 2 == 1:", "+n = int(eval(input()))", "+for i in range(n):", "+ t, x, y = list(map(int, input().split()))", "+ if (x + y) > t or (x + y + t) % 2:" ]
false
0.096047
0.044039
2.180942
[ "s527732743", "s805701375" ]
u433532588
p03061
python
s767401087
s115852751
226
207
16,144
16,140
Accepted
Accepted
8.41
''' - [ABC125 - C - GCD on Blackboard(300点)](https://qiita.com/hkrutknouch/items/e71488de4a0c8e83ee97) - [累積GCDでAtCoder ABC 125 C – GCD on Blackboardを解く](https://muroiwataru.net/entry/abc-125-python) ''' from fractions import gcd n = int(eval(input())) a = list(map(int,input().split())) #累積GCD left = [0...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############################## from fractions import gcd N = int(eval(input())) A = list(map(int, input().split())) # 累積gcdを左からと右から left = [0] * N right = [0] * N left[0] = A[0] for i in range(1, N): left[i] = gcd(left[i-1], A[i]...
55
35
1,501
591
""" - [ABC125 - C - GCD on Blackboard(300点)](https://qiita.com/hkrutknouch/items/e71488de4a0c8e83ee97) - [累積GCDでAtCoder ABC 125 C – GCD on Blackboardを解く](https://muroiwataru.net/entry/abc-125-python) """ from fractions import gcd n = int(eval(input())) a = list(map(int, input().split())) # 累積GCD left = [0] * (n + 1) r...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############################## from fractions import gcd N = int(eval(input())) A = list(map(int, input().split())) # 累積gcdを左からと右から left = [0] * N right = [0] * N left[0] = A[0] for i in range(1, N): left[i] = gcd(left[i - 1], A[i]) right[N - 1] =...
false
36.363636
[ "-\"\"\"", "-- [ABC125 - C - GCD on Blackboard(300点)](https://qiita.com/hkrutknouch/items/e71488de4a0c8e83ee97)", "-- [累積GCDでAtCoder ABC 125 C – GCD on Blackboardを解く](https://muroiwataru.net/entry/abc-125-python)", "-\"\"\"", "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(1...
false
0.042333
0.043776
0.967055
[ "s767401087", "s115852751" ]
u156815136
p03807
python
s170500201
s975490471
96
61
13,756
13,248
Accepted
Accepted
36.46
from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] -...
from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] -...
30
29
713
684
from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] - k[j...
from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] - k[j...
false
3.333333
[ "- print(", "- (\"YES\" if sum(list([int(x) % 2 for x in input().split()])) % 2 == 0 else \"NO\")", "- )", "+ print((\"NO\" if sum(map(int, input().split())) % 2 else \"YES\"))" ]
false
0.128886
0.037522
3.434978
[ "s170500201", "s975490471" ]
u912237403
p02413
python
s897091508
s309192632
30
20
4,332
4,292
Accepted
Accepted
33.33
import sys p = 0 x1 = [] for line in sys.stdin: x = [int(i) for i in line.split()] if p == 0: r,c = x p = 1 else: x1.append(x) for i in range(r): x1[i].append(sum(x1[i])) x=[] for j in range(c+1): s = 0 for i in range(r): s += x1[i][j] x.a...
r, c = list(map(int, input().split())) x = [list(map(int, input().split())) for i in range(r)] x.append([sum([x[i][j] for i in range(r)]) for j in range(c)]) for e1 in x: for e in e1: print(e, end=' ') print(sum(e1))
26
10
428
230
import sys p = 0 x1 = [] for line in sys.stdin: x = [int(i) for i in line.split()] if p == 0: r, c = x p = 1 else: x1.append(x) for i in range(r): x1[i].append(sum(x1[i])) x = [] for j in range(c + 1): s = 0 for i in range(r): s += x1[i][j] x.append(s) x1.app...
r, c = list(map(int, input().split())) x = [list(map(int, input().split())) for i in range(r)] x.append([sum([x[i][j] for i in range(r)]) for j in range(c)]) for e1 in x: for e in e1: print(e, end=" ") print(sum(e1))
false
61.538462
[ "-import sys", "-", "-p = 0", "-x1 = []", "-for line in sys.stdin:", "- x = [int(i) for i in line.split()]", "- if p == 0:", "- r, c = x", "- p = 1", "- else:", "- x1.append(x)", "-for i in range(r):", "- x1[i].append(sum(x1[i]))", "-x = []", "-for j in r...
false
0.038322
0.135001
0.283862
[ "s897091508", "s309192632" ]
u551437236
p03416
python
s113435689
s165364392
47
34
2,940
2,940
Accepted
Accepted
27.66
a, b = list(map(int, input().split())) count = 0 for i in range(a,b+1): s = str(i) if s[0] == s[4] and s[1] == s[3]: count += 1 else: pass print(count)
a, b = list(map(int, input().split())) count = 0 for i in range(a,b+1): if i//10000 == i%10 and i//1000 %10 == i//10 %10: count += 1 print(count)
9
6
182
157
a, b = list(map(int, input().split())) count = 0 for i in range(a, b + 1): s = str(i) if s[0] == s[4] and s[1] == s[3]: count += 1 else: pass print(count)
a, b = list(map(int, input().split())) count = 0 for i in range(a, b + 1): if i // 10000 == i % 10 and i // 1000 % 10 == i // 10 % 10: count += 1 print(count)
false
33.333333
[ "- s = str(i)", "- if s[0] == s[4] and s[1] == s[3]:", "+ if i // 10000 == i % 10 and i // 1000 % 10 == i // 10 % 10:", "- else:", "- pass" ]
false
0.059063
0.045706
1.292234
[ "s113435689", "s165364392" ]
u941047297
p02559
python
s132340733
s208336420
5,000
4,080
70,932
67,144
Accepted
Accepted
18.4
class Fenwick_Tree: def __init__(self, n): self._n = n self.data = [0] * n def add(self, p, x): assert 0 <= p < self._n p += 1 while p <= self._n: self.data[p - 1] += x p += p & -p def sum(self, l, r): assert 0 <=...
import sys class Fenwick_Tree: def __init__(self, n): self._n = n self.data = [0] * n def add(self, p, x): assert 0 <= p < self._n p += 1 while p <= self._n: self.data[p - 1] += x p += p & -p def sum(self, l, r): ...
37
42
882
932
class Fenwick_Tree: def __init__(self, n): self._n = n self.data = [0] * n def add(self, p, x): assert 0 <= p < self._n p += 1 while p <= self._n: self.data[p - 1] += x p += p & -p def sum(self, l, r): assert 0 <= l <= r <= self._n ...
import sys class Fenwick_Tree: def __init__(self, n): self._n = n self.data = [0] * n def add(self, p, x): assert 0 <= p < self._n p += 1 while p <= self._n: self.data[p - 1] += x p += p & -p def sum(self, l, r): assert 0 <= l <= r ...
false
11.904762
[ "+import sys", "+", "+", "+ input = sys.stdin.readline" ]
false
0.065476
0.046133
1.419285
[ "s132340733", "s208336420" ]
u934442292
p03161
python
s366044959
s424668190
797
631
37,952
121,420
Accepted
Accepted
20.83
import sys # import numba as nb import numpy as np input = sys.stdin.readline INF = float("inf") # @nb.njit("i8(i8,i8,i8[:])") def solve(N, K, h): dp = np.zeros(N, dtype=np.int64) for i in range(1, N): k = min(K, i) dp[i] = np.min(dp[i - k:i] + np.abs(h[i] - h[i - k:i])) r...
import sys import numba as nb import numpy as np input = sys.stdin.readline INF = float("inf") @nb.njit("i8(i8,i8,i8[:])") def solve(N, K, h): dp = np.zeros(N, dtype=np.int64) for i in range(1, N): min_cost = INF for k in range(1, min(K + 1, i + 1)): cost = dp[i - ...
28
32
527
651
import sys # import numba as nb import numpy as np input = sys.stdin.readline INF = float("inf") # @nb.njit("i8(i8,i8,i8[:])") def solve(N, K, h): dp = np.zeros(N, dtype=np.int64) for i in range(1, N): k = min(K, i) dp[i] = np.min(dp[i - k : i] + np.abs(h[i] - h[i - k : i])) return dp[-1] ...
import sys import numba as nb import numpy as np input = sys.stdin.readline INF = float("inf") @nb.njit("i8(i8,i8,i8[:])") def solve(N, K, h): dp = np.zeros(N, dtype=np.int64) for i in range(1, N): min_cost = INF for k in range(1, min(K + 1, i + 1)): cost = dp[i - k] + abs(h[i] - ...
false
12.5
[ "-", "-# import numba as nb", "+import numba as nb", "-# @nb.njit(\"i8(i8,i8,i8[:])\")", "+", "+", "+@nb.njit(\"i8(i8,i8,i8[:])\")", "- k = min(K, i)", "- dp[i] = np.min(dp[i - k : i] + np.abs(h[i] - h[i - k : i]))", "+ min_cost = INF", "+ for k in range(1, min(K + 1,...
false
0.238445
0.043492
5.48248
[ "s366044959", "s424668190" ]
u841021102
p02676
python
s132494622
s045845730
31
27
9,172
9,128
Accepted
Accepted
12.9
k = int(eval(input())) s = eval(input()) a = list(s.split()) if len(s) <= k: print(s) elif len(s) > k: print((s[0:k] + '...'))
k = int(eval(input())) s = eval(input()) if len(s) <= k: print(s) elif len(s) > k: print((s[0:k] + '...'))
7
6
124
103
k = int(eval(input())) s = eval(input()) a = list(s.split()) if len(s) <= k: print(s) elif len(s) > k: print((s[0:k] + "..."))
k = int(eval(input())) s = eval(input()) if len(s) <= k: print(s) elif len(s) > k: print((s[0:k] + "..."))
false
14.285714
[ "-a = list(s.split())" ]
false
0.035769
0.041835
0.854991
[ "s132494622", "s045845730" ]
u203748490
p03378
python
s552538809
s020078185
21
17
3,316
2,940
Accepted
Accepted
19.05
N, M, X = list(map(int, input().split())) F = [0 for _ in range(N+1)] for A in input().split(): F[int(A)] = 1 print((min(sum(F[:X+1]), sum(F[X:]))))
n,m,x=list(map(int,input().split())) s=sum(int(a)<x for a in input().split()) print((min(s,m-s)))
5
3
145
91
N, M, X = list(map(int, input().split())) F = [0 for _ in range(N + 1)] for A in input().split(): F[int(A)] = 1 print((min(sum(F[: X + 1]), sum(F[X:]))))
n, m, x = list(map(int, input().split())) s = sum(int(a) < x for a in input().split()) print((min(s, m - s)))
false
40
[ "-N, M, X = list(map(int, input().split()))", "-F = [0 for _ in range(N + 1)]", "-for A in input().split():", "- F[int(A)] = 1", "-print((min(sum(F[: X + 1]), sum(F[X:]))))", "+n, m, x = list(map(int, input().split()))", "+s = sum(int(a) < x for a in input().split())", "+print((min(s, m - s)))" ]
false
0.049074
0.046902
1.046309
[ "s552538809", "s020078185" ]
u606045429
p02642
python
s556414065
s982610029
613
446
132,268
33,032
Accepted
Accepted
27.24
from collections import Counter N, *A = list(map(int, open(0).read().split())) C = Counter(A) B = sorted(list(C.items()), key=lambda x: x[0]) lim = B[-1][0] + 1 memo = set() ans = 0 for k, v in B: if k in memo: continue memo |= set(range(k, lim, k)) ans += (v == 1) print(ans)
N, *A = list(map(int, open(0).read().split())) A.sort() lim = A[-1] + 1 dp = [0] * lim for a in A: dp[a] += 1 if dp[a] == 1: for j in range(2 * a, lim, a): dp[j] += 2 print((dp.count(1)))
18
13
306
222
from collections import Counter N, *A = list(map(int, open(0).read().split())) C = Counter(A) B = sorted(list(C.items()), key=lambda x: x[0]) lim = B[-1][0] + 1 memo = set() ans = 0 for k, v in B: if k in memo: continue memo |= set(range(k, lim, k)) ans += v == 1 print(ans)
N, *A = list(map(int, open(0).read().split())) A.sort() lim = A[-1] + 1 dp = [0] * lim for a in A: dp[a] += 1 if dp[a] == 1: for j in range(2 * a, lim, a): dp[j] += 2 print((dp.count(1)))
false
27.777778
[ "-from collections import Counter", "-", "-C = Counter(A)", "-B = sorted(list(C.items()), key=lambda x: x[0])", "-lim = B[-1][0] + 1", "-memo = set()", "-ans = 0", "-for k, v in B:", "- if k in memo:", "- continue", "- memo |= set(range(k, lim, k))", "- ans += v == 1", "-prin...
false
0.03517
0.118493
0.296809
[ "s556414065", "s982610029" ]
u753803401
p03166
python
s181752043
s551864486
1,938
1,097
654,080
151,852
Accepted
Accepted
43.4
import sys import collections from functools import lru_cache xy = [] d = collections.defaultdict(list) @lru_cache(maxsize=None) def alg_memoization_recursion(f): mt = 0 for v in d[f]: mt = max(mt, alg_memoization_recursion(v) + 1) return mt def solve(): readline = sys.stdin.bu...
import sys import collections from functools import lru_cache sys.setrecursionlimit(10 ** 7 + 1) xy = [] d = collections.defaultdict(list) @lru_cache(maxsize=None) def alg_memoization_recursion(f): mt = 0 for v in d[f]: mt = max(mt, alg_memoization_recursion(v) + 1) return mt def...
30
31
692
690
import sys import collections from functools import lru_cache xy = [] d = collections.defaultdict(list) @lru_cache(maxsize=None) def alg_memoization_recursion(f): mt = 0 for v in d[f]: mt = max(mt, alg_memoization_recursion(v) + 1) return mt def solve(): readline = sys.stdin.buffer.readline...
import sys import collections from functools import lru_cache sys.setrecursionlimit(10**7 + 1) xy = [] d = collections.defaultdict(list) @lru_cache(maxsize=None) def alg_memoization_recursion(f): mt = 0 for v in d[f]: mt = max(mt, alg_memoization_recursion(v) + 1) return mt def solve(): rea...
false
3.225806
[ "+sys.setrecursionlimit(10**7 + 1)", "- sys.setrecursionlimit(10**5 + 1)" ]
false
0.05742
0.064037
0.896669
[ "s181752043", "s551864486" ]
u380524497
p02804
python
s697787003
s848511536
263
170
22,544
14,040
Accepted
Accepted
35.36
P = 10**9 + 7 N = 200000 inv_t = [0]+[1] # 逆元 for i in range(2, N): inv_t += [inv_t[P % i] * (P - int(P / i)) % P] n, k = list(map(int, input().split())) A = list(map(int, input().split())) mod = 10 ** 9 + 7 A.sort() mini_count = 0 maxim_count = 0 pattern = 1 """ minX, maxXとして選ばれるのはそれぞれ minX:so...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) mod = 10 ** 9 + 7 P = 10**9 + 7 N = n-k+10 inv_t = [0]+[1] # 逆元 for i in range(2, N): inv_t += [inv_t[P % i] * (P - int(P / i)) % P] A.sort() mini_count = 0 maxim_count = 0 pattern = 1 """ minX, maxXとして選ばれるのはそれぞれ minX:sort...
41
40
951
950
P = 10**9 + 7 N = 200000 inv_t = [0] + [1] # 逆元 for i in range(2, N): inv_t += [inv_t[P % i] * (P - int(P / i)) % P] n, k = list(map(int, input().split())) A = list(map(int, input().split())) mod = 10**9 + 7 A.sort() mini_count = 0 maxim_count = 0 pattern = 1 """ minX, maxXとして選ばれるのはそれぞれ minX:sortAの右からk番目(大きい数値からk個...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) mod = 10**9 + 7 P = 10**9 + 7 N = n - k + 10 inv_t = [0] + [1] # 逆元 for i in range(2, N): inv_t += [inv_t[P % i] * (P - int(P / i)) % P] A.sort() mini_count = 0 maxim_count = 0 pattern = 1 """ minX, maxXとして選ばれるのはそれぞれ minX:sortAの右からk番目(大きい数値...
false
2.439024
[ "+n, k = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+mod = 10**9 + 7", "-N = 200000", "+N = n - k + 10", "-n, k = list(map(int, input().split()))", "-A = list(map(int, input().split()))", "-mod = 10**9 + 7" ]
false
0.234718
0.03828
6.131594
[ "s697787003", "s848511536" ]
u116038906
p02838
python
s347926055
s323792388
336
272
49,916
68,804
Accepted
Accepted
19.05
import numpy as np mod=10**9+7 N=int(eval(input())) A=np.array(list(map(int, input().split()))) ans=0 for i in range(60): b=np.count_nonzero(A>>i&1) ans+=(2**i)*b*(N-b) ans%=mod print(ans)
import numpy as np # 初期入力 mod = 10**9 +7 ans =0 N =int(eval(input())) A =list(map(int,input().split())) A_np =np.array(A,dtype=np.int64) # xor 各桁の0と1の数を求め for i in range(60): c =np.count_nonzero(A_np &1) ans +=2**i*c*(N-c) A_np >>=1 print((ans %mod))
11
14
201
269
import numpy as np mod = 10**9 + 7 N = int(eval(input())) A = np.array(list(map(int, input().split()))) ans = 0 for i in range(60): b = np.count_nonzero(A >> i & 1) ans += (2**i) * b * (N - b) ans %= mod print(ans)
import numpy as np # 初期入力 mod = 10**9 + 7 ans = 0 N = int(eval(input())) A = list(map(int, input().split())) A_np = np.array(A, dtype=np.int64) # xor 各桁の0と1の数を求め for i in range(60): c = np.count_nonzero(A_np & 1) ans += 2**i * c * (N - c) A_np >>= 1 print((ans % mod))
false
21.428571
[ "+# 初期入力", "+ans = 0", "-A = np.array(list(map(int, input().split())))", "-ans = 0", "+A = list(map(int, input().split()))", "+A_np = np.array(A, dtype=np.int64)", "+# xor 各桁の0と1の数を求め", "- b = np.count_nonzero(A >> i & 1)", "- ans += (2**i) * b * (N - b)", "- ans %= mod", "-print(ans)",...
false
0.348197
0.202993
1.71532
[ "s347926055", "s323792388" ]
u352394527
p01268
python
s851396327
s068149957
2,490
940
7,164
7,188
Accepted
Accepted
62.25
from bisect import bisect_right as br from itertools import combinations_with_replacement as cwr MAX = 110000 ROOT = 340 tf = [True] * MAX tf[0] = tf[1] = False for i in range(2, ROOT + 1): if tf[i]: for j in range(i * i, MAX, i): tf[j] = False primes = [i for i in range(MAX) if tf[i]] while ...
from bisect import bisect_right as br from itertools import combinations_with_replacement as cwr MAX = 110000 ROOT = 340 tf = [True] * MAX tf[0] = tf[1] = False for i in range(2, ROOT + 1): if tf[i]: for j in range(i * i, MAX, i): tf[j] = False primes = [i for i in range(MAX) if tf[i]] while ...
23
23
541
539
from bisect import bisect_right as br from itertools import combinations_with_replacement as cwr MAX = 110000 ROOT = 340 tf = [True] * MAX tf[0] = tf[1] = False for i in range(2, ROOT + 1): if tf[i]: for j in range(i * i, MAX, i): tf[j] = False primes = [i for i in range(MAX) if tf[i]] while Tr...
from bisect import bisect_right as br from itertools import combinations_with_replacement as cwr MAX = 110000 ROOT = 340 tf = [True] * MAX tf[0] = tf[1] = False for i in range(2, ROOT + 1): if tf[i]: for j in range(i * i, MAX, i): tf[j] = False primes = [i for i in range(MAX) if tf[i]] while Tr...
false
0
[ "- choice = primes[init : init + 100]", "+ choice = primes[init : init + p]" ]
false
0.095793
0.137006
0.699191
[ "s851396327", "s068149957" ]
u747602774
p03814
python
s387171465
s771449446
55
42
12,804
3,516
Accepted
Accepted
23.64
s=list(eval(input())) As=[i for i, x in enumerate(s) if x == 'A'] Zs=[i for i, x in enumerate(s) if x == 'Z'] print((Zs[-1]-As[0]+1))
s = eval(input()) n = len(s) for i in range(n): if s[i] == 'A': start = i break for i in range(n): if s[i] == 'Z': end = i print((end-start+1))
5
10
131
176
s = list(eval(input())) As = [i for i, x in enumerate(s) if x == "A"] Zs = [i for i, x in enumerate(s) if x == "Z"] print((Zs[-1] - As[0] + 1))
s = eval(input()) n = len(s) for i in range(n): if s[i] == "A": start = i break for i in range(n): if s[i] == "Z": end = i print((end - start + 1))
false
50
[ "-s = list(eval(input()))", "-As = [i for i, x in enumerate(s) if x == \"A\"]", "-Zs = [i for i, x in enumerate(s) if x == \"Z\"]", "-print((Zs[-1] - As[0] + 1))", "+s = eval(input())", "+n = len(s)", "+for i in range(n):", "+ if s[i] == \"A\":", "+ start = i", "+ break", "+for ...
false
0.045847
0.035378
1.295912
[ "s387171465", "s771449446" ]
u895515293
p02838
python
s781456410
s538290035
1,997
1,407
203,332
202,840
Accepted
Accepted
29.54
import sys import math import heapq sys.setrecursionlimit(10**7) INTMAX = 9223372036854775807 INTMIN = -9223372036854775808 DVSR = 1000000007 def POW(x, y): return pow(x, y, DVSR) def INV(x, m=DVSR): return pow(x, m - 2, m) def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m def LI(): return [int(x) for x in in...
import sys import math import heapq sys.setrecursionlimit(10**7) INTMAX = 9223372036854775807 INTMIN = -9223372036854775808 DVSR = 1000000007 def POW(x, y): return pow(x, y, DVSR) def INV(x, m=DVSR): return pow(x, m - 2, m) def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m def LI(): return [int(x) for x in in...
47
48
1,253
1,190
import sys import math import heapq sys.setrecursionlimit(10**7) INTMAX = 9223372036854775807 INTMIN = -9223372036854775808 DVSR = 1000000007 def POW(x, y): return pow(x, y, DVSR) def INV(x, m=DVSR): return pow(x, m - 2, m) def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m def LI(): return [int...
import sys import math import heapq sys.setrecursionlimit(10**7) INTMAX = 9223372036854775807 INTMIN = -9223372036854775808 DVSR = 1000000007 def POW(x, y): return pow(x, y, DVSR) def INV(x, m=DVSR): return pow(x, m - 2, m) def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m def LI(): return [int...
false
2.083333
[ "+POW2 = [1]", "+for i in range(60):", "+ POW2.append(POW2[i] * 2 % DVSR)", "- # coef = (N - i - 1 - (DIG_CUM[N][s] - DIG_CUM[i+1][s])) if (As[i] >> s) & 1 else DIG_CUM[N][s] - DIG_CUM[i+1][s]", "- res += coef * (1 << s)", "+ res += coef * POW2[s]" ]
false
0.037838
0.038526
0.982135
[ "s781456410", "s538290035" ]