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
u133583235
p02994
python
s905146380
s546589376
19
17
3,064
3,060
Accepted
Accepted
10.53
N, L = list(map(int, input().split())) a = [] b = [] #ringo goto aji dasu for i in range(N): a.append(L+ i+1 -1) if max(a) < 0: print((sum(a)-max(a))) elif max(a) >= 0 and min(a) <= 0: print((sum(a))) else: print((sum(a)-min(a)))
N, L = list(map(int, input().split())) a = [] for i in range(N): a.append(L+i+1-1) if min(a) > 0: print((sum(a)-min(a))) elif min(a)<=0 and max(a)>=0: print((sum(a))) else: print((sum(a)-max(a)))
14
14
240
216
N, L = list(map(int, input().split())) a = [] b = [] # ringo goto aji dasu for i in range(N): a.append(L + i + 1 - 1) if max(a) < 0: print((sum(a) - max(a))) elif max(a) >= 0 and min(a) <= 0: print((sum(a))) else: print((sum(a) - min(a)))
N, L = list(map(int, input().split())) a = [] for i in range(N): a.append(L + i + 1 - 1) if min(a) > 0: print((sum(a) - min(a))) elif min(a) <= 0 and max(a) >= 0: print((sum(a))) else: print((sum(a) - max(a)))
false
0
[ "-b = []", "-# ringo goto aji dasu", "-if max(a) < 0:", "- print((sum(a) - max(a)))", "-elif max(a) >= 0 and min(a) <= 0:", "+if min(a) > 0:", "+ print((sum(a) - min(a)))", "+elif min(a) <= 0 and max(a) >= 0:", "- print((sum(a) - min(a)))", "+ print((sum(a) - max(a)))" ]
false
0.044499
0.044617
0.997358
[ "s905146380", "s546589376" ]
u528470578
p03162
python
s031429517
s674105423
639
250
51,416
97,664
Accepted
Accepted
60.88
N = int(eval(input())) dpa = [0] * N dpb = [0] * N dpc = [0] * N a, b, c = list(map(int, input().split())) dpa[0] = a dpb[0] = b dpc[0] = c for i in range(1, N): a, b, c = list(map(int, input().split())) dpa[i] = max(dpb[i-1] + a, dpc[i-1] + a) dpb[i] = max(dpa[i-1] + b, dpc[i-1] + b) dpc[...
N = int(eval(input())) abc = [list(map(int, input().split())) for _ in range(N)] # dp dp_a = [0 for _ in range(N)] dp_b, dp_c = dp_a.copy(), dp_a.copy() dp_a[0] = abc[0][0] dp_b[0] = abc[0][1] dp_c[0] = abc[0][2] for i in range(N - 1): dp_a[i + 1] = max(dp_b[i], dp_c[i]) + abc[i + 1][0] dp_b[i + 1...
16
15
382
454
N = int(eval(input())) dpa = [0] * N dpb = [0] * N dpc = [0] * N a, b, c = list(map(int, input().split())) dpa[0] = a dpb[0] = b dpc[0] = c for i in range(1, N): a, b, c = list(map(int, input().split())) dpa[i] = max(dpb[i - 1] + a, dpc[i - 1] + a) dpb[i] = max(dpa[i - 1] + b, dpc[i - 1] + b) dpc[i] = m...
N = int(eval(input())) abc = [list(map(int, input().split())) for _ in range(N)] # dp dp_a = [0 for _ in range(N)] dp_b, dp_c = dp_a.copy(), dp_a.copy() dp_a[0] = abc[0][0] dp_b[0] = abc[0][1] dp_c[0] = abc[0][2] for i in range(N - 1): dp_a[i + 1] = max(dp_b[i], dp_c[i]) + abc[i + 1][0] dp_b[i + 1] = max(dp_a[i...
false
6.25
[ "-dpa = [0] * N", "-dpb = [0] * N", "-dpc = [0] * N", "-a, b, c = list(map(int, input().split()))", "-dpa[0] = a", "-dpb[0] = b", "-dpc[0] = c", "-for i in range(1, N):", "- a, b, c = list(map(int, input().split()))", "- dpa[i] = max(dpb[i - 1] + a, dpc[i - 1] + a)", "- dpb[i] = max(dpa...
false
0.062313
0.063866
0.975695
[ "s031429517", "s674105423" ]
u729133443
p03434
python
s765246756
s192326848
170
18
38,384
2,940
Accepted
Accepted
89.41
eval(input());l=sorted(map(int,input().split()));print((sum(l[-1::-2])-sum(l[-2::-2])))
eval(input());c=0 for a in sorted(map(int,input().split())):c=a-c print(c)
1
4
79
72
eval(input()) l = sorted(map(int, input().split())) print((sum(l[-1::-2]) - sum(l[-2::-2])))
eval(input()) c = 0 for a in sorted(map(int, input().split())): c = a - c print(c)
false
75
[ "-l = sorted(map(int, input().split()))", "-print((sum(l[-1::-2]) - sum(l[-2::-2])))", "+c = 0", "+for a in sorted(map(int, input().split())):", "+ c = a - c", "+print(c)" ]
false
0.106952
0.151941
0.703903
[ "s765246756", "s192326848" ]
u950708010
p03193
python
s787209209
s114688372
22
20
3,188
3,060
Accepted
Accepted
9.09
n,h,w = (int(i) for i in input().split()) a = [] for i in range(n): tmp = list(int(i) for i in input().split()) a.append(tmp) ct = 0 for i in range(n): if a[i][0] >= h and a[i][1] >=w: ct += 1 print(ct)
def solve(): n,h,w = (int(i) for i in input().split()) ct = 0 for i in range(n): a,b = (int(i) for i in input().split()) if a>=h and b >= w: ct += 1 print(ct) solve()
9
9
216
196
n, h, w = (int(i) for i in input().split()) a = [] for i in range(n): tmp = list(int(i) for i in input().split()) a.append(tmp) ct = 0 for i in range(n): if a[i][0] >= h and a[i][1] >= w: ct += 1 print(ct)
def solve(): n, h, w = (int(i) for i in input().split()) ct = 0 for i in range(n): a, b = (int(i) for i in input().split()) if a >= h and b >= w: ct += 1 print(ct) solve()
false
0
[ "-n, h, w = (int(i) for i in input().split())", "-a = []", "-for i in range(n):", "- tmp = list(int(i) for i in input().split())", "- a.append(tmp)", "-ct = 0", "-for i in range(n):", "- if a[i][0] >= h and a[i][1] >= w:", "- ct += 1", "-print(ct)", "+def solve():", "+ n, h,...
false
0.044581
0.037236
1.197265
[ "s787209209", "s114688372" ]
u542932305
p02982
python
s880582585
s070822833
20
17
3,064
3,064
Accepted
Accepted
15
import math N, D = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] count = 0 tmp = [] for i in range(N): r1 = X[i] for j in range(N): t = str(i)+str(j) if i == j or t in tmp or str(j)+str(i) in tmp: continue r2 = X[j] ...
import math N, D = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] count = 0 for i in range(N): r1 = X[i] for j in range(N-1, -1, -1): if i == j: break r2 = X[j] ls = [(r1[j] - r2[j])**2 for j in range(D)] res = mat...
23
17
490
395
import math N, D = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] count = 0 tmp = [] for i in range(N): r1 = X[i] for j in range(N): t = str(i) + str(j) if i == j or t in tmp or str(j) + str(i) in tmp: continue r2 = X[j] ls = ...
import math N, D = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] count = 0 for i in range(N): r1 = X[i] for j in range(N - 1, -1, -1): if i == j: break r2 = X[j] ls = [(r1[j] - r2[j]) ** 2 for j in range(D)] res = math.sqrt(s...
false
26.086957
[ "-tmp = []", "- for j in range(N):", "- t = str(i) + str(j)", "- if i == j or t in tmp or str(j) + str(i) in tmp:", "- continue", "+ for j in range(N - 1, -1, -1):", "+ if i == j:", "+ break", "- tmp.append(t)" ]
false
0.088114
0.088548
0.995106
[ "s880582585", "s070822833" ]
u325227960
p03078
python
s859860443
s880283381
779
688
167,528
135,996
Accepted
Accepted
11.68
x, y, z, k = list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) A.sort(reverse=1) B.sort(reverse=1) C.sort(reverse=1) D = [0] * (min(k, x) * min(k, y)) for i in range(min(k, x)): for j in range(min(k, y)): D...
x, y, z, k = list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) A.sort(reverse=1) B.sort(reverse=1) C.sort(reverse=1) D = [] for i in range(min(k, x)): for j in range(min(k, y)): for l in range(min(k, z)): ...
26
23
553
488
x, y, z, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort(reverse=1) B.sort(reverse=1) C.sort(reverse=1) D = [0] * (min(k, x) * min(k, y)) for i in range(min(k, x)): for j in range(min(k, y)): D.append(A[i]...
x, y, z, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort(reverse=1) B.sort(reverse=1) C.sort(reverse=1) D = [] for i in range(min(k, x)): for j in range(min(k, y)): for l in range(min(k, z)): i...
false
11.538462
[ "-D = [0] * (min(k, x) * min(k, y))", "+D = []", "- D.append(A[i] + B[j])", "+ for l in range(min(k, z)):", "+ if i * j * l <= k:", "+ D.append(A[i] + B[j] + C[l])", "+ else:", "+ break", "-E = [0] * (min(k, len(D)) * min(k, z))", "...
false
0.034872
0.034124
1.021898
[ "s859860443", "s880283381" ]
u408071652
p02616
python
s637815931
s129952077
207
144
118,048
32,392
Accepted
Accepted
30.43
import sys sys.setrecursionlimit(10 ** 7) # import bisect # import numpy as np # from collections import deque from collections import deque # map(int, sys.stdin.read().split()) import itertools import heapq def input(): return sys.stdin.readline().rstrip() def main(): N, K = list(map(int,...
import sys sys.setrecursionlimit(10 ** 7) # import bisect # import numpy as np # from collections import deque from collections import deque # map(int, sys.stdin.read().split()) #import itertools #import heapq import bisect def input(): return sys.stdin.readline().rstrip() def main(): N, ...
81
100
1,891
2,349
import sys sys.setrecursionlimit(10**7) # import bisect # import numpy as np # from collections import deque from collections import deque # map(int, sys.stdin.read().split()) import itertools import heapq def input(): return sys.stdin.readline().rstrip() def main(): N, K = list(map(int, input().split()))...
import sys sys.setrecursionlimit(10**7) # import bisect # import numpy as np # from collections import deque from collections import deque # map(int, sys.stdin.read().split()) # import itertools # import heapq import bisect def input(): return sys.stdin.readline().rstrip() def main(): N, K = list(map(int,...
false
19
[ "-import itertools", "-import heapq", "+# import itertools", "+# import heapq", "+import bisect", "- A = deque(A)", "- A_minus = deque([s for s in A if s < 0])", "- A_plus = deque([s for s in A if s >= 0])", "+ pp = int(bisect.bisect_left(A, 0))", "+ A_minus = deque(A[:pp])", "+ ...
false
0.037416
0.037767
0.990699
[ "s637815931", "s129952077" ]
u312814337
p02678
python
s790408952
s140600298
734
643
37,848
36,848
Accepted
Accepted
12.4
from collections import deque room_num, path_num = list(map(int, input().split(" "))) graph = [[] for _ in range(room_num)] dis = [-1] * room_num count = [0] * room_num count[0] = 1 for _ in range(path_num): a, b = list(map(int, input().split(" "))) graph[a-1].append(b-1) graph[b-1].append(a-1)...
from collections import deque room_num, path_num = list(map(int, input().split(" "))) graph = [[] for _ in range(room_num)] dis = [-1] * room_num for _ in range(path_num): a, b = list(map(int, input().split(" "))) graph[a-1].append(b-1) graph[b-1].append(a-1) dis[0] = 0 q = deque() q.append(0) ...
31
27
668
585
from collections import deque room_num, path_num = list(map(int, input().split(" "))) graph = [[] for _ in range(room_num)] dis = [-1] * room_num count = [0] * room_num count[0] = 1 for _ in range(path_num): a, b = list(map(int, input().split(" "))) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) dis...
from collections import deque room_num, path_num = list(map(int, input().split(" "))) graph = [[] for _ in range(room_num)] dis = [-1] * room_num for _ in range(path_num): a, b = list(map(int, input().split(" "))) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) dis[0] = 0 q = deque() q.append(0) whil...
false
12.903226
[ "-count = [0] * room_num", "-count[0] = 1", "- if count[n] == 1:", "- continue", "+ if dis[n] > 0:", "+ pass", "- count[n] = 1", "-if sum(dis) == room_num:", "+if -1 in dis:" ]
false
0.00777
0.129717
0.059902
[ "s790408952", "s140600298" ]
u423585790
p02716
python
s941082953
s603544867
542
429
148,548
136,724
Accepted
Accepted
20.85
#!/usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(...
#!/usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(...
50
50
1,518
1,518
#!/usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF...
#!/usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF...
false
0
[ "- print((max(dp[-3][0], dp[-1][1], dp[-1][2])))", "+ print((max(dp[-3][0], dp[-2][1], dp[-1][2])))" ]
false
0.117282
0.043035
2.725269
[ "s941082953", "s603544867" ]
u983918956
p03326
python
s217314058
s449864650
30
27
3,700
3,380
Accepted
Accepted
10
import itertools N,M = list(map(int,input().split())) info = [list(map(int,input().split())) for i in range(N)] note = [] for x,y,z in info: X = [x,-x]; Y = [y,-y]; Z = [z,-z] tmp = [] for c in itertools.product(X,Y,Z): tmp.append(sum(c)) note.append(tmp) ans = -float('inf') for j i...
import itertools N,M = list(map(int,input().split())) info = [list(map(int,input().split())) for i in range(N)] ans = -float('inf') for i,j,k in itertools.product([1,-1],repeat=3): tmp = [] for x,y,z in info: value = x*i + y*j + z*k tmp.append(value) tmp.sort(reverse=True) res ...
21
14
511
378
import itertools N, M = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(N)] note = [] for x, y, z in info: X = [x, -x] Y = [y, -y] Z = [z, -z] tmp = [] for c in itertools.product(X, Y, Z): tmp.append(sum(c)) note.append(tmp) ans = -float("inf") for...
import itertools N, M = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(N)] ans = -float("inf") for i, j, k in itertools.product([1, -1], repeat=3): tmp = [] for x, y, z in info: value = x * i + y * j + z * k tmp.append(value) tmp.sort(reverse=True) ...
false
33.333333
[ "-note = []", "-for x, y, z in info:", "- X = [x, -x]", "- Y = [y, -y]", "- Z = [z, -z]", "+ans = -float(\"inf\")", "+for i, j, k in itertools.product([1, -1], repeat=3):", "- for c in itertools.product(X, Y, Z):", "- tmp.append(sum(c))", "- note.append(tmp)", "-ans = -floa...
false
0.06673
0.04665
1.430437
[ "s217314058", "s449864650" ]
u076917070
p03575
python
s848062583
s987015990
24
21
3,444
3,064
Accepted
Accepted
12.5
import sys input=sys.stdin.readline import math def get_edges_include_node(i, Edges): # 頂点 i を含む辺のリストを返す es = [] for e in Edges: if i in e: es.append(e) return es def dfs(i, e0, goal, Edges): # 頂点 i から頂点 j にたどり着けるかどうか if e0 in Edges: Edges.remove(e0) for e...
import sys input = sys.stdin.readline class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return se...
41
57
980
1,332
import sys input = sys.stdin.readline import math def get_edges_include_node(i, Edges): # 頂点 i を含む辺のリストを返す es = [] for e in Edges: if i in e: es.append(e) return es def dfs(i, e0, goal, Edges): # 頂点 i から頂点 j にたどり着けるかどうか if e0 in Edges: Edges.remove(e0) for e1 in ge...
import sys input = sys.stdin.readline class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] ...
false
28.070175
[ "-import math", "-def get_edges_include_node(i, Edges): # 頂点 i を含む辺のリストを返す", "- es = []", "- for e in Edges:", "- if i in e:", "- es.append(e)", "- return es", "+class UnionFind:", "+ def __init__(self, n):", "+ self.n = n", "+ self.parents = [-1] * n...
false
0.049271
0.047596
1.0352
[ "s848062583", "s987015990" ]
u271934630
p03212
python
s345481829
s977433045
356
92
55,004
2,940
Accepted
Accepted
74.16
n = int(eval(input())) def dfs(s): if int(s) > n: return 0 ret = 1 if all(s.count(c) > 0 for c in '753') else 0 for c in '753': ret += dfs(s+c) return ret print((dfs('0')))
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): N = int(eval(input())) def dfs(s): if int(s) > N: return 0 ret = 1 if all(s.count(c) for c in '357') else 0 for c in '357': ret += dfs(s+c) return ret ...
11
21
208
374
n = int(eval(input())) def dfs(s): if int(s) > n: return 0 ret = 1 if all(s.count(c) > 0 for c in "753") else 0 for c in "753": ret += dfs(s + c) return ret print((dfs("0")))
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) def main(): N = int(eval(input())) def dfs(s): if int(s) > N: return 0 ret = 1 if all(s.count(c) for c in "357") else 0 for c in "357": ret += dfs(s + c) return ret print((dfs("0")...
false
47.619048
[ "-n = int(eval(input()))", "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**7)", "-def dfs(s):", "- if int(s) > n:", "- return 0", "- ret = 1 if all(s.count(c) > 0 for c in \"753\") else 0", "- for c in \"753\":", "- ret += dfs(s + c)", "- ...
false
0.288239
0.078585
3.667851
[ "s345481829", "s977433045" ]
u492910842
p03624
python
s199946151
s954469188
84
65
76,108
62,420
Accepted
Accepted
22.62
import string s = list(eval(input())) alpha = list(string.ascii_lowercase) n = len(alpha) ans = "None" for i in range(n): if alpha[i] not in s: ans = alpha[i] break print(ans)
import sys s=eval(input()) for i in range(ord("a"),ord("z")+1): if chr(i) not in s: print((chr(i))) sys.exit() print("None")
11
7
190
132
import string s = list(eval(input())) alpha = list(string.ascii_lowercase) n = len(alpha) ans = "None" for i in range(n): if alpha[i] not in s: ans = alpha[i] break print(ans)
import sys s = eval(input()) for i in range(ord("a"), ord("z") + 1): if chr(i) not in s: print((chr(i))) sys.exit() print("None")
false
36.363636
[ "-import string", "+import sys", "-s = list(eval(input()))", "-alpha = list(string.ascii_lowercase)", "-n = len(alpha)", "-ans = \"None\"", "-for i in range(n):", "- if alpha[i] not in s:", "- ans = alpha[i]", "- break", "-print(ans)", "+s = eval(input())", "+for i in range(...
false
0.04979
0.041752
1.192514
[ "s199946151", "s954469188" ]
u150984829
p02315
python
s296928779
s597628251
370
340
5,928
5,916
Accepted
Accepted
8.11
import sys W=int(input().split()[1]) C=[0]*-~W for e in sys.stdin: v,w=list(map(int,e.split())) for i in range(W,w-1,-1): t=v+C[i-w] if t>C[i]:C[i]=t print((C[W]))
N,W=list(map(int,input().split())) C=[0]*-~W for _ in[0]*N: v,w=list(map(int,input().split())) for i in range(W,w-1,-1): t=v+C[i-w] if t>C[i]:C[i]=t print((C[W]))
9
8
170
162
import sys W = int(input().split()[1]) C = [0] * -~W for e in sys.stdin: v, w = list(map(int, e.split())) for i in range(W, w - 1, -1): t = v + C[i - w] if t > C[i]: C[i] = t print((C[W]))
N, W = list(map(int, input().split())) C = [0] * -~W for _ in [0] * N: v, w = list(map(int, input().split())) for i in range(W, w - 1, -1): t = v + C[i - w] if t > C[i]: C[i] = t print((C[W]))
false
11.111111
[ "-import sys", "-", "-W = int(input().split()[1])", "+N, W = list(map(int, input().split()))", "-for e in sys.stdin:", "- v, w = list(map(int, e.split()))", "+for _ in [0] * N:", "+ v, w = list(map(int, input().split()))" ]
false
0.040837
0.038971
1.047885
[ "s296928779", "s597628251" ]
u534308356
p02909
python
s303196790
s225813719
205
176
38,384
38,256
Accepted
Accepted
14.15
s = eval(input()) if s == "Sunny": print("Cloudy") elif s == "Cloudy": print("Rainy") elif s == "Rainy": print("Sunny")
data = ['Sunny', 'Cloudy', 'Rainy'] s = eval(input()) if s == data[0]: print((data[1])) elif s == data[1]: print((data[2])) else: print((data[0]))
7
8
125
147
s = eval(input()) if s == "Sunny": print("Cloudy") elif s == "Cloudy": print("Rainy") elif s == "Rainy": print("Sunny")
data = ["Sunny", "Cloudy", "Rainy"] s = eval(input()) if s == data[0]: print((data[1])) elif s == data[1]: print((data[2])) else: print((data[0]))
false
12.5
[ "+data = [\"Sunny\", \"Cloudy\", \"Rainy\"]", "-if s == \"Sunny\":", "- print(\"Cloudy\")", "-elif s == \"Cloudy\":", "- print(\"Rainy\")", "-elif s == \"Rainy\":", "- print(\"Sunny\")", "+if s == data[0]:", "+ print((data[1]))", "+elif s == data[1]:", "+ print((data[2]))", "+el...
false
0.042645
0.042781
0.996812
[ "s303196790", "s225813719" ]
u179169725
p03208
python
s153070613
s152905842
351
314
17,184
18,400
Accepted
Accepted
10.54
N,K=list(map(int,input().split())) H=[int(eval(input())) for _ in range(N)] H.sort() import numpy as np H=np.array(H) print(((H[K-1:]-H[:-K+1]).min()))
N,K=list(map(int,input().split())) import numpy as np H=np.array([int(eval(input())) for _ in range(N)]) H.sort() print(((H[K-1:]-H[:-K+1]).min()))
6
5
143
138
N, K = list(map(int, input().split())) H = [int(eval(input())) for _ in range(N)] H.sort() import numpy as np H = np.array(H) print(((H[K - 1 :] - H[: -K + 1]).min()))
N, K = list(map(int, input().split())) import numpy as np H = np.array([int(eval(input())) for _ in range(N)]) H.sort() print(((H[K - 1 :] - H[: -K + 1]).min()))
false
16.666667
[ "-H = [int(eval(input())) for _ in range(N)]", "-H.sort()", "-H = np.array(H)", "+H = np.array([int(eval(input())) for _ in range(N)])", "+H.sort()" ]
false
0.280911
0.4481
0.626893
[ "s153070613", "s152905842" ]
u643542669
p02397
python
s365894102
s068157449
60
50
5,608
5,612
Accepted
Accepted
16.67
while True: x, y = list(map(int, input().split())) if x == 0 and y == 0: break if x > y: z = x x = y y = z print((x, y))
while True: x, y = list(map(int, input().split())) if x == 0 and y == 0: break if x > y: x, y = y, x print((x, y))
12
10
175
151
while True: x, y = list(map(int, input().split())) if x == 0 and y == 0: break if x > y: z = x x = y y = z print((x, y))
while True: x, y = list(map(int, input().split())) if x == 0 and y == 0: break if x > y: x, y = y, x print((x, y))
false
16.666667
[ "- z = x", "- x = y", "- y = z", "+ x, y = y, x" ]
false
0.082842
0.00786
10.540214
[ "s365894102", "s068157449" ]
u096294926
p02767
python
s669248289
s877634283
35
21
5,084
3,060
Accepted
Accepted
40
import math from statistics import mean, median,variance,stdev N = int(eval(input())) X = list(map(int,input().split())) a = sum(X) ave = round(a/N) b = 0 for i in range(N): b +=(X[i]-ave)**2 print(b)
N = int(eval(input())) X = list(map(int,input().split())) ans = 10**8 c = int() for i in range(1,100): c = 0 for j in range(len(X)): c += (X[j]-i)**2 if c < ans: ans = c print(ans)
10
11
207
212
import math from statistics import mean, median, variance, stdev N = int(eval(input())) X = list(map(int, input().split())) a = sum(X) ave = round(a / N) b = 0 for i in range(N): b += (X[i] - ave) ** 2 print(b)
N = int(eval(input())) X = list(map(int, input().split())) ans = 10**8 c = int() for i in range(1, 100): c = 0 for j in range(len(X)): c += (X[j] - i) ** 2 if c < ans: ans = c print(ans)
false
9.090909
[ "-import math", "-from statistics import mean, median, variance, stdev", "-", "-a = sum(X)", "-ave = round(a / N)", "-b = 0", "-for i in range(N):", "- b += (X[i] - ave) ** 2", "-print(b)", "+ans = 10**8", "+c = int()", "+for i in range(1, 100):", "+ c = 0", "+ for j in range(len(...
false
0.044926
0.04489
1.000817
[ "s669248289", "s877634283" ]
u366996583
p02658
python
s730073046
s475161881
59
54
21,592
21,660
Accepted
Accepted
8.47
n=int(eval(input())) a=list(map(int,input().split())) b=1 if 0 in a: print((0)) else: for i in range(n): b*=a[i] if b>10**18: print((-1)) exit() print(b)
n=int(eval(input())) a=list(map(int,input().split())) t=1 for i in range(n): t*=a[i] if t>10**18: if not(0 in a): print((-1)) exit() else: print((0)) exit() print(t)
12
13
180
203
n = int(eval(input())) a = list(map(int, input().split())) b = 1 if 0 in a: print((0)) else: for i in range(n): b *= a[i] if b > 10**18: print((-1)) exit() print(b)
n = int(eval(input())) a = list(map(int, input().split())) t = 1 for i in range(n): t *= a[i] if t > 10**18: if not (0 in a): print((-1)) exit() else: print((0)) exit() print(t)
false
7.692308
[ "-b = 1", "-if 0 in a:", "- print((0))", "-else:", "- for i in range(n):", "- b *= a[i]", "- if b > 10**18:", "+t = 1", "+for i in range(n):", "+ t *= a[i]", "+ if t > 10**18:", "+ if not (0 in a):", "- print(b)", "+ else:", "+ print(...
false
0.040618
0.056277
0.721759
[ "s730073046", "s475161881" ]
u893063840
p03796
python
s598651425
s346668544
231
35
4,028
2,940
Accepted
Accepted
84.85
n = int(eval(input())) from math import factorial power = factorial(n) mod = 10 ** 9 + 7 ans = power % mod print(ans)
n = int(eval(input())) mod = 10 ** 9 + 7 power = 1 for i in range(1, n + 1): power = i * power % mod print(power)
8
8
121
121
n = int(eval(input())) from math import factorial power = factorial(n) mod = 10**9 + 7 ans = power % mod print(ans)
n = int(eval(input())) mod = 10**9 + 7 power = 1 for i in range(1, n + 1): power = i * power % mod print(power)
false
0
[ "-from math import factorial", "-", "-power = factorial(n)", "-ans = power % mod", "-print(ans)", "+power = 1", "+for i in range(1, n + 1):", "+ power = i * power % mod", "+print(power)" ]
false
0.236122
0.067334
3.506744
[ "s598651425", "s346668544" ]
u721316601
p02959
python
s211874766
s343613745
238
174
18,624
18,476
Accepted
Accepted
26.89
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N): ans += min(A[i], B[i]) B[i] -= min(A[i], B[i]) ans += min(A[i+1], B[i]) A[i+1] -= min(A[i+1], B[i]) print(ans)
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = sum(A) for i in range(N): n = min(A[i], B[i]) A[i] -= n B[i] -= n if B[i] > 0: A[i+1] = max(0, A[i+1]-B[i]) print((ans - sum(A)))
11
14
253
259
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N): ans += min(A[i], B[i]) B[i] -= min(A[i], B[i]) ans += min(A[i + 1], B[i]) A[i + 1] -= min(A[i + 1], B[i]) print(ans)
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = sum(A) for i in range(N): n = min(A[i], B[i]) A[i] -= n B[i] -= n if B[i] > 0: A[i + 1] = max(0, A[i + 1] - B[i]) print((ans - sum(A)))
false
21.428571
[ "-ans = 0", "+ans = sum(A)", "- ans += min(A[i], B[i])", "- B[i] -= min(A[i], B[i])", "- ans += min(A[i + 1], B[i])", "- A[i + 1] -= min(A[i + 1], B[i])", "-print(ans)", "+ n = min(A[i], B[i])", "+ A[i] -= n", "+ B[i] -= n", "+ if B[i] > 0:", "+ A[i + 1] = max(0,...
false
0.150601
0.036292
4.149709
[ "s211874766", "s343613745" ]
u077291787
p02901
python
s152506096
s911879830
793
552
3,188
3,188
Accepted
Accepted
30.39
# ABC142E - Get Everything import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) p = 2 ** N dp = [float("inf")] * p dp[0] = 0 for _ in range(M): a, _ = list(map(int, input().split())) x = sum(2 ** (i - 1) for i in map(int, input().split(...
# ABC142E - Get Everything import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) p = 1 << N INF = 10 ** 10 dp = [INF] * p dp[0] = 0 for _ in range(M): a, _ = list(map(int, input().split())) x = sum(1 << (i - 1) for i in map(int, inp...
21
22
529
531
# ABC142E - Get Everything import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) p = 2**N dp = [float("inf")] * p dp[0] = 0 for _ in range(M): a, _ = list(map(int, input().split())) x = sum(2 ** (i - 1) for i in map(int, input().split())) ...
# ABC142E - Get Everything import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) p = 1 << N INF = 10**10 dp = [INF] * p dp[0] = 0 for _ in range(M): a, _ = list(map(int, input().split())) x = sum(1 << (i - 1) for i in map(int, input().split()...
false
4.545455
[ "- p = 2**N", "- dp = [float(\"inf\")] * p", "+ p = 1 << N", "+ INF = 10**10", "+ dp = [INF] * p", "- x = sum(2 ** (i - 1) for i in map(int, input().split()))", "+ x = sum(1 << (i - 1) for i in map(int, input().split()))", "- ans = dp[-1] if dp[-1] != float(\"inf\") els...
false
0.046909
0.047231
0.99319
[ "s152506096", "s911879830" ]
u790905630
p03240
python
s836450509
s357974911
34
27
3,064
3,064
Accepted
Accepted
20.59
from math import * N = int(eval(input())) all_input_list = [list(map(int, input().split())) for i in range(N)] x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0] for cx in range(101): for cy in range(101): H = h + abs(cx - x) + abs(cy - y) for input_list in all_i...
from math import * import sys N = int(eval(input())) all_input_list = [list(map(int, input().split())) for i in range(N)] x, y, h = sorted(all_input_list, key=lambda x: x[2])[-1] for cx in range(101): for cy in range(101): H = h + abs(cx - x) + abs(cy - y) for input_list in all_input_list:...
14
15
526
520
from math import * N = int(eval(input())) all_input_list = [list(map(int, input().split())) for i in range(N)] x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0] for cx in range(101): for cy in range(101): H = h + abs(cx - x) + abs(cy - y) for input_list in all_input_lis...
from math import * import sys N = int(eval(input())) all_input_list = [list(map(int, input().split())) for i in range(N)] x, y, h = sorted(all_input_list, key=lambda x: x[2])[-1] for cx in range(101): for cy in range(101): H = h + abs(cx - x) + abs(cy - y) for input_list in all_input_list: ...
false
6.666667
[ "+import sys", "-x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]", "+x, y, h = sorted(all_input_list, key=lambda x: x[2])[-1]", "- exit()", "+ sys.exit(0)" ]
false
0.121645
0.04769
2.550734
[ "s836450509", "s357974911" ]
u528470578
p03163
python
s886923817
s508742379
686
497
144,484
120,044
Accepted
Accepted
27.55
# Educational DP Contest D-knapsack def knapsack(N, W, wv): # initialize dp = [list(0 for _ in range(W+1)) for j in range(N+1)] # DP for i in range(N): for j in range(W+1): if j >= wv[i][0]: dp[i+1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1]) ...
N, W = list(map(int, input().split())) wv = [list(map(int, input().split())) for _ in range(N)] dp = [] for _ in range(N+1): dp.append([0] * (W+1)) for i in range(N): for j in range(W+1): if j >= wv[i][0]: dp[i+1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1]) else: ...
21
14
584
365
# Educational DP Contest D-knapsack def knapsack(N, W, wv): # initialize dp = [list(0 for _ in range(W + 1)) for j in range(N + 1)] # DP for i in range(N): for j in range(W + 1): if j >= wv[i][0]: dp[i + 1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1]) ...
N, W = list(map(int, input().split())) wv = [list(map(int, input().split())) for _ in range(N)] dp = [] for _ in range(N + 1): dp.append([0] * (W + 1)) for i in range(N): for j in range(W + 1): if j >= wv[i][0]: dp[i + 1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1]) else: ...
false
33.333333
[ "-# Educational DP Contest D-knapsack", "-def knapsack(N, W, wv):", "- # initialize", "- dp = [list(0 for _ in range(W + 1)) for j in range(N + 1)]", "- # DP", "- for i in range(N):", "- for j in range(W + 1):", "- if j >= wv[i][0]:", "- dp[i + 1][j] = ma...
false
0.045584
0.074727
0.610008
[ "s886923817", "s508742379" ]
u564902833
p02952
python
s997111587
s093925057
49
17
2,940
2,940
Accepted
Accepted
65.31
N = int(eval(input())) ans = sum(len(str(i)) % 2 == 1 for i in range(1, N + 1)) print(ans)
N = int(eval(input())) ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999) print(ans)
5
5
91
108
N = int(eval(input())) ans = sum(len(str(i)) % 2 == 1 for i in range(1, N + 1)) print(ans)
N = int(eval(input())) ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999) print(ans)
false
0
[ "-ans = sum(len(str(i)) % 2 == 1 for i in range(1, N + 1))", "+ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999)" ]
false
0.038807
0.04247
0.913759
[ "s997111587", "s093925057" ]
u926080943
p02755
python
s585532999
s453235982
177
17
38,768
3,064
Accepted
Accepted
90.4
def main(): a, b = list(map(int, input().split())) eight = [i for i in range(0, 2000) if a == int(i * 0.08)] ten = [i for i in range(0, 2000) if b == int(i * 0.1)] for i in eight: for j in ten: if i == j: print(i) return print((-1)) i...
def main(): a, b = list(map(int, input().split())) al = int(a / 0.08 + 0.5) bl = int(b / 0.1) au = al + 12 - a % 2 bu = bl + 9 if bu < al or au < bl: print((-1)) else: print((max(al, bl))) if __name__ == '__main__': main()
14
14
350
276
def main(): a, b = list(map(int, input().split())) eight = [i for i in range(0, 2000) if a == int(i * 0.08)] ten = [i for i in range(0, 2000) if b == int(i * 0.1)] for i in eight: for j in ten: if i == j: print(i) return print((-1)) if __name__ =...
def main(): a, b = list(map(int, input().split())) al = int(a / 0.08 + 0.5) bl = int(b / 0.1) au = al + 12 - a % 2 bu = bl + 9 if bu < al or au < bl: print((-1)) else: print((max(al, bl))) if __name__ == "__main__": main()
false
0
[ "- eight = [i for i in range(0, 2000) if a == int(i * 0.08)]", "- ten = [i for i in range(0, 2000) if b == int(i * 0.1)]", "- for i in eight:", "- for j in ten:", "- if i == j:", "- print(i)", "- return", "- print((-1))", "+ al = int(a /...
false
0.047714
0.042513
1.122341
[ "s585532999", "s453235982" ]
u200887663
p03610
python
s709220548
s003407751
52
47
6,440
9,368
Accepted
Accepted
9.62
sl=list(input()) n=len(sl) li=[] for i in range(1,n+1) : if i % 2 != 0 : li.append(sl[i-1]) print(*li,sep="")
#n = int(input()) #a, b = map(int,input().split()) #l = list(map(int,input().split())) #l = [list(map(int,input().split())) for i in range(n)] s = list(eval(input())) ans = '' for i, si in enumerate(s): if (i+1) % 2 != 0: ans += si print(ans)
8
10
124
258
sl = list(input()) n = len(sl) li = [] for i in range(1, n + 1): if i % 2 != 0: li.append(sl[i - 1]) print(*li, sep="")
# n = int(input()) # a, b = map(int,input().split()) # l = list(map(int,input().split())) # l = [list(map(int,input().split())) for i in range(n)] s = list(eval(input())) ans = "" for i, si in enumerate(s): if (i + 1) % 2 != 0: ans += si print(ans)
false
20
[ "-sl = list(input())", "-n = len(sl)", "-li = []", "-for i in range(1, n + 1):", "- if i % 2 != 0:", "- li.append(sl[i - 1])", "-print(*li, sep=\"\")", "+# n = int(input())", "+# a, b = map(int,input().split())", "+# l = list(map(int,input().split()))", "+# l = [list(map(int,input().sp...
false
0.039249
0.039374
0.996811
[ "s709220548", "s003407751" ]
u002459665
p03575
python
s260929483
s558879104
26
22
3,064
3,064
Accepted
Accepted
15.38
""" 解説PDFを見ながら実装 https://img.atcoder.jp/abc075/editorial.pdf """ def dfs(v, graph, visited, n): # 出発点 visited[v] = True for i in range(n): # 辺がない if graph[v][i] == False: continue # 訪問済み if visited[i] == True: continue # 辺があったらそ...
def main(): N, M = list(map(int, input().split())) AB = [] for _ in range(M): a, b = list(map(int, input().split())) AB.append([a-1, b-1]) # グラフを表現する(辺のある・なし) graph = [] for _ in range(N): graph.append([False] * N) for a, b in AB: graph[a][b] ...
66
59
1,304
1,119
""" 解説PDFを見ながら実装 https://img.atcoder.jp/abc075/editorial.pdf """ def dfs(v, graph, visited, n): # 出発点 visited[v] = True for i in range(n): # 辺がない if graph[v][i] == False: continue # 訪問済み if visited[i] == True: continue # 辺があったらそこから訪問する ...
def main(): N, M = list(map(int, input().split())) AB = [] for _ in range(M): a, b = list(map(int, input().split())) AB.append([a - 1, b - 1]) # グラフを表現する(辺のある・なし) graph = [] for _ in range(N): graph.append([False] * N) for a, b in AB: graph[a][b] = True ...
false
10.606061
[ "-\"\"\"", "-解説PDFを見ながら実装", "-https://img.atcoder.jp/abc075/editorial.pdf", "-\"\"\"", "-", "-", "-def dfs(v, graph, visited, n):", "- # 出発点", "- visited[v] = True", "- for i in range(n):", "- # 辺がない", "- if graph[v][i] == False:", "- continue", "- ...
false
0.048625
0.04119
1.180512
[ "s260929483", "s558879104" ]
u021019433
p03038
python
s246316344
s216903484
864
797
24,168
20,872
Accepted
Accepted
7.75
import heapq from collections import Counter from itertools import starmap from operator import mul R = lambda: list(map(int, input().split())) n, m = R() a = list(Counter(R()).items()) heapq.heapify(a) for _ in range(m): b, c = R() i = b while i: x, y = a[0] if x >= c: ...
import heapq from itertools import repeat, starmap from operator import mul R = lambda: list(map(int, input().split())) n, m = R() a = list(zip(R(), repeat(1))) heapq.heapify(a) for _ in range(m): b, c = R() i = b while i: x, y = a[0] if x >= c: break d = ...
25
24
548
522
import heapq from collections import Counter from itertools import starmap from operator import mul R = lambda: list(map(int, input().split())) n, m = R() a = list(Counter(R()).items()) heapq.heapify(a) for _ in range(m): b, c = R() i = b while i: x, y = a[0] if x >= c: break ...
import heapq from itertools import repeat, starmap from operator import mul R = lambda: list(map(int, input().split())) n, m = R() a = list(zip(R(), repeat(1))) heapq.heapify(a) for _ in range(m): b, c = R() i = b while i: x, y = a[0] if x >= c: break d = min(i, y) ...
false
4
[ "-from collections import Counter", "-from itertools import starmap", "+from itertools import repeat, starmap", "-a = list(Counter(R()).items())", "+a = list(zip(R(), repeat(1)))" ]
false
0.034177
0.066422
0.514552
[ "s246316344", "s216903484" ]
u347640436
p03274
python
s642554131
s458867878
121
95
14,660
14,564
Accepted
Accepted
21.49
n, k = list(map(int, input().split())) x = list(map(int, input().split())) p = n for i in range(n): if x[i] > 0: p = i break result = float('inf') for i in range(k + 1): if p - i < 0 or p + k - i > n: continue if i == 0: t = min(result, x[p + k - 1]) elif i == k: t = min(result...
n, k = list(map(int, input().split())) x = list(map(int, input().split())) p = n for i in range(n): if x[i] > 0: p = i break result = float('inf') for i in range(k + 1): if p - i < 0 or p + k - i > n: continue if i == 0: result = min(result, x[p + k - 1]) elif i == k: result = ...
19
20
483
455
n, k = list(map(int, input().split())) x = list(map(int, input().split())) p = n for i in range(n): if x[i] > 0: p = i break result = float("inf") for i in range(k + 1): if p - i < 0 or p + k - i > n: continue if i == 0: t = min(result, x[p + k - 1]) elif i == k: ...
n, k = list(map(int, input().split())) x = list(map(int, input().split())) p = n for i in range(n): if x[i] > 0: p = i break result = float("inf") for i in range(k + 1): if p - i < 0 or p + k - i > n: continue if i == 0: result = min(result, x[p + k - 1]) elif i == k: ...
false
5
[ "- t = min(result, x[p + k - 1])", "+ result = min(result, x[p + k - 1])", "- t = min(result, abs(x[p - k]))", "+ result = min(result, -x[p - k])", "- t = min(", "- result,", "- abs(x[p - i]) * 2 + x[p + (k - i) - 1],", "- abs(x[p - i...
false
0.037956
0.066106
0.574171
[ "s642554131", "s458867878" ]
u347640436
p02838
python
s690307777
s908420014
1,826
284
42,156
44,560
Accepted
Accepted
84.45
N = int(eval(input())) A = list(map(int, input().split())) result = 0 for bit in range(60): m = 1 << bit c = sum(a & m for a in A) >> bit result += (c * (N - c)) << bit result %= 1000000007 print(result)
import numpy as np N = int(eval(input())) A = np.fromiter(list(map(int, input().split())), np.int64) result = 0 for bit in range(60): c = int((A & 1).sum()) A >>= 1 result = (result + c * (N - c) * (1 << bit)) % 1000000007 print(result)
10
11
224
243
N = int(eval(input())) A = list(map(int, input().split())) result = 0 for bit in range(60): m = 1 << bit c = sum(a & m for a in A) >> bit result += (c * (N - c)) << bit result %= 1000000007 print(result)
import numpy as np N = int(eval(input())) A = np.fromiter(list(map(int, input().split())), np.int64) result = 0 for bit in range(60): c = int((A & 1).sum()) A >>= 1 result = (result + c * (N - c) * (1 << bit)) % 1000000007 print(result)
false
9.090909
[ "+import numpy as np", "+", "-A = list(map(int, input().split()))", "+A = np.fromiter(list(map(int, input().split())), np.int64)", "- m = 1 << bit", "- c = sum(a & m for a in A) >> bit", "- result += (c * (N - c)) << bit", "- result %= 1000000007", "+ c = int((A & 1).sum())", "+ ...
false
0.036979
1.061759
0.034828
[ "s690307777", "s908420014" ]
u263753244
p03854
python
s983008157
s343402864
382
253
65,516
78,096
Accepted
Accepted
33.77
import sys sys.setrecursionlimit(10**6) g=[] def jdream(l,i): if len(l)>=i+5: if l[i:i+5]=="dream": i=i+5 if i==len(l): g.append("Y") return else: jer(l,i) jdream(l,i) ...
s=eval(input()) n=len(s) dp=list('false'*n) dp[0]="true" if s[0:5]=="dream" or s[0:5]=="erase": for i in range(5): dp[i]="true" if s[0:6]=="eraser": for i in range(6): dp[i]="true" if s[0:7]=="dreamer": for i in range(7): dp[i]="true" for i in range(5,n): if...
115
28
2,031
612
import sys sys.setrecursionlimit(10**6) g = [] def jdream(l, i): if len(l) >= i + 5: if l[i : i + 5] == "dream": i = i + 5 if i == len(l): g.append("Y") return else: jer(l, i) jdream(l, i) ...
s = eval(input()) n = len(s) dp = list("false" * n) dp[0] = "true" if s[0:5] == "dream" or s[0:5] == "erase": for i in range(5): dp[i] = "true" if s[0:6] == "eraser": for i in range(6): dp[i] = "true" if s[0:7] == "dreamer": for i in range(7): dp[i] = "true" for i in range(5, n): ...
false
75.652174
[ "-import sys", "-", "-sys.setrecursionlimit(10**6)", "-g = []", "-", "-", "-def jdream(l, i):", "- if len(l) >= i + 5:", "- if l[i : i + 5] == \"dream\":", "- i = i + 5", "- if i == len(l):", "- g.append(\"Y\")", "- return", "- ...
false
0.042476
0.037923
1.120058
[ "s983008157", "s343402864" ]
u726285999
p02632
python
s373926784
s364713326
1,374
1,152
49,300
49,396
Accepted
Accepted
16.16
import sys K = int(sys.stdin.readline()) S = sys.stdin.readline().rstrip('\n') # ## COMBINATION (MOD) ### N_MAX = 10**6 # 問題サイズに合わせて変えておく MOD = 10**9 + 7 inv = [0] * (N_MAX + 2) inv[0] = 0 # 逆元テーブル計算用テーブル inv[1] = 1 for i in range(2, N_MAX + 2): inv[i] = -inv[MOD % i] * (MOD // i) % MOD # K 文...
import sys K = int(sys.stdin.readline()) S = sys.stdin.readline().rstrip('\n') # ## COMBINATION (MOD) ### N_MAX = 10**6 # 問題サイズに合わせて変えておく MOD = 10**9 + 7 inv = [0] * (N_MAX + 2) inv[0] = 0 # 逆元テーブル計算用テーブル inv[1] = 1 for i in range(2, N_MAX + 2): q, r = divmod(MOD, i) inv[i] = -inv[r] * q % ...
40
37
637
581
import sys K = int(sys.stdin.readline()) S = sys.stdin.readline().rstrip("\n") # ## COMBINATION (MOD) ### N_MAX = 10**6 # 問題サイズに合わせて変えておく MOD = 10**9 + 7 inv = [0] * (N_MAX + 2) inv[0] = 0 # 逆元テーブル計算用テーブル inv[1] = 1 for i in range(2, N_MAX + 2): inv[i] = -inv[MOD % i] * (MOD // i) % MOD # K 文字追加 ans = 0 ln = len...
import sys K = int(sys.stdin.readline()) S = sys.stdin.readline().rstrip("\n") # ## COMBINATION (MOD) ### N_MAX = 10**6 # 問題サイズに合わせて変えておく MOD = 10**9 + 7 inv = [0] * (N_MAX + 2) inv[0] = 0 # 逆元テーブル計算用テーブル inv[1] = 1 for i in range(2, N_MAX + 2): q, r = divmod(MOD, i) inv[i] = -inv[r] * q % MOD # K 文字追加 ans =...
false
7.5
[ "- inv[i] = -inv[MOD % i] * (MOD // i) % MOD", "+ q, r = divmod(MOD, i)", "+ inv[i] = -inv[r] * q % MOD", "-p1 = 1", "-p2 = 1", "-s2 = pow(26, K, MOD)", "+p = pow(26, K, MOD)", "- ans += (p1 * p2 * s2) % MOD", "+ ans += p % MOD", "- # print(p1, p2, s2)", "- p1 = (p1 * (ln + ...
false
0.682421
1.065058
0.640736
[ "s373926784", "s364713326" ]
u933341648
p03775
python
s614530983
s765605788
33
30
2,940
2,940
Accepted
Accepted
9.09
from math import sqrt n = int(eval(input())) for a in range(int(sqrt(n))+1, 0, -1): if n % a == 0: b = n // a res = max(list(map(len, list(map(str, [a, b]))))) break print(res)
n = int(eval(input())) for a in range(int(n**0.5)+1, 0, -1): if n % a == 0: b = n // a res = max(list(map(len, list(map(str, [a, b]))))) break print(res)
11
9
200
174
from math import sqrt n = int(eval(input())) for a in range(int(sqrt(n)) + 1, 0, -1): if n % a == 0: b = n // a res = max(list(map(len, list(map(str, [a, b]))))) break print(res)
n = int(eval(input())) for a in range(int(n**0.5) + 1, 0, -1): if n % a == 0: b = n // a res = max(list(map(len, list(map(str, [a, b]))))) break print(res)
false
18.181818
[ "-from math import sqrt", "-", "-for a in range(int(sqrt(n)) + 1, 0, -1):", "+for a in range(int(n**0.5) + 1, 0, -1):" ]
false
0.007938
0.039327
0.201857
[ "s614530983", "s765605788" ]
u761320129
p03166
python
s934685235
s967580932
570
271
32,936
40,764
Accepted
Accepted
52.46
N,M = list(map(int,input().split())) es = [tuple([int(x)-1 for x in input().split()]) for i in range(M)] indeg = [0 for i in range(N)] outdeg = [[] for i in range(N)] for a,b in es: indeg[b] += 1 outdeg[a].append(b) heads = [] for i in range(N): if indeg[i]: continue heads.append(i) dp ...
import sys input = sys.stdin.readline N,M = list(map(int,input().split())) XY = [tuple(map(int,input().split())) for i in range(M)] es = [[] for _ in range(N)] indeg = [0] * N for x,y in XY: x,y = x-1,y-1 es[x].append(y) indeg[y] += 1 from collections import deque q = deque() for i in range(...
23
27
520
554
N, M = list(map(int, input().split())) es = [tuple([int(x) - 1 for x in input().split()]) for i in range(M)] indeg = [0 for i in range(N)] outdeg = [[] for i in range(N)] for a, b in es: indeg[b] += 1 outdeg[a].append(b) heads = [] for i in range(N): if indeg[i]: continue heads.append(i) dp = [0...
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) XY = [tuple(map(int, input().split())) for i in range(M)] es = [[] for _ in range(N)] indeg = [0] * N for x, y in XY: x, y = x - 1, y - 1 es[x].append(y) indeg[y] += 1 from collections import deque q = deque() for i in range(N): ...
false
14.814815
[ "+import sys", "+", "+input = sys.stdin.readline", "-es = [tuple([int(x) - 1 for x in input().split()]) for i in range(M)]", "-indeg = [0 for i in range(N)]", "-outdeg = [[] for i in range(N)]", "-for a, b in es:", "- indeg[b] += 1", "- outdeg[a].append(b)", "-heads = []", "+XY = [tuple(ma...
false
0.065378
0.043015
1.519876
[ "s934685235", "s967580932" ]
u777283665
p03457
python
s457325757
s628563041
617
369
47,592
3,064
Accepted
Accepted
40.19
def validation(l1, l2): dif_t = abs(l2[0] - l1[0]) dif_x = abs(l2[1] - l1[1]) dif_y = l2[2] - l1[2] if dif_x + dif_y > dif_t: return False elif dif_t % 2 == 0: if (dif_x + dif_y) % 2 != 0: return False else: return True elif dif_t % 2 != 0: if (dif_x + dif_y) % 2 ==...
n = int(eval(input())) current_time = 0 current_pos = 0 ans = True for _ in range(n): t, x, y = list(map(int, input().split())) time_dif = t - current_time # 3 pos_dif = (x+y) - current_pos # 3 if time_dif % 2 == 1 and pos_dif % 2 == 1 and pos_dif <= time_dif: current_time += time_dif ...
30
21
572
564
def validation(l1, l2): dif_t = abs(l2[0] - l1[0]) dif_x = abs(l2[1] - l1[1]) dif_y = l2[2] - l1[2] if dif_x + dif_y > dif_t: return False elif dif_t % 2 == 0: if (dif_x + dif_y) % 2 != 0: return False else: return True elif dif_t % 2 != 0: ...
n = int(eval(input())) current_time = 0 current_pos = 0 ans = True for _ in range(n): t, x, y = list(map(int, input().split())) time_dif = t - current_time # 3 pos_dif = (x + y) - current_pos # 3 if time_dif % 2 == 1 and pos_dif % 2 == 1 and pos_dif <= time_dif: current_time += time_dif ...
false
30
[ "-def validation(l1, l2):", "- dif_t = abs(l2[0] - l1[0])", "- dif_x = abs(l2[1] - l1[1])", "- dif_y = l2[2] - l1[2]", "- if dif_x + dif_y > dif_t:", "- return False", "- elif dif_t % 2 == 0:", "- if (dif_x + dif_y) % 2 != 0:", "- return False", "- el...
false
0.036254
0.037619
0.963709
[ "s457325757", "s628563041" ]
u821624310
p02398
python
s600706365
s841507322
30
20
7,620
7,640
Accepted
Accepted
33.33
a, b, c = list(map(int, input().split())) cnt = 0 for i in range(a, b+1): if c % i == 0: cnt += 1 print(cnt)
a, b, c = list(map(int, input().split())) divisor = 0 for n in range(a, b+1): if c % n == 0: divisor += 1 print(divisor)
6
6
119
131
a, b, c = list(map(int, input().split())) cnt = 0 for i in range(a, b + 1): if c % i == 0: cnt += 1 print(cnt)
a, b, c = list(map(int, input().split())) divisor = 0 for n in range(a, b + 1): if c % n == 0: divisor += 1 print(divisor)
false
0
[ "-cnt = 0", "-for i in range(a, b + 1):", "- if c % i == 0:", "- cnt += 1", "-print(cnt)", "+divisor = 0", "+for n in range(a, b + 1):", "+ if c % n == 0:", "+ divisor += 1", "+print(divisor)" ]
false
0.050741
0.047245
1.073984
[ "s600706365", "s841507322" ]
u556799364
p03290
python
s946482747
s850999768
214
34
42,588
9,144
Accepted
Accepted
84.11
D, G = list(map(int, input().split(' '))) p_c_pairs = [(i+1, list(map(int, input().split(' ')))) for i in range(D)] import itertools, math ans = float('inf') nums = list(range(D)) for n in range(D+1): for num in itertools.combinations(nums, n): probs, score = 0, 0 for i in num: ...
# -*- coding: utf-8 -*- D, G = list(map(int, input().split(' '))) p_c_pairs = [((i+1) * 100, list(map(int, input().split(' ')))) for i in range(D)] import math ans = float('inf') p_c_pairs.sort(key=lambda x: -x[0]) for d in range(1<<D): # print(bin(d)) cnt = 0 g = G for i in range(D): ...
28
32
773
777
D, G = list(map(int, input().split(" "))) p_c_pairs = [(i + 1, list(map(int, input().split(" ")))) for i in range(D)] import itertools, math ans = float("inf") nums = list(range(D)) for n in range(D + 1): for num in itertools.combinations(nums, n): probs, score = 0, 0 for i in num: j, (...
# -*- coding: utf-8 -*- D, G = list(map(int, input().split(" "))) p_c_pairs = [((i + 1) * 100, list(map(int, input().split(" ")))) for i in range(D)] import math ans = float("inf") p_c_pairs.sort(key=lambda x: -x[0]) for d in range(1 << D): # print(bin(d)) cnt = 0 g = G for i in range(D): if 1 ...
false
12.5
[ "+# -*- coding: utf-8 -*-", "-p_c_pairs = [(i + 1, list(map(int, input().split(\" \")))) for i in range(D)]", "-import itertools, math", "+p_c_pairs = [((i + 1) * 100, list(map(int, input().split(\" \")))) for i in range(D)]", "+import math", "-nums = list(range(D))", "-for n in range(D + 1):", "- ...
false
0.037027
0.036416
1.01677
[ "s946482747", "s850999768" ]
u007018214
p03457
python
s586586479
s109960968
408
342
3,064
3,060
Accepted
Accepted
16.18
now = {"t":0,"x":0,"y":0} can = True for i in range(int(eval(input()))): t,x,y = list(map(int,input().split())) dx = abs(x - now["x"]) #x距離 dy = abs(y - now["y"]) #y距離 d = dx + dy #距離合計 if d > t-now["t"] or d%2 != (t-now["t"])%2: print("No") can = False break n...
N=int(eval(input())) count=0 for i in range(N): t,x,y=list(map(int,input().split())) if x+y<=t and t%2==(x+y)%2:count+=1 print(("Yes" if count==N else "No"))
14
6
359
156
now = {"t": 0, "x": 0, "y": 0} can = True for i in range(int(eval(input()))): t, x, y = list(map(int, input().split())) dx = abs(x - now["x"]) # x距離 dy = abs(y - now["y"]) # y距離 d = dx + dy # 距離合計 if d > t - now["t"] or d % 2 != (t - now["t"]) % 2: print("No") can = False ...
N = int(eval(input())) count = 0 for i in range(N): t, x, y = list(map(int, input().split())) if x + y <= t and t % 2 == (x + y) % 2: count += 1 print(("Yes" if count == N else "No"))
false
57.142857
[ "-now = {\"t\": 0, \"x\": 0, \"y\": 0}", "-can = True", "-for i in range(int(eval(input()))):", "+N = int(eval(input()))", "+count = 0", "+for i in range(N):", "- dx = abs(x - now[\"x\"]) # x距離", "- dy = abs(y - now[\"y\"]) # y距離", "- d = dx + dy # 距離合計", "- if d > t - now[\"t\"] or...
false
0.048453
0.039636
1.222457
[ "s586586479", "s109960968" ]
u285891772
p03994
python
s640096951
s278975979
130
95
9,048
6,352
Accepted
Accepted
26.92
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, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemg...
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, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemg...
35
39
1,175
1,182
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, log from itertools import ( accumulate, permutations, combinations, ...
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, log from itertools import ( accumulate, permutations, combinations, ...
false
10.25641
[ "- return int(input())", "+ return int(eval(input()))", "- return map(int, input().split())", "+ return list(map(int, input().split()))", "- return zip(*(MAP() for _ in range(n)))", "+ return list(zip(*(MAP() for _ in range(n))))", "-s = list(input())", "+s = list(eval(input()))", ...
false
0.04787
0.040071
1.194646
[ "s640096951", "s278975979" ]
u905203728
p02837
python
s224735214
s180899947
236
197
3,188
3,188
Accepted
Accepted
16.53
import re n=int(eval(input())) A=[] for i in range(n): B=["."]*n for x,y in [list(map(int,input().split())) for k in range(int(eval(input())))]: B[x-1]=str(y) A.append("".join(B)) ans=0 for i in range(2**n): num=format(i,"b").zfill(n) cnt,flag=0,1 for k,j in enumerate(num):...
import re n=int(eval(input())) A=[] for i in range(n): word=["."]*n for j in range(int(eval(input()))): x,y=list(map(int,input().split())) word[x-1]=str(y) A.append(word) ans=0 for i in range(2**n): num=format(i, "b").zfill(n) flag,cnt=1,0 for j,k in enumerate(num)...
22
23
563
558
import re n = int(eval(input())) A = [] for i in range(n): B = ["."] * n for x, y in [list(map(int, input().split())) for k in range(int(eval(input())))]: B[x - 1] = str(y) A.append("".join(B)) ans = 0 for i in range(2**n): num = format(i, "b").zfill(n) cnt, flag = 0, 1 for k, j in enum...
import re n = int(eval(input())) A = [] for i in range(n): word = ["."] * n for j in range(int(eval(input()))): x, y = list(map(int, input().split())) word[x - 1] = str(y) A.append(word) ans = 0 for i in range(2**n): num = format(i, "b").zfill(n) flag, cnt = 1, 0 for j, k in enu...
false
4.347826
[ "- B = [\".\"] * n", "- for x, y in [list(map(int, input().split())) for k in range(int(eval(input())))]:", "- B[x - 1] = str(y)", "- A.append(\"\".join(B))", "+ word = [\".\"] * n", "+ for j in range(int(eval(input()))):", "+ x, y = list(map(int, input().split()))", "+ ...
false
0.051826
0.056537
0.91666
[ "s224735214", "s180899947" ]
u620084012
p02831
python
s889540119
s440607024
177
18
38,448
2,940
Accepted
Accepted
89.83
import math A, B = list(map(int,input().split())) # aとbの最大公約数 def gcd(a,b): if b == 0: return a return gcd(b,a%b) # aとbの最小公倍数 # a*b = lcm(a,b)*gcd(a,b) より def lcm(a,b): return a*b//gcd(a,b) print((lcm(A,B)))
A, B = list(map(int,input().split())) def gcd(a,b): if b == 0: return a return gcd(b,a%b) def lcm(a,b): return a*b//gcd(a,b) print((lcm(A,B)))
15
8
237
162
import math A, B = list(map(int, input().split())) # aとbの最大公約数 def gcd(a, b): if b == 0: return a return gcd(b, a % b) # aとbの最小公倍数 # a*b = lcm(a,b)*gcd(a,b) より def lcm(a, b): return a * b // gcd(a, b) print((lcm(A, B)))
A, B = list(map(int, input().split())) def gcd(a, b): if b == 0: return a return gcd(b, a % b) def lcm(a, b): return a * b // gcd(a, b) print((lcm(A, B)))
false
46.666667
[ "-import math", "+A, B = list(map(int, input().split()))", "-A, B = list(map(int, input().split()))", "-# aとbの最大公約数", "+", "-# aとbの最小公倍数", "-# a*b = lcm(a,b)*gcd(a,b) より" ]
false
0.035479
0.036055
0.984003
[ "s889540119", "s440607024" ]
u887207211
p03127
python
s508799774
s419499356
188
60
14,252
14,252
Accepted
Accepted
68.09
N = int(eval(input())) A = list(map(int,input().split())) def gcd(m, n): while n: m, n = n, m%n return m ans = A[0] tmp = [] for i in range(1,N): tmp.append(gcd(ans,A[i])) print((min(tmp)))
def gcd(m, n): while n: m, n = n, m%n return m def ans(): N = int(eval(input())) A = list(map(int,input().split())) tmp = A[0] for i in range(1,N): tmp = gcd(A[i], tmp) print(tmp) ans()
12
13
203
214
N = int(eval(input())) A = list(map(int, input().split())) def gcd(m, n): while n: m, n = n, m % n return m ans = A[0] tmp = [] for i in range(1, N): tmp.append(gcd(ans, A[i])) print((min(tmp)))
def gcd(m, n): while n: m, n = n, m % n return m def ans(): N = int(eval(input())) A = list(map(int, input().split())) tmp = A[0] for i in range(1, N): tmp = gcd(A[i], tmp) print(tmp) ans()
false
7.692308
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-", "-", "-ans = A[0]", "-tmp = []", "-for i in range(1, N):", "- tmp.append(gcd(ans, A[i]))", "-print((min(tmp)))", "+def ans():", "+ N = int(eval(input()))", "+ A = list(map(int, input().split()))", "+ tmp = A[...
false
0.036485
0.037156
0.981921
[ "s508799774", "s419499356" ]
u796942881
p03731
python
s935213633
s567707938
131
89
27,196
27,324
Accepted
Accepted
32.06
from sys import stdin def main(): lines = stdin.readlines() T = int(lines[0].split()[1]) tn = [int(ti) for ti in lines[1].split()] ans = 0 for t1, t2 in zip(tn[0:], tn[1:]): ans += min(T, t2 - t1) ans += T print(ans) return main()
from sys import stdin def main(): lines = stdin.readlines() T = int(lines[0].split()[1]) tn = [int(ti) for ti in lines[1].split()] print((tn[-1] + T - sum(t2 - t1 - T for t1, t2 in zip(tn[0:], tn[1:]) if t2 - t1 > T))) return main()
16
12
290
266
from sys import stdin def main(): lines = stdin.readlines() T = int(lines[0].split()[1]) tn = [int(ti) for ti in lines[1].split()] ans = 0 for t1, t2 in zip(tn[0:], tn[1:]): ans += min(T, t2 - t1) ans += T print(ans) return main()
from sys import stdin def main(): lines = stdin.readlines() T = int(lines[0].split()[1]) tn = [int(ti) for ti in lines[1].split()] print( (tn[-1] + T - sum(t2 - t1 - T for t1, t2 in zip(tn[0:], tn[1:]) if t2 - t1 > T)) ) return main()
false
25
[ "- ans = 0", "- for t1, t2 in zip(tn[0:], tn[1:]):", "- ans += min(T, t2 - t1)", "- ans += T", "- print(ans)", "+ print(", "+ (tn[-1] + T - sum(t2 - t1 - T for t1, t2 in zip(tn[0:], tn[1:]) if t2 - t1 > T))", "+ )" ]
false
0.038905
0.039611
0.982175
[ "s935213633", "s567707938" ]
u038229929
p03108
python
s837449644
s365838400
553
442
49,996
50,008
Accepted
Accepted
20.07
from sys import stdin N, M = [int(x) for x in stdin.readline().rstrip().split()] data = [stdin.readline().rstrip().split() for _ in range(M)] island = list(range(N)) counts = [1] * N total = int((N * (N - 1)) / 2) result = [] for c in reversed(data): ref0 = int(c[0]) - 1 while island[ref0] != ref0:...
from sys import stdin N, M = [int(x) for x in stdin.readline().rstrip().split()] data = [stdin.readline().rstrip().split() for _ in range(M)] island = list(range(N)) counts = [1] * N total = int((N * (N - 1)) / 2) result = [] for c in reversed(data): ref0 = int(c[0]) - 1 while island[ref0] != ref0:...
29
38
789
1,067
from sys import stdin N, M = [int(x) for x in stdin.readline().rstrip().split()] data = [stdin.readline().rstrip().split() for _ in range(M)] island = list(range(N)) counts = [1] * N total = int((N * (N - 1)) / 2) result = [] for c in reversed(data): ref0 = int(c[0]) - 1 while island[ref0] != ref0: ref...
from sys import stdin N, M = [int(x) for x in stdin.readline().rstrip().split()] data = [stdin.readline().rstrip().split() for _ in range(M)] island = list(range(N)) counts = [1] * N total = int((N * (N - 1)) / 2) result = [] for c in reversed(data): ref0 = int(c[0]) - 1 while island[ref0] != ref0: ref...
false
23.684211
[ "+ root = min(ref0, ref1)", "+ pair = max(ref0, ref1)", "+ island[int(c[0]) - 1] = root", "+ island[int(c[1]) - 1] = root", "+ island[pair] = root", "- island[max(ref0, ref1)] = min(ref0, ref1)", "+ root = min(ref0, ref1)", "+ pair = max(ref0, re...
false
0.041598
0.104336
0.398696
[ "s837449644", "s365838400" ]
u855710796
p02937
python
s448069096
s071993573
325
203
193,684
133,376
Accepted
Accepted
37.54
s = eval(input()) t = eval(input()) l_s = len(s) l_t = len(t) s2 = s + s l_s2 = len(s2) next_idx_1 = [[l_s2] * 26 for i in range(l_s2+1)] for i in reversed(list(range(l_s2))): for j in range(26): next_idx_1[i][j] = next_idx_1[i+1][j] next_idx_1[i][ord(s2[i]) - ord("a")] = i next_idx_2...
s = eval(input()) t = eval(input()) l_s = len(s) l_t = len(t) s2 = s + s l_s2 = len(s2) next_idx = [[l_s2] * 26 for i in range(l_s2)] for i in reversed(list(range(1, l_s2))): for j in range(26): next_idx[i-1][j] = next_idx[i][j] next_idx[i-1][ord(s2[i]) - ord("a")] = i cur_idx = 0 fo...
37
40
809
793
s = eval(input()) t = eval(input()) l_s = len(s) l_t = len(t) s2 = s + s l_s2 = len(s2) next_idx_1 = [[l_s2] * 26 for i in range(l_s2 + 1)] for i in reversed(list(range(l_s2))): for j in range(26): next_idx_1[i][j] = next_idx_1[i + 1][j] next_idx_1[i][ord(s2[i]) - ord("a")] = i next_idx_2 = [[l_s2] * 26...
s = eval(input()) t = eval(input()) l_s = len(s) l_t = len(t) s2 = s + s l_s2 = len(s2) next_idx = [[l_s2] * 26 for i in range(l_s2)] for i in reversed(list(range(1, l_s2))): for j in range(26): next_idx[i - 1][j] = next_idx[i][j] next_idx[i - 1][ord(s2[i]) - ord("a")] = i cur_idx = 0 for i in range(l_t...
false
7.5
[ "-next_idx_1 = [[l_s2] * 26 for i in range(l_s2 + 1)]", "-for i in reversed(list(range(l_s2))):", "- for j in range(26):", "- next_idx_1[i][j] = next_idx_1[i + 1][j]", "- next_idx_1[i][ord(s2[i]) - ord(\"a\")] = i", "-next_idx_2 = [[l_s2] * 26 for i in range(l_s2)]", "+next_idx = [[l_s2] * ...
false
0.142701
0.097405
1.465025
[ "s448069096", "s071993573" ]
u994988729
p03946
python
s583531926
s084004538
86
70
14,252
15,020
Accepted
Accepted
18.6
n, t = list(map(int, input().split())) a = list(map(int, input().split())) profit = 0 prof_n = 0 mn = 0 for i in range(n): if i == 0: mn = a[i] continue if a[i] < mn: mn = a[i] else: if a[i] - mn > profit: profit = a[i] - mn prof_n = ...
N, T = list(map(int, input().split())) A = list(map(int, input().split())) pre = 10 ** 18 diff_max = 0 diff_cnt = 0 for a in A: if a < pre: pre = a continue if a - pre > diff_max: diff_max = a - pre diff_cnt = 1 elif a - pre == diff_max: diff_cnt +=...
22
21
404
387
n, t = list(map(int, input().split())) a = list(map(int, input().split())) profit = 0 prof_n = 0 mn = 0 for i in range(n): if i == 0: mn = a[i] continue if a[i] < mn: mn = a[i] else: if a[i] - mn > profit: profit = a[i] - mn prof_n = 1 elif a[i...
N, T = list(map(int, input().split())) A = list(map(int, input().split())) pre = 10**18 diff_max = 0 diff_cnt = 0 for a in A: if a < pre: pre = a continue if a - pre > diff_max: diff_max = a - pre diff_cnt = 1 elif a - pre == diff_max: diff_cnt += 1 # 高橋君はdiffmax*(T//...
false
4.545455
[ "-n, t = list(map(int, input().split()))", "-a = list(map(int, input().split()))", "-profit = 0", "-prof_n = 0", "-mn = 0", "-for i in range(n):", "- if i == 0:", "- mn = a[i]", "+N, T = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+pre = 10**18", "+diff...
false
0.078042
0.042286
1.845571
[ "s583531926", "s084004538" ]
u133936772
p02596
python
s204985956
s038544357
281
212
9,036
9,172
Accepted
Accepted
24.56
k=int(input()) if (k%2)*(k%5)<1: exit(print(-1)) a,t,m=1,7,7 while m%k: a+=1 t=t*10%k m+=t print(a)
k=int(input()) t=7 for i in range(k): if t%k<1: exit(print(i+1)) t=(t*10+7)%k print(-1)
8
6
112
96
k = int(input()) if (k % 2) * (k % 5) < 1: exit(print(-1)) a, t, m = 1, 7, 7 while m % k: a += 1 t = t * 10 % k m += t print(a)
k = int(input()) t = 7 for i in range(k): if t % k < 1: exit(print(i + 1)) t = (t * 10 + 7) % k print(-1)
false
25
[ "-if (k % 2) * (k % 5) < 1:", "- exit(print(-1))", "-a, t, m = 1, 7, 7", "-while m % k:", "- a += 1", "- t = t * 10 % k", "- m += t", "-print(a)", "+t = 7", "+for i in range(k):", "+ if t % k < 1:", "+ exit(print(i + 1))", "+ t = (t * 10 + 7) % k", "+print(-1)" ]
false
0.424151
0.082745
5.126015
[ "s204985956", "s038544357" ]
u133936772
p02959
python
s515604776
s639593531
163
126
18,476
22,116
Accepted
Accepted
22.7
f=lambda:list(map(int,input().split())) n=f()[0];l=f();c=0;t=l.pop(0) for a,b in zip(l,f()): s=min(t+a,b);t=min(max(t+a-s,0),a);c+=s print(c)
f=lambda:list(map(int,input().split())) eval(input()) p,*A=f() B=f() s=0 for a,b in zip(A,B): t=min(b,a+p) p=a-max(0,t-p) s+=t print(s)
5
10
147
138
f = lambda: list(map(int, input().split())) n = f()[0] l = f() c = 0 t = l.pop(0) for a, b in zip(l, f()): s = min(t + a, b) t = min(max(t + a - s, 0), a) c += s print(c)
f = lambda: list(map(int, input().split())) eval(input()) p, *A = f() B = f() s = 0 for a, b in zip(A, B): t = min(b, a + p) p = a - max(0, t - p) s += t print(s)
false
50
[ "-n = f()[0]", "-l = f()", "-c = 0", "-t = l.pop(0)", "-for a, b in zip(l, f()):", "- s = min(t + a, b)", "- t = min(max(t + a - s, 0), a)", "- c += s", "-print(c)", "+eval(input())", "+p, *A = f()", "+B = f()", "+s = 0", "+for a, b in zip(A, B):", "+ t = min(b, a + p)", "+...
false
0.039458
0.03983
0.990662
[ "s515604776", "s639593531" ]
u903005414
p03569
python
s067567672
s781684473
190
70
41,904
10,704
Accepted
Accepted
63.16
import numpy as np S = np.array(list(eval(input()))) num_x = np.count_nonzero(S == 'x') # print(f'{num_x=}') A = [s for s in S if s != 'x'] # print(f'{S=}, {A=}') if len(A) % 2 == 0: L = A[:len(A) // 2] R = A[len(A) // 2:][::-1] else: L = A[:len(A) // 2] R = A[len(A) // 2 + 1:][::-1] # p...
from collections import deque S = deque(list(eval(input()))) ans = 0 while len(S) > 1: l = S.popleft() r = S.pop() if l == r: continue elif l == 'x': ans += 1 S.append(r) elif r == 'x': ans += 1 S.appendleft(l) else: print((-1)) ...
35
20
748
340
import numpy as np S = np.array(list(eval(input()))) num_x = np.count_nonzero(S == "x") # print(f'{num_x=}') A = [s for s in S if s != "x"] # print(f'{S=}, {A=}') if len(A) % 2 == 0: L = A[: len(A) // 2] R = A[len(A) // 2 :][::-1] else: L = A[: len(A) // 2] R = A[len(A) // 2 + 1 :][::-1] # print(f'{L=}...
from collections import deque S = deque(list(eval(input()))) ans = 0 while len(S) > 1: l = S.popleft() r = S.pop() if l == r: continue elif l == "x": ans += 1 S.append(r) elif r == "x": ans += 1 S.appendleft(l) else: print((-1)) exit() pri...
false
42.857143
[ "-import numpy as np", "+from collections import deque", "-S = np.array(list(eval(input())))", "-num_x = np.count_nonzero(S == \"x\")", "-# print(f'{num_x=}')", "-A = [s for s in S if s != \"x\"]", "-# print(f'{S=}, {A=}')", "-if len(A) % 2 == 0:", "- L = A[: len(A) // 2]", "- R = A[len(A) /...
false
0.308283
0.036884
8.35809
[ "s067567672", "s781684473" ]
u504836877
p03715
python
s124733664
s732735100
488
318
3,188
3,188
Accepted
Accepted
34.84
H,W = list(map(int, input().split())) ans = 10**10 for i in range(1, H): if (H-i)%2 == 0: smax = max(W*i, (H-i)*W//2) smin = min(W*i, (H-i)*W//2) else: smax = max(W*i, (H-i+1)*W//2) smin = min(W*i, (H-i-1)*W//2) ans = min(ans, smax-smin) if W%2 == 1: ...
H,W = list(map(int, input().split())) ans = [] if H > 2: ans.append(W*max(H//3, (H-H//3)//2, H-H//3-(H-H//3)//2)-W*min(H//3, (H-H//3)//2, H-H//3-(H-H//3)//2)) if W > 2: ans.append(H*max(W//3, (W-W//3)//2, W-W//3-(W-W//3)//2)-H*min(W//3, (W-W//3)//2, W-W//3-(W-W//3)//2)) num = 10**10 for x in range(...
35
18
971
606
H, W = list(map(int, input().split())) ans = 10**10 for i in range(1, H): if (H - i) % 2 == 0: smax = max(W * i, (H - i) * W // 2) smin = min(W * i, (H - i) * W // 2) else: smax = max(W * i, (H - i + 1) * W // 2) smin = min(W * i, (H - i - 1) * W // 2) ans = min(ans, smax - s...
H, W = list(map(int, input().split())) ans = [] if H > 2: ans.append( W * max(H // 3, (H - H // 3) // 2, H - H // 3 - (H - H // 3) // 2) - W * min(H // 3, (H - H // 3) // 2, H - H // 3 - (H - H // 3) // 2) ) if W > 2: ans.append( H * max(W // 3, (W - W // 3) // 2, W - W // 3 - (W - W...
false
48.571429
[ "-ans = 10**10", "-for i in range(1, H):", "- if (H - i) % 2 == 0:", "- smax = max(W * i, (H - i) * W // 2)", "- smin = min(W * i, (H - i) * W // 2)", "- else:", "- smax = max(W * i, (H - i + 1) * W // 2)", "- smin = min(W * i, (H - i - 1) * W // 2)", "- ans = mi...
false
0.087391
0.055587
1.572147
[ "s124733664", "s732735100" ]
u894114233
p00557
python
s246365798
s152921142
8,820
6,930
821,780
821,724
Accepted
Accepted
21.43
def check(y,x): if 0<=y<=h-1 and 0<=x<=w-1: return True return False h,w=list(map(int,input().split())) g=[list(map(int,input().split())) for _ in range(h)] pos=[-1]*(h*w) for i in range(h): for j in range(w): pos[g[i][j]-1]=[i,j] dy=(1,0,-1,0) dx=(0,1,0,-1) stop=[set() for _...
def check(y,x): if 0<=y<=h-1 and 0<=x<=w-1: return True return False h,w=list(map(int,input().split())) g=[list(map(int,input().split())) for _ in range(h)] pos=[-1]*(h*w) for i in range(h): for j in range(w): pos[g[i][j]-1]=[i,j] dy=(1,0,-1,0) dx=(0,1,0,-1) stop=[set() for _...
31
30
701
665
def check(y, x): if 0 <= y <= h - 1 and 0 <= x <= w - 1: return True return False h, w = list(map(int, input().split())) g = [list(map(int, input().split())) for _ in range(h)] pos = [-1] * (h * w) for i in range(h): for j in range(w): pos[g[i][j] - 1] = [i, j] dy = (1, 0, -1, 0) dx = (0, ...
def check(y, x): if 0 <= y <= h - 1 and 0 <= x <= w - 1: return True return False h, w = list(map(int, input().split())) g = [list(map(int, input().split())) for _ in range(h)] pos = [-1] * (h * w) for i in range(h): for j in range(w): pos[g[i][j] - 1] = [i, j] dy = (1, 0, -1, 0) dx = (0, ...
false
3.225806
[ "- for k in list(stop[g[ny][nx] - 1]):", "- stop[i].add(k)", "+ stop[i] = stop[i] | stop[g[ny][nx] - 1]" ]
false
0.056189
0.054302
1.034743
[ "s246365798", "s152921142" ]
u210992699
p02315
python
s973641313
s432029110
1,100
870
25,948
25,940
Accepted
Accepted
20.91
INF = 10 ** 12 N, W = list(map(int, input().split())) items =[] * N for i in range(N): v, w = list(map(int, input().split())) items.append([v,w]) dp = [[INF for i in range(W+1)] for j in range(N+1)] for i in range(W+1): dp[0][i] = 0 for i in range(N+1): dp[i][0] = 0 for i in ran...
N, W =list(map(int,input().split())) INF = 10**10 #dp = [[INF]*100000]*(N*100)#余分に dp = [[0 for i in range(W+1)] for j in range(N+1)] for i in range (N): dp[i][0] =0 for j in range (W+1): dp[0][j] =0 for i in range (N): v, w = list(map(int,input().split())) for j in range (W+1): ...
26
22
563
451
INF = 10**12 N, W = list(map(int, input().split())) items = [] * N for i in range(N): v, w = list(map(int, input().split())) items.append([v, w]) dp = [[INF for i in range(W + 1)] for j in range(N + 1)] for i in range(W + 1): dp[0][i] = 0 for i in range(N + 1): dp[i][0] = 0 for i in range(1, N + 1): # ...
N, W = list(map(int, input().split())) INF = 10**10 # dp = [[INF]*100000]*(N*100)#余分に dp = [[0 for i in range(W + 1)] for j in range(N + 1)] for i in range(N): dp[i][0] = 0 for j in range(W + 1): dp[0][j] = 0 for i in range(N): v, w = list(map(int, input().split())) for j in range(W + 1): if j -...
false
15.384615
[ "-INF = 10**12", "-items = [] * N", "+INF = 10**10", "+# dp = [[INF]*100000]*(N*100)#余分に", "+dp = [[0 for i in range(W + 1)] for j in range(N + 1)]", "+for i in range(N):", "+ dp[i][0] = 0", "+for j in range(W + 1):", "+ dp[0][j] = 0", "- items.append([v, w])", "-dp = [[INF for i in ran...
false
0.039635
0.041524
0.954519
[ "s973641313", "s432029110" ]
u350997995
p02859
python
s236085290
s884429566
21
17
3,316
2,940
Accepted
Accepted
19.05
print((int(eval(input()))**2))
r = int(eval(input())) print((r*r))
1
2
22
28
print((int(eval(input())) ** 2))
r = int(eval(input())) print((r * r))
false
50
[ "-print((int(eval(input())) ** 2))", "+r = int(eval(input()))", "+print((r * r))" ]
false
0.046825
0.048679
0.961908
[ "s236085290", "s884429566" ]
u379959788
p03624
python
s962209034
s119762969
33
20
3,188
3,956
Accepted
Accepted
39.39
# ABC072-B S = eval(input()) ss = set() for i in range(len(S)): ss.add(S[i]) alpha_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] ans = '' for k in range(len(alpha_list)): if alpha_list[...
S = eval(input()) S = set(list(S)) alp = [chr(ord('a') + i) for i in range(26)] for al in alp: if al in S: pass else: print(al) exit() print("None")
17
10
432
183
# ABC072-B S = eval(input()) ss = set() for i in range(len(S)): ss.add(S[i]) alpha_list = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y",...
S = eval(input()) S = set(list(S)) alp = [chr(ord("a") + i) for i in range(26)] for al in alp: if al in S: pass else: print(al) exit() print("None")
false
41.176471
[ "-# ABC072-B", "-ss = set()", "-for i in range(len(S)):", "- ss.add(S[i])", "-alpha_list = [", "- \"a\",", "- \"b\",", "- \"c\",", "- \"d\",", "- \"e\",", "- \"f\",", "- \"g\",", "- \"h\",", "- \"i\",", "- \"j\",", "- \"k\",", "- \"l\",", "- ...
false
0.039862
0.03968
1.004601
[ "s962209034", "s119762969" ]
u116233709
p03329
python
s911178316
s032333538
1,263
189
5,548
5,528
Accepted
Accepted
85.04
n=int(eval(input())) import math ansa=[0] ansb=[0] ans=[] cnt=0 x=0 y=0 for i in range(1,n+1): while 9**(x+1)<=i: x+=1 for j in range(x,-1,-1): z=(math.floor(i/(9**j))%9) i-=(9**j)*z cnt+=z ansa.append(cnt) cnt=0 for i in range(1,n+1): whil...
n=int(eval(input())) li6=[46656,7776,1296,216,36,6,1] li9=[59049,6561,729,81,9,1] dp6=[0]*(n+1) dp9=[0]*(n+1) dp6[1]=1 dp9[1]=1 ans=[] for i in range(2,n+1): for j in range(7): if i>=li6[j]: k=i-li6[j] break dp6[i]=1+dp6[k] for i in range(2,n+1): for j in rang...
33
24
570
503
n = int(eval(input())) import math ansa = [0] ansb = [0] ans = [] cnt = 0 x = 0 y = 0 for i in range(1, n + 1): while 9 ** (x + 1) <= i: x += 1 for j in range(x, -1, -1): z = math.floor(i / (9**j)) % 9 i -= (9**j) * z cnt += z ansa.append(cnt) cnt = 0 for i in range(1, n...
n = int(eval(input())) li6 = [46656, 7776, 1296, 216, 36, 6, 1] li9 = [59049, 6561, 729, 81, 9, 1] dp6 = [0] * (n + 1) dp9 = [0] * (n + 1) dp6[1] = 1 dp9[1] = 1 ans = [] for i in range(2, n + 1): for j in range(7): if i >= li6[j]: k = i - li6[j] break dp6[i] = 1 + dp6[k] for i in...
false
27.272727
[ "-import math", "-", "-ansa = [0]", "-ansb = [0]", "+li6 = [46656, 7776, 1296, 216, 36, 6, 1]", "+li9 = [59049, 6561, 729, 81, 9, 1]", "+dp6 = [0] * (n + 1)", "+dp9 = [0] * (n + 1)", "+dp6[1] = 1", "+dp9[1] = 1", "-cnt = 0", "-x = 0", "-y = 0", "-for i in range(1, n + 1):", "- while 9...
false
0.293375
0.052786
5.557859
[ "s911178316", "s032333538" ]
u389910364
p03293
python
s677957375
s383344840
326
164
22,332
13,436
Accepted
Accepted
49.69
import bisect import os from collections import Counter, deque from fractions import gcd from functools import lru_cache from functools import reduce import functools import heapq import itertools import math import numpy as np import re import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", ...
import bisect import cmath import heapq import itertools import math import operator import os import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from fractions import gcd from functools import lru_cache, reduce fro...
32
46
586
877
import bisect import os from collections import Counter, deque from fractions import gcd from functools import lru_cache from functools import reduce import functools import heapq import itertools import math import numpy as np import re import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrec...
import bisect import cmath import heapq import itertools import math import operator import os import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from fractions import gcd from functools import lru_cache, reduce from operator impo...
false
30.434783
[ "-import os", "-from collections import Counter, deque", "-from fractions import gcd", "-from functools import lru_cache", "-from functools import reduce", "-import functools", "+import cmath", "+import operator", "+import os", "+import re", "+import string", "+import sys", "+from collection...
false
0.068264
0.178609
0.382197
[ "s677957375", "s383344840" ]
u557523358
p04046
python
s837370264
s918501178
1,648
1,456
11,096
3,064
Accepted
Accepted
11.65
M=10**9+7;F=[pow(X,M-2,M)for X in range(2*10**5)];H,W,A,B=list(map(int,input().split()));Z=C=1 for I in range(H-1):Z=C=C*(W+H-B-2-I)*F[I+1]%M for I in range(1,H-A):C=C*(B-1+I)*F[I]*(H-I)*F[W+H-B-1-I]%M;Z=(Z+C)%M print(Z)
M=10**9+7;F=lambda X:pow(X,M-2,M);H,W,A,B=list(map(int,input().split()));Z=C=1 for I in range(H-1):Z=C=C*(W+H-B-2-I)*F(I+1)%M for I in range(1,H-A):C=C*(B-1+I)*(H-I)*F(I*(W+H-B-1-I))%M;Z=(Z+C)%M print(Z)
4
4
217
200
M = 10**9 + 7 F = [pow(X, M - 2, M) for X in range(2 * 10**5)] H, W, A, B = list(map(int, input().split())) Z = C = 1 for I in range(H - 1): Z = C = C * (W + H - B - 2 - I) * F[I + 1] % M for I in range(1, H - A): C = C * (B - 1 + I) * F[I] * (H - I) * F[W + H - B - 1 - I] % M Z = (Z + C) % M print(Z)
M = 10**9 + 7 F = lambda X: pow(X, M - 2, M) H, W, A, B = list(map(int, input().split())) Z = C = 1 for I in range(H - 1): Z = C = C * (W + H - B - 2 - I) * F(I + 1) % M for I in range(1, H - A): C = C * (B - 1 + I) * (H - I) * F(I * (W + H - B - 1 - I)) % M Z = (Z + C) % M print(Z)
false
0
[ "-F = [pow(X, M - 2, M) for X in range(2 * 10**5)]", "+F = lambda X: pow(X, M - 2, M)", "- Z = C = C * (W + H - B - 2 - I) * F[I + 1] % M", "+ Z = C = C * (W + H - B - 2 - I) * F(I + 1) % M", "- C = C * (B - 1 + I) * F[I] * (H - I) * F[W + H - B - 1 - I] % M", "+ C = C * (B - 1 + I) * (H - I) ...
false
0.900778
0.03728
24.162284
[ "s837370264", "s918501178" ]
u753803401
p02900
python
s591605638
s948118710
293
269
64,364
64,620
Accepted
Accepted
8.19
def slove(): import sys import fractions input = sys.stdin.readline a, b = list(map(int, input().rstrip('\n').split())) gcd = fractions.gcd(a, b) cnt = 1 for i in range(2, int(gcd ** 0.5) + 1): if gcd % i == 0: cnt += 1 while True: i...
def slove(): import sys import fractions input = sys.stdin.readline a, b = list(map(int, input().rstrip('\n').split())) gcd = fractions.gcd(a, b) cnt = 1 s = 2 e = int(gcd ** 0.5) + 1 d = True while True: if d: d = False for i in range...
22
34
514
836
def slove(): import sys import fractions input = sys.stdin.readline a, b = list(map(int, input().rstrip("\n").split())) gcd = fractions.gcd(a, b) cnt = 1 for i in range(2, int(gcd**0.5) + 1): if gcd % i == 0: cnt += 1 while True: if gcd % i ==...
def slove(): import sys import fractions input = sys.stdin.readline a, b = list(map(int, input().rstrip("\n").split())) gcd = fractions.gcd(a, b) cnt = 1 s = 2 e = int(gcd**0.5) + 1 d = True while True: if d: d = False for i in range(s, e): ...
false
35.294118
[ "- for i in range(2, int(gcd**0.5) + 1):", "- if gcd % i == 0:", "- cnt += 1", "- while True:", "+ s = 2", "+ e = int(gcd**0.5) + 1", "+ d = True", "+ while True:", "+ if d:", "+ d = False", "+ for i in range(s, e):", "- ...
false
0.094954
0.093756
1.012771
[ "s591605638", "s948118710" ]
u160414758
p03721
python
s597433601
s836779222
342
193
15,072
14,940
Accepted
Accepted
43.57
N,K = list(map(int,input().split())) d = {} for i in range(N): a,b = list(map(int,input().split())) if a in d: d[a]=d[a]+b else: d.setdefault(a,b) d = sorted(list(d.items())) for i in range(len(d)): K = K - d[i][1] if K <= 0: print((d[i][0])) break
from collections import defaultdict as dd import sys input = sys.stdin.readline N,K = list(map(int,input().split())) d = dd(int) for i in range(N): a,b = list(map(int,input().split())) d[a] += b d = sorted(d.items()) for i,j in d: K -= j if K <= 0: print(i) break
16
17
303
302
N, K = list(map(int, input().split())) d = {} for i in range(N): a, b = list(map(int, input().split())) if a in d: d[a] = d[a] + b else: d.setdefault(a, b) d = sorted(list(d.items())) for i in range(len(d)): K = K - d[i][1] if K <= 0: print((d[i][0])) break
from collections import defaultdict as dd import sys input = sys.stdin.readline N, K = list(map(int, input().split())) d = dd(int) for i in range(N): a, b = list(map(int, input().split())) d[a] += b d = sorted(d.items()) for i, j in d: K -= j if K <= 0: print(i) break
false
5.882353
[ "+from collections import defaultdict as dd", "+import sys", "+", "+input = sys.stdin.readline", "-d = {}", "+d = dd(int)", "- if a in d:", "- d[a] = d[a] + b", "- else:", "- d.setdefault(a, b)", "-d = sorted(list(d.items()))", "-for i in range(len(d)):", "- K = K - d[...
false
0.036416
0.058324
0.624376
[ "s597433601", "s836779222" ]
u102461423
p03161
python
s368212676
s714479907
1,954
1,776
21,760
12,444
Accepted
Accepted
9.11
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) import numpy as np N,K = list(map(int,input().split())) H = np.array(input().split(), dtype=np.int64) N,K,H dp = np.zeros(N,dtype=np.int64) for i in range(1,N): L = max(0,i-K) dp[i] = np.min(np.abs(H[i] - H[L:i]) + dp[L:i]) ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,K,*H = list(map(int,read().split())) H = [H[0]]*K+H dp = [0]*(K+N) for n in range(K,N+K): h = H[n] dp[n] = min(x+abs(y-h) for x,y in zip(dp[n-K:n],H[n-K:n])) answer = dp[-1] ...
18
17
346
328
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) import numpy as np N, K = list(map(int, input().split())) H = np.array(input().split(), dtype=np.int64) N, K, H dp = np.zeros(N, dtype=np.int64) for i in range(1, N): L = max(0, i - K) dp[i] = np.min(np.abs(H[i] - H[L:i]) + dp[L:i]) answer = d...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K, *H = list(map(int, read().split())) H = [H[0]] * K + H dp = [0] * (K + N) for n in range(K, N + K): h = H[n] dp[n] = min(x + abs(y - h) for x, y in zip(dp[n - K : n], H[n - K : n])) answer ...
false
5.555556
[ "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**7)", "-import numpy as np", "-", "-N, K = list(map(int, input().split()))", "-H = np.array(input().split(), dtype=np.int64)", "-N, K, H", "-dp = np.zeros(N, dtype=np.int64)", "-for i in range(1, N):", "- L = max(0, i - K)", "- dp[i...
false
0.290599
0.153812
1.889311
[ "s368212676", "s714479907" ]
u285891772
p02723
python
s950520175
s140533746
42
38
5,396
5,148
Accepted
Accepted
9.52
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ...
25
23
872
849
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_...
false
8
[ "-if S[2] == S[3] and S[4] == S[5]:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print((\"Yes\" if S[2] == S[3] and S[4] == S[5] else \"No\"))" ]
false
0.047145
0.067265
0.70088
[ "s950520175", "s140533746" ]
u227082700
p03945
python
s620166991
s831278050
47
18
3,188
3,188
Accepted
Accepted
61.7
s,ans=eval(input()),0 for i in range(len(s)-1): if s[i]!=s[i+1]:ans+=1 print(ans)
s=eval(input()) n=len(s) ans=s.count("WB") anss=s.count("BW") print((ans+anss))
4
5
80
75
s, ans = eval(input()), 0 for i in range(len(s) - 1): if s[i] != s[i + 1]: ans += 1 print(ans)
s = eval(input()) n = len(s) ans = s.count("WB") anss = s.count("BW") print((ans + anss))
false
20
[ "-s, ans = eval(input()), 0", "-for i in range(len(s) - 1):", "- if s[i] != s[i + 1]:", "- ans += 1", "-print(ans)", "+s = eval(input())", "+n = len(s)", "+ans = s.count(\"WB\")", "+anss = s.count(\"BW\")", "+print((ans + anss))" ]
false
0.06552
0.068389
0.958043
[ "s620166991", "s831278050" ]
u271934630
p03086
python
s671230668
s977591380
182
17
38,256
3,064
Accepted
Accepted
90.66
S = eval(input()) ACGT = ['A', 'C', 'G', 'T'] cnt = 0 maximum = 0 for s in S: if s in ACGT: cnt += 1 maximum = max(maximum, cnt) else: maximum = max(maximum, cnt) cnt = 0 print(maximum)
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) i_i = lambda: int(i_s()) i_l = lambda: list(map(int, stdin.readline().split())) i_s = lambda: stdin.readline().rstrip() S = i_s() cnt = 0 ans = 0 for s in S: if s in ['A', 'T', 'C', 'G']: cnt += 1 else: ans = max(ans,...
14
22
235
379
S = eval(input()) ACGT = ["A", "C", "G", "T"] cnt = 0 maximum = 0 for s in S: if s in ACGT: cnt += 1 maximum = max(maximum, cnt) else: maximum = max(maximum, cnt) cnt = 0 print(maximum)
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) i_i = lambda: int(i_s()) i_l = lambda: list(map(int, stdin.readline().split())) i_s = lambda: stdin.readline().rstrip() S = i_s() cnt = 0 ans = 0 for s in S: if s in ["A", "T", "C", "G"]: cnt += 1 else: ans = max(ans, cnt) cnt = ...
false
36.363636
[ "-S = eval(input())", "-ACGT = [\"A\", \"C\", \"G\", \"T\"]", "+import sys", "+", "+stdin = sys.stdin", "+sys.setrecursionlimit(10**7)", "+i_i = lambda: int(i_s())", "+i_l = lambda: list(map(int, stdin.readline().split()))", "+i_s = lambda: stdin.readline().rstrip()", "+S = i_s()", "-maximum = 0...
false
0.035346
0.037287
0.947936
[ "s671230668", "s977591380" ]
u761320129
p02574
python
s972954403
s193241661
1,986
834
127,344
132,124
Accepted
Accepted
58.01
from math import gcd N = int(eval(input())) A = list(map(int,input().split())) g = 0 for a in A: g = gcd(g,a) if g > 1: print('not coprime') exit() sa = set() for a in A: if a==1: continue if a in sa: print('setwise coprime') exit() sa.add(a) MAXN = 10**6+10...
from math import gcd N = int(eval(input())) A = list(map(int,input().split())) g = 0 for a in A: g = gcd(g,a) if g > 1: print('not coprime') exit() MAXN = 10**6+10 sieve = [i for i in range(MAXN+1)] p = 2 while p*p <= MAXN: if sieve[p] == p: for q in range(2*p,MAXN+1,p): ...
50
33
956
637
from math import gcd N = int(eval(input())) A = list(map(int, input().split())) g = 0 for a in A: g = gcd(g, a) if g > 1: print("not coprime") exit() sa = set() for a in A: if a == 1: continue if a in sa: print("setwise coprime") exit() sa.add(a) MAXN = 10**6 + 10 sieve ...
from math import gcd N = int(eval(input())) A = list(map(int, input().split())) g = 0 for a in A: g = gcd(g, a) if g > 1: print("not coprime") exit() MAXN = 10**6 + 10 sieve = [i for i in range(MAXN + 1)] p = 2 while p * p <= MAXN: if sieve[p] == p: for q in range(2 * p, MAXN + 1, p): ...
false
34
[ "-sa = set()", "-for a in A:", "- if a == 1:", "- continue", "- if a in sa:", "- print(\"setwise coprime\")", "- exit()", "- sa.add(a)", "-sieve = [0, 0] + [1] * MAXN", "+sieve = [i for i in range(MAXN + 1)]", "-small_primes = []", "- if sieve[p]:", "- ...
false
0.383158
0.910442
0.420848
[ "s972954403", "s193241661" ]
u892251744
p02762
python
s468662905
s121979987
691
529
80,728
61,144
Accepted
Accepted
23.44
def main(): import sys from collections import defaultdict input = sys.stdin.buffer.readline class UnionFind(): def __init__(self, n): self.n = n self.root = [-1] * (n + 1) self.rnk = [0] * (n + 1) def find_root(self, x): if s...
def main(): import sys from collections import defaultdict input = sys.stdin.buffer.readline class UnionFind(): def __init__(self, n): self.n = n self.root = [-1] * (n + 1) self.rnk = [0] * (n + 1) def find_root(self, x): whil...
61
59
1,669
1,586
def main(): import sys from collections import defaultdict input = sys.stdin.buffer.readline class UnionFind: def __init__(self, n): self.n = n self.root = [-1] * (n + 1) self.rnk = [0] * (n + 1) def find_root(self, x): if self.root[x] <...
def main(): import sys from collections import defaultdict input = sys.stdin.buffer.readline class UnionFind: def __init__(self, n): self.n = n self.root = [-1] * (n + 1) self.rnk = [0] * (n + 1) def find_root(self, x): while self.root[x...
false
3.278689
[ "- if self.root[x] < 0:", "- return x", "- else:", "- self.root[x] = self.find_root(self.root[x])", "- return self.root[x]", "+ while self.root[x] >= 0:", "+ x = self.root[x]", "+ return x" ]
false
0.04187
0.042609
0.982659
[ "s468662905", "s121979987" ]
u987164499
p02936
python
s831399624
s808677699
1,976
1,378
300,156
253,160
Accepted
Accepted
30.26
from sys import stdin,setrecursionlimit from itertools import groupby setrecursionlimit(10**6) n,q = [int(x) for x in stdin.readline().rstrip().split()] li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n-1)] lin = [list(map(int,stdin.readline().rstrip().split())) for _ in range(q)] kazu = [[...
from collections import defaultdict from sys import setrecursionlimit setrecursionlimit(10 ** 7) n,q = list(map(int,input().split())) node = [[] for _ in range(n+1)] counter = [0 for _ in range(n+1)] visited = [0 for _ in range(n+1)] point_dic = defaultdict(int) for _ in range(n-1): a,b = list(map(in...
21
44
649
868
from sys import stdin, setrecursionlimit from itertools import groupby setrecursionlimit(10**6) n, q = [int(x) for x in stdin.readline().rstrip().split()] li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n - 1)] lin = [list(map(int, stdin.readline().rstrip().split())) for _ in range(q)] kazu = [[...
from collections import defaultdict from sys import setrecursionlimit setrecursionlimit(10**7) n, q = list(map(int, input().split())) node = [[] for _ in range(n + 1)] counter = [0 for _ in range(n + 1)] visited = [0 for _ in range(n + 1)] point_dic = defaultdict(int) for _ in range(n - 1): a, b = list(map(int, in...
false
52.272727
[ "-from sys import stdin, setrecursionlimit", "-from itertools import groupby", "+from collections import defaultdict", "+from sys import setrecursionlimit", "-setrecursionlimit(10**6)", "-n, q = [int(x) for x in stdin.readline().rstrip().split()]", "-li = [list(map(int, stdin.readline().rstrip().split()...
false
0.03819
0.037977
1.005609
[ "s831399624", "s808677699" ]
u498487134
p02868
python
s944720052
s790196763
1,000
638
92,636
86,960
Accepted
Accepted
36.2
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): N,M=MI() inf=10**16 class SegTree: def __init__(self,N,ide,segfunc=min): self.ide_ele = ide...
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): N,M=MI() inf=10**16 ########################################## import heapq class Dijkstra(): ...
127
127
2,911
3,312
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): N, M = MI() inf = 10**16 class SegTree: def __init__(self, N, ide, segfunc=min): se...
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): N, M = MI() inf = 10**16 ########################################## import heapq class Dijkstra...
false
0
[ "+ ##########################################", "+ import heapq", "- class SegTree:", "- def __init__(self, N, ide, segfunc=min):", "- self.ide_ele = ide", "- \"\"\"", "- ex)", "- 最小値のセグ木 → +inf", "- 和のセグ木 → 0", "- ...
false
0.069707
0.042204
1.651691
[ "s944720052", "s790196763" ]
u167647458
p02725
python
s862180153
s509899413
136
116
26,436
26,420
Accepted
Accepted
14.71
k, n = list(map(int, input().split())) a = list(map(int, input().split())) a.append(a[0] + k) m = 0 for i in range(n): m = max(m, a[i+1] - a[i]) print((k - m))
k, n = list(map(int, input().split())) a = list(map(int, input().split())) a.append(a[0] + k) m = [] for i in range(n): m.append(a[i+1] - a[i]) print((k - max(m)))
8
7
163
165
k, n = list(map(int, input().split())) a = list(map(int, input().split())) a.append(a[0] + k) m = 0 for i in range(n): m = max(m, a[i + 1] - a[i]) print((k - m))
k, n = list(map(int, input().split())) a = list(map(int, input().split())) a.append(a[0] + k) m = [] for i in range(n): m.append(a[i + 1] - a[i]) print((k - max(m)))
false
12.5
[ "-m = 0", "+m = []", "- m = max(m, a[i + 1] - a[i])", "-print((k - m))", "+ m.append(a[i + 1] - a[i])", "+print((k - max(m)))" ]
false
0.037512
0.048924
0.766731
[ "s862180153", "s509899413" ]
u201234972
p03673
python
s604704000
s565808409
353
156
25,412
30,660
Accepted
Accepted
55.81
from collections import deque n = int(input()) A = list( map( int, input().split())) B = deque() reverse = 0 for i in range(n): if reverse == 0: B.append(A[i]) reverse = 1 else: B.appendleft(A[i]) reverse = 0 B = list(B) if reverse == 1: B = B[::-1] for i in ra...
from collections import deque n = int(eval(input())) A = list( map( int, input().split())) B = deque() reverse = 0 for i in range(n): if reverse == 0: B.append(A[i]) reverse = 1 else: B.appendleft(A[i]) reverse = 0 B = list(B) if reverse == 1: B = B[::-1] print...
18
16
372
346
from collections import deque n = int(input()) A = list(map(int, input().split())) B = deque() reverse = 0 for i in range(n): if reverse == 0: B.append(A[i]) reverse = 1 else: B.appendleft(A[i]) reverse = 0 B = list(B) if reverse == 1: B = B[::-1] for i in range(n - 1): ...
from collections import deque n = int(eval(input())) A = list(map(int, input().split())) B = deque() reverse = 0 for i in range(n): if reverse == 0: B.append(A[i]) reverse = 1 else: B.appendleft(A[i]) reverse = 0 B = list(B) if reverse == 1: B = B[::-1] print((" ".join(list(...
false
11.111111
[ "-n = int(input())", "+n = int(eval(input()))", "-for i in range(n - 1):", "- print(B[i], end=\" \")", "-print(B[n - 1])", "+print((\" \".join(list(map(str, B)))))" ]
false
0.04519
0.043577
1.037012
[ "s604704000", "s565808409" ]
u305366205
p03352
python
s385671179
s287268865
21
17
2,940
2,940
Accepted
Accepted
19.05
x = int(eval(input())) ans = 1 for b in range(1, 1001): for p in range(2, 11): now = b ** p if now <= x: ans = max(ans, now) print(ans)
X = int(eval(input())) ans = 0 for b in range(1, 32): for p in range(2, 10): exp = b ** p if exp <= X: ans = max(ans, exp) print(ans)
8
8
168
166
x = int(eval(input())) ans = 1 for b in range(1, 1001): for p in range(2, 11): now = b**p if now <= x: ans = max(ans, now) print(ans)
X = int(eval(input())) ans = 0 for b in range(1, 32): for p in range(2, 10): exp = b**p if exp <= X: ans = max(ans, exp) print(ans)
false
0
[ "-x = int(eval(input()))", "-ans = 1", "-for b in range(1, 1001):", "- for p in range(2, 11):", "- now = b**p", "- if now <= x:", "- ans = max(ans, now)", "+X = int(eval(input()))", "+ans = 0", "+for b in range(1, 32):", "+ for p in range(2, 10):", "+ exp ...
false
0.041473
0.03716
1.116059
[ "s385671179", "s287268865" ]
u645250356
p02733
python
s499630686
s495687153
844
462
101,080
80,208
Accepted
Accepted
45.26
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions from decimal import Decimal sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, ...
54
51
1,459
1,540
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions from decimal import Decimal sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return ...
false
5.555556
[ "-from heapq import heappop, heappush, heapify", "-import sys, bisect, math, itertools, fractions", "-from decimal import Decimal", "+from heapq import heappop, heappush", "+from bisect import bisect_left, bisect_right", "+import sys, math, itertools, fractions, pprint", "-n, m, K = inpl()", "-s = [ev...
false
0.038103
0.075779
0.50282
[ "s499630686", "s495687153" ]
u936985471
p03163
python
s947944985
s827380532
177
141
14,536
28,864
Accepted
Accepted
20.34
N,W=list(map(int,input().split())) import numpy as np dp=np.zeros(W+1,dtype=int) for i in range(N): w,v=list(map(int,input().split())) np.maximum(dp[:-w]+v,dp[w:],out=dp[w:]) print((dp.max()))
import sys readline = sys.stdin.readline import numpy as np N,W = list(map(int,readline().split())) dp = np.zeros(W + 1, dtype = int) for i in range(N): w,v = list(map(int,readline().split())) np.maximum(dp[:-w] + v,dp[w:],out = dp[w:]) print((max(dp)))
7
13
189
261
N, W = list(map(int, input().split())) import numpy as np dp = np.zeros(W + 1, dtype=int) for i in range(N): w, v = list(map(int, input().split())) np.maximum(dp[:-w] + v, dp[w:], out=dp[w:]) print((dp.max()))
import sys readline = sys.stdin.readline import numpy as np N, W = list(map(int, readline().split())) dp = np.zeros(W + 1, dtype=int) for i in range(N): w, v = list(map(int, readline().split())) np.maximum(dp[:-w] + v, dp[w:], out=dp[w:]) print((max(dp)))
false
46.153846
[ "-N, W = list(map(int, input().split()))", "+import sys", "+", "+readline = sys.stdin.readline", "+N, W = list(map(int, readline().split()))", "- w, v = list(map(int, input().split()))", "+ w, v = list(map(int, readline().split()))", "-print((dp.max()))", "+print((max(dp)))" ]
false
0.180313
0.575206
0.313476
[ "s947944985", "s827380532" ]
u414980766
p02889
python
s330489983
s369860564
1,577
345
19,144
36,868
Accepted
Accepted
78.12
import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix INF = 10**12 N, M, L = list(map(int, input().split())) A = []; B = []; C = [] for i in range(M): a, b, c = list(map(int, input().split())) A.append(a - 1); B.append(b - 1); C.append(c) A = np.array(...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix INF = 10**12 N, M, L = list(map(int, readline().split())) ABCQST = np.array(read().spl...
27
32
686
717
import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix INF = 10**12 N, M, L = list(map(int, input().split())) A = [] B = [] C = [] for i in range(M): a, b, c = list(map(int, input().split())) A.append(a - 1) B.append(b - 1) C.append(c) A = np.array(A) B =...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix INF = 10**12 N, M, L = list(map(int, readline().split())) ABCQST = np.array(read().split(), dtype=n...
false
15.625
[ "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "-N, M, L = list(map(int, input().split()))", "-A = []", "-B = []", "-C = []", "-for i in range(M):", "- a, b, c = list(map(int, input().split()))", "- ...
false
0.258669
0.330942
0.781616
[ "s330489983", "s369860564" ]
u729133443
p03485
python
s767611628
s339716465
164
26
38,384
9,108
Accepted
Accepted
84.15
print((eval(input().replace(' ','+1+'))//2))
print((eval(input().replace(*' +'))+1>>1))
1
1
42
40
print((eval(input().replace(" ", "+1+")) // 2))
print((eval(input().replace(*" +")) + 1 >> 1))
false
0
[ "-print((eval(input().replace(\" \", \"+1+\")) // 2))", "+print((eval(input().replace(*\" +\")) + 1 >> 1))" ]
false
0.084577
0.080703
1.048004
[ "s767611628", "s339716465" ]
u875291233
p03014
python
s303758303
s687199716
1,027
700
96,088
179,460
Accepted
Accepted
31.84
# coding: utf-8 # Your code here! #n = int(input()) #s = input() #a = [int(i) for i in input().split()] #m = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行 h,w = [int(i) for i in input().split()] b = [eval(input()) for i in range(h)] ans = [[0]*w for i in range(h)] for i in range(h):...
# coding: utf-8 # Your code here! h,w = [int(i) for i in input().split()] b = [eval(input()) for i in range(h)] l = [[0]*w for _ in [0]*h] #左にある白マス(自分含む) r = [[0]*w for _ in [0]*h] u = [[0]*w for _ in [0]*h] #上にある白マス(自分含む) d = [[0]*w for _ in [0]*h] for hi in range(h): for wj in range(w): if b...
64
26
1,224
696
# coding: utf-8 # Your code here! # n = int(input()) # s = input() # a = [int(i) for i in input().split()] # m = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行 h, w = [int(i) for i in input().split()] b = [eval(input()) for i in range(h)] ans = [[0] * w for i in range(h)] for i in range(h): res = 0 ...
# coding: utf-8 # Your code here! h, w = [int(i) for i in input().split()] b = [eval(input()) for i in range(h)] l = [[0] * w for _ in [0] * h] # 左にある白マス(自分含む) r = [[0] * w for _ in [0] * h] u = [[0] * w for _ in [0] * h] # 上にある白マス(自分含む) d = [[0] * w for _ in [0] * h] for hi in range(h): for wj in range(w): ...
false
59.375
[ "-# n = int(input())", "-# s = input()", "-# a = [int(i) for i in input().split()]", "-# m = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行", "-ans = [[0] * w for i in range(h)]", "+l = [[0] * w for _ in [0] * h] # 左にある白マス(自分含む)", "+r = [[0] * w for _ in [0] * h]", "+u = [[0] * w for _...
false
0.083541
0.037508
2.227317
[ "s303758303", "s687199716" ]
u064505481
p03178
python
s543575733
s156531047
1,217
743
45,464
92,892
Accepted
Accepted
38.95
from sys import stdin, stdout from collections import deque, defaultdict from functools import lru_cache rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.readline().split())) INF, NINF = float('inf'), float('-inf') def main(): MOD = 10**9 + 7 x = []...
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter from heapq import heappush, heappop from functools import lru_cache import math setrecursionlimit(10**6) rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.r...
37
38
900
1,012
from sys import stdin, stdout from collections import deque, defaultdict from functools import lru_cache rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.readline().split())) INF, NINF = float("inf"), float("-inf") def main(): MOD = 10**9 + 7 x = [] f...
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter from heapq import heappush, heappop from functools import lru_cache import math setrecursionlimit(10**6) rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.readline()...
false
2.631579
[ "-from sys import stdin, stdout", "-from collections import deque, defaultdict", "+from sys import stdin, stdout, setrecursionlimit", "+from collections import deque, defaultdict, Counter", "+from heapq import heappush, heappop", "+import math", "+setrecursionlimit(10**6)", "+rlf = lambda: list(map(fl...
false
0.038427
0.038296
1.003435
[ "s543575733", "s156531047" ]
u730769327
p03557
python
s601251439
s672643905
456
212
107,108
106,736
Accepted
Accepted
53.51
import bisect n=int(eval(input())) A=sorted(list(map(int,input().split()))) B=sorted(list(map(int,input().split()))) C=sorted(list(map(int,input().split()))) sm=0 for j in B: sm+=bisect.bisect_left(A,j)*(n-bisect.bisect_right(C,j)) print(sm)
import bisect n=int(eval(input())) a=sorted(list(map(int,input().split()))) b=sorted(list(map(int,input().split()))) c=sorted(list(map(int,input().split()))) cnt=0 for i in b: cnt+=bisect.bisect_left(a,i)*(n-bisect.bisect_right(c,i)) print(cnt)
10
9
249
248
import bisect n = int(eval(input())) A = sorted(list(map(int, input().split()))) B = sorted(list(map(int, input().split()))) C = sorted(list(map(int, input().split()))) sm = 0 for j in B: sm += bisect.bisect_left(A, j) * (n - bisect.bisect_right(C, j)) print(sm)
import bisect n = int(eval(input())) a = sorted(list(map(int, input().split()))) b = sorted(list(map(int, input().split()))) c = sorted(list(map(int, input().split()))) cnt = 0 for i in b: cnt += bisect.bisect_left(a, i) * (n - bisect.bisect_right(c, i)) print(cnt)
false
10
[ "-A = sorted(list(map(int, input().split())))", "-B = sorted(list(map(int, input().split())))", "-C = sorted(list(map(int, input().split())))", "-sm = 0", "-for j in B:", "- sm += bisect.bisect_left(A, j) * (n - bisect.bisect_right(C, j))", "-print(sm)", "+a = sorted(list(map(int, input().split()))...
false
0.112454
0.274036
0.410361
[ "s601251439", "s672643905" ]
u020373088
p03294
python
s936566487
s883036123
20
18
3,316
3,316
Accepted
Accepted
10
n = int(eval(input())) a = list(map(int, input().split())) print((sum(a)-len(a)))
n = int(eval(input())) a = list(map(int, input().split())) print((sum(a)-n))
3
3
75
70
n = int(eval(input())) a = list(map(int, input().split())) print((sum(a) - len(a)))
n = int(eval(input())) a = list(map(int, input().split())) print((sum(a) - n))
false
0
[ "-print((sum(a) - len(a)))", "+print((sum(a) - n))" ]
false
0.008016
0.037889
0.211555
[ "s936566487", "s883036123" ]
u729133443
p02964
python
s031050848
s507345015
738
679
49,148
49,148
Accepted
Accepted
7.99
n,k,*a=list(map(int,open(0).read().split())) b=[[]for _ in range(max(a)+1)] l=[] for i,v in enumerate(a): b[v]+=i, l+=len(b[v]), s=a[0] i=c=0 while 1: t=b[s] m=len(t) j=l[i] c+=j==m i=t[j%m]+1 if i==n:break s=a[i] k%=c+1 s=a[0] i=c=0 r=[] while c<k-1or i<n: t=b[s] m=len(t) ...
n,k,*a=list(map(int,open(0).read().split())) b=[[]for _ in range(max(a)+1)] l=[] for i,v in enumerate(a): b[v]+=i, l+=len(b[v]), s=a[0] i=c=0 while 1: t=b[s] m=len(t) j=l[i] c+=j==m i=t[j%m]+1 if i==n:break s=a[i] k%=c+1 s=a[0] i=c=0 r=[] while 1: t=b[s] m=len(t) j=l[i] ...
32
33
420
425
n, k, *a = list(map(int, open(0).read().split())) b = [[] for _ in range(max(a) + 1)] l = [] for i, v in enumerate(a): b[v] += (i,) l += (len(b[v]),) s = a[0] i = c = 0 while 1: t = b[s] m = len(t) j = l[i] c += j == m i = t[j % m] + 1 if i == n: break s = a[i] k %= c + 1 s =...
n, k, *a = list(map(int, open(0).read().split())) b = [[] for _ in range(max(a) + 1)] l = [] for i, v in enumerate(a): b[v] += (i,) l += (len(b[v]),) s = a[0] i = c = 0 while 1: t = b[s] m = len(t) j = l[i] c += j == m i = t[j % m] + 1 if i == n: break s = a[i] k %= c + 1 s =...
false
3.030303
[ "-while c < k - 1 or i < n:", "+while 1:", "- s = a[i % n]", "+ if i == n:", "+ break", "+ s = a[i]" ]
false
0.047736
0.008352
5.715683
[ "s031050848", "s507345015" ]
u983918956
p03986
python
s841013771
s852594578
71
62
5,096
5,096
Accepted
Accepted
12.68
X = eval(input()) stack = [] for e in X: if e == "S": stack.append(e) elif stack == []: stack.append(e) elif stack[-1] == "T": stack.append(e) elif stack[-1] == "S": stack.pop(-1) print((len(stack)))
from collections import deque X = eval(input()) dq = deque() for x in X: if not dq: dq.append(x) elif dq[-1] == "S" and x == "T": dq.pop() else: dq.append(x) ans = len(dq) print(ans)
12
16
250
235
X = eval(input()) stack = [] for e in X: if e == "S": stack.append(e) elif stack == []: stack.append(e) elif stack[-1] == "T": stack.append(e) elif stack[-1] == "S": stack.pop(-1) print((len(stack)))
from collections import deque X = eval(input()) dq = deque() for x in X: if not dq: dq.append(x) elif dq[-1] == "S" and x == "T": dq.pop() else: dq.append(x) ans = len(dq) print(ans)
false
25
[ "+from collections import deque", "+", "-stack = []", "-for e in X:", "- if e == \"S\":", "- stack.append(e)", "- elif stack == []:", "- stack.append(e)", "- elif stack[-1] == \"T\":", "- stack.append(e)", "- elif stack[-1] == \"S\":", "- stack.pop(-1)",...
false
0.03798
0.037366
1.016418
[ "s841013771", "s852594578" ]
u667024514
p03315
python
s055328793
s574715150
142
18
3,444
2,940
Accepted
Accepted
87.32
from collections import Counter s = str(eval(input())) cou = 0 print((s.count("+") - s.count("-")))
s = list(str(eval(input()))) cou = 0 for i in range(len(s)): if s[i] == "-": cou -= 1 else: cou += 1 print(cou)
4
8
94
124
from collections import Counter s = str(eval(input())) cou = 0 print((s.count("+") - s.count("-")))
s = list(str(eval(input()))) cou = 0 for i in range(len(s)): if s[i] == "-": cou -= 1 else: cou += 1 print(cou)
false
50
[ "-from collections import Counter", "-", "-s = str(eval(input()))", "+s = list(str(eval(input())))", "-print((s.count(\"+\") - s.count(\"-\")))", "+for i in range(len(s)):", "+ if s[i] == \"-\":", "+ cou -= 1", "+ else:", "+ cou += 1", "+print(cou)" ]
false
0.037653
0.036912
1.020073
[ "s055328793", "s574715150" ]
u974100230
p03457
python
s956669894
s722261567
382
320
3,060
3,060
Accepted
Accepted
16.23
t, x, y = 0, 0, 0 for i in range(int(eval(input()))): next_t, next_x, next_y = list(map(int, input().split())) diff = abs(x - next_x) + abs(y - next_y) if diff > (next_t - t) or (diff - (next_t - t)) % 2 == 1: print("No") exit(0) t, x, y, = next_t, next_x, next_y print("Yes")
N = int(eval(input())) for __ in range(N): t, x, y = list(map(int, input().split())) if (x + y) > t or (x + y + t) % 2 == 1: print("No") exit(0) print("Yes")
9
8
304
177
t, x, y = 0, 0, 0 for i in range(int(eval(input()))): next_t, next_x, next_y = list(map(int, input().split())) diff = abs(x - next_x) + abs(y - next_y) if diff > (next_t - t) or (diff - (next_t - t)) % 2 == 1: print("No") exit(0) t, x, y, = ( next_t, next_x, next_...
N = int(eval(input())) for __ in range(N): t, x, y = list(map(int, input().split())) if (x + y) > t or (x + y + t) % 2 == 1: print("No") exit(0) print("Yes")
false
11.111111
[ "-t, x, y = 0, 0, 0", "-for i in range(int(eval(input()))):", "- next_t, next_x, next_y = list(map(int, input().split()))", "- diff = abs(x - next_x) + abs(y - next_y)", "- if diff > (next_t - t) or (diff - (next_t - t)) % 2 == 1:", "+N = int(eval(input()))", "+for __ in range(N):", "+ t, ...
false
0.04352
0.072427
0.600882
[ "s956669894", "s722261567" ]
u557565572
p02762
python
s850756136
s482572840
1,545
1,302
47,112
46,760
Accepted
Accepted
15.73
# import bisect # # import heapq # # from copy import deepcopy from collections import deque # # from collections import Counter # # from itertools import accumulate # # from itertools import permutations # import numpy as np # # import math n, m, k = list(map(int, input().split())) # a = list(map(int, inpu...
# import bisect # import heapq # from copy import deepcopy # from collections import deque # from collections import Counter # from itertools import accumulate # from itertools import permutations # import numpy as np # import math n, m, k = list(map(int, input().split())) # a = list(map(int, input().split(...
65
65
1,537
1,527
# import bisect # # import heapq # # from copy import deepcopy from collections import deque # # from collections import Counter # # from itertools import accumulate # # from itertools import permutations # import numpy as np # # import math n, m, k = list(map(int, input().split())) # a = list(map(int, input().split()...
# import bisect # import heapq # from copy import deepcopy # from collections import deque # from collections import Counter # from itertools import accumulate # from itertools import permutations # import numpy as np # import math n, m, k = list(map(int, input().split())) # a = list(map(int, input().split())) # n = in...
false
0
[ "-# # import heapq", "-# # from copy import deepcopy", "-from collections import deque", "-", "-# # from collections import Counter", "-# # from itertools import accumulate", "-# # from itertools import permutations", "+# import heapq", "+# from copy import deepcopy", "+# from collections import d...
false
0.086696
0.075637
1.146223
[ "s850756136", "s482572840" ]
u729133443
p02792
python
s668499192
s504790709
206
182
3,060
2,940
Accepted
Accepted
11.65
d=[0]*100 for i in range(int(eval(input()))): s=str(i+1) d[int(s[0])*10+int(s[-1])]+=1 print((sum(d[i]*d[i%10*10+i//10]for i in range(100))))
d=[0]*100 for i in range(int(eval(input()))):s=str(i+1);d[int(s[0]+s[-1])]+=1 print((sum(d[i]*d[i%10*10+i//10]for i in range(100))))
5
3
141
126
d = [0] * 100 for i in range(int(eval(input()))): s = str(i + 1) d[int(s[0]) * 10 + int(s[-1])] += 1 print((sum(d[i] * d[i % 10 * 10 + i // 10] for i in range(100))))
d = [0] * 100 for i in range(int(eval(input()))): s = str(i + 1) d[int(s[0] + s[-1])] += 1 print((sum(d[i] * d[i % 10 * 10 + i // 10] for i in range(100))))
false
40
[ "- d[int(s[0]) * 10 + int(s[-1])] += 1", "+ d[int(s[0] + s[-1])] += 1" ]
false
0.120032
0.152784
0.78563
[ "s668499192", "s504790709" ]
u389910364
p02659
python
s836891766
s921447175
102
25
27,212
9,236
Accepted
Accepted
75.49
import bisect import cmath import heapq import itertools import math import operator import os import random import re import string import sys from collections import Counter, defaultdict, deque from copy import deepcopy from decimal import Decimal from functools import lru_cache, reduce from math impor...
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 a, b = sys.stdin.buffer.readline().decode().rstrip().split() a = int(a) b = round(float(b) * 100) print((a * b // 100...
32
17
682
321
import bisect import cmath import heapq import itertools import math import operator import os import random import re import string import sys from collections import Counter, defaultdict, deque from copy import deepcopy from decimal import Decimal from functools import lru_cache, reduce from math import gcd from oper...
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 a, b = sys.stdin.buffer.readline().decode().rstrip().split() a = int(a) b = round(float(b) * 100) print((a * b // 100))
false
46.875
[ "-import bisect", "-import cmath", "-import heapq", "-import itertools", "-import math", "-import operator", "-import random", "-import re", "-import string", "-from collections import Counter, defaultdict, deque", "-from copy import deepcopy", "-from decimal import Decimal", "-from functool...
false
0.037166
0.036432
1.020162
[ "s836891766", "s921447175" ]
u109266345
p02898
python
s911939698
s249964502
53
48
11,908
11,908
Accepted
Accepted
9.43
n,k = list(map(int,input().split())) h = list(map(int,input().split())) ans = 0 for i in range(n): if h[i] >= k: ans += 1 print(ans)
n,k = list(map(int,input().split())) h = list(map(int,input().split())) print((sum(a>=k for a in h)))
7
3
144
95
n, k = list(map(int, input().split())) h = list(map(int, input().split())) ans = 0 for i in range(n): if h[i] >= k: ans += 1 print(ans)
n, k = list(map(int, input().split())) h = list(map(int, input().split())) print((sum(a >= k for a in h)))
false
57.142857
[ "-ans = 0", "-for i in range(n):", "- if h[i] >= k:", "- ans += 1", "-print(ans)", "+print((sum(a >= k for a in h)))" ]
false
0.048031
0.048198
0.996538
[ "s911939698", "s249964502" ]
u314050667
p03805
python
s368192756
s145906261
35
31
3,064
3,064
Accepted
Accepted
11.43
N, M = list(map(int, input().split())) E = [[] for _ in range(N)] for _ in range(M): ta, tb = list(map(int, input().split())) E[ta-1].append(tb-1) E[tb-1].append(ta-1) def next_permutation(out, cnt, flg): if cnt == N: for i in range(N-1): if out[i+1] not in E[out[i]]: return 0 return 1 ...
import itertools N, M = list(map(int, input().split())) E = [[] for _ in range(N)] for _ in range(M): ta, tb = list(map(int, input().split())) E[ta-1].append(tb-1) E[tb-1].append(ta-1) ans = 0 for p in itertools.permutations(list(range(1,N))): p = [0] + list(p) cond = 1 for i in range(N-1): ...
38
23
612
380
N, M = list(map(int, input().split())) E = [[] for _ in range(N)] for _ in range(M): ta, tb = list(map(int, input().split())) E[ta - 1].append(tb - 1) E[tb - 1].append(ta - 1) def next_permutation(out, cnt, flg): if cnt == N: for i in range(N - 1): if out[i + 1] not in E[out[i]]: ...
import itertools N, M = list(map(int, input().split())) E = [[] for _ in range(N)] for _ in range(M): ta, tb = list(map(int, input().split())) E[ta - 1].append(tb - 1) E[tb - 1].append(ta - 1) ans = 0 for p in itertools.permutations(list(range(1, N))): p = [0] + list(p) cond = 1 for i in range(...
false
39.473684
[ "+import itertools", "+", "-", "-", "-def next_permutation(out, cnt, flg):", "- if cnt == N:", "- for i in range(N - 1):", "- if out[i + 1] not in E[out[i]]:", "- return 0", "- return 1", "- ans = 0", "- for i in range(N):", "- if flg[i...
false
0.043961
0.050415
0.871976
[ "s368192756", "s145906261" ]
u119148115
p02647
python
s244713902
s175965299
697
389
185,184
208,868
Accepted
Accepted
44.19
import sys def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり N,K = MI() A = LI() from itertools import accumulate for _ in range(min(K,100)): B = [0]*(N+1) for i in range(N): a = A[i] ...
import sys def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり N,K = MI() A = LI() from itertools import accumulate for _ in range(min(K,41)): B = [0]*(N+1) for i in range(N): a = A[i] ...
20
20
442
441
import sys def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり N, K = MI() A = LI() from itertools import accumulate for _ in range(min(K, 100)): B = [0] * (N + 1) for i in range(N): a = A[i]...
import sys def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり N, K = MI() A = LI() from itertools import accumulate for _ in range(min(K, 41)): B = [0] * (N + 1) for i in range(N): a = A[i] ...
false
0
[ "-for _ in range(min(K, 100)):", "+for _ in range(min(K, 41)):" ]
false
0.041196
0.042637
0.966202
[ "s244713902", "s175965299" ]
u347640436
p03295
python
s901028856
s168450785
310
233
23,368
28,712
Accepted
Accepted
24.84
N, M = list(map(int, input().split())) ab = [[] for _ in range(N + 1)] for _ in range(M): a, b = list(map(int, input().split())) ab[a].append(b) dp = [0] * (N + 1) for i in range(1, N + 1): dp[i] = max(dp[i], dp[i - 1]) for j in ab[i]: dp[j] = max(dp[j], dp[i] + 1) print((dp[N]))...
from sys import stdin readline = stdin.readline N, M = list(map(int, readline().split())) ab = [list(map(int, readline().split())) for _ in range(M)] ab.sort(key=lambda x: x[1]) result = 0 t = -1 for a, b in ab: a, b = a - 1, b - 1 if a <= t < b: continue result += 1 t = b - 1 ...
14
17
307
329
N, M = list(map(int, input().split())) ab = [[] for _ in range(N + 1)] for _ in range(M): a, b = list(map(int, input().split())) ab[a].append(b) dp = [0] * (N + 1) for i in range(1, N + 1): dp[i] = max(dp[i], dp[i - 1]) for j in ab[i]: dp[j] = max(dp[j], dp[i] + 1) print((dp[N]))
from sys import stdin readline = stdin.readline N, M = list(map(int, readline().split())) ab = [list(map(int, readline().split())) for _ in range(M)] ab.sort(key=lambda x: x[1]) result = 0 t = -1 for a, b in ab: a, b = a - 1, b - 1 if a <= t < b: continue result += 1 t = b - 1 print(result)
false
17.647059
[ "-N, M = list(map(int, input().split()))", "-ab = [[] for _ in range(N + 1)]", "-for _ in range(M):", "- a, b = list(map(int, input().split()))", "- ab[a].append(b)", "-dp = [0] * (N + 1)", "-for i in range(1, N + 1):", "- dp[i] = max(dp[i], dp[i - 1])", "- for j in ab[i]:", "- ...
false
0.119762
0.034539
3.467499
[ "s901028856", "s168450785" ]
u671446913
p02843
python
s116880413
s475386301
330
22
21,276
3,316
Accepted
Accepted
93.33
import collections import itertools as it import math import numpy as np # A = input() # A = int(input()) # A = map(int, input().split()) # A = list(map(int, input().split())) # A = [int(input()) for i in range(N)] # # c = collections.Counter() X = int(eval(input())) nshohin = X // 100 amari = X % 100 ...
#!/usr/bin/env python3 import collections import itertools as it import math #import numpy as np # = input() x = int(eval(input())) # = map(int, input().split()) # = list(map(int, input().split())) # = [int(input()) for i in range(N)] # # c = collections.Counter() n = x // 100 mod = x % 100 prin...
18
18
355
343
import collections import itertools as it import math import numpy as np # A = input() # A = int(input()) # A = map(int, input().split()) # A = list(map(int, input().split())) # A = [int(input()) for i in range(N)] # # c = collections.Counter() X = int(eval(input())) nshohin = X // 100 amari = X % 100 print((0 if nsho...
#!/usr/bin/env python3 import collections import itertools as it import math # import numpy as np # = input() x = int(eval(input())) # = map(int, input().split()) # = list(map(int, input().split())) # = [int(input()) for i in range(N)] # # c = collections.Counter() n = x // 100 mod = x % 100 print((0 if 5 * n < mo...
false
0
[ "+#!/usr/bin/env python3", "-import numpy as np", "-# A = input()", "-# A = int(input())", "-# A = map(int, input().split())", "-# A = list(map(int, input().split()))", "-# A = [int(input()) for i in range(N)]", "+# import numpy as np", "+# = input()", "+x = int(eval(input()))", "+# = map(int,...
false
0.040254
0.035303
1.140232
[ "s116880413", "s475386301" ]
u991567869
p03624
python
s454541533
s395807570
21
19
3,188
3,188
Accepted
Accepted
9.52
s = sorted(list(set(eval(input())))) a = "abcdefghijklmnopqrstuvwxyz" if "".join(s) == a: print("None") exit() else: for i in s: a = a.replace(i, "") print((a[0]))
a = [chr(ord("a") + i) for i in range(26)] s = sorted(list(set(eval(input())))) for i in a: if i not in s: print(i) exit() print("None")
11
9
187
160
s = sorted(list(set(eval(input())))) a = "abcdefghijklmnopqrstuvwxyz" if "".join(s) == a: print("None") exit() else: for i in s: a = a.replace(i, "") print((a[0]))
a = [chr(ord("a") + i) for i in range(26)] s = sorted(list(set(eval(input())))) for i in a: if i not in s: print(i) exit() print("None")
false
18.181818
[ "+a = [chr(ord(\"a\") + i) for i in range(26)]", "-a = \"abcdefghijklmnopqrstuvwxyz\"", "-if \"\".join(s) == a:", "- print(\"None\")", "- exit()", "-else:", "- for i in s:", "- a = a.replace(i, \"\")", "-print((a[0]))", "+for i in a:", "+ if i not in s:", "+ print(i)"...
false
0.039663
0.042045
0.943352
[ "s454541533", "s395807570" ]
u998769995
p03162
python
s335847041
s214285829
290
134
91,552
85,992
Accepted
Accepted
53.79
import math,sys,bisect,heapq from collections import defaultdict,Counter,deque from itertools import groupby,accumulate #sys.setrecursionlimit(200000000) input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: list(map(int,input().split())) alele = lambda: list(map(int, input().split(...
import math,sys,bisect,heapq from collections import defaultdict,Counter,deque from itertools import groupby,accumulate #sys.setrecursionlimit(200000000) input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: list(map(int,input().split())) alele = lambda: list(map(int, input().split(...
26
23
838
762
import math, sys, bisect, heapq from collections import defaultdict, Counter, deque from itertools import groupby, accumulate # sys.setrecursionlimit(200000000) input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: list(map(int, input().split())) alele = lambda: list(map(int, input().spl...
import math, sys, bisect, heapq from collections import defaultdict, Counter, deque from itertools import groupby, accumulate # sys.setrecursionlimit(200000000) input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: list(map(int, input().split())) alele = lambda: list(map(int, input().spl...
false
11.538462
[ "- if x == y == z == 0:", "- x, y, z = a, b, c", "- else:", "- d = a + max(y, z)", "- e = b + max(x, z)", "- f = c + max(x, y)", "- x, y, z = d, e, f", "+ d = a + max(y, z)", "+ e = b + max(x, z)", "+ f = c + max(x, y)", "+ x, y, z = d, e, f" ...
false
0.047733
0.04468
1.068333
[ "s335847041", "s214285829" ]
u503227287
p02713
python
s767678975
s938746183
547
75
81,360
67,632
Accepted
Accepted
86.29
import sys import fractions def in_ctrl(): _input = [_.rstrip() for _ in sys.stdin.readlines()] # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv K = int(_input[0]) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return K def out_ctrl(s): print(s) if __name__ == "__...
from sys import stdin from math import gcd if __name__ == "__main__": _in = [_.rstrip() for _ in stdin.readlines()] K = int(_in[0]) # type:int # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv cnt = 0 for a in range(1,K+1): cnt += a for b in range(a+1,K+1): ...
38
19
1,134
519
import sys import fractions def in_ctrl(): _input = [_.rstrip() for _ in sys.stdin.readlines()] # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv K = int(_input[0]) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return K def out_ctrl(s): print(s) if __name__ == "__main__": K...
from sys import stdin from math import gcd if __name__ == "__main__": _in = [_.rstrip() for _ in stdin.readlines()] K = int(_in[0]) # type:int # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv cnt = 0 for a in range(1, K + 1): cnt += a for b in range(a + 1, K + 1): ...
false
50
[ "-import sys", "-import fractions", "-", "-", "-def in_ctrl():", "- _input = [_.rstrip() for _ in sys.stdin.readlines()]", "- # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv", "- K = int(_input[0])", "- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", "- return K", "-...
false
0.103652
0.047859
2.16577
[ "s767678975", "s938746183" ]
u227020436
p03290
python
s707155125
s618842708
21
19
3,064
3,064
Accepted
Accepted
9.52
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import ceil D, G = [int(t) for t in input().split()] p = [] c = [] for i in range(D): p_, c_ = [int(t) for t in input().split()] p.append(p_) c.append(c_) def minsolve(G, p, c, i): """100i点以下の問題だけでGを達成する最小問題数""" if i <= 0:...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import ceil D, G = [int(t) for t in input().split()] p = [] c = [] for i in range(D): p_, c_ = [int(t) for t in input().split()] p.append(p_) c.append(c_) cache = {} def minsolve(G, i): """100i点以下の問題だけでGを達成する最小問題数""" if i ...
28
27
671
572
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import ceil D, G = [int(t) for t in input().split()] p = [] c = [] for i in range(D): p_, c_ = [int(t) for t in input().split()] p.append(p_) c.append(c_) def minsolve(G, p, c, i): """100i点以下の問題だけでGを達成する最小問題数""" if i <= 0: return fl...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import ceil D, G = [int(t) for t in input().split()] p = [] c = [] for i in range(D): p_, c_ = [int(t) for t in input().split()] p.append(p_) c.append(c_) cache = {} def minsolve(G, i): """100i点以下の問題だけでGを達成する最小問題数""" if i <= 0: retu...
false
3.571429
[ "+cache = {}", "-def minsolve(G, p, c, i):", "+def minsolve(G, i):", "- if s >= G:", "- return min(n, minsolve(G, p, c, i - 1))", "- else:", "- return min(n + minsolve(G - s, p, c, i - 1), minsolve(G, p, c, i - 1))", "+ m = n if s >= G else n + minsolve(G - s, i - 1)", "+ r...
false
0.049333
0.04049
1.218397
[ "s707155125", "s618842708" ]
u367130284
p03425
python
s708922090
s969276548
57
41
17,692
10,992
Accepted
Accepted
28.07
from itertools import*;print((sum(p*q*r for p,q,r in combinations(list(map(list(zip(*open(0).readlines()))[0].count,'MARCH')),3))))
from itertools import* n,*a=open(0).read().split() print((sum(p*q*r for p,q,r in combinations(list(map([i[0]for i in a].count,"MARCH")),3))))
1
3
123
135
from itertools import * print( ( sum( p * q * r for p, q, r in combinations( list(map(list(zip(*open(0).readlines()))[0].count, "MARCH")), 3 ) ) ) )
from itertools import * n, *a = open(0).read().split() print( ( sum( p * q * r for p, q, r in combinations(list(map([i[0] for i in a].count, "MARCH")), 3) ) ) )
false
66.666667
[ "+n, *a = open(0).read().split()", "- for p, q, r in combinations(", "- list(map(list(zip(*open(0).readlines()))[0].count, \"MARCH\")), 3", "- )", "+ for p, q, r in combinations(list(map([i[0] for i in a].count, \"MARCH\")), 3)" ]
false
0.045388
0.038067
1.192322
[ "s708922090", "s969276548" ]
u202570162
p03001
python
s603169762
s821112219
20
17
3,316
2,940
Accepted
Accepted
15
W,H,x,y=list(map(int,input().split())) ans = 1 if (W/2,H/2) == (x,y) else 0 print((H*W/2,ans))
W,H,x,y=list(map(int,input().split())) print((H*W/2,1 if (W/2,H/2) == (x,y) else 0))
3
2
88
77
W, H, x, y = list(map(int, input().split())) ans = 1 if (W / 2, H / 2) == (x, y) else 0 print((H * W / 2, ans))
W, H, x, y = list(map(int, input().split())) print((H * W / 2, 1 if (W / 2, H / 2) == (x, y) else 0))
false
33.333333
[ "-ans = 1 if (W / 2, H / 2) == (x, y) else 0", "-print((H * W / 2, ans))", "+print((H * W / 2, 1 if (W / 2, H / 2) == (x, y) else 0))" ]
false
0.04855
0.047968
1.012126
[ "s603169762", "s821112219" ]
u057109575
p03128
python
s738213742
s929603000
836
118
138,380
96,380
Accepted
Accepted
85.89
N, M, *A = map(int, open(0).read().split()) match = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6} dp = [[0] * M for _ in range(N + 1)] for i in range(N + 1): for j in range(M): for k in range(M): if (i - match[A[k]] == 0) or \ (i - match[A[k]] > 0 and dp[i ...
N, M = list(map(int, input().split())) X = list(map(int, input().split())) X.sort(reverse=True) count = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] dp = [-1] * (N + 1) dp[0] = 0 for a in X: n = count[a] for i in range(N - n + 1): if dp[i] == -1: continue dp[i + n] = max(dp[i + n]...
15
17
480
349
N, M, *A = map(int, open(0).read().split()) match = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6} dp = [[0] * M for _ in range(N + 1)] for i in range(N + 1): for j in range(M): for k in range(M): if (i - match[A[k]] == 0) or ( i - match[A[k]] > 0 and dp[i - match[A[k]]][...
N, M = list(map(int, input().split())) X = list(map(int, input().split())) X.sort(reverse=True) count = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] dp = [-1] * (N + 1) dp[0] = 0 for a in X: n = count[a] for i in range(N - n + 1): if dp[i] == -1: continue dp[i + n] = max(dp[i + n], dp[i] * 10 + a)...
false
11.764706
[ "-N, M, *A = map(int, open(0).read().split())", "-match = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}", "-dp = [[0] * M for _ in range(N + 1)]", "-for i in range(N + 1):", "- for j in range(M):", "- for k in range(M):", "- if (i - match[A[k]] == 0) or (", "- ...
false
0.072321
0.04491
1.610367
[ "s738213742", "s929603000" ]
u724687935
p03565
python
s493151571
s611424922
20
17
3,188
3,064
Accepted
Accepted
15
import re S_ = eval(input()) T = eval(input()) S_ = S_[::-1] T = T[::-1] t = '' for c in T: t += '[?' + c + ']' regex = re.compile(t) S, cnt = regex.subn(T, S_, count=1) if cnt: S = S.replace('?', 'a') print((S[::-1])) else: print('UNRESTORABLE')
Sx = eval(input()) T = eval(input()) offset = len(Sx) - len(T) ans = 'UNRESTORABLE' if len(Sx) >= len(T): for d in range(offset, -1, -1): for j in range(len(T)): if Sx[d + j] not in ['?', T[j]]: break else: break else: print('UNREST...
20
28
273
556
import re S_ = eval(input()) T = eval(input()) S_ = S_[::-1] T = T[::-1] t = "" for c in T: t += "[?" + c + "]" regex = re.compile(t) S, cnt = regex.subn(T, S_, count=1) if cnt: S = S.replace("?", "a") print((S[::-1])) else: print("UNRESTORABLE")
Sx = eval(input()) T = eval(input()) offset = len(Sx) - len(T) ans = "UNRESTORABLE" if len(Sx) >= len(T): for d in range(offset, -1, -1): for j in range(len(T)): if Sx[d + j] not in ["?", T[j]]: break else: break else: print("UNRESTORABLE") ...
false
28.571429
[ "-import re", "-", "-S_ = eval(input())", "+Sx = eval(input())", "-S_ = S_[::-1]", "-T = T[::-1]", "-t = \"\"", "-for c in T:", "- t += \"[?\" + c + \"]\"", "-regex = re.compile(t)", "-S, cnt = regex.subn(T, S_, count=1)", "-if cnt:", "- S = S.replace(\"?\", \"a\")", "- print((S[:...
false
0.045175
0.159944
0.282445
[ "s493151571", "s611424922" ]
u150984829
p02243
python
s122440408
s106372810
710
530
69,152
68,780
Accepted
Accepted
25.35
import sys from heapq import* e=sys.stdin.readline n=int(e()) A=[[]for _ in[0]*n] for _ in[0]*n: b=list(map(int,e().split())) for i in range(b[1]):k=2*-~i;A[b[0]]+=[(b[k],b[k+1])] H=[[0,0]] d=[0]+[1e6]*n c=[1]*n while H: f=heappop(H) u=f[1] c[u]=0 if d[u]>=f[0]: for s in A[u]: v=s[0] if ...
from heapq import* def m(): n=int(eval(input())) A=[[]for _ in[0]*n] for _ in[0]*n: e=list(map(int,input().split())) for i in range(e[1]):k=2*-~i;A[e[0]]+=[(e[k],e[k+1])] H=[[0,0]] d=[0]+[1e6]*n c=[1]*n while H: f=heappop(H) u=f[1] c[u]=0 if d[u]>=f[0]: for s in A[u]: v=s[0] ...
22
22
423
431
import sys from heapq import * e = sys.stdin.readline n = int(e()) A = [[] for _ in [0] * n] for _ in [0] * n: b = list(map(int, e().split())) for i in range(b[1]): k = 2 * -~i A[b[0]] += [(b[k], b[k + 1])] H = [[0, 0]] d = [0] + [1e6] * n c = [1] * n while H: f = heappop(H) u = f[1] ...
from heapq import * def m(): n = int(eval(input())) A = [[] for _ in [0] * n] for _ in [0] * n: e = list(map(int, input().split())) for i in range(e[1]): k = 2 * -~i A[e[0]] += [(e[k], e[k + 1])] H = [[0, 0]] d = [0] + [1e6] * n c = [1] * n while H: ...
false
0
[ "-import sys", "-e = sys.stdin.readline", "-n = int(e())", "-A = [[] for _ in [0] * n]", "-for _ in [0] * n:", "- b = list(map(int, e().split()))", "- for i in range(b[1]):", "- k = 2 * -~i", "- A[b[0]] += [(b[k], b[k + 1])]", "-H = [[0, 0]]", "-d = [0] + [1e6] * n", "-c = ...
false
0.046722
0.043723
1.068604
[ "s122440408", "s106372810" ]