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
u368249389
p02784
python
s000004615
s273759263
199
42
52,292
13,964
Accepted
Accepted
78.89
# Problem B - Common Raccoon vs Monster # input h, n = list(map(int, input().split())) a_list = list(map(int, input().split())) # initialization a_sum = sum(a_list) # output if h - a_sum<=0: print("Yes") else: print("No")
# Problem B - Common Raccoon vs Monster # input H, N = list(map(int, input().split())) a_nums = list(map(int, input().split())) # initialization a_sum = sum(a_nums) # output if a_sum>=H: print("Yes") else: print("No")
14
14
240
236
# Problem B - Common Raccoon vs Monster # input h, n = list(map(int, input().split())) a_list = list(map(int, input().split())) # initialization a_sum = sum(a_list) # output if h - a_sum <= 0: print("Yes") else: print("No")
# Problem B - Common Raccoon vs Monster # input H, N = list(map(int, input().split())) a_nums = list(map(int, input().split())) # initialization a_sum = sum(a_nums) # output if a_sum >= H: print("Yes") else: print("No")
false
0
[ "-h, n = list(map(int, input().split()))", "-a_list = list(map(int, input().split()))", "+H, N = list(map(int, input().split()))", "+a_nums = list(map(int, input().split()))", "-a_sum = sum(a_list)", "+a_sum = sum(a_nums)", "-if h - a_sum <= 0:", "+if a_sum >= H:" ]
false
0.040683
0.074239
0.548007
[ "s000004615", "s273759263" ]
u489959379
p03212
python
s762740447
s014126268
74
67
2,940
3,064
Accepted
Accepted
9.46
n = int(eval(input())) def dfs(s): if int(s) > n: return 0 for i in '753': if s.count(i) == 0: res = 0 break else: res = 1 for i in '753': res += dfs(s + i) return res print((dfs('0')))
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 res = 0 def resolve(): n = int(eval(input())) def is_ok(L): l = "".join(L) if int(l) <= n: for i in ["7", "5", "3"]: if i not in l: return False ...
19
41
277
741
n = int(eval(input())) def dfs(s): if int(s) > n: return 0 for i in "753": if s.count(i) == 0: res = 0 break else: res = 1 for i in "753": res += dfs(s + i) return res print((dfs("0")))
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 res = 0 def resolve(): n = int(eval(input())) def is_ok(L): l = "".join(L) if int(l) <= n: for i in ["7", "5", "3"]: if i not in l: return False else: ...
false
53.658537
[ "-n = int(eval(input()))", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "+f_inf = float(\"inf\")", "+mod = 10**9 + 7", "+res = 0", "-def dfs(s):", "- if int(s) > n:", "- return 0", "- for i in \"753\":", "- if s.count(i) == 0:", "- res = 0", "- ...
false
0.044585
0.160311
0.278112
[ "s762740447", "s014126268" ]
u588341295
p03776
python
s425939787
s193330110
25
22
3,316
3,316
Accepted
Accepted
12
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) from collections import Counter from math import factorial def nCr(n, r): # 10C7 = 10C3 r = min(r, n-r) return factorial(n) / factorial(r) / factorial(n-r) round = lambda x: i...
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) from collections import Counter MAX = 51 # 階乗テーブル factorial = [1] * (MAX) factorial[0] = factorial[1] = 1 for i in range(2, MAX): factorial[i] = factorial[i-1] * i # 組み合わせの数(必要な階乗のテー...
43
54
922
1,155
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10**9) from collections import Counter from math import factorial def nCr(n, r): # 10C7 = 10C3 r = min(r, n - r) return factorial(n) / factorial(r) / factorial(n - r) round = lambda x: int((...
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10**9) from collections import Counter MAX = 51 # 階乗テーブル factorial = [1] * (MAX) factorial[0] = factorial[1] = 1 for i in range(2, MAX): factorial[i] = factorial[i - 1] * i # 組み合わせの数(必要な階乗のテーブルを事前に作ってお...
false
20.37037
[ "-from math import factorial", "-", "+MAX = 51", "+# 階乗テーブル", "+factorial = [1] * (MAX)", "+factorial[0] = factorial[1] = 1", "+for i in range(2, MAX):", "+ factorial[i] = factorial[i - 1] * i", "+# 組み合わせの数(必要な階乗のテーブルを事前に作っておく)", "- return factorial(n) / factorial(r) / factorial(n - r)", "...
false
0.049505
0.050621
0.977961
[ "s425939787", "s193330110" ]
u698031448
p03165
python
s450661371
s545250445
794
283
153,096
144,560
Accepted
Accepted
64.36
# Returns length of LCS for X[0..m-1], Y[0..n-1] def lcs(X, Y, m, n): L = [[0 for x in range(n+1)] for x in range(m+1)] # Following steps build L[m+1][n+1] in bottom up fashion. Note # that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] for i in range(m+1): for j in range(n+1): if ...
s=eval(input()) t=eval(input()) dp=[[0]*(len(t)+1) for i in range(len(s)+1)] for i in range(1,len(s)+1): for j in range(1,len(t)+1): if s[i-1]==t[j-1]: dp[i][j]=dp[i-1][j-1]+1 else: dp[i][j]=max(dp[i-1][j],dp[i][j-1]) # print(dp[i]) ans='' i,j=len(s),len(t)...
53
25
1,220
484
# Returns length of LCS for X[0..m-1], Y[0..n-1] def lcs(X, Y, m, n): L = [[0 for x in range(n + 1)] for x in range(m + 1)] # Following steps build L[m+1][n+1] in bottom up fashion. Note # that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] for i in range(m + 1): for j in range(n + 1)...
s = eval(input()) t = eval(input()) dp = [[0] * (len(t) + 1) for i in range(len(s) + 1)] for i in range(1, len(s) + 1): for j in range(1, len(t) + 1): if s[i - 1] == t[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) # print(dp[i]) ...
false
52.830189
[ "-# Returns length of LCS for X[0..m-1], Y[0..n-1]", "-def lcs(X, Y, m, n):", "- L = [[0 for x in range(n + 1)] for x in range(m + 1)]", "- # Following steps build L[m+1][n+1] in bottom up fashion. Note", "- # that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]", "- for i in range(m...
false
0.077915
0.038655
2.015655
[ "s450661371", "s545250445" ]
u757117214
p03680
python
s066123125
s375618191
209
66
7,192
13,940
Accepted
Accepted
68.42
n=int(eval(input())) a=[] cnt=0 now=0 for i in range(n): a.append(int(eval(input()))-1) flg=False for i in range(n): if now==1: flg=True break now=a[now] cnt+=1 print((cnt if flg else -1))
N,*a = list(map(int,open(0).read().split())) a.insert(0,0) flg = False on = 1 cnt = 0 for i in range(N): on = a[on] cnt += 1 if on == 2: print(cnt) exit() print((-1))
14
12
205
205
n = int(eval(input())) a = [] cnt = 0 now = 0 for i in range(n): a.append(int(eval(input())) - 1) flg = False for i in range(n): if now == 1: flg = True break now = a[now] cnt += 1 print((cnt if flg else -1))
N, *a = list(map(int, open(0).read().split())) a.insert(0, 0) flg = False on = 1 cnt = 0 for i in range(N): on = a[on] cnt += 1 if on == 2: print(cnt) exit() print((-1))
false
14.285714
[ "-n = int(eval(input()))", "-a = []", "+N, *a = list(map(int, open(0).read().split()))", "+a.insert(0, 0)", "+flg = False", "+on = 1", "-now = 0", "-for i in range(n):", "- a.append(int(eval(input())) - 1)", "-flg = False", "-for i in range(n):", "- if now == 1:", "- flg = True"...
false
0.034707
0.035978
0.964667
[ "s066123125", "s375618191" ]
u606045429
p03241
python
s154008626
s187599901
24
22
3,060
2,940
Accepted
Accepted
8.33
def divisors(N): res = [] i = 1 while i * i <= N: q, r = N // i, N % i if r == 0: res.append(i) if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M...
def divisors(N): res = [] i = 1 while i * i <= N: if N % i == 0: res.append(i) q = N // i if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M) ...
15
15
331
329
def divisors(N): res = [] i = 1 while i * i <= N: q, r = N // i, N % i if r == 0: res.append(i) if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M) if d * N <=...
def divisors(N): res = [] i = 1 while i * i <= N: if N % i == 0: res.append(i) q = N // i if i != q: res.append(q) i += 1 res.sort() return res N, M = list(map(int, input().split())) print((max(d for d in divisors(M) if d * N <= M...
false
0
[ "- q, r = N // i, N % i", "- if r == 0:", "+ if N % i == 0:", "+ q = N // i" ]
false
0.048779
0.053329
0.914677
[ "s154008626", "s187599901" ]
u475503988
p02734
python
s915111777
s419988846
620
531
112,988
43,372
Accepted
Accepted
14.35
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10 ** 7) MOD = 998244353 N, S = list(map(int, input().split())) A = list(map(int, list(input().split()))) ans = 0 dp = [[0]*(S+1) for _ in range(N+1)] for i in range(N): dp[i][0] += 1 # Lがiからを足す for j in range...
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10 ** 7) MOD = 998244353 N, S = list(map(int, input().split())) A = list(map(int, list(input().split()))) ans = 0 dp = [0]*(S+1) for i in range(N): dp[0] += 1 # Lがiからを足す next_dp = [0]*(S+1) for j in range(...
22
24
583
589
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) MOD = 998244353 N, S = list(map(int, input().split())) A = list(map(int, list(input().split()))) ans = 0 dp = [[0] * (S + 1) for _ in range(N + 1)] for i in range(N): dp[i][0] += 1 # Lがiからを足す for j in range(S + 1)...
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) MOD = 998244353 N, S = list(map(int, input().split())) A = list(map(int, list(input().split()))) ans = 0 dp = [0] * (S + 1) for i in range(N): dp[0] += 1 # Lがiからを足す next_dp = [0] * (S + 1) for j in range(S + 1...
false
8.333333
[ "-dp = [[0] * (S + 1) for _ in range(N + 1)]", "+dp = [0] * (S + 1)", "- dp[i][0] += 1 # Lがiからを足す", "+ dp[0] += 1 # Lがiからを足す", "+ next_dp = [0] * (S + 1)", "- dp[i + 1][j] += dp[i][j] # A[i]を選ばない", "- dp[i + 1][j] %= MOD", "+ next_dp[j] += dp[j] # A[i]を選ばない", "+ ...
false
0.038446
0.111402
0.345112
[ "s915111777", "s419988846" ]
u561231954
p02617
python
s963937140
s526828270
668
388
46,676
9,076
Accepted
Accepted
41.92
import sys sys.setrecursionlimit(10000000) MOD = 10 ** 9 + 7 INF = 10 ** 15 def main(): N = int(eval(input())) G = [[] for _ in range(N)] for _ in range(N - 1): a,b = list(map(int,input().split())) a -= 1 b -= 1 G[a].append(b) G[b].append(a) p...
import sys sys.setrecursionlimit(10000000) MOD = 10 ** 9 + 7 INF = 10 ** 15 def main(): N = int(eval(input())) ans = 0 for i in range(N): ans += (i + 1)*(N - i) for _ in range(N - 1): a,b = list(map(int,input().split())) a -= 1 b -= 1 if a > b: ...
34
20
773
416
import sys sys.setrecursionlimit(10000000) MOD = 10**9 + 7 INF = 10**15 def main(): N = int(eval(input())) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 G[a].append(b) G[b].append(a) parents = [-1] * N ...
import sys sys.setrecursionlimit(10000000) MOD = 10**9 + 7 INF = 10**15 def main(): N = int(eval(input())) ans = 0 for i in range(N): ans += (i + 1) * (N - i) for _ in range(N - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 if a > b: a, b...
false
41.176471
[ "- G = [[] for _ in range(N)]", "+ ans = 0", "+ for i in range(N):", "+ ans += (i + 1) * (N - i)", "- G[a].append(b)", "- G[b].append(a)", "- parents = [-1] * N", "- stack = [0]", "- while stack:", "- v = stack.pop()", "- for e in G[v]:", "-...
false
0.119537
0.081482
1.467039
[ "s963937140", "s526828270" ]
u658288444
p03408
python
s945307954
s458097600
21
17
3,316
2,940
Accepted
Accepted
19.05
b = [eval(input()) for i in range(int(eval(input())))] r = [eval(input()) for i in range(int(eval(input())))] o = 0 for w in list(set(b)): o = max(o, b.count(w) - r.count(w)) print(o)
b = [eval(input()) for i in range(int(eval(input())))] r = [eval(input()) for i in range(int(eval(input())))] k = 0 for w in list(set(b)): k = max(k, b.count(w) - r.count(w)) print(k)
7
6
170
166
b = [eval(input()) for i in range(int(eval(input())))] r = [eval(input()) for i in range(int(eval(input())))] o = 0 for w in list(set(b)): o = max(o, b.count(w) - r.count(w)) print(o)
b = [eval(input()) for i in range(int(eval(input())))] r = [eval(input()) for i in range(int(eval(input())))] k = 0 for w in list(set(b)): k = max(k, b.count(w) - r.count(w)) print(k)
false
14.285714
[ "-o = 0", "+k = 0", "- o = max(o, b.count(w) - r.count(w))", "-print(o)", "+ k = max(k, b.count(w) - r.count(w))", "+print(k)" ]
false
0.039553
0.034796
1.136719
[ "s945307954", "s458097600" ]
u537962130
p02841
python
s628960877
s515709375
185
169
38,256
38,384
Accepted
Accepted
8.65
m1,d1=list(map(int,input().split())) m2,d2=list(map(int,input().split())) print(((m1<m2 and d1>d2)+0))
m,d=list(map(int,input().split())) mm,dd=list(map(int,input().split())) print(('01'[m<mm]))
3
3
90
79
m1, d1 = list(map(int, input().split())) m2, d2 = list(map(int, input().split())) print(((m1 < m2 and d1 > d2) + 0))
m, d = list(map(int, input().split())) mm, dd = list(map(int, input().split())) print(("01"[m < mm]))
false
0
[ "-m1, d1 = list(map(int, input().split()))", "-m2, d2 = list(map(int, input().split()))", "-print(((m1 < m2 and d1 > d2) + 0))", "+m, d = list(map(int, input().split()))", "+mm, dd = list(map(int, input().split()))", "+print((\"01\"[m < mm]))" ]
false
0.110885
0.111225
0.996943
[ "s628960877", "s515709375" ]
u540761833
p03699
python
s130099243
s404796632
997
18
28,516
3,060
Accepted
Accepted
98.19
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) ssum = sum(s) dp = [[-(10**5) for i in range(ssum+1)] for j in range(N+1)] dp[0][0] = 0 for i in range(1,N+1): for j in range(ssum+1): if j-s[i-1] >= 0: dp[i][j] = max(dp[i-1][j],dp[i-1][j-s[i-1]]+s[i-1...
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) s.sort() ssum = sum(s) c = 0 for i in s: if ssum%10 != 0: print(ssum) c = 1 break if i%10 != 0: ssum -= i if c == 0: print((0))
25
16
569
254
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) ssum = sum(s) dp = [[-(10**5) for i in range(ssum + 1)] for j in range(N + 1)] dp[0][0] = 0 for i in range(1, N + 1): for j in range(ssum + 1): if j - s[i - 1] >= 0: dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - s[i -...
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) s.sort() ssum = sum(s) c = 0 for i in s: if ssum % 10 != 0: print(ssum) c = 1 break if i % 10 != 0: ssum -= i if c == 0: print((0))
false
36
[ "+s.sort()", "-dp = [[-(10**5) for i in range(ssum + 1)] for j in range(N + 1)]", "-dp[0][0] = 0", "-for i in range(1, N + 1):", "- for j in range(ssum + 1):", "- if j - s[i - 1] >= 0:", "- dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - s[i - 1]] + s[i - 1])", "- else:", "- ...
false
0.116295
0.048349
2.405302
[ "s130099243", "s404796632" ]
u895660619
p02267
python
s633448374
s655470989
60
20
8,160
8,196
Accepted
Accepted
66.67
n = int(eval(input())) s = input().split() q = int(eval(input())) t = input().split() cont = 0 for i in t: for o in s: if i == o: cont +=1 break print(cont)
n = int(eval(input())) s = set(input().split()) q = int(eval(input())) t = set(input().split()) print((len(s & t)))
12
6
192
107
n = int(eval(input())) s = input().split() q = int(eval(input())) t = input().split() cont = 0 for i in t: for o in s: if i == o: cont += 1 break print(cont)
n = int(eval(input())) s = set(input().split()) q = int(eval(input())) t = set(input().split()) print((len(s & t)))
false
50
[ "-s = input().split()", "+s = set(input().split())", "-t = input().split()", "-cont = 0", "-for i in t:", "- for o in s:", "- if i == o:", "- cont += 1", "- break", "-print(cont)", "+t = set(input().split())", "+print((len(s & t)))" ]
false
0.033844
0.034167
0.990543
[ "s633448374", "s655470989" ]
u197615397
p02323
python
s616626089
s694169494
190
160
8,916
8,704
Accepted
Accepted
15.79
def solve(): V, E = list(map(int, input().split())) edges = [[] for _ in [0]*V] for _ in [0]*E: s, t, d = list(map(int, input().split())) edges[s].append((t, d)) result = float("inf") beam_width = 80 for i in range(V): q = [(0, i, {i})] for j in range(...
def solve(): V, E = list(map(int, input().split())) edges = [[] for _ in [0]*V] for _ in [0]*E: s, t, d = list(map(int, input().split())) edges[s].append((t, d)) result = float("inf") beam_width = 70 for i in range(V): q = [(0, i, {i})] for j in range(...
31
31
963
963
def solve(): V, E = list(map(int, input().split())) edges = [[] for _ in [0] * V] for _ in [0] * E: s, t, d = list(map(int, input().split())) edges[s].append((t, d)) result = float("inf") beam_width = 80 for i in range(V): q = [(0, i, {i})] for j in range(V - 1): ...
def solve(): V, E = list(map(int, input().split())) edges = [[] for _ in [0] * V] for _ in [0] * E: s, t, d = list(map(int, input().split())) edges[s].append((t, d)) result = float("inf") beam_width = 70 for i in range(V): q = [(0, i, {i})] for j in range(V - 1): ...
false
0
[ "- beam_width = 80", "+ beam_width = 70" ]
false
0.044821
0.044626
1.004359
[ "s616626089", "s694169494" ]
u906337264
p03239
python
s887989231
s346988464
21
17
2,940
2,940
Accepted
Accepted
19.05
N, T = list(map(int, input().split())) c = [] t = [] for _ in range(N): _c, _t = list(map(int, input().split())) if _t <= T: c.append(_c) t.append(_t) if len(c) == 0: print('TLE') else: print((min(c)))
N, T = list(map(int, input().split())) min_c = 1001 for _ in range(N): _c, _t = list(map(int, input().split())) if _t <= T: min_c = min(min_c, _c) if min_c == 1001: print('TLE') else: print(min_c)
16
14
242
226
N, T = list(map(int, input().split())) c = [] t = [] for _ in range(N): _c, _t = list(map(int, input().split())) if _t <= T: c.append(_c) t.append(_t) if len(c) == 0: print("TLE") else: print((min(c)))
N, T = list(map(int, input().split())) min_c = 1001 for _ in range(N): _c, _t = list(map(int, input().split())) if _t <= T: min_c = min(min_c, _c) if min_c == 1001: print("TLE") else: print(min_c)
false
12.5
[ "-c = []", "-t = []", "+min_c = 1001", "- c.append(_c)", "- t.append(_t)", "-if len(c) == 0:", "+ min_c = min(min_c, _c)", "+if min_c == 1001:", "- print((min(c)))", "+ print(min_c)" ]
false
0.04032
0.044007
0.916217
[ "s887989231", "s346988464" ]
u380524497
p03295
python
s525140232
s449760696
300
234
27,740
6,900
Accepted
Accepted
22
import sys from collections import defaultdict input = sys.stdin.readline n, m = list(map(int, input().split())) path = defaultdict(list) for _ in range(m): a, b = list(map(int, input().split())) path[a].append(b) idx = 1 ans = 1 right = n while idx <= n: candidate = path[idx] if no...
import sys input = sys.stdin.readline INF = float('INF') n, m = list(map(int, input().split())) path = [INF]*(n+1) for _ in range(m): a, b = list(map(int, input().split())) path[a] = min(path[a], b) left = 1 ans = 1 right = n while left <= n: cut = path[left] if cut == INF: l...
28
26
498
452
import sys from collections import defaultdict input = sys.stdin.readline n, m = list(map(int, input().split())) path = defaultdict(list) for _ in range(m): a, b = list(map(int, input().split())) path[a].append(b) idx = 1 ans = 1 right = n while idx <= n: candidate = path[idx] if not candidate: ...
import sys input = sys.stdin.readline INF = float("INF") n, m = list(map(int, input().split())) path = [INF] * (n + 1) for _ in range(m): a, b = list(map(int, input().split())) path[a] = min(path[a], b) left = 1 ans = 1 right = n while left <= n: cut = path[left] if cut == INF: left += 1 ...
false
7.142857
[ "-from collections import defaultdict", "+INF = float(\"INF\")", "-path = defaultdict(list)", "+path = [INF] * (n + 1)", "- path[a].append(b)", "-idx = 1", "+ path[a] = min(path[a], b)", "+left = 1", "-while idx <= n:", "- candidate = path[idx]", "- if not candidate:", "- id...
false
0.079825
0.078132
1.021663
[ "s525140232", "s449760696" ]
u088552457
p02888
python
s005078456
s855126461
732
341
42,204
74,176
Accepted
Accepted
53.42
import sys input = sys.stdin.readline import collections import bisect def main(): n = int(eval(input())) l = input_list() l.sort() ans = 0 for i in range(n-2): for j in range(i+1, n-1): ind = bisect.bisect_left(l, l[i]+l[j]) num = ind - 1 - j ...
import sys input = sys.stdin.readline import bisect # 持っているビスケットを叩き、1枚増やす # ビスケット A枚を 1円に交換する # 1円をビスケット B枚に交換する def main(): n = int(eval(input())) l = sorted(input_list()) ans = 0 for a in range(n): for b in range(a+1, n): ans += bisect.bisect_left(l, l[a]+l[b]) - (b...
28
27
526
514
import sys input = sys.stdin.readline import collections import bisect def main(): n = int(eval(input())) l = input_list() l.sort() ans = 0 for i in range(n - 2): for j in range(i + 1, n - 1): ind = bisect.bisect_left(l, l[i] + l[j]) num = ind - 1 - j a...
import sys input = sys.stdin.readline import bisect # 持っているビスケットを叩き、1枚増やす # ビスケット A枚を 1円に交換する # 1円をビスケット B枚に交換する def main(): n = int(eval(input())) l = sorted(input_list()) ans = 0 for a in range(n): for b in range(a + 1, n): ans += bisect.bisect_left(l, l[a] + l[b]) - (b + 1) ...
false
3.571429
[ "-import collections", "-", "+# 持っているビスケットを叩き、1枚増やす", "+# ビスケット A枚を 1円に交換する", "+# 1円をビスケット B枚に交換する", "- l = input_list()", "- l.sort()", "+ l = sorted(input_list())", "- for i in range(n - 2):", "- for j in range(i + 1, n - 1):", "- ind = bisect.bisect_left(l, l[i] ...
false
0.033175
0.034199
0.970051
[ "s005078456", "s855126461" ]
u863442865
p02838
python
s531123079
s325303086
642
557
123,132
123,132
Accepted
Accepted
13.24
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby #from itertools import product from bisect import bisect_left,bisect_right from heapq import heapif...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby #from itertools import product from bisect import bisec...
25
29
657
803
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby # from itertools import product from bisect import bisect_left, bisect_right from heapq import heapify,...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby # from itertools import product from bisect import bisect_l...
false
13.793103
[ "-import sys", "+def main():", "+ import sys", "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**7)", "-from collections import Counter, deque", "+ input = sys.stdin.readline", "+ sys.setrecursionlimit(10**7)", "+ from collections import Counter, deque", "-# from collections i...
false
0.038343
0.038923
0.985112
[ "s531123079", "s325303086" ]
u394721319
p03436
python
s232147982
s730151787
312
155
21,040
14,416
Accepted
Accepted
50.32
from collections import deque import numpy as np H,W = [int(i) for i in input().split()] l = [list(eval(input())) for _ in range(H)] check = [[False]*W for _ in range(H)] ans = [[0]*W for _ in range(H)] q = deque() q.append([0,0]) check[0][0] = True while q: i,j = q.popleft() for next_i, next_j...
from collections import deque import numpy as np H,W = [int(zz) for zz in input().split()] map = [['#']*(W+2) for _ in range(H+2)] ans = 0 for i in range(1,H+1): tmp = eval(input()) s = list('#'+tmp+'#') map[i] = s ans += tmp.count('#') check = [[1]*(W+2) for _ in range(H+2)] count = [[...
31
33
797
817
from collections import deque import numpy as np H, W = [int(i) for i in input().split()] l = [list(eval(input())) for _ in range(H)] check = [[False] * W for _ in range(H)] ans = [[0] * W for _ in range(H)] q = deque() q.append([0, 0]) check[0][0] = True while q: i, j = q.popleft() for next_i, next_j in [[i +...
from collections import deque import numpy as np H, W = [int(zz) for zz in input().split()] map = [["#"] * (W + 2) for _ in range(H + 2)] ans = 0 for i in range(1, H + 1): tmp = eval(input()) s = list("#" + tmp + "#") map[i] = s ans += tmp.count("#") check = [[1] * (W + 2) for _ in range(H + 2)] count ...
false
6.060606
[ "-H, W = [int(i) for i in input().split()]", "-l = [list(eval(input())) for _ in range(H)]", "-check = [[False] * W for _ in range(H)]", "-ans = [[0] * W for _ in range(H)]", "-q = deque()", "-q.append([0, 0])", "-check[0][0] = True", "+H, W = [int(zz) for zz in input().split()]", "+map = [[\"#\"] *...
false
0.054341
0.184003
0.295327
[ "s232147982", "s730151787" ]
u223133214
p03379
python
s987504621
s108660838
302
191
25,220
105,140
Accepted
Accepted
36.75
N = int(eval(input())) X = list(map(int, input().split())) X0 = X[::] X.sort() num = int(N / 2 - 1) # index は num ans0, ans1 = X[num], X[num + 1] for i in range(N): if X0[i] > ans0: print(ans0) else: print(ans1)
n = int(eval(input())) X = list(map(int, input().split())) Y = X[::] Y.sort() m = n // 2 median = (Y[m] + Y[m - 1]) / 2 for x in X: if x < median: print((Y[m])) else: print((Y[m-1]))
11
15
241
215
N = int(eval(input())) X = list(map(int, input().split())) X0 = X[::] X.sort() num = int(N / 2 - 1) # index は num ans0, ans1 = X[num], X[num + 1] for i in range(N): if X0[i] > ans0: print(ans0) else: print(ans1)
n = int(eval(input())) X = list(map(int, input().split())) Y = X[::] Y.sort() m = n // 2 median = (Y[m] + Y[m - 1]) / 2 for x in X: if x < median: print((Y[m])) else: print((Y[m - 1]))
false
26.666667
[ "-N = int(eval(input()))", "+n = int(eval(input()))", "-X0 = X[::]", "-X.sort()", "-num = int(N / 2 - 1) # index は num", "-ans0, ans1 = X[num], X[num + 1]", "-for i in range(N):", "- if X0[i] > ans0:", "- print(ans0)", "+Y = X[::]", "+Y.sort()", "+m = n // 2", "+median = (Y[m] + Y...
false
0.162479
0.122065
1.33109
[ "s987504621", "s108660838" ]
u769870836
p03634
python
s946632351
s066529548
1,671
608
93,344
83,376
Accepted
Accepted
63.61
n=int(eval(input())) l=[[] for i in range(n)] for i in range(n-1): a,b,c=list(map(int,input().split())) l[a-1].append([b-1,c]) l[b-1].append([a-1,c]) ans=[-1]*n q,k=list(map(int,input().split())) ans[k-1]=0 from collections import deque d=deque([k-1]) while d: now=d.pop() for x in l[now]: a,...
import sys from collections import deque input = sys.stdin.readline n=int(eval(input())) l=[[] for i in range(n)] for i in range(n-1): a,b,c=list(map(int,input().split())) l[a-1].append([b-1,c]) l[b-1].append([a-1,c]) ans=[-1]*n q,k=list(map(int,input().split())) ans[k-1]=0 d=deque([k-1]) while d: ...
21
23
451
491
n = int(eval(input())) l = [[] for i in range(n)] for i in range(n - 1): a, b, c = list(map(int, input().split())) l[a - 1].append([b - 1, c]) l[b - 1].append([a - 1, c]) ans = [-1] * n q, k = list(map(int, input().split())) ans[k - 1] = 0 from collections import deque d = deque([k - 1]) while d: now =...
import sys from collections import deque input = sys.stdin.readline n = int(eval(input())) l = [[] for i in range(n)] for i in range(n - 1): a, b, c = list(map(int, input().split())) l[a - 1].append([b - 1, c]) l[b - 1].append([a - 1, c]) ans = [-1] * n q, k = list(map(int, input().split())) ans[k - 1] = 0...
false
8.695652
[ "+import sys", "+from collections import deque", "+", "+input = sys.stdin.readline", "-from collections import deque", "-" ]
false
0.093507
0.146557
0.638024
[ "s946632351", "s066529548" ]
u319725914
p00213
python
s322027500
s756629088
3,500
2,910
5,712
5,716
Accepted
Accepted
16.86
def putpiece(bitmap,unused,pieces,numans,pcsans,FINFLAG): # print(bin(bitmap)) # print(unused,"***",pieces,"***",numans) if FINFLAG: return numans,pcsans if not unused: pcsans = pieces return numans + 1, pcsans if numans > 1: return 2, pieces b,k,y,x...
from itertools import product # from line_profiler import LineProfiler def putpiece(X,Y,bitmap,unused,pieces,numans,pcsans,FINFLAG): if FINFLAG: return numans,pcsans if not unused: pcsans = pieces return numans + 1, pcsans if numans > 1: return 2, pieces b,k...
84
53
2,672
2,106
def putpiece(bitmap, unused, pieces, numans, pcsans, FINFLAG): # print(bin(bitmap)) # print(unused,"***",pieces,"***",numans) if FINFLAG: return numans, pcsans if not unused: pcsans = pieces return numans + 1, pcsans if numans > 1: return 2, pieces b, k, y, x = un...
from itertools import product # from line_profiler import LineProfiler def putpiece(X, Y, bitmap, unused, pieces, numans, pcsans, FINFLAG): if FINFLAG: return numans, pcsans if not unused: pcsans = pieces return numans + 1, pcsans if numans > 1: return 2, pieces b, k, y,...
false
36.904762
[ "-def putpiece(bitmap, unused, pieces, numans, pcsans, FINFLAG):", "- # print(bin(bitmap))", "- # print(unused,\"***\",pieces,\"***\",numans)", "+from itertools import product", "+", "+# from line_profiler import LineProfiler", "+def putpiece(X, Y, bitmap, unused, pieces, numans, pcsans, FINFLAG):...
false
0.037516
0.067372
0.556852
[ "s322027500", "s756629088" ]
u631277801
p03426
python
s193308752
s077994318
477
395
43,224
22,808
Accepted
Accepted
17.19
import sys sdin = sys.stdin.readline H,W,D = list(map(int, sdin().split())) A = [] for h in range(H): A.append(list(map(int, sdin().split()))) Q = int(sdin()) RL = [] for q in range(Q): RL.append(tuple(map(int, sdin().split()))) codn = {} for h in range(H): for w in range(W): codn...
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.re...
51
32
977
811
import sys sdin = sys.stdin.readline H, W, D = list(map(int, sdin().split())) A = [] for h in range(H): A.append(list(map(int, sdin().split()))) Q = int(sdin()) RL = [] for q in range(Q): RL.append(tuple(map(int, sdin().split()))) codn = {} for h in range(H): for w in range(W): codn[A[h][w]] = (h +...
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
false
37.254902
[ "-sdin = sys.stdin.readline", "-H, W, D = list(map(int, sdin().split()))", "-A = []", "-for h in range(H):", "- A.append(list(map(int, sdin().split())))", "-Q = int(sdin())", "-RL = []", "-for q in range(Q):", "- RL.append(tuple(map(int, sdin().split())))", "-codn = {}", "-for h in range(H...
false
0.044366
0.045045
0.984919
[ "s193308752", "s077994318" ]
u405256066
p02743
python
s281990050
s205444194
34
17
5,076
2,940
Accepted
Accepted
50
from sys import stdin from decimal import Decimal,getcontext getcontext().prec = 50 a,b,c = [Decimal(x) for x in stdin.readline().rstrip().split()] if a.sqrt() + b.sqrt() < c.sqrt(): print("Yes") else: print("No")
from sys import stdin a,b,c = [int(x) for x in stdin.readline().rstrip().split()] if 4*a*b < (c-a-b)**2 and (c-a-b) > 0: print("Yes") else: print("No")
8
6
228
164
from sys import stdin from decimal import Decimal, getcontext getcontext().prec = 50 a, b, c = [Decimal(x) for x in stdin.readline().rstrip().split()] if a.sqrt() + b.sqrt() < c.sqrt(): print("Yes") else: print("No")
from sys import stdin a, b, c = [int(x) for x in stdin.readline().rstrip().split()] if 4 * a * b < (c - a - b) ** 2 and (c - a - b) > 0: print("Yes") else: print("No")
false
25
[ "-from decimal import Decimal, getcontext", "-getcontext().prec = 50", "-a, b, c = [Decimal(x) for x in stdin.readline().rstrip().split()]", "-if a.sqrt() + b.sqrt() < c.sqrt():", "+a, b, c = [int(x) for x in stdin.readline().rstrip().split()]", "+if 4 * a * b < (c - a - b) ** 2 and (c - a - b) > 0:" ]
false
0.103441
0.088711
1.166044
[ "s281990050", "s205444194" ]
u716660050
p03338
python
s406397411
s069677562
29
26
9,152
9,120
Accepted
Accepted
10.34
N,S=int(eval(input())),eval(input()) ans=0 for i in range(1,N): a,b,c=S[:i],S[i:],0 for j in range(97,123): if chr(j)in a and chr(j)in b:c+=1 ans=max(ans,c) print(ans)
N,S,z=int(eval(input())),eval(input()),0 for i in range(1,N):a,b=S[:i],S[i:];z=max(z,len([0 for j in range(97,123)if chr(j)in a and chr(j)in b])) print(z)
8
3
182
144
N, S = int(eval(input())), eval(input()) ans = 0 for i in range(1, N): a, b, c = S[:i], S[i:], 0 for j in range(97, 123): if chr(j) in a and chr(j) in b: c += 1 ans = max(ans, c) print(ans)
N, S, z = int(eval(input())), eval(input()), 0 for i in range(1, N): a, b = S[:i], S[i:] z = max(z, len([0 for j in range(97, 123) if chr(j) in a and chr(j) in b])) print(z)
false
62.5
[ "-N, S = int(eval(input())), eval(input())", "-ans = 0", "+N, S, z = int(eval(input())), eval(input()), 0", "- a, b, c = S[:i], S[i:], 0", "- for j in range(97, 123):", "- if chr(j) in a and chr(j) in b:", "- c += 1", "- ans = max(ans, c)", "-print(ans)", "+ a, b = S[...
false
0.037907
0.04256
0.890666
[ "s406397411", "s069677562" ]
u973840923
p03107
python
s042318773
s291391293
52
48
3,956
3,956
Accepted
Accepted
7.69
list = [] cnt = 0 for i in eval(input()): if list: if list[-1] != i: list.pop(-1) cnt += 2 else: list.append(i) else: list.append(i) print(cnt)
list = [] cnt = 0 for i in eval(input()): if not list: list.append(i) elif list[-1] != i: list.pop(-1) cnt += 2 else: list.append(i) print(cnt)
14
12
220
194
list = [] cnt = 0 for i in eval(input()): if list: if list[-1] != i: list.pop(-1) cnt += 2 else: list.append(i) else: list.append(i) print(cnt)
list = [] cnt = 0 for i in eval(input()): if not list: list.append(i) elif list[-1] != i: list.pop(-1) cnt += 2 else: list.append(i) print(cnt)
false
14.285714
[ "- if list:", "- if list[-1] != i:", "- list.pop(-1)", "- cnt += 2", "- else:", "- list.append(i)", "+ if not list:", "+ list.append(i)", "+ elif list[-1] != i:", "+ list.pop(-1)", "+ cnt += 2" ]
false
0.090741
0.083009
1.093148
[ "s042318773", "s291391293" ]
u279605379
p02235
python
s773487339
s633844118
4,510
3,650
5,628
5,632
Accepted
Accepted
19.07
def calc(x,y): n = len(x) m = len(y) dp1 = [0]*(m+1) for i in range(n): dp2 = dp1[:] for j in range(m): if x[i] == y[j]: dp1[j+1] = dp2[j]+1 elif dp1[j+1] < dp1[j]: dp1[j+1] = dp1[j] return dp1[-1] q = int(eval(inp...
def calc(x,y): n = len(x) m = len(y) dp1 = [0]*(m+1) for i in range(n): s = x[i] dp2 = dp1[:] for j in range(m): if s == y[j]: dp1[j+1] = dp2[j]+1 elif dp1[j+1] < dp1[j]: dp1[j+1] = dp1[j] return dp1[-1] q...
18
19
397
412
def calc(x, y): n = len(x) m = len(y) dp1 = [0] * (m + 1) for i in range(n): dp2 = dp1[:] for j in range(m): if x[i] == y[j]: dp1[j + 1] = dp2[j] + 1 elif dp1[j + 1] < dp1[j]: dp1[j + 1] = dp1[j] return dp1[-1] q = int(eval(in...
def calc(x, y): n = len(x) m = len(y) dp1 = [0] * (m + 1) for i in range(n): s = x[i] dp2 = dp1[:] for j in range(m): if s == y[j]: dp1[j + 1] = dp2[j] + 1 elif dp1[j + 1] < dp1[j]: dp1[j + 1] = dp1[j] return dp1[-1] q...
false
5.263158
[ "+ s = x[i]", "- if x[i] == y[j]:", "+ if s == y[j]:" ]
false
0.045127
0.038935
1.159038
[ "s773487339", "s633844118" ]
u413021823
p03086
python
s438343453
s791638997
166
67
38,256
64,988
Accepted
Accepted
59.64
import sys from itertools import combinations import math def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) s = S(...
import sys from collections import deque from itertools import * def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) ...
28
28
463
474
import sys from itertools import combinations import math def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) s = S()...
import sys from collections import deque from itertools import * def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) ...
false
0
[ "-from itertools import combinations", "-import math", "+from collections import deque", "+from itertools import *", "-for a in s:", "- if a in \"ACGT\":", "+for s_s in s:", "+ if s_s in \"ACGT\":" ]
false
0.03811
0.037417
1.01852
[ "s438343453", "s791638997" ]
u325227960
p02774
python
s660191697
s444733254
677
466
92,116
106,092
Accepted
Accepted
31.17
import sys input = sys.stdin.readline n, k = list(map(int,input().split())) A = list(map(int,input().split())) A.sort() A00 = A[:] A0 = [] A1 = [] F = [0,0,0] for i in range(n): if A[i] > 0: F[0] += 1 A0.append(A[i]) elif A[i] == 0: F[1] += 1 else: F[2] +=...
import sys input = sys.stdin.readline n, k = list(map(int,input().split())) A = list(map(int,input().split())) minus = 0 for i in range(n): if A[i] < 0: minus += 1 zplus = n - minus B = [] C = [] for i in range(n): if A[i] < 0: C.append(A[i]) else: B.append(A[i]) ...
112
70
2,387
1,474
import sys input = sys.stdin.readline n, k = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() A00 = A[:] A0 = [] A1 = [] F = [0, 0, 0] for i in range(n): if A[i] > 0: F[0] += 1 A0.append(A[i]) elif A[i] == 0: F[1] += 1 else: F[2] += 1 A1.a...
import sys input = sys.stdin.readline n, k = list(map(int, input().split())) A = list(map(int, input().split())) minus = 0 for i in range(n): if A[i] < 0: minus += 1 zplus = n - minus B = [] C = [] for i in range(n): if A[i] < 0: C.append(A[i]) else: B.append(A[i]) B.sort(reverse=Tr...
false
37.5
[ "-A.sort()", "-A00 = A[:]", "-A0 = []", "-A1 = []", "-F = [0, 0, 0]", "+minus = 0", "- if A[i] > 0:", "- F[0] += 1", "- A0.append(A[i])", "- elif A[i] == 0:", "- F[1] += 1", "+ if A[i] < 0:", "+ minus += 1", "+zplus = n - minus", "+B = []", "+C = []...
false
0.038633
0.038471
1.004231
[ "s660191697", "s444733254" ]
u682860781
p02714
python
s031953167
s480001811
1,943
1,191
9,092
9,156
Accepted
Accepted
38.7
n = int(eval(input())) s = eval(input()) cnt = s.count("R") * s.count("G") * s.count("B") for i in range(n-2): for j in range(i+1, n-1): if s[i] == s[j]: continue k = j - i + j if k > n-1: continue if s[i] == s[k] or s[j] == s[k]: co...
n = int(eval(input())) s = eval(input()) cnt = s.count("R") * s.count("G") * s.count("B") for i in range(n-2): for j in range(i+1, n-1): if s[i] == s[j]: continue k = j - i + j if k > n-1: break if s[i] == s[k] or s[j] == s[k]: conti...
14
14
345
342
n = int(eval(input())) s = eval(input()) cnt = s.count("R") * s.count("G") * s.count("B") for i in range(n - 2): for j in range(i + 1, n - 1): if s[i] == s[j]: continue k = j - i + j if k > n - 1: continue if s[i] == s[k] or s[j] == s[k]: continue ...
n = int(eval(input())) s = eval(input()) cnt = s.count("R") * s.count("G") * s.count("B") for i in range(n - 2): for j in range(i + 1, n - 1): if s[i] == s[j]: continue k = j - i + j if k > n - 1: break if s[i] == s[k] or s[j] == s[k]: continue ...
false
0
[ "- continue", "+ break" ]
false
0.03761
0.046946
0.801137
[ "s031953167", "s480001811" ]
u813387707
p02793
python
s002525524
s026777975
1,999
1,618
264,700
264,572
Accepted
Accepted
19.06
from fractions import gcd from functools import reduce n = int(eval(input())) a_list = [int(x) for x in input().split()] temp = reduce(lambda x, y: (x * y) // gcd(x, y), a_list) mod = 10 ** 9 + 7 ans = sum([temp // a for a in a_list]) % mod print(ans)
from fractions import gcd from functools import reduce n = int(eval(input())) a_list = [int(x) for x in input().split()] temp = 1 for a in a_list: temp *= a // gcd(a, temp) mod = 10 ** 9 + 7 ans = sum([temp // a for a in a_list]) % mod print(ans)
13
15
262
263
from fractions import gcd from functools import reduce n = int(eval(input())) a_list = [int(x) for x in input().split()] temp = reduce(lambda x, y: (x * y) // gcd(x, y), a_list) mod = 10**9 + 7 ans = sum([temp // a for a in a_list]) % mod print(ans)
from fractions import gcd from functools import reduce n = int(eval(input())) a_list = [int(x) for x in input().split()] temp = 1 for a in a_list: temp *= a // gcd(a, temp) mod = 10**9 + 7 ans = sum([temp // a for a in a_list]) % mod print(ans)
false
13.333333
[ "-temp = reduce(lambda x, y: (x * y) // gcd(x, y), a_list)", "+temp = 1", "+for a in a_list:", "+ temp *= a // gcd(a, temp)" ]
false
0.139044
0.056853
2.445684
[ "s002525524", "s026777975" ]
u357751375
p03470
python
s642596887
s136650277
19
17
3,060
2,940
Accepted
Accepted
10.53
n = int(eval(input())) d = [] for i in range(n): d.append(int(eval(input()))) i = 1 c = 1 list.sort(d,reverse = True) j = d[0] for i in range(len(d)): if j > d[i]: c += 1 j = d[i] print(c)
n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a = set(a) print((len(a)))
17
7
221
101
n = int(eval(input())) d = [] for i in range(n): d.append(int(eval(input()))) i = 1 c = 1 list.sort(d, reverse=True) j = d[0] for i in range(len(d)): if j > d[i]: c += 1 j = d[i] print(c)
n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a = set(a) print((len(a)))
false
58.823529
[ "-d = []", "+a = []", "- d.append(int(eval(input())))", "-i = 1", "-c = 1", "-list.sort(d, reverse=True)", "-j = d[0]", "-for i in range(len(d)):", "- if j > d[i]:", "- c += 1", "- j = d[i]", "-print(c)", "+ a.append(int(eval(input())))", "+a = set(a)", "+print((le...
false
0.048143
0.047615
1.011101
[ "s642596887", "s136650277" ]
u787562674
p03377
python
s173561313
s169891738
21
19
3,316
2,940
Accepted
Accepted
9.52
# Aは猫, Bはどっちかわからん A, B, X = list(map(int, input().split())) if X - A < 0: print('NO') elif X - A > B: print('NO') else: print('YES')
A, B, X = list(map(int, input().split())) print(('NO' if X - A < 0 or X - A > B else 'YES'))
9
3
148
88
# Aは猫, Bはどっちかわからん A, B, X = list(map(int, input().split())) if X - A < 0: print("NO") elif X - A > B: print("NO") else: print("YES")
A, B, X = list(map(int, input().split())) print(("NO" if X - A < 0 or X - A > B else "YES"))
false
66.666667
[ "-# Aは猫, Bはどっちかわからん", "-if X - A < 0:", "- print(\"NO\")", "-elif X - A > B:", "- print(\"NO\")", "-else:", "- print(\"YES\")", "+print((\"NO\" if X - A < 0 or X - A > B else \"YES\"))" ]
false
0.044042
0.04452
0.98926
[ "s173561313", "s169891738" ]
u537976628
p03485
python
s007637629
s090058548
26
24
9,052
8,976
Accepted
Accepted
7.69
a, b = list(map(int, input().split())) print((-(-(a + b) // 2)))
a, b = list(map(int, input().split())) print(((a + b + 1) // 2))
2
2
57
57
a, b = list(map(int, input().split())) print((-(-(a + b) // 2)))
a, b = list(map(int, input().split())) print(((a + b + 1) // 2))
false
0
[ "-print((-(-(a + b) // 2)))", "+print(((a + b + 1) // 2))" ]
false
0.047651
0.048385
0.984829
[ "s007637629", "s090058548" ]
u674588203
p02583
python
s471790898
s660717470
202
81
9,104
9,156
Accepted
Accepted
59.9
# AtCoder Beginner Contest 175 # B - Making Triangle import bisect N=int(eval(input())) L=list(map(int,input().split())) ans=0 for i in range (N): for j in range (i+1,N): for k in range (j+1,N): # print(i,j,k) a=min(L[i],L[j],L[k]) c=max(L[i],L[j],L[k])...
# AtCoder Beginner Contest 175 # B - Making Triangle N=int(eval(input())) L=list(map(int,input().split())) L.sort() ans=0 for i in range (N): for j in range (i+1,N): for k in range (j+1,N): if L[i]+L[j]>L[k] and L[i]<L[j]<L[k]: ans+=1 print(ans)
21
16
421
298
# AtCoder Beginner Contest 175 # B - Making Triangle import bisect N = int(eval(input())) L = list(map(int, input().split())) ans = 0 for i in range(N): for j in range(i + 1, N): for k in range(j + 1, N): # print(i,j,k) a = min(L[i], L[j], L[k]) c = max(L[i], L[j], L[k])...
# AtCoder Beginner Contest 175 # B - Making Triangle N = int(eval(input())) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(N): for j in range(i + 1, N): for k in range(j + 1, N): if L[i] + L[j] > L[k] and L[i] < L[j] < L[k]: ans += 1 print(ans)
false
23.809524
[ "-import bisect", "-", "+L.sort()", "- # print(i,j,k)", "- a = min(L[i], L[j], L[k])", "- c = max(L[i], L[j], L[k])", "- b = L[i] + L[j] + L[k] - a - c", "- if a + b > c and a < b < c:", "+ if L[i] + L[j] > L[k] and L[i] < L[j] < L[k]...
false
0.081404
0.053896
1.510373
[ "s471790898", "s660717470" ]
u941753895
p02918
python
s891177433
s524066145
173
45
11,004
10,820
Accepted
Accepted
73.99
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin....
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] # def LF(): return [float(x) f...
75
36
1,329
759
import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI(): return [int(x) for x in sys.stdin.readline().spl...
import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI(): return [int(x) for x in sys.stdin.readline().spl...
false
52
[ "+# def LF(): return [float(x) for x in sys.stdin.readline().split()]", "+", "+", "+def F():", "+ return float(sys.stdin.readline())", "-# Summarize count of factor within list -- START --", "-def summarize_list(sl):", "- a = sl[0]", "- c = 1", "- res = []", "- for x in sl[1:]:", ...
false
0.036577
0.036945
0.990035
[ "s891177433", "s524066145" ]
u036104576
p03003
python
s183023822
s548544053
212
158
133,200
96,012
Accepted
Accepted
25.47
import sys import itertools # import numpy as np import time import math from heapq import heappop, heappush from collections import defaultdict from collections import Counter from collections import deque sys.setrecursionlimit(10 ** 7) INF = 10 ** 18 MOD = 10 ** 9 + 7 read = sys.stdin.buffer.read read...
import sys import itertools # import numpy as np import time import math from heapq import heappop, heappush from collections import defaultdict from collections import Counter from collections import deque sys.setrecursionlimit(10 ** 7) INF = 10 ** 18 MOD = 10 ** 9 + 7 read = sys.stdin.buffer.read read...
37
37
942
963
import sys import itertools # import numpy as np import time import math from heapq import heappop, heappush from collections import defaultdict from collections import Counter from collections import deque sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 read = sys.stdin.buffer.read readline = sys.stdin.buf...
import sys import itertools # import numpy as np import time import math from heapq import heappop, heappush from collections import defaultdict from collections import Counter from collections import deque sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 read = sys.stdin.buffer.read readline = sys.stdin.buf...
false
0
[ "-S = list(map(int, input().split()))", "-T = list(map(int, input().split()))", "-S.append(0)", "-T.append(0)", "-MAX = 2005", "-dp0 = [[0] * MAX for _ in range(MAX)]", "-dp1 = [[0] * MAX for _ in range(MAX)]", "-dp0[0][0] = 1", "-for i in range(N + 1):", "- for j in range(M + 1):", "- ...
false
0.333889
0.03632
9.192985
[ "s183023822", "s548544053" ]
u562935282
p03148
python
s318450072
s961757826
539
289
23,876
20,556
Accepted
Accepted
46.38
# 解説放送 N, K = list(map(int, input().split())) e = [None for _ in range(N + 1)] # 種別の美味しさ t_kinds_count = 0 # 何種類あるか rest_length = 0 # 各種の2番手以降の個数の総数 tops = [] # 各種の最大美味しさ c_tops = [0] # 各種の最大美味しさの累積和 rests = [] # 各種の2番手以降 c_rests = [0] # 各種の2番手以降の累積和 for _ in range(N): t, d = list(map(int, input()...
from heapq import heappush, heappop from operator import itemgetter import sys input = sys.stdin.readline n, k = list(map(int, input().split())) e = [] for _ in range(n): t, d = list(map(int, input().split())) t -= 1 e.append((d, t)) e.sort(key=itemgetter(0), reverse=True) b = e[:k] # 暫定...
53
58
1,012
1,074
# 解説放送 N, K = list(map(int, input().split())) e = [None for _ in range(N + 1)] # 種別の美味しさ t_kinds_count = 0 # 何種類あるか rest_length = 0 # 各種の2番手以降の個数の総数 tops = [] # 各種の最大美味しさ c_tops = [0] # 各種の最大美味しさの累積和 rests = [] # 各種の2番手以降 c_rests = [0] # 各種の2番手以降の累積和 for _ in range(N): t, d = list(map(int, input().split())) ...
from heapq import heappush, heappop from operator import itemgetter import sys input = sys.stdin.readline n, k = list(map(int, input().split())) e = [] for _ in range(n): t, d = list(map(int, input().split())) t -= 1 e.append((d, t)) e.sort(key=itemgetter(0), reverse=True) b = e[:k] # 暫定選択(おいしさ基礎ポイント降順取得)...
false
8.62069
[ "-# 解説放送", "-N, K = list(map(int, input().split()))", "-e = [None for _ in range(N + 1)] # 種別の美味しさ", "-t_kinds_count = 0 # 何種類あるか", "-rest_length = 0 # 各種の2番手以降の個数の総数", "-tops = [] # 各種の最大美味しさ", "-c_tops = [0] # 各種の最大美味しさの累積和", "-rests = [] # 各種の2番手以降", "-c_rests = [0] # 各種の2番手以降の累積和", "-fo...
false
0.035459
0.036253
0.978108
[ "s318450072", "s961757826" ]
u786020649
p03504
python
s577781516
s151493204
914
557
74,832
94,440
Accepted
Accepted
39.06
import sys readline=sys.stdin.readline read=sys.stdin.read n,c=list(map(int,readline().split())) m=2*10**5 stc=[list(map(int,l.split())) for l in read().splitlines()] cht=[[0]*(m+1) for _ in range(c)] for e in stc: cht[e[2]-1][2*e[0]-1:2*e[1]]=[1 for _ in range(2*e[1]-2*e[0]+1)] mnr=0 for i in range(1,m+1...
import sys import numpy as np readline=sys.stdin.readline read=sys.stdin.read n,c=list(map(int,readline().split())) m=2*10**5 stc=[list(map(int,l.split())) for l in read().splitlines()] cht=np.zeros((c,m+1),dtype='int64') for e in stc: cht[e[2]-1,2*e[0]-1:2*e[1]]=np.ones(2*e[1]-2*e[0]+1) print((max(np.sum...
14
12
380
328
import sys readline = sys.stdin.readline read = sys.stdin.read n, c = list(map(int, readline().split())) m = 2 * 10**5 stc = [list(map(int, l.split())) for l in read().splitlines()] cht = [[0] * (m + 1) for _ in range(c)] for e in stc: cht[e[2] - 1][2 * e[0] - 1 : 2 * e[1]] = [1 for _ in range(2 * e[1] - 2 * e[0] ...
import sys import numpy as np readline = sys.stdin.readline read = sys.stdin.read n, c = list(map(int, readline().split())) m = 2 * 10**5 stc = [list(map(int, l.split())) for l in read().splitlines()] cht = np.zeros((c, m + 1), dtype="int64") for e in stc: cht[e[2] - 1, 2 * e[0] - 1 : 2 * e[1]] = np.ones(2 * e[1] ...
false
14.285714
[ "+import numpy as np", "-cht = [[0] * (m + 1) for _ in range(c)]", "+cht = np.zeros((c, m + 1), dtype=\"int64\")", "- cht[e[2] - 1][2 * e[0] - 1 : 2 * e[1]] = [1 for _ in range(2 * e[1] - 2 * e[0] + 1)]", "-mnr = 0", "-for i in range(1, m + 1):", "- mnr = max(mnr, sum(cht[ch][i] for ch in range(c)...
false
0.528355
0.504376
1.047541
[ "s577781516", "s151493204" ]
u170839742
p02629
python
s241078971
s783008369
33
29
9,172
9,136
Accepted
Accepted
12.12
N = int(eval(input())) res = [] while N: r = N % 26 if r == 0: r = 26 res.append(chr(r + 96)) if r == 26: N -= 1 N //= 26 res.reverse() print((''.join(res)))
N = int(eval(input())) res = [] while N: N -= 1 N, r = divmod(N, 26) res.append(chr(r + ord('a'))) res.reverse() print((''.join(res)))
12
8
196
146
N = int(eval(input())) res = [] while N: r = N % 26 if r == 0: r = 26 res.append(chr(r + 96)) if r == 26: N -= 1 N //= 26 res.reverse() print(("".join(res)))
N = int(eval(input())) res = [] while N: N -= 1 N, r = divmod(N, 26) res.append(chr(r + ord("a"))) res.reverse() print(("".join(res)))
false
33.333333
[ "- r = N % 26", "- if r == 0:", "- r = 26", "- res.append(chr(r + 96))", "- if r == 26:", "- N -= 1", "- N //= 26", "+ N -= 1", "+ N, r = divmod(N, 26)", "+ res.append(chr(r + ord(\"a\")))" ]
false
0.041269
0.04096
1.007537
[ "s241078971", "s783008369" ]
u393512980
p02821
python
s962348096
s157141750
1,414
920
14,428
30,080
Accepted
Accepted
34.94
import sys sys.setrecursionlimit(10000000) # input = sys.stdin.readline from bisect import * # from collections import * # from heapq import * # import functools # import itertools # import math INF = 500000 MOD = 10**9+7 N, M = list(map(int, input().split())) A = [int(x) for x in input().split()] A.sort...
import numpy as np from numpy.fft import rfft, irfft import sys input=sys.stdin.readline N, M = list(map(int, input().split())) fft_len = 1<<18 MAX = 2*10**5 A = np.zeros(fft_len) for a in [int(x) for x in input().split()]: A[a] += 1 F = rfft(A, fft_len) f = np.rint(irfft(F*F)) n, ans = 0, 0 for i, c...
34
21
676
459
import sys sys.setrecursionlimit(10000000) # input = sys.stdin.readline from bisect import * # from collections import * # from heapq import * # import functools # import itertools # import math INF = 500000 MOD = 10**9 + 7 N, M = list(map(int, input().split())) A = [int(x) for x in input().split()] A.sort() l, r = 0...
import numpy as np from numpy.fft import rfft, irfft import sys input = sys.stdin.readline N, M = list(map(int, input().split())) fft_len = 1 << 18 MAX = 2 * 10**5 A = np.zeros(fft_len) for a in [int(x) for x in input().split()]: A[a] += 1 F = rfft(A, fft_len) f = np.rint(irfft(F * F)) n, ans = 0, 0 for i, c in en...
false
38.235294
[ "+import numpy as np", "+from numpy.fft import rfft, irfft", "-sys.setrecursionlimit(10000000)", "-# input = sys.stdin.readline", "-from bisect import *", "-", "-# from collections import *", "-# from heapq import *", "-# import functools", "-# import itertools", "-# import math", "-INF = 5000...
false
0.082601
0.365067
0.226262
[ "s962348096", "s157141750" ]
u317710033
p03493
python
s090996061
s764594860
19
17
3,060
2,940
Accepted
Accepted
10.53
a = eval(input()) b = a.count('1') print((1*b))
a = eval(input()) b = a.count('1') print(b)
3
3
41
39
a = eval(input()) b = a.count("1") print((1 * b))
a = eval(input()) b = a.count("1") print(b)
false
0
[ "-print((1 * b))", "+print(b)" ]
false
0.083074
0.202875
0.409484
[ "s090996061", "s764594860" ]
u867826040
p03425
python
s515949134
s231740560
59
49
9,184
8,988
Accepted
Accepted
16.95
from itertools import combinations as cmbs import sys c = {"M":0,"A":0,"R":0,"C":0,"H":0} for i in range(int(eval(input()))): si = sys.stdin.readline()[0] if si in c: c[si] += 1 ans = sum(i*j*k for i,j,k in cmbs(list(c.values()),r=3)) print(ans)
from itertools import combinations as cmbs import sys c = {"M":0,"A":0,"R":0,"C":0,"H":0} sys.stdin.readline() for si in sys.stdin: if si[0] in c: c[si[0]] += 1 ans = sum(i*j*k for i,j,k in cmbs(list(c.values()),r=3)) print(ans)
9
9
250
243
from itertools import combinations as cmbs import sys c = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} for i in range(int(eval(input()))): si = sys.stdin.readline()[0] if si in c: c[si] += 1 ans = sum(i * j * k for i, j, k in cmbs(list(c.values()), r=3)) print(ans)
from itertools import combinations as cmbs import sys c = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} sys.stdin.readline() for si in sys.stdin: if si[0] in c: c[si[0]] += 1 ans = sum(i * j * k for i, j, k in cmbs(list(c.values()), r=3)) print(ans)
false
0
[ "-for i in range(int(eval(input()))):", "- si = sys.stdin.readline()[0]", "- if si in c:", "- c[si] += 1", "+sys.stdin.readline()", "+for si in sys.stdin:", "+ if si[0] in c:", "+ c[si[0]] += 1" ]
false
0.035782
0.038484
0.929772
[ "s515949134", "s231740560" ]
u392319141
p03112
python
s861778636
s405842339
1,646
1,505
13,848
12,816
Accepted
Accepted
8.57
from bisect import bisect_right, bisect_left A, B, Q = list(map(int, input().split())) INF = 10**18 S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] for _ in range(Q): x = int(eval(input())) lS, lT = S[bisect_right(S, x) - 1], T...
from bisect import bisect_left A, B, Q = list(map(int, input().split())) INF = 10**18 S = [int(eval(input())) for _ in range(A)] + [INF, INF, -INF, -INF] T = [int(eval(input())) for _ in range(B)] + [INF, INF, -INF, -INF] S.sort() T.sort() for _ in range(Q): x = int(eval(input())) s = bisect_le...
21
29
590
634
from bisect import bisect_right, bisect_left A, B, Q = list(map(int, input().split())) INF = 10**18 S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] for _ in range(Q): x = int(eval(input())) lS, lT = S[bisect_right(S, x) - 1], T[bisect_righ...
from bisect import bisect_left A, B, Q = list(map(int, input().split())) INF = 10**18 S = [int(eval(input())) for _ in range(A)] + [INF, INF, -INF, -INF] T = [int(eval(input())) for _ in range(B)] + [INF, INF, -INF, -INF] S.sort() T.sort() for _ in range(Q): x = int(eval(input())) s = bisect_left(S, x) ls ...
false
27.586207
[ "-from bisect import bisect_right, bisect_left", "+from bisect import bisect_left", "-S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]", "-T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]", "+S = [int(eval(input())) for _ in range(A)] + [INF, INF, -INF, -INF]", "+T = [int(eval(input(...
false
0.039145
0.09162
0.427254
[ "s861778636", "s405842339" ]
u055941944
p03043
python
s374680473
s059253329
64
47
3,060
3,060
Accepted
Accepted
26.56
n,k = list(map(int,input().split())) ans = 0 for i in range(1,n+1): y = 0 while i*2**y < k: y +=1 else: ans += (1/2)**y*1/n print(ans)
n, k = list(map(int, input().split())) ans = 0 for i in range(1,n+1): a = i x = 0 while a < k: x += 1 a = a * 2 ans += (1/n)*(1/2)**x print(ans)
10
11
145
157
n, k = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): y = 0 while i * 2**y < k: y += 1 else: ans += (1 / 2) ** y * 1 / n print(ans)
n, k = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): a = i x = 0 while a < k: x += 1 a = a * 2 ans += (1 / n) * (1 / 2) ** x print(ans)
false
9.090909
[ "- y = 0", "- while i * 2**y < k:", "- y += 1", "- else:", "- ans += (1 / 2) ** y * 1 / n", "+ a = i", "+ x = 0", "+ while a < k:", "+ x += 1", "+ a = a * 2", "+ ans += (1 / n) * (1 / 2) ** x" ]
false
0.058482
0.054763
1.06791
[ "s374680473", "s059253329" ]
u054514819
p02615
python
s213814463
s891137393
304
195
107,180
105,704
Accepted
Accepted
35.86
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) As = list(mapint()) As.sort(reverse=True) from heapq import heappush, heappop first = (As.pop(0)) hq = [] if N<2: print((0)) else: ...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) As = list(mapint()) conf = 0 from heapq import heapify, heappop, heappush As.sort(reverse=True) m = As.pop(0) s = As.pop(0) conf += m Q = [...
27
23
570
447
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) As = list(mapint()) As.sort(reverse=True) from heapq import heappush, heappop first = As.pop(0) hq = [] if N < 2: print((0)) else: a...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) As = list(mapint()) conf = 0 from heapq import heapify, heappop, heappush As.sort(reverse=True) m = As.pop(0) s = As.pop(0) conf += m Q = []...
false
14.814815
[ "+conf = 0", "+from heapq import heapify, heappop, heappush", "+", "-from heapq import heappush, heappop", "-", "-first = As.pop(0)", "-hq = []", "-if N < 2:", "- print((0))", "-else:", "- ans = 0", "- second = As.pop(0)", "- ans += first", "- heappush(hq, (-second, -first))...
false
0.04746
0.036406
1.303651
[ "s213814463", "s891137393" ]
u537976628
p03434
python
s842785074
s839399708
28
25
9,184
9,148
Accepted
Accepted
10.71
n = int(eval(input())) A = sorted(list(map(int, input().split())), reverse=True) alc = 0 bb = 0 for i in range(0, n, 2): alc += A[i] for j in range(1, n, 2): bb += A[j] print((alc - bb))
n = int(eval(input())) A = sorted(list(map(int, input().split())), reverse=True) print((sum(A[::2]) - sum(A[1::2])))
9
3
194
110
n = int(eval(input())) A = sorted(list(map(int, input().split())), reverse=True) alc = 0 bb = 0 for i in range(0, n, 2): alc += A[i] for j in range(1, n, 2): bb += A[j] print((alc - bb))
n = int(eval(input())) A = sorted(list(map(int, input().split())), reverse=True) print((sum(A[::2]) - sum(A[1::2])))
false
66.666667
[ "-alc = 0", "-bb = 0", "-for i in range(0, n, 2):", "- alc += A[i]", "-for j in range(1, n, 2):", "- bb += A[j]", "-print((alc - bb))", "+print((sum(A[::2]) - sum(A[1::2])))" ]
false
0.038201
0.037943
1.006798
[ "s842785074", "s839399708" ]
u103657515
p03286
python
s443043177
s688765530
249
175
43,996
38,512
Accepted
Accepted
29.72
import bisect n = int(eval(input())) ps = [0] * (1 << 16) for i in range(1 << 16): temp = 0 x = 1 for j in range(16): if (i >> j) & 1: # temp += (-2) ** (2 *j) temp += x x *= 4 ps[i] = temp pattern1 = None pattern2 = None for i in range(1 ...
n = int(eval(input())) n2 = n ans = "" for i in range(100): while n != 0: r = (n % 2) n = (n - r) // (-2) ans = str(r) + ans if n2==0: print("0") else: print(ans)
49
12
1,025
203
import bisect n = int(eval(input())) ps = [0] * (1 << 16) for i in range(1 << 16): temp = 0 x = 1 for j in range(16): if (i >> j) & 1: # temp += (-2) ** (2 *j) temp += x x *= 4 ps[i] = temp pattern1 = None pattern2 = None for i in range(1 << 16): ...
n = int(eval(input())) n2 = n ans = "" for i in range(100): while n != 0: r = n % 2 n = (n - r) // (-2) ans = str(r) + ans if n2 == 0: print("0") else: print(ans)
false
75.510204
[ "-import bisect", "-", "-ps = [0] * (1 << 16)", "-for i in range(1 << 16):", "- temp = 0", "- x = 1", "- for j in range(16):", "- if (i >> j) & 1:", "- # temp += (-2) ** (2 *j)", "- temp += x", "- x *= 4", "- ps[i] = temp", "-pat...
false
1.10611
0.073112
15.128995
[ "s443043177", "s688765530" ]
u072717685
p02614
python
s677899452
s941033006
73
29
67,856
9,224
Accepted
Accepted
60.27
from itertools import product import sys read = sys.stdin.read def main(): h, w, k = list(map(int, input().split())) c = [] for _ in range(h): row = [c == '#' for c in list(eval(input()))] c.append(row) r = 0 p1 = tuple(product((0, 1), repeat=w)) p2 = tuple(product((0,...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines from itertools import product def main(): h, w, k = list(map(int, input().split())) gg = [] for _ in range(h): row = [1 if c == '#' else 0 for c in list(eval(input()))] gg.extend(row) ...
23
32
614
874
from itertools import product import sys read = sys.stdin.read def main(): h, w, k = list(map(int, input().split())) c = [] for _ in range(h): row = [c == "#" for c in list(eval(input()))] c.append(row) r = 0 p1 = tuple(product((0, 1), repeat=w)) p2 = tuple(product((0, 1), rep...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines from itertools import product def main(): h, w, k = list(map(int, input().split())) gg = [] for _ in range(h): row = [1 if c == "#" else 0 for c in list(eval(input()))] gg.extend(row) row_pr...
false
28.125
[ "-from itertools import product", "+readline = sys.stdin.readline", "+readlines = sys.stdin.readlines", "+from itertools import product", "- c = []", "+ gg = []", "- row = [c == \"#\" for c in list(eval(input()))]", "- c.append(row)", "+ row = [1 if c == \"#\" else 0 for c...
false
0.05221
0.007222
7.229014
[ "s677899452", "s941033006" ]
u974935538
p02713
python
s993849794
s365981060
1,387
950
209,264
75,000
Accepted
Accepted
31.51
K = int(eval(input())) import math from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) temp = [] for i in range(1,K+1): for j in range(1,K+1): for k in range(1,K+1): temp.append(gcd(i,j,k)) print((sum(temp)))
K = int(eval(input())) import math from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) ans = 0 for i in range(1,K+1): for j in range(1,K+1): for k in range(1,K+1): ans += (gcd(i,j,k)) print(ans)
15
14
275
261
K = int(eval(input())) import math from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) temp = [] for i in range(1, K + 1): for j in range(1, K + 1): for k in range(1, K + 1): temp.append(gcd(i, j, k)) print((sum(temp)))
K = int(eval(input())) import math from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) ans = 0 for i in range(1, K + 1): for j in range(1, K + 1): for k in range(1, K + 1): ans += gcd(i, j, k) print(ans)
false
6.666667
[ "-temp = []", "+ans = 0", "- temp.append(gcd(i, j, k))", "-print((sum(temp)))", "+ ans += gcd(i, j, k)", "+print(ans)" ]
false
0.094535
0.041971
2.252356
[ "s993849794", "s365981060" ]
u221264296
p02598
python
s325707608
s137402776
1,986
1,045
31,000
31,012
Accepted
Accepted
47.38
from math import * def trycut(val): ret = 0 for i in range(n): ret += ceil(a[i]/val)-1 return ret n,k=list(map(int,input().split())) a = [int(i) for i in input().split()] low = 0 high = 1000000000 ans =-1 while low <= high: mid = (low + high)/2 cut = trycut(mid) # ~ print("low=",low, "hi...
from math import * def trycut(val): if val == 0 : return float('inf') ret = 0 for i in range(n): ret += ceil(a[i]/val)-1 return ret n,k=list(map(int,input().split())) a = [int(i) for i in input().split()] low = 0 high = 1000000000 ans =-1 while low <= high: mid = (low + high)//2 cut = tr...
30
27
563
408
from math import * def trycut(val): ret = 0 for i in range(n): ret += ceil(a[i] / val) - 1 return ret n, k = list(map(int, input().split())) a = [int(i) for i in input().split()] low = 0 high = 1000000000 ans = -1 while low <= high: mid = (low + high) / 2 cut = trycut(mid) # ~ print(...
from math import * def trycut(val): if val == 0: return float("inf") ret = 0 for i in range(n): ret += ceil(a[i] / val) - 1 return ret n, k = list(map(int, input().split())) a = [int(i) for i in input().split()] low = 0 high = 1000000000 ans = -1 while low <= high: mid = (low + h...
false
10
[ "+ if val == 0:", "+ return float(\"inf\")", "- mid = (low + high) / 2", "+ mid = (low + high) // 2", "- # ~ print(\"low=\",low, \"high=\", high,\"val = \",mid,\"ret = \",cut)", "- high = mid - 0.0000001", "+ high = mid - 1", "- low = mid + 0.0000001", "- #...
false
0.045191
0.077827
0.580664
[ "s325707608", "s137402776" ]
u539692012
p02658
python
s980713144
s481257154
122
89
83,540
20,584
Accepted
Accepted
27.05
_,a=open(0) t=1 for b in sorted(a.split()): t*=int(b) if t>10**18:t=-1;break print(t)
_,a=open(0) t=1 for b in sorted(a.split()): t*=int(b) if t>1e18:t=-1;break print(t)
6
6
92
90
_, a = open(0) t = 1 for b in sorted(a.split()): t *= int(b) if t > 10**18: t = -1 break print(t)
_, a = open(0) t = 1 for b in sorted(a.split()): t *= int(b) if t > 1e18: t = -1 break print(t)
false
0
[ "- if t > 10**18:", "+ if t > 1e18:" ]
false
0.038026
0.038825
0.979421
[ "s980713144", "s481257154" ]
u186838327
p03610
python
s339007607
s433128499
174
71
41,840
69,568
Accepted
Accepted
59.2
s = str(eval(input())) ans = [] for i in range(len(s)): if i%2 == 0: ans.append(s[i]) print((''.join(ans)))
s = str(eval(input())) n = len(s) ans = [] for i in range(n): if i%2 == 0: ans.append(s[i]) print((''.join(ans)))
6
7
117
124
s = str(eval(input())) ans = [] for i in range(len(s)): if i % 2 == 0: ans.append(s[i]) print(("".join(ans)))
s = str(eval(input())) n = len(s) ans = [] for i in range(n): if i % 2 == 0: ans.append(s[i]) print(("".join(ans)))
false
14.285714
[ "+n = len(s)", "-for i in range(len(s)):", "+for i in range(n):" ]
false
0.040873
0.052215
0.782772
[ "s339007607", "s433128499" ]
u612721349
p03695
python
s927303635
s309881476
183
165
38,384
38,384
Accepted
Accepted
9.84
al=[0]*13 eval(input()) for i in input().split(): al[int(i)//400]+=1 tuyoi=sum(al[8:]) iru=sum([1 for a in al[:8] if a > 0]) print((max(1,iru),iru+tuyoi))
l=[0]*13 eval(input()) for i in input().split(): l[int(i)//400]+=1 r=sum([1 for a in l[:8] if a > 0]) print((max(1,r),r+sum(l[8:])))
7
6
156
131
al = [0] * 13 eval(input()) for i in input().split(): al[int(i) // 400] += 1 tuyoi = sum(al[8:]) iru = sum([1 for a in al[:8] if a > 0]) print((max(1, iru), iru + tuyoi))
l = [0] * 13 eval(input()) for i in input().split(): l[int(i) // 400] += 1 r = sum([1 for a in l[:8] if a > 0]) print((max(1, r), r + sum(l[8:])))
false
14.285714
[ "-al = [0] * 13", "+l = [0] * 13", "- al[int(i) // 400] += 1", "-tuyoi = sum(al[8:])", "-iru = sum([1 for a in al[:8] if a > 0])", "-print((max(1, iru), iru + tuyoi))", "+ l[int(i) // 400] += 1", "+r = sum([1 for a in l[:8] if a > 0])", "+print((max(1, r), r + sum(l[8:])))" ]
false
0.043603
0.079311
0.549776
[ "s927303635", "s309881476" ]
u729133443
p02912
python
s960054106
s399529159
155
135
14,180
14,180
Accepted
Accepted
12.9
from heapq import* n,m,*a=[-int(i)for i in open(0).read().split()] heapify(a) while m:heappush(a,0--heappop(a)//2);m+=1 print((-sum(a)))
def main(): from heapq import heapify,heappush,heappop n,m,*a=[-int(i)for i in open(0).read().split()] heapify(a) for _ in range(-m):heappush(a,0--heappop(a)//2) print((-sum(a))) main()
5
7
138
199
from heapq import * n, m, *a = [-int(i) for i in open(0).read().split()] heapify(a) while m: heappush(a, 0 - -heappop(a) // 2) m += 1 print((-sum(a)))
def main(): from heapq import heapify, heappush, heappop n, m, *a = [-int(i) for i in open(0).read().split()] heapify(a) for _ in range(-m): heappush(a, 0 - -heappop(a) // 2) print((-sum(a))) main()
false
28.571429
[ "-from heapq import *", "+def main():", "+ from heapq import heapify, heappush, heappop", "-n, m, *a = [-int(i) for i in open(0).read().split()]", "-heapify(a)", "-while m:", "- heappush(a, 0 - -heappop(a) // 2)", "- m += 1", "-print((-sum(a)))", "+ n, m, *a = [-int(i) for i in open(0)...
false
0.067651
0.034604
1.954992
[ "s960054106", "s399529159" ]
u426534722
p02385
python
s386557135
s063703439
40
20
6,356
5,620
Accepted
Accepted
50
from copy import deepcopy, copy class dice: men = [0] * 7 def __init__(self, li = [0] * 6): self.men = [0] + li def move0(self, a, b, c, d): self.men[a], self.men[b], self.men[c], self.men[d] = self.men[b], self.men[c], self.men[d], self.men[a] def move(self, h): if h == ...
class dice: def __init__(self, li = [0] * 6): self.men = [0] + li def move0(self, a, b, c, d): self.men[a], self.men[b], self.men[c], self.men[d] = self.men[b], self.men[c], self.men[d], self.men[a] def move(self, h): if h == "N": self.move0(1, 2, 6, 5) el...
57
53
1,962
1,841
from copy import deepcopy, copy class dice: men = [0] * 7 def __init__(self, li=[0] * 6): self.men = [0] + li def move0(self, a, b, c, d): self.men[a], self.men[b], self.men[c], self.men[d] = ( self.men[b], self.men[c], self.men[d], self.me...
class dice: def __init__(self, li=[0] * 6): self.men = [0] + li def move0(self, a, b, c, d): self.men[a], self.men[b], self.men[c], self.men[d] = ( self.men[b], self.men[c], self.men[d], self.men[a], ) def move(self, h): if h ...
false
7.017544
[ "-from copy import deepcopy, copy", "-", "-", "- men = [0] * 7", "-", "- if h == \"A\":", "- pass", "- elif h == \"N\":", "+ if h == \"N\":", "- print(\"笆イ繧ィ繝ゥ繝シ\")", "+ print(\"▲err\")", "-saikoro1 = dice(list(map(int, input().split()))...
false
0.051593
0.201822
0.255638
[ "s386557135", "s063703439" ]
u373047809
p03659
python
s437476130
s264504561
283
111
86,264
26,408
Accepted
Accepted
60.78
from itertools import*;*a,s=list(accumulate(list(map(int,open(0).read().split()[1:]))));print((min(abs(s-x*2)for x in a)))
from itertools import*;eval(input());*a,s=accumulate(list(map(int,input().split())));print((min(abs(s-x*2)for x in a)))
1
1
114
105
from itertools import * *a, s = list(accumulate(list(map(int, open(0).read().split()[1:])))) print((min(abs(s - x * 2) for x in a)))
from itertools import * eval(input()) *a, s = accumulate(list(map(int, input().split()))) print((min(abs(s - x * 2) for x in a)))
false
0
[ "-*a, s = list(accumulate(list(map(int, open(0).read().split()[1:]))))", "+eval(input())", "+*a, s = accumulate(list(map(int, input().split())))" ]
false
0.04
0.037286
1.072804
[ "s437476130", "s264504561" ]
u078349616
p03408
python
s912861005
s649954574
21
18
3,316
3,060
Accepted
Accepted
14.29
from collections import defaultdict N = int(eval(input())) S = [eval(input()) for _ in range(N)] M = int(eval(input())) T = [eval(input()) for _ in range(M)] ans = 0 for s in set(S+T): ans = max(ans, S.count(s) - T.count(s)) print(ans)
N = int(eval(input())) S = [eval(input()) for _ in range(N)] M = int(eval(input())) T = [eval(input()) for _ in range(M)] ans = 0 for s in set(S+T): ans = max(ans, S.count(s) - T.count(s)) print(ans)
12
8
227
184
from collections import defaultdict N = int(eval(input())) S = [eval(input()) for _ in range(N)] M = int(eval(input())) T = [eval(input()) for _ in range(M)] ans = 0 for s in set(S + T): ans = max(ans, S.count(s) - T.count(s)) print(ans)
N = int(eval(input())) S = [eval(input()) for _ in range(N)] M = int(eval(input())) T = [eval(input()) for _ in range(M)] ans = 0 for s in set(S + T): ans = max(ans, S.count(s) - T.count(s)) print(ans)
false
33.333333
[ "-from collections import defaultdict", "-" ]
false
0.036791
0.057324
0.641798
[ "s912861005", "s649954574" ]
u832039789
p03713
python
s010336394
s547132276
552
426
7,096
7,096
Accepted
Accepted
22.83
h,w=list(map(int,input().split()));f=lambda x:max(x)-min(x);g=lambda h,w:min([min(f([j if j else -1e9for j in[i*w,((h-i)//2)*w,((h-i)-(h-i)//2)*w]]),f([j if j else -1e9for j in[i*w,(h-i)*(w//2),(h-i)*(w-w//2)]]))for i in range(1,h)]);print((min(g(h,w),g(w,h))))
h,w=list(map(int,input().split()));f=lambda x:max(x)-min(x);g=lambda h,w:min([min(f([i*w,((h-i)//2)*w,((h-i)-(h-i)//2)*w]),f([i*w,(h-i)*(w//2),(h-i)*(w-w//2)]))for i in range(1,h)]);print((min(g(h,w),g(w,h))))
1
1
253
201
h, w = list(map(int, input().split())) f = lambda x: max(x) - min(x) g = lambda h, w: min( [ min( f( [ j if j else -1e9 for j in [i * w, ((h - i) // 2) * w, ((h - i) - (h - i) // 2) * w] ] ), f( ...
h, w = list(map(int, input().split())) f = lambda x: max(x) - min(x) g = lambda h, w: min( [ min( f([i * w, ((h - i) // 2) * w, ((h - i) - (h - i) // 2) * w]), f([i * w, (h - i) * (w // 2), (h - i) * (w - w // 2)]), ) for i in range(1, h) ] ) print((min(g(h, w), g...
false
0
[ "- f(", "- [", "- j if j else -1e9", "- for j in [i * w, ((h - i) // 2) * w, ((h - i) - (h - i) // 2) * w]", "- ]", "- ),", "- f(", "- [", "- j if j else -1e9", "-...
false
0.008026
0.316875
0.025328
[ "s010336394", "s547132276" ]
u869790980
p03737
python
s932910533
s825216420
383
319
85,436
84,916
Accepted
Accepted
16.71
s = input().split() print(''.join([w[0] for w in s]).upper())
print(''.join([w[0] for w in input().split()]).upper())
2
1
66
58
s = input().split() print("".join([w[0] for w in s]).upper())
print("".join([w[0] for w in input().split()]).upper())
false
50
[ "-s = input().split()", "-print(\"\".join([w[0] for w in s]).upper())", "+print(\"\".join([w[0] for w in input().split()]).upper())" ]
false
0.042346
0.05398
0.784467
[ "s932910533", "s825216420" ]
u296518383
p03796
python
s274679590
s294800627
231
35
4,024
2,940
Accepted
Accepted
84.85
import math print((math.factorial(int(eval(input())))%(10**9+7)))
N = int(eval(input())) MOD = 10 ** 9 + 7 answer = 1 for i in range(1, N + 1): answer = (answer * i) % MOD print(answer)
2
8
58
126
import math print((math.factorial(int(eval(input()))) % (10**9 + 7)))
N = int(eval(input())) MOD = 10**9 + 7 answer = 1 for i in range(1, N + 1): answer = (answer * i) % MOD print(answer)
false
75
[ "-import math", "-", "-print((math.factorial(int(eval(input()))) % (10**9 + 7)))", "+N = int(eval(input()))", "+MOD = 10**9 + 7", "+answer = 1", "+for i in range(1, N + 1):", "+ answer = (answer * i) % MOD", "+print(answer)" ]
false
0.132624
0.10944
1.211842
[ "s274679590", "s294800627" ]
u131984977
p02397
python
s372035331
s938138226
60
50
6,720
7,664
Accepted
Accepted
16.67
while True: (x, y) = [int(i) for i in input().split()] if x == y == 0: break if x < y: print((x, y)) else: print((y, x))
while True: x, y = [int(i) for i in input().split()] if x == y == 0: break if x > y: x, y = y, x print((x, y))
9
10
165
152
while True: (x, y) = [int(i) for i in input().split()] if x == y == 0: break if x < y: print((x, y)) else: print((y, x))
while True: x, y = [int(i) for i in input().split()] if x == y == 0: break if x > y: x, y = y, x print((x, y))
false
10
[ "- (x, y) = [int(i) for i in input().split()]", "+ x, y = [int(i) for i in input().split()]", "- if x < y:", "- print((x, y))", "- else:", "- print((y, x))", "+ if x > y:", "+ x, y = y, x", "+ print((x, y))" ]
false
0.238314
0.070046
3.402241
[ "s372035331", "s938138226" ]
u572144347
p03128
python
s610551851
s098348482
218
64
43,484
3,316
Accepted
Accepted
70.64
#!/mnt/c/Users/moiki/bash/env/bin/python N,M = list(map(int, input().split())) cost = [0,2,5,5,4,5,6,3,7,6] A =list(map(int, input().split())) dp = [-1]*(N+1) dp[0] = 0 for i in range(N): if dp[i] == -1: continue for c,a in zip( [cost[a] for a in A], A): if i + c <= N: ...
costs = [2,5,5,4,5,6,3,7,6] N, M = list(map(int, input().split())) A = list(map(int, input().split())) neginf = -1 * 1e20 D = [neginf]*(N+1) def dp(n_match): D[0] = 0 for n in range(1,n_match+1): arr = [D[n-costs[a-1]] if n-costs[a-1]>=0 else neginf for a in A] if max(arr) < 0: ...
28
32
605
681
#!/mnt/c/Users/moiki/bash/env/bin/python N, M = list(map(int, input().split())) cost = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] A = list(map(int, input().split())) dp = [-1] * (N + 1) dp[0] = 0 for i in range(N): if dp[i] == -1: continue for c, a in zip([cost[a] for a in A], A): if i + c <= N: ...
costs = [2, 5, 5, 4, 5, 6, 3, 7, 6] N, M = list(map(int, input().split())) A = list(map(int, input().split())) neginf = -1 * 1e20 D = [neginf] * (N + 1) def dp(n_match): D[0] = 0 for n in range(1, n_match + 1): arr = [D[n - costs[a - 1]] if n - costs[a - 1] >= 0 else neginf for a in A] if max(...
false
12.5
[ "-#!/mnt/c/Users/moiki/bash/env/bin/python", "+costs = [2, 5, 5, 4, 5, 6, 3, 7, 6]", "-cost = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]", "-dp = [-1] * (N + 1)", "-dp[0] = 0", "-for i in range(N):", "- if dp[i] == -1:", "- continue", "- for c, a in zip([cost[a] for a in A], A):", "- if i ...
false
0.084123
0.162735
0.516932
[ "s610551851", "s098348482" ]
u863370423
p02835
python
s078088314
s262969177
170
27
38,384
9,140
Accepted
Accepted
84.12
def main(): a, b, c = list(map(int, input().split())) if (a + b + c) >= 22: print("bust") else: print("win") main()
n = list(map(int, input().split())) if n[0]+n[1]+n[2] >= 22: print("bust") else: print("win")
7
6
143
107
def main(): a, b, c = list(map(int, input().split())) if (a + b + c) >= 22: print("bust") else: print("win") main()
n = list(map(int, input().split())) if n[0] + n[1] + n[2] >= 22: print("bust") else: print("win")
false
14.285714
[ "-def main():", "- a, b, c = list(map(int, input().split()))", "- if (a + b + c) >= 22:", "- print(\"bust\")", "- else:", "- print(\"win\")", "-", "-", "-main()", "+n = list(map(int, input().split()))", "+if n[0] + n[1] + n[2] >= 22:", "+ print(\"bust\")", "+else:",...
false
0.047557
0.047272
1.006031
[ "s078088314", "s262969177" ]
u498487134
p02815
python
s133661373
s414325220
291
266
87,500
103,896
Accepted
Accepted
8.59
N=int(eval(input())) C=list(map(int,input().split())) C.sort() mod=10**9+7 ans=0 for i in range(N): ans+=C[i]*(N-i+1) ans%=mod p=pow(4,N-1,mod) print(((ans*p)%mod))
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) """ Sは全部0と仮定して良い,最後に2^N倍 Cはソートしておく,後ろから使う. iは0indexとする 各C[i]ごとに見るか,そうしたら,それが何番目かによって寄与が決まる i桁目なので左にi桁あるけど,これは通り数にしか関与しない 右側にN-i-1(=a...
15
53
188
943
N = int(eval(input())) C = list(map(int, input().split())) C.sort() mod = 10**9 + 7 ans = 0 for i in range(N): ans += C[i] * (N - i + 1) ans %= mod p = pow(4, N - 1, mod) print(((ans * p) % mod))
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) """ Sは全部0と仮定して良い,最後に2^N倍 Cはソートしておく,後ろから使う. iは0indexとする 各C[i]ごとに見るか,そうしたら,それが何番目かによって寄与が決まる i桁目なので左にi桁あるけど,これは通り数にしか関与しない 右側にN-i-...
false
71.698113
[ "-N = int(eval(input()))", "-C = list(map(int, input().split()))", "-C.sort()", "-mod = 10**9 + 7", "-ans = 0", "-for i in range(N):", "- ans += C[i] * (N - i + 1)", "- ans %= mod", "-p = pow(4, N - 1, mod)", "-print(((ans * p) % mod))", "+import sys", "+", "+input = sys.stdin.readline...
false
0.033937
0.033666
1.008026
[ "s133661373", "s414325220" ]
u270886147
p02707
python
s279548635
s436188798
185
153
32,408
32,192
Accepted
Accepted
17.3
N = int(eval(input())) A = list(map(int,input().strip().split())) M = [0] * N for i in range(0, len(A)): M[(A[i]-1)] += 1 i += 1 for j in range(0, N): print((M[j])) j += 1
N = int(eval(input())) A = list(map(int,input().strip().split())) M = [0] * N for i in range(0, len(A)): M[(A[i]-1)] += 1 for j in range(0, N): print((M[j]))
11
9
192
170
N = int(eval(input())) A = list(map(int, input().strip().split())) M = [0] * N for i in range(0, len(A)): M[(A[i] - 1)] += 1 i += 1 for j in range(0, N): print((M[j])) j += 1
N = int(eval(input())) A = list(map(int, input().strip().split())) M = [0] * N for i in range(0, len(A)): M[(A[i] - 1)] += 1 for j in range(0, N): print((M[j]))
false
18.181818
[ "- i += 1", "- j += 1" ]
false
0.060111
0.036822
1.632463
[ "s279548635", "s436188798" ]
u461993794
p02631
python
s458434616
s852645430
292
157
116,268
121,844
Accepted
Accepted
46.23
n = int(eval(input())) a = list(map(int, input().split())) b = a[0] for v in a[1:]: b ^= v print((*[x ^ b for x in a]))
from functools import reduce n = int(eval(input())) a = list(map(int, input().split())) b = reduce(lambda acc, x: acc ^ x, a[1:], a[0]) print((*[x ^ b for x in a]))
7
7
128
170
n = int(eval(input())) a = list(map(int, input().split())) b = a[0] for v in a[1:]: b ^= v print((*[x ^ b for x in a]))
from functools import reduce n = int(eval(input())) a = list(map(int, input().split())) b = reduce(lambda acc, x: acc ^ x, a[1:], a[0]) print((*[x ^ b for x in a]))
false
0
[ "+from functools import reduce", "+", "-b = a[0]", "-for v in a[1:]:", "- b ^= v", "+b = reduce(lambda acc, x: acc ^ x, a[1:], a[0])" ]
false
0.104275
0.091953
1.134
[ "s458434616", "s852645430" ]
u991567869
p03730
python
s822189468
s348108636
20
17
3,064
2,940
Accepted
Accepted
15
a, b, c = list(map(int, input().split())) for i in range(10000): if (a*i)%b == c: print("YES") exit() print("NO")
a, b, c = list(map(int, input().split())) for i in range(b): if (a*i)%b == c: print("YES") exit() print("NO")
9
9
138
134
a, b, c = list(map(int, input().split())) for i in range(10000): if (a * i) % b == c: print("YES") exit() print("NO")
a, b, c = list(map(int, input().split())) for i in range(b): if (a * i) % b == c: print("YES") exit() print("NO")
false
0
[ "-for i in range(10000):", "+for i in range(b):" ]
false
0.036008
0.037649
0.956426
[ "s822189468", "s348108636" ]
u396518935
p02972
python
s633632094
s658710581
281
247
18,764
19,396
Accepted
Accepted
12.1
N = int(eval(input())) A = list(map(int, input().split())) B = [0 for n in range(N+1)] x = [] for n in range(N): i = N-n # print(i) BB = B[::i] if (sum(BB))%2 == A[i-1]: B[i] = 0 else: B[i] = 1 # print(B) if B[i] == 1: x.append(str(i)) if len(x) == 0: print((0)) else...
N = int(eval(input())) A = list(map(int, input().split())) B = [0]*(N+1) x = [] for n in range(N): i = N-n BB = B[::i] if (sum(BB))%2 == A[i-1]: B[i] = 0 else: B[i] = 1 x.append(str(i)) if len(x) == 0: print((0)) else: print((len(x))) print((' '.join(x)))
22
19
352
291
N = int(eval(input())) A = list(map(int, input().split())) B = [0 for n in range(N + 1)] x = [] for n in range(N): i = N - n # print(i) BB = B[::i] if (sum(BB)) % 2 == A[i - 1]: B[i] = 0 else: B[i] = 1 # print(B) if B[i] == 1: x.append(str(i)) if len(x) == 0: ...
N = int(eval(input())) A = list(map(int, input().split())) B = [0] * (N + 1) x = [] for n in range(N): i = N - n BB = B[::i] if (sum(BB)) % 2 == A[i - 1]: B[i] = 0 else: B[i] = 1 x.append(str(i)) if len(x) == 0: print((0)) else: print((len(x))) print((" ".join(x)))
false
13.636364
[ "-B = [0 for n in range(N + 1)]", "+B = [0] * (N + 1)", "- # print(i)", "- # print(B)", "- if B[i] == 1:" ]
false
0.155633
0.156173
0.996545
[ "s633632094", "s658710581" ]
u077291787
p03095
python
s804229669
s374741849
27
22
3,812
3,188
Accepted
Accepted
18.52
# AGC031A - Colorful Subsequence from functools import reduce def main(): _ = int(eval(input())) S = input().rstrip() MOD = 10 ** 9 + 7 C = [S.count(i) + 1 for i in set(S)] ans = reduce(lambda x, y: (x * y) % MOD, C) print((ans - 1)) if __name__ == "__main__": main()
# AGC031A - Colorful Subsequence def main(): _ = int(eval(input())) S = input().rstrip() MOD = 10 ** 9 + 7 ans = 1 for i in set(S): ans *= S.count(i) + 1 print((ans % MOD - 1)) if __name__ == "__main__": main()
15
13
305
252
# AGC031A - Colorful Subsequence from functools import reduce def main(): _ = int(eval(input())) S = input().rstrip() MOD = 10**9 + 7 C = [S.count(i) + 1 for i in set(S)] ans = reduce(lambda x, y: (x * y) % MOD, C) print((ans - 1)) if __name__ == "__main__": main()
# AGC031A - Colorful Subsequence def main(): _ = int(eval(input())) S = input().rstrip() MOD = 10**9 + 7 ans = 1 for i in set(S): ans *= S.count(i) + 1 print((ans % MOD - 1)) if __name__ == "__main__": main()
false
13.333333
[ "-from functools import reduce", "-", "-", "- C = [S.count(i) + 1 for i in set(S)]", "- ans = reduce(lambda x, y: (x * y) % MOD, C)", "- print((ans - 1))", "+ ans = 1", "+ for i in set(S):", "+ ans *= S.count(i) + 1", "+ print((ans % MOD - 1))" ]
false
0.046116
0.049708
0.927737
[ "s804229669", "s374741849" ]
u681444474
p03775
python
s908193717
s111776341
184
30
38,512
3,060
Accepted
Accepted
83.7
# coding: utf-8 # Your code here! import math N=int(eval(input())) n=int(math.sqrt(N)) dev=0 for i in range(1,n+1): if N%i==0: dev=i print((max(len(str(dev)),len(str(N//dev)))))
#codng utf-8 import math N=int(eval(input())) n=int(math.sqrt(N)) for i in range(n,0,-1): if N%i==0: ans=max(len(str(i)),len(str(N//i))) break print(ans)
10
9
190
175
# coding: utf-8 # Your code here! import math N = int(eval(input())) n = int(math.sqrt(N)) dev = 0 for i in range(1, n + 1): if N % i == 0: dev = i print((max(len(str(dev)), len(str(N // dev)))))
# codng utf-8 import math N = int(eval(input())) n = int(math.sqrt(N)) for i in range(n, 0, -1): if N % i == 0: ans = max(len(str(i)), len(str(N // i))) break print(ans)
false
10
[ "-# coding: utf-8", "-# Your code here!", "+# codng utf-8", "-dev = 0", "-for i in range(1, n + 1):", "+for i in range(n, 0, -1):", "- dev = i", "-print((max(len(str(dev)), len(str(N // dev)))))", "+ ans = max(len(str(i)), len(str(N // i)))", "+ break", "+print(ans)" ]
false
0.047415
0.038226
1.240414
[ "s908193717", "s111776341" ]
u810356688
p03166
python
s715327044
s863037127
995
480
150,728
72,384
Accepted
Accepted
51.76
import sys def input(): return sys.stdin.readline().rstrip() from functools import lru_cache sys.setrecursionlimit(10**6) @lru_cache(maxsize=None) def rec(v): res=0 for nv in graph[v]: res=max(res,rec(nv)+1) return res def main(): n,m=list(map(int,input().split())) XY=[tuple(map(...
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10**6) def rec(v): if dp[v]!=-1:return dp[v] res=0 for nv in graph[v]: res=max(res,rec(nv)+1) dp[v]=res return res def main(): n,m=list(map(int,input().split())) XY=[tuple(map(int,input().s...
24
25
577
612
import sys def input(): return sys.stdin.readline().rstrip() from functools import lru_cache sys.setrecursionlimit(10**6) @lru_cache(maxsize=None) def rec(v): res = 0 for nv in graph[v]: res = max(res, rec(nv) + 1) return res def main(): n, m = list(map(int, input().split())) XY...
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10**6) def rec(v): if dp[v] != -1: return dp[v] res = 0 for nv in graph[v]: res = max(res, rec(nv) + 1) dp[v] = res return res def main(): n, m = list(map(int, input().split())) XY ...
false
4
[ "-from functools import lru_cache", "-", "-@lru_cache(maxsize=None)", "+ if dp[v] != -1:", "+ return dp[v]", "+ dp[v] = res", "- global graph", "+ global dp, graph", "+ dp = [-1] * n # 頂点i(0-)を始点としたときの有効パスの長さの最大値" ]
false
0.095815
0.041177
2.326903
[ "s715327044", "s863037127" ]
u896451538
p02767
python
s793068456
s986640343
40
21
5,040
3,060
Accepted
Accepted
47.5
import math import itertools import fractions import heapq import collections import bisect import sys import copy sys.setrecursionlimit(10**9) mod = 10**7+9 inf = 10**20 def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlin...
n = int(eval(input())) x = list(map(int,input().split())) ans = 10**9+7 for i in range(min(x),max(x)+1): tmp=0 for j in x: tmp+=(i-j)**2 ans = min(ans,tmp) print(ans)
35
10
797
190
import math import itertools import fractions import heapq import collections import bisect import sys import copy sys.setrecursionlimit(10**9) mod = 10**7 + 9 inf = 10**20 def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readline...
n = int(eval(input())) x = list(map(int, input().split())) ans = 10**9 + 7 for i in range(min(x), max(x) + 1): tmp = 0 for j in x: tmp += (i - j) ** 2 ans = min(ans, tmp) print(ans)
false
71.428571
[ "-import math", "-import itertools", "-import fractions", "-import heapq", "-import collections", "-import bisect", "-import sys", "-import copy", "-", "-sys.setrecursionlimit(10**9)", "-mod = 10**7 + 9", "-inf = 10**20", "-", "-", "-def LI():", "- return list(map(int, sys.stdin.rea...
false
0.037696
0.037441
1.006794
[ "s793068456", "s986640343" ]
u125545880
p02756
python
s498655238
s734708959
1,612
471
4,412
5,740
Accepted
Accepted
70.78
# 文字列の操作だけでできるか S = eval(input()) Q = int(eval(input())) T = 0 l = "" r = "" for i in range(Q): Query = list(input().split()) if len(Query) == 1: # T = T ^ 1 (排他的論理和; 0 XOR 1 = 1, 1 XOR 1 = 0) T ^= 1 elif T == 0: s = Query[2] if Query[1] == '1': ...
# list の append だけで実装する S = eval(input()) Q = int(eval(input())) T = 0 l = [] r = [] for _ in range(Q): Query = list(input().split()) if len(Query) == 1: T ^= 1 elif T == 0: s = Query[2] if Query[1] == '1': l.append(s) else: r.append...
36
33
635
592
# 文字列の操作だけでできるか S = eval(input()) Q = int(eval(input())) T = 0 l = "" r = "" for i in range(Q): Query = list(input().split()) if len(Query) == 1: # T = T ^ 1 (排他的論理和; 0 XOR 1 = 1, 1 XOR 1 = 0) T ^= 1 elif T == 0: s = Query[2] if Query[1] == "1": # S = s + S ...
# list の append だけで実装する S = eval(input()) Q = int(eval(input())) T = 0 l = [] r = [] for _ in range(Q): Query = list(input().split()) if len(Query) == 1: T ^= 1 elif T == 0: s = Query[2] if Query[1] == "1": l.append(s) else: r.append(s) else: ...
false
8.333333
[ "-# 文字列の操作だけでできるか", "+# list の append だけで実装する", "-l = \"\"", "-r = \"\"", "-for i in range(Q):", "+l = []", "+r = []", "+for _ in range(Q):", "- # T = T ^ 1 (排他的論理和; 0 XOR 1 = 1, 1 XOR 1 = 0)", "- # S = s + S", "- l = s + l", "+ l.append(s)", "- ...
false
0.037366
0.062839
0.594637
[ "s498655238", "s734708959" ]
u200887663
p03087
python
s395665890
s076724027
865
479
6,828
13,024
Accepted
Accepted
44.62
#n=int(input()) n,q=list(map(int,input().split())) s=list(eval(input())) #bl=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] count=[0]*n for i in range(1,n): st=s[i-1:i+1] if st==["A","C"]: count[i]=count[i-1]+1 else: count[i]=count[i-1] ...
#n = int(input()) n, q = list(map(int, input().split())) #bl = list(map(int, input().split())) #al=[list(input()) for i in range(n)] s = eval(input()) acnum = [0]*(n+1) for i in range(2, n+1): if s[i-2:i] == 'AC': acnum[i] += acnum[i-1]+1 else: acnum[i] += acnum[i-1] for i in range(...
19
15
398
380
# n=int(input()) n, q = list(map(int, input().split())) s = list(eval(input())) # bl=list(map(int,input().split())) # l=[list(map(int,input().split())) for i in range(n)] count = [0] * n for i in range(1, n): st = s[i - 1 : i + 1] if st == ["A", "C"]: count[i] = count[i - 1] + 1 else: count[...
# n = int(input()) n, q = list(map(int, input().split())) # bl = list(map(int, input().split())) # al=[list(input()) for i in range(n)] s = eval(input()) acnum = [0] * (n + 1) for i in range(2, n + 1): if s[i - 2 : i] == "AC": acnum[i] += acnum[i - 1] + 1 else: acnum[i] += acnum[i - 1] for i in ...
false
21.052632
[ "-# n=int(input())", "+# n = int(input())", "-s = list(eval(input()))", "-# bl=list(map(int,input().split()))", "-# l=[list(map(int,input().split())) for i in range(n)]", "-count = [0] * n", "-for i in range(1, n):", "- st = s[i - 1 : i + 1]", "- if st == [\"A\", \"C\"]:", "- count[i]...
false
0.057338
0.05508
1.040993
[ "s395665890", "s076724027" ]
u084320347
p03105
python
s679075579
s419777144
164
17
38,256
2,940
Accepted
Accepted
89.63
a,b,c = list(map(int,input().split())) sound_max = b//a if c >= sound_max: print(sound_max) elif c <= sound_max: print(c)
a,b,c = list(map(int,input().split())) if b//a >= c: print(c) else: print((b//a))
11
5
145
91
a, b, c = list(map(int, input().split())) sound_max = b // a if c >= sound_max: print(sound_max) elif c <= sound_max: print(c)
a, b, c = list(map(int, input().split())) if b // a >= c: print(c) else: print((b // a))
false
54.545455
[ "-sound_max = b // a", "-if c >= sound_max:", "- print(sound_max)", "-elif c <= sound_max:", "+if b // a >= c:", "+else:", "+ print((b // a))" ]
false
0.069983
0.037273
1.877583
[ "s679075579", "s419777144" ]
u037430802
p02936
python
s349142152
s220692192
1,908
1,708
62,572
56,180
Accepted
Accepted
10.48
N,Q = list(map(int, input().split())) es = [[] for _ in range(N)] for i in range(N-1): a,b = list(map(int, input().split())) es[a-1].append(b-1) es[b-1].append(a-1) ans = [0] * N px = [0] * N for i in range(Q): p, x = list(map(int, input().split())) px[p-1] += x visited = [False...
from collections import deque N,Q = list(map(int, input().split())) es = [[] for _ in range(N)] for i in range(N-1): a,b = list(map(int, input().split())) es[a-1].append(b-1) es[b-1].append(a-1) ans = [0] * N for _ in range(Q): p,x = list(map(int, input().split())) ans[p-1] += x ...
31
29
559
553
N, Q = list(map(int, input().split())) es = [[] for _ in range(N)] for i in range(N - 1): a, b = list(map(int, input().split())) es[a - 1].append(b - 1) es[b - 1].append(a - 1) ans = [0] * N px = [0] * N for i in range(Q): p, x = list(map(int, input().split())) px[p - 1] += x visited = [False] * N s...
from collections import deque N, Q = list(map(int, input().split())) es = [[] for _ in range(N)] for i in range(N - 1): a, b = list(map(int, input().split())) es[a - 1].append(b - 1) es[b - 1].append(a - 1) ans = [0] * N for _ in range(Q): p, x = list(map(int, input().split())) ans[p - 1] += x chec...
false
6.451613
[ "+from collections import deque", "+", "-px = [0] * N", "-for i in range(Q):", "+for _ in range(Q):", "- px[p - 1] += x", "-visited = [False] * N", "-stack = [0]", "-while stack:", "- i = stack.pop()", "- ans[i] += px[i]", "- visited[i] = True", "- for j in es[i]:", "- ...
false
0.05656
0.069096
0.818563
[ "s349142152", "s220692192" ]
u188827677
p03293
python
s601173573
s473581823
30
26
9,348
9,096
Accepted
Accepted
13.33
from collections import deque s = deque(list(eval(input()))) t = deque(list(eval(input()))) for i in range(len(s)+1): if s == t: print("Yes") exit() p = s.pop() s.appendleft(p) print("No")
s = eval(input()) t = eval(input()) n = 0 m = len(s) while n != m: if s == t: print("Yes") exit() s = s[-1]+s[:m-1] n += 1 print("No")
11
12
201
148
from collections import deque s = deque(list(eval(input()))) t = deque(list(eval(input()))) for i in range(len(s) + 1): if s == t: print("Yes") exit() p = s.pop() s.appendleft(p) print("No")
s = eval(input()) t = eval(input()) n = 0 m = len(s) while n != m: if s == t: print("Yes") exit() s = s[-1] + s[: m - 1] n += 1 print("No")
false
8.333333
[ "-from collections import deque", "-", "-s = deque(list(eval(input())))", "-t = deque(list(eval(input())))", "-for i in range(len(s) + 1):", "+s = eval(input())", "+t = eval(input())", "+n = 0", "+m = len(s)", "+while n != m:", "- p = s.pop()", "- s.appendleft(p)", "+ s = s[-1] + s[...
false
0.039257
0.036409
1.078239
[ "s601173573", "s473581823" ]
u711238850
p02754
python
s855916254
s372022343
21
17
3,316
2,940
Accepted
Accepted
19.05
import math from collections import deque def main(): n,a,b = tuple([int(t)for t in input().split()]) if b == 0: print(n) else: t = a+b res = (n // t)*a+min(n%t,a) print(res) if __name__ == "__main__": main()
n,a,b = tuple(map(int,input().split())) ans = n//(a+b)*a ans += min(n%(a+b),a) print(ans)
13
7
270
98
import math from collections import deque def main(): n, a, b = tuple([int(t) for t in input().split()]) if b == 0: print(n) else: t = a + b res = (n // t) * a + min(n % t, a) print(res) if __name__ == "__main__": main()
n, a, b = tuple(map(int, input().split())) ans = n // (a + b) * a ans += min(n % (a + b), a) print(ans)
false
46.153846
[ "-import math", "-from collections import deque", "-", "-", "-def main():", "- n, a, b = tuple([int(t) for t in input().split()])", "- if b == 0:", "- print(n)", "- else:", "- t = a + b", "- res = (n // t) * a + min(n % t, a)", "- print(res)", "-", "-",...
false
0.087605
0.03239
2.704688
[ "s855916254", "s372022343" ]
u708255304
p02659
python
s892120914
s790829194
23
21
9,164
9,100
Accepted
Accepted
8.7
A, B = list(map(str, input().split())) A = int(A) B = B.replace(".", "") B = int(B) print((A*B//100))
A, B = list(map(str, input().split())) A = int(A) B = B.replace(".", "") B = int(B) print(((A*B)//100))
5
5
98
100
A, B = list(map(str, input().split())) A = int(A) B = B.replace(".", "") B = int(B) print((A * B // 100))
A, B = list(map(str, input().split())) A = int(A) B = B.replace(".", "") B = int(B) print(((A * B) // 100))
false
0
[ "-print((A * B // 100))", "+print(((A * B) // 100))" ]
false
0.041497
0.035082
1.182872
[ "s892120914", "s790829194" ]
u887207211
p03240
python
s178279122
s090760870
36
30
3,064
3,064
Accepted
Accepted
16.67
N = int(eval(input())) xyh = [list(map(int,input().split())) for _ in range(N)] xyh = sorted(xyh, key = lambda x:-x[2]) mx, my, mh = xyh[0] for Cx in range(101): for Cy in range(101): H = mh+abs(mx-Cx)+abs(my-Cy) if(all(h == max(0, H-abs(x-Cx)-abs(y-Cy)) for x,y,h in xyh)): print((Cx,Cy,H)) ...
from operator import itemgetter N = int(eval(input())) xyh = [[int(i) for i in input().split()] for _ in range(N)] xyh.sort(key = itemgetter(2)) tx, ty, th = xyh[-1] for Cx in range(101): for Cy in range(101): H = th + abs(tx-Cx) + abs(ty-Cy) if all(h == max(H-abs(x-Cx)-abs(y-Cy), 0) for x, y, h i...
10
13
321
359
N = int(eval(input())) xyh = [list(map(int, input().split())) for _ in range(N)] xyh = sorted(xyh, key=lambda x: -x[2]) mx, my, mh = xyh[0] for Cx in range(101): for Cy in range(101): H = mh + abs(mx - Cx) + abs(my - Cy) if all(h == max(0, H - abs(x - Cx) - abs(y - Cy)) for x, y, h in xyh): ...
from operator import itemgetter N = int(eval(input())) xyh = [[int(i) for i in input().split()] for _ in range(N)] xyh.sort(key=itemgetter(2)) tx, ty, th = xyh[-1] for Cx in range(101): for Cy in range(101): H = th + abs(tx - Cx) + abs(ty - Cy) if all(h == max(H - abs(x - Cx) - abs(y - Cy), 0) for ...
false
23.076923
[ "+from operator import itemgetter", "+", "-xyh = [list(map(int, input().split())) for _ in range(N)]", "-xyh = sorted(xyh, key=lambda x: -x[2])", "-mx, my, mh = xyh[0]", "+xyh = [[int(i) for i in input().split()] for _ in range(N)]", "+xyh.sort(key=itemgetter(2))", "+tx, ty, th = xyh[-1]", "- ...
false
0.052127
0.047021
1.108599
[ "s178279122", "s090760870" ]
u919633157
p03998
python
s767300895
s169167163
20
17
3,316
2,940
Accepted
Accepted
15
from collections import deque a=deque(list(eval(input()))) b=deque(list(eval(input()))) c=deque(list(eval(input()))) tmp=a.popleft() while 1: if tmp=='a': if not len(a): print('A') break tmp=a.popleft() elif tmp=='b': if not len(b): print(...
s={i:list(eval(input())) for i in 'abc'} tmp='a' while s[tmp]: tmp=s[tmp].pop(0) print((tmp.upper())) # (#4130525)
21
7
454
117
from collections import deque a = deque(list(eval(input()))) b = deque(list(eval(input()))) c = deque(list(eval(input()))) tmp = a.popleft() while 1: if tmp == "a": if not len(a): print("A") break tmp = a.popleft() elif tmp == "b": if not len(b): prin...
s = {i: list(eval(input())) for i in "abc"} tmp = "a" while s[tmp]: tmp = s[tmp].pop(0) print((tmp.upper())) # (#4130525)
false
66.666667
[ "-from collections import deque", "-", "-a = deque(list(eval(input())))", "-b = deque(list(eval(input())))", "-c = deque(list(eval(input())))", "-tmp = a.popleft()", "-while 1:", "- if tmp == \"a\":", "- if not len(a):", "- print(\"A\")", "- break", "- tm...
false
0.03852
0.042114
0.91465
[ "s767300895", "s169167163" ]
u039864635
p02785
python
s183369959
s538996080
162
148
26,180
26,024
Accepted
Accepted
8.64
n, k = list(map(int, input().split())) h = [int(x) for x in input().split()] if len(h) <= k: print((0)) else: sorted_h = sorted(h, reverse=True) print((sum(sorted_h[k:])))
def find_minimum_normal_attack(monster_num, special_move_num, monster_healths): return sum(sorted(monster_healths, reverse=True)[special_move_num:]) if __name__ == '__main__': n, k = list(map(int, input().split())) h = list(map(int, input().split())) print((find_minimum_normal_attack(n, k, h)))...
9
8
183
313
n, k = list(map(int, input().split())) h = [int(x) for x in input().split()] if len(h) <= k: print((0)) else: sorted_h = sorted(h, reverse=True) print((sum(sorted_h[k:])))
def find_minimum_normal_attack(monster_num, special_move_num, monster_healths): return sum(sorted(monster_healths, reverse=True)[special_move_num:]) if __name__ == "__main__": n, k = list(map(int, input().split())) h = list(map(int, input().split())) print((find_minimum_normal_attack(n, k, h)))
false
11.111111
[ "-n, k = list(map(int, input().split()))", "-h = [int(x) for x in input().split()]", "-if len(h) <= k:", "- print((0))", "-else:", "- sorted_h = sorted(h, reverse=True)", "- print((sum(sorted_h[k:])))", "+def find_minimum_normal_attack(monster_num, special_move_num, monster_healths):", "+ ...
false
0.080655
0.046347
1.740224
[ "s183369959", "s538996080" ]
u185896732
p02657
python
s483962216
s659214771
108
22
27,092
9,008
Accepted
Accepted
79.63
import numpy a,b=list(map(int,input().split())) print((a*b))
a,b=list(map(int,input().split())) print((a*b))
3
2
54
40
import numpy a, b = list(map(int, input().split())) print((a * b))
a, b = list(map(int, input().split())) print((a * b))
false
33.333333
[ "-import numpy", "-" ]
false
0.034361
0.036353
0.945195
[ "s483962216", "s659214771" ]
u254871849
p02983
python
s766547775
s899056858
609
503
3,060
75,416
Accepted
Accepted
17.41
# 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 # ...
# 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 ...
34
31
712
712
# 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 n...
# 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 ...
false
8.823529
[ "-import math", "-", "+# import math", "- minimum = 2018", "+ remainders = []", "- minimum = min(minimum, i * j % mod)", "- print(minimum)", "+ remainders.append(i * j % mod)", "+ print((min(remainders)))" ]
false
0.069957
0.069096
1.012453
[ "s766547775", "s899056858" ]
u945181840
p03721
python
s434389852
s920891247
457
310
25,972
25,972
Accepted
Accepted
32.17
N, K = list(map(int, input().split())) a = [0] * N b = [0] * N for i in range(N): a[i], b[i] = list(map(int, input().split())) a, b = list(zip(*sorted(zip(a, b)))) count = 0 while K > 0: K -= b[count] count += 1 print((a[count - 1]))
import sys input = sys.stdin.readline N, K = list(map(int, input().split())) a = [0] * N b = [0] * N for i in range(N): a[i], b[i] = list(map(int, input().split())) a, b = list(zip(*sorted(zip(a, b)))) count = 0 while K > 0: K -= b[count] count += 1 print((a[count - 1]))
15
18
243
285
N, K = list(map(int, input().split())) a = [0] * N b = [0] * N for i in range(N): a[i], b[i] = list(map(int, input().split())) a, b = list(zip(*sorted(zip(a, b)))) count = 0 while K > 0: K -= b[count] count += 1 print((a[count - 1]))
import sys input = sys.stdin.readline N, K = list(map(int, input().split())) a = [0] * N b = [0] * N for i in range(N): a[i], b[i] = list(map(int, input().split())) a, b = list(zip(*sorted(zip(a, b)))) count = 0 while K > 0: K -= b[count] count += 1 print((a[count - 1]))
false
16.666667
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.037166
0.034946
1.063524
[ "s434389852", "s920891247" ]
u894114233
p00526
python
s335416123
s368555288
120
90
7,708
7,804
Accepted
Accepted
25
n=int(input()) il=list(map(int,input().split())) s=0 t=0 cnt=[] while t<n-1: if il[t]==il[t+1]: cnt.append(t+1-s) s=t+1 t+=1 if t==n-1: cnt.append(t+1-s) ans=0 if len(cnt)<=3: print((sum(cnt))) else: for i in range(len(cnt)-2): ans=max(ans,cnt[i]+cnt[...
n=int(input()) il=list(map(int,input().split())) s=0 cnt=[] for t in range(n): if t==n-1: cnt.append(t+1-s) break if il[t]==il[t+1]: cnt.append(t+1-s) s=t+1 ans=0 if len(cnt)<=3: print((sum(cnt))) else: for i in range(len(cnt)-2): ans=max(ans,cnt[i...
19
18
351
358
n = int(input()) il = list(map(int, input().split())) s = 0 t = 0 cnt = [] while t < n - 1: if il[t] == il[t + 1]: cnt.append(t + 1 - s) s = t + 1 t += 1 if t == n - 1: cnt.append(t + 1 - s) ans = 0 if len(cnt) <= 3: print((sum(cnt))) else: for i in range(len(cnt) - 2): ...
n = int(input()) il = list(map(int, input().split())) s = 0 cnt = [] for t in range(n): if t == n - 1: cnt.append(t + 1 - s) break if il[t] == il[t + 1]: cnt.append(t + 1 - s) s = t + 1 ans = 0 if len(cnt) <= 3: print((sum(cnt))) else: for i in range(len(cnt) - 2): ...
false
5.263158
[ "-t = 0", "-while t < n - 1:", "+for t in range(n):", "+ if t == n - 1:", "+ cnt.append(t + 1 - s)", "+ break", "- t += 1", "- if t == n - 1:", "- cnt.append(t + 1 - s)" ]
false
0.034625
0.038174
0.90704
[ "s335416123", "s368555288" ]
u545368057
p02665
python
s842958646
s754468135
183
78
84,508
85,964
Accepted
Accepted
57.38
n = int(eval(input())) As = list(map(int, input().split())) # ps = [0] * (n+1) # qs = [0] * (n+1) # ps[-1] = As[-1] # qs[-1] = As[-1] p = As[-1] q = As[-1] Asr = As[::-1] qs = [q] # 深い方から見ていく for j,a in enumerate(Asr[1:]): i = n - (j + 1) p = (p+1)//2 + a q = min(q + a, 2**i) # 最小...
from itertools import accumulate n = int(eval(input())) As = list(map(int, input().split())) if n == 0: if As[0] == 1:print((1)) else:print((-1)) exit() if As[0] != 0: print((-1)) exit() b = 1 ans = 1 acc = list(accumulate(As)) s = acc[-1] for ac,a in zip(acc[1:], As[1:]): ...
40
27
701
438
n = int(eval(input())) As = list(map(int, input().split())) # ps = [0] * (n+1) # qs = [0] * (n+1) # ps[-1] = As[-1] # qs[-1] = As[-1] p = As[-1] q = As[-1] Asr = As[::-1] qs = [q] # 深い方から見ていく for j, a in enumerate(Asr[1:]): i = n - (j + 1) p = (p + 1) // 2 + a q = min(q + a, 2**i) # 最小値が、2**iを超えると、深さ0畳め...
from itertools import accumulate n = int(eval(input())) As = list(map(int, input().split())) if n == 0: if As[0] == 1: print((1)) else: print((-1)) exit() if As[0] != 0: print((-1)) exit() b = 1 ans = 1 acc = list(accumulate(As)) s = acc[-1] for ac, a in zip(acc[1:], As[1:]): # ...
false
32.5
[ "+from itertools import accumulate", "+", "-# ps = [0] * (n+1)", "-# qs = [0] * (n+1)", "-# ps[-1] = As[-1]", "-# qs[-1] = As[-1]", "-p = As[-1]", "-q = As[-1]", "-Asr = As[::-1]", "-qs = [q]", "-# 深い方から見ていく", "-for j, a in enumerate(Asr[1:]):", "- i = n - (j + 1)", "- p = (p + 1) //...
false
0.070898
0.071125
0.99681
[ "s842958646", "s754468135" ]
u780962115
p03053
python
s044136879
s583266789
509
333
99,036
164,788
Accepted
Accepted
34.58
#darker and darker from collections import deque d=deque() e=deque() h,w=list(map(int,input().split())) field=[0 for i in range(h+2)] field[0]=[True for i in range(w+2)] distance=0 for i in range(h): s=eval(input()) a=[False for i in range(w+2)] a[0]=True for j in range(w): if s[j]=...
# Review problem from collections import deque H, W = list(map(int, input().split())) D = [list(eval(input())) for i in range(H)] visited = [[False for i in range(W)] for j in range(H)] dis = [[0 for i in range(W)] for j in range(H)] black = deque() dif = [(-1, 0), (1, 0), (0, 1), (0, -1)] for i in range(H)...
40
28
1,142
798
# darker and darker from collections import deque d = deque() e = deque() h, w = list(map(int, input().split())) field = [0 for i in range(h + 2)] field[0] = [True for i in range(w + 2)] distance = 0 for i in range(h): s = eval(input()) a = [False for i in range(w + 2)] a[0] = True for j in range(w): ...
# Review problem from collections import deque H, W = list(map(int, input().split())) D = [list(eval(input())) for i in range(H)] visited = [[False for i in range(W)] for j in range(H)] dis = [[0 for i in range(W)] for j in range(H)] black = deque() dif = [(-1, 0), (1, 0), (0, 1), (0, -1)] for i in range(H): for j...
false
30
[ "-# darker and darker", "+# Review problem", "-d = deque()", "-e = deque()", "-h, w = list(map(int, input().split()))", "-field = [0 for i in range(h + 2)]", "-field[0] = [True for i in range(w + 2)]", "-distance = 0", "-for i in range(h):", "- s = eval(input())", "- a = [False for i in ra...
false
0.214248
0.058879
3.638783
[ "s044136879", "s583266789" ]
u002459665
p03611
python
s253048118
s234798065
85
68
13,964
13,964
Accepted
Accepted
20
def main(): N = int(eval(input())) A = list(map(int, input().split())) c = [0] * (100000 + 1) for ai in A: c[ai] += 1 ans = 0 for i in range(len(c) - 2): ans = max(ans, c[i] + c[i+1] + c[i+2]) print(ans) if __name__ == "__main__": main()
def main(): N = int(eval(input())) A = list(map(int, input().split())) c = [0] * (100000 + 2) for ai in A: c[ai+1] += 1 c[ai] += 1 c[ai+2] += 1 print((max(c))) if __name__ == "__main__": main()
15
14
296
249
def main(): N = int(eval(input())) A = list(map(int, input().split())) c = [0] * (100000 + 1) for ai in A: c[ai] += 1 ans = 0 for i in range(len(c) - 2): ans = max(ans, c[i] + c[i + 1] + c[i + 2]) print(ans) if __name__ == "__main__": main()
def main(): N = int(eval(input())) A = list(map(int, input().split())) c = [0] * (100000 + 2) for ai in A: c[ai + 1] += 1 c[ai] += 1 c[ai + 2] += 1 print((max(c))) if __name__ == "__main__": main()
false
6.666667
[ "- c = [0] * (100000 + 1)", "+ c = [0] * (100000 + 2)", "+ c[ai + 1] += 1", "- ans = 0", "- for i in range(len(c) - 2):", "- ans = max(ans, c[i] + c[i + 1] + c[i + 2])", "- print(ans)", "+ c[ai + 2] += 1", "+ print((max(c)))" ]
false
0.105411
0.054035
1.950796
[ "s253048118", "s234798065" ]
u580920947
p03775
python
s048419368
s916575694
314
178
66,540
39,152
Accepted
Accepted
43.31
#!/usr/bin/env python from fractions import gcd def main(): N = int(eval(input())) ans = len(str(N)) for i in range(len(str(N)) // 2 + 1): for j in reversed(list(range(10**i, 10**(i+1)))): if N % j == 0: tmp = max(len(str(j)), len(str(N // j))) ...
#!/usr/bin/env python import math def main(): N = int(eval(input())) ans = len(str(N)) for i in range(1, math.ceil(math.sqrt(N))+1): if N % i == 0: tmp = max(len(str(i)), len(str(N // i))) if ans > tmp: ans = tmp print(ans) if __name__ == '__m...
16
14
455
333
#!/usr/bin/env python from fractions import gcd def main(): N = int(eval(input())) ans = len(str(N)) for i in range(len(str(N)) // 2 + 1): for j in reversed(list(range(10**i, 10 ** (i + 1)))): if N % j == 0: tmp = max(len(str(j)), len(str(N // j))) if an...
#!/usr/bin/env python import math def main(): N = int(eval(input())) ans = len(str(N)) for i in range(1, math.ceil(math.sqrt(N)) + 1): if N % i == 0: tmp = max(len(str(i)), len(str(N // i))) if ans > tmp: ans = tmp print(ans) if __name__ == "__main__":...
false
12.5
[ "-from fractions import gcd", "+import math", "- for i in range(len(str(N)) // 2 + 1):", "- for j in reversed(list(range(10**i, 10 ** (i + 1)))):", "- if N % j == 0:", "- tmp = max(len(str(j)), len(str(N // j)))", "- if ans > tmp:", "- ...
false
0.11282
0.041377
2.726647
[ "s048419368", "s916575694" ]
u687053495
p03128
python
s052886228
s826589306
176
161
14,692
30,196
Accepted
Accepted
8.52
N,M = list(map(int,input().split())) A = list(map(int,input().split())) weight = [0,2,5,5,4,5,6,3,7,6] dp=[-1]*(N+1) dp[0] = 0 for i in range(N+1): if dp[i] == -1: continue for a in A: if i+weight[a]<N+1: dp[i+weight[a]] = max(dp[i+weight[a]],dp[i]*10+a) print((dp[-1]))
N, M = list(map(int, input().split())) A = list(map(int, input().split())) numbers = [0,2,5,5,4,5,6,3,7,6] dp = ["-" for i in range(11000)] dp[0] = "" def cal(x, y): lenx = len(x) leny = len(y) if lenx > leny: return x if leny > lenx: return y return max(x, y) for i in r...
13
29
290
473
N, M = list(map(int, input().split())) A = list(map(int, input().split())) weight = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] dp = [-1] * (N + 1) dp[0] = 0 for i in range(N + 1): if dp[i] == -1: continue for a in A: if i + weight[a] < N + 1: dp[i + weight[a]] = max(dp[i + weight[a]], dp[i] * 10...
N, M = list(map(int, input().split())) A = list(map(int, input().split())) numbers = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] dp = ["-" for i in range(11000)] dp[0] = "" def cal(x, y): lenx = len(x) leny = len(y) if lenx > leny: return x if leny > lenx: return y return max(x, y) for i in r...
false
55.172414
[ "-weight = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]", "-dp = [-1] * (N + 1)", "-dp[0] = 0", "-for i in range(N + 1):", "- if dp[i] == -1:", "+numbers = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]", "+dp = [\"-\" for i in range(11000)]", "+dp[0] = \"\"", "+", "+", "+def cal(x, y):", "+ lenx = len(x)", "+ l...
false
0.078574
0.082898
0.947846
[ "s052886228", "s826589306" ]
u476124554
p03106
python
s648394828
s231760647
37
27
4,208
3,952
Accepted
Accepted
27.03
import queue a,b,c = list(map(int,input().split())) l = list() for i in range(1,101): if(a%i == 0 and b%i == 0): l.append(i) print((l[len(l)-c]))
import queue a,b,c = list(map(int,input().split())) q = queue.LifoQueue() for i in range(1,101): if(a%i == 0 and b%i == 0): q.put(i) for i in range(c-1): q.get() print((q.get()))
7
9
149
186
import queue a, b, c = list(map(int, input().split())) l = list() for i in range(1, 101): if a % i == 0 and b % i == 0: l.append(i) print((l[len(l) - c]))
import queue a, b, c = list(map(int, input().split())) q = queue.LifoQueue() for i in range(1, 101): if a % i == 0 and b % i == 0: q.put(i) for i in range(c - 1): q.get() print((q.get()))
false
22.222222
[ "-l = list()", "+q = queue.LifoQueue()", "- l.append(i)", "-print((l[len(l) - c]))", "+ q.put(i)", "+for i in range(c - 1):", "+ q.get()", "+print((q.get()))" ]
false
0.035793
0.038631
0.926524
[ "s648394828", "s231760647" ]
u606045429
p02930
python
s834620813
s226832361
104
83
3,952
3,952
Accepted
Accepted
20.19
N = int(eval(input())) for i in range(N): A = [] for j in range(i + 1, N): d = i ^ j A.append((d & -d).bit_length()) print((*A))
N = int(eval(input())) for i in range(N): A = [] for j in range(i + 1, N): A.append((i ^ j).bit_length()) print((*A))
8
7
157
137
N = int(eval(input())) for i in range(N): A = [] for j in range(i + 1, N): d = i ^ j A.append((d & -d).bit_length()) print((*A))
N = int(eval(input())) for i in range(N): A = [] for j in range(i + 1, N): A.append((i ^ j).bit_length()) print((*A))
false
12.5
[ "- d = i ^ j", "- A.append((d & -d).bit_length())", "+ A.append((i ^ j).bit_length())" ]
false
0.12243
0.111364
1.099366
[ "s834620813", "s226832361" ]
u747602774
p02850
python
s744249949
s925230069
954
608
74,912
85,688
Accepted
Accepted
36.27
from collections import deque n = int(eval(input())) ab = [list(map(int,input().split())) for i in range(n-1)] ver = [[] for i in range(n)] for i in range(n-1): a,b = ab[i][0],ab[i][1] ver[a-1].append(b-1) ver[b-1].append(a-1) #print(ver) color = [dict() for i in range(n)] q = deque() ...
import sys sys.setrecursionlimit(10**8) n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n-1): a,b = list(map(int,input().split())) edge[a-1].append((b-1,i)) edge[b-1].append((a-1,i)) k = max(len(e) for e in edge) print(k) ans = [-1]*(n-1) def dfs(v=0, p=-1, to_p_col ...
47
28
839
554
from collections import deque n = int(eval(input())) ab = [list(map(int, input().split())) for i in range(n - 1)] ver = [[] for i in range(n)] for i in range(n - 1): a, b = ab[i][0], ab[i][1] ver[a - 1].append(b - 1) ver[b - 1].append(a - 1) # print(ver) color = [dict() for i in range(n)] q = deque() i = 1...
import sys sys.setrecursionlimit(10**8) n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n - 1): a, b = list(map(int, input().split())) edge[a - 1].append((b - 1, i)) edge[b - 1].append((a - 1, i)) k = max(len(e) for e in edge) print(k) ans = [-1] * (n - 1) def dfs(v=0, p=-1, to_p_col=...
false
40.425532
[ "-from collections import deque", "+import sys", "+sys.setrecursionlimit(10**8)", "-ab = [list(map(int, input().split())) for i in range(n - 1)]", "-ver = [[] for i in range(n)]", "+edge = [[] for i in range(n)]", "- a, b = ab[i][0], ab[i][1]", "- ver[a - 1].append(b - 1)", "- ver[b - 1].ap...
false
0.044852
0.037178
1.206408
[ "s744249949", "s925230069" ]
u219417113
p03163
python
s844635061
s319747855
518
171
120,172
14,584
Accepted
Accepted
66.99
N, W = list(map(int, input().split())) WV = [tuple(map(int, input().split())) for _ in range(N)] dp = [[0] * (W+1) for _ in range(N+1)] for i in range(1, N+1): for w in range(1, W+1): if w >= WV[i-1][0]: dp[i][w] = max(dp[i-1][w], dp[i-1][w-WV[i-1][0]] + WV[i-1][1]) else: ...
import numpy as np n, W = list(map(int, input().split())) w, v = [0] * n, [0] * n for i in range(n): w[i], v[i] = list(map(int, input().split())) ndp = np.zeros(W + 1, dtype=np.int64) for w, v in zip(w, v): # [:w]は品物の重量がナップサックの空きよりも重いので更新しない。 # ndp[w:] は通常DPでのdp[i][w]=dp[i-1][w]。そのままでの更新。 #...
13
15
364
414
N, W = list(map(int, input().split())) WV = [tuple(map(int, input().split())) for _ in range(N)] dp = [[0] * (W + 1) for _ in range(N + 1)] for i in range(1, N + 1): for w in range(1, W + 1): if w >= WV[i - 1][0]: dp[i][w] = max(dp[i - 1][w], dp[i - 1][w - WV[i - 1][0]] + WV[i - 1][1]) e...
import numpy as np n, W = list(map(int, input().split())) w, v = [0] * n, [0] * n for i in range(n): w[i], v[i] = list(map(int, input().split())) ndp = np.zeros(W + 1, dtype=np.int64) for w, v in zip(w, v): # [:w]は品物の重量がナップサックの空きよりも重いので更新しない。 # ndp[w:] は通常DPでのdp[i][w]=dp[i-1][w]。そのままでの更新。 # ndp[:-w] + ...
false
13.333333
[ "-N, W = list(map(int, input().split()))", "-WV = [tuple(map(int, input().split())) for _ in range(N)]", "-dp = [[0] * (W + 1) for _ in range(N + 1)]", "-for i in range(1, N + 1):", "- for w in range(1, W + 1):", "- if w >= WV[i - 1][0]:", "- dp[i][w] = max(dp[i - 1][w], dp[i - 1][w...
false
0.044265
0.182104
0.243075
[ "s844635061", "s319747855" ]
u414980766
p02883
python
s804238249
s754091865
561
447
37,292
38,624
Accepted
Accepted
20.32
# 時間内に解ける import numpy as np N, K = list(map(int, input().split())) A = np.array(sorted(list(map(int, input().split())))) F = np.array(sorted(list(map(int, input().split())), reverse=True)) left = - 1 right = 10**12 def f(x): #return np.maximum(0, A - x//F) .sum()<= K return A.sum() - np.minimum(A,...
import numpy as np N, K = list(map(int, input().split())) A = np.array(list(map(int, input().split()))) F = np.array(list(map(int, input().split()))) A.sort(); F.sort(); F = F[::- 1] left = - 1 right = 10**12 def f(x): l = x//F return A[A > l].sum() <= K + l[A > l].sum() while right - left > 1...
21
22
474
432
# 時間内に解ける import numpy as np N, K = list(map(int, input().split())) A = np.array(sorted(list(map(int, input().split())))) F = np.array(sorted(list(map(int, input().split())), reverse=True)) left = -1 right = 10**12 def f(x): # return np.maximum(0, A - x//F) .sum()<= K return A.sum() - np.minimum(A, x // F).s...
import numpy as np N, K = list(map(int, input().split())) A = np.array(list(map(int, input().split()))) F = np.array(list(map(int, input().split()))) A.sort() F.sort() F = F[::-1] left = -1 right = 10**12 def f(x): l = x // F return A[A > l].sum() <= K + l[A > l].sum() while right - left > 1: mid = (le...
false
4.545455
[ "-# 時間内に解ける", "-A = np.array(sorted(list(map(int, input().split()))))", "-F = np.array(sorted(list(map(int, input().split())), reverse=True))", "+A = np.array(list(map(int, input().split())))", "+F = np.array(list(map(int, input().split())))", "+A.sort()", "+F.sort()", "+F = F[::-1]", "- # return...
false
0.370376
0.292768
1.265084
[ "s804238249", "s754091865" ]
u493520238
p02787
python
s859188086
s709419268
479
165
41,964
74,056
Accepted
Accepted
65.55
H, N = list(map(int, input().split())) abl = [] for _ in range(N): ab = list(map(int, input().split()) ) abl.append(ab) dp = [10**8]*(2*10**4+1) dp[0] = 0 for h in range(H+1): for ab in abl: a,b = ab dp[h+a] = min(dp[h+a], dp[h]+b) print((min( dp[H:] )))
h,n = list(map(int, input().split())) abl = [tuple(map(int, input().split())) for _ in range(n)] dp = [10**18]*(h+1) dp[0] = 0 for i in range(h): for a,b in abl: next_h = min(h,i+a) dp[next_h] = min(dp[next_h], dp[i]+b) print((dp[-1]))
14
11
290
259
H, N = list(map(int, input().split())) abl = [] for _ in range(N): ab = list(map(int, input().split())) abl.append(ab) dp = [10**8] * (2 * 10**4 + 1) dp[0] = 0 for h in range(H + 1): for ab in abl: a, b = ab dp[h + a] = min(dp[h + a], dp[h] + b) print((min(dp[H:])))
h, n = list(map(int, input().split())) abl = [tuple(map(int, input().split())) for _ in range(n)] dp = [10**18] * (h + 1) dp[0] = 0 for i in range(h): for a, b in abl: next_h = min(h, i + a) dp[next_h] = min(dp[next_h], dp[i] + b) print((dp[-1]))
false
21.428571
[ "-H, N = list(map(int, input().split()))", "-abl = []", "-for _ in range(N):", "- ab = list(map(int, input().split()))", "- abl.append(ab)", "-dp = [10**8] * (2 * 10**4 + 1)", "+h, n = list(map(int, input().split()))", "+abl = [tuple(map(int, input().split())) for _ in range(n)]", "+dp = [10**...
false
0.133807
0.260258
0.514132
[ "s859188086", "s709419268" ]
u644907318
p03244
python
s067731968
s391901287
270
147
66,668
102,196
Accepted
Accepted
45.56
n = int(eval(input())) V = list(map(int,input().split())) Ce = {} Co = {} for i in range(n): v = V[i] if i%2==0: if v not in Ce: Ce[v] = 0 Ce[v] += 1 else: if v not in Co: Co[v] = 0 Co[v] += 1 Ce = sorted(list(Ce.items()),key=lambda x:x[1...
n = int(eval(input())) V = list(map(int,input().split())) Ce = {} Co = {} for i in range(n): v = V[i] if i%2==0: if v not in Ce: Ce[v]=0 Ce[v] += 1 else: if v not in Co: Co[v]=0 Co[v] += 1 Ce = sorted(list(Ce.items()),key=lambda x:x[1],re...
26
41
640
1,000
n = int(eval(input())) V = list(map(int, input().split())) Ce = {} Co = {} for i in range(n): v = V[i] if i % 2 == 0: if v not in Ce: Ce[v] = 0 Ce[v] += 1 else: if v not in Co: Co[v] = 0 Co[v] += 1 Ce = sorted(list(Ce.items()), key=lambda x: x[1], reve...
n = int(eval(input())) V = list(map(int, input().split())) Ce = {} Co = {} for i in range(n): v = V[i] if i % 2 == 0: if v not in Ce: Ce[v] = 0 Ce[v] += 1 else: if v not in Co: Co[v] = 0 Co[v] += 1 Ce = sorted(list(Ce.items()), key=lambda x: x[1], reve...
false
36.585366
[ "-if len(Ce) == 1 and len(Co) == 1 and Ce[0][0] == Co[0][0]:", "- m = n // 2", "+if Ce[0][0] != Co[0][0]:", "+ cnt = 0", "+ for i in range(1, len(Ce)):", "+ cnt += Ce[i][1]", "+ for i in range(1, len(Co)):", "+ cnt += Co[i][1]", "+ print(cnt)", "- if Ce[0][0] != Co[...
false
0.038069
0.037299
1.020646
[ "s067731968", "s391901287" ]
u808585569
p03087
python
s574908070
s418830225
937
785
40,368
40,324
Accepted
Accepted
16.22
import numpy as np N, Q=list(map(int,input().split())) S=eval(input()) L =[list(map(int,input().split()))for i in range(Q)] c = [0]*(N) #ACのチェック s = [0]*(N) #ACの累積和 ans = [0]*Q for i in range(N-1): if S[i] == "A" and S[i+1] == "C": c[i+1] = 1 s = np.cumsum(c) for i in range(Q): ans[i] = s[L[i][...
from sys import stdin import numpy as np N, Q=list(map(int,input().split())) S=eval(input()) L =[list(map(int, stdin.readline().split())) for _ in range(Q)] c = [0]*(N) #ACのチェック s = [0]*(N) #ACの累積和 ans = [0]*Q for i in range(N-1): if S[i] == "A" and S[i+1] == "C": c[i+1] = 1 s = np.cumsum(c) for ...
17
18
356
390
import numpy as np N, Q = list(map(int, input().split())) S = eval(input()) L = [list(map(int, input().split())) for i in range(Q)] c = [0] * (N) # ACのチェック s = [0] * (N) # ACの累積和 ans = [0] * Q for i in range(N - 1): if S[i] == "A" and S[i + 1] == "C": c[i + 1] = 1 s = np.cumsum(c) for i in range(Q): ...
from sys import stdin import numpy as np N, Q = list(map(int, input().split())) S = eval(input()) L = [list(map(int, stdin.readline().split())) for _ in range(Q)] c = [0] * (N) # ACのチェック s = [0] * (N) # ACの累積和 ans = [0] * Q for i in range(N - 1): if S[i] == "A" and S[i + 1] == "C": c[i + 1] = 1 s = np.cu...
false
5.555556
[ "+from sys import stdin", "-L = [list(map(int, input().split())) for i in range(Q)]", "+L = [list(map(int, stdin.readline().split())) for _ in range(Q)]" ]
false
0.28487
0.605396
0.470551
[ "s574908070", "s418830225" ]
u040298438
p03759
python
s154628267
s883248843
33
29
9,152
9,144
Accepted
Accepted
12.12
a, b, c = list(map(int, input().split())) print(("YES" if b - a == c - b else "NO"))
a, b, c = list(map(int, input().split())) print((("NO", "YES")[b - a == c - b]))
2
2
78
73
a, b, c = list(map(int, input().split())) print(("YES" if b - a == c - b else "NO"))
a, b, c = list(map(int, input().split())) print((("NO", "YES")[b - a == c - b]))
false
0
[ "-print((\"YES\" if b - a == c - b else \"NO\"))", "+print(((\"NO\", \"YES\")[b - a == c - b]))" ]
false
0.047115
0.047509
0.991707
[ "s154628267", "s883248843" ]