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
u731427834
p03354
python
s495960829
s763578641
605
541
13,812
14,324
Accepted
Accepted
10.58
# UnionFindで参考にしたページ # http://www.geocities.jp/m_hiroi/light/pyalgo61.html # 集合の代表を求める def find(x): if link[x] < 0: return x else: # 経路の圧縮 link[x] = find(link[x]) return link[x] # 併合 def union(x, y): s1 = find(x) s2 = find(y) if s1 != s2: ...
# UnionFindで参考にしたページ # http://www.geocities.jp/m_hiroi/light/pyalgo61.html # 集合の代表を求める def find(x): if link[x] < 0: return x else: # 経路の圧縮 link[x] = find(link[x]) return link[x] # 併合 def union(x, y): s1 = find(x) s2 = find(y) if s1 != s2: ...
43
43
840
840
# UnionFindで参考にしたページ # http://www.geocities.jp/m_hiroi/light/pyalgo61.html # 集合の代表を求める def find(x): if link[x] < 0: return x else: # 経路の圧縮 link[x] = find(link[x]) return link[x] # 併合 def union(x, y): s1 = find(x) s2 = find(y) if s1 != s2: if link[s1] >= link...
# UnionFindで参考にしたページ # http://www.geocities.jp/m_hiroi/light/pyalgo61.html # 集合の代表を求める def find(x): if link[x] < 0: return x else: # 経路の圧縮 link[x] = find(link[x]) return link[x] # 併合 def union(x, y): s1 = find(x) s2 = find(y) if s1 != s2: if link[s1] >= link...
false
0
[ "+ link[s2] += link[s1]", "+ link[s1] = s2", "+ else:", "- else:", "- link[s2] += link[s1]", "- link[s1] = s2" ]
false
0.047003
0.041829
1.123704
[ "s495960829", "s763578641" ]
u366959492
p02958
python
s833961456
s080877454
197
165
38,384
38,384
Accepted
Accepted
16.24
n=int(eval(input())) p=list(map(int,input().split())) c=0 a=[] b=[] for i in range(n): if p[i]!=i+1: c+=1 a.append(i+1) b.append(p[i]) if c==0: print("YES") elif c==2: if a[0]==b[1]: print("YES") else: print("NO") else: print("NO")
n=int(eval(input())) p=list(map(int,input().split())) c=0 a=[] b=[] for i in range(n): if p[i]!=i+1: c+=1 a.append(i+1) b.append(p[i]) if c==0 or c==2: print("YES") else: print("NO")
19
14
304
226
n = int(eval(input())) p = list(map(int, input().split())) c = 0 a = [] b = [] for i in range(n): if p[i] != i + 1: c += 1 a.append(i + 1) b.append(p[i]) if c == 0: print("YES") elif c == 2: if a[0] == b[1]: print("YES") else: print("NO") else: print("NO")
n = int(eval(input())) p = list(map(int, input().split())) c = 0 a = [] b = [] for i in range(n): if p[i] != i + 1: c += 1 a.append(i + 1) b.append(p[i]) if c == 0 or c == 2: print("YES") else: print("NO")
false
26.315789
[ "-if c == 0:", "+if c == 0 or c == 2:", "-elif c == 2:", "- if a[0] == b[1]:", "- print(\"YES\")", "- else:", "- print(\"NO\")" ]
false
0.071402
0.034273
2.083349
[ "s833961456", "s080877454" ]
u185948224
p02574
python
s709437926
s026097998
1,164
706
133,216
133,100
Accepted
Accepted
39.35
import sys, math input = sys.stdin.readline n = int(eval(input())) a = [int(x) for x in input().split()] m = max(a) primes = list(range(m+1)) primes[1] = 0 for i in range(2, m+1, 2): primes[i] = 2 for i in range(3, int(m ** 0.5)+1): for j in range(i, m+1, i): if primes[j] > i: primes[j] = i ...
import sys, math input = sys.stdin.readline n = int(eval(input())) a = [int(x) for x in input().split()] m = max(a) primes = list(range(m+1)) primes[1] = 0 for i in range(2, m+1, 2): primes[i] = 2 for i in range(3, int(m ** 0.5)+1): if primes[i] < i: continue for j in range(i, m+1, i): pr...
40
41
848
862
import sys, math input = sys.stdin.readline n = int(eval(input())) a = [int(x) for x in input().split()] m = max(a) primes = list(range(m + 1)) primes[1] = 0 for i in range(2, m + 1, 2): primes[i] = 2 for i in range(3, int(m**0.5) + 1): for j in range(i, m + 1, i): if primes[j] > i: primes[...
import sys, math input = sys.stdin.readline n = int(eval(input())) a = [int(x) for x in input().split()] m = max(a) primes = list(range(m + 1)) primes[1] = 0 for i in range(2, m + 1, 2): primes[i] = 2 for i in range(3, int(m**0.5) + 1): if primes[i] < i: continue for j in range(i, m + 1, i): ...
false
2.439024
[ "+ if primes[i] < i:", "+ continue", "- if primes[j] > i:", "- primes[j] = i", "+ primes[j] = i" ]
false
0.037899
0.102332
0.370352
[ "s709437926", "s026097998" ]
u619458041
p03329
python
s652394212
s226185898
1,042
20
3,864
3,064
Accepted
Accepted
98.08
import sys def f(n): X6 = [] X9 = [] for i in range(0, 10): if n >= 6**i: X6.append(6**i) if n >= 9**i: X9.append(9**i) return max(X6), max(X9) def main(): input = sys.stdin.readline N = int(eval(input())) dp = [0 for _ in range(N+1)] for i in range(1, N+1): ...
import sys from itertools import count, takewhile def dfs(n, d={}): if n < 6: return n if n in d: return d[n] max9 = max(takewhile(lambda x: x<=n, (9**i for i in count()))) max6 = max(takewhile(lambda x: x<=n, (6**i for i in count()))) d[n] = min(dfs(n-max9), dfs(n-max6)) + 1 return d[...
28
22
496
448
import sys def f(n): X6 = [] X9 = [] for i in range(0, 10): if n >= 6**i: X6.append(6**i) if n >= 9**i: X9.append(9**i) return max(X6), max(X9) def main(): input = sys.stdin.readline N = int(eval(input())) dp = [0 for _ in range(N + 1)] for i i...
import sys from itertools import count, takewhile def dfs(n, d={}): if n < 6: return n if n in d: return d[n] max9 = max(takewhile(lambda x: x <= n, (9**i for i in count()))) max6 = max(takewhile(lambda x: x <= n, (6**i for i in count()))) d[n] = min(dfs(n - max9), dfs(n - max6)) +...
false
21.428571
[ "+from itertools import count, takewhile", "-def f(n):", "- X6 = []", "- X9 = []", "- for i in range(0, 10):", "- if n >= 6**i:", "- X6.append(6**i)", "- if n >= 9**i:", "- X9.append(9**i)", "- return max(X6), max(X9)", "+def dfs(n, d={}):", "+ ...
false
0.233238
0.035692
6.534721
[ "s652394212", "s226185898" ]
u901447859
p03289
python
s614753613
s034101752
21
17
3,316
2,940
Accepted
Accepted
19.05
s=eval(input()) from collections import Counter ans='AC' if s[0]=='A' and Counter(s[2:-1]).get('C')==1: for x in sorted(s)[2:]: if x.isupper(): ans='WA' break else: ans='WA' print(ans)
s=eval(input()) if s[0]=='A' and 'C' in s[2:-1] and s[1:].replace('C','',1).islower(): print('AC') else: print('WA')
11
5
209
118
s = eval(input()) from collections import Counter ans = "AC" if s[0] == "A" and Counter(s[2:-1]).get("C") == 1: for x in sorted(s)[2:]: if x.isupper(): ans = "WA" break else: ans = "WA" print(ans)
s = eval(input()) if s[0] == "A" and "C" in s[2:-1] and s[1:].replace("C", "", 1).islower(): print("AC") else: print("WA")
false
54.545455
[ "-from collections import Counter", "-", "-ans = \"AC\"", "-if s[0] == \"A\" and Counter(s[2:-1]).get(\"C\") == 1:", "- for x in sorted(s)[2:]:", "- if x.isupper():", "- ans = \"WA\"", "- break", "+if s[0] == \"A\" and \"C\" in s[2:-1] and s[1:].replace(\"C\", \"\", 1...
false
0.045422
0.047132
0.96372
[ "s614753613", "s034101752" ]
u150984829
p00447
python
s404259838
s039666289
1,310
1,070
5,900
5,980
Accepted
Accepted
18.32
for e in iter(input,'0'): a=sorted([list(map(int,input().split()))for _ in[0]*int(e)],key=lambda x:x[0]) b=sorted([list(map(int,input().split()))for _ in[0]*int(eval(input()))],key=lambda x:x[0]) for s,t in b: u,v=a[0] x,y=s-u,t-v for u,v in a: if[u+x,v+y]not in b:break else:print((x,y))
for e in iter(input,'0'): a=[list(map(int,input().split()))for _ in[0]*int(e)] b=[list(map(int,input().split()))for _ in[0]*int(eval(input()))] for s,t in b: u,v=a[0] x,y=s-u,t-v for u,v in a: if[u+x,v+y]not in b:break else:print((x,y))
9
9
303
251
for e in iter(input, "0"): a = sorted( [list(map(int, input().split())) for _ in [0] * int(e)], key=lambda x: x[0] ) b = sorted( [list(map(int, input().split())) for _ in [0] * int(eval(input()))], key=lambda x: x[0], ) for s, t in b: u, v = a[0] x, y = s - u,...
for e in iter(input, "0"): a = [list(map(int, input().split())) for _ in [0] * int(e)] b = [list(map(int, input().split())) for _ in [0] * int(eval(input()))] for s, t in b: u, v = a[0] x, y = s - u, t - v for u, v in a: if [u + x, v + y] not in b: break ...
false
0
[ "- a = sorted(", "- [list(map(int, input().split())) for _ in [0] * int(e)], key=lambda x: x[0]", "- )", "- b = sorted(", "- [list(map(int, input().split())) for _ in [0] * int(eval(input()))],", "- key=lambda x: x[0],", "- )", "+ a = [list(map(int, input().split())...
false
0.035909
0.038227
0.939356
[ "s404259838", "s039666289" ]
u629540524
p02915
python
s320146060
s383034785
20
17
3,060
2,940
Accepted
Accepted
15
n = int(eval(input())) print((n*n*n))
n = int(eval(input())) print((n**3))
2
2
30
29
n = int(eval(input())) print((n * n * n))
n = int(eval(input())) print((n**3))
false
0
[ "-print((n * n * n))", "+print((n**3))" ]
false
0.047976
0.047449
1.011107
[ "s320146060", "s383034785" ]
u318427318
p02832
python
s761324898
s172725966
104
77
24,872
32,404
Accepted
Accepted
25.96
N = int(eval(input())) list = list(map(int,input().split(" "))) t = 1 ans=0 if 1 not in list: print((-1)) exit() for i in range(N): if list[i]==t: t+=1 else: ans+=1 if t==ans: print((ans-1)) else: print(ans)
#-*-coding:utf-8-*- import sys input=sys.stdin.readline def main2(): numbers=[] N = int(eval(input())) numbers=list(map(int,input().split())) n=1 #条件が1<=n<=200kのため1から順に数えてlist内を調査した場合の最大値+1をnに記入 for x in numbers: if x ==n: n+=1 #条件から+1まで数えてしまうため、nを+1して調整 an...
21
42
262
931
N = int(eval(input())) list = list(map(int, input().split(" "))) t = 1 ans = 0 if 1 not in list: print((-1)) exit() for i in range(N): if list[i] == t: t += 1 else: ans += 1 if t == ans: print((ans - 1)) else: print(ans)
# -*-coding:utf-8-*- import sys input = sys.stdin.readline def main2(): numbers = [] N = int(eval(input())) numbers = list(map(int, input().split())) n = 1 # 条件が1<=n<=200kのため1から順に数えてlist内を調査した場合の最大値+1をnに記入 for x in numbers: if x == n: n += 1 # 条件から+1まで数えてしまうため、nを+1して調整...
false
50
[ "-N = int(eval(input()))", "-list = list(map(int, input().split(\" \")))", "-t = 1", "-ans = 0", "-if 1 not in list:", "- print((-1))", "- exit()", "-for i in range(N):", "- if list[i] == t:", "- t += 1", "- else:", "- ans += 1", "-if t == ans:", "- print((ans ...
false
0.035974
0.035098
1.024938
[ "s761324898", "s172725966" ]
u572142121
p03476
python
s026573519
s409412844
1,529
559
80,728
36,080
Accepted
Accepted
63.44
Q=int(eval(input())) A=[list(map(int,input().split())) for i in range(Q)] B,C=list(zip(*A)) a=max(max(B),max(C)) def get_primenumber(N): prime_list=[2] for num in range(3,N+1,2): if all(num%prime != 0 for prime in prime_list): prime_list.append(num) return prime_list X=get_primenumber(a) P=...
import math Q=int(eval(input())) A=[list(map(int,input().split())) for i in range(Q)] B,C=list(zip(*A)) a=max(max(B),max(C)) def get_primenumber(n): prime=[] limit=math.sqrt(n) data=[i+1 for i in range(1, n)] while True: p=data[0] if limit<=p: return prime+data prime.append(p) ...
27
33
518
594
Q = int(eval(input())) A = [list(map(int, input().split())) for i in range(Q)] B, C = list(zip(*A)) a = max(max(B), max(C)) def get_primenumber(N): prime_list = [2] for num in range(3, N + 1, 2): if all(num % prime != 0 for prime in prime_list): prime_list.append(num) return prime_list...
import math Q = int(eval(input())) A = [list(map(int, input().split())) for i in range(Q)] B, C = list(zip(*A)) a = max(max(B), max(C)) def get_primenumber(n): prime = [] limit = math.sqrt(n) data = [i + 1 for i in range(1, n)] while True: p = data[0] if limit <= p: return...
false
18.181818
[ "+import math", "+", "-def get_primenumber(N):", "- prime_list = [2]", "- for num in range(3, N + 1, 2):", "- if all(num % prime != 0 for prime in prime_list):", "- prime_list.append(num)", "- return prime_list", "+def get_primenumber(n):", "+ prime = []", "+ lim...
false
0.03701
0.037296
0.992341
[ "s026573519", "s409412844" ]
u729133443
p02851
python
s975486026
s205080960
307
264
102,656
35,744
Accepted
Accepted
14.01
n,k,*a=list(map(int,open(0).read().split())) a=[0]+a for i in range(n):a[i+1]=(a[i+1]-1+a[i])%k d={} c=0 for i,b in enumerate(a): v=d.get(b,0) c+=v d[b]=v+1 j=i-k+1 if j>=0:d[a[j]]=d.get(a[j],0)-1 print(c)
n,k,*a=list(map(int, open(0).read().split())) b=[0] for t in a:b+=(t-1+b[-1])%k, d={k:0} a=0 for l,r in zip([k]*min(k,n+1)+b,b):d[l]-=1;t=d.get(r,0);a+=t;d[r]=t+1 print(a)
12
7
220
171
n, k, *a = list(map(int, open(0).read().split())) a = [0] + a for i in range(n): a[i + 1] = (a[i + 1] - 1 + a[i]) % k d = {} c = 0 for i, b in enumerate(a): v = d.get(b, 0) c += v d[b] = v + 1 j = i - k + 1 if j >= 0: d[a[j]] = d.get(a[j], 0) - 1 print(c)
n, k, *a = list(map(int, open(0).read().split())) b = [0] for t in a: b += ((t - 1 + b[-1]) % k,) d = {k: 0} a = 0 for l, r in zip([k] * min(k, n + 1) + b, b): d[l] -= 1 t = d.get(r, 0) a += t d[r] = t + 1 print(a)
false
41.666667
[ "-a = [0] + a", "-for i in range(n):", "- a[i + 1] = (a[i + 1] - 1 + a[i]) % k", "-d = {}", "-c = 0", "-for i, b in enumerate(a):", "- v = d.get(b, 0)", "- c += v", "- d[b] = v + 1", "- j = i - k + 1", "- if j >= 0:", "- d[a[j]] = d.get(a[j], 0) - 1", "-print(c)", ...
false
0.148942
0.114637
1.299248
[ "s975486026", "s205080960" ]
u046187684
p02996
python
s209217847
s705906288
725
317
52,096
48,708
Accepted
Accepted
56.28
from operator import itemgetter def solve(string): n, *ab = list(map(int, string.split())) ab = sorted(zip(*[iter(ab[::-1])] * 2)) past = 0 for b, a in ab: past += a if past > b: return "No" return "Yes" if __name__ == '__main__': n = int(eval(input...
# ABC131D - Megalomania from operator import itemgetter as gt def main(): N, *AB = list(map(int, open(0).read().split())) cur, TD = 0, sorted([(i, j) for i, j in zip(*[iter(AB)] * 2)], key=gt(1)) for task, deadline in TD: # check all tasks greedily cur += task if cur > deadline: ...
17
17
390
466
from operator import itemgetter def solve(string): n, *ab = list(map(int, string.split())) ab = sorted(zip(*[iter(ab[::-1])] * 2)) past = 0 for b, a in ab: past += a if past > b: return "No" return "Yes" if __name__ == "__main__": n = int(eval(input())) print(...
# ABC131D - Megalomania from operator import itemgetter as gt def main(): N, *AB = list(map(int, open(0).read().split())) cur, TD = 0, sorted([(i, j) for i, j in zip(*[iter(AB)] * 2)], key=gt(1)) for task, deadline in TD: # check all tasks greedily cur += task if cur > deadline: # fail t...
false
0
[ "-from operator import itemgetter", "+# ABC131D - Megalomania", "+from operator import itemgetter as gt", "-def solve(string):", "- n, *ab = list(map(int, string.split()))", "- ab = sorted(zip(*[iter(ab[::-1])] * 2))", "- past = 0", "- for b, a in ab:", "- past += a", "- ...
false
0.046086
0.103228
0.446445
[ "s209217847", "s705906288" ]
u970197315
p03329
python
s816483740
s946248321
981
631
3,828
3,864
Accepted
Accepted
35.68
n=int(eval(input())) dp=[0]*(n+1) for i in range(1,n+1): ans=dp[i-1]+1 j=1 while i>=6**j: ans=min(ans,dp[i-6**j]+1) j+=1 j=1 while i>=9**j: ans=min(ans,dp[i-9**j]+1) j+=1 dp[i]=ans print(ans)
n=int(eval(input())) l=[1] l_9=[pow(9,i) for i in range(1,7)] l_6=[pow(6,i) for i in range(1,8)] l+=l_9 l+=l_6 l.sort(reverse=True) dp=[10**9 for i in range(n+1)] dp[0]=0 for i in range(1,n+1): for j in l: if i-j>=0: dp[i]=min(dp[i],dp[i-j]+1) print((dp[n]))
16
17
261
293
n = int(eval(input())) dp = [0] * (n + 1) for i in range(1, n + 1): ans = dp[i - 1] + 1 j = 1 while i >= 6**j: ans = min(ans, dp[i - 6**j] + 1) j += 1 j = 1 while i >= 9**j: ans = min(ans, dp[i - 9**j] + 1) j += 1 dp[i] = ans print(ans)
n = int(eval(input())) l = [1] l_9 = [pow(9, i) for i in range(1, 7)] l_6 = [pow(6, i) for i in range(1, 8)] l += l_9 l += l_6 l.sort(reverse=True) dp = [10**9 for i in range(n + 1)] dp[0] = 0 for i in range(1, n + 1): for j in l: if i - j >= 0: dp[i] = min(dp[i], dp[i - j] + 1) print((dp[n]))
false
5.882353
[ "-dp = [0] * (n + 1)", "+l = [1]", "+l_9 = [pow(9, i) for i in range(1, 7)]", "+l_6 = [pow(6, i) for i in range(1, 8)]", "+l += l_9", "+l += l_6", "+l.sort(reverse=True)", "+dp = [10**9 for i in range(n + 1)]", "+dp[0] = 0", "- ans = dp[i - 1] + 1", "- j = 1", "- while i >= 6**j:", ...
false
0.149503
0.1009
1.481694
[ "s816483740", "s946248321" ]
u810978770
p04011
python
s347155720
s358846621
19
17
3,060
2,940
Accepted
Accepted
10.53
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) ans = 0 for i in range(1,n+1): if i <= k: ans += x else: ans += y print(ans)
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) ans = 0 if n > k: print(((n - k) * y + k * x)) else: print((n * x))
11
9
178
147
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) ans = 0 for i in range(1, n + 1): if i <= k: ans += x else: ans += y print(ans)
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) ans = 0 if n > k: print(((n - k) * y + k * x)) else: print((n * x))
false
18.181818
[ "-for i in range(1, n + 1):", "- if i <= k:", "- ans += x", "- else:", "- ans += y", "-print(ans)", "+if n > k:", "+ print(((n - k) * y + k * x))", "+else:", "+ print((n * x))" ]
false
0.077986
0.072619
1.073896
[ "s347155720", "s358846621" ]
u594567187
p03436
python
s978089761
s193965349
27
24
3,316
3,064
Accepted
Accepted
11.11
import sys from collections import defaultdict nesw = [[0, 1], [0, -1], [1, 0], [-1, 0]] height, width = list(map(int, input().split(" "))) root = [] black = 0 for i in range(height): temp = [n for n in eval(input())] root.append(temp) black += temp.count("#") start_y, start_x = 0, 0 end_y, end...
height, width = list(map(int, input().split(" "))) target = [] white_num = 0 for h in range(height): temp = [n for n in eval(input())] white_num += temp.count(".") target.append(temp) queue = [[0, 0]] goal = -1 turn = 1 visited = [[0 for n in range(width)] for m in range(height)] visited[0][0] = ...
38
33
1,010
1,012
import sys from collections import defaultdict nesw = [[0, 1], [0, -1], [1, 0], [-1, 0]] height, width = list(map(int, input().split(" "))) root = [] black = 0 for i in range(height): temp = [n for n in eval(input())] root.append(temp) black += temp.count("#") start_y, start_x = 0, 0 end_y, end_x = height ...
height, width = list(map(int, input().split(" "))) target = [] white_num = 0 for h in range(height): temp = [n for n in eval(input())] white_num += temp.count(".") target.append(temp) queue = [[0, 0]] goal = -1 turn = 1 visited = [[0 for n in range(width)] for m in range(height)] visited[0][0] = 1 all_move ...
false
13.157895
[ "-import sys", "-from collections import defaultdict", "-", "-nesw = [[0, 1], [0, -1], [1, 0], [-1, 0]]", "-root = []", "-black = 0", "-for i in range(height):", "+target = []", "+white_num = 0", "+for h in range(height):", "- root.append(temp)", "- black += temp.count(\"#\")", "-start...
false
0.048494
0.048576
0.998308
[ "s978089761", "s193965349" ]
u597374218
p03262
python
s176089371
s644378790
128
91
16,280
16,368
Accepted
Accepted
28.91
from fractions import gcd from functools import reduce N,D=list(map(int,input().split())) X=list(map(int,input().split())) X=sorted(X+[D]) m=min(X) s=[X[i]-m for i in range(1,len(X))] print((reduce(gcd,s)))
from fractions import gcd from functools import reduce N,X=list(map(int,input().split())) x=[abs(X-i) for i in map(int,input().split())] print((reduce(gcd,x)))
8
5
205
155
from fractions import gcd from functools import reduce N, D = list(map(int, input().split())) X = list(map(int, input().split())) X = sorted(X + [D]) m = min(X) s = [X[i] - m for i in range(1, len(X))] print((reduce(gcd, s)))
from fractions import gcd from functools import reduce N, X = list(map(int, input().split())) x = [abs(X - i) for i in map(int, input().split())] print((reduce(gcd, x)))
false
37.5
[ "-N, D = list(map(int, input().split()))", "-X = list(map(int, input().split()))", "-X = sorted(X + [D])", "-m = min(X)", "-s = [X[i] - m for i in range(1, len(X))]", "-print((reduce(gcd, s)))", "+N, X = list(map(int, input().split()))", "+x = [abs(X - i) for i in map(int, input().split())]", "+prin...
false
0.053849
0.049911
1.078915
[ "s176089371", "s644378790" ]
u392319141
p02556
python
s100611251
s979715284
856
428
36,016
36,104
Accepted
Accepted
50
N = int(eval(input())) def dist(A, B): return abs(A[0] - B[0]) + abs(A[1] - B[1]) XY = [tuple(map(int, input().split())) for _ in range(N)] INF = -10**10 ans = 0 for O in [(INF, INF), (-INF, INF)]: S = XY[0] for xy in XY: if dist(O, S) < dist(O, xy): S = xy O = S ...
N = int(eval(input())) def rot(x, y): return (x - y, x + y) UV = [rot(*list(map(int, input().split()))) for _ in range(N)] mxU = max(u for u, _ in UV) miU = min(u for u, _ in UV) mxV = max(v for _, v in UV) miV = min(v for _, v in UV) print((max(mxU - miU, mxV - miV)))
21
13
434
276
N = int(eval(input())) def dist(A, B): return abs(A[0] - B[0]) + abs(A[1] - B[1]) XY = [tuple(map(int, input().split())) for _ in range(N)] INF = -(10**10) ans = 0 for O in [(INF, INF), (-INF, INF)]: S = XY[0] for xy in XY: if dist(O, S) < dist(O, xy): S = xy O = S for xy in ...
N = int(eval(input())) def rot(x, y): return (x - y, x + y) UV = [rot(*list(map(int, input().split()))) for _ in range(N)] mxU = max(u for u, _ in UV) miU = min(u for u, _ in UV) mxV = max(v for _, v in UV) miV = min(v for _, v in UV) print((max(mxU - miU, mxV - miV)))
false
38.095238
[ "-def dist(A, B):", "- return abs(A[0] - B[0]) + abs(A[1] - B[1])", "+def rot(x, y):", "+ return (x - y, x + y)", "-XY = [tuple(map(int, input().split())) for _ in range(N)]", "-INF = -(10**10)", "-ans = 0", "-for O in [(INF, INF), (-INF, INF)]:", "- S = XY[0]", "- for xy in XY:", "-...
false
0.036139
0.03571
1.012018
[ "s100611251", "s979715284" ]
u844789719
p02782
python
s684256805
s529460033
1,035
698
121,716
82,164
Accepted
Accepted
32.56
r, c, R, C = [int(_) for _ in input().split()] mod = 10**9 + 7 f = [1] * (3 * 10**6 + 10) for i in range(1, 3 * 10**6 + 10): f[i] = i * f[i - 1] % mod fi = {} def inv(x): return pow(x, mod - 2, mod) a1 = (C + 2) * f[c + 1] * f[C + R + 2] - (c + 1) * f[C + 2] * f[c + R + 1] a1 *= inv(f[c + 1])...
r, c, R, C = [int(_) for _ in input().split()] mod = 10**9 + 7 f = [1] * (2 * 10**6 + 10) for i in range(1, 2 * 10**6 + 10): f[i] = i * f[i - 1] % mod fi = {} def inv(x): return pow(x, mod - 2, mod) a1 = (C + 2) * f[c + 1] * f[C + R + 2] - (c + 1) * f[C + 2] * f[c + R + 1] a1 *= inv(f[c + 1])...
20
20
513
513
r, c, R, C = [int(_) for _ in input().split()] mod = 10**9 + 7 f = [1] * (3 * 10**6 + 10) for i in range(1, 3 * 10**6 + 10): f[i] = i * f[i - 1] % mod fi = {} def inv(x): return pow(x, mod - 2, mod) a1 = (C + 2) * f[c + 1] * f[C + R + 2] - (c + 1) * f[C + 2] * f[c + R + 1] a1 *= inv(f[c + 1]) * inv(f[C + 2]...
r, c, R, C = [int(_) for _ in input().split()] mod = 10**9 + 7 f = [1] * (2 * 10**6 + 10) for i in range(1, 2 * 10**6 + 10): f[i] = i * f[i - 1] % mod fi = {} def inv(x): return pow(x, mod - 2, mod) a1 = (C + 2) * f[c + 1] * f[C + R + 2] - (c + 1) * f[C + 2] * f[c + R + 1] a1 *= inv(f[c + 1]) * inv(f[C + 2]...
false
0
[ "-f = [1] * (3 * 10**6 + 10)", "-for i in range(1, 3 * 10**6 + 10):", "+f = [1] * (2 * 10**6 + 10)", "+for i in range(1, 2 * 10**6 + 10):" ]
false
1.350222
0.850934
1.586752
[ "s684256805", "s529460033" ]
u266014018
p02720
python
s418500574
s893124651
1,048
82
12,480
18,952
Accepted
Accepted
92.18
import queue K = int(eval(input())) q = queue.Queue() for i in range(1,10): q.put(i) for i in range(K): x = q.get() a = x%10 if a !=0: q.put(10*x +a -1) q.put(10*x +a ) if a != 9: q.put(10*x +a +1) print(x)
def main(): import sys def input(): return sys.stdin.readline().rstrip() k = int(eval(input())) from collections import deque que = deque(list(range(1, 10))) for i in range(k): now = que.popleft() r = now%10 nx = now*10 if r == 0: for j in [...
15
23
255
582
import queue K = int(eval(input())) q = queue.Queue() for i in range(1, 10): q.put(i) for i in range(K): x = q.get() a = x % 10 if a != 0: q.put(10 * x + a - 1) q.put(10 * x + a) if a != 9: q.put(10 * x + a + 1) print(x)
def main(): import sys def input(): return sys.stdin.readline().rstrip() k = int(eval(input())) from collections import deque que = deque(list(range(1, 10))) for i in range(k): now = que.popleft() r = now % 10 nx = now * 10 if r == 0: for j ...
false
34.782609
[ "-import queue", "+def main():", "+ import sys", "-K = int(eval(input()))", "-q = queue.Queue()", "-for i in range(1, 10):", "- q.put(i)", "-for i in range(K):", "- x = q.get()", "- a = x % 10", "- if a != 0:", "- q.put(10 * x + a - 1)", "- q.put(10 * x + a)", "- ...
false
0.124867
0.043869
2.846347
[ "s418500574", "s893124651" ]
u635277286
p03611
python
s156808869
s243106624
202
117
19,684
20,004
Accepted
Accepted
42.08
N = int(eval(input())) a = list(map(int,input().split())) def solve(cand): global a res = 0 for ai in a: if ai - 1 == cand or ai == cand or ai + 1 == cand: res += 1 return res cnt = {} for ai in a: for i in range(-1,2): b = ai + i if b >= 0: if b not in cnt: cnt[b] = 1 else: ...
from collections import defaultdict N = int(eval(input())) a = list(map(int,input().split())) cnt = defaultdict(int) for ai in a: cnt[ai - 1] += 1 cnt[ai] += 1 cnt[ai + 1] += 1 res = max(cnt.values()) print(res)
25
14
415
225
N = int(eval(input())) a = list(map(int, input().split())) def solve(cand): global a res = 0 for ai in a: if ai - 1 == cand or ai == cand or ai + 1 == cand: res += 1 return res cnt = {} for ai in a: for i in range(-1, 2): b = ai + i if b >= 0: if b...
from collections import defaultdict N = int(eval(input())) a = list(map(int, input().split())) cnt = defaultdict(int) for ai in a: cnt[ai - 1] += 1 cnt[ai] += 1 cnt[ai + 1] += 1 res = max(cnt.values()) print(res)
false
44
[ "+from collections import defaultdict", "+", "-", "-", "-def solve(cand):", "- global a", "- res = 0", "- for ai in a:", "- if ai - 1 == cand or ai == cand or ai + 1 == cand:", "- res += 1", "- return res", "-", "-", "-cnt = {}", "+cnt = defaultdict(int)", ...
false
0.044318
0.04491
0.986835
[ "s156808869", "s243106624" ]
u944209426
p03241
python
s601520656
s666834532
1,880
1,032
41,972
41,728
Accepted
Accepted
45.11
n,m=list(map(int,input().split())) x=1 if n==1: x=m else: for i in range(1,100000000): if m%i==0 and i*n<=m: x=i print(x)
n,m=list(map(int,input().split())) x=1 if m%n==0: print((m//n)) else: for i in range(1,m//n+1): if m%i==0 and i*n<=m: x=max(x,i) if m%i==0 and (m//i)*n<=m: x=max(x,m//i) print(x)
9
11
151
232
n, m = list(map(int, input().split())) x = 1 if n == 1: x = m else: for i in range(1, 100000000): if m % i == 0 and i * n <= m: x = i print(x)
n, m = list(map(int, input().split())) x = 1 if m % n == 0: print((m // n)) else: for i in range(1, m // n + 1): if m % i == 0 and i * n <= m: x = max(x, i) if m % i == 0 and (m // i) * n <= m: x = max(x, m // i) print(x)
false
18.181818
[ "-if n == 1:", "- x = m", "+if m % n == 0:", "+ print((m // n))", "- for i in range(1, 100000000):", "+ for i in range(1, m // n + 1):", "- x = i", "-print(x)", "+ x = max(x, i)", "+ if m % i == 0 and (m // i) * n <= m:", "+ x = max(x, m // i)"...
false
0.007033
0.081516
0.086282
[ "s601520656", "s666834532" ]
u600402037
p02693
python
s903621997
s649707676
22
20
9,128
9,180
Accepted
Accepted
9.09
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) K = ir() A, B = lr() left = -(-A//K) right = B // K bl = left <= right if A % K == 0 or B % K == 0: bl = True print(('OK' if bl else 'NG'))
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) K = ir() A, B = lr() left = -(-A//K) right = B // K bl = left <= right print(('OK' if bl else 'NG'))
15
13
293
248
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) K = ir() A, B = lr() left = -(-A // K) right = B // K bl = left <= right if A % K == 0 or B % K == 0: bl = True print(("OK" if bl else "NG"))
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) K = ir() A, B = lr() left = -(-A // K) right = B // K bl = left <= right print(("OK" if bl else "NG"))
false
13.333333
[ "-if A % K == 0 or B % K == 0:", "- bl = True" ]
false
0.116915
0.041592
2.811038
[ "s903621997", "s649707676" ]
u588341295
p03845
python
s653388239
s673923905
30
18
3,444
3,060
Accepted
Accepted
40
# -*- coding: utf-8 -*- import copy N = int(eval(input())) tests = list(map(int, input().split())) M = int(eval(input())) for i in range(M): tmp = copy.deepcopy(tests) p, x = list(map(int, input().split())) tmp[p-1] = x print((sum(tmp)))
# -*- coding: utf-8 -*- N = int(eval(input())) tests = list(map(int, input().split())) M = int(eval(input())) # 予め基準になる合計値を出しておく sum1 = sum(tests) for i in range(M): p, x = list(map(int, input().split())) # 先に出しておいた基準からの差分で算出 print((sum1 + (x - tests[p-1])))
13
13
248
265
# -*- coding: utf-8 -*- import copy N = int(eval(input())) tests = list(map(int, input().split())) M = int(eval(input())) for i in range(M): tmp = copy.deepcopy(tests) p, x = list(map(int, input().split())) tmp[p - 1] = x print((sum(tmp)))
# -*- coding: utf-8 -*- N = int(eval(input())) tests = list(map(int, input().split())) M = int(eval(input())) # 予め基準になる合計値を出しておく sum1 = sum(tests) for i in range(M): p, x = list(map(int, input().split())) # 先に出しておいた基準からの差分で算出 print((sum1 + (x - tests[p - 1])))
false
0
[ "-import copy", "-", "+# 予め基準になる合計値を出しておく", "+sum1 = sum(tests)", "- tmp = copy.deepcopy(tests)", "- tmp[p - 1] = x", "- print((sum(tmp)))", "+ # 先に出しておいた基準からの差分で算出", "+ print((sum1 + (x - tests[p - 1])))" ]
false
0.064442
0.149337
0.431517
[ "s653388239", "s673923905" ]
u348805958
p02632
python
s942253398
s154933760
302
262
106,672
106,680
Accepted
Accepted
13.25
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def _cmb(N, mod): N1 = N + 1 fact = [1] * N1 inv = [1] * N1 for i in range(2, N1): fact[i] = fact[i-1] * i % mod inv[N] = pow(fact[N], mod-2, mod) for i in range(N-1, 1, -1): ...
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def _cmb(N, mod): N1 = N + 1 fact = [1] * N1 inv = [1] * N1 for i in range(2, N1): fact[i] = fact[i-1] * i % mod inv[N] = pow(fact[N], mod-2, mod) for i in range(N-1, 1, -1): ...
41
41
868
874
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def _cmb(N, mod): N1 = N + 1 fact = [1] * N1 inv = [1] * N1 for i in range(2, N1): fact[i] = fact[i - 1] * i % mod inv[N] = pow(fact[N], mod - 2, mod) for i in range(N - 1, 1, -1): inv[i] ...
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def _cmb(N, mod): N1 = N + 1 fact = [1] * N1 inv = [1] * N1 for i in range(2, N1): fact[i] = fact[i - 1] * i % mod inv[N] = pow(fact[N], mod - 2, mod) for i in range(N - 1, 1, -1): inv[i] ...
false
0
[ "- return fact[a] * inv[b] * inv[a - b] % mod", "+ return fact[a] * inv[b] % mod * inv[a - b] % mod" ]
false
0.042112
0.036568
1.151617
[ "s942253398", "s154933760" ]
u535803878
p02703
python
s928583936
s807563207
1,830
1,594
124,832
124,720
Accepted
Accepted
12.9
import heapq from collections import defaultdict h = [] heapq.heapify(h) n, m, s = list(map(int, input().split())) a, b = [[None] * m for _ in range(2)] c, d = [[None] * n for _ in range(2)] ns = defaultdict(list) uv2e = {} for i in range(m): u,v,a[i],b[i] = list(map(int, input().split())) ns...
import sys input = lambda : sys.stdin.readline().rstrip() import heapq from collections import defaultdict h = [] heapq.heapify(h) n, m, s = list(map(int, input().split())) a, b = [[None] * m for _ in range(2)] c, d = [[None] * n for _ in range(2)] ns = defaultdict(list) uv2e = {} for i in range(m): ...
50
52
1,207
1,267
import heapq from collections import defaultdict h = [] heapq.heapify(h) n, m, s = list(map(int, input().split())) a, b = [[None] * m for _ in range(2)] c, d = [[None] * n for _ in range(2)] ns = defaultdict(list) uv2e = {} for i in range(m): u, v, a[i], b[i] = list(map(int, input().split())) ns[u - 1].append(...
import sys input = lambda: sys.stdin.readline().rstrip() import heapq from collections import defaultdict h = [] heapq.heapify(h) n, m, s = list(map(int, input().split())) a, b = [[None] * m for _ in range(2)] c, d = [[None] * n for _ in range(2)] ns = defaultdict(list) uv2e = {} for i in range(m): u, v, a[i], b[...
false
3.846154
[ "+import sys", "+", "+input = lambda: sys.stdin.readline().rstrip()" ]
false
0.044913
0.045216
0.99329
[ "s928583936", "s807563207" ]
u047918169
p02860
python
s087830821
s827063055
19
17
2,940
2,940
Accepted
Accepted
10.53
n = int(input()) s = input() if n % 2 == 1: print('No') exit() l = int(n/2) print('Yes') if s[:l] == s[l:] else print('No')
n = int(input()) s = input() print('Yes') if s[:n//2] == s[n//2:] else print('No')
9
3
141
84
n = int(input()) s = input() if n % 2 == 1: print("No") exit() l = int(n / 2) print("Yes") if s[:l] == s[l:] else print("No")
n = int(input()) s = input() print("Yes") if s[: n // 2] == s[n // 2 :] else print("No")
false
66.666667
[ "-if n % 2 == 1:", "- print(\"No\")", "- exit()", "-l = int(n / 2)", "-print(\"Yes\") if s[:l] == s[l:] else print(\"No\")", "+print(\"Yes\") if s[: n // 2] == s[n // 2 :] else print(\"No\")" ]
false
0.114269
0.040839
2.798048
[ "s087830821", "s827063055" ]
u556016145
p04012
python
s602426321
s315902618
24
21
3,316
3,316
Accepted
Accepted
12.5
import collections s = [] a = 0 x = eval(input()) if len(x) % 2 != 0: print('No') else: for i in x: s.append(i) c = collections.Counter(s) values, counts = list(zip(*c.most_common())) for j in counts: if j % 2 == 0: a += 1 if len(counts) == a: ...
import collections s = eval(input()) lst = [] for i in s: lst.append(i) c = collections.Counter(lst) for i in list(c.values()): if i % 2 != 0: x = 'No' break else: x = 'Yes' print(x)
19
14
353
220
import collections s = [] a = 0 x = eval(input()) if len(x) % 2 != 0: print("No") else: for i in x: s.append(i) c = collections.Counter(s) values, counts = list(zip(*c.most_common())) for j in counts: if j % 2 == 0: a += 1 if len(counts) == a: print("Yes") ...
import collections s = eval(input()) lst = [] for i in s: lst.append(i) c = collections.Counter(lst) for i in list(c.values()): if i % 2 != 0: x = "No" break else: x = "Yes" print(x)
false
26.315789
[ "-s = []", "-a = 0", "-x = eval(input())", "-if len(x) % 2 != 0:", "- print(\"No\")", "-else:", "- for i in x:", "- s.append(i)", "- c = collections.Counter(s)", "- values, counts = list(zip(*c.most_common()))", "- for j in counts:", "- if j % 2 == 0:", "- ...
false
0.039484
0.04584
0.861358
[ "s602426321", "s315902618" ]
u498487134
p02972
python
s706819562
s458735339
302
158
81,128
108,752
Accepted
Accepted
47.68
N=int(eval(input())) a=list(map(int,input().split())) b=[0]*(N+1)#箱 ans=[] for i in range(N,0,-1): bit=0 for j in range(N//i): bit+=b[i+j*i] bit%=2 if bit!=a[i-1]: b[i]=1 ans.append(i) print((sum(b))) print((' '.join(map(str, ans))))
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() a=LI() b=[0]*N for i in range(N-1,-1,-1): temp=0 for j ...
16
35
280
659
N = int(eval(input())) a = list(map(int, input().split())) b = [0] * (N + 1) # 箱 ans = [] for i in range(N, 0, -1): bit = 0 for j in range(N // i): bit += b[i + j * i] bit %= 2 if bit != a[i - 1]: b[i] = 1 ans.append(i) print((sum(b))) print((" ".join(map(str, ans))))
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod = 10**9 + 7 N = I() a = LI() b = [0] * N for i in range(N - 1, -1, -1): temp = 0 ...
false
54.285714
[ "-N = int(eval(input()))", "-a = list(map(int, input().split()))", "-b = [0] * (N + 1) # 箱", "-ans = []", "-for i in range(N, 0, -1):", "- bit = 0", "- for j in range(N // i):", "- bit += b[i + j * i]", "- bit %= 2", "- if bit != a[i - 1]:", "- b[i] = 1", "- a...
false
0.085119
0.046194
1.842662
[ "s706819562", "s458735339" ]
u271752821
p02885
python
s139959977
s901319677
19
17
2,940
2,940
Accepted
Accepted
10.53
a, b = list(map(int, input().split())) if a - b * 2 >= 0: print((a - b * 2)) else: print((0))
a, b = list(map(int, input().split())) print((max(0, a - b * 2)))
5
2
95
58
a, b = list(map(int, input().split())) if a - b * 2 >= 0: print((a - b * 2)) else: print((0))
a, b = list(map(int, input().split())) print((max(0, a - b * 2)))
false
60
[ "-if a - b * 2 >= 0:", "- print((a - b * 2))", "-else:", "- print((0))", "+print((max(0, a - b * 2)))" ]
false
0.049769
0.052366
0.950403
[ "s139959977", "s901319677" ]
u117078923
p02922
python
s373693476
s616646664
19
17
3,064
2,940
Accepted
Accepted
10.53
a, b = list(map(int, input().split())) c = 0 sum = 1 while True: if sum>= b: print(c) break else: sum += a-1 c+= 1
a,b=list(map(int,input().split())) m=1 n=0 while True: if m<b: m += a-1 n += 1 else: break print(n)
10
10
157
118
a, b = list(map(int, input().split())) c = 0 sum = 1 while True: if sum >= b: print(c) break else: sum += a - 1 c += 1
a, b = list(map(int, input().split())) m = 1 n = 0 while True: if m < b: m += a - 1 n += 1 else: break print(n)
false
0
[ "-c = 0", "-sum = 1", "+m = 1", "+n = 0", "- if sum >= b:", "- print(c)", "+ if m < b:", "+ m += a - 1", "+ n += 1", "+ else:", "- else:", "- sum += a - 1", "- c += 1", "+print(n)" ]
false
0.046429
0.183248
0.253366
[ "s373693476", "s616646664" ]
u952656646
p03565
python
s995987099
s815536269
22
20
3,188
3,188
Accepted
Accepted
9.09
import re S_ = eval(input()) T = eval(input()) Srev = "".join(reversed(S_)) Trev = "".join(reversed(T)) pattern = "".join(["[{}?]".format(t) for t in Trev]) ans = re.sub(pattern, Trev, Srev, count=1) ans = "".join(reversed(ans.replace("?", "a"))) if ans.count(T): print(ans) else: print("UNRESTORA...
import re S_ = eval(input()) T = eval(input()) Tr = T[::-1] Sr = S_[::-1] reg = "".join(["[{}?]".format(x) for x in Tr]) ans = re.sub(reg, Tr, Sr, count=1) if ans.count(Tr)==1: print((ans.replace("?", "a")[::-1])) else: print("UNRESTORABLE")
14
11
313
250
import re S_ = eval(input()) T = eval(input()) Srev = "".join(reversed(S_)) Trev = "".join(reversed(T)) pattern = "".join(["[{}?]".format(t) for t in Trev]) ans = re.sub(pattern, Trev, Srev, count=1) ans = "".join(reversed(ans.replace("?", "a"))) if ans.count(T): print(ans) else: print("UNRESTORABLE")
import re S_ = eval(input()) T = eval(input()) Tr = T[::-1] Sr = S_[::-1] reg = "".join(["[{}?]".format(x) for x in Tr]) ans = re.sub(reg, Tr, Sr, count=1) if ans.count(Tr) == 1: print((ans.replace("?", "a")[::-1])) else: print("UNRESTORABLE")
false
21.428571
[ "-Srev = \"\".join(reversed(S_))", "-Trev = \"\".join(reversed(T))", "-pattern = \"\".join([\"[{}?]\".format(t) for t in Trev])", "-ans = re.sub(pattern, Trev, Srev, count=1)", "-ans = \"\".join(reversed(ans.replace(\"?\", \"a\")))", "-if ans.count(T):", "- print(ans)", "+Tr = T[::-1]", "+Sr = S_...
false
0.0505
0.074751
0.67558
[ "s995987099", "s815536269" ]
u187516587
p02595
python
s880340195
s898689230
453
287
9,172
9,076
Accepted
Accepted
36.64
N,D=list(map(int,input().split())) a=0 d=D**2 for i in range(N): x,y=list(map(int,input().split())) if x**2+y**2<=d: a+=1 print(a)
import sys def input(): return sys.stdin.readline()[:-1] N,D=list(map(int,input().split())) a=0 d=D**2 for i in range(N): x,y=list(map(int,input().split())) if x**2+y**2<=d: a+=1 print(a)
8
11
142
206
N, D = list(map(int, input().split())) a = 0 d = D**2 for i in range(N): x, y = list(map(int, input().split())) if x**2 + y**2 <= d: a += 1 print(a)
import sys def input(): return sys.stdin.readline()[:-1] N, D = list(map(int, input().split())) a = 0 d = D**2 for i in range(N): x, y = list(map(int, input().split())) if x**2 + y**2 <= d: a += 1 print(a)
false
27.272727
[ "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline()[:-1]", "+", "+" ]
false
0.073437
0.057346
1.280583
[ "s880340195", "s898689230" ]
u606045429
p02862
python
s295945048
s874423916
115
96
3,064
3,064
Accepted
Accepted
16.52
def main(): def nCk(n, k, mod=10 ** 9 + 7): def xgcd(a, b): if b == 0: return (1, 0) x, y = xgcd(b, a % b) return (y, x - (a // b) * y) p, q = 1, 1 for i in range(n - k + 1, n + 1): p = (p * i) % mod for i in r...
def nCk(n, k, mod=10 ** 9 + 7): if n < k: return 0 k = min(k, n - k) numer = 1 for x in range(n - k + 1, n + 1): numer = (numer * x) % mod denom = 1 for x in range(1, k + 1): denom = (denom * x) % mod return numer * pow(denom, mod - 2, mod) % mod X, Y = l...
26
21
629
480
def main(): def nCk(n, k, mod=10**9 + 7): def xgcd(a, b): if b == 0: return (1, 0) x, y = xgcd(b, a % b) return (y, x - (a // b) * y) p, q = 1, 1 for i in range(n - k + 1, n + 1): p = (p * i) % mod for i in range(2, k +...
def nCk(n, k, mod=10**9 + 7): if n < k: return 0 k = min(k, n - k) numer = 1 for x in range(n - k + 1, n + 1): numer = (numer * x) % mod denom = 1 for x in range(1, k + 1): denom = (denom * x) % mod return numer * pow(denom, mod - 2, mod) % mod X, Y = list(map(int, ...
false
19.230769
[ "-def main():", "- def nCk(n, k, mod=10**9 + 7):", "- def xgcd(a, b):", "- if b == 0:", "- return (1, 0)", "- x, y = xgcd(b, a % b)", "- return (y, x - (a // b) * y)", "-", "- p, q = 1, 1", "- for i in range(n - k + 1, n + 1):...
false
0.10029
0.076523
1.310586
[ "s295945048", "s874423916" ]
u970109776
p03862
python
s240597127
s485593274
165
119
20,048
19,904
Accepted
Accepted
27.88
#coding: utf-8 N, X = (int(x) for x in input().split()) A = [int(x) for x in input().split()] diffs = [] for i in range(N-1): diffs.append(A[i]+A[i+1] - X) ret = 0 for i in range(N-1): tmp = min(diffs[i], A[i+1]) ret += tmp diffs[i] -= tmp if i+1 < len(diffs): diffs[i+1] ...
#coding: utf-8 N, X = (int(x) for x in input().split()) A = [int(x) for x in input().split()] ret = 0 for i in range(N-1): if A[i] + A[i+1] > X: tmp = A[i] + A[i+1] - X ret += tmp A[i+1] -= min(A[i+1], tmp) print(ret)
20
15
390
265
# coding: utf-8 N, X = (int(x) for x in input().split()) A = [int(x) for x in input().split()] diffs = [] for i in range(N - 1): diffs.append(A[i] + A[i + 1] - X) ret = 0 for i in range(N - 1): tmp = min(diffs[i], A[i + 1]) ret += tmp diffs[i] -= tmp if i + 1 < len(diffs): diffs[i + 1] -= mi...
# coding: utf-8 N, X = (int(x) for x in input().split()) A = [int(x) for x in input().split()] ret = 0 for i in range(N - 1): if A[i] + A[i + 1] > X: tmp = A[i] + A[i + 1] - X ret += tmp A[i + 1] -= min(A[i + 1], tmp) print(ret)
false
25
[ "-diffs = []", "-for i in range(N - 1):", "- diffs.append(A[i] + A[i + 1] - X)", "- tmp = min(diffs[i], A[i + 1])", "- ret += tmp", "- diffs[i] -= tmp", "- if i + 1 < len(diffs):", "- diffs[i + 1] -= min(tmp, diffs[i + 1])", "- ret += diffs[i]", "-print((max(0, ret)))", ...
false
0.036514
0.0397
0.919759
[ "s240597127", "s485593274" ]
u226155577
p03783
python
s642597376
s552666124
1,000
609
102,488
36,460
Accepted
Accepted
39.1
# seishin.py N = int(eval(input())) P = [list(map(int, input().split())) for i in range(N)] INF = 10**18 from heapq import heappush, heappop l0, r0 = P[0] L = [-l0+1] R = [l0-1] s = t = 0 res = 0 for i in range(N-1): l0, r0 = P[i] l1, r1 = P[i+1] s += (r1 - l1); t += (r0 - l0) if...
# seishin.py N = int(eval(input())) P = [list(map(int, input().split())) for i in range(N)] from heapq import heappush, heappop l0, r0 = P[0] L = [-l0+1] R = [l0-1] s = t = 0 res = 0 for i in range(N-1): l0, r0 = P[i] l1, r1 = P[i+1] s += (r1 - l1); t += (r0 - l0) if -s-L[0] <= l1-1...
35
33
745
731
# seishin.py N = int(eval(input())) P = [list(map(int, input().split())) for i in range(N)] INF = 10**18 from heapq import heappush, heappop l0, r0 = P[0] L = [-l0 + 1] R = [l0 - 1] s = t = 0 res = 0 for i in range(N - 1): l0, r0 = P[i] l1, r1 = P[i + 1] s += r1 - l1 t += r0 - l0 if -s - L[0] <= l1...
# seishin.py N = int(eval(input())) P = [list(map(int, input().split())) for i in range(N)] from heapq import heappush, heappop l0, r0 = P[0] L = [-l0 + 1] R = [l0 - 1] s = t = 0 res = 0 for i in range(N - 1): l0, r0 = P[i] l1, r1 = P[i + 1] s += r1 - l1 t += r0 - l0 if -s - L[0] <= l1 - 1 <= t + R...
false
5.714286
[ "-INF = 10**18", "- res += l1 - 1 - p", "+ res += (l1 - 1) - p" ]
false
0.079366
0.108891
0.72886
[ "s642597376", "s552666124" ]
u046187684
p03480
python
s313615043
s964601714
57
40
4,852
6,244
Accepted
Accepted
29.82
#!/usr/bin/env python3 # coding=utf-8 import sys s = sys.stdin.readline().strip() check = [_s is "1" for _s in list(s)] index = 0 for i, (curr, next) in enumerate(zip(check[:len(s) // 2], check[1:len(s) // 2 + 1])): if curr ^ next: index = max(index, i + 1) check = check[::-1] for i, (curr, ne...
#!/usr/bin/env python3 # coding=utf-8 import sys s = sys.stdin.readline().strip() l = [_s is "1" for _s in list(s)] l_r = l[::-1] index = 0 for i, (c, n, c_r, n_r) in enumerate( zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])): if c ^ n or c_r ^ n_r: ...
16
14
469
359
#!/usr/bin/env python3 # coding=utf-8 import sys s = sys.stdin.readline().strip() check = [_s is "1" for _s in list(s)] index = 0 for i, (curr, next) in enumerate(zip(check[: len(s) // 2], check[1 : len(s) // 2 + 1])): if curr ^ next: index = max(index, i + 1) check = check[::-1] for i, (curr, next) in enu...
#!/usr/bin/env python3 # coding=utf-8 import sys s = sys.stdin.readline().strip() l = [_s is "1" for _s in list(s)] l_r = l[::-1] index = 0 for i, (c, n, c_r, n_r) in enumerate( zip( l[: len(s) // 2], l[1 : len(s) // 2 + 1], l_r[: len(s) // 2], l_r[1 : len(s) // 2 + 1], ) ): ...
false
12.5
[ "-check = [_s is \"1\" for _s in list(s)]", "+l = [_s is \"1\" for _s in list(s)]", "+l_r = l[::-1]", "-for i, (curr, next) in enumerate(zip(check[: len(s) // 2], check[1 : len(s) // 2 + 1])):", "- if curr ^ next:", "- index = max(index, i + 1)", "-check = check[::-1]", "-for i, (curr, next)...
false
0.071109
0.069955
1.0165
[ "s313615043", "s964601714" ]
u940139461
p02850
python
s993975244
s545381565
1,015
836
97,824
80,032
Accepted
Accepted
17.64
# https://atcoder.jp/contests/abc146/tasks/abc146_d n = int(eval(input())) graph = [[] for _ in range(n)] edges = {} for i in range(n - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 graph[a].append(b) graph[b].append(a) edges[(a, b)] = i edges[(b, a)] = i ans = [...
from collections import deque n = int(eval(input())) graph = [[] for _ in range(n)] edges = {} for i in range(n - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 graph[a].append(b) # graph[b].append(a) edges[(a, b)] = i # edges[(b, a)] = i que = deque([0]) ans = [0]...
35
36
741
680
# https://atcoder.jp/contests/abc146/tasks/abc146_d n = int(eval(input())) graph = [[] for _ in range(n)] edges = {} for i in range(n - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 graph[a].append(b) graph[b].append(a) edges[(a, b)] = i edges[(b, a)] = i ans = [0] * (n - 1) stack...
from collections import deque n = int(eval(input())) graph = [[] for _ in range(n)] edges = {} for i in range(n - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 graph[a].append(b) # graph[b].append(a) edges[(a, b)] = i # edges[(b, a)] = i que = deque([0]) ans = [0] * (n - 1) visit...
false
2.777778
[ "-# https://atcoder.jp/contests/abc146/tasks/abc146_d", "+from collections import deque", "+", "- graph[b].append(a)", "+ # graph[b].append(a)", "- edges[(b, a)] = i", "+ # edges[(b, a)] = i", "+que = deque([0])", "-stack = [0]", "-while stack:", "- node = stack.pop()", "- co...
false
0.098466
0.105481
0.9335
[ "s993975244", "s545381565" ]
u444856278
p03289
python
s972260084
s722631222
27
19
3,316
3,188
Accepted
Accepted
29.63
import re;print(("AC"if re.match("^A[a-z]+C[a-z]+$",eval(input()))else"WA"))
import re print((re.match(r"A[a-z]+C[a-z]+$",eval(input()))and"AC"or"WA"))
1
2
68
67
import re print(("AC" if re.match("^A[a-z]+C[a-z]+$", eval(input())) else "WA"))
import re print((re.match(r"A[a-z]+C[a-z]+$", eval(input())) and "AC" or "WA"))
false
50
[ "-print((\"AC\" if re.match(\"^A[a-z]+C[a-z]+$\", eval(input())) else \"WA\"))", "+print((re.match(r\"A[a-z]+C[a-z]+$\", eval(input())) and \"AC\" or \"WA\"))" ]
false
0.046996
0.089089
0.527515
[ "s972260084", "s722631222" ]
u888337853
p03168
python
s933077825
s226153959
413
353
228,848
228,592
Accepted
Accepted
14.53
import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy # import heapq import decimal # import statistics import queue # import numpy as np sys.setrecursionlimit(10 ** 9) INF = 10 ** 16 MOD = 10 ** 9 + 7 ...
import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy # import heapq import decimal # import statistics import queue # import numpy as np sys.setrecursionlimit(10 ** 9) INF = 10 ** 16 MOD = 10 ** 9 + 7 ...
49
49
982
984
import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy # import heapq import decimal # import statistics import queue # import numpy as np sys.setrecursionlimit(10**9) INF = 10**16 MOD = 10**9 + 7 # MOD = 998244353 ni =...
import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy # import heapq import decimal # import statistics import queue # import numpy as np sys.setrecursionlimit(10**9) INF = 10**16 MOD = 10**9 + 7 # MOD = 998244353 ni =...
false
0
[ "- for j in range(n):", "+ for j in range(i + 1):" ]
false
0.046745
0.047254
0.989234
[ "s933077825", "s226153959" ]
u810288681
p02842
python
s120690841
s951695243
169
18
38,384
2,940
Accepted
Accepted
89.35
import math n = int(eval(input())) ans = math.ceil(n/1.08) if math.floor((math.ceil(n/1.08))*1.08) != n: ans = ':(' print(ans)
import math n = int(eval(input())) x1 = math.ceil(n/1.08) print((':(' if math.floor(x1*1.08) != n else x1))
6
4
129
102
import math n = int(eval(input())) ans = math.ceil(n / 1.08) if math.floor((math.ceil(n / 1.08)) * 1.08) != n: ans = ":(" print(ans)
import math n = int(eval(input())) x1 = math.ceil(n / 1.08) print((":(" if math.floor(x1 * 1.08) != n else x1))
false
33.333333
[ "-ans = math.ceil(n / 1.08)", "-if math.floor((math.ceil(n / 1.08)) * 1.08) != n:", "- ans = \":(\"", "-print(ans)", "+x1 = math.ceil(n / 1.08)", "+print((\":(\" if math.floor(x1 * 1.08) != n else x1))" ]
false
0.032427
0.035573
0.911566
[ "s120690841", "s951695243" ]
u680851063
p02756
python
s865688668
s357768118
487
320
44,532
15,896
Accepted
Accepted
34.29
from collections import deque s = deque(eval(input())) n = int(eval(input())) l = [input().split(" ") for _ in range(n)] x = 0 for i in range(n): if l[i][0]=='1': if x == 0: x = 1 else: x = 0 elif l[i][0]=='2': if x == 0: if l[i][1]=='...
from collections import deque s = deque(eval(input())) n = int(eval(input())) #x.append(y) #x.appendleft(y) memo = 0 for i in range(n): q = list(input().split()) if q[0] == '1': if memo == 0: memo = 1 else: memo = 0 else: if memo == 0: if q[1] == '1': ...
29
24
619
530
from collections import deque s = deque(eval(input())) n = int(eval(input())) l = [input().split(" ") for _ in range(n)] x = 0 for i in range(n): if l[i][0] == "1": if x == 0: x = 1 else: x = 0 elif l[i][0] == "2": if x == 0: if l[i][1] == "1": ...
from collections import deque s = deque(eval(input())) n = int(eval(input())) # x.append(y) # x.appendleft(y) memo = 0 for i in range(n): q = list(input().split()) if q[0] == "1": if memo == 0: memo = 1 else: memo = 0 else: if memo == 0: if q[1] =...
false
17.241379
[ "-l = [input().split(\" \") for _ in range(n)]", "-x = 0", "+# x.append(y)", "+# x.appendleft(y)", "+memo = 0", "- if l[i][0] == \"1\":", "- if x == 0:", "- x = 1", "+ q = list(input().split())", "+ if q[0] == \"1\":", "+ if memo == 0:", "+ memo = 1...
false
0.042164
0.045486
0.926964
[ "s865688668", "s357768118" ]
u054556734
p02684
python
s678081362
s649172766
725
164
32,388
95,936
Accepted
Accepted
77.38
n,k = list(map(int,input().split())) a = [0]+list(map(int,input().split())) def bin(arr,val): left,right = 0,len(arr)-1 while left<=right: mid = (left+right)//2 if arr[mid]==val: return 1 elif arr[mid]<val: left = mid + 1 else: right = mid - 1 return 0 know = []...
n,k = list(map(int,input().split())) a = [0]+list(map(int,input().split())) def bin(arr,val): left,right = 0,len(arr)-1 while left<=right: mid = (left+right)//2 if arr[mid]==val: return 1 elif arr[mid]<val: left = mid + 1 else: right = mid - 1 return 0 know = []...
31
25
628
572
n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) def bin(arr, val): left, right = 0, len(arr) - 1 while left <= right: mid = (left + right) // 2 if arr[mid] == val: return 1 elif arr[mid] < val: left = mid + 1 else: ...
n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) def bin(arr, val): left, right = 0, len(arr) - 1 while left <= right: mid = (left + right) // 2 if arr[mid] == val: return 1 elif arr[mid] < val: left = mid + 1 else: ...
false
19.354839
[ "-# print(know,start,loop)", "-if k < len(know):", "- ans = know[k]", "-else:", "- k -= len(know)", "- ans = loop[k % len(loop)]", "+ans = know[k] if k < len(know) else loop[(k - len(know)) % len(loop)]" ]
false
0.04565
0.045101
1.012171
[ "s678081362", "s649172766" ]
u747602774
p02792
python
s057861261
s459709589
471
188
3,064
3,064
Accepted
Accepted
60.08
N = int(eval(input())) li = [[0 for j in range(9)] for i in range(9)] for i in range(1,N+1): start = str(i)[0] end = str(i)[-1] if start != '0' and end != '0': li[int(start)-1][int(end)-1] += 1 ans = 0 for i in range(1,N+1): start = str(i)[0] end = str(i)[-1] if start !=...
n = int(eval(input())) a = [[0 for i in range(10)] for j in range(10)] for i in range(1,n+1): s = str(i) a[int(s[0])][int(s[-1])] += 1 ans = 0 for i in range(1,10): for j in range(1,10): ans += a[i][j]*a[j][i] print(ans)
17
11
391
246
N = int(eval(input())) li = [[0 for j in range(9)] for i in range(9)] for i in range(1, N + 1): start = str(i)[0] end = str(i)[-1] if start != "0" and end != "0": li[int(start) - 1][int(end) - 1] += 1 ans = 0 for i in range(1, N + 1): start = str(i)[0] end = str(i)[-1] if start != "0" an...
n = int(eval(input())) a = [[0 for i in range(10)] for j in range(10)] for i in range(1, n + 1): s = str(i) a[int(s[0])][int(s[-1])] += 1 ans = 0 for i in range(1, 10): for j in range(1, 10): ans += a[i][j] * a[j][i] print(ans)
false
35.294118
[ "-N = int(eval(input()))", "-li = [[0 for j in range(9)] for i in range(9)]", "-for i in range(1, N + 1):", "- start = str(i)[0]", "- end = str(i)[-1]", "- if start != \"0\" and end != \"0\":", "- li[int(start) - 1][int(end) - 1] += 1", "+n = int(eval(input()))", "+a = [[0 for i in r...
false
0.072072
0.25612
0.281401
[ "s057861261", "s459709589" ]
u550061714
p02762
python
s195123856
s019977863
1,374
1,231
69,360
94,360
Accepted
Accepted
10.41
class UnionFind: def __init__(self, n): self.n = n self.parent = [i for i in range(n)] self.height = [1] * n self.size = [1] * n def find(self, x): if self.parent[x] == x: return x else: self.parent[x] = self.find(self.parent[x]...
from sys import exit from collections import Counter import numpy as np from scipy.sparse.csgraph import connected_components from scipy.sparse import csr_matrix N, M, K = list(map(int, input().split())) exc = [set() for _ in range(N)] edge = [] if M == 0: print((*[0 for _ in range(N)])) exit() ...
51
33
1,399
840
class UnionFind: def __init__(self, n): self.n = n self.parent = [i for i in range(n)] self.height = [1] * n self.size = [1] * n def find(self, x): if self.parent[x] == x: return x else: self.parent[x] = self.find(self.parent[x]) ...
from sys import exit from collections import Counter import numpy as np from scipy.sparse.csgraph import connected_components from scipy.sparse import csr_matrix N, M, K = list(map(int, input().split())) exc = [set() for _ in range(N)] edge = [] if M == 0: print((*[0 for _ in range(N)])) exit() for _ in range(...
false
35.294118
[ "-class UnionFind:", "- def __init__(self, n):", "- self.n = n", "- self.parent = [i for i in range(n)]", "- self.height = [1] * n", "- self.size = [1] * n", "-", "- def find(self, x):", "- if self.parent[x] == x:", "- return x", "- else...
false
0.073421
0.468557
0.156696
[ "s195123856", "s019977863" ]
u408260374
p00719
python
s165374415
s830386759
13,170
6,380
8,040
7,892
Accepted
Accepted
51.56
while True: N, M, P, A, B = list(map(int, input().split())) if not (N | M | P | A | B): break A, B = A - 1, B - 1 T = [int(x) for x in input().split()] dp = [[float("inf")] * M for _ in range(1 << N)] dp[0][A] = 0 D = [[float('inf')] * M for _ in range(M)] for _ in range...
while True: N, M, P, A, B = list(map(int, input().split())) if not (N | M | P | A | B): break A, B = A - 1, B - 1 T = [int(x) for x in input().split()] dp = [[float("inf")] * M for _ in range(1 << N)] dp[0][A] = 0 edges = [] for _ in range(P): s, t, c = list(map...
25
25
913
865
while True: N, M, P, A, B = list(map(int, input().split())) if not (N | M | P | A | B): break A, B = A - 1, B - 1 T = [int(x) for x in input().split()] dp = [[float("inf")] * M for _ in range(1 << N)] dp[0][A] = 0 D = [[float("inf")] * M for _ in range(M)] for _ in range(P): ...
while True: N, M, P, A, B = list(map(int, input().split())) if not (N | M | P | A | B): break A, B = A - 1, B - 1 T = [int(x) for x in input().split()] dp = [[float("inf")] * M for _ in range(1 << N)] dp[0][A] = 0 edges = [] for _ in range(P): s, t, c = list(map(int, inpu...
false
0
[ "- D = [[float(\"inf\")] * M for _ in range(M)]", "+ edges = []", "- D[s][t] = D[t][s] = c", "+ edges.append((s, t, c))", "+ edges.append((t, s, c))", "- for i in range(M):", "- for j in range(M):", "- for k in range(N):", "- ...
false
0.056342
0.154374
0.364972
[ "s165374415", "s830386759" ]
u821432765
p02688
python
s181280084
s048486798
55
23
67,248
9,188
Accepted
Accepted
58.18
N, K = list(map(int, input().split())) has_snack = set() for i in range(K): d = int(eval(input())) A = set(map(int, input().split())) has_snack |= A print((N-len(has_snack)))
N, K = list(map(int, input().split())) has_snack = [False]*N # has_snack: 1つ以上のお菓子を持っているかどうか # has_snack[i] = True なら、すぬけ君i+1は1つ以上のお菓子を持っている for i in range(K): d = int(eval(input())) # d を読む (使わないけど) A = list(map(int, input().split())) # A を読む for v in A: # A の各要素 v について、 has_snack[v-1]...
9
15
182
480
N, K = list(map(int, input().split())) has_snack = set() for i in range(K): d = int(eval(input())) A = set(map(int, input().split())) has_snack |= A print((N - len(has_snack)))
N, K = list(map(int, input().split())) has_snack = [False] * N # has_snack: 1つ以上のお菓子を持っているかどうか # has_snack[i] = True なら、すぬけ君i+1は1つ以上のお菓子を持っている for i in range(K): d = int(eval(input())) # d を読む (使わないけど) A = list(map(int, input().split())) # A を読む for v in A: # A の各要素 v について、 has_snack[v - 1] = Tru...
false
40
[ "-has_snack = set()", "+has_snack = [False] * N", "+# has_snack: 1つ以上のお菓子を持っているかどうか", "+# has_snack[i] = True なら、すぬけ君i+1は1つ以上のお菓子を持っている", "- d = int(eval(input()))", "- A = set(map(int, input().split()))", "- has_snack |= A", "-print((N - len(has_snack)))", "+ d = int(eval(input())) # d...
false
0.037071
0.037642
0.984827
[ "s181280084", "s048486798" ]
u533393669
p02750
python
s843328840
s826112761
1,445
714
140,576
72,028
Accepted
Accepted
50.59
#!/usr/bin/env pypy3 import sys import math import itertools import bisect INF = int(1e18) T_MAX = int(1e9) def main(): N, T = list(map(int, sys.stdin.readline().split())) shops = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] nzshops = [(a, b) for a, b in shops if a > 0...
#!/usr/bin/env pypy3 import sys import math import itertools import bisect INF = int(1e18) def main(): n, t = list(map(int, sys.stdin.readline().split())) nzshops = [] zshops = [] for _ in range(n): a, b = list(map(int, sys.stdin.readline().split())) (zshops if a == 0...
35
38
985
922
#!/usr/bin/env pypy3 import sys import math import itertools import bisect INF = int(1e18) T_MAX = int(1e9) def main(): N, T = list(map(int, sys.stdin.readline().split())) shops = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] nzshops = [(a, b) for a, b in shops if a > 0] zshops = ...
#!/usr/bin/env pypy3 import sys import math import itertools import bisect INF = int(1e18) def main(): n, t = list(map(int, sys.stdin.readline().split())) nzshops = [] zshops = [] for _ in range(n): a, b = list(map(int, sys.stdin.readline().split())) (zshops if a == 0 else nzshops).ap...
false
7.894737
[ "-T_MAX = int(1e9)", "- N, T = list(map(int, sys.stdin.readline().split()))", "- shops = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]", "- nzshops = [(a, b) for a, b in shops if a > 0]", "- zshops = [(a, b) for a, b in shops if a == 0]", "+ n, t = list(map(int, sys.stdi...
false
0.036798
0.059206
0.621529
[ "s843328840", "s826112761" ]
u564105430
p02265
python
s491753073
s866226819
4,010
2,800
69,736
420,656
Accepted
Accepted
30.17
import collections a=collections.deque() for _ in range(int(eval(input()))): b=eval(input()) if b[0]=='i':a.appendleft(b[7:]) elif b[6]==' ': try:a.remove(b[7:]) except:pass elif len(b)>10:a.popleft() elif len(b)>6:a.pop() print((*a))
from collections import deque import sys n = int(eval(input())) deq = deque() sub_deq = {} for cmd in sys.stdin.readlines(): if cmd == 'deleteFirst\n': while deq: data = deq.pop() if data[1]: data[1] = 0 break elif cmd == 'deleteLast\n'...
11
37
267
1,085
import collections a = collections.deque() for _ in range(int(eval(input()))): b = eval(input()) if b[0] == "i": a.appendleft(b[7:]) elif b[6] == " ": try: a.remove(b[7:]) except: pass elif len(b) > 10: a.popleft() elif len(b) > 6: a.p...
from collections import deque import sys n = int(eval(input())) deq = deque() sub_deq = {} for cmd in sys.stdin.readlines(): if cmd == "deleteFirst\n": while deq: data = deq.pop() if data[1]: data[1] = 0 break elif cmd == "deleteLast\n": w...
false
70.27027
[ "-import collections", "+from collections import deque", "+import sys", "-a = collections.deque()", "-for _ in range(int(eval(input()))):", "- b = eval(input())", "- if b[0] == \"i\":", "- a.appendleft(b[7:])", "- elif b[6] == \" \":", "- try:", "- a.remove(b[7:...
false
0.038459
0.038521
0.998395
[ "s491753073", "s866226819" ]
u380669795
p02641
python
s097660702
s123954457
25
19
9,180
9,184
Accepted
Accepted
24
X,N = list(map(int,input().split())) p = list(map(int,input().split())) import sys for i in range(100): if X-i not in p: print((X-i)) sys.exit() elif X+i not in p: print((X+i)) sys.exit()
X,N = list(map(int,input().split())) p = list(map(int,input().split())) import sys for i in range(51): if X-i not in p: print((X-i)) sys.exit() elif X+i not in p: print((X+i)) sys.exit()
13
13
237
236
X, N = list(map(int, input().split())) p = list(map(int, input().split())) import sys for i in range(100): if X - i not in p: print((X - i)) sys.exit() elif X + i not in p: print((X + i)) sys.exit()
X, N = list(map(int, input().split())) p = list(map(int, input().split())) import sys for i in range(51): if X - i not in p: print((X - i)) sys.exit() elif X + i not in p: print((X + i)) sys.exit()
false
0
[ "-for i in range(100):", "+for i in range(51):" ]
false
0.03789
0.065979
0.574276
[ "s097660702", "s123954457" ]
u918276501
p02381
python
s762315962
s293355923
60
30
10,240
7,808
Accepted
Accepted
50
import statistics as st while True: n = int(eval(input())) if n == 0: break x = tuple(map(float, input().strip().split())) y = st.mean(x)**2 z = st.mean(list(map(pow, x, (2 for i in range(n))))) print(((z-y)**0.5))
while True: n = int(eval(input())) if n == 0: break x = tuple(map(float, input().strip().split())) y = (sum(x)/n)**2 z = sum(map(pow, x, (2 for i in range(n))))/n print(((z-y)**0.5))
9
8
240
213
import statistics as st while True: n = int(eval(input())) if n == 0: break x = tuple(map(float, input().strip().split())) y = st.mean(x) ** 2 z = st.mean(list(map(pow, x, (2 for i in range(n))))) print(((z - y) ** 0.5))
while True: n = int(eval(input())) if n == 0: break x = tuple(map(float, input().strip().split())) y = (sum(x) / n) ** 2 z = sum(map(pow, x, (2 for i in range(n)))) / n print(((z - y) ** 0.5))
false
11.111111
[ "-import statistics as st", "-", "- y = st.mean(x) ** 2", "- z = st.mean(list(map(pow, x, (2 for i in range(n)))))", "+ y = (sum(x) / n) ** 2", "+ z = sum(map(pow, x, (2 for i in range(n)))) / n" ]
false
0.072016
0.007639
9.427071
[ "s762315962", "s293355923" ]
u006883624
p02689
python
s193140094
s053777015
383
296
45,264
19,960
Accepted
Accepted
22.72
from heapq import heappush, heappop def main(): N, M = [int(v) for v in input().split()] H = [int(v) for v in input().split()] net = [set() for _ in range(N)] for _ in range(M): a, b = [int(v) - 1 for v in input().split()] net[a].add(b) net[b].add(a) de...
from heapq import heappush, heappop def main(): N, M = [int(v) for v in input().split()] H = [int(v) for v in input().split()] link = [0] * N for _ in range(M): a, b = [int(v) - 1 for v in input().split()] link[a] = max(link[a], H[b]) link[b] = max(link[b], H[a]...
31
23
574
445
from heapq import heappush, heappop def main(): N, M = [int(v) for v in input().split()] H = [int(v) for v in input().split()] net = [set() for _ in range(N)] for _ in range(M): a, b = [int(v) - 1 for v in input().split()] net[a].add(b) net[b].add(a) def goodview(i, h): ...
from heapq import heappush, heappop def main(): N, M = [int(v) for v in input().split()] H = [int(v) for v in input().split()] link = [0] * N for _ in range(M): a, b = [int(v) - 1 for v in input().split()] link[a] = max(link[a], H[b]) link[b] = max(link[b], H[a]) count = 0 ...
false
25.806452
[ "- net = [set() for _ in range(N)]", "+ link = [0] * N", "- net[a].add(b)", "- net[b].add(a)", "-", "- def goodview(i, h):", "- for j in net[i]:", "- if H[j] >= h:", "- return False", "- return True", "-", "+ link[a] = max(l...
false
0.038073
0.036965
1.029971
[ "s193140094", "s053777015" ]
u659744483
p03448
python
s751809121
s989516404
91
11
10,512
2,568
Accepted
Accepted
87.91
import numpy as np a = int(input()) b = int(input()) c = int(input()) x = int(input()) n = 0 i = 0 while i * 500 <= x and i <= a: if i * 500 == x: n += 1 # print 10 else: y = x - i * 500 j = 0 while j * 100 <= y and j <= b: if j * 100 == y: ...
a = int(input()) b = int(input()) c = int(input()) x = int(input()) n = 0 i = 0 while i * 500 <= x and i <= a: if i * 500 == x: n += 1 # print 10 else: y = x - i * 500 j = 0 while j * 100 <= y and j <= b: if j * 100 == y: n += 1...
29
27
573
550
import numpy as np a = int(input()) b = int(input()) c = int(input()) x = int(input()) n = 0 i = 0 while i * 500 <= x and i <= a: if i * 500 == x: n += 1 # print 10 else: y = x - i * 500 j = 0 while j * 100 <= y and j <= b: if j * 100 == y: ...
a = int(input()) b = int(input()) c = int(input()) x = int(input()) n = 0 i = 0 while i * 500 <= x and i <= a: if i * 500 == x: n += 1 # print 10 else: y = x - i * 500 j = 0 while j * 100 <= y and j <= b: if j * 100 == y: n += 1 ...
false
6.896552
[ "-import numpy as np", "-" ]
false
0.043666
0.065714
0.664495
[ "s751809121", "s989516404" ]
u724687935
p02620
python
s956325466
s590405564
1,080
954
94,820
96,860
Accepted
Accepted
11.67
import sys def B(T): global S, Z, D _last = [0] * Z cnt = 0 for d in range(1, D + 1): t = T[d] _last[t] = d up = S[d][t] down = sum(C[i] * (d - _last[i]) for i in range(Z)) cnt += up - down return cnt def checkScore(r): global D, last ...
import sys from bisect import bisect_right, bisect_left def checkScore(p): global D, last, S rst = 0 _last = last[p] for d in range(1, D + 1): down = C[p] * (d - _last[d]) up = S[d][p] if _last[d] == d else 0 rst += up - down return rst Z = 26 D = int(eval...
69
58
1,447
1,265
import sys def B(T): global S, Z, D _last = [0] * Z cnt = 0 for d in range(1, D + 1): t = T[d] _last[t] = d up = S[d][t] down = sum(C[i] * (d - _last[i]) for i in range(Z)) cnt += up - down return cnt def checkScore(r): global D, last L = last[r] ...
import sys from bisect import bisect_right, bisect_left def checkScore(p): global D, last, S rst = 0 _last = last[p] for d in range(1, D + 1): down = C[p] * (d - _last[d]) up = S[d][p] if _last[d] == d else 0 rst += up - down return rst Z = 26 D = int(eval(input())) C = l...
false
15.942029
[ "+from bisect import bisect_right, bisect_left", "-def B(T):", "- global S, Z, D", "- _last = [0] * Z", "- cnt = 0", "+def checkScore(p):", "+ global D, last, S", "+ rst = 0", "+ _last = last[p]", "- t = T[d]", "- _last[t] = d", "- up = S[d][t]", "- ...
false
0.037298
0.044163
0.844548
[ "s956325466", "s590405564" ]
u416758623
p03244
python
s732727762
s224824976
89
78
21,212
15,588
Accepted
Accepted
12.36
from collections import Counter n = int(eval(input())) lst_v = list(map(int, input().split())) lst_o = lst_v[::2] lst_e = lst_v[1::2] cnt_o = Counter(lst_o).most_common() + [(0, 0)] cnt_e = Counter(lst_e).most_common() + [(0, 0)] if cnt_o[0][0] == cnt_e[0][0]: rem_number = max(cnt_o[0][1] + cnt_...
from collections import Counter n = int(eval(input())) ls = list(map(int, input().split())) ac = Counter(ls[::2]).most_common(2) bd = Counter(ls[1::2]).most_common(2) if ac[0][0] != bd[0][0]: print((n-ac[0][1]-bd[0][1])) else: if len(ac) == 1 or len(bd) == 1: print((n//2)) else: ...
21
15
438
369
from collections import Counter n = int(eval(input())) lst_v = list(map(int, input().split())) lst_o = lst_v[::2] lst_e = lst_v[1::2] cnt_o = Counter(lst_o).most_common() + [(0, 0)] cnt_e = Counter(lst_e).most_common() + [(0, 0)] if cnt_o[0][0] == cnt_e[0][0]: rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1...
from collections import Counter n = int(eval(input())) ls = list(map(int, input().split())) ac = Counter(ls[::2]).most_common(2) bd = Counter(ls[1::2]).most_common(2) if ac[0][0] != bd[0][0]: print((n - ac[0][1] - bd[0][1])) else: if len(ac) == 1 or len(bd) == 1: print((n // 2)) else: print...
false
28.571429
[ "-lst_v = list(map(int, input().split()))", "-lst_o = lst_v[::2]", "-lst_e = lst_v[1::2]", "-cnt_o = Counter(lst_o).most_common() + [(0, 0)]", "-cnt_e = Counter(lst_e).most_common() + [(0, 0)]", "-if cnt_o[0][0] == cnt_e[0][0]:", "- rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1...
false
0.037217
0.037545
0.991259
[ "s732727762", "s224824976" ]
u084320347
p02801
python
s366606621
s561698676
20
17
3,060
2,940
Accepted
Accepted
15
print((chr(ord(eval(input()))+1)))
a = chr(ord(eval(input()))+1) print(a)
1
2
27
34
print((chr(ord(eval(input())) + 1)))
a = chr(ord(eval(input())) + 1) print(a)
false
50
[ "-print((chr(ord(eval(input())) + 1)))", "+a = chr(ord(eval(input())) + 1)", "+print(a)" ]
false
0.04928
0.05004
0.984811
[ "s366606621", "s561698676" ]
u673361376
p03804
python
s846658218
s644121362
27
18
3,444
3,064
Accepted
Accepted
33.33
import re n, m = list(map(int, input().split())) a = [input().strip() for _ in range(n)] b = [input().strip() for _ in range(m)] for idx_a, arow in enumerate(a[:n-m+1]): for idx_obj in re.finditer(b[0], arow): falg = True for i in range(1,m): if b[i] != a[idx_a+i][idx_obj.start():idx_obj.end()...
def is_same(si, sj): for i in range(M): for j in range(M): if gridsA[sj + j][si + i] != gridsB[j][i]: return False return True N, M = list(map(int, input().split())) gridsA = [eval(input()) for _ in range(N)] gridsB = [eval(input()) for _ in range(M)] if N == M...
15
24
407
550
import re n, m = list(map(int, input().split())) a = [input().strip() for _ in range(n)] b = [input().strip() for _ in range(m)] for idx_a, arow in enumerate(a[: n - m + 1]): for idx_obj in re.finditer(b[0], arow): falg = True for i in range(1, m): if b[i] != a[idx_a + i][idx_obj.start(...
def is_same(si, sj): for i in range(M): for j in range(M): if gridsA[sj + j][si + i] != gridsB[j][i]: return False return True N, M = list(map(int, input().split())) gridsA = [eval(input()) for _ in range(N)] gridsB = [eval(input()) for _ in range(M)] if N == M: if is_s...
false
37.5
[ "-import re", "+def is_same(si, sj):", "+ for i in range(M):", "+ for j in range(M):", "+ if gridsA[sj + j][si + i] != gridsB[j][i]:", "+ return False", "+ return True", "-n, m = list(map(int, input().split()))", "-a = [input().strip() for _ in range(n)]", "-...
false
0.048159
0.039941
1.205739
[ "s846658218", "s644121362" ]
u309120194
p02773
python
s845608640
s473418448
488
442
49,460
49,552
Accepted
Accepted
9.43
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] S = Counter(S).most_common() l = [] for i in S: if i[1] == S[0][1]: l.append(i[0]) l = sorted(l) for i in l: print(i)
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] # 方針:各文字列の出現回数を数え、出現回数が最大なる文字列を昇順に出力する # Counter(リスト) は辞書型のサブクラスであり、キーに要素・値に出現回数という形式 # Counter(リスト).most_common() は(要素, 出現回数)というタプルを出現回数順に並べたリスト S = Counter(S).most_common() max_count = S[0][1] # 最大の出現回数 # 最大の出現回数...
13
16
217
412
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] S = Counter(S).most_common() l = [] for i in S: if i[1] == S[0][1]: l.append(i[0]) l = sorted(l) for i in l: print(i)
from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] # 方針:各文字列の出現回数を数え、出現回数が最大なる文字列を昇順に出力する # Counter(リスト) は辞書型のサブクラスであり、キーに要素・値に出現回数という形式 # Counter(リスト).most_common() は(要素, 出現回数)というタプルを出現回数順に並べたリスト S = Counter(S).most_common() max_count = S[0][1] # 最大の出現回数 # 最大の出現回数を取る文字列を出力する...
false
18.75
[ "+# 方針:各文字列の出現回数を数え、出現回数が最大なる文字列を昇順に出力する", "+# Counter(リスト) は辞書型のサブクラスであり、キーに要素・値に出現回数という形式", "+# Counter(リスト).most_common() は(要素, 出現回数)というタプルを出現回数順に並べたリスト", "-l = []", "-for i in S:", "- if i[1] == S[0][1]:", "- l.append(i[0])", "-l = sorted(l)", "-for i in l:", "+max_count = S[0][1] #...
false
0.047648
0.048558
0.981266
[ "s845608640", "s473418448" ]
u811841526
p02381
python
s353104533
s553231773
60
20
10,212
5,696
Accepted
Accepted
66.67
import statistics while True: n = eval(input()) if n == '0': break print((statistics.pstdev(list(map(int, input().split())))))
import math while True: n = int(eval(input())) if n == 0: break points = list(map(int, input().split())) m = sum(points) / n variance = sum([(x - m) ** 2 for x in points]) / n standard_deviation = math.sqrt(variance) print(standard_deviation)
5
13
128
293
import statistics while True: n = eval(input()) if n == "0": break print((statistics.pstdev(list(map(int, input().split())))))
import math while True: n = int(eval(input())) if n == 0: break points = list(map(int, input().split())) m = sum(points) / n variance = sum([(x - m) ** 2 for x in points]) / n standard_deviation = math.sqrt(variance) print(standard_deviation)
false
61.538462
[ "-import statistics", "+import math", "- n = eval(input())", "- if n == \"0\":", "+ n = int(eval(input()))", "+ if n == 0:", "- print((statistics.pstdev(list(map(int, input().split())))))", "+ points = list(map(int, input().split()))", "+ m = sum(points) / n", "+ variance =...
false
0.133423
0.037401
3.567333
[ "s353104533", "s553231773" ]
u430726059
p02556
python
s567919566
s805681668
544
414
9,144
24,804
Accepted
Accepted
23.9
n=int(eval(input())) bignum=10**30 num1,num2,num3,num4=-bignum,bignum,-bignum,bignum for i in range(n): x,y=list(map(int, input().split())) num1=max(x+y,num1) num2=min(x+y,num2) num3=max(x-y,num3) num4=min(x-y,num4) print((max(num1-num2,num3-num4)))
n=int(eval(input())) alist=[] blist=[] for i in range(n): x,y=list(map(int, input().split())) alist.append(x+y) blist.append(x-y) print((max(max(alist)-min(alist),max(blist)-min(blist))))
10
8
254
186
n = int(eval(input())) bignum = 10**30 num1, num2, num3, num4 = -bignum, bignum, -bignum, bignum for i in range(n): x, y = list(map(int, input().split())) num1 = max(x + y, num1) num2 = min(x + y, num2) num3 = max(x - y, num3) num4 = min(x - y, num4) print((max(num1 - num2, num3 - num4)))
n = int(eval(input())) alist = [] blist = [] for i in range(n): x, y = list(map(int, input().split())) alist.append(x + y) blist.append(x - y) print((max(max(alist) - min(alist), max(blist) - min(blist))))
false
20
[ "-bignum = 10**30", "-num1, num2, num3, num4 = -bignum, bignum, -bignum, bignum", "+alist = []", "+blist = []", "- num1 = max(x + y, num1)", "- num2 = min(x + y, num2)", "- num3 = max(x - y, num3)", "- num4 = min(x - y, num4)", "-print((max(num1 - num2, num3 - num4)))", "+ alist.app...
false
0.039466
0.008041
4.907932
[ "s567919566", "s805681668" ]
u573754721
p02888
python
s240791669
s665770543
1,700
752
3,188
45,212
Accepted
Accepted
55.76
import bisect n=int(eval(input())) L=sorted(list(map(int,input().split()))) ans=0 for i in range(n-1): for j in range(i+1,n): idx=bisect.bisect_left(L,L[j]+L[i]) ans+=max(0,idx-j-1) print(ans)
import bisect n=int(eval(input())) L=sorted(list(map(int,input().split()))) ans=0 for i in range(n-1): for j in range(i+1,n): idx=bisect.bisect_left(L,L[i]+L[j]) ans+=max(0,idx-j-1) print(ans)
12
11
230
219
import bisect n = int(eval(input())) L = sorted(list(map(int, input().split()))) ans = 0 for i in range(n - 1): for j in range(i + 1, n): idx = bisect.bisect_left(L, L[j] + L[i]) ans += max(0, idx - j - 1) print(ans)
import bisect n = int(eval(input())) L = sorted(list(map(int, input().split()))) ans = 0 for i in range(n - 1): for j in range(i + 1, n): idx = bisect.bisect_left(L, L[i] + L[j]) ans += max(0, idx - j - 1) print(ans)
false
8.333333
[ "- idx = bisect.bisect_left(L, L[j] + L[i])", "+ idx = bisect.bisect_left(L, L[i] + L[j])" ]
false
0.036504
0.036737
0.993647
[ "s240791669", "s665770543" ]
u578441226
p02548
python
s379729817
s076878343
1,444
113
9,024
67,656
Accepted
Accepted
92.17
n = int(eval(input())) ans = 0 for a in range (1,n): for b in range(a, n, a): ans += 1 print(ans)
n = int(eval(input())) ans = 0 for a in range (1,n): for b in range(1, n): if n <= a * b: break ans += 1 print(ans)
6
8
108
148
n = int(eval(input())) ans = 0 for a in range(1, n): for b in range(a, n, a): ans += 1 print(ans)
n = int(eval(input())) ans = 0 for a in range(1, n): for b in range(1, n): if n <= a * b: break ans += 1 print(ans)
false
25
[ "- for b in range(a, n, a):", "+ for b in range(1, n):", "+ if n <= a * b:", "+ break" ]
false
0.296812
0.450682
0.658585
[ "s379729817", "s076878343" ]
u208713671
p03761
python
s739947852
s533267862
74
62
65,112
66,200
Accepted
Accepted
16.22
N = int(eval(input())) al=[chr(ord('a') + i) for i in range(26)] out = [1000]*26 for i in range(N): S = list(eval(input())) LS = len(S) tmp = [0]*26 for j in range(LS): tmp[ord(S[j])-ord("a")]+=1 for j in range(26): out[j]=min(out[j],tmp[j]) S = "" for i in range(26): ...
N = int(eval(input())) al = [chr(ord('a') + i) for i in range(26)] out = dict(list(zip(al,[100]*26))) for i in range(N): S = list(eval(input())) tmp = dict(list(zip(al,[0]*26))) for T in S: tmp[T] += 1 for key in list(out.keys()): out[key]=min(out[key],tmp[key]) outS = "" for ...
15
14
348
348
N = int(eval(input())) al = [chr(ord("a") + i) for i in range(26)] out = [1000] * 26 for i in range(N): S = list(eval(input())) LS = len(S) tmp = [0] * 26 for j in range(LS): tmp[ord(S[j]) - ord("a")] += 1 for j in range(26): out[j] = min(out[j], tmp[j]) S = "" for i in range(26): ...
N = int(eval(input())) al = [chr(ord("a") + i) for i in range(26)] out = dict(list(zip(al, [100] * 26))) for i in range(N): S = list(eval(input())) tmp = dict(list(zip(al, [0] * 26))) for T in S: tmp[T] += 1 for key in list(out.keys()): out[key] = min(out[key], tmp[key]) outS = "" for ke...
false
6.666667
[ "-out = [1000] * 26", "+out = dict(list(zip(al, [100] * 26)))", "- LS = len(S)", "- tmp = [0] * 26", "- for j in range(LS):", "- tmp[ord(S[j]) - ord(\"a\")] += 1", "- for j in range(26):", "- out[j] = min(out[j], tmp[j])", "-S = \"\"", "-for i in range(26):", "- S +=...
false
0.048949
0.048864
1.00174
[ "s739947852", "s533267862" ]
u588341295
p02708
python
s226482056
s951675285
226
125
35,044
27,468
Accepted
Accepted
44.69
# -*- coding: utf-8 -*- import sys from itertools import accumulate def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in rang...
# -*- coding: utf-8 -*- import sys from itertools import accumulate def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in rang...
67
31
1,949
912
# -*- coding: utf-8 -*- import sys from itertools import accumulate def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d...
# -*- coding: utf-8 -*- import sys from itertools import accumulate def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d...
false
53.731343
[ "-", "-", "-class ModTools:", "- \"\"\"階乗たくさん使う時用のテーブル準備\"\"\"", "-", "- def __init__(self, MAX, MOD):", "- \"\"\"MAX:階乗に使う数値の最大以上まで作る\"\"\"", "- MAX += 1", "- self.MAX = MAX", "- self.MOD = MOD", "- factorial = [1] * MAX", "- factorial[0] = fact...
false
0.097842
0.060605
1.614414
[ "s226482056", "s951675285" ]
u020604402
p02690
python
s247239759
s468541581
175
72
9,640
65,812
Accepted
Accepted
58.86
x = int(eval(input())) import math f = 1 for A in range(-10**5,10**5): A5 = A ** 5 if x - A5 > 0: f = -1 B = round(math.pow(x - A5,1/5),0) else: B = round(math.pow(-(x - A5),1/5),0) if A5 == x + int(B*f) ** 5: print((A,int(B)*f)) quit()
x = int(eval(input())) import math for A in range(-10**3,10**3): for B in range(-10**3,10**3): if A ** 5 - B ** 5 == x: print((A,B)) quit()
13
8
298
176
x = int(eval(input())) import math f = 1 for A in range(-(10**5), 10**5): A5 = A**5 if x - A5 > 0: f = -1 B = round(math.pow(x - A5, 1 / 5), 0) else: B = round(math.pow(-(x - A5), 1 / 5), 0) if A5 == x + int(B * f) ** 5: print((A, int(B) * f)) quit()
x = int(eval(input())) import math for A in range(-(10**3), 10**3): for B in range(-(10**3), 10**3): if A**5 - B**5 == x: print((A, B)) quit()
false
38.461538
[ "-f = 1", "-for A in range(-(10**5), 10**5):", "- A5 = A**5", "- if x - A5 > 0:", "- f = -1", "- B = round(math.pow(x - A5, 1 / 5), 0)", "- else:", "- B = round(math.pow(-(x - A5), 1 / 5), 0)", "- if A5 == x + int(B * f) ** 5:", "- print((A, int(B) * f))", ...
false
0.969987
2.828226
0.342966
[ "s247239759", "s468541581" ]
u444069166
p02919
python
s430780328
s254787600
1,024
903
124,832
109,728
Accepted
Accepted
11.82
#!/usr/bin/python3 import math import os import sys DEBUG = 'DEBUG' in os.environ def inp(): return sys.stdin.readline().rstrip() def dprint(*value, sep=' ', end='\n'): if DEBUG: print(*value, sep=sep, end=end) def solve(N, P): revp = [-1] * (N + 1) for i, p in enum...
#!/usr/bin/python3 import math import os import sys DEBUG = 'DEBUG' in os.environ def inp(): return sys.stdin.readline().rstrip() def dprint(*value, sep=' ', end='\n'): if DEBUG: print(*value, sep=sep, end=end) def solve(N, P): revp = [-1] * (N + 1) for i, p in enum...
122
122
2,761
2,755
#!/usr/bin/python3 import math import os import sys DEBUG = "DEBUG" in os.environ def inp(): return sys.stdin.readline().rstrip() def dprint(*value, sep=" ", end="\n"): if DEBUG: print(*value, sep=sep, end=end) def solve(N, P): revp = [-1] * (N + 1) for i, p in enumerate(P): revp[...
#!/usr/bin/python3 import math import os import sys DEBUG = "DEBUG" in os.environ def inp(): return sys.stdin.readline().rstrip() def dprint(*value, sep=" ", end="\n"): if DEBUG: print(*value, sep=sep, end=end) def solve(N, P): revp = [-1] * (N + 1) for i, p in enumerate(P): revp[...
false
0
[ "- cache = [dict() for _ in range(N)]", "+ cache = dict()", "- if j in cache[i]:", "+ if (i, j) in cache:", "- if not (d - c < 2 or d in cache[c]):", "+ if not (d - c < 2 or (c, d) in cache):", "- left, right, mid = [0 if d - c < 2...
false
0.04971
0.038785
1.28168
[ "s430780328", "s254787600" ]
u367701763
p03967
python
s216650904
s473534634
76
68
68,036
62,268
Accepted
Accepted
10.53
from collections import Counter s = input().rstrip() L = len(s) d = Counter(s) print((L//2-d["p"]))
s = input().rstrip() print((len(s)//2-s.count("p")))
5
2
101
51
from collections import Counter s = input().rstrip() L = len(s) d = Counter(s) print((L // 2 - d["p"]))
s = input().rstrip() print((len(s) // 2 - s.count("p")))
false
60
[ "-from collections import Counter", "-", "-L = len(s)", "-d = Counter(s)", "-print((L // 2 - d[\"p\"]))", "+print((len(s) // 2 - s.count(\"p\")))" ]
false
0.042109
0.042766
0.984641
[ "s216650904", "s473534634" ]
u133936772
p03425
python
s766116363
s973994765
148
78
3,864
9,976
Accepted
Accepted
47.3
l=[input()[0] for _ in range(int(eval(input())))] import itertools as it print((sum(x*y*z for x,y,z in it.combinations([l.count(c) for c in 'MARCH'],3))))
_,*l=open(0) import itertools as it print((sum(x*y*z for x,y,z in it.combinations([sum(s[0]==c for s in l) for c in 'MARCH'],3))))
3
3
148
130
l = [input()[0] for _ in range(int(eval(input())))] import itertools as it print((sum(x * y * z for x, y, z in it.combinations([l.count(c) for c in "MARCH"], 3))))
_, *l = open(0) import itertools as it print( ( sum( x * y * z for x, y, z in it.combinations( [sum(s[0] == c for s in l) for c in "MARCH"], 3 ) ) ) )
false
0
[ "-l = [input()[0] for _ in range(int(eval(input())))]", "+_, *l = open(0)", "-print((sum(x * y * z for x, y, z in it.combinations([l.count(c) for c in \"MARCH\"], 3))))", "+print(", "+ (", "+ sum(", "+ x * y * z", "+ for x, y, z in it.combinations(", "+ ...
false
0.037999
0.038671
0.982642
[ "s766116363", "s973994765" ]
u426534722
p02243
python
s321903834
s303355728
890
340
50,036
40,036
Accepted
Accepted
61.8
from heapq import heapify, heappush, heappop INF = float("inf") def MAIN(): n = int(eval(input())) G = [[i, INF] for i in range(n)] G[0][1] = 0 m = {} for _ in range(n): A = list(map(int, input().split())) m[A[0]] = {} for i in range(2, len(A), 2): m[A[...
import sys readline = sys.stdin.readline from heapq import heapify, heappush, heappop INF = float("inf") def MAIN(): n = int(eval(input())) adj = [[]] * n for _ in range(0, n): U = list(map(int, input().split())) adj[U[0]] = list(zip(U[2::2], U[3::2])) def dijkstra(): ...
22
24
623
670
from heapq import heapify, heappush, heappop INF = float("inf") def MAIN(): n = int(eval(input())) G = [[i, INF] for i in range(n)] G[0][1] = 0 m = {} for _ in range(n): A = list(map(int, input().split())) m[A[0]] = {} for i in range(2, len(A), 2): m[A[0]][A[i]...
import sys readline = sys.stdin.readline from heapq import heapify, heappush, heappop INF = float("inf") def MAIN(): n = int(eval(input())) adj = [[]] * n for _ in range(0, n): U = list(map(int, input().split())) adj[U[0]] = list(zip(U[2::2], U[3::2])) def dijkstra(): d = [0...
false
8.333333
[ "+import sys", "+", "+readline = sys.stdin.readline", "- G = [[i, INF] for i in range(n)]", "- G[0][1] = 0", "- m = {}", "- for _ in range(n):", "- A = list(map(int, input().split()))", "- m[A[0]] = {}", "- for i in range(2, len(A), 2):", "- m[A[0]][A[...
false
0.037242
0.041356
0.900536
[ "s321903834", "s303355728" ]
u583507988
p02881
python
s056400421
s430151757
149
84
9,124
64,040
Accepted
Accepted
43.62
import math n=int(eval(input())) ans=n-1 for i in range(2,int(math.sqrt(n))+1): if n%i==0: ans=min(ans,(i-1)+(n//i)-1) print(ans)
from math import sqrt n=int(eval(input())) ans=float('inf') for i in range(1,int(sqrt(n))+1): if n%i==0: res=i+n//i-2 ans=min(ans,res) print(ans)
7
8
135
156
import math n = int(eval(input())) ans = n - 1 for i in range(2, int(math.sqrt(n)) + 1): if n % i == 0: ans = min(ans, (i - 1) + (n // i) - 1) print(ans)
from math import sqrt n = int(eval(input())) ans = float("inf") for i in range(1, int(sqrt(n)) + 1): if n % i == 0: res = i + n // i - 2 ans = min(ans, res) print(ans)
false
12.5
[ "-import math", "+from math import sqrt", "-ans = n - 1", "-for i in range(2, int(math.sqrt(n)) + 1):", "+ans = float(\"inf\")", "+for i in range(1, int(sqrt(n)) + 1):", "- ans = min(ans, (i - 1) + (n // i) - 1)", "+ res = i + n // i - 2", "+ ans = min(ans, res)" ]
false
0.042017
0.042228
0.995003
[ "s056400421", "s430151757" ]
u413165887
p03715
python
s460720810
s755672237
558
433
19,016
18,992
Accepted
Accepted
22.4
from math import floor, ceil h, w = list(map(int, input().split(' '))) result = [] if h%3 == 0 or w%3 == 0: print((0)) elif h<3 or w<3: if h<3 and w>=3: for i in range(1, w-1): x = i*h y = (w-i)*floor(h/2) z = (w-i)*ceil(h/2) result.append(max(x...
def main(): from math import floor, ceil h, w = list(map(int, input().split(' '))) result = [] if h%3 == 0 or w%3 == 0: print((0)) elif h<3 or w<3: if h<3 and w>=3: for i in range(1, w-1): x = i*h y = (w-i)*floor(h/2) ...
46
48
1,386
1,591
from math import floor, ceil h, w = list(map(int, input().split(" "))) result = [] if h % 3 == 0 or w % 3 == 0: print((0)) elif h < 3 or w < 3: if h < 3 and w >= 3: for i in range(1, w - 1): x = i * h y = (w - i) * floor(h / 2) z = (w - i) * ceil(h / 2) r...
def main(): from math import floor, ceil h, w = list(map(int, input().split(" "))) result = [] if h % 3 == 0 or w % 3 == 0: print((0)) elif h < 3 or w < 3: if h < 3 and w >= 3: for i in range(1, w - 1): x = i * h y = (w - i) * floor(h / 2)...
false
4.166667
[ "-from math import floor, ceil", "+def main():", "+ from math import floor, ceil", "-h, w = list(map(int, input().split(\" \")))", "-result = []", "-if h % 3 == 0 or w % 3 == 0:", "- print((0))", "-elif h < 3 or w < 3:", "- if h < 3 and w >= 3:", "+ h, w = list(map(int, input().split(\...
false
0.118132
0.076295
1.54835
[ "s460720810", "s755672237" ]
u629560745
p02784
python
s493231638
s022604897
48
40
13,964
13,964
Accepted
Accepted
16.67
H, N = list(map(int, input().split())) A = list(map(int,input().split())) sum = 0 for i in A: sum += i if sum >= H: print('Yes') else: print('No')
H, N = list(map(int, input().split())) A = sum(list(map(int,input().split()))) if A >= H: print('Yes') else: print('No')
9
7
160
129
H, N = list(map(int, input().split())) A = list(map(int, input().split())) sum = 0 for i in A: sum += i if sum >= H: print("Yes") else: print("No")
H, N = list(map(int, input().split())) A = sum(list(map(int, input().split()))) if A >= H: print("Yes") else: print("No")
false
22.222222
[ "-A = list(map(int, input().split()))", "-sum = 0", "-for i in A:", "- sum += i", "-if sum >= H:", "+A = sum(list(map(int, input().split())))", "+if A >= H:" ]
false
0.046993
0.047415
0.991091
[ "s493231638", "s022604897" ]
u285891772
p03090
python
s358262679
s036596007
46
40
10,632
10,712
Accepted
Accepted
13.04
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2 from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, asc...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemge...
37
39
1,025
1,224
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2 from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_upp...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, ) from itertools import ( accumulate, permutations, combinations, ...
false
5.128205
[ "-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2", "-from itertools import accumulate, permutations, combinations, product", "+from math import (", "+ ceil,", "+ sqrt,", "+ hypot,", "+ factorial,", "+ pi,", "+ sin,", "+ cos,", "+ tan,", "+ ...
false
0.048129
0.047694
1.009121
[ "s358262679", "s036596007" ]
u138486156
p03074
python
s233225934
s063030936
229
134
61,660
16,060
Accepted
Accepted
41.48
from itertools import groupby n, k = list(map(int, input().split())) s = eval(input()) t = [] if s[0] == "0": t.append(("1", 0)) for c, v in groupby(s): t.append((c, sum(1 for _ in v))) if s[-1] == "0": t.append(("1", 0)) S = [t[0][1]] rm = [0] m = len(t) for i in range(m//2): tmp = ...
from itertools import groupby n, k = list(map(int, input().split())) s = eval(input()) t = [] if s[0] == "0": t.append(("1", 0)) cnt = 1 for i in range(n): if i != n-1: if s[i] == s[i+1]: cnt += 1 else: t.append((s[i], cnt)) cnt = 1 if i ...
28
37
533
689
from itertools import groupby n, k = list(map(int, input().split())) s = eval(input()) t = [] if s[0] == "0": t.append(("1", 0)) for c, v in groupby(s): t.append((c, sum(1 for _ in v))) if s[-1] == "0": t.append(("1", 0)) S = [t[0][1]] rm = [0] m = len(t) for i in range(m // 2): tmp = S[-1] S.appen...
from itertools import groupby n, k = list(map(int, input().split())) s = eval(input()) t = [] if s[0] == "0": t.append(("1", 0)) cnt = 1 for i in range(n): if i != n - 1: if s[i] == s[i + 1]: cnt += 1 else: t.append((s[i], cnt)) cnt = 1 if i == n - 1: ...
false
24.324324
[ "-for c, v in groupby(s):", "- t.append((c, sum(1 for _ in v)))", "+cnt = 1", "+for i in range(n):", "+ if i != n - 1:", "+ if s[i] == s[i + 1]:", "+ cnt += 1", "+ else:", "+ t.append((s[i], cnt))", "+ cnt = 1", "+ if i == n - 1:", "+ ...
false
0.03794
0.038911
0.975028
[ "s233225934", "s063030936" ]
u715329136
p02601
python
s628205792
s760306642
32
27
9,148
9,188
Accepted
Accepted
15.62
rgb = list(map(int, input().split(' '))) r = rgb[0] g = rgb[1] b = rgb[2] k = int(eval(input())) for i in range(k): if(r >= g): g = g * 2 elif(g >= b): b = b * 2 if (r < g < b): print('Yes') else: print('No')
def resolve(): a, b, c = list(map(int, input().split())) k = int(eval(input())) for i in range(k): if (a >= b): b *= 2 elif (b >= c): c *= 2 if(a < b < c): print('Yes') else: print('No') if __name__ == "__main__": ...
16
17
252
318
rgb = list(map(int, input().split(" "))) r = rgb[0] g = rgb[1] b = rgb[2] k = int(eval(input())) for i in range(k): if r >= g: g = g * 2 elif g >= b: b = b * 2 if r < g < b: print("Yes") else: print("No")
def resolve(): a, b, c = list(map(int, input().split())) k = int(eval(input())) for i in range(k): if a >= b: b *= 2 elif b >= c: c *= 2 if a < b < c: print("Yes") else: print("No") if __name__ == "__main__": resolve()
false
5.882353
[ "-rgb = list(map(int, input().split(\" \")))", "-r = rgb[0]", "-g = rgb[1]", "-b = rgb[2]", "-k = int(eval(input()))", "-for i in range(k):", "- if r >= g:", "- g = g * 2", "- elif g >= b:", "- b = b * 2", "-if r < g < b:", "- print(\"Yes\")", "-else:", "- print(\...
false
0.038242
0.037578
1.017674
[ "s628205792", "s760306642" ]
u648315264
p02681
python
s917241064
s673180134
103
81
72,008
71,720
Accepted
Accepted
21.36
import math from math import gcd INF = float("inf") import sys input=sys.stdin.readline import itertools import string def main(): s = input().rstrip() t = input().rstrip() for i in range(len(s)): if s[i] != t[i]: print("No") exit() if len(t) == len(s) +...
import math from math import gcd INF = float("inf") import sys input=sys.stdin.readline import itertools import string def main(): s = input().rstrip() t = input().rstrip() t = t[0:-1] if s == t: print("Yes") else: print("No") if __name__=="__main__": main()...
23
20
417
321
import math from math import gcd INF = float("inf") import sys input = sys.stdin.readline import itertools import string def main(): s = input().rstrip() t = input().rstrip() for i in range(len(s)): if s[i] != t[i]: print("No") exit() if len(t) == len(s) + 1: ...
import math from math import gcd INF = float("inf") import sys input = sys.stdin.readline import itertools import string def main(): s = input().rstrip() t = input().rstrip() t = t[0:-1] if s == t: print("Yes") else: print("No") if __name__ == "__main__": main()
false
13.043478
[ "- for i in range(len(s)):", "- if s[i] != t[i]:", "- print(\"No\")", "- exit()", "- if len(t) == len(s) + 1:", "+ t = t[0:-1]", "+ if s == t:" ]
false
0.047934
0.097529
0.491485
[ "s917241064", "s673180134" ]
u952708174
p02842
python
s497960426
s397466590
310
17
3,060
2,940
Accepted
Accepted
94.52
N = int(eval(input())) import math for x in range(900000 + 1): if math.floor(x * 1.08) == N: print(x) break else: print(':(')
N = int(eval(input())) import math x = math.ceil(N / 1.08) print((str(x) if math.floor(x * 1.08) == N else ':('))
9
5
152
110
N = int(eval(input())) import math for x in range(900000 + 1): if math.floor(x * 1.08) == N: print(x) break else: print(":(")
N = int(eval(input())) import math x = math.ceil(N / 1.08) print((str(x) if math.floor(x * 1.08) == N else ":("))
false
44.444444
[ "-for x in range(900000 + 1):", "- if math.floor(x * 1.08) == N:", "- print(x)", "- break", "-else:", "- print(\":(\")", "+x = math.ceil(N / 1.08)", "+print((str(x) if math.floor(x * 1.08) == N else \":(\"))" ]
false
0.177321
0.035777
4.956286
[ "s497960426", "s397466590" ]
u223133214
p02987
python
s871962182
s217986680
176
17
38,384
2,940
Accepted
Accepted
90.34
ssss = list(eval(input())) ans = {} for s in ssss: if s in ans: ans[s] += 1 else: ans[s] = 1 for s in ans: if ans[s] == 2: continue else: print('No') exit() print('Yes')
S = list(eval(input())) cnt = {} for s in S: if s not in cnt: cnt[s] = 1 else: cnt[s] += 1 for c in cnt: if cnt[c] != 2: print('No') exit() print('Yes')
15
12
234
202
ssss = list(eval(input())) ans = {} for s in ssss: if s in ans: ans[s] += 1 else: ans[s] = 1 for s in ans: if ans[s] == 2: continue else: print("No") exit() print("Yes")
S = list(eval(input())) cnt = {} for s in S: if s not in cnt: cnt[s] = 1 else: cnt[s] += 1 for c in cnt: if cnt[c] != 2: print("No") exit() print("Yes")
false
20
[ "-ssss = list(eval(input()))", "-ans = {}", "-for s in ssss:", "- if s in ans:", "- ans[s] += 1", "+S = list(eval(input()))", "+cnt = {}", "+for s in S:", "+ if s not in cnt:", "+ cnt[s] = 1", "- ans[s] = 1", "-for s in ans:", "- if ans[s] == 2:", "- co...
false
0.100113
0.043433
2.304981
[ "s871962182", "s217986680" ]
u344065503
p02947
python
s351905915
s351821228
689
635
65,496
75,096
Accepted
Accepted
7.84
N=int(eval(input())) dictionary={} count=0 for i in range(N): s="".join(sorted(eval(input()))) if s in dictionary: dictionary[s]+=1 count+=dictionary[s] else: dictionary[s]=0 print(count)
import collections n=int(eval(input())) ans=0 s=["".join(sorted(eval(input()))) for _ in range(n)] c=collections.Counter(s) for i in set(s): a=c[i] ans+=a*(a-1)//2 print(ans)
11
9
221
175
N = int(eval(input())) dictionary = {} count = 0 for i in range(N): s = "".join(sorted(eval(input()))) if s in dictionary: dictionary[s] += 1 count += dictionary[s] else: dictionary[s] = 0 print(count)
import collections n = int(eval(input())) ans = 0 s = ["".join(sorted(eval(input()))) for _ in range(n)] c = collections.Counter(s) for i in set(s): a = c[i] ans += a * (a - 1) // 2 print(ans)
false
18.181818
[ "-N = int(eval(input()))", "-dictionary = {}", "-count = 0", "-for i in range(N):", "- s = \"\".join(sorted(eval(input())))", "- if s in dictionary:", "- dictionary[s] += 1", "- count += dictionary[s]", "- else:", "- dictionary[s] = 0", "-print(count)", "+import c...
false
0.046644
0.03215
1.450818
[ "s351905915", "s351821228" ]
u753803401
p03853
python
s833973370
s473296258
181
18
38,472
3,060
Accepted
Accepted
90.06
h, w = list(map(int, input().split())) for i in range(h): c = eval(input()) print(c) print(c)
h, w = list(map(int, input().split())) a = [tuple(eval(input())) for _ in range(h)] for i in a: print(("".join(i))) print(("".join(i)))
5
5
98
132
h, w = list(map(int, input().split())) for i in range(h): c = eval(input()) print(c) print(c)
h, w = list(map(int, input().split())) a = [tuple(eval(input())) for _ in range(h)] for i in a: print(("".join(i))) print(("".join(i)))
false
0
[ "-for i in range(h):", "- c = eval(input())", "- print(c)", "- print(c)", "+a = [tuple(eval(input())) for _ in range(h)]", "+for i in a:", "+ print((\"\".join(i)))", "+ print((\"\".join(i)))" ]
false
0.038155
0.037969
1.004895
[ "s833973370", "s473296258" ]
u970899068
p03352
python
s931735225
s136244191
88
17
3,060
2,940
Accepted
Accepted
80.68
x=int(eval(input())) v=[] for i in range(1,32): for j in range(2,1000): if i**j<=x and (i+1)**j>x: v.append(i**j) print((max(v)))
x=int(eval(input())) v=[] for j in range(2,11): for i in range(1,32): if i**j<=x and (i+1)**j>x: v.append(i**j) break print((max(v)))
7
9
151
178
x = int(eval(input())) v = [] for i in range(1, 32): for j in range(2, 1000): if i**j <= x and (i + 1) ** j > x: v.append(i**j) print((max(v)))
x = int(eval(input())) v = [] for j in range(2, 11): for i in range(1, 32): if i**j <= x and (i + 1) ** j > x: v.append(i**j) break print((max(v)))
false
22.222222
[ "-for i in range(1, 32):", "- for j in range(2, 1000):", "+for j in range(2, 11):", "+ for i in range(1, 32):", "+ break" ]
false
0.154066
0.034302
4.491508
[ "s931735225", "s136244191" ]
u134302690
p03478
python
s511416062
s155283559
35
28
3,064
3,060
Accepted
Accepted
20
n,a,b = list(map(int, input().split())) ans = 0 for i in range(n+1): n10000 = int(i/10000) n1000 =int(i/1000)-n10000*10 n100 =int(i/100)-n1000*10-n10000*100 n10 = int(i/10)-n100*10-n1000*100-n10000*1000 n1 = int(i)-n10*10-n100*100-n1000*1000-n10000*10000 s = n10000+n1000+n100+n10+n...
def findSumofDigits(n): s = 0 while(n > 0): s += n % 10 n = int(n/10) return s n,a,b = list(map(int, input().split())) total = 0 for i in range(n+1): s = findSumofDigits(i) if a<= s <=b: total += i print(total)
15
14
373
262
n, a, b = list(map(int, input().split())) ans = 0 for i in range(n + 1): n10000 = int(i / 10000) n1000 = int(i / 1000) - n10000 * 10 n100 = int(i / 100) - n1000 * 10 - n10000 * 100 n10 = int(i / 10) - n100 * 10 - n1000 * 100 - n10000 * 1000 n1 = int(i) - n10 * 10 - n100 * 100 - n1000 * 1000 - n10000...
def findSumofDigits(n): s = 0 while n > 0: s += n % 10 n = int(n / 10) return s n, a, b = list(map(int, input().split())) total = 0 for i in range(n + 1): s = findSumofDigits(i) if a <= s <= b: total += i print(total)
false
6.666667
[ "+def findSumofDigits(n):", "+ s = 0", "+ while n > 0:", "+ s += n % 10", "+ n = int(n / 10)", "+ return s", "+", "+", "-ans = 0", "+total = 0", "- n10000 = int(i / 10000)", "- n1000 = int(i / 1000) - n10000 * 10", "- n100 = int(i / 100) - n1000 * 10 - n10000 ...
false
0.045903
0.039816
1.152886
[ "s511416062", "s155283559" ]
u766566560
p02725
python
s164853282
s490786341
126
106
26,060
25,452
Accepted
Accepted
15.87
K, N = list(map(int, input().split())) A = list(map(int, input().split())) max_dist = 0 for i in range(N): if i == N - 1: dist = A[0] + K - A[i] else: dist = A[i+1] - A[i] if dist > max_dist: max_dist = dist print((K - max_dist))
K, N = list(map(int, input().split())) A = list(map(int, input().split())) diff = [abs(A[i-1] - A[i]) for i in range(1, N)] diff.append(abs(A[0] - A[N-1] + K)) print((K - max(diff)))
14
6
261
180
K, N = list(map(int, input().split())) A = list(map(int, input().split())) max_dist = 0 for i in range(N): if i == N - 1: dist = A[0] + K - A[i] else: dist = A[i + 1] - A[i] if dist > max_dist: max_dist = dist print((K - max_dist))
K, N = list(map(int, input().split())) A = list(map(int, input().split())) diff = [abs(A[i - 1] - A[i]) for i in range(1, N)] diff.append(abs(A[0] - A[N - 1] + K)) print((K - max(diff)))
false
57.142857
[ "-max_dist = 0", "-for i in range(N):", "- if i == N - 1:", "- dist = A[0] + K - A[i]", "- else:", "- dist = A[i + 1] - A[i]", "- if dist > max_dist:", "- max_dist = dist", "-print((K - max_dist))", "+diff = [abs(A[i - 1] - A[i]) for i in range(1, N)]", "+diff.appen...
false
0.046713
0.094217
0.495805
[ "s164853282", "s490786341" ]
u917382715
p03494
python
s920791794
s280681538
20
17
3,060
3,060
Accepted
Accepted
15
n = int(eval(input())) l = list(map(int, input().split(" "))) flag = True count = 0 while True: for i in range(n): if l[i] % 2 == 1: flag = False break l[i] = l[i] / 2 if flag == False: break count += 1 print(count)
import math n = eval(input()) a = list(map(int, input().split())) ans = float("inf") for i in a: ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1) print((round(ans)))
16
7
287
170
n = int(eval(input())) l = list(map(int, input().split(" "))) flag = True count = 0 while True: for i in range(n): if l[i] % 2 == 1: flag = False break l[i] = l[i] / 2 if flag == False: break count += 1 print(count)
import math n = eval(input()) a = list(map(int, input().split())) ans = float("inf") for i in a: ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1) print((round(ans)))
false
56.25
[ "-n = int(eval(input()))", "-l = list(map(int, input().split(\" \")))", "-flag = True", "-count = 0", "-while True:", "- for i in range(n):", "- if l[i] % 2 == 1:", "- flag = False", "- break", "- l[i] = l[i] / 2", "- if flag == False:", "- brea...
false
0.04442
0.046543
0.954385
[ "s920791794", "s280681538" ]
u899645116
p02856
python
s310561070
s801689078
928
350
45,336
41,580
Accepted
Accepted
62.28
import sys m = int(eval(input())) csum = 0 dsum = 0 for i in range(m): d,c = list(map(int,input().split())) csum += c dsum += d*c print((csum-1 + (dsum-1) // 9))
import sys input = sys.stdin.readline m = int(eval(input())) csum = 0 dsum = 0 for i in range(m): d,c = list(map(int,input().split())) csum += c dsum += d*c print((csum-1 + (dsum-1) // 9))
10
10
164
190
import sys m = int(eval(input())) csum = 0 dsum = 0 for i in range(m): d, c = list(map(int, input().split())) csum += c dsum += d * c print((csum - 1 + (dsum - 1) // 9))
import sys input = sys.stdin.readline m = int(eval(input())) csum = 0 dsum = 0 for i in range(m): d, c = list(map(int, input().split())) csum += c dsum += d * c print((csum - 1 + (dsum - 1) // 9))
false
0
[ "+input = sys.stdin.readline" ]
false
0.078095
0.078724
0.992
[ "s310561070", "s801689078" ]
u735335967
p03325
python
s088198352
s415748926
166
78
4,152
4,148
Accepted
Accepted
53.01
n = int(eval(input())) a = list(map(int, input().split())) a = sorted([i for i in a if i%2==0]) x = 0 ans = 0 while len(a)!=0 and a[-1]%2==0: if a[x] % 2 != 0: x += 1 a[x] = a[x]//2 ans += 1 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in a: while i%2==0: ans += 1 i = i//2 print(ans)
12
10
228
147
n = int(eval(input())) a = list(map(int, input().split())) a = sorted([i for i in a if i % 2 == 0]) x = 0 ans = 0 while len(a) != 0 and a[-1] % 2 == 0: if a[x] % 2 != 0: x += 1 a[x] = a[x] // 2 ans += 1 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in a: while i % 2 == 0: ans += 1 i = i // 2 print(ans)
false
16.666667
[ "-a = sorted([i for i in a if i % 2 == 0])", "-x = 0", "-while len(a) != 0 and a[-1] % 2 == 0:", "- if a[x] % 2 != 0:", "- x += 1", "- a[x] = a[x] // 2", "- ans += 1", "+for i in a:", "+ while i % 2 == 0:", "+ ans += 1", "+ i = i // 2" ]
false
0.037101
0.047615
0.779189
[ "s088198352", "s415748926" ]
u600402037
p03248
python
s598833637
s934414017
149
93
6,312
14,232
Accepted
Accepted
37.58
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) S = list(sr()) N = len(S) if S[-1] == '1' or S[0] == '0' or S[:-1] != S[:-1][::-1]: print((-1)); exit() S = ['-'] + S def solve(S): prev = 1 graph = [] for i in range(...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) S = '-' + sr() N = len(S) - 1 def solve(S): if S[1] == '0': return None if S[N] == '1': return None prev = 1 graph = [] for n in range(1,N//2 + 1): ...
25
33
527
700
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) S = list(sr()) N = len(S) if S[-1] == "1" or S[0] == "0" or S[:-1] != S[:-1][::-1]: print((-1)) exit() S = ["-"] + S def solve(S): prev = 1 graph = [] for i in range(1, N // 2 + ...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) S = "-" + sr() N = len(S) - 1 def solve(S): if S[1] == "0": return None if S[N] == "1": return None prev = 1 graph = [] for n in range(1, N // 2 + 1): if ...
false
24.242424
[ "-S = list(sr())", "-N = len(S)", "-if S[-1] == \"1\" or S[0] == \"0\" or S[:-1] != S[:-1][::-1]:", "- print((-1))", "- exit()", "-S = [\"-\"] + S", "+S = \"-\" + sr()", "+N = len(S) - 1", "+ if S[1] == \"0\":", "+ return None", "+ if S[N] == \"1\":", "+ return None",...
false
0.217114
0.03667
5.920734
[ "s598833637", "s934414017" ]
u952708174
p03253
python
s348555214
s525119456
78
55
10,868
11,824
Accepted
Accepted
29.49
def d_factorization(N, M): def prime_factorization_dict(n): if n == 1: return {2: 0} # 1は素数の0乗の積とみなす i = 2 table = {} while i**2 <= n: table[i] = 0 while n % i == 0: table[i] += 1 n //= i if t...
def d_factorization(MOD=10**9 + 7): N, M = [int(i) for i in input().split()] def prime_factorization_dict(n): if n == 1: return {2: 0} # 1は素数の0乗の積とみなす i, table = 2, {} while i**2 <= n: table[i] = 0 while n % i == 0: table[i]...
54
57
1,741
1,849
def d_factorization(N, M): def prime_factorization_dict(n): if n == 1: return {2: 0} # 1は素数の0乗の積とみなす i = 2 table = {} while i**2 <= n: table[i] = 0 while n % i == 0: table[i] += 1 n //= i if table[i] == ...
def d_factorization(MOD=10**9 + 7): N, M = [int(i) for i in input().split()] def prime_factorization_dict(n): if n == 1: return {2: 0} # 1は素数の0乗の積とみなす i, table = 2, {} while i**2 <= n: table[i] = 0 while n % i == 0: table[i] += 1 ...
false
5.263158
[ "-def d_factorization(N, M):", "+def d_factorization(MOD=10**9 + 7):", "+ N, M = [int(i) for i in input().split()]", "+", "- i = 2", "- table = {}", "+ i, table = 2, {}", "- def __init__(self, n, mod):", "- self.mod = mod", "- # フェルマーの小定理による組合せの...
false
0.089761
0.097026
0.925122
[ "s348555214", "s525119456" ]
u619197965
p03317
python
s493319811
s340749488
196
160
52,780
38,256
Accepted
Accepted
18.37
n,k=[int(i) for i in input().split()] a=[int(i) for i in input().split()] print((-((-n+1)//(k-1))))
n,k=[int(i) for i in input().split()] print((-((-n+1)//(k-1))))
3
2
99
62
n, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] print((-((-n + 1) // (k - 1))))
n, k = [int(i) for i in input().split()] print((-((-n + 1) // (k - 1))))
false
33.333333
[ "-a = [int(i) for i in input().split()]" ]
false
0.152513
0.035317
4.31838
[ "s493319811", "s340749488" ]
u917101497
p02982
python
s444284581
s652932185
24
17
3,064
3,064
Accepted
Accepted
29.17
import math n,d = list(map(int,input().split())) x = [[0]*d for _ in range(n)] for i in range(n): x[i] = list( map( int, input().split() ) ) count = 0 for i in range(n): for j in range(n): if i <= j: continue dist = 0 for k in range(d): dist += (...
import math n,d = list(map( int, input().split())) point = [[0]*d for _ in range(n)] for i in range(n): point[i] = list( map( int, input().split())) count = 0 for i in range(n): for j in range(n): if i < j: sum = 0 for k in range(d): sum += ( po...
21
23
435
489
import math n, d = list(map(int, input().split())) x = [[0] * d for _ in range(n)] for i in range(n): x[i] = list(map(int, input().split())) count = 0 for i in range(n): for j in range(n): if i <= j: continue dist = 0 for k in range(d): dist += (x[i][k] - x[j][k]...
import math n, d = list(map(int, input().split())) point = [[0] * d for _ in range(n)] for i in range(n): point[i] = list(map(int, input().split())) count = 0 for i in range(n): for j in range(n): if i < j: sum = 0 for k in range(d): sum += (point[i][k] - point[j...
false
8.695652
[ "-x = [[0] * d for _ in range(n)]", "+point = [[0] * d for _ in range(n)]", "- x[i] = list(map(int, input().split()))", "+ point[i] = list(map(int, input().split()))", "- if i <= j:", "+ if i < j:", "+ sum = 0", "+ for k in range(d):", "+ sum ...
false
0.038724
0.043634
0.887477
[ "s444284581", "s652932185" ]
u624475441
p03246
python
s272067623
s852847158
85
76
18,648
18,656
Accepted
Accepted
10.59
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) c1 = Counter(A[::2]) c2 = Counter(A[1::2]) c1[0] = 0 c2[0] = 0 c1m = max(list(c1.items()), key=lambda x:x[1]) c2m = max(list(c2.items()), key=lambda x:x[1]) c1c2 = max(c for k,c in list(c2.items()) if c1m[0]!=k) c2c1 = ...
from collections import Counter n = int(eval(input())) V = list(map(int, input().split())) c1 = Counter(V[::2]) c2 = Counter(V[1::2]) c1[0] = 0 c2[0] = 0 (x, cx), (_, cxx) = c1.most_common(2) (y, cy), (_, cyy) = c2.most_common(2) if x == y: print((n - max(cx + cyy, cy + cxx))) else: print((n - cx - ...
12
13
387
314
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) c1 = Counter(A[::2]) c2 = Counter(A[1::2]) c1[0] = 0 c2[0] = 0 c1m = max(list(c1.items()), key=lambda x: x[1]) c2m = max(list(c2.items()), key=lambda x: x[1]) c1c2 = max(c for k, c in list(c2.items()) if c1m[0] != k) c2c1 = max(...
from collections import Counter n = int(eval(input())) V = list(map(int, input().split())) c1 = Counter(V[::2]) c2 = Counter(V[1::2]) c1[0] = 0 c2[0] = 0 (x, cx), (_, cxx) = c1.most_common(2) (y, cy), (_, cyy) = c2.most_common(2) if x == y: print((n - max(cx + cyy, cy + cxx))) else: print((n - cx - cy))
false
7.692308
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-c1 = Counter(A[::2])", "-c2 = Counter(A[1::2])", "+n = int(eval(input()))", "+V = list(map(int, input().split()))", "+c1 = Counter(V[::2])", "+c2 = Counter(V[1::2])", "-c1m = max(list(c1.items()), key=lambda x: x[1])", "-c2m = ma...
false
0.043098
0.110073
0.391539
[ "s272067623", "s852847158" ]
u994988729
p02996
python
s470715339
s339827570
499
430
30,788
31,804
Accepted
Accepted
13.83
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) def main(): N = int(eval(input())) work = [] # due, duration for _ in range(N): a, b = list(map(int, input().split())) work.append((b, -a)) work.sort() now = 0 for b, a in work: ...
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N = int(eval(input())) AB = [tuple(map(int, input().split())) for _ in range(N)] AB.sort(key=lambda x: x[1]) ans = "Yes" t = 0 for a, b in AB: t += a if t > b: ans = "No" break print(ans)
23
16
437
298
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) def main(): N = int(eval(input())) work = [] # due, duration for _ in range(N): a, b = list(map(int, input().split())) work.append((b, -a)) work.sort() now = 0 for b, a in work: now = now - a ...
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) N = int(eval(input())) AB = [tuple(map(int, input().split())) for _ in range(N)] AB.sort(key=lambda x: x[1]) ans = "Yes" t = 0 for a, b in AB: t += a if t > b: ans = "No" break print(ans)
false
30.434783
[ "-", "-", "-def main():", "- N = int(eval(input()))", "- work = [] # due, duration", "- for _ in range(N):", "- a, b = list(map(int, input().split()))", "- work.append((b, -a))", "- work.sort()", "- now = 0", "- for b, a in work:", "- now = now - a", "...
false
0.04276
0.040642
1.052122
[ "s470715339", "s339827570" ]
u282228874
p03212
python
s229352916
s625914061
313
49
6,240
3,060
Accepted
Accepted
84.35
from itertools import product n = int(eval(input())) num = ["","3","5","7"] A = set() for i in product(num,repeat=9): x = "".join(i) if x == "": continue elif len(set(x)) < 3: continue elif int(x) not in A and int(x) <= n: A.add(int(x)) print((len(A)))
from itertools import product n = int(eval(input())) cnt = 0 for i in range(3, len(str(n))+1): for p in product(["7","5","3"], repeat = i): if len(set(p)) == 3: p = int("".join(p)) if p <= n: cnt += 1 print(cnt)
13
10
267
227
from itertools import product n = int(eval(input())) num = ["", "3", "5", "7"] A = set() for i in product(num, repeat=9): x = "".join(i) if x == "": continue elif len(set(x)) < 3: continue elif int(x) not in A and int(x) <= n: A.add(int(x)) print((len(A)))
from itertools import product n = int(eval(input())) cnt = 0 for i in range(3, len(str(n)) + 1): for p in product(["7", "5", "3"], repeat=i): if len(set(p)) == 3: p = int("".join(p)) if p <= n: cnt += 1 print(cnt)
false
23.076923
[ "-num = [\"\", \"3\", \"5\", \"7\"]", "-A = set()", "-for i in product(num, repeat=9):", "- x = \"\".join(i)", "- if x == \"\":", "- continue", "- elif len(set(x)) < 3:", "- continue", "- elif int(x) not in A and int(x) <= n:", "- A.add(int(x))", "-print((len(A))...
false
0.679629
0.119974
5.664801
[ "s229352916", "s625914061" ]
u156815136
p03472
python
s471931838
s092435762
449
178
12,208
19,044
Accepted
Accepted
60.36
#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 - ...
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate, product # (string,3) 3回 #from collections import deque from collections import deque,defaultdi...
47
62
968
1,375
# 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...
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations, permutations, accumulate, product # (string,3) 3回 # from collections import deque from collections import deque, defaul...
false
24.193548
[ "-# from fractions import gcd", "-# from itertools import combinations # (string,3) 3回", "+from fractions import gcd", "+from itertools import combinations, permutations, accumulate, product # (string,3) 3回", "+", "-# from collections import defaultdict", "-# import bisect", "-#", "-# d = m - k[...
false
0.038299
0.045673
0.838531
[ "s471931838", "s092435762" ]
u102461423
p03968
python
s185199712
s292148490
3,979
2,535
136,872
87,260
Accepted
Accepted
36.29
import sys input = sys.stdin.readline from collections import Counter, defaultdict import itertools from functools import lru_cache mask = (1 << 10) - 1 symmetry = defaultdict(int) def encode(a,b,c,d): t = 1 << 40 for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]: u = x + (y <<...
import sys input = sys.stdin.readline from collections import defaultdict, Counter import itertools mask = (1 << 10) - 1 symmetry = dict() decode = dict() counter = defaultdict(int) def encode(a,b,c,d): t = 1 << 40 for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]: u = x + (y ...
63
65
1,628
1,681
import sys input = sys.stdin.readline from collections import Counter, defaultdict import itertools from functools import lru_cache mask = (1 << 10) - 1 symmetry = defaultdict(int) def encode(a, b, c, d): t = 1 << 40 for x, y, z, w in [(a, b, c, d), (b, c, d, a), (c, d, a, b), (d, a, b, c)]: u = x +...
import sys input = sys.stdin.readline from collections import defaultdict, Counter import itertools mask = (1 << 10) - 1 symmetry = dict() decode = dict() counter = defaultdict(int) def encode(a, b, c, d): t = 1 << 40 for x, y, z, w in [(a, b, c, d), (b, c, d, a), (c, d, a, b), (d, a, b, c)]: u = x ...
false
3.076923
[ "-from collections import Counter, defaultdict", "+from collections import defaultdict, Counter", "-from functools import lru_cache", "-symmetry = defaultdict(int)", "+symmetry = dict()", "+decode = dict()", "+counter = defaultdict(int)", "+ return t", "+", "+", "+N = int(eval(input()))", "...
false
0.074931
0.072182
1.038083
[ "s185199712", "s292148490" ]
u241159583
p03524
python
s093375765
s912498915
20
18
3,188
3,188
Accepted
Accepted
10
s = eval(input()) cnt = [s.count("a"),s.count("b"), s.count("c")] if sum(cnt) == 1: print("YES") elif len(set(s)) == 1 or max(cnt) - min(cnt) > 1: print("NO") else: print("YES")
s = eval(input()) cnt = [s.count("a"), s.count("b"), s.count("c")] cnt.sort() ans = "YES" if cnt[1]-cnt[0] >=2 or cnt[2]-cnt[0] >= 2 or cnt[2]-cnt[1] >= 2: ans ="NO" print(ans)
5
8
175
181
s = eval(input()) cnt = [s.count("a"), s.count("b"), s.count("c")] if sum(cnt) == 1: print("YES") elif len(set(s)) == 1 or max(cnt) - min(cnt) > 1: print("NO") else: print("YES")
s = eval(input()) cnt = [s.count("a"), s.count("b"), s.count("c")] cnt.sort() ans = "YES" if cnt[1] - cnt[0] >= 2 or cnt[2] - cnt[0] >= 2 or cnt[2] - cnt[1] >= 2: ans = "NO" print(ans)
false
37.5
[ "-if sum(cnt) == 1:", "- print(\"YES\")", "-elif len(set(s)) == 1 or max(cnt) - min(cnt) > 1:", "- print(\"NO\")", "-else:", "- print(\"YES\")", "+cnt.sort()", "+ans = \"YES\"", "+if cnt[1] - cnt[0] >= 2 or cnt[2] - cnt[0] >= 2 or cnt[2] - cnt[1] >= 2:", "+ ans = \"NO\"", "+print(ans...
false
0.04142
0.043291
0.95678
[ "s093375765", "s912498915" ]
u066855390
p03860
python
s838722080
s514547574
19
17
3,064
2,940
Accepted
Accepted
10.53
s = input()[8] print(("A"+s+"C"))
s = input()[8] print(("A%sC" % s))
2
2
32
33
s = input()[8] print(("A" + s + "C"))
s = input()[8] print(("A%sC" % s))
false
0
[ "-print((\"A\" + s + \"C\"))", "+print((\"A%sC\" % s))" ]
false
0.066109
0.072172
0.915991
[ "s838722080", "s514547574" ]
u462329577
p02853
python
s260189904
s372287721
174
17
38,256
2,940
Accepted
Accepted
90.23
n,m = list(map(int,input().split())) if n == 1 and m == 1: print((10**6)) else: print(((max(0,(4-n))+max(0,(4-m)))*(10**5)))
#!/usr/bin/env python3 x,y = list(map(int,input().split())) if x == 1 and y == 1: #if False: print((10**6)) else: print(((max(0,4-x)+max(0,4-y))*(10**5)))
5
7
122
158
n, m = list(map(int, input().split())) if n == 1 and m == 1: print((10**6)) else: print(((max(0, (4 - n)) + max(0, (4 - m))) * (10**5)))
#!/usr/bin/env python3 x, y = list(map(int, input().split())) if x == 1 and y == 1: # if False: print((10**6)) else: print(((max(0, 4 - x) + max(0, 4 - y)) * (10**5)))
false
28.571429
[ "-n, m = list(map(int, input().split()))", "-if n == 1 and m == 1:", "+#!/usr/bin/env python3", "+x, y = list(map(int, input().split()))", "+if x == 1 and y == 1:", "+ # if False:", "- print(((max(0, (4 - n)) + max(0, (4 - m))) * (10**5)))", "+ print(((max(0, 4 - x) + max(0, 4 - y)) * (10**5)...
false
0.081836
0.040829
2.004378
[ "s260189904", "s372287721" ]
u340781749
p03424
python
s556503803
s686698933
137
17
3,444
2,940
Accepted
Accepted
87.59
from collections import Counter n = eval(input()) s = input().split() ss = Counter(s) print(('Three' if len(ss) == 3 else 'Four'))
n = eval(input()) s = set(input().split()) print(('Three' if len(s) == 3 else 'Four'))
6
3
129
81
from collections import Counter n = eval(input()) s = input().split() ss = Counter(s) print(("Three" if len(ss) == 3 else "Four"))
n = eval(input()) s = set(input().split()) print(("Three" if len(s) == 3 else "Four"))
false
50
[ "-from collections import Counter", "-", "-s = input().split()", "-ss = Counter(s)", "-print((\"Three\" if len(ss) == 3 else \"Four\"))", "+s = set(input().split())", "+print((\"Three\" if len(s) == 3 else \"Four\"))" ]
false
0.044469
0.045114
0.985721
[ "s556503803", "s686698933" ]
u047102107
p02754
python
s201945733
s146194593
170
73
38,448
65,544
Accepted
Accepted
57.06
import sys input = sys.stdin.readline N, A, B = list(map(int, input().split())) # print(N, A, B) if A == 0: print((0)) elif N % (A + B) == 0: print((N // (A + B) * A)) else: count = N // (A + B) * A rem = min(A, N % (A + B)) print((count + rem))
from sys import stdin, setrecursionlimit from collections import Counter, deque, defaultdict from math import floor, ceil from bisect import bisect_left from itertools import combinations setrecursionlimit(100000) INF = int(1e10) MOD = int(1e9 + 7) def main(): from builtins import int, map N, A, B...
16
24
272
550
import sys input = sys.stdin.readline N, A, B = list(map(int, input().split())) # print(N, A, B) if A == 0: print((0)) elif N % (A + B) == 0: print((N // (A + B) * A)) else: count = N // (A + B) * A rem = min(A, N % (A + B)) print((count + rem))
from sys import stdin, setrecursionlimit from collections import Counter, deque, defaultdict from math import floor, ceil from bisect import bisect_left from itertools import combinations setrecursionlimit(100000) INF = int(1e10) MOD = int(1e9 + 7) def main(): from builtins import int, map N, A, B = list(ma...
false
33.333333
[ "-import sys", "+from sys import stdin, setrecursionlimit", "+from collections import Counter, deque, defaultdict", "+from math import floor, ceil", "+from bisect import bisect_left", "+from itertools import combinations", "-input = sys.stdin.readline", "-N, A, B = list(map(int, input().split()))", ...
false
0.046537
0.066135
0.703672
[ "s201945733", "s146194593" ]
u391731808
p03241
python
s143475365
s753671888
40
20
3,064
3,064
Accepted
Accepted
50
N,M = list(map(int,input().split())) if M//N < 10**7: for i in range(M//N,0,-1): if M % i ==0: break print(i) else: for i in range(N,int(M**0.5)): if M % i == 0: break else: i = M print((M//i))
def get_divisor(n): a,b = [],[] for i in range(1,int(n**0.5)+1): if n%i==0: a.append(i) b.append(n//i) if a[-1]==b[-1]:b.pop() a.extend(b[::-1]) return a N,M = list(map(int,input().split())) print((max(n for n in get_divisor(M) if n<=M//N)))
14
12
273
297
N, M = list(map(int, input().split())) if M // N < 10**7: for i in range(M // N, 0, -1): if M % i == 0: break print(i) else: for i in range(N, int(M**0.5)): if M % i == 0: break else: i = M print((M // i))
def get_divisor(n): a, b = [], [] for i in range(1, int(n**0.5) + 1): if n % i == 0: a.append(i) b.append(n // i) if a[-1] == b[-1]: b.pop() a.extend(b[::-1]) return a N, M = list(map(int, input().split())) print((max(n for n in get_divisor(M) if n <= M // N...
false
14.285714
[ "+def get_divisor(n):", "+ a, b = [], []", "+ for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ a.append(i)", "+ b.append(n // i)", "+ if a[-1] == b[-1]:", "+ b.pop()", "+ a.extend(b[::-1])", "+ return a", "+", "+", "-if M // N < ...
false
0.043656
0.080943
0.539341
[ "s143475365", "s753671888" ]
u677267454
p03018
python
s993245497
s086818718
114
47
3,500
3,500
Accepted
Accepted
58.77
# -*- coding: utf-8 -*- s = eval(input()) a_num = 0 ans = 0 i = 0 while i < len(s): if s[i] == 'A': a_num += 1 i += 1 elif s[i:i+2] == 'BC': ans += a_num i += 2 else: a_num = 0 i += 1 print(ans)
# -*- coding: utf-8 -*- s = eval(input()) s = s.replace('BC', 'D') a_num = 0 ans = 0 for c in s: if c == 'A': a_num += 1 elif c == 'D': ans += a_num else: a_num = 0 print(ans)
18
15
268
222
# -*- coding: utf-8 -*- s = eval(input()) a_num = 0 ans = 0 i = 0 while i < len(s): if s[i] == "A": a_num += 1 i += 1 elif s[i : i + 2] == "BC": ans += a_num i += 2 else: a_num = 0 i += 1 print(ans)
# -*- coding: utf-8 -*- s = eval(input()) s = s.replace("BC", "D") a_num = 0 ans = 0 for c in s: if c == "A": a_num += 1 elif c == "D": ans += a_num else: a_num = 0 print(ans)
false
16.666667
[ "+s = s.replace(\"BC\", \"D\")", "-i = 0", "-while i < len(s):", "- if s[i] == \"A\":", "+for c in s:", "+ if c == \"A\":", "- i += 1", "- elif s[i : i + 2] == \"BC\":", "+ elif c == \"D\":", "- i += 2", "- i += 1" ]
false
0.094949
0.03744
2.536005
[ "s993245497", "s086818718" ]