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
u539367121
p02918
python
s007578720
s398545229
55
40
10,764
9,228
Accepted
Accepted
27.27
from collections import deque def main(): n,k=list(map(int,input().split())) s=eval(input()) # maked group t=[] t.append(s[0]) x=s[0] for i in range(1,n): if x!=s[i]: t.append(s[i]) x=s[i] #print(t) j=0 t=deque(t) while j<k: if len(t)<=2: print((n-1...
def main(): n,k=list(map(int,input().split())) s=eval(input()) # first score ans=0 x=s[0] for i in range(1,n): if x==s[i]: ans+=1 else: x=s[i] print((min(ans+2*k,n-1))) if __name__=='__main__': main()
30
17
440
246
from collections import deque def main(): n, k = list(map(int, input().split())) s = eval(input()) # maked group t = [] t.append(s[0]) x = s[0] for i in range(1, n): if x != s[i]: t.append(s[i]) x = s[i] # print(t) j = 0 t = deque(t) while j ...
def main(): n, k = list(map(int, input().split())) s = eval(input()) # first score ans = 0 x = s[0] for i in range(1, n): if x == s[i]: ans += 1 else: x = s[i] print((min(ans + 2 * k, n - 1))) if __name__ == "__main__": main()
false
43.333333
[ "-from collections import deque", "-", "-", "- # maked group", "- t = []", "- t.append(s[0])", "+ # first score", "+ ans = 0", "- if x != s[i]:", "- t.append(s[i])", "+ if x == s[i]:", "+ ans += 1", "+ else:", "- # print(t)", "...
false
0.03643
0.036341
1.002465
[ "s007578720", "s398545229" ]
u970197315
p03478
python
s744524201
s145114133
35
25
2,940
3,060
Accepted
Accepted
28.57
n,a,b=list(map(int,input().split())) ans=0 for i in range(1,n+1): s=str(i) t=0 for ss in s: t+=int(ss) if a<=t<=b: ans+=int(i) print(ans)
def sumdidits(x): res=0 while x: res+=x%10 x//=10 return res n,a,b=list(map(int,input().split())) ans=0 for i in range(1,n+1): t=sumdidits(i) if a<=t<=b: ans+=i print(ans)
11
14
175
201
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): s = str(i) t = 0 for ss in s: t += int(ss) if a <= t <= b: ans += int(i) print(ans)
def sumdidits(x): res = 0 while x: res += x % 10 x //= 10 return res n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): t = sumdidits(i) if a <= t <= b: ans += i print(ans)
false
21.428571
[ "+def sumdidits(x):", "+ res = 0", "+ while x:", "+ res += x % 10", "+ x //= 10", "+ return res", "+", "+", "- s = str(i)", "- t = 0", "- for ss in s:", "- t += int(ss)", "+ t = sumdidits(i)", "- ans += int(i)", "+ ans += i" ]
false
0.044894
0.0069
6.506797
[ "s744524201", "s145114133" ]
u367130284
p03821
python
s231714277
s153158512
205
186
25,124
25,124
Accepted
Accepted
9.27
n,*a=list(map(int,open(0).read().split())) #print(a) sumcount=0 for s in range(n*2-1,-1,-2): hidari=a[s-1]+sumcount # print(hidari,a[s],sumcount) if hidari%a[s]==0: continue elif hidari%a[s]!=0 and hidari//a[s]==0: sumcount+=a[s]-hidari elif hidari%a[s]!=0 and hidari//a[s]!=0: sumcount+=...
n,*a=list(map(int,open(0).read().split())) sumcount=0 for s in range(n*2-1,-1,-2): hidari=a[s-1]+sumcount if hidari%a[s]!=0 and hidari//a[s]==0: sumcount+=a[s]-hidari if hidari%a[s]!=0 and hidari//a[s]!=0: sumcount+=(hidari//a[s]+1)*a[s]-hidari print(sumcount)
13
9
359
276
n, *a = list(map(int, open(0).read().split())) # print(a) sumcount = 0 for s in range(n * 2 - 1, -1, -2): hidari = a[s - 1] + sumcount # print(hidari,a[s],sumcount) if hidari % a[s] == 0: continue elif hidari % a[s] != 0 and hidari // a[s] == 0: sumcount += a[s] - hidari elif hidari...
n, *a = list(map(int, open(0).read().split())) sumcount = 0 for s in range(n * 2 - 1, -1, -2): hidari = a[s - 1] + sumcount if hidari % a[s] != 0 and hidari // a[s] == 0: sumcount += a[s] - hidari if hidari % a[s] != 0 and hidari // a[s] != 0: sumcount += (hidari // a[s] + 1) * a[s] - hidari...
false
30.769231
[ "-# print(a)", "- # print(hidari,a[s],sumcount)", "- if hidari % a[s] == 0:", "- continue", "- elif hidari % a[s] != 0 and hidari // a[s] == 0:", "+ if hidari % a[s] != 0 and hidari // a[s] == 0:", "- elif hidari % a[s] != 0 and hidari // a[s] != 0:", "+ if hidari % a[s] != 0...
false
0.109747
0.092277
1.189321
[ "s231714277", "s153158512" ]
u423665486
p03854
python
s684582975
s003447679
1,934
29
3,188
6,516
Accepted
Accepted
98.5
def resolve(): s = eval(input()) w = ['dream', 'dreamer', 'erase', 'eraser'] h = dict() for i in range(len(w)): h[w[i][::-1]] = True s = s[::-1] c = '' for i in s: c += i if h.get(c): c = '' if not len(c): print('YES') else: print('NO') resolve()
import re def resolve(): s = eval(input()) if re.search("^(dream|dreamer|erase|eraser)+$", s): print("YES") else: print("NO") resolve()
17
8
278
144
def resolve(): s = eval(input()) w = ["dream", "dreamer", "erase", "eraser"] h = dict() for i in range(len(w)): h[w[i][::-1]] = True s = s[::-1] c = "" for i in s: c += i if h.get(c): c = "" if not len(c): print("YES") else: print("...
import re def resolve(): s = eval(input()) if re.search("^(dream|dreamer|erase|eraser)+$", s): print("YES") else: print("NO") resolve()
false
52.941176
[ "+import re", "+", "+", "- w = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]", "- h = dict()", "- for i in range(len(w)):", "- h[w[i][::-1]] = True", "- s = s[::-1]", "- c = \"\"", "- for i in s:", "- c += i", "- if h.get(c):", "- c = \"\""...
false
0.093816
0.054099
1.734166
[ "s684582975", "s003447679" ]
u869154953
p03485
python
s276947505
s934542364
112
26
26,960
9,060
Accepted
Accepted
76.79
import numpy as np Alist=list(map(int,input().split())) print((int(np.ceil(np.mean(Alist)))))
import math a,b=list(map(int,input().split())) print((math.ceil((a+b)/2)))
5
5
97
72
import numpy as np Alist = list(map(int, input().split())) print((int(np.ceil(np.mean(Alist)))))
import math a, b = list(map(int, input().split())) print((math.ceil((a + b) / 2)))
false
0
[ "-import numpy as np", "+import math", "-Alist = list(map(int, input().split()))", "-print((int(np.ceil(np.mean(Alist)))))", "+a, b = list(map(int, input().split()))", "+print((math.ceil((a + b) / 2)))" ]
false
0.673318
0.070205
9.590746
[ "s276947505", "s934542364" ]
u578958929
p03775
python
s714784642
s393860207
73
62
73,568
65,088
Accepted
Accepted
15.07
import math N = int(eval(input())) INF = float("inf") for a in range(1, int(math.sqrt(N)) + 1): if N % a != 0: continue b = int(N / a) a = list(map(int, str(a))) b = list(map(int, str(b))) length = max(len(a), len(b)) if INF > length: INF = length print(INF)
N = int(eval(input())) ans = float("inf") for a in range(1, N+1): if a * a > N: break if N % a ==0: b = N / a f = max(a, b) keta = 0 while True: keta += 1 if 10 ** keta > f: break ans = min(ans, keta) print(ans)
13
15
305
309
import math N = int(eval(input())) INF = float("inf") for a in range(1, int(math.sqrt(N)) + 1): if N % a != 0: continue b = int(N / a) a = list(map(int, str(a))) b = list(map(int, str(b))) length = max(len(a), len(b)) if INF > length: INF = length print(INF)
N = int(eval(input())) ans = float("inf") for a in range(1, N + 1): if a * a > N: break if N % a == 0: b = N / a f = max(a, b) keta = 0 while True: keta += 1 if 10**keta > f: break ans = min(ans, keta) print(ans)
false
13.333333
[ "-import math", "-", "-INF = float(\"inf\")", "-for a in range(1, int(math.sqrt(N)) + 1):", "- if N % a != 0:", "- continue", "- b = int(N / a)", "- a = list(map(int, str(a)))", "- b = list(map(int, str(b)))", "- length = max(len(a), len(b))", "- if INF > length:", "- ...
false
0.047447
0.048563
0.977023
[ "s714784642", "s393860207" ]
u492910842
p02725
python
s796380310
s862767098
238
108
77,260
99,996
Accepted
Accepted
54.62
k,n = list(map(int,input().split())) a = list(map(int,input().split())) a.append(a[0]+k-a[n-1]) counter = 0 for i in range(n): if counter < a[i+1]-a[i]: counter = a[i+1]-a[i] print((min(k-counter,a[n-1]-a[0])))
k,n=list(map(int,input().split())) a=list(map(int,input().split())) a.append(a[0]+k) cnt=0 for i in range(n): cnt=max(cnt,a[i+1]-a[i]) print((k-cnt))
10
8
219
151
k, n = list(map(int, input().split())) a = list(map(int, input().split())) a.append(a[0] + k - a[n - 1]) counter = 0 for i in range(n): if counter < a[i + 1] - a[i]: counter = a[i + 1] - a[i] print((min(k - counter, a[n - 1] - a[0])))
k, n = list(map(int, input().split())) a = list(map(int, input().split())) a.append(a[0] + k) cnt = 0 for i in range(n): cnt = max(cnt, a[i + 1] - a[i]) print((k - cnt))
false
20
[ "-a.append(a[0] + k - a[n - 1])", "-counter = 0", "+a.append(a[0] + k)", "+cnt = 0", "- if counter < a[i + 1] - a[i]:", "- counter = a[i + 1] - a[i]", "-print((min(k - counter, a[n - 1] - a[0])))", "+ cnt = max(cnt, a[i + 1] - a[i])", "+print((k - cnt))" ]
false
0.036052
0.06453
0.558688
[ "s796380310", "s862767098" ]
u860657719
p02683
python
s516671646
s362219961
89
79
68,532
68,436
Accepted
Accepted
11.24
inf = 10**9 n, m, x = list(map(int, input().split())) a = [0] * n c = [0] * n y = [0] * n for i in range(n): data = list(map(int, input().split())) c[i] = data[0] a[i] = data[1:] ans = inf for i in range(2**n): lis = [0]*n money = 0 know = [0] * m for j in range(n): if...
inf = 10**9 n, m, x = list(map(int, input().split())) a = [0] * n c = [0] * n y = [0] * n for i in range(n): data = list(map(int, input().split())) c[i] = data[0] a[i] = data[1:] ans = inf for i in range(2**n): money = 0 know = [0] * m for j in range(n): if (i >> j) & 1: ...
29
28
579
562
inf = 10**9 n, m, x = list(map(int, input().split())) a = [0] * n c = [0] * n y = [0] * n for i in range(n): data = list(map(int, input().split())) c[i] = data[0] a[i] = data[1:] ans = inf for i in range(2**n): lis = [0] * n money = 0 know = [0] * m for j in range(n): if (i >> j) & 1...
inf = 10**9 n, m, x = list(map(int, input().split())) a = [0] * n c = [0] * n y = [0] * n for i in range(n): data = list(map(int, input().split())) c[i] = data[0] a[i] = data[1:] ans = inf for i in range(2**n): money = 0 know = [0] * m for j in range(n): if (i >> j) & 1: mone...
false
3.448276
[ "- lis = [0] * n", "- for l in range(m):", "- know[l] += a[j][l]", "+ for k in range(m):", "+ know[k] += a[j][k]" ]
false
0.007011
0.067814
0.103389
[ "s516671646", "s362219961" ]
u989345508
p03732
python
s747755486
s073264240
201
38
3,188
3,188
Accepted
Accepted
81.09
n,w=list(map(int,input().split())) wv=[list(map(int,input().split())) for i in range(n)] wv.sort(key=lambda x:-x[1]) wv.sort(key=lambda x:x[0]) #print(wv) w0=wv[0][0] x=[[0],[0],[0],[0]] for i in range(n): if wv[i][0]==w0: k=wv[i][1]+x[0][-1] l=len(x[0]) if l*w0<=w:x[0].append(k) ...
n,w=list(map(int,input().split())) wv=[list(map(int,input().split())) for i in range(n)] wv.sort(key=lambda x:-x[1]) wv.sort(key=lambda x:x[0]) #print(wv) w0=wv[0][0] x=[[0],[0],[0],[0]] for i in range(n): if wv[i][0]==w0: k=wv[i][1]+x[0][-1] l=len(x[0]) if l*w0<=w:x[0].append(k) ...
36
35
1,013
985
n, w = list(map(int, input().split())) wv = [list(map(int, input().split())) for i in range(n)] wv.sort(key=lambda x: -x[1]) wv.sort(key=lambda x: x[0]) # print(wv) w0 = wv[0][0] x = [[0], [0], [0], [0]] for i in range(n): if wv[i][0] == w0: k = wv[i][1] + x[0][-1] l = len(x[0]) if l * w0 <=...
n, w = list(map(int, input().split())) wv = [list(map(int, input().split())) for i in range(n)] wv.sort(key=lambda x: -x[1]) wv.sort(key=lambda x: x[0]) # print(wv) w0 = wv[0][0] x = [[0], [0], [0], [0]] for i in range(n): if wv[i][0] == w0: k = wv[i][1] + x[0][-1] l = len(x[0]) if l * w0 <=...
false
2.777778
[ "- for l in range(len(x[0])):", "- if i * (w0 + 3) + j * (w0 + 2) + k * (w0 + 1) + l * w0 <= w:", "- ma_sub = x[3][i] + x[2][j] + x[1][k] + x[0][l]", "- ma = max(ma, ma_sub)", "- else:", "- break", "+ ...
false
0.051639
0.056894
0.907625
[ "s747755486", "s073264240" ]
u573234244
p02555
python
s478902168
s064294749
163
114
9,256
9,128
Accepted
Accepted
30.06
s = int(eval(input())) x = s // 3 def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2,r+1): pivot = denominator[p - 1] if pivot > 1:...
from math import factorial s = int(eval(input())) ans = 0 for i in range(s // 3): box = i + 1 # 箱の数 ball = s - 3 * box # あらかじめ箱に3こずつ入れたあとの残りの玉の数 # 箱の入れ方が何通りあるか計算。 # 割り算を // ではなく / とするとfloat型の計算となりオーバーフローする可能性がある。 # factorial(s_ + i) // (factorial(s_) * factorial(i))ではなくfactorial...
34
15
772
505
s = int(eval(input())) x = s // 3 def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2, r + 1): pivot = denominator[p - 1] if...
from math import factorial s = int(eval(input())) ans = 0 for i in range(s // 3): box = i + 1 # 箱の数 ball = s - 3 * box # あらかじめ箱に3こずつ入れたあとの残りの玉の数 # 箱の入れ方が何通りあるか計算。 # 割り算を // ではなく / とするとfloat型の計算となりオーバーフローする可能性がある。 # factorial(s_ + i) // (factorial(s_) * factorial(i))ではなくfactorial(s_ + i) // (facto...
false
55.882353
[ "+from math import factorial", "+", "-x = s // 3", "-", "-", "-def cmb(n, r):", "- if n - r < r:", "- r = n - r", "- if r == 0:", "- return 1", "- if r == 1:", "- return n", "- numerator = [n - r + k + 1 for k in range(r)]", "- denominator = [k + 1 for k...
false
0.062859
0.079936
0.786367
[ "s478902168", "s064294749" ]
u890870565
p02658
python
s476130685
s735242750
75
58
21,804
21,440
Accepted
Accepted
22.67
N = int(eval(input())) A = list(map(int, input().split())) A.sort() if A[0] == 0: print((0)) else: ans = 1 for a in A: ans *= a th = 10**18 if ans > th: print((-1)) exit(0) print(ans)
n = int(eval(input())) a = list(map(int, input().split())) if 0 in a: print((0)) exit(0) m = 10**18 ans = 1 for x in a: ans *= x if ans > m: print((-1)) exit(0) print(ans)
14
17
250
215
N = int(eval(input())) A = list(map(int, input().split())) A.sort() if A[0] == 0: print((0)) else: ans = 1 for a in A: ans *= a th = 10**18 if ans > th: print((-1)) exit(0) print(ans)
n = int(eval(input())) a = list(map(int, input().split())) if 0 in a: print((0)) exit(0) m = 10**18 ans = 1 for x in a: ans *= x if ans > m: print((-1)) exit(0) print(ans)
false
17.647059
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-A.sort()", "-if A[0] == 0:", "+n = int(eval(input()))", "+a = list(map(int, input().split()))", "+if 0 in a:", "-else:", "- ans = 1", "- for a in A:", "- ans *= a", "- th = 10**18", "- if ans > th...
false
0.043709
0.043672
1.000849
[ "s476130685", "s735242750" ]
u633068244
p00106
python
s732347284
s651241299
20
10
4,236
4,240
Accepted
Accepted
50
r = 51 wc = [[15,2244],[10,1520],[12,1870],[5,850],[3,550],[2,380]] dp = [0]*r for w,c in wc: dp[w] = c for i in range(r - w): if dp[i] > 0 and (dp[i + w] == 0 or dp[i + w] > dp[i] + c): dp[i + w] = dp[i] + c while 1: n = eval(input()) if n == 0: break print(dp[n/100])
r,x = 51,2**31 wc = [[15,2244],[10,1520],[12,1870],[5,850],[3,550],[2,380]] dp = [x]*r for w,c in wc: dp[w] = c for i in range(r - w): if dp[i] < x and dp[i + w] > dp[i] + c: dp[i + w] = dp[i] + c while 1: n = eval(input()) if n == 0: break print(dp[n/100])
13
13
285
273
r = 51 wc = [[15, 2244], [10, 1520], [12, 1870], [5, 850], [3, 550], [2, 380]] dp = [0] * r for w, c in wc: dp[w] = c for i in range(r - w): if dp[i] > 0 and (dp[i + w] == 0 or dp[i + w] > dp[i] + c): dp[i + w] = dp[i] + c while 1: n = eval(input()) if n == 0: break print...
r, x = 51, 2**31 wc = [[15, 2244], [10, 1520], [12, 1870], [5, 850], [3, 550], [2, 380]] dp = [x] * r for w, c in wc: dp[w] = c for i in range(r - w): if dp[i] < x and dp[i + w] > dp[i] + c: dp[i + w] = dp[i] + c while 1: n = eval(input()) if n == 0: break print(dp[n / 10...
false
0
[ "-r = 51", "+r, x = 51, 2**31", "-dp = [0] * r", "+dp = [x] * r", "- if dp[i] > 0 and (dp[i + w] == 0 or dp[i + w] > dp[i] + c):", "+ if dp[i] < x and dp[i + w] > dp[i] + c:" ]
false
0.046716
0.048947
0.954415
[ "s732347284", "s651241299" ]
u219417113
p03805
python
s363617580
s532505619
36
27
3,064
3,064
Accepted
Accepted
25
n, m = list(map(int, input().split())) graph = {i:[] for i in range(1, n+1)} for _ in range(m): a, b = list(map(int, input().split())) graph[a].append(b) graph[b].append(a) visited = [False] * (n+1) stack = [(1, 1, visited)] count = 0 while stack: now, dist, visited_ = stack.pop() ...
from itertools import permutations N, M = list(map(int, input().split())) graph = [[] for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) graph[a-1].append(b-1) graph[b-1].append(a-1) ans = 0 for comb in permutations(list(range(1, N)), N-1): v = 0 valid = True ...
24
22
540
461
n, m = list(map(int, input().split())) graph = {i: [] for i in range(1, n + 1)} for _ in range(m): a, b = list(map(int, input().split())) graph[a].append(b) graph[b].append(a) visited = [False] * (n + 1) stack = [(1, 1, visited)] count = 0 while stack: now, dist, visited_ = stack.pop() visited = vis...
from itertools import permutations N, M = list(map(int, input().split())) graph = [[] for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) ans = 0 for comb in permutations(list(range(1, N)), N - 1): v = 0 valid = True ...
false
8.333333
[ "-n, m = list(map(int, input().split()))", "-graph = {i: [] for i in range(1, n + 1)}", "-for _ in range(m):", "+from itertools import permutations", "+", "+N, M = list(map(int, input().split()))", "+graph = [[] for _ in range(N)]", "+for _ in range(M):", "- graph[a].append(b)", "- graph[b]....
false
0.064718
0.197213
0.328162
[ "s363617580", "s532505619" ]
u914797917
p03448
python
s862207151
s002054992
50
19
3,060
3,188
Accepted
Accepted
62
A=int(eval(input())) B=int(eval(input())) C=int(eval(input())) X=int(eval(input())) cnt=0 for i in range(A+1): for j in range(B+1): for k in range(C+1): if i*500+j*100+k*50==X: cnt+=1 print(cnt)
A=int(eval(input())) B=int(eval(input())) C=int(eval(input())) X=int(eval(input())) cnt=0 for i in range(A+1): for j in range(B+1): s=i*500+j*100 if (X-s)%50==0 and (X-s)/50<=C and (X-s)/50>=0: cnt+=1 print(cnt)
11
11
200
213
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) cnt = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): if i * 500 + j * 100 + k * 50 == X: cnt += 1 print(cnt)
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) cnt = 0 for i in range(A + 1): for j in range(B + 1): s = i * 500 + j * 100 if (X - s) % 50 == 0 and (X - s) / 50 <= C and (X - s) / 50 >= 0: cnt += 1 print(cnt)
false
0
[ "- for k in range(C + 1):", "- if i * 500 + j * 100 + k * 50 == X:", "- cnt += 1", "+ s = i * 500 + j * 100", "+ if (X - s) % 50 == 0 and (X - s) / 50 <= C and (X - s) / 50 >= 0:", "+ cnt += 1" ]
false
0.202633
0.137203
1.476888
[ "s862207151", "s002054992" ]
u738898077
p02779
python
s119912888
s390485947
183
86
26,808
26,804
Accepted
Accepted
53.01
n = int(eval(input())) a = sorted(list(map(int,input().split()))) for i in range(n-1): if a[i] == a[i+1]: print("NO") exit() print("YES")
n=int(eval(input())) a=list(map(int,input().split())) if len(set(a))==len(a): print("YES") else: print("NO")
7
6
157
116
n = int(eval(input())) a = sorted(list(map(int, input().split()))) for i in range(n - 1): if a[i] == a[i + 1]: print("NO") exit() print("YES")
n = int(eval(input())) a = list(map(int, input().split())) if len(set(a)) == len(a): print("YES") else: print("NO")
false
14.285714
[ "-a = sorted(list(map(int, input().split())))", "-for i in range(n - 1):", "- if a[i] == a[i + 1]:", "- print(\"NO\")", "- exit()", "-print(\"YES\")", "+a = list(map(int, input().split()))", "+if len(set(a)) == len(a):", "+ print(\"YES\")", "+else:", "+ print(\"NO\")" ]
false
0.044219
0.04714
0.938034
[ "s119912888", "s390485947" ]
u994784668
p03747
python
s586807023
s471645368
458
306
8,116
8,116
Accepted
Accepted
33.19
N, L, T = list(map(int, input().split())) gap = 0 X = [0] * N for i in range(N): x, w = list(map(int, input().split())) x += ((w + 1) % 3 - 1) * T gap += x // L gap %= N X[i] = x % L X.sort() for i in range(N): print((X[(i+gap) % N]))
import sys input = sys.stdin.readline N, L, T = list(map(int, input().split())) gap = 0 X = [0] * N for i in range(N): x, w = list(map(int, input().split())) x += ((w + 1) % 3 - 1) * T gap += x // L gap %= N X[i] = x % L X.sort() for i in range(N): print((X[(i+gap) % N]))
12
14
255
295
N, L, T = list(map(int, input().split())) gap = 0 X = [0] * N for i in range(N): x, w = list(map(int, input().split())) x += ((w + 1) % 3 - 1) * T gap += x // L gap %= N X[i] = x % L X.sort() for i in range(N): print((X[(i + gap) % N]))
import sys input = sys.stdin.readline N, L, T = list(map(int, input().split())) gap = 0 X = [0] * N for i in range(N): x, w = list(map(int, input().split())) x += ((w + 1) % 3 - 1) * T gap += x // L gap %= N X[i] = x % L X.sort() for i in range(N): print((X[(i + gap) % N]))
false
14.285714
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.040436
0.043791
0.923395
[ "s586807023", "s471645368" ]
u350997995
p03705
python
s153541122
s873991071
24
17
3,316
2,940
Accepted
Accepted
29.17
N,A,B = list(map(int,input().split())) if A>B or (N==1 and A!=B): print((0)) elif A==B or N==2: print((1)) else: N-=2 print((B*N-A*N+1))
N,A,B = list(map(int,input().split())) if (N==1 and A!=B) or B-A<0:print((0)) else: print(((A-B)*(2-N)+1))
6
3
137
98
N, A, B = list(map(int, input().split())) if A > B or (N == 1 and A != B): print((0)) elif A == B or N == 2: print((1)) else: N -= 2 print((B * N - A * N + 1))
N, A, B = list(map(int, input().split())) if (N == 1 and A != B) or B - A < 0: print((0)) else: print(((A - B) * (2 - N) + 1))
false
50
[ "-if A > B or (N == 1 and A != B):", "+if (N == 1 and A != B) or B - A < 0:", "-elif A == B or N == 2:", "- print((1))", "- N -= 2", "- print((B * N - A * N + 1))", "+ print(((A - B) * (2 - N) + 1))" ]
false
0.035458
0.061944
0.572425
[ "s153541122", "s873991071" ]
u867848444
p02881
python
s752920317
s320086604
160
144
2,940
3,060
Accepted
Accepted
10
n=int(eval(input())) ans=10**12 for i in range(1,int(n**0.5)+1): if n%i==0: ans=min(ans,i+n//i-2) print(ans)
n=int(eval(input())) num=int(n**0.5) ans=float('inf') for i in range(1,num+1): if n%i==0: temp=i+n//i-2 if temp<ans:ans=temp print(temp)
7
10
121
161
n = int(eval(input())) ans = 10**12 for i in range(1, int(n**0.5) + 1): if n % i == 0: ans = min(ans, i + n // i - 2) print(ans)
n = int(eval(input())) num = int(n**0.5) ans = float("inf") for i in range(1, num + 1): if n % i == 0: temp = i + n // i - 2 if temp < ans: ans = temp print(temp)
false
30
[ "-ans = 10**12", "-for i in range(1, int(n**0.5) + 1):", "+num = int(n**0.5)", "+ans = float(\"inf\")", "+for i in range(1, num + 1):", "- ans = min(ans, i + n // i - 2)", "-print(ans)", "+ temp = i + n // i - 2", "+ if temp < ans:", "+ ans = temp", "+print(temp)"...
false
0.064534
0.046846
1.377579
[ "s752920317", "s320086604" ]
u759412327
p03111
python
s109693522
s281017265
279
213
3,064
10,852
Accepted
Accepted
23.66
from itertools import product n,*B=list(map(int,input().split())) A=[int(eval(input())) for i in range(n)] s=10**9 for P in product([0,1,2,3],repeat=n): if {0,1,2}<=set(P): m=[0,0,0] for x,y in zip(P,A): if x!=3: m[x]+=y t=sum(abs(m-y) for m,y in zip(m,B)) l=sum(1 for j in P i...
from itertools import * N,A,B,C = list(map(int, input().split())) L = [int(eval(input())) for n in range(N)] ans = [] for i in product(list(range(4)),repeat=N): a = 0 b = 0 c = 0 d = 0 for j in range(N): if i[j]: d+=1 if i[j]==1: a+=L[j] elif i[j]==2: b+=...
14
23
348
416
from itertools import product n, *B = list(map(int, input().split())) A = [int(eval(input())) for i in range(n)] s = 10**9 for P in product([0, 1, 2, 3], repeat=n): if {0, 1, 2} <= set(P): m = [0, 0, 0] for x, y in zip(P, A): if x != 3: m[x] += y t = sum(abs(m - ...
from itertools import * N, A, B, C = list(map(int, input().split())) L = [int(eval(input())) for n in range(N)] ans = [] for i in product(list(range(4)), repeat=N): a = 0 b = 0 c = 0 d = 0 for j in range(N): if i[j]: d += 1 if i[j] == 1: a += L[j] ...
false
39.130435
[ "-from itertools import product", "+from itertools import *", "-n, *B = list(map(int, input().split()))", "-A = [int(eval(input())) for i in range(n)]", "-s = 10**9", "-for P in product([0, 1, 2, 3], repeat=n):", "- if {0, 1, 2} <= set(P):", "- m = [0, 0, 0]", "- for x, y in zip(P, ...
false
0.226698
0.552936
0.409989
[ "s109693522", "s281017265" ]
u437215432
p04019
python
s394134090
s863483612
29
26
9,040
9,020
Accepted
Accepted
10.34
s = input() s = list(s) sowth = s.count('S') if 'S' in s else 0 east = s.count('E') if 'E' in s else 0 north = s.count('N') if 'N' in s else 0 west = s.count('W') if 'W' in s else 0 if (sowth != 0 and north == 0) or\ (sowth == 0 and north != 0) or\ (west != 0 and east == 0) or\ (west == 0 and...
s = input() s = list(s) sowth = s.count('S') if 'S' in s else 0 east = s.count('E') if 'E' in s else 0 north = s.count('N') if 'N' in s else 0 west = s.count('W') if 'W' in s else 0 if (sowth + north != 0 and sowth * north == 0) or\ (west + east != 0 and west * east == 0): print('No') else: ...
15
13
375
333
s = input() s = list(s) sowth = s.count("S") if "S" in s else 0 east = s.count("E") if "E" in s else 0 north = s.count("N") if "N" in s else 0 west = s.count("W") if "W" in s else 0 if ( (sowth != 0 and north == 0) or (sowth == 0 and north != 0) or (west != 0 and east == 0) or (west == 0 and east != 0) ...
s = input() s = list(s) sowth = s.count("S") if "S" in s else 0 east = s.count("E") if "E" in s else 0 north = s.count("N") if "N" in s else 0 west = s.count("W") if "W" in s else 0 if (sowth + north != 0 and sowth * north == 0) or ( west + east != 0 and west * east == 0 ): print("No") else: print("Yes")
false
13.333333
[ "-if (", "- (sowth != 0 and north == 0)", "- or (sowth == 0 and north != 0)", "- or (west != 0 and east == 0)", "- or (west == 0 and east != 0)", "+if (sowth + north != 0 and sowth * north == 0) or (", "+ west + east != 0 and west * east == 0" ]
false
0.045348
0.088507
0.512359
[ "s394134090", "s863483612" ]
u600402037
p02949
python
s784449712
s293943762
1,144
1,037
46,428
46,428
Accepted
Accepted
9.35
import sys sys.setrecursionlimit(10 ** 9) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, M, P = lr() graph = [lr() for _ in range(M)] def bellmanford(s, g): dist = [float("inf")] * (N+1) dist[s] = 0 for i in range(2 * N): ...
import sys sys.setrecursionlimit(10 ** 9) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, M, P = lr() graph = [lr() for _ in range(M)] def bellmanford(s, g): dist = [float('inf')] * (N+1) dist[s] = 0 for i in range(2 * N): ...
30
28
682
653
import sys sys.setrecursionlimit(10**9) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, M, P = lr() graph = [lr() for _ in range(M)] def bellmanford(s, g): dist = [float("inf")] * (N + 1) dist[s] = 0 for i in range(2 * N): for a, b, c...
import sys sys.setrecursionlimit(10**9) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, M, P = lr() graph = [lr() for _ in range(M)] def bellmanford(s, g): dist = [float("inf")] * (N + 1) dist[s] = 0 for i in range(2 * N): for a, b, c...
false
6.666667
[ "- cost = -(c - P)", "- if dist[b] > dist[a] + cost:", "- dist[b] = dist[a] + cost", "+ if dist[b] > dist[a] - c + P:", "+ dist[b] = dist[a] - c + P" ]
false
0.046769
0.046677
1.001964
[ "s784449712", "s293943762" ]
u977389981
p03739
python
s578145506
s937297133
144
113
14,468
14,332
Accepted
Accepted
21.53
n = int(eval(input())) A = [int(i) for i in input().split()] ans = 0 cnt = 0 for i in range(n): if i % 2 == 0: if cnt + A[i] < 0: cnt += A[i] else: ans += abs(cnt + A[i] - (-1)) cnt = -1 else: if cnt + A[i] > 0: cnt += A[i] ...
n = int(eval(input())) A = [int(i) for i in input().split()] def f(x): ans = 0 cnt = 0 for i in range(n): if i % 2 == x: if cnt + A[i] < 0: cnt += A[i] else: ans += abs(cnt + A[i] - (-1)) cnt = -1 else: ...
36
22
786
501
n = int(eval(input())) A = [int(i) for i in input().split()] ans = 0 cnt = 0 for i in range(n): if i % 2 == 0: if cnt + A[i] < 0: cnt += A[i] else: ans += abs(cnt + A[i] - (-1)) cnt = -1 else: if cnt + A[i] > 0: cnt += A[i] else: ...
n = int(eval(input())) A = [int(i) for i in input().split()] def f(x): ans = 0 cnt = 0 for i in range(n): if i % 2 == x: if cnt + A[i] < 0: cnt += A[i] else: ans += abs(cnt + A[i] - (-1)) cnt = -1 else: if ...
false
38.888889
[ "-ans = 0", "-cnt = 0", "-for i in range(n):", "- if i % 2 == 0:", "- if cnt + A[i] < 0:", "- cnt += A[i]", "+", "+", "+def f(x):", "+ ans = 0", "+ cnt = 0", "+ for i in range(n):", "+ if i % 2 == x:", "+ if cnt + A[i] < 0:", "+ ...
false
0.044103
0.044742
0.985727
[ "s578145506", "s937297133" ]
u124498235
p03425
python
s133787524
s525394349
276
193
3,064
3,188
Accepted
Accepted
30.07
n = int(eval(input())) ss = "MARCH" c = [0 for i in range(5)] for i in range(n): s = eval(input()) for j in range(5): if s[0] == ss[j]: c[j] += 1 ans = 0 for i in range(5): for j in range(i+1,5): for k in range(j+1,5): ans += c[i]*c[j]*c[k] print (ans)
import math n = int(eval(input())) a = ["M","A","R","C","H"] dic = {} def combination(n,r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) for i in range(n): x = eval(input()) if x[0] in a: if x[0] in dic: dic[x[0]] += 1 else: dic[x[0]] = 1 b = [] for i in list(dic.valu...
14
23
266
464
n = int(eval(input())) ss = "MARCH" c = [0 for i in range(5)] for i in range(n): s = eval(input()) for j in range(5): if s[0] == ss[j]: c[j] += 1 ans = 0 for i in range(5): for j in range(i + 1, 5): for k in range(j + 1, 5): ans += c[i] * c[j] * c[k] print(ans)
import math n = int(eval(input())) a = ["M", "A", "R", "C", "H"] dic = {} def combination(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) for i in range(n): x = eval(input()) if x[0] in a: if x[0] in dic: dic[x[0]] += 1 else: dic[x[...
false
39.130435
[ "+import math", "+", "-ss = \"MARCH\"", "-c = [0 for i in range(5)]", "+a = [\"M\", \"A\", \"R\", \"C\", \"H\"]", "+dic = {}", "+", "+", "+def combination(n, r):", "+ return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))", "+", "+", "- s = eval(input())", "- for ...
false
0.03794
0.00757
5.011891
[ "s133787524", "s525394349" ]
u650459696
p02257
python
s004459040
s593840576
950
860
7,852
7,836
Accepted
Accepted
9.47
c = 0 while True: try: n = int(eval(input())) except EOFError: break c += 1 for i in range(2, int(n ** 0.5 + 1)): if n % i == 0: c -= 1 break print(c)
#Prime Numbers ?´???° c = 0 for i in range(int(eval(input()))): n = int(eval(input())) for i in range(2, int(n ** 0.5 + 1)): if n % i == 0: break else: c += 1 print(c)
12
10
219
204
c = 0 while True: try: n = int(eval(input())) except EOFError: break c += 1 for i in range(2, int(n**0.5 + 1)): if n % i == 0: c -= 1 break print(c)
# Prime Numbers ?´???° c = 0 for i in range(int(eval(input()))): n = int(eval(input())) for i in range(2, int(n**0.5 + 1)): if n % i == 0: break else: c += 1 print(c)
false
16.666667
[ "+# Prime Numbers ?´???°", "-while True:", "- try:", "- n = int(eval(input()))", "- except EOFError:", "- break", "- c += 1", "+for i in range(int(eval(input()))):", "+ n = int(eval(input()))", "- c -= 1", "+ else:", "+ c += 1" ]
false
0.048613
0.008677
5.602499
[ "s004459040", "s593840576" ]
u642528832
p02554
python
s497139893
s620281087
573
32
10,652
9,084
Accepted
Accepted
94.42
N = int(eval(input())) mod = 10**9+7 ans = 10**N%mod ans -= 9**N%mod+9**N%mod ans += 8**N%mod ans %= mod print(ans)
N = int(eval(input())) mod = 10**9+7 ans = pow(10,N,mod) ans -= 2*pow(9,N,mod) ans += pow(8,N,mod) ans %= mod print(ans)
7
8
115
122
N = int(eval(input())) mod = 10**9 + 7 ans = 10**N % mod ans -= 9**N % mod + 9**N % mod ans += 8**N % mod ans %= mod print(ans)
N = int(eval(input())) mod = 10**9 + 7 ans = pow(10, N, mod) ans -= 2 * pow(9, N, mod) ans += pow(8, N, mod) ans %= mod print(ans)
false
12.5
[ "-ans = 10**N % mod", "-ans -= 9**N % mod + 9**N % mod", "-ans += 8**N % mod", "+ans = pow(10, N, mod)", "+ans -= 2 * pow(9, N, mod)", "+ans += pow(8, N, mod)" ]
false
0.344164
0.035301
9.74947
[ "s497139893", "s620281087" ]
u392319141
p02720
python
s850780120
s115073706
222
195
17,012
16,616
Accepted
Accepted
12.16
from collections import deque K = int(eval(input())) que = deque(list(map(str, list(range(1, 10))))) while K > 1: n = que.popleft() K -= 1 R = int(n[-1]) for r in (R - 1, R, R + 1): if 0 <= r <= 9: que.append(n + str(r)) print((que[0]))
from collections import deque K = int(eval(input())) que = deque([i for i in range(1, 10)]) ans = [] while len(ans) <= K + 10: now = que.popleft() ans.append(now) b = now % 10 for i in range(max(0, b - 1), min(10, b + 2)): que.append(now * 10 + i) ans.sort() print((ans[K - 1])...
13
16
267
314
from collections import deque K = int(eval(input())) que = deque(list(map(str, list(range(1, 10))))) while K > 1: n = que.popleft() K -= 1 R = int(n[-1]) for r in (R - 1, R, R + 1): if 0 <= r <= 9: que.append(n + str(r)) print((que[0]))
from collections import deque K = int(eval(input())) que = deque([i for i in range(1, 10)]) ans = [] while len(ans) <= K + 10: now = que.popleft() ans.append(now) b = now % 10 for i in range(max(0, b - 1), min(10, b + 2)): que.append(now * 10 + i) ans.sort() print((ans[K - 1]))
false
18.75
[ "-que = deque(list(map(str, list(range(1, 10)))))", "-while K > 1:", "- n = que.popleft()", "- K -= 1", "- R = int(n[-1])", "- for r in (R - 1, R, R + 1):", "- if 0 <= r <= 9:", "- que.append(n + str(r))", "-print((que[0]))", "+que = deque([i for i in range(1, 10)])",...
false
0.054101
0.266122
0.203293
[ "s850780120", "s115073706" ]
u931489673
p02971
python
s660070597
s429269922
564
443
13,320
24,976
Accepted
Accepted
21.45
N=int(eval(input())) A=[int(eval(input())) for n in range(N)] m=max(A) n=sorted(A,reverse=True)[1] for i in range(N): if A[i]<m: print(m) else: print(n)
N=int(eval(input())) A=[int(eval(input())) for n in range(N)] m=max(A) n=sorted(A,reverse=True)[1] print(("\n".join([str(m) if a<m else str(n) for a in A])))
9
5
173
148
N = int(eval(input())) A = [int(eval(input())) for n in range(N)] m = max(A) n = sorted(A, reverse=True)[1] for i in range(N): if A[i] < m: print(m) else: print(n)
N = int(eval(input())) A = [int(eval(input())) for n in range(N)] m = max(A) n = sorted(A, reverse=True)[1] print(("\n".join([str(m) if a < m else str(n) for a in A])))
false
44.444444
[ "-for i in range(N):", "- if A[i] < m:", "- print(m)", "- else:", "- print(n)", "+print((\"\\n\".join([str(m) if a < m else str(n) for a in A])))" ]
false
0.049407
0.007442
6.638738
[ "s660070597", "s429269922" ]
u316386814
p03835
python
s158443580
s081383256
1,714
19
3,060
3,060
Accepted
Accepted
98.89
import itertools k, s = list(map(int, input().split())) count = 0 for x, y in itertools.product(list(range(k + 1)), repeat = 2): if x + y <= s <= x + y + k: count += 1 print(count)
import itertools k, s = list(map(int, input().split())) count = 0 for x in range(max(0, s - 2 * k), min(k + 1, s + 1)): count += min(s - x, 2 * k - (s - x)) + 1 print(count)
10
9
199
189
import itertools k, s = list(map(int, input().split())) count = 0 for x, y in itertools.product(list(range(k + 1)), repeat=2): if x + y <= s <= x + y + k: count += 1 print(count)
import itertools k, s = list(map(int, input().split())) count = 0 for x in range(max(0, s - 2 * k), min(k + 1, s + 1)): count += min(s - x, 2 * k - (s - x)) + 1 print(count)
false
10
[ "-for x, y in itertools.product(list(range(k + 1)), repeat=2):", "- if x + y <= s <= x + y + k:", "- count += 1", "+for x in range(max(0, s - 2 * k), min(k + 1, s + 1)):", "+ count += min(s - x, 2 * k - (s - x)) + 1" ]
false
0.068919
0.068396
1.007646
[ "s158443580", "s081383256" ]
u525065967
p02594
python
s578862094
s455453707
29
26
9,140
9,140
Accepted
Accepted
10.34
x = int(eval(input())) ans = 'Yes' if x < 30: ans ='No' print(ans)
print(('No' if int(eval(input())) < 30 else 'Yes'))
4
1
64
44
x = int(eval(input())) ans = "Yes" if x < 30: ans = "No" print(ans)
print(("No" if int(eval(input())) < 30 else "Yes"))
false
75
[ "-x = int(eval(input()))", "-ans = \"Yes\"", "-if x < 30:", "- ans = \"No\"", "-print(ans)", "+print((\"No\" if int(eval(input())) < 30 else \"Yes\"))" ]
false
0.043292
0.049069
0.882275
[ "s578862094", "s455453707" ]
u371467115
p03246
python
s827743561
s874583749
143
125
24,896
27,104
Accepted
Accepted
12.59
from collections import defaultdict n = int(eval(input())) A = [int(x) for x in input().split()] even = A[0::2] odd = A[1::2] EC = defaultdict(int) EC[0] = 0 OC = defaultdict(int) OC[0] = 0 for e in even: EC[e] += 1 for o in odd: OC[o] += 1 E = sorted([[v, k] for k, v in list(EC.items())], reverse=True...
n=int(eval(input())) v=list(map(int,input().split())) a=v[0::2] b=v[1::2] c=dict() d=dict() for i in a: if i in c: c[i]+=1 else: c[i]=1 for j in b: if j in d: d[j]+=1 else: d[j]=1 e=sorted([[w,v] for v,w in list(c.items())],reverse=True) f=sorted([[w,v] for v,w in list(d.ite...
23
34
538
719
from collections import defaultdict n = int(eval(input())) A = [int(x) for x in input().split()] even = A[0::2] odd = A[1::2] EC = defaultdict(int) EC[0] = 0 OC = defaultdict(int) OC[0] = 0 for e in even: EC[e] += 1 for o in odd: OC[o] += 1 E = sorted([[v, k] for k, v in list(EC.items())], reverse=True) O = so...
n = int(eval(input())) v = list(map(int, input().split())) a = v[0::2] b = v[1::2] c = dict() d = dict() for i in a: if i in c: c[i] += 1 else: c[i] = 1 for j in b: if j in d: d[j] += 1 else: d[j] = 1 e = sorted([[w, v] for v, w in list(c.items())], reverse=True) f = sort...
false
32.352941
[ "-from collections import defaultdict", "-", "-A = [int(x) for x in input().split()]", "-even = A[0::2]", "-odd = A[1::2]", "-EC = defaultdict(int)", "-EC[0] = 0", "-OC = defaultdict(int)", "-OC[0] = 0", "-for e in even:", "- EC[e] += 1", "-for o in odd:", "- OC[o] += 1", "-E = sorte...
false
0.047438
0.120433
0.393891
[ "s827743561", "s874583749" ]
u287500079
p03937
python
s700281398
s354466458
314
286
64,492
59,664
Accepted
Accepted
8.92
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import asci...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import asci...
43
42
1,363
1,357
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowe...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowe...
false
2.325581
[ "-a = [[1 if i == \"#\" else 0 for i in STR()] for _ in range(h)]", "-s = 0", "-for i in range(h):", "- s += sum(a[i])", "-if s != h + w - 1:", "- print(\"Impossible\")", "- exit()", "+a = [eval(input()) for _ in range(h)]", "-d = [[1, 0], [0, 1]]", "-while y < h - 1 or x < w - 1:", "- ...
false
0.035489
0.037316
0.951042
[ "s700281398", "s354466458" ]
u721316601
p02996
python
s710528650
s305587542
960
791
55,268
33,428
Accepted
Accepted
17.6
from operator import itemgetter N = int(eval(input())) AB = sorted([list(map(int, input().split())) for i in range(N)], key=itemgetter(1)) time = 0 for A, B in AB: if time + A <= B: time += A else: print('No') break else: print('Yes')
from operator import itemgetter N = int(eval(input())) AB = [] for i in range(N): A, B = list(map(int, input().split())) AB.append((A, B)) AB = sorted(AB, key=itemgetter(1)) t = 0 ans = 'Yes' for A, B in AB: if t + A > B: ans = 'No' break else: t += A print(...
15
21
281
312
from operator import itemgetter N = int(eval(input())) AB = sorted([list(map(int, input().split())) for i in range(N)], key=itemgetter(1)) time = 0 for A, B in AB: if time + A <= B: time += A else: print("No") break else: print("Yes")
from operator import itemgetter N = int(eval(input())) AB = [] for i in range(N): A, B = list(map(int, input().split())) AB.append((A, B)) AB = sorted(AB, key=itemgetter(1)) t = 0 ans = "Yes" for A, B in AB: if t + A > B: ans = "No" break else: t += A print(ans)
false
28.571429
[ "-AB = sorted([list(map(int, input().split())) for i in range(N)], key=itemgetter(1))", "-time = 0", "+AB = []", "+for i in range(N):", "+ A, B = list(map(int, input().split()))", "+ AB.append((A, B))", "+AB = sorted(AB, key=itemgetter(1))", "+t = 0", "+ans = \"Yes\"", "- if time + A <= B...
false
0.048543
0.046456
1.04494
[ "s710528650", "s305587542" ]
u535803878
p03165
python
s162516964
s575253323
1,268
812
428,636
425,912
Accepted
Accepted
35.96
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") s = eval(input()) t = eval(input()) def sub(s,t): """共通部分文字列長 """ ls = len(s) lt = len(t) dp = [[0]*(lt+1) for _ in range(ls+1)] ### ...
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") s = eval(input()) t = eval(input()) def sub(s,t): """共通部分文字列長 """ ls = len(s) lt = len(t) dp = [[0]*(lt+1) for _ in range(ls+1)] ### ...
45
43
1,070
1,037
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") s = eval(input()) t = eval(input()) def sub(s, t): """共通部分文字列長""" ls = len(s) lt = len(t) dp = [[0] * (lt + 1) for _ in range(ls + 1)] ### prev = [[Non...
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") s = eval(input()) t = eval(input()) def sub(s, t): """共通部分文字列長""" ls = len(s) lt = len(t) dp = [[0] * (lt + 1) for _ in range(ls + 1)] ### prev = [[Non...
false
4.444444
[ "- vals = [dp[i][j - 1], dp[i - 1][j]]", "- if s[i - 1] == t[j - 1]:", "- vals.append(dp[i - 1][j - 1] + 1)", "- m = max(vals)", "- dp[i][j] = m", "+ if dp[i][j - 1] > dp[i - 1][j]:", "+ v = dp[i][j - 1]", "+ ...
false
0.061581
0.095073
0.647726
[ "s162516964", "s575253323" ]
u375616706
p03294
python
s969446250
s744640955
95
24
3,812
3,812
Accepted
Accepted
74.74
from functools import reduce n = (int)(eval(input())) a = (list)(list(map(int, input().split()))) def calcMod(a, m): return sum([m % v for v in a]) def mul(a, b): return a*b print((calcMod(a, reduce(mul, a)-1)))
from functools import reduce n = (int)(eval(input())) a = (list)(list(map(int, input().split()))) def calcMod(a, m): return sum([m % v for v in a]) def mul(a, b): return a*b #print(calcMod(a, reduce(mul, a)-1)) print((sum(a)-n))
14
15
221
239
from functools import reduce n = (int)(eval(input())) a = (list)(list(map(int, input().split()))) def calcMod(a, m): return sum([m % v for v in a]) def mul(a, b): return a * b print((calcMod(a, reduce(mul, a) - 1)))
from functools import reduce n = (int)(eval(input())) a = (list)(list(map(int, input().split()))) def calcMod(a, m): return sum([m % v for v in a]) def mul(a, b): return a * b # print(calcMod(a, reduce(mul, a)-1)) print((sum(a) - n))
false
6.666667
[ "-print((calcMod(a, reduce(mul, a) - 1)))", "+# print(calcMod(a, reduce(mul, a)-1))", "+print((sum(a) - n))" ]
false
0.040123
0.035145
1.14164
[ "s969446250", "s744640955" ]
u141574039
p03013
python
s620954640
s695709157
447
205
460,788
8,616
Accepted
Accepted
54.14
N,M=list(map(int,input().split())) A=[] B=[True]*(N+1) DP=[0]*(N+1) DP[0]=1 for i in range(M): A.append(int(eval(input()))) for i in range(M): B[A[i]]=False #print(B) for i in range(1,N+1): if B[i]==False: DP[i]=0 else: if i==1: DP[i]=DP[i-1] else: DP[i]=DP[i-1]+DP[i-2...
N,M=list(map(int,input().split())) A=[] B=[True]*(N+1) DP=[0]*(N+1) DP[0]=1 for i in range(M): A.append(int(eval(input()))) for i in range(M): B[A[i]]=False #print(B) for i in range(1,N+1): if B[i]==False: DP[i]=0 else: if i==1: DP[i]=DP[i-1] else: DP[i]=(DP[i-1]+DP[i-...
23
23
369
371
N, M = list(map(int, input().split())) A = [] B = [True] * (N + 1) DP = [0] * (N + 1) DP[0] = 1 for i in range(M): A.append(int(eval(input()))) for i in range(M): B[A[i]] = False # print(B) for i in range(1, N + 1): if B[i] == False: DP[i] = 0 else: if i == 1: DP[i] = DP[i - ...
N, M = list(map(int, input().split())) A = [] B = [True] * (N + 1) DP = [0] * (N + 1) DP[0] = 1 for i in range(M): A.append(int(eval(input()))) for i in range(M): B[A[i]] = False # print(B) for i in range(1, N + 1): if B[i] == False: DP[i] = 0 else: if i == 1: DP[i] = DP[i - ...
false
0
[ "- DP[i] = DP[i - 1] + DP[i - 2]", "+ DP[i] = (DP[i - 1] + DP[i - 2]) % 1000000007", "- print((DP[N] % 1000000007))", "+ print((DP[N]))" ]
false
0.044741
0.064154
0.697404
[ "s620954640", "s695709157" ]
u146803137
p03146
python
s341959370
s298138064
34
29
10,996
9,128
Accepted
Accepted
14.71
import math def py(): print("Yes") def pn(): print("No") def iin(): x = int(eval(input())) return x neko = 0 nya = 0 nuko = 0 b = iin() f = [0] * 1000001 i = 1 while True: if f[int(b)] == 0: f[int(b)] = i else: break b = 3 * b + 1 if b%2 else b/2 ...
def f(x): if x%2: return 3*x + 1 else: return x/2 s = int(eval(input())) a = [s] for i in range(1,10**6+2): if f(a[i-1]) in a: print((i+1)) break a.append(f(a[i-1]))
24
12
333
217
import math def py(): print("Yes") def pn(): print("No") def iin(): x = int(eval(input())) return x neko = 0 nya = 0 nuko = 0 b = iin() f = [0] * 1000001 i = 1 while True: if f[int(b)] == 0: f[int(b)] = i else: break b = 3 * b + 1 if b % 2 else b / 2 i = i + 1 pri...
def f(x): if x % 2: return 3 * x + 1 else: return x / 2 s = int(eval(input())) a = [s] for i in range(1, 10**6 + 2): if f(a[i - 1]) in a: print((i + 1)) break a.append(f(a[i - 1]))
false
50
[ "-import math", "+def f(x):", "+ if x % 2:", "+ return 3 * x + 1", "+ else:", "+ return x / 2", "-def py():", "- print(\"Yes\")", "-", "-", "-def pn():", "- print(\"No\")", "-", "-", "-def iin():", "- x = int(eval(input()))", "- return x", "-", "-"...
false
0.3028
0.036901
8.20579
[ "s341959370", "s298138064" ]
u816631826
p03012
python
s842243320
s916675607
20
17
3,064
2,940
Accepted
Accepted
15
def sum(lista: list): soma = 0 for l in lista: soma = soma + l return soma n = int(eval(input())) x = [] line = eval(input()) for _ in range(n): x = [int(t) for t in line.split()] sum1 = [] sum2 = [] diff = [] for i in range(1, n): sum1 = sum(x[0:i]) sum2 = sum(x[i:]...
n = int(eval(input())) w = [int(x) for x in input().split()] balance = [] for i in range(1, n): balance.append(abs(sum(w[:i]) - sum(w[i:]))) print((min(balance)))
22
6
371
164
def sum(lista: list): soma = 0 for l in lista: soma = soma + l return soma n = int(eval(input())) x = [] line = eval(input()) for _ in range(n): x = [int(t) for t in line.split()] sum1 = [] sum2 = [] diff = [] for i in range(1, n): sum1 = sum(x[0:i]) sum2 = sum(x[i:]) diff.append(a...
n = int(eval(input())) w = [int(x) for x in input().split()] balance = [] for i in range(1, n): balance.append(abs(sum(w[:i]) - sum(w[i:]))) print((min(balance)))
false
72.727273
[ "-def sum(lista: list):", "- soma = 0", "- for l in lista:", "- soma = soma + l", "- return soma", "-", "-", "-x = []", "-line = eval(input())", "-for _ in range(n):", "- x = [int(t) for t in line.split()]", "-sum1 = []", "-sum2 = []", "-diff = []", "+w = [int(x) for x...
false
0.05013
0.05031
0.996434
[ "s842243320", "s916675607" ]
u940139461
p02972
python
s433432208
s952361749
825
352
14,132
75,100
Accepted
Accepted
57.33
n = int(eval(input())) nums = [int(i) for i in input().split()] box = [-1] * n for i in range(1, n + 1)[::-1]: c = i * 2 ball = nums[i - 1] while c <= n: ball = ball ^ box[c - 1] c += i box[i - 1] = ball ans = box.count(1) print(ans) ball = [] for i in range(n): if bo...
n = int(eval(input())) nums = [int(i) for i in input().split()] box = [0] * n for i in range(1, n + 1)[::-1]: c = i * 2 ball = nums[i - 1] while c <= n: ball = ball ^ box[c - 1] c += i box[i - 1] = ball ans = box.count(1) print(ans) ball = [] for i in range(n): if box...
18
18
367
366
n = int(eval(input())) nums = [int(i) for i in input().split()] box = [-1] * n for i in range(1, n + 1)[::-1]: c = i * 2 ball = nums[i - 1] while c <= n: ball = ball ^ box[c - 1] c += i box[i - 1] = ball ans = box.count(1) print(ans) ball = [] for i in range(n): if box[i] == 1: ...
n = int(eval(input())) nums = [int(i) for i in input().split()] box = [0] * n for i in range(1, n + 1)[::-1]: c = i * 2 ball = nums[i - 1] while c <= n: ball = ball ^ box[c - 1] c += i box[i - 1] = ball ans = box.count(1) print(ans) ball = [] for i in range(n): if box[i] == 1: ...
false
0
[ "-box = [-1] * n", "+box = [0] * n" ]
false
0.066678
0.056676
1.176459
[ "s433432208", "s952361749" ]
u777283665
p02922
python
s987020296
s076224596
172
17
38,384
2,940
Accepted
Accepted
90.12
a, b = list(map(int, input().split())) num = 1 ans = 0 if b == 1: print((0)) exit() while True: num += a - 1 ans += 1 if num >= b: break print(ans)
a, b = list(map(int, input().split())) ans = 0 cnt = 1 while cnt < b: cnt += a - 1 ans += 1 print(ans)
16
10
186
116
a, b = list(map(int, input().split())) num = 1 ans = 0 if b == 1: print((0)) exit() while True: num += a - 1 ans += 1 if num >= b: break print(ans)
a, b = list(map(int, input().split())) ans = 0 cnt = 1 while cnt < b: cnt += a - 1 ans += 1 print(ans)
false
37.5
[ "-num = 1", "-if b == 1:", "- print((0))", "- exit()", "-while True:", "- num += a - 1", "+cnt = 1", "+while cnt < b:", "+ cnt += a - 1", "- if num >= b:", "- break" ]
false
0.042663
0.036729
1.161574
[ "s987020296", "s076224596" ]
u047796752
p02901
python
s066275869
s412670344
102
91
75,240
74,248
Accepted
Accepted
10.78
import sys input = sys.stdin.readline from collections import * N, M = list(map(int, input().split())) v = [] t = [] for _ in range(M): a, b = list(map(int, input().split())) c = list(map(int, input().split())) v.append(a) ti = 0 for i in range(b): ti += 1<<(c[i]-1) ...
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) ks = [] for _ in range(M): a, b = list(map(int, input().split())) c = list(map(int, input().split())) T = 0 for ci in c: T += 1<<(ci-1) ks.append((a, T)) dp = [10**18]*(1<<N) dp[0] = 0 ...
30
27
525
457
import sys input = sys.stdin.readline from collections import * N, M = list(map(int, input().split())) v = [] t = [] for _ in range(M): a, b = list(map(int, input().split())) c = list(map(int, input().split())) v.append(a) ti = 0 for i in range(b): ti += 1 << (c[i] - 1) t.append(ti) dp...
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) ks = [] for _ in range(M): a, b = list(map(int, input().split())) c = list(map(int, input().split())) T = 0 for ci in c: T += 1 << (ci - 1) ks.append((a, T)) dp = [10**18] * (1 << N) dp[0] = 0 for S in range(1 << N...
false
10
[ "-from collections import *", "-", "-v = []", "-t = []", "+ks = []", "- v.append(a)", "- ti = 0", "- for i in range(b):", "- ti += 1 << (c[i] - 1)", "- t.append(ti)", "+ T = 0", "+ for ci in c:", "+ T += 1 << (ci - 1)", "+ ks.append((a, T))", "- for ...
false
0.037364
0.038259
0.976597
[ "s066275869", "s412670344" ]
u794544096
p02790
python
s511038130
s472484364
166
63
38,256
61,836
Accepted
Accepted
62.05
a, b = list(map(int, input().split())) a_l = [] b_l = [] for i in range(a): a_l += str(b) for i in range(b): b_l += str(a) a_l = ''.join(a_l) b_l = ''.join(b_l) all = [] all.append(a_l) all.append(b_l) all.sort() print((all[0]))
a, b = list(map(int, input().split())) list_a = [] list_b = [] for i in range(a): list_a.append(str(b)) for i in range(b): list_b.append(str(a)) A = ''.join(list_a) B = ''.join(list_b) if a >= b: print(A) else: print(B)
19
17
263
253
a, b = list(map(int, input().split())) a_l = [] b_l = [] for i in range(a): a_l += str(b) for i in range(b): b_l += str(a) a_l = "".join(a_l) b_l = "".join(b_l) all = [] all.append(a_l) all.append(b_l) all.sort() print((all[0]))
a, b = list(map(int, input().split())) list_a = [] list_b = [] for i in range(a): list_a.append(str(b)) for i in range(b): list_b.append(str(a)) A = "".join(list_a) B = "".join(list_b) if a >= b: print(A) else: print(B)
false
10.526316
[ "-a_l = []", "-b_l = []", "+list_a = []", "+list_b = []", "- a_l += str(b)", "+ list_a.append(str(b))", "- b_l += str(a)", "-a_l = \"\".join(a_l)", "-b_l = \"\".join(b_l)", "-all = []", "-all.append(a_l)", "-all.append(b_l)", "-all.sort()", "-print((all[0]))", "+ list_b.appen...
false
0.036987
0.041935
0.882006
[ "s511038130", "s472484364" ]
u707808519
p02681
python
s346112189
s371644163
23
21
9,072
9,044
Accepted
Accepted
8.7
S = eval(input()) T = eval(input()) alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] ans = 'No' for i in range(len(alp)): if S + alp[i] == T: ans = 'Yes' break print(ans)
S = eval(input()) T = eval(input()) if S == T[:-1]: print('Yes') else: print('No')
9
6
249
83
S = eval(input()) T = eval(input()) alp = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", ] ans = "No" for i in range(len(alp)): ...
S = eval(input()) T = eval(input()) if S == T[:-1]: print("Yes") else: print("No")
false
33.333333
[ "-alp = [", "- \"a\",", "- \"b\",", "- \"c\",", "- \"d\",", "- \"e\",", "- \"f\",", "- \"g\",", "- \"h\",", "- \"i\",", "- \"j\",", "- \"k\",", "- \"l\",", "- \"m\",", "- \"n\",", "- \"o\",", "- \"p\",", "- \"q\",", "- \"r\","...
false
0.035647
0.03634
0.980917
[ "s346112189", "s371644163" ]
u143492911
p03361
python
s057643206
s174488643
24
22
3,064
3,064
Accepted
Accepted
8.33
h,w=list(map(int,input().split())) s=[list(eval(input()))for i in range(h)] dx=[1,-1,0,0] dy=[0,0,1,-1] for i in range(h): for j in range(w): if s[i][j]=="#": judge=False for k in range(4): x=i+dx[k] y=j+dy[k] if 0<=x and x<h...
h,w=list(map(int,input().split())) t=[list(eval(input()))for i in range(h)] def check(x,y): dx=[0,0,1,-1] dy=[1,-1,0,0] jugde=False for k in range(4): i=x+dx[k] j=y+dy[k] if 0<=i and i<h and 0<=j and j<w and t[i][j]=="#": jugde=True if jugde==False: ...
19
23
505
556
h, w = list(map(int, input().split())) s = [list(eval(input())) for i in range(h)] dx = [1, -1, 0, 0] dy = [0, 0, 1, -1] for i in range(h): for j in range(w): if s[i][j] == "#": judge = False for k in range(4): x = i + dx[k] y = j + dy[k] ...
h, w = list(map(int, input().split())) t = [list(eval(input())) for i in range(h)] def check(x, y): dx = [0, 0, 1, -1] dy = [1, -1, 0, 0] jugde = False for k in range(4): i = x + dx[k] j = y + dy[k] if 0 <= i and i < h and 0 <= j and j < w and t[i][j] == "#": jugde ...
false
17.391304
[ "-s = [list(eval(input())) for i in range(h)]", "-dx = [1, -1, 0, 0]", "-dy = [0, 0, 1, -1]", "+t = [list(eval(input())) for i in range(h)]", "+", "+", "+def check(x, y):", "+ dx = [0, 0, 1, -1]", "+ dy = [1, -1, 0, 0]", "+ jugde = False", "+ for k in range(4):", "+ i = x + ...
false
0.044656
0.049546
0.901314
[ "s057643206", "s174488643" ]
u307159845
p03285
python
s891152542
s543591043
19
17
2,940
2,940
Accepted
Accepted
10.53
import math N = int(eval(input())) flag = False for i in range(100): for j in range(100): if flag == True: continue #print(N - i * 7 - j * 4 ) if N - i * 7 - j * 4 == 0: flag = True if flag == True: print('Yes') else: print('No')
import math N = int(eval(input())) flag = False for i in range(math.ceil(N/7)+1): for j in range(math.ceil(N/4)+1): if flag == True: continue #print(N - i * 7 - j * 4 ) if N - i * 7 - j * 4 == 0: flag = True if flag == True: print('Yes') else: ...
17
17
303
329
import math N = int(eval(input())) flag = False for i in range(100): for j in range(100): if flag == True: continue # print(N - i * 7 - j * 4 ) if N - i * 7 - j * 4 == 0: flag = True if flag == True: print("Yes") else: print("No")
import math N = int(eval(input())) flag = False for i in range(math.ceil(N / 7) + 1): for j in range(math.ceil(N / 4) + 1): if flag == True: continue # print(N - i * 7 - j * 4 ) if N - i * 7 - j * 4 == 0: flag = True if flag == True: print("Yes") else: print(...
false
0
[ "-for i in range(100):", "- for j in range(100):", "+for i in range(math.ceil(N / 7) + 1):", "+ for j in range(math.ceil(N / 4) + 1):" ]
false
0.04301
0.044034
0.976755
[ "s891152542", "s543591043" ]
u021019433
p02642
python
s536242029
s188146912
208
160
98,156
100,752
Accepted
Accepted
23.08
N = 1000001 a = [0]* N _, s = open(0) for x in s.split(): a[int(x)] += 1 for i in range(1, N): for j in range(i + i, N, i): if a[i]: a[j] = 0 print((a.count(1)))
N = 1000001 a = [0]* N _, s = open(0) for x in s.split(): a[int(x)] += 1 for i in range(1, N): if a[i]: for j in range(i + i, N, i): a[j] = 0 print((a.count(1)))
10
10
183
183
N = 1000001 a = [0] * N _, s = open(0) for x in s.split(): a[int(x)] += 1 for i in range(1, N): for j in range(i + i, N, i): if a[i]: a[j] = 0 print((a.count(1)))
N = 1000001 a = [0] * N _, s = open(0) for x in s.split(): a[int(x)] += 1 for i in range(1, N): if a[i]: for j in range(i + i, N, i): a[j] = 0 print((a.count(1)))
false
0
[ "- for j in range(i + i, N, i):", "- if a[i]:", "+ if a[i]:", "+ for j in range(i + i, N, i):" ]
false
3.220693
1.243737
2.589529
[ "s536242029", "s188146912" ]
u197615397
p00741
python
s597605237
s615218953
110
50
5,800
6,032
Accepted
Accepted
54.55
from itertools import product while True: w, h = list(map(int, input().split())) if w == 0: break a = [[0]*(w+2)] + [[0]+list(map(int, input().split()))+[0] for _ in [0]*h] + [[0]*(w+2)] visited = [[0]*(w+2) for _ in [0]*(h+2)] ans = 0 for y in range(1, h+1): for x in ra...
def solve(): from collections import deque while True: w, h = [int(x)+2 for x in input().split()] if w == 2: break result = 0 a = ['0']*w for _ in [0]*(h-2): a += ['0'] + input().split() + ['0'] a += ['0']*w for...
24
31
848
800
from itertools import product while True: w, h = list(map(int, input().split())) if w == 0: break a = ( [[0] * (w + 2)] + [[0] + list(map(int, input().split())) + [0] for _ in [0] * h] + [[0] * (w + 2)] ) visited = [[0] * (w + 2) for _ in [0] * (h + 2)] ans = 0 ...
def solve(): from collections import deque while True: w, h = [int(x) + 2 for x in input().split()] if w == 2: break result = 0 a = ["0"] * w for _ in [0] * (h - 2): a += ["0"] + input().split() + ["0"] a += ["0"] * w for i in rang...
false
22.580645
[ "-from itertools import product", "+def solve():", "+ from collections import deque", "-while True:", "- w, h = list(map(int, input().split()))", "- if w == 0:", "- break", "- a = (", "- [[0] * (w + 2)]", "- + [[0] + list(map(int, input().split())) + [0] for _ in [...
false
0.04754
0.045481
1.045281
[ "s597605237", "s615218953" ]
u762533651
p02779
python
s205053691
s323803828
417
139
126,604
113,740
Accepted
Accepted
66.67
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) re = 0 c = Counter(a) new = list(c.values()) for i in new: if i > 1: re += 1 if re > 0: print("NO") else: print("YES")
n = int(eval(input())) a = list(map(int, input().split())) re = 0 from collections import Counter c = Counter(a) for i, v in list(c.items()): if v >= 2: re += 1 if re >= 1: print("NO") else: print("YES")
17
16
238
225
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) re = 0 c = Counter(a) new = list(c.values()) for i in new: if i > 1: re += 1 if re > 0: print("NO") else: print("YES")
n = int(eval(input())) a = list(map(int, input().split())) re = 0 from collections import Counter c = Counter(a) for i, v in list(c.items()): if v >= 2: re += 1 if re >= 1: print("NO") else: print("YES")
false
5.882353
[ "-from collections import Counter", "-", "+from collections import Counter", "+", "-new = list(c.values())", "-for i in new:", "- if i > 1:", "+for i, v in list(c.items()):", "+ if v >= 2:", "-if re > 0:", "+if re >= 1:" ]
false
0.035121
0.031649
1.109705
[ "s205053691", "s323803828" ]
u707960254
p02995
python
s457753301
s912204705
38
17
5,344
3,064
Accepted
Accepted
55.26
from fractions import gcd A, B, C, D = list(map(int, input().split())) l = C * D // gcd(C, D) x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l y = B - B // C - B // D + B // l print((y - x))
a, b, c, d = list(map(int, input().split())) #a,bの最大公約数 def gcd(a, b): while b: a, b = b, a % b return a #a,bの最小公倍数 def lcm(a, b): return a * b // gcd (a, b) def multiple_counting(range, a, b): return (range -range//a -range//b +range//lcm(a,b)) def main(): print((multipl...
7
26
197
608
from fractions import gcd A, B, C, D = list(map(int, input().split())) l = C * D // gcd(C, D) x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l y = B - B // C - B // D + B // l print((y - x))
a, b, c, d = list(map(int, input().split())) # a,bの最大公約数 def gcd(a, b): while b: a, b = b, a % b return a # a,bの最小公倍数 def lcm(a, b): return a * b // gcd(a, b) def multiple_counting(range, a, b): return range - range // a - range // b + range // lcm(a, b) def main(): print((multiple_cou...
false
73.076923
[ "-from fractions import gcd", "+a, b, c, d = list(map(int, input().split()))", "+# a,bの最大公約数", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "-A, B, C, D = list(map(int, input().split()))", "-l = C * D // gcd(C, D)", "-x = (A - 1) - (A - 1) // C - (A - 1) // D + ...
false
0.045854
0.05621
0.815762
[ "s457753301", "s912204705" ]
u124498235
p03474
python
s084188909
s924280687
19
17
3,188
2,940
Accepted
Accepted
10.53
import re a, b = list(map(int, input().split())) s = eval(input()) if re.search('\d+',s[:a]) and s[a] == "-" and re.search('\d+',s[a+1:]): print ("Yes") else: print ("No")
a, b = list(map(int, input().split())) s = eval(input()) if "-" not in s[:a] and s[a] == "-" and "-" not in s[a+1:]: print ("Yes") else: print ("No")
7
6
168
144
import re a, b = list(map(int, input().split())) s = eval(input()) if re.search("\d+", s[:a]) and s[a] == "-" and re.search("\d+", s[a + 1 :]): print("Yes") else: print("No")
a, b = list(map(int, input().split())) s = eval(input()) if "-" not in s[:a] and s[a] == "-" and "-" not in s[a + 1 :]: print("Yes") else: print("No")
false
14.285714
[ "-import re", "-", "-if re.search(\"\\d+\", s[:a]) and s[a] == \"-\" and re.search(\"\\d+\", s[a + 1 :]):", "+if \"-\" not in s[:a] and s[a] == \"-\" and \"-\" not in s[a + 1 :]:" ]
false
0.114292
0.04321
2.645027
[ "s084188909", "s924280687" ]
u072717685
p02624
python
s176144406
s132475463
1,223
570
9,148
108,920
Accepted
Accepted
53.39
import sys read = sys.stdin.read readlines = sys.stdin.readlines def main(): n = int(eval(input())) if n == 1: print((1)) sys.exit() r = 0 for i1 in range(1, n + 1): y = n // i1 r += y * (y + 1) // 2 * i1 print(r) if __name__ == '__main__': main(...
import sys read = sys.stdin.read readlines = sys.stdin.readlines import numba def main(): @numba.njit def solve(n): r = 0 for i1 in range(1, n + 1): y = n // i1 r += y * (y + 1) // 2 * i1 return r no = int(eval(input())) print((solve(no))) ...
17
18
313
352
import sys read = sys.stdin.read readlines = sys.stdin.readlines def main(): n = int(eval(input())) if n == 1: print((1)) sys.exit() r = 0 for i1 in range(1, n + 1): y = n // i1 r += y * (y + 1) // 2 * i1 print(r) if __name__ == "__main__": main()
import sys read = sys.stdin.read readlines = sys.stdin.readlines import numba def main(): @numba.njit def solve(n): r = 0 for i1 in range(1, n + 1): y = n // i1 r += y * (y + 1) // 2 * i1 return r no = int(eval(input())) print((solve(no))) if __name_...
false
5.555556
[ "+import numba", "- n = int(eval(input()))", "- if n == 1:", "- print((1))", "- sys.exit()", "- r = 0", "- for i1 in range(1, n + 1):", "- y = n // i1", "- r += y * (y + 1) // 2 * i1", "- print(r)", "+ @numba.njit", "+ def solve(n):", "+ ...
false
0.555628
0.102952
5.396947
[ "s176144406", "s132475463" ]
u952708174
p03762
python
s685182187
s622433853
132
109
19,472
19,648
Accepted
Accepted
17.42
def d_igeta(N, M, X, Y): tmp1 = 0 tmp2 = 0 for k, x in enumerate(X): k += 1 tmp1 += (k - 1) * x - (N - k) * x for k, y in enumerate(Y): k += 1 tmp2 += (k - 1) * y - (M - k) * y return (tmp1 * tmp2) % (10**9 + 7) N,M = [int(i) for i in input().split()] X =...
def d_rectangles(MOD=10**9 + 7): N, M = [int(i) for i in input().split()] X = [int(i) for i in input().split()] Y = [int(i) for i in input().split()] ans1 = sum([x * (2 * k - N - 1) for k, x in enumerate(X, 1)]) ans2 = sum([y * (2 * k - M - 1) for k, y in enumerate(Y, 1)]) return (ans1 *...
15
10
421
357
def d_igeta(N, M, X, Y): tmp1 = 0 tmp2 = 0 for k, x in enumerate(X): k += 1 tmp1 += (k - 1) * x - (N - k) * x for k, y in enumerate(Y): k += 1 tmp2 += (k - 1) * y - (M - k) * y return (tmp1 * tmp2) % (10**9 + 7) N, M = [int(i) for i in input().split()] X = [int(i) f...
def d_rectangles(MOD=10**9 + 7): N, M = [int(i) for i in input().split()] X = [int(i) for i in input().split()] Y = [int(i) for i in input().split()] ans1 = sum([x * (2 * k - N - 1) for k, x in enumerate(X, 1)]) ans2 = sum([y * (2 * k - M - 1) for k, y in enumerate(Y, 1)]) return (ans1 * ans2) %...
false
33.333333
[ "-def d_igeta(N, M, X, Y):", "- tmp1 = 0", "- tmp2 = 0", "- for k, x in enumerate(X):", "- k += 1", "- tmp1 += (k - 1) * x - (N - k) * x", "- for k, y in enumerate(Y):", "- k += 1", "- tmp2 += (k - 1) * y - (M - k) * y", "- return (tmp1 * tmp2) % (10**9 +...
false
0.076598
0.044242
1.731325
[ "s685182187", "s622433853" ]
u535423069
p03698
python
s526499128
s460388110
21
18
3,316
3,064
Accepted
Accepted
14.29
# Author: cr4zjh0bp # Created: Sun Mar 22 23:25:40 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf ...
# Author: cr4zjh0bp # Created: Sun Mar 22 23:25:40 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf ...
26
23
791
745
# Author: cr4zjh0bp # Created: Sun Mar 22 23:25:40 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y:...
# Author: cr4zjh0bp # Created: Sun Mar 22 23:25:40 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y:...
false
11.538462
[ "-from collections import Counter", "-", "-c = Counter(s)", "-print((\"yes\" if len(s) == len(c) else \"no\"))", "+print((\"yes\" if len(s) == len(set(s)) else \"no\"))" ]
false
0.045535
0.047774
0.953138
[ "s526499128", "s460388110" ]
u102461423
p03983
python
s069225198
s636989547
949
534
120,220
39,516
Accepted
Accepted
43.73
import sys import numpy as np import numba from numba import njit i8 = numba.int64 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 @njit((i8, ), cache=True) def precompute(M): # 残り M 秒あるとする。 # dp1:人数 # dp2:生産開始時刻の総和 ...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 def precompute(M): # 残り M 秒あるとする。 # dp1:人数 # dp2:生産開始時刻の総和 g = M + 10 dp1 = np.ones(M, np.int64) dp2 = np.zeros(M, np.int64) ...
45
56
1,106
1,376
import sys import numpy as np import numba from numba import njit i8 = numba.int64 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 @njit((i8,), cache=True) def precompute(M): # 残り M 秒あるとする。 # dp1:人数 # dp2:生産開始時刻の総和 g = M + 10 ...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 def precompute(M): # 残り M 秒あるとする。 # dp1:人数 # dp2:生産開始時刻の総和 g = M + 10 dp1 = np.ones(M, np.int64) dp2 = np.zeros(M, np.int64) while g * (g ...
false
19.642857
[ "-import numba", "-from numba import njit", "-i8 = numba.int64", "-@njit((i8,), cache=True)", "-@njit((i8[:],), cache=True)", "+if sys.argv[-1] == \"ONLINE_JUDGE\":", "+ import numba", "+ from numba.pycc import CC", "+", "+ i8 = numba.int64", "+ cc = CC(\"my_module\")", "+", "+ ...
false
0.383224
0.185511
2.065783
[ "s069225198", "s636989547" ]
u332385682
p03806
python
s753682773
s170772492
1,016
213
42,348
40,560
Accepted
Accepted
79.04
import sys def solve(): N, Ma, Mb = map(int, input().split()) table = [tuple(map(int, input().split())) for i in range(N)] g1 = half_rekkyo(N, Ma, Mb, table, 0, N // 2) g2 = half_rekkyo(N, Ma, Mb, table, N // 2, N - N // 2) inf = 100 * 40 + 1 ans = inf if 0 in g1: an...
def solve(): N, Ma, Mb = list(map(int, input().split())) a, b, c = [], [], [] for i in range(N): ai, bi, ci = list(map(int, input().split())) a.append(ai) b.append(bi) c.append(ci) alim = sum(a) blim = sum(b) inf = 40 * 100 + 1 dp = [[inf]*(...
56
37
1,226
835
import sys def solve(): N, Ma, Mb = map(int, input().split()) table = [tuple(map(int, input().split())) for i in range(N)] g1 = half_rekkyo(N, Ma, Mb, table, 0, N // 2) g2 = half_rekkyo(N, Ma, Mb, table, N // 2, N - N // 2) inf = 100 * 40 + 1 ans = inf if 0 in g1: ans = min(ans, g1...
def solve(): N, Ma, Mb = list(map(int, input().split())) a, b, c = [], [], [] for i in range(N): ai, bi, ci = list(map(int, input().split())) a.append(ai) b.append(bi) c.append(ci) alim = sum(a) blim = sum(b) inf = 40 * 100 + 1 dp = [[inf] * (blim + 1) for i i...
false
33.928571
[ "-import sys", "-", "-", "- N, Ma, Mb = map(int, input().split())", "- table = [tuple(map(int, input().split())) for i in range(N)]", "- g1 = half_rekkyo(N, Ma, Mb, table, 0, N // 2)", "- g2 = half_rekkyo(N, Ma, Mb, table, N // 2, N - N // 2)", "- inf = 100 * 40 + 1", "+ N, Ma, Mb ...
false
0.035767
0.034775
1.028545
[ "s753682773", "s170772492" ]
u860002137
p02727
python
s620557308
s957524498
442
313
23,456
29,568
Accepted
Accepted
29.19
from heapq import heapify, heappop, heappush x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) r = [-x for x in r] p.sort() q.sort() r.sort() p = p[-x:] q = q[-y:] heapify(p) heapify(q) heapi...
from heapq import heapify, heappop, heappush x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) r = [-x for x in r] p.sort() q.sort() r.sort() p = p[-x:] q = q[-y:] heapify(p) heapify(q) heapi...
46
41
849
715
from heapq import heapify, heappop, heappush x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) r = [-x for x in r] p.sort() q.sort() r.sort() p = p[-x:] q = q[-y:] heapify(p) heapify(q) heapify(r) is_p = True is_q...
from heapq import heapify, heappop, heappush x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) r = [-x for x in r] p.sort() q.sort() r.sort() p = p[-x:] q = q[-y:] heapify(p) heapify(q) heapify(r) while r: pp ...
false
10.869565
[ "-is_p = True", "-is_q = True", "-while is_p and is_q and r:", "+while r:", "- if pp <= qq:", "+ rr *= -1", "+ if pp >= rr and qq >= rr:", "+ heappush(p, pp)", "- if pp < -rr:", "- heappush(p, -rr)", "- else:", "- is_p = False", "- ...
false
0.036725
0.036154
1.015784
[ "s620557308", "s957524498" ]
u059210959
p02642
python
s163248843
s918279348
957
702
174,652
45,976
Accepted
Accepted
26.65
# encoding:utf-8 import copy import random import bisect #bisect_left これで二部探索の大小検索が行える import fractions #最小公倍数などはこっち import math import sys import collections mod = 10**9+7 sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000 d = collections.deque() def LI(): return list(map(int, sys.stdin.readline().split...
# encoding:utf-8 import copy import random import bisect #bisect_left これで二部探索の大小検索が行える import fractions #最小公倍数などはこっち import math import sys import collections mod = 10**9+7 sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000 d = collections.deque() def LI(): return list(map(int, sys.stdin.readline().split()...
47
37
835
681
# encoding:utf-8 import copy import random import bisect # bisect_left これで二部探索の大小検索が行える import fractions # 最小公倍数などはこっち import math import sys import collections mod = 10**9 + 7 sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000 d = collections.deque() def LI(): return list(map(int, sys.stdin.readline().split())...
# encoding:utf-8 import copy import random import bisect # bisect_left これで二部探索の大小検索が行える import fractions # 最小公倍数などはこっち import math import sys import collections mod = 10**9 + 7 sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000 d = collections.deque() def LI(): return list(map(int, sys.stdin.readline().split())...
false
21.276596
[ "-\"\"\"", "-3", "-1 1 2", "-のパターンが例外だった", "-\"\"\"", "-table = [0 for i in range(10**6 + 1)]", "+table = [0 for i in range(10**6 + 1)] # 約数のテーブル", "+cc = collections.Counter(A)", "-cc = collections.Counter(A)", "-duplicate = []", "-for key in list(cc.keys()):", "- if cc[key] > 1:", "- ...
false
0.316065
0.296749
1.065092
[ "s163248843", "s918279348" ]
u425762225
p02971
python
s596779074
s172523637
503
347
14,124
25,252
Accepted
Accepted
31.01
N = int(eval(input())) a = [int(eval(input())) for _ in range(N)] first = max(a) f_id = a.index(max(a)) second = max(a[:f_id] + a[f_id+1:]) for i in range(N): if a[i] == first: print(second) else: print(first)
from collections import Counter N = int(input()) a = [int(input()) for _ in range(N)] def solve(n,a): d = Counter(a) if len(d) == 1: return a d_lst = list(sorted(d.keys())) first = d_lst[-1] second = d_lst[-2] if d[first] != 1: return [first]*n else: # first は一つだけ return [seco...
12
18
224
401
N = int(eval(input())) a = [int(eval(input())) for _ in range(N)] first = max(a) f_id = a.index(max(a)) second = max(a[:f_id] + a[f_id + 1 :]) for i in range(N): if a[i] == first: print(second) else: print(first)
from collections import Counter N = int(input()) a = [int(input()) for _ in range(N)] def solve(n, a): d = Counter(a) if len(d) == 1: return a d_lst = list(sorted(d.keys())) first = d_lst[-1] second = d_lst[-2] if d[first] != 1: return [first] * n else: # first は一つだけ ...
false
33.333333
[ "-N = int(eval(input()))", "-a = [int(eval(input())) for _ in range(N)]", "-first = max(a)", "-f_id = a.index(max(a))", "-second = max(a[:f_id] + a[f_id + 1 :])", "-for i in range(N):", "- if a[i] == first:", "- print(second)", "- else:", "- print(first)", "+from collections ...
false
0.04638
0.07595
0.610669
[ "s596779074", "s172523637" ]
u729133443
p03222
python
s046054620
s851904498
22
20
3,064
3,064
Accepted
Accepted
9.09
h,w,k=list(map(int,input().split()));p=[sum(('11'in str(bin(j)))^1for j in range(1<<i))for i in range(8)];d=[w*[0]for _ in[0]*-~h];d[0][0]=1 for i in range(h): b=d[i] for j in range(w): t=u=D=0 if j:t=p[max(0,j-2)]*p[max(0,w-j-2)];D=b[j-1]*t if j<w-1:u=p[max(0,j-1)]*p[max(0,w-j-3)];D+=b[j+1]*u d[i+1][j...
h,w,k=list(map(int,input().split())) p=[sum(('11'in str(bin(j)))^1for j in range(1<<i))for i in range(8)] dp=[w*[0]for _ in[0]*-~h] dp[0][0]=1 for i in range(1,h+1): for j in range(w): t=u=0 if j: t=p[max(0,j-2)]*p[max(0,w-j-2)] dp[i][j]+=dp[i-1][j-1]*t if j...
9
15
366
485
h, w, k = list(map(int, input().split())) p = [sum(("11" in str(bin(j))) ^ 1 for j in range(1 << i)) for i in range(8)] d = [w * [0] for _ in [0] * -~h] d[0][0] = 1 for i in range(h): b = d[i] for j in range(w): t = u = D = 0 if j: t = p[max(0, j - 2)] * p[max(0, w - j - 2)] ...
h, w, k = list(map(int, input().split())) p = [sum(("11" in str(bin(j))) ^ 1 for j in range(1 << i)) for i in range(8)] dp = [w * [0] for _ in [0] * -~h] dp[0][0] = 1 for i in range(1, h + 1): for j in range(w): t = u = 0 if j: t = p[max(0, j - 2)] * p[max(0, w - j - 2)] dp[i...
false
40
[ "-d = [w * [0] for _ in [0] * -~h]", "-d[0][0] = 1", "-for i in range(h):", "- b = d[i]", "+dp = [w * [0] for _ in [0] * -~h]", "+dp[0][0] = 1", "+for i in range(1, h + 1):", "- t = u = D = 0", "+ t = u = 0", "- D = b[j - 1] * t", "+ dp[i][j] += dp[i - 1][j...
false
0.039004
0.038891
1.00292
[ "s046054620", "s851904498" ]
u753803401
p03386
python
s612497382
s379381935
184
169
38,512
38,516
Accepted
Accepted
8.15
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 a, b, k = list(map(int, readline().split())) if a == b: print(a) else: ans = set() for i in range(a, min(a + k, b)): ans.add(i) for i in range(b, max(b - k, a), -...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 a, b, k = list(map(int, readline().split())) st = set() for i in range(a, min(a + k, b + 1)): st.add(i) for i in range(b, max(b - k, a - 1), - 1): st.add(i) for v in sorted(st): ...
20
18
429
378
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 a, b, k = list(map(int, readline().split())) if a == b: print(a) else: ans = set() for i in range(a, min(a + k, b)): ans.add(i) for i in range(b, max(b - k, a), -1): ...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 a, b, k = list(map(int, readline().split())) st = set() for i in range(a, min(a + k, b + 1)): st.add(i) for i in range(b, max(b - k, a - 1), -1): st.add(i) for v in sorted(st): print(v) i...
false
10
[ "- if a == b:", "- print(a)", "- else:", "- ans = set()", "- for i in range(a, min(a + k, b)):", "- ans.add(i)", "- for i in range(b, max(b - k, a), -1):", "- ans.add(i)", "- print((*sorted(list(ans))))", "+ st = set()", "+ for...
false
0.097358
0.057388
1.696471
[ "s612497382", "s379381935" ]
u197457087
p02862
python
s739962900
s279057528
1,370
121
121,764
88,084
Accepted
Accepted
91.17
def cmb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fac[n] * finv[r] * finv[n-r] % p N = pow(10,6) MOD = pow(10,9)+7 fac = [-1]*(N+1); fac[0] = 1; fac[1] = 1 finv = [-1]*(N+1); finv[0] = 1; finv[1] = 1 inv = [-1]*(N+1); inv[0] = 0; inv[1] = 1 for i in range(2,N+1): fac[...
def cmb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fac[n]*finv[r]*finv[n-r]%p N = pow(10,6) MOD = pow(10,9)+7 fac = [-1]*(N+1); fac[0] = 1; fac[1] = 1 #階乗 finv = [-1]*(N+1); finv[0] = 1; finv[1] = 1 #階乗の逆元 inv = [-1]*(N+1); inv[0] = 0; inv[1] = 1 #逆元 for i in range(2,N+1)...
31
29
612
597
def cmb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fac[n] * finv[r] * finv[n - r] % p N = pow(10, 6) MOD = pow(10, 9) + 7 fac = [-1] * (N + 1) fac[0] = 1 fac[1] = 1 finv = [-1] * (N + 1) finv[0] = 1 finv[1] = 1 inv = [-1] * (N + 1) inv[0] = 0 inv[1] = 1 for i in range(2, N ...
def cmb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fac[n] * finv[r] * finv[n - r] % p N = pow(10, 6) MOD = pow(10, 9) + 7 fac = [-1] * (N + 1) fac[0] = 1 fac[1] = 1 # 階乗 finv = [-1] * (N + 1) finv[0] = 1 finv[1] = 1 # 階乗の逆元 inv = [-1] * (N + 1) inv[0] = 0 inv[1] = 1 # 逆元...
false
6.451613
[ "-fac[1] = 1", "+fac[1] = 1 # 階乗", "-finv[1] = 1", "+finv[1] = 1 # 階乗の逆元", "-inv[1] = 1", "+inv[1] = 1 # 逆元", "- print(\"0\")", "- exit(0)", "-M = (X + Y) // 3 # M回動く必要がある。", "-D = abs(X - Y) # D回差がある。", "-A = (M - D) // 2", "-# print(M,D,A)", "-ans = cmb(M, A, MOD)", "+ prin...
false
2.587245
1.729349
1.496081
[ "s739962900", "s279057528" ]
u923279197
p02945
python
s353211877
s709853837
181
17
38,256
2,940
Accepted
Accepted
90.61
a,b = list(map(int,input().split())) print((max(a+b,a-b,a*b)))
a,b = list(map(int,input().split())) ans1 = a+b ans2 = a-b ans3 = a*b ans = max(ans1,ans2,ans3) print(ans)
2
6
55
105
a, b = list(map(int, input().split())) print((max(a + b, a - b, a * b)))
a, b = list(map(int, input().split())) ans1 = a + b ans2 = a - b ans3 = a * b ans = max(ans1, ans2, ans3) print(ans)
false
66.666667
[ "-print((max(a + b, a - b, a * b)))", "+ans1 = a + b", "+ans2 = a - b", "+ans3 = a * b", "+ans = max(ans1, ans2, ans3)", "+print(ans)" ]
false
0.039209
0.035914
1.091742
[ "s353211877", "s709853837" ]
u102461423
p02923
python
s297323565
s169131658
335
175
24,312
24,256
Accepted
Accepted
47.76
import sys import numpy as np N = int(sys.stdin.readline()) A = np.array(sys.stdin.readline().split(), dtype=np.int32) """ A = [10,4,8,7,3] is_left_end = [1,0,1,0,0] left_idx = [0,0,2,2,2] というものを作る """ is_left_end = np.empty(N, dtype=np.bool) is_left_end[0] = 1 is_left_end[1:] = (A[1:] > A[:-1]) left...
import numpy as np N = int(eval(input())) A = np.array(input().split(), dtype=np.int32) """ A = [10,4,8,7,3] left_idx = [0,0,2,2,2] というものを作る """ left_idx = np.arange(N) # [0,1,2,3,4] left_idx[1:][A[:-1] >= A[1:]] = 0 # [0,0,2,0,0] (自身が左以下ならば0に) np.maximum.accumulate(left_idx, out=left_idx) # [0,0,2,2,2] ...
21
15
500
369
import sys import numpy as np N = int(sys.stdin.readline()) A = np.array(sys.stdin.readline().split(), dtype=np.int32) """ A = [10,4,8,7,3] is_left_end = [1,0,1,0,0] left_idx = [0,0,2,2,2] というものを作る """ is_left_end = np.empty(N, dtype=np.bool) is_left_end[0] = 1 is_left_end[1:] = A[1:] > A[:-1] left_idx = np.where(is_l...
import numpy as np N = int(eval(input())) A = np.array(input().split(), dtype=np.int32) """ A = [10,4,8,7,3] left_idx = [0,0,2,2,2] というものを作る """ left_idx = np.arange(N) # [0,1,2,3,4] left_idx[1:][A[:-1] >= A[1:]] = 0 # [0,0,2,0,0] (自身が左以下ならば0に) np.maximum.accumulate(left_idx, out=left_idx) # [0,0,2,2,2] answer = (n...
false
28.571429
[ "-import sys", "-N = int(sys.stdin.readline())", "-A = np.array(sys.stdin.readline().split(), dtype=np.int32)", "+N = int(eval(input()))", "+A = np.array(input().split(), dtype=np.int32)", "-is_left_end = [1,0,1,0,0]", "-is_left_end = np.empty(N, dtype=np.bool)", "-is_left_end[0] = 1", "-is_left_end...
false
0.210997
0.212172
0.994461
[ "s297323565", "s169131658" ]
u198440493
p03108
python
s923211545
s260129802
503
416
50,020
41,040
Accepted
Accepted
17.3
import sys sys.setrecursionlimit(100000) input = sys.stdin.readline n,m=list(map(int,input().split())) z=n*(n-1)//2 l=[-1]*n a=[1]*n b=[input().split() for _ in range(m)] c=[0]*m+[z] def r(s): t=l[s] if t<0: return s else: l[s]=r(t) return l[s] for i in range(m-1,-1,-1): x,y=[r(int(...
import sys sys.setrecursionlimit(100000) input=sys.stdin.readline n,m=list(map(int,input().split())) z=n*(n-1)//2 l=[-1]*n a=[1]*n b=[input().split() for _ in range(m)] c=[0]*m+[z] def r(s): t=l[s] if t<0: return s else: l[s]=r(t) return l[s] def f(s): return r(int(s)-1) for i in r...
25
32
434
513
import sys sys.setrecursionlimit(100000) input = sys.stdin.readline n, m = list(map(int, input().split())) z = n * (n - 1) // 2 l = [-1] * n a = [1] * n b = [input().split() for _ in range(m)] c = [0] * m + [z] def r(s): t = l[s] if t < 0: return s else: l[s] = r(t) return l[s] ...
import sys sys.setrecursionlimit(100000) input = sys.stdin.readline n, m = list(map(int, input().split())) z = n * (n - 1) // 2 l = [-1] * n a = [1] * n b = [input().split() for _ in range(m)] c = [0] * m + [z] def r(s): t = l[s] if t < 0: return s else: l[s] = r(t) return l[s] ...
false
21.875
[ "+def f(s):", "+ return r(int(s) - 1)", "+", "+", "- x, y = [r(int(w) - 1) for w in b[i]]", "+ x, y = list(map(f, b[i]))", "- z -= a[x] * a[y]", "- l[x] = y", "- a[y] += a[x]", "+ s, t = a[x], a[y]", "+ z -= s * t", "+ if s < t:", "+ ...
false
0.040566
0.044299
0.915734
[ "s923211545", "s260129802" ]
u864197622
p02904
python
s074248340
s161628873
1,102
402
128,764
98,000
Accepted
Accepted
63.52
NN = 18 MA = [-1] * ((1<<NN+1)-1) MI = [1<<100] * ((1<<NN+1)-1) def update(a, x): i = (1<<NN) - 1 + a MI[i] = x MA[i] = x while True: i = (i-1) // 2 MI[i] = min(MI[2*i+1], MI[2*i+2]) MA[i] = max(MA[2*i+1], MA[2*i+2]) if i == 0: break def rangem...
from collections import deque def slidemax(X, k): q = deque([]) ret = [] for i in range(len(X)): while q and q[-1][1] <= X[i]: q.pop() deque.append(q, (i+k, X[i])) if q[0][0] == i: deque.popleft(q) if i >= k-1: ret.append(q[0][1]...
65
48
1,367
1,064
NN = 18 MA = [-1] * ((1 << NN + 1) - 1) MI = [1 << 100] * ((1 << NN + 1) - 1) def update(a, x): i = (1 << NN) - 1 + a MI[i] = x MA[i] = x while True: i = (i - 1) // 2 MI[i] = min(MI[2 * i + 1], MI[2 * i + 2]) MA[i] = max(MA[2 * i + 1], MA[2 * i + 2]) if i == 0: ...
from collections import deque def slidemax(X, k): q = deque([]) ret = [] for i in range(len(X)): while q and q[-1][1] <= X[i]: q.pop() deque.append(q, (i + k, X[i])) if q[0][0] == i: deque.popleft(q) if i >= k - 1: ret.append(q[0][1]) ...
false
26.153846
[ "-NN = 18", "-MA = [-1] * ((1 << NN + 1) - 1)", "-MI = [1 << 100] * ((1 << NN + 1) - 1)", "+from collections import deque", "-def update(a, x):", "- i = (1 << NN) - 1 + a", "- MI[i] = x", "- MA[i] = x", "- while True:", "- i = (i - 1) // 2", "- MI[i] = min(MI[2 * i + 1]...
false
0.077165
0.08699
0.887056
[ "s074248340", "s161628873" ]
u428199834
p02576
python
s813247069
s753107870
34
31
9,152
9,116
Accepted
Accepted
8.82
n,x,t=list(map(int,input().split())) u=n//x if n-u*x==0: print((u*t)) else: print((u*t+t))
n,x,y=list(map(int,input().split())) c=(n+x-1)//x print((c*y))
6
3
89
56
n, x, t = list(map(int, input().split())) u = n // x if n - u * x == 0: print((u * t)) else: print((u * t + t))
n, x, y = list(map(int, input().split())) c = (n + x - 1) // x print((c * y))
false
50
[ "-n, x, t = list(map(int, input().split()))", "-u = n // x", "-if n - u * x == 0:", "- print((u * t))", "-else:", "- print((u * t + t))", "+n, x, y = list(map(int, input().split()))", "+c = (n + x - 1) // x", "+print((c * y))" ]
false
0.094049
0.123979
0.758587
[ "s813247069", "s753107870" ]
u730769327
p03108
python
s262561862
s226364355
433
397
95,436
91,676
Accepted
Accepted
8.31
from itertools import combinations class UnionFind(): def __init__(self, n): self.n = n self.root = [-1]*(n+1) self.rnk = [0]*(n+1) def Find_Root(self, x): if(self.root[x] < 0): return x else: self.root[x] = self.Find_Root(self.root[x]) ...
class UnionFind(): def __init__(self, n=10**6): self.n=n self.root=[-1]*(n+1) self.rnk=[0]*(n+1) def find(self, x): if(self.root[x]<0): return x else: self.root[x]=self.find(self.root[x]) return self.root[x] def unite(self, x, y): x=self.find(x) y=self.fi...
46
43
1,239
1,014
from itertools import combinations class UnionFind: def __init__(self, n): self.n = n self.root = [-1] * (n + 1) self.rnk = [0] * (n + 1) def Find_Root(self, x): if self.root[x] < 0: return x else: self.root[x] = self.Find_Root(self.root[x]) ...
class UnionFind: def __init__(self, n=10**6): self.n = n self.root = [-1] * (n + 1) self.rnk = [0] * (n + 1) def find(self, x): if self.root[x] < 0: return x else: self.root[x] = self.find(self.root[x]) return self.root[x] def uni...
false
6.521739
[ "-from itertools import combinations", "-", "-", "- def __init__(self, n):", "+ def __init__(self, n=10**6):", "- def Find_Root(self, x):", "+ def find(self, x):", "- self.root[x] = self.Find_Root(self.root[x])", "+ self.root[x] = self.find(self.root[x])", "- d...
false
0.038809
0.037071
1.046868
[ "s262561862", "s226364355" ]
u952030520
p02918
python
s062325973
s595443607
100
51
9,588
9,588
Accepted
Accepted
49
#D-Face Produces Unhappiness N, K = list(map(int, input().split())) S = str(eval(input())) def count_LRorRL(l): ans = 0 l_index = [l[i]+l[i+1] for i in range(0,N-1)] ans += l_index.count('LR') ans += l_index.count('RL') return ans def count_LLorRR(l): ans = 0 l_index = [l[i]+l...
#D-Face Produces Unhappiness N, K = list(map(int, input().split())) S = str(eval(input())) S_index = [S[i]+S[i+1] for i in range(0,N-1)] count_LRorRL =0 count_LRorRL += S_index.count('LR') count_LRorRL += S_index.count('RL') count_LLorRR = 0 count_LLorRR += S_index.count('LL') count_LLorRR += S_index.count...
22
17
531
414
# D-Face Produces Unhappiness N, K = list(map(int, input().split())) S = str(eval(input())) def count_LRorRL(l): ans = 0 l_index = [l[i] + l[i + 1] for i in range(0, N - 1)] ans += l_index.count("LR") ans += l_index.count("RL") return ans def count_LLorRR(l): ans = 0 l_index = [l[i] + l[...
# D-Face Produces Unhappiness N, K = list(map(int, input().split())) S = str(eval(input())) S_index = [S[i] + S[i + 1] for i in range(0, N - 1)] count_LRorRL = 0 count_LRorRL += S_index.count("LR") count_LRorRL += S_index.count("RL") count_LLorRR = 0 count_LLorRR += S_index.count("LL") count_LLorRR += S_index.count("RR...
false
22.727273
[ "-", "-", "-def count_LRorRL(l):", "- ans = 0", "- l_index = [l[i] + l[i + 1] for i in range(0, N - 1)]", "- ans += l_index.count(\"LR\")", "- ans += l_index.count(\"RL\")", "- return ans", "-", "-", "-def count_LLorRR(l):", "- ans = 0", "- l_index = [l[i] + l[i + 1] for...
false
0.107651
0.078422
1.372708
[ "s062325973", "s595443607" ]
u595289165
p02937
python
s312718571
s169307902
151
128
9,044
87,224
Accepted
Accepted
15.23
from bisect import bisect_right, bisect_left s = [ord(i) - ord("a") for i in eval(input())] t = [ord(i) - ord("a") for i in eval(input())] index = [[] for _ in range(26)] for i, x in enumerate(s): index[x].append(i) l_s = len(s) for x in index: if x: x.append(x[0] + l_s) cnt = -1 fo...
from bisect import bisect_left s = eval(input()) t = eval(input()) n = len(s) s = s * 2 r = {} for i, v in enumerate(s): if v in list(r.keys()): r[v].append(i+1) else: r[v] = [i+1] now = 0 lt = len(t) for v in t: if v in list(r.keys()): index = bisect_left(r[...
28
28
480
429
from bisect import bisect_right, bisect_left s = [ord(i) - ord("a") for i in eval(input())] t = [ord(i) - ord("a") for i in eval(input())] index = [[] for _ in range(26)] for i, x in enumerate(s): index[x].append(i) l_s = len(s) for x in index: if x: x.append(x[0] + l_s) cnt = -1 for r in t: seq = ...
from bisect import bisect_left s = eval(input()) t = eval(input()) n = len(s) s = s * 2 r = {} for i, v in enumerate(s): if v in list(r.keys()): r[v].append(i + 1) else: r[v] = [i + 1] now = 0 lt = len(t) for v in t: if v in list(r.keys()): index = bisect_left(r[v], now % n + 1) ...
false
0
[ "-from bisect import bisect_right, bisect_left", "+from bisect import bisect_left", "-s = [ord(i) - ord(\"a\") for i in eval(input())]", "-t = [ord(i) - ord(\"a\") for i in eval(input())]", "-index = [[] for _ in range(26)]", "-for i, x in enumerate(s):", "- index[x].append(i)", "-l_s = len(s)", ...
false
0.039178
0.042796
0.915455
[ "s312718571", "s169307902" ]
u197615397
p02269
python
s128589809
s964844389
3,930
2,060
45,124
38,000
Accepted
Accepted
47.58
N = int(eval(input())) d = {} for i in [None]*N: a, b = input().split() if a == "insert": d[b] = 1 else: print(("yes" if b in d else "no"))
class Dictionary(object): def __init__(self, size): self.size = size self.a = [None]*size def hash(self, x): key = hash(x) % self.size while self.a[key] and self.a[key] != x: key = (key + 10**9+7) % self.size return key def insert(self, x): ...
8
30
166
781
N = int(eval(input())) d = {} for i in [None] * N: a, b = input().split() if a == "insert": d[b] = 1 else: print(("yes" if b in d else "no"))
class Dictionary(object): def __init__(self, size): self.size = size self.a = [None] * size def hash(self, x): key = hash(x) % self.size while self.a[key] and self.a[key] != x: key = (key + 10**9 + 7) % self.size return key def insert(self, x): s...
false
73.333333
[ "-N = int(eval(input()))", "-d = {}", "-for i in [None] * N:", "- a, b = input().split()", "- if a == \"insert\":", "- d[b] = 1", "- else:", "- print((\"yes\" if b in d else \"no\"))", "+class Dictionary(object):", "+ def __init__(self, size):", "+ self.size = si...
false
0.079623
0.128632
0.618997
[ "s128589809", "s964844389" ]
u497046426
p03478
python
s973729275
s148368638
35
29
3,060
3,060
Accepted
Accepted
17.14
# スペース区切りの整数の入力 N, a, b= list(map(int, input().split())) summation = 0 for i in range(N+1): num = i total = 0 while num != 0: q, mod = divmod(num, 10) total += mod num = q if total >= a and total <= b: summation += i print(summation)
N, A, B = list(map(int, input().split())) ans = 0 for i in range(1, N+1): if A <= sum(map(int, str(i))) <= B: ans += i print(ans)
16
6
301
140
# スペース区切りの整数の入力 N, a, b = list(map(int, input().split())) summation = 0 for i in range(N + 1): num = i total = 0 while num != 0: q, mod = divmod(num, 10) total += mod num = q if total >= a and total <= b: summation += i print(summation)
N, A, B = list(map(int, input().split())) ans = 0 for i in range(1, N + 1): if A <= sum(map(int, str(i))) <= B: ans += i print(ans)
false
62.5
[ "-# スペース区切りの整数の入力", "-N, a, b = list(map(int, input().split()))", "-summation = 0", "-for i in range(N + 1):", "- num = i", "- total = 0", "- while num != 0:", "- q, mod = divmod(num, 10)", "- total += mod", "- num = q", "- if total >= a and total <= b:", "- ...
false
0.041772
0.039824
1.0489
[ "s973729275", "s148368638" ]
u046187684
p03503
python
s127725139
s804704323
434
353
21,540
12,700
Accepted
Accepted
18.66
from itertools import product import numpy as np def solve(string): n, *fp = list(map(int, string.split())) f = np.asarray(fp[:10 * n]).reshape((n, 10)) p = fp[10 * n:] ans = -n * 10**7 for o in product([0, 1], repeat=10): if sum(o) == 0: continue tmp = np.d...
from itertools import product import numpy as np def solve(string): n, *fp = list(map(int, string.split())) # f = np.asarray(fp[:10 * n]).reshape((n, 10)) f = fp[:10 * n] p = fp[10 * n:] ans = -n * 10**7 """ for o in product([0, 1], repeat=10): if sum(o) == 0: ...
20
29
569
931
from itertools import product import numpy as np def solve(string): n, *fp = list(map(int, string.split())) f = np.asarray(fp[: 10 * n]).reshape((n, 10)) p = fp[10 * n :] ans = -n * 10**7 for o in product([0, 1], repeat=10): if sum(o) == 0: continue tmp = np.dot(f, np.a...
from itertools import product import numpy as np def solve(string): n, *fp = list(map(int, string.split())) # f = np.asarray(fp[:10 * n]).reshape((n, 10)) f = fp[: 10 * n] p = fp[10 * n :] ans = -n * 10**7 """ for o in product([0, 1], repeat=10): if sum(o) == 0: continu...
false
31.034483
[ "- f = np.asarray(fp[: 10 * n]).reshape((n, 10))", "+ # f = np.asarray(fp[:10 * n]).reshape((n, 10))", "+ f = fp[: 10 * n]", "+ \"\"\"", "- tmp = np.dot(f, np.asanyarray(o).T)", "+ # tmp = np.dot(f, np.asanyarray(o).T)", "+ tmp = [sum([for ]) for _f in f]", "+ a...
false
0.006817
0.035395
0.192598
[ "s127725139", "s804704323" ]
u886878171
p03493
python
s153401387
s013649981
174
17
38,384
2,940
Accepted
Accepted
90.23
a = eval(input()) count = 0 if a[0] == "1": count += 1 if a[1] == "1": count += 1 if a[2] == "1": count += 1 print(count)
a = eval(input()) count = 0 for b in a: if b == "1": count += 1 print(count)
9
8
129
85
a = eval(input()) count = 0 if a[0] == "1": count += 1 if a[1] == "1": count += 1 if a[2] == "1": count += 1 print(count)
a = eval(input()) count = 0 for b in a: if b == "1": count += 1 print(count)
false
11.111111
[ "-if a[0] == \"1\":", "- count += 1", "-if a[1] == \"1\":", "- count += 1", "-if a[2] == \"1\":", "- count += 1", "+for b in a:", "+ if b == \"1\":", "+ count += 1" ]
false
0.095717
0.038806
2.466581
[ "s153401387", "s013649981" ]
u860002137
p02574
python
s957580354
s684912562
1,588
1,023
209,068
208,192
Accepted
Accepted
35.58
import numpy as np from numba import njit n = int(eval(input())) arr = np.array(list(map(int, input().split()))) n = 10**6 + 1 primes = set(range(3, n+1, 2)) for i in range(3, int(n**0.5+1)): primes.difference_update(list(range(i*2, n+1, i))) primes.add(2) @njit def solve(arr, primes): ...
import numpy as np from numba import njit n = int(eval(input())) arr = np.array(list(map(int, input().split()))) @njit def solve(arr): cnt = np.bincount(arr) for i in range(2, 10**6 + 1): if (cnt[i::i]).sum() > 1: return False else: return True if np.gcd.r...
32
24
598
442
import numpy as np from numba import njit n = int(eval(input())) arr = np.array(list(map(int, input().split()))) n = 10**6 + 1 primes = set(range(3, n + 1, 2)) for i in range(3, int(n**0.5 + 1)): primes.difference_update(list(range(i * 2, n + 1, i))) primes.add(2) @njit def solve(arr, primes): cnt = np.binco...
import numpy as np from numba import njit n = int(eval(input())) arr = np.array(list(map(int, input().split()))) @njit def solve(arr): cnt = np.bincount(arr) for i in range(2, 10**6 + 1): if (cnt[i::i]).sum() > 1: return False else: return True if np.gcd.reduce(arr) != 1: ...
false
25
[ "-n = 10**6 + 1", "-primes = set(range(3, n + 1, 2))", "-for i in range(3, int(n**0.5 + 1)):", "- primes.difference_update(list(range(i * 2, n + 1, i)))", "-primes.add(2)", "-def solve(arr, primes):", "+def solve(arr):", "- for p in primes:", "- if (cnt[p::p]).sum() > 1:", "+ for i...
false
0.440259
0.193174
2.279084
[ "s957580354", "s684912562" ]
u380524497
p02756
python
s676425474
s501444587
585
242
10,084
8,420
Accepted
Accepted
58.63
from collections import deque reverse = 0 S = deque(list(eval(input()))) q = int(eval(input())) for _ in range(q): query = eval(input()) if query[0] == '1': reverse = 1 - reverse continue _, f, c = query.split() f = int(f) action = (reverse + f) % 2 if action:...
import sys from collections import deque reverse = 0 S = deque(list(eval(input()))) q = int(eval(input())) for query in sys.stdin: if query[0] == '1': reverse = 1 - reverse continue _, f, c = query.split() f = int(f) action = (reverse + f) % 2 if action: ...
25
25
418
408
from collections import deque reverse = 0 S = deque(list(eval(input()))) q = int(eval(input())) for _ in range(q): query = eval(input()) if query[0] == "1": reverse = 1 - reverse continue _, f, c = query.split() f = int(f) action = (reverse + f) % 2 if action: S.appendle...
import sys from collections import deque reverse = 0 S = deque(list(eval(input()))) q = int(eval(input())) for query in sys.stdin: if query[0] == "1": reverse = 1 - reverse continue _, f, c = query.split() f = int(f) action = (reverse + f) % 2 if action: S.appendleft(c) ...
false
0
[ "+import sys", "-for _ in range(q):", "- query = eval(input())", "+for query in sys.stdin:", "- S = list(S)[::-1]", "+ S.reverse()" ]
false
0.210221
0.207016
1.015481
[ "s676425474", "s501444587" ]
u130900604
p02784
python
s404653590
s755318212
215
88
53,572
88,384
Accepted
Accepted
59.07
h,n=list(map(int,input().split())) a=list(map(int,input().split())) s=sum(a) ans="Yes" if s>=h else "No" print(ans)
h,n,*a=list(map(int,open(0).read().split())) h-=sum(a) if h>0: print("No") else: print("Yes")
10
6
124
96
h, n = list(map(int, input().split())) a = list(map(int, input().split())) s = sum(a) ans = "Yes" if s >= h else "No" print(ans)
h, n, *a = list(map(int, open(0).read().split())) h -= sum(a) if h > 0: print("No") else: print("Yes")
false
40
[ "-h, n = list(map(int, input().split()))", "-a = list(map(int, input().split()))", "-s = sum(a)", "-ans = \"Yes\" if s >= h else \"No\"", "-print(ans)", "+h, n, *a = list(map(int, open(0).read().split()))", "+h -= sum(a)", "+if h > 0:", "+ print(\"No\")", "+else:", "+ print(\"Yes\")" ]
false
0.087865
0.086965
1.010346
[ "s404653590", "s755318212" ]
u686036872
p03556
python
s482225162
s632946892
41
18
2,940
3,060
Accepted
Accepted
56.1
N = int(eval(input())) max=1 for i in range(1, N): if int(i**2)<=N: max=i**2 else: break print(max)
N = int(eval(input())) print((int(N**(1/2))**2))
8
3
112
43
N = int(eval(input())) max = 1 for i in range(1, N): if int(i**2) <= N: max = i**2 else: break print(max)
N = int(eval(input())) print((int(N ** (1 / 2)) ** 2))
false
62.5
[ "-max = 1", "-for i in range(1, N):", "- if int(i**2) <= N:", "- max = i**2", "- else:", "- break", "-print(max)", "+print((int(N ** (1 / 2)) ** 2))" ]
false
0.124412
0.007217
17.237667
[ "s482225162", "s632946892" ]
u952708174
p02660
python
s127193891
s781809030
366
319
9,464
9,404
Accepted
Accepted
12.84
def d_div_game(): N=int(eval(input())) def prime_factorization_dict(n): """nを素因数分解したときの素数とその指数の辞書""" from collections import defaultdict if n == 1: return {2: 0} # 1は素数の0乗の積とみなす i, table = 2, defaultdict(int) while i**2 <= n: while n % ...
def d_div_game(): def prime_factorization_dict(n): """n を素因数分解したときの素数とその指数の辞書""" from collections import defaultdict if n == 1: return {2: 0} # 1 は素数の 0 乗の積とみなす i, table = 2, defaultdict(int) while i**2 <= n: while n % i == 0: ...
32
28
761
776
def d_div_game(): N = int(eval(input())) def prime_factorization_dict(n): """nを素因数分解したときの素数とその指数の辞書""" from collections import defaultdict if n == 1: return {2: 0} # 1は素数の0乗の積とみなす i, table = 2, defaultdict(int) while i**2 <= n: while n % i == 0:...
def d_div_game(): def prime_factorization_dict(n): """n を素因数分解したときの素数とその指数の辞書""" from collections import defaultdict if n == 1: return {2: 0} # 1 は素数の 0 乗の積とみなす i, table = 2, defaultdict(int) while i**2 <= n: while n % i == 0: table[i...
false
12.5
[ "- N = int(eval(input()))", "-", "- \"\"\"nを素因数分解したときの素数とその指数の辞書\"\"\"", "+ \"\"\"n を素因数分解したときの素数とその指数の辞書\"\"\"", "- return {2: 0} # 1は素数の0乗の積とみなす", "+ return {2: 0} # 1 は素数の 0 乗の積とみなす", "- d = prime_factorization_dict(N)", "- ans = 0", "- for v in l...
false
0.063556
0.044002
1.444389
[ "s127193891", "s781809030" ]
u456579619
p02989
python
s274918916
s658647425
220
70
39,120
20,704
Accepted
Accepted
68.18
import numpy as np N = int(eval(input())) d = sorted(map(int, input().split())) med = np.median(d) if med in d: print((0)) else: lar = [x for x in d if x>med] sma = [x for x in d if x<med] print((lar[0]-sma[-1]))
N = int(eval(input())) d = sorted(map(int, input().split())) print((d[int(N/2)] - d[int(N/2-1)]))
14
4
229
93
import numpy as np N = int(eval(input())) d = sorted(map(int, input().split())) med = np.median(d) if med in d: print((0)) else: lar = [x for x in d if x > med] sma = [x for x in d if x < med] print((lar[0] - sma[-1]))
N = int(eval(input())) d = sorted(map(int, input().split())) print((d[int(N / 2)] - d[int(N / 2 - 1)]))
false
71.428571
[ "-import numpy as np", "-", "-med = np.median(d)", "-if med in d:", "- print((0))", "-else:", "- lar = [x for x in d if x > med]", "- sma = [x for x in d if x < med]", "- print((lar[0] - sma[-1]))", "+print((d[int(N / 2)] - d[int(N / 2 - 1)]))" ]
false
0.356771
0.0452
7.89308
[ "s274918916", "s658647425" ]
u077291787
p03827
python
s600215403
s722718512
19
17
2,940
2,940
Accepted
Accepted
10.53
# ABC052B - Increment Decrement _ = int(eval(input())) s = eval(input()) x = 0 lst = [0] for i in s: if i == "I": x += 1 else: x -= 1 lst.append(x) print((max(lst)))
# ABC052B - Increment Decrement def main(): _, S = tuple(eval(input()) for _ in range(2)) ans, x = [0], 0 for i in S: x += 1 if i == "I" else -1 ans += [x] print((max(ans))) if __name__ == "__main__": main()
12
12
190
248
# ABC052B - Increment Decrement _ = int(eval(input())) s = eval(input()) x = 0 lst = [0] for i in s: if i == "I": x += 1 else: x -= 1 lst.append(x) print((max(lst)))
# ABC052B - Increment Decrement def main(): _, S = tuple(eval(input()) for _ in range(2)) ans, x = [0], 0 for i in S: x += 1 if i == "I" else -1 ans += [x] print((max(ans))) if __name__ == "__main__": main()
false
0
[ "-_ = int(eval(input()))", "-s = eval(input())", "-x = 0", "-lst = [0]", "-for i in s:", "- if i == \"I\":", "- x += 1", "- else:", "- x -= 1", "- lst.append(x)", "-print((max(lst)))", "+def main():", "+ _, S = tuple(eval(input()) for _ in range(2))", "+ ans, x...
false
0.04918
0.048184
1.020656
[ "s600215403", "s722718512" ]
u750712894
p02571
python
s200033030
s731706997
110
72
67,936
73,820
Accepted
Accepted
34.55
s = eval(input()) t = eval(input()) ls = [] for i in range(len(s) - len(t) + 1): ls.append(s[i:i+len(t)]) now = 0 minimum = len(t) for i in range(len(ls)): now = 0 for j in range(len(t)): if t[j] == ls[i][j]: now += 1 if len(t) - now < minimum: minimum = len(t) -...
S = eval(input()) T = eval(input()) A = len(T) ls = [] for i in range(len(S)-len(T)+1): ls.append(S[i:i+len(T)]) for i in range(len(ls)): same = 0 for j in range(len(T)): if T[j] == ls[i][j]: same += 1; if len(T)-same < A: A = len(T)-same print(A)
15
14
328
302
s = eval(input()) t = eval(input()) ls = [] for i in range(len(s) - len(t) + 1): ls.append(s[i : i + len(t)]) now = 0 minimum = len(t) for i in range(len(ls)): now = 0 for j in range(len(t)): if t[j] == ls[i][j]: now += 1 if len(t) - now < minimum: minimum = len(t) - now prin...
S = eval(input()) T = eval(input()) A = len(T) ls = [] for i in range(len(S) - len(T) + 1): ls.append(S[i : i + len(T)]) for i in range(len(ls)): same = 0 for j in range(len(T)): if T[j] == ls[i][j]: same += 1 if len(T) - same < A: A = len(T) - same print(A)
false
6.666667
[ "-s = eval(input())", "-t = eval(input())", "+S = eval(input())", "+T = eval(input())", "+A = len(T)", "-for i in range(len(s) - len(t) + 1):", "- ls.append(s[i : i + len(t)])", "-now = 0", "-minimum = len(t)", "+for i in range(len(S) - len(T) + 1):", "+ ls.append(S[i : i + len(T)])", "-...
false
0.039219
0.059145
0.663093
[ "s200033030", "s731706997" ]
u759412327
p02614
python
s406822939
s562554254
215
64
27,268
9,104
Accepted
Accepted
70.23
from itertools import * import numpy as np H,W,K = list(map(int,input().split())) C = [list(eval(input())) for h in range(H)] D = np.zeros((H,W),dtype=np.int) a = 0 for h in range(H): for w in range(W): if C[h][w]=="#": D[h][w]=1 T = np.sum(D) for h in range(1+H): for I in combinations(l...
H,W,K = list(map(int,input().split())) C = [list(eval(input())) for h in range(H)] ans = 0 for h in range(2**H): for w in range(2**W): c = 0 for i in range(H): for j in range(W): if (h>>i)&1==0 and (w>>j)&1==0 and C[i][j]=="#": c+=1 if c==K: ans+=1 print(ans)
34
15
688
307
from itertools import * import numpy as np H, W, K = list(map(int, input().split())) C = [list(eval(input())) for h in range(H)] D = np.zeros((H, W), dtype=np.int) a = 0 for h in range(H): for w in range(W): if C[h][w] == "#": D[h][w] = 1 T = np.sum(D) for h in range(1 + H): for I in combin...
H, W, K = list(map(int, input().split())) C = [list(eval(input())) for h in range(H)] ans = 0 for h in range(2**H): for w in range(2**W): c = 0 for i in range(H): for j in range(W): if (h >> i) & 1 == 0 and (w >> j) & 1 == 0 and C[i][j] == "#": c += 1 ...
false
55.882353
[ "-from itertools import *", "-import numpy as np", "-", "-D = np.zeros((H, W), dtype=np.int)", "-a = 0", "-for h in range(H):", "- for w in range(W):", "- if C[h][w] == \"#\":", "- D[h][w] = 1", "-T = np.sum(D)", "-for h in range(1 + H):", "- for I in combinations(list(...
false
0.210594
0.0341
6.175747
[ "s406822939", "s562554254" ]
u019685451
p02629
python
s213526625
s872649699
39
30
9,200
9,196
Accepted
Accepted
23.08
N = int(eval(input())) - 1 lb, ub = 0, 0 for n_digit in range(1, 20): lb = ub ub = (ub + 1) * 26 # print(n_digit, lb, ub) if lb <= N < ub: off = N - lb ans = ['a' for _ in range(n_digit)] idx = 1 while off > 0: ans[-idx] = chr(ord('a') + off %...
def solve(): N = int(eval(input())) lb, ub = 0, 0 for n_digit in range(1, 100): lb = ub + 1 ub = (ub + 1) * 26 if lb <= N <= ub: off = N - lb res = [] while off > 0: off, r = divmod(off, 26) res.append(r...
20
20
418
519
N = int(eval(input())) - 1 lb, ub = 0, 0 for n_digit in range(1, 20): lb = ub ub = (ub + 1) * 26 # print(n_digit, lb, ub) if lb <= N < ub: off = N - lb ans = ["a" for _ in range(n_digit)] idx = 1 while off > 0: ans[-idx] = chr(ord("a") + off % 26) ...
def solve(): N = int(eval(input())) lb, ub = 0, 0 for n_digit in range(1, 100): lb = ub + 1 ub = (ub + 1) * 26 if lb <= N <= ub: off = N - lb res = [] while off > 0: off, r = divmod(off, 26) res.append(r) ...
false
0
[ "-N = int(eval(input())) - 1", "-lb, ub = 0, 0", "-for n_digit in range(1, 20):", "- lb = ub", "- ub = (ub + 1) * 26", "- # print(n_digit, lb, ub)", "- if lb <= N < ub:", "- off = N - lb", "- ans = [\"a\" for _ in range(n_digit)]", "- idx = 1", "- while of...
false
0.038075
0.036287
1.04927
[ "s213526625", "s872649699" ]
u163783894
p03111
python
s904877879
s718695679
1,175
200
13,044
10,996
Accepted
Accepted
82.98
import sys import itertools read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline in_n = lambda: int(readline()) in_nn = lambda: list(map(int, readline().split())) in_s = lambda: readline().rstrip().decode('utf-8') def main(): N, A, B, C = in_nn() l = list(map(int, read().rstrip().spl...
import sys import itertools read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline in_n = lambda: int(readline()) in_nn = lambda: list(map(int, readline().split())) in_s = lambda: readline().rstrip().decode('utf-8') def main(): N, A, B, C = in_nn() l = list(map(int, read().rstrip().spl...
39
38
984
886
import sys import itertools read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline in_n = lambda: int(readline()) in_nn = lambda: list(map(int, readline().split())) in_s = lambda: readline().rstrip().decode("utf-8") def main(): N, A, B, C = in_nn() l = list(map(int, read().rstrip().split())) c...
import sys import itertools read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline in_n = lambda: int(readline()) in_nn = lambda: list(map(int, readline().split())) in_s = lambda: readline().rstrip().decode("utf-8") def main(): N, A, B, C = in_nn() l = list(map(int, read().rstrip().split())) c...
false
2.564103
[ "- abc_p = list(itertools.permutations([A, B, C], 3))", "- for abc in abc_p:", "- for c in comb:", "- if (0 in c) and (1 in c) and (2 in c):", "- t = [0] * 3", "- m = [-10] * 3", "- for i in range(N):", "- if c[i] ...
false
0.943929
0.217625
4.337417
[ "s904877879", "s718695679" ]
u909601929
p03964
python
s213795199
s968688846
101
22
5,200
3,064
Accepted
Accepted
78.22
from math import * from decimal import * N = int(eval(input())) T = [] A = [] for i in range(0, N): ti, ai = [Decimal(int(x)) for x in input().split()] T.append(ti) A.append(ai) prevT = T[0] prevA = A[0] for i in range(1, N): nextfacT = int(ceil(prevT / T[i])) nextfacA = int(ceil(pre...
from math import * N = int(eval(input())) T = [] A = [] for i in range(0, N): ti, ai = [int(x) for x in input().split()] T.append(ti) A.append(ai) prevT = T[0] prevA = A[0] for i in range(1, N): nextfacT = int(ceil((prevT + T[i] - 1) // T[i])) nextfacA = int(ceil((prevA + A[i] - 1) // ...
20
19
443
438
from math import * from decimal import * N = int(eval(input())) T = [] A = [] for i in range(0, N): ti, ai = [Decimal(int(x)) for x in input().split()] T.append(ti) A.append(ai) prevT = T[0] prevA = A[0] for i in range(1, N): nextfacT = int(ceil(prevT / T[i])) nextfacA = int(ceil(prevA / A[i])) ...
from math import * N = int(eval(input())) T = [] A = [] for i in range(0, N): ti, ai = [int(x) for x in input().split()] T.append(ti) A.append(ai) prevT = T[0] prevA = A[0] for i in range(1, N): nextfacT = int(ceil((prevT + T[i] - 1) // T[i])) nextfacA = int(ceil((prevA + A[i] - 1) // A[i])) ne...
false
5
[ "-from decimal import *", "- ti, ai = [Decimal(int(x)) for x in input().split()]", "+ ti, ai = [int(x) for x in input().split()]", "- nextfacT = int(ceil(prevT / T[i]))", "- nextfacA = int(ceil(prevA / A[i]))", "+ nextfacT = int(ceil((prevT + T[i] - 1) // T[i]))", "+ nextfacA = int(cei...
false
0.043383
0.035428
1.224544
[ "s213795199", "s968688846" ]
u843175622
p02883
python
s280021605
s473591426
403
300
116,224
115,908
Accepted
Accepted
25.56
n, k = list(map(int, input().split())) a = list(map(int, input().split())) f = list(map(int, input().split())) a = sorted(a) f = sorted(f)[::-1] def c(x): # x決めると必要な修行回数も決まる res = 0 for O, K in zip(a, f): d = max(0, O * K - x) res += (d + K - 1) // K return res <= k l...
n, k = list(map(int, input().split())) a = sorted(map(int, input().split())) f = sorted(map(int, input().split()))[::-1] # 成績 Σ{i=1~n}a[i]*f[i] # a[i]小さいの、f[i]でかいの組み合わせるとよい(交換しても悪化しない) def c(x): need = 0 for i in range(n): if a[i] * f[i] > x: # f[i]を何回減らしてx以下にできるか dif...
25
26
434
536
n, k = list(map(int, input().split())) a = list(map(int, input().split())) f = list(map(int, input().split())) a = sorted(a) f = sorted(f)[::-1] def c(x): # x決めると必要な修行回数も決まる res = 0 for O, K in zip(a, f): d = max(0, O * K - x) res += (d + K - 1) // K return res <= k l = -1 r = 1 << 6...
n, k = list(map(int, input().split())) a = sorted(map(int, input().split())) f = sorted(map(int, input().split()))[::-1] # 成績 Σ{i=1~n}a[i]*f[i] # a[i]小さいの、f[i]でかいの組み合わせるとよい(交換しても悪化しない) def c(x): need = 0 for i in range(n): if a[i] * f[i] > x: # f[i]を何回減らしてx以下にできるか diff = a[i] * f...
false
3.846154
[ "-a = list(map(int, input().split()))", "-f = list(map(int, input().split()))", "-a = sorted(a)", "-f = sorted(f)[::-1]", "+a = sorted(map(int, input().split()))", "+f = sorted(map(int, input().split()))[::-1]", "+# 成績 Σ{i=1~n}a[i]*f[i]", "+# a[i]小さいの、f[i]でかいの組み合わせるとよい(交換しても悪化しない)", "+def c(x):", ...
false
0.045595
0.037324
1.221594
[ "s280021605", "s473591426" ]
u707498674
p03007
python
s840728759
s891323909
298
235
15,824
17,012
Accepted
Accepted
21.14
from collections import deque N = int(eval(input())) A = (list(map(int, input().split()))) A = sorted(A) A = deque(A) l = [] for i in range(N - 1): if i == N - 2: ans = A[1] - A[0] l.append("{} {}".format(A[1], A[0])) elif i == N - 3: left = A.popleft() right = A.pop(...
N = int(eval(input())) A = list(map(int, input().split())) A = sorted(A) leftest_val = A[0] rightest_val = A[-1] left_idx = 1 right_idx = N - 2 history = [] for i in range(N - 1): left_val = A[left_idx] right_val = A[right_idx] if i == N - 2: history.append("{} {}".format(rightest_val,...
50
26
1,375
684
from collections import deque N = int(eval(input())) A = list(map(int, input().split())) A = sorted(A) A = deque(A) l = [] for i in range(N - 1): if i == N - 2: ans = A[1] - A[0] l.append("{} {}".format(A[1], A[0])) elif i == N - 3: left = A.popleft() right = A.pop() cen...
N = int(eval(input())) A = list(map(int, input().split())) A = sorted(A) leftest_val = A[0] rightest_val = A[-1] left_idx = 1 right_idx = N - 2 history = [] for i in range(N - 1): left_val = A[left_idx] right_val = A[right_idx] if i == N - 2: history.append("{} {}".format(rightest_val, leftest_val))...
false
48
[ "-from collections import deque", "-", "-A = deque(A)", "-l = []", "+leftest_val = A[0]", "+rightest_val = A[-1]", "+left_idx = 1", "+right_idx = N - 2", "+history = []", "+ left_val = A[left_idx]", "+ right_val = A[right_idx]", "- ans = A[1] - A[0]", "- l.append(\"{} {}\...
false
0.108194
0.043607
2.481118
[ "s840728759", "s891323909" ]
u912237403
p00068
python
s755057489
s103941281
30
20
4,280
4,280
Accepted
Accepted
33.33
import sys def side(p1, p2, p3): y1,x1=p1 y2,x2=p2 y3,x3=p3 return (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)>0 while 1: n=eval(input()) if n==0:break D=sorted([list(eval(input())) for i in range(n)]) p1=D[0] D1=D[:] while True: c=0 for p2 in D1: if p1==p2:continue f=[0,0] ...
import sys def side(p1, p2, p3): y1,x1=p1 y2,x2=p2 y3,x3=p3 return (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)>0 while 1: n=eval(input()) if n==0:break D=sorted([list(eval(input())) for i in range(n)]) p1=D[0] D1=D[:] while True: for p2 in D1: if p1==p2:continue for p3 in D[::-1]:...
25
23
495
471
import sys def side(p1, p2, p3): y1, x1 = p1 y2, x2 = p2 y3, x3 = p3 return (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) > 0 while 1: n = eval(input()) if n == 0: break D = sorted([list(eval(input())) for i in range(n)]) p1 = D[0] D1 = D[:] while True: c = 0 ...
import sys def side(p1, p2, p3): y1, x1 = p1 y2, x2 = p2 y3, x3 = p3 return (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) > 0 while 1: n = eval(input()) if n == 0: break D = sorted([list(eval(input())) for i in range(n)]) p1 = D[0] D1 = D[:] while True: for p2...
false
8
[ "- c = 0", "- f = [0, 0]", "- f[side(p1, p2, p3)] += 1", "- if f[0] == 0:", "+ if side(p1, p2, p3) == 0:", "+ break", "+ else:" ]
false
0.035642
0.039148
0.910449
[ "s755057489", "s103941281" ]
u222668979
p02582
python
s464019143
s871869222
106
76
61,576
61,776
Accepted
Accepted
28.3
s = eval(input()) if 'RRR' in s: print((3)) elif 'RR' in s: print((2)) elif 'R' in s: print((1)) else: print((0))
s = eval(input()) for i in [3, 2, 1, 0]: if 'R' * i in s: print(i) break
11
6
131
93
s = eval(input()) if "RRR" in s: print((3)) elif "RR" in s: print((2)) elif "R" in s: print((1)) else: print((0))
s = eval(input()) for i in [3, 2, 1, 0]: if "R" * i in s: print(i) break
false
45.454545
[ "-if \"RRR\" in s:", "- print((3))", "-elif \"RR\" in s:", "- print((2))", "-elif \"R\" in s:", "- print((1))", "-else:", "- print((0))", "+for i in [3, 2, 1, 0]:", "+ if \"R\" * i in s:", "+ print(i)", "+ break" ]
false
0.048789
0.049201
0.991639
[ "s464019143", "s871869222" ]
u562935282
p03111
python
s759504405
s819729921
611
515
3,064
3,064
Accepted
Accepted
15.71
inf = float('inf') n, *goal = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] ans = inf for q in range(4 ** n): m = [[] for _ in range(4)] lm = 0 for j in range(n): idx = (q // (4 ** j)) % 4 m[idx].append(l[j]) if any(len(m[idx]) == 0 for idx in r...
inf = float('inf') n, *goal = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] ans = inf for q in range(4 ** n): cost = -30 t = [0] * 3 for j in range(n): idx = (q // (4 ** j)) % 4 if idx == 3: continue t[idx] += l[j] cost += 10 ...
24
24
537
467
inf = float("inf") n, *goal = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] ans = inf for q in range(4**n): m = [[] for _ in range(4)] lm = 0 for j in range(n): idx = (q // (4**j)) % 4 m[idx].append(l[j]) if any(len(m[idx]) == 0 for idx in range(3)): ...
inf = float("inf") n, *goal = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] ans = inf for q in range(4**n): cost = -30 t = [0] * 3 for j in range(n): idx = (q // (4**j)) % 4 if idx == 3: continue t[idx] += l[j] cost += 10 if any(tt...
false
0
[ "- m = [[] for _ in range(4)]", "- lm = 0", "+ cost = -30", "+ t = [0] * 3", "- m[idx].append(l[j])", "- if any(len(m[idx]) == 0 for idx in range(3)):", "+ if idx == 3:", "+ continue", "+ t[idx] += l[j]", "+ cost += 10", "+ if any(tt == 0 ...
false
1.56625
0.47908
3.269284
[ "s759504405", "s819729921" ]
u561083515
p02775
python
s632627878
s559141673
714
494
20,692
20,692
Accepted
Accepted
30.81
import sys input = sys.stdin.readline # 不変 N = [0] + list(map(int, tuple(input().rstrip("\n")))) # 計算用 Ncopy = N.copy() ans = 0 # 繰り上げ発生時に変更 flag = False for i in range(len(N)-1, 0, -1): if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i-1] <= 4): ans += Ncopy[i] flag = False else: ...
import sys input = sys.stdin.readline # たこ焼き器の価値 N = [0] + list(map(int, tuple(input().rstrip("\n")))) def main(): # 支払額 Ncopy = N.copy() # 紙幣の枚数 ans = 0 # 繰り上げ発生時に変更 flag = False for i in range(len(N)-1, 0, -1): # 繰り上げしない場合 if (Ncopy[i] <= 4) or (Ncopy[i] ...
29
37
548
749
import sys input = sys.stdin.readline # 不変 N = [0] + list(map(int, tuple(input().rstrip("\n")))) # 計算用 Ncopy = N.copy() ans = 0 # 繰り上げ発生時に変更 flag = False for i in range(len(N) - 1, 0, -1): if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i - 1] <= 4): ans += Ncopy[i] flag = False else: Ncopy[...
import sys input = sys.stdin.readline # たこ焼き器の価値 N = [0] + list(map(int, tuple(input().rstrip("\n")))) def main(): # 支払額 Ncopy = N.copy() # 紙幣の枚数 ans = 0 # 繰り上げ発生時に変更 flag = False for i in range(len(N) - 1, 0, -1): # 繰り上げしない場合 if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i -...
false
21.621622
[ "-# 不変", "+# たこ焼き器の価値", "-# 計算用", "-Ncopy = N.copy()", "-ans = 0", "-# 繰り上げ発生時に変更", "-flag = False", "-for i in range(len(N) - 1, 0, -1):", "- if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i - 1] <= 4):", "- ans += Ncopy[i]", "- flag = False", "- else:", "- Ncopy[i - ...
false
0.041189
0.041603
0.990071
[ "s632627878", "s559141673" ]
u135389999
p02684
python
s661834053
s140444618
136
122
32,416
32,376
Accepted
Accepted
10.29
n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) cheak = [0] * (2*(10**5) + 1) point = 1 dev = [1] flag = 0 for i in range(1, k + 1): if cheak[point]: loop = i -cheak[point] pre_loop = cheak[point] flag = 1 break else: ...
n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) cheak = [0] * (2*(10**5) + 1) point = 1 dev = [1] flag = 0 for i in range(1, k + 1): if cheak[point]: loop = i -cheak[point] pre_loop = cheak[point] flag = 1 break else: ...
29
29
530
532
n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) cheak = [0] * (2 * (10**5) + 1) point = 1 dev = [1] flag = 0 for i in range(1, k + 1): if cheak[point]: loop = i - cheak[point] pre_loop = cheak[point] flag = 1 break else: cheak[point] = i ...
n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) cheak = [0] * (2 * (10**5) + 1) point = 1 dev = [1] flag = 0 for i in range(1, k + 1): if cheak[point]: loop = i - cheak[point] pre_loop = cheak[point] flag = 1 break else: cheak[point] = i ...
false
0
[ "- dev.append(point)", "+ # dev.append(point)", "- dev.append(point)", "+ # dev.append(point)" ]
false
0.041931
0.042438
0.988053
[ "s661834053", "s140444618" ]
u940139461
p02900
python
s813382916
s021313805
204
175
41,960
38,512
Accepted
Accepted
14.22
import sys input = sys.stdin.readline # int(input()) # 入力が1つ a, b = list(map(int, input().split())) # 入力が複数 # [int(i) for i in input().split()] # 配列で数字 # 公約数の中から、素数を選べばいいのかな。 def is_prime(num): if num == 2: return True if num < 2 or num % 2 == 0: return False sqrt_num = num **...
# https://atcoder.jp/contests/abc142/tasks/abc142_d def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.appe...
42
29
798
543
import sys input = sys.stdin.readline # int(input()) # 入力が1つ a, b = list(map(int, input().split())) # 入力が複数 # [int(i) for i in input().split()] # 配列で数字 # 公約数の中から、素数を選べばいいのかな。 def is_prime(num): if num == 2: return True if num < 2 or num % 2 == 0: return False sqrt_num = num**0.5 i = 2 ...
# https://atcoder.jp/contests/abc142/tasks/abc142_d def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) retu...
false
30.952381
[ "-import sys", "-", "-input = sys.stdin.readline", "-# int(input()) # 入力が1つ", "-a, b = list(map(int, input().split())) # 入力が複数", "-# [int(i) for i in input().split()] # 配列で数字", "-# 公約数の中から、素数を選べばいいのかな。", "-def is_prime(num):", "- if num == 2:", "- return True", "- if num < 2 or num...
false
0.041859
0.043509
0.962063
[ "s813382916", "s021313805" ]
u924276527
p02726
python
s229562623
s794056655
286
230
47,580
43,372
Accepted
Accepted
19.58
n, a1, a2 = list(map(int, input().split(" "))) anscount = [0 for i in range(n + 1)] for i in range(1, n): for j in range(i + 1, n + 1): anscount[min(abs(j - i), abs(i - a1) + abs(j - a2) + 1, abs(i - a2) + abs(j - a1) + 1)] += 1 for i in range(1, n): print((anscount[i]))
n, a1, a2 = list(map(int, input().split(" "))) print(n) wa = a2 - a1 + 1 l1 = a1 - 1 l2 = n - a2 hwa = wa // 2 pari = wa % 2 # print(wa,l1,l2,hwa,pari) tmp = 0 for i in range(2, n): if l1 + l2 + 1 >= i: tmp += l1 + l2 - i + 2 if i - 1 <= l1: tmp -= 1 if i - 1 <= l2: ...
9
43
289
1,072
n, a1, a2 = list(map(int, input().split(" "))) anscount = [0 for i in range(n + 1)] for i in range(1, n): for j in range(i + 1, n + 1): anscount[ min( abs(j - i), abs(i - a1) + abs(j - a2) + 1, abs(i - a2) + abs(j - a1) + 1 ) ] += 1 for i in range(1, n): p...
n, a1, a2 = list(map(int, input().split(" "))) print(n) wa = a2 - a1 + 1 l1 = a1 - 1 l2 = n - a2 hwa = wa // 2 pari = wa % 2 # print(wa,l1,l2,hwa,pari) tmp = 0 for i in range(2, n): if l1 + l2 + 1 >= i: tmp += l1 + l2 - i + 2 if i - 1 <= l1: tmp -= 1 if i - 1 <= l2: tmp -= 1 # pr...
false
79.069767
[ "-anscount = [0 for i in range(n + 1)]", "-for i in range(1, n):", "- for j in range(i + 1, n + 1):", "- anscount[", "- min(", "- abs(j - i), abs(i - a1) + abs(j - a2) + 1, abs(i - a2) + abs(j - a1) + 1", "- )", "- ] += 1", "-for i in range(1, n)...
false
0.039376
0.07397
0.532322
[ "s229562623", "s794056655" ]
u926046014
p02971
python
s745065405
s319482024
486
300
12,532
90,380
Accepted
Accepted
38.27
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] m = max(a) count = a.count(m) if count != 1: for i in range(n): print(m) else: switch = 0 for i in range(n-1): if a[i] == m: a.remove(m) m2max = max(a) print(m2max) ...
n=int(eval(input())) s=[int(eval(input())) for _ in range(n)] lst=sorted(s,reverse=True) max1=lst[0] max2=lst[1] for i in range(n): if s[i]==max1: print(max2) else: print(max1)
28
10
510
197
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] m = max(a) count = a.count(m) if count != 1: for i in range(n): print(m) else: switch = 0 for i in range(n - 1): if a[i] == m: a.remove(m) m2max = max(a) print(m2max) a.append(m)...
n = int(eval(input())) s = [int(eval(input())) for _ in range(n)] lst = sorted(s, reverse=True) max1 = lst[0] max2 = lst[1] for i in range(n): if s[i] == max1: print(max2) else: print(max1)
false
64.285714
[ "-a = [int(eval(input())) for i in range(n)]", "-m = max(a)", "-count = a.count(m)", "-if count != 1:", "- for i in range(n):", "- print(m)", "-else:", "- switch = 0", "- for i in range(n - 1):", "- if a[i] == m:", "- a.remove(m)", "- m2max = max(a)...
false
0.043122
0.034579
1.247057
[ "s745065405", "s319482024" ]
u373274281
p03088
python
s099277559
s812834186
190
145
6,164
6,488
Accepted
Accepted
23.68
N = int(eval(input())) MOD = 10 ** 9 + 7 C = 'ACGT' dp = [{} for _ in range(N+1)] def ok(l4): if (l4[0:3] in ['AGC', 'GAC', 'ACG'] or l4[1:4] in ['AGC', 'GAC', 'ACG'] or l4[0:1] + l4[2:4] == 'AGC' or l4[0:2] + l4[3:4] == 'AGC'): return False else: return True for c1 in C:...
import sys N = int(eval(input())) MOD = 10**9+7 ACGT = ['A', 'C', 'G', 'T'] # ?AGC # ?GAC # ?ACG # A?GC # AG?C def ok(l4): l3 = l4[1:4] if l3 == 'AGC' or l3 =='GAC' or l3 == 'ACG': return False if l4[0] == 'A' and l4[2:4] == 'GC': return False if l4[0:2] == 'AG' and l4[3] == 'C': r...
37
42
786
835
N = int(eval(input())) MOD = 10**9 + 7 C = "ACGT" dp = [{} for _ in range(N + 1)] def ok(l4): if ( l4[0:3] in ["AGC", "GAC", "ACG"] or l4[1:4] in ["AGC", "GAC", "ACG"] or l4[0:1] + l4[2:4] == "AGC" or l4[0:2] + l4[3:4] == "AGC" ): return False else: return T...
import sys N = int(eval(input())) MOD = 10**9 + 7 ACGT = ["A", "C", "G", "T"] # ?AGC # ?GAC # ?ACG # A?GC # AG?C def ok(l4): l3 = l4[1:4] if l3 == "AGC" or l3 == "GAC" or l3 == "ACG": return False if l4[0] == "A" and l4[2:4] == "GC": return False if l4[0:2] == "AG" and l4[3] == "C": ...
false
11.904762
[ "+import sys", "+", "-C = \"ACGT\"", "-dp = [{} for _ in range(N + 1)]", "+ACGT = [\"A\", \"C\", \"G\", \"T\"]", "+# ?AGC", "+# ?GAC", "+# ?ACG", "+# A?GC", "+# AG?C", "+def ok(l4):", "+ l3 = l4[1:4]", "+ if l3 == \"AGC\" or l3 == \"GAC\" or l3 == \"ACG\":", "+ return False", ...
false
0.226696
0.081738
2.773446
[ "s099277559", "s812834186" ]
u104005543
p02783
python
s452642100
s996486378
20
17
2,940
2,940
Accepted
Accepted
15
h, a = list(map(int, input().split())) ans = h // a if h % a != 0: ans += 1 print(ans)
h, a = list(map(int, input().split())) print((-1 * (-1 * h // a)))
6
2
90
59
h, a = list(map(int, input().split())) ans = h // a if h % a != 0: ans += 1 print(ans)
h, a = list(map(int, input().split())) print((-1 * (-1 * h // a)))
false
66.666667
[ "-ans = h // a", "-if h % a != 0:", "- ans += 1", "-print(ans)", "+print((-1 * (-1 * h // a)))" ]
false
0.049653
0.065886
0.753619
[ "s452642100", "s996486378" ]
u690536347
p03347
python
s726732179
s385613404
829
395
59,364
12,588
Accepted
Accepted
52.35
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)][::-1] if A[-1] != 0: print((-1)) else: bef = A[0] c, ans = 0, 0 for i in A: if bef!=i: if bef-i > 1: print((-1)) break ans += bef*c c = 1 if bef<i ...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)][::-1] if A[-1]: print((-1)) else: bef = A[0] c, ans = 0, 0 for i in A: if bef!=i: if bef-i > 1: ans = -1 break ans += bef*c c = 1 if bef<i else 0 ...
20
19
393
372
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)][::-1] if A[-1] != 0: print((-1)) else: bef = A[0] c, ans = 0, 0 for i in A: if bef != i: if bef - i > 1: print((-1)) break ans += bef * c c = 1 if bef < i else 0 ...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)][::-1] if A[-1]: print((-1)) else: bef = A[0] c, ans = 0, 0 for i in A: if bef != i: if bef - i > 1: ans = -1 break ans += bef * c c = 1 if bef < i else 0 ...
false
5
[ "-if A[-1] != 0:", "+if A[-1]:", "- print((-1))", "+ ans = -1", "- else:", "- print(ans)", "+ print(ans)" ]
false
0.038576
0.043714
0.882456
[ "s726732179", "s385613404" ]
u941645670
p02614
python
s033188867
s709558332
127
84
9,236
9,212
Accepted
Accepted
33.86
#c h, w, k=list(map(int, input().split())) s = [eval(input()) for i in range(h)] def get_unique_list(seq): seen = [] return [x for x in seq if x not in seen and not seen.append(x)] ans = 0 count = 0 for i in range(h): count += s[i].count("#") for i in range(2 ** (h+w)): bag = [] for ...
h, w, k = list(map(int, input().split())) s = [eval(input()) for i in range(h)] ans = 0 for i in range(2 ** (h)): for j in range(2 ** (w)): bag = 0 sharp = 0 for l in range(h): for m in range(w): if s[l][m] == "#": ...
32
22
800
558
# c h, w, k = list(map(int, input().split())) s = [eval(input()) for i in range(h)] def get_unique_list(seq): seen = [] return [x for x in seq if x not in seen and not seen.append(x)] ans = 0 count = 0 for i in range(h): count += s[i].count("#") for i in range(2 ** (h + w)): bag = [] for j in ra...
h, w, k = list(map(int, input().split())) s = [eval(input()) for i in range(h)] ans = 0 for i in range(2 ** (h)): for j in range(2 ** (w)): bag = 0 sharp = 0 for l in range(h): for m in range(w): if s[l][m] == "#": sharp += 1 if...
false
31.25
[ "-# c", "-", "-", "-def get_unique_list(seq):", "- seen = []", "- return [x for x in seq if x not in seen and not seen.append(x)]", "-", "-", "-count = 0", "-for i in range(h):", "- count += s[i].count(\"#\")", "-for i in range(2 ** (h + w)):", "- bag = []", "- for j in rang...
false
0.120787
0.047413
2.547566
[ "s033188867", "s709558332" ]
u173148629
p02727
python
s623057089
s829911204
315
234
23,388
23,328
Accepted
Accepted
25.71
X,Y,A,B,C=list(map(int,input().split())) p=list(map(int,input().split())) q=list(map(int,input().split())) r=list(map(int,input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) tot=sum(p[:X])+sum(q[:Y]) a=0 b=0 for i in r: if a==X and b==Y: break elif a==X: ...
X,Y,A,B,C=list(map(int,input().split())) p=list(map(int,input().split())) q=list(map(int,input().split())) r=list(map(int,input().split())) p.sort(reverse=True) q.sort(reverse=True) p=p[:X] q=q[:Y] z=p+q+r z.sort(reverse=True) tot=sum(z[:X+Y]) print(tot)
48
20
951
276
X, Y, A, B, C = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) tot = sum(p[:X]) + sum(q[:Y]) a = 0 b = 0 for i in r: if a == X and b == Y: break eli...
X, Y, A, B, C = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) p = p[:X] q = q[:Y] z = p + q + r z.sort(reverse=True) tot = sum(z[: X + Y]) print(tot)
false
58.333333
[ "-r.sort(reverse=True)", "-tot = sum(p[:X]) + sum(q[:Y])", "-a = 0", "-b = 0", "-for i in r:", "- if a == X and b == Y:", "- break", "- elif a == X:", "- if i > q[Y - b - 1]:", "- tot += i - q[Y - b - 1]", "- b += 1", "- else:", "- ...
false
0.044878
0.161693
0.277547
[ "s623057089", "s829911204" ]
u475503988
p03074
python
s277201858
s580062548
151
130
4,092
7,884
Accepted
Accepted
13.91
N, K = list(map(int, input().split())) S = eval(input()) Nums = [] now = 1 # 今見ている数 cnt = 0 # nowがいくつ並んでいるか for i in range(N): if S[i] == str(now): cnt += 1 else: Nums.append(cnt) now = 1 - now # 0と1を切り替えるときの計算 now ^= 1 cnt = 1 if cnt != 0: Nums.append(cnt) # ...
N, K = list(map(int, input().split())) S = eval(input()) Nums = [] now = 1 # 今見ている数 cnt = 0 # nowがいくつ並んでいるか for i in range(N): if S[i] == str(now): cnt += 1 else: Nums.append(cnt) now = 1 - now # 0と1を切り替えるときの計算 now ^= 1 cnt = 1 if cnt != 0: Nums.append(cnt) # ...
41
36
895
805
N, K = list(map(int, input().split())) S = eval(input()) Nums = [] now = 1 # 今見ている数 cnt = 0 # nowがいくつ並んでいるか for i in range(N): if S[i] == str(now): cnt += 1 else: Nums.append(cnt) now = 1 - now # 0と1を切り替えるときの計算 now ^= 1 cnt = 1 if cnt != 0: Nums.append(cnt) # 1-0-1-0-1-0-1...
N, K = list(map(int, input().split())) S = eval(input()) Nums = [] now = 1 # 今見ている数 cnt = 0 # nowがいくつ並んでいるか for i in range(N): if S[i] == str(now): cnt += 1 else: Nums.append(cnt) now = 1 - now # 0と1を切り替えるときの計算 now ^= 1 cnt = 1 if cnt != 0: Nums.append(cnt) # 1-0-1-0-1-0-1...
false
12.195122
[ "+# 累積和を作る", "+# 0 1 2 3 4 5 6", "+# 0 1 2 3 4 5", "+sum = [0] * (len(Nums) + 1)", "+for i in range(len(Nums)):", "+ sum[i + 1] = sum[i] + Nums[i]", "-# 尺取り法 forループの外側にleft, rightを持つ", "-left = 0", "-right = 0", "-tmp = 0 # [left, right)のsum", "- # 次のleft, rightを計算する", "- Nextleft =...
false
0.042299
0.04329
0.977109
[ "s277201858", "s580062548" ]