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
u426534722
p02249
python
s403110051
s756174700
1,780
1,490
92,000
92,016
Accepted
Accepted
16.29
base1 = 1009 base2 = 1013 mask = (1 << 32) - 1 def calc_hash(f, r, c): global ph, pw, h tmp = [[0] * c for _ in range(r)] dr, dc = r - ph, c - pw t1 = 1 for _ in range(pw): t1 = (t1 * base1) & mask for i in range(r): e = 0 for j in range(pw): e = ...
base1 = 1009 base2 = 1013 mask = (1 << 32) - 1 def calc_hash(f, r, c): global ph, pw, h tmp = [[0] * c for _ in range(r)] dr, dc = r - ph, c - pw t1 = 1 for _ in range(pw): t1 = (t1 * base1) & mask for i in range(r): e = 0 for j in range(pw): e = ...
43
45
1,297
1,363
base1 = 1009 base2 = 1013 mask = (1 << 32) - 1 def calc_hash(f, r, c): global ph, pw, h tmp = [[0] * c for _ in range(r)] dr, dc = r - ph, c - pw t1 = 1 for _ in range(pw): t1 = (t1 * base1) & mask for i in range(r): e = 0 for j in range(pw): e = e * base1 +...
base1 = 1009 base2 = 1013 mask = (1 << 32) - 1 def calc_hash(f, r, c): global ph, pw, h tmp = [[0] * c for _ in range(r)] dr, dc = r - ph, c - pw t1 = 1 for _ in range(pw): t1 = (t1 * base1) & mask for i in range(r): e = 0 for j in range(pw): e = e * base1 +...
false
4.444444
[ "+ans = []", "- print((i, j))", "+ ans.append(f\"{i} {j}\")", "+if ans:", "+ print((\"\\n\".join(a for a in ans)))" ]
false
0.051315
0.041935
1.223674
[ "s403110051", "s756174700" ]
u669696235
p02688
python
s165594743
s524206418
22
20
9,188
9,172
Accepted
Accepted
9.09
N,K=list(map(int,input().split())) hoge=[0 for j in range(N)] for j in range(K): eval(input()) for i in input().split(): hoge[int(i)-1]+=1 print((sum([j==0 for j in hoge])))
N,K=list(map(int,input().split())) hoge={} for j in range(K): eval(input()) [hoge.update({int(j)-1:1}) for j in input().split()] print((sum([not j in hoge for j in range(N)])))
8
6
184
176
N, K = list(map(int, input().split())) hoge = [0 for j in range(N)] for j in range(K): eval(input()) for i in input().split(): hoge[int(i) - 1] += 1 print((sum([j == 0 for j in hoge])))
N, K = list(map(int, input().split())) hoge = {} for j in range(K): eval(input()) [hoge.update({int(j) - 1: 1}) for j in input().split()] print((sum([not j in hoge for j in range(N)])))
false
25
[ "-hoge = [0 for j in range(N)]", "+hoge = {}", "- for i in input().split():", "- hoge[int(i) - 1] += 1", "-print((sum([j == 0 for j in hoge])))", "+ [hoge.update({int(j) - 1: 1}) for j in input().split()]", "+print((sum([not j in hoge for j in range(N)])))" ]
false
0.033296
0.035707
0.93247
[ "s165594743", "s524206418" ]
u633068244
p00086
python
s407539577
s770789272
20
10
4,216
4,216
Accepted
Accepted
50
while True: try: path = [0]*101 while True: a,b = list(map(int, input().split())) if a == 0: break path[a-1] += 1; path[b-1] += 1 for i in range(3,101): if path[i]%2 != 0: flag = 0 break else: flag = 1 if path[0]%2 == path[1]%2 == 1 and flag: print("OK") else: ...
while True: try: path = [0]*100 while True: a,b = list(map(int, input().split())) if a == 0: break path[a-1] += 1; path[b-1] += 1 if path[0]%2 == path[1]%2 == 1 and sum([x for x in path[2:] if x%2==1]) == 0: print("OK") else: print("NG") except: break
19
13
352
293
while True: try: path = [0] * 101 while True: a, b = list(map(int, input().split())) if a == 0: break path[a - 1] += 1 path[b - 1] += 1 for i in range(3, 101): if path[i] % 2 != 0: flag = 0 ...
while True: try: path = [0] * 100 while True: a, b = list(map(int, input().split())) if a == 0: break path[a - 1] += 1 path[b - 1] += 1 if ( path[0] % 2 == path[1] % 2 == 1 and sum([x for x in path[2:] if...
false
31.578947
[ "- path = [0] * 101", "+ path = [0] * 100", "- for i in range(3, 101):", "- if path[i] % 2 != 0:", "- flag = 0", "- break", "- else:", "- flag = 1", "- if path[0] % 2 == path[1] % 2 == 1 and flag:", "+ if...
false
0.045754
0.04644
0.985241
[ "s407539577", "s770789272" ]
u278886389
p03854
python
s332329927
s394578057
232
191
6,952
7,576
Accepted
Accepted
17.67
from collections import deque S = eval(input()) l = len(S) a = list(map(list,['dream','dreamer','erase','eraser'])) q = deque() q.append(["",0]) while len(q): b,i = q.pop() if i == l: print('YES') exit() x = 0 f = True for B in b: if i+x >= l or S[i+x] != ...
from collections import deque S = list(eval(input())) S.reverse() l = len(S) def rev(x): x = list(x) x.reverse() return x a = list(map(rev,['dream','dreamer','erase','eraser'])) q = deque() q.append(["",0]) while len(q): b,i = q.pop() if i == l: print('YES') ex...
25
31
434
515
from collections import deque S = eval(input()) l = len(S) a = list(map(list, ["dream", "dreamer", "erase", "eraser"])) q = deque() q.append(["", 0]) while len(q): b, i = q.pop() if i == l: print("YES") exit() x = 0 f = True for B in b: if i + x >= l or S[i + x] != B: ...
from collections import deque S = list(eval(input())) S.reverse() l = len(S) def rev(x): x = list(x) x.reverse() return x a = list(map(rev, ["dream", "dreamer", "erase", "eraser"])) q = deque() q.append(["", 0]) while len(q): b, i = q.pop() if i == l: print("YES") exit() x =...
false
19.354839
[ "-S = eval(input())", "+S = list(eval(input()))", "+S.reverse()", "-a = list(map(list, [\"dream\", \"dreamer\", \"erase\", \"eraser\"]))", "+", "+", "+def rev(x):", "+ x = list(x)", "+ x.reverse()", "+ return x", "+", "+", "+a = list(map(rev, [\"dream\", \"dreamer\", \"erase\", \"er...
false
0.046474
0.045853
1.013526
[ "s332329927", "s394578057" ]
u928784113
p03059
python
s072126164
s427478077
19
17
2,940
2,940
Accepted
Accepted
10.53
A,B,T = list(map(int,input().split())) print((B*(T//A)))
A,B,T = list(map(int,input().split())) print(((T//A)*B))
2
2
49
49
A, B, T = list(map(int, input().split())) print((B * (T // A)))
A, B, T = list(map(int, input().split())) print(((T // A) * B))
false
0
[ "-print((B * (T // A)))", "+print(((T // A) * B))" ]
false
0.063405
0.062521
1.014151
[ "s072126164", "s427478077" ]
u790710233
p02683
python
s308258827
s095104592
81
35
9,228
9,240
Accepted
Accepted
56.79
n, m, x = list(map(int, input().split())) ca = [tuple(map(int, input().split()))for _ in range(n)] INF = 10**18 ans = INF for bit in range(1 << n): cost = 0 proficiency = [0]*m for i in range(n): if bit >> i & 1: c, *A = ca[i] cost += c for j in range(m...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m, x = list(map(int, input().split())) ca = [tuple(map(int, input().split()))for _ in range(n)] INF = 10**18 ans = INF proficiency = [0]*m def dfs(i, cost): if i == n: global ans if cost < ans and all(x <= proficien...
16
28
476
604
n, m, x = list(map(int, input().split())) ca = [tuple(map(int, input().split())) for _ in range(n)] INF = 10**18 ans = INF for bit in range(1 << n): cost = 0 proficiency = [0] * m for i in range(n): if bit >> i & 1: c, *A = ca[i] cost += c for j in range(m): ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m, x = list(map(int, input().split())) ca = [tuple(map(int, input().split())) for _ in range(n)] INF = 10**18 ans = INF proficiency = [0] * m def dfs(i, cost): if i == n: global ans if cost < ans and all(x <= proficiency[j] for...
false
42.857143
[ "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**7)", "-for bit in range(1 << n):", "- cost = 0", "- proficiency = [0] * m", "- for i in range(n):", "- if bit >> i & 1:", "- c, *A = ca[i]", "- cost += c", "- for j i...
false
0.039435
0.03835
1.028298
[ "s308258827", "s095104592" ]
u821969418
p02629
python
s620108843
s573018809
32
28
9,112
9,136
Accepted
Accepted
12.5
def alpha2num(alpha): num=0 for index, item in enumerate(list(alpha)): num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1) return num def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: ret...
n=int(eval(input())) chars = "Xabcdefghijklmnopqrstuvwxyz" n_rem = n ans = "" while True: x = n_rem%26 if x == 0: x = 26 ans += chars[x] n_rem -= x if n_rem == 0: break n_rem //=26 print((ans[::-1]))
18
20
413
257
def alpha2num(alpha): num = 0 for index, item in enumerate(list(alpha)): num += pow(26, len(alpha) - index - 1) * (ord(item) - ord("A") + 1) return num def num2alpha(num): if num <= 26: return chr(64 + num) elif num % 26 == 0: return num2alpha(num // 26 - 1) + chr(90) e...
n = int(eval(input())) chars = "Xabcdefghijklmnopqrstuvwxyz" n_rem = n ans = "" while True: x = n_rem % 26 if x == 0: x = 26 ans += chars[x] n_rem -= x if n_rem == 0: break n_rem //= 26 print((ans[::-1]))
false
10
[ "-def alpha2num(alpha):", "- num = 0", "- for index, item in enumerate(list(alpha)):", "- num += pow(26, len(alpha) - index - 1) * (ord(item) - ord(\"A\") + 1)", "- return num", "-", "-", "-def num2alpha(num):", "- if num <= 26:", "- return chr(64 + num)", "- elif nu...
false
0.03562
0.036258
0.982406
[ "s620108843", "s573018809" ]
u923662841
p03722
python
s832138076
s489273917
875
478
9,276
9,976
Accepted
Accepted
45.37
N,M = list(map(int,input().split())) ABC = [tuple(map(int,input().split())) for i in range(M)] INF = float('inf') dist = [INF] * N dist[0] = 0 for i in range(N): for a,b,c in ABC: a,b,c = a-1,b-1,-c if dist[b] > dist[a] + c: dist[b] = dist[a] + c if i==N-1 and b =...
from collections import deque N,M = list(map(int,input().split())) ABC = [] Adake = [[] for _ in range(N)] Bdake = [[] for _ in range(N)] for i in range(M): a,b,c = list(map(int, input().split())) ABC.append((a-1,b-1,-c)) Adake[a-1].append(b-1) Bdake[b-1].append(a-1) def dfs(X,s): use...
15
38
392
913
N, M = list(map(int, input().split())) ABC = [tuple(map(int, input().split())) for i in range(M)] INF = float("inf") dist = [INF] * N dist[0] = 0 for i in range(N): for a, b, c in ABC: a, b, c = a - 1, b - 1, -c if dist[b] > dist[a] + c: dist[b] = dist[a] + c if i == N - 1 an...
from collections import deque N, M = list(map(int, input().split())) ABC = [] Adake = [[] for _ in range(N)] Bdake = [[] for _ in range(N)] for i in range(M): a, b, c = list(map(int, input().split())) ABC.append((a - 1, b - 1, -c)) Adake[a - 1].append(b - 1) Bdake[b - 1].append(a - 1) def dfs(X, s): ...
false
60.526316
[ "+from collections import deque", "+", "-ABC = [tuple(map(int, input().split())) for i in range(M)]", "+ABC = []", "+Adake = [[] for _ in range(N)]", "+Bdake = [[] for _ in range(N)]", "+for i in range(M):", "+ a, b, c = list(map(int, input().split()))", "+ ABC.append((a - 1, b - 1, -c))", "...
false
0.050858
0.040533
1.254719
[ "s832138076", "s489273917" ]
u021019433
p02837
python
s927963697
s236407742
62
56
3,188
3,064
Accepted
Accepted
9.68
from itertools import combinations n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1].issubset(x) for i in x) ...
from itertools import combinations n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x) while...
15
15
361
363
from itertools import combinations n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1].issubset(x) for i in x) w...
from itertools import combinations n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x) while all...
false
0
[ "-fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1].issubset(x) for i in x)", "-while all(map(fail, combinations(r, n))):", "+fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)", "+while all(map(fail, list(map(set, combinations(r, n))))):" ]
false
0.036541
0.036482
1.001616
[ "s927963697", "s236407742" ]
u729133443
p03545
python
s601578071
s009342497
165
17
38,384
2,940
Accepted
Accepted
89.7
a,b,c,d=eval(input()) o='+-' for i in o: for j in o: for k in o: s=a+i+b+j+c+k+d if eval(s)==7: print((s+'=7')) exit()
a,b,c,d=eval(input()) o='+-' for i in range(8): s=a+o[i&1]+b+o[i&2>0]+c+o[i&4>0]+d if eval(s)==7:print((s+'=7'));exit()
9
5
186
117
a, b, c, d = eval(input()) o = "+-" for i in o: for j in o: for k in o: s = a + i + b + j + c + k + d if eval(s) == 7: print((s + "=7")) exit()
a, b, c, d = eval(input()) o = "+-" for i in range(8): s = a + o[i & 1] + b + o[i & 2 > 0] + c + o[i & 4 > 0] + d if eval(s) == 7: print((s + "=7")) exit()
false
44.444444
[ "-for i in o:", "- for j in o:", "- for k in o:", "- s = a + i + b + j + c + k + d", "- if eval(s) == 7:", "- print((s + \"=7\"))", "- exit()", "+for i in range(8):", "+ s = a + o[i & 1] + b + o[i & 2 > 0] + c + o[i & 4 > 0] + d", "+...
false
0.085246
0.034705
2.456314
[ "s601578071", "s009342497" ]
u145035045
p03361
python
s272884099
s557513759
21
18
4,724
3,064
Accepted
Accepted
14.29
import sys sys.setrecursionlimit(100000) h,w = list(map(int,input().split())) lst = [] for i in range(h): lst.append([s for s in eval(input())]) def dfs(x,y): if lst[x][y] == '#': lst[x][y] = '.' if x + 1 <= h - 1: dfs(x + 1,y) if x - 1 >= 0: dfs(x - 1,y) if y + 1 <= w - 1: ...
h,w = list(map(int,input().split())) lst = ["." * (w + 2)] for _ in range(h): s = eval(input()) s = "." + s + "." lst.append(s) lst.append("." * (w + 2)) flag = True for x in range(1,h + 1): for y in range(1,w + 1): if lst[x][y] == "#": if lst[x - 1][y] == "." and lst[x + 1][y] == "." a...
30
22
736
447
import sys sys.setrecursionlimit(100000) h, w = list(map(int, input().split())) lst = [] for i in range(h): lst.append([s for s in eval(input())]) def dfs(x, y): if lst[x][y] == "#": lst[x][y] = "." if x + 1 <= h - 1: dfs(x + 1, y) if x - 1 >= 0: dfs(x - 1, y) ...
h, w = list(map(int, input().split())) lst = ["." * (w + 2)] for _ in range(h): s = eval(input()) s = "." + s + "." lst.append(s) lst.append("." * (w + 2)) flag = True for x in range(1, h + 1): for y in range(1, w + 1): if lst[x][y] == "#": if ( lst[x - 1][y] == "." ...
false
26.666667
[ "-import sys", "-", "-sys.setrecursionlimit(100000)", "-lst = []", "-for i in range(h):", "- lst.append([s for s in eval(input())])", "-", "-", "-def dfs(x, y):", "- if lst[x][y] == \"#\":", "- lst[x][y] = \".\"", "- if x + 1 <= h - 1:", "- dfs(x + 1, y)", "-...
false
0.103075
0.100624
1.024363
[ "s272884099", "s557513759" ]
u814166125
p03610
python
s113914966
s570886879
38
17
3,956
3,188
Accepted
Accepted
55.26
# -*- coding: utf-8 -*- s = eval(input()) sList = list(s) output = "" for i in range(len(sList)): if i%2 == 0: output += sList[i] print(output)
s = eval(input()) print((s[::2]))
14
3
184
29
# -*- coding: utf-8 -*- s = eval(input()) sList = list(s) output = "" for i in range(len(sList)): if i % 2 == 0: output += sList[i] print(output)
s = eval(input()) print((s[::2]))
false
78.571429
[ "-# -*- coding: utf-8 -*-", "-sList = list(s)", "-output = \"\"", "-for i in range(len(sList)):", "- if i % 2 == 0:", "- output += sList[i]", "-print(output)", "+print((s[::2]))" ]
false
0.0466
0.117277
0.397355
[ "s113914966", "s570886879" ]
u054514819
p02708
python
s275080834
s951732731
157
71
9,200
83,176
Accepted
Accepted
54.78
N, K = list(map(int, input().split())) N += 1 mod = 10**9+7 ans = 0 for i in range(N+1-K): nowk = K+i min_k = nowk*(nowk-1)//2 max_k = (2*N-nowk-1)*nowk//2 ans += (max_k-min_k+1)%mod ans %= mod print(ans)
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, K = mapint() mod = 10**9+7 from itertools import accumulate lis = list(accumulate([0]+[i for i in range(N+1)])) ans = 0 for k in range(K, N+2): MIN = lis[k] ...
12
16
230
392
N, K = list(map(int, input().split())) N += 1 mod = 10**9 + 7 ans = 0 for i in range(N + 1 - K): nowk = K + i min_k = nowk * (nowk - 1) // 2 max_k = (2 * N - nowk - 1) * nowk // 2 ans += (max_k - min_k + 1) % mod ans %= mod print(ans)
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, K = mapint() mod = 10**9 + 7 from itertools import accumulate lis = list(accumulate([0] + [i for i in range(N + 1)])) ans = 0 for k in range(K, N + 2): MIN ...
false
25
[ "-N, K = list(map(int, input().split()))", "-N += 1", "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+def mapint():", "+ return list(map(int, input().split()))", "+", "+", "+sys.setrecursionlimit(10**9)", "+N, K = mapint()", "+from i...
false
0.082644
0.085272
0.969184
[ "s275080834", "s951732731" ]
u561231954
p03014
python
s496234402
s317588053
1,893
935
306,952
251,044
Accepted
Accepted
50.61
h,w=list(map(int,input().split())) grid=[list(eval(input())) for i in range(h)] left=[[0]*w for _ in range(h)] for i in range(h): cnt=0 for j in range(w): if grid[i][j]=='.': cnt+=1 left[i][j]=cnt else: cnt=0 left[i][j]=cnt right=[[0]*w for _ in range(h)] for i...
def main(): import numpy as np h,w=list(map(int,input().split())) grid=np.array([list(eval(input())) for i in range(h)]) grid=np.where(grid=='.',1,0) left=np.zeros((h,w),dtype=np.int64) right=np.zeros((h,w),dtype=np.int64) up=np.zeros((h,w),dtype=np.int64) down=np.zeros((h,w),dtype=np.in...
58
22
1,084
603
h, w = list(map(int, input().split())) grid = [list(eval(input())) for i in range(h)] left = [[0] * w for _ in range(h)] for i in range(h): cnt = 0 for j in range(w): if grid[i][j] == ".": cnt += 1 left[i][j] = cnt else: cnt = 0 left[i][j] = cnt ri...
def main(): import numpy as np h, w = list(map(int, input().split())) grid = np.array([list(eval(input())) for i in range(h)]) grid = np.where(grid == ".", 1, 0) left = np.zeros((h, w), dtype=np.int64) right = np.zeros((h, w), dtype=np.int64) up = np.zeros((h, w), dtype=np.int64) down =...
false
62.068966
[ "-h, w = list(map(int, input().split()))", "-grid = [list(eval(input())) for i in range(h)]", "-left = [[0] * w for _ in range(h)]", "-for i in range(h):", "- cnt = 0", "- for j in range(w):", "- if grid[i][j] == \".\":", "- cnt += 1", "- left[i][j] = cnt", "- ...
false
0.04263
0.259317
0.164392
[ "s496234402", "s317588053" ]
u905203728
p03476
python
s643859784
s016946456
1,975
813
4,576
72,920
Accepted
Accepted
58.84
def prime(n): is_prime=[True]*(n+1) is_prime[0],is_prime[1]=False,False for i in range(2,int(n**0.5)+1): if not is_prime[i]:continue for j in range(i*2,n+1,i): is_prime[j]=False return [i for i in range(n+1) if is_prime[i]] prime_number=prime(10**5) number=[i for i...
def prime(n): is_prime=[True]*(n+1) is_prime[0],is_prime[1]=False,False for i in range(2,int(n**0.5)+1): if not is_prime[i]:continue for j in range(i*2,n+1,i): is_prime[j]=False return [i for i in range(n+1) if is_prime[i]] q=int(eval(input())) LR=[list(map(int,i...
23
24
606
550
def prime(n): is_prime = [True] * (n + 1) is_prime[0], is_prime[1] = False, False for i in range(2, int(n**0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False return [i for i in range(n + 1) if is_prime[i]] prime_number =...
def prime(n): is_prime = [True] * (n + 1) is_prime[0], is_prime[1] = False, False for i in range(2, int(n**0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False return [i for i in range(n + 1) if is_prime[i]] q = int(eval(i...
false
4.166667
[ "-prime_number = prime(10**5)", "-number = [i for i in prime_number if (i + 1) // 2 in prime_number] + [0]", "-ans = [0] * (10**5 + 1)", "-count = 0", "-for i in range(1, 10**5):", "- ans[i] = ans[i - 1]", "- if i == number[count]:", "- ans[i] += 1", "- count += 1", "-for i in ...
false
1.121572
1.104046
1.015875
[ "s643859784", "s016946456" ]
u600195339
p02888
python
s140331051
s035365700
1,894
1,723
51,676
51,676
Accepted
Accepted
9.03
import bisect n = int(eval(input())) l = list(map(int, input().split())) l.sort() ans = 0 for i in range(n): for j in range(i+1, n): length = l[i] + l[j] index = bisect.bisect_left(l[j+1:], length) ans += index print(ans)
import bisect n = int(eval(input())) l = sorted(list(map(int, input().split()))) ans = 0 for i in range(n): for j in range(i+1, n): ans += bisect.bisect_left(l[j+1:], l[i] + l[j]) print(ans)
14
10
259
207
import bisect n = int(eval(input())) l = list(map(int, input().split())) l.sort() ans = 0 for i in range(n): for j in range(i + 1, n): length = l[i] + l[j] index = bisect.bisect_left(l[j + 1 :], length) ans += index print(ans)
import bisect n = int(eval(input())) l = sorted(list(map(int, input().split()))) ans = 0 for i in range(n): for j in range(i + 1, n): ans += bisect.bisect_left(l[j + 1 :], l[i] + l[j]) print(ans)
false
28.571429
[ "-l = list(map(int, input().split()))", "-l.sort()", "+l = sorted(list(map(int, input().split())))", "- length = l[i] + l[j]", "- index = bisect.bisect_left(l[j + 1 :], length)", "- ans += index", "+ ans += bisect.bisect_left(l[j + 1 :], l[i] + l[j])" ]
false
0.047157
0.046819
1.007222
[ "s140331051", "s035365700" ]
u970197315
p03311
python
s621941116
s712442324
261
207
26,180
30,828
Accepted
Accepted
20.69
n=int(eval(input())) b=[int(a-(i+1)) for i,a in enumerate(list(map(int,input().split())))] if n==1: print((0)) exit(0) bm=b[:] bm.sort() mid_1=bm[n//2] mid_2=bm[(n//2)+1] ans_1,ans_2=0,0 if n%2==1: for bb in b: ans_1+=abs(bb-mid_1) print(ans_1) else: for bb in b: ans_1+=abs(bb-mid_1) ...
n=int(eval(input())) a=list(map(int,input().split())) for i in range(n): a[i]-=i+1 b=a[:] b.sort() mid1=0 mid2=0 if n%2==1: ans=0 mid1=b[n//2] for bb in b: ans+=abs(bb-mid1) print(ans) else: mid1=b[n//2] mid2=b[n//2-1] ans1,ans2=0,0 for bb in b: ans1+=abs(bb-mid1) ans2+...
20
22
367
353
n = int(eval(input())) b = [int(a - (i + 1)) for i, a in enumerate(list(map(int, input().split())))] if n == 1: print((0)) exit(0) bm = b[:] bm.sort() mid_1 = bm[n // 2] mid_2 = bm[(n // 2) + 1] ans_1, ans_2 = 0, 0 if n % 2 == 1: for bb in b: ans_1 += abs(bb - mid_1) print(ans_1) else: for b...
n = int(eval(input())) a = list(map(int, input().split())) for i in range(n): a[i] -= i + 1 b = a[:] b.sort() mid1 = 0 mid2 = 0 if n % 2 == 1: ans = 0 mid1 = b[n // 2] for bb in b: ans += abs(bb - mid1) print(ans) else: mid1 = b[n // 2] mid2 = b[n // 2 - 1] ans1, ans2 = 0, 0 ...
false
9.090909
[ "-b = [int(a - (i + 1)) for i, a in enumerate(list(map(int, input().split())))]", "-if n == 1:", "- print((0))", "- exit(0)", "-bm = b[:]", "-bm.sort()", "-mid_1 = bm[n // 2]", "-mid_2 = bm[(n // 2) + 1]", "-ans_1, ans_2 = 0, 0", "+a = list(map(int, input().split()))", "+for i in range(n):...
false
0.046852
0.112866
0.415109
[ "s621941116", "s712442324" ]
u222668979
p03959
python
s739083231
s381958169
157
112
97,744
97,460
Accepted
Accepted
28.66
n = int(eval(input())) t = list(map(int, input().split())) a = list(map(int, input().split())) mod = 10 ** 9 + 7 ans, l, r = 1, 0, n - 1 for i in range(1, n): if t[i] == t[i - 1]: ans = ans * t[i] % mod if t[i] == a[i]: l = i break for i in range(n - 1)[::-1]: if a[i] =...
n = int(eval(input())) t = list(map(int, input().split())) a = list(map(int, input().split())) mod = 10 ** 9 + 7 ans = 1 if n == 1: print((int(t == a))) exit() for i in range(1, n - 1): ht, ha = 0, 0 if t[i - 1] < t[i] and a[i] > a[i + 1]: if t[i] != a[i]: print((0)) ...
23
27
549
590
n = int(eval(input())) t = list(map(int, input().split())) a = list(map(int, input().split())) mod = 10**9 + 7 ans, l, r = 1, 0, n - 1 for i in range(1, n): if t[i] == t[i - 1]: ans = ans * t[i] % mod if t[i] == a[i]: l = i break for i in range(n - 1)[::-1]: if a[i] == a[i + 1]: ...
n = int(eval(input())) t = list(map(int, input().split())) a = list(map(int, input().split())) mod = 10**9 + 7 ans = 1 if n == 1: print((int(t == a))) exit() for i in range(1, n - 1): ht, ha = 0, 0 if t[i - 1] < t[i] and a[i] > a[i + 1]: if t[i] != a[i]: print((0)) break ...
false
14.814815
[ "-ans, l, r = 1, 0, n - 1", "-for i in range(1, n):", "- if t[i] == t[i - 1]:", "- ans = ans * t[i] % mod", "- if t[i] == a[i]:", "- l = i", "- break", "-for i in range(n - 1)[::-1]:", "- if a[i] == a[i + 1]:", "- ans = ans * a[i] % mod", "- if t[i] == a[i...
false
0.088333
0.10819
0.816462
[ "s739083231", "s381958169" ]
u493520238
p03032
python
s078484134
s157324541
962
84
23,924
74,108
Accepted
Accepted
91.27
import bisect abcd = [] n, k = list(map(int, input().split())) v_list = list(map(int, input().split())) for a in range(0, k+1): for b in range(0, k+1-a): for c in range(0, k+1-a-b): d = k-a-b-c abcd.append([a,b,c,d]) ans = 0 for curr_abcd in abcd: a,b,c,d = c...
from bisect import bisect_left, bisect_right n,k = list(map(int, input().split())) vl = list(map(int, input().split())) ans = 0 for get_num in range(0,k+1): rem = k-get_num for l in range(0,get_num+1): r = get_num-l if l+r > n: continue ls = vl[:l] rs = vl[n-r:] ...
28
24
610
626
import bisect abcd = [] n, k = list(map(int, input().split())) v_list = list(map(int, input().split())) for a in range(0, k + 1): for b in range(0, k + 1 - a): for c in range(0, k + 1 - a - b): d = k - a - b - c abcd.append([a, b, c, d]) ans = 0 for curr_abcd in abcd: a, b, c, d...
from bisect import bisect_left, bisect_right n, k = list(map(int, input().split())) vl = list(map(int, input().split())) ans = 0 for get_num in range(0, k + 1): rem = k - get_num for l in range(0, get_num + 1): r = get_num - l if l + r > n: continue ls = vl[:l] rs = ...
false
14.285714
[ "-import bisect", "+from bisect import bisect_left, bisect_right", "-abcd = []", "-v_list = list(map(int, input().split()))", "-for a in range(0, k + 1):", "- for b in range(0, k + 1 - a):", "- for c in range(0, k + 1 - a - b):", "- d = k - a - b - c", "- abcd.append(...
false
0.043231
0.036218
1.193617
[ "s078484134", "s157324541" ]
u096736378
p03354
python
s009353858
s056891402
618
566
14,008
13,812
Accepted
Accepted
8.41
n,m = list(map(int, input().split())) p = list(map(int, input().split())) par = [i for i in range(n)] rank = [0 for x in range(n)] def root(x): tmp = par[x] if tmp == x: return x else: a = root(tmp) par[x] = a return a def merge(x, y): x = root(x) y = root(y) if x == y: return else...
n,m = list(map(int, input().split())) p = list(map(int, input().split())) par = [i for i in range(n)] def root(x): tmp = par[x] if tmp == x: return x else: a = root(tmp) par[x] = a return a def merge(x, y): x = root(x) y = root(y) if x != y: par[x] = y return for i in range(m): ...
41
33
631
487
n, m = list(map(int, input().split())) p = list(map(int, input().split())) par = [i for i in range(n)] rank = [0 for x in range(n)] def root(x): tmp = par[x] if tmp == x: return x else: a = root(tmp) par[x] = a return a def merge(x, y): x = root(x) y = root(y) ...
n, m = list(map(int, input().split())) p = list(map(int, input().split())) par = [i for i in range(n)] def root(x): tmp = par[x] if tmp == x: return x else: a = root(tmp) par[x] = a return a def merge(x, y): x = root(x) y = root(y) if x != y: par[x] = ...
false
19.512195
[ "-rank = [0 for x in range(n)]", "- if x == y:", "- return", "- else:", "- if rank[x] > rank[y]:", "- par[y] = x", "- rank[y] += rank[x]", "- else:", "- par[x] = y", "- rank[x] += rank[y]", "+ if x != y:", "+ par[...
false
0.035603
0.035325
1.00789
[ "s009353858", "s056891402" ]
u891635666
p03054
python
s509393763
s699389867
551
159
4,036
3,768
Accepted
Accepted
71.14
import collections h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) s = input().rstrip() t = input().rstrip() counter = collections.Counter() for c in s: counter[c] += 1 def check(counts, direction, opposite_direction, pos, target): for i in range(n): coun...
h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) s = input().rstrip() t = input().rstrip() def check(direction, opposite_direction, pos, target): for i in range(n): if s[i] == direction: pos += 1 if pos == target: return False ...
37
29
892
668
import collections h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) s = input().rstrip() t = input().rstrip() counter = collections.Counter() for c in s: counter[c] += 1 def check(counts, direction, opposite_direction, pos, target): for i in range(n): counts[direction]...
h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) s = input().rstrip() t = input().rstrip() def check(direction, opposite_direction, pos, target): for i in range(n): if s[i] == direction: pos += 1 if pos == target: return False if t[i]...
false
21.621622
[ "-import collections", "-", "-counter = collections.Counter()", "-for c in s:", "- counter[c] += 1", "-def check(counts, direction, opposite_direction, pos, target):", "+def check(direction, opposite_direction, pos, target):", "- counts[direction] -= 1", "- if t[i] == opposite_direc...
false
0.036327
0.037344
0.97277
[ "s509393763", "s699389867" ]
u378299699
p03207
python
s843393692
s629466574
19
17
2,940
2,940
Accepted
Accepted
10.53
n = int(eval(input())) nums =[] for i in range(n): nums.append(int(eval(input()))) m = max(nums) nums.remove(m) print((int(sum(nums) + (m / 2))))
N = int(eval(input())) nums = [] for i in range(N): nums.append(int(eval(input()))) m = max(nums) nums.remove(m) print((int(sum(nums) + (m / 2))))
8
7
144
143
n = int(eval(input())) nums = [] for i in range(n): nums.append(int(eval(input()))) m = max(nums) nums.remove(m) print((int(sum(nums) + (m / 2))))
N = int(eval(input())) nums = [] for i in range(N): nums.append(int(eval(input()))) m = max(nums) nums.remove(m) print((int(sum(nums) + (m / 2))))
false
12.5
[ "-n = int(eval(input()))", "+N = int(eval(input()))", "-for i in range(n):", "+for i in range(N):" ]
false
0.063582
0.048085
1.322273
[ "s843393692", "s629466574" ]
u017415492
p02756
python
s226911356
s301226248
788
454
42,372
35,864
Accepted
Accepted
42.39
s=eval(input()) q=int(eval(input())) que=[] count=0 left=[] right=[] for i in range(q): qu=list(map(str,input().split())) if qu[0]=="1": count+=1 que.append(qu) han=0 for i in range(q): if que[i][0]=="1": han+=1 else: if que[i][1]=="1": if (count-han)%2==0: left.a...
s=eval(input()) q=int(eval(input())) que=[list(map(str,input().split())) for i in range(q)] count=0 for i in que: if i[0]=="1": count+=1 ans=[[],[]] ak=count for i in que: if i[0]=="1": count-=1 else: if i[1]=="1": ans[count%2].append(i[2]) else: ans[(count+1)%2].append...
32
21
612
467
s = eval(input()) q = int(eval(input())) que = [] count = 0 left = [] right = [] for i in range(q): qu = list(map(str, input().split())) if qu[0] == "1": count += 1 que.append(qu) han = 0 for i in range(q): if que[i][0] == "1": han += 1 else: if que[i][1] == "1": ...
s = eval(input()) q = int(eval(input())) que = [list(map(str, input().split())) for i in range(q)] count = 0 for i in que: if i[0] == "1": count += 1 ans = [[], []] ak = count for i in que: if i[0] == "1": count -= 1 else: if i[1] == "1": ans[count % 2].append(i[2]) ...
false
34.375
[ "-que = []", "+que = [list(map(str, input().split())) for i in range(q)]", "-left = []", "-right = []", "-for i in range(q):", "- qu = list(map(str, input().split()))", "- if qu[0] == \"1\":", "+for i in que:", "+ if i[0] == \"1\":", "- que.append(qu)", "-han = 0", "-for i in range...
false
0.037705
0.036221
1.040945
[ "s226911356", "s301226248" ]
u416011173
p02612
python
s234952487
s383287435
35
26
9,140
9,180
Accepted
Accepted
25.71
# -*- coding: utf-8 -*- # 標準入力を取得 N = int(eval(input())) # 求解処理 ans = (1000 - (N % 1000)) % 1000 # 結果出力 print(ans)
# -*- coding: utf-8 -*- def get_input() -> int: """ 標準入力を取得する. Returns:\n int: 標準入力 """ N = int(eval(input())) return N def main(N: int) -> None: """ メイン処理. Args:\n N (int): 整数(1 <= N <= 10000) """ # 求解処理 ans = (1000 - (N % 1000...
9
34
119
450
# -*- coding: utf-8 -*- # 標準入力を取得 N = int(eval(input())) # 求解処理 ans = (1000 - (N % 1000)) % 1000 # 結果出力 print(ans)
# -*- coding: utf-8 -*- def get_input() -> int: """ 標準入力を取得する. Returns:\n int: 標準入力 """ N = int(eval(input())) return N def main(N: int) -> None: """ メイン処理. Args:\n N (int): 整数(1 <= N <= 10000) """ # 求解処理 ans = (1000 - (N % 1000)) % 1000 # 結果出力 p...
false
73.529412
[ "-# 標準入力を取得", "-N = int(eval(input()))", "-# 求解処理", "-ans = (1000 - (N % 1000)) % 1000", "-# 結果出力", "-print(ans)", "+def get_input() -> int:", "+ \"\"\"", "+ 標準入力を取得する.", "+ Returns:\\n", "+ int: 標準入力", "+ \"\"\"", "+ N = int(eval(input()))", "+ return N", "+", ...
false
0.038071
0.077896
0.488744
[ "s234952487", "s383287435" ]
u644907318
p04005
python
s725665877
s225872783
72
64
61,488
61,788
Accepted
Accepted
11.11
A,B,C = list(map(int,input().split())) if (A*B*C)%2==0: print((0)) else: print((min(A*B,B*C,C*A)))
A,B,C = list(map(int,input().split())) if A*B*C % 2 == 0: print((0)) else: print((min(A*B,B*C,C*A)))
5
5
100
102
A, B, C = list(map(int, input().split())) if (A * B * C) % 2 == 0: print((0)) else: print((min(A * B, B * C, C * A)))
A, B, C = list(map(int, input().split())) if A * B * C % 2 == 0: print((0)) else: print((min(A * B, B * C, C * A)))
false
0
[ "-if (A * B * C) % 2 == 0:", "+if A * B * C % 2 == 0:" ]
false
0.033695
0.074589
0.451736
[ "s725665877", "s225872783" ]
u853185302
p03160
python
s345105525
s146669969
831
549
103,100
22,744
Accepted
Accepted
33.94
import numpy as np import sys sys.setrecursionlimit(10**6) N = int(eval(input())) h = list(map(int,input().split())) memo = np.zeros(N) - 1 def search(i): if i == 0: return 0 elif i == 1: return abs(h[i] - h[i-1]) if memo[i] != -1: return memo[i] c1 = search(i-1) + abs(h[i]-h[...
import numpy as np N = int(eval(input())) h = list(map(int,input().split())) memo = np.zeros(N) memo[0] = 0 memo[1] = abs(h[0]-h[1]) for i in range(2,N): a = memo[i-1] + abs(h[i] - h[i-1]) b = memo[i-2] + abs(h[i] - h[i-2]) memo[i] = min(a,b) print((int(memo[N-1])))
23
15
430
282
import numpy as np import sys sys.setrecursionlimit(10**6) N = int(eval(input())) h = list(map(int, input().split())) memo = np.zeros(N) - 1 def search(i): if i == 0: return 0 elif i == 1: return abs(h[i] - h[i - 1]) if memo[i] != -1: return memo[i] c1 = search(i - 1) + abs(h[...
import numpy as np N = int(eval(input())) h = list(map(int, input().split())) memo = np.zeros(N) memo[0] = 0 memo[1] = abs(h[0] - h[1]) for i in range(2, N): a = memo[i - 1] + abs(h[i] - h[i - 1]) b = memo[i - 2] + abs(h[i] - h[i - 2]) memo[i] = min(a, b) print((int(memo[N - 1])))
false
34.782609
[ "-import sys", "-sys.setrecursionlimit(10**6)", "-memo = np.zeros(N) - 1", "-", "-", "-def search(i):", "- if i == 0:", "- return 0", "- elif i == 1:", "- return abs(h[i] - h[i - 1])", "- if memo[i] != -1:", "- return memo[i]", "- c1 = search(i - 1) + abs(h[i...
false
0.200277
0.195226
1.025875
[ "s345105525", "s146669969" ]
u272525952
p02818
python
s798601459
s476871323
165
28
38,384
9,116
Accepted
Accepted
83.03
a,b,k=list(map(int,input().split())) if a>=k: print((a-k,b)) elif a<k and a+b>=k: print((0,a+b-k)) else: print((0,0))
a,b,k=list(map(int,input().split())) if k<=a: print((a-k,b)) elif k>a and k<=a+b: print((0,a+b-k)) else: print((0,0))
8
7
129
123
a, b, k = list(map(int, input().split())) if a >= k: print((a - k, b)) elif a < k and a + b >= k: print((0, a + b - k)) else: print((0, 0))
a, b, k = list(map(int, input().split())) if k <= a: print((a - k, b)) elif k > a and k <= a + b: print((0, a + b - k)) else: print((0, 0))
false
12.5
[ "-if a >= k:", "+if k <= a:", "-elif a < k and a + b >= k:", "+elif k > a and k <= a + b:" ]
false
0.079397
0.035983
2.206526
[ "s798601459", "s476871323" ]
u263830634
p02990
python
s503064103
s702513045
202
21
3,316
3,316
Accepted
Accepted
89.6
import math N, K = list(map(int, input().split())) R = N - K if R == 0: #赤いボールが無い時 print((1)) for _ in range(1, K): print((0)) exit() if K == 1: #青いボールが1つのとき print((R+1)) exit() # K_1 = math.factorial(K-1) # R_1 = math.factorial(R+1) # print (K_1, R_1) for i in range(...
N, K = list(map(int, input().split())) R = N - K if R == 0: #赤いボールが無い時 print((1)) for _ in range(1, K): print((0)) exit() if K == 1: #青いボールが1つのとき print((R+1)) exit() for i in range(1, K+1): #K回答えを出力 if i > R+1: print((0)) continue if i == 1: ...
31
24
720
544
import math N, K = list(map(int, input().split())) R = N - K if R == 0: # 赤いボールが無い時 print((1)) for _ in range(1, K): print((0)) exit() if K == 1: # 青いボールが1つのとき print((R + 1)) exit() # K_1 = math.factorial(K-1) # R_1 = math.factorial(R+1) # print (K_1, R_1) for i in range(1, K + 1): # K回答...
N, K = list(map(int, input().split())) R = N - K if R == 0: # 赤いボールが無い時 print((1)) for _ in range(1, K): print((0)) exit() if K == 1: # 青いボールが1つのとき print((R + 1)) exit() for i in range(1, K + 1): # K回答えを出力 if i > R + 1: print((0)) continue if i == 1: positi...
false
22.580645
[ "-import math", "-", "-# K_1 = math.factorial(K-1)", "-# R_1 = math.factorial(R+1)", "-# print (K_1, R_1)", "- print((R + 1))", "- continue", "- # print (K_1, R_1, math.factorial(i))", "+ position = R + 1", "+ boal = 1", "- position = R_1 = math.factorial(R ...
false
0.042694
0.037009
1.153613
[ "s503064103", "s702513045" ]
u170183831
p03568
python
s272804435
s758926272
29
25
9,072
9,024
Accepted
Accepted
13.79
n = int(eval(input())) A = list(map(int, input().split())) count = 1 for a in A: count *= 2 if a % 2 == 0 else 1 print((3 ** n - count))
n = int(eval(input())) A = list(map(int, input().split())) print((3 ** n - 2 ** len([a for a in A if a % 2 == 0])))
7
4
137
111
n = int(eval(input())) A = list(map(int, input().split())) count = 1 for a in A: count *= 2 if a % 2 == 0 else 1 print((3**n - count))
n = int(eval(input())) A = list(map(int, input().split())) print((3**n - 2 ** len([a for a in A if a % 2 == 0])))
false
42.857143
[ "-count = 1", "-for a in A:", "- count *= 2 if a % 2 == 0 else 1", "-print((3**n - count))", "+print((3**n - 2 ** len([a for a in A if a % 2 == 0])))" ]
false
0.052115
0.077182
0.675215
[ "s272804435", "s758926272" ]
u489959379
p03304
python
s230418516
s861179972
32
23
9,132
9,164
Accepted
Accepted
28.12
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, m, d = list(map(int, input().split())) if d == 0: print(((m - 1) / n)) else: print(((m - 1) * 2 * (n - d) / n ** 2)) if __name__ == '__main__': resolve()
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, m, d = list(map(int, input().split())) print(((m - 1) / n if d == 0 else (m - 1) * (n - d) * 2 / pow(n, 2))) if __name__ == '__main__': resolve()
17
15
296
295
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): n, m, d = list(map(int, input().split())) if d == 0: print(((m - 1) / n)) else: print(((m - 1) * 2 * (n - d) / n**2)) if __name__ == "__main__": resolve()
import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline f_inf = float("inf") mod = 10**9 + 7 def resolve(): n, m, d = list(map(int, input().split())) print(((m - 1) / n if d == 0 else (m - 1) * (n - d) * 2 / pow(n, 2))) if __name__ == "__main__": resolve()
false
11.764706
[ "+input = sys.stdin.readline", "- if d == 0:", "- print(((m - 1) / n))", "- else:", "- print(((m - 1) * 2 * (n - d) / n**2))", "+ print(((m - 1) / n if d == 0 else (m - 1) * (n - d) * 2 / pow(n, 2)))" ]
false
0.037697
0.037208
1.013152
[ "s230418516", "s861179972" ]
u671060652
p03041
python
s618621626
s829603141
164
68
38,256
61,820
Accepted
Accepted
58.54
n, k = list(map(int, input().split())) s = list(eval(input())) s[k-1] = chr(ord(s[k-1])+ord("a")-ord("A")) print(("".join(s)))
import math def main(): # n = int(input()) n, k = list(map(int, input().split())) # h = list(map(int, input().split())) s = list(eval(input())) # h = [int(input()) for _ in rane(n)] s[k-1] = s[k-1].lower() print(("".join(s))) if __name__ == '__main__': main()
6
16
119
298
n, k = list(map(int, input().split())) s = list(eval(input())) s[k - 1] = chr(ord(s[k - 1]) + ord("a") - ord("A")) print(("".join(s)))
import math def main(): # n = int(input()) n, k = list(map(int, input().split())) # h = list(map(int, input().split())) s = list(eval(input())) # h = [int(input()) for _ in rane(n)] s[k - 1] = s[k - 1].lower() print(("".join(s))) if __name__ == "__main__": main()
false
62.5
[ "-n, k = list(map(int, input().split()))", "-s = list(eval(input()))", "-s[k - 1] = chr(ord(s[k - 1]) + ord(\"a\") - ord(\"A\"))", "-print((\"\".join(s)))", "+import math", "+", "+", "+def main():", "+ # n = int(input())", "+ n, k = list(map(int, input().split()))", "+ # h = list(map(in...
false
0.035708
0.034615
1.031559
[ "s618621626", "s829603141" ]
u811733736
p00184
python
s249712740
s336886744
810
660
7,980
7,992
Accepted
Accepted
18.52
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0184 """ import sys from sys import stdin from collections import defaultdict input = stdin.readline def main(args): while True: n = int(eval(input())) if n == 0: break visitor...
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0184 """ import sys from sys import stdin from collections import defaultdict input = stdin.readline def main(args): while True: n = int(eval(input())) if n == 0: break visitor...
47
67
1,145
1,585
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0184 """ import sys from sys import stdin from collections import defaultdict input = stdin.readline def main(args): while True: n = int(eval(input())) if n == 0: break visitors = defaultdict(...
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0184 """ import sys from sys import stdin from collections import defaultdict input = stdin.readline def main(args): while True: n = int(eval(input())) if n == 0: break visitors = defaultdict(...
false
29.850746
[ "+def main2(args):", "+ while True:", "+ n = int(eval(input()))", "+ if n == 0:", "+ break", "+ age = [0] * (120 + 1)", "+ for _ in range(n):", "+ n = int(eval(input()))", "+ age[n] += 1", "+ print((sum(age[0:10])))", "+ ...
false
0.131239
0.171046
0.767278
[ "s249712740", "s336886744" ]
u077291787
p03761
python
s777728675
s872190895
26
23
3,768
3,572
Accepted
Accepted
11.54
# ABC058C - 怪文書 / Dubious Document (ARC071C) import sys input = sys.stdin.readline from collections import Counter from string import ascii_lowercase def main(): N = int(eval(input())) D = tuple(Counter(eval(input())) for _ in range(N)) ans = "" for s in ascii_lowercase: if all(s...
# ABC058C - 怪文書 / Dubious Document (ARC071C) from functools import reduce def main(): N = int(input()) if N == 1: print(*sorted(input()), sep="") return S = tuple(input() for _ in range(N)) ch = sorted(reduce(lambda a, b: set(a) & set(b), S)) ans = "" for i in ch: ...
20
19
431
425
# ABC058C - 怪文書 / Dubious Document (ARC071C) import sys input = sys.stdin.readline from collections import Counter from string import ascii_lowercase def main(): N = int(eval(input())) D = tuple(Counter(eval(input())) for _ in range(N)) ans = "" for s in ascii_lowercase: if all(s in d for d i...
# ABC058C - 怪文書 / Dubious Document (ARC071C) from functools import reduce def main(): N = int(input()) if N == 1: print(*sorted(input()), sep="") return S = tuple(input() for _ in range(N)) ch = sorted(reduce(lambda a, b: set(a) & set(b), S)) ans = "" for i in ch: ans +...
false
5
[ "-import sys", "-", "-input = sys.stdin.readline", "-from collections import Counter", "-from string import ascii_lowercase", "+from functools import reduce", "- N = int(eval(input()))", "- D = tuple(Counter(eval(input())) for _ in range(N))", "+ N = int(input())", "+ if N == 1:", "+...
false
0.154652
0.068422
2.260268
[ "s777728675", "s872190895" ]
u133936772
p02779
python
s825367655
s755267292
87
62
36,656
31,156
Accepted
Accepted
28.74
print((['YES','NO'][int(eval(input()))>len(set(map(int,input().split())))]))
print(('YNEOS'[int(eval(input()))>len(set(input().split()))::2]))
1
1
68
57
print((["YES", "NO"][int(eval(input())) > len(set(map(int, input().split())))]))
print(("YNEOS"[int(eval(input())) > len(set(input().split())) :: 2]))
false
0
[ "-print(([\"YES\", \"NO\"][int(eval(input())) > len(set(map(int, input().split())))]))", "+print((\"YNEOS\"[int(eval(input())) > len(set(input().split())) :: 2]))" ]
false
0.047393
0.03637
1.303062
[ "s825367655", "s755267292" ]
u690536347
p03216
python
s747678805
s701951573
1,515
1,337
86,108
83,312
Accepted
Accepted
11.75
N = int(eval(input())) S = eval(input()) Q = int(eval(input())) *k, = list(map(int, input().split())) acd = [0]*(N+1) acm = [0]*(N+1) acc = [0]*(N+1) acmc = [0]*(N+2) for i in range(1, N+1): acd[i] = acd[i-1] + (S[i-1]=="D") acm[i] = acm[i-1] + (S[i-1]=="M") acc[i] = acc[i-1] + (S[i-1]=="C") ...
import sys input=sys.stdin.readline def solve(): N = int(eval(input())) S = eval(input()) Q = int(eval(input())) *k, = list(map(int, input().split())) acd = [0]*(N+1) acm = [0]*(N+1) acc = [0]*(N+1) acmc = [0]*(N+2) for i in range(1, N+1): acd[i] = acd[i-1...
31
40
699
905
N = int(eval(input())) S = eval(input()) Q = int(eval(input())) (*k,) = list(map(int, input().split())) acd = [0] * (N + 1) acm = [0] * (N + 1) acc = [0] * (N + 1) acmc = [0] * (N + 2) for i in range(1, N + 1): acd[i] = acd[i - 1] + (S[i - 1] == "D") acm[i] = acm[i - 1] + (S[i - 1] == "M") acc[i] = acc[i - ...
import sys input = sys.stdin.readline def solve(): N = int(eval(input())) S = eval(input()) Q = int(eval(input())) (*k,) = list(map(int, input().split())) acd = [0] * (N + 1) acm = [0] * (N + 1) acc = [0] * (N + 1) acmc = [0] * (N + 2) for i in range(1, N + 1): acd[i] = ac...
false
22.5
[ "-N = int(eval(input()))", "-S = eval(input())", "-Q = int(eval(input()))", "-(*k,) = list(map(int, input().split()))", "-acd = [0] * (N + 1)", "-acm = [0] * (N + 1)", "-acc = [0] * (N + 1)", "-acmc = [0] * (N + 2)", "-for i in range(1, N + 1):", "- acd[i] = acd[i - 1] + (S[i - 1] == \"D\")", ...
false
0.099431
0.158474
0.627432
[ "s747678805", "s701951573" ]
u203843959
p03722
python
s329972201
s336600294
752
649
4,340
4,340
Accepted
Accepted
13.7
import sys sys.setrecursionlimit(10**9) N,M=list(map(int,input().split())) def find_negative_loop(n,w,es): dist=[float("inf")]*n #この始点はどこでもよい dist[1]=0 for i in range(n): for j in range(w): e=es[j] if dist[e[1]]>dist[e[0]]+e[2]: dist[e[1]]=dist[e[0]]+e[2] if i==...
import sys sys.setrecursionlimit(10**9) N,M=list(map(int,input().split())) def find_negative_loop(n,w,es): dist=[float("inf")]*n #この始点はどこでもよい dist[1]=0 for i in range(n): for j in range(w): e=es[j] if dist[e[1]]>dist[e[0]]+e[2]: dist[e[1]]=dist[e[0]]+e[2] if i==...
85
87
1,656
1,710
import sys sys.setrecursionlimit(10**9) N, M = list(map(int, input().split())) def find_negative_loop(n, w, es): dist = [float("inf")] * n # この始点はどこでもよい dist[1] = 0 for i in range(n): for j in range(w): e = es[j] if dist[e[1]] > dist[e[0]] + e[2]: dist[...
import sys sys.setrecursionlimit(10**9) N, M = list(map(int, input().split())) def find_negative_loop(n, w, es): dist = [float("inf")] * n # この始点はどこでもよい dist[1] = 0 for i in range(n): for j in range(w): e = es[j] if dist[e[1]] > dist[e[0]] + e[2]: dist[...
false
2.298851
[ "+ visited[u] = True", "- visited[u] = True", "+ elif reachable[u] != None:", "+ return reachable[u]", "-reachable = [False] * (N + 1)", "+reachable = [None] * (N + 1)", "- if not reachable[i]:", "+ if reachable[i] == None:" ]
false
0.050926
0.048873
1.042014
[ "s329972201", "s336600294" ]
u744920373
p03031
python
s333776500
s837977397
31
27
3,064
3,064
Accepted
Accepted
12.9
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
33
35
995
1,031
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
false
5.714286
[ "+from itertools import product", "+", "-for i in range(2**N):", "- x = bin(i)[2:].zfill(N)", "- l = list(map(int, list(x)))", "- flag = 1", "+# for i in range(2**N):", "+# x = bin(i)[2:].zfill(N)", "+# l = list(map(int, list(x)))", "+for l in product([0, 1], repeat=N):", "- ...
false
0.097365
0.13347
0.729492
[ "s333776500", "s837977397" ]
u156815136
p03240
python
s953557710
s539147230
386
57
5,148
5,148
Accepted
Accepted
85.23
from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] -...
from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] -...
56
54
1,416
1,360
from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] - k[j...
from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] - k[j...
false
3.571429
[ "-def main():", "- n = int(eval(input()))", "- vx = []", "- vy = []", "- vh = []", "- for i in range(n):", "- x, y, h = readInts()", "- vx.append(x)", "- vy.append(y)", "- vh.append(h)", "- if h > 0:", "- si = i", "- # 基準となる座標はど...
false
0.302139
0.075444
4.004832
[ "s953557710", "s539147230" ]
u197615397
p02346
python
s558546968
s271569113
3,380
3,110
19,168
18,592
Accepted
Accepted
7.99
import math import functools class SegmentTree: def __init__(self, a: list, default: int, op): real_size = len(a) self.elem_size = 1 << int(math.ceil(math.log2(real_size))) # honto ha int() iranai self.tree_size = 2 * self.elem_size + 1 self.tree = [default] * (self.elem_...
import math class SegmentTree: __slots__ = ["elem_size", "tree_size", "tree"] def __init__(self, a: list, default: int): real_size = len(a) self.elem_size = 1 << math.ceil(math.log2(real_size)) self.tree_size = 2 * self.elem_size + 1 self.tree = [default] * (self.ele...
63
63
1,940
1,864
import math import functools class SegmentTree: def __init__(self, a: list, default: int, op): real_size = len(a) self.elem_size = 1 << int( math.ceil(math.log2(real_size)) ) # honto ha int() iranai self.tree_size = 2 * self.elem_size + 1 self.tree = ( ...
import math class SegmentTree: __slots__ = ["elem_size", "tree_size", "tree"] def __init__(self, a: list, default: int): real_size = len(a) self.elem_size = 1 << math.ceil(math.log2(real_size)) self.tree_size = 2 * self.elem_size + 1 self.tree = ( [default] * (self...
false
0
[ "-import functools", "- def __init__(self, a: list, default: int, op):", "+ __slots__ = [\"elem_size\", \"tree_size\", \"tree\"]", "+", "+ def __init__(self, a: list, default: int):", "- self.elem_size = 1 << int(", "- math.ceil(math.log2(real_size))", "- ) # honto h...
false
0.040007
0.118077
0.338826
[ "s558546968", "s271569113" ]
u754022296
p03061
python
s761419984
s852597128
1,677
614
16,168
87,272
Accepted
Accepted
63.39
class Segtree: def __init__(self, original, func, element): self.n = len(original) self.element = element self.func = func self.N0 = 1 << (n-1).bit_length() self.seg = [element]*(self.N0 << 1) for i, j in enumerate(original, self.N0): self.seg[i] =...
class Segtree: def __init__(self, original, func, element): self.n = len(original) self.element = element self.func = func self.N0 = 1 << (n-1).bit_length() self.seg = [element]*(self.N0 << 1) for i, j in enumerate(original, self.N0): self.seg[i] =...
55
53
1,445
1,400
class Segtree: def __init__(self, original, func, element): self.n = len(original) self.element = element self.func = func self.N0 = 1 << (n - 1).bit_length() self.seg = [element] * (self.N0 << 1) for i, j in enumerate(original, self.N0): self.seg[i] = j ...
class Segtree: def __init__(self, original, func, element): self.n = len(original) self.element = element self.func = func self.N0 = 1 << (n - 1).bit_length() self.seg = [element] * (self.N0 << 1) for i, j in enumerate(original, self.N0): self.seg[i] = j ...
false
3.636364
[ "- if y <= x:", "- break" ]
false
0.125694
0.048723
2.579791
[ "s761419984", "s852597128" ]
u072053884
p00449
python
s397610814
s803661173
4,090
950
6,204
6,240
Accepted
Accepted
76.77
def solve(): max_fare = 99000001 def dijkstra(start, goal): unvisited = [i for i in range(n)] fare = [max_fare] * n fare[start] = 0 while True: min_fare = max_fare for i in unvisited: f = fare[i] if f < m...
def solve(): from heapq import heappush, heappop def dijkstra(start, goal): fare = [99000001] * n fare[start] = 0 pq = [(0, start)] while pq: u_fare, u = heappop(pq) if u == goal: return u_fare ...
47
41
1,346
1,168
def solve(): max_fare = 99000001 def dijkstra(start, goal): unvisited = [i for i in range(n)] fare = [max_fare] * n fare[start] = 0 while True: min_fare = max_fare for i in unvisited: f = fare[i] if f < min_fare: ...
def solve(): from heapq import heappush, heappop def dijkstra(start, goal): fare = [99000001] * n fare[start] = 0 pq = [(0, start)] while pq: u_fare, u = heappop(pq) if u == goal: return u_fare for f, v in adj[u]: ...
false
12.765957
[ "- max_fare = 99000001", "+ from heapq import heappush, heappop", "- unvisited = [i for i in range(n)]", "- fare = [max_fare] * n", "+ fare = [99000001] * n", "- while True:", "- min_fare = max_fare", "- for i in unvisited:", "- ...
false
0.044912
0.041604
1.079501
[ "s397610814", "s803661173" ]
u537782349
p03262
python
s578800618
s046990819
132
109
14,224
14,224
Accepted
Accepted
17.42
def g_c_d(x, y): if x == 0: return y elif y == 0: return x else: return g_c_d(y, x%y) a, b = list(map(int, input().split())) c = list(map(int, input().split())) c.append(b) c.sort() d = 0 for i in range(1, a + 1): d = g_c_d(c[i] - c[i-1], d) print(d)
def g_c_d(x, y): if x == 0: return y elif y == 0: return x else: return g_c_d(y, x % y) a, b = list(map(int, input().split())) c = list(map(int, input().split())) c.append(b) d = 0 for i in range(len(c)): d = g_c_d(d, abs((c[i] - c[i-1]))) print(d)
17
16
303
300
def g_c_d(x, y): if x == 0: return y elif y == 0: return x else: return g_c_d(y, x % y) a, b = list(map(int, input().split())) c = list(map(int, input().split())) c.append(b) c.sort() d = 0 for i in range(1, a + 1): d = g_c_d(c[i] - c[i - 1], d) print(d)
def g_c_d(x, y): if x == 0: return y elif y == 0: return x else: return g_c_d(y, x % y) a, b = list(map(int, input().split())) c = list(map(int, input().split())) c.append(b) d = 0 for i in range(len(c)): d = g_c_d(d, abs((c[i] - c[i - 1]))) print(d)
false
5.882353
[ "-c.sort()", "-for i in range(1, a + 1):", "- d = g_c_d(c[i] - c[i - 1], d)", "+for i in range(len(c)):", "+ d = g_c_d(d, abs((c[i] - c[i - 1])))" ]
false
0.040461
0.040422
1.00096
[ "s578800618", "s046990819" ]
u133936772
p02887
python
s187051172
s591316323
54
39
15,988
3,316
Accepted
Accepted
27.78
f=input;f() import itertools as it print((len(list(it.groupby(f())))))
f=input;n=int(f());s=f() print((1+sum(s[i]!=s[i-1] for i in range(1,n))))
3
2
70
72
f = input f() import itertools as it print((len(list(it.groupby(f())))))
f = input n = int(f()) s = f() print((1 + sum(s[i] != s[i - 1] for i in range(1, n))))
false
33.333333
[ "-f()", "-import itertools as it", "-", "-print((len(list(it.groupby(f())))))", "+n = int(f())", "+s = f()", "+print((1 + sum(s[i] != s[i - 1] for i in range(1, n))))" ]
false
0.036417
0.03662
0.994465
[ "s187051172", "s591316323" ]
u121161758
p02934
python
s519075990
s306328791
20
17
3,064
3,060
Accepted
Accepted
15
n = int(eval(input())) list = list(map(int,input().split())) product_list = [1]*n for i in range(len(list)): for j in range(len(list)): if i != j : product_list[i] *= list[j] product_sum = 0 for i in range(len(list)): product_sum += product_list[i] total_product = product_list[0] * l...
n = int(eval(input())) list = list(map(int,input().split())) div_list = [0] * n for i in range(len(list)): div_list[i] = 1 / list[i] sum = 0 for i in range(len(list)): sum += div_list[i] print(( 1 / sum ))
17
13
359
221
n = int(eval(input())) list = list(map(int, input().split())) product_list = [1] * n for i in range(len(list)): for j in range(len(list)): if i != j: product_list[i] *= list[j] product_sum = 0 for i in range(len(list)): product_sum += product_list[i] total_product = product_list[0] * list[0]...
n = int(eval(input())) list = list(map(int, input().split())) div_list = [0] * n for i in range(len(list)): div_list[i] = 1 / list[i] sum = 0 for i in range(len(list)): sum += div_list[i] print((1 / sum))
false
23.529412
[ "-product_list = [1] * n", "+div_list = [0] * n", "- for j in range(len(list)):", "- if i != j:", "- product_list[i] *= list[j]", "-product_sum = 0", "+ div_list[i] = 1 / list[i]", "+sum = 0", "- product_sum += product_list[i]", "-total_product = product_list[0] * list[0...
false
0.036311
0.036992
0.981594
[ "s519075990", "s306328791" ]
u690536347
p02991
python
s822590102
s169617197
1,115
1,016
125,144
120,288
Accepted
Accepted
8.88
from collections import defaultdict, deque from heapq import heappush, heappop def bfs(V, s, t): q = deque([(0, s)]) used = set() while q: dist, a = q.popleft() used.add(a) if a == t: break for b in V[a]: if b in used: continue ...
from heapq import heappush, heappop def dijkstra1(V, n, source): # O(ElogV) inf = float("inf") dist = [inf] * (n+1) dist[source] = 0 q = [(0, source)] while q: cost, u = heappop(q) if dist[u] < cost: continue for c, v in V[u]: if ...
55
34
1,266
853
from collections import defaultdict, deque from heapq import heappush, heappop def bfs(V, s, t): q = deque([(0, s)]) used = set() while q: dist, a = q.popleft() used.add(a) if a == t: break for b in V[a]: if b in used: continue ...
from heapq import heappush, heappop def dijkstra1(V, n, source): # O(ElogV) inf = float("inf") dist = [inf] * (n + 1) dist[source] = 0 q = [(0, source)] while q: cost, u = heappop(q) if dist[u] < cost: continue for c, v in V[u]: if dist[v] > dist...
false
38.181818
[ "-from collections import defaultdict, deque", "-", "-", "-def bfs(V, s, t):", "- q = deque([(0, s)])", "- used = set()", "- while q:", "- dist, a = q.popleft()", "- used.add(a)", "- if a == t:", "- break", "- for b in V[a]:", "- if ...
false
0.040278
0.044965
0.895745
[ "s822590102", "s169617197" ]
u332385682
p03716
python
s498446766
s688849259
674
402
119,840
37,212
Accepted
Accepted
40.36
import sys from heapq import heapify, heappush, heappop from itertools import accumulate inf = 1<<100 def solve(): N = int(eval(input())) a = [int(i) for i in input().split()] ps = [0] + list(accumulate(a)) psmin = [0] * (N + 1) minhp = a[:N] heapify(minhp) for i in range(...
import sys from heapq import heapify, heappush, heappop inf = 1<<60 def solve(): n = int(eval(input())) a = [int(i) for i in input().split()] ps = [sum(a[:n])] minhp = a[:n] heapify(minhp) for i in range(n): heappush(minhp, a[n + i]) x = heappop(minhp) ...
44
36
990
730
import sys from heapq import heapify, heappush, heappop from itertools import accumulate inf = 1 << 100 def solve(): N = int(eval(input())) a = [int(i) for i in input().split()] ps = [0] + list(accumulate(a)) psmin = [0] * (N + 1) minhp = a[:N] heapify(minhp) for i in range(1, N + 1): ...
import sys from heapq import heapify, heappush, heappop inf = 1 << 60 def solve(): n = int(eval(input())) a = [int(i) for i in input().split()] ps = [sum(a[:n])] minhp = a[:n] heapify(minhp) for i in range(n): heappush(minhp, a[n + i]) x = heappop(minhp) ps.append(ps[-...
false
18.181818
[ "-from itertools import accumulate", "-inf = 1 << 100", "+inf = 1 << 60", "- N = int(eval(input()))", "+ n = int(eval(input()))", "- ps = [0] + list(accumulate(a))", "- psmin = [0] * (N + 1)", "- minhp = a[:N]", "+ ps = [sum(a[:n])]", "+ minhp = a[:n]", "- for i in range(...
false
0.04488
0.046514
0.964885
[ "s498446766", "s688849259" ]
u931005464
p03167
python
s405998676
s610207536
750
656
52,548
52,572
Accepted
Accepted
12.53
h, w = list(map(int, input().split())) mat = [] dp = [] m = 10**9+7 for i in range(h): mat.append(list(eval(input()))) dp.append(list([0]*w)) dp[0][0] = 1 for x in range(h): for y in range(w): if x != 0 or y != 0: if mat[x][y] == "#": dp[x][y] = 0 ...
h, w = list(map(int, input().split())) mat = [] dp = [] m = 10**9+7 for i in range(h): mat.append(list(eval(input()))) dp.append(list([0]*w)) dp[0][0] = 1 for x in range(h): for y in range(w): if x != 0 or y != 0: if mat[x][y] == "#": dp[x][y] = 0 ...
25
25
421
420
h, w = list(map(int, input().split())) mat = [] dp = [] m = 10**9 + 7 for i in range(h): mat.append(list(eval(input()))) dp.append(list([0] * w)) dp[0][0] = 1 for x in range(h): for y in range(w): if x != 0 or y != 0: if mat[x][y] == "#": dp[x][y] = 0 else: ...
h, w = list(map(int, input().split())) mat = [] dp = [] m = 10**9 + 7 for i in range(h): mat.append(list(eval(input()))) dp.append(list([0] * w)) dp[0][0] = 1 for x in range(h): for y in range(w): if x != 0 or y != 0: if mat[x][y] == "#": dp[x][y] = 0 else: ...
false
0
[ "- dp[x][y] += (dp[x - 1][y] + dp[x][y - 1]) % m", "+ dp[x][y] = (dp[x - 1][y] + dp[x][y - 1]) % m" ]
false
0.040996
0.041615
0.985118
[ "s405998676", "s610207536" ]
u348805958
p02781
python
s645650237
s753797022
69
45
3,428
3,428
Accepted
Accepted
34.78
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0]*(size+1) for j in range(2)] for i in range(size+1)] dp[0][0][0] =...
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0]*(size+1) for j in range(2)] for i in range(size+1)] dp[0][0][0] =...
29
29
749
748
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0] * (size + 1) for j in range(2)] for i in range(size + 1)] dp[0][0][0] = 1 for i i...
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0] * (size + 1) for j in range(2)] for i in range(size + 1)] dp[0][0][0] = 1 for i i...
false
0
[ "- for k in range(size):", "+ for k in range(i + 1):" ]
false
0.03468
0.035615
0.973749
[ "s645650237", "s753797022" ]
u333945892
p03291
python
s809484543
s233501158
1,432
261
11,428
11,440
Accepted
Accepted
81.77
from collections import defaultdict import sys,heapq,bisect,math,itertools,string,queue,datetime sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 AtoZ = [chr(i) for i in range(65,65+26)] atoz = [chr(i) for i in range(97,97+26)] def inpl(): return list(map(int, input().split())) def ...
from collections import defaultdict import sys,heapq,bisect,math,itertools,string,queue,datetime sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 AtoZ = [chr(i) for i in range(65,65+26)] atoz = [chr(i) for i in range(97,97+26)] def inpl(): return list(map(int, input().split())) def ...
78
67
1,370
1,284
from collections import defaultdict import sys, heapq, bisect, math, itertools, string, queue, datetime sys.setrecursionlimit(10**8) INF = float("inf") mod = 10**9 + 7 eps = 10**-7 AtoZ = [chr(i) for i in range(65, 65 + 26)] atoz = [chr(i) for i in range(97, 97 + 26)] def inpl(): return list(map(int, input().spl...
from collections import defaultdict import sys, heapq, bisect, math, itertools, string, queue, datetime sys.setrecursionlimit(10**8) INF = float("inf") mod = 10**9 + 7 eps = 10**-7 AtoZ = [chr(i) for i in range(65, 65 + 26)] atoz = [chr(i) for i in range(97, 97 + 26)] def inpl(): return list(map(int, input().spl...
false
14.102564
[ "- if k == 0:", "- ans = 1", "+ if k <= 0:", "+ return 1", "- ans %= mod", "- return ans", "+ return ans % mod", "+ex = [", "+ ex_square(3, Sq),", "+ ex_square(3, Sq - 1),", "+ ex_square(3, Sq - 2),", "+ ex_square(3, Sq - 3),", "+]", "- SUMq ...
false
0.073042
0.034969
2.088768
[ "s809484543", "s233501158" ]
u896847891
p02784
python
s930071984
s900082062
41
37
13,964
9,944
Accepted
Accepted
9.76
h,n=list(map(int,input().split())) print(("Yes"if sum(list(map(int,input().split())))>=h else "No"))
h, n = list(map(int, input().split())) print(("Yes" if h <= sum(map(int, input().split())) else "No"))
2
2
93
95
h, n = list(map(int, input().split())) print(("Yes" if sum(list(map(int, input().split()))) >= h else "No"))
h, n = list(map(int, input().split())) print(("Yes" if h <= sum(map(int, input().split())) else "No"))
false
0
[ "-print((\"Yes\" if sum(list(map(int, input().split()))) >= h else \"No\"))", "+print((\"Yes\" if h <= sum(map(int, input().split())) else \"No\"))" ]
false
0.038878
0.039606
0.981623
[ "s930071984", "s900082062" ]
u724687935
p02644
python
s219563162
s111760460
1,734
1,546
401,304
400,560
Accepted
Accepted
10.84
from collections import deque H, W, K = list(map(int, input().split())) x1, y1, x2, y2 = [int(x) - 1 for x in input().split()] grid = [eval(input()) for _ in range(H)] INF = float('inf') path = [[[(INF, INF)] * 4 for _ in range(W)] for _ in range(H)] q = deque() for d in range(4): path[x1][y1][d] = ...
from collections import deque H, W, K = list(map(int, input().split())) x1, y1, x2, y2 = [int(x) - 1 for x in input().split()] grid = [eval(input()) for _ in range(H)] INF = float('inf') path = [[[(INF, INF)] * 4 for _ in range(W)] for _ in range(H)] q = deque() for d in range(4): path[x1][y1][d] = ...
53
40
1,587
1,114
from collections import deque H, W, K = list(map(int, input().split())) x1, y1, x2, y2 = [int(x) - 1 for x in input().split()] grid = [eval(input()) for _ in range(H)] INF = float("inf") path = [[[(INF, INF)] * 4 for _ in range(W)] for _ in range(H)] q = deque() for d in range(4): path[x1][y1][d] = (1, 0) q.ap...
from collections import deque H, W, K = list(map(int, input().split())) x1, y1, x2, y2 = [int(x) - 1 for x in input().split()] grid = [eval(input()) for _ in range(H)] INF = float("inf") path = [[[(INF, INF)] * 4 for _ in range(W)] for _ in range(H)] q = deque() for d in range(4): path[x1][y1][d] = (1, 0) q.ap...
false
24.528302
[ "- if k == K:", "- for nd in range(4):", "- if nd == d:", "- dx, dy = D[nd]", "- nk = 1", "+ for nd in range(4):", "+ if nd == d:", "+ dx, dy = D[nd]", "+ nk = 1 if k == K else k + 1", "+ ns = s + 1 if k ...
false
0.043132
0.0437
0.986997
[ "s219563162", "s111760460" ]
u392029857
p03463
python
s188264563
s275155220
20
18
3,060
3,064
Accepted
Accepted
10
N, A, B = list(map(int, input().split())) det = (B-A)%2 if det == 1: print('Borys') else: print('Alice')
N, A, B = list(map(int, input().split())) if (B-A)%2 == 0: print('Alice') else: print('Borys')
6
5
111
100
N, A, B = list(map(int, input().split())) det = (B - A) % 2 if det == 1: print("Borys") else: print("Alice")
N, A, B = list(map(int, input().split())) if (B - A) % 2 == 0: print("Alice") else: print("Borys")
false
16.666667
[ "-det = (B - A) % 2", "-if det == 1:", "+if (B - A) % 2 == 0:", "+ print(\"Alice\")", "+else:", "-else:", "- print(\"Alice\")" ]
false
0.041402
0.041733
0.992078
[ "s188264563", "s275155220" ]
u054514819
p02614
python
s957117603
s786322829
90
82
74,084
68,324
Accepted
Accepted
8.89
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) H, W, K = mapint() rows = [0]*H query = [] allcnt = 0 for h in range(H): Cs = list(eval(input())) query.append(Cs) cnt = sum([1 if i=='#' else 0 for i ...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) H, W, K = mapint() query = [list(eval(input())) for _ in range(H)] ans = 0 for i in range(1<<H): for j in range(1<<W): cnt = 0 for h in range(H)...
36
21
863
524
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) H, W, K = mapint() rows = [0] * H query = [] allcnt = 0 for h in range(H): Cs = list(eval(input())) query.append(Cs) cnt = sum([1 if i == "#" else 0 for...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) H, W, K = mapint() query = [list(eval(input())) for _ in range(H)] ans = 0 for i in range(1 << H): for j in range(1 << W): cnt = 0 for h in rang...
false
41.666667
[ "-rows = [0] * H", "-query = []", "-allcnt = 0", "-for h in range(H):", "- Cs = list(eval(input()))", "- query.append(Cs)", "- cnt = sum([1 if i == \"#\" else 0 for i in Cs])", "- rows[h] = cnt", "- allcnt += cnt", "+query = [list(eval(input())) for _ in range(H)]", "- skip = s...
false
0.044138
0.04417
0.999275
[ "s957117603", "s786322829" ]
u386819480
p03633
python
s451452244
s409798195
35
23
5,076
3,572
Accepted
Accepted
34.29
#!/usr/bin/env python3 import sys from fractions import gcd # from math import gcd from functools import reduce def lcm(x, y): return (x * y) // gcd(x, y) def solve(N: int, T: "List[int]"): print((reduce(lcm, T))) return # Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools...
#!/usr/bin/env python3 import sys from functools import reduce sys.setrecursionlimit(10000000) INF = 1<<32 def solve(N: int, T: "List[int]"): from functools import reduce def lcm_base(a: int, b:int): return a*b // gcd(a,b) def lcm(*numbers): return reduce(lcm_base, numbers, ...
28
41
754
841
#!/usr/bin/env python3 import sys from fractions import gcd # from math import gcd from functools import reduce def lcm(x, y): return (x * y) // gcd(x, y) def solve(N: int, T: "List[int]"): print((reduce(lcm, T))) return # Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You ...
#!/usr/bin/env python3 import sys from functools import reduce sys.setrecursionlimit(10000000) INF = 1 << 32 def solve(N: int, T: "List[int]"): from functools import reduce def lcm_base(a: int, b: int): return a * b // gcd(a, b) def lcm(*numbers): return reduce(lcm_base, numbers, 1) ...
false
31.707317
[ "-from fractions import gcd", "-", "-# from math import gcd", "-", "-def lcm(x, y):", "- return (x * y) // gcd(x, y)", "+sys.setrecursionlimit(10000000)", "+INF = 1 << 32", "- print((reduce(lcm, T)))", "+ from functools import reduce", "+", "+ def lcm_base(a: int, b: int):", "+ ...
false
0.048649
0.059713
0.814717
[ "s451452244", "s409798195" ]
u895558682
p02768
python
s182193300
s423059519
165
149
3,064
3,064
Accepted
Accepted
9.7
M = 10**9 + 7 n,a,b = list(map(int, input().split())) def modinv(n): return pow(n, M-2, M) def comb(n, r): num = 1 for i in range(n,n-r,-1): cur = i while cur%M == 0: cur //= M num = (num*cur)%M denom = 1 for i in range(1,r+1): cur = i ...
M = 10**9 + 7 n,a,b = list(map(int, input().split())) def modinv(n): return pow(n, M-2, M) def comb(n, r): num = denom = 1 for i in range(1,r+1): num = (num*(n+1-i))%M denom = (denom*i)%M return num * modinv(denom) % M print(((pow(2, n, M) - comb(n, a) - comb(n, b) - 1) %...
25
14
492
316
M = 10**9 + 7 n, a, b = list(map(int, input().split())) def modinv(n): return pow(n, M - 2, M) def comb(n, r): num = 1 for i in range(n, n - r, -1): cur = i while cur % M == 0: cur //= M num = (num * cur) % M denom = 1 for i in range(1, r + 1): cur = i...
M = 10**9 + 7 n, a, b = list(map(int, input().split())) def modinv(n): return pow(n, M - 2, M) def comb(n, r): num = denom = 1 for i in range(1, r + 1): num = (num * (n + 1 - i)) % M denom = (denom * i) % M return num * modinv(denom) % M print(((pow(2, n, M) - comb(n, a) - comb(n, ...
false
44
[ "- num = 1", "- for i in range(n, n - r, -1):", "- cur = i", "- while cur % M == 0:", "- cur //= M", "- num = (num * cur) % M", "- denom = 1", "+ num = denom = 1", "- cur = i", "- while cur % M == 0:", "- cur //= M", "- ...
false
0.236346
0.15623
1.512805
[ "s182193300", "s423059519" ]
u433380437
p03386
python
s257652769
s813008554
75
26
62,432
9,196
Accepted
Accepted
65.33
a,b,k = list(map(int,input().split())) A=[] for i in range(a,min(a+k,b+1)): A.append(i) B=[] for i in range(b,max(b-k,a-1),-1): B.append(i) C=list(set(A+B)) C.sort(reverse=False) for j in range(len(C)): print((C[j]))
a,b,k = list(map(int,input().split())) A=[] B=[] for i in range(a,min(a+k,b+1)): A.append(i) for j in range(b,max(b-k,a-1),-1): A.append(j) B=list(set(A)) B.sort(reverse=False) for p in range(len(B)): print((B[p]))
11
11
230
228
a, b, k = list(map(int, input().split())) A = [] for i in range(a, min(a + k, b + 1)): A.append(i) B = [] for i in range(b, max(b - k, a - 1), -1): B.append(i) C = list(set(A + B)) C.sort(reverse=False) for j in range(len(C)): print((C[j]))
a, b, k = list(map(int, input().split())) A = [] B = [] for i in range(a, min(a + k, b + 1)): A.append(i) for j in range(b, max(b - k, a - 1), -1): A.append(j) B = list(set(A)) B.sort(reverse=False) for p in range(len(B)): print((B[p]))
false
0
[ "+B = []", "-B = []", "-for i in range(b, max(b - k, a - 1), -1):", "- B.append(i)", "-C = list(set(A + B))", "-C.sort(reverse=False)", "-for j in range(len(C)):", "- print((C[j]))", "+for j in range(b, max(b - k, a - 1), -1):", "+ A.append(j)", "+B = list(set(A))", "+B.sort(reverse=F...
false
0.042372
0.101926
0.41571
[ "s257652769", "s813008554" ]
u887207211
p03252
python
s341320356
s416608098
256
29
7,708
3,632
Accepted
Accepted
88.67
S = sorted(eval(input())) T = sorted(eval(input())) S_list = [] T_list = [] for alp in "abcdefghijklmnopqrstuvwxyz": S_list.append(S.count(alp)) T_list.append(T.count(alp)) if(sorted(S_list) != sorted(T_list)): print('No') else: print('Yes')
S = eval(input()) T = eval(input()) s = [] t = [] for alp in "abcdefghijklmnopqrstuvwxyz": s.append(S.count(alp)) t.append(T.count(alp)) if(sorted(s) == sorted(t)): print("Yes") else: print("No")
11
11
247
202
S = sorted(eval(input())) T = sorted(eval(input())) S_list = [] T_list = [] for alp in "abcdefghijklmnopqrstuvwxyz": S_list.append(S.count(alp)) T_list.append(T.count(alp)) if sorted(S_list) != sorted(T_list): print("No") else: print("Yes")
S = eval(input()) T = eval(input()) s = [] t = [] for alp in "abcdefghijklmnopqrstuvwxyz": s.append(S.count(alp)) t.append(T.count(alp)) if sorted(s) == sorted(t): print("Yes") else: print("No")
false
0
[ "-S = sorted(eval(input()))", "-T = sorted(eval(input()))", "-S_list = []", "-T_list = []", "+S = eval(input())", "+T = eval(input())", "+s = []", "+t = []", "- S_list.append(S.count(alp))", "- T_list.append(T.count(alp))", "-if sorted(S_list) != sorted(T_list):", "+ s.append(S.count(...
false
0.120879
0.037331
3.238073
[ "s341320356", "s416608098" ]
u729133443
p02685
python
s556683846
s080264595
690
145
48,408
79,344
Accepted
Accepted
78.99
M=998244353 class Factorial: def __init__(self,n): self.f=f=[0]*(n+1) f[0]=b=1 for i in range(1,n+1):f[i]=b=b*i%M self.inv=inv=[0]*(n+1) inv[n]=b=pow(self.f[n],-1,M) for i in range(n,0,-1):inv[i-1]=b=b*i%M def factorial(self,i): return self.f[i] ...
M=998244353 class Factorial: def __init__(self,n): self.f=f=[0]*(n+1) f[0]=b=1 for i in range(1,n+1):f[i]=b=b*i%M self.inv=inv=[0]*(n+1) inv[n]=b=pow(self.f[n],M-2,M) for i in range(n,0,-1):inv[i-1]=b=b*i%M def factorial(self,i): return self.f[i]...
19
19
612
613
M = 998244353 class Factorial: def __init__(self, n): self.f = f = [0] * (n + 1) f[0] = b = 1 for i in range(1, n + 1): f[i] = b = b * i % M self.inv = inv = [0] * (n + 1) inv[n] = b = pow(self.f[n], -1, M) for i in range(n, 0, -1): inv[i - 1...
M = 998244353 class Factorial: def __init__(self, n): self.f = f = [0] * (n + 1) f[0] = b = 1 for i in range(1, n + 1): f[i] = b = b * i % M self.inv = inv = [0] * (n + 1) inv[n] = b = pow(self.f[n], M - 2, M) for i in range(n, 0, -1): inv[i ...
false
0
[ "- inv[n] = b = pow(self.f[n], -1, M)", "+ inv[n] = b = pow(self.f[n], M - 2, M)" ]
false
0.776057
0.326549
2.376544
[ "s556683846", "s080264595" ]
u254022775
p03346
python
s709937887
s585220619
451
410
18,916
11,048
Accepted
Accepted
9.09
N = int(eval(input())) a = [0 for i in range(N)] chain = [0 for i in range(N+1)] for i in range(N): a[i] = int(eval(input())) chain[a[i]] = chain[a[i]-1]+1 print((N-max(chain)))
N = int(eval(input())) chain = [0 for i in range(N+1)] for i in range(N): a = int(eval(input())) chain[a] = chain[a-1]+1 print((N-max(chain)))
7
6
173
137
N = int(eval(input())) a = [0 for i in range(N)] chain = [0 for i in range(N + 1)] for i in range(N): a[i] = int(eval(input())) chain[a[i]] = chain[a[i] - 1] + 1 print((N - max(chain)))
N = int(eval(input())) chain = [0 for i in range(N + 1)] for i in range(N): a = int(eval(input())) chain[a] = chain[a - 1] + 1 print((N - max(chain)))
false
14.285714
[ "-a = [0 for i in range(N)]", "- a[i] = int(eval(input()))", "- chain[a[i]] = chain[a[i] - 1] + 1", "+ a = int(eval(input()))", "+ chain[a] = chain[a - 1] + 1" ]
false
0.048073
0.048703
0.987073
[ "s709937887", "s585220619" ]
u832039789
p03745
python
s471121341
s098684441
79
66
14,224
14,224
Accepted
Accepted
16.46
n = int(eval(input())) a = list(map(int,input().split())) cond = 0 # 1: 上昇, -1: 減少, 0: 一緒 res = 1 for i in range(1,len(a)): if a[i] > a[i-1]: # 上昇 if cond != 1: if cond == -1: res += 1 cond = 0 else: cond = 1 e...
n = int(eval(input())) a = list(map(int,input().split())) # 0 : 未定 # 1 : 増加 # -1 : 減少 res = 0 prv = a[0] cond = 0 for i in a: if cond == 0: if prv > i: cond = -1 elif prv < i: cond = 1 elif cond == 1: if prv > i: cond = 0 ...
23
26
508
433
n = int(eval(input())) a = list(map(int, input().split())) cond = 0 # 1: 上昇, -1: 減少, 0: 一緒 res = 1 for i in range(1, len(a)): if a[i] > a[i - 1]: # 上昇 if cond != 1: if cond == -1: res += 1 cond = 0 else: cond = 1 elif a[i] <...
n = int(eval(input())) a = list(map(int, input().split())) # 0 : 未定 # 1 : 増加 # -1 : 減少 res = 0 prv = a[0] cond = 0 for i in a: if cond == 0: if prv > i: cond = -1 elif prv < i: cond = 1 elif cond == 1: if prv > i: cond = 0 res += 1 el...
false
11.538462
[ "+# 0 : 未定", "+# 1 : 増加", "+# -1 : 減少", "+res = 0", "+prv = a[0]", "-# 1: 上昇, -1: 減少, 0: 一緒", "-res = 1", "-for i in range(1, len(a)):", "- if a[i] > a[i - 1]:", "- # 上昇", "- if cond != 1:", "- if cond == -1:", "- res += 1", "- co...
false
0.17576
0.045181
3.890135
[ "s471121341", "s098684441" ]
u828766688
p03333
python
s141215168
s198972942
1,636
601
109,016
57,944
Accepted
Accepted
63.26
""" 貪欲か? 今いる地点から左のRと右のLの数を比較 多い方の最遠点に行く→そのような点が無くなったら終了 証明は… まず右のR,左のLは無意味→区間を無駄にするだけ 少ない方に行く→多い方の区間が無駄になる 近い点に行く→ ここがむずい 遠い区間が無駄になるのを防ぐため? 実装は? 多い方の処理→BITで左にあるRの数と右にあるLの数をlogNで 優先度付きキューで最小のRと最大のLを検出 10^5+1 を足して1 ~ 2*10^5 + 1の区間として扱う 初期・終了地点は 10^5+1 """ import heapq def bitadd(a,w,bit): #aにw...
N = int(eval(input())) L = [] R = [] for i in range(N): l,r = list(map(int,input().split())) L.append(2 * l) R.append(-2 * r) L.sort() R.sort() L.reverse() R.reverse() ans = 0 now = 0 for i in range(N): now += L[i] ans = max(ans,now) now += R[i] ans = max(ans,now...
122
33
2,004
438
""" 貪欲か? 今いる地点から左のRと右のLの数を比較 多い方の最遠点に行く→そのような点が無くなったら終了 証明は… まず右のR,左のLは無意味→区間を無駄にするだけ 少ない方に行く→多い方の区間が無駄になる 近い点に行く→ ここがむずい 遠い区間が無駄になるのを防ぐため? 実装は? 多い方の処理→BITで左にあるRの数と右にあるLの数をlogNで 優先度付きキューで最小のRと最大のLを検出 10^5+1 を足して1 ~ 2*10^5 + 1の区間として扱う 初期・終了地点は 10^5+1 """ import heapq def bitadd(a, w, bit): # aにwを加える(1-origin) x =...
N = int(eval(input())) L = [] R = [] for i in range(N): l, r = list(map(int, input().split())) L.append(2 * l) R.append(-2 * r) L.sort() R.sort() L.reverse() R.reverse() ans = 0 now = 0 for i in range(N): now += L[i] ans = max(ans, now) now += R[i] ans = max(ans, now) now = 0 for i in range(...
false
72.95082
[ "-\"\"\"", "-貪欲か?", "-今いる地点から左のRと右のLの数を比較", "-多い方の最遠点に行く→そのような点が無くなったら終了", "-証明は…", "-まず右のR,左のLは無意味→区間を無駄にするだけ", "-少ない方に行く→多い方の区間が無駄になる", "-近い点に行く→ ここがむずい", "-遠い区間が無駄になるのを防ぐため?", "-実装は?", "-多い方の処理→BITで左にあるRの数と右にあるLの数をlogNで", "-優先度付きキューで最小のRと最大のLを検出", "-10^5+1 を足して1 ~ 2*10^5 + 1の区間として扱う", "...
false
0.056504
0.043197
1.308061
[ "s141215168", "s198972942" ]
u272028993
p03845
python
s361179931
s296450611
29
19
2,692
2,568
Accepted
Accepted
34.48
import copy n=int(input()) t=list(map(int,input().split())) m=int(input()) pt=[list(map(int,input().split())) for _ in range(m)] ans=[0]*m for i in range(m): tmp=copy.deepcopy(t) tmp[pt[i][0]-1]=pt[i][1] for j in range(n): ans[i]+=tmp[j] for i in range(m): print((ans[i]))
n=int(input()) t=list(map(int,input().split())) m=int(input()) pt=[list(map(int,input().split())) for _ in range(m)] ans=[0]*m for i in range(m): tmp=list(t) tmp[pt[i][0]-1]=pt[i][1] for j in range(n): ans[i]+=tmp[j] for i in range(m): print((ans[i]))
13
12
314
292
import copy n = int(input()) t = list(map(int, input().split())) m = int(input()) pt = [list(map(int, input().split())) for _ in range(m)] ans = [0] * m for i in range(m): tmp = copy.deepcopy(t) tmp[pt[i][0] - 1] = pt[i][1] for j in range(n): ans[i] += tmp[j] for i in range(m): print((ans[i]))
n = int(input()) t = list(map(int, input().split())) m = int(input()) pt = [list(map(int, input().split())) for _ in range(m)] ans = [0] * m for i in range(m): tmp = list(t) tmp[pt[i][0] - 1] = pt[i][1] for j in range(n): ans[i] += tmp[j] for i in range(m): print((ans[i]))
false
7.692308
[ "-import copy", "-", "- tmp = copy.deepcopy(t)", "+ tmp = list(t)" ]
false
0.041625
0.043749
0.951445
[ "s361179931", "s296450611" ]
u773265208
p02790
python
s087981570
s761940484
19
17
3,060
2,940
Accepted
Accepted
10.53
a,b = list(map(str,input().split())) a_int = int(a) b_int = int(b) ans = [] sa = '' sb = '' for _ in range(b_int): sa += a for _ in range(a_int): sb += b ans.append(sa) ans.append(sb) ans.sort() print((ans[0]))
a,b = list(map(int,input().split())) if a > b: print((str(b)*a)) else: print((str(a)*b))
19
6
228
89
a, b = list(map(str, input().split())) a_int = int(a) b_int = int(b) ans = [] sa = "" sb = "" for _ in range(b_int): sa += a for _ in range(a_int): sb += b ans.append(sa) ans.append(sb) ans.sort() print((ans[0]))
a, b = list(map(int, input().split())) if a > b: print((str(b) * a)) else: print((str(a) * b))
false
68.421053
[ "-a, b = list(map(str, input().split()))", "-a_int = int(a)", "-b_int = int(b)", "-ans = []", "-sa = \"\"", "-sb = \"\"", "-for _ in range(b_int):", "- sa += a", "-for _ in range(a_int):", "- sb += b", "-ans.append(sa)", "-ans.append(sb)", "-ans.sort()", "-print((ans[0]))", "+a, b ...
false
0.068023
0.067272
1.011168
[ "s087981570", "s761940484" ]
u631277801
p03576
python
s208199436
s785283452
1,429
1,304
48,220
3,188
Accepted
Accepted
8.75
import sys stdin = sys.stdin def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return...
import sys stdin = sys.stdin def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return list(n...
39
55
1,063
1,408
import sys stdin = sys.stdin def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.readline().r...
import sys stdin = sys.stdin def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x) - 1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip()...
false
29.090909
[ "- return list(map(int, stdin.readline().split()))", "+ return map(int, stdin.readline().split())", "- return [int(x) - 1 for x in stdin.readline().split()]", "+ return map(lambda x: int(x) - 1, stdin.readline().split())", "- return list(map(float, stdin.readline().split()))", "+ return ...
false
0.039531
0.038542
1.025649
[ "s208199436", "s785283452" ]
u968166680
p02838
python
s284853051
s162750883
313
212
118,580
136,744
Accepted
Accepted
32.27
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, *A = list(map(int, read().split())) ans = 0 p = 1 for _ in range(60): n = 0 for i in range(N): ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, *A = list(map(int, read().split())) ans = 0 p = 1 for _ in range(60): n = 0 for i in range(N): ...
30
29
532
521
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): N, *A = list(map(int, read().split())) ans = 0 p = 1 for _ in range(60): n = 0 for i in range(N): if A[i] ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): N, *A = list(map(int, read().split())) ans = 0 p = 1 for _ in range(60): n = 0 for i in range(N): A[i], d ...
false
3.333333
[ "- if A[i] % 2:", "- n += 1", "- A[i] //= 2", "+ A[i], d = A[i] // 2, A[i] % 2", "+ n += d" ]
false
0.041673
0.068078
0.612129
[ "s284853051", "s162750883" ]
u949338836
p02390
python
s412207181
s970898842
40
30
6,724
6,724
Accepted
Accepted
25
#coding:utf-8 #1_1_D 2015.3.6 second = int(eval(input())) hour = second // 3600 minutes = (second // 60) % 60 second %= 60 print(("%s:%s:%s" %(hour,minutes,second)))
#coding:utf-8 #1_1_D 2015.3.6 second = int(eval(input())) hour = second // 3600 minutes = (second // 60) % 60 second %= 60 print(("{}:{}:{}".format(hour,minutes,second)))
7
7
163
168
# coding:utf-8 # 1_1_D 2015.3.6 second = int(eval(input())) hour = second // 3600 minutes = (second // 60) % 60 second %= 60 print(("%s:%s:%s" % (hour, minutes, second)))
# coding:utf-8 # 1_1_D 2015.3.6 second = int(eval(input())) hour = second // 3600 minutes = (second // 60) % 60 second %= 60 print(("{}:{}:{}".format(hour, minutes, second)))
false
0
[ "-print((\"%s:%s:%s\" % (hour, minutes, second)))", "+print((\"{}:{}:{}\".format(hour, minutes, second)))" ]
false
0.071436
0.041233
1.732485
[ "s412207181", "s970898842" ]
u060793972
p03379
python
s438967659
s196597039
301
201
26,180
28,608
Accepted
Accepted
33.22
n=int(eval(input())) x=list(map(int,input().split())) lr,rr=sorted(x)[n//2-1:n//2+1] for i in x: print((lr if lr<i else rr))
n=int(eval(input())) x=list(map(int,input().split())) lr,rr=sorted(x)[n//2-1:n//2+1] print(('\n'.join([str(lr) if lr<i else str(rr) for i in x])))
5
4
124
141
n = int(eval(input())) x = list(map(int, input().split())) lr, rr = sorted(x)[n // 2 - 1 : n // 2 + 1] for i in x: print((lr if lr < i else rr))
n = int(eval(input())) x = list(map(int, input().split())) lr, rr = sorted(x)[n // 2 - 1 : n // 2 + 1] print(("\n".join([str(lr) if lr < i else str(rr) for i in x])))
false
20
[ "-for i in x:", "- print((lr if lr < i else rr))", "+print((\"\\n\".join([str(lr) if lr < i else str(rr) for i in x])))" ]
false
0.041603
0.03856
1.078913
[ "s438967659", "s196597039" ]
u433380437
p02803
python
s525859923
s774141388
165
130
75,232
74,616
Accepted
Accepted
21.21
from collections import deque H, W = list(map(int, input().split())) maze = [eval(input()) for i in range(H)] def bfs(maze, sy, sx): visited = [[-1]*W for j in range(H)] queue = deque([[sy, sx]]) visited[sy][sx] = 0 while queue: ans=0 y, x = queue.popleft() for j, k i...
h,w = list(map(int,input().split())) C = [list(eval(input())) for i in range(h)] queue = [] visited = [] visited = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if C[i][j] == '.': queue.append([i,j]) visited[i][j] = 1 ...
31
34
972
1,056
from collections import deque H, W = list(map(int, input().split())) maze = [eval(input()) for i in range(H)] def bfs(maze, sy, sx): visited = [[-1] * W for j in range(H)] queue = deque([[sy, sx]]) visited[sy][sx] = 0 while queue: ans = 0 y, x = queue.popleft() for j, k in ([1...
h, w = list(map(int, input().split())) C = [list(eval(input())) for i in range(h)] queue = [] visited = [] visited = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if C[i][j] == ".": queue.append([i, j]) visited[i][j] = 1 dy_dx = [...
false
8.823529
[ "-from collections import deque", "-", "-H, W = list(map(int, input().split()))", "-maze = [eval(input()) for i in range(H)]", "-", "-", "-def bfs(maze, sy, sx):", "- visited = [[-1] * W for j in range(H)]", "- queue = deque([[sy, sx]])", "- visited[sy][sx] = 0", "- while queue:", ...
false
0.040551
0.078874
0.514124
[ "s525859923", "s774141388" ]
u671060652
p03086
python
s417044607
s740258057
296
64
67,052
61,836
Accepted
Accepted
78.38
import itertools import math import fractions import functools import copy s = eval(input()) maximum = 0 count = 0 for i in range(len(s)): if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T": count += 1 maximum = max(maximum,count) else: count = 0 print(maxim...
def main(): # n = int(input()) # n, m = map(int, input().split()) # a = list(map(int, input().split())) s = eval(input()) # h = [int(input()) for _ in rane(n)] count = 0 maxi = 0 for string in s: if string == "A" or string == "C" or string == "G" or string == "T": ...
18
20
317
469
import itertools import math import fractions import functools import copy s = eval(input()) maximum = 0 count = 0 for i in range(len(s)): if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T": count += 1 maximum = max(maximum, count) else: count = 0 print(maximum)
def main(): # n = int(input()) # n, m = map(int, input().split()) # a = list(map(int, input().split())) s = eval(input()) # h = [int(input()) for _ in rane(n)] count = 0 maxi = 0 for string in s: if string == "A" or string == "C" or string == "G" or string == "T": cou...
false
10
[ "-import itertools", "-import math", "-import fractions", "-import functools", "-import copy", "+def main():", "+ # n = int(input())", "+ # n, m = map(int, input().split())", "+ # a = list(map(int, input().split()))", "+ s = eval(input())", "+ # h = [int(input()) for _ in rane(n)]...
false
0.035994
0.04554
0.790396
[ "s417044607", "s740258057" ]
u368249389
p02689
python
s454124211
s723665219
300
261
20,164
20,116
Accepted
Accepted
13
# Problem C - Peaks # input N, M = list(map(int, input().split())) h_list = list(map(int, input().split())) # initialization score_list = [0]*N for i in range(M): a, b = list(map(int, input().split())) if h_list[a-1]<h_list[b-1]: if h_list[b-1]>=0: score_list[b-1] += 1 ...
# Problem C - Peaks # input N, M = list(map(int, input().split())) h_list = list(map(int, input().split())) # initialization ans_list = [1]*N ans = 0 # count for m in range(M): a, b = list(map(int, input().split())) if h_list[a-1]>h_list[b-1]: ans_list[b-1] = -1 elif h_list[a-1]<h_...
32
28
804
500
# Problem C - Peaks # input N, M = list(map(int, input().split())) h_list = list(map(int, input().split())) # initialization score_list = [0] * N for i in range(M): a, b = list(map(int, input().split())) if h_list[a - 1] < h_list[b - 1]: if h_list[b - 1] >= 0: score_list[b - 1] += 1 ...
# Problem C - Peaks # input N, M = list(map(int, input().split())) h_list = list(map(int, input().split())) # initialization ans_list = [1] * N ans = 0 # count for m in range(M): a, b = list(map(int, input().split())) if h_list[a - 1] > h_list[b - 1]: ans_list[b - 1] = -1 elif h_list[a - 1] < h_list...
false
12.5
[ "-score_list = [0] * N", "-for i in range(M):", "+ans_list = [1] * N", "+ans = 0", "+# count", "+for m in range(M):", "- if h_list[a - 1] < h_list[b - 1]:", "- if h_list[b - 1] >= 0:", "- score_list[b - 1] += 1", "- else:", "- score_list[b - 1] = -1 * float...
false
0.064511
0.063199
1.020755
[ "s454124211", "s723665219" ]
u332385682
p03701
python
s269883640
s737318021
132
18
3,188
3,060
Accepted
Accepted
86.36
import sys from itertools import accumulate def solve(): n = int(eval(input())) s = [int(eval(input())) for i in range(n)] lim = n * 100 dp = [False] * (lim + 1) dp[0] = True for i in range(n): for j in range(lim, s[i] - 1, -1): dp[j] |= dp[j - s[i]] fo...
import sys def solve(): n = int(eval(input())) s = [int(eval(input())) for i in range(n)] s.sort() ssum = sum(s) if ssum % 10: print(ssum) else: for si in s: if si % 10: print((ssum - si)) return print((0)) ...
26
21
500
346
import sys from itertools import accumulate def solve(): n = int(eval(input())) s = [int(eval(input())) for i in range(n)] lim = n * 100 dp = [False] * (lim + 1) dp[0] = True for i in range(n): for j in range(lim, s[i] - 1, -1): dp[j] |= dp[j - s[i]] for i in range(lim,...
import sys def solve(): n = int(eval(input())) s = [int(eval(input())) for i in range(n)] s.sort() ssum = sum(s) if ssum % 10: print(ssum) else: for si in s: if si % 10: print((ssum - si)) return print((0)) if __name__ == "_...
false
19.230769
[ "-from itertools import accumulate", "- lim = n * 100", "- dp = [False] * (lim + 1)", "- dp[0] = True", "- for i in range(n):", "- for j in range(lim, s[i] - 1, -1):", "- dp[j] |= dp[j - s[i]]", "- for i in range(lim, 0, -1):", "- if i % 10 == 0:", "- ...
false
0.04517
0.043019
1.049989
[ "s269883640", "s737318021" ]
u083960235
p03795
python
s715120052
s667361305
40
27
5,148
3,892
Accepted
Accepted
32.5
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii...
27
24
786
800
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_upper...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_upper...
false
11.111111
[ "-from fractions import gcd", "+from heapq import heapify, heappop, heappush", "-c = N // 15", "-a = N * 800 - c * 200", "-print(a)", "+x = N * 800", "+y = N // 15 * 200", "+print((x - y))" ]
false
0.072945
0.040262
1.81178
[ "s715120052", "s667361305" ]
u305366205
p02796
python
s419755907
s595137059
455
407
16,996
18,260
Accepted
Accepted
10.55
n = int(eval(input())) robots = [] for _ in range(n): xi, li = list(map(int, input().split())) robots.append((xi + li, xi - li)) robots.sort() ans = n pre_right = robots[0][0] for i in range(1, n): now_left = robots[i][1] if pre_right > now_left: ans -= 1 else: pre_right...
n = int(eval(input())) robots = [] for _ in range(n): xi, li = list(map(int, input().split())) robots.append((xi - li, xi + li)) robots.sort(key=lambda x: x[1]) ans = 0 pre_r = -float('inf') for l, r in robots: if pre_r <= l: ans += 1 pre_r = r print(ans)
15
13
336
284
n = int(eval(input())) robots = [] for _ in range(n): xi, li = list(map(int, input().split())) robots.append((xi + li, xi - li)) robots.sort() ans = n pre_right = robots[0][0] for i in range(1, n): now_left = robots[i][1] if pre_right > now_left: ans -= 1 else: pre_right = robots[i][...
n = int(eval(input())) robots = [] for _ in range(n): xi, li = list(map(int, input().split())) robots.append((xi - li, xi + li)) robots.sort(key=lambda x: x[1]) ans = 0 pre_r = -float("inf") for l, r in robots: if pre_r <= l: ans += 1 pre_r = r print(ans)
false
13.333333
[ "- robots.append((xi + li, xi - li))", "-robots.sort()", "-ans = n", "-pre_right = robots[0][0]", "-for i in range(1, n):", "- now_left = robots[i][1]", "- if pre_right > now_left:", "- ans -= 1", "- else:", "- pre_right = robots[i][0]", "+ robots.append((xi - li, xi...
false
0.040022
0.047616
0.840525
[ "s419755907", "s595137059" ]
u912237403
p00071
python
s588219945
s628385876
20
10
4,280
4,288
Accepted
Accepted
50
def bomb(x,y): s=M[y] if s[x]=="0":return M[y]=s[:x]+"0"+s[x+1:] for e in [-3,-2,-1,1,2,3]: bomb(x+e,y) bomb(x,y+e) return A=list(range(14)) B=list(range(3,11)) M=["00000000000000" for i in A] z="000" n=eval(input()) for i in range(n): s=input() for j in B: ...
def bomb(x,y): s=M[y] if s[x]=="0":return M[y]=s[:x]+"0"+s[x+1:] R=[-3,-2,-1,1,2,3] for e in R: bomb(x+e,y) bomb(x,y+e) return A=list(range(14)) B=list(range(3,11)) M=["00000000000000" for i in A] z="000" n=eval(input()) for i in range(n): s=input() for ...
24
25
455
464
def bomb(x, y): s = M[y] if s[x] == "0": return M[y] = s[:x] + "0" + s[x + 1 :] for e in [-3, -2, -1, 1, 2, 3]: bomb(x + e, y) bomb(x, y + e) return A = list(range(14)) B = list(range(3, 11)) M = ["00000000000000" for i in A] z = "000" n = eval(input()) for i in range(n): ...
def bomb(x, y): s = M[y] if s[x] == "0": return M[y] = s[:x] + "0" + s[x + 1 :] R = [-3, -2, -1, 1, 2, 3] for e in R: bomb(x + e, y) bomb(x, y + e) return A = list(range(14)) B = list(range(3, 11)) M = ["00000000000000" for i in A] z = "000" n = eval(input()) for i in r...
false
4
[ "- for e in [-3, -2, -1, 1, 2, 3]:", "+ R = [-3, -2, -1, 1, 2, 3]", "+ for e in R:" ]
false
0.04139
0.031545
1.312103
[ "s588219945", "s628385876" ]
u827448139
p00275
python
s445758880
s335153704
50
40
6,724
6,724
Accepted
Accepted
20
while 1: n=int(eval(input())) if n==0: break cs=eval(input()) a,b=[0]*n,0 for i in range(100): if cs[i]=="M": a[i%n]+=1 elif cs[i]=="S": a[i%n],b=0,b+1+a[i%n] elif cs[i]=="L": a[i%n],b=a[i%n]+1+b,0 a.sort() print((" ".join(map(str,a+[b]))))
while 1: n=int(eval(input())) if n==0: break a,b,i=[0]*n,0,0 for c in eval(input()): if c=="M": a[i]+=1 elif c=="S": a[i],b=0,b+1+a[i] elif c=="L": a[i],b=a[i]+1+b,0 i=(i+1)%n a.sort() print((" ".join(map(str,a+[b]))))
14
11
283
242
while 1: n = int(eval(input())) if n == 0: break cs = eval(input()) a, b = [0] * n, 0 for i in range(100): if cs[i] == "M": a[i % n] += 1 elif cs[i] == "S": a[i % n], b = 0, b + 1 + a[i % n] elif cs[i] == "L": a[i % n], b = a[i % n]...
while 1: n = int(eval(input())) if n == 0: break a, b, i = [0] * n, 0, 0 for c in eval(input()): if c == "M": a[i] += 1 elif c == "S": a[i], b = 0, b + 1 + a[i] elif c == "L": a[i], b = a[i] + 1 + b, 0 i = (i + 1) % n a.sort...
false
21.428571
[ "- cs = eval(input())", "- a, b = [0] * n, 0", "- for i in range(100):", "- if cs[i] == \"M\":", "- a[i % n] += 1", "- elif cs[i] == \"S\":", "- a[i % n], b = 0, b + 1 + a[i % n]", "- elif cs[i] == \"L\":", "- a[i % n], b = a[i % n] + 1 ...
false
0.041665
0.043363
0.960857
[ "s445758880", "s335153704" ]
u353638740
p03854
python
s410166427
s709098654
157
90
3,444
3,188
Accepted
Accepted
42.68
str_list = ["dream","erase","er","ase","r",] class stringJudge(): def __init__(self,string,string_list): self.string = string self.string_list = string_list def isNextMatch(self): for (i,str_val) in enumerate(str_list): if self.string.startswith(str_val): ...
str_list = ["dream","dreamer","erase","eraser"] class stringJudge(): def __init__(self,string,string_list): self.string = string self.string_list = string_list def isNextMatch(self): for str_val in self.string_list: if self.string.endswith(str_val): ...
39
24
1,766
677
str_list = [ "dream", "erase", "er", "ase", "r", ] class stringJudge: def __init__(self, string, string_list): self.string = string self.string_list = string_list def isNextMatch(self): for (i, str_val) in enumerate(str_list): if self.string.startswith(...
str_list = ["dream", "dreamer", "erase", "eraser"] class stringJudge: def __init__(self, string, string_list): self.string = string self.string_list = string_list def isNextMatch(self): for str_val in self.string_list: if self.string.endswith(str_val): self...
false
38.461538
[ "-str_list = [", "- \"dream\",", "- \"erase\",", "- \"er\",", "- \"ase\",", "- \"r\",", "-]", "+str_list = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]", "- for (i, str_val) in enumerate(str_list):", "- if self.string.startswith(str_val):", "- s...
false
0.042808
0.043631
0.981143
[ "s410166427", "s709098654" ]
u219015402
p02755
python
s357643189
s589420878
19
17
3,060
3,060
Accepted
Accepted
10.53
import math A,B= list(map(int,input().split())) # min_x = math.ceil(max(A/8,B/10)*100) min_x = max(A//0.08,B//0.10) +1 max_x = (min((A+1)/8,(B+1)/10)*100) if max_x-min_x>0: ans = int(min_x) else: ans = -1 print(ans)
import math A,B= list(map(int,input().split())) min_x = math.ceil(max(A/0.08,B/0.10)) # min_x = max(A//0.08,B//0.10) +1 max_x = (min((A+1)/8,(B+1)/10)*100) if max_x-min_x>0: ans = int(min_x) else: ans = -1 print(ans)
11
11
228
229
import math A, B = list(map(int, input().split())) # min_x = math.ceil(max(A/8,B/10)*100) min_x = max(A // 0.08, B // 0.10) + 1 max_x = min((A + 1) / 8, (B + 1) / 10) * 100 if max_x - min_x > 0: ans = int(min_x) else: ans = -1 print(ans)
import math A, B = list(map(int, input().split())) min_x = math.ceil(max(A / 0.08, B / 0.10)) # min_x = max(A//0.08,B//0.10) +1 max_x = min((A + 1) / 8, (B + 1) / 10) * 100 if max_x - min_x > 0: ans = int(min_x) else: ans = -1 print(ans)
false
0
[ "-# min_x = math.ceil(max(A/8,B/10)*100)", "-min_x = max(A // 0.08, B // 0.10) + 1", "+min_x = math.ceil(max(A / 0.08, B / 0.10))", "+# min_x = max(A//0.08,B//0.10) +1" ]
false
0.04752
0.047015
1.010742
[ "s357643189", "s589420878" ]
u222841610
p03449
python
s880930742
s784808780
20
18
3,064
3,060
Accepted
Accepted
10
n = int(eval(input())) a1 = list(map(int, input().split())) a2 = list(map(int, input().split())) count = 0 max1 = 0 for i in range(n): for j in range(n): if j < i: count += a1[j] elif j==i: count += (a1[j] + a2[j]) else: count += a2[j] if ...
n = int(eval(input())) a1 = list(map(int, input().split())) a2 = list(map(int, input().split())) m = 0 for i in range(n): m = max(m, sum(a1[:i+1])+sum(a2[i:])) print (m)
17
7
378
173
n = int(eval(input())) a1 = list(map(int, input().split())) a2 = list(map(int, input().split())) count = 0 max1 = 0 for i in range(n): for j in range(n): if j < i: count += a1[j] elif j == i: count += a1[j] + a2[j] else: count += a2[j] if max1 < count:...
n = int(eval(input())) a1 = list(map(int, input().split())) a2 = list(map(int, input().split())) m = 0 for i in range(n): m = max(m, sum(a1[: i + 1]) + sum(a2[i:])) print(m)
false
58.823529
[ "-count = 0", "-max1 = 0", "+m = 0", "- for j in range(n):", "- if j < i:", "- count += a1[j]", "- elif j == i:", "- count += a1[j] + a2[j]", "- else:", "- count += a2[j]", "- if max1 < count:", "- max1 = count", "- count ...
false
0.128499
0.278872
0.460782
[ "s880930742", "s784808780" ]
u816631826
p02711
python
s452147033
s897933176
29
25
9,016
9,112
Accepted
Accepted
13.79
n=int(eval(input())) while(n!=0): digit=n%10 if(digit==7): flag=1 break else: flag=0 n=n//10 if(flag==1): print("Yes") else: print("No")
N=int(eval(input())) if '7' in str(N): print('Yes') else: print('No')
13
5
190
76
n = int(eval(input())) while n != 0: digit = n % 10 if digit == 7: flag = 1 break else: flag = 0 n = n // 10 if flag == 1: print("Yes") else: print("No")
N = int(eval(input())) if "7" in str(N): print("Yes") else: print("No")
false
61.538462
[ "-n = int(eval(input()))", "-while n != 0:", "- digit = n % 10", "- if digit == 7:", "- flag = 1", "- break", "- else:", "- flag = 0", "- n = n // 10", "-if flag == 1:", "+N = int(eval(input()))", "+if \"7\" in str(N):" ]
false
0.037087
0.077804
0.476677
[ "s452147033", "s897933176" ]
u285891772
p02873
python
s020635658
s545097867
565
420
35,876
35,184
Accepted
Accepted
25.66
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
53
47
1,312
1,237
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, ) # , log2 from itertools import ( accumulate, permutations, combinations, combi...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, ) # , log2 from itertools import ( accumulate, permutations, combinations, combi...
false
11.320755
[ "-for i in range(N - 2, -1, -1):", "- if S[i] == \">\":", "+for i in range(N - 1):", "+ if S[N - i - 2] == \">\":", "- r[i] = tmp_r", "+ r[i + 1] = tmp_r", "+r = r[::-1]", "-ans = 0", "-for i in range(N):", "- ans += max(l[i], r[i])", "-# print(l)", "-# print(r)", "-# ...
false
0.047947
0.03917
1.224078
[ "s020635658", "s545097867" ]
u349724238
p02720
python
s988723619
s910559056
744
260
31,508
12,864
Accepted
Accepted
65.05
K = int(eval(input())) A = [1,2,3,4,5,6,7,8,9] for i in range(len(A)): if A[i] != 9: for j in range(-1,2): a = int(str(A[i]) + str(A[i]+j)) A.append(a) else: A.append(98) A.append(99) A.append(100) A.append(101) L1 = len(A.copy()) for i in range(10, L...
K = int(eval(input())) A = [1,2,3,4,5,6,7,8,9] for i in range(len(A)): if A[i] != 9: for j in range(-1,2): a = int(str(A[i]) + str(A[i]+j)) A.append(a) else: A.append(98) A.append(99) A.append(100) A.append(101) L1 = 10 L2 = len(A.copy()) for i in ra...
42
30
1,127
768
K = int(eval(input())) A = [1, 2, 3, 4, 5, 6, 7, 8, 9] for i in range(len(A)): if A[i] != 9: for j in range(-1, 2): a = int(str(A[i]) + str(A[i] + j)) A.append(a) else: A.append(98) A.append(99) A.append(100) A.append(101) L1 = len(A.copy()) for i in range(10, L1)...
K = int(eval(input())) A = [1, 2, 3, 4, 5, 6, 7, 8, 9] for i in range(len(A)): if A[i] != 9: for j in range(-1, 2): a = int(str(A[i]) + str(A[i] + j)) A.append(a) else: A.append(98) A.append(99) A.append(100) A.append(101) L1 = 10 L2 = len(A.copy()) for i in range...
false
28.571429
[ "-L1 = len(A.copy())", "-for i in range(10, L1):", "- B = A[i]", "- if B % 10 == 0:", "- A.append(int(str(B) + \"0\"))", "- A.append(int(str(B) + \"1\"))", "- elif B % 10 == 9:", "- A.append(int(str(B) + \"8\"))", "- A.append(int(str(B) + \"9\"))", "- else:"...
false
1.187684
0.273253
4.346461
[ "s988723619", "s910559056" ]
u777923818
p03702
python
s264149386
s587843470
1,047
390
14,876
17,060
Accepted
Accepted
62.75
# -*- coding: utf-8 -*- def inpl(): return tuple(map(int, input().split())) N, A, B = inpl() D = A-B H = [] res = 0 for _ in range(N): H.append(int(eval(input()))) H = sorted(H) l = sum(H) // (A+B*(N-1)) r = sum([h//A + (h%A>0) for h in H]) def judge(m): nH = [h - B*m for h in H] if sum([...
# -*- coding: utf-8 -*- import numpy as np N, A, B = list(map(int, input().split())) C = A - B E = np.array([int(eval(input())) for _ in range(N)], dtype=np.int64) Z = np.zeros(N, dtype=np.int64) OK = (np.max(E) // B) + 1 NG = 0 while (OK - NG) > 1: m = (OK + NG)//2 if -np.sum((-np.maximum(Z...
31
21
563
385
# -*- coding: utf-8 -*- def inpl(): return tuple(map(int, input().split())) N, A, B = inpl() D = A - B H = [] res = 0 for _ in range(N): H.append(int(eval(input()))) H = sorted(H) l = sum(H) // (A + B * (N - 1)) r = sum([h // A + (h % A > 0) for h in H]) def judge(m): nH = [h - B * m for h in H] if ...
# -*- coding: utf-8 -*- import numpy as np N, A, B = list(map(int, input().split())) C = A - B E = np.array([int(eval(input())) for _ in range(N)], dtype=np.int64) Z = np.zeros(N, dtype=np.int64) OK = (np.max(E) // B) + 1 NG = 0 while (OK - NG) > 1: m = (OK + NG) // 2 if -np.sum((-np.maximum(Z, E - m * B) // C...
false
32.258065
[ "-def inpl():", "- return tuple(map(int, input().split()))", "+import numpy as np", "-", "-N, A, B = inpl()", "-D = A - B", "-H = []", "-res = 0", "-for _ in range(N):", "- H.append(int(eval(input())))", "-H = sorted(H)", "-l = sum(H) // (A + B * (N - 1))", "-r = sum([h // A + (h % A >...
false
0.04509
0.240621
0.187391
[ "s264149386", "s587843470" ]
u813098295
p04045
python
s684958329
s346796503
235
134
34,436
5,380
Accepted
Accepted
42.98
N, K = list(map(int, input().split())) D = list(map(int, input().split())) for i in range(N, 1000000): flag = 0 for j in D: if str(j) in str(i): flag = 1 break if flag == 0: print(i) exit()
def main(): N, K = list(map(int, input().split())) D = input().split() for i in range(N, N*10): if len(set(list(str(i))) & set(D)) == 0: print(i) break main()
16
10
234
214
N, K = list(map(int, input().split())) D = list(map(int, input().split())) for i in range(N, 1000000): flag = 0 for j in D: if str(j) in str(i): flag = 1 break if flag == 0: print(i) exit()
def main(): N, K = list(map(int, input().split())) D = input().split() for i in range(N, N * 10): if len(set(list(str(i))) & set(D)) == 0: print(i) break main()
false
37.5
[ "-N, K = list(map(int, input().split()))", "-D = list(map(int, input().split()))", "-for i in range(N, 1000000):", "- flag = 0", "- for j in D:", "- if str(j) in str(i):", "- flag = 1", "+def main():", "+ N, K = list(map(int, input().split()))", "+ D = input().split()...
false
0.04061
0.076295
0.532281
[ "s684958329", "s346796503" ]
u353919145
p02771
python
s080078859
s488144622
19
17
3,064
3,060
Accepted
Accepted
10.53
n = input().split() for i in range (3) : n[i] = int(n[i]) a = sorted (n) fl = False if (a[0] == a[1] and a[1] != a[2]) : fl = True if (a[0] != a[1] and a[1] == a[2]) : fl = True print(('Yes' if fl else 'No'))
A,B,C=input().split() a,b,c=int(A),int(B),int(C) if a==b and b!=c: print("Yes") elif a==c and a!=b: print("Yes") elif b==c and a!=b: print("Yes") else: print("No")
13
11
234
190
n = input().split() for i in range(3): n[i] = int(n[i]) a = sorted(n) fl = False if a[0] == a[1] and a[1] != a[2]: fl = True if a[0] != a[1] and a[1] == a[2]: fl = True print(("Yes" if fl else "No"))
A, B, C = input().split() a, b, c = int(A), int(B), int(C) if a == b and b != c: print("Yes") elif a == c and a != b: print("Yes") elif b == c and a != b: print("Yes") else: print("No")
false
15.384615
[ "-n = input().split()", "-for i in range(3):", "- n[i] = int(n[i])", "-a = sorted(n)", "-fl = False", "-if a[0] == a[1] and a[1] != a[2]:", "- fl = True", "-if a[0] != a[1] and a[1] == a[2]:", "- fl = True", "-print((\"Yes\" if fl else \"No\"))", "+A, B, C = input().split()", "+a, b, ...
false
0.040539
0.041422
0.978669
[ "s080078859", "s488144622" ]
u790710233
p02720
python
s449084553
s391670802
371
198
12,776
7,708
Accepted
Accepted
46.63
k = int(eval(input())) ans = [] def dfs(x): if x > 10**10: return 0 else: ans.append(x) y = x % 10 for i in range(10): if abs(y-i) <= 1: dfs(10*x+i) for i in range(1, 10): dfs(i) ans.sort() print((ans[k-1]))
k = int(eval(input())) ans = [] def dfs(x): if x > 3234566667: return 0 else: ans.append(x) y = x % 10 for i in range(10): if abs(y-i) <= 1: dfs(10*x+i) for i in range(1, 10): dfs(i) ans.sort() print((ans[k-1]))
18
20
307
307
k = int(eval(input())) ans = [] def dfs(x): if x > 10**10: return 0 else: ans.append(x) y = x % 10 for i in range(10): if abs(y - i) <= 1: dfs(10 * x + i) for i in range(1, 10): dfs(i) ans.sort() print((ans[k - 1]))
k = int(eval(input())) ans = [] def dfs(x): if x > 3234566667: return 0 else: ans.append(x) y = x % 10 for i in range(10): if abs(y - i) <= 1: dfs(10 * x + i) for i in range(1, 10): dfs(i) ans.sort() print((ans[k - 1]))
false
10
[ "- if x > 10**10:", "+ if x > 3234566667:" ]
false
1.119955
0.471633
2.374634
[ "s449084553", "s391670802" ]
u864197622
p02728
python
s085604682
s542446684
1,661
1,469
125,872
126,128
Accepted
Accepted
11.56
import sys input = sys.stdin.readline from collections import deque nn = 200200 mod = 10**9+7 fa = [1] * (nn+1) fainv = [1] * (nn+1) for i in range(nn): fa[i+1] = fa[i] * (i+1) % mod fainv[-1] = pow(fa[-1], mod-2, mod) for i in range(nn)[::-1]: fainv[i] = fainv[i+1] * (i+1) % mod C = lambda a, b...
import sys input = sys.stdin.readline from collections import deque nn = 200200 mod = 10**9+7 fa = [1] * (nn+1) fainv = [1] * (nn+1) inv = [1] * (nn+1) for i in range(nn): fa[i+1] = fa[i] * (i+1) % mod fainv[-1] = pow(fa[-1], mod-2, mod) for i in range(nn)[::-1]: fainv[i] = fainv[i+1] * (i+1) % ...
60
64
1,476
1,501
import sys input = sys.stdin.readline from collections import deque nn = 200200 mod = 10**9 + 7 fa = [1] * (nn + 1) fainv = [1] * (nn + 1) for i in range(nn): fa[i + 1] = fa[i] * (i + 1) % mod fainv[-1] = pow(fa[-1], mod - 2, mod) for i in range(nn)[::-1]: fainv[i] = fainv[i + 1] * (i + 1) % mod C = lambda a,...
import sys input = sys.stdin.readline from collections import deque nn = 200200 mod = 10**9 + 7 fa = [1] * (nn + 1) fainv = [1] * (nn + 1) inv = [1] * (nn + 1) for i in range(nn): fa[i + 1] = fa[i] * (i + 1) % mod fainv[-1] = pow(fa[-1], mod - 2, mod) for i in range(nn)[::-1]: fainv[i] = fainv[i + 1] * (i + 1...
false
6.25
[ "+inv = [1] * (nn + 1)", "+for i in range(1, nn)[::-1]:", "+ inv[i] = fainv[i] * fa[i - 1]", "- s = 0", "+ s = 1", "- a = a * BU[j] * fainv[SI[j]] % mod", "+ a = a * BU[j] % mod", "- SI[i] = s + 1", "- BU[i] = fa[s] * a % mod", "+ SI[i] = s", "+ BU[i] = inv[s] ...
false
0.305719
0.778613
0.392646
[ "s085604682", "s542446684" ]
u847923740
p03163
python
s522852613
s989052630
184
124
29,868
28,944
Accepted
Accepted
32.61
import numpy as np N, W = list(map(int, input().split())) dp = np.zeros(W + 1, dtype = np.int64) for i in range(N): w, v = list(map(int, input().split())) dp[w:] = np.maximum(dp[w:], dp[:-w] + v) print((dp.max()))
import numpy as np N, W = list(map(int, input().split())) dp = np.zeros(W + 1, dtype = np.int64) for i in range(N): w, v = list(map(int, input().split())) np.maximum(dp[w:], dp[:-w] + v, out = dp[w:]) print((dp.max()))
11
11
215
220
import numpy as np N, W = list(map(int, input().split())) dp = np.zeros(W + 1, dtype=np.int64) for i in range(N): w, v = list(map(int, input().split())) dp[w:] = np.maximum(dp[w:], dp[:-w] + v) print((dp.max()))
import numpy as np N, W = list(map(int, input().split())) dp = np.zeros(W + 1, dtype=np.int64) for i in range(N): w, v = list(map(int, input().split())) np.maximum(dp[w:], dp[:-w] + v, out=dp[w:]) print((dp.max()))
false
0
[ "- dp[w:] = np.maximum(dp[w:], dp[:-w] + v)", "+ np.maximum(dp[w:], dp[:-w] + v, out=dp[w:])" ]
false
0.210742
0.415911
0.506699
[ "s522852613", "s989052630" ]
u597374218
p03694
python
s496148621
s593771781
19
17
2,940
2,940
Accepted
Accepted
10.53
eval(input()) a=list(map(int,input().split())) print((max(a)-min(a)))
eval(input()) a = sorted(map(int, input().split())) print((a[-1]-a[0]))
3
3
63
65
eval(input()) a = list(map(int, input().split())) print((max(a) - min(a)))
eval(input()) a = sorted(map(int, input().split())) print((a[-1] - a[0]))
false
0
[ "-a = list(map(int, input().split()))", "-print((max(a) - min(a)))", "+a = sorted(map(int, input().split()))", "+print((a[-1] - a[0]))" ]
false
0.038964
0.038565
1.010343
[ "s496148621", "s593771781" ]
u864197622
p04014
python
s485942363
s810013994
28
22
3,316
3,308
Accepted
Accepted
21.43
def primeFactor(N): i, n, ret, d, sq = 2, N, {}, 2, 99 while i <= sq: k = 0 while n % i == 0: n, k, ret[i] = n//i, k+1, k+1 if k > 0 or i == 97: sq = int(n**(1/2)+0.5) if i < 4: i = i * 2 - 1 else: i, d = i+d, d^6 if n > 1: ret[n] = 1 return ret def di...
def primeFactor(N): i = 2 ret = {} n = N mrFlg = 0 while i**2 <= n: k = 0 while n % i == 0: n //= i k += 1 ret[i] = k i += 1 if i == 101 and n >= (2**20): def findFactorRho(N): # Primeでないことを確認したものを引数とする。 ...
43
108
901
2,715
def primeFactor(N): i, n, ret, d, sq = 2, N, {}, 2, 99 while i <= sq: k = 0 while n % i == 0: n, k, ret[i] = n // i, k + 1, k + 1 if k > 0 or i == 97: sq = int(n ** (1 / 2) + 0.5) if i < 4: i = i * 2 - 1 else: i, d = i + d, ...
def primeFactor(N): i = 2 ret = {} n = N mrFlg = 0 while i**2 <= n: k = 0 while n % i == 0: n //= i k += 1 ret[i] = k i += 1 if i == 101 and n >= (2**20): def findFactorRho(N): # Primeでないことを確認したものを引数とする。 ...
false
60.185185
[ "- i, n, ret, d, sq = 2, N, {}, 2, 99", "- while i <= sq:", "+ i = 2", "+ ret = {}", "+ n = N", "+ mrFlg = 0", "+ while i**2 <= n:", "- n, k, ret[i] = n // i, k + 1, k + 1", "- if k > 0 or i == 97:", "- sq = int(n ** (1 / 2) + 0.5)", "- if...
false
0.040925
0.049075
0.833932
[ "s485942363", "s810013994" ]
u548252256
p02264
python
s124432070
s964483074
860
370
14,292
17,352
Accepted
Accepted
56.98
pnum,mtime = list(map(int,input().split(" "))) total = [list(input().split(" ")) for _ in range(pnum)] cnt=0 tcnt=0 while len(total) > 0: ztime = int(total[0][1]) - mtime if ztime <= 0: tcnt += int(total[0][1]) print((total[0][0],int(tcnt))) total.pop(0) else: total.append([total[0][0],ztime...
#queueを使った方法 from collections import deque pnum,mtime = list(map(int,input().split(" "))) q = deque([]) [q.append(input().split(" ")) for u in range(pnum)] tcnt=0 while len(q) > 0: qq = q.popleft() ztime = int(qq[1]) - mtime if ztime <= 0: tcnt += int(qq[1]) print((qq[0],int(tcnt))) else: q...
19
19
361
354
pnum, mtime = list(map(int, input().split(" "))) total = [list(input().split(" ")) for _ in range(pnum)] cnt = 0 tcnt = 0 while len(total) > 0: ztime = int(total[0][1]) - mtime if ztime <= 0: tcnt += int(total[0][1]) print((total[0][0], int(tcnt))) total.pop(0) else: total.ap...
# queueを使った方法 from collections import deque pnum, mtime = list(map(int, input().split(" "))) q = deque([]) [q.append(input().split(" ")) for u in range(pnum)] tcnt = 0 while len(q) > 0: qq = q.popleft() ztime = int(qq[1]) - mtime if ztime <= 0: tcnt += int(qq[1]) print((qq[0], int(tcnt))) ...
false
0
[ "+# queueを使った方法", "+from collections import deque", "+", "-total = [list(input().split(\" \")) for _ in range(pnum)]", "-cnt = 0", "+q = deque([])", "+[q.append(input().split(\" \")) for u in range(pnum)]", "-while len(total) > 0:", "- ztime = int(total[0][1]) - mtime", "+while len(q) > 0:", ...
false
0.036825
0.036297
1.014539
[ "s124432070", "s964483074" ]
u285891772
p03805
python
s988859483
s082770242
61
45
5,160
5,316
Accepted
Accepted
26.23
import sys, re from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2 from collections import deque, defaultdict, Counter from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter,...
import sys, re from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2 from collections import deque, defaultdict, Counter from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter,...
49
46
1,284
1,244
import sys, re from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, ) from collections import deque, defaultdict, Counter from itertools import ( accumulate, permutations, combinations, combi...
import sys, re from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, ) from collections import deque, defaultdict, Counter from itertools import ( accumulate, permutations, combinations, combi...
false
6.122449
[ "-graph = defaultdict(list)", "-for _ in range(M):", "- a, b = MAP()", "- graph[a - 1].append(b - 1)", "- graph[b - 1].append(a - 1)", "-# print(graph)", "+ab = [LIST() for _ in range(M)]", "+# 隣接行列", "+contact = [[0] * N for _ in range(N)]", "+for a, b in ab:", "+ contact[a - 1][b -...
false
0.043283
0.038996
1.10993
[ "s988859483", "s082770242" ]
u223663729
p02722
python
s403995382
s696915021
265
211
3,064
3,188
Accepted
Accepted
20.38
N = int(eval(input())) cnt = 2 if N > 2 else 1 ret = [] for i in range(2, int(N**0.5)+1): if N % i == 0: k = N//i while k % i == 0: k //= i if k % i == 1: cnt += 1 if N // i != i: j = N // i k = i while k % ...
N = int(eval(input())) def divisor(N): ret = [] for i in range(1, int(N**0.5)+1): if N % i == 0: ret.append(i) if N // i != i: ret.append(N//i) return ret div_N = divisor(N) div_N_1 = divisor(N-1) ans = 0 for k in div_N[1:]: n = N ...
28
27
550
431
N = int(eval(input())) cnt = 2 if N > 2 else 1 ret = [] for i in range(2, int(N**0.5) + 1): if N % i == 0: k = N // i while k % i == 0: k //= i if k % i == 1: cnt += 1 if N // i != i: j = N // i k = i while k % j == 0: ...
N = int(eval(input())) def divisor(N): ret = [] for i in range(1, int(N**0.5) + 1): if N % i == 0: ret.append(i) if N // i != i: ret.append(N // i) return ret div_N = divisor(N) div_N_1 = divisor(N - 1) ans = 0 for k in div_N[1:]: n = N while n % k...
false
3.571429
[ "-cnt = 2 if N > 2 else 1", "-ret = []", "-for i in range(2, int(N**0.5) + 1):", "- if N % i == 0:", "- k = N // i", "- while k % i == 0:", "- k //= i", "- if k % i == 1:", "- cnt += 1", "- if N // i != i:", "- j = N // i", "- ...
false
0.260514
0.066598
3.911759
[ "s403995382", "s696915021" ]
u969850098
p03339
python
s042942239
s016331586
146
124
3,780
3,672
Accepted
Accepted
15.07
import sys readline = sys.stdin.readline def main(): N = int(readline()) S = readline().rstrip() e_right = S.count('E') w_right = S.count('W') e_left, w_left = 0, 0 res = N for i in range(N): if S[i] == 'E': e_right -= 1 res = min(res, e_right + ...
import sys readline = sys.stdin.readline def main(): N = int(readline()) S = readline().rstrip() e_right = S.count('E') w_left = 0 res = N for i in range(N): if S[i] == 'E': e_right -= 1 res = min(res, e_right + w_left) else: ...
24
22
528
444
import sys readline = sys.stdin.readline def main(): N = int(readline()) S = readline().rstrip() e_right = S.count("E") w_right = S.count("W") e_left, w_left = 0, 0 res = N for i in range(N): if S[i] == "E": e_right -= 1 res = min(res, e_right + w_left) ...
import sys readline = sys.stdin.readline def main(): N = int(readline()) S = readline().rstrip() e_right = S.count("E") w_left = 0 res = N for i in range(N): if S[i] == "E": e_right -= 1 res = min(res, e_right + w_left) else: res = min(res, ...
false
8.333333
[ "- w_right = S.count(\"W\")", "- e_left, w_left = 0, 0", "+ w_left = 0", "- e_left += 1", "- w_right -= 1" ]
false
0.040339
0.108072
0.373257
[ "s042942239", "s016331586" ]
u768559443
p03207
python
s832482316
s863316684
171
17
38,384
2,940
Accepted
Accepted
90.06
n=int(eval(input())) l=[int(eval(input())) for i in range(n)] print((sum(l)-int(max(l)/2)))
n=int(eval(input())) p=[int(eval(input())) for i in range(n)] print((sum(p)-max(p)//2))
3
4
79
77
n = int(eval(input())) l = [int(eval(input())) for i in range(n)] print((sum(l) - int(max(l) / 2)))
n = int(eval(input())) p = [int(eval(input())) for i in range(n)] print((sum(p) - max(p) // 2))
false
25
[ "-l = [int(eval(input())) for i in range(n)]", "-print((sum(l) - int(max(l) / 2)))", "+p = [int(eval(input())) for i in range(n)]", "+print((sum(p) - max(p) // 2))" ]
false
0.042023
0.043211
0.972498
[ "s832482316", "s863316684" ]
u007263493
p03796
python
s071062079
s824519077
236
40
3,976
2,940
Accepted
Accepted
83.05
n = int(eval(input())) import math print((int(math.factorial(n))%(10**9+7)))
n = int(eval(input())) mod = 10 **9 +7 ans = 1 for i in range(1, n+1): ans *= i ans = ans % mod print(ans)
4
8
72
117
n = int(eval(input())) import math print((int(math.factorial(n)) % (10**9 + 7)))
n = int(eval(input())) mod = 10**9 + 7 ans = 1 for i in range(1, n + 1): ans *= i ans = ans % mod print(ans)
false
50
[ "-import math", "-", "-print((int(math.factorial(n)) % (10**9 + 7)))", "+mod = 10**9 + 7", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % mod", "+print(ans)" ]
false
0.123842
0.041859
2.95855
[ "s071062079", "s824519077" ]
u816872429
p02993
python
s353263707
s324811740
194
17
38,384
2,940
Accepted
Accepted
91.24
s = eval(input()) print(('Bad' if any(a == b for a, b in zip(s, s[1:])) else 'Good'))
s = eval(input()) print(('Bad' if any(s[i] == s[i + 1] for i in range(3)) else 'Good'))
2
2
79
80
s = eval(input()) print(("Bad" if any(a == b for a, b in zip(s, s[1:])) else "Good"))
s = eval(input()) print(("Bad" if any(s[i] == s[i + 1] for i in range(3)) else "Good"))
false
0
[ "-print((\"Bad\" if any(a == b for a, b in zip(s, s[1:])) else \"Good\"))", "+print((\"Bad\" if any(s[i] == s[i + 1] for i in range(3)) else \"Good\"))" ]
false
0.093302
0.036202
2.577299
[ "s353263707", "s324811740" ]
u869790980
p03449
python
s510726314
s262992081
75
59
75,964
64,540
Accepted
Accepted
21.33
n,mat = input(),[ list(map(int,input().split())) for i in range(2)] def f(mat,i,j): if i<0 or j <0: return -float('inf') if i == 0 and j == 0: return mat[i][j] return mat[i][j] + max(f(mat,i-1,j),f(mat,i,j-1)) print(f(mat,1,len(mat[0])-1))
n,mat = input(),[ list(map(int,input().split())) for i in range(2)] mem = {} def f(mat,i,j): if i<0 or j <0: return -float('inf') if i == 0 and j == 0: return mat[i][j] if (i,j) not in mem: mem[(i,j)] = mat[i][j] + max(f(mat,i-1,j),f(mat,i,j-1)) return mem[(i,j)] print(f(mat,1,len(mat[0])-1))
8
9
255
310
n, mat = input(), [list(map(int, input().split())) for i in range(2)] def f(mat, i, j): if i < 0 or j < 0: return -float("inf") if i == 0 and j == 0: return mat[i][j] return mat[i][j] + max(f(mat, i - 1, j), f(mat, i, j - 1)) print(f(mat, 1, len(mat[0]) - 1))
n, mat = input(), [list(map(int, input().split())) for i in range(2)] mem = {} def f(mat, i, j): if i < 0 or j < 0: return -float("inf") if i == 0 and j == 0: return mat[i][j] if (i, j) not in mem: mem[(i, j)] = mat[i][j] + max(f(mat, i - 1, j), f(mat, i, j - 1)) return mem[(i,...
false
11.111111
[ "+mem = {}", "- return mat[i][j] + max(f(mat, i - 1, j), f(mat, i, j - 1))", "+ if (i, j) not in mem:", "+ mem[(i, j)] = mat[i][j] + max(f(mat, i - 1, j), f(mat, i, j - 1))", "+ return mem[(i, j)]" ]
false
0.036779
0.057021
0.645009
[ "s510726314", "s262992081" ]
u692336506
p03494
python
s148114168
s484668108
29
26
9,116
9,044
Accepted
Accepted
10.34
N = int(eval(input())) A = list(map(int, input().split())) # N が 2 で何回割れるか def how_many_times(N): exp = 0 while N % 2 == 0: N //= 2 exp += 1 return exp result = min([how_many_times(v) for v in A]) print(result)
N = int(eval(input())) A = list(map(int, input().split())) # N が 2 で何回割れるか def how_many_times(N): exp = 0 while N % 2 == 0: N //= 2 exp += 1 return exp result = min(list(map(how_many_times, A))) print(result)
13
13
246
232
N = int(eval(input())) A = list(map(int, input().split())) # N が 2 で何回割れるか def how_many_times(N): exp = 0 while N % 2 == 0: N //= 2 exp += 1 return exp result = min([how_many_times(v) for v in A]) print(result)
N = int(eval(input())) A = list(map(int, input().split())) # N が 2 で何回割れるか def how_many_times(N): exp = 0 while N % 2 == 0: N //= 2 exp += 1 return exp result = min(list(map(how_many_times, A))) print(result)
false
0
[ "-result = min([how_many_times(v) for v in A])", "+result = min(list(map(how_many_times, A)))" ]
false
0.04182
0.04898
0.853823
[ "s148114168", "s484668108" ]
u597374218
p03999
python
s524730826
s417658441
28
18
3,060
2,940
Accepted
Accepted
35.71
S=eval(input()) ans=0 for i in range(2**(len(S)-1)): tmp=S[0] for j in range(len(S)-1): if i&(1<<j):tmp+="+" tmp+=S[j+1] ans+=eval(tmp) print(ans)
S=eval(input()) ans=0 for i in range(len(S)): for j in range(i+1): ans+=int(S[-(i+1)])*(10**j)*(2**(len(S)-1))//(2**min(i,j+1)) print(ans)
9
6
176
149
S = eval(input()) ans = 0 for i in range(2 ** (len(S) - 1)): tmp = S[0] for j in range(len(S) - 1): if i & (1 << j): tmp += "+" tmp += S[j + 1] ans += eval(tmp) print(ans)
S = eval(input()) ans = 0 for i in range(len(S)): for j in range(i + 1): ans += ( int(S[-(i + 1)]) * (10**j) * (2 ** (len(S) - 1)) // (2 ** min(i, j + 1)) ) print(ans)
false
33.333333
[ "-for i in range(2 ** (len(S) - 1)):", "- tmp = S[0]", "- for j in range(len(S) - 1):", "- if i & (1 << j):", "- tmp += \"+\"", "- tmp += S[j + 1]", "- ans += eval(tmp)", "+for i in range(len(S)):", "+ for j in range(i + 1):", "+ ans += (", "+ ...
false
0.036797
0.036038
1.021059
[ "s524730826", "s417658441" ]
u323680411
p03447
python
s835814082
s833583402
19
17
3,060
2,940
Accepted
Accepted
10.53
X = int(eval(input())) A = int(eval(input())) B = int(eval(input())) bf = X - A while bf >= B: bf -= B print(bf)
X, A, B = [int(eval(input())) for i in range(3)] X -= A X %= B print(X)
9
5
108
70
X = int(eval(input())) A = int(eval(input())) B = int(eval(input())) bf = X - A while bf >= B: bf -= B print(bf)
X, A, B = [int(eval(input())) for i in range(3)] X -= A X %= B print(X)
false
44.444444
[ "-X = int(eval(input()))", "-A = int(eval(input()))", "-B = int(eval(input()))", "-bf = X - A", "-while bf >= B:", "- bf -= B", "-print(bf)", "+X, A, B = [int(eval(input())) for i in range(3)]", "+X -= A", "+X %= B", "+print(X)" ]
false
0.036166
0.036453
0.992143
[ "s835814082", "s833583402" ]