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
u352394527
p00519
python
s006926007
s830078941
14,200
180
202,648
7,840
Accepted
Accepted
98.73
from heapq import heappop as pop from heapq import heappush as push INF = 10 ** 20 n, k = list(map(int, input().split())) clst = [] rlst = [] for i in range(n): c, r = list(map(int, input().split())) clst.append(c) rlst.append(r) edges = [[0] * n for i in range(n)] for i in range(k): a, b = ...
from heapq import heappop as pop from heapq import heappush as push INF = 10 ** 20 n, k = list(map(int, input().split())) clst = [] rlst = [] for i in range(n): c, r = list(map(int, input().split())) clst.append(c) rlst.append(r) edges = [[] * n for i in range(n)] for i in range(k): a, b = l...
59
60
1,216
1,196
from heapq import heappop as pop from heapq import heappush as push INF = 10**20 n, k = list(map(int, input().split())) clst = [] rlst = [] for i in range(n): c, r = list(map(int, input().split())) clst.append(c) rlst.append(r) edges = [[0] * n for i in range(n)] for i in range(k): a, b = list(map(int,...
from heapq import heappop as pop from heapq import heappush as push INF = 10**20 n, k = list(map(int, input().split())) clst = [] rlst = [] for i in range(n): c, r = list(map(int, input().split())) clst.append(c) rlst.append(r) edges = [[] * n for i in range(n)] for i in range(k): a, b = list(map(int, ...
false
1.666667
[ "-edges = [[0] * n for i in range(n)]", "+edges = [[] * n for i in range(n)]", "- edges[a][b] = edges[b][a] = 1", "+ edges[a].append(b)", "+ edges[b].append(a)", "- temp = {i for i in range(n) if edges[s_num][i]}", "+ temp = {i for i in edges[s_num]}", "- pto = {i for i in ra...
false
0.049086
0.049404
0.993563
[ "s006926007", "s830078941" ]
u525065967
p02767
python
s375961827
s532963185
21
17
3,060
2,940
Accepted
Accepted
19.05
n = int(eval(input())) X = list(map(int, input().split())) ans = 1000000000 for p in range(1,101): s = 0 for x in X: s += (x-p)**2 ans = min(ans, s) print(ans)
n,*X = list(map(int, open(0).read().split())) p = round(sum(X)/n) print((sum((x-p)**2 for x in X)))
9
3
181
93
n = int(eval(input())) X = list(map(int, input().split())) ans = 1000000000 for p in range(1, 101): s = 0 for x in X: s += (x - p) ** 2 ans = min(ans, s) print(ans)
n, *X = list(map(int, open(0).read().split())) p = round(sum(X) / n) print((sum((x - p) ** 2 for x in X)))
false
66.666667
[ "-n = int(eval(input()))", "-X = list(map(int, input().split()))", "-ans = 1000000000", "-for p in range(1, 101):", "- s = 0", "- for x in X:", "- s += (x - p) ** 2", "- ans = min(ans, s)", "-print(ans)", "+n, *X = list(map(int, open(0).read().split()))", "+p = round(sum(X) / n)"...
false
0.041462
0.041527
0.998429
[ "s375961827", "s532963185" ]
u326609687
p02575
python
s263912741
s556922886
589
234
136,864
55,176
Accepted
Accepted
60.27
import numpy as np from numba import njit from numba.types import Array, int64 i4 = np.int32 i8 = np.int64 @njit((Array(int64, 1, 'C'), Array(int64, 1, 'C'), int64, int64), cache=True) def solve(a, b, H, W): ret = np.empty(H, i8) for i in range(H): ret[i] = -1 dp0 = np.arange(W) d...
import numpy as np i4 = np.int32 i8 = np.int64 def solve(a, b, H, W): ret = np.empty(H, i8) for i in range(H): ret[i] = -1 dp0 = np.arange(W) dp = np.arange(W) arg0 = W - 1 arg = 0 for i in range(H): r1 = np.searchsorted(dp, a[i]) r2 = np.searchsorted...
82
92
2,347
2,563
import numpy as np from numba import njit from numba.types import Array, int64 i4 = np.int32 i8 = np.int64 @njit((Array(int64, 1, "C"), Array(int64, 1, "C"), int64, int64), cache=True) def solve(a, b, H, W): ret = np.empty(H, i8) for i in range(H): ret[i] = -1 dp0 = np.arange(W) dp = np.arang...
import numpy as np i4 = np.int32 i8 = np.int64 def solve(a, b, H, W): ret = np.empty(H, i8) for i in range(H): ret[i] = -1 dp0 = np.arange(W) dp = np.arange(W) arg0 = W - 1 arg = 0 for i in range(H): r1 = np.searchsorted(dp, a[i]) r2 = np.searchsorted(dp, b[i]) ...
false
10.869565
[ "-from numba import njit", "-from numba.types import Array, int64", "-@njit((Array(int64, 1, \"C\"), Array(int64, 1, \"C\"), int64, int64), cache=True)", "- ab = np.fromstring(stdin.read(), i8, sep=\" \").reshape((-1, 2)).T", "- ans = solve(ab[0] - 1, ab[1].copy(), H, W)", "+ ab = np.fromstring(s...
false
0.224853
0.202309
1.111434
[ "s263912741", "s556922886" ]
u156815136
p03103
python
s411337244
s517697780
424
299
21,972
25,764
Accepted
Accepted
29.48
# Aiでソートしてあげたほうがいいね? n,m = list(map(int,input().split())) drink = [] for i in range(n): a,b = list(map(int,input().split())) drink.append([a,b]) drink = sorted(drink,key = lambda x:x[0]) #print(drink) total = 0 cnt = 0 for price,num in drink: if cnt == m: break if cnt + num <= m: ...
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate # (string,3) 3回 #from collections import deque from collections import deque,defaultdict,Counte...
23
45
537
973
# Aiでソートしてあげたほうがいいね? n, m = list(map(int, input().split())) drink = [] for i in range(n): a, b = list(map(int, input().split())) drink.append([a, b]) drink = sorted(drink, key=lambda x: x[0]) # print(drink) total = 0 cnt = 0 for price, num in drink: if cnt == m: break if cnt + num <= m: ...
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations, permutations, accumulate # (string,3) 3回 # from collections import deque from collections import deque, defaultdict, Co...
false
48.888889
[ "-# Aiでソートしてあげたほうがいいね?", "-n, m = list(map(int, input().split()))", "-drink = []", "+# from statistics import median", "+# import collections", "+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]", "+from fractions import gcd", "+from itertools import combinations, pe...
false
0.087742
0.045127
1.94431
[ "s411337244", "s517697780" ]
u513081876
p04030
python
s014670519
s499748810
19
17
3,064
2,940
Accepted
Accepted
10.53
s = (eval(input())) ans = [] for i in s: if i == '0': ans.append(0) elif i == '1': ans.append(1) elif i == 'B': if len(ans) >= 1: del ans[-1] ans = list(map(str, ans)) print((''.join(ans)))
s = list(eval(input())) S = '' for i in s: if i == '0' or i == '1': S += i elif i == 'B' and len(S) != 0: S = S[:-1] print(S)
12
8
240
151
s = eval(input()) ans = [] for i in s: if i == "0": ans.append(0) elif i == "1": ans.append(1) elif i == "B": if len(ans) >= 1: del ans[-1] ans = list(map(str, ans)) print(("".join(ans)))
s = list(eval(input())) S = "" for i in s: if i == "0" or i == "1": S += i elif i == "B" and len(S) != 0: S = S[:-1] print(S)
false
33.333333
[ "-s = eval(input())", "-ans = []", "+s = list(eval(input()))", "+S = \"\"", "- if i == \"0\":", "- ans.append(0)", "- elif i == \"1\":", "- ans.append(1)", "- elif i == \"B\":", "- if len(ans) >= 1:", "- del ans[-1]", "-ans = list(map(str, ans))", "-p...
false
0.055512
0.050868
1.091278
[ "s014670519", "s499748810" ]
u579699847
p03361
python
s852688856
s979590776
21
19
3,064
3,064
Accepted
Accepted
9.52
import itertools,sys def S(): return sys.stdin.readline().rstrip() def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) H,W = LI() s = [S() for _ in range(H)] ans = 1 for i,j in itertools.product(list(range(H)),list(range(W))): if s[i][j]=='.': continue uh,uw,dh,dw = i-1,j,i+1,...
import itertools,sys def S(): return sys.stdin.readline().rstrip() def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) H,W = LI() s = [S() for _ in range(H)] ans = 1 for i,j in itertools.product(list(range(H)),list(range(W))): if s[i][j]=='.': continue try: if s[i-1][...
21
18
718
497
import itertools, sys def S(): return sys.stdin.readline().rstrip() def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) H, W = LI() s = [S() for _ in range(H)] ans = 1 for i, j in itertools.product(list(range(H)), list(range(W))): if s[i][j] == ".": continue uh, uw, dh, ...
import itertools, sys def S(): return sys.stdin.readline().rstrip() def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) H, W = LI() s = [S() for _ in range(H)] ans = 1 for i, j in itertools.product(list(range(H)), list(range(W))): if s[i][j] == ".": continue try: ...
false
14.285714
[ "- uh, uw, dh, dw = i - 1, j, i + 1, j", "- lh, lw, rh, rw = i, j - 1, i, j + 1", "- if (", "- not (0 <= uh <= H - 1)", "- or not (0 <= dh <= H - 1)", "- or not (0 <= lh <= H - 1)", "- or not (0 <= rh <= H - 1)", "- ):", "- continue", "- if (", "...
false
0.070055
0.074445
0.941031
[ "s852688856", "s979590776" ]
u768559443
p03378
python
s701983765
s300249721
168
18
38,256
2,940
Accepted
Accepted
89.29
n,m,x=list(map(int,input().split())) a=list(map(int,input().split())) left=0 right=0 for ai in a: if ai<x: left+=1 else: right+=1 print((min(left,right)))
n,m,x=list(map(int,input().split())) a=list(map(int,input().split())) for i in a: s=sum(int(i)<x for i in a) print((min(s,m-s)))
12
6
165
128
n, m, x = list(map(int, input().split())) a = list(map(int, input().split())) left = 0 right = 0 for ai in a: if ai < x: left += 1 else: right += 1 print((min(left, right)))
n, m, x = list(map(int, input().split())) a = list(map(int, input().split())) for i in a: s = sum(int(i) < x for i in a) print((min(s, m - s)))
false
50
[ "-left = 0", "-right = 0", "-for ai in a:", "- if ai < x:", "- left += 1", "- else:", "- right += 1", "-print((min(left, right)))", "+for i in a:", "+ s = sum(int(i) < x for i in a)", "+print((min(s, m - s)))" ]
false
0.038617
0.039511
0.977375
[ "s701983765", "s300249721" ]
u759651152
p03503
python
s726498477
s000078930
299
173
3,064
3,064
Accepted
Accepted
42.14
#N,A,B=map(int, input().split()) #A=list(map(int, input().split())) N=int(eval(input())) F=[] P=[] for i in range(N): tmp=list(map(int, input().split())) F.append(tmp) for i in range(N): tmp=list(map(int, input().split())) P.append(tmp) max_sum=-1000000001 for i in range...
#-*-coding:utf-8-*- def main(): n = int(eval(input())) f_list = [list(map(int, input().split())) for i in range(n)] p_list = [list(map(int, input().split())) for i in range(n)] max_profit = -1000000001 for i in range(1, 2 ** 10): binary=[0]*10 now=i for j i...
36
29
656
746
# N,A,B=map(int, input().split()) # A=list(map(int, input().split())) N = int(eval(input())) F = [] P = [] for i in range(N): tmp = list(map(int, input().split())) F.append(tmp) for i in range(N): tmp = list(map(int, input().split())) P.append(tmp) max_sum = -1000000001 for i in range(1, 1024): bin ...
# -*-coding:utf-8-*- def main(): n = int(eval(input())) f_list = [list(map(int, input().split())) for i in range(n)] p_list = [list(map(int, input().split())) for i in range(n)] max_profit = -1000000001 for i in range(1, 2**10): binary = [0] * 10 now = i for j in range(10): ...
false
19.444444
[ "-# N,A,B=map(int, input().split())", "-# A=list(map(int, input().split()))", "-N = int(eval(input()))", "-F = []", "-P = []", "-for i in range(N):", "- tmp = list(map(int, input().split()))", "- F.append(tmp)", "-for i in range(N):", "- tmp = list(map(int, input().split()))", "- P.a...
false
0.046406
0.102926
0.45087
[ "s726498477", "s000078930" ]
u150984829
p00424
python
s852260369
s941832782
140
110
7,860
7,112
Accepted
Accepted
21.43
import sys s=sys.stdin.readline for n in iter(s,'0\n'): d={} for _ in[0]*int(n): k,v=s()[:-1].split() d[k]=v print(*[d.get(*[s()[0]]*2)for _ in[0]*int(s())],sep='')
import sys s=sys.stdin.readline for n in iter(s,'0\n'): d={} for _ in[0]*int(n): e=s() d[e[0]]=e[2] print((''.join(d.get(*[s()[0]]*2)for _ in[0]*int(s()))))
8
8
179
169
import sys s = sys.stdin.readline for n in iter(s, "0\n"): d = {} for _ in [0] * int(n): k, v = s()[:-1].split() d[k] = v print(*[d.get(*[s()[0]] * 2) for _ in [0] * int(s())], sep="")
import sys s = sys.stdin.readline for n in iter(s, "0\n"): d = {} for _ in [0] * int(n): e = s() d[e[0]] = e[2] print(("".join(d.get(*[s()[0]] * 2) for _ in [0] * int(s()))))
false
0
[ "- k, v = s()[:-1].split()", "- d[k] = v", "- print(*[d.get(*[s()[0]] * 2) for _ in [0] * int(s())], sep=\"\")", "+ e = s()", "+ d[e[0]] = e[2]", "+ print((\"\".join(d.get(*[s()[0]] * 2) for _ in [0] * int(s()))))" ]
false
0.041072
0.082729
0.496462
[ "s852260369", "s941832782" ]
u680851063
p03013
python
s571106692
s159487184
472
228
460,020
50,140
Accepted
Accepted
51.69
n, m = list(map(int, input().split())) a = set(map(int, [eval(input()) for _ in range(m)])) dp = [0] * (n+1) # 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り) dp[:2] = 1, 1 if 1 not in a else 0 for i in range(2, n+1): if i in a: continue else: dp[i] = (dp[i-1] + dp[i-2]) p...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) broken_steps = set([int(eval(input())) for _ in range(m)]) #print(broken_steps) def ptn_num(x): # 'x'stepまでのパターン数 if x == 1: print((1)) else: dp = [0] * (x+1) # DP枠_including step'0' cnt = 0 ...
14
31
333
801
n, m = list(map(int, input().split())) a = set(map(int, [eval(input()) for _ in range(m)])) dp = [0] * (n + 1) # 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り) dp[:2] = 1, 1 if 1 not in a else 0 for i in range(2, n + 1): if i in a: continue else: dp[i] = dp[i - 1] + dp[i - 2] print((dp[-1...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) broken_steps = set([int(eval(input())) for _ in range(m)]) # print(broken_steps) def ptn_num(x): # 'x'stepまでのパターン数 if x == 1: print((1)) else: dp = [0] * (x + 1) # DP枠_including step'0' cnt = 0 if 1 i...
false
54.83871
[ "+import sys", "+", "+input = sys.stdin.readline", "-a = set(map(int, [eval(input()) for _ in range(m)]))", "-dp = [0] * (n + 1)", "-# 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り)", "-dp[:2] = 1, 1 if 1 not in a else 0", "-for i in range(2, n + 1):", "- if i in a:", "- continue"...
false
0.076578
0.078062
0.980995
[ "s571106692", "s159487184" ]
u576917603
p02936
python
s573179160
s735418228
1,776
1,237
73,204
73,212
Accepted
Accepted
30.35
def main(): n,q=list(map(int,input().split())) from collections import deque,defaultdict dic=defaultdict(list) for i in range(n-1): x,y=list(map(int,input().split())) dic[x-1].append(y-1) dic[y-1].append(x-1) cnt=[0]*n for i in range(q): x,y=list(map(int...
def main(): import sys input=sys.stdin.readline n,q=list(map(int,input().split())) from collections import deque,defaultdict dic=defaultdict(list) for i in range(n-1): x,y=list(map(int,input().split())) dic[x-1].append(y-1) dic[y-1].append(x-1) cnt=[0]*n ...
27
29
657
703
def main(): n, q = list(map(int, input().split())) from collections import deque, defaultdict dic = defaultdict(list) for i in range(n - 1): x, y = list(map(int, input().split())) dic[x - 1].append(y - 1) dic[y - 1].append(x - 1) cnt = [0] * n for i in range(q): ...
def main(): import sys input = sys.stdin.readline n, q = list(map(int, input().split())) from collections import deque, defaultdict dic = defaultdict(list) for i in range(n - 1): x, y = list(map(int, input().split())) dic[x - 1].append(y - 1) dic[y - 1].append(x - 1) ...
false
6.896552
[ "+ import sys", "+", "+ input = sys.stdin.readline" ]
false
0.072151
0.037456
1.926274
[ "s573179160", "s735418228" ]
u254871849
p02984
python
s459555079
s362458045
195
100
14,092
14,092
Accepted
Accepted
48.72
# 2019-11-15 13:51:51(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # from scipy.misc import comb # float ...
import sys n, *a = map(int, sys.stdin.read().split()) def main(): res = [None] * n x = (sum(a[::2]) - sum(a[1::2])) // 2 for i in range(n): res[i] = x * 2 x = a[i] - x return res if __name__ == '__main__': ans = main() print(*ans, sep='\n')
35
16
924
303
# 2019-11-15 13:51:51(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # from scipy.misc import comb # float # import ...
import sys n, *a = map(int, sys.stdin.read().split()) def main(): res = [None] * n x = (sum(a[::2]) - sum(a[1::2])) // 2 for i in range(n): res[i] = x * 2 x = a[i] - x return res if __name__ == "__main__": ans = main() print(*ans, sep="\n")
false
54.285714
[ "-# 2019-11-15 13:51:51(JST)", "-# import collections", "-# import math", "-# from string import ascii_lowercase, ascii_uppercase, digits", "-# from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import itertools", "-# from functools import reduce", "-# import operator as op", "-# fro...
false
0.090061
0.08577
1.050034
[ "s459555079", "s362458045" ]
u457901067
p02862
python
s588877815
s394131086
352
284
125,148
116,332
Accepted
Accepted
19.32
X,Y = list(map(int, input().split())) class Combination: """ O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms) 使用例: comb = Combination(1000000) print(comb(5, 3)) # 10 """ def __init__(self, n_max, mod=10**9+7): self.mod = ...
X,Y = list(map(int, input().split())) class Combination: """ O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms) 使用例: comb = Combination(1000000) print(comb(5, 3)) # 10 """ def __init__(self, n_max, mod=10**9+7): self.mod = ...
48
48
1,340
1,333
X, Y = list(map(int, input().split())) class Combination: """ O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms) 使用例: comb = Combination(1000000) print(comb(5, 3)) # 10 """ def __init__(self, n_max, mod=10**9 + 7): self.mod = mod ...
X, Y = list(map(int, input().split())) class Combination: """ O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms) 使用例: comb = Combination(1000000) print(comb(5, 3)) # 10 """ def __init__(self, n_max, mod=10**9 + 7): self.mod = mod ...
false
0
[ "-comb = Combination(int(1e6 + 10))", "+comb = Combination(K + 10)" ]
false
1.293582
0.370445
3.491965
[ "s588877815", "s394131086" ]
u150984829
p02262
python
s065354949
s171006969
11,930
9,990
53,312
126,044
Accepted
Accepted
16.26
import sys n = int(input()) A = [int(e)for e in sys.stdin] cnt = 0 G = [int(4**i+3*2**(i-1)+1)for i in range(9,0,-1)]+[1] G = [v for v in G if v <= n] def insertionSort(A, n, g): global cnt for i in range(g, n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j+g]...
import sys n = int(eval(input())) A = [int(e)for e in sys.stdin] cnt = 0 G = [int((2.25**i-1)/1.25)for i in range(17,0,-1)] G = [v for v in G if v <= n] def insertionSort(A, n, g): global cnt for i in range(g, n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j+...
22
22
492
498
import sys n = int(input()) A = [int(e) for e in sys.stdin] cnt = 0 G = [int(4**i + 3 * 2 ** (i - 1) + 1) for i in range(9, 0, -1)] + [1] G = [v for v in G if v <= n] def insertionSort(A, n, g): global cnt for i in range(g, n): v = A[i] j = i - g while j >= 0 and A[j] > v: ...
import sys n = int(eval(input())) A = [int(e) for e in sys.stdin] cnt = 0 G = [int((2.25**i - 1) / 1.25) for i in range(17, 0, -1)] G = [v for v in G if v <= n] def insertionSort(A, n, g): global cnt for i in range(g, n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j +...
false
0
[ "-n = int(input())", "+n = int(eval(input()))", "-G = [int(4**i + 3 * 2 ** (i - 1) + 1) for i in range(9, 0, -1)] + [1]", "+G = [int((2.25**i - 1) / 1.25) for i in range(17, 0, -1)]", "-print(len(G))", "-print(*G)", "+print((len(G)))", "+print((*G))", "-print(*A, sep=\"\\n\")", "+print((\"\\n\".jo...
false
0.046962
0.047213
0.994673
[ "s065354949", "s171006969" ]
u130900604
p02786
python
s542749654
s729110790
186
73
38,256
61,692
Accepted
Accepted
60.75
h=int(eval(input())) t=0 while h!=1: # print(h) h//=2 t+=1 print((2**t*2-1))
h=int(eval(input())) def f(x): if x==1: return 1 return f(x//2)*2 ans=f(h) print((ans*2-1))
11
8
98
99
h = int(eval(input())) t = 0 while h != 1: # print(h) h //= 2 t += 1 print((2**t * 2 - 1))
h = int(eval(input())) def f(x): if x == 1: return 1 return f(x // 2) * 2 ans = f(h) print((ans * 2 - 1))
false
27.272727
[ "-t = 0", "-while h != 1:", "- # print(h)", "- h //= 2", "- t += 1", "-print((2**t * 2 - 1))", "+", "+", "+def f(x):", "+ if x == 1:", "+ return 1", "+ return f(x // 2) * 2", "+", "+", "+ans = f(h)", "+print((ans * 2 - 1))" ]
false
0.061145
0.036593
1.670922
[ "s542749654", "s729110790" ]
u660912567
p01093
python
s159794131
s928749959
1,170
50
29,072
7,676
Accepted
Accepted
95.73
while True: n = int(eval(input())) if n==0: break l = list(map(int,input().split())) r = [] for i in range(n): for j in range(i+1,n): r += [abs(l[i]-l[j])] print((min(r)))
while True: n = int(eval(input())) if n==0: break l = sorted(list(map(int,input().split()))) r = [] for i in range(n-1): r += [l[i+1]-l[i]] print((min(r)))
9
8
215
186
while True: n = int(eval(input())) if n == 0: break l = list(map(int, input().split())) r = [] for i in range(n): for j in range(i + 1, n): r += [abs(l[i] - l[j])] print((min(r)))
while True: n = int(eval(input())) if n == 0: break l = sorted(list(map(int, input().split()))) r = [] for i in range(n - 1): r += [l[i + 1] - l[i]] print((min(r)))
false
11.111111
[ "- l = list(map(int, input().split()))", "+ l = sorted(list(map(int, input().split())))", "- for i in range(n):", "- for j in range(i + 1, n):", "- r += [abs(l[i] - l[j])]", "+ for i in range(n - 1):", "+ r += [l[i + 1] - l[i]]" ]
false
0.038896
0.034965
1.112442
[ "s159794131", "s928749959" ]
u177040005
p03944
python
s581464033
s386093656
149
18
12,504
3,064
Accepted
Accepted
87.92
import numpy as np W,H,N = list(map(int,input().split())) xl = 0 xr = W yu = H yd = 0 for i in range(N): x,y,a = list(map(int, input().split())) if a == 1: xl = max(xl,x) elif a == 2: xr = min(xr,x) elif a == 3: yd = max(yd,y) else: yu = min(yu,...
W,H,N = list(map(int,input().split())) xl = 0 xr = W yu = H yd = 0 for i in range(N): x,y,a = list(map(int, input().split())) if a == 1: xl = max(xl,x) elif a == 2: xr = min(xr,x) elif a == 3: yd = max(yd,y) else: yu = min(yu,y) ans = max(0,xr -...
24
22
366
344
import numpy as np W, H, N = list(map(int, input().split())) xl = 0 xr = W yu = H yd = 0 for i in range(N): x, y, a = list(map(int, input().split())) if a == 1: xl = max(xl, x) elif a == 2: xr = min(xr, x) elif a == 3: yd = max(yd, y) else: yu = min(yu, y) ans = max(...
W, H, N = list(map(int, input().split())) xl = 0 xr = W yu = H yd = 0 for i in range(N): x, y, a = list(map(int, input().split())) if a == 1: xl = max(xl, x) elif a == 2: xr = min(xr, x) elif a == 3: yd = max(yd, y) else: yu = min(yu, y) ans = max(0, xr - xl) * max(0,...
false
8.333333
[ "-import numpy as np", "-" ]
false
0.036631
0.078464
0.466855
[ "s581464033", "s386093656" ]
u197955752
p02862
python
s898933023
s925086523
215
109
68,336
9,220
Accepted
Accepted
49.3
def binomial_p(n, k, p): ''' Input: integers n, k such that n >= k >= 0, prime number p Output: n choose k mod p ''' k = min(k, n-k) fct_n = 1 # factorial of n mod p = 1 * 2 * ... * n mod p inv = [0, 1] # inv[i] : inverse of i mod p invfct_k = 1 # factorial of inverse of k mod...
# 20-7-30 再トライ import sys def binomial_p(n, k, p): k = min(k, n - k) if k == 0: return 1 numer = 1 denom = 1 for i in range(k): numer = numer * (n - i) % p denom = denom * (k - i) % p return numer * pow(denom, p - 2, p) % p X, Y = [int(x) for x in input().split()...
42
25
1,158
538
def binomial_p(n, k, p): """ Input: integers n, k such that n >= k >= 0, prime number p Output: n choose k mod p """ k = min(k, n - k) fct_n = 1 # factorial of n mod p = 1 * 2 * ... * n mod p inv = [0, 1] # inv[i] : inverse of i mod p invfct_k = ( 1 # factorial of inverse of k...
# 20-7-30 再トライ import sys def binomial_p(n, k, p): k = min(k, n - k) if k == 0: return 1 numer = 1 denom = 1 for i in range(k): numer = numer * (n - i) % p denom = denom * (k - i) % p return numer * pow(denom, p - 2, p) % p X, Y = [int(x) for x in input().split()] p =...
false
40.47619
[ "-def binomial_p(n, k, p):", "- \"\"\"", "- Input: integers n, k such that n >= k >= 0, prime number p", "- Output: n choose k mod p", "- \"\"\"", "- k = min(k, n - k)", "- fct_n = 1 # factorial of n mod p = 1 * 2 * ... * n mod p", "- inv = [0, 1] # inv[i] : inverse of i mod p",...
false
0.218451
0.079533
2.746682
[ "s898933023", "s925086523" ]
u909327177
p03470
python
s019151095
s336587403
19
17
3,060
2,940
Accepted
Accepted
10.53
N = int(eval(input())) A = [int(eval(input())) for i in range(N)] A.sort(reverse=True) count = 0 for i in range(N): for j in range(i+1,N): if A[i] == A[j] and A[i]!=0: A[j] = 0 count += 1 print((len(A)-count))
N = int(eval(input())) A = [int(eval(input())) for i in range(N)] A.sort(reverse=True) count = 0 m = set(A) print((len(m)))
12
8
253
127
N = int(eval(input())) A = [int(eval(input())) for i in range(N)] A.sort(reverse=True) count = 0 for i in range(N): for j in range(i + 1, N): if A[i] == A[j] and A[i] != 0: A[j] = 0 count += 1 print((len(A) - count))
N = int(eval(input())) A = [int(eval(input())) for i in range(N)] A.sort(reverse=True) count = 0 m = set(A) print((len(m)))
false
33.333333
[ "-for i in range(N):", "- for j in range(i + 1, N):", "- if A[i] == A[j] and A[i] != 0:", "- A[j] = 0", "- count += 1", "-print((len(A) - count))", "+m = set(A)", "+print((len(m)))" ]
false
0.03886
0.038649
1.005448
[ "s019151095", "s336587403" ]
u998082063
p02802
python
s015809106
s506473205
284
213
4,596
4,840
Accepted
Accepted
25
n, m = list(map(int, input().split())) p = [0]*(n+1) q = [False]*(n+1) for _ in range(m) : v,s = input().split() v = int(v) if q[v]: continue if s[0] == 'A': q[v] = True else : p[v] += 1 print((sum(q), sum(p[i] for i in range(n+1) if q[i])))
from collections import defaultdict, deque import sys import heapq import bisect import itertools import queue import copy import time sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readli...
13
34
273
662
n, m = list(map(int, input().split())) p = [0] * (n + 1) q = [False] * (n + 1) for _ in range(m): v, s = input().split() v = int(v) if q[v]: continue if s[0] == "A": q[v] = True else: p[v] += 1 print((sum(q), sum(p[i] for i in range(n + 1) if q[i])))
from collections import defaultdict, deque import sys import heapq import bisect import itertools import queue import copy import time sys.setrecursionlimit(10**8) INF = float("inf") mod = 10**9 + 7 eps = 10**-7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline...
false
61.764706
[ "-n, m = list(map(int, input().split()))", "-p = [0] * (n + 1)", "-q = [False] * (n + 1)", "-for _ in range(m):", "- v, s = input().split()", "- v = int(v)", "- if q[v]:", "- continue", "- if s[0] == \"A\":", "- q[v] = True", "- else:", "- p[v] += 1", "-pr...
false
0.048932
0.047749
1.024778
[ "s015809106", "s506473205" ]
u492605584
p03107
python
s782297601
s304545191
196
163
50,944
39,152
Accepted
Accepted
16.84
S = eval(input()) cnt = 0 prev = 0 while prev != len(S): prev = len(S) ans = [] for i, n in enumerate(S): if i == 0: ans.append(n) continue if len(ans) > 0 and ans[-1] != n: ans.pop() cnt += 2 else: ans.append(...
N = eval(input()) zero = N.count('0') one = N.count('1') ans = min(zero, one) * 2 print(ans)
18
5
353
90
S = eval(input()) cnt = 0 prev = 0 while prev != len(S): prev = len(S) ans = [] for i, n in enumerate(S): if i == 0: ans.append(n) continue if len(ans) > 0 and ans[-1] != n: ans.pop() cnt += 2 else: ans.append(n) S = ""....
N = eval(input()) zero = N.count("0") one = N.count("1") ans = min(zero, one) * 2 print(ans)
false
72.222222
[ "-S = eval(input())", "-cnt = 0", "-prev = 0", "-while prev != len(S):", "- prev = len(S)", "- ans = []", "- for i, n in enumerate(S):", "- if i == 0:", "- ans.append(n)", "- continue", "- if len(ans) > 0 and ans[-1] != n:", "- ans.pop()"...
false
0.037109
0.037305
0.994755
[ "s782297601", "s304545191" ]
u122428774
p03773
python
s284423240
s975231142
180
160
38,256
38,352
Accepted
Accepted
11.11
p=eval(input().replace(" ","+"));print((p-24if p>23else p))
print((eval(input().replace(" ","+"))%24))
1
1
57
40
p = eval(input().replace(" ", "+")) print((p - 24 if p > 23 else p))
print((eval(input().replace(" ", "+")) % 24))
false
0
[ "-p = eval(input().replace(\" \", \"+\"))", "-print((p - 24 if p > 23 else p))", "+print((eval(input().replace(\" \", \"+\")) % 24))" ]
false
0.034318
0.030911
1.110217
[ "s284423240", "s975231142" ]
u600402037
p03583
python
s334204788
s135992671
1,025
335
3,316
12,584
Accepted
Accepted
67.32
import sys from collections import Counter stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces sys.setrecursionlimit(10 ** 8) N = ri() #一番小さい数をhとして良い for i in range(N//4, 3501): for j in rang...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) import numpy as np N = int(eval(input())) """ 4xyz = n(xy+yz+zx) (4xy-ny-nx)z = nxy """ UP = 3501 for x in range(1, UP): y = np.arange(1, UP, dtype=np.int64) den = N * x * y num = 4*x*y - N*y - N*x y = y[(den % ...
20
25
513
453
import sys from collections import Counter stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces sys.setrecursionlimit(10**8) N = ri() # 一番小さい数をhとして良い for i in range(N // 4, 3501): for j in range(i, 3501): ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) import numpy as np N = int(eval(input())) """ 4xyz = n(xy+yz+zx) (4xy-ny-nx)z = nxy """ UP = 3501 for x in range(1, UP): y = np.arange(1, UP, dtype=np.int64) den = N * x * y num = 4 * x * y - N * y - N * x y = y[(den % num == 0) & (num...
false
20
[ "-from collections import Counter", "-stdin = sys.stdin", "-ri = lambda: int(rs())", "-rl = lambda: list(map(int, stdin.readline().split()))", "-rs = lambda: stdin.readline().rstrip() # ignore trailing spaces", "-sys.setrecursionlimit(10**8)", "-N = ri()", "-# 一番小さい数をhとして良い", "-for i in range(N // ...
false
0.298531
0.878715
0.339736
[ "s334204788", "s135992671" ]
u613920660
p03290
python
s883745901
s654112400
241
146
3,064
3,064
Accepted
Accepted
39.42
D,G=list(map(int,input().strip().split())) pc=[] for _ in range(D): pc.append(list(map(int,input().strip().split()))) N=0 for i in range(D): N+=pc[i][0] MIN_SUM=N for n in range(2**D): score=0 SUM=0 for i in range(D): if (n>>i)&1==1: SUM+=pc[i][0] sc...
D,G=list(map(int,input().strip().split())) pc=[] for _ in range(D): pc.append(list(map(int,input().strip().split()))) min_num=0 for i in range(D): min_num+=pc[i][0] def dfs(l,D,G): global min_num score=0 num=0 if len(l)==D: for n in range(len(l)): if l[n]...
31
39
699
992
D, G = list(map(int, input().strip().split())) pc = [] for _ in range(D): pc.append(list(map(int, input().strip().split()))) N = 0 for i in range(D): N += pc[i][0] MIN_SUM = N for n in range(2**D): score = 0 SUM = 0 for i in range(D): if (n >> i) & 1 == 1: SUM += pc[i][0] ...
D, G = list(map(int, input().strip().split())) pc = [] for _ in range(D): pc.append(list(map(int, input().strip().split()))) min_num = 0 for i in range(D): min_num += pc[i][0] def dfs(l, D, G): global min_num score = 0 num = 0 if len(l) == D: for n in range(len(l)): if l[n]...
false
20.512821
[ "-N = 0", "+min_num = 0", "- N += pc[i][0]", "-MIN_SUM = N", "-for n in range(2**D):", "+ min_num += pc[i][0]", "+", "+", "+def dfs(l, D, G):", "+ global min_num", "- SUM = 0", "- for i in range(D):", "- if (n >> i) & 1 == 1:", "- SUM += pc[i][0]", "- ...
false
0.073318
0.043066
1.702441
[ "s883745901", "s654112400" ]
u150984829
p02276
python
s644746017
s591840398
110
100
16,388
16,396
Accepted
Accepted
9.09
n=int(eval(input()))-1 A=list(map(int,input().split())) i=0 for j in range(n): if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1 A[i],A[n]='['+str(A[n])+']',A[i] print((*A))
n=int(eval(input()))-1 A=list(map(int,input().split())) i=0;x=A[-1] for j in range(n): if A[j]<=x:A[i],A[j]=A[j],A[i];i+=1 A[i],A[n]='['+str(A[n])+']',A[i] print((*A))
7
7
163
167
n = int(eval(input())) - 1 A = list(map(int, input().split())) i = 0 for j in range(n): if A[j] <= A[-1]: A[i], A[j] = A[j], A[i] i += 1 A[i], A[n] = "[" + str(A[n]) + "]", A[i] print((*A))
n = int(eval(input())) - 1 A = list(map(int, input().split())) i = 0 x = A[-1] for j in range(n): if A[j] <= x: A[i], A[j] = A[j], A[i] i += 1 A[i], A[n] = "[" + str(A[n]) + "]", A[i] print((*A))
false
0
[ "+x = A[-1]", "- if A[j] <= A[-1]:", "+ if A[j] <= x:" ]
false
0.047795
0.038542
1.240073
[ "s644746017", "s591840398" ]
u603234915
p03673
python
s633037291
s554419299
102
46
21,908
21,572
Accepted
Accepted
54.9
def split_and_change(N, Array): Arr1 = [a for ind, a in enumerate(Array) if ind % 2 == 0] Arr2 = [a for ind, a in enumerate(Array) if ind % 2 != 0] if N % 2 == 0: return Arr2[::-1] + Arr1 else: return Arr1[::-1] + Arr2 print((" ".join(split_and_change(int(eval(input())), lis...
def split_and_change(N, Array): Arr1 = Array[0::2] Arr2 = Array[1::2] if N % 2 == 0: return Arr2[::-1] + Arr1 else: return Arr1[::-1] + Arr2 print((" ".join(split_and_change(int(eval(input())), input().split()))))
9
9
344
250
def split_and_change(N, Array): Arr1 = [a for ind, a in enumerate(Array) if ind % 2 == 0] Arr2 = [a for ind, a in enumerate(Array) if ind % 2 != 0] if N % 2 == 0: return Arr2[::-1] + Arr1 else: return Arr1[::-1] + Arr2 print((" ".join(split_and_change(int(eval(input())), list(map(str, ...
def split_and_change(N, Array): Arr1 = Array[0::2] Arr2 = Array[1::2] if N % 2 == 0: return Arr2[::-1] + Arr1 else: return Arr1[::-1] + Arr2 print((" ".join(split_and_change(int(eval(input())), input().split()))))
false
0
[ "- Arr1 = [a for ind, a in enumerate(Array) if ind % 2 == 0]", "- Arr2 = [a for ind, a in enumerate(Array) if ind % 2 != 0]", "+ Arr1 = Array[0::2]", "+ Arr2 = Array[1::2]", "-print((\" \".join(split_and_change(int(eval(input())), list(map(str, input().split()))))))", "+print((\" \".join(split...
false
0.117816
0.072203
1.631742
[ "s633037291", "s554419299" ]
u752898745
p03135
python
s585512008
s159579971
19
17
3,060
2,940
Accepted
Accepted
10.53
t,x=list(map(int,input().split()));print(('{:.04f}'.format(t/x)))
t,x=list(map(int,input().split()));print((t/x))
1
1
57
39
t, x = list(map(int, input().split())) print(("{:.04f}".format(t / x)))
t, x = list(map(int, input().split())) print((t / x))
false
0
[ "-print((\"{:.04f}\".format(t / x)))", "+print((t / x))" ]
false
0.050007
0.048741
1.025988
[ "s585512008", "s159579971" ]
u886747123
p03170
python
s641161753
s811819771
342
239
41,708
42,220
Accepted
Accepted
30.12
N, K = list(map(int, input().split())) a = list(map(int, input().split())) dp = [False] * (K+1) for i in range(1, K+1): for j in range(N): if 0 <= i - a[j] and not dp[i-a[j]]: dp[i] = True print(("First" if dp[K] else "Second"))
N, K = list(map(int, input().split())) a = list(map(int, input().split())) dp = [False] * (K+1) for i in range(1, K+1): for j in range(N): if 0 <= i - a[j] and not dp[i-a[j]]: dp[i] = True break print(("First" if dp[K] else "Second"))
11
12
257
276
N, K = list(map(int, input().split())) a = list(map(int, input().split())) dp = [False] * (K + 1) for i in range(1, K + 1): for j in range(N): if 0 <= i - a[j] and not dp[i - a[j]]: dp[i] = True print(("First" if dp[K] else "Second"))
N, K = list(map(int, input().split())) a = list(map(int, input().split())) dp = [False] * (K + 1) for i in range(1, K + 1): for j in range(N): if 0 <= i - a[j] and not dp[i - a[j]]: dp[i] = True break print(("First" if dp[K] else "Second"))
false
8.333333
[ "+ break" ]
false
0.040566
0.04156
0.976082
[ "s641161753", "s811819771" ]
u707498674
p02792
python
s534888480
s625637421
178
150
17,652
17,652
Accepted
Accepted
15.73
from collections import defaultdict def main(): N = int(eval(input())) combs = [(S[0], S[-1]) for S in map(str, list(range(1, N+1)))] d = defaultdict(int) for pre, suf in combs: if suf != "0": d[(pre, suf)] += 1 d[(suf, pre)] ans = 0 for key, val in ...
from collections import defaultdict def main(): N = int(eval(input())) combs = [(S[0], S[-1]) for S in map(str, list(range(1, N+1)))] d = defaultdict(int) for pre, suf in combs: d[(pre, suf)] += 1 d[(suf, pre)] ans = 0 for key, val in list(d.items()): pre, s...
19
18
444
412
from collections import defaultdict def main(): N = int(eval(input())) combs = [(S[0], S[-1]) for S in map(str, list(range(1, N + 1)))] d = defaultdict(int) for pre, suf in combs: if suf != "0": d[(pre, suf)] += 1 d[(suf, pre)] ans = 0 for key, val in list(d.ite...
from collections import defaultdict def main(): N = int(eval(input())) combs = [(S[0], S[-1]) for S in map(str, list(range(1, N + 1)))] d = defaultdict(int) for pre, suf in combs: d[(pre, suf)] += 1 d[(suf, pre)] ans = 0 for key, val in list(d.items()): pre, suf = key ...
false
5.263158
[ "- if suf != \"0\":", "- d[(pre, suf)] += 1", "- d[(suf, pre)]", "+ d[(pre, suf)] += 1", "+ d[(suf, pre)]" ]
false
0.0794
0.061035
1.300889
[ "s534888480", "s625637421" ]
u150984829
p02396
python
s212445901
s180128215
140
50
5,616
5,672
Accepted
Accepted
64.29
i=1 while 1: a=eval(input()) if int(a)==0:break print(f'Case {i}: {a}') i+=1
import sys i=1 for a in sys.stdin: if a=='0\n':break print(f'Case {i}: {a.strip()}') i+=1
6
6
79
97
i = 1 while 1: a = eval(input()) if int(a) == 0: break print(f"Case {i}: {a}") i += 1
import sys i = 1 for a in sys.stdin: if a == "0\n": break print(f"Case {i}: {a.strip()}") i += 1
false
0
[ "+import sys", "+", "-while 1:", "- a = eval(input())", "- if int(a) == 0:", "+for a in sys.stdin:", "+ if a == \"0\\n\":", "- print(f\"Case {i}: {a}\")", "+ print(f\"Case {i}: {a.strip()}\")" ]
false
0.149989
0.145244
1.032674
[ "s212445901", "s180128215" ]
u143509139
p02821
python
s034702705
s125346908
1,557
980
55,700
23,364
Accepted
Accepted
37.06
from bisect import bisect_left n, k = list(map(int, input().split())) a = list(map(int, input().split())) a.sort() l, r = 0, 10000000000 while r - l > 1: m = (l + r) // 2 res = 0 for x in a: res += n - bisect_left(a, m - x) if res >= k: l = m else: r = m b = [0]...
import numpy as np n, k = list(map(int, input().split())) a = np.array(list(map(int, input().split()))) a.sort() l, r = 0, 10000000000 while r - l > 1: m = (l + r) // 2 res = n * n - a.searchsorted(m - a).sum() if res >= k: l = m else: r = m b = np.array([0] * (n + 1)) for i...
24
22
517
500
from bisect import bisect_left n, k = list(map(int, input().split())) a = list(map(int, input().split())) a.sort() l, r = 0, 10000000000 while r - l > 1: m = (l + r) // 2 res = 0 for x in a: res += n - bisect_left(a, m - x) if res >= k: l = m else: r = m b = [0] * (n + 1) fo...
import numpy as np n, k = list(map(int, input().split())) a = np.array(list(map(int, input().split()))) a.sort() l, r = 0, 10000000000 while r - l > 1: m = (l + r) // 2 res = n * n - a.searchsorted(m - a).sum() if res >= k: l = m else: r = m b = np.array([0] * (n + 1)) for i in range(1,...
false
8.333333
[ "-from bisect import bisect_left", "+import numpy as np", "-a = list(map(int, input().split()))", "+a = np.array(list(map(int, input().split())))", "- res = 0", "- for x in a:", "- res += n - bisect_left(a, m - x)", "+ res = n * n - a.searchsorted(m - a).sum()", "-b = [0] * (n + 1)",...
false
0.008128
0.33805
0.024043
[ "s034702705", "s125346908" ]
u118147328
p03610
python
s181521671
s519590595
80
28
4,596
3,188
Accepted
Accepted
65
S = input() for i in range(len(S)): if i % 2 == 0: print(S[i],end="")
S = eval(input()) ans = "" for i in range(0,len(S),2): ans += S[i] print(ans)
5
7
86
87
S = input() for i in range(len(S)): if i % 2 == 0: print(S[i], end="")
S = eval(input()) ans = "" for i in range(0, len(S), 2): ans += S[i] print(ans)
false
28.571429
[ "-S = input()", "-for i in range(len(S)):", "- if i % 2 == 0:", "- print(S[i], end=\"\")", "+S = eval(input())", "+ans = \"\"", "+for i in range(0, len(S), 2):", "+ ans += S[i]", "+print(ans)" ]
false
0.059026
0.102507
0.575827
[ "s181521671", "s519590595" ]
u765643145
p02554
python
s529694295
s007624567
570
26
11,024
9,124
Accepted
Accepted
95.44
N=int(eval(input())) ans=10**N - 9**N - 9**N + 8**N print((ans % (10**9+7)))
N=int(eval(input())) MOD=10**9+7 ans=pow(10,N,MOD) - pow(9,N,MOD)*2 + pow(8,N,MOD) print((ans % MOD))
3
4
71
98
N = int(eval(input())) ans = 10**N - 9**N - 9**N + 8**N print((ans % (10**9 + 7)))
N = int(eval(input())) MOD = 10**9 + 7 ans = pow(10, N, MOD) - pow(9, N, MOD) * 2 + pow(8, N, MOD) print((ans % MOD))
false
25
[ "-ans = 10**N - 9**N - 9**N + 8**N", "-print((ans % (10**9 + 7)))", "+MOD = 10**9 + 7", "+ans = pow(10, N, MOD) - pow(9, N, MOD) * 2 + pow(8, N, MOD)", "+print((ans % MOD))" ]
false
0.240455
0.031438
7.648669
[ "s529694295", "s007624567" ]
u729133443
p02957
python
s750634456
s759145203
173
24
39,892
9,004
Accepted
Accepted
86.13
a=eval(input().replace(' ','+'));print((a%2*'IMPOSSIBLE'or a//2))
a=eval(input().replace(*' +')) print((a%2*'IMPOSSIBLE'or a//2))
1
2
63
62
a = eval(input().replace(" ", "+")) print((a % 2 * "IMPOSSIBLE" or a // 2))
a = eval(input().replace(*" +")) print((a % 2 * "IMPOSSIBLE" or a // 2))
false
50
[ "-a = eval(input().replace(\" \", \"+\"))", "+a = eval(input().replace(*\" +\"))" ]
false
0.035984
0.064126
0.561136
[ "s750634456", "s759145203" ]
u665038048
p03325
python
s040849101
s636652666
156
143
4,148
4,148
Accepted
Accepted
8.33
N = int(eval(input())) A = list(map(int, input().split())) two_num = 0 for i in range(len(A)): while A[i] % 2 == 0: two_num += 1 A[i] = A[i] / 2 print(two_num)
N = int(eval(input())) a = list(map(int, input().split())) cnt = [] for i in range(N): cnt_sub = 0 while a[i] % 2 == 0: a[i] = a[i] / 2 cnt_sub += 1 cnt.append(cnt_sub) print((sum(cnt)))
8
10
180
215
N = int(eval(input())) A = list(map(int, input().split())) two_num = 0 for i in range(len(A)): while A[i] % 2 == 0: two_num += 1 A[i] = A[i] / 2 print(two_num)
N = int(eval(input())) a = list(map(int, input().split())) cnt = [] for i in range(N): cnt_sub = 0 while a[i] % 2 == 0: a[i] = a[i] / 2 cnt_sub += 1 cnt.append(cnt_sub) print((sum(cnt)))
false
20
[ "-A = list(map(int, input().split()))", "-two_num = 0", "-for i in range(len(A)):", "- while A[i] % 2 == 0:", "- two_num += 1", "- A[i] = A[i] / 2", "-print(two_num)", "+a = list(map(int, input().split()))", "+cnt = []", "+for i in range(N):", "+ cnt_sub = 0", "+ while a...
false
0.031786
0.037009
0.858871
[ "s040849101", "s636652666" ]
u160224209
p03944
python
s265318769
s911162357
30
27
9,156
9,160
Accepted
Accepted
10
w,h,n = list(map(int,input().split())) lists = [list(map(int,input().split())) for i in range(n)] x1 = 0 x2 = w y1 = 0 y2 = h for x,y,a in lists: if a == 1: x1 = max(x1,x) elif a == 2: x2 = min(x2,x) elif a == 3: y1 = max(y1,y) elif a == 4: y2 = min(y2,y) x...
w,h,n = list(map(int,input().split())) lists = [list(map(int,input().split())) for i in range(n)] plx = 0 ply = 0 prx = w pry = h for x,y,a in lists: if a == 1: if plx < x: plx = x elif a == 2: if prx > x: prx = x elif a == 3: if ply < y: ...
19
29
385
525
w, h, n = list(map(int, input().split())) lists = [list(map(int, input().split())) for i in range(n)] x1 = 0 x2 = w y1 = 0 y2 = h for x, y, a in lists: if a == 1: x1 = max(x1, x) elif a == 2: x2 = min(x2, x) elif a == 3: y1 = max(y1, y) elif a == 4: y2 = min(y2, y) x = ma...
w, h, n = list(map(int, input().split())) lists = [list(map(int, input().split())) for i in range(n)] plx = 0 ply = 0 prx = w pry = h for x, y, a in lists: if a == 1: if plx < x: plx = x elif a == 2: if prx > x: prx = x elif a == 3: if ply < y: ply...
false
34.482759
[ "-x1 = 0", "-x2 = w", "-y1 = 0", "-y2 = h", "+plx = 0", "+ply = 0", "+prx = w", "+pry = h", "- x1 = max(x1, x)", "+ if plx < x:", "+ plx = x", "- x2 = min(x2, x)", "+ if prx > x:", "+ prx = x", "- y1 = max(y1, y)", "+ if p...
false
0.223779
0.044441
5.035401
[ "s265318769", "s911162357" ]
u545368057
p02787
python
s616185001
s476381543
595
337
237,480
41,452
Accepted
Accepted
43.36
H, N = list(map(int, input().split())) # hitpoint H # waza N As = [] # damage Bs = [] # MP comsumptions for i in range(N): a,b = list(map(int, input().split())) As.append(a) Bs.append(b) """ dp[i][j] = i番目までの魔法を見たとき、ダメージがちょうどjになる最小値 """ INF = 10**10 M = 21000 dp = [[INF]*M for i in range(N+...
H, N = list(map(int, input().split())) # hitpoint H # waza N As = [] # damage Bs = [] # MP comsumptions for i in range(N): a,b = list(map(int, input().split())) As.append(a) Bs.append(b) INF = 10**10 M = 21000 dp = [INF]*M dp[0] = 0 for i,(a,b) in enumerate(zip(As,Bs)): # update fo...
23
21
568
423
H, N = list(map(int, input().split())) # hitpoint H # waza N As = [] # damage Bs = [] # MP comsumptions for i in range(N): a, b = list(map(int, input().split())) As.append(a) Bs.append(b) """ dp[i][j] = i番目までの魔法を見たとき、ダメージがちょうどjになる最小値 """ INF = 10**10 M = 21000 dp = [[INF] * M for i in range(N + 1)] dp[0][...
H, N = list(map(int, input().split())) # hitpoint H # waza N As = [] # damage Bs = [] # MP comsumptions for i in range(N): a, b = list(map(int, input().split())) As.append(a) Bs.append(b) INF = 10**10 M = 21000 dp = [INF] * M dp[0] = 0 for i, (a, b) in enumerate(zip(As, Bs)): # update for j in ran...
false
8.695652
[ "-\"\"\"", "-dp[i][j] = i番目までの魔法を見たとき、ダメージがちょうどjになる最小値", "-\"\"\"", "-dp = [[INF] * M for i in range(N + 1)]", "-dp[0][0] = 0", "+dp = [INF] * M", "+dp[0] = 0", "- dp[i + 1][:] = dp[i][:]", "+ # update", "- dp[i + 1][j + a] = min(dp[i][j + a], dp[i + 1][j] + b)", "- # print(i...
false
0.099608
0.104863
0.949884
[ "s616185001", "s476381543" ]
u044964932
p02630
python
s787823101
s704036624
465
293
20,832
32,668
Accepted
Accepted
36.99
def main(): n = int(eval(input())) As = list(map(int, input().split())) nums = [0] * (10**5+1) ans = 0 for a in As: ans += a nums[a] += 1 q = int(eval(input())) for i in range(q): b, c = list(map(int, input().split())) ans += (c-b) * nums[b] ...
def main(): n = int(eval(input())) As = list(map(int, input().split())) As_Count = [0] * (10**5+1) q = int(eval(input())) bcs = [list(map(int, input().split())) for _ in range(q)] for A in As: As_Count[A] += 1 ans = sum(As) for b, c in bcs: ans -= As_Count[b] * ...
21
19
412
467
def main(): n = int(eval(input())) As = list(map(int, input().split())) nums = [0] * (10**5 + 1) ans = 0 for a in As: ans += a nums[a] += 1 q = int(eval(input())) for i in range(q): b, c = list(map(int, input().split())) ans += (c - b) * nums[b] nums[c...
def main(): n = int(eval(input())) As = list(map(int, input().split())) As_Count = [0] * (10**5 + 1) q = int(eval(input())) bcs = [list(map(int, input().split())) for _ in range(q)] for A in As: As_Count[A] += 1 ans = sum(As) for b, c in bcs: ans -= As_Count[b] * b ...
false
9.52381
[ "- nums = [0] * (10**5 + 1)", "- ans = 0", "- for a in As:", "- ans += a", "- nums[a] += 1", "+ As_Count = [0] * (10**5 + 1)", "- for i in range(q):", "- b, c = list(map(int, input().split()))", "- ans += (c - b) * nums[b]", "- nums[c] += nums[b]",...
false
0.169852
0.119616
1.419977
[ "s787823101", "s704036624" ]
u078042885
p00226
python
s375242713
s661637879
170
150
7,420
7,416
Accepted
Accepted
11.76
while 1: a,b=list(input().split()) if len(a)==1:break h=0 for i,j in zip(a,b):h+=i==j print((h,len(set(a)&set(b))-h))
while 1: a,b=input().split() if a=='0':break h=0 for i,j in zip(a,b):h+=i==j print((h,len(set(a)&set(b))-h))
6
6
140
131
while 1: a, b = list(input().split()) if len(a) == 1: break h = 0 for i, j in zip(a, b): h += i == j print((h, len(set(a) & set(b)) - h))
while 1: a, b = input().split() if a == "0": break h = 0 for i, j in zip(a, b): h += i == j print((h, len(set(a) & set(b)) - h))
false
0
[ "- a, b = list(input().split())", "- if len(a) == 1:", "+ a, b = input().split()", "+ if a == \"0\":" ]
false
0.038096
0.101219
0.376368
[ "s375242713", "s661637879" ]
u631277801
p03329
python
s024605310
s673188591
522
19
3,828
3,064
Accepted
Accepted
96.36
MAX_N = 10**5 N = int(eval(input())) dp = [MAX_N]*(N+1) dp[0] = 0 dp[1] = 1 MONEY_LIST = [6**i for i in range(7)] MONEY_LIST.extend([9**i for i in range(1,6)]) MONEY_LIST.sort() for i in range(N+1): for m in MONEY_LIST: if m>i: break dp[i] = min(dp[i],dp[i-m...
from itertools import count, takewhile def dfs(n:int, d={}) -> int: if n<6: return n if n in d: return d[n] max9 = max(takewhile(lambda x: x<=n, (9**i for i in count()))) max6 = max(takewhile(lambda x: x<=n, (6**i for i in count()))) d[n] = min(dfs(n-max9)...
20
17
342
387
MAX_N = 10**5 N = int(eval(input())) dp = [MAX_N] * (N + 1) dp[0] = 0 dp[1] = 1 MONEY_LIST = [6**i for i in range(7)] MONEY_LIST.extend([9**i for i in range(1, 6)]) MONEY_LIST.sort() for i in range(N + 1): for m in MONEY_LIST: if m > i: break dp[i] = min(dp[i], dp[i - m] + 1) print((dp[N...
from itertools import count, takewhile def dfs(n: int, d={}) -> int: if n < 6: return n if n in d: return d[n] max9 = max(takewhile(lambda x: x <= n, (9**i for i in count()))) max6 = max(takewhile(lambda x: x <= n, (6**i for i in count()))) d[n] = min(dfs(n - max9), dfs(n - max6)) ...
false
15
[ "-MAX_N = 10**5", "-N = int(eval(input()))", "-dp = [MAX_N] * (N + 1)", "-dp[0] = 0", "-dp[1] = 1", "-MONEY_LIST = [6**i for i in range(7)]", "-MONEY_LIST.extend([9**i for i in range(1, 6)])", "-MONEY_LIST.sort()", "-for i in range(N + 1):", "- for m in MONEY_LIST:", "- if m > i:", "...
false
0.269434
0.037487
7.187424
[ "s024605310", "s673188591" ]
u119148115
p02814
python
s333990542
s891790160
415
152
89,580
87,360
Accepted
Accepted
63.37
from fractions import gcd def lcm(a,b): return a*b//gcd(a,b) N,M = list(map(int,input().split())) A = [int(i) for i in input().split()] a = 0 b = A[0] while b % 2 == 0: a += 1 b = b//2 for i in range(1,N): if A[i] % (2**a) != 0 or A[i] % (2**(a+1)) == 0: print((0)) exit() c = A...
import sys from math import gcd sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rst...
24
37
380
925
from fractions import gcd def lcm(a, b): return a * b // gcd(a, b) N, M = list(map(int, input().split())) A = [int(i) for i in input().split()] a = 0 b = A[0] while b % 2 == 0: a += 1 b = b // 2 for i in range(1, N): if A[i] % (2**a) != 0 or A[i] % (2 ** (a + 1)) == 0: print((0)) exi...
import sys from math import gcd sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり def LI2(): return list(map(int, s...
false
35.135135
[ "-from fractions import gcd", "+import sys", "+from math import gcd", "+", "+sys.setrecursionlimit(10**7)", "-def lcm(a, b):", "- return a * b // gcd(a, b)", "+def I():", "+ return int(sys.stdin.readline().rstrip())", "-N, M = list(map(int, input().split()))", "-A = [int(i) for i in input(...
false
0.07635
0.101577
0.751649
[ "s333990542", "s891790160" ]
u762420987
p03425
python
s081098327
s887197986
214
160
14,316
10,880
Accepted
Accepted
25.23
N = int(eval(input())) Sset = set() str_dict = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} for _ in range(N): S = eval(input()) if S in Sset: continue if S[0] in {"M", "A", "R", "C", "H"}: Sset.add(S) str_dict[S[0]] += 1 non0 = [] for item in list(str_dict.items()): if...
from collections import Counter from itertools import combinations N = int(eval(input())) Slist = [eval(input()) for _ in range(N)] Sc = Counter([S[0] for S in Slist]) ans = 0 for x, y, z in combinations(list("MARCH"), 3): ans += Sc[x] * Sc[y] * Sc[z] print(ans)
22
9
513
262
N = int(eval(input())) Sset = set() str_dict = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} for _ in range(N): S = eval(input()) if S in Sset: continue if S[0] in {"M", "A", "R", "C", "H"}: Sset.add(S) str_dict[S[0]] += 1 non0 = [] for item in list(str_dict.items()): if item[1] > 0: ...
from collections import Counter from itertools import combinations N = int(eval(input())) Slist = [eval(input()) for _ in range(N)] Sc = Counter([S[0] for S in Slist]) ans = 0 for x, y, z in combinations(list("MARCH"), 3): ans += Sc[x] * Sc[y] * Sc[z] print(ans)
false
59.090909
[ "-N = int(eval(input()))", "-Sset = set()", "-str_dict = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "-for _ in range(N):", "- S = eval(input())", "- if S in Sset:", "- continue", "- if S[0] in {\"M\", \"A\", \"R\", \"C\", \"H\"}:", "- Sset.add(S)", "- str_di...
false
0.040333
0.039236
1.027949
[ "s081098327", "s887197986" ]
u910632349
p02888
python
s622135012
s434093625
1,257
904
9,304
9,336
Accepted
Accepted
28.08
import bisect n=int(eval(input())) l=sorted(list(map(int,input().split()))) ans=0 for i in range(n-2): for j in range(i+1,n-1): x=bisect.bisect_left(l,l[i]+l[j])-j-1 ans+=max(0,x) print(ans)
import bisect n=int(eval(input())) l=sorted(list(map(int,input().split()))) ans=0 for i in range(n-2): for j in range(i+1,n-1): ans+=bisect.bisect_left(l,l[i]+l[j])-j-1 print(ans)
9
8
212
192
import bisect n = int(eval(input())) l = sorted(list(map(int, input().split()))) ans = 0 for i in range(n - 2): for j in range(i + 1, n - 1): x = bisect.bisect_left(l, l[i] + l[j]) - j - 1 ans += max(0, x) print(ans)
import bisect n = int(eval(input())) l = sorted(list(map(int, input().split()))) ans = 0 for i in range(n - 2): for j in range(i + 1, n - 1): ans += bisect.bisect_left(l, l[i] + l[j]) - j - 1 print(ans)
false
11.111111
[ "- x = bisect.bisect_left(l, l[i] + l[j]) - j - 1", "- ans += max(0, x)", "+ ans += bisect.bisect_left(l, l[i] + l[j]) - j - 1" ]
false
0.039303
0.074691
0.526212
[ "s622135012", "s434093625" ]
u126227204
p02862
python
s344923738
s048039701
636
96
84,084
3,188
Accepted
Accepted
84.91
#coding:utf-8 import bisect import sys sys.setrecursionlimit(10**6) write = sys.stdout.write dbg = lambda *something : print(*something) if DEBUG else 0 DEBUG = True def com(a, b, p): if a < b or a < 0 or b < 0: return 0 fac = [1]*(a+1) inv = [1]*(a+1) finv = [1]*(a+1) for...
#coding:utf-8 import bisect import sys sys.setrecursionlimit(10**6) write = sys.stdout.write dbg = lambda *something : print(*something) if DEBUG else 0 DEBUG = True def main(given = sys.stdin.readline): input = lambda : given().rstrip() LMIIS = lambda : list(map(int,input().split())) II = l...
48
42
1,007
822
# coding:utf-8 import bisect import sys sys.setrecursionlimit(10**6) write = sys.stdout.write dbg = lambda *something: print(*something) if DEBUG else 0 DEBUG = True def com(a, b, p): if a < b or a < 0 or b < 0: return 0 fac = [1] * (a + 1) inv = [1] * (a + 1) finv = [1] * (a + 1) for i i...
# coding:utf-8 import bisect import sys sys.setrecursionlimit(10**6) write = sys.stdout.write dbg = lambda *something: print(*something) if DEBUG else 0 DEBUG = True def main(given=sys.stdin.readline): input = lambda: given().rstrip() LMIIS = lambda: list(map(int, input().split())) II = lambda: int(input...
false
12.5
[ "-", "-", "-def com(a, b, p):", "- if a < b or a < 0 or b < 0:", "- return 0", "- fac = [1] * (a + 1)", "- inv = [1] * (a + 1)", "- finv = [1] * (a + 1)", "- for i in range(2, a + 1):", "- fac[i] = fac[i - 1] * i % p", "- inv[i] = p - (inv[p % i] * (p // i)) %...
false
0.550773
0.254412
2.164882
[ "s344923738", "s048039701" ]
u143492911
p03457
python
s370038722
s012662294
417
337
27,300
3,060
Accepted
Accepted
19.18
n=int(eval(input())) t=[list(map(int,input().split()))for i in range(n)] t.insert(0,[0,0,0]) for i in range(n): dxy=abs(t[i][1]-t[i+1][1])+abs(t[i][2]-t[i+1][2]) dt=abs(t[i][0]-t[i+1][0]) dd=dt-dxy if dxy<=dt and dd%2==0: pass else: print("No") exit() print("Yes")...
n=int(input()) cnt=0 for i in range(n): t,x,y=map(int,input().split()) if x+y<=t and t%2==(x+y)%2: cnt+=1 print("Yes") if cnt==n else print("No")
13
8
315
170
n = int(eval(input())) t = [list(map(int, input().split())) for i in range(n)] t.insert(0, [0, 0, 0]) for i in range(n): dxy = abs(t[i][1] - t[i + 1][1]) + abs(t[i][2] - t[i + 1][2]) dt = abs(t[i][0] - t[i + 1][0]) dd = dt - dxy if dxy <= dt and dd % 2 == 0: pass else: print("No") ...
n = int(input()) cnt = 0 for i in range(n): t, x, y = map(int, input().split()) if x + y <= t and t % 2 == (x + y) % 2: cnt += 1 print("Yes") if cnt == n else print("No")
false
38.461538
[ "-n = int(eval(input()))", "-t = [list(map(int, input().split())) for i in range(n)]", "-t.insert(0, [0, 0, 0])", "+n = int(input())", "+cnt = 0", "- dxy = abs(t[i][1] - t[i + 1][1]) + abs(t[i][2] - t[i + 1][2])", "- dt = abs(t[i][0] - t[i + 1][0])", "- dd = dt - dxy", "- if dxy <= dt an...
false
0.099123
0.054999
1.802258
[ "s370038722", "s012662294" ]
u874723578
p03319
python
s760070753
s909798369
40
19
13,852
3,060
Accepted
Accepted
52.5
import math N, K, *A = list(map(int, open(0).read().split())) print((math.ceil((N-1)/(K-1))))
import math N, K = list(map(int, input().split())) print((math.ceil((N-1)/(K-1))))
3
3
88
77
import math N, K, *A = list(map(int, open(0).read().split())) print((math.ceil((N - 1) / (K - 1))))
import math N, K = list(map(int, input().split())) print((math.ceil((N - 1) / (K - 1))))
false
0
[ "-N, K, *A = list(map(int, open(0).read().split()))", "+N, K = list(map(int, input().split()))" ]
false
0.077091
0.04066
1.895988
[ "s760070753", "s909798369" ]
u299231628
p02417
python
s782563003
s399369798
30
20
5,556
5,572
Accepted
Accepted
33.33
alpha = 'abcdefghijklmnopqrstuvwxyz' text = '' while True: try: text += input().lower() except: break for key in alpha: print(('{} : {}'.format(key, text.count(key))))
alpha = 'abcdefghijklmnopqrstuvwxyz' text = '' while True: try: text += input().lower() except: break [print('{} : {}'.format(key, text.count(key))) for key in alpha]
11
10
218
203
alpha = "abcdefghijklmnopqrstuvwxyz" text = "" while True: try: text += input().lower() except: break for key in alpha: print(("{} : {}".format(key, text.count(key))))
alpha = "abcdefghijklmnopqrstuvwxyz" text = "" while True: try: text += input().lower() except: break [print("{} : {}".format(key, text.count(key))) for key in alpha]
false
9.090909
[ "-for key in alpha:", "- print((\"{} : {}\".format(key, text.count(key))))", "+[print(\"{} : {}\".format(key, text.count(key))) for key in alpha]" ]
false
0.049597
0.055745
0.88971
[ "s782563003", "s399369798" ]
u332657092
p03044
python
s962129787
s024461786
1,210
1,114
59,740
92,064
Accepted
Accepted
7.93
import numpy as np from scipy.sparse.csgraph import shortest_path import heapq n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n-1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 edge[u].append([w, v]) edge[v].append([w, u]) def dijkstra_heap(s): #始点sか...
import heapq n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n-1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 edge[u].append([w, v]) edge[v].append([w, u]) def dijkstra_heap(s): #始点sから各頂点への最短距離 d = [float("inf")] * n used = [True] * n #True:...
38
35
945
874
import numpy as np from scipy.sparse.csgraph import shortest_path import heapq n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 edge[u].append([w, v]) edge[v].append([w, u]) def dijkstra_heap(s): # 始点sから各頂点への最短...
import heapq n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 edge[u].append([w, v]) edge[v].append([w, u]) def dijkstra_heap(s): # 始点sから各頂点への最短距離 d = [float("inf")] * n used = [True] * n # True:未確定 ...
false
7.894737
[ "-import numpy as np", "-from scipy.sparse.csgraph import shortest_path" ]
false
0.045525
0.037205
1.223648
[ "s962129787", "s024461786" ]
u684120680
p03436
python
s659286853
s897684885
205
27
41,072
3,192
Accepted
Accepted
86.83
import sys h,w = [int(i) for i in input().split()] sys.setrecursionlimit(100000) s = [['#']*(w+2)] + [['#']+list(eval(input()))+['#'] for _ in range(h)] + [['#']*(w+2)] #print(s) cost = [[-1 if s[y][x] == '#' else float('inf') for x in range(w+2)] for y in range(h+2)] cost[1][1] = 0 #print(cost) move_...
import sys h,w = [int(i) for i in input().split()] sys.setrecursionlimit(100000) s = [['#']*(w+2)] + [['#']+list(eval(input()))+['#'] for _ in range(h)] + [['#']*(w+2)] #print(s) cost = [[-1 if s[y][x] == '#' else float('inf') for x in range(w+2)] for y in range(h+2)] cost[1][1] = 0 #print(cost) move_...
61
57
1,400
1,384
import sys h, w = [int(i) for i in input().split()] sys.setrecursionlimit(100000) s = ( [["#"] * (w + 2)] + [["#"] + list(eval(input())) + ["#"] for _ in range(h)] + [["#"] * (w + 2)] ) # print(s) cost = [ [-1 if s[y][x] == "#" else float("inf") for x in range(w + 2)] for y in range(h + 2) ] cost[1][1]...
import sys h, w = [int(i) for i in input().split()] sys.setrecursionlimit(100000) s = ( [["#"] * (w + 2)] + [["#"] + list(eval(input())) + ["#"] for _ in range(h)] + [["#"] * (w + 2)] ) # print(s) cost = [ [-1 if s[y][x] == "#" else float("inf") for x in range(w + 2)] for y in range(h + 2) ] cost[1][1]...
false
6.557377
[ "- if cost[y + 1][x] != -1:", "- if cost[y + 1][x] > cost[y][x] + 1:", "- cost[y + 1][x] = cost[y][x] + 1", "- move_que.append([y + 1, x])", "- if cost[y - 1][x] != -1:", "- if cost[y - 1][x] > cost[y][x] + 1:", "- cost[y - 1][x] = cost[y][x] + 1", ...
false
0.03764
0.037109
1.01433
[ "s659286853", "s897684885" ]
u823044869
p03485
python
s026245951
s005493091
19
17
2,940
2,940
Accepted
Accepted
10.53
import math a, b = list(map(float, input().split())) print((math.ceil((a+b)/2)))
import math a,b = list(map(int,input().split())) print((math.ceil((a+b)/2)))
5
5
79
75
import math a, b = list(map(float, input().split())) print((math.ceil((a + b) / 2)))
import math a, b = list(map(int, input().split())) print((math.ceil((a + b) / 2)))
false
0
[ "-a, b = list(map(float, input().split()))", "+a, b = list(map(int, input().split()))" ]
false
0.045335
0.044195
1.025785
[ "s026245951", "s005493091" ]
u389910364
p03053
python
s501706867
s405962335
557
483
127,148
45,088
Accepted
Accepted
13.29
import os import itertools import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 H, W = list(map(int, sys.stdin.readline().split())) A = [list(sys.stdin.readline().rstrip()) for _ in range(H)] ...
import bisect import heapq import itertools import math 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 import itemgetter ...
40
30
844
749
import os import itertools import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 H, W = list(map(int, sys.stdin.readline().split())) A = [list(sys.stdin.readline().rstrip()) for _ in range(H)] def ok(h, w): return...
import bisect import heapq import itertools import math 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 import itemgetter import numpy as...
false
25
[ "+import bisect", "+import heapq", "+import itertools", "+import math", "-import itertools", "+import re", "+import string", "+from collections import Counter, deque, defaultdict", "+from copy import deepcopy", "+from decimal import Decimal", "+from fractions import gcd", "+from functools impo...
false
0.04591
0.414238
0.110831
[ "s501706867", "s405962335" ]
u798803522
p02276
python
s499668795
s963914910
110
90
18,384
16,364
Accepted
Accepted
18.18
length = int(eval(input())) target = [int(n) for n in input().split(" ")] splitter = target[-1] border = 0 for i, n in enumerate(target): if n <= splitter: target[i], target[border] = target[border], target[i] border += 1 target[border - 1] = [splitter] print((*target))
def partition(li, m, length): ini_i = 0 target = li[length - 1] for i, n in enumerate(li[:length - 1]): if n <= target: li[ini_i], li[i] = li[i], li[ini_i] ini_i += 1 li[ini_i], li[-1] = [li[-1]], li[ini_i] print((*li)) length = int(eval(input())) li = [int(...
10
12
291
371
length = int(eval(input())) target = [int(n) for n in input().split(" ")] splitter = target[-1] border = 0 for i, n in enumerate(target): if n <= splitter: target[i], target[border] = target[border], target[i] border += 1 target[border - 1] = [splitter] print((*target))
def partition(li, m, length): ini_i = 0 target = li[length - 1] for i, n in enumerate(li[: length - 1]): if n <= target: li[ini_i], li[i] = li[i], li[ini_i] ini_i += 1 li[ini_i], li[-1] = [li[-1]], li[ini_i] print((*li)) length = int(eval(input())) li = [int(n) for ...
false
16.666667
[ "+def partition(li, m, length):", "+ ini_i = 0", "+ target = li[length - 1]", "+ for i, n in enumerate(li[: length - 1]):", "+ if n <= target:", "+ li[ini_i], li[i] = li[i], li[ini_i]", "+ ini_i += 1", "+ li[ini_i], li[-1] = [li[-1]], li[ini_i]", "+ print(...
false
0.038776
0.063845
0.607341
[ "s499668795", "s963914910" ]
u150984829
p00458
python
s681909921
s715544156
370
260
5,720
5,724
Accepted
Accepted
29.73
def s(): def b(M,x,y,n=0): if M[x][y]==0:return n M[x][y]=0 a=max(b(M,x-1,y,n+1),b(M,x,y-1,n+1),b(M,x+1,y,n+1),b(M,x,y+1,n+1)) M[x][y]=1 return a for e in iter(input,'0'): n,m=int(e),int(eval(input())) P=[[0]*(n+2)for _ in[0]*(m+2)] for i in range(m):P[i+1][1:-1]=list(map(int,input().split()...
def s(): def b(M,x,y,n): M[x][y]=0;a=n if M[x-1][y]:a=max(a,b(M,x-1,y,n+1)) if M[x][y-1]:a=max(a,b(M,x,y-1,n+1)) if M[x+1][y]:a=max(a,b(M,x+1,y,n+1)) if M[x][y+1]:a=max(a,b(M,x,y+1,n+1)) M[x][y]=1 return a for e in iter(input,'0'): n,m=int(e),int(eval(input())) P=[[0]*(n+2)for _ in[0]*(m+...
13
15
405
483
def s(): def b(M, x, y, n=0): if M[x][y] == 0: return n M[x][y] = 0 a = max( b(M, x - 1, y, n + 1), b(M, x, y - 1, n + 1), b(M, x + 1, y, n + 1), b(M, x, y + 1, n + 1), ) M[x][y] = 1 return a for e in it...
def s(): def b(M, x, y, n): M[x][y] = 0 a = n if M[x - 1][y]: a = max(a, b(M, x - 1, y, n + 1)) if M[x][y - 1]: a = max(a, b(M, x, y - 1, n + 1)) if M[x + 1][y]: a = max(a, b(M, x + 1, y, n + 1)) if M[x][y + 1]: a = max(...
false
13.333333
[ "- def b(M, x, y, n=0):", "- if M[x][y] == 0:", "- return n", "+ def b(M, x, y, n):", "- a = max(", "- b(M, x - 1, y, n + 1),", "- b(M, x, y - 1, n + 1),", "- b(M, x + 1, y, n + 1),", "- b(M, x, y + 1, n + 1),", "- )...
false
0.072219
0.0748
0.965502
[ "s681909921", "s715544156" ]
u218834617
p04030
python
s704180819
s018327774
27
24
8,968
9,112
Accepted
Accepted
11.11
s=eval(input()) ans,skip='',0 for c in reversed(s): if c=='B': skip+=1 elif skip: skip-=1 else: ans+=c print((ans[::-1]))
s=eval(input()) stk=[] for c in s: if c in '01': stk.append(c) elif stk: stk.pop() print((''.join(stk)))
11
9
161
130
s = eval(input()) ans, skip = "", 0 for c in reversed(s): if c == "B": skip += 1 elif skip: skip -= 1 else: ans += c print((ans[::-1]))
s = eval(input()) stk = [] for c in s: if c in "01": stk.append(c) elif stk: stk.pop() print(("".join(stk)))
false
18.181818
[ "-ans, skip = \"\", 0", "-for c in reversed(s):", "- if c == \"B\":", "- skip += 1", "- elif skip:", "- skip -= 1", "- else:", "- ans += c", "-print((ans[::-1]))", "+stk = []", "+for c in s:", "+ if c in \"01\":", "+ stk.append(c)", "+ elif stk:",...
false
0.04595
0.125454
0.36627
[ "s704180819", "s018327774" ]
u077291787
p03880
python
s183098447
s793545254
127
63
7,484
7,560
Accepted
Accepted
50.39
# cf16-exhibition-final-openC - Cheating Nim def main(): # player is second move -> make xor 0 N, *A = list(map(int, open(0))) A.sort(reverse=1) ans, x, flg = 0, 0, [0] * 30 for i in A: x ^= i p = bin(i ^ i - 1)[::-1].rfind("1") # rightmost bits of i^i-1 flg[p] = 1 ...
# cf16-exhibition-final-openC - Cheating Nim from functools import reduce from operator import xor def main(): # player is second move -> make xor 0 N, *A = list(map(int, open(0))) # A.sort(reverse=1) X, changeable, cand = reduce(xor, A), {x ^ (x - 1) for x in A}, [] while X: i ...
24
26
646
583
# cf16-exhibition-final-openC - Cheating Nim def main(): # player is second move -> make xor 0 N, *A = list(map(int, open(0))) A.sort(reverse=1) ans, x, flg = 0, 0, [0] * 30 for i in A: x ^= i p = bin(i ^ i - 1)[::-1].rfind("1") # rightmost bits of i^i-1 flg[p] = 1 for i...
# cf16-exhibition-final-openC - Cheating Nim from functools import reduce from operator import xor def main(): # player is second move -> make xor 0 N, *A = list(map(int, open(0))) # A.sort(reverse=1) X, changeable, cand = reduce(xor, A), {x ^ (x - 1) for x in A}, [] while X: i = (1 << X.b...
false
7.692308
[ "+from functools import reduce", "+from operator import xor", "+", "+", "- A.sort(reverse=1)", "- ans, x, flg = 0, 0, [0] * 30", "- for i in A:", "- x ^= i", "- p = bin(i ^ i - 1)[::-1].rfind(\"1\") # rightmost bits of i^i-1", "- flg[p] = 1", "- for i in range(2...
false
0.040676
0.063255
0.643057
[ "s183098447", "s793545254" ]
u130900604
p02783
python
s584995938
s493362355
177
64
38,384
61,732
Accepted
Accepted
63.84
h,a=list(map(int,input().split())) print(((h+a-1)//a))
h,a=list(map(int,input().split())) print((-(-h//a)))
3
2
50
45
h, a = list(map(int, input().split())) print(((h + a - 1) // a))
h, a = list(map(int, input().split())) print((-(-h // a)))
false
33.333333
[ "-print(((h + a - 1) // a))", "+print((-(-h // a)))" ]
false
0.044745
0.041234
1.085162
[ "s584995938", "s493362355" ]
u263830634
p03168
python
s170715604
s177258767
798
216
263,432
14,536
Accepted
Accepted
72.93
N = int(eval(input())) P = list(map(float, input().split())) dp = [[0] * (N + 1) for _ in range(N + 1)] dp[0][0] = 1 for i in range(N): p = P[i] q = 1 - p dp[i + 1][0] = dp[i][0] * q for j in range(1, i + 2): dp[i + 1][j] = dp[i][j - 1] * p + dp[i][j] * q print((sum(dp[N][(N + 1)...
import numpy as np N = int(eval(input())) P = list(map(float, input().split())) dp = np.zeros(N + 2) dp[1] = 1 for p in P: q = 1 - p dp[1:] = dp[:N + 1] * p + dp[1:] * q # print (dp) print((sum(dp[N // 2 + 2:])))
14
14
323
230
N = int(eval(input())) P = list(map(float, input().split())) dp = [[0] * (N + 1) for _ in range(N + 1)] dp[0][0] = 1 for i in range(N): p = P[i] q = 1 - p dp[i + 1][0] = dp[i][0] * q for j in range(1, i + 2): dp[i + 1][j] = dp[i][j - 1] * p + dp[i][j] * q print((sum(dp[N][(N + 1) // 2 :])))
import numpy as np N = int(eval(input())) P = list(map(float, input().split())) dp = np.zeros(N + 2) dp[1] = 1 for p in P: q = 1 - p dp[1:] = dp[: N + 1] * p + dp[1:] * q # print (dp) print((sum(dp[N // 2 + 2 :])))
false
0
[ "+import numpy as np", "+", "-dp = [[0] * (N + 1) for _ in range(N + 1)]", "-dp[0][0] = 1", "-for i in range(N):", "- p = P[i]", "+dp = np.zeros(N + 2)", "+dp[1] = 1", "+for p in P:", "- dp[i + 1][0] = dp[i][0] * q", "- for j in range(1, i + 2):", "- dp[i + 1][j] = dp[i][j - 1]...
false
0.03652
0.275937
0.132351
[ "s170715604", "s177258767" ]
u426534722
p02317
python
s338472606
s259289470
280
170
13,316
13,188
Accepted
Accepted
39.29
import bisect n = int(eval(input())) A = [int(eval(input())) for j in range(n)] dp = A[:1] for a_i in A[1:]: if dp[-1] < a_i: dp.append(a_i) else: dp[bisect.bisect_left(dp, a_i)] = a_i print((len(dp)))
import sys import bisect n = int(sys.stdin.readline()) A = [int(sys.stdin.readline()) for j in range(n)] dp = A[:1] for a_i in A[1:]: if dp[-1] < a_i: dp.append(a_i) else: dp[bisect.bisect_left(dp, a_i)] = a_i print((len(dp)))
10
11
220
258
import bisect n = int(eval(input())) A = [int(eval(input())) for j in range(n)] dp = A[:1] for a_i in A[1:]: if dp[-1] < a_i: dp.append(a_i) else: dp[bisect.bisect_left(dp, a_i)] = a_i print((len(dp)))
import sys import bisect n = int(sys.stdin.readline()) A = [int(sys.stdin.readline()) for j in range(n)] dp = A[:1] for a_i in A[1:]: if dp[-1] < a_i: dp.append(a_i) else: dp[bisect.bisect_left(dp, a_i)] = a_i print((len(dp)))
false
9.090909
[ "+import sys", "-n = int(eval(input()))", "-A = [int(eval(input())) for j in range(n)]", "+n = int(sys.stdin.readline())", "+A = [int(sys.stdin.readline()) for j in range(n)]" ]
false
0.007544
0.04115
0.183334
[ "s338472606", "s259289470" ]
u952467214
p03164
python
s934754592
s379939222
1,120
959
311,760
308,168
Accepted
Accepted
14.37
N, W = [int(i) for i in input().split()] w, v = [0]*N, [0]*N for i in range(N): w[i], v[i] = [int(_) for _ in input().split()] V = sum(v) dp = [[float('inf')] * (V+1) for _ in range(N+1)] # dp[i][j] i番目までの荷物で価値がj以上になるように選んだときの重さの最小値 dp[0][0] = 0 for i in range(N): for j in range(V+1): if v[i] <= ...
N, W = [int(i) for i in input().split()] w, v = [0]*N, [0]*N for i in range(N): w[i], v[i] = [int(_) for _ in input().split()] V = sum(v) dp = [[float('inf')] * (V+1) for _ in range(N+1)] # dp[i][j] i番目までの荷物で価値がj以上になるように選んだときの重さの最小値 dp[0][0] = 0 for i in range(N): for j in range(V+1): if v[i] <=...
22
23
554
557
N, W = [int(i) for i in input().split()] w, v = [0] * N, [0] * N for i in range(N): w[i], v[i] = [int(_) for _ in input().split()] V = sum(v) dp = [[float("inf")] * (V + 1) for _ in range(N + 1)] # dp[i][j] i番目までの荷物で価値がj以上になるように選んだときの重さの最小値 dp[0][0] = 0 for i in range(N): for j in range(V + 1): if v[i] ...
N, W = [int(i) for i in input().split()] w, v = [0] * N, [0] * N for i in range(N): w[i], v[i] = [int(_) for _ in input().split()] V = sum(v) dp = [[float("inf")] * (V + 1) for _ in range(N + 1)] # dp[i][j] i番目までの荷物で価値がj以上になるように選んだときの重さの最小値 dp[0][0] = 0 for i in range(N): for j in range(V + 1): if v[i] ...
false
4.347826
[ "- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i])", "- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])", "+ dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])", "+ else:", "+ dp[i + 1][j] = dp[i][j]" ]
false
0.044989
0.045473
0.989358
[ "s934754592", "s379939222" ]
u200887663
p02572
python
s348251503
s004878243
183
151
31,716
31,544
Accepted
Accepted
17.49
n = int(eval(input())) #a, b = map(int,input().split()) al = list(map(int, input().split())) #l = [list(map(int,input().split())) for i in range(n)] mod = 10**9+7 cuml = [al[0]] for i in range(n-2): cuml.append((cuml[i]+al[i+1]) % mod) ans = 0 for i in range(1, n): ans = (ans+cuml[i-1]*al[i]) % mod p...
n = int(eval(input())) #n, m = map(int, input().split()) al = list(map(int, input().split())) #al=[list(input()) for i in range(n)] mod = 10**9+7 add = 0 ans = 0 for i in range(n-1, 0, -1): add = (add+al[i]) % mod ans = (ans+add*al[i-1]) % mod print(ans)
12
12
324
269
n = int(eval(input())) # a, b = map(int,input().split()) al = list(map(int, input().split())) # l = [list(map(int,input().split())) for i in range(n)] mod = 10**9 + 7 cuml = [al[0]] for i in range(n - 2): cuml.append((cuml[i] + al[i + 1]) % mod) ans = 0 for i in range(1, n): ans = (ans + cuml[i - 1] * al[i]) % ...
n = int(eval(input())) # n, m = map(int, input().split()) al = list(map(int, input().split())) # al=[list(input()) for i in range(n)] mod = 10**9 + 7 add = 0 ans = 0 for i in range(n - 1, 0, -1): add = (add + al[i]) % mod ans = (ans + add * al[i - 1]) % mod print(ans)
false
0
[ "-# a, b = map(int,input().split())", "+# n, m = map(int, input().split())", "-# l = [list(map(int,input().split())) for i in range(n)]", "+# al=[list(input()) for i in range(n)]", "-cuml = [al[0]]", "-for i in range(n - 2):", "- cuml.append((cuml[i] + al[i + 1]) % mod)", "+add = 0", "-for i in r...
false
0.042854
0.037597
1.139829
[ "s348251503", "s004878243" ]
u716530146
p03379
python
s915129544
s977505733
419
292
89,456
25,880
Accepted
Accepted
30.31
#!/usr/bin/env python3 import sys, math, itertools, heapq, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') sys.setrecursionlimit(10**8) inf = float('inf') ans = count = 0 n=int(eval(input())) Y=list(map(int,input().split())) X=sorted(Y) X0=X[n//2-1] X1=X[n//2] for i...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 n = int(eval(input())) X = list(map(int,input().split())) Y = sorted(X) a = Y[n//2-1] b = Y[n/...
18
15
398
378
#!/usr/bin/env python3 import sys, math, itertools, heapq, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") sys.setrecursionlimit(10**8) inf = float("inf") ans = count = 0 n = int(eval(input())) Y = list(map(int, input().split())) X = sorted(Y) X0 = X[n // 2 - 1] X1 = X[n // 2] ...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 n = int(eval(input())) X = list(map(int, input().split())) Y = sorted(X) a = Y[n // 2 - 1] b = Y[n // 2] f...
false
16.666667
[ "-import sys, math, itertools, heapq, collections, bisect", "+import sys, math, itertools, collections, bisect", "-sys.setrecursionlimit(10**8)", "-ans = count = 0", "+mod = 10**9 + 7", "+mans = inf", "+ans = 0", "+count = 0", "+pro = 1", "-Y = list(map(int, input().split()))", "-X = sorted(Y)",...
false
0.043649
0.039677
1.100117
[ "s915129544", "s977505733" ]
u633068244
p00129
python
s387427255
s345546294
50
40
4,404
4,400
Accepted
Accepted
20
def dist(x,y,x1,y1): return (x-x1)**2+(y-y1)**2 def inWall(x,y,x1,y1,r): return True if dist(x,y,x1,y1) <= (r + 1e-9)**2 else False def isHide(x,y,r,a,b,c): D = abs(a*x+b*y+c)/(a**2+b**2)**0.5 return True if D <= r + 1e-9 else False def isBetween(x,y,tx,ty,sx,sy): a,b,c = dist(x,y,tx,ty),dist(x,y,s...
def inWall(x,y,x1,y1,r): return True if ((x-x1)**2+(y-y1)**2)**0.5 <= r + 1e-9 else False def isHide(x,y,r,a,b,c): D = abs(a*x+b*y+c)/(a**2+b**2)**0.5 return True if D <= r + 1e-9 else False def isBetween(x,y,tx,ty,sx,sy): a,b,c = (x-tx)**2+(y-ty)**2,(x-sx)**2+(y-sy)**2,(sx-tx)**2+(sy-ty)**2 if c > b an...
30
27
881
844
def dist(x, y, x1, y1): return (x - x1) ** 2 + (y - y1) ** 2 def inWall(x, y, x1, y1, r): return True if dist(x, y, x1, y1) <= (r + 1e-9) ** 2 else False def isHide(x, y, r, a, b, c): D = abs(a * x + b * y + c) / (a**2 + b**2) ** 0.5 return True if D <= r + 1e-9 else False def isBetween(x, y, tx, ...
def inWall(x, y, x1, y1, r): return True if ((x - x1) ** 2 + (y - y1) ** 2) ** 0.5 <= r + 1e-9 else False def isHide(x, y, r, a, b, c): D = abs(a * x + b * y + c) / (a**2 + b**2) ** 0.5 return True if D <= r + 1e-9 else False def isBetween(x, y, tx, ty, sx, sy): a, b, c = ( (x - tx) ** 2 + (...
false
10
[ "-def dist(x, y, x1, y1):", "- return (x - x1) ** 2 + (y - y1) ** 2", "-", "-", "- return True if dist(x, y, x1, y1) <= (r + 1e-9) ** 2 else False", "+ return True if ((x - x1) ** 2 + (y - y1) ** 2) ** 0.5 <= r + 1e-9 else False", "- a, b, c = dist(x, y, tx, ty), dist(x, y, sx, sy), dist(tx,...
false
0.036915
0.008337
4.427826
[ "s387427255", "s345546294" ]
u729938879
p03127
python
s002940063
s361329192
166
84
19,088
14,224
Accepted
Accepted
49.4
n = int(eval(input())) monster= list(map(int,input().split())) while True: index_list = [i for i, v in enumerate(monster) if v >0] mini = monster[index_list[0]] for i in range(1, len(index_list)): if mini > monster[index_list[i]]: mini = monster[index_list[i]] miniindex_...
n = int(eval(input())) monsters = list(map(int, input().split())) def gcd(a, b): if b == 0: return a else: return gcd(b, a%b) gcd(4,2) def gcd_more(a): ans = a[0] for i in range(1,len(a)): ans = gcd(ans, a[i]) return ans print((gcd_more(monsters)))
22
15
740
301
n = int(eval(input())) monster = list(map(int, input().split())) while True: index_list = [i for i, v in enumerate(monster) if v > 0] mini = monster[index_list[0]] for i in range(1, len(index_list)): if mini > monster[index_list[i]]: mini = monster[index_list[i]] miniindex_list = [i ...
n = int(eval(input())) monsters = list(map(int, input().split())) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) gcd(4, 2) def gcd_more(a): ans = a[0] for i in range(1, len(a)): ans = gcd(ans, a[i]) return ans print((gcd_more(monsters)))
false
31.818182
[ "-monster = list(map(int, input().split()))", "-while True:", "- index_list = [i for i, v in enumerate(monster) if v > 0]", "- mini = monster[index_list[0]]", "- for i in range(1, len(index_list)):", "- if mini > monster[index_list[i]]:", "- mini = monster[index_list[i]]", "...
false
0.040504
0.04036
1.003568
[ "s002940063", "s361329192" ]
u427469869
p02813
python
s993430867
s571324928
49
26
8,052
3,188
Accepted
Accepted
46.94
import itertools n = int(eval(input())) order = list(itertools.permutations([int(x)for x in range(1,n+1)])) P = [int(x) for x in input().split()] Q = [int(x) for x in input().split()] for i in range(len(order)): if P == list(order[i]): P_num = i if Q == list(order[i]): Q_num = i ...
import sys import itertools input = sys.stdin.readline def slove(): n = int(eval(input())) P = tuple(map(int,input().split())) Q = tuple(map(int,input().split())) """ print(P) print(Q) """ count = 0 for item in itertools.permutations(list(range(1,1+n))): if P...
15
25
347
473
import itertools n = int(eval(input())) order = list(itertools.permutations([int(x) for x in range(1, n + 1)])) P = [int(x) for x in input().split()] Q = [int(x) for x in input().split()] for i in range(len(order)): if P == list(order[i]): P_num = i if Q == list(order[i]): Q_num = i print((abs(...
import sys import itertools input = sys.stdin.readline def slove(): n = int(eval(input())) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) """ print(P) print(Q) """ count = 0 for item in itertools.permutations(list(range(1, 1 + n))): if P == item:...
false
40
[ "+import sys", "-n = int(eval(input()))", "-order = list(itertools.permutations([int(x) for x in range(1, n + 1)]))", "-P = [int(x) for x in input().split()]", "-Q = [int(x) for x in input().split()]", "-for i in range(len(order)):", "- if P == list(order[i]):", "- P_num = i", "- if Q =...
false
0.038389
0.03902
0.983843
[ "s993430867", "s571324928" ]
u997641430
p02620
python
s225581157
s073271548
551
507
97,616
97,588
Accepted
Accepted
7.99
d = int(eval(input())) dd = d * (d + 1) // 2 *C, = list(map(int, input().split())) S = [list(map(int, input().split())) for i in range(d)] T = [int(eval(input())) - 1 for i in range(d)] m = int(eval(input())) PQ = [tuple(map(int, input().split())) for k in range(m)] PQ = [(p - 1, q - 1) for p, q in PQ] for p,...
d = int(eval(input())) dd = d * (d + 1) // 2 *C, = list(map(int, input().split())) S = [list(map(int, input().split())) for i in range(d)] def calc_score(T): L = [-1 for j in range(26)] X = [0 for j in range(26)] score = 0 for i in range(d): score += S[i][T[i]] X[T[i]] += (...
21
27
598
652
d = int(eval(input())) dd = d * (d + 1) // 2 (*C,) = list(map(int, input().split())) S = [list(map(int, input().split())) for i in range(d)] T = [int(eval(input())) - 1 for i in range(d)] m = int(eval(input())) PQ = [tuple(map(int, input().split())) for k in range(m)] PQ = [(p - 1, q - 1) for p, q in PQ] for p, q in PQ...
d = int(eval(input())) dd = d * (d + 1) // 2 (*C,) = list(map(int, input().split())) S = [list(map(int, input().split())) for i in range(d)] def calc_score(T): L = [-1 for j in range(26)] X = [0 for j in range(26)] score = 0 for i in range(d): score += S[i][T[i]] X[T[i]] += (d - i) * (...
false
22.222222
[ "-T = [int(eval(input())) - 1 for i in range(d)]", "-m = int(eval(input()))", "-PQ = [tuple(map(int, input().split())) for k in range(m)]", "-PQ = [(p - 1, q - 1) for p, q in PQ]", "-for p, q in PQ:", "- T[p] = q", "+", "+", "+def calc_score(T):", "- print(score)", "+ return score", "...
false
0.05612
0.041108
1.365188
[ "s225581157", "s073271548" ]
u380524497
p02844
python
s890904503
s764204849
1,201
33
3,188
9,196
Accepted
Accepted
97.25
n = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): first_idx = S.find(str(i)) if first_idx == -1: continue for j in range(10): second_idx = S.find(str(j), first_idx+1) if second_idx == -1: continue count = [0] * 10 for k...
import sys input = sys.stdin.readline def main(): n = int(eval(input())) S: str = eval(input()) ans = 0 for s1 in range(10): idx1 = S.find(str(s1)) if idx1 == -1: continue for s2 in range(10): idx2 = S.find(str(s2), idx1+1) if...
24
28
484
554
n = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): first_idx = S.find(str(i)) if first_idx == -1: continue for j in range(10): second_idx = S.find(str(j), first_idx + 1) if second_idx == -1: continue count = [0] * 10 for k in range(second...
import sys input = sys.stdin.readline def main(): n = int(eval(input())) S: str = eval(input()) ans = 0 for s1 in range(10): idx1 = S.find(str(s1)) if idx1 == -1: continue for s2 in range(10): idx2 = S.find(str(s2), idx1 + 1) if idx2 == -1: ...
false
14.285714
[ "-n = int(eval(input()))", "-S = eval(input())", "-ans = 0", "-for i in range(10):", "- first_idx = S.find(str(i))", "- if first_idx == -1:", "- continue", "- for j in range(10):", "- second_idx = S.find(str(j), first_idx + 1)", "- if second_idx == -1:", "+import sy...
false
0.073886
0.04184
1.765918
[ "s890904503", "s764204849" ]
u761529120
p02598
python
s996880335
s842467153
254
189
104,348
104,664
Accepted
Accepted
25.59
from bisect import bisect_left def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() def check(x): index = bisect_left(A,x) ans = 0 for i in range(index,N): if A[i] % x == 0: tmp = (A[i] // x) - 1 ...
from bisect import bisect_left def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() def check(x): index = bisect_left(A,x) ans = 0 for i in range(index,N): tmp = -(-A[i] // x) - 1 ans += tmp i...
32
29
705
620
from bisect import bisect_left def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() def check(x): index = bisect_left(A, x) ans = 0 for i in range(index, N): if A[i] % x == 0: tmp = (A[i] // x) - 1 ...
from bisect import bisect_left def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() def check(x): index = bisect_left(A, x) ans = 0 for i in range(index, N): tmp = -(-A[i] // x) - 1 ans += tmp if ans <=...
false
9.375
[ "- if A[i] % x == 0:", "- tmp = (A[i] // x) - 1", "- else:", "- tmp = A[i] // x", "+ tmp = -(-A[i] // x) - 1" ]
false
0.045842
0.045911
0.998513
[ "s996880335", "s842467153" ]
u279493135
p03965
python
s900547012
s015490490
35
27
4,084
3,956
Accepted
Accepted
22.86
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digi...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digi...
24
21
713
649
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits d...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits d...
false
12.5
[ "-if len(s) % 2 == 0:", "- print((int(len(s) / 2 - p)))", "-else:", "- print((int((len(s) - 1) / 2 - p)))", "+print((len(s) // 2 - p))" ]
false
0.048509
0.045885
1.057168
[ "s900547012", "s015490490" ]
u397496203
p02537
python
s426418528
s980025523
453
403
78,332
75,732
Accepted
Accepted
11.04
import sys # sys.setrecursionlimit(100000) def input(): return sys.stdin.readline().strip() def input_int(): return int(eval(input())) def input_int_list(): return [int(i) for i in input().split()] class SegTree: X_unit = 0 X_f = max def __init__(self, N): ...
import sys # sys.setrecursionlimit(100000) def input(): return sys.stdin.readline().strip() def input_int(): return int(eval(input())) def input_int_list(): return [int(i) for i in input().split()] class SegTree: X_unit = 0 X_f = max def __init__(self, N): ...
71
71
1,495
1,495
import sys # sys.setrecursionlimit(100000) def input(): return sys.stdin.readline().strip() def input_int(): return int(eval(input())) def input_int_list(): return [int(i) for i in input().split()] class SegTree: X_unit = 0 X_f = max def __init__(self, N): self.N = N self...
import sys # sys.setrecursionlimit(100000) def input(): return sys.stdin.readline().strip() def input_int(): return int(eval(input())) def input_int_list(): return [int(i) for i in input().split()] class SegTree: X_unit = 0 X_f = max def __init__(self, N): self.N = N self...
false
0
[ "- segtree = SegTree(500000)", "+ segtree = SegTree(300001)", "- val = segtree.fold(max(0, a - k), min(500000, a + k + 1))", "+ val = segtree.fold(max(0, a - k), min(300001, a + k + 1))" ]
false
0.008586
0.043618
0.196858
[ "s426418528", "s980025523" ]
u334712262
p02564
python
s570201984
s825991831
2,640
2,415
366,652
381,968
Accepted
Accepted
8.52
from collections import defaultdict import sys sys.setrecursionlimit(10**6) def scc(N, g, rg): V = list(range(N)) def dfs(u, done, o): done.add(u) for v in g[u]: if v in done: continue done.add(v) dfs(v, done, o) o.a...
from collections import defaultdict import sys sys.setrecursionlimit(10**6) def scc(V, E): g = defaultdict(list) rg = defaultdict(list) for u, v in E: g[u].append(v) rg[v].append(u) def dfs(u, done, o): done.add(u) for v in g[u]: if v in done...
85
87
1,519
1,567
from collections import defaultdict import sys sys.setrecursionlimit(10**6) def scc(N, g, rg): V = list(range(N)) def dfs(u, done, o): done.add(u) for v in g[u]: if v in done: continue done.add(v) dfs(v, done, o) o.append(u) de...
from collections import defaultdict import sys sys.setrecursionlimit(10**6) def scc(V, E): g = defaultdict(list) rg = defaultdict(list) for u, v in E: g[u].append(v) rg[v].append(u) def dfs(u, done, o): done.add(u) for v in g[u]: if v in done: ...
false
2.298851
[ "-def scc(N, g, rg):", "- V = list(range(N))", "+def scc(V, E):", "+ g = defaultdict(list)", "+ rg = defaultdict(list)", "+ for u, v in E:", "+ g[u].append(v)", "+ rg[v].append(u)", "- g = defaultdict(list)", "- rg = defaultdict(list)", "+ E = []", "- ...
false
0.048904
0.047553
1.028422
[ "s570201984", "s825991831" ]
u564902833
p03482
python
s672999509
s178388170
42
38
5,164
3,188
Accepted
Accepted
9.52
from itertools import takewhile S = eval(input()) # 中央から同一の数字が何個並ぶかによって解は求まる N = len(S) M = N // 2 ans = M + len( list( takewhile( lambda i: S[M] == S[M - i - 1] == S[M + i] if N % 2 == 0 else S[M] == S[M - i] == S[M + i], list(range(N...
S = eval(input()) # 中央から同一の数字が何個並ぶかによって解は求まる N = len(S) M = N // 2 ans = M + next( ( i for i in range(N - M) if ( S[M - i - 1] != S[M] or S[M + i] != S[M] if N % 2 == 0 else S[M - i] != S[M] or S[M + i] != S[M] ) ), N - M ) print(ans...
20
18
350
316
from itertools import takewhile S = eval(input()) # 中央から同一の数字が何個並ぶかによって解は求まる N = len(S) M = N // 2 ans = M + len( list( takewhile( lambda i: S[M] == S[M - i - 1] == S[M + i] if N % 2 == 0 else S[M] == S[M - i] == S[M + i], list(range(N - M)), ) ) ...
S = eval(input()) # 中央から同一の数字が何個並ぶかによって解は求まる N = len(S) M = N // 2 ans = M + next( ( i for i in range(N - M) if ( S[M - i - 1] != S[M] or S[M + i] != S[M] if N % 2 == 0 else S[M - i] != S[M] or S[M + i] != S[M] ) ), N - M, ) print(ans)
false
10
[ "-from itertools import takewhile", "-", "-ans = M + len(", "- list(", "- takewhile(", "- lambda i: S[M] == S[M - i - 1] == S[M + i]", "+ans = M + next(", "+ (", "+ i", "+ for i in range(N - M)", "+ if (", "+ S[M - i - 1] != S[M] or S[M +...
false
0.050084
0.213317
0.234789
[ "s672999509", "s178388170" ]
u073852194
p03837
python
s135651048
s393155716
264
120
43,372
74,412
Accepted
Accepted
54.55
INF = 10**18 N,M = list(map(int,input().split())) edge = [list(map(int,input().split())) for _ in range(M)] graph = [[INF for j in range(N)] for i in range(N)] for i in range(N): graph[i][i] = 0 for e in edge: graph[e[0]-1][e[1]-1] = e[2] graph[e[1]-1][e[0]-1] = e[2] for k in range(N): ...
class Graph(): #non-directed def __init__(self, n, edge, indexed=1): self.n = n self.edge = edge self.indexed = indexed self.graph = [[] for _ in range(n)] for e in edge: self.graph[e[0] - indexed].append((e[1] - indexed, e[2])) self.graph[e[1...
26
39
604
1,182
INF = 10**18 N, M = list(map(int, input().split())) edge = [list(map(int, input().split())) for _ in range(M)] graph = [[INF for j in range(N)] for i in range(N)] for i in range(N): graph[i][i] = 0 for e in edge: graph[e[0] - 1][e[1] - 1] = e[2] graph[e[1] - 1][e[0] - 1] = e[2] for k in range(N): for i ...
class Graph: # non-directed def __init__(self, n, edge, indexed=1): self.n = n self.edge = edge self.indexed = indexed self.graph = [[] for _ in range(n)] for e in edge: self.graph[e[0] - indexed].append((e[1] - indexed, e[2])) self.graph[e[1] - index...
false
33.333333
[ "-INF = 10**18", "+class Graph: # non-directed", "+ def __init__(self, n, edge, indexed=1):", "+ self.n = n", "+ self.edge = edge", "+ self.indexed = indexed", "+ self.graph = [[] for _ in range(n)]", "+ for e in edge:", "+ self.graph[e[0] - indexed]...
false
0.040417
0.047749
0.846447
[ "s135651048", "s393155716" ]
u773265208
p02996
python
s914111402
s633946699
1,540
1,232
112,932
55,752
Accepted
Accepted
20
import heapq import copy import bisect from collections import deque n = int(eval(input())) a = [] b = [] tmp_a = [] tmp_b = [] flag = True for _ in range(n): a_dash,b_dash = list(map(int,input().split())) tmp_a.append(a_dash) tmp_b.append(b_dash) k = list(zip(tmp_b,tmp_a)) sorted_k = sorted(k) ...
from collections import deque import sys n = int(eval(input())) ab = [] for _ in range(n): ab.append(list(map(int,input().split()))) ab = sorted(ab, key=lambda x:x[1], reverse=True) d = [] d = deque(d) num = 0 while len(ab) > 0: d = deque([]) d.append(ab.pop()) while True: if len(ab) == 0: ...
39
32
597
507
import heapq import copy import bisect from collections import deque n = int(eval(input())) a = [] b = [] tmp_a = [] tmp_b = [] flag = True for _ in range(n): a_dash, b_dash = list(map(int, input().split())) tmp_a.append(a_dash) tmp_b.append(b_dash) k = list(zip(tmp_b, tmp_a)) sorted_k = sorted(k) for b_da...
from collections import deque import sys n = int(eval(input())) ab = [] for _ in range(n): ab.append(list(map(int, input().split()))) ab = sorted(ab, key=lambda x: x[1], reverse=True) d = [] d = deque(d) num = 0 while len(ab) > 0: d = deque([]) d.append(ab.pop()) while True: if len(ab) == 0: ...
false
17.948718
[ "-import heapq", "-import copy", "-import bisect", "+import sys", "-a = []", "-b = []", "-tmp_a = []", "-tmp_b = []", "-flag = True", "+ab = []", "- a_dash, b_dash = list(map(int, input().split()))", "- tmp_a.append(a_dash)", "- tmp_b.append(b_dash)", "-k = list(zip(tmp_b, tmp_a))...
false
0.100669
0.101343
0.993346
[ "s914111402", "s633946699" ]
u013956357
p02713
python
s046516649
s863941526
1,945
1,776
9,096
9,168
Accepted
Accepted
8.69
from math import gcd k=int(eval(input())) r=0 for i in range(1,k+1): for j in range(1,k+1): for l in range(1,k+1): r+=gcd(gcd(i,j),l) print(r)
from math import gcd k = int(eval(input())) total = 0 for a in range(1,k+1): for b in range(1,k+1): for c in range(1,k+1): total += gcd(gcd(a,b),c) print(total)
9
11
177
194
from math import gcd k = int(eval(input())) r = 0 for i in range(1, k + 1): for j in range(1, k + 1): for l in range(1, k + 1): r += gcd(gcd(i, j), l) print(r)
from math import gcd k = int(eval(input())) total = 0 for a in range(1, k + 1): for b in range(1, k + 1): for c in range(1, k + 1): total += gcd(gcd(a, b), c) print(total)
false
18.181818
[ "-r = 0", "-for i in range(1, k + 1):", "- for j in range(1, k + 1):", "- for l in range(1, k + 1):", "- r += gcd(gcd(i, j), l)", "-print(r)", "+total = 0", "+for a in range(1, k + 1):", "+ for b in range(1, k + 1):", "+ for c in range(1, k + 1):", "+ to...
false
0.006743
0.176452
0.038213
[ "s046516649", "s863941526" ]
u602702913
p02388
python
s320266685
s635263827
30
20
7,576
7,696
Accepted
Accepted
33.33
print((int(eval(input()))**3))
a=int(eval(input())) print((a*a*a))
1
2
22
28
print((int(eval(input())) ** 3))
a = int(eval(input())) print((a * a * a))
false
50
[ "-print((int(eval(input())) ** 3))", "+a = int(eval(input()))", "+print((a * a * a))" ]
false
0.117907
0.08993
1.311088
[ "s320266685", "s635263827" ]
u059210959
p03730
python
s096571567
s758946765
1,067
55
6,800
6,600
Accepted
Accepted
94.85
# encoding:utf-8 import copy import random import bisect #bisect_left これで二部探索の大小検索が行える import fractions #最小公倍数などはこっち import math mod = 10**9+7 A,B,C = list(map(int,input().split())) extra = [] import time now = time.time() mod = A while True: mod += A if mod % B == C: print("YES...
# encoding:utf-8 import copy import random import bisect #bisect_left これで二部探索の大小検索が行える import fractions #最小公倍数などはこっち import math mod = 10**9+7 A,B,C = list(map(int,input().split())) extra = [] import time now = time.time() for i in range(B): if i*A % B == C: print("YES") brea...
26
23
399
357
# encoding:utf-8 import copy import random import bisect # bisect_left これで二部探索の大小検索が行える import fractions # 最小公倍数などはこっち import math mod = 10**9 + 7 A, B, C = list(map(int, input().split())) extra = [] import time now = time.time() mod = A while True: mod += A if mod % B == C: print("YES") bre...
# encoding:utf-8 import copy import random import bisect # bisect_left これで二部探索の大小検索が行える import fractions # 最小公倍数などはこっち import math mod = 10**9 + 7 A, B, C = list(map(int, input().split())) extra = [] import time now = time.time() for i in range(B): if i * A % B == C: print("YES") break if i ...
false
11.538462
[ "-mod = A", "-while True:", "- mod += A", "- if mod % B == C:", "+for i in range(B):", "+ if i * A % B == C:", "- if time.time() - now > 1:", "+ if i == B - 1:", "- break" ]
false
0.498839
0.044106
11.309924
[ "s096571567", "s758946765" ]
u347640436
p03107
python
s447010157
s313199201
22
18
3,956
3,316
Accepted
Accepted
18.18
s = eval(input()) t = len([c for c in s if c == '0']) print((2 * min(t, len(s) - t)))
s = eval(input()) t = s.count('0') print((2 * min(t, len(s) - t)))
3
3
80
61
s = eval(input()) t = len([c for c in s if c == "0"]) print((2 * min(t, len(s) - t)))
s = eval(input()) t = s.count("0") print((2 * min(t, len(s) - t)))
false
0
[ "-t = len([c for c in s if c == \"0\"])", "+t = s.count(\"0\")" ]
false
0.034285
0.033817
1.013841
[ "s447010157", "s313199201" ]
u508732591
p02257
python
s841312940
s499263353
200
70
7,776
7,712
Accepted
Accepted
65
def maybe_prime(d,s,n): for a in (2,3,5,7): p = False x = pow(a,d,n) if x==1 or x==n-1: continue for i in range(1,s): x = x*x%n if x==1: return False elif x == n-1: p = True break if n...
def maybe_prime(d,s,n): for a in (2,3,5,7): p = False x = pow(a,d,n) if x==1 or x==n-1: continue for i in range(1,s): x = x*x%n if x==1: return False elif x == n-1: p = True break if n...
31
31
756
755
def maybe_prime(d, s, n): for a in (2, 3, 5, 7): p = False x = pow(a, d, n) if x == 1 or x == n - 1: continue for i in range(1, s): x = x * x % n if x == 1: return False elif x == n - 1: p = True ...
def maybe_prime(d, s, n): for a in (2, 3, 5, 7): p = False x = pow(a, d, n) if x == 1 or x == n - 1: continue for i in range(1, s): x = x * x % n if x == 1: return False elif x == n - 1: p = True ...
false
0
[ "- elif 0 in [n % i for i in range(11, min(n - 1, 1000), 2)]:", "+ elif 0 in [n % i for i in range(11, min(n - 1, 100), 2)]:" ]
false
0.043749
0.081778
0.534973
[ "s841312940", "s499263353" ]
u938486382
p03088
python
s943323392
s004271887
239
203
7,764
7,616
Accepted
Accepted
15.06
n = int(eval(input())) ans = 0 hoges = [] seeds = 'ATCG' def ng(currents): v = 'AGC' in currents # for k in range(max(1, 0), len(currents)): for k in range(max(1, len(currents) - 3), len(currents)): v = v or 'AGC' in (currents[:k-1] + currents[k] + currents[k-1] + currents[k+1:]) return v memo = {...
n = int(eval(input())) seeds = 'ATCG' def ng(currents): v = 'AGC' in currents for k in range(max(1, len(currents) - 3), len(currents)): # 先頭の方はチェック済み v = v or 'AGC' in (currents[:k-1] + currents[k] + currents[k-1] + currents[k+1:]) return v memo = {} # 今の長さと最新4つだけメモする def f(index, currents): ke...
36
19
828
567
n = int(eval(input())) ans = 0 hoges = [] seeds = "ATCG" def ng(currents): v = "AGC" in currents # for k in range(max(1, 0), len(currents)): for k in range(max(1, len(currents) - 3), len(currents)): v = v or "AGC" in ( currents[: k - 1] + currents[k] + currents[k - 1] + currents[k + 1 ...
n = int(eval(input())) seeds = "ATCG" def ng(currents): v = "AGC" in currents for k in range(max(1, len(currents) - 3), len(currents)): # 先頭の方はチェック済み v = v or "AGC" in ( currents[: k - 1] + currents[k] + currents[k - 1] + currents[k + 1 :] ) return v memo = {} # 今の長さと最新4つだけ...
false
47.222222
[ "-ans = 0", "-hoges = []", "- # for k in range(max(1, 0), len(currents)):", "- for k in range(max(1, len(currents) - 3), len(currents)):", "+ for k in range(max(1, len(currents) - 3), len(currents)): # 先頭の方はチェック済み", "-memo = {}", "-ng_memo = {} # 後ろ4つだけ見ればNGわかる?", "+memo = {} # 今の長さと最新4つだけ...
false
0.303471
0.150984
2.009954
[ "s943323392", "s004271887" ]
u100641536
p03607
python
s072388070
s679379254
233
166
101,188
24,092
Accepted
Accepted
28.76
n=int(eval(input())) a = [eval(input()) for _ in range(n)] a.sort() dict = {} count = 0 for i in range(n): k = a[i] if (k in dict): count-=dict[k] dict[k]=1-dict[k] count+=dict[k] else: dict[k]=1 count+=1 print(count)
from collections import Counter n=int(eval(input())) a = [eval(input()) for _ in range(n)] c = Counter(a) count = 0 for i in list(c.keys()): count += c[i]%2 print(count)
15
9
245
162
n = int(eval(input())) a = [eval(input()) for _ in range(n)] a.sort() dict = {} count = 0 for i in range(n): k = a[i] if k in dict: count -= dict[k] dict[k] = 1 - dict[k] count += dict[k] else: dict[k] = 1 count += 1 print(count)
from collections import Counter n = int(eval(input())) a = [eval(input()) for _ in range(n)] c = Counter(a) count = 0 for i in list(c.keys()): count += c[i] % 2 print(count)
false
40
[ "+from collections import Counter", "+", "-a.sort()", "-dict = {}", "+c = Counter(a)", "-for i in range(n):", "- k = a[i]", "- if k in dict:", "- count -= dict[k]", "- dict[k] = 1 - dict[k]", "- count += dict[k]", "- else:", "- dict[k] = 1", "- c...
false
0.052697
0.063903
0.824635
[ "s072388070", "s679379254" ]
u557437077
p03450
python
s729448412
s248679629
1,447
1,309
29,808
29,808
Accepted
Accepted
9.54
class WeightedUnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) # 根への距離を管理 self.weight = [0] * (n + 1) # 検索 def find(self, x): # xの親を返す if self.par[x] == x: return x else: y =...
class WeightedUnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) # 根への距離を管理 self.weight = [0] * (n + 1) # 検索 def find(self, x): # xの親を返す if self.par[x] == x: return x else: y =...
63
66
1,816
1,876
class WeightedUnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) # 根への距離を管理 self.weight = [0] * (n + 1) # 検索 def find(self, x): # xの親を返す if self.par[x] == x: return x else: y = self.find(s...
class WeightedUnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) # 根への距離を管理 self.weight = [0] * (n + 1) # 検索 def find(self, x): # xの親を返す if self.par[x] == x: return x else: y = self.find(s...
false
4.545455
[ "+ def show(self):", "+ for i in range(1, n + 1):", "+ print((\"node:{} par:{} w:{}\".format(i, union.par[i], union.weight[i])))", "+", "-# for i in range(1, n+1):", "-# print(\"{} par:{} w:{}\".format(i, union.par[i], union.weight[i]))", "+# union.show()" ]
false
0.03306
0.040629
0.81369
[ "s729448412", "s248679629" ]
u634208461
p03109
python
s627020560
s527645197
164
17
38,384
2,940
Accepted
Accepted
89.63
S = eval(input()) m = S[5:7] if int(m) <= 4: print('Heisei') else: print('TBD')
y, m, d = list(map(int, input().split('/'))) if int(m) <= 4: print('Heisei') else: print('TBD')
6
5
86
101
S = eval(input()) m = S[5:7] if int(m) <= 4: print("Heisei") else: print("TBD")
y, m, d = list(map(int, input().split("/"))) if int(m) <= 4: print("Heisei") else: print("TBD")
false
16.666667
[ "-S = eval(input())", "-m = S[5:7]", "+y, m, d = list(map(int, input().split(\"/\")))" ]
false
0.04102
0.037461
1.095012
[ "s627020560", "s527645197" ]
u721316601
p03634
python
s136915942
s302879318
1,678
1,472
61,820
47,024
Accepted
Accepted
12.28
import heapq N = int(eval(input())) tree = {i+1:[] for i in range(N)} route = [10**20 for i in range(N+1)] visited = [False for i in range(N+1)] for i in range(N-1): a, b, c = list(map(int, input().split())) tree[a].append((c, b)) tree[b].append((c, a)) Q, K = list(map(int, input().split())...
import heapq N = int(eval(input())) graph = [[] for i in range(N+1)] visited = [False] * (N+1) cost = [10**20 for i in range(N+1)] for i in range(N-1): a, b, c = list(map(int, input().split())) graph[a].append((c, b)) graph[b].append((c, a)) Q, K = list(map(int, input().split())) q = [] ...
30
34
726
736
import heapq N = int(eval(input())) tree = {i + 1: [] for i in range(N)} route = [10**20 for i in range(N + 1)] visited = [False for i in range(N + 1)] for i in range(N - 1): a, b, c = list(map(int, input().split())) tree[a].append((c, b)) tree[b].append((c, a)) Q, K = list(map(int, input().split())) route...
import heapq N = int(eval(input())) graph = [[] for i in range(N + 1)] visited = [False] * (N + 1) cost = [10**20 for i in range(N + 1)] for i in range(N - 1): a, b, c = list(map(int, input().split())) graph[a].append((c, b)) graph[b].append((c, a)) Q, K = list(map(int, input().split())) q = [] for cr in g...
false
11.764706
[ "-tree = {i + 1: [] for i in range(N)}", "-route = [10**20 for i in range(N + 1)]", "-visited = [False for i in range(N + 1)]", "+graph = [[] for i in range(N + 1)]", "+visited = [False] * (N + 1)", "+cost = [10**20 for i in range(N + 1)]", "- tree[a].append((c, b))", "- tree[b].append((c, a))",...
false
0.07973
0.038594
2.065879
[ "s136915942", "s302879318" ]
u353895424
p03387
python
s822903053
s341082132
173
17
38,256
3,060
Accepted
Accepted
90.17
a ,b, c = list(map(int, input().split())) m = max(a, b, c) for i in range(100000): mod1 = 3*(m + i) % 2 mod2 = (a + b + c) % 2 if mod1 == mod2: print(((3*(m + i) - (a + b + c))//2)) exit()
import math l = list(map(int, input().split())) l.sort() a, b, c = l[0], l[1], l[2] if (b-a)%2 == 0: ans = c-b+(b-a)//2 else: ans = c-b+math.ceil((b-a)/2) + 1 print(ans)
8
10
243
187
a, b, c = list(map(int, input().split())) m = max(a, b, c) for i in range(100000): mod1 = 3 * (m + i) % 2 mod2 = (a + b + c) % 2 if mod1 == mod2: print(((3 * (m + i) - (a + b + c)) // 2)) exit()
import math l = list(map(int, input().split())) l.sort() a, b, c = l[0], l[1], l[2] if (b - a) % 2 == 0: ans = c - b + (b - a) // 2 else: ans = c - b + math.ceil((b - a) / 2) + 1 print(ans)
false
20
[ "-a, b, c = list(map(int, input().split()))", "-m = max(a, b, c)", "-for i in range(100000):", "- mod1 = 3 * (m + i) % 2", "- mod2 = (a + b + c) % 2", "- if mod1 == mod2:", "- print(((3 * (m + i) - (a + b + c)) // 2))", "- exit()", "+import math", "+", "+l = list(map(int, ...
false
0.047313
0.085699
0.552077
[ "s822903053", "s341082132" ]
u211306418
p02888
python
s572940722
s887508036
1,437
1,287
3,188
3,188
Accepted
Accepted
10.44
from bisect import bisect from bisect import bisect_left n = int(eval(input())) l = eval(input()) l = sorted(list(map(int, l.split()))) count = 0 for i in range(n): for j in range(i+1, n): c = l[i]+l[j] count += bisect_left(l,c) - (j+1) print(count)
from bisect import bisect from bisect import bisect_left _ = eval(input()) l = eval(input()) l = sorted(list(map(int, l.split()))) count = 0 for i in range(len(l)): for j in range(i+1, len(l)): count += bisect_left(l,l[i]+l[j]) - (j+1) print(count)
14
14
259
259
from bisect import bisect from bisect import bisect_left n = int(eval(input())) l = eval(input()) l = sorted(list(map(int, l.split()))) count = 0 for i in range(n): for j in range(i + 1, n): c = l[i] + l[j] count += bisect_left(l, c) - (j + 1) print(count)
from bisect import bisect from bisect import bisect_left _ = eval(input()) l = eval(input()) l = sorted(list(map(int, l.split()))) count = 0 for i in range(len(l)): for j in range(i + 1, len(l)): count += bisect_left(l, l[i] + l[j]) - (j + 1) print(count)
false
0
[ "-n = int(eval(input()))", "+_ = eval(input())", "-for i in range(n):", "- for j in range(i + 1, n):", "- c = l[i] + l[j]", "- count += bisect_left(l, c) - (j + 1)", "+for i in range(len(l)):", "+ for j in range(i + 1, len(l)):", "+ count += bisect_left(l, l[i] + l[j]) - (...
false
0.064205
0.047049
1.364655
[ "s572940722", "s887508036" ]
u957167787
p03828
python
s688800487
s289636933
27
19
3,064
3,064
Accepted
Accepted
29.63
import math N = int(eval(input())) MOD = 10 ** 9 + 7 # 試し割り法(2以外の偶数は捨てる方法を追加) def check_prime(n): flag = True # n:evenかつ2でないならば素数でない # n=1は素数でない,n=0も実装しやすいように入れておく if (n % 2 == 0 and n != 2) or n == 0 or n == 1: flag = False return(flag) # n:oddまたは2のときは考える e...
# こちらの方がやや高速 import math N = int(eval(input())) MOD = 10 ** 9 + 7 # 試し割り法(2以外の偶数は捨てる方法を追加) def check_prime(n): flag = True # n:evenかつ2でないならば素数でない # n=1は素数でない,n=0も実装しやすいように入れておく if (n % 2 == 0 and n != 2) or n == 0 or n == 1: flag = False return(flag) # n:oddまたは2...
48
45
945
839
import math N = int(eval(input())) MOD = 10**9 + 7 # 試し割り法(2以外の偶数は捨てる方法を追加) def check_prime(n): flag = True # n:evenかつ2でないならば素数でない # n=1は素数でない,n=0も実装しやすいように入れておく if (n % 2 == 0 and n != 2) or n == 0 or n == 1: flag = False return flag # n:oddまたは2のときは考える else: # 2からrootnま...
# こちらの方がやや高速 import math N = int(eval(input())) MOD = 10**9 + 7 # 試し割り法(2以外の偶数は捨てる方法を追加) def check_prime(n): flag = True # n:evenかつ2でないならば素数でない # n=1は素数でない,n=0も実装しやすいように入れておく if (n % 2 == 0 and n != 2) or n == 0 or n == 1: flag = False return flag # n:oddまたは2のときは考える else: ...
false
6.25
[ "+# こちらの方がやや高速", "-cnt = [0] * M # primeで割れる個数を格納", "-for i in range(1, N + 1):", "- for j in range(M):", "- p = prime[j]", "- if p > i:", "- break", "- else:", "- while i % p == 0:", "- i //= p", "- cnt[j] += 1", "+c...
false
0.007069
0.079528
0.088893
[ "s688800487", "s289636933" ]
u098012509
p03363
python
s041385922
s170640272
184
166
41,544
44,184
Accepted
Accepted
9.78
import sys import collections sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N = int(eval(input())) A = [int(x) for x in input().split()] ruiseki = [0] * (N + 1) for i, a in enumerate(A): ruiseki[i] = ruiseki[i - 1] + a c = collections.Counter(rui...
import collections N = int(eval(input())) A = [int(x) for x in input().split()] ruiseki = [0] for a in A: ruiseki.append(ruiseki[-1] + a) c = collections.Counter(ruiseki) ans = 0 for k in list(c.keys()): if c[k] >= 2: ans += c[k] * (c[k] - 1) // 2 print(ans)
27
18
450
286
import sys import collections sys.setrecursionlimit(10**8) input = sys.stdin.readline def main(): N = int(eval(input())) A = [int(x) for x in input().split()] ruiseki = [0] * (N + 1) for i, a in enumerate(A): ruiseki[i] = ruiseki[i - 1] + a c = collections.Counter(ruiseki) ans = 0 ...
import collections N = int(eval(input())) A = [int(x) for x in input().split()] ruiseki = [0] for a in A: ruiseki.append(ruiseki[-1] + a) c = collections.Counter(ruiseki) ans = 0 for k in list(c.keys()): if c[k] >= 2: ans += c[k] * (c[k] - 1) // 2 print(ans)
false
33.333333
[ "-import sys", "-sys.setrecursionlimit(10**8)", "-input = sys.stdin.readline", "-", "-", "-def main():", "- N = int(eval(input()))", "- A = [int(x) for x in input().split()]", "- ruiseki = [0] * (N + 1)", "- for i, a in enumerate(A):", "- ruiseki[i] = ruiseki[i - 1] + a", "-...
false
0.03901
0.039785
0.980517
[ "s041385922", "s170640272" ]
u980322611
p02758
python
s460140050
s697399602
1,944
1,322
122,804
114,484
Accepted
Accepted
32
class SegTree: def __init__(self, init_val, ide_ele, segfunc): self.n = len(init_val) self.num =2**(self.n-1).bit_length() self.ide_ele = ide_ele self.seg = [self.ide_ele]*2*self.num self.segfunc = segfunc #set_val for i in range(self.n): ...
class SegTree: def __init__(self, init_val, ide_ele, segfunc): self.n = len(init_val) self.num =2**(self.n-1).bit_length() self.ide_ele = ide_ele self.seg = [self.ide_ele]*2*self.num self.segfunc = segfunc #set_val for i in range(self.n): ...
88
91
2,084
2,126
class SegTree: def __init__(self, init_val, ide_ele, segfunc): self.n = len(init_val) self.num = 2 ** (self.n - 1).bit_length() self.ide_ele = ide_ele self.seg = [self.ide_ele] * 2 * self.num self.segfunc = segfunc # set_val for i in range(self.n): ...
class SegTree: def __init__(self, init_val, ide_ele, segfunc): self.n = len(init_val) self.num = 2 ** (self.n - 1).bit_length() self.ide_ele = ide_ele self.seg = [self.ide_ele] * 2 * self.num self.segfunc = segfunc # set_val for i in range(self.n): ...
false
3.296703
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.048327
0.039565
1.221469
[ "s460140050", "s697399602" ]
u191874006
p03282
python
s846663851
s267763627
306
165
20,420
38,384
Accepted
Accepted
46.08
#!/usr/bin/env python3 import numpy as np import math import re S = eval(input()) K = eval(input()) for i in range(int(K)): if(S[i] != '1'): print((S[i])) exit() print((1))
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from...
13
32
190
731
#!/usr/bin/env python3 import numpy as np import math import re S = eval(input()) K = eval(input()) for i in range(int(K)): if S[i] != "1": print((S[i])) exit() print((1))
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop, heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collectio...
false
59.375
[ "-import numpy as np", "+import sys", "-import re", "+from bisect import bisect_right as br", "+from bisect import bisect_left as bl", "-S = eval(input())", "-K = eval(input())", "-for i in range(int(K)):", "- if S[i] != \"1\":", "- print((S[i]))", "- exit()", "-print((1))", ...
false
0.037021
0.104746
0.353431
[ "s846663851", "s267763627" ]
u325956328
p03212
python
s505654279
s863901222
69
56
3,060
3,060
Accepted
Accepted
18.84
N = int(eval(input())) def dfs(s): if int(s) > N: return 0 if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0: ret = 1 # print(s) else: ret = 0 ret += dfs(s + "7") ret += dfs(s + "5") ret += dfs(s + "3") return ret print((dfs("0...
N = int(eval(input())) def dfs(x): if x > N: return 0 s = str(x) if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0: ret = 1 # print(x) else: ret = 0 ret += dfs(10 * x + 7) ret += dfs(10 * x + 5) ret += dfs(10 * x + 3) return re...
19
20
319
337
N = int(eval(input())) def dfs(s): if int(s) > N: return 0 if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0: ret = 1 # print(s) else: ret = 0 ret += dfs(s + "7") ret += dfs(s + "5") ret += dfs(s + "3") return ret print((dfs("0")))
N = int(eval(input())) def dfs(x): if x > N: return 0 s = str(x) if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0: ret = 1 # print(x) else: ret = 0 ret += dfs(10 * x + 7) ret += dfs(10 * x + 5) ret += dfs(10 * x + 3) return ret print((dfs(...
false
5
[ "-def dfs(s):", "- if int(s) > N:", "+def dfs(x):", "+ if x > N:", "+ s = str(x)", "- # print(s)", "+ # print(x)", "- ret += dfs(s + \"7\")", "- ret += dfs(s + \"5\")", "- ret += dfs(s + \"3\")", "+ ret += dfs(10 * x + 7)", "+ ret += dfs(10 * x + 5)", "+...
false
0.058176
0.043296
1.343687
[ "s505654279", "s863901222" ]
u357751375
p03140
python
s931510715
s028137860
29
26
9,128
9,124
Accepted
Accepted
10.34
n = int(eval(input())) a = eval(input()) b = eval(input()) c = eval(input()) p = 0 for i in range(n): if a[i] == b[i] == c[i]: pass else: if a[i] == b[i]: p += 1 elif b[i] == c[i]: p += 1 elif a[i] == c[i]: p += 1 else:...
n = int(eval(input())) a = list(eval(input())) b = list(eval(input())) c = list(eval(input())) ans = 0 for i in range(n): l = [a[i],b[i],c[i]] l = list(set(l)) if len(l) == 3: ans += 2 elif len(l) == 2: ans += 1 else: pass print(ans)
20
15
328
267
n = int(eval(input())) a = eval(input()) b = eval(input()) c = eval(input()) p = 0 for i in range(n): if a[i] == b[i] == c[i]: pass else: if a[i] == b[i]: p += 1 elif b[i] == c[i]: p += 1 elif a[i] == c[i]: p += 1 else: p +=...
n = int(eval(input())) a = list(eval(input())) b = list(eval(input())) c = list(eval(input())) ans = 0 for i in range(n): l = [a[i], b[i], c[i]] l = list(set(l)) if len(l) == 3: ans += 2 elif len(l) == 2: ans += 1 else: pass print(ans)
false
25
[ "-a = eval(input())", "-b = eval(input())", "-c = eval(input())", "-p = 0", "+a = list(eval(input()))", "+b = list(eval(input()))", "+c = list(eval(input()))", "+ans = 0", "- if a[i] == b[i] == c[i]:", "+ l = [a[i], b[i], c[i]]", "+ l = list(set(l))", "+ if len(l) == 3:", "+ ...
false
0.043247
0.042845
1.009368
[ "s931510715", "s028137860" ]
u546285759
p00515
python
s334560551
s531668663
30
20
7,568
7,680
Accepted
Accepted
33.33
a = [] for _ in range(5): x = int(eval(input())) a.append(x if x>= 40 else 40) print((sum(a)//5))
scores = [int(eval(input())) for _ in range(5)] print((sum([(score < 40) * 40 + (score >= 40) * score for score in scores]) // 5))
5
2
101
123
a = [] for _ in range(5): x = int(eval(input())) a.append(x if x >= 40 else 40) print((sum(a) // 5))
scores = [int(eval(input())) for _ in range(5)] print((sum([(score < 40) * 40 + (score >= 40) * score for score in scores]) // 5))
false
60
[ "-a = []", "-for _ in range(5):", "- x = int(eval(input()))", "- a.append(x if x >= 40 else 40)", "-print((sum(a) // 5))", "+scores = [int(eval(input())) for _ in range(5)]", "+print((sum([(score < 40) * 40 + (score >= 40) * score for score in scores]) // 5))" ]
false
0.034264
0.035818
0.956611
[ "s334560551", "s531668663" ]
u561231954
p02713
python
s807744307
s101865015
498
204
67,752
89,760
Accepted
Accepted
59.04
MOD = 10 ** 9 + 7 INF = 10 ** 12 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from itertools import permutations from math import gcd def main(): k = int(eval(input())) ans = 0 for i in range(1,k + 1): for j in range(1,k + 1): for l in range...
import numpy as np k = int(eval(input())) a = np.arange(1,k + 1) ans = np.gcd.outer(np.gcd.outer(a,a),a).sum() print(ans)
19
5
421
119
MOD = 10**9 + 7 INF = 10**12 import sys sys.setrecursionlimit(100000000) dy = (-1, 0, 1, 0) dx = (0, 1, 0, -1) from itertools import permutations from math import gcd def main(): k = int(eval(input())) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): for l in range(1, k + 1...
import numpy as np k = int(eval(input())) a = np.arange(1, k + 1) ans = np.gcd.outer(np.gcd.outer(a, a), a).sum() print(ans)
false
73.684211
[ "-MOD = 10**9 + 7", "-INF = 10**12", "-import sys", "+import numpy as np", "-sys.setrecursionlimit(100000000)", "-dy = (-1, 0, 1, 0)", "-dx = (0, 1, 0, -1)", "-from itertools import permutations", "-from math import gcd", "-", "-", "-def main():", "- k = int(eval(input()))", "- ans =...
false
0.046792
0.233783
0.200152
[ "s807744307", "s101865015" ]
u844789719
p04013
python
s999658092
s470753507
79
69
3,188
3,188
Accepted
Accepted
12.66
N, A = [int(_) for _ in input().split()] X = [int(_) - A for _ in input().split()] dp = [0] * 3000 + [1] + [0] * 3000 for x in X: dp_old = dp.copy() for i in range(max(-x, 0), min(6001, 6001 - x)): dp[i + x] += dp_old[i] print((dp[3000] - 1))
N, A = [int(_) for _ in input().split()] X = [int(_) - A for _ in input().split()] M = max(X + [A]) dp = [0] * (2 * N * M + 1) dp[N * M] = 1 for x in X: dp_old = dp.copy() for i in range(max(-x, 0), min(2 * N * M + 1, 2 * N * M + 1 - x)): dp[i + x] += dp_old[i] print((dp[N * M] - 1))
8
10
264
308
N, A = [int(_) for _ in input().split()] X = [int(_) - A for _ in input().split()] dp = [0] * 3000 + [1] + [0] * 3000 for x in X: dp_old = dp.copy() for i in range(max(-x, 0), min(6001, 6001 - x)): dp[i + x] += dp_old[i] print((dp[3000] - 1))
N, A = [int(_) for _ in input().split()] X = [int(_) - A for _ in input().split()] M = max(X + [A]) dp = [0] * (2 * N * M + 1) dp[N * M] = 1 for x in X: dp_old = dp.copy() for i in range(max(-x, 0), min(2 * N * M + 1, 2 * N * M + 1 - x)): dp[i + x] += dp_old[i] print((dp[N * M] - 1))
false
20
[ "-dp = [0] * 3000 + [1] + [0] * 3000", "+M = max(X + [A])", "+dp = [0] * (2 * N * M + 1)", "+dp[N * M] = 1", "- for i in range(max(-x, 0), min(6001, 6001 - x)):", "+ for i in range(max(-x, 0), min(2 * N * M + 1, 2 * N * M + 1 - x)):", "-print((dp[3000] - 1))", "+print((dp[N * M] - 1))" ]
false
0.048976
0.04075
1.201867
[ "s999658092", "s470753507" ]
u645250356
p02948
python
s392405952
s019323743
1,144
469
101,336
97,372
Accepted
Accepted
59
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,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, sys.stdin.readline().split())) ...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,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, sys.stdin.readline().split())) ...
28
26
697
649
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, 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, sys.stdin.read...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, 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, sys.stdin.read...
false
7.142857
[ "-ab = [inpl() for i in range(n)]", "-hq = []", "+jobs = [inpl() for _ in range(n)]", "+jobs.sort()", "+can = []", "+ind = 0", "-ind = 0", "-ab.sort()", "- while True:", "- if ind >= n:", "- break", "- a, b = ab[ind]", "- if a <= i:", "- heappu...
false
0.036108
0.036552
0.987862
[ "s392405952", "s019323743" ]
u323680411
p03556
python
s732051362
s471677457
29
17
3,060
3,060
Accepted
Accepted
41.38
from sys import stdin def main() -> None: n = int(next_str()) for i in range(1, n + 1): if not judge(i + 1, n): print((i ** 2)) break def judge(i: int, n: int) -> bool: if i ** 2 <= n: return True return False def next_str() -> str: r...
from sys import stdin def main() -> None: n = int(next_str()) print((int(n ** 0.5) ** 2)) def next_str() -> str: result = "" while True: tmp = stdin.read(1) if tmp.strip() != "": result += tmp elif tmp != '\r': break return result ...
31
20
541
358
from sys import stdin def main() -> None: n = int(next_str()) for i in range(1, n + 1): if not judge(i + 1, n): print((i**2)) break def judge(i: int, n: int) -> bool: if i**2 <= n: return True return False def next_str() -> str: result = "" while Tru...
from sys import stdin def main() -> None: n = int(next_str()) print((int(n**0.5) ** 2)) def next_str() -> str: result = "" while True: tmp = stdin.read(1) if tmp.strip() != "": result += tmp elif tmp != "\r": break return result if __name__ == "_...
false
35.483871
[ "- for i in range(1, n + 1):", "- if not judge(i + 1, n):", "- print((i**2))", "- break", "-", "-", "-def judge(i: int, n: int) -> bool:", "- if i**2 <= n:", "- return True", "- return False", "+ print((int(n**0.5) ** 2))" ]
false
0.081777
0.067663
1.208597
[ "s732051362", "s471677457" ]
u581187895
p03283
python
s580785414
s083533522
2,318
1,530
18,236
57,552
Accepted
Accepted
33.99
import numpy as np def resolve(): N, M, Q = list(map(int, input().split())) S = np.zeros(((N + 1), (N + 1))) for _ in range(M): l, r = list(map(int, input().split())) # L,Rの区間にある本数 S[l, r] += 1 # ゼータ変換(横縦累積和) axis=1:横, axis=0:縦 S = np.cumsum(S, axis=1).cumsum(a...
import numpy as np def resolve(): N, M, Q = map(int, input().split()) L, R = np.array([list(map(int, input().split())) for _ in range(M)]).T P, Q = np.array([list(map(int, input().split())) for _ in range(Q)]).T P -= 1 S = np.zeros(((N + 1), (N + 1))) # L,Rの区間にある本数 np.add.at(S,...
24
21
540
551
import numpy as np def resolve(): N, M, Q = list(map(int, input().split())) S = np.zeros(((N + 1), (N + 1))) for _ in range(M): l, r = list(map(int, input().split())) # L,Rの区間にある本数 S[l, r] += 1 # ゼータ変換(横縦累積和) axis=1:横, axis=0:縦 S = np.cumsum(S, axis=1).cumsum(axis=0) fo...
import numpy as np def resolve(): N, M, Q = map(int, input().split()) L, R = np.array([list(map(int, input().split())) for _ in range(M)]).T P, Q = np.array([list(map(int, input().split())) for _ in range(Q)]).T P -= 1 S = np.zeros(((N + 1), (N + 1))) # L,Rの区間にある本数 np.add.at(S, (L, R), 1) ...
false
12.5
[ "- N, M, Q = list(map(int, input().split()))", "+ N, M, Q = map(int, input().split())", "+ L, R = np.array([list(map(int, input().split())) for _ in range(M)]).T", "+ P, Q = np.array([list(map(int, input().split())) for _ in range(Q)]).T", "+ P -= 1", "- for _ in range(M):", "- ...
false
0.008297
0.246122
0.033709
[ "s580785414", "s083533522" ]
u606146341
p04001
python
s521009821
s198644294
26
24
3,188
3,060
Accepted
Accepted
7.69
import itertools s = str(eval(input())) s4 = [] for l in range(2 ** (len(s)-1)): s3 = list(s) h = 0 for i in range(len(s)-1): if (l >> i) & 1: s3.insert(i+h+1,'+') h += 1 s4.append(s3) print((sum([eval(''.join(i)) for i in s4])))
s = input() n = len(s) def dfs(i, f): if i == n - 1: return eval(f) return dfs(i+1, f + s[i+1]) + \ dfs(i+1, f + '+' + s[i+1]) print(dfs(0,s[0]))
13
10
283
188
import itertools s = str(eval(input())) s4 = [] for l in range(2 ** (len(s) - 1)): s3 = list(s) h = 0 for i in range(len(s) - 1): if (l >> i) & 1: s3.insert(i + h + 1, "+") h += 1 s4.append(s3) print((sum([eval("".join(i)) for i in s4])))
s = input() n = len(s) def dfs(i, f): if i == n - 1: return eval(f) return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1]) print(dfs(0, s[0]))
false
23.076923
[ "-import itertools", "+s = input()", "+n = len(s)", "-s = str(eval(input()))", "-s4 = []", "-for l in range(2 ** (len(s) - 1)):", "- s3 = list(s)", "- h = 0", "- for i in range(len(s) - 1):", "- if (l >> i) & 1:", "- s3.insert(i + h + 1, \"+\")", "- h += 1...
false
0.047282
0.04708
1.004287
[ "s521009821", "s198644294" ]
u188827677
p04043
python
s232771841
s835514007
25
20
8,992
8,956
Accepted
Accepted
20
abc = list(map(int,input().split())) print(("YES" if abc.count(5) == 2 and abc.count(7) == 1 else "NO"))
abc = list(map(int, input().split())) if abc.count(5) == 2 and abc.count(7) == 1: print("YES") else: print("NO")
2
3
103
114
abc = list(map(int, input().split())) print(("YES" if abc.count(5) == 2 and abc.count(7) == 1 else "NO"))
abc = list(map(int, input().split())) if abc.count(5) == 2 and abc.count(7) == 1: print("YES") else: print("NO")
false
33.333333
[ "-print((\"YES\" if abc.count(5) == 2 and abc.count(7) == 1 else \"NO\"))", "+if abc.count(5) == 2 and abc.count(7) == 1:", "+ print(\"YES\")", "+else:", "+ print(\"NO\")" ]
false
0.044837
0.106036
0.422843
[ "s232771841", "s835514007" ]
u297574184
p03061
python
s099126713
s316899842
1,073
152
63,984
14,528
Accepted
Accepted
85.83
from collections import Counter def getDivisor(x): ans = [] for d in range(1, int(x**0.5)+1): if x % d == 0: ans.append(d) if x//d != d: ans.append(x//d) return sorted(ans) N = int(eval(input())) As = list(map(int, input().split())) divisors =...
from itertools import accumulate def gcd(a, b): while b: a, b = b, a%b return a N = int(eval(input())) As = list(map(int, input().split())) Ls = [As[-1]] + list(accumulate(As, gcd)) Rs = list(accumulate(As[::-1], gcd))[::-1] + [As[0]] ans = 0 for i in range(N): g = gcd(Ls[i], Rs[i...
27
18
611
354
from collections import Counter def getDivisor(x): ans = [] for d in range(1, int(x**0.5) + 1): if x % d == 0: ans.append(d) if x // d != d: ans.append(x // d) return sorted(ans) N = int(eval(input())) As = list(map(int, input().split())) divisors = getDiv...
from itertools import accumulate def gcd(a, b): while b: a, b = b, a % b return a N = int(eval(input())) As = list(map(int, input().split())) Ls = [As[-1]] + list(accumulate(As, gcd)) Rs = list(accumulate(As[::-1], gcd))[::-1] + [As[0]] ans = 0 for i in range(N): g = gcd(Ls[i], Rs[i + 1]) an...
false
33.333333
[ "-from collections import Counter", "+from itertools import accumulate", "-def getDivisor(x):", "- ans = []", "- for d in range(1, int(x**0.5) + 1):", "- if x % d == 0:", "- ans.append(d)", "- if x // d != d:", "- ans.append(x // d)", "- return ...
false
0.06929
0.037217
1.861803
[ "s099126713", "s316899842" ]