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
u987164499
p03013
python
s272925609
s604992800
482
165
460,020
7,076
Accepted
Accepted
65.77
from sys import stdin import bisect n,m = [int(x) for x in stdin.readline().rstrip().split()] if m == 0: li = [0] else: li = [int(stdin.readline().rstrip()) for _ in range(m)] dp = [-1]*(n+1) dp[0] = 1 if li[0] == 1: dp[1] = 0 else: dp[1] = 1 for i in range(2,n+1): if li[bise...
n,m = list(map(int,input().split())) a = [int(eval(input())) for _ in range(m)] now = 0 point = 1 mod = 10**9+7 def fib(n,mod): a, b = 1, 1 for _ in range(n): a, b = b %mod, (a + b)%mod return a%mod for i in range(1,m): if a[i-1]+1 == a[i]: print((0)) exit() ...
25
29
441
474
from sys import stdin import bisect n, m = [int(x) for x in stdin.readline().rstrip().split()] if m == 0: li = [0] else: li = [int(stdin.readline().rstrip()) for _ in range(m)] dp = [-1] * (n + 1) dp[0] = 1 if li[0] == 1: dp[1] = 0 else: dp[1] = 1 for i in range(2, n + 1): if li[bisect.bisect_right...
n, m = list(map(int, input().split())) a = [int(eval(input())) for _ in range(m)] now = 0 point = 1 mod = 10**9 + 7 def fib(n, mod): a, b = 1, 1 for _ in range(n): a, b = b % mod, (a + b) % mod return a % mod for i in range(1, m): if a[i - 1] + 1 == a[i]: print((0)) exit() fo...
false
13.793103
[ "-from sys import stdin", "-import bisect", "+n, m = list(map(int, input().split()))", "+a = [int(eval(input())) for _ in range(m)]", "+now = 0", "+point = 1", "+mod = 10**9 + 7", "-n, m = [int(x) for x in stdin.readline().rstrip().split()]", "-if m == 0:", "- li = [0]", "-else:", "- li ...
false
0.038797
0.039899
0.972381
[ "s272925609", "s604992800" ]
u346812984
p03804
python
s392090920
s532708002
160
21
3,064
3,064
Accepted
Accepted
86.88
N, M = list(map(int, input().split())) A = [] B = [] # for _ in range(N): # A.append(list(input())) # for _ in range(M): # B.append(list(input())) for _ in range(N): A.append(eval(input())) for _ in range(M): B.append(eval(input())) for i in range(N - M + 1): for j in range(N - M + 1...
N, M = list(map(int, input().split())) A = [] B = [] # for _ in range(N): # A.append(list(input())) # for _ in range(M): # B.append(list(input())) for _ in range(N): A.append(eval(input())) for _ in range(M): B.append(eval(input())) for i in range(N - M + 1): for j in range(N - M + 1...
34
38
658
736
N, M = list(map(int, input().split())) A = [] B = [] # for _ in range(N): # A.append(list(input())) # for _ in range(M): # B.append(list(input())) for _ in range(N): A.append(eval(input())) for _ in range(M): B.append(eval(input())) for i in range(N - M + 1): for j in range(N - M + 1): # mat...
N, M = list(map(int, input().split())) A = [] B = [] # for _ in range(N): # A.append(list(input())) # for _ in range(M): # B.append(list(input())) for _ in range(N): A.append(eval(input())) for _ in range(M): B.append(eval(input())) for i in range(N - M + 1): for j in range(N - M + 1): # mat...
false
10.526316
[ "+ break", "+ if not flag:", "+ break" ]
false
0.0359
0.037449
0.958655
[ "s392090920", "s532708002" ]
u309141201
p02881
python
s160950339
s077211773
212
115
3,552
3,268
Accepted
Accepted
45.75
n = int(eval(input())) dv = float('inf') def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors div = make_divisors(n) # pr...
N = int(eval(input())) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors div = make_divisors(N) if len(div) % 2 == 0:...
27
17
712
428
n = int(eval(input())) dv = float("inf") def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) divisors.sort() return divisors div = make_divisors(n) # print(ma...
N = int(eval(input())) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) divisors.sort() return divisors div = make_divisors(N) if len(div) % 2 == 0: pr...
false
37.037037
[ "-n = int(eval(input()))", "-dv = float(\"inf\")", "+N = int(eval(input()))", "-div = make_divisors(n)", "-# print(make_divisors(n), len(make_divisors(n)))", "-# print(make_divisors(n)[169//2])", "-l = len(make_divisors(n))", "-# print(div)", "-if l % 2 == 0:", "- for i in range(l // 2):", "-...
false
0.087145
0.04309
2.022379
[ "s160950339", "s077211773" ]
u029000441
p03078
python
s611494373
s701137601
514
161
94,988
79,168
Accepted
Accepted
68.68
# coding: utf-8 # hello worldと表示する #float型を許すな #numpyはpythonで 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, product from bisect import bisect_l...
# coding: utf-8 # hello worldと表示する #float型を許すな #numpyはpythonで 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, product from bisect import bisect_l...
70
59
2,004
1,538
# coding: utf-8 # hello worldと表示する # float型を許すな # numpyはpythonで 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, product from bisect import bisect_left, bi...
# coding: utf-8 # hello worldと表示する # float型を許すな # numpyはpythonで 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, product from bisect import bisect_left, bi...
false
15.714286
[ "-", "-", "-def main():", "- x, y, z, k = MI()", "- set_ = set()", "- A = sorted(LI(), reverse=True)", "- B = sorted(LI(), reverse=True)", "- C = sorted(LI(), reverse=True)", "- Q = [[(A[0] + B[0] + C[0]) * (-1), 0, 0, 0]]", "- heapify(Q)", "- set_.add((0, 0, 0))", "- ...
false
0.036093
0.036183
0.997502
[ "s611494373", "s701137601" ]
u061916079
p03947
python
s306807721
s639142965
184
47
12,616
3,188
Accepted
Accepted
74.46
# -*- coding: utf-8 -*- import math import sys import itertools import numpy as np import functools import collections mo = 1000000007 r = range s = eval(input()) ret = 0 for i in range(len(s)-1): ret += s[i] != s[i+1] print(ret)
s = eval(input()) ret = 0 for i in range(len(s)-1): ret += s[i] != s[i+1] print(ret)
15
5
243
87
# -*- coding: utf-8 -*- import math import sys import itertools import numpy as np import functools import collections mo = 1000000007 r = range s = eval(input()) ret = 0 for i in range(len(s) - 1): ret += s[i] != s[i + 1] print(ret)
s = eval(input()) ret = 0 for i in range(len(s) - 1): ret += s[i] != s[i + 1] print(ret)
false
66.666667
[ "-# -*- coding: utf-8 -*-", "-import math", "-import sys", "-import itertools", "-import numpy as np", "-import functools", "-import collections", "-", "-mo = 1000000007", "-r = range" ]
false
0.039436
0.040014
0.985561
[ "s306807721", "s639142965" ]
u594567187
p03290
python
s738083270
s182638480
704
304
3,316
3,316
Accepted
Accepted
56.82
dp = [[0 for n in range(1001)] for m in range(11)] length, goal = list(map(int, input().split(" "))) problems = [] for l in range(length): a, b = list(map(int, input().split(" "))) problems.append([a, b]) for i in range(length): max_problems = problems[i][0] for k in range(1000):...
import math length, goal = list(map(int, input().split(" "))) nums = [] sumall = [] for i in range(length): a, b = list(map(int, input().split(" "))) nums.append(a) sumall.append(a * (i + 1) * 100 + b) answer = float("inf") for bit in range(2 ** length): temp = [] for i in range(length - ...
24
34
927
1,241
dp = [[0 for n in range(1001)] for m in range(11)] length, goal = list(map(int, input().split(" "))) problems = [] for l in range(length): a, b = list(map(int, input().split(" "))) problems.append([a, b]) for i in range(length): max_problems = problems[i][0] for k in range(1000): if dp[i][k]: ...
import math length, goal = list(map(int, input().split(" "))) nums = [] sumall = [] for i in range(length): a, b = list(map(int, input().split(" "))) nums.append(a) sumall.append(a * (i + 1) * 100 + b) answer = float("inf") for bit in range(2**length): temp = [] for i in range(length - 1, -1, -1): ...
false
29.411765
[ "-dp = [[0 for n in range(1001)] for m in range(11)]", "+import math", "+", "-problems = []", "-for l in range(length):", "+nums = []", "+sumall = []", "+for i in range(length):", "- problems.append([a, b])", "-for i in range(length):", "- max_problems = problems[i][0]", "- for k in r...
false
0.122213
0.056978
2.144935
[ "s738083270", "s182638480" ]
u488178971
p03073
python
s716252115
s468051836
67
60
3,188
3,188
Accepted
Accepted
10.45
S = str(eval(input())) s0=0 s1=0 for i in range(len(S)): if i%2==0 and S[i]=="0": s1+=1 elif i%2==0 and S[i]=="1" : s0+=1 elif i%2==1 and S[i]=="0": s0+=1 elif i%2==1 and S[i]=="1": s1+=1 print((min(s0,s1)))
#C S =eval(input()) s0=0 s1=0 for i in range(len(S)): if i%2==0 and S[i]=="0": s1+=1 elif i%2==0: s0+=1 elif i%2!=0 and S[i]=="0": s0+=1 elif i%2!=0: s1+=1 print((min(s0,s1)))
15
14
263
229
S = str(eval(input())) s0 = 0 s1 = 0 for i in range(len(S)): if i % 2 == 0 and S[i] == "0": s1 += 1 elif i % 2 == 0 and S[i] == "1": s0 += 1 elif i % 2 == 1 and S[i] == "0": s0 += 1 elif i % 2 == 1 and S[i] == "1": s1 += 1 print((min(s0, s1)))
# C S = eval(input()) s0 = 0 s1 = 0 for i in range(len(S)): if i % 2 == 0 and S[i] == "0": s1 += 1 elif i % 2 == 0: s0 += 1 elif i % 2 != 0 and S[i] == "0": s0 += 1 elif i % 2 != 0: s1 += 1 print((min(s0, s1)))
false
6.666667
[ "-S = str(eval(input()))", "+# C", "+S = eval(input())", "- elif i % 2 == 0 and S[i] == \"1\":", "+ elif i % 2 == 0:", "- elif i % 2 == 1 and S[i] == \"0\":", "+ elif i % 2 != 0 and S[i] == \"0\":", "- elif i % 2 == 1 and S[i] == \"1\":", "+ elif i % 2 != 0:" ]
false
0.054218
0.041966
1.291952
[ "s716252115", "s468051836" ]
u076917070
p03817
python
s831258371
s550425512
187
17
38,256
2,940
Accepted
Accepted
90.91
import sys input = sys.stdin.readline def main(): x = int(eval(input())) ans = 2 * (x//11) r = x % 11 if r > 6: ans += 2 elif r > 0: ans += 1 print(ans) if __name__ == '__main__': main()
import sys input = sys.stdin.readline def main(): x = int(eval(input())) d, m = divmod(x, 11) print((2*d + int(m > 6) + int(m > 0))) if __name__ == '__main__': main()
17
12
245
190
import sys input = sys.stdin.readline def main(): x = int(eval(input())) ans = 2 * (x // 11) r = x % 11 if r > 6: ans += 2 elif r > 0: ans += 1 print(ans) if __name__ == "__main__": main()
import sys input = sys.stdin.readline def main(): x = int(eval(input())) d, m = divmod(x, 11) print((2 * d + int(m > 6) + int(m > 0))) if __name__ == "__main__": main()
false
29.411765
[ "- ans = 2 * (x // 11)", "- r = x % 11", "- if r > 6:", "- ans += 2", "- elif r > 0:", "- ans += 1", "- print(ans)", "+ d, m = divmod(x, 11)", "+ print((2 * d + int(m > 6) + int(m > 0)))" ]
false
0.08759
0.081743
1.071529
[ "s831258371", "s550425512" ]
u564902833
p02953
python
s072569176
s841718730
94
70
14,224
14,612
Accepted
Accepted
25.53
N = int(eval(input())) H = [0] + list(map(int, input().split())) ans = 'Yes' for i in range(N): if H[i + 1] > H[i]: H[i + 1] -= 1 if H[i] > H[i + 1]: ans = 'No' print(ans)
from functools import reduce N = int(eval(input())) H = list(map(int, input().split())) # 先頭から順に、可能な限りマスの高さを低くする戦略により、単調非減少にできるか判定 ans, _ = reduce( lambda acc, h: ( ( 'Yes' if acc[0] == 'Yes' and acc[1] <= h else 'No' ), h if acc[1] >= h else h ...
11
20
202
367
N = int(eval(input())) H = [0] + list(map(int, input().split())) ans = "Yes" for i in range(N): if H[i + 1] > H[i]: H[i + 1] -= 1 if H[i] > H[i + 1]: ans = "No" print(ans)
from functools import reduce N = int(eval(input())) H = list(map(int, input().split())) # 先頭から順に、可能な限りマスの高さを低くする戦略により、単調非減少にできるか判定 ans, _ = reduce( lambda acc, h: ( ("Yes" if acc[0] == "Yes" and acc[1] <= h else "No"), h if acc[1] >= h else h - 1, ), H, ("Yes", 0), ) print(ans)
false
45
[ "+from functools import reduce", "+", "-H = [0] + list(map(int, input().split()))", "-ans = \"Yes\"", "-for i in range(N):", "- if H[i + 1] > H[i]:", "- H[i + 1] -= 1", "- if H[i] > H[i + 1]:", "- ans = \"No\"", "+H = list(map(int, input().split()))", "+# 先頭から順に、可能な限りマスの高さを低く...
false
0.07156
0.036855
1.94164
[ "s072569176", "s841718730" ]
u780962115
p02685
python
s912513727
s109262286
741
186
42,256
99,120
Accepted
Accepted
74.9
mod=998244353 ##mod,nについての制約は自分でいかに記入する def find_power(n,mod): # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである) powlist=[0]*(n+1) powlist[0]=1 powlist[1]=1 for i in range(2,n+1): powlist[i]=powlist[i-1]*i%(mod) return powlist #あるかずxのn乗をmodで割ったあまりを返す関数pow_cal(x,n,mod) def p...
mod=998244353 ##mod,nについての制約は自分でいかに記入する def find_power(n,mod): # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである) powlist=[0]*(n+1) powlist[0]=1 powlist[1]=1 for i in range(2,n+1): powlist[i]=powlist[i-1]*i%(mod) return powlist def find_inv_power(n,mod): #0!からn!までの逆元を素数...
57
46
1,261
969
mod = 998244353 ##mod,nについての制約は自分でいかに記入する def find_power(n, mod): # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである) powlist = [0] * (n + 1) powlist[0] = 1 powlist[1] = 1 for i in range(2, n + 1): powlist[i] = powlist[i - 1] * i % (mod) return powlist # あるかずxのn乗をmodで割ったあまりを返す関数pow_cal(x,n,m...
mod = 998244353 ##mod,nについての制約は自分でいかに記入する def find_power(n, mod): # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである) powlist = [0] * (n + 1) powlist[0] = 1 powlist[1] = 1 for i in range(2, n + 1): powlist[i] = powlist[i - 1] * i % (mod) return powlist def find_inv_power(n, mod): # 0!からn...
false
19.298246
[ "-# あるかずxのn乗をmodで割ったあまりを返す関数pow_cal(x,n,mod)", "-def pow_cal(x, n, mod):", "- if n == 0:", "- return 1", "- elif n == 1:", "- return x % mod", "- elif n >= 2:", "- if n % 2 == 0:", "- return (pow_cal(x, n // 2, mod) ** 2) % mod", "- else:", "- ...
false
0.418406
0.479974
0.871727
[ "s912513727", "s109262286" ]
u252828980
p03273
python
s872608419
s562781637
24
22
3,316
4,596
Accepted
Accepted
8.33
h,w = list(map(int,input().split())) li,li2 = [],[] for i in range(h): a = list(eval(input())) if "#" in a: li.append(a) for i in range(len(li)): for j in range(w): if li[i][j] == ".": li[i][j] = 0 elif li[i][j] == "#": li[i][j] = 1 li = list(zip...
h,w = map(int,input().split()) L = [] for i in range(h): L.append(list(input())) L = [x for x in L if "#" in x] L = [x for x in zip(*L)] L = [x for x in L if "#" in x] L = [x for x in zip(*L)] for i in range(len(L)): print(*L[i],sep = "")
28
10
696
255
h, w = list(map(int, input().split())) li, li2 = [], [] for i in range(h): a = list(eval(input())) if "#" in a: li.append(a) for i in range(len(li)): for j in range(w): if li[i][j] == ".": li[i][j] = 0 elif li[i][j] == "#": li[i][j] = 1 li = list(zip(*li)) for...
h, w = map(int, input().split()) L = [] for i in range(h): L.append(list(input())) L = [x for x in L if "#" in x] L = [x for x in zip(*L)] L = [x for x in L if "#" in x] L = [x for x in zip(*L)] for i in range(len(L)): print(*L[i], sep="")
false
64.285714
[ "-h, w = list(map(int, input().split()))", "-li, li2 = [], []", "+h, w = map(int, input().split())", "+L = []", "- a = list(eval(input()))", "- if \"#\" in a:", "- li.append(a)", "-for i in range(len(li)):", "- for j in range(w):", "- if li[i][j] == \".\":", "- ...
false
0.048465
0.196981
0.24604
[ "s872608419", "s562781637" ]
u260036763
p03944
python
s807930547
s181028955
72
17
3,188
3,064
Accepted
Accepted
76.39
W, H, N = list(map(int, input().split())) zahyo = [list(map(int, input().split())) for i in range(N)] area = [[0 for i in range(H)] for j in range(W)] for i in range(N): if zahyo[i][2] == 1: for j in range(zahyo[i][0]): for k in range(H): area[j][k] = 1 ...
W, H, N = list(map(int, input().split())) zahyo = [list(map(int, input().split())) for i in range(N)] x_min = y_min = 0 x_max = W y_max = H for i in range(N): if zahyo[i][2] == 1: if x_min < zahyo[i][0]: x_min = zahyo[i][0] elif zahyo[i][2] == 2: if zahyo[i][0] < x_ma...
30
26
852
688
W, H, N = list(map(int, input().split())) zahyo = [list(map(int, input().split())) for i in range(N)] area = [[0 for i in range(H)] for j in range(W)] for i in range(N): if zahyo[i][2] == 1: for j in range(zahyo[i][0]): for k in range(H): area[j][k] = 1 elif zahyo[i][2] == 2:...
W, H, N = list(map(int, input().split())) zahyo = [list(map(int, input().split())) for i in range(N)] x_min = y_min = 0 x_max = W y_max = H for i in range(N): if zahyo[i][2] == 1: if x_min < zahyo[i][0]: x_min = zahyo[i][0] elif zahyo[i][2] == 2: if zahyo[i][0] < x_max: x...
false
13.333333
[ "-area = [[0 for i in range(H)] for j in range(W)]", "+x_min = y_min = 0", "+x_max = W", "+y_max = H", "- for j in range(zahyo[i][0]):", "- for k in range(H):", "- area[j][k] = 1", "+ if x_min < zahyo[i][0]:", "+ x_min = zahyo[i][0]", "- fo...
false
0.042049
0.106292
0.395604
[ "s807930547", "s181028955" ]
u498487134
p02996
python
s695163971
s285339601
1,509
618
67,020
100,380
Accepted
Accepted
59.05
N=int(eval(input())) BA=[[0,0] for _ in range(N)] for i in range(N): BA[i][1],BA[i][0]=list(map(int,input().split())) BA.sort() t=0 ans="Yes" for i in range(N): t+=BA[i][1] if t>BA[i][0]: ans="No" break print(ans)
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() Q=[] for _ in range(N): a,b=MI() Q.append([b,a]) Q.sort()...
15
32
245
550
N = int(eval(input())) BA = [[0, 0] for _ in range(N)] for i in range(N): BA[i][1], BA[i][0] = list(map(int, input().split())) BA.sort() t = 0 ans = "Yes" for i in range(N): t += BA[i][1] if t > BA[i][0]: ans = "No" break print(ans)
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod = 10**9 + 7 N = I() Q = [] for _ in range(N): a, b = MI() Q.append([b, a]) Q...
false
53.125
[ "-N = int(eval(input()))", "-BA = [[0, 0] for _ in range(N)]", "-for i in range(N):", "- BA[i][1], BA[i][0] = list(map(int, input().split()))", "-BA.sort()", "-t = 0", "-ans = \"Yes\"", "-for i in range(N):", "- t += BA[i][1]", "- if t > BA[i][0]:", "- ans = \"No\"", "- ...
false
0.036503
0.035116
1.039512
[ "s695163971", "s285339601" ]
u766477342
p00011
python
s157896667
s243647565
30
20
7,640
7,672
Accepted
Accepted
33.33
w = int(eval(input())) n = int(eval(input())) l = [list(map(int, input().split(','))) for x in range(n)] res = [0] * (w + 1) for i in range(1, w + 1): c = i for a in l: if a[0] == c: c = a[1] elif a[1] == c: c = a[0] res[c] = i for r in res[1:]: ...
w = int(eval(input())) n = int(eval(input())) l = list(reversed([list(map(int, input().split(','))) for x in range(n)])) for i in range(1, w + 1): c = i for a in l: if a[0] == c: c = a[1] elif a[1] == c: c = a[0] print(c)
17
13
317
275
w = int(eval(input())) n = int(eval(input())) l = [list(map(int, input().split(","))) for x in range(n)] res = [0] * (w + 1) for i in range(1, w + 1): c = i for a in l: if a[0] == c: c = a[1] elif a[1] == c: c = a[0] res[c] = i for r in res[1:]: print(r)
w = int(eval(input())) n = int(eval(input())) l = list(reversed([list(map(int, input().split(","))) for x in range(n)])) for i in range(1, w + 1): c = i for a in l: if a[0] == c: c = a[1] elif a[1] == c: c = a[0] print(c)
false
23.529412
[ "-l = [list(map(int, input().split(\",\"))) for x in range(n)]", "-res = [0] * (w + 1)", "+l = list(reversed([list(map(int, input().split(\",\"))) for x in range(n)]))", "- res[c] = i", "-for r in res[1:]:", "- print(r)", "+ print(c)" ]
false
0.040417
0.090574
0.446233
[ "s157896667", "s243647565" ]
u966695411
p03627
python
s558101775
s124266597
1,523
89
14,244
14,252
Accepted
Accepted
94.16
#! /usr/bin/env python3 N = int(eval(input())) L = sorted(map(int, input().split()))[::-1] a = 0 b = 0 while L: t = L.pop(0) if a == t: break else: a = t while L: t = L.pop(0) if b == t: break else: b = t print((a*b))
#! /usr/bin/env python3 def main(): N = int(eval(input())) L = sorted(map(int, input().split()))[::-1] a = b = c = 0 while c < len(L): t = L[c] c += 1 if a == t: break else: a = t while c < len(L): t = L[c] c += ...
20
24
290
450
#! /usr/bin/env python3 N = int(eval(input())) L = sorted(map(int, input().split()))[::-1] a = 0 b = 0 while L: t = L.pop(0) if a == t: break else: a = t while L: t = L.pop(0) if b == t: break else: b = t print((a * b))
#! /usr/bin/env python3 def main(): N = int(eval(input())) L = sorted(map(int, input().split()))[::-1] a = b = c = 0 while c < len(L): t = L[c] c += 1 if a == t: break else: a = t while c < len(L): t = L[c] c += 1 if b =...
false
16.666667
[ "-N = int(eval(input()))", "-L = sorted(map(int, input().split()))[::-1]", "-a = 0", "-b = 0", "-while L:", "- t = L.pop(0)", "- if a == t:", "- break", "- else:", "- a = t", "-while L:", "- t = L.pop(0)", "- if b == t:", "- break", "- else:", "- ...
false
0.069887
0.036538
1.912728
[ "s558101775", "s124266597" ]
u225388820
p02971
python
s636285002
s663020040
601
526
14,112
4,540
Accepted
Accepted
12.48
N= int(eval(input())) A=[] for x in range(0,N): A.append(int(eval(input()))) B=sorted(A) for x in range(0,N): if A[x]==B[N-1]: print((B[N-2])) else: print((B[N-1]))
n=int(eval(input())) a=int(eval(input())) f,v,w=0,a,a a=int(eval(input())) if a>=v: w,v,f=v,a,1 else: w=a for i in range(2,n): a=int(eval(input())) if a>=v: w,v,f=v,a,i elif a>=w: w=a for i in range(n): if i==f: print(w) else: print(v)
10
19
186
289
N = int(eval(input())) A = [] for x in range(0, N): A.append(int(eval(input()))) B = sorted(A) for x in range(0, N): if A[x] == B[N - 1]: print((B[N - 2])) else: print((B[N - 1]))
n = int(eval(input())) a = int(eval(input())) f, v, w = 0, a, a a = int(eval(input())) if a >= v: w, v, f = v, a, 1 else: w = a for i in range(2, n): a = int(eval(input())) if a >= v: w, v, f = v, a, i elif a >= w: w = a for i in range(n): if i == f: print(w) else: ...
false
47.368421
[ "-N = int(eval(input()))", "-A = []", "-for x in range(0, N):", "- A.append(int(eval(input())))", "-B = sorted(A)", "-for x in range(0, N):", "- if A[x] == B[N - 1]:", "- print((B[N - 2]))", "+n = int(eval(input()))", "+a = int(eval(input()))", "+f, v, w = 0, a, a", "+a = int(eval...
false
0.039727
0.041957
0.946848
[ "s636285002", "s663020040" ]
u226155577
p03850
python
s055379397
s095205280
313
170
27,140
20,724
Accepted
Accepted
45.69
n = eval(input()) code = input().split() # DP(N, <parentheses nested>) dp = [[0]*3 for i in range(n)] dp[0] = [int(code[0]), -10**18, -10**18] for i in range(1,n): op, a = code[2*i-1: 2*i+1] v = int(a) if op is "+": dp[i][0] = max(dp[i-1][0]+v, dp[i-1][1]-v, dp[i-1][2]+v) dp[i][1] ...
n = eval(input()) code = input().split() # DP(N, <parentheses nested>) a = int(code[0]); b = c = -10**18 for op, v in zip(code[1::2], list(map(int,code[2::2]))): if op is "+": d = max(b-v, c+v) a,b,c = max(a+v, d), d, c+v else: d = max(b+v, c-v) a,b,c = max(a-v, d), max...
17
12
660
343
n = eval(input()) code = input().split() # DP(N, <parentheses nested>) dp = [[0] * 3 for i in range(n)] dp[0] = [int(code[0]), -(10**18), -(10**18)] for i in range(1, n): op, a = code[2 * i - 1 : 2 * i + 1] v = int(a) if op is "+": dp[i][0] = max(dp[i - 1][0] + v, dp[i - 1][1] - v, dp[i - 1][2] + v)...
n = eval(input()) code = input().split() # DP(N, <parentheses nested>) a = int(code[0]) b = c = -(10**18) for op, v in zip(code[1::2], list(map(int, code[2::2]))): if op is "+": d = max(b - v, c + v) a, b, c = max(a + v, d), d, c + v else: d = max(b + v, c - v) a, b, c = max(a - ...
false
29.411765
[ "-dp = [[0] * 3 for i in range(n)]", "-dp[0] = [int(code[0]), -(10**18), -(10**18)]", "-for i in range(1, n):", "- op, a = code[2 * i - 1 : 2 * i + 1]", "- v = int(a)", "+a = int(code[0])", "+b = c = -(10**18)", "+for op, v in zip(code[1::2], list(map(int, code[2::2]))):", "- dp[i][0] =...
false
0.053484
0.044386
1.204969
[ "s055379397", "s095205280" ]
u627325970
p03325
python
s232654036
s886657032
118
87
4,148
4,148
Accepted
Accepted
26.27
def num_divisions(num): for i in range(1+num): if num % 2**i == 0: pass else: return i - 1 N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: cnt += num_divisions(a) print(cnt)
def decompose_by_2(n): cnt = 0 while True: if n % 2 == 1: return cnt n = n / 2 cnt += 1 _ = eval(input()) A = list(map(int, input().split())) cnt = 0 for a in A: cnt += decompose_by_2(a) print(cnt)
15
15
279
267
def num_divisions(num): for i in range(1 + num): if num % 2**i == 0: pass else: return i - 1 N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: cnt += num_divisions(a) print(cnt)
def decompose_by_2(n): cnt = 0 while True: if n % 2 == 1: return cnt n = n / 2 cnt += 1 _ = eval(input()) A = list(map(int, input().split())) cnt = 0 for a in A: cnt += decompose_by_2(a) print(cnt)
false
0
[ "-def num_divisions(num):", "- for i in range(1 + num):", "- if num % 2**i == 0:", "- pass", "- else:", "- return i - 1", "+def decompose_by_2(n):", "+ cnt = 0", "+ while True:", "+ if n % 2 == 1:", "+ return cnt", "+ n = n ...
false
0.033263
0.033909
0.980934
[ "s232654036", "s886657032" ]
u111365362
p02879
python
s146285388
s250030806
41
17
3,316
2,940
Accepted
Accepted
58.54
a,b = list(map(int,input().split())) if a < 10 and b < 10: print((a*b)) else: print((-1))
#20:17 a,b = list(map(int,input().split())) if 0 < a < 10 and 0 < b < 10: print((a*b)) else: print((-1))
5
6
87
103
a, b = list(map(int, input().split())) if a < 10 and b < 10: print((a * b)) else: print((-1))
# 20:17 a, b = list(map(int, input().split())) if 0 < a < 10 and 0 < b < 10: print((a * b)) else: print((-1))
false
16.666667
[ "+# 20:17", "-if a < 10 and b < 10:", "+if 0 < a < 10 and 0 < b < 10:" ]
false
0.037785
0.074121
0.509783
[ "s146285388", "s250030806" ]
u181668771
p03206
python
s041222944
s137295948
36
17
5,036
3,060
Accepted
Accepted
52.78
def main(): from builtins import int,str,map,list,dict,float,print,len,sorted,max,min from itertools import accumulate, permutations, combinations from collections import deque, defaultdict, Counter from operator import itemgetter from bisect import bisect_left, bisect_right, bisect from h...
def main(): from builtins import int,map,list,print import sys input = sys.stdin.readline input_number = (lambda: int(input())) D = input_number() ans = 'Christmas' r = 25 - D for i in range(r): ans+=' Eve' print(ans) def resolve(): main() if __na...
28
19
858
354
def main(): from builtins import int, str, map, list, dict, float, print, len, sorted, max, min from itertools import accumulate, permutations, combinations from collections import deque, defaultdict, Counter from operator import itemgetter from bisect import bisect_left, bisect_right, bisect fr...
def main(): from builtins import int, map, list, print import sys input = sys.stdin.readline input_number = lambda: int(input()) D = input_number() ans = "Christmas" r = 25 - D for i in range(r): ans += " Eve" print(ans) def resolve(): main() if __name__ == "__main__...
false
32.142857
[ "- from builtins import int, str, map, list, dict, float, print, len, sorted, max, min", "- from itertools import accumulate, permutations, combinations", "- from collections import deque, defaultdict, Counter", "- from operator import itemgetter", "- from bisect import bisect_left, bisect_ri...
false
0.054506
0.041532
1.31237
[ "s041222944", "s137295948" ]
u811733736
p02397
python
s592038399
s267811909
60
40
7,556
7,948
Accepted
Accepted
33.33
if __name__ == '__main__': while True: key_in = eval(input()) #data = key_in.split(' ') data = [int(x) for x in key_in.split(' ')] data.sort() if data[0] == 0 and data[1] == 0: break else: print(('{0} {1}'.format(data[0], data[1])))
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_C&lang=jp """ import sys from sys import stdin input = stdin.readline def main(args): while True: x, y = list(map(int, input().split())) if x == 0 and y == 0: break if x ...
11
23
311
426
if __name__ == "__main__": while True: key_in = eval(input()) # data = key_in.split(' ') data = [int(x) for x in key_in.split(" ")] data.sort() if data[0] == 0 and data[1] == 0: break else: print(("{0} {1}".format(data[0], data[1])))
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_C&lang=jp """ import sys from sys import stdin input = stdin.readline def main(args): while True: x, y = list(map(int, input().split())) if x == 0 and y == 0: break if x > y: ...
false
52.173913
[ "+# -*- coding: utf-8 -*-", "+\"\"\"", "+http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_C&lang=jp", "+\"\"\"", "+import sys", "+from sys import stdin", "+", "+input = stdin.readline", "+", "+", "+def main(args):", "+ while True:", "+ x, y = list(map(int, input().sp...
false
0.03757
0.037705
0.99642
[ "s592038399", "s267811909" ]
u902973687
p03494
python
s627637243
s984833942
21
19
3,060
2,940
Accepted
Accepted
9.52
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(30): if 1 in [n % 2 for n in A]: break A = [n // 2 for n in A] ans += 1 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(30): if 1 in [n % 2 for n in A]: break A = [n >> 1 for n in A] ans += 1 print(ans)
10
10
178
179
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(30): if 1 in [n % 2 for n in A]: break A = [n // 2 for n in A] ans += 1 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(30): if 1 in [n % 2 for n in A]: break A = [n >> 1 for n in A] ans += 1 print(ans)
false
0
[ "- A = [n // 2 for n in A]", "+ A = [n >> 1 for n in A]" ]
false
0.040204
0.038894
1.033665
[ "s627637243", "s984833942" ]
u562935282
p02844
python
s939996468
s001694100
1,425
951
3,828
3,188
Accepted
Accepted
33.26
from itertools import product from string import digits def is_producible(s, digit3): curr = 0 for c in s: if c == digit3[curr]: curr += 1 if curr == 3: return True return False n = int(eval(input())) s = eval(input()) ret = 0 for digit3...
n = int(eval(input())) s = eval(input()) dp = tuple(set() for _ in range(4)) dp[0].add('') # dp[x]:=x文字の構成可能なset for c in s: for k in range(2, -1, -1): for incomplete_key in dp[k]: dp[k + 1].add(incomplete_key + c) print((len(dp[3]))) # dp
25
15
431
268
from itertools import product from string import digits def is_producible(s, digit3): curr = 0 for c in s: if c == digit3[curr]: curr += 1 if curr == 3: return True return False n = int(eval(input())) s = eval(input()) ret = 0 for digit3 in product(digits,...
n = int(eval(input())) s = eval(input()) dp = tuple(set() for _ in range(4)) dp[0].add("") # dp[x]:=x文字の構成可能なset for c in s: for k in range(2, -1, -1): for incomplete_key in dp[k]: dp[k + 1].add(incomplete_key + c) print((len(dp[3]))) # dp
false
40
[ "-from itertools import product", "-from string import digits", "-", "-", "-def is_producible(s, digit3):", "- curr = 0", "- for c in s:", "- if c == digit3[curr]:", "- curr += 1", "- if curr == 3:", "- return True", "- return False", "-",...
false
0.047177
0.041082
1.14834
[ "s939996468", "s001694100" ]
u002459665
p02791
python
s210829756
s421467663
186
95
24,744
24,744
Accepted
Accepted
48.92
N = int(eval(input())) P = list(map(int, input().split())) rui = [None] * (N) rui[0] = P[0] # print(rui) for i in range(1, N): a = rui[i-1] b = P[i] rui[i] = min(a, b) c = 0 for i in range(N): if P[i] <= rui[i]: c += 1 print(c)
N = int(eval(input())) P = list(map(int, input().split())) mn = N+1 c = 0 for pi in P: if pi <= mn: c += 1 mn = pi print(c)
18
11
266
149
N = int(eval(input())) P = list(map(int, input().split())) rui = [None] * (N) rui[0] = P[0] # print(rui) for i in range(1, N): a = rui[i - 1] b = P[i] rui[i] = min(a, b) c = 0 for i in range(N): if P[i] <= rui[i]: c += 1 print(c)
N = int(eval(input())) P = list(map(int, input().split())) mn = N + 1 c = 0 for pi in P: if pi <= mn: c += 1 mn = pi print(c)
false
38.888889
[ "-rui = [None] * (N)", "-rui[0] = P[0]", "-# print(rui)", "-for i in range(1, N):", "- a = rui[i - 1]", "- b = P[i]", "- rui[i] = min(a, b)", "+mn = N + 1", "-for i in range(N):", "- if P[i] <= rui[i]:", "+for pi in P:", "+ if pi <= mn:", "+ mn = pi" ]
false
0.040265
0.046416
0.867477
[ "s210829756", "s421467663" ]
u219197917
p03038
python
s082540559
s122443269
307
229
28,108
27,996
Accepted
Accepted
25.41
def main(): n, m = list(map(int, input().split())) a = sorted(int(i) for i in input().split()) bc = [(0, 0) for _ in range(m)] for i in range(m): b, c = list(map(int, input().split())) bc[i] = (c, b) bc.sort(reverse=True) k = 0 d = [] for c, b in bc: if...
import sys def read(): return sys.stdin.readline().rstrip() def main(): n, m = list(map(int, read().split())) a = sorted(int(i) for i in read().split()) bc = [(0, 0) for _ in range(m)] for i in range(m): b, c = list(map(int, read().split())) bc[i] = (c, b) bc.so...
26
33
585
657
def main(): n, m = list(map(int, input().split())) a = sorted(int(i) for i in input().split()) bc = [(0, 0) for _ in range(m)] for i in range(m): b, c = list(map(int, input().split())) bc[i] = (c, b) bc.sort(reverse=True) k = 0 d = [] for c, b in bc: if k + b > n:...
import sys def read(): return sys.stdin.readline().rstrip() def main(): n, m = list(map(int, read().split())) a = sorted(int(i) for i in read().split()) bc = [(0, 0) for _ in range(m)] for i in range(m): b, c = list(map(int, read().split())) bc[i] = (c, b) bc.sort(reverse=Tru...
false
21.212121
[ "+import sys", "+", "+", "+def read():", "+ return sys.stdin.readline().rstrip()", "+", "+", "- n, m = list(map(int, input().split()))", "- a = sorted(int(i) for i in input().split())", "+ n, m = list(map(int, read().split()))", "+ a = sorted(int(i) for i in read().split())", "-...
false
0.036996
0.053382
0.693038
[ "s082540559", "s122443269" ]
u409064224
p02993
python
s865634074
s844297976
21
17
3,060
2,940
Accepted
Accepted
19.05
s = eval(input()) for i in range(len(s)-1): if s[i] == s[i+1]: print("Bad") exit() else: print("Good")
s = eval(input()) f = 0 for i in range(3): if s[i] == s[i+1]: f = 1 if f==1: print("Bad") else: print("Good")
8
12
128
131
s = eval(input()) for i in range(len(s) - 1): if s[i] == s[i + 1]: print("Bad") exit() else: print("Good")
s = eval(input()) f = 0 for i in range(3): if s[i] == s[i + 1]: f = 1 if f == 1: print("Bad") else: print("Good")
false
33.333333
[ "-for i in range(len(s) - 1):", "+f = 0", "+for i in range(3):", "- print(\"Bad\")", "- exit()", "+ f = 1", "+if f == 1:", "+ print(\"Bad\")" ]
false
0.04265
0.036904
1.155702
[ "s865634074", "s844297976" ]
u947883560
p03128
python
s821617387
s513154438
75
65
3,316
3,316
Accepted
Accepted
13.33
N, M = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a.sort() # 破壊的。返り値はNone # print(N, M) # print(a) num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] dp = [-999 for _ in range(N+1)] dp[0] = 0 for i in range(N+1): n = [dp[i-num[a[j]]] for j in range(M) if i-num[...
N, M = [int(x) for x in input().split()] a = sorted([int(x) for x in input().split()]) INF = 10**9 num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] keta = [-INF for _ in range(N+1)] keta[0] = 0 for i in range(1, N+1): cand = [keta[i-num[aa]] for aa in a if i-num[aa] >= 0] if len(cand) > 0: keta[i] = ma...
38
21
936
556
N, M = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a.sort() # 破壊的。返り値はNone # print(N, M) # print(a) num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] dp = [-999 for _ in range(N + 1)] dp[0] = 0 for i in range(N + 1): n = [dp[i - num[a[j]]] for j in range(M) if i - num[a[j]] >= 0] if len(n) > 0: ...
N, M = [int(x) for x in input().split()] a = sorted([int(x) for x in input().split()]) INF = 10**9 num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6] keta = [-INF for _ in range(N + 1)] keta[0] = 0 for i in range(1, N + 1): cand = [keta[i - num[aa]] for aa in a if i - num[aa] >= 0] if len(cand) > 0: keta[i] = max(can...
false
44.736842
[ "-N, M = [int(i) for i in input().split()]", "-a = [int(i) for i in input().split()]", "-a.sort() # 破壊的。返り値はNone", "-# print(N, M)", "-# print(a)", "+N, M = [int(x) for x in input().split()]", "+a = sorted([int(x) for x in input().split()])", "+INF = 10**9", "-dp = [-999 for _ in range(N + 1)]", ...
false
0.04798
0.036424
1.317278
[ "s821617387", "s513154438" ]
u453815934
p02796
python
s129607442
s616179292
458
365
22,104
22,636
Accepted
Accepted
20.31
a=int(eval(input())) List=[] for i in range(a): p,q=list(map(int,input().split())) List.append([p-q,p+q]) List=sorted(List, key=lambda x:x[1]) ans=0 t=-10000000000 for i in range(a): if t<=List[i][0]: ans+=1 t=List[i][1] print(ans)
import math import sys from collections import deque import copy import itertools from itertools import permutations def mi() : return list(map(int,sys.stdin.readline().split())) def ii() : return int(sys.stdin.readline().rstrip()) def i() : return sys.stdin.readline().rstrip() a=ii() List=[] for i in range(...
13
25
245
534
a = int(eval(input())) List = [] for i in range(a): p, q = list(map(int, input().split())) List.append([p - q, p + q]) List = sorted(List, key=lambda x: x[1]) ans = 0 t = -10000000000 for i in range(a): if t <= List[i][0]: ans += 1 t = List[i][1] print(ans)
import math import sys from collections import deque import copy import itertools from itertools import permutations def mi(): return list(map(int, sys.stdin.readline().split())) def ii(): return int(sys.stdin.readline().rstrip()) def i(): return sys.stdin.readline().rstrip() a = ii() List = [] for ...
false
48
[ "-a = int(eval(input()))", "+import math", "+import sys", "+from collections import deque", "+import copy", "+import itertools", "+from itertools import permutations", "+", "+", "+def mi():", "+ return list(map(int, sys.stdin.readline().split()))", "+", "+", "+def ii():", "+ return...
false
0.061113
0.04366
1.399745
[ "s129607442", "s616179292" ]
u796942881
p03680
python
s984637266
s526113841
225
76
7,852
7,840
Accepted
Accepted
66.22
N = int(eval(input())) a = [] for i in range(N): a.append(int(eval(input())) - 1) done = [False] * N i = 0 ans = 0 while True: if done[i] == False: done[i] = True ans += 1 if a[i] == 1: break i = a[i] else: ans = -1 brea...
import sys l = [int(i) for i in sys.stdin] done = [False] * (l[0] + 1) i = 1 ans = 0 while True: if done[i] == False: done[i] = True ans += 1 if l[i] == 2: break i = l[i] else: ans = -1 break print(ans)
25
22
324
298
N = int(eval(input())) a = [] for i in range(N): a.append(int(eval(input())) - 1) done = [False] * N i = 0 ans = 0 while True: if done[i] == False: done[i] = True ans += 1 if a[i] == 1: break i = a[i] else: ans = -1 break print(ans)
import sys l = [int(i) for i in sys.stdin] done = [False] * (l[0] + 1) i = 1 ans = 0 while True: if done[i] == False: done[i] = True ans += 1 if l[i] == 2: break i = l[i] else: ans = -1 break print(ans)
false
12
[ "-N = int(eval(input()))", "-a = []", "-for i in range(N):", "- a.append(int(eval(input())) - 1)", "-done = [False] * N", "-i = 0", "+import sys", "+", "+l = [int(i) for i in sys.stdin]", "+done = [False] * (l[0] + 1)", "+i = 1", "- if a[i] == 1:", "+ if l[i] == 2:", "- ...
false
0.037576
0.037005
1.015432
[ "s984637266", "s526113841" ]
u844895214
p02725
python
s764049609
s915692506
192
118
50,772
32,376
Accepted
Accepted
38.54
import sys from collections import deque import numpy as np import math sys.setrecursionlimit(10**6) def S(): return sys.stdin.readline().rstrip() def SL(): return list(map(str,sys.stdin.readline().rstrip().split())) def I(): return int(sys.stdin.readline().rstrip()) def IL(): return list(map(int,sys.stdin.read...
import sys def IL(): return list(map(int,sys.stdin.readline().rstrip().split())) def Main(): k,n = IL() a = list(IL()) a.sort() m = 0 for i in range(n): if i<n-1: m = max(m,a[i+1]-a[i]) else: m = max(m,k-a[i]+a[0]) print((k-m)) return ...
26
18
634
349
import sys from collections import deque import numpy as np import math sys.setrecursionlimit(10**6) def S(): return sys.stdin.readline().rstrip() def SL(): return list(map(str, sys.stdin.readline().rstrip().split())) def I(): return int(sys.stdin.readline().rstrip()) def IL(): return list(map(...
import sys def IL(): return list(map(int, sys.stdin.readline().rstrip().split())) def Main(): k, n = IL() a = list(IL()) a.sort() m = 0 for i in range(n): if i < n - 1: m = max(m, a[i + 1] - a[i]) else: m = max(m, k - a[i] + a[0]) print((k - m)) ...
false
30.769231
[ "-from collections import deque", "-import numpy as np", "-import math", "-", "-sys.setrecursionlimit(10**6)", "-", "-", "-def S():", "- return sys.stdin.readline().rstrip()", "-", "-", "-def SL():", "- return list(map(str, sys.stdin.readline().rstrip().split()))", "-", "-", "-de...
false
0.074831
0.077425
0.966492
[ "s764049609", "s915692506" ]
u322185540
p03804
python
s395125511
s431172636
23
21
3,064
3,064
Accepted
Accepted
8.7
n,m = list(map(int,input().split())) a = [] for i in range(n): a.append(eval(input())) b = [] for g in range(m): b.append(eval(input())) #print(a) #print(b) ans = 'No' for c in range(n-m+1): for d in range(n-m+1): flag = 0 for e in range(m): if a[d+e][c:c+m] != b[e]...
n,m = list(map(int,input().split())) a = [] for i in range(n): a.append(eval(input())) b = [] for g in range(m): b.append(eval(input())) #print(a) #print(b) ans = 'No' for c in range(n-m+1): for d in range(n-m+1): C = [a[d+e][c:c+m] for e in range(m)] if C == b: a...
20
18
391
330
n, m = list(map(int, input().split())) a = [] for i in range(n): a.append(eval(input())) b = [] for g in range(m): b.append(eval(input())) # print(a) # print(b) ans = "No" for c in range(n - m + 1): for d in range(n - m + 1): flag = 0 for e in range(m): if a[d + e][c : c + m] != ...
n, m = list(map(int, input().split())) a = [] for i in range(n): a.append(eval(input())) b = [] for g in range(m): b.append(eval(input())) # print(a) # print(b) ans = "No" for c in range(n - m + 1): for d in range(n - m + 1): C = [a[d + e][c : c + m] for e in range(m)] if C == b: ...
false
10
[ "- flag = 0", "- for e in range(m):", "- if a[d + e][c : c + m] != b[e]:", "- flag = 1", "- if flag == 0:", "+ C = [a[d + e][c : c + m] for e in range(m)]", "+ if C == b:" ]
false
0.130951
0.086331
1.516843
[ "s395125511", "s431172636" ]
u225493896
p02792
python
s994492287
s903645498
763
227
13,224
3,064
Accepted
Accepted
70.25
import numpy as np N = int(eval(input())) l = np.zeros((9,9), dtype=np.int) # l[i][j] : i = 頭文字 j = 最後の文字 for k in range(N): x = str(k+1) i = int(x[0]) j = int(x[-1]) #print(i,j) if i == 0 or j == 0: continue l[i-1][j-1] += 1 ans = 0 for i in range(9): for j...
#import numpy as np N = int(eval(input())) l = [ [ 0 for i in range(9) ] for j in range(9) ] #l = np.zeros((9,9), dtype=np.int) # l[i][j] : i = 頭文字 j = 最後の文字 for k in range(N): x = str(k+1) i = int(x[0]) j = int(x[-1]) #print(i,j) if i == 0 or j == 0: continue l[i-1...
36
37
499
552
import numpy as np N = int(eval(input())) l = np.zeros((9, 9), dtype=np.int) # l[i][j] : i = 頭文字 j = 最後の文字 for k in range(N): x = str(k + 1) i = int(x[0]) j = int(x[-1]) # print(i,j) if i == 0 or j == 0: continue l[i - 1][j - 1] += 1 ans = 0 for i in range(9): for j in range(i, 9): ...
# import numpy as np N = int(eval(input())) l = [[0 for i in range(9)] for j in range(9)] # l = np.zeros((9,9), dtype=np.int) # l[i][j] : i = 頭文字 j = 最後の文字 for k in range(N): x = str(k + 1) i = int(x[0]) j = int(x[-1]) # print(i,j) if i == 0 or j == 0: continue l[i - 1][j - 1] += 1 ans =...
false
2.702703
[ "-import numpy as np", "-", "+# import numpy as np", "-l = np.zeros((9, 9), dtype=np.int)", "+l = [[0 for i in range(9)] for j in range(9)]", "+# l = np.zeros((9,9), dtype=np.int)" ]
false
0.624001
0.208514
2.992607
[ "s994492287", "s903645498" ]
u048945791
p03339
python
s733801773
s039174154
147
96
6,048
5,836
Accepted
Accepted
34.69
N = int(eval(input())) S = eval(input()) cost = list(S).count("E") ans = 10 ** 6 for si in S: if si == "E": cost -= 1 ans = min(ans, cost) if si == "W": cost += 1 print(ans)
N = int(eval(input())) S = eval(input()) cost = list(S).count("E") ans = 10 ** 6 for si in S: if si == "E": cost -= 1 if cost < ans: ans = cost if si == "W": cost += 1 print(ans)
16
17
213
227
N = int(eval(input())) S = eval(input()) cost = list(S).count("E") ans = 10**6 for si in S: if si == "E": cost -= 1 ans = min(ans, cost) if si == "W": cost += 1 print(ans)
N = int(eval(input())) S = eval(input()) cost = list(S).count("E") ans = 10**6 for si in S: if si == "E": cost -= 1 if cost < ans: ans = cost if si == "W": cost += 1 print(ans)
false
5.882353
[ "- ans = min(ans, cost)", "+ if cost < ans:", "+ ans = cost" ]
false
0.165994
0.044594
3.722326
[ "s733801773", "s039174154" ]
u837673618
p02745
python
s156627413
s612397198
971
594
3,796
52,828
Accepted
Accepted
38.83
from itertools import chain, permutations, dropwhile from heapq import merge from functools import wraps def listify(fn): @wraps(fn) def wraper(*args, **kwargs): return list(fn(*args, **kwargs)) return wraper def comp_wild(a,b): return all(x==y or "?" in (x,y) for x,y in zip(a, b)) @listify ...
from itertools import chain, permutations, dropwhile from heapq import merge from functools import wraps def listify(fn): @wraps(fn) def wrapper(*args, **kwargs): return list(fn(*args, **kwargs)) return wrapper def comp_wild(a,b): return all(x==y or "?" in (x,y) for x,y in zip(a, b)) @listif...
76
76
2,143
2,149
from itertools import chain, permutations, dropwhile from heapq import merge from functools import wraps def listify(fn): @wraps(fn) def wraper(*args, **kwargs): return list(fn(*args, **kwargs)) return wraper def comp_wild(a, b): return all(x == y or "?" in (x, y) for x, y in zip(a, b)) @...
from itertools import chain, permutations, dropwhile from heapq import merge from functools import wraps def listify(fn): @wraps(fn) def wrapper(*args, **kwargs): return list(fn(*args, **kwargs)) return wrapper def comp_wild(a, b): return all(x == y or "?" in (x, y) for x, y in zip(a, b)) ...
false
0
[ "- def wraper(*args, **kwargs):", "+ def wrapper(*args, **kwargs):", "- return wraper", "+ return wrapper", "-print((solve(*(eval(input()) for _ in range(3)))))", "+print((solve(*(eval(input()) for i in range(3)))))" ]
false
0.038799
0.0402
0.965149
[ "s156627413", "s612397198" ]
u268554510
p02844
python
s459027877
s961484471
648
123
3,700
48,136
Accepted
Accepted
81.02
N = int(eval(input())) S = list(map(int,list(eval(input())))) def judge(x,l): ret = False num = 0 for a,n in enumerate(l): if n==x: ret = True num = a break return ret,num ans = 0 for i in range(10): tf1,n1 = judge(i,S) if tf1: for j in range(10): tf...
N = int(eval(input())) S = list(map(int,list(eval(input())))) S_riv=S[::-1] l_lis=[0]*N r_lis=[0]*N mat=([set([])for j in range(10)]) l_set=set([]) r_set=set([]) for i,s in enumerate(S): l_lis[i]=l_set.copy() l_set.add(s) for i,s in enumerate(S_riv): r_lis[i]=r_set.copy() r_set.add(s) r_li...
26
23
468
430
N = int(eval(input())) S = list(map(int, list(eval(input())))) def judge(x, l): ret = False num = 0 for a, n in enumerate(l): if n == x: ret = True num = a break return ret, num ans = 0 for i in range(10): tf1, n1 = judge(i, S) if tf1: for ...
N = int(eval(input())) S = list(map(int, list(eval(input())))) S_riv = S[::-1] l_lis = [0] * N r_lis = [0] * N mat = [set([]) for j in range(10)] l_set = set([]) r_set = set([]) for i, s in enumerate(S): l_lis[i] = l_set.copy() l_set.add(s) for i, s in enumerate(S_riv): r_lis[i] = r_set.copy() r_set.add...
false
11.538462
[ "-", "-", "-def judge(x, l):", "- ret = False", "- num = 0", "- for a, n in enumerate(l):", "- if n == x:", "- ret = True", "- num = a", "- break", "- return ret, num", "-", "-", "+S_riv = S[::-1]", "+l_lis = [0] * N", "+r_lis = [0] *...
false
0.034002
0.034315
0.990863
[ "s459027877", "s961484471" ]
u156815136
p02854
python
s721690150
s603125241
210
180
26,056
32,780
Accepted
Accepted
14.29
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] #from fractions import gcd #from itertools import combinations # (string,3) 3回 #from collections import deque #from collections import deque,defaultdict #import bisect # # d ...
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate, product # (string,3) 3回 #from collections import deque from collections import deque,defaultdi...
49
40
1,027
924
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] # from fractions import gcd # from itertools import combinations # (string,3) 3回 # from collections import deque # from collections import deque,defaultdict # import bisect # # d =...
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations, permutations, accumulate, product # (string,3) 3回 # from collections import deque from collections import deque, defaul...
false
18.367347
[ "-# from fractions import gcd", "-# from itertools import combinations # (string,3) 3回", "+from fractions import gcd", "+from itertools import combinations, permutations, accumulate, product # (string,3) 3回", "+", "-# from collections import deque,defaultdict", "+from collections import deque, defaultd...
false
0.046936
0.045794
1.02494
[ "s721690150", "s603125241" ]
u254871849
p03294
python
s740250287
s985040216
164
18
3,812
3,316
Accepted
Accepted
89.02
# author: kagemeka # created: 2019-11-08 15:54:47(JST) ### modules ## from standard library import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics import functools # import operator ...
# author: kagemeka # created: 2019-11-08 15:54:47(JST) ### modules ## from standard library import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator...
38
29
875
707
# author: kagemeka # created: 2019-11-08 15:54:47(JST) ### modules ## from standard library import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics import functools # import operator ## from exter...
# author: kagemeka # created: 2019-11-08 15:54:47(JST) ### modules ## from standard library import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator ## from exte...
false
23.684211
[ "-import functools", "-", "+# import functools", "-def gcd(a, b):", "- while b != 0:", "- a, b = b, a % b", "- return a", "-", "-", "-def lcm(a, b):", "- return a * b // gcd(a, b)", "-", "-", "- m = functools.reduce(lcm, a)", "- f = sum([(m - 1) % a[i] for i in rang...
false
0.046295
0.035964
1.287269
[ "s740250287", "s985040216" ]
u923172145
p02573
python
s599842747
s400837359
574
418
14,720
86,888
Accepted
Accepted
27.18
#xの根を求める def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] #xとyの属する集合の併合 def unite(x,y): x = find(x) y = find(y) if x == y: return False else: #sizeの大きいほうがx if par[x] > par[y]: x,y = y,...
# データ構造: Union Find (素集合データ構造) # 前提 # グラフ(頂点と辺からなる集合)上の各頂点が、どの連結成分に属しているかを管理するときに使う # 具体的には、各連結成分ごとに適当な1点を親として、同じ連結成分に属する他の点が子になるように配置する # できること # 1, ある頂点の親を返す (つまり、どの連結成分に属するかがわかる) # 2, 新たな辺が与えられた時、必要なら連結成分の統合を行う # 以下、事前準備。(本処理は42行目から) # 上記1,2を実現する関数を作成する。 # 0, 前提 # par = [-1 for _ in range...
46
55
724
1,236
# xの根を求める def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] # xとyの属する集合の併合 def unite(x, y): x = find(x) y = find(y) if x == y: return False else: # sizeの大きいほうがx if par[x] > par[y]: x, y = y, x par[...
# データ構造: Union Find (素集合データ構造) # 前提 # グラフ(頂点と辺からなる集合)上の各頂点が、どの連結成分に属しているかを管理するときに使う # 具体的には、各連結成分ごとに適当な1点を親として、同じ連結成分に属する他の点が子になるように配置する # できること # 1, ある頂点の親を返す (つまり、どの連結成分に属するかがわかる) # 2, 新たな辺が与えられた時、必要なら連結成分の統合を行う # 以下、事前準備。(本処理は42行目から) # 上記1,2を実現する関数を作成する。 # 0, 前提 # par = [-1 for _ in range(n)] # 配列parの...
false
16.363636
[ "-# xの根を求める", "+# データ構造: Union Find (素集合データ構造)", "+# 前提", "+# グラフ(頂点と辺からなる集合)上の各頂点が、どの連結成分に属しているかを管理するときに使う", "+# 具体的には、各連結成分ごとに適当な1点を親として、同じ連結成分に属する他の点が子になるように配置する", "+# できること", "+# 1, ある頂点の親を返す (つまり、どの連結成分に属するかがわかる)", "+# 2, 新たな辺が与えられた時、必要なら連結成分の統合を行う", "+# 以下、事前準備。(本処理は42行目から)", "...
false
0.035265
0.035643
0.989393
[ "s599842747", "s400837359" ]
u077291787
p02900
python
s712669904
s986618269
217
140
5,120
5,844
Accepted
Accepted
35.48
# ABC142D - Disjoint Set of Common Divisors def divisors(n: int) -> set: div = set() for i in range(1, int(n ** 0.5) + 1): if n % i == 0: div.add(i), div.add(n // i) return div def main(): A, B = list(map(int, input().split())) divs = sorted(divisors(A) & divisors(B)...
# ABC142D - Disjoint Set of Common Divisors from fractions import gcd # from math import gcd def divisors(n: int) -> set: div = set() for i in range(1, int(n ** 0.5) + 1): if n % i == 0: div.add(i), div.add(n // i) return sorted(div) def main(): A, B = list(map(int,...
23
27
526
645
# ABC142D - Disjoint Set of Common Divisors def divisors(n: int) -> set: div = set() for i in range(1, int(n**0.5) + 1): if n % i == 0: div.add(i), div.add(n // i) return div def main(): A, B = list(map(int, input().split())) divs = sorted(divisors(A) & divisors(B)) divs.po...
# ABC142D - Disjoint Set of Common Divisors from fractions import gcd # from math import gcd def divisors(n: int) -> set: div = set() for i in range(1, int(n**0.5) + 1): if n % i == 0: div.add(i), div.add(n // i) return sorted(div) def main(): A, B = list(map(int, input().split())...
false
14.814815
[ "+from fractions import gcd", "+", "+# from math import gcd", "- return div", "+ return sorted(div)", "- divs = sorted(divisors(A) & divisors(B))", "- divs.pop(0)", "+ divs = divisors(gcd(A, B))", "+ divs.pop(0) # 1 divides all numbers -> pop", "- groups.add(i)", "+...
false
0.066679
0.045612
1.461863
[ "s712669904", "s986618269" ]
u996731299
p02732
python
s125503816
s838893023
453
417
20,576
20,992
Accepted
Accepted
7.95
M=int(eval(input())) N=list(input().split()) check=[0]*M for i in range(M): check[int(N[i])-1]+=1 num=0 for i in range(M): num+=check[i]*(check[i]-1)//2 for i in range(M): if check[int(N[i])-1]!=2: print((num-(check[int(N[i])-1]-1))) else: print((num-1))
M=int(eval(input())) N=list(input().split()) check=[0]*M for i in range(M): check[int(N[i])-1]+=1 num=0 for i in range(M): num+=check[i]*(check[i]-1)//2 for i in range(M): #if check[int(N[i])-1]!=2: print((num-(check[int(N[i])-1]-1))) #else: # print(num-1)
13
13
289
287
M = int(eval(input())) N = list(input().split()) check = [0] * M for i in range(M): check[int(N[i]) - 1] += 1 num = 0 for i in range(M): num += check[i] * (check[i] - 1) // 2 for i in range(M): if check[int(N[i]) - 1] != 2: print((num - (check[int(N[i]) - 1] - 1))) else: print((num - 1))...
M = int(eval(input())) N = list(input().split()) check = [0] * M for i in range(M): check[int(N[i]) - 1] += 1 num = 0 for i in range(M): num += check[i] * (check[i] - 1) // 2 for i in range(M): # if check[int(N[i])-1]!=2: print((num - (check[int(N[i]) - 1] - 1))) # else: # print(num-1)
false
0
[ "- if check[int(N[i]) - 1] != 2:", "- print((num - (check[int(N[i]) - 1] - 1)))", "- else:", "- print((num - 1))", "+ # if check[int(N[i])-1]!=2:", "+ print((num - (check[int(N[i]) - 1] - 1)))", "+ # else:", "+ # print(num-1)" ]
false
0.046658
0.047679
0.978584
[ "s125503816", "s838893023" ]
u116038906
p02792
python
s154090759
s757435060
689
367
12,492
12,500
Accepted
Accepted
46.73
""" 参考 blog名 あっとのTECH LOG 2020-01-24 url https://at274.hatenablog.com/entry/2020/01/24/060000 id: AT274 """ #初期入力 N = int(eval(input())) # import numpy as np count = np.zeros((10,10),dtype=np.int64) for i in range(1,N+1): n_left =str(i)[0] #左端の数字(N) n_right =str(i)[-1] #右端の数字(N)...
""" 参考 blog名 あっとのTECH LOG 2020-01-24 url https://at274.hatenablog.com/entry/2020/01/24/060000 id: AT274 """ #初期入力 N = int(eval(input())) # import numpy as np cnt = [[0] * 10 for i in range(10)] #count = np.zeros((10,10),dtype=np.int64) for i in range(1,N+1): n_left =str(i)[0] #左端の数字...
21
24
435
549
""" 参考 blog名 あっとのTECH LOG 2020-01-24 url https://at274.hatenablog.com/entry/2020/01/24/060000 id: AT274 """ # 初期入力 N = int(eval(input())) # import numpy as np count = np.zeros((10, 10), dtype=np.int64) for i in range(1, N + 1): n_left = str(i)[0] # 左端の数字(N) n_right = str(i)[-1] # 右端の数字(N) cou...
""" 参考 blog名 あっとのTECH LOG 2020-01-24 url https://at274.hatenablog.com/entry/2020/01/24/060000 id: AT274 """ # 初期入力 N = int(eval(input())) # import numpy as np cnt = [[0] * 10 for i in range(10)] # count = np.zeros((10,10),dtype=np.int64) for i in range(1, N + 1): n_left = str(i)[0] # 左端の数字(N) n_ri...
false
12.5
[ "-count = np.zeros((10, 10), dtype=np.int64)", "+cnt = [[0] * 10 for i in range(10)]", "+# count = np.zeros((10,10),dtype=np.int64)", "- count[int(n_left), int(n_right)] += 1", "+ # cnt[int(n_left) , int(n_right)] +=1", "+ cnt[int(n_left)][int(n_right)] += 1", "+count = np.array(cnt, dtype=np.i...
false
0.007578
0.255657
0.029643
[ "s154090759", "s757435060" ]
u557437077
p03286
python
s573996367
s156889114
19
17
3,188
3,060
Accepted
Accepted
10.53
import math n = int(eval(input())) if n == 0: print((0)) exit() out = "" i = 0 while n != 0: if n % -2 != 0: out = str(- (n % -2)) + out # print("n:{} div:{}=(-2)^{}".format(n, (-2) ** i, i)) else: out = str(- (n % -2)) + out # 123->100, -123->-100 if n ...
import math # print("{}/{}={} %{}".format(-123, 10, -123/10, -123 %10)) n = int(eval(input())) if n == 0: print((0)) exit() out = "" i = 0 while n != 0: if n % -2 != 0: out = str(- (n % -2)) + out # print("n:{} div:{}=(-2)^{}".format(n, (-2) ** i, i)) else: out = s...
36
23
654
489
import math n = int(eval(input())) if n == 0: print((0)) exit() out = "" i = 0 while n != 0: if n % -2 != 0: out = str(-(n % -2)) + out # print("n:{} div:{}=(-2)^{}".format(n, (-2) ** i, i)) else: out = str(-(n % -2)) + out # 123->100, -123->-100 if n > 0: n = in...
import math # print("{}/{}={} %{}".format(-123, 10, -123/10, -123 %10)) n = int(eval(input())) if n == 0: print((0)) exit() out = "" i = 0 while n != 0: if n % -2 != 0: out = str(-(n % -2)) + out # print("n:{} div:{}=(-2)^{}".format(n, (-2) ** i, i)) else: out = str(-(n % -2)) +...
false
36.111111
[ "+# print(\"{}/{}={} %{}\".format(-123, 10, -123/10, -123 %10))", "- # 123->100, -123->-100", "+ # 12 -> 2 + 10^1, -12 -> 8 + 2*(-10)^1", "-\"\"\"", "-tmp = 1", "-digit = 0", "-while tmp < n:", "- tmp *= 4", "- digit += 1", "-number = [0 for i in range(digit)]", "-print(number)", "...
false
0.040935
0.041443
0.987742
[ "s573996367", "s156889114" ]
u125545880
p03261
python
s347885150
s219607812
31
27
9,016
9,128
Accepted
Accepted
12.9
def main(): N = int(eval(input())) W_before = eval(input()) W_list = set() W_list.add(W_before) for i in range(N-1): W_after = eval(input()) if W_before[-1] != W_after[0]: print('No') return if W_after in W_list: print('No') ...
def main(): N = int(eval(input())) W_before = eval(input()) word_set = set() word_set.add(W_before) for i in range(N-1): W_after = eval(input()) if W_before[-1] != W_after[0]: print('No') return if W_after in word_set: print('No'...
19
19
435
443
def main(): N = int(eval(input())) W_before = eval(input()) W_list = set() W_list.add(W_before) for i in range(N - 1): W_after = eval(input()) if W_before[-1] != W_after[0]: print("No") return if W_after in W_list: print("No") r...
def main(): N = int(eval(input())) W_before = eval(input()) word_set = set() word_set.add(W_before) for i in range(N - 1): W_after = eval(input()) if W_before[-1] != W_after[0]: print("No") return if W_after in word_set: print("No") ...
false
0
[ "- W_list = set()", "- W_list.add(W_before)", "+ word_set = set()", "+ word_set.add(W_before)", "- if W_after in W_list:", "+ if W_after in word_set:", "- W_list.add(W_after)", "+ word_set.add(W_after)" ]
false
0.10619
0.104903
1.01227
[ "s347885150", "s219607812" ]
u034128150
p02781
python
s106751769
s026126563
293
154
21,504
12,496
Accepted
Accepted
47.44
import numpy as np N = eval(input()) K = int(eval(input())) dp = np.zeros((len(N)+1, K+1), np.int64) dp[1, 1] = 1 for d in range(1, len(N)): dp[d+1] = dp[d] dp[d+1, 1:] += dp[d, :-1] ans = 0 for i, c in enumerate(N): n = len(N)-i if c != '0': ans += np.sum(dp[:n, K]) * (9 ** K)...
import numpy as np N = eval(input()) K = int(eval(input())) n = len(N) dp0 = np.zeros((n, K+1), np.int64) dp1 = np.zeros((n, K+1), np.int64) dp0[0, 0] = 1 dp0[0, 1] = int(N[0]) - 1 dp1[0, 1] = 1 for i, d in enumerate(N[1:]): dp0[i+1] += dp0[i] dp0[i+1, 1:] += dp0[i, :-1] * 9 if int(d) == 0...
23
26
454
597
import numpy as np N = eval(input()) K = int(eval(input())) dp = np.zeros((len(N) + 1, K + 1), np.int64) dp[1, 1] = 1 for d in range(1, len(N)): dp[d + 1] = dp[d] dp[d + 1, 1:] += dp[d, :-1] ans = 0 for i, c in enumerate(N): n = len(N) - i if c != "0": ans += np.sum(dp[:n, K]) * (9**K) ...
import numpy as np N = eval(input()) K = int(eval(input())) n = len(N) dp0 = np.zeros((n, K + 1), np.int64) dp1 = np.zeros((n, K + 1), np.int64) dp0[0, 0] = 1 dp0[0, 1] = int(N[0]) - 1 dp1[0, 1] = 1 for i, d in enumerate(N[1:]): dp0[i + 1] += dp0[i] dp0[i + 1, 1:] += dp0[i, :-1] * 9 if int(d) == 0: ...
false
11.538462
[ "-dp = np.zeros((len(N) + 1, K + 1), np.int64)", "-dp[1, 1] = 1", "-for d in range(1, len(N)):", "- dp[d + 1] = dp[d]", "- dp[d + 1, 1:] += dp[d, :-1]", "-ans = 0", "-for i, c in enumerate(N):", "- n = len(N) - i", "- if c != \"0\":", "- ans += np.sum(dp[:n, K]) * (9**K)", "- ...
false
0.480731
0.197115
2.43884
[ "s106751769", "s026126563" ]
u912237403
p00033
python
s866967751
s982733111
20
10
4,212
4,212
Accepted
Accepted
50
def f(x): a,b=0,0 for e in x: if e>a: a=e elif e>b: b=e else: return 0 return 1 n=eval(input()) for i in range(n): D = list(map(int, input().split())) print(["NO","YES"][f(D)])
def f(x): a,b=0,0 for e in x: if e>a: a=e elif e>b: b=e else: return 0 return 1 n=eval(input()) for i in range(n): D = list(map(int, input().split())) s = ["NO","YES"][f(D)] print(s)
12
13
223
234
def f(x): a, b = 0, 0 for e in x: if e > a: a = e elif e > b: b = e else: return 0 return 1 n = eval(input()) for i in range(n): D = list(map(int, input().split())) print(["NO", "YES"][f(D)])
def f(x): a, b = 0, 0 for e in x: if e > a: a = e elif e > b: b = e else: return 0 return 1 n = eval(input()) for i in range(n): D = list(map(int, input().split())) s = ["NO", "YES"][f(D)] print(s)
false
7.692308
[ "- print([\"NO\", \"YES\"][f(D)])", "+ s = [\"NO\", \"YES\"][f(D)]", "+ print(s)" ]
false
0.036156
0.041573
0.869709
[ "s866967751", "s982733111" ]
u306664745
p02983
python
s560038811
s371918129
56
46
3,064
6,804
Accepted
Accepted
17.86
l, r=list(map(int, input().split())) if r-l>672: p=0 else: p=2019 for i in range(l, r): for j in range(i+1, r+1): p=min(p, (i*j%2019)) if not p: break if not p: break print(p)
l, r=list(map(int, input().split())) if r-l>672: p=0 else: x=[] for i in range(l, r): for j in range(i+1, r+1): x.append((i*j)%2019) p=min(x) print(p)
13
10
201
162
l, r = list(map(int, input().split())) if r - l > 672: p = 0 else: p = 2019 for i in range(l, r): for j in range(i + 1, r + 1): p = min(p, (i * j % 2019)) if not p: break if not p: break print(p)
l, r = list(map(int, input().split())) if r - l > 672: p = 0 else: x = [] for i in range(l, r): for j in range(i + 1, r + 1): x.append((i * j) % 2019) p = min(x) print(p)
false
23.076923
[ "- p = 2019", "+ x = []", "- p = min(p, (i * j % 2019))", "- if not p:", "- break", "- if not p:", "- break", "+ x.append((i * j) % 2019)", "+ p = min(x)" ]
false
0.038891
0.038594
1.00769
[ "s560038811", "s371918129" ]
u534308356
p02720
python
s972447492
s834854284
251
95
10,916
12,404
Accepted
Accepted
62.15
from collections import deque def main(): k = int(eval(input())) # 前後をチェックする再帰関数( 要素として深さも必要そう / DPのメモ化とか使えそう ) # # 生データ # 1桁 # [1, 2, 3, 4, 5, 6, 7, 8, 9] # 2桁 # [10, 11, 12, 21, 22, 23,..., 98, 99] # # 1 # 10 11 12 # # 2 # .. .. .. 21 22 23 # # Point. ...
from collections import deque def main(): k = int(eval(input())) # 前後をチェックする再帰関数( 要素として深さも必要そう / DPのメモ化とか使えそう ) # # 生データ # 1桁 # [1, 2, 3, 4, 5, 6, 7, 8, 9] # 2桁 # [10, 11, 12, 21, 22, 23,..., 98, 99] # # 1 # 10 11 12 # # 2 # .. .. .. 21 22 23 # # Point. ...
68
66
1,288
1,196
from collections import deque def main(): k = int(eval(input())) # 前後をチェックする再帰関数( 要素として深さも必要そう / DPのメモ化とか使えそう ) # # 生データ # 1桁 # [1, 2, 3, 4, 5, 6, 7, 8, 9] # 2桁 # [10, 11, 12, 21, 22, 23,..., 98, 99] # # 1 # 10 11 12 # # 2 # .. .. .. 21 22 23 # ...
from collections import deque def main(): k = int(eval(input())) # 前後をチェックする再帰関数( 要素として深さも必要そう / DPのメモ化とか使えそう ) # # 生データ # 1桁 # [1, 2, 3, 4, 5, 6, 7, 8, 9] # 2桁 # [10, 11, 12, 21, 22, 23,..., 98, 99] # # 1 # 10 11 12 # # 2 # .. .. .. 21 22 23 # ...
false
2.941176
[ "- new_data1 = int(str(p) + str(l - 1))", "+ new_data1 = p * 10 + (l - 1)", "- new_data2 = int(str(p) + str(l))", "+ new_data2 = p * 10 + l", "- new_data3 = int(str(p) + str(l + 1))", "+ new_data3 = p * 10 + (l + 1)", "- # print(\"============...
false
0.056874
0.041252
1.378721
[ "s972447492", "s834854284" ]
u018679195
p03814
python
s264869679
s208134341
46
17
3,500
3,500
Accepted
Accepted
63.04
s = eval(input()) r = len(s) - 1 l = 0 while (s[l] != 'A'): l+=1 while (s[r] != 'Z'): r-=1 print((r-l+1))
s = eval(input()) order_a=s.find('A') order_z=s.rfind('Z') print((order_z - order_a + 1))
6
4
103
85
s = eval(input()) r = len(s) - 1 l = 0 while s[l] != "A": l += 1 while s[r] != "Z": r -= 1 print((r - l + 1))
s = eval(input()) order_a = s.find("A") order_z = s.rfind("Z") print((order_z - order_a + 1))
false
33.333333
[ "-r = len(s) - 1", "-l = 0", "-while s[l] != \"A\":", "- l += 1", "-while s[r] != \"Z\":", "- r -= 1", "-print((r - l + 1))", "+order_a = s.find(\"A\")", "+order_z = s.rfind(\"Z\")", "+print((order_z - order_a + 1))" ]
false
0.035713
0.035226
1.013813
[ "s264869679", "s208134341" ]
u600402037
p02726
python
s670741519
s085059623
1,435
370
4,080
73,948
Accepted
Accepted
74.22
import sys from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def dijkstra(start): INF = 10 ** 10 dist = [INF] * (N+1) dist[start] = 0 que = [(0,start)] while que: d, prev = h...
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, X, Y = lr() dis = [[0] * (N+1) for _ in range(N+1)] for i in range(1, N): for j in range(i+1, N+1): dis[i][j] = j - i dis[j][i] = j - i dis[X][Y]...
40
27
999
622
import sys from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def dijkstra(start): INF = 10**10 dist = [INF] * (N + 1) dist[start] = 0 que = [(0, start)] while que: d, prev = heappop(que)...
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, X, Y = lr() dis = [[0] * (N + 1) for _ in range(N + 1)] for i in range(1, N): for j in range(i + 1, N + 1): dis[i][j] = j - i dis[j][i] = j - i dis[X][Y] = 1 dis...
false
32.5
[ "+# coding: utf-8", "-from heapq import heapify, heappop, heappush", "-", "-", "-def dijkstra(start):", "- INF = 10**10", "- dist = [INF] * (N + 1)", "- dist[start] = 0", "- que = [(0, start)]", "- while que:", "- d, prev = heappop(que)", "- if dist[prev] < d:", ...
false
0.034804
0.036233
0.960564
[ "s670741519", "s085059623" ]
u759412327
p03632
python
s001691192
s796506046
30
27
9,164
9,072
Accepted
Accepted
10
A,B,C,D = list(map(int,input().split())) print((max(min(B,D)-max(A,C),0)))
A,B,C,D = list(map(int,input().split())) print((max(0,min(B,D)-max(A,C))))
2
2
67
67
A, B, C, D = list(map(int, input().split())) print((max(min(B, D) - max(A, C), 0)))
A, B, C, D = list(map(int, input().split())) print((max(0, min(B, D) - max(A, C))))
false
0
[ "-print((max(min(B, D) - max(A, C), 0)))", "+print((max(0, min(B, D) - max(A, C))))" ]
false
0.042037
0.046202
0.909837
[ "s001691192", "s796506046" ]
u297089927
p02729
python
s387044392
s925014620
19
17
3,060
2,940
Accepted
Accepted
10.53
N,M=list(map(int,input().split())) print((int(N*(N-1)/2+M*(M-1)/2)))
n,m=list(map(int,input().split())) print((n*(n-1)//2+m*(m-1)//2))
2
2
61
58
N, M = list(map(int, input().split())) print((int(N * (N - 1) / 2 + M * (M - 1) / 2)))
n, m = list(map(int, input().split())) print((n * (n - 1) // 2 + m * (m - 1) // 2))
false
0
[ "-N, M = list(map(int, input().split()))", "-print((int(N * (N - 1) / 2 + M * (M - 1) / 2)))", "+n, m = list(map(int, input().split()))", "+print((n * (n - 1) // 2 + m * (m - 1) // 2))" ]
false
0.037099
0.041189
0.900688
[ "s387044392", "s925014620" ]
u716530146
p02763
python
s681653633
s937068900
486
436
76,164
70,404
Accepted
Accepted
10.29
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 class SegmentTree: __slots__ = ['ide','n','seg','segfunc'] def __init__(self,size,func,ele...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 class SegmentTree: __slots__ = ['ide','n','seg','segfunc'] def __init__(self,size,func,ele...
87
100
2,288
2,606
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 class SegmentTree: __slots__ = ["ide", "n", "seg", "segfunc"] def __init__(self, size, func, el...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 class SegmentTree: __slots__ = ["ide", "n", "seg", "segfunc"] def __init__(self, size, func, el...
false
13
[ "+ def query1(self, l, r):", "+ # 半開区間[l,r)", "+ l += self.n - 1", "+ r += self.n - 1", "+ res = self.ide", "+ while l < r:", "+ if l & 1 == 0:", "+ res = self.segfunc(res, self.seg[l])", "+ l += 1", "+ if r ...
false
0.040661
0.038533
1.055217
[ "s681653633", "s937068900" ]
u977349332
p03478
python
s557429642
s021848384
32
27
2,940
2,940
Accepted
Accepted
15.62
def sum(i): t=0 while True: if i==0: return t else: t +=i%10 i //=10 N,A,B = [int(i) for i in input().split()] s = 0 for i in range(1, N+1): if sum(i) <=B and sum(i) >=A: s += i print(s)
n, a, b = list(map(int, input().split())) answer = 0 for i in range(1,n+1): sum = 0 x = i while x > 0: sum += x % 10 x = x // 10 if a <= sum <= b: answer += i print(answer)
16
12
245
189
def sum(i): t = 0 while True: if i == 0: return t else: t += i % 10 i //= 10 N, A, B = [int(i) for i in input().split()] s = 0 for i in range(1, N + 1): if sum(i) <= B and sum(i) >= A: s += i print(s)
n, a, b = list(map(int, input().split())) answer = 0 for i in range(1, n + 1): sum = 0 x = i while x > 0: sum += x % 10 x = x // 10 if a <= sum <= b: answer += i print(answer)
false
25
[ "-def sum(i):", "- t = 0", "- while True:", "- if i == 0:", "- return t", "- else:", "- t += i % 10", "- i //= 10", "-", "-", "-N, A, B = [int(i) for i in input().split()]", "-s = 0", "-for i in range(1, N + 1):", "- if sum(i) <= B an...
false
0.044856
0.044928
0.998413
[ "s557429642", "s021848384" ]
u623819879
p02925
python
s627018304
s175163038
822
621
73,560
65,368
Accepted
Accepted
24.45
from heapq import heappush, heappop from collections import deque,defaultdict,Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts=time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return lis...
from heapq import heappush, heappop from collections import deque,defaultdict,Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts=time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return lis...
76
65
1,711
1,399
from heapq import heappush, heappop from collections import deque, defaultdict, Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts = time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return list(map...
from heapq import heappush, heappop from collections import deque, defaultdict, Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts = time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return list(map...
false
14.473684
[ "-d = []", "-nx = [0] * n", "+nx = [-1] * n", "- d.append([-1] * (n))", "-flg = True", "+IsMatch = True", "-yet = set(range(n))", "-n_yet = set(range(n))", "-while flg and MacthNum < n * (n - 1) // 2:", "- elp = time.time() - ts", "- if elp > 1.8:", "- ans = 0 # n*(n-1)//2", ...
false
0.03604
0.037777
0.954007
[ "s627018304", "s175163038" ]
u597374218
p03487
python
s711821079
s701631242
149
90
30,060
20,852
Accepted
Accepted
39.6
from collections import Counter n=int(eval(input())) a=Counter(input().split()) count=0 keys,counts=list(zip(*a.most_common())) for i,j in zip(keys,counts): i=int(i) if i>j: count+=j elif i<j: count+=j-i print(count)
from collections import Counter n=int(eval(input())) a=Counter(input().split()) ans=0 for i,j in list(a.items()): i=int(i) if i>j: ans+=j elif i<j: ans+=j-i print(ans)
12
11
243
193
from collections import Counter n = int(eval(input())) a = Counter(input().split()) count = 0 keys, counts = list(zip(*a.most_common())) for i, j in zip(keys, counts): i = int(i) if i > j: count += j elif i < j: count += j - i print(count)
from collections import Counter n = int(eval(input())) a = Counter(input().split()) ans = 0 for i, j in list(a.items()): i = int(i) if i > j: ans += j elif i < j: ans += j - i print(ans)
false
8.333333
[ "-count = 0", "-keys, counts = list(zip(*a.most_common()))", "-for i, j in zip(keys, counts):", "+ans = 0", "+for i, j in list(a.items()):", "- count += j", "+ ans += j", "- count += j - i", "-print(count)", "+ ans += j - i", "+print(ans)" ]
false
0.045499
0.047166
0.964668
[ "s711821079", "s701631242" ]
u421674761
p02622
python
s214667115
s488847936
66
59
9,360
9,276
Accepted
Accepted
10.61
s = eval(input()) t = eval(input()) count = 0 for i in range(len(s)): if s[i] != t[i]: count += 1 print(count)
s = eval(input()) t = eval(input()) cnt = 0 for i in range(len(s)): if s[i] != t[i]: cnt += 1 print(cnt)
9
10
121
117
s = eval(input()) t = eval(input()) count = 0 for i in range(len(s)): if s[i] != t[i]: count += 1 print(count)
s = eval(input()) t = eval(input()) cnt = 0 for i in range(len(s)): if s[i] != t[i]: cnt += 1 print(cnt)
false
10
[ "-count = 0", "+cnt = 0", "- count += 1", "-print(count)", "+ cnt += 1", "+print(cnt)" ]
false
0.095113
0.03889
2.44572
[ "s214667115", "s488847936" ]
u178432859
p02899
python
s130812092
s118494799
196
117
13,880
13,880
Accepted
Accepted
40.31
a = int(input()) b = list(map(int,input().split())) c = [] for val in range(a): c.append(5) for val in range(a): c[b[val]-1] = val+1 d = str() for val in range(len(c)-1): print(c[val], end = ' ') print(c[-1])
n = int(eval(input())) people = list(map(int, input().split())) ind = [0 for i in range(n)] for i in range(n): ind[people[i]-1] = i+1 print((*ind))
11
6
230
148
a = int(input()) b = list(map(int, input().split())) c = [] for val in range(a): c.append(5) for val in range(a): c[b[val] - 1] = val + 1 d = str() for val in range(len(c) - 1): print(c[val], end=" ") print(c[-1])
n = int(eval(input())) people = list(map(int, input().split())) ind = [0 for i in range(n)] for i in range(n): ind[people[i] - 1] = i + 1 print((*ind))
false
45.454545
[ "-a = int(input())", "-b = list(map(int, input().split()))", "-c = []", "-for val in range(a):", "- c.append(5)", "-for val in range(a):", "- c[b[val] - 1] = val + 1", "-d = str()", "-for val in range(len(c) - 1):", "- print(c[val], end=\" \")", "-print(c[-1])", "+n = int(eval(input()...
false
0.045242
0.04448
1.017116
[ "s130812092", "s118494799" ]
u918009437
p03013
python
s036245132
s162508381
227
163
13,212
92,300
Accepted
Accepted
28.19
if __name__ == '__main__': n, m = list(map(int,input().split())) a = set([int(eval(input())) for i in range(m)]) broken = [False] * (n+1) for i in range(n+1): if i in a: broken[i] = True MOD = 1000000007 dp = [0 for i in range(n+1)] dp[0] = 1 if 1 in a: dp[1] ...
import sys sys.setrecursionlimit(1000000) MOD = 1000000007 state = [-1 for i in range(100010)] def step_state(n, broken): if state[n] != -1: return state[n] if n == 0: state[0]=1 return 1 elif n == 1: if broken[1]: state[1]=0 ret...
29
48
619
1,115
if __name__ == "__main__": n, m = list(map(int, input().split())) a = set([int(eval(input())) for i in range(m)]) broken = [False] * (n + 1) for i in range(n + 1): if i in a: broken[i] = True MOD = 1000000007 dp = [0 for i in range(n + 1)] dp[0] = 1 if 1 in a: ...
import sys sys.setrecursionlimit(1000000) MOD = 1000000007 state = [-1 for i in range(100010)] def step_state(n, broken): if state[n] != -1: return state[n] if n == 0: state[0] = 1 return 1 elif n == 1: if broken[1]: state[1] = 0 return 0 el...
false
39.583333
[ "+import sys", "+", "+sys.setrecursionlimit(1000000)", "+MOD = 1000000007", "+state = [-1 for i in range(100010)]", "+", "+", "+def step_state(n, broken):", "+ if state[n] != -1:", "+ return state[n]", "+ if n == 0:", "+ state[0] = 1", "+ return 1", "+ elif n ...
false
0.048734
0.058425
0.834125
[ "s036245132", "s162508381" ]
u864197622
p03806
python
s802089592
s626738673
162
100
3,188
3,188
Accepted
Accepted
38.27
N, A, B = list(map(int, input().split())) X = [1<<20] * 8080 for _ in range(N): a, b, c = list(map(int, input().split())) t = A*b-B*a X = [min(X[i], (0 if (i-t)%8080 == 0 else X[(i-t)%8080]) + c) for i in range(8080)] print((-1 if X[0] > 1<<18 else X[0]))
N, A, B = list(map(int, input().split())) X = [1<<20] * 4040 for _ in range(N): a, b, c = list(map(int, input().split())) t = A*b-B*a X = [min(X[i], (0 if (i-t)%4040 == 0 else X[(i-t)%4040]) + c) for i in range(4040)] print((-1 if X[0] > 1<<18 else X[0]))
7
7
259
259
N, A, B = list(map(int, input().split())) X = [1 << 20] * 8080 for _ in range(N): a, b, c = list(map(int, input().split())) t = A * b - B * a X = [ min(X[i], (0 if (i - t) % 8080 == 0 else X[(i - t) % 8080]) + c) for i in range(8080) ] print((-1 if X[0] > 1 << 18 else X[0]))
N, A, B = list(map(int, input().split())) X = [1 << 20] * 4040 for _ in range(N): a, b, c = list(map(int, input().split())) t = A * b - B * a X = [ min(X[i], (0 if (i - t) % 4040 == 0 else X[(i - t) % 4040]) + c) for i in range(4040) ] print((-1 if X[0] > 1 << 18 else X[0]))
false
0
[ "-X = [1 << 20] * 8080", "+X = [1 << 20] * 4040", "- min(X[i], (0 if (i - t) % 8080 == 0 else X[(i - t) % 8080]) + c)", "- for i in range(8080)", "+ min(X[i], (0 if (i - t) % 4040 == 0 else X[(i - t) % 4040]) + c)", "+ for i in range(4040)" ]
false
0.044619
0.037056
1.204102
[ "s802089592", "s626738673" ]
u126434371
p02987
python
s022602923
s119030204
19
17
2,940
2,940
Accepted
Accepted
10.53
a = eval(input()) a = sorted(a) if a[0] == a[1] and a[2] == a[3] and a[1] != a[3]: print("Yes") else: print("No")
a = sorted(input()) print("Yes") if a[0] == a[1] and a[2] == a[3] and a[1] != a[3] else print("No")
7
2
122
100
a = eval(input()) a = sorted(a) if a[0] == a[1] and a[2] == a[3] and a[1] != a[3]: print("Yes") else: print("No")
a = sorted(input()) print("Yes") if a[0] == a[1] and a[2] == a[3] and a[1] != a[3] else print("No")
false
71.428571
[ "-a = eval(input())", "-a = sorted(a)", "-if a[0] == a[1] and a[2] == a[3] and a[1] != a[3]:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+a = sorted(input())", "+print(\"Yes\") if a[0] == a[1] and a[2] == a[3] and a[1] != a[3] else print(\"No\")" ]
false
0.037676
0.038781
0.9715
[ "s022602923", "s119030204" ]
u243535639
p02554
python
s916471902
s269425870
107
95
62,912
63,056
Accepted
Accepted
11.21
def main(): N = int(eval(input())) mod = 10 ** 9 + 7 mod_1 = 1 mod_2 = 1 mod_3 = 1 for _ in range(N): mod_1 = (mod_1 * 10) % mod mod_2 = (mod_2 * 9) % mod mod_3 = (mod_3 * 8) % mod v = mod_1 - 2 * mod_2 + mod_3 if v < 0: v *= -1 v = ((...
def main(): N = int(eval(input())) mod = 10 ** 9 + 7 mod_1 = 1 mod_2 = 1 mod_3 = 1 for _ in range(N): mod_1 = (mod_1 * 10) % mod mod_2 = (mod_2 * 9) % mod mod_3 = (mod_3 * 8) % mod v = (mod_1 - 2 * mod_2 + mod_3) % mod print(v) if __name__ == '__main...
18
15
395
330
def main(): N = int(eval(input())) mod = 10**9 + 7 mod_1 = 1 mod_2 = 1 mod_3 = 1 for _ in range(N): mod_1 = (mod_1 * 10) % mod mod_2 = (mod_2 * 9) % mod mod_3 = (mod_3 * 8) % mod v = mod_1 - 2 * mod_2 + mod_3 if v < 0: v *= -1 v = ((v // mod) + 1) ...
def main(): N = int(eval(input())) mod = 10**9 + 7 mod_1 = 1 mod_2 = 1 mod_3 = 1 for _ in range(N): mod_1 = (mod_1 * 10) % mod mod_2 = (mod_2 * 9) % mod mod_3 = (mod_3 * 8) % mod v = (mod_1 - 2 * mod_2 + mod_3) % mod print(v) if __name__ == "__main__": main(...
false
16.666667
[ "- v = mod_1 - 2 * mod_2 + mod_3", "- if v < 0:", "- v *= -1", "- v = ((v // mod) + 1) * mod - v", "+ v = (mod_1 - 2 * mod_2 + mod_3) % mod" ]
false
0.120714
0.13291
0.908242
[ "s916471902", "s269425870" ]
u180058306
p03607
python
s414640952
s883662609
1,956
223
7,848
7,388
Accepted
Accepted
88.6
import bisect # 操作回数を入力する N = int(eval(input())) # 言う数字を入力する list_A = [int(eval(input())) for _ in range(N)] # 紙の状態を設定する paper = [] # for A in list_A: if paper == []: paper.append(A) continue # 紙上のAをニ分探索する index = bisect.bisect_left(paper, A) if index < len(paper) and pape...
# 操作回数を入力する N = int(eval(input())) # 言う数字を入力する list_A = [int(eval(input())) for _ in range(N)] # 数字を昇順に並べる list_A.sort() # 終了後に残っている数字の数を設定する ans = 0 # 直前の数字を設定する num = 0 # ある数字が連続している回数を設定する count = 0 # 昇順に並んだ各数字Aについて、、 for A in list_A: # 数字Aが直前の数字と同じ場合、、 if A == num: # 連続回数を増やす ...
20
32
421
639
import bisect # 操作回数を入力する N = int(eval(input())) # 言う数字を入力する list_A = [int(eval(input())) for _ in range(N)] # 紙の状態を設定する paper = [] # for A in list_A: if paper == []: paper.append(A) continue # 紙上のAをニ分探索する index = bisect.bisect_left(paper, A) if index < len(paper) and paper[index] == A:...
# 操作回数を入力する N = int(eval(input())) # 言う数字を入力する list_A = [int(eval(input())) for _ in range(N)] # 数字を昇順に並べる list_A.sort() # 終了後に残っている数字の数を設定する ans = 0 # 直前の数字を設定する num = 0 # ある数字が連続している回数を設定する count = 0 # 昇順に並んだ各数字Aについて、、 for A in list_A: # 数字Aが直前の数字と同じ場合、、 if A == num: # 連続回数を増やす count += 1 ...
false
37.5
[ "-import bisect", "-", "-# 紙の状態を設定する", "-paper = []", "-#", "+# 数字を昇順に並べる", "+list_A.sort()", "+# 終了後に残っている数字の数を設定する", "+ans = 0", "+# 直前の数字を設定する", "+num = 0", "+# ある数字が連続している回数を設定する", "+count = 0", "+# 昇順に並んだ各数字Aについて、、", "- if paper == []:", "- paper.append(A)", "- ...
false
0.035817
0.052815
0.678173
[ "s414640952", "s883662609" ]
u499381410
p02665
python
s798635833
s777683366
187
164
95,880
95,888
Accepted
Accepted
12.3
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
56
55
1,541
1,524
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor, co...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor, co...
false
1.785714
[ "- ret = 1 - A[0]", "+ ret = 1", "- ret = min(ret * 2, max_arr[j])", "+ ret = min((ret - A[j - 1]) * 2, max_arr[j])", "- ret -= A[j]" ]
false
0.099889
0.05744
1.739009
[ "s798635833", "s777683366" ]
u077291787
p02780
python
s361048063
s603713662
118
106
26,288
26,288
Accepted
Accepted
10.17
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) for i in P])) ans = max(right - left for left, right in zip(cumsum,...
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate([0] + [(i + 1) / 2 for i in P])) ans = max(right - left for left, right in zip(cumsum, cumsum[K:...
14
14
388
378
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) for i in P])) ans = max(right - left for left, right in zip(cumsum, cumsum[...
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate([0] + [(i + 1) / 2 for i in P])) ans = max(right - left for left, right in zip(cumsum, cumsum[K:])) ...
false
0
[ "- cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) for i in P]))", "+ cumsum = tuple(accumulate([0] + [(i + 1) / 2 for i in P]))" ]
false
0.078675
0.078127
1.007006
[ "s361048063", "s603713662" ]
u227020436
p02700
python
s271674516
s925155416
23
20
9,108
9,160
Accepted
Accepted
13.04
# B - Battle a, b, c, d = list(map(int, input().split())) while c > 0 and a > 0: c -= b a -= d print(('Yes' if c <= 0 else 'No'))
# B - Battle import math a, b, c, d = list(map(int, input().split())) ao = math.ceil(c / b) # 青木君の生存回数 ta = math.ceil(a / d) # 高橋君の生存回数 print(('Yes' if ao <= ta else 'No'))
9
10
140
180
# B - Battle a, b, c, d = list(map(int, input().split())) while c > 0 and a > 0: c -= b a -= d print(("Yes" if c <= 0 else "No"))
# B - Battle import math a, b, c, d = list(map(int, input().split())) ao = math.ceil(c / b) # 青木君の生存回数 ta = math.ceil(a / d) # 高橋君の生存回数 print(("Yes" if ao <= ta else "No"))
false
10
[ "+import math", "+", "-while c > 0 and a > 0:", "- c -= b", "- a -= d", "-print((\"Yes\" if c <= 0 else \"No\"))", "+ao = math.ceil(c / b) # 青木君の生存回数", "+ta = math.ceil(a / d) # 高橋君の生存回数", "+print((\"Yes\" if ao <= ta else \"No\"))" ]
false
0.036396
0.036954
0.984897
[ "s271674516", "s925155416" ]
u876438858
p02696
python
s806907586
s733261588
22
20
9,192
9,196
Accepted
Accepted
9.09
import sys from math import sqrt, floor input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def main(): a, b, n = MI() if b - 1 <= n: print(((a * (b - 1)) // b)) else: ...
import sys from math import sqrt, floor input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def main(): a, b, n = MI() if b - 1 <= n: print(((a * (b - 1)) // b)) else: ...
26
26
390
373
import sys from math import sqrt, floor input = sys.stdin.readline sys.setrecursionlimit(10**6) def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def main(): a, b, n = MI() if b - 1 <= n: print(((a * (b - 1)) // b)) else: print(((a * n) // b -...
import sys from math import sqrt, floor input = sys.stdin.readline sys.setrecursionlimit(10**6) def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def main(): a, b, n = MI() if b - 1 <= n: print(((a * (b - 1)) // b)) else: print(((a * n) // b))...
false
0
[ "- print(((a * n) // b - (a * (n // b))))", "+ print(((a * n) // b))" ]
false
0.0747
0.072288
1.033363
[ "s806907586", "s733261588" ]
u159994501
p02791
python
s330044040
s075870452
112
91
24,744
17,940
Accepted
Accepted
18.75
N = int(eval(input())) P = list(map(int, input().split())) m = float('INF') ans = 0 for i in range(N): if P[i] < m: ans += 1 m = P[i] print(ans)
N = int(eval(input())) P = list(map(int, input().split())) minimal = float('inf') ans = 0 for i in P: if minimal >= i: ans += 1 minimal = i print(ans)
10
9
169
167
N = int(eval(input())) P = list(map(int, input().split())) m = float("INF") ans = 0 for i in range(N): if P[i] < m: ans += 1 m = P[i] print(ans)
N = int(eval(input())) P = list(map(int, input().split())) minimal = float("inf") ans = 0 for i in P: if minimal >= i: ans += 1 minimal = i print(ans)
false
10
[ "-m = float(\"INF\")", "+minimal = float(\"inf\")", "-for i in range(N):", "- if P[i] < m:", "+for i in P:", "+ if minimal >= i:", "- m = P[i]", "+ minimal = i" ]
false
0.044505
0.043069
1.033349
[ "s330044040", "s075870452" ]
u535803878
p04006
python
s842789125
s493758108
880
801
57,048
56,920
Accepted
Accepted
8.98
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") from queue import deque n,x = list(map(int, input().split())) a = list(map(int, input().split())) def sub(p): k = p res = [] q = deque([]) # q: ...
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") from queue import deque n,x = list(map(int, input().split())) A = list(map(int, input().split())) def sub(p): k = p res = [] q = deque([]) a = A...
42
33
1,030
737
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") from queue import deque n, x = list(map(int, input().split())) a = list(map(int, input().split())) def sub(p): k = p res = [] q = deque([]) # q: i0<i1<,..., a...
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") from queue import deque n, x = list(map(int, input().split())) A = list(map(int, input().split())) def sub(p): k = p res = [] q = deque([]) a = A + A[: k - 1]...
false
21.428571
[ "-a = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+ a = A + A[: k - 1]", "- for j, num in enumerate(a):", "- if len(res) >= n:", "- break", "- while q and a[q[-1] if q[-1] < n else q[-1] - n] > num:", "- q.pop()", "- q.a...
false
0.050286
0.049497
1.015948
[ "s842789125", "s493758108" ]
u392319141
p03043
python
s767977038
s796592089
41
34
3,060
2,940
Accepted
Accepted
17.07
import math N , K = list(map(int,input().split())) count = 0 now = K while now > N : count += 1 now = now / 2. prob = 0 for i in range(1,N+1) : if i < now : for k in range(N) : if i * 2**k >= now : break prob += 2**(-(count + k )) / N e...
N, K = list(map(int, input().split())) ans = 0 for i in range(1, N + 1): if i >= K: ans += 1 else: cnt = 0 while i < K: i *= 2 cnt += 1 ans += pow(2, -cnt) print((ans / N))
23
13
368
242
import math N, K = list(map(int, input().split())) count = 0 now = K while now > N: count += 1 now = now / 2.0 prob = 0 for i in range(1, N + 1): if i < now: for k in range(N): if i * 2**k >= now: break prob += 2 ** (-(count + k)) / N else: prob += 2 ...
N, K = list(map(int, input().split())) ans = 0 for i in range(1, N + 1): if i >= K: ans += 1 else: cnt = 0 while i < K: i *= 2 cnt += 1 ans += pow(2, -cnt) print((ans / N))
false
43.478261
[ "-import math", "-", "-count = 0", "-now = K", "-while now > N:", "- count += 1", "- now = now / 2.0", "-prob = 0", "+ans = 0", "- if i < now:", "- for k in range(N):", "- if i * 2**k >= now:", "- break", "- prob += 2 ** (-(count + k)) / N",...
false
0.056711
0.057243
0.990715
[ "s767977038", "s796592089" ]
u227082700
p03061
python
s119216121
s821355799
159
78
14,400
14,584
Accepted
Accepted
50.94
def gcd(a,b): while b:a,b=b,a%b return a n=int(eval(input())) a=list(map(int,input().split())) if n==2:print((max(a[0],a[1])));exit() left=[a[0]] for i in range(1,n):left.append(gcd(left[-1],a[i])) right=[a[n-1]] for i in range(n-2,-1,-1):right.append(gcd(right[-1],a[i])) right.reverse() ans=max(right[1]...
def gcd(a,b): while b:a,b=b,a%b return a n,a=int(eval(input())),list(map(int,input().split())) if n==2:print((max(a)));exit() if n==3:print((max(gcd(a[0],a[1]),gcd(a[0],a[2]),gcd(a[1],a[2]))));exit() ans=ans2=a[0] for i in range(1,n): g=gcd(ans,a[i]) if g!=ans: ans=max(g,ans2) ans2=gcd(g,ans2...
13
13
392
323
def gcd(a, b): while b: a, b = b, a % b return a n = int(eval(input())) a = list(map(int, input().split())) if n == 2: print((max(a[0], a[1]))) exit() left = [a[0]] for i in range(1, n): left.append(gcd(left[-1], a[i])) right = [a[n - 1]] for i in range(n - 2, -1, -1): right.append(gcd...
def gcd(a, b): while b: a, b = b, a % b return a n, a = int(eval(input())), list(map(int, input().split())) if n == 2: print((max(a))) exit() if n == 3: print((max(gcd(a[0], a[1]), gcd(a[0], a[2]), gcd(a[1], a[2])))) exit() ans = ans2 = a[0] for i in range(1, n): g = gcd(ans, a[i])...
false
0
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "+n, a = int(eval(input())), list(map(int, input().split()))", "- print((max(a[0], a[1])))", "+ print((max(a)))", "-left = [a[0]]", "+if n == 3:", "+ print((max(gcd(a[0], a[1]), gcd(a[0], a[2]), gcd(a[1], a[2]))))", "+ ex...
false
0.098817
0.051106
1.933555
[ "s119216121", "s821355799" ]
u932465688
p03240
python
s455161389
s370058947
601
146
3,064
3,064
Accepted
Accepted
75.71
N = int(eval(input())) L = [] for i in range(N): L.append(list(map(int,input().split()))) for j in range(N): if L[j][2] != 0: karix = L[j][0] kariy = L[j][1] karih = L[j][2] break for p in range(0,101): for q in range(0,101): cnt = 0 kouhoH = karih+abs(karix-p)+abs(kariy-q) ...
N = int(eval(input())) L = [] for i in range(N): L.append(list(map(int,input().split()))) H = 0 for X in range(101): for Y in range(101): for i in range(N): h = 0 if L[i][2] != 0: h = L[i][2] break flag = True H = h+abs(L[i][0]-X)+abs(L[i][1]-Y) for j in ran...
20
21
477
466
N = int(eval(input())) L = [] for i in range(N): L.append(list(map(int, input().split()))) for j in range(N): if L[j][2] != 0: karix = L[j][0] kariy = L[j][1] karih = L[j][2] break for p in range(0, 101): for q in range(0, 101): cnt = 0 kouhoH = karih + abs(ka...
N = int(eval(input())) L = [] for i in range(N): L.append(list(map(int, input().split()))) H = 0 for X in range(101): for Y in range(101): for i in range(N): h = 0 if L[i][2] != 0: h = L[i][2] break flag = True H = h + abs(L[i][0] -...
false
4.761905
[ "-for j in range(N):", "- if L[j][2] != 0:", "- karix = L[j][0]", "- kariy = L[j][1]", "- karih = L[j][2]", "- break", "-for p in range(0, 101):", "- for q in range(0, 101):", "- cnt = 0", "- kouhoH = karih + abs(karix - p) + abs(kariy - q)", "- ...
false
0.041778
0.06416
0.651147
[ "s455161389", "s370058947" ]
u223663729
p03645
python
s488868142
s483305762
537
454
65,420
39,932
Accepted
Accepted
15.46
N, M, *A = list(map(int, open(0).read().split())) A = [(A[i], A[i+1]) for i in range(0, M*2, 2)] E = [[] for _ in range(N)] for a, b in A: a -= 1; b -= 1 E[a].append(b) E[b].append(a) def search(d=2, v=0, g=N-1): if d == 0: if v == g: return True else: ...
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) G = [[] for _ in [0]*N] for _ in [0]*M: a, b = list(map(int, input().split())) a -= 1; b -= 1 G[a].append(b) G[b].append(a) for v in G[0]: if N-1 in G[v]: print('POSSIBLE') break else: pr...
24
16
498
325
N, M, *A = list(map(int, open(0).read().split())) A = [(A[i], A[i + 1]) for i in range(0, M * 2, 2)] E = [[] for _ in range(N)] for a, b in A: a -= 1 b -= 1 E[a].append(b) E[b].append(a) def search(d=2, v=0, g=N - 1): if d == 0: if v == g: return True else: ...
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) G = [[] for _ in [0] * N] for _ in [0] * M: a, b = list(map(int, input().split())) a -= 1 b -= 1 G[a].append(b) G[b].append(a) for v in G[0]: if N - 1 in G[v]: print("POSSIBLE") break else: print("I...
false
33.333333
[ "-N, M, *A = list(map(int, open(0).read().split()))", "-A = [(A[i], A[i + 1]) for i in range(0, M * 2, 2)]", "-E = [[] for _ in range(N)]", "-for a, b in A:", "+import sys", "+", "+input = sys.stdin.readline", "+N, M = list(map(int, input().split()))", "+G = [[] for _ in [0] * N]", "+for _ in [0] ...
false
0.040504
0.04027
1.005815
[ "s488868142", "s483305762" ]
u652583512
p02844
python
s231397523
s697429739
984
20
3,444
3,060
Accepted
Accepted
97.97
N = int(eval(input())) S = [int(i) for i in eval(input())] ans = 0 for i in range(10): fp = -1 for tf in range(N - 2): if S[tf] == i: fp = tf break if fp == -1: continue for j in range(10): sp = -1 for ts in range(fp + 1, N - 1): ...
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): fp = S.find(str(i)) if fp == -1: continue for j in range(10): sp = S.find(str(j), fp + 1) if sp == -1: continue for k in range(10): if str(k) in S[sp + 1:]: ...
34
23
612
348
N = int(eval(input())) S = [int(i) for i in eval(input())] ans = 0 for i in range(10): fp = -1 for tf in range(N - 2): if S[tf] == i: fp = tf break if fp == -1: continue for j in range(10): sp = -1 for ts in range(fp + 1, N - 1): if S[t...
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): fp = S.find(str(i)) if fp == -1: continue for j in range(10): sp = S.find(str(j), fp + 1) if sp == -1: continue for k in range(10): if str(k) in S[sp + 1 :]: ans += 1 ...
false
32.352941
[ "-S = [int(i) for i in eval(input())]", "+S = eval(input())", "- fp = -1", "- for tf in range(N - 2):", "- if S[tf] == i:", "- fp = tf", "- break", "+ fp = S.find(str(i))", "- sp = -1", "- for ts in range(fp + 1, N - 1):", "- if S[ts...
false
0.0471
0.03666
1.284754
[ "s231397523", "s697429739" ]
u975820355
p02725
python
s229055773
s137162548
175
112
24,780
26,444
Accepted
Accepted
36
k, n = list(map(float, input().split())) m = list(map(float, input().split())) half_k = k / 2 min = float(1000000) for i in range(int(n)): first = m[i] last = m[i-1] len = last - first if len < 0: len = len + k if min > len: min = len print((int(min)))
K, N = list(map(int, input().split())) A = list(map(int, input().split())) max = A[0] + (K - A[-1]) for i in range(len(A)-1): d = A[i+1] - A[i] if d > max: max = d print((K-max))
13
9
292
187
k, n = list(map(float, input().split())) m = list(map(float, input().split())) half_k = k / 2 min = float(1000000) for i in range(int(n)): first = m[i] last = m[i - 1] len = last - first if len < 0: len = len + k if min > len: min = len print((int(min)))
K, N = list(map(int, input().split())) A = list(map(int, input().split())) max = A[0] + (K - A[-1]) for i in range(len(A) - 1): d = A[i + 1] - A[i] if d > max: max = d print((K - max))
false
30.769231
[ "-k, n = list(map(float, input().split()))", "-m = list(map(float, input().split()))", "-half_k = k / 2", "-min = float(1000000)", "-for i in range(int(n)):", "- first = m[i]", "- last = m[i - 1]", "- len = last - first", "- if len < 0:", "- len = len + k", "- if min > len:...
false
0.143265
0.096082
1.491075
[ "s229055773", "s137162548" ]
u588341295
p03550
python
s048181368
s540277199
832
20
46,852
3,188
Accepted
Accepted
97.6
# -*- coding: utf-8 -*- """ 参考:https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/    https://atcoder.jp/contests/abc078/submissions/3854338 ・ミニマックス法 ・メモ化再帰 ・メモの持ち方をシンプルにした版 """ import sys from collections import defaultdict # 再帰呼び出しの回数制限(デフォルト1000) sys.setrecursionlimit(10 ** 9) N, Z, W = list(ma...
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/arc085/editorial.pdf ・公式解、O(1)の一発解法 ・思いつけばいいけど、そういつも上手くいかないよね…。 """ N, Z, W = list(map(int, input().split())) aN = list(map(int, input().split())) if N == 1: print((abs(aN[0] - W))) else: # Xが最後まで引くか、最後から2番目まで引くか print((max(abs(aN[-1] ...
51
16
1,204
340
# -*- coding: utf-8 -*- """ 参考:https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/    https://atcoder.jp/contests/abc078/submissions/3854338 ・ミニマックス法 ・メモ化再帰 ・メモの持ち方をシンプルにした版 """ import sys from collections import defaultdict # 再帰呼び出しの回数制限(デフォルト1000) sys.setrecursionlimit(10**9) N, Z, W = list(map(int, input().split()...
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/arc085/editorial.pdf ・公式解、O(1)の一発解法 ・思いつけばいいけど、そういつも上手くいかないよね…。 """ N, Z, W = list(map(int, input().split())) aN = list(map(int, input().split())) if N == 1: print((abs(aN[0] - W))) else: # Xが最後まで引くか、最後から2番目まで引くか print((max(abs(aN[-1] - W), abs(aN[-2] - ...
false
68.627451
[ "-参考:https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/", "-   https://atcoder.jp/contests/abc078/submissions/3854338", "-・ミニマックス法", "-・メモ化再帰", "-・メモの持ち方をシンプルにした版", "+参考:https://img.atcoder.jp/arc085/editorial.pdf", "+・公式解、O(1)の一発解法", "+・思いつけばいいけど、そういつも上手くいかないよね…。", "-import sys", "-from collect...
false
0.129895
0.043662
2.975039
[ "s048181368", "s540277199" ]
u899909022
p02971
python
s740065741
s486879233
713
584
22,060
12,520
Accepted
Accepted
18.09
N=int(eval(input())) A=[] for i in range(N): A.append(int(eval(input()))) R=[] max_ = 0 for i in range(N): max_ = max(max_, A[i]) R.append(max_) L=[] max_ = 0 for i in reversed(list(range(N))): max_ = max(max_, A[i]) L.append(max_) L = list(reversed(L)) print((L[1])) for i in range(1...
n=int(eval(input())) max1 = 0 max2 = 0 A=[] for _ in range(n): num = int(eval(input())) if num == max(num, max1): max2 = max1 max1 = num elif num == max(num, max2): max2 = num A.append(num) for a in A: if a == max1: print(max2) else: print(...
19
17
360
313
N = int(eval(input())) A = [] for i in range(N): A.append(int(eval(input()))) R = [] max_ = 0 for i in range(N): max_ = max(max_, A[i]) R.append(max_) L = [] max_ = 0 for i in reversed(list(range(N))): max_ = max(max_, A[i]) L.append(max_) L = list(reversed(L)) print((L[1])) for i in range(1, N - 1)...
n = int(eval(input())) max1 = 0 max2 = 0 A = [] for _ in range(n): num = int(eval(input())) if num == max(num, max1): max2 = max1 max1 = num elif num == max(num, max2): max2 = num A.append(num) for a in A: if a == max1: print(max2) else: print(max1)
false
10.526316
[ "-N = int(eval(input()))", "+n = int(eval(input()))", "+max1 = 0", "+max2 = 0", "-for i in range(N):", "- A.append(int(eval(input())))", "-R = []", "-max_ = 0", "-for i in range(N):", "- max_ = max(max_, A[i])", "- R.append(max_)", "-L = []", "-max_ = 0", "-for i in reversed(list(...
false
0.040921
0.049963
0.819028
[ "s740065741", "s486879233" ]
u133936772
p02627
python
s044931434
s207435612
28
24
8,956
8,996
Accepted
Accepted
14.29
print(('Aa'[ord(eval(input()))>96]))
print(('Aa'[input().islower()]))
1
1
28
30
print(("Aa"[ord(eval(input())) > 96]))
print(("Aa"[input().islower()]))
false
0
[ "-print((\"Aa\"[ord(eval(input())) > 96]))", "+print((\"Aa\"[input().islower()]))" ]
false
0.044888
0.047847
0.938157
[ "s044931434", "s207435612" ]
u188827677
p03524
python
s249231769
s431497244
37
30
10,080
9,220
Accepted
Accepted
18.92
from collections import Counter s = list(eval(input())) count = Counter(s) if len(s) <= 3: if len(s) == 1: print("YES") elif len(list(count.keys())) == len(s): print("YES") else: print("NO") else: if len(list(count.keys())) <= 2: print("NO") elif max(count.values()) - min(count.values()) <= 1: prin...
s = eval(input()) a = s.count("a") b = s.count("b") c = s.count("c") if abs(a-b) <=1 and abs(b-c) <= 1 and abs(c-a) <= 1: print("YES") else: print("NO")
12
8
332
155
from collections import Counter s = list(eval(input())) count = Counter(s) if len(s) <= 3: if len(s) == 1: print("YES") elif len(list(count.keys())) == len(s): print("YES") else: print("NO") else: if len(list(count.keys())) <= 2: print("NO") elif max(count.values()) ...
s = eval(input()) a = s.count("a") b = s.count("b") c = s.count("c") if abs(a - b) <= 1 and abs(b - c) <= 1 and abs(c - a) <= 1: print("YES") else: print("NO")
false
33.333333
[ "-from collections import Counter", "-", "-s = list(eval(input()))", "-count = Counter(s)", "-if len(s) <= 3:", "- if len(s) == 1:", "- print(\"YES\")", "- elif len(list(count.keys())) == len(s):", "- print(\"YES\")", "- else:", "- print(\"NO\")", "+s = eval(input...
false
0.141804
0.156367
0.906867
[ "s249231769", "s431497244" ]
u881590806
p02264
python
s426777893
s262968302
960
500
31,512
18,792
Accepted
Accepted
47.92
class Node: def __init__(self,v): self.v = v self.next = None class Queue: def __init__(self): self.head = None self.tail = None self.size = 0 def enqueue(self,v): self.size += 1 n = Node(v) if self.tail == None: se...
class Queue: def __init__(self, n): self.values = [None]*n self.n = n self.s = 0 self.t = 0 def next(self, p): ret = p+1 if ret >= self.n: ret = 0 return ret def enqueue(self, x): if self.next(self.s) == self.t: ...
80
47
1,962
1,096
class Node: def __init__(self, v): self.v = v self.next = None class Queue: def __init__(self): self.head = None self.tail = None self.size = 0 def enqueue(self, v): self.size += 1 n = Node(v) if self.tail == None: self.tail = n ...
class Queue: def __init__(self, n): self.values = [None] * n self.n = n self.s = 0 self.t = 0 def next(self, p): ret = p + 1 if ret >= self.n: ret = 0 return ret def enqueue(self, x): if self.next(self.s) == self.t: ra...
false
41.25
[ "-class Node:", "- def __init__(self, v):", "- self.v = v", "- self.next = None", "+class Queue:", "+ def __init__(self, n):", "+ self.values = [None] * n", "+ self.n = n", "+ self.s = 0", "+ self.t = 0", "+", "+ def next(self, p):", "+ ...
false
0.048177
0.046566
1.034599
[ "s426777893", "s262968302" ]
u170201762
p03305
python
s801408232
s785537023
1,986
1,611
95,856
87,500
Accepted
Accepted
18.88
from heapq import * from numpy import array INF = 10**15 def djikstra(G,s,d): #d = [0]*V que = [] d[s] = 0 visited = [False] * V heappush(que,(0,s)) while(len(que)!=0): c,v = heappop(que) if visited[v]: continue visited[v] = True for i ...
from heapq import * INF = 10**15 def djikstra(G,s,d): #d = [0]*V que = [] d[s] = 0 visited = [False] * V heappush(que,(0,s)) while(len(que)!=0): c,v = heappop(que) if visited[v]: continue visited[v] = True for i in range(len(G[v])): ...
48
49
1,061
1,063
from heapq import * from numpy import array INF = 10**15 def djikstra(G, s, d): # d = [0]*V que = [] d[s] = 0 visited = [False] * V heappush(que, (0, s)) while len(que) != 0: c, v = heappop(que) if visited[v]: continue visited[v] = True for i in ran...
from heapq import * INF = 10**15 def djikstra(G, s, d): # d = [0]*V que = [] d[s] = 0 visited = [False] * V heappush(que, (0, s)) while len(que) != 0: c, v = heappop(que) if visited[v]: continue visited[v] = True for i in range(len(G[v])): ...
false
2.040816
[ "-from numpy import array", "-M = INF - (array(S) + array(T))", "+M = [0] * n", "+for i in range(n):", "+ M[i] = INF - S[i] - T[i]" ]
false
0.26968
0.045759
5.893496
[ "s801408232", "s785537023" ]
u614314290
p03103
python
s849868641
s905039716
520
374
18,372
18,136
Accepted
Accepted
28.08
from collections import defaultdict as dd # お約束 INF = float("inf") MOD = int(1e9 + 7) def int1(n): return int(n) - 1 def parse(*args): return tuple(p(v) for p, v in zip(args, input().split())) # エントリーポイント def main(): N, M = parse(int, int) AB = dd(int) for _ in range(N): a...
from collections import defaultdict as dd # お約束 INF = float("inf") MOD = int(1e9 + 7) def int1(n): return int(n) - 1 def parse(*args): return tuple(p(v) for p, v in zip(args, input().split())) # エントリーポイント def main(): N, M = parse(int, int) AB = dd(int) for _ in range(N): a...
32
32
642
671
from collections import defaultdict as dd # お約束 INF = float("inf") MOD = int(1e9 + 7) def int1(n): return int(n) - 1 def parse(*args): return tuple(p(v) for p, v in zip(args, input().split())) # エントリーポイント def main(): N, M = parse(int, int) AB = dd(int) for _ in range(N): a, b = parse(...
from collections import defaultdict as dd # お約束 INF = float("inf") MOD = int(1e9 + 7) def int1(n): return int(n) - 1 def parse(*args): return tuple(p(v) for p, v in zip(args, input().split())) # エントリーポイント def main(): N, M = parse(int, int) AB = dd(int) for _ in range(N): a, b = list(m...
false
0
[ "- a, b = parse(int, int)", "+ a, b = list(map(int, input().split())) # parse(int, int)" ]
false
0.03579
0.038108
0.939171
[ "s849868641", "s905039716" ]
u038021590
p03831
python
s707828472
s265807879
232
87
62,704
85,628
Accepted
Accepted
62.5
N, A, B = list(map(int, input().split())) City = list(map(int, input().split())) d = B //A ans = 0 for x, y in zip(City, City[1:]): if y - x <= d: ans += (y - x) * A else: ans += B print(ans)
N, A, B = list(map(int, input().split())) X = list(map(int, input().split())) ans = (X[-1] - X[0]) * A for x1, x2 in zip(X, X[1:]): if (x2 - x1) * A > B: ans -= (x2 - x1) * A - B print(ans)
11
7
220
201
N, A, B = list(map(int, input().split())) City = list(map(int, input().split())) d = B // A ans = 0 for x, y in zip(City, City[1:]): if y - x <= d: ans += (y - x) * A else: ans += B print(ans)
N, A, B = list(map(int, input().split())) X = list(map(int, input().split())) ans = (X[-1] - X[0]) * A for x1, x2 in zip(X, X[1:]): if (x2 - x1) * A > B: ans -= (x2 - x1) * A - B print(ans)
false
36.363636
[ "-City = list(map(int, input().split()))", "-d = B // A", "-ans = 0", "-for x, y in zip(City, City[1:]):", "- if y - x <= d:", "- ans += (y - x) * A", "- else:", "- ans += B", "+X = list(map(int, input().split()))", "+ans = (X[-1] - X[0]) * A", "+for x1, x2 in zip(X, X[1:]):"...
false
0.038247
0.039287
0.973512
[ "s707828472", "s265807879" ]
u497952650
p02726
python
s404959751
s555978496
1,942
1,779
131,252
131,264
Accepted
Accepted
8.39
from scipy.sparse.csgraph import dijkstra import numpy as np N,X,Y = list(map(int,input().split())) edge = [[0]*N for i in range(N)] for i in range(N-1): edge[i][i+1] = 1 edge[i+1][i] = 1 edge[X-1][Y-1] = 1 edge[Y-1][X-1] = 1 edge_n = np.array(edge) ans = dijkstra(edge_n) ans = np.array(an...
from scipy.sparse.csgraph import dijkstra import numpy as np N,X,Y = list(map(int,input().split())) edge = tuple([0]*N for i in range(N)) for i in range(N-1): edge[i][i+1] = 1 edge[i+1][i] = 1 edge[X-1][Y-1] = 1 edge[Y-1][X-1] = 1 edge_n = np.array(edge) ans = dijkstra(edge_n) ans = np.arr...
24
24
453
457
from scipy.sparse.csgraph import dijkstra import numpy as np N, X, Y = list(map(int, input().split())) edge = [[0] * N for i in range(N)] for i in range(N - 1): edge[i][i + 1] = 1 edge[i + 1][i] = 1 edge[X - 1][Y - 1] = 1 edge[Y - 1][X - 1] = 1 edge_n = np.array(edge) ans = dijkstra(edge_n) ans = np.array(ans,...
from scipy.sparse.csgraph import dijkstra import numpy as np N, X, Y = list(map(int, input().split())) edge = tuple([0] * N for i in range(N)) for i in range(N - 1): edge[i][i + 1] = 1 edge[i + 1][i] = 1 edge[X - 1][Y - 1] = 1 edge[Y - 1][X - 1] = 1 edge_n = np.array(edge) ans = dijkstra(edge_n) ans = np.array...
false
0
[ "-edge = [[0] * N for i in range(N)]", "+edge = tuple([0] * N for i in range(N))" ]
false
0.493985
0.586084
0.842857
[ "s404959751", "s555978496" ]
u060793972
p03673
python
s006631643
s862520018
215
153
26,016
30,912
Accepted
Accepted
28.84
n=int(eval(input())) a=list(map(int,input().split())) ushiro=[a[i] for i in range(n) if i%2==0]#if_n%2==0_it_will_be_behind mae=[a[i] for i in range(n) if i%2==1] p=mae[::-1]+ushiro if n%2==0: print((*p)) else: print((*p[::-1]))
n=int(eval(input())) a=list(map(int,input().split())) ushiro=list() mae=list() for i in range(n): if i%2:#1 mae.append(a[i]) else: ushiro.append(a[i]) p=ushiro[::-1]+mae if n%2 else mae[::-1]+ushiro print((*p))
9
11
234
236
n = int(eval(input())) a = list(map(int, input().split())) ushiro = [a[i] for i in range(n) if i % 2 == 0] # if_n%2==0_it_will_be_behind mae = [a[i] for i in range(n) if i % 2 == 1] p = mae[::-1] + ushiro if n % 2 == 0: print((*p)) else: print((*p[::-1]))
n = int(eval(input())) a = list(map(int, input().split())) ushiro = list() mae = list() for i in range(n): if i % 2: # 1 mae.append(a[i]) else: ushiro.append(a[i]) p = ushiro[::-1] + mae if n % 2 else mae[::-1] + ushiro print((*p))
false
18.181818
[ "-ushiro = [a[i] for i in range(n) if i % 2 == 0] # if_n%2==0_it_will_be_behind", "-mae = [a[i] for i in range(n) if i % 2 == 1]", "-p = mae[::-1] + ushiro", "-if n % 2 == 0:", "- print((*p))", "-else:", "- print((*p[::-1]))", "+ushiro = list()", "+mae = list()", "+for i in range(n):", "+...
false
0.048819
0.125781
0.388124
[ "s006631643", "s862520018" ]
u040298438
p02995
python
s725980207
s964300616
30
27
9,080
9,104
Accepted
Accepted
10
def cnt(n): return n // c + n // d - n // e from math import gcd a, b, c, d = list(map(int, input().split())) e = c // gcd(c, d) * d print((b - a + 1 - cnt(b) + cnt(a - 1)))
from math import gcd a, b, c, d = list(map(int, input().split())) e = c // gcd(c, d) * d cnt = lambda n: n // c + n // d - n // e print((b - a + 1 - cnt(b) + cnt(a - 1)))
9
6
180
168
def cnt(n): return n // c + n // d - n // e from math import gcd a, b, c, d = list(map(int, input().split())) e = c // gcd(c, d) * d print((b - a + 1 - cnt(b) + cnt(a - 1)))
from math import gcd a, b, c, d = list(map(int, input().split())) e = c // gcd(c, d) * d cnt = lambda n: n // c + n // d - n // e print((b - a + 1 - cnt(b) + cnt(a - 1)))
false
33.333333
[ "-def cnt(n):", "- return n // c + n // d - n // e", "-", "-", "+cnt = lambda n: n // c + n // d - n // e" ]
false
0.039155
0.037374
1.047629
[ "s725980207", "s964300616" ]
u049182844
p03060
python
s326714888
s851118326
29
24
9,144
8,972
Accepted
Accepted
17.24
def main(): g = [] n = int(eval(input())) v = list(map(int,input().split())) c = list(map(int,input().split())) for i in range(n): gain = v[i] -c[i] if gain > 0 : g.append(gain) print((sum(g))) if __name__ == '__main__': main()
def main(): g = 0 n = int(eval(input())) v = list(map(int,input().split())) c = list(map(int,input().split())) for i in range(n): gain = v[i] -c[i] if gain > 0 : g += gain print(g) if __name__ == '__main__': main()
14
14
290
279
def main(): g = [] n = int(eval(input())) v = list(map(int, input().split())) c = list(map(int, input().split())) for i in range(n): gain = v[i] - c[i] if gain > 0: g.append(gain) print((sum(g))) if __name__ == "__main__": main()
def main(): g = 0 n = int(eval(input())) v = list(map(int, input().split())) c = list(map(int, input().split())) for i in range(n): gain = v[i] - c[i] if gain > 0: g += gain print(g) if __name__ == "__main__": main()
false
0
[ "- g = []", "+ g = 0", "- g.append(gain)", "- print((sum(g)))", "+ g += gain", "+ print(g)" ]
false
0.043003
0.042808
1.004557
[ "s326714888", "s851118326" ]
u553987207
p02773
python
s424096936
s865372085
578
448
32,332
35,280
Accepted
Accepted
22.49
import sys readline = sys.stdin.readline N = int(readline()) sn = {} maxn = 0 for _ in range(N): S = readline() if S in sn: sn[S] += 1 else: sn[S] = 0 maxn = max(maxn, sn[S]) ans = sorted(s for s, n in sn.items() if n == maxn) for s in ans: print(s, end="")
N = int(eval(input())) x = {} for _ in range(N): s = eval(input()) if s in x: x[s] += 1 else: x[s] = 1 maxcount = max(x.values()) ans = [] for s, count in list(x.items()): if count == maxcount: ans.append(s) ans.sort() for a in ans: print(a)
15
17
307
284
import sys readline = sys.stdin.readline N = int(readline()) sn = {} maxn = 0 for _ in range(N): S = readline() if S in sn: sn[S] += 1 else: sn[S] = 0 maxn = max(maxn, sn[S]) ans = sorted(s for s, n in sn.items() if n == maxn) for s in ans: print(s, end="")
N = int(eval(input())) x = {} for _ in range(N): s = eval(input()) if s in x: x[s] += 1 else: x[s] = 1 maxcount = max(x.values()) ans = [] for s, count in list(x.items()): if count == maxcount: ans.append(s) ans.sort() for a in ans: print(a)
false
11.764706
[ "-import sys", "-", "-readline = sys.stdin.readline", "-N = int(readline())", "-sn = {}", "-maxn = 0", "+N = int(eval(input()))", "+x = {}", "- S = readline()", "- if S in sn:", "- sn[S] += 1", "+ s = eval(input())", "+ if s in x:", "+ x[s] += 1", "- sn[S...
false
0.037308
0.039852
0.93616
[ "s424096936", "s865372085" ]
u800058906
p02917
python
s528533671
s816305692
30
26
9,196
9,056
Accepted
Accepted
13.33
n=int(eval(input())) b=list(map(int,input().split())) b.reverse() a=[0]*n for i in range(1,n-1): a[i]=min(b[i],b[i-1]) a[0]=b[0] a[n-1]=b[n-2] print((sum(a)))
n=int(eval(input())) b=list(map(int,input().split())) c=0 c+=b[0]+b[-1] for i in range(n-2): c+=min(b[i],b[i+1]) print(c)
13
11
168
134
n = int(eval(input())) b = list(map(int, input().split())) b.reverse() a = [0] * n for i in range(1, n - 1): a[i] = min(b[i], b[i - 1]) a[0] = b[0] a[n - 1] = b[n - 2] print((sum(a)))
n = int(eval(input())) b = list(map(int, input().split())) c = 0 c += b[0] + b[-1] for i in range(n - 2): c += min(b[i], b[i + 1]) print(c)
false
15.384615
[ "-b.reverse()", "-a = [0] * n", "-for i in range(1, n - 1):", "- a[i] = min(b[i], b[i - 1])", "-a[0] = b[0]", "-a[n - 1] = b[n - 2]", "-print((sum(a)))", "+c = 0", "+c += b[0] + b[-1]", "+for i in range(n - 2):", "+ c += min(b[i], b[i + 1])", "+print(c)" ]
false
0.045303
0.047051
0.962857
[ "s528533671", "s816305692" ]
u242757684
p02576
python
s183288840
s195954335
85
67
61,396
61,804
Accepted
Accepted
21.18
N,X,T = list(map(int,input().split())) print((((N + X - 1) // X) * T))
n,x,t = list(map(int,input().split())) print((-t * (-n // x)))
3
2
65
55
N, X, T = list(map(int, input().split())) print((((N + X - 1) // X) * T))
n, x, t = list(map(int, input().split())) print((-t * (-n // x)))
false
33.333333
[ "-N, X, T = list(map(int, input().split()))", "-print((((N + X - 1) // X) * T))", "+n, x, t = list(map(int, input().split()))", "+print((-t * (-n // x)))" ]
false
0.045637
0.044055
1.035902
[ "s183288840", "s195954335" ]
u227082700
p02837
python
s926612000
s048278094
569
422
42,860
43,484
Accepted
Accepted
25.83
n=int(eval(input())) a=[] for i in range(n): m=int(eval(input())) a.append([]) for i in range(m): a[-1].append(list(map(int,input().split()))) ans=0 for i in range(2**n): s=bin(i)[2:].zfill(n) f=True for j,k in enumerate(a): for x,y in k: if s[x-1]!=str(y) and s[j]=="1":f=False ...
n=int(eval(input())) xy=[[]for _ in range(n)] for i in range(n): for j in range(int(eval(input()))): xy[i].append(list(map(int,input().split()))) ans=0 for i in range(1,1<<n): syojiki=[(i&(1<<j)!=0)+0 for j in range(n)] flag=True for j in range(n): for x,y in xy[j]: if syojiki[x-1]!=y a...
16
15
351
394
n = int(eval(input())) a = [] for i in range(n): m = int(eval(input())) a.append([]) for i in range(m): a[-1].append(list(map(int, input().split()))) ans = 0 for i in range(2**n): s = bin(i)[2:].zfill(n) f = True for j, k in enumerate(a): for x, y in k: if s[x - 1] !=...
n = int(eval(input())) xy = [[] for _ in range(n)] for i in range(n): for j in range(int(eval(input()))): xy[i].append(list(map(int, input().split()))) ans = 0 for i in range(1, 1 << n): syojiki = [(i & (1 << j) != 0) + 0 for j in range(n)] flag = True for j in range(n): for x, y in xy[j...
false
6.25
[ "-a = []", "+xy = [[] for _ in range(n)]", "- m = int(eval(input()))", "- a.append([])", "- for i in range(m):", "- a[-1].append(list(map(int, input().split())))", "+ for j in range(int(eval(input()))):", "+ xy[i].append(list(map(int, input().split())))", "-for i in range(2...
false
0.109573
0.045423
2.412308
[ "s926612000", "s048278094" ]
u535803878
p03283
python
s419082042
s100704103
2,552
2,188
23,724
25,764
Accepted
Accepted
14.26
import numpy as np n, m, q = [int(item) for item in input().split(" ")] # n, m, q = [int(item) for item in lines[0].split(" ")] end = np.zeros((m,2),dtype=int) query = np.zeros((q,2),dtype=int) for i in range(m): end[i] = [int(item) for item in input().split(" ")] # end[i] = [int(item) for item in line...
import numpy as np n, m, q = [int(item) for item in input().split(" ")] # n, m, q = [int(item) for item in lines[0].split(" ")] end = np.zeros((m,2),dtype=int) query = np.zeros((q,2),dtype=int) for i in range(m): end[i] = [int(item) for item in input().split(" ")] # end[i] = [int(item) for item in line...
21
25
733
821
import numpy as np n, m, q = [int(item) for item in input().split(" ")] # n, m, q = [int(item) for item in lines[0].split(" ")] end = np.zeros((m, 2), dtype=int) query = np.zeros((q, 2), dtype=int) for i in range(m): end[i] = [int(item) for item in input().split(" ")] # end[i] = [int(item) for item in lines[1+...
import numpy as np n, m, q = [int(item) for item in input().split(" ")] # n, m, q = [int(item) for item in lines[0].split(" ")] end = np.zeros((m, 2), dtype=int) query = np.zeros((q, 2), dtype=int) for i in range(m): end[i] = [int(item) for item in input().split(" ")] # end[i] = [int(item) for item in lines[1+...
false
16
[ "-for item in query:", "- print((c[item[0] - 1, item[1] - 1]))", "- # print(np.sum(a[(item[0]-1):, :item[1]]))", "+result = c[query[:, 0] - 1, query[:, 1] - 1]", "+for i in range(q):", "+ print((result[i]))", "+# for item in query:", "+# print(c[item[0]-1, item[1]-1])", "+# print(np.sum...
false
0.369563
0.92401
0.399956
[ "s419082042", "s100704103" ]
u678167152
p03745
python
s432915163
s443343811
77
64
14,252
19,992
Accepted
Accepted
16.88
N = int(eval(input())) A = list(map(int, input().split())) def solve(N,A): ans = 1 lis = [A[0]] for i in range(1,N): if len(lis)==1 or diff==0: diff = A[i]-A[i-1] elif (A[i]-A[i-1])*diff<0: ans += 1 lis = [] lis.append(A[i]) return ...
def check(a,b): if a<b: return 'up' if a>b: return 'down' return '' def solve(): ans = 1 N = int(eval(input())) A = list(map(int, input().split())) ud = '' for i in range(N-1): a = check(A[i],A[i+1]) if ud=='' or ud==a: ud = a continue if a=='': c...
14
23
336
378
N = int(eval(input())) A = list(map(int, input().split())) def solve(N, A): ans = 1 lis = [A[0]] for i in range(1, N): if len(lis) == 1 or diff == 0: diff = A[i] - A[i - 1] elif (A[i] - A[i - 1]) * diff < 0: ans += 1 lis = [] lis.append(A[i]) ...
def check(a, b): if a < b: return "up" if a > b: return "down" return "" def solve(): ans = 1 N = int(eval(input())) A = list(map(int, input().split())) ud = "" for i in range(N - 1): a = check(A[i], A[i + 1]) if ud == "" or ud == a: ud = a ...
false
39.130435
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "+def check(a, b):", "+ if a < b:", "+ return \"up\"", "+ if a > b:", "+ return \"down\"", "+ return \"\"", "-def solve(N, A):", "+def solve():", "- lis = [A[0]]", "- for i in range(1, N):", "- ...
false
0.101753
0.16722
0.608498
[ "s432915163", "s443343811" ]
u197968862
p02583
python
s118334962
s794009777
996
222
30,864
31,012
Accepted
Accepted
77.71
n = int(eval(input())) l = list(map(int,input().split())) nums = set([]) for i in range(n): for j in range(n): for k in range(n): if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]: continue else: ver = [l[i],l[j],l[k]] num = [...
n = int(eval(input())) l = list(map(int,input().split())) nums = set([]) for i in range(n): for j in range(i,n): for k in range(j,n): if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]: continue else: ver = [l[i],l[j],l[k]] num...
18
18
484
489
n = int(eval(input())) l = list(map(int, input().split())) nums = set([]) for i in range(n): for j in range(n): for k in range(n): if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]: continue else: ver = [l[i], l[j], l[k]] num = [i, j, k] ...
n = int(eval(input())) l = list(map(int, input().split())) nums = set([]) for i in range(n): for j in range(i, n): for k in range(j, n): if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]: continue else: ver = [l[i], l[j], l[k]] num = [i, ...
false
0
[ "- for j in range(n):", "- for k in range(n):", "+ for j in range(i, n):", "+ for k in range(j, n):" ]
false
0.053855
0.059124
0.910882
[ "s118334962", "s794009777" ]
u987143553
p03435
python
s668871471
s875296514
1,428
682
3,064
3,064
Accepted
Accepted
52.24
def main(): c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) r1max = max([c11, c12, c13]) r2max = max([c21, c22, c23]) r3max = max([c31, c32, c33]) c1max = max([c11, c21, c31]) c2max ...
def main(): c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) r1max = max([c11, c12, c13]) r2max = max([c21, c22, c23]) r3max = max([c31, c32, c33]) c1max = max([c11, c21, c31]) c2max ...
39
30
1,483
1,132
def main(): c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) r1max = max([c11, c12, c13]) r2max = max([c21, c22, c23]) r3max = max([c31, c32, c33]) c1max = max([c11, c21, c31]) c2max = max([c12...
def main(): c11, c12, c13 = list(map(int, input().split())) c21, c22, c23 = list(map(int, input().split())) c31, c32, c33 = list(map(int, input().split())) r1max = max([c11, c12, c13]) r2max = max([c21, c22, c23]) r3max = max([c31, c32, c33]) c1max = max([c11, c21, c31]) c2max = max([c12...
false
23.076923
[ "- C11 = a1 + b1", "- C21 = a2 + b1", "- C31 = a3 + b1", "- if C11 == c11 and C21 == c21 and C31 == c31:", "+ if a1 + b1 == c11 and a2 + b1 == c21 and a3 + b1 == c31:", "- C12 = a1 + b...
false
0.042706
0.038365
1.113153
[ "s668871471", "s875296514" ]
u877428733
p02887
python
s405085230
s961406457
57
50
4,084
4,084
Accepted
Accepted
12.28
N = int(eval(input())) S = list(eval(input())) ans = 1 for i in range(N): if i == N - 1: print(ans) elif S[i] == S[i + 1]: i += 1 continue else: ans += 1 i += 1
N = int(eval(input())) S = list(eval(input())) ans = 1 for i in range(N): if i == N - 1: print(ans) elif S[i] == S[i + 1]: continue else: ans += 1
13
11
213
181
N = int(eval(input())) S = list(eval(input())) ans = 1 for i in range(N): if i == N - 1: print(ans) elif S[i] == S[i + 1]: i += 1 continue else: ans += 1 i += 1
N = int(eval(input())) S = list(eval(input())) ans = 1 for i in range(N): if i == N - 1: print(ans) elif S[i] == S[i + 1]: continue else: ans += 1
false
15.384615
[ "- i += 1", "- i += 1" ]
false
0.078869
0.041597
1.896018
[ "s405085230", "s961406457" ]
u270681687
p03816
python
s644853457
s768449727
117
99
14,276
14,396
Accepted
Accepted
15.38
n = int(eval(input())) a = list(map(int, input().split())) l = [] a.sort() i = 0 num = 1 while i < len(a) - 1: if a[i+1] == a[i]: num += 1 i += 1 else: l.append(num) num = 1 i += 1 l.append(num) count = 0 for i in range(len(l)): if l[i] % 2 == 1...
n = int(eval(input())) a = list(map(int, input().split())) l = [] a.sort() num = 1 for i in range(len(a)-1): if a[i+1] == a[i]: num += 1 else: l.append(num) num = 1 l.append(num) count = 0 for i in range(len(l)): if l[i] % 2 == 1: l[i] = 1 else: ...
30
27
453
418
n = int(eval(input())) a = list(map(int, input().split())) l = [] a.sort() i = 0 num = 1 while i < len(a) - 1: if a[i + 1] == a[i]: num += 1 i += 1 else: l.append(num) num = 1 i += 1 l.append(num) count = 0 for i in range(len(l)): if l[i] % 2 == 1: l[i] = 1 ...
n = int(eval(input())) a = list(map(int, input().split())) l = [] a.sort() num = 1 for i in range(len(a) - 1): if a[i + 1] == a[i]: num += 1 else: l.append(num) num = 1 l.append(num) count = 0 for i in range(len(l)): if l[i] % 2 == 1: l[i] = 1 else: count += 1 ...
false
10
[ "-i = 0", "-while i < len(a) - 1:", "+for i in range(len(a) - 1):", "- i += 1", "- i += 1" ]
false
0.084914
0.073505
1.155215
[ "s644853457", "s768449727" ]
u275934251
p03478
python
s306618150
s814913427
45
28
3,060
2,940
Accepted
Accepted
37.78
ans=0 n,a,b=list(map(int,input().split())) for i in range(1,n+1): s=list(str(i)) s1=list(map(int, list(s))) tmp=sum(s1) if a<=tmp<=b: ans+=int("".join(s)) print(ans)
n,a,b=list(map(int,input().split())) print((sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b)))
9
2
191
95
ans = 0 n, a, b = list(map(int, input().split())) for i in range(1, n + 1): s = list(str(i)) s1 = list(map(int, list(s))) tmp = sum(s1) if a <= tmp <= b: ans += int("".join(s)) print(ans)
n, a, b = list(map(int, input().split())) print((sum(i for i in range(n + 1) if a <= sum(map(int, str(i))) <= b)))
false
77.777778
[ "-ans = 0", "-for i in range(1, n + 1):", "- s = list(str(i))", "- s1 = list(map(int, list(s)))", "- tmp = sum(s1)", "- if a <= tmp <= b:", "- ans += int(\"\".join(s))", "-print(ans)", "+print((sum(i for i in range(n + 1) if a <= sum(map(int, str(i))) <= b)))" ]
false
0.040065
0.040069
0.99988
[ "s306618150", "s814913427" ]
u968166680
p02901
python
s848620218
s600303208
163
108
94,200
73,624
Accepted
Accepted
33.74
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, M = list(map(int, readline().split())) A = [0] * M C = [0] * M for i in range(M): A[i], b = list(map(int, ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, M = list(map(int, readline().split())) A = [0] * M C = [0] * M for i in range(M): A[i], b = list(map(int, ...
37
37
874
782
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): N, M = list(map(int, readline().split())) A = [0] * M C = [0] * M for i in range(M): A[i], b = list(map(int, readline().split(...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): N, M = list(map(int, readline().split())) A = [0] * M C = [0] * M for i in range(M): A[i], b = list(map(int, readline().split(...
false
0
[ "- dp = [[INF] * (1 << N) for _ in range(M + 1)]", "- dp[0][0] = 0", "- for i in range(M):", "- for j in range(1 << N):", "- if dp[i + 1][j] > dp[i][j]:", "- dp[i + 1][j] = dp[i][j]", "- if dp[i + 1][j | C[i]] > dp[i][j] + A[i]:", "- ...
false
0.036776
0.047053
0.781574
[ "s848620218", "s600303208" ]
u760569096
p03295
python
s772170597
s362665380
515
418
222,220
219,888
Accepted
Accepted
18.83
n,m = list(map(int, input().split())) t = [[n] for i in range(n)] for i in range(m): a,b = list(map(int, input().split())) t[a-1].append(b-1) g = [] for i in t: g.append(sorted(i)) k = 0 ans=0 while k <=n-1: e = n for i in g[k:]: e = min(e,i[0]) if e==n: break ans+=1 k = e prin...
n,m = list(map(int, input().split())) t = [[n] for i in range(n)] for i in range(m): a,b = list(map(int, input().split())) t[a-1].append(b-1) g = [] for i in t: g.append(min(i)) k = 0 ans=0 while k <=n-1: e = min(g[k:]) if e==n: break ans+=1 k = e print(ans)
19
17
314
280
n, m = list(map(int, input().split())) t = [[n] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) t[a - 1].append(b - 1) g = [] for i in t: g.append(sorted(i)) k = 0 ans = 0 while k <= n - 1: e = n for i in g[k:]: e = min(e, i[0]) if e == n: break a...
n, m = list(map(int, input().split())) t = [[n] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) t[a - 1].append(b - 1) g = [] for i in t: g.append(min(i)) k = 0 ans = 0 while k <= n - 1: e = min(g[k:]) if e == n: break ans += 1 k = e print(ans)
false
10.526316
[ "- g.append(sorted(i))", "+ g.append(min(i))", "- e = n", "- for i in g[k:]:", "- e = min(e, i[0])", "+ e = min(g[k:])" ]
false
0.035094
0.043648
0.804026
[ "s772170597", "s362665380" ]
u439396449
p03546
python
s787701181
s770554282
49
39
3,572
3,316
Accepted
Accepted
20.41
from collections import defaultdict from itertools import product H, W = list(map(int, input().split())) c = [[int(x) for x in input().split()] for _ in range(10)] A = defaultdict(int) for _ in range(H): for x in input().split(): x = int(x) if x != -1 and x != 1: A[x] += 1 ...
from collections import defaultdict from itertools import product H, W = list(map(int, input().split())) c = [[int(x) for x in input().split()] for _ in range(10)] A = defaultdict(int) for _ in range(H): for x in input().split(): x = int(x) if x != -1 and x != 1: A[x] += 1 ...
21
19
546
488
from collections import defaultdict from itertools import product H, W = list(map(int, input().split())) c = [[int(x) for x in input().split()] for _ in range(10)] A = defaultdict(int) for _ in range(H): for x in input().split(): x = int(x) if x != -1 and x != 1: A[x] += 1 for _, i, j, ...
from collections import defaultdict from itertools import product H, W = list(map(int, input().split())) c = [[int(x) for x in input().split()] for _ in range(10)] A = defaultdict(int) for _ in range(H): for x in input().split(): x = int(x) if x != -1 and x != 1: A[x] += 1 for k, i, j i...
false
9.52381
[ "-for _, i, j, k in product(", "- list(range(10)), list(range(10)), list(range(10)), list(range(10))", "-):", "- if i == 1 or k == 1:", "- continue", "+for k, i, j in product(list(range(10)), list(range(10)), list(range(10))):" ]
false
0.051361
0.042825
1.199321
[ "s787701181", "s770554282" ]