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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u106971015 | p02768 | python | s479452625 | s028664288 | 832 | 141 | 11,052 | 3,064 | Accepted | Accepted | 83.05 | n,a,b = list(map(int,input().split()))
mod = 10 ** 9 + 7
k = max(a,b)
com = [1]
for i in range(1,k+1):
com.append((com[i-1]*(n-i+1)*pow(i,mod-2,mod))%mod)
print(((pow(2,n,mod)-1-com[a]-com[b])%mod)) | n,a,b = list(map(int,input().split()))
mod = 10 ** 9 + 7
def nCr(n,r):
if r*2>n:
return nCr(n,n-r)
else:
a = b = 1
for i in range(r):
a = a * (n - i) % mod
b = b * (r - i) % mod
return (a * pow(b,mod-2,mod)) % mod
ans = pow(2,n,mod) - 1 - nC... | 10 | 15 | 206 | 347 | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
k = max(a, b)
com = [1]
for i in range(1, k + 1):
com.append((com[i - 1] * (n - i + 1) * pow(i, mod - 2, mod)) % mod)
print(((pow(2, n, mod) - 1 - com[a] - com[b]) % mod))
| n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
def nCr(n, r):
if r * 2 > n:
return nCr(n, n - r)
else:
a = b = 1
for i in range(r):
a = a * (n - i) % mod
b = b * (r - i) % mod
return (a * pow(b, mod - 2, mod)) % mod
ans = pow(2, n, mod) - 1 ... | false | 33.333333 | [
"-k = max(a, b)",
"-com = [1]",
"-for i in range(1, k + 1):",
"- com.append((com[i - 1] * (n - i + 1) * pow(i, mod - 2, mod)) % mod)",
"-print(((pow(2, n, mod) - 1 - com[a] - com[b]) % mod))",
"+",
"+",
"+def nCr(n, r):",
"+ if r * 2 > n:",
"+ return nCr(n, n - r)",
"+ else:",
... | false | 1.021985 | 0.192626 | 5.305536 | [
"s479452625",
"s028664288"
] |
u681444474 | p03958 | python | s016395646 | s008082257 | 88 | 28 | 68,768 | 8,992 | Accepted | Accepted | 68.18 | # coding: utf-8
import math
from collections import deque
import copy
import bisect
k, n = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort()
m=max(A)
s=k-m
print((max(m-1-s, 0))) | # coding: utf-8
k, t = list(map(int,input().split()))
A=list(map(int,input().split()))
m=max(A)
s=k-m
print((max(m-1-s, 0))) | 11 | 6 | 205 | 121 | # coding: utf-8
import math
from collections import deque
import copy
import bisect
k, n = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
m = max(A)
s = k - m
print((max(m - 1 - s, 0)))
| # coding: utf-8
k, t = list(map(int, input().split()))
A = list(map(int, input().split()))
m = max(A)
s = k - m
print((max(m - 1 - s, 0)))
| false | 45.454545 | [
"-import math",
"-from collections import deque",
"-import copy",
"-import bisect",
"-",
"-k, n = list(map(int, input().split()))",
"+k, t = list(map(int, input().split()))",
"-A.sort()"
] | false | 0.044761 | 0.038053 | 1.176261 | [
"s016395646",
"s008082257"
] |
u466143662 | p03049 | python | s605800717 | s799329305 | 53 | 39 | 3,064 | 3,064 | Accepted | Accepted | 26.42 | N=int(eval(input()))
lasta=0
headb=0
spec=0
cnt=0
for _ in range(N):
s=str(eval(input()))
for i in range(len(s)-1):
if s[i:i+2]=="AB":
cnt+=1
if s[0]=="B" and s[-1]=="A":
spec+=1
elif s[-1]=="A":
lasta+=1
elif s[0]=="B":
headb+=1
... | N=int(eval(input()))
lasta=0
headb=0
spec=0
cnt=0
for _ in range(N):
s=str(eval(input()))
cnt+=s.count("AB")
if s[0]=="B" and s[-1]=="A":
spec+=1
elif s[-1]=="A":
lasta+=1
elif s[0]=="B":
headb+=1
if abs(headb-lasta)>=spec:
print((min(headb,lasta)... | 25 | 23 | 557 | 502 | N = int(eval(input()))
lasta = 0
headb = 0
spec = 0
cnt = 0
for _ in range(N):
s = str(eval(input()))
for i in range(len(s) - 1):
if s[i : i + 2] == "AB":
cnt += 1
if s[0] == "B" and s[-1] == "A":
spec += 1
elif s[-1] == "A":
lasta += 1
elif s[0] == "B":
h... | N = int(eval(input()))
lasta = 0
headb = 0
spec = 0
cnt = 0
for _ in range(N):
s = str(eval(input()))
cnt += s.count("AB")
if s[0] == "B" and s[-1] == "A":
spec += 1
elif s[-1] == "A":
lasta += 1
elif s[0] == "B":
headb += 1
if abs(headb - lasta) >= spec:
print((min(headb... | false | 8 | [
"- for i in range(len(s) - 1):",
"- if s[i : i + 2] == \"AB\":",
"- cnt += 1",
"+ cnt += s.count(\"AB\")"
] | false | 0.036731 | 0.075319 | 0.487665 | [
"s605800717",
"s799329305"
] |
u977389981 | p03036 | python | s587124997 | s686233758 | 170 | 18 | 38,384 | 2,940 | Accepted | Accepted | 89.41 | r, d, x = list(map(int, input().split()))
tmp = x
for i in range(10):
ans = r * tmp - d
print(ans)
tmp = ans | r, D, x = list(map(int, input().split()))
for i in range(10):
ans = r * x - D
print(ans)
x = ans | 7 | 6 | 121 | 108 | r, d, x = list(map(int, input().split()))
tmp = x
for i in range(10):
ans = r * tmp - d
print(ans)
tmp = ans
| r, D, x = list(map(int, input().split()))
for i in range(10):
ans = r * x - D
print(ans)
x = ans
| false | 14.285714 | [
"-r, d, x = list(map(int, input().split()))",
"-tmp = x",
"+r, D, x = list(map(int, input().split()))",
"- ans = r * tmp - d",
"+ ans = r * x - D",
"- tmp = ans",
"+ x = ans"
] | false | 0.037518 | 0.036867 | 1.017656 | [
"s587124997",
"s686233758"
] |
u832039789 | p03076 | python | s307837629 | s763503565 | 36 | 17 | 5,072 | 3,060 | Accepted | Accepted | 52.78 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
l = [i for i in range(5)]
p = [int(eval(input())) for _ in range(5)]
res = 10**100
... | lst = []
for i in range(5):
n = int(eval(input()))
lst.append([(n - 1) % 10, n])
lst = sorted(lst)
res = 0
for i in range(5):
if i == 0:
res += lst[i][1]
else:
res += (lst[i][1] + 9) // 10 * 10
print(res)
| 22 | 13 | 543 | 228 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
l = [i for i in range(5)]
p = [int(eval(input())) for _ in range(5)]
res = 10**100
for ll in pe... | lst = []
for i in range(5):
n = int(eval(input()))
lst.append([(n - 1) % 10, n])
lst = sorted(lst)
res = 0
for i in range(5):
if i == 0:
res += lst[i][1]
else:
res += (lst[i][1] + 9) // 10 * 10
print(res)
| false | 40.909091 | [
"-import sys",
"-from fractions import gcd",
"-from itertools import groupby as gb",
"-from itertools import permutations as perm",
"-from collections import Counter as C",
"-from collections import defaultdict as dd",
"-",
"-sys.setrecursionlimit(10**5)",
"-l = [i for i in range(5)]",
"-p = [int(... | false | 0.059871 | 0.06331 | 0.945679 | [
"s307837629",
"s763503565"
] |
u525065967 | p02684 | python | s983161287 | s384410804 | 193 | 169 | 32,372 | 32,372 | Accepted | Accepted | 12.44 | N,K = list(map(int, input().split()))
A = [*[int(x)-1 for x in input().split()]]
pre = 0
index = [-1]*N
path_cnt = 0
for i in range(N):
if index[pre] >= 0:
break
else:
index[pre] = i
path_cnt += 1
pre = A[pre]
loops = path_cnt - index[pre]
one = path_cnt - loops
k =... | N,K = list(map(int, input().split()))
A = [*[int(x)-1 for x in input().split()]]
index = [-1]*N
pre, path_cnt = 0, 0
for i in range(N):
if index[pre] >= 0: break
else:
index[pre] = i
path_cnt += 1
pre = A[pre]
loops = path_cnt - index[pre]
one = index[pre]
k = max(0, K-one) %... | 21 | 19 | 415 | 399 | N, K = list(map(int, input().split()))
A = [*[int(x) - 1 for x in input().split()]]
pre = 0
index = [-1] * N
path_cnt = 0
for i in range(N):
if index[pre] >= 0:
break
else:
index[pre] = i
path_cnt += 1
pre = A[pre]
loops = path_cnt - index[pre]
one = path_cnt - loops
k = max(0, K - o... | N, K = list(map(int, input().split()))
A = [*[int(x) - 1 for x in input().split()]]
index = [-1] * N
pre, path_cnt = 0, 0
for i in range(N):
if index[pre] >= 0:
break
else:
index[pre] = i
path_cnt += 1
pre = A[pre]
loops = path_cnt - index[pre]
one = index[pre]
k = max(0, K - one) % ... | false | 9.52381 | [
"-pre = 0",
"-path_cnt = 0",
"+pre, path_cnt = 0, 0",
"-one = path_cnt - loops",
"+one = index[pre]"
] | false | 0.045663 | 0.046419 | 0.98371 | [
"s983161287",
"s384410804"
] |
u074220993 | p03475 | python | s883508612 | s341320948 | 568 | 69 | 27,412 | 9,220 | Accepted | Accepted | 87.85 | N = int(eval(input()))
C, S, F = [], [], []
for _ in range(N-1):
c, s, f = list(map(int, input().split()))
C.append(c)
S.append(s)
F.append(f)
S.append(0)
import numpy as np
def theta(x): #ヘヴィサイドの段差関数
return x if x > 0 else 0
def DptTimeAtNextSt(i, T): #時刻Tに駅iを出発した時、駅i+1を出発する時間
g... |
def main():
with open(0) as f:
N = int(f.readline())
train = [tuple(map(int, line.split())) for line in f.readlines()]
ans = []
for start in range(N-1):
arrive = 0
for station in range(start, N-1):
c, s, f = train[station]
#出発時間:区間[arr... | 27 | 19 | 625 | 542 | N = int(eval(input()))
C, S, F = [], [], []
for _ in range(N - 1):
c, s, f = list(map(int, input().split()))
C.append(c)
S.append(s)
F.append(f)
S.append(0)
import numpy as np
def theta(x): # ヘヴィサイドの段差関数
return x if x > 0 else 0
def DptTimeAtNextSt(i, T): # 時刻Tに駅iを出発した時、駅i+1を出発する時間
global ... | def main():
with open(0) as f:
N = int(f.readline())
train = [tuple(map(int, line.split())) for line in f.readlines()]
ans = []
for start in range(N - 1):
arrive = 0
for station in range(start, N - 1):
c, s, f = train[station]
# 出発時間:区間[arrive,)の下限
... | false | 29.62963 | [
"-N = int(eval(input()))",
"-C, S, F = [], [], []",
"-for _ in range(N - 1):",
"- c, s, f = list(map(int, input().split()))",
"- C.append(c)",
"- S.append(s)",
"- F.append(f)",
"-S.append(0)",
"-import numpy as np",
"+def main():",
"+ with open(0) as f:",
"+ N = int(f.rea... | false | 0.190679 | 0.035875 | 5.315111 | [
"s883508612",
"s341320948"
] |
u894258749 | p03078 | python | s655060090 | s807611096 | 411 | 63 | 5,088 | 5,280 | Accepted | Accepted | 84.67 | from collections import defaultdict
inpl = lambda: list(map(int,input().split()))
X, Y, Z, K = inpl()
A = [ sorted(inpl(), key=lambda x: -x) for _ in range(3) ]
N = [X, Y, Z]
mem = defaultdict(int)
ans = sum([A[i][0] for i in range(3)])
mem[(0,0,0)] = 1
cand = [(ans,0,0,0)]
for i in range(K):
cand.s... | from collections import defaultdict
import heapq
inpl = lambda: list(map(int,input().split()))
X, Y, Z, K = inpl()
A = [ sorted(inpl(), reverse=True) for _ in range(3) ]
N = [X, Y, Z]
mem = defaultdict(int)
score = sum([A[i][0] for i in range(3)])
mem[(0,0,0)] = 1
candidates = []
heapq.heappush(candidates... | 26 | 27 | 677 | 732 | from collections import defaultdict
inpl = lambda: list(map(int, input().split()))
X, Y, Z, K = inpl()
A = [sorted(inpl(), key=lambda x: -x) for _ in range(3)]
N = [X, Y, Z]
mem = defaultdict(int)
ans = sum([A[i][0] for i in range(3)])
mem[(0, 0, 0)] = 1
cand = [(ans, 0, 0, 0)]
for i in range(K):
cand.sort()
c... | from collections import defaultdict
import heapq
inpl = lambda: list(map(int, input().split()))
X, Y, Z, K = inpl()
A = [sorted(inpl(), reverse=True) for _ in range(3)]
N = [X, Y, Z]
mem = defaultdict(int)
score = sum([A[i][0] for i in range(3)])
mem[(0, 0, 0)] = 1
candidates = []
heapq.heappush(candidates, (-score, (... | false | 3.703704 | [
"+import heapq",
"-A = [sorted(inpl(), key=lambda x: -x) for _ in range(3)]",
"+A = [sorted(inpl(), reverse=True) for _ in range(3)]",
"-ans = sum([A[i][0] for i in range(3)])",
"+score = sum([A[i][0] for i in range(3)])",
"-cand = [(ans, 0, 0, 0)]",
"+candidates = []",
"+heapq.heappush(candidates, (-... | false | 0.085833 | 0.040032 | 2.144117 | [
"s655060090",
"s807611096"
] |
u821588465 | p02898 | python | s837011294 | s075184973 | 143 | 61 | 37,288 | 18,576 | Accepted | Accepted | 57.34 | import numpy as np
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
H = np.array(H)
print((np.count_nonzero(H >= K)))
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
cnt = 0
for h in H:
if h >= K:
cnt += 1
print(cnt)
| 9 | 8 | 149 | 140 | import numpy as np
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
H = np.array(H)
print((np.count_nonzero(H >= K)))
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
cnt = 0
for h in H:
if h >= K:
cnt += 1
print(cnt)
| false | 11.111111 | [
"-import numpy as np",
"-",
"-H = np.array(H)",
"-print((np.count_nonzero(H >= K)))",
"+cnt = 0",
"+for h in H:",
"+ if h >= K:",
"+ cnt += 1",
"+print(cnt)"
] | false | 0.20661 | 0.036457 | 5.667266 | [
"s837011294",
"s075184973"
] |
u573754721 | p02837 | python | s418799791 | s197432218 | 400 | 273 | 3,064 | 46,828 | Accepted | Accepted | 31.75 | n=int(eval(input()))
a=[]
b=[]
for i in range(n):
aa=int(eval(input()))
a.append(aa)
d=[]
for j in range(aa):
x,y=list(map(int,input().split()))
d.append((x,y))
b.append(d)
cc=0
for i in range(2**n):
L=[0]*n
for j in range(n):
... | n=int(eval(input()))
A=[]
B=[]
for i in range(n):
a=int(eval(input()))
A.append(a)
d=[]
for j in range(a):
x,y=list(map(int,input().split()))
d.append((x,y))
B.append(d)
ans=0
for i in range(2**n):
L=[0]*n
for j in range(n):
if i>>j&1:
L[j]=1
if 1 in L... | 29 | 28 | 719 | 564 | n = int(eval(input()))
a = []
b = []
for i in range(n):
aa = int(eval(input()))
a.append(aa)
d = []
for j in range(aa):
x, y = list(map(int, input().split()))
d.append((x, y))
b.append(d)
cc = 0
for i in range(2**n):
L = [0] * n
for j in range(n):
if (i >> j) & 1:
... | n = int(eval(input()))
A = []
B = []
for i in range(n):
a = int(eval(input()))
A.append(a)
d = []
for j in range(a):
x, y = list(map(int, input().split()))
d.append((x, y))
B.append(d)
ans = 0
for i in range(2**n):
L = [0] * n
for j in range(n):
if i >> j & 1:
... | false | 3.448276 | [
"-a = []",
"-b = []",
"+A = []",
"+B = []",
"- aa = int(eval(input()))",
"- a.append(aa)",
"+ a = int(eval(input()))",
"+ A.append(a)",
"- for j in range(aa):",
"+ for j in range(a):",
"- b.append(d)",
"-cc = 0",
"+ B.append(d)",
"+ans = 0",
"- if (i >> j) ... | false | 0.045713 | 0.038918 | 1.174595 | [
"s418799791",
"s197432218"
] |
u952164537 | p02887 | python | s587390623 | s533363801 | 1,539 | 72 | 4,664 | 5,416 | Accepted | Accepted | 95.32 | length = int(eval(input()))
li = list(eval(input()))
i = 0
for n in li[:]:
if i + 1 == len(li):
print((len(li)))
break
if li[i] == li[i + 1]:
del (li[i + 1])
else:
i = 1 + i
continue | length = int(eval(input()))
li = list(eval(input()))
li2 = []
i = -1
for str in li[:]:
i = 1 + i
if i + 1 == len(li):
li2.append(li[i])
print((len(li2)))
break
if li[i] != li[i + 1]:
li2.append(li[i])
continue | 12 | 13 | 230 | 259 | length = int(eval(input()))
li = list(eval(input()))
i = 0
for n in li[:]:
if i + 1 == len(li):
print((len(li)))
break
if li[i] == li[i + 1]:
del li[i + 1]
else:
i = 1 + i
continue
| length = int(eval(input()))
li = list(eval(input()))
li2 = []
i = -1
for str in li[:]:
i = 1 + i
if i + 1 == len(li):
li2.append(li[i])
print((len(li2)))
break
if li[i] != li[i + 1]:
li2.append(li[i])
continue
| false | 7.692308 | [
"-i = 0",
"-for n in li[:]:",
"+li2 = []",
"+i = -1",
"+for str in li[:]:",
"+ i = 1 + i",
"- print((len(li)))",
"+ li2.append(li[i])",
"+ print((len(li2)))",
"- if li[i] == li[i + 1]:",
"- del li[i + 1]",
"- else:",
"- i = 1 + i",
"+ if li[i]... | false | 0.093083 | 0.036714 | 2.535392 | [
"s587390623",
"s533363801"
] |
u801359367 | p03478 | python | s923250543 | s175402177 | 37 | 30 | 3,060 | 3,060 | Accepted | Accepted | 18.92 | N,a,b = list(map(int,input().split()))
Sum_0 = 0
for i in range(N+1):
i = str(i)
Sum_1 = 0
for t in i:
Sum_1 += int(t)
if a <= Sum_1 <=b:
Sum_0+=int(i)
print (Sum_0) | N,a,b = list(map(int,input().split()))
Sum_0 = 0
for i in range(1,N+1):
Sum_1 = 0
t = i
while t != 0:
Sum_1+=t%10
t = t//10
if a <= Sum_1 <= b:
Sum_0+=i
print(Sum_0) | 11 | 13 | 208 | 227 | N, a, b = list(map(int, input().split()))
Sum_0 = 0
for i in range(N + 1):
i = str(i)
Sum_1 = 0
for t in i:
Sum_1 += int(t)
if a <= Sum_1 <= b:
Sum_0 += int(i)
print(Sum_0)
| N, a, b = list(map(int, input().split()))
Sum_0 = 0
for i in range(1, N + 1):
Sum_1 = 0
t = i
while t != 0:
Sum_1 += t % 10
t = t // 10
if a <= Sum_1 <= b:
Sum_0 += i
print(Sum_0)
| false | 15.384615 | [
"-for i in range(N + 1):",
"- i = str(i)",
"+for i in range(1, N + 1):",
"- for t in i:",
"- Sum_1 += int(t)",
"+ t = i",
"+ while t != 0:",
"+ Sum_1 += t % 10",
"+ t = t // 10",
"- Sum_0 += int(i)",
"+ Sum_0 += i"
] | false | 0.04061 | 0.045893 | 0.884888 | [
"s923250543",
"s175402177"
] |
u678167152 | p03625 | python | s431295457 | s450011337 | 244 | 105 | 68,760 | 18,600 | Accepted | Accepted | 56.97 | N = int(eval(input()))
A = list(map(int, input().split()))
import collections
ans = 0
c = collections.Counter(A)
lis = []
for k,v in list(c.items()):
if v>=2:
lis.append(k)
if v>=4:
lis.append(k)
if len(lis)>=2:
lis.sort()
ans = lis[-1]*lis[-2]
print(ans)
#print(*ans, sep='\n')
| from collections import Counter
def solve():
ans = 0
N = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
D = [[0,0],[0,0]]
for k,v in list(C.items()):
if v>=2:
D.append([k,v])
D.sort(reverse=True)
if D[0][1]>=4:
return D[0][0]... | 18 | 15 | 302 | 355 | N = int(eval(input()))
A = list(map(int, input().split()))
import collections
ans = 0
c = collections.Counter(A)
lis = []
for k, v in list(c.items()):
if v >= 2:
lis.append(k)
if v >= 4:
lis.append(k)
if len(lis) >= 2:
lis.sort()
ans = lis[-1] * lis[-2]
print(ans)
# print(*ans, sep='\n'... | from collections import Counter
def solve():
ans = 0
N = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
D = [[0, 0], [0, 0]]
for k, v in list(C.items()):
if v >= 2:
D.append([k, v])
D.sort(reverse=True)
if D[0][1] >= 4:
return D[0][0] ... | false | 16.666667 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-import collections",
"+from collections import Counter",
"-ans = 0",
"-c = collections.Counter(A)",
"-lis = []",
"-for k, v in list(c.items()):",
"- if v >= 2:",
"- lis.append(k)",
"- if v >= 4:",
"- lis.a... | false | 0.08491 | 0.114579 | 0.741061 | [
"s431295457",
"s450011337"
] |
u437727817 | p02768 | python | s739045137 | s220905152 | 1,505 | 120 | 3,060 | 3,064 | Accepted | Accepted | 92.03 | import itertools
import math
n,a,b = list(map(int,input().split()))
mod = 10**9+7
def comb(n, r):
ans = 1
for i in range(r):
ans = ans * (n-i) * pow(i+1, mod-2, mod) % mod
return ans
print(((pow(2, n, mod)-1-comb(n,a)-comb(n,b)) % mod))
|
n,a,b = list(map(int,input().split()))
mod = 10**9+7
def comb(n,r):
u = 1
d = 1
for i in range(n-r+1,n+1):
u = u*i%mod
for i in range(1,r+1):
d = d*i%mod
D = pow(d,mod-2,mod)
return u*D%mod
ans = pow(2,n,mod)-1-comb(n,a)-comb(n,b)
print((ans%mod)) | 14 | 20 | 266 | 275 | import itertools
import math
n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
def comb(n, r):
ans = 1
for i in range(r):
ans = ans * (n - i) * pow(i + 1, mod - 2, mod) % mod
return ans
print(((pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)) % mod))
| n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
def comb(n, r):
u = 1
d = 1
for i in range(n - r + 1, n + 1):
u = u * i % mod
for i in range(1, r + 1):
d = d * i % mod
D = pow(d, mod - 2, mod)
return u * D % mod
ans = pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)
pri... | false | 30 | [
"-import itertools",
"-import math",
"-",
"- ans = 1",
"- for i in range(r):",
"- ans = ans * (n - i) * pow(i + 1, mod - 2, mod) % mod",
"- return ans",
"+ u = 1",
"+ d = 1",
"+ for i in range(n - r + 1, n + 1):",
"+ u = u * i % mod",
"+ for i in range(1, r +... | false | 0.78661 | 0.091984 | 8.551641 | [
"s739045137",
"s220905152"
] |
u348805958 | p02610 | python | s574922684 | s102346702 | 610 | 348 | 124,604 | 143,528 | Accepted | Accepted | 42.95 | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from heapq import heappush, heappushpop
def resolve():
it = map(int, sys.stdin.read().split())
T = next(it)
ans = []
for i in range(T):
N = next(it)
val = 0; a1 = []; a2 = []
for... | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from heapq import heappush, heappushpop
def resolve():
it = map(int, sys.stdin.read().split())
T = next(it)
ans = []
for i in range(T):
N = next(it)
val = 0
a1 = [[] for i in ran... | 47 | 51 | 1,070 | 1,235 | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from heapq import heappush, heappushpop
def resolve():
it = map(int, sys.stdin.read().split())
T = next(it)
ans = []
for i in range(T):
N = next(it)
val = 0
a1 = []
a2 = []
for i... | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from heapq import heappush, heappushpop
def resolve():
it = map(int, sys.stdin.read().split())
T = next(it)
ans = []
for i in range(T):
N = next(it)
val = 0
a1 = [[] for i in range(N)]
a... | false | 7.843137 | [
"- a1 = []",
"- a2 = []",
"- for i, v1, v2 in ((next(it), next(it), next(it)) for i in range(N)):",
"+ a1 = [[] for i in range(N)]",
"+ a2 = [[] for i in range(N)]",
"+ for i, v1, v2 in ((next(it) - 1, next(it), next(it)) for i in range(N)):",
"- if d... | false | 0.105011 | 0.038132 | 2.753911 | [
"s574922684",
"s102346702"
] |
u790710233 | p03283 | python | s647052812 | s688530679 | 1,373 | 1,020 | 112,628 | 66,296 | Accepted | Accepted | 25.71 | import numpy as np
import sys
input = sys.stdin.readline
n, m, q = map(int, input().split())
cnt = np.zeros((n+1, n+1), dtype=np.int32)
L, R = map(np.array, zip(*[map(int, input().split()) for _ in range(m)]))
np.add.at(cnt, (L, R), 1)
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(*[map(i... | import numpy as np
import sys
input = sys.stdin.readline
n, m, q = map(int, input().split())
cnt = [[0]*(n+1)for _ in range(n+1)]
for _ in range(m):
L, R = map(int, input().split())
cnt[L][R] += 1
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(*[map(int, input().split()) for _ in ... | 13 | 14 | 433 | 403 | import numpy as np
import sys
input = sys.stdin.readline
n, m, q = map(int, input().split())
cnt = np.zeros((n + 1, n + 1), dtype=np.int32)
L, R = map(np.array, zip(*[map(int, input().split()) for _ in range(m)]))
np.add.at(cnt, (L, R), 1)
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(*[map(int, i... | import numpy as np
import sys
input = sys.stdin.readline
n, m, q = map(int, input().split())
cnt = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
L, R = map(int, input().split())
cnt[L][R] += 1
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(*[map(int, input().split()) for _ in ran... | false | 7.142857 | [
"-cnt = np.zeros((n + 1, n + 1), dtype=np.int32)",
"-L, R = map(np.array, zip(*[map(int, input().split()) for _ in range(m)]))",
"-np.add.at(cnt, (L, R), 1)",
"+cnt = [[0] * (n + 1) for _ in range(n + 1)]",
"+for _ in range(m):",
"+ L, R = map(int, input().split())",
"+ cnt[L][R] += 1"
] | false | 0.187559 | 0.221301 | 0.84753 | [
"s647052812",
"s688530679"
] |
u072053884 | p00277 | python | s821125996 | s938636003 | 2,940 | 2,380 | 105,996 | 89,508 | Accepted | Accepted | 19.05 | import sys
from heapq import heappush, heappop
def solve():
file_input = sys.stdin
N, R, L = list(map(int, file_input.readline().split()))
hq = []
m = {}
for i in range(1, N + 1):
team = [0, i, 0]
heappush(hq, team)
m[i] = team
time = 0
for l... | import sys
from heapq import heappush, heappop, heapreplace
def solve():
file_input = sys.stdin
N, R, L = list(map(int, file_input.readline().split()))
pq = [[0, i, 0] for i in range(1, N + 1)]
m = dict(list(zip(list(range(1, N + 1)), pq)))
pre_t = 0
for line in file_input:... | 33 | 35 | 760 | 903 | import sys
from heapq import heappush, heappop
def solve():
file_input = sys.stdin
N, R, L = list(map(int, file_input.readline().split()))
hq = []
m = {}
for i in range(1, N + 1):
team = [0, i, 0]
heappush(hq, team)
m[i] = team
time = 0
for line in file_input:
... | import sys
from heapq import heappush, heappop, heapreplace
def solve():
file_input = sys.stdin
N, R, L = list(map(int, file_input.readline().split()))
pq = [[0, i, 0] for i in range(1, N + 1)]
m = dict(list(zip(list(range(1, N + 1)), pq)))
pre_t = 0
for line in file_input:
d, t, x = l... | false | 5.714286 | [
"-from heapq import heappush, heappop",
"+from heapq import heappush, heappop, heapreplace",
"- hq = []",
"- m = {}",
"- for i in range(1, N + 1):",
"- team = [0, i, 0]",
"- heappush(hq, team)",
"- m[i] = team",
"- time = 0",
"+ pq = [[0, i, 0] for i in range(1,... | false | 0.04233 | 0.044457 | 0.952138 | [
"s821125996",
"s938636003"
] |
u440566786 | p03684 | python | s218824191 | s790300580 | 1,660 | 1,389 | 128,588 | 124,828 | Accepted | Accepted | 16.33 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=lambda :sys.stdin.readline().rstrip()
def resolve():
class UnionFind(object):
"""
query: O(Ack^-1(n,n)) (amortize)
"""
def __init__(self,n):
"""
param n: number of no... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
class UnionFind(object):
"""
query: O(Ack^-1(n,n)) (amortize)
"""
def __init__(self,n):
"""
param n: number of node... | 70 | 68 | 1,887 | 1,839 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
# input=lambda :sys.stdin.readline().rstrip()
def resolve():
class UnionFind(object):
"""
query: O(Ack^-1(n,n)) (amortize)
"""
def __init__(self, n):
"""
param n: number of nodes... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
class UnionFind(object):
"""
query: O(Ack^-1(n,n)) (amortize)
"""
def __init__(self, n):
"""
param n: number of nod... | false | 2.857143 | [
"-# input=lambda :sys.stdin.readline().rstrip()",
"+input = lambda: sys.stdin.readline().rstrip()",
"+",
"+",
"- # 候補となるedgesは2N-2個しかないため、全列挙",
"- # Kruskal's algorithmでuniteしていく",
"+ # Kruskal's algorithm"
] | false | 0.127917 | 0.087016 | 1.470049 | [
"s218824191",
"s790300580"
] |
u133936772 | p02918 | python | s901138054 | s162296291 | 55 | 19 | 15,988 | 3,316 | Accepted | Accepted | 65.45 | n,k=list(map(int,input().split()))
from itertools import*
print((n-max(len(list(groupby(eval(input()))))-k*2,1))) | n,k=list(map(int,input().split()))
s=eval(input())
c=s.count
print((n-1-max(c('LR')+c('RL')-k*2,0))) | 3 | 4 | 101 | 89 | n, k = list(map(int, input().split()))
from itertools import *
print((n - max(len(list(groupby(eval(input())))) - k * 2, 1)))
| n, k = list(map(int, input().split()))
s = eval(input())
c = s.count
print((n - 1 - max(c("LR") + c("RL") - k * 2, 0)))
| false | 25 | [
"-from itertools import *",
"-",
"-print((n - max(len(list(groupby(eval(input())))) - k * 2, 1)))",
"+s = eval(input())",
"+c = s.count",
"+print((n - 1 - max(c(\"LR\") + c(\"RL\") - k * 2, 0)))"
] | false | 0.040261 | 0.03884 | 1.036585 | [
"s901138054",
"s162296291"
] |
u416758623 | p03370 | python | s730474548 | s747552331 | 39 | 17 | 3,064 | 3,060 | Accepted | Accepted | 56.41 | n,x = list(map(int, input().split()))
ls = [int(eval(input())) for _ in range(n)]
total = x - sum(ls)
minNum = min(ls)
ans = n - 1
while total >= 0:
total -= minNum
ans += 1
print(ans) | n, x = list(map(int, input().split()))
minNum = float('inf')
for i in range(n):
m = int(eval(input()))
minNum = min(m, minNum)
x -= m
print((x // minNum + n)) | 10 | 7 | 190 | 162 | n, x = list(map(int, input().split()))
ls = [int(eval(input())) for _ in range(n)]
total = x - sum(ls)
minNum = min(ls)
ans = n - 1
while total >= 0:
total -= minNum
ans += 1
print(ans)
| n, x = list(map(int, input().split()))
minNum = float("inf")
for i in range(n):
m = int(eval(input()))
minNum = min(m, minNum)
x -= m
print((x // minNum + n))
| false | 30 | [
"-ls = [int(eval(input())) for _ in range(n)]",
"-total = x - sum(ls)",
"-minNum = min(ls)",
"-ans = n - 1",
"-while total >= 0:",
"- total -= minNum",
"- ans += 1",
"-print(ans)",
"+minNum = float(\"inf\")",
"+for i in range(n):",
"+ m = int(eval(input()))",
"+ minNum = min(m, min... | false | 0.044633 | 0.037502 | 1.190168 | [
"s730474548",
"s747552331"
] |
u927357863 | p02995 | python | s795494617 | s589479884 | 164 | 17 | 38,256 | 3,064 | Accepted | Accepted | 89.63 | # -*- coding: utf-8 -*-
A, B, C, D = list(map(int, input().split()))
ans = 0
Am = 0
Bm = 0
df = 0
t = 0
def lcm(x, y):
return (x * y) // gcd(x, y)
def gcd(a, b):
while b:
a, b = b, a % b
return a
t = B - A + 1
Am = B // C - (A - 1) // C
Bm = B // D - (A - 1) // D
df = B // lcm(C, D) - (A - 1)... | # -*- coding: utf-8 -*-
A, B, C, D = list(map(int, input().split()))
ans = 0
Am = 0
Bm = 0
df = 0
t = 0
def lcm(x, y):
return (x * y) // gcd(x, y)
def gcd(a, b):
while b:
a, b = b, a % b
return a
t = B - A + 1
Am = (A - 1) // C + (A - 1) // D - (A - 1)//lcm(C, D)
Bm = B // C + B // D - B // lc... | 22 | 22 | 363 | 356 | # -*- coding: utf-8 -*-
A, B, C, D = list(map(int, input().split()))
ans = 0
Am = 0
Bm = 0
df = 0
t = 0
def lcm(x, y):
return (x * y) // gcd(x, y)
def gcd(a, b):
while b:
a, b = b, a % b
return a
t = B - A + 1
Am = B // C - (A - 1) // C
Bm = B // D - (A - 1) // D
df = B // lcm(C, D) - (A - 1) ... | # -*- coding: utf-8 -*-
A, B, C, D = list(map(int, input().split()))
ans = 0
Am = 0
Bm = 0
df = 0
t = 0
def lcm(x, y):
return (x * y) // gcd(x, y)
def gcd(a, b):
while b:
a, b = b, a % b
return a
t = B - A + 1
Am = (A - 1) // C + (A - 1) // D - (A - 1) // lcm(C, D)
Bm = B // C + B // D - B // ... | false | 0 | [
"-Am = B // C - (A - 1) // C",
"-Bm = B // D - (A - 1) // D",
"-df = B // lcm(C, D) - (A - 1) // lcm(C, D)",
"-ans = t - (Am + Bm) + df",
"+Am = (A - 1) // C + (A - 1) // D - (A - 1) // lcm(C, D)",
"+Bm = B // C + B // D - B // lcm(C, D)",
"+ans = t - (Bm - Am)"
] | false | 0.039231 | 0.046797 | 0.838326 | [
"s795494617",
"s589479884"
] |
u247211039 | p02989 | python | s708037231 | s513960713 | 475 | 105 | 20,592 | 20,600 | Accepted | Accepted | 77.89 | N=int(eval(input()))
d=list(map(int, input().split()))
d=sorted(d)
ans=0
for i in range(10**6):
if d[int(N/2-1)] < i and i <= d[int(N/2)]:
ans +=1
print(ans) | N=int(eval(input()))
d=list(map(int, input().split()))
d=sorted(d)
ans=0
for i in range(1+10**5):
if d[int(N/2-1)] < i and i <= d[int(N/2)]:
ans +=1
print(ans) | 11 | 11 | 179 | 181 | N = int(eval(input()))
d = list(map(int, input().split()))
d = sorted(d)
ans = 0
for i in range(10**6):
if d[int(N / 2 - 1)] < i and i <= d[int(N / 2)]:
ans += 1
print(ans)
| N = int(eval(input()))
d = list(map(int, input().split()))
d = sorted(d)
ans = 0
for i in range(1 + 10**5):
if d[int(N / 2 - 1)] < i and i <= d[int(N / 2)]:
ans += 1
print(ans)
| false | 0 | [
"-for i in range(10**6):",
"+for i in range(1 + 10**5):"
] | false | 1.329083 | 0.139414 | 9.533384 | [
"s708037231",
"s513960713"
] |
u156815136 | p04034 | python | s650248863 | s229224288 | 356 | 244 | 4,596 | 12,620 | Accepted | Accepted | 31.46 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
# d = m - k[i] - k[j]
# if kk[bisect.bi... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | 48 | 53 | 1,072 | 1,266 | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from itertools import combinations # (string,3) 3回
# from collections import deque
# import collections.defaultdict
# import bisect
#
# d = m - k[i] - k[j]
# if kk[bisect.bise... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | false | 9.433962 | [
"-# from itertools import combinations # (string,3) 3回",
"+from fractions import gcd",
"+from itertools import combinations, permutations, accumulate # (string,3) 3回",
"+",
"-# import collections.defaultdict",
"+from collections import deque, defaultdict, Counter",
"+import decimal",
"+import re",
... | false | 0.036489 | 0.035785 | 1.019687 | [
"s650248863",
"s229224288"
] |
u499381410 | p03600 | python | s787934732 | s516361342 | 777 | 541 | 50,652 | 44,252 | Accepted | Accepted | 30.37 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
INF = float('inf')
def LI(): return list(map(int, s... | 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, ... | 63 | 51 | 1,646 | 1,481 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
INF = float("inf")
def LI():
return list(map(int, sys.stdin... | 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, at... | false | 19.047619 | [
"-from bisect import bisect_left, bisect_right",
"+import bisect",
"-from itertools import permutations, accumulate, combinations",
"+from itertools import permutations, accumulate, combinations, product",
"+from bisect import bisect_left, bisect_right",
"+from math import factorial, ceil, floor, atan2",
... | false | 0.038036 | 0.037342 | 1.018601 | [
"s787934732",
"s516361342"
] |
u120106384 | p03107 | python | s694580451 | s540833353 | 198 | 183 | 46,448 | 39,152 | Accepted | Accepted | 7.58 | def compute():
from sys import stdin
S = stdin.readline().strip()
wew = []
for x in S:
if len(wew)>0 and wew[-1]!=x:
wew.pop()
else:
wew.append(x)
print((len(S) - len(wew)))
if __name__ == "__main__":
compute()
| def compute():
from sys import stdin
S = stdin.readline().strip()
l = len(S)
x = S.count("1")
y = min(x, l-x)
print((y<<1))
if __name__ == "__main__":
compute()
| 15 | 11 | 290 | 199 | def compute():
from sys import stdin
S = stdin.readline().strip()
wew = []
for x in S:
if len(wew) > 0 and wew[-1] != x:
wew.pop()
else:
wew.append(x)
print((len(S) - len(wew)))
if __name__ == "__main__":
compute()
| def compute():
from sys import stdin
S = stdin.readline().strip()
l = len(S)
x = S.count("1")
y = min(x, l - x)
print((y << 1))
if __name__ == "__main__":
compute()
| false | 26.666667 | [
"- wew = []",
"- for x in S:",
"- if len(wew) > 0 and wew[-1] != x:",
"- wew.pop()",
"- else:",
"- wew.append(x)",
"- print((len(S) - len(wew)))",
"+ l = len(S)",
"+ x = S.count(\"1\")",
"+ y = min(x, l - x)",
"+ print((y << 1))"
] | false | 0.044161 | 0.04443 | 0.99396 | [
"s694580451",
"s540833353"
] |
u046187684 | p03339 | python | s124842656 | s592629042 | 162 | 111 | 21,572 | 3,672 | Accepted | Accepted | 31.48 | def solve(string):
n, s = string.split()
n = int(n)
es = {i for i, _s in enumerate(s) if _s == "E"}
num_e = len(es)
count_e = 0
count_w = 0
ans = n
for i, _s in enumerate(s):
tmp = count_w
if i in es:
count_e += 1
else:
count... | def solve(string):
n, s = string.split()
num_e = s.count("E")
count_e = 0
count_w = 0
ans = int(n)
for _s in s:
tmp = count_w
if _s == "E":
count_e += 1
else:
count_w += 1
tmp += num_e - count_e
ans = min(ans, tmp)
... | 22 | 19 | 491 | 418 | def solve(string):
n, s = string.split()
n = int(n)
es = {i for i, _s in enumerate(s) if _s == "E"}
num_e = len(es)
count_e = 0
count_w = 0
ans = n
for i, _s in enumerate(s):
tmp = count_w
if i in es:
count_e += 1
else:
count_w += 1
... | def solve(string):
n, s = string.split()
num_e = s.count("E")
count_e = 0
count_w = 0
ans = int(n)
for _s in s:
tmp = count_w
if _s == "E":
count_e += 1
else:
count_w += 1
tmp += num_e - count_e
ans = min(ans, tmp)
return str(an... | false | 13.636364 | [
"- n = int(n)",
"- es = {i for i, _s in enumerate(s) if _s == \"E\"}",
"- num_e = len(es)",
"+ num_e = s.count(\"E\")",
"- ans = n",
"- for i, _s in enumerate(s):",
"+ ans = int(n)",
"+ for _s in s:",
"- if i in es:",
"+ if _s == \"E\":"
] | false | 0.060991 | 0.044517 | 1.370084 | [
"s124842656",
"s592629042"
] |
u285436211 | p02639 | python | s163680163 | s308348376 | 25 | 22 | 9,016 | 9,080 | Accepted | Accepted | 12 | A=[int(_) for _ in input().split()]
B=sum(A)
S=15-B
print(S) | A=[int(_) for _ in input().split()]
print((15-sum(A))) | 4 | 2 | 63 | 53 | A = [int(_) for _ in input().split()]
B = sum(A)
S = 15 - B
print(S)
| A = [int(_) for _ in input().split()]
print((15 - sum(A)))
| false | 50 | [
"-B = sum(A)",
"-S = 15 - B",
"-print(S)",
"+print((15 - sum(A)))"
] | false | 0.041515 | 0.038496 | 1.078416 | [
"s163680163",
"s308348376"
] |
u339851548 | p02629 | python | s478672137 | s372546689 | 162 | 63 | 61,604 | 61,896 | Accepted | Accepted | 61.11 | n = int(eval(input()))
eigo = 'abcdefghijklmnopqrstuvwxyz'
keta = 1
j = 1
while n > 26**j:
n -= 26**j
keta += 1
j += 1
n = n-1
ans =''
while keta != 0:
a = n //(26**(keta-1))
if a != 0:
n = n -(26**(keta-1)*a)
ans += eigo[a]
else:
ans+= eigo[0]
... | n = int(eval(input()))
eigo = 'abcdefghijklmnopqrstuvwxyz'
keta = 1
while n > 26**keta:
n -= 26**keta
keta += 1
ans =''
n = n-1
for i in range(keta):
a =n // 26**(keta-1-i)
ans += eigo[a]
n = n % (26**(keta-1-i))
print(ans)
| 23 | 15 | 337 | 254 | n = int(eval(input()))
eigo = "abcdefghijklmnopqrstuvwxyz"
keta = 1
j = 1
while n > 26**j:
n -= 26**j
keta += 1
j += 1
n = n - 1
ans = ""
while keta != 0:
a = n // (26 ** (keta - 1))
if a != 0:
n = n - (26 ** (keta - 1) * a)
ans += eigo[a]
else:
ans += eigo[0]
keta -=... | n = int(eval(input()))
eigo = "abcdefghijklmnopqrstuvwxyz"
keta = 1
while n > 26**keta:
n -= 26**keta
keta += 1
ans = ""
n = n - 1
for i in range(keta):
a = n // 26 ** (keta - 1 - i)
ans += eigo[a]
n = n % (26 ** (keta - 1 - i))
print(ans)
| false | 34.782609 | [
"-j = 1",
"-while n > 26**j:",
"- n -= 26**j",
"+while n > 26**keta:",
"+ n -= 26**keta",
"- j += 1",
"+ans = \"\"",
"-ans = \"\"",
"-while keta != 0:",
"- a = n // (26 ** (keta - 1))",
"- if a != 0:",
"- n = n - (26 ** (keta - 1) * a)",
"- ans += eigo[a]",
"- ... | false | 0.039534 | 0.111931 | 0.353201 | [
"s478672137",
"s372546689"
] |
u552176911 | p02714 | python | s875056784 | s887210031 | 177 | 135 | 73,772 | 73,640 | Accepted | Accepted | 23.73 | import math
n = int(eval(input()))
s = eval(input())
R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B
for i in range(n):
for j in range(n):
c1 = i
c2 = i + j
c3 = i + j * 2
if c3 >= n: continue
if c1 == c2 == c3: continue
if s[c1] !... | import math
n = int(eval(input()))
s = eval(input())
R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B
for i in range(n):
for j in range(n):
c1 = i
c2 = i + j
c3 = i + j * 2
if c3 >= n: break
if c1 == c2 == c3: continue
if s[c1] != s... | 21 | 21 | 428 | 425 | import math
n = int(eval(input()))
s = eval(input())
R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B
for i in range(n):
for j in range(n):
c1 = i
c2 = i + j
c3 = i + j * 2
if c3 >= n:
continue
if c1 == c2 == c3:
continue
if ... | import math
n = int(eval(input()))
s = eval(input())
R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B
for i in range(n):
for j in range(n):
c1 = i
c2 = i + j
c3 = i + j * 2
if c3 >= n:
break
if c1 == c2 == c3:
continue
if s[c... | false | 0 | [
"- continue",
"+ break"
] | false | 0.109421 | 0.044834 | 2.44059 | [
"s875056784",
"s887210031"
] |
u107077660 | p04011 | python | s377016813 | s740556639 | 37 | 24 | 3,064 | 3,064 | Accepted | Accepted | 35.14 | N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N > K:
a = X * K + Y * (N - K)
else:
a = X * N
print(a) | N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N <= K:
print((X*N))
else:
ans = X*K + Y*(N-K)
print(ans) | 9 | 9 | 136 | 137 | N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N > K:
a = X * K + Y * (N - K)
else:
a = X * N
print(a)
| N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N <= K:
print((X * N))
else:
ans = X * K + Y * (N - K)
print(ans)
| false | 0 | [
"-if N > K:",
"- a = X * K + Y * (N - K)",
"+if N <= K:",
"+ print((X * N))",
"- a = X * N",
"-print(a)",
"+ ans = X * K + Y * (N - K)",
"+ print(ans)"
] | false | 0.037653 | 0.04256 | 0.8847 | [
"s377016813",
"s740556639"
] |
u111473084 | p02781 | python | s736757052 | s959169896 | 24 | 19 | 3,572 | 3,064 | Accepted | Accepted | 20.83 | def main():
import sys
input = sys.stdin.readline
N = list(map(int, list(input()[:-1])))
K = int(eval(input()))
L = len(N)
# dp[i][j][k]
# i 桁目まで決めて
# j 個の非0を使って
# k = 0 : そこまでの桁はNと一致
# k = 1 : そこまでの桁でN未満であることが確定
dp = [[[0] * 2 for _ in range(K + 2)] for _ in r... | def main():
import sys
input = sys.stdin.readline
N = list(map(int, list(input()[:-1])))
K = int(eval(input()))
L = len(N)
# dp[i][j][k]
# i 桁目まで決めて
# j 個の非0を使って
# k = 0 : そこまでの桁はNと一致
# k = 1 : そこまでの桁でN未満であることが確定
dp = [[[0] * 2 for _ in range(K + 2)] for _ in r... | 39 | 38 | 1,055 | 1,024 | def main():
import sys
input = sys.stdin.readline
N = list(map(int, list(input()[:-1])))
K = int(eval(input()))
L = len(N)
# dp[i][j][k]
# i 桁目まで決めて
# j 個の非0を使って
# k = 0 : そこまでの桁はNと一致
# k = 1 : そこまでの桁でN未満であることが確定
dp = [[[0] * 2 for _ in range(K + 2)] for _ in range(L + 1)]
... | def main():
import sys
input = sys.stdin.readline
N = list(map(int, list(input()[:-1])))
K = int(eval(input()))
L = len(N)
# dp[i][j][k]
# i 桁目まで決めて
# j 個の非0を使って
# k = 0 : そこまでの桁はNと一致
# k = 1 : そこまでの桁でN未満であることが確定
dp = [[[0] * 2 for _ in range(K + 2)] for _ in range(L + 1)]
... | false | 2.564103 | [
"- from pprint import pprint",
"-"
] | false | 0.037621 | 0.035598 | 1.056827 | [
"s736757052",
"s959169896"
] |
u528470578 | p03103 | python | s122389344 | s393413616 | 452 | 286 | 29,024 | 29,180 | Accepted | Accepted | 36.73 | N, M = list(map(int, input().split()))
AB = []
for i in range(N):
AB.append(list(map(int, input().split())))
AB.sort(key=lambda x:x[0])
kane = 0
hon = 0
for i in range(N):
if hon + AB[i][1] < M:
hon += AB[i][1]
kane += AB[i][0] * AB[i][1]
continue
elif hon + AB[i]... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x:x[0])
ans = 0
for a, b in AB:
if b <= M:
ans += a * b
M -= b
else:
ans += a * M
break
if M == 0:
break
print(ans) | 23 | 14 | 506 | 295 | N, M = list(map(int, input().split()))
AB = []
for i in range(N):
AB.append(list(map(int, input().split())))
AB.sort(key=lambda x: x[0])
kane = 0
hon = 0
for i in range(N):
if hon + AB[i][1] < M:
hon += AB[i][1]
kane += AB[i][0] * AB[i][1]
continue
elif hon + AB[i][1] == M:
h... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])
ans = 0
for a, b in AB:
if b <= M:
ans += a * b
M -= b
else:
ans += a * M
break
if M == 0:
break
print(ans)
| false | 39.130435 | [
"-AB = []",
"-for i in range(N):",
"- AB.append(list(map(int, input().split())))",
"-AB.sort(key=lambda x: x[0])",
"-kane = 0",
"-hon = 0",
"-for i in range(N):",
"- if hon + AB[i][1] < M:",
"- hon += AB[i][1]",
"- kane += AB[i][0] * AB[i][1]",
"- continue",
"- el... | false | 0.067861 | 0.068039 | 0.997385 | [
"s122389344",
"s393413616"
] |
u562935282 | p03171 | python | s502940325 | s593480389 | 614 | 532 | 162,952 | 179,804 | Accepted | Accepted | 13.36 | n = int(eval(input()))
a = tuple(int(x) for x in input().split())
memo = tuple([None] * n for _ in range(n))
for i in range(n):
memo[i][i] = a[i]
for l in range(n - 2, -1, -1):
for r in range(l + 1, n):
memo[l][r] = max(a[l] - memo[l + 1][r], a[r] - memo[l][r - 1])
print((memo[0][n - 1]))
... | def main():
n = int(eval(input()))
a = tuple(int(x) for x in input().split())
memo = tuple([None] * n for _ in range(n))
for i in range(n):
memo[i][i] = a[i]
for l in range(n - 2, -1, -1):
for r in range(l + 1, n):
memo[l][r] = max(a[l] - memo[l + 1][r], a[r] ... | 23 | 28 | 579 | 653 | n = int(eval(input()))
a = tuple(int(x) for x in input().split())
memo = tuple([None] * n for _ in range(n))
for i in range(n):
memo[i][i] = a[i]
for l in range(n - 2, -1, -1):
for r in range(l + 1, n):
memo[l][r] = max(a[l] - memo[l + 1][r], a[r] - memo[l][r - 1])
print((memo[0][n - 1]))
# [l,r]を
# l:=... | def main():
n = int(eval(input()))
a = tuple(int(x) for x in input().split())
memo = tuple([None] * n for _ in range(n))
for i in range(n):
memo[i][i] = a[i]
for l in range(n - 2, -1, -1):
for r in range(l + 1, n):
memo[l][r] = max(a[l] - memo[l + 1][r], a[r] - memo[l][r ... | false | 17.857143 | [
"-n = int(eval(input()))",
"-a = tuple(int(x) for x in input().split())",
"-memo = tuple([None] * n for _ in range(n))",
"-for i in range(n):",
"- memo[i][i] = a[i]",
"-for l in range(n - 2, -1, -1):",
"- for r in range(l + 1, n):",
"- memo[l][r] = max(a[l] - memo[l + 1][r], a[r] - memo[l... | false | 0.038448 | 0.034947 | 1.100173 | [
"s502940325",
"s593480389"
] |
u673361376 | p03417 | python | s174126859 | s374851537 | 176 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.34 | N,M = list(map(int,input().split()))
if N == 1 and M == 1: print((1))
elif N == 1: print((M-2))
elif M == 1: print((N-2))
else: print(((M-2)*(N-2))) | N, M = list(map(int, input().split()))
if N == 1 and M == 1:
print((1))
elif N == 1 and M != 1:
print((M - 2))
elif M == 1 and N != 1:
print((N - 2))
else:
print(((N - 2) * (M - 2)))
| 5 | 9 | 138 | 193 | N, M = list(map(int, input().split()))
if N == 1 and M == 1:
print((1))
elif N == 1:
print((M - 2))
elif M == 1:
print((N - 2))
else:
print(((M - 2) * (N - 2)))
| N, M = list(map(int, input().split()))
if N == 1 and M == 1:
print((1))
elif N == 1 and M != 1:
print((M - 2))
elif M == 1 and N != 1:
print((N - 2))
else:
print(((N - 2) * (M - 2)))
| false | 44.444444 | [
"-elif N == 1:",
"+elif N == 1 and M != 1:",
"-elif M == 1:",
"+elif M == 1 and N != 1:",
"- print(((M - 2) * (N - 2)))",
"+ print(((N - 2) * (M - 2)))"
] | false | 0.084086 | 0.038483 | 2.185014 | [
"s174126859",
"s374851537"
] |
u732412551 | p03221 | python | s048375123 | s906831428 | 763 | 616 | 43,060 | 32,892 | Accepted | Accepted | 19.27 | from operator import itemgetter
N, M = map(int, input().split())
PY = sorted(((i, tuple(map(int, input().split()))) for i in range(M)), key=itemgetter(1))
L = []
prev, x = 0, 1
for i, (p, _y) in PY:
if p == prev:
x += 1
else:
prev = p
x = 1
L.append((i, "{:06d}{:06d}".form... | N,M=list(map(int, input().split()))
PY=[tuple(map(int, input().split()))for _ in range(M)]
ans=[None]*M
I=sorted(list(range(M)),key=lambda i: PY[i][1])
C=[0]*(N+1)
for i in I:
p=PY[i][0]
C[p]+=1
ans[i]=(p,C[p])
def f(x):
s=str(x)
return "0"*(6-len(s))+s
for p,c in ans:
print((f(p)+f... | 14 | 14 | 377 | 311 | from operator import itemgetter
N, M = map(int, input().split())
PY = sorted(
((i, tuple(map(int, input().split()))) for i in range(M)), key=itemgetter(1)
)
L = []
prev, x = 0, 1
for i, (p, _y) in PY:
if p == prev:
x += 1
else:
prev = p
x = 1
L.append((i, "{:06d}{:06d}".format(p... | N, M = list(map(int, input().split()))
PY = [tuple(map(int, input().split())) for _ in range(M)]
ans = [None] * M
I = sorted(list(range(M)), key=lambda i: PY[i][1])
C = [0] * (N + 1)
for i in I:
p = PY[i][0]
C[p] += 1
ans[i] = (p, C[p])
def f(x):
s = str(x)
return "0" * (6 - len(s)) + s
for p, c... | false | 0 | [
"-from operator import itemgetter",
"+N, M = list(map(int, input().split()))",
"+PY = [tuple(map(int, input().split())) for _ in range(M)]",
"+ans = [None] * M",
"+I = sorted(list(range(M)), key=lambda i: PY[i][1])",
"+C = [0] * (N + 1)",
"+for i in I:",
"+ p = PY[i][0]",
"+ C[p] += 1",
"+ ... | false | 0.044297 | 0.083725 | 0.52908 | [
"s048375123",
"s906831428"
] |
u325282913 | p02936 | python | s443360668 | s092539129 | 1,552 | 1,397 | 230,960 | 228,020 | Accepted | Accepted | 9.99 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N)]
point = [0]*N
for i in range(N-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
for i in range(Q):
p... | import sys
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
edges = [[] for _ in range(N)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
edges[a - 1].append(b - 1)
edges[b - 1].append(a - 1)
Query = [0]*N
for _ in range(Q):
p, x = list(map(int, input().split())... | 23 | 23 | 525 | 571 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N)]
point = [0] * N
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
for i in range(Q):
p, x = li... | import sys
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
edges = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
edges[a - 1].append(b - 1)
edges[b - 1].append(a - 1)
Query = [0] * N
for _ in range(Q):
p, x = list(map(int, input().split()))
... | false | 0 | [
"-input = sys.stdin.readline",
"-graph = [[] for _ in range(N)]",
"-point = [0] * N",
"-for i in range(N - 1):",
"+edges = [[] for _ in range(N)]",
"+for _ in range(N - 1):",
"- a -= 1",
"- b -= 1",
"- graph[a].append(b)",
"- graph[b].append(a)",
"-for i in range(Q):",
"+ edges[... | false | 0.048978 | 0.047591 | 1.029132 | [
"s443360668",
"s092539129"
] |
u729133443 | p03032 | python | s093172084 | s480554125 | 213 | 31 | 41,324 | 3,060 | Accepted | Accepted | 85.45 | n,k,*v=list(map(int,open(0).read().split()))
m=0
r=range
for i in r(n+1):
for j in r(min(k-i+1,n-i+1)):
t=sorted(v[:i]+v[-j:]*(j>0))[::-1];c=k-i-j
while t and c and t[-1]<0:t.pop();c-=1
m=max(m,sum(t))
print(m) | n,k,*v=list(map(int,open(0).read().split()))
m=0
r=range
for i in r(n+1):
for j in r(min(k-i+1,n-i+1)):
t=sorted(v[:i]+v[-j:]*(j>0))[::-1];c=k-i-j
while t and c*t[-1]<0:t.pop();c-=1
m=max(m,sum(t))
print(m) | 9 | 9 | 219 | 215 | n, k, *v = list(map(int, open(0).read().split()))
m = 0
r = range
for i in r(n + 1):
for j in r(min(k - i + 1, n - i + 1)):
t = sorted(v[:i] + v[-j:] * (j > 0))[::-1]
c = k - i - j
while t and c and t[-1] < 0:
t.pop()
c -= 1
m = max(m, sum(t))
print(m)
| n, k, *v = list(map(int, open(0).read().split()))
m = 0
r = range
for i in r(n + 1):
for j in r(min(k - i + 1, n - i + 1)):
t = sorted(v[:i] + v[-j:] * (j > 0))[::-1]
c = k - i - j
while t and c * t[-1] < 0:
t.pop()
c -= 1
m = max(m, sum(t))
print(m)
| false | 0 | [
"- while t and c and t[-1] < 0:",
"+ while t and c * t[-1] < 0:"
] | false | 0.040807 | 0.036052 | 1.131879 | [
"s093172084",
"s480554125"
] |
u046187684 | p03148 | python | s591373001 | s251770460 | 336 | 300 | 26,784 | 26,876 | Accepted | Accepted | 10.71 | def solve(string):
n, k, *td = list(map(int, string.split()))
td = sorted([(t, d) for t, d in zip(td[::2], td[1::2])], key=lambda x: x[1], reverse=True)
max_variety = len(set([c[0] for c in td]))
choice = td[:k]
count = [0] * n
for _c in choice:
count[_c[0] - 1] += 1
variety ... | def solve(string):
n, k, *td = list(map(int, string.split()))
td = sorted([(t, d) for t, d in zip(td[::2], td[1::2])], key=lambda x: x[1], reverse=True)
max_variety = len(set([c[0] for c in td]))
choice = td[:k]
r = []
variety = set([])
base = 0
for _c in choice:
base +=... | 27 | 28 | 1,022 | 871 | def solve(string):
n, k, *td = list(map(int, string.split()))
td = sorted(
[(t, d) for t, d in zip(td[::2], td[1::2])], key=lambda x: x[1], reverse=True
)
max_variety = len(set([c[0] for c in td]))
choice = td[:k]
count = [0] * n
for _c in choice:
count[_c[0] - 1] += 1
va... | def solve(string):
n, k, *td = list(map(int, string.split()))
td = sorted(
[(t, d) for t, d in zip(td[::2], td[1::2])], key=lambda x: x[1], reverse=True
)
max_variety = len(set([c[0] for c in td]))
choice = td[:k]
r = []
variety = set([])
base = 0
for _c in choice:
ba... | false | 3.571429 | [
"- count = [0] * n",
"+ r = []",
"+ variety = set([])",
"+ base = 0",
"- count[_c[0] - 1] += 1",
"- variety = set([c[0] for c in choice])",
"- ans = [len(variety) ** 2 + sum([c[1] for c in choice])]",
"- i_remove, i_append = k - 1, k",
"+ base += _c[1]",
"+ ... | false | 0.045074 | 0.044804 | 1.006017 | [
"s591373001",
"s251770460"
] |
u410269178 | p03044 | python | s520355324 | s737491620 | 914 | 783 | 45,368 | 46,512 | Accepted | Accepted | 14.33 | from collections import deque
n = int(eval(input()))
to = [[] for _ in range(n)]
for i in range(n-1):
u, v, w = list(map(int, input().split()))
u , v = u-1, v-1
to[u].append([v, w])
to[v].append([u, w])
color = [-1] * n
color[0] = False
q = deque([0])
while q:
v = q.popleft()
for u,... | from collections import deque
n = int(eval(input()))
to = [[] for _ in range(n)]
for i in range(n-1):
u, v, w = list(map(int, input().split()))
u , v = u-1, v-1
to[u].append([v, w])
to[v].append([u, w])
color = [-1] * n
color[0] = 0
q = deque([0])
while q:
v = q.popleft()
for u, w i... | 23 | 23 | 536 | 527 | from collections import deque
n = int(eval(input()))
to = [[] for _ in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u, v = u - 1, v - 1
to[u].append([v, w])
to[v].append([u, w])
color = [-1] * n
color[0] = False
q = deque([0])
while q:
v = q.popleft()
for u, w in t... | from collections import deque
n = int(eval(input()))
to = [[] for _ in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u, v = u - 1, v - 1
to[u].append([v, w])
to[v].append([u, w])
color = [-1] * n
color[0] = 0
q = deque([0])
while q:
v = q.popleft()
for u, w in to[v]... | false | 0 | [
"-color[0] = False",
"+color[0] = 0",
"- print((int(c)))",
"+ print(c)"
] | false | 0.048461 | 0.107963 | 0.448868 | [
"s520355324",
"s737491620"
] |
u197955752 | p02983 | python | s502566423 | s857213923 | 736 | 61 | 2,940 | 3,060 | Accepted | Accepted | 91.71 | L, R = [int(x) for x in input().split()]
if R - L >= 2018:
ans = 0
else:
ans = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
print(ans) | L, R = [int(x) for x in input().split()]
if R - L >= 2018:
ans = 0
else:
ans = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
if ans == 0: break
else:
continue
break
print(ans)
| 11 | 15 | 219 | 304 | L, R = [int(x) for x in input().split()]
if R - L >= 2018:
ans = 0
else:
ans = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
print(ans)
| L, R = [int(x) for x in input().split()]
if R - L >= 2018:
ans = 0
else:
ans = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
if ans == 0:
break
else:
continue
break
print(ans)
| false | 26.666667 | [
"+ if ans == 0:",
"+ break",
"+ else:",
"+ continue",
"+ break"
] | false | 0.053299 | 0.037516 | 1.420715 | [
"s502566423",
"s857213923"
] |
u761320129 | p03739 | python | s976656543 | s254938361 | 117 | 100 | 14,468 | 19,960 | Accepted | Accepted | 14.53 | N = int(eval(input()))
A = list(map(int,input().split()))
ans1 = c = 0
for i,a in enumerate(A):
c += a
if i%2:
if c < 1:
ans1 += 1-c
c = 1
else:
if c > -1:
ans1 += c+1
c = -1
ans2 = c = 0
for i,a in enumerate(A):
c += a
... | N = int(eval(input()))
A = list(map(int,input().split()))
ans1 = 0
s = 0
for i,a in enumerate(A):
s += a
if i%2:
if s > -1:
ans1 += s+1
s = -1
else:
if s < 1:
ans1 += 1-s
s = 1
ans2 = 0
s = 0
for i,a in enumerate(A):
s ... | 28 | 30 | 492 | 499 | N = int(eval(input()))
A = list(map(int, input().split()))
ans1 = c = 0
for i, a in enumerate(A):
c += a
if i % 2:
if c < 1:
ans1 += 1 - c
c = 1
else:
if c > -1:
ans1 += c + 1
c = -1
ans2 = c = 0
for i, a in enumerate(A):
c += a
if i % ... | N = int(eval(input()))
A = list(map(int, input().split()))
ans1 = 0
s = 0
for i, a in enumerate(A):
s += a
if i % 2:
if s > -1:
ans1 += s + 1
s = -1
else:
if s < 1:
ans1 += 1 - s
s = 1
ans2 = 0
s = 0
for i, a in enumerate(A):
s += a
if ... | false | 6.666667 | [
"-ans1 = c = 0",
"+ans1 = 0",
"+s = 0",
"- c += a",
"+ s += a",
"- if c < 1:",
"- ans1 += 1 - c",
"- c = 1",
"+ if s > -1:",
"+ ans1 += s + 1",
"+ s = -1",
"- if c > -1:",
"- ans1 += c + 1",
"- c =... | false | 0.036475 | 0.082942 | 0.439766 | [
"s976656543",
"s254938361"
] |
u297089927 | p02548 | python | s874028292 | s665231921 | 1,318 | 162 | 16,700 | 8,980 | Accepted | Accepted | 87.71 | def num_divisors_table(n):
table = [0] * (n + 1)
for i in range(1, n + 1):
for j in range(i, n + 1, i):
table[j] += 1
return table
n=int(eval(input()))
print((sum(num_divisors_table(n-1))))
| n=int(eval(input()))
ans=0
for i in range(1,n):
ans+=(n-1)//i
print(ans) | 10 | 5 | 233 | 72 | def num_divisors_table(n):
table = [0] * (n + 1)
for i in range(1, n + 1):
for j in range(i, n + 1, i):
table[j] += 1
return table
n = int(eval(input()))
print((sum(num_divisors_table(n - 1))))
| n = int(eval(input()))
ans = 0
for i in range(1, n):
ans += (n - 1) // i
print(ans)
| false | 50 | [
"-def num_divisors_table(n):",
"- table = [0] * (n + 1)",
"- for i in range(1, n + 1):",
"- for j in range(i, n + 1, i):",
"- table[j] += 1",
"- return table",
"-",
"-",
"-print((sum(num_divisors_table(n - 1))))",
"+ans = 0",
"+for i in range(1, n):",
"+ ans += (n... | false | 0.306871 | 0.079296 | 3.86996 | [
"s874028292",
"s665231921"
] |
u847467233 | p00267 | python | s937118897 | s009821304 | 800 | 660 | 13,480 | 14,260 | Accepted | Accepted | 17.5 | # AOJ 0272: The Lonely Girl's Lie
# Python3 2018.6.26 bal4u
while True:
n = int(eval(input()))
if n == 0: break
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
ans, i = n, -1
for k in range(0, n, 2):
i += 1
if a[k] > b[i]:
a... | # AOJ 0272: The Lonely Girl's Lie
# Python3 2018.6.26 bal4u
def counting_sort(nmax, la): # nmax:最大値, n:len(la), a:データリスト
f = [0]*(nmax+1)
nmax = 0
for a in la:
f[a] += 1
if a > nmax: nmax = a
k, i = len(la), nmax
la = []
while k:
if f[i]:
la += [i]*f[i]
k -= f[i]
i -= 1
return la
... | 17 | 33 | 370 | 648 | # AOJ 0272: The Lonely Girl's Lie
# Python3 2018.6.26 bal4u
while True:
n = int(eval(input()))
if n == 0:
break
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
ans, i = n, -1
for k in range(0, n, 2):
i += 1... | # AOJ 0272: The Lonely Girl's Lie
# Python3 2018.6.26 bal4u
def counting_sort(nmax, la): # nmax:最大値, n:len(la), a:データリスト
f = [0] * (nmax + 1)
nmax = 0
for a in la:
f[a] += 1
if a > nmax:
nmax = a
k, i = len(la), nmax
la = []
while k:
if f[i]:
la +... | false | 48.484848 | [
"+def counting_sort(nmax, la): # nmax:最大値, n:len(la), a:データリスト",
"+ f = [0] * (nmax + 1)",
"+ nmax = 0",
"+ for a in la:",
"+ f[a] += 1",
"+ if a > nmax:",
"+ nmax = a",
"+ k, i = len(la), nmax",
"+ la = []",
"+ while k:",
"+ if f[i]:",
"+ ... | false | 0.043285 | 0.037603 | 1.151108 | [
"s937118897",
"s009821304"
] |
u585482323 | p03568 | python | s432131331 | s476734766 | 202 | 181 | 39,408 | 39,920 | Accepted | Accepted | 10.4 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 43 | 48 | 1,046 | 1,154 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 10.416667 | [
"- for b in range((1 << n) - 1):",
"+ for b in range(1, 1 << n):",
"+ c = 0",
"- res *= (s[i] << (b >> i)) % 3",
"- ans += res",
"+ if b & (1 << i):",
"+ res *= s[i]",
"+ c ^= 1",
"+ else:",
"+ res *=... | false | 0.04859 | 0.047526 | 1.022392 | [
"s432131331",
"s476734766"
] |
u619274787 | p03456 | python | s748972009 | s282551170 | 28 | 17 | 2,940 | 3,060 | Accepted | Accepted | 39.29 | x = int(input().replace(' ', ''))
for i in range(x):
if i*i == x:
print('Yes')
exit()
print('No') | x = int(input().replace(' ', ''))
print(('Yes' if x in [i*i for i in range(1000)] else 'No')) | 6 | 2 | 122 | 92 | x = int(input().replace(" ", ""))
for i in range(x):
if i * i == x:
print("Yes")
exit()
print("No")
| x = int(input().replace(" ", ""))
print(("Yes" if x in [i * i for i in range(1000)] else "No"))
| false | 66.666667 | [
"-for i in range(x):",
"- if i * i == x:",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"+print((\"Yes\" if x in [i * i for i in range(1000)] else \"No\"))"
] | false | 0.044094 | 0.039228 | 1.124047 | [
"s748972009",
"s282551170"
] |
u857428111 | p03048 | python | s919561094 | s654682851 | 347 | 292 | 40,812 | 39,408 | Accepted | Accepted | 15.85 | #入力(後でいじる)
def pin(type=int):
return list(map(type,input().split()))
#どっかで最悪計算量の入力データを用意する関数を作ろう?
"""
O(N^2)
"""
#solution:
#潜 影 蛇 手 ! !
*c,N=pin()
ans=0
I=(N//c[0])+1
J=N//c[1]+1
for i in range(I):
for j in range(J):
remain=(N-i*c[0]-j*c[1])
if remain>=0 and remain... | #print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return list(map(type,input().split()))
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
R,G,... | 28 | 23 | 476 | 571 | # 入力(後でいじる)
def pin(type=int):
return list(map(type, input().split()))
# どっかで最悪計算量の入力データを用意する関数を作ろう?
"""
O(N^2)
"""
# solution:
# 潜 影 蛇 手 ! !
*c, N = pin()
ans = 0
I = (N // c[0]) + 1
J = N // c[1] + 1
for i in range(I):
for j in range(J):
remain = N - i * c[0] - j * c[1]
if remain >= 0 and re... | # print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):
return list(map(type, input().split()))
def tupin(t=int):
return tuple(pin(t))
def lispin(t=int):
return list(pin(t))
#%%code
def reso... | false | 17.857143 | [
"-# 入力(後でいじる)",
"+# print#!/usr/bin/env python3",
"+#%% for atcoder uniittest use",
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip()",
"+sys.setrecursionlimit(10**9)",
"+",
"+",
"-# どっかで最悪計算量の入力データを用意する関数を作ろう?",
"-\"\"\"",
"-O(N^2)",
"-\"\"\"",
"-# solution:",
"-# 潜 影 ... | false | 0.265805 | 0.896417 | 0.296519 | [
"s919561094",
"s654682851"
] |
u230717961 | p03495 | python | s792372419 | s469632184 | 270 | 191 | 40,956 | 32,532 | Accepted | Accepted | 29.26 | import collections
def solve(n, k, a_list):
counter = collections.Counter()
for i in a_list:
counter[i] += 1
key_num = len(list(counter.keys()))
if key_num > k:
tmp = sorted(list(counter.items()), key=lambda x: x[1])
ans = sum([v for k, v in tmp[: key_num - k]])
... | import collections
def solve(n, k, a_list):
counter = collections.Counter()
for i in a_list:
counter[i] += 1
tmp = sorted(list(counter.values()), reverse=True)
ans = n - sum(tmp[:k])
return ans
if __name__ == "__main__":
n, k = [int(i) for i in input().split()]
... | 21 | 17 | 507 | 390 | import collections
def solve(n, k, a_list):
counter = collections.Counter()
for i in a_list:
counter[i] += 1
key_num = len(list(counter.keys()))
if key_num > k:
tmp = sorted(list(counter.items()), key=lambda x: x[1])
ans = sum([v for k, v in tmp[: key_num - k]])
else:
... | import collections
def solve(n, k, a_list):
counter = collections.Counter()
for i in a_list:
counter[i] += 1
tmp = sorted(list(counter.values()), reverse=True)
ans = n - sum(tmp[:k])
return ans
if __name__ == "__main__":
n, k = [int(i) for i in input().split()]
a_list = [int(i) f... | false | 19.047619 | [
"- key_num = len(list(counter.keys()))",
"- if key_num > k:",
"- tmp = sorted(list(counter.items()), key=lambda x: x[1])",
"- ans = sum([v for k, v in tmp[: key_num - k]])",
"- else:",
"- ans = 0",
"+ tmp = sorted(list(counter.values()), reverse=True)",
"+ ans = n -... | false | 0.129078 | 0.038371 | 3.363914 | [
"s792372419",
"s469632184"
] |
u843768197 | p04043 | python | s180143803 | s666507632 | 31 | 22 | 8,860 | 9,060 | Accepted | Accepted | 29.03 | l = list(map(int, input().split()))
l.sort(reverse=True)
if l[0] == 7 and l[1] == 5 and l[2] == 5:
print('YES')
else:
print('NO') | a = list(map(int, input().split()))
cnt_5 = 0
cnt_7 = 0
for i in a:
if i == 5:
cnt_5 += 1
if i == 7:
cnt_7 += 1
if cnt_5 == 2 and cnt_7 == 1:
print('YES')
else:
print('NO') | 6 | 14 | 138 | 209 | l = list(map(int, input().split()))
l.sort(reverse=True)
if l[0] == 7 and l[1] == 5 and l[2] == 5:
print("YES")
else:
print("NO")
| a = list(map(int, input().split()))
cnt_5 = 0
cnt_7 = 0
for i in a:
if i == 5:
cnt_5 += 1
if i == 7:
cnt_7 += 1
if cnt_5 == 2 and cnt_7 == 1:
print("YES")
else:
print("NO")
| false | 57.142857 | [
"-l = list(map(int, input().split()))",
"-l.sort(reverse=True)",
"-if l[0] == 7 and l[1] == 5 and l[2] == 5:",
"+a = list(map(int, input().split()))",
"+cnt_5 = 0",
"+cnt_7 = 0",
"+for i in a:",
"+ if i == 5:",
"+ cnt_5 += 1",
"+ if i == 7:",
"+ cnt_7 += 1",
"+if cnt_5 == 2... | false | 0.037393 | 0.036394 | 1.027443 | [
"s180143803",
"s666507632"
] |
u898967808 | p03162 | python | s252209138 | s689946554 | 657 | 581 | 58,968 | 52,340 | Accepted | Accepted | 11.57 | n = int(eval(input()))
abc=[[0,0,0]]*n
dp = [[0]*n for _ in range(3)]
for i in range(n):
abc[i] = list(map(int,input().split()))
for i in range(3):
dp[i][0] = abc[0][i]
for i in range(1,n):
for j in range(3):
for k in range(3):
if j==k:
pass
else:
dp[j][i] ... | n = int(eval(input()))
abc=[[]]*n
dp = [[0]*3 for _ in range(n)]
for i in range(n):
abc[i] = list(map(int,input().split()))
for i in range(3):
dp[0][i] = abc[0][i]
for i in range(1,n):
dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + abc[i][0]
dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + abc[i][1]
dp[i][2] ... | 19 | 16 | 406 | 396 | n = int(eval(input()))
abc = [[0, 0, 0]] * n
dp = [[0] * n for _ in range(3)]
for i in range(n):
abc[i] = list(map(int, input().split()))
for i in range(3):
dp[i][0] = abc[0][i]
for i in range(1, n):
for j in range(3):
for k in range(3):
if j == k:
pass
else:
... | n = int(eval(input()))
abc = [[]] * n
dp = [[0] * 3 for _ in range(n)]
for i in range(n):
abc[i] = list(map(int, input().split()))
for i in range(3):
dp[0][i] = abc[0][i]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + abc[i][0]
dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + abc[i][1]
... | false | 15.789474 | [
"-abc = [[0, 0, 0]] * n",
"-dp = [[0] * n for _ in range(3)]",
"+abc = [[]] * n",
"+dp = [[0] * 3 for _ in range(n)]",
"- dp[i][0] = abc[0][i]",
"+ dp[0][i] = abc[0][i]",
"- for j in range(3):",
"- for k in range(3):",
"- if j == k:",
"- pass",
"- ... | false | 0.040431 | 0.038329 | 1.054846 | [
"s252209138",
"s689946554"
] |
u506858457 | p03673 | python | s563809029 | s831021917 | 181 | 163 | 26,020 | 26,020 | Accepted | Accepted | 9.94 | n = int(eval(input()))
A = list(map(int,input().split()))
answer = A[1::2][::-1]+A[::2]
if n%2==1:
answer=answer[::-1]
print((*answer))
| N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],end=' ')
print(*A[N%2::2])
| 6 | 4 | 137 | 92 | n = int(eval(input()))
A = list(map(int, input().split()))
answer = A[1::2][::-1] + A[::2]
if n % 2 == 1:
answer = answer[::-1]
print((*answer))
| N = int(input())
A = list(map(int, input().split()))
print(*A[::-2], end=" ")
print(*A[N % 2 :: 2])
| false | 33.333333 | [
"-n = int(eval(input()))",
"+N = int(input())",
"-answer = A[1::2][::-1] + A[::2]",
"-if n % 2 == 1:",
"- answer = answer[::-1]",
"-print((*answer))",
"+print(*A[::-2], end=\" \")",
"+print(*A[N % 2 :: 2])"
] | false | 0.049287 | 0.048513 | 1.015949 | [
"s563809029",
"s831021917"
] |
u271934630 | p02713 | python | s229346362 | s127139156 | 1,756 | 1,325 | 71,520 | 9,236 | Accepted | Accepted | 24.54 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
import math
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
K = i_i()
res = sum([math.gcd(math.gcd(a, b), c) for a in range(1,K+1) for b in range(1,K+1) for c in range(1,K+1)... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
import math
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
K = i_i()
ans = 0
ab = []
for a in range(1, K+1):
for b in range(1, K+1):
ab.append(math.gcd(a,b))... | 13 | 20 | 334 | 406 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
import math
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
K = i_i()
res = sum(
[
math.gcd(math.gcd(a, b), c)
for a in range(1, K + 1)
for b in range(1, K + 1)... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
import math
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
K = i_i()
ans = 0
ab = []
for a in range(1, K + 1):
for b in range(1, K + 1):
ab.append(math.gcd(a, b))
for c in ran... | false | 35 | [
"-res = sum(",
"- [",
"- math.gcd(math.gcd(a, b), c)",
"- for a in range(1, K + 1)",
"- for b in range(1, K + 1)",
"- for c in range(1, K + 1)",
"- ]",
"-)",
"-print(res)",
"+ans = 0",
"+ab = []",
"+for a in range(1, K + 1):",
"+ for b in range(1, K + 1):... | false | 0.042019 | 0.12652 | 0.332117 | [
"s229346362",
"s127139156"
] |
u130900604 | p02690 | python | s977325376 | s506826852 | 64 | 58 | 64,576 | 63,820 | Accepted | Accepted | 9.38 | x=int(eval(input()))
for a in range(-200,200):
for b in range(-200,200):
if a**5-b**5==x:
print((a,b))
exit() | x=int(eval(input()))
for a in range(200):
for b in range(-200,a):
if a**5-b**5==x:
print((a,b))
exit()
| 6 | 6 | 124 | 118 | x = int(eval(input()))
for a in range(-200, 200):
for b in range(-200, 200):
if a**5 - b**5 == x:
print((a, b))
exit()
| x = int(eval(input()))
for a in range(200):
for b in range(-200, a):
if a**5 - b**5 == x:
print((a, b))
exit()
| false | 0 | [
"-for a in range(-200, 200):",
"- for b in range(-200, 200):",
"+for a in range(200):",
"+ for b in range(-200, a):"
] | false | 0.115469 | 0.044296 | 2.606787 | [
"s977325376",
"s506826852"
] |
u445624660 | p02831 | python | s189491970 | s941822310 | 305 | 26 | 66,028 | 9,092 | Accepted | Accepted | 91.48 | # 最小公倍数
import fractions
a, b = list(map(int, input().split()))
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
print((lcm(a, b)))
| a, b = list(map(int, input().split()))
def gcd(a, b):
if a > b:
a, b = b, a
while a > 0:
a, b = b % a, a
return b
def lcm(a, b):
return (a * b) // gcd(a, b)
print((lcm(a, b)))
| 11 | 16 | 147 | 221 | # 最小公倍数
import fractions
a, b = list(map(int, input().split()))
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
print((lcm(a, b)))
| a, b = list(map(int, input().split()))
def gcd(a, b):
if a > b:
a, b = b, a
while a > 0:
a, b = b % a, a
return b
def lcm(a, b):
return (a * b) // gcd(a, b)
print((lcm(a, b)))
| false | 31.25 | [
"-# 最小公倍数",
"-import fractions",
"-",
"-def lcm(x, y):",
"- return (x * y) // fractions.gcd(x, y)",
"+def gcd(a, b):",
"+ if a > b:",
"+ a, b = b, a",
"+ while a > 0:",
"+ a, b = b % a, a",
"+ return b",
"+",
"+",
"+def lcm(a, b):",
"+ return (a * b) // gcd(a... | false | 0.088621 | 0.034045 | 2.603052 | [
"s189491970",
"s941822310"
] |
u556594202 | p02629 | python | s919343667 | s401373800 | 29 | 26 | 9,172 | 9,068 | Accepted | Accepted | 10.34 | import math
# one = 1000000000000001
dict={1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",
11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",
21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}
n=int(eval(input()))
ans = str(dict[(n-1)%26+1])
n=(n-1)//26
while n:... | import math
# one = 1000000000000001
dict={1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",
11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",
21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}
n=int(eval(input()))
ans = ""
while n:
ans = str(dict[(n-1)%26+1]) ... | 17 | 15 | 385 | 351 | import math
# one = 1000000000000001
dict = {
1: "a",
2: "b",
3: "c",
4: "d",
5: "e",
6: "f",
7: "g",
8: "h",
9: "i",
10: "j",
11: "k",
12: "l",
13: "m",
14: "n",
15: "o",
16: "p",
17: "q",
18: "r",
19: "s",
20: "t",
21: "u",
22: "... | import math
# one = 1000000000000001
dict = {
1: "a",
2: "b",
3: "c",
4: "d",
5: "e",
6: "f",
7: "g",
8: "h",
9: "i",
10: "j",
11: "k",
12: "l",
13: "m",
14: "n",
15: "o",
16: "p",
17: "q",
18: "r",
19: "s",
20: "t",
21: "u",
22: "... | false | 11.764706 | [
"-ans = str(dict[(n - 1) % 26 + 1])",
"-n = (n - 1) // 26",
"+ans = \"\""
] | false | 0.036476 | 0.043699 | 0.834712 | [
"s919343667",
"s401373800"
] |
u288944922 | p03160 | python | s031355129 | s956967457 | 170 | 122 | 95,492 | 20,528 | Accepted | Accepted | 28.24 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [-1] * N # dp[i] := i から N-1 までの移動にかかる最小コスト
dp[N-1] = 0
def rec_memo(i):
if dp[i] >= 0:
return dp[i]
if i == N-2:
dp[i] = rec_memo(i+1) + abs(h[i+1] - h[i])
retu... | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [-1] * N # dp[i] := i から N-1 までの移動にかかる最小コスト
dp[N-1] = 0
for i in reversed(list(range(N - 1))):
if i == N - 2:
dp[i] = dp[i + 1] + abs(h[i + 1] - h[i])
else:
dp[i] = min(dp[i + ... | 21 | 16 | 470 | 384 | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [-1] * N # dp[i] := i から N-1 までの移動にかかる最小コスト
dp[N - 1] = 0
def rec_memo(i):
if dp[i] >= 0:
return dp[i]
if i == N - 2:
dp[i] = rec_memo(i + 1) + abs(h[i + 1] - h[i])
return dp[i]
... | import sys
sys.setrecursionlimit(10**7)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [-1] * N # dp[i] := i から N-1 までの移動にかかる最小コスト
dp[N - 1] = 0
for i in reversed(list(range(N - 1))):
if i == N - 2:
dp[i] = dp[i + 1] + abs(h[i + 1] - h[i])
else:
dp[i] = min(dp[i + 2] + abs(h[i... | false | 23.809524 | [
"-",
"-",
"-def rec_memo(i):",
"- if dp[i] >= 0:",
"- return dp[i]",
"+for i in reversed(list(range(N - 1))):",
"- dp[i] = rec_memo(i + 1) + abs(h[i + 1] - h[i])",
"- return dp[i]",
"+ dp[i] = dp[i + 1] + abs(h[i + 1] - h[i])",
"- dp[i] = min(",
"- ... | false | 0.048965 | 0.047947 | 1.021233 | [
"s031355129",
"s956967457"
] |
u806403461 | p02639 | python | s785179407 | s626892611 | 24 | 20 | 9,180 | 9,088 | Accepted | Accepted | 16.67 | x = list(map(int, input().split()))
for a in range(5):
if x[a] == 0:
print((a+1))
break
| x = list(map(int, input().split()))
print((15 - sum(x)))
| 6 | 2 | 112 | 56 | x = list(map(int, input().split()))
for a in range(5):
if x[a] == 0:
print((a + 1))
break
| x = list(map(int, input().split()))
print((15 - sum(x)))
| false | 66.666667 | [
"-for a in range(5):",
"- if x[a] == 0:",
"- print((a + 1))",
"- break",
"+print((15 - sum(x)))"
] | false | 0.138121 | 0.040243 | 3.432151 | [
"s785179407",
"s626892611"
] |
u698176039 | p03425 | python | s570145853 | s330881378 | 198 | 166 | 9,772 | 10,132 | Accepted | Accepted | 16.16 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
MARCH = [0] * 5
for i in range(N):
if S[i][0] == 'M' : MARCH[0] += 1
if S[i][0] == 'A' : MARCH[1] += 1
if S[i][0] == 'R' : MARCH[2] += 1
if S[i][0] == 'C' : MARCH[3] += 1
if S[i][0] == 'H' : MARCH[4] += 1
ans = 0
for i in... |
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
mydict = {'M':1,'A':2,'R':3,'C':4,'H':5}
count = [0] * 6
for i in range(N):
s = S[i][0]
if s in mydict:
count[mydict[s]] += 1
ans = 0
for i in range(1,6):
for j in range(i+1,6):
if i==j:continue
for k in ran... | 19 | 22 | 462 | 477 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
MARCH = [0] * 5
for i in range(N):
if S[i][0] == "M":
MARCH[0] += 1
if S[i][0] == "A":
MARCH[1] += 1
if S[i][0] == "R":
MARCH[2] += 1
if S[i][0] == "C":
MARCH[3] += 1
if S[i][0] == "H":
MARCH[4] += 1... | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
mydict = {"M": 1, "A": 2, "R": 3, "C": 4, "H": 5}
count = [0] * 6
for i in range(N):
s = S[i][0]
if s in mydict:
count[mydict[s]] += 1
ans = 0
for i in range(1, 6):
for j in range(i + 1, 6):
if i == j:
continue
... | false | 13.636364 | [
"-MARCH = [0] * 5",
"+mydict = {\"M\": 1, \"A\": 2, \"R\": 3, \"C\": 4, \"H\": 5}",
"+count = [0] * 6",
"- if S[i][0] == \"M\":",
"- MARCH[0] += 1",
"- if S[i][0] == \"A\":",
"- MARCH[1] += 1",
"- if S[i][0] == \"R\":",
"- MARCH[2] += 1",
"- if S[i][0] == \"C\":",
... | false | 0.053496 | 0.062912 | 0.850321 | [
"s570145853",
"s330881378"
] |
u110580875 | p02571 | python | s664522184 | s422994580 | 65 | 47 | 9,056 | 9,120 | Accepted | Accepted | 27.69 | s = eval(input())
t = eval(input())
fans = 100000000
for i in range(len(s) - len(t) + 1):
ans = 0
for j in range(len(t)):
if (s[i+j] == t[j]):
pass
else:
ans += 1
fans = min(fans, ans)
print(fans) | s=eval(input())
t=eval(input())
lent=len(t)
num=lent
ls=[]
count=0
for i in range(len(s)-lent+1):
st=s[i:i+num]
num+=1
for j in range(lent):
if st[j]!=t[j]:
count+=1
ls.append(count)
count=0
print((min(ls))) | 14 | 19 | 251 | 245 | s = eval(input())
t = eval(input())
fans = 100000000
for i in range(len(s) - len(t) + 1):
ans = 0
for j in range(len(t)):
if s[i + j] == t[j]:
pass
else:
ans += 1
fans = min(fans, ans)
print(fans)
| s = eval(input())
t = eval(input())
lent = len(t)
num = lent
ls = []
count = 0
for i in range(len(s) - lent + 1):
st = s[i : i + num]
num += 1
for j in range(lent):
if st[j] != t[j]:
count += 1
ls.append(count)
count = 0
print((min(ls)))
| false | 26.315789 | [
"-fans = 100000000",
"-for i in range(len(s) - len(t) + 1):",
"- ans = 0",
"- for j in range(len(t)):",
"- if s[i + j] == t[j]:",
"- pass",
"- else:",
"- ans += 1",
"- fans = min(fans, ans)",
"-print(fans)",
"+lent = len(t)",
"+num = lent",
"+ls =... | false | 0.041911 | 0.038625 | 1.085083 | [
"s664522184",
"s422994580"
] |
u644907318 | p03426 | python | s023434437 | s826785706 | 1,141 | 508 | 75,996 | 111,296 | Accepted | Accepted | 55.48 | def dist(x,y):
return abs(x[0]-y[0])+abs(x[1]-y[1])
H,W,D = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(H)]
G = {}
for i in range(H):
for j in range(W):
G[A[i][j]] = (i,j)
C = {}
for j in range(1,D+1):
k = 1
C[j] = 0
while j+k*D<=H*W:
... | H,W,D = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(H)]
C = {i:0 for i in range(1,H*W+1)}
for i in range(H):
for j in range(W):
C[A[i][j]] = (i,j)
dist = {i:[] for i in range(1,D+1)}
for i in range(1,D+1):
dist[i].append(0)
y0,x0 = C[i]
for j in ra... | 19 | 24 | 479 | 643 | def dist(x, y):
return abs(x[0] - y[0]) + abs(x[1] - y[1])
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
G = {}
for i in range(H):
for j in range(W):
G[A[i][j]] = (i, j)
C = {}
for j in range(1, D + 1):
k = 1
C[j] = 0
while j + k * D <= H... | H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
C = {i: 0 for i in range(1, H * W + 1)}
for i in range(H):
for j in range(W):
C[A[i][j]] = (i, j)
dist = {i: [] for i in range(1, D + 1)}
for i in range(1, D + 1):
dist[i].append(0)
y0, x0 = C[i]
fo... | false | 20.833333 | [
"-def dist(x, y):",
"- return abs(x[0] - y[0]) + abs(x[1] - y[1])",
"-",
"-",
"-G = {}",
"+C = {i: 0 for i in range(1, H * W + 1)}",
"- G[A[i][j]] = (i, j)",
"-C = {}",
"-for j in range(1, D + 1):",
"- k = 1",
"- C[j] = 0",
"- while j + k * D <= H * W:",
"- C[j + k ... | false | 0.035455 | 0.042846 | 0.827514 | [
"s023434437",
"s826785706"
] |
u811817592 | p02756 | python | s048636034 | s924045205 | 449 | 408 | 4,596 | 4,596 | Accepted | Accepted | 9.13 | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = str(eval(input())) # contains spaces
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[2] == "1" else -1
h_or_t_flag... | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = eval(input()) # contains spaces
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[2] == "1" else -1
h_or_t_flag *= r... | 22 | 22 | 520 | 515 | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = str(eval(input())) # contains spaces
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[2] == "1" else -1
h_or_t_flag *= rev_flag
... | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = eval(input()) # contains spaces
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[2] == "1" else -1
h_or_t_flag *= rev_flag
... | false | 0 | [
"- query = str(eval(input())) # contains spaces",
"+ query = eval(input()) # contains spaces"
] | false | 0.035257 | 0.044035 | 0.800663 | [
"s048636034",
"s924045205"
] |
u072717685 | p02683 | python | s925587962 | s106882726 | 84 | 66 | 11,780 | 11,340 | Accepted | Accepted | 21.43 |
from itertools import combinations
from copy import deepcopy
def main():
n, m, x = list(map(int, input().split()))
books = []
for _ in range(n):
books.append(list(map(int, input().split())))
books_pattern = []
books_num = [i for i in range(n)]
for i1 in range(1, n + 1):
... | def main():
n, m, x = list(map(int, input().split()))
books = []
for _ in range(n):
books.append(tuple(map(int, input().split())))
books_set_all = []
for bit in range(1<<n):
books_set = [0] * (m + 1)
for i in range(n):
mask = 1 << i
if bit ... | 39 | 30 | 993 | 776 | from itertools import combinations
from copy import deepcopy
def main():
n, m, x = list(map(int, input().split()))
books = []
for _ in range(n):
books.append(list(map(int, input().split())))
books_pattern = []
books_num = [i for i in range(n)]
for i1 in range(1, n + 1):
books_p... | def main():
n, m, x = list(map(int, input().split()))
books = []
for _ in range(n):
books.append(tuple(map(int, input().split())))
books_set_all = []
for bit in range(1 << n):
books_set = [0] * (m + 1)
for i in range(n):
mask = 1 << i
if bit & mask:
... | false | 23.076923 | [
"-from itertools import combinations",
"-from copy import deepcopy",
"-",
"-",
"- books.append(list(map(int, input().split())))",
"- books_pattern = []",
"- books_num = [i for i in range(n)]",
"- for i1 in range(1, n + 1):",
"- books_pattern += list(combinations(books_num, i1)... | false | 0.04185 | 0.040052 | 1.0449 | [
"s925587962",
"s106882726"
] |
u941407962 | p02883 | python | s976572967 | s396668479 | 1,614 | 704 | 123,340 | 123,384 | Accepted | Accepted | 56.38 | import math
N,K=list(map(int,input().split()))
X=[(b,a*b)for a,b in zip(sorted(list(map(int,input().split()))),sorted(list(map(int,input().split())))[::-1])]
m,M,i=0,10**12,1
exec("i,M,m=((i+m)//2,i,m) if sum(math.ceil(max(0,c-i)/b)for b, c in X)<=K else((i+M)//2,M,i);"*50)
print(M) | N,K=list(map(int,input().split()))
X=[(b,a*b)for a,b in zip(sorted(list(map(int,input().split()))),sorted(list(map(int,input().split())))[::-1])]
m,M,i=0,2**40,1
exec("i,M,m=((i+m)//2,i,m) if -sum(min(0,i-c)//b for b, c in X)<=K else((i+M)//2,M,i);"*50)
print(M) | 6 | 5 | 282 | 260 | import math
N, K = list(map(int, input().split()))
X = [
(b, a * b)
for a, b in zip(
sorted(list(map(int, input().split()))),
sorted(list(map(int, input().split())))[::-1],
)
]
m, M, i = 0, 10**12, 1
exec(
"i,M,m=((i+m)//2,i,m) if sum(math.ceil(max(0,c-i)/b)for b, c in X)<=K else((i+M)/... | N, K = list(map(int, input().split()))
X = [
(b, a * b)
for a, b in zip(
sorted(list(map(int, input().split()))),
sorted(list(map(int, input().split())))[::-1],
)
]
m, M, i = 0, 2**40, 1
exec(
"i,M,m=((i+m)//2,i,m) if -sum(min(0,i-c)//b for b, c in X)<=K else((i+M)//2,M,i);"
* 50
)
p... | false | 16.666667 | [
"-import math",
"-",
"-m, M, i = 0, 10**12, 1",
"+m, M, i = 0, 2**40, 1",
"- \"i,M,m=((i+m)//2,i,m) if sum(math.ceil(max(0,c-i)/b)for b, c in X)<=K else((i+M)//2,M,i);\"",
"+ \"i,M,m=((i+m)//2,i,m) if -sum(min(0,i-c)//b for b, c in X)<=K else((i+M)//2,M,i);\""
] | false | 0.083951 | 0.039824 | 2.108041 | [
"s976572967",
"s396668479"
] |
u888092736 | p03331 | python | s777430695 | s161122017 | 260 | 150 | 9,072 | 9,000 | Accepted | Accepted | 42.31 | def digits_sum(n):
return sum(int(c) for c in str(n))
N = int(eval(input()))
ans = float("inf")
for i in range(1, N):
A = i
B = N - i
ans = min(ans, digits_sum(A) + digits_sum(B))
print(ans)
| def digit_sum(x):
res = 0
while x > 0:
res += x % 10
x //= 10
return res
N = int(eval(input()))
ans = N
for i in range(1, N):
A = i
B = N - i
ans = min(ans, digit_sum(A) + digit_sum(B))
print(ans)
| 11 | 15 | 213 | 247 | def digits_sum(n):
return sum(int(c) for c in str(n))
N = int(eval(input()))
ans = float("inf")
for i in range(1, N):
A = i
B = N - i
ans = min(ans, digits_sum(A) + digits_sum(B))
print(ans)
| def digit_sum(x):
res = 0
while x > 0:
res += x % 10
x //= 10
return res
N = int(eval(input()))
ans = N
for i in range(1, N):
A = i
B = N - i
ans = min(ans, digit_sum(A) + digit_sum(B))
print(ans)
| false | 26.666667 | [
"-def digits_sum(n):",
"- return sum(int(c) for c in str(n))",
"+def digit_sum(x):",
"+ res = 0",
"+ while x > 0:",
"+ res += x % 10",
"+ x //= 10",
"+ return res",
"-ans = float(\"inf\")",
"+ans = N",
"- ans = min(ans, digits_sum(A) + digits_sum(B))",
"+ ans = ... | false | 0.260383 | 0.170172 | 1.530114 | [
"s777430695",
"s161122017"
] |
u260036763 | p03470 | python | s353097506 | s542039462 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
d = [eval(input()) for i in range(n)]
print((len(set(d)))) | N = int(eval(input()))
d = [eval(input()) for i in range(N)]
print((len(set(d)))) | 3 | 3 | 69 | 69 | n = int(eval(input()))
d = [eval(input()) for i in range(n)]
print((len(set(d))))
| N = int(eval(input()))
d = [eval(input()) for i in range(N)]
print((len(set(d))))
| false | 0 | [
"-n = int(eval(input()))",
"-d = [eval(input()) for i in range(n)]",
"+N = int(eval(input()))",
"+d = [eval(input()) for i in range(N)]"
] | false | 0.036372 | 0.036077 | 1.008185 | [
"s353097506",
"s542039462"
] |
u832039789 | p03416 | python | s458017156 | s047133521 | 67 | 51 | 2,940 | 2,940 | Accepted | Accepted | 23.88 | a,b=list(map(int,input().split()))
res=0
for i in range(a,b+1):
s=str(i)
res += s==s[::-1]
print(res)
| a,b = list(map(int,input().split()))
res = 0
for i in range(a,b+1):
s = str(i)
if s == s[::-1]:
res += 1
print(res)
| 6 | 7 | 109 | 132 | a, b = list(map(int, input().split()))
res = 0
for i in range(a, b + 1):
s = str(i)
res += s == s[::-1]
print(res)
| a, b = list(map(int, input().split()))
res = 0
for i in range(a, b + 1):
s = str(i)
if s == s[::-1]:
res += 1
print(res)
| false | 14.285714 | [
"- res += s == s[::-1]",
"+ if s == s[::-1]:",
"+ res += 1"
] | false | 0.061863 | 0.0595 | 1.039715 | [
"s458017156",
"s047133521"
] |
u077291787 | p03645 | python | s858686442 | s064267600 | 325 | 266 | 19,016 | 19,004 | Accepted | Accepted | 18.15 | # ARC079C - Cat Snuke and a Voyage (ABC068C)
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
s, d = set(), set()
for _ in range(m):
a, b = list(map(int, input().rstrip().split()))
if a == 1:
s.add(b)
elif b == ... | # ARC079C - Cat Snuke and a Voyage (ABC068C)
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
s, d = set(), set()
for _ in range(m):
a, b = list(map(int, input().rstrip().split()))
if a == 1:
s.add(b)
elif b == ... | 19 | 18 | 458 | 426 | # ARC079C - Cat Snuke and a Voyage (ABC068C)
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
s, d = set(), set()
for _ in range(m):
a, b = list(map(int, input().rstrip().split()))
if a == 1:
s.add(b)
elif b == n:
... | # ARC079C - Cat Snuke and a Voyage (ABC068C)
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
s, d = set(), set()
for _ in range(m):
a, b = list(map(int, input().rstrip().split()))
if a == 1:
s.add(b)
elif b == n:
... | false | 5.263158 | [
"- ans = len(s & d)",
"- print((\"POSSIBLE\" if ans else \"IMPOSSIBLE\"))",
"+ print((\"POSSIBLE\" if s & d else \"IMPOSSIBLE\"))"
] | false | 0.235077 | 0.185639 | 1.266314 | [
"s858686442",
"s064267600"
] |
u606045429 | p03703 | python | s824984786 | s615416816 | 1,334 | 1,072 | 54,684 | 54,688 | Accepted | Accepted | 19.64 | from itertools import accumulate
def main():
class BIT:
def __init__(self, N):
self.size = N
self.tree = [0] * (N + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return ... | from itertools import accumulate
def main():
N, K, *A = list(map(int, open(0).read().split()))
B = [0] + list(accumulate(a - K for a in A))
memo = {n: i for i, n in enumerate(sorted(set(B)), 1)}
N += 1
tree = [0] * (N + 1)
def bit_sum(i):
s = 0
while i > 0:
... | 36 | 33 | 797 | 637 | from itertools import accumulate
def main():
class BIT:
def __init__(self, N):
self.size = N
self.tree = [0] * (N + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
d... | from itertools import accumulate
def main():
N, K, *A = list(map(int, open(0).read().split()))
B = [0] + list(accumulate(a - K for a in A))
memo = {n: i for i, n in enumerate(sorted(set(B)), 1)}
N += 1
tree = [0] * (N + 1)
def bit_sum(i):
s = 0
while i > 0:
s += tr... | false | 8.333333 | [
"- class BIT:",
"- def __init__(self, N):",
"- self.size = N",
"- self.tree = [0] * (N + 1)",
"-",
"- def sum(self, i):",
"- s = 0",
"- while i > 0:",
"- s += self.tree[i]",
"- i -= i & -i",
"- ... | false | 0.0455 | 0.086724 | 0.524658 | [
"s824984786",
"s615416816"
] |
u691018832 | p03487 | python | s383460926 | s364653505 | 100 | 79 | 20,880 | 18,392 | Accepted | Accepted | 21 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import Counter
n = int(readline())
a = tuple(map(int, readline().split()))
memo = tuple(Counter(a).items())
ans = 0
for x, y in memo:
if ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import Counter
n, *a = list(map(int, read().split()))
ans = 0
for k, v in list(Counter(a).items()):
if k > v:
ans += v
elif k ... | 18 | 16 | 391 | 347 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter
n = int(readline())
a = tuple(map(int, readline().split()))
memo = tuple(Counter(a).items())
ans = 0
for x, y in memo:
if x <= y:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter
n, *a = list(map(int, read().split()))
ans = 0
for k, v in list(Counter(a).items()):
if k > v:
ans += v
elif k < v:
a... | false | 11.111111 | [
"-n = int(readline())",
"-a = tuple(map(int, readline().split()))",
"-memo = tuple(Counter(a).items())",
"+n, *a = list(map(int, read().split()))",
"-for x, y in memo:",
"- if x <= y:",
"- ans += y - x",
"- else:",
"- ans += y",
"+for k, v in list(Counter(a).items()):",
"+ ... | false | 0.034528 | 0.045241 | 0.763208 | [
"s383460926",
"s364653505"
] |
u076917070 | p03687 | python | s539758311 | s799752704 | 39 | 26 | 3,316 | 3,064 | Accepted | Accepted | 33.33 | import sys
input=sys.stdin.readline
import collections
def main():
S = input().strip()
mi = len(S)
for c in list(collections.Counter(S).keys()):
s = list(S)
n = 0
while len(list(collections.Counter(s).keys())) > 1:
for i in range(len(s)-1):
if... | import sys
input=sys.stdin.readline
def main():
S = input().strip()
mi = len(S)
for c in set(S):
s = list(S)
n = 0
while len(set(s)) > 1:
for i in range(len(s)-1):
if s[i+1] == c:
s[i] = c
s.pop()
... | 21 | 20 | 475 | 409 | import sys
input = sys.stdin.readline
import collections
def main():
S = input().strip()
mi = len(S)
for c in list(collections.Counter(S).keys()):
s = list(S)
n = 0
while len(list(collections.Counter(s).keys())) > 1:
for i in range(len(s) - 1):
if s[i +... | import sys
input = sys.stdin.readline
def main():
S = input().strip()
mi = len(S)
for c in set(S):
s = list(S)
n = 0
while len(set(s)) > 1:
for i in range(len(s) - 1):
if s[i + 1] == c:
s[i] = c
s.pop()
n += 1... | false | 4.761905 | [
"-import collections",
"- for c in list(collections.Counter(S).keys()):",
"+ for c in set(S):",
"- while len(list(collections.Counter(s).keys())) > 1:",
"+ while len(set(s)) > 1:"
] | false | 0.039417 | 0.04207 | 0.93695 | [
"s539758311",
"s799752704"
] |
u395202850 | p02689 | python | s886731975 | s925459452 | 232 | 136 | 20,108 | 20,092 | Accepted | Accepted | 41.38 | def main():
n, m = list(map(int, input().split()))
hList = list(map(int, input().split()))
hAns = [1] * n
for i in range(m):
a, b = list(map(int, input().split()))
if hList[a - 1] > hList[b - 1]:
hAns[b - 1] = 0
continue
if hList[a - 1] < hList[b ... | import sys
readline = sys.stdin.readline
def main():
n, m = list(map(int, readline().rstrip().split()))
hList = list(map(int, readline().rstrip().split()))
hAns = [1] * n
for i in range(m):
a, b = list(map(int, readline().rstrip().split()))
if hList[a - 1] > hList[b - 1]:
... | 19 | 23 | 481 | 564 | def main():
n, m = list(map(int, input().split()))
hList = list(map(int, input().split()))
hAns = [1] * n
for i in range(m):
a, b = list(map(int, input().split()))
if hList[a - 1] > hList[b - 1]:
hAns[b - 1] = 0
continue
if hList[a - 1] < hList[b - 1]:
... | import sys
readline = sys.stdin.readline
def main():
n, m = list(map(int, readline().rstrip().split()))
hList = list(map(int, readline().rstrip().split()))
hAns = [1] * n
for i in range(m):
a, b = list(map(int, readline().rstrip().split()))
if hList[a - 1] > hList[b - 1]:
... | false | 17.391304 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+",
"+",
"- n, m = list(map(int, input().split()))",
"- hList = list(map(int, input().split()))",
"+ n, m = list(map(int, readline().rstrip().split()))",
"+ hList = list(map(int, readline().rstrip().split()))",
"- a, b = lis... | false | 0.037773 | 0.038182 | 0.989294 | [
"s886731975",
"s925459452"
] |
u358919705 | p00008 | python | s542545460 | s239306531 | 230 | 190 | 7,672 | 7,720 | Accepted | Accepted | 17.39 | import itertools
while True:
try:
n = int(eval(input()))
ans = 0
for a in itertools.product(list(range(10)), repeat=4):
if n == sum(a):
ans += 1
print(ans)
except:
break | import itertools
while True:
try:print(([sum(a)for a in itertools.product(list(range(10)),repeat=4)].count(int(eval(input())))))
except:break | 11 | 4 | 243 | 132 | import itertools
while True:
try:
n = int(eval(input()))
ans = 0
for a in itertools.product(list(range(10)), repeat=4):
if n == sum(a):
ans += 1
print(ans)
except:
break
| import itertools
while True:
try:
print(
(
[sum(a) for a in itertools.product(list(range(10)), repeat=4)].count(
int(eval(input()))
)
)
)
except:
break
| false | 63.636364 | [
"- n = int(eval(input()))",
"- ans = 0",
"- for a in itertools.product(list(range(10)), repeat=4):",
"- if n == sum(a):",
"- ans += 1",
"- print(ans)",
"+ print(",
"+ (",
"+ [sum(a) for a in itertools.product(list... | false | 0.050956 | 0.046683 | 1.091527 | [
"s542545460",
"s239306531"
] |
u475065881 | p03283 | python | s600925083 | s875248144 | 1,506 | 1,006 | 8,456 | 18,856 | Accepted | Accepted | 33.2 | N, M , Q = list(map(int, input().split()))
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
L, R = list(map(int, input().split()))
LR[L][R-L+1] += 1
for i in range(2,N+2):
for j in range(1,N-i+2):
LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
for i in range(... | N, M , Q = list(map(int, input().split()))
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
L, R = list(map(int, input().split()))
LR[L][R-L+1] += 1
for i in range(2,N+2):
for j in range(1,N-i+2):
LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
A = []
for i in r... | 15 | 18 | 382 | 422 | N, M, Q = list(map(int, input().split()))
LR = [[0 for _ in range(N + 2 - i)] for i in range(N + 2)]
for i in range(M):
L, R = list(map(int, input().split()))
LR[L][R - L + 1] += 1
for i in range(2, N + 2):
for j in range(1, N - i + 2):
LR[j][i] += LR[j][i - 1] + LR[j + 1][i - 1] - LR[j + 1][i - 2]
... | N, M, Q = list(map(int, input().split()))
LR = [[0 for _ in range(N + 2 - i)] for i in range(N + 2)]
for i in range(M):
L, R = list(map(int, input().split()))
LR[L][R - L + 1] += 1
for i in range(2, N + 2):
for j in range(1, N - i + 2):
LR[j][i] += LR[j][i - 1] + LR[j + 1][i - 1] - LR[j + 1][i - 2]
... | false | 16.666667 | [
"+A = []",
"- print((LR[p][q - p + 1] - LR[q + 1][0]))",
"+ A.append(LR[p][q - p + 1] - LR[q + 1][0])",
"+print((\"\\n\".join(map(str, A))))"
] | false | 0.042722 | 0.042467 | 1.005999 | [
"s600925083",
"s875248144"
] |
u737298927 | p02696 | python | s531203351 | s451216258 | 22 | 20 | 9,196 | 9,068 | Accepted | Accepted | 9.09 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
a, b, n = list(map(int, input().split()))
def f(x):
return a*x//b-a*(x//b)
high = n
low = 0
while high - low >= 1:
mid_left = high/3+low*2/3
mid_right = high*2/3+low/3
if f(mid_left) <= f(mid_right):
low = mid_left
else:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
a, b, n = list(map(int, input().split()))
if n >= b:
x = b-1
else:
x = n
print((a*x//b-a*(x//b))) | 19 | 11 | 373 | 159 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
a, b, n = list(map(int, input().split()))
def f(x):
return a * x // b - a * (x // b)
high = n
low = 0
while high - low >= 1:
mid_left = high / 3 + low * 2 / 3
mid_right = high * 2 / 3 + low / 3
if f(mid_left) <= f(mid_right):
low = mid_left
e... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
a, b, n = list(map(int, input().split()))
if n >= b:
x = b - 1
else:
x = n
print((a * x // b - a * (x // b)))
| false | 42.105263 | [
"-",
"-",
"-def f(x):",
"- return a * x // b - a * (x // b)",
"-",
"-",
"-high = n",
"-low = 0",
"-while high - low >= 1:",
"- mid_left = high / 3 + low * 2 / 3",
"- mid_right = high * 2 / 3 + low / 3",
"- if f(mid_left) <= f(mid_right):",
"- low = mid_left",
"- else:... | false | 0.034095 | 0.03595 | 0.948415 | [
"s531203351",
"s451216258"
] |
u562935282 | p02586 | python | s683665676 | s467202731 | 1,392 | 400 | 223,224 | 145,528 | Accepted | Accepted | 71.26 | def main():
import sys
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
G = [[0] * W for _ in range(H)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
G[r - 1][c - 1] = v
pdp = [[0] * 4 for _ in range(W)]
for r in range(H):
... | # https://atcoder.jp/contests/abc175/submissions/15965930
def main():
import sys
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
G = [[0] * W for _ in range(H)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
G[r - 1][c - 1] = v
... | 47 | 47 | 1,084 | 1,144 | def main():
import sys
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
G = [[0] * W for _ in range(H)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
G[r - 1][c - 1] = v
pdp = [[0] * 4 for _ in range(W)]
for r in range(H):
dp = [[0]... | # https://atcoder.jp/contests/abc175/submissions/15965930
def main():
import sys
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))
G = [[0] * W for _ in range(H)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
G[r - 1][c - 1] = v
dp0 = [0] * (W +... | false | 0 | [
"+# https://atcoder.jp/contests/abc175/submissions/15965930",
"- pdp = [[0] * 4 for _ in range(W)]",
"+ dp0 = [0] * (W + 1)",
"+ dp1 = [0] * (W + 1)",
"+ dp2 = [0] * (W + 1)",
"+ dp3 = [0] * (W + 1)",
"+ # dpx:=行内取得x個以下の最大値",
"+ # <cは更新済の同じ行の値",
"+ # c<=は前の行の値",
"- d... | false | 0.036526 | 0.035547 | 1.02755 | [
"s683665676",
"s467202731"
] |
u057109575 | p02925 | python | s990899573 | s731903273 | 1,175 | 689 | 153,788 | 197,748 | Accepted | Accepted | 41.36 | from collections import deque
N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
graph = [[] for _ in range(N * N)]
ins = [0] * (N * N)
for i, nodes in enumerate(A):
for j1, j2 in zip(nodes[:-1], nodes[1:]):
n1 = max(i, j1 - 1) * N + min(i, j1 - 1)
n2 = max(... | from collections import deque
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
graph = [[] for _ in range(N * N)]
ins = [0] * (N * N)
for i, nodes in enumerate(X):
for j1, j2 in zip(nodes[:-1], nodes[1:]):
n1 = max(i, j1 - 1) * N + min(i, j1 - 1)
n2 = max(... | 39 | 40 | 896 | 888 | from collections import deque
N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
graph = [[] for _ in range(N * N)]
ins = [0] * (N * N)
for i, nodes in enumerate(A):
for j1, j2 in zip(nodes[:-1], nodes[1:]):
n1 = max(i, j1 - 1) * N + min(i, j1 - 1)
n2 = max(i, j2 - 1) * ... | from collections import deque
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
graph = [[] for _ in range(N * N)]
ins = [0] * (N * N)
for i, nodes in enumerate(X):
for j1, j2 in zip(nodes[:-1], nodes[1:]):
n1 = max(i, j1 - 1) * N + min(i, j1 - 1)
n2 = max(i, j2 - 1) * ... | false | 2.5 | [
"-A = [list(map(int, input().split())) for _ in range(N)]",
"+X = [list(map(int, input().split())) for _ in range(N)]",
"-for i, nodes in enumerate(A):",
"+for i, nodes in enumerate(X):",
"+dist = [0] * (N * N)",
"+q = deque()",
"-que = deque()",
"- que.append((i, 1))",
"-dist = [0] * (N * N)... | false | 0.039188 | 0.038394 | 1.020688 | [
"s990899573",
"s731903273"
] |
u784022244 | p02983 | python | s833871999 | s828097267 | 735 | 134 | 3,060 | 65,124 | Accepted | Accepted | 81.77 | L,R=list(map(int, input().split()))
#2019の倍数が入っていれば0→R-Lが2019以上
if R-L>=2019:
print((0))
exit()
ans=2019
for i in range(L,R):
for j in range(i+1,R+1):
ans=min(ans, (i*j)%2019)
print(ans) | L, R=list(map(int, input().split()))
if R - L >= 2019:
print((0))
else:
ans=float("INF")
for i in range(L, R):
for j in range(i+1,R+1):
ans=min(ans, (i*j)%2019)
print(ans) | 11 | 11 | 209 | 215 | L, R = list(map(int, input().split()))
# 2019の倍数が入っていれば0→R-Lが2019以上
if R - L >= 2019:
print((0))
exit()
ans = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
| L, R = list(map(int, input().split()))
if R - L >= 2019:
print((0))
else:
ans = float("INF")
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
| false | 0 | [
"-# 2019の倍数が入っていれば0→R-Lが2019以上",
"- exit()",
"-ans = 2019",
"-for i in range(L, R):",
"- for j in range(i + 1, R + 1):",
"- ans = min(ans, (i * j) % 2019)",
"-print(ans)",
"+else:",
"+ ans = float(\"INF\")",
"+ for i in range(L, R):",
"+ for j in range(i + 1, R + 1):",
... | false | 0.006863 | 0.063537 | 0.108017 | [
"s833871999",
"s828097267"
] |
u361826811 | p02881 | python | s862137978 | s230455497 | 290 | 156 | 12,516 | 3,188 | Accepted | Accepted | 46.21 | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
import itertools
# import math
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 13
N = int(readline())
temp = INF
a = 0
b = 0
for i in range(1, int(N... | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
import itertools
# import math
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 13
N = int(readline())
temp = INF
a = 0
b = 0
for i in range(1, int... | 28 | 31 | 479 | 488 | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
import itertools
# import math
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**13
N = int(readline())
temp = INF
a = 0
b = 0
for i in range(1, int(N**0.5) + 1):
if N % i ... | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
import itertools
# import math
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**13
N = int(readline())
temp = INF
a = 0
b = 0
for i in range(1, int(N**0.5) + 1):
if N % i... | false | 9.677419 | [
"-import numpy as np",
"-",
"+# import numpy as np"
] | false | 0.03802 | 0.03754 | 1.012788 | [
"s862137978",
"s230455497"
] |
u347640436 | p02819 | python | s404048032 | s822902325 | 255 | 192 | 48,540 | 48,572 | Accepted | Accepted | 24.71 | # エラトステネスの篩
def make_prime_table(n):
sieve = list(range(n + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(2, int(n ** 0.5) + 1):
if sieve[i] != i:
continue
for j in range(i * i, n + 1, i):
if sieve[j] == j:
sieve[j] = i
return sieve... | def make_prime_table(n):
sieve = list(range(n + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(4, n + 1, 2):
sieve[i] = 2
for i in range(3, int(n ** 0.5) + 1, 2):
if sieve[i] != i:
continue
for j in range(i * i, n + 1, i * 2):
if sieve[j] == ... | 22 | 22 | 482 | 530 | # エラトステネスの篩
def make_prime_table(n):
sieve = list(range(n + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(2, int(n**0.5) + 1):
if sieve[i] != i:
continue
for j in range(i * i, n + 1, i):
if sieve[j] == j:
sieve[j] = i
return sieve
X = int(ev... | def make_prime_table(n):
sieve = list(range(n + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(4, n + 1, 2):
sieve[i] = 2
for i in range(3, int(n**0.5) + 1, 2):
if sieve[i] != i:
continue
for j in range(i * i, n + 1, i * 2):
if sieve[j] == j:
... | false | 0 | [
"-# エラトステネスの篩",
"- for i in range(2, int(n**0.5) + 1):",
"+ for i in range(4, n + 1, 2):",
"+ sieve[i] = 2",
"+ for i in range(3, int(n**0.5) + 1, 2):",
"- for j in range(i * i, n + 1, i):",
"+ for j in range(i * i, n + 1, i * 2):"
] | false | 0.624793 | 0.45929 | 1.360345 | [
"s404048032",
"s822902325"
] |
u033606236 | p03266 | python | s903386351 | s172592627 | 99 | 85 | 10,996 | 11,032 | Accepted | Accepted | 14.14 | N,K = list(map(int,input().split()))
odd = []
even1 = []
even2 = []
if K % 2 == 1:
for i in range(1,N+1):
if i % K == 0:
odd += [i]
ans = len(odd) ** 3
else:
for i in range(1,N+1):
if i % K == 0:
even1 += [i]
elif i % (K/2) == 0:
even... | N,K = list(map(int,input().split()))
ary1 = []
ary2 = []
if K % 2 == 1:
for i in range(K,N+1,K):
ary1 += [i]
print((len(ary1)**3))
else:
for i in range(1,N+1):
if i % K == 0:
ary1 += [i]
elif i % (K//2) == 0:
ary2 += [i]
print(((len(ary1) ** 3... | 17 | 14 | 379 | 333 | N, K = list(map(int, input().split()))
odd = []
even1 = []
even2 = []
if K % 2 == 1:
for i in range(1, N + 1):
if i % K == 0:
odd += [i]
ans = len(odd) ** 3
else:
for i in range(1, N + 1):
if i % K == 0:
even1 += [i]
elif i % (K / 2) == 0:
even2 +=... | N, K = list(map(int, input().split()))
ary1 = []
ary2 = []
if K % 2 == 1:
for i in range(K, N + 1, K):
ary1 += [i]
print((len(ary1) ** 3))
else:
for i in range(1, N + 1):
if i % K == 0:
ary1 += [i]
elif i % (K // 2) == 0:
ary2 += [i]
print(((len(ary1) ** 3... | false | 17.647059 | [
"-odd = []",
"-even1 = []",
"-even2 = []",
"+ary1 = []",
"+ary2 = []",
"- for i in range(1, N + 1):",
"- if i % K == 0:",
"- odd += [i]",
"- ans = len(odd) ** 3",
"+ for i in range(K, N + 1, K):",
"+ ary1 += [i]",
"+ print((len(ary1) ** 3))",
"- ... | false | 0.105899 | 0.09364 | 1.13092 | [
"s903386351",
"s172592627"
] |
u695811449 | p03017 | python | s548031229 | s823461940 | 236 | 138 | 41,480 | 6,392 | Accepted | Accepted | 41.53 | import sys
input = sys.stdin.readline
N,A,B,C,D=list(map(int,input().split()))
S=input().strip()
S+="#####"
A-=1
B-=1
C-=1
D-=1
if C<D:
while B!=D or A!=C:
#print(A,B)
if B!=D and S[B+1]==".":
B+=1
elif B!=D and S[B+2]==".":
B+=2
elif B!... | import sys
input = sys.stdin.readline
N,A,B,C,D=list(map(int,input().split()))
S=input().strip()
BLOCK=[0]*N
OPEN=[0]*N
for i in range(1,N):
if S[i]=="#" and S[i-1]=="#":
BLOCK[i]=1
for i in range(2,N):
if S[i]==S[i-1]==S[i-2]==".":
OPEN[i]=1
RIGHT_A=N-1
for i in range(A,N... | 98 | 46 | 1,884 | 815 | import sys
input = sys.stdin.readline
N, A, B, C, D = list(map(int, input().split()))
S = input().strip()
S += "#####"
A -= 1
B -= 1
C -= 1
D -= 1
if C < D:
while B != D or A != C:
# print(A,B)
if B != D and S[B + 1] == ".":
B += 1
elif B != D and S[B + 2] == ".":
B ... | import sys
input = sys.stdin.readline
N, A, B, C, D = list(map(int, input().split()))
S = input().strip()
BLOCK = [0] * N
OPEN = [0] * N
for i in range(1, N):
if S[i] == "#" and S[i - 1] == "#":
BLOCK[i] = 1
for i in range(2, N):
if S[i] == S[i - 1] == S[i - 2] == ".":
OPEN[i] = 1
RIGHT_A = N -... | false | 53.061224 | [
"-S += \"#####\"",
"-A -= 1",
"-B -= 1",
"-C -= 1",
"-D -= 1",
"-if C < D:",
"- while B != D or A != C:",
"- # print(A,B)",
"- if B != D and S[B + 1] == \".\":",
"- B += 1",
"- elif B != D and S[B + 2] == \".\":",
"- B += 2",
"- elif B != ... | false | 0.074848 | 0.007211 | 10.379744 | [
"s548031229",
"s823461940"
] |
u416758623 | p03493 | python | s499009951 | s105915829 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | sentence = eval(input())
count = 0
for i in range(len(sentence)):
if sentence[i] == "1":
count+=1
print(count)
| s = eval(input())
print((s.count("1"))) | 7 | 2 | 124 | 32 | sentence = eval(input())
count = 0
for i in range(len(sentence)):
if sentence[i] == "1":
count += 1
print(count)
| s = eval(input())
print((s.count("1")))
| false | 71.428571 | [
"-sentence = eval(input())",
"-count = 0",
"-for i in range(len(sentence)):",
"- if sentence[i] == \"1\":",
"- count += 1",
"-print(count)",
"+s = eval(input())",
"+print((s.count(\"1\")))"
] | false | 0.086733 | 0.088695 | 0.977879 | [
"s499009951",
"s105915829"
] |
u571969099 | p02632 | python | s474674633 | s748872887 | 1,216 | 1,053 | 164,672 | 163,368 | Accepted | Accepted | 13.4 | mod = 10 ** 9 + 7
max_kai = 5*10**6
kai = [1]
for i in range(1, max_kai):
kai.append(kai[-1] * i % mod)
kkai = [0] * max_kai
kkai[-1] = pow(kai[-1], mod - 2, mod)
for i in reversed(list(range(1, max_kai))):
kkai[i - 1] = kkai[i] * i % mod
def comb(a, b):
if a < 0 or b < 0:
return 0
... | mod = 10 ** 9 + 7
max_kai = 2*10**6
kai = [1]
for i in range(1, max_kai):
kai.append(kai[-1] * i % mod)
kkai = [0] * max_kai
kkai[-1] = pow(kai[-1], mod - 2, mod)
for i in reversed(list(range(1, max_kai))):
kkai[i - 1] = kkai[i] * i % mod
def comb(a, b):
if a < 0 or b < 0:
return 0
... | 31 | 31 | 639 | 618 | mod = 10**9 + 7
max_kai = 5 * 10**6
kai = [1]
for i in range(1, max_kai):
kai.append(kai[-1] * i % mod)
kkai = [0] * max_kai
kkai[-1] = pow(kai[-1], mod - 2, mod)
for i in reversed(list(range(1, max_kai))):
kkai[i - 1] = kkai[i] * i % mod
def comb(a, b):
if a < 0 or b < 0:
return 0
elif a < b:... | mod = 10**9 + 7
max_kai = 2 * 10**6
kai = [1]
for i in range(1, max_kai):
kai.append(kai[-1] * i % mod)
kkai = [0] * max_kai
kkai[-1] = pow(kai[-1], mod - 2, mod)
for i in reversed(list(range(1, max_kai))):
kkai[i - 1] = kkai[i] * i % mod
def comb(a, b):
if a < 0 or b < 0:
return 0
elif a < b:... | false | 0 | [
"-max_kai = 5 * 10**6",
"+max_kai = 2 * 10**6",
"-for i in range(len(s), len(s) + k + 1):",
"- ans += (",
"- pow(25, i - len(s), mod)",
"- * pow(26, len(s) + k - i, mod)",
"- * comb(i - 1, len(s) - 1)",
"- )",
"+for i in range(k + 1):",
"+ ans += pow(25, i, mod) * pow... | false | 2.9647 | 1.967182 | 1.507079 | [
"s474674633",
"s748872887"
] |
u367701763 | p03053 | python | s009381530 | s695011177 | 986 | 314 | 248,320 | 149,464 | Accepted | Accepted | 68.15 | # https://atcoder.jp/contests/agc033/tasks/agc033_a
from collections import deque
import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
move = [(1, 0), (-1, 0), (0, 1), (0, -1)] # 動ける場所の候補
def debug(start, goal, p, t):
player = p
debug_grid = list(list(grid[h]) for h in range(H)... | # https://atcoder.jp/contests/agc033/tasks/agc033_a
from collections import deque
import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
move = [(1, 0), (-1, 0), (0, 1), (0, -1)] # 動ける場所の候補
def debug(start, goal, p, t):
player = p
debug_grid = list(list(grid[h]) for h in range(H)... | 62 | 61 | 2,304 | 2,301 | # https://atcoder.jp/contests/agc033/tasks/agc033_a
from collections import deque
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
move = [(1, 0), (-1, 0), (0, 1), (0, -1)] # 動ける場所の候補
def debug(start, goal, p, t):
player = p
debug_grid = list(list(grid[h]) for h in range(H))
if start !... | # https://atcoder.jp/contests/agc033/tasks/agc033_a
from collections import deque
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
move = [(1, 0), (-1, 0), (0, 1), (0, -1)] # 動ける場所の候補
def debug(start, goal, p, t):
player = p
debug_grid = list(list(grid[h]) for h in range(H))
if start !... | false | 1.612903 | [
"-def search(grid, next_set, goal=(None, None), visit=set()):",
"- visit.add(start) # スタート地点はすでに訪れている",
"+def bfs(grid, next_set, goal, visit):",
"+ visit[start[0]][start[1]] = 1 # スタート地点はすでに訪れている",
"- if q in visit: # 一度訪れていた場合は進まない",
"+ if visit[q[0]][q[1]] == 1: # 一度訪れてい... | false | 0.08761 | 0.048648 | 1.800892 | [
"s009381530",
"s695011177"
] |
u816631826 | p04039 | python | s500785182 | s774051850 | 183 | 75 | 40,412 | 9,192 | Accepted | Accepted | 59.02 | n, k = list(map(int, input().split()))
d = list(input().split())
from itertools import count
for i in count(n):
s = str(i)
for bit in s:
if bit in d:
break
else:
print(i)
break
| n,k = list(map(int, input().split()))
d = list(map(int, input().split()))
def v(n):
for c in map(int, str(n)):
if (c in d):
return False
return True
while (v(n) == False):
n += 1
print(n) | 14 | 10 | 235 | 222 | n, k = list(map(int, input().split()))
d = list(input().split())
from itertools import count
for i in count(n):
s = str(i)
for bit in s:
if bit in d:
break
else:
print(i)
break
| n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
def v(n):
for c in map(int, str(n)):
if c in d:
return False
return True
while v(n) == False:
n += 1
print(n)
| false | 28.571429 | [
"-d = list(input().split())",
"-from itertools import count",
"+d = list(map(int, input().split()))",
"-for i in count(n):",
"- s = str(i)",
"- for bit in s:",
"- if bit in d:",
"- break",
"- else:",
"- print(i)",
"- break",
"+",
"+def v(n):",
"+ ... | false | 0.072611 | 0.083091 | 0.873871 | [
"s500785182",
"s774051850"
] |
u334712262 | p02679 | python | s449719819 | s355109736 | 762 | 521 | 223,304 | 168,104 | Accepted | Accepted | 31.63 | # -*- coding: utf-8 -*-
from collections import Counter, defaultdict, deque
import math
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
... | # -*- coding: utf-8 -*-
from collections import Counter, defaultdict, deque
import math
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
... | 131 | 130 | 2,479 | 2,457 | # -*- coding: utf-8 -*-
from collections import Counter, defaultdict, deque
import math
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int... | # -*- coding: utf-8 -*-
from collections import Counter, defaultdict, deque
import math
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int... | false | 0.763359 | [
"- error_print(adb)"
] | false | 0.143035 | 0.108275 | 1.321031 | [
"s449719819",
"s355109736"
] |
u185249212 | p02690 | python | s381066377 | s319294315 | 499 | 201 | 78,340 | 78,232 | Accepted | Accepted | 59.72 |
import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import... |
import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import... | 118 | 82 | 2,350 | 1,531 | import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import heappush
from heapq import he... | import sys
sys.setrecursionlimit(500000)
import re
import array
import copy
import functools
import operator
import math
import string
import fractions
from fractions import Fraction
import collections
import itertools
import bisect
import random
import time
import heapq
from heapq import heappush
from heapq import he... | false | 30.508475 | [
"-def check(a, b, x):",
"- a = round(a)",
"- return a**5 - b**5 == x",
"-",
"-",
"-def fifthroot(n):",
"- for i in range(int(n ** (1 / 5) + 1)):",
"- if i**5 == n:",
"- return i",
"- return -1",
"-",
"-",
"- # b>=0 のとき",
"- # #",
"- # a=(x + b**5)**... | false | 0.038912 | 0.085681 | 0.454156 | [
"s381066377",
"s319294315"
] |
u539895865 | p03455 | python | s103483660 | s528683168 | 28 | 23 | 9,008 | 9,108 | Accepted | Accepted | 17.86 | a,b=list(map(int,input().split()))
m=a*b
if m%2==1:
print('Odd')
else:
print('Even') | a,b=list(map(int,input().split(' ')))
m=a*b
if m%2==1:
print('Odd')
else:
print('Even') | 6 | 6 | 87 | 90 | a, b = list(map(int, input().split()))
m = a * b
if m % 2 == 1:
print("Odd")
else:
print("Even")
| a, b = list(map(int, input().split(" ")))
m = a * b
if m % 2 == 1:
print("Odd")
else:
print("Even")
| false | 0 | [
"-a, b = list(map(int, input().split()))",
"+a, b = list(map(int, input().split(\" \")))"
] | false | 0.049118 | 0.172227 | 0.285195 | [
"s103483660",
"s528683168"
] |
u440566786 | p02860 | python | s353352598 | s706235612 | 189 | 168 | 38,384 | 38,256 | Accepted | Accepted | 11.11 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
if(n&1):
print("No")
return
S=eval(input())
a=S[:n//2]
b=S[n//2:]
print(("Yes" if(a==b) else "No"))
resolve() | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
if(n&1):
print("No")
return
S=eval(input())
print(("Yes" if(S[:n//2]==S[n//2:]) else "No"))
resolve() | 15 | 14 | 303 | 286 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
if n & 1:
print("No")
return
S = eval(input())
a = S[: n // 2]
b = S[n // 2 :]
print(("Yes" if (a == b) else "No"... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
if n & 1:
print("No")
return
S = eval(input())
print(("Yes" if (S[: n // 2] == S[n // 2 :]) else "No"))
resolve()
| false | 6.666667 | [
"- a = S[: n // 2]",
"- b = S[n // 2 :]",
"- print((\"Yes\" if (a == b) else \"No\"))",
"+ print((\"Yes\" if (S[: n // 2] == S[n // 2 :]) else \"No\"))"
] | false | 0.033642 | 0.031162 | 1.079578 | [
"s353352598",
"s706235612"
] |
u221301671 | p02713 | python | s013462481 | s739030667 | 833 | 680 | 9,212 | 9,096 | Accepted | Accepted | 18.37 | k = int(eval(input()))
s = 0
for i1 in range(1, k+1):
for i2 in range(1, i1+1):
x1, x2 = i1, i2
while x2 != 0:
x1, x2 = x2, x1 % x2
gcd1 = x1
s2 = i1 == i2
for i3 in range(i1, k+1):
x1, x2 = gcd1, i3
while x2 != 0:
... | k = int(eval(input()))
s = 0
# 3つ違う
for i1 in range(1, k+1):
s = s + i1
for i2 in range(1, i1):
x1, x2 = i1, i2
while x2 != 0:
x1, x2 = x2, x1 % x2
gcd1 = x1
s = s + gcd1 * 6
for i3 in range(i1+1, k+1):
x1, x2 = gcd1, i3
... | 24 | 20 | 582 | 432 | k = int(eval(input()))
s = 0
for i1 in range(1, k + 1):
for i2 in range(1, i1 + 1):
x1, x2 = i1, i2
while x2 != 0:
x1, x2 = x2, x1 % x2
gcd1 = x1
s2 = i1 == i2
for i3 in range(i1, k + 1):
x1, x2 = gcd1, i3
while x2 != 0:
x1,... | k = int(eval(input()))
s = 0
# 3つ違う
for i1 in range(1, k + 1):
s = s + i1
for i2 in range(1, i1):
x1, x2 = i1, i2
while x2 != 0:
x1, x2 = x2, x1 % x2
gcd1 = x1
s = s + gcd1 * 6
for i3 in range(i1 + 1, k + 1):
x1, x2 = gcd1, i3
while x2 ... | false | 16.666667 | [
"+# 3つ違う",
"- for i2 in range(1, i1 + 1):",
"+ s = s + i1",
"+ for i2 in range(1, i1):",
"- s2 = i1 == i2",
"- for i3 in range(i1, k + 1):",
"+ s = s + gcd1 * 6",
"+ for i3 in range(i1 + 1, k + 1):",
"- s3 = i2 == i3 or i1 == i3",
"- if s2... | false | 0.076965 | 0.079244 | 0.971248 | [
"s013462481",
"s739030667"
] |
u687574784 | p02983 | python | s459659567 | s183246513 | 1,226 | 54 | 3,188 | 10,696 | Accepted | Accepted | 95.6 | def mod2019(x, y):
return (x%2019 * y%2019 ) % 2019
L,R = list(map(int, input().split()))
ans=2019
s=set()
for i in range(L,R+1):
if i%2019 in s:
break
s.add(i%2019)
l = list(s)
for i in range(len(l)):
for j in range(i+1, len(l)):
# print(i, j, l[i], l[j], mod2019(l[i], l[j]... | L,R = list(map(int, input().split()))
if R-L >= 2019:
print((0))
exit()
s=set()
for i in range(L,R+1):
if i%2019 in s:
break
s.add(i%2019)
l = list(s)
if 3 in l and 673 in l:
print((0))
exit()
print((min([(i*j)%2019 for i in l for j in l if i != j]))) | 17 | 17 | 383 | 304 | def mod2019(x, y):
return (x % 2019 * y % 2019) % 2019
L, R = list(map(int, input().split()))
ans = 2019
s = set()
for i in range(L, R + 1):
if i % 2019 in s:
break
s.add(i % 2019)
l = list(s)
for i in range(len(l)):
for j in range(i + 1, len(l)):
# print(i, j, l[i], l[j], mod20... | L, R = list(map(int, input().split()))
if R - L >= 2019:
print((0))
exit()
s = set()
for i in range(L, R + 1):
if i % 2019 in s:
break
s.add(i % 2019)
l = list(s)
if 3 in l and 673 in l:
print((0))
exit()
print((min([(i * j) % 2019 for i in l for j in l if i != j])))
| false | 0 | [
"-def mod2019(x, y):",
"- return (x % 2019 * y % 2019) % 2019",
"-",
"-",
"-ans = 2019",
"+if R - L >= 2019:",
"+ print((0))",
"+ exit()",
"-for i in range(len(l)):",
"- for j in range(i + 1, len(l)):",
"- # print(i, j, l[i], l[j], mod2019(l[i], l[j]))",
"- ans... | false | 0.178849 | 0.041772 | 4.281547 | [
"s459659567",
"s183246513"
] |
u020390084 | p02971 | python | s020788463 | s363473219 | 549 | 350 | 14,108 | 14,104 | Accepted | Accepted | 36.25 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
sortA = sorted(a, reverse=True)
maxA = sortA[0]
semiMaxA = sortA[1]
for i in range(n):
if a[i] == maxA:
print(semiMaxA)
else:
print(maxA) | #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[int]"):
B = sorted(A)
max_A = B[-1]
submax_A = B[-2]
for i in range(N):
if A[i] == max_A:
print(submax_A)
else:
print(max_A)
return
def main():
def iterate_tokens():
... | 12 | 28 | 216 | 609 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
sortA = sorted(a, reverse=True)
maxA = sortA[0]
semiMaxA = sortA[1]
for i in range(n):
if a[i] == maxA:
print(semiMaxA)
else:
print(maxA)
| #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[int]"):
B = sorted(A)
max_A = B[-1]
submax_A = B[-2]
for i in range(N):
if A[i] == max_A:
print(submax_A)
else:
print(max_A)
return
def main():
def iterate_tokens():
for line in sys.s... | false | 57.142857 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"-sortA = sorted(a, reverse=True)",
"-maxA = sortA[0]",
"-semiMaxA = sortA[1]",
"-for i in range(n):",
"- if a[i] == maxA:",
"- print(semiMaxA)",
"- else:",
"- print(maxA)",
"+#!/usr/bin/env python3",
... | false | 0.04113 | 0.042523 | 0.967236 | [
"s020788463",
"s363473219"
] |
u729133443 | p04003 | python | s014781845 | s150736330 | 2,574 | 2,257 | 178,068 | 182,140 | Accepted | Accepted | 12.32 | def main():
from heapq import heappush,heappop,heapify
inf=2**31-1
n,m,*t=list(map(int,open(0).read().split()))
z=[]
for a,b,c in zip(t[::3],t[1::3],t[2::3]):
z.extend([a,b,a+n*c,b+n*c])
z={i:v for v,i in enumerate(sorted(set(z)))}
try:
z[1]
except:
print((-1))
exit()
edge... | from subprocess import*
call(('pypy3','-c',"""
def main():
from heapq import heappush,heappop,heapify
inf=2**31-1
n,m,*t=map(int,open(0).read().split())
z=[]
for a,b,c in zip(t[::3],t[1::3],t[2::3]):
z.extend([a,b,a+n*c,b+n*c])
z={i:v for v,i in enumerate(sorted(set(z)))}
try:
z[1]
e... | 42 | 45 | 1,027 | 1,083 | def main():
from heapq import heappush, heappop, heapify
inf = 2**31 - 1
n, m, *t = list(map(int, open(0).read().split()))
z = []
for a, b, c in zip(t[::3], t[1::3], t[2::3]):
z.extend([a, b, a + n * c, b + n * c])
z = {i: v for v, i in enumerate(sorted(set(z)))}
try:
z[1]
... | from subprocess import *
call(
(
"pypy3",
"-c",
"""
def main():
from heapq import heappush,heappop,heapify
inf=2**31-1
n,m,*t=map(int,open(0).read().split())
z=[]
for a,b,c in zip(t[::3],t[1::3],t[2::3]):
z.extend([a,b,a+n*c,b+n*c])
z={i:v for v,i in enumerate(sorted(set(z))... | false | 6.666667 | [
"+from subprocess import *",
"+",
"+call(",
"+ (",
"+ \"pypy3\",",
"+ \"-c\",",
"+ \"\"\"",
"- from heapq import heappush, heappop, heapify",
"-",
"- inf = 2**31 - 1",
"- n, m, *t = list(map(int, open(0).read().split()))",
"- z = []",
"- for a, b, c in ... | false | 0.039313 | 0.048013 | 0.818806 | [
"s014781845",
"s150736330"
] |
u059210959 | p02601 | python | s380402172 | s735814787 | 47 | 39 | 10,924 | 10,760 | Accepted | Accepted | 17.02 | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | 30 | 43 | 569 | 765 | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | false | 30.232558 | [
"+# A, B, C = LI()",
"+# K = int(input())",
"+# for k in range(K):",
"+# if A < B:",
"+# C *= 2",
"+# else:",
"+# B *= 2",
"+# if A < B and B < C:",
"+# print(\"Yes\")",
"+# else:",
"+# print(\"No\")",
"- if A < B:",
"+ if A >= B:",
"+ B *= 2",
... | false | 0.045427 | 0.045451 | 0.99947 | [
"s380402172",
"s735814787"
] |
u730769327 | p03546 | python | s025394133 | s799942147 | 82 | 47 | 74,012 | 9,420 | Accepted | Accepted | 42.68 | h,w=list(map(int,input().split()))
n=10
dis=[list(map(int,input().split())) for _ in range(n)]
a=[list(map(int,input().split())) for _ in range(h)]
for k in range(n):
for i in range(n):
for j in range(n):
dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j])
ans=0
for i in range(h):
for j in range(w):
... | INF=10**18
n=10
h,w=list(map(int,input().split()))
dist=[list(map(int,input().split())) for _ in range(n)]
a=[list(map(int,input().split())) for _ in range(h)]
for k in range(n):
for i in range(n):
for j in range(n):
dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j])
ans=0
for i in range(h):
for ... | 13 | 15 | 364 | 396 | h, w = list(map(int, input().split()))
n = 10
dis = [list(map(int, input().split())) for _ in range(n)]
a = [list(map(int, input().split())) for _ in range(h)]
for k in range(n):
for i in range(n):
for j in range(n):
dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])
ans = 0
for i in range(h):
... | INF = 10**18
n = 10
h, w = list(map(int, input().split()))
dist = [list(map(int, input().split())) for _ in range(n)]
a = [list(map(int, input().split())) for _ in range(h)]
for k in range(n):
for i in range(n):
for j in range(n):
dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
ans = 0
for... | false | 13.333333 | [
"+INF = 10**18",
"+n = 10",
"-n = 10",
"-dis = [list(map(int, input().split())) for _ in range(n)]",
"+dist = [list(map(int, input().split())) for _ in range(n)]",
"- dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])",
"+ dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])",
"-... | false | 0.085865 | 0.048011 | 1.788451 | [
"s025394133",
"s799942147"
] |
u690536347 | p03765 | python | s610837537 | s473295997 | 1,239 | 1,089 | 121,312 | 53,848 | Accepted | Accepted | 12.11 | from operator import add
import sys
input=sys.stdin.readline
class SegTree():
def __init__(self, N, e, operator_func=add):
self.e = e # 単位元
self.size = N
self.node = [self.e] * (2*N)
self.operator_func = operator_func # 処理(add or xor max minなど)
def set_list(self, l... | S, T = eval(input()), eval(input())
q = int(eval(input()))
ls, lt = len(S), len(T)
acs, act = [0]*(ls+1), [0]*(lt+1)
for i in range(1, ls+1):
acs[i] = acs[i-1] + (S[i-1]=="A")
for i in range(1, lt+1):
act[i] = act[i-1] + (T[i-1]=="A")
for _ in range(q):
a, b, c, d = list(map(int, input().spli... | 65 | 18 | 1,733 | 448 | from operator import add
import sys
input = sys.stdin.readline
class SegTree:
def __init__(self, N, e, operator_func=add):
self.e = e # 単位元
self.size = N
self.node = [self.e] * (2 * N)
self.operator_func = operator_func # 処理(add or xor max minなど)
def set_list(self, l):
... | S, T = eval(input()), eval(input())
q = int(eval(input()))
ls, lt = len(S), len(T)
acs, act = [0] * (ls + 1), [0] * (lt + 1)
for i in range(1, ls + 1):
acs[i] = acs[i - 1] + (S[i - 1] == "A")
for i in range(1, lt + 1):
act[i] = act[i - 1] + (T[i - 1] == "A")
for _ in range(q):
a, b, c, d = list(map(int, inp... | false | 72.307692 | [
"-from operator import add",
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"-class SegTree:",
"- def __init__(self, N, e, operator_func=add):",
"- self.e = e # 単位元",
"- self.size = N",
"- self.node = [self.e] * (2 * N)",
"- self.operator_func = op... | false | 0.039597 | 0.04432 | 0.89344 | [
"s610837537",
"s473295997"
] |
u242890210 | p02700 | python | s623333294 | s858026146 | 23 | 20 | 9,172 | 9,172 | Accepted | Accepted | 13.04 | [A, B, C, D] = list(map(int, input().split()))
while A > 0:
C -= B
if C <= 0:
print('Yes')
break
A -= D
if A <= 0:
print('No')
break | import math
[A, B, C, D] = list(map(int, input().split()))
X = math.ceil(A / D)
Y = math.ceil(C / B)
if Y > X:
print('No')
else:
print('Yes') | 10 | 8 | 189 | 156 | [A, B, C, D] = list(map(int, input().split()))
while A > 0:
C -= B
if C <= 0:
print("Yes")
break
A -= D
if A <= 0:
print("No")
break
| import math
[A, B, C, D] = list(map(int, input().split()))
X = math.ceil(A / D)
Y = math.ceil(C / B)
if Y > X:
print("No")
else:
print("Yes")
| false | 20 | [
"+import math",
"+",
"-while A > 0:",
"- C -= B",
"- if C <= 0:",
"- print(\"Yes\")",
"- break",
"- A -= D",
"- if A <= 0:",
"- print(\"No\")",
"- break",
"+X = math.ceil(A / D)",
"+Y = math.ceil(C / B)",
"+if Y > X:",
"+ print(\"No\")",
"+els... | false | 0.077259 | 0.04215 | 1.832937 | [
"s623333294",
"s858026146"
] |
u076917070 | p02868 | python | s705531356 | s114626285 | 722 | 630 | 89,648 | 79,024 | Accepted | Accepted | 12.74 | import sys
import heapq
input = sys.stdin.readline
def dijkstra(s, E):
inf = float('inf')
d = [inf for i in range(len(E))]
d[s] = 0
q = [(0, s)]
heapq.heapify(q)
while q:
c, p = heapq.heappop(q)
if d[p] < c:
continue
for cost, to in E[p]:
... | import sys
import heapq
input = sys.stdin.readline
def dijkstra(s, E):
inf = float('inf')
d = [inf for i in range(len(E))]
d[s] = 0
q = [(0, s)]
while q:
c, p = heapq.heappop(q)
if d[p] < c:
continue
for cost, to in E[p]:
if d[to] > d[... | 42 | 41 | 867 | 845 | import sys
import heapq
input = sys.stdin.readline
def dijkstra(s, E):
inf = float("inf")
d = [inf for i in range(len(E))]
d[s] = 0
q = [(0, s)]
heapq.heapify(q)
while q:
c, p = heapq.heappop(q)
if d[p] < c:
continue
for cost, to in E[p]:
if d[t... | import sys
import heapq
input = sys.stdin.readline
def dijkstra(s, E):
inf = float("inf")
d = [inf for i in range(len(E))]
d[s] = 0
q = [(0, s)]
while q:
c, p = heapq.heappop(q)
if d[p] < c:
continue
for cost, to in E[p]:
if d[to] > d[p] + cost:
... | false | 2.380952 | [
"- heapq.heapify(q)",
"- E[s - 1].append([c, t - 1])",
"+ E[s - 1].append((c, t - 1))",
"- E[i + 1].append([0, i])",
"+ E[i + 1].append((0, i))"
] | false | 0.039287 | 0.047612 | 0.825147 | [
"s705531356",
"s114626285"
] |
u130900604 | p03240 | python | s231861944 | s171775720 | 405 | 261 | 9,048 | 70,616 | Accepted | Accepted | 35.56 | n=int(eval(input()))
x=[-1]*n
y=[-1]*n
h=[-1]*n
for i in range(n):
x[i],y[i],h[i]=list(map(int,input().split()))
cnt=0
now=0
for i in range(n):
if h[i]>0:
cnt+=1
now=i
if cnt==1:
print((x[now],y[now],h[now]))
exit()
for cx in range(0,101):
for cy in range(0,101):
H=[]
f... | n=int(eval(input()))
x=[-1]*n
y=[-1]*n
h=[-1]*n
for i in range(n):
x[i],y[i],h[i]=list(map(int,input().split()))
mh=max(h)
for cx in range(0,101):
for cy in range(0,101):
for H in range(mh,mh+216):
if all(h[j]==max(H-abs(cx-x[j])-abs(cy-y[j]),0) for j in range(n)):
print((cx,cy,H))
... | 26 | 14 | 455 | 320 | n = int(eval(input()))
x = [-1] * n
y = [-1] * n
h = [-1] * n
for i in range(n):
x[i], y[i], h[i] = list(map(int, input().split()))
cnt = 0
now = 0
for i in range(n):
if h[i] > 0:
cnt += 1
now = i
if cnt == 1:
print((x[now], y[now], h[now]))
exit()
for cx in range(0, 101):
for cy in ... | n = int(eval(input()))
x = [-1] * n
y = [-1] * n
h = [-1] * n
for i in range(n):
x[i], y[i], h[i] = list(map(int, input().split()))
mh = max(h)
for cx in range(0, 101):
for cy in range(0, 101):
for H in range(mh, mh + 216):
if all(
h[j] == max(H - abs(cx - x[j]) - abs(cy - y[... | false | 46.153846 | [
"-cnt = 0",
"-now = 0",
"-for i in range(n):",
"- if h[i] > 0:",
"- cnt += 1",
"- now = i",
"-if cnt == 1:",
"- print((x[now], y[now], h[now]))",
"- exit()",
"+mh = max(h)",
"- H = []",
"- for i in range(n):",
"- if h[i] > 0:",
"- ... | false | 0.102005 | 1.236209 | 0.082514 | [
"s231861944",
"s171775720"
] |
u360038884 | p03448 | python | s622206745 | s376372516 | 52 | 19 | 3,060 | 3,060 | Accepted | Accepted | 63.46 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if X == i * 500 + j * 100 + k * 50:
cnt += 1
print(cnt) | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
y = X - i * 500 - j * 100
if y % 50 == 0 and 0 <= y <=50*C:
cnt += 1
print(cnt) | 13 | 13 | 242 | 241 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if X == i * 500 + j * 100 + k * 50:
cnt += 1
print(cnt)
| A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for i in range(A + 1):
for j in range(B + 1):
y = X - i * 500 - j * 100
if y % 50 == 0 and 0 <= y <= 50 * C:
cnt += 1
print(cnt)
| false | 0 | [
"- for k in range(C + 1):",
"- if X == i * 500 + j * 100 + k * 50:",
"- cnt += 1",
"+ y = X - i * 500 - j * 100",
"+ if y % 50 == 0 and 0 <= y <= 50 * C:",
"+ cnt += 1"
] | false | 0.066519 | 0.034435 | 1.931707 | [
"s622206745",
"s376372516"
] |
u312025627 | p03038 | python | s856454003 | s770026733 | 619 | 415 | 82,104 | 101,044 | Accepted | Accepted | 32.96 | def main():
import sys
input = sys.stdin.buffer.readline
from heapq import heappush, heappop, heapify
N, M = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
BC = [[int(i) for i in input().split()] for j in range(M)]
heapify(A)
BC.sort(key=lambda p: p[1], r... | def main():
from heapq import heapify, heappushpop
_, M = (int(i) for i in input().split())
A = ([int(i) for i in input().split()])
BC = [[int(i) for i in input().split()] for j in range(M)]
heapify(A)
BC.sort(lambda p: p[1], reverse=True)
for b, c in BC:
if A[0] >= c:
... | 27 | 20 | 679 | 507 | def main():
import sys
input = sys.stdin.buffer.readline
from heapq import heappush, heappop, heapify
N, M = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
BC = [[int(i) for i in input().split()] for j in range(M)]
heapify(A)
BC.sort(key=lambda p: p[1], reverse... | def main():
from heapq import heapify, heappushpop
_, M = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
BC = [[int(i) for i in input().split()] for j in range(M)]
heapify(A)
BC.sort(lambda p: p[1], reverse=True)
for b, c in BC:
if A[0] >= c:
bre... | false | 25.925926 | [
"- import sys",
"+ from heapq import heapify, heappushpop",
"- input = sys.stdin.buffer.readline",
"- from heapq import heappush, heappop, heapify",
"-",
"- N, M = (int(i) for i in input().split())",
"+ _, M = (int(i) for i in input().split())",
"- BC.sort(key=lambda p: p[1], reve... | false | 0.05 | 0.037447 | 1.3352 | [
"s856454003",
"s770026733"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.