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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u123756661 | p02603 | python | s180317894 | s130656574 | 82 | 67 | 61,820 | 61,860 | Accepted | Accepted | 18.29 | n=int(eval(input()))
a=[int(i) for i in input().split()]
ans=[1000,0]
for i in range(1,n):
if a[i-1]<a[i]:
ans[0]+=ans[1]*a[i-1]
ans[1]=0
ans[1]=ans[0]//a[i-1]
ans[0]=ans[0]%a[i-1]
else:
ans[0]+=ans[1]*a[i-1]
ans[1]=0
print((ans[0]+ans[1]*a[-1]))
| n=int(eval(input()))
a=[int(i) for i in input().split()]
a.append(0)
x,y=1000,0
for i in range(n):
if a[i]>a[i+1]:
x+=y*a[i]
y=0
else:
y+=x//a[i]
x=x%a[i]
print((x+y*a[-2])) | 13 | 12 | 307 | 216 | n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = [1000, 0]
for i in range(1, n):
if a[i - 1] < a[i]:
ans[0] += ans[1] * a[i - 1]
ans[1] = 0
ans[1] = ans[0] // a[i - 1]
ans[0] = ans[0] % a[i - 1]
else:
ans[0] += ans[1] * a[i - 1]
ans[1] = 0
print(... | n = int(eval(input()))
a = [int(i) for i in input().split()]
a.append(0)
x, y = 1000, 0
for i in range(n):
if a[i] > a[i + 1]:
x += y * a[i]
y = 0
else:
y += x // a[i]
x = x % a[i]
print((x + y * a[-2]))
| false | 7.692308 | [
"-ans = [1000, 0]",
"-for i in range(1, n):",
"- if a[i - 1] < a[i]:",
"- ans[0] += ans[1] * a[i - 1]",
"- ans[1] = 0",
"- ans[1] = ans[0] // a[i - 1]",
"- ans[0] = ans[0] % a[i - 1]",
"+a.append(0)",
"+x, y = 1000, 0",
"+for i in range(n):",
"+ if a[i] > a[i + ... | false | 0.036398 | 0.035235 | 1.033016 | [
"s180317894",
"s130656574"
] |
u225388820 | p03724 | python | s154281033 | s165401556 | 426 | 299 | 190,336 | 27,640 | Accepted | Accepted | 29.81 | from collections import defaultdict
# d = defaultdict(int)で0で初期化
# d = defaultdict(lambda: 100)で100で初期化
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
es = [defaultdict(int) for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().spli... | import numpy as np
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
a = np.zeros(n + 1, dtype=int)
for _ in range(m):
x, y = list(map(int, input().split()))
a[x] = (a[x] + 1) & 1
a[y] = (a[y] + 1) & 1
print(("YES" if np.sum(a) == 0 else "NO"))
| 36 | 10 | 820 | 279 | from collections import defaultdict
# d = defaultdict(int)で0で初期化
# d = defaultdict(lambda: 100)で100で初期化
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
es = [defaultdict(int) for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
... | import numpy as np
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
a = np.zeros(n + 1, dtype=int)
for _ in range(m):
x, y = list(map(int, input().split()))
a[x] = (a[x] + 1) & 1
a[y] = (a[y] + 1) & 1
print(("YES" if np.sum(a) == 0 else "NO"))
| false | 72.222222 | [
"-from collections import defaultdict",
"-",
"-# d = defaultdict(int)で0で初期化",
"-# d = defaultdict(lambda: 100)で100で初期化",
"+import numpy as np",
"-sys.setrecursionlimit(10000000)",
"-es = [defaultdict(int) for _ in range(n)]",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"-... | false | 0.07552 | 0.334432 | 0.225816 | [
"s154281033",
"s165401556"
] |
u620868411 | p03607 | python | s554958247 | s373094062 | 211 | 165 | 11,884 | 14,696 | Accepted | Accepted | 21.8 | # -*- coding: utf-8 -*-
n = int(eval(input()))
s = set([])
for _ in range(n):
x = int(eval(input()))
if x in s:
s.remove(x)
else:
s.add(x)
print((len(s)))
| # -*- coding: utf-8 -*-
n = int(eval(input()))
s = set()
for _ in range(n):
a = eval(input())
if a in s:
s.remove(a)
else:
s.add(a)
print((len(s)))
| 12 | 11 | 182 | 173 | # -*- coding: utf-8 -*-
n = int(eval(input()))
s = set([])
for _ in range(n):
x = int(eval(input()))
if x in s:
s.remove(x)
else:
s.add(x)
print((len(s)))
| # -*- coding: utf-8 -*-
n = int(eval(input()))
s = set()
for _ in range(n):
a = eval(input())
if a in s:
s.remove(a)
else:
s.add(a)
print((len(s)))
| false | 8.333333 | [
"-s = set([])",
"+s = set()",
"- x = int(eval(input()))",
"- if x in s:",
"- s.remove(x)",
"+ a = eval(input())",
"+ if a in s:",
"+ s.remove(a)",
"- s.add(x)",
"+ s.add(a)"
] | false | 0.041119 | 0.034433 | 1.194177 | [
"s554958247",
"s373094062"
] |
u694380052 | p02684 | python | s764293512 | s348932078 | 174 | 160 | 32,316 | 32,348 | Accepted | Accepted | 8.05 | n,k=list(map(int,input().split()))
pl=list(map(int,input().split()))
cl=[0]*2*n
res=[]
next=0
for x in range(k):
if cl[next]==0:
cl[next]=1
next=pl[next]-1
elif cl[next]==1:
res.append(next+1)
cl[next]+=1
next=pl[next]-1
else:
lroop=len(res)
k-=cl.count(1)
num=k%lro... | n,k=list(map(int,input().split()))
pl=list(map(int,input().split()))
cl=[0]*2*n
order=[]
next=0
for i in range(k):
if cl[next]==0:
cl[next]=1
next=pl[next]-1
elif cl[next]==1:
cl[next]=2
order.append(next+1)
next=pl[next]-1
else:
kk=len(order)
hasuu=cl.count(1)
newk... | 21 | 22 | 373 | 398 | n, k = list(map(int, input().split()))
pl = list(map(int, input().split()))
cl = [0] * 2 * n
res = []
next = 0
for x in range(k):
if cl[next] == 0:
cl[next] = 1
next = pl[next] - 1
elif cl[next] == 1:
res.append(next + 1)
cl[next] += 1
next = pl[next] - 1
else:
... | n, k = list(map(int, input().split()))
pl = list(map(int, input().split()))
cl = [0] * 2 * n
order = []
next = 0
for i in range(k):
if cl[next] == 0:
cl[next] = 1
next = pl[next] - 1
elif cl[next] == 1:
cl[next] = 2
order.append(next + 1)
next = pl[next] - 1
else:
... | false | 4.545455 | [
"-res = []",
"+order = []",
"-for x in range(k):",
"+for i in range(k):",
"- res.append(next + 1)",
"- cl[next] += 1",
"+ cl[next] = 2",
"+ order.append(next + 1)",
"- lroop = len(res)",
"- k -= cl.count(1)",
"- num = k % lroop",
"- print... | false | 0.159535 | 0.100055 | 1.594476 | [
"s764293512",
"s348932078"
] |
u930705402 | p03283 | python | s887775663 | s821877924 | 2,925 | 1,629 | 58,088 | 14,708 | Accepted | Accepted | 44.31 | N,M,Q=list(map(int,input().split()))
x=[[0]*N for i in range(N)]
for i in range(M):
L,R=[int(x)-1 for x in input().split()]
x[L][R]+=1
cum=[[0]*(N+1) for i in range(N+1)]
for l in range(N):
for r in range(N):
cum[l][r+1]=cum[l][r]+x[l][r]
for i in range(Q):
p,q=[int(x)-1 for x in input... | N,M,Q=list(map(int,input().split()))
x=[[0]*(N+1) for i in range(N+1)]
for i in range(M):
L,R=list(map(int,input().split()))
x[L][R]+=1
for i in range(N+1):
for j in range(N):
x[i][j+1]+=x[i][j]
for j in range(N+1):
for i in range(N):
x[i+1][j]+=x[i][j]
for i in range(Q):
... | 15 | 14 | 422 | 389 | N, M, Q = list(map(int, input().split()))
x = [[0] * N for i in range(N)]
for i in range(M):
L, R = [int(x) - 1 for x in input().split()]
x[L][R] += 1
cum = [[0] * (N + 1) for i in range(N + 1)]
for l in range(N):
for r in range(N):
cum[l][r + 1] = cum[l][r] + x[l][r]
for i in range(Q):
p, q = [... | N, M, Q = list(map(int, input().split()))
x = [[0] * (N + 1) for i in range(N + 1)]
for i in range(M):
L, R = list(map(int, input().split()))
x[L][R] += 1
for i in range(N + 1):
for j in range(N):
x[i][j + 1] += x[i][j]
for j in range(N + 1):
for i in range(N):
x[i + 1][j] += x[i][j]
for... | false | 6.666667 | [
"-x = [[0] * N for i in range(N)]",
"+x = [[0] * (N + 1) for i in range(N + 1)]",
"- L, R = [int(x) - 1 for x in input().split()]",
"+ L, R = list(map(int, input().split()))",
"-cum = [[0] * (N + 1) for i in range(N + 1)]",
"-for l in range(N):",
"- for r in range(N):",
"- cum[l][r + 1... | false | 0.062211 | 0.035709 | 1.742153 | [
"s887775663",
"s821877924"
] |
u161164709 | p02585 | python | s871367251 | s898752473 | 1,422 | 1,086 | 296,124 | 146,272 | Accepted | Accepted | 23.63 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
# mv_array = [set() for _ in range(n)]
score_mv_array = [[] for _ in range(n)]
score_array = [0]*n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array.a... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
# mv_array = [set() for _ in range(n)]
# score_mv_array = [[] for _ in range(n)]
score_array = [0]*n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array... | 43 | 43 | 1,206 | 1,186 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
# mv_array = [set() for _ in range(n)]
score_mv_array = [[] for _ in range(n)]
score_array = [0] * n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array.append(sco... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
# mv_array = [set() for _ in range(n)]
# score_mv_array = [[] for _ in range(n)]
score_array = [0] * n
def get_sum(array):
score_array = [0]
for i, a in enumerate(array):
score_array.append(s... | false | 0 | [
"-score_mv_array = [[] for _ in range(n)]",
"+# score_mv_array = [[] for _ in range(n)]",
"+ score_mv_array = []",
"- # if pos in mv_array[i]:",
"- len_mv = len(score_mv_array[i])",
"+ len_mv = len(score_mv_array)",
"+ # len_mv = j+1",
"- score += ... | false | 0.086282 | 0.036638 | 2.354968 | [
"s871367251",
"s898752473"
] |
u993461026 | p03325 | python | s162300599 | s989536377 | 100 | 88 | 4,148 | 4,148 | Accepted | Accepted | 12 | N = int(eval(input()))
a = list(map(int, input().rstrip().split()))
even = [i for i in a if i%2 == 0]
count = 0
for i in even:
c = 0
for j in range(100):
rem = i % 2
i //= 2
if rem == 1:
break
c += 1
count += c
print(count) | N = int(eval(input()))
a = list(map(int, input().rstrip().split()))
even = [i for i in a if i%2 == 0]
count = 0
for i in even:
c = 0
while True:
rem = i % 2
i //= 2
if rem == 1:
break
c += 1
count += c
print(count) | 14 | 14 | 286 | 277 | N = int(eval(input()))
a = list(map(int, input().rstrip().split()))
even = [i for i in a if i % 2 == 0]
count = 0
for i in even:
c = 0
for j in range(100):
rem = i % 2
i //= 2
if rem == 1:
break
c += 1
count += c
print(count)
| N = int(eval(input()))
a = list(map(int, input().rstrip().split()))
even = [i for i in a if i % 2 == 0]
count = 0
for i in even:
c = 0
while True:
rem = i % 2
i //= 2
if rem == 1:
break
c += 1
count += c
print(count)
| false | 0 | [
"- for j in range(100):",
"+ while True:"
] | false | 0.075736 | 0.058442 | 1.295913 | [
"s162300599",
"s989536377"
] |
u086503932 | p03599 | python | s251737361 | s236484815 | 862 | 85 | 3,064 | 73,656 | Accepted | Accepted | 90.14 | #!/usr/bin/env python3
def main():
A, B, C, D, E, F = list(map(int, input().split()))
ans = [100*A,0]
# 水の量で全探索する
N = F // (100*A)
M = F // (100*B)
for i in range(N+1):
for j in range(M+1):
if i == j == 0:# 水なしはだめ
continue
water = 10... | A, B, C, D, E, F = list(map(int, input().split()))
res = 0
ans = [100*A,0]# sugar+water, sugar
for x in range(F//(100*A)+1):
for y in range((F-100*A*x)//(100*B)+1):
if x == y == 0: continue
sugarMAX = (A*x+B*y)*E
M = F-100*A*x-100*B*y
water = 100*A*x+100*B*y
for z ... | 33 | 19 | 951 | 622 | #!/usr/bin/env python3
def main():
A, B, C, D, E, F = list(map(int, input().split()))
ans = [100 * A, 0]
# 水の量で全探索する
N = F // (100 * A)
M = F // (100 * B)
for i in range(N + 1):
for j in range(M + 1):
if i == j == 0: # 水なしはだめ
continue
water = 100 ... | A, B, C, D, E, F = list(map(int, input().split()))
res = 0
ans = [100 * A, 0] # sugar+water, sugar
for x in range(F // (100 * A) + 1):
for y in range((F - 100 * A * x) // (100 * B) + 1):
if x == y == 0:
continue
sugarMAX = (A * x + B * y) * E
M = F - 100 * A * x - 100 * B * y
... | false | 42.424242 | [
"-#!/usr/bin/env python3",
"-def main():",
"- A, B, C, D, E, F = list(map(int, input().split()))",
"- ans = [100 * A, 0]",
"- # 水の量で全探索する",
"- N = F // (100 * A)",
"- M = F // (100 * B)",
"- for i in range(N + 1):",
"- for j in range(M + 1):",
"- if i == j == 0:... | false | 0.454175 | 0.111405 | 4.076777 | [
"s251737361",
"s236484815"
] |
u649202997 | p02899 | python | s232818430 | s594285286 | 123 | 100 | 22,752 | 21,752 | Accepted | Accepted | 18.7 | n = int(eval(input()))
array = list(map(int, input().split()))
map = {}
for i in range(n):
map[array[i]] = str(i+1)
list = []
for i in range(1, n+1):
list.append(map[i])
print((" ".join(list))) | n = int(eval(input()))
array = list(map(int, input().split()))
map = {}
for i in range(n):
map[array[i]] = str(i+1)
print((" ".join([map[i] for i in range(1, n+1)]))) | 9 | 6 | 201 | 167 | n = int(eval(input()))
array = list(map(int, input().split()))
map = {}
for i in range(n):
map[array[i]] = str(i + 1)
list = []
for i in range(1, n + 1):
list.append(map[i])
print((" ".join(list)))
| n = int(eval(input()))
array = list(map(int, input().split()))
map = {}
for i in range(n):
map[array[i]] = str(i + 1)
print((" ".join([map[i] for i in range(1, n + 1)])))
| false | 33.333333 | [
"-list = []",
"-for i in range(1, n + 1):",
"- list.append(map[i])",
"-print((\" \".join(list)))",
"+print((\" \".join([map[i] for i in range(1, n + 1)])))"
] | false | 0.044764 | 0.048651 | 0.920114 | [
"s232818430",
"s594285286"
] |
u888092736 | p03472 | python | s958573552 | s038749155 | 441 | 100 | 11,168 | 32,084 | Accepted | Accepted | 77.32 | from heapq import heappush, heappop
def solve():
N, H = list(map(int, input().split()))
cut_dmgs = []
thr_dmgs = []
for _ in range(N):
a, b = list(map(int, input().split()))
heappush(cut_dmgs, -a)
heappush(thr_dmgs, -b)
ans = 0
max_cut_dmg = -min(cut_dmgs)... | N, H, *blades = list(map(int, open(0).read().split()))
cut = max(blades[::2])
throws = sorted(b for b in blades[1::2] if b >= cut)
ans = 0
while throws:
H -= throws.pop()
ans += 1
if H <= 0:
print(ans)
exit()
ans += (H + cut - 1) // cut
print(ans) | 26 | 14 | 589 | 284 | from heapq import heappush, heappop
def solve():
N, H = list(map(int, input().split()))
cut_dmgs = []
thr_dmgs = []
for _ in range(N):
a, b = list(map(int, input().split()))
heappush(cut_dmgs, -a)
heappush(thr_dmgs, -b)
ans = 0
max_cut_dmg = -min(cut_dmgs)
while thr... | N, H, *blades = list(map(int, open(0).read().split()))
cut = max(blades[::2])
throws = sorted(b for b in blades[1::2] if b >= cut)
ans = 0
while throws:
H -= throws.pop()
ans += 1
if H <= 0:
print(ans)
exit()
ans += (H + cut - 1) // cut
print(ans)
| false | 46.153846 | [
"-from heapq import heappush, heappop",
"-",
"-",
"-def solve():",
"- N, H = list(map(int, input().split()))",
"- cut_dmgs = []",
"- thr_dmgs = []",
"- for _ in range(N):",
"- a, b = list(map(int, input().split()))",
"- heappush(cut_dmgs, -a)",
"- heappush(thr_dm... | false | 0.079313 | 0.078155 | 1.014816 | [
"s958573552",
"s038749155"
] |
u095021077 | p02957 | python | s584371352 | s517530735 | 175 | 153 | 38,256 | 12,392 | Accepted | Accepted | 12.57 | temp=input().split()
A=int(temp[0])
B=int(temp[1])
m=int((A+B)/2)
if m==(A+B)/2 and m>=0:
print((int(m)))
else:
print('IMPOSSIBLE') | import numpy as np
temp=list(map(int, input().split()))
temp=np.mean(temp)
if temp-int(temp)>0:
output='IMPOSSIBLE'
else:
output=int(temp)
print(output) | 10 | 10 | 144 | 169 | temp = input().split()
A = int(temp[0])
B = int(temp[1])
m = int((A + B) / 2)
if m == (A + B) / 2 and m >= 0:
print((int(m)))
else:
print("IMPOSSIBLE")
| import numpy as np
temp = list(map(int, input().split()))
temp = np.mean(temp)
if temp - int(temp) > 0:
output = "IMPOSSIBLE"
else:
output = int(temp)
print(output)
| false | 0 | [
"-temp = input().split()",
"-A = int(temp[0])",
"-B = int(temp[1])",
"-m = int((A + B) / 2)",
"-if m == (A + B) / 2 and m >= 0:",
"- print((int(m)))",
"+import numpy as np",
"+",
"+temp = list(map(int, input().split()))",
"+temp = np.mean(temp)",
"+if temp - int(temp) > 0:",
"+ output = ... | false | 0.042405 | 0.273832 | 0.154857 | [
"s584371352",
"s517530735"
] |
u150984829 | p00446 | python | s627005731 | s248585295 | 30 | 20 | 5,652 | 5,656 | Accepted | Accepted | 33.33 | import bisect
for e in iter(input,'0'):
n=int(e)
c=[sorted(int(eval(input()))for _ in[0]*n)]
c+=[sorted(set(range(1,2*n+1))-set(c[0]))]
t=f=0
while 1:
l=len(c[t])
if l<1:break
x=bisect.bisect(c[t],f)
f=c[t].pop(x)if x<l else 0
t^=1
for i in[1,0]:print((len(c[i])))
| import bisect
for e in iter(input,'0'):
n=int(e)
c=[sorted(int(eval(input()))for _ in[0]*n)]
c+=[sorted(set(range(1,2*n+1))-set(c[0]))]
t=f=0
while 1:
if not c[t]:break
x=bisect.bisect(c[t],f)
f=c[t].pop(x)if x<len(c[t])else 0
t^=1
for i in[1,0]:print((len(c[i])))
| 13 | 12 | 285 | 282 | import bisect
for e in iter(input, "0"):
n = int(e)
c = [sorted(int(eval(input())) for _ in [0] * n)]
c += [sorted(set(range(1, 2 * n + 1)) - set(c[0]))]
t = f = 0
while 1:
l = len(c[t])
if l < 1:
break
x = bisect.bisect(c[t], f)
f = c[t].pop(x) if x < l ... | import bisect
for e in iter(input, "0"):
n = int(e)
c = [sorted(int(eval(input())) for _ in [0] * n)]
c += [sorted(set(range(1, 2 * n + 1)) - set(c[0]))]
t = f = 0
while 1:
if not c[t]:
break
x = bisect.bisect(c[t], f)
f = c[t].pop(x) if x < len(c[t]) else 0
... | false | 7.692308 | [
"- l = len(c[t])",
"- if l < 1:",
"+ if not c[t]:",
"- f = c[t].pop(x) if x < l else 0",
"+ f = c[t].pop(x) if x < len(c[t]) else 0"
] | false | 0.045909 | 0.043629 | 1.052265 | [
"s627005731",
"s248585295"
] |
u474423089 | p02720 | python | s827164790 | s492191608 | 417 | 119 | 52,056 | 11,948 | Accepted | Accepted | 71.46 | K=int(eval(input()))
u12 = [i for i in range(1,10)]
ans = 0
for i in range(K):
if ans <=11:
ans += 1
continue
flg = True
l = len(str(ans))
for j in range(l-1,-1,-1):
if 0<j<l-1:
x,y,z = list(map(int,str(ans)[j-1:j+2]))
if y!=9 and abs(x-(y+1))<... | from collections import deque
K=int(eval(input()))
ans =deque([i for i in range(1,10)])
for i in range(K):
x = ans.popleft()
mod_x=x%10
if mod_x != 0:
ans.append(x*10+mod_x-1)
ans.append(x*10+mod_x)
if x%10!=9:
ans.append(x*10+mod_x+1)
print(x) | 31 | 12 | 928 | 285 | K = int(eval(input()))
u12 = [i for i in range(1, 10)]
ans = 0
for i in range(K):
if ans <= 11:
ans += 1
continue
flg = True
l = len(str(ans))
for j in range(l - 1, -1, -1):
if 0 < j < l - 1:
x, y, z = list(map(int, str(ans)[j - 1 : j + 2]))
if y != 9 and ... | from collections import deque
K = int(eval(input()))
ans = deque([i for i in range(1, 10)])
for i in range(K):
x = ans.popleft()
mod_x = x % 10
if mod_x != 0:
ans.append(x * 10 + mod_x - 1)
ans.append(x * 10 + mod_x)
if x % 10 != 9:
ans.append(x * 10 + mod_x + 1)
print(x)
| false | 61.290323 | [
"+from collections import deque",
"+",
"-u12 = [i for i in range(1, 10)]",
"-ans = 0",
"+ans = deque([i for i in range(1, 10)])",
"- if ans <= 11:",
"- ans += 1",
"- continue",
"- flg = True",
"- l = len(str(ans))",
"- for j in range(l - 1, -1, -1):",
"- if 0 <... | false | 0.111455 | 0.05988 | 1.861312 | [
"s827164790",
"s492191608"
] |
u586960661 | p03163 | python | s822743168 | s248373247 | 1,151 | 281 | 129,868 | 41,580 | Accepted | Accepted | 75.59 | n,w=list(map(int,input().split()))
dp=[0]*(w+1)
for i in range(w+1):
dp[i]=[0]*(n+1)
wt=[0]*n
val=[0]*n
for i in range(n):
wt[i],val[i]=list(map(int,input().split()))
for i in range(1,w+1):
for j in range(1,n+1):
if i-wt[j-1]>=0:
# print(i,j)
dp[i][j]=max(val[j-1]+dp[i-wt[j-1]][j-1],dp[i][j-1])
... | n,w=list(map(int,input().split()))
dp=[0]*(w+1)
for i in range(n):
wt,val=list(map(int,input().split()))
for j in range(w,wt-1,-1):
dp[j]=max(dp[j],dp[j-wt]+val)
# print(dp)
print((dp[w])) | 18 | 8 | 398 | 186 | n, w = list(map(int, input().split()))
dp = [0] * (w + 1)
for i in range(w + 1):
dp[i] = [0] * (n + 1)
wt = [0] * n
val = [0] * n
for i in range(n):
wt[i], val[i] = list(map(int, input().split()))
for i in range(1, w + 1):
for j in range(1, n + 1):
if i - wt[j - 1] >= 0:
# print(i,j)
... | n, w = list(map(int, input().split()))
dp = [0] * (w + 1)
for i in range(n):
wt, val = list(map(int, input().split()))
for j in range(w, wt - 1, -1):
dp[j] = max(dp[j], dp[j - wt] + val)
# print(dp)
print((dp[w]))
| false | 55.555556 | [
"-for i in range(w + 1):",
"- dp[i] = [0] * (n + 1)",
"-wt = [0] * n",
"-val = [0] * n",
"- wt[i], val[i] = list(map(int, input().split()))",
"-for i in range(1, w + 1):",
"- for j in range(1, n + 1):",
"- if i - wt[j - 1] >= 0:",
"- # print(i,j)",
"- dp[i][j]... | false | 0.036411 | 0.0371 | 0.981428 | [
"s822743168",
"s248373247"
] |
u033183216 | p03855 | python | s812302556 | s986630078 | 1,975 | 1,743 | 86,372 | 41,128 | Accepted | Accepted | 11.75 | class UnionFind:
def __init__(self, elements):
self.elements = {e: -1 for e in elements}
def same(self, a, b):
return self.find(a) == self.find(b)
def find(self, a):
parent = self.elements[a]
if parent < 0:
return a
self.elements[a] = self.fin... | class UnionFind:
def __init__(self, elements):
self.elements = elements
def same(self, a, b):
return self.find(a) == self.find(b)
def find(self, a):
parent = self.elements[a]
if parent < 0:
return a
self.elements[a] = self.find(parent)
... | 45 | 45 | 1,204 | 1,179 | class UnionFind:
def __init__(self, elements):
self.elements = {e: -1 for e in elements}
def same(self, a, b):
return self.find(a) == self.find(b)
def find(self, a):
parent = self.elements[a]
if parent < 0:
return a
self.elements[a] = self.find(parent)
... | class UnionFind:
def __init__(self, elements):
self.elements = elements
def same(self, a, b):
return self.find(a) == self.find(b)
def find(self, a):
parent = self.elements[a]
if parent < 0:
return a
self.elements[a] = self.find(parent)
return sel... | false | 0 | [
"- self.elements = {e: -1 for e in elements}",
"+ self.elements = elements",
"-road_union = UnionFind(i for i in range(1, N + 1))",
"+road_union = UnionFind([-1 for i in range(N)])",
"- road_union.unite(a, b)",
"-train_union = UnionFind(i for i in range(1, N + 1))",
"+ road_union.uni... | false | 0.118504 | 0.045874 | 2.583244 | [
"s812302556",
"s986630078"
] |
u120691615 | p03944 | python | s068707906 | s913079029 | 50 | 17 | 3,064 | 3,064 | Accepted | Accepted | 66 | W,H,N = list(map(int,input().split()))
rectangle = [[1 for i in range(W)] for j in range(H)]
def paint(x,y,a):
if a == 1:
for i in range(x):
for j in range(H):
rectangle[j][i] = 0
if a == 2:
for i in range(x,W):
for j in range(H):
... | W,H,N = list(map(int,input().split()))
minx,maxx,miny,maxy = 0,W,0,H
for i in range(N):
x,y,a = list(map(int,input().split()))
if a == 1:
minx = max(x,minx)
if a == 2:
maxx = min(x,maxx)
if a == 3:
miny = max(y,miny)
if a == 4:
maxy = min(y,maxy)
print((ma... | 29 | 13 | 715 | 347 | W, H, N = list(map(int, input().split()))
rectangle = [[1 for i in range(W)] for j in range(H)]
def paint(x, y, a):
if a == 1:
for i in range(x):
for j in range(H):
rectangle[j][i] = 0
if a == 2:
for i in range(x, W):
for j in range(H):
r... | W, H, N = list(map(int, input().split()))
minx, maxx, miny, maxy = 0, W, 0, H
for i in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
minx = max(x, minx)
if a == 2:
maxx = min(x, maxx)
if a == 3:
miny = max(y, miny)
if a == 4:
maxy = min(y, maxy)
print... | false | 55.172414 | [
"-rectangle = [[1 for i in range(W)] for j in range(H)]",
"-",
"-",
"-def paint(x, y, a):",
"- if a == 1:",
"- for i in range(x):",
"- for j in range(H):",
"- rectangle[j][i] = 0",
"- if a == 2:",
"- for i in range(x, W):",
"- for j in ran... | false | 0.036648 | 0.038055 | 0.963032 | [
"s068707906",
"s913079029"
] |
u919730120 | p02887 | python | s464265315 | s957895916 | 51 | 44 | 3,956 | 3,316 | Accepted | Accepted | 13.73 | n=int(eval(input()))
s=str(eval(input()))
ans=[]
ans.append(s[0])
cnt=0
for i in range(1,n):
if ans[cnt]==s[i]:
continue
else:
cnt+=1
ans.append(s[i])
print((len(ans))) | n=int(eval(input()))
s=str(eval(input()))
cnt=1
for i in range(n-1):
if s[i]==s[i+1]:
continue
else:
cnt+=1
print(cnt) | 12 | 9 | 181 | 126 | n = int(eval(input()))
s = str(eval(input()))
ans = []
ans.append(s[0])
cnt = 0
for i in range(1, n):
if ans[cnt] == s[i]:
continue
else:
cnt += 1
ans.append(s[i])
print((len(ans)))
| n = int(eval(input()))
s = str(eval(input()))
cnt = 1
for i in range(n - 1):
if s[i] == s[i + 1]:
continue
else:
cnt += 1
print(cnt)
| false | 25 | [
"-ans = []",
"-ans.append(s[0])",
"-cnt = 0",
"-for i in range(1, n):",
"- if ans[cnt] == s[i]:",
"+cnt = 1",
"+for i in range(n - 1):",
"+ if s[i] == s[i + 1]:",
"- ans.append(s[i])",
"-print((len(ans)))",
"+print(cnt)"
] | false | 0.044431 | 0.107659 | 0.412706 | [
"s464265315",
"s957895916"
] |
u692054751 | p02959 | python | s450826243 | s486688822 | 157 | 129 | 19,156 | 18,624 | Accepted | Accepted | 17.83 | def LI():
return [int(s) for s in input().split()]
N = int(eval(input()))
A_s = LI()
B_s = LI()
counter = 0
for i in range(N):
if A_s[i] > B_s[i]:
counter+=B_s[i]
elif B_s[i] < A_s[i] + A_s[i+1]:
counter+=B_s[i]
A_s[i+1] = A_s[i+1] - (B_s[i]-A_s[i])
else:
counter+=A_s[i]+A_s... | N = int(eval(input()))
A = [int(s) for s in input().split()]
sum_A = sum(A)
B = [int(s) for s in input().split()]
for i in range(N):
attack1 = A[i] - B[i]
if attack1 < 0:
attack2 = A[i + 1] + attack1
A[i] = 0
A[i + 1] = attack2 if attack2 >= 0 else 0
else:
A[i] = a... | 21 | 14 | 359 | 346 | def LI():
return [int(s) for s in input().split()]
N = int(eval(input()))
A_s = LI()
B_s = LI()
counter = 0
for i in range(N):
if A_s[i] > B_s[i]:
counter += B_s[i]
elif B_s[i] < A_s[i] + A_s[i + 1]:
counter += B_s[i]
A_s[i + 1] = A_s[i + 1] - (B_s[i] - A_s[i])
else:
co... | N = int(eval(input()))
A = [int(s) for s in input().split()]
sum_A = sum(A)
B = [int(s) for s in input().split()]
for i in range(N):
attack1 = A[i] - B[i]
if attack1 < 0:
attack2 = A[i + 1] + attack1
A[i] = 0
A[i + 1] = attack2 if attack2 >= 0 else 0
else:
A[i] = attack1
prin... | false | 33.333333 | [
"-def LI():",
"- return [int(s) for s in input().split()]",
"-",
"-",
"-A_s = LI()",
"-B_s = LI()",
"-counter = 0",
"+A = [int(s) for s in input().split()]",
"+sum_A = sum(A)",
"+B = [int(s) for s in input().split()]",
"- if A_s[i] > B_s[i]:",
"- counter += B_s[i]",
"- elif B... | false | 0.035041 | 0.086043 | 0.40725 | [
"s450826243",
"s486688822"
] |
u128456980 | p02775 | python | s897346121 | s596637826 | 531 | 413 | 137,952 | 138,044 | Accepted | Accepted | 22.22 | s = eval(input()); n = len(s); INF=1<<32
dp = [ [0,INF] for i in range(n+1) ]
for i in range(n):
d = int(s[i])
dp[i+1][0] = min(dp[i][0], dp[i][1])+d
dp[i+1][1] = min(dp[i][0], dp[i][1]-2)+11-d
print((min(dp[n][0],dp[n][1]))) | s = eval(input()); n = len(s)
dp = [ [0,1<<32] for i in range(n+1) ]
for i in range(n):
d = ord(s[i])-ord('0')
dp[i+1][0] = min(dp[i][0], dp[i][1])+d
dp[i+1][1] = min(dp[i][0], dp[i][1]-2)+11-d
print((min(dp[n][0],dp[n][1]))) | 7 | 7 | 229 | 229 | s = eval(input())
n = len(s)
INF = 1 << 32
dp = [[0, INF] for i in range(n + 1)]
for i in range(n):
d = int(s[i])
dp[i + 1][0] = min(dp[i][0], dp[i][1]) + d
dp[i + 1][1] = min(dp[i][0], dp[i][1] - 2) + 11 - d
print((min(dp[n][0], dp[n][1])))
| s = eval(input())
n = len(s)
dp = [[0, 1 << 32] for i in range(n + 1)]
for i in range(n):
d = ord(s[i]) - ord("0")
dp[i + 1][0] = min(dp[i][0], dp[i][1]) + d
dp[i + 1][1] = min(dp[i][0], dp[i][1] - 2) + 11 - d
print((min(dp[n][0], dp[n][1])))
| false | 0 | [
"-INF = 1 << 32",
"-dp = [[0, INF] for i in range(n + 1)]",
"+dp = [[0, 1 << 32] for i in range(n + 1)]",
"- d = int(s[i])",
"+ d = ord(s[i]) - ord(\"0\")"
] | false | 0.075707 | 0.046815 | 1.617155 | [
"s897346121",
"s596637826"
] |
u762420987 | p03013 | python | s820974626 | s711353569 | 485 | 258 | 460,020 | 13,216 | Accepted | Accepted | 46.8 | N, M = list(map(int, input().split()))
aset = set([int(eval(input())) for _ in range(M)])
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in aset else 1
for i in range(2, N + 1):
if i not in aset:
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[-1] % MOD))
| N, M = list(map(int, input().split()))
aset = set([int(eval(input())) for _ in range(M)])
dp = [0] * (N + 1)
dp[0] = 1
for i in range(N):
for j in range(i + 1, min(N, i + 2) + 1):
if j not in aset:
dp[j] += dp[i]
dp[j] %= 10**9 + 7
print((dp[N]))
| 10 | 10 | 268 | 278 | N, M = list(map(int, input().split()))
aset = set([int(eval(input())) for _ in range(M)])
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in aset else 1
for i in range(2, N + 1):
if i not in aset:
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[-1] % MOD))
| N, M = list(map(int, input().split()))
aset = set([int(eval(input())) for _ in range(M)])
dp = [0] * (N + 1)
dp[0] = 1
for i in range(N):
for j in range(i + 1, min(N, i + 2) + 1):
if j not in aset:
dp[j] += dp[i]
dp[j] %= 10**9 + 7
print((dp[N]))
| false | 0 | [
"-MOD = 10**9 + 7",
"-dp[1] = 0 if 1 in aset else 1",
"-for i in range(2, N + 1):",
"- if i not in aset:",
"- dp[i] = dp[i - 1] + dp[i - 2]",
"-print((dp[-1] % MOD))",
"+for i in range(N):",
"+ for j in range(i + 1, min(N, i + 2) + 1):",
"+ if j not in aset:",
"+ dp[... | false | 0.037913 | 0.038973 | 0.97279 | [
"s820974626",
"s711353569"
] |
u028939600 | p00474 | python | s550661494 | s335920018 | 220 | 200 | 12,644 | 12,592 | Accepted | Accepted | 9.09 | def orderN(N,L,ices):
upPeak = L - ices[0]
downPeak = L - ices[0]
peaks = []
for i in range(len(ices)):
if i < N-1:
if ices[i] < ices[i+1]:
peaks.append(downPeak)
downPeak = L - ices[i+1]
upPeak += L - ices[i+1]
el... | def orderN(N,L,ices):
upPeak = L - ices[0]
downPeak = L - ices[0]
peaks = []
for i in range(len(ices)):
if i < N-1:
if ices[i] < ices[i+1]:
peaks.append(downPeak)
downPeak = L - ices[i+1]
upPeak += L - ices[i+1]
el... | 28 | 23 | 740 | 673 | def orderN(N, L, ices):
upPeak = L - ices[0]
downPeak = L - ices[0]
peaks = []
for i in range(len(ices)):
if i < N - 1:
if ices[i] < ices[i + 1]:
peaks.append(downPeak)
downPeak = L - ices[i + 1]
upPeak += L - ices[i + 1]
el... | def orderN(N, L, ices):
upPeak = L - ices[0]
downPeak = L - ices[0]
peaks = []
for i in range(len(ices)):
if i < N - 1:
if ices[i] < ices[i + 1]:
peaks.append(downPeak)
downPeak = L - ices[i + 1]
upPeak += L - ices[i + 1]
el... | false | 17.857143 | [
"-ices = []",
"-while True:",
"- ice = int(input().strip())",
"- ices.append(ice)",
"- if len(ices) == N:",
"- break",
"+ices = [int(input().strip()) for _ in range(N)]"
] | false | 0.046378 | 0.043411 | 1.068349 | [
"s550661494",
"s335920018"
] |
u225020286 | p02791 | python | s438029666 | s871396292 | 121 | 90 | 24,744 | 24,744 | Accepted | Accepted | 25.62 | N=int(eval(input()))
P=list(map(int,input().split()))
min=10**8
count=0
for i in range(N):
if P[i]==1:
print((count+1))
exit()
elif min>=P[i]:
count+=1
min=P[i] | N=int(eval(input()))
P=list(map(int,input().split()))
num=100000000
ans=0
for i in P:
if num>i:
ans+=1
num=i
print(ans)
| 11 | 10 | 182 | 137 | N = int(eval(input()))
P = list(map(int, input().split()))
min = 10**8
count = 0
for i in range(N):
if P[i] == 1:
print((count + 1))
exit()
elif min >= P[i]:
count += 1
min = P[i]
| N = int(eval(input()))
P = list(map(int, input().split()))
num = 100000000
ans = 0
for i in P:
if num > i:
ans += 1
num = i
print(ans)
| false | 9.090909 | [
"-min = 10**8",
"-count = 0",
"-for i in range(N):",
"- if P[i] == 1:",
"- print((count + 1))",
"- exit()",
"- elif min >= P[i]:",
"- count += 1",
"- min = P[i]",
"+num = 100000000",
"+ans = 0",
"+for i in P:",
"+ if num > i:",
"+ ans += 1",
"+... | false | 0.037125 | 0.063783 | 0.582051 | [
"s438029666",
"s871396292"
] |
u476604182 | p03722 | python | s730494075 | s811184888 | 589 | 393 | 44,892 | 44,780 | Accepted | Accepted | 33.28 | from collections import defaultdict
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
rdic = defaultdict(list)
nin = [0]*N
Els = []
for a,b,c in zip(*[iter(L)]*3):
dic[a-1] += [b-1]
rdic[b-1] += [a-1]
nin[b-1] += 1
Els += [(a-1,b-1,-c)]
To = [False]*N
From = [False]*N
q = ... | from collections import defaultdict
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
rdic = defaultdict(list)
nin = [0]*N
Els = []
for a,b,c in zip(*[iter(L)]*3):
dic[a-1] += [b-1]
rdic[b-1] += [a-1]
nin[b-1] += 1
Els += [(a-1,b-1,-c)]
To = [False]*N
From = [False]*N
q = ... | 61 | 59 | 1,089 | 1,040 | from collections import defaultdict
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
rdic = defaultdict(list)
nin = [0] * N
Els = []
for a, b, c in zip(*[iter(L)] * 3):
dic[a - 1] += [b - 1]
rdic[b - 1] += [a - 1]
nin[b - 1] += 1
Els += [(a - 1, b - 1, -c)]
To = [False] * N
Fro... | from collections import defaultdict
N, M, *L = list(map(int, open(0).read().split()))
dic = defaultdict(list)
rdic = defaultdict(list)
nin = [0] * N
Els = []
for a, b, c in zip(*[iter(L)] * 3):
dic[a - 1] += [b - 1]
rdic[b - 1] += [a - 1]
nin[b - 1] += 1
Els += [(a - 1, b - 1, -c)]
To = [False] * N
Fro... | false | 3.278689 | [
"- if cnt > 2 * N:",
"+ if cnt > N:",
"-elif dist[N - 1] == float(\"inf\"):",
"- print(\"inf\")"
] | false | 0.051089 | 0.050658 | 1.008501 | [
"s730494075",
"s811184888"
] |
u952708174 | p03829 | python | s232960564 | s268774655 | 93 | 82 | 14,252 | 14,480 | Accepted | Accepted | 11.83 | N,A,B = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = 0
for i in range(N-1):
ans += min(A*(X[i+1]-X[i]), B)
print(ans) | def d_walk_and_teleport(N, A, B, X):
# 西から東に1つずつ、歩くかテレポートのどちらか疲労しない方で進む
ans = sum([min(A * (X[k + 1] - X[k]), B) for k in range(N - 1)])
return ans
N,A,B = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
print((d_walk_and_teleport(N, A, B, X))) | 7 | 8 | 159 | 286 | N, A, B = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = 0
for i in range(N - 1):
ans += min(A * (X[i + 1] - X[i]), B)
print(ans)
| def d_walk_and_teleport(N, A, B, X):
# 西から東に1つずつ、歩くかテレポートのどちらか疲労しない方で進む
ans = sum([min(A * (X[k + 1] - X[k]), B) for k in range(N - 1)])
return ans
N, A, B = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
print((d_walk_and_teleport(N, A, B, X)))
| false | 12.5 | [
"+def d_walk_and_teleport(N, A, B, X):",
"+ # 西から東に1つずつ、歩くかテレポートのどちらか疲労しない方で進む",
"+ ans = sum([min(A * (X[k + 1] - X[k]), B) for k in range(N - 1)])",
"+ return ans",
"+",
"+",
"-ans = 0",
"-for i in range(N - 1):",
"- ans += min(A * (X[i + 1] - X[i]), B)",
"-print(ans)",
"+print((d_... | false | 0.03651 | 0.04123 | 0.88553 | [
"s232960564",
"s268774655"
] |
u609061751 | p02717 | python | s151462307 | s756779866 | 179 | 163 | 38,256 | 38,256 | Accepted | Accepted | 8.94 | import sys
input = sys.stdin.readline
x, y, z = [int(x) for x in input().split()]
x, y = y, x
x, z = z, x
print((x, y, z)) | import sys
input = sys.stdin.readline
def linput():
return [int(x) for x in input().split()]
x, y, z = linput()
print((z, x, y)) | 9 | 9 | 131 | 141 | import sys
input = sys.stdin.readline
x, y, z = [int(x) for x in input().split()]
x, y = y, x
x, z = z, x
print((x, y, z))
| import sys
input = sys.stdin.readline
def linput():
return [int(x) for x in input().split()]
x, y, z = linput()
print((z, x, y))
| false | 0 | [
"-x, y, z = [int(x) for x in input().split()]",
"-x, y = y, x",
"-x, z = z, x",
"-print((x, y, z))",
"+",
"+",
"+def linput():",
"+ return [int(x) for x in input().split()]",
"+",
"+",
"+x, y, z = linput()",
"+print((z, x, y))"
] | false | 0.041259 | 0.038813 | 1.063022 | [
"s151462307",
"s756779866"
] |
u192908410 | p03946 | python | s296829815 | s227683374 | 113 | 100 | 11,832 | 14,252 | Accepted | Accepted | 11.5 | input('').split()
A = [int(x) for x in input('').split()]
max = 0
count = 0
pl = 0
msp = A[0]
for i in range(1,len(A)):
pl_t = pl + A[i] - A[i-1]
if pl_t <= 0:
pl = 0
else:
pl = pl_t
if max < pl_t:
max = pl_t
count = 1
elif max == pl_t:
count += 1
print(count) | eval(input())
A=list(map(int,input().split()))
d,c,s=0,0,A[0]
for x in A[1:]:
s=min(s,x)
D=x-s
if d<D:
d,c=D,1
elif D==d:
c+=1
print(c) | 18 | 11 | 324 | 147 | input("").split()
A = [int(x) for x in input("").split()]
max = 0
count = 0
pl = 0
msp = A[0]
for i in range(1, len(A)):
pl_t = pl + A[i] - A[i - 1]
if pl_t <= 0:
pl = 0
else:
pl = pl_t
if max < pl_t:
max = pl_t
count = 1
elif max == pl_t:
... | eval(input())
A = list(map(int, input().split()))
d, c, s = 0, 0, A[0]
for x in A[1:]:
s = min(s, x)
D = x - s
if d < D:
d, c = D, 1
elif D == d:
c += 1
print(c)
| false | 38.888889 | [
"-input(\"\").split()",
"-A = [int(x) for x in input(\"\").split()]",
"-max = 0",
"-count = 0",
"-pl = 0",
"-msp = A[0]",
"-for i in range(1, len(A)):",
"- pl_t = pl + A[i] - A[i - 1]",
"- if pl_t <= 0:",
"- pl = 0",
"- else:",
"- pl = pl_t",
"- if max < pl_t:",... | false | 0.040222 | 0.101319 | 0.396983 | [
"s296829815",
"s227683374"
] |
u054514819 | p03197 | python | s687955096 | s925130348 | 183 | 89 | 7,840 | 77,620 | Accepted | Accepted | 51.37 | N = int(eval(input()))
As = [int(eval(input())) for _ in range(N)]
if all([a%2==0 for a in As]):
print('second')
else:
print('first') | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = [True if int(eval(input()))%2==0 else False for _ in range(N)]
if all(As):
print('second')
else:
print('first')
| 7 | 12 | 136 | 285 | N = int(eval(input()))
As = [int(eval(input())) for _ in range(N)]
if all([a % 2 == 0 for a in As]):
print("second")
else:
print("first")
| import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = [True if int(eval(input())) % 2 == 0 else False for _ in range(N)]
if all(As):
print("second")
else:
print("first")
| false | 41.666667 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"-As = [int(eval(input())) for _ in range(N)]",
"-if all([a % 2 == 0 for a in As]):",
... | false | 0.034423 | 0.034946 | 0.985037 | [
"s687955096",
"s925130348"
] |
u692746605 | p02755 | python | s407894663 | s653403987 | 21 | 17 | 3,064 | 2,940 | Accepted | Accepted | 19.05 | A,B=list(map(int,input().split()))
for i in range(10,1250):
if int(i*0.08)==A and int(i*0.1)==B:
print(i)
break
else:
print((-1))
| A,B=list(map(int,input().split()))
for i in range(B*10,(B+1)*10):
if int(i*0.08)==A:
print(i)
break
else:
print((-1))
| 7 | 7 | 140 | 128 | A, B = list(map(int, input().split()))
for i in range(10, 1250):
if int(i * 0.08) == A and int(i * 0.1) == B:
print(i)
break
else:
print((-1))
| A, B = list(map(int, input().split()))
for i in range(B * 10, (B + 1) * 10):
if int(i * 0.08) == A:
print(i)
break
else:
print((-1))
| false | 0 | [
"-for i in range(10, 1250):",
"- if int(i * 0.08) == A and int(i * 0.1) == B:",
"+for i in range(B * 10, (B + 1) * 10):",
"+ if int(i * 0.08) == A:"
] | false | 0.042845 | 0.040059 | 1.06954 | [
"s407894663",
"s653403987"
] |
u285022453 | p02796 | python | s312972261 | s940847409 | 439 | 268 | 21,336 | 21,292 | Accepted | Accepted | 38.95 | n = int(eval(input()))
robot = []
for _ in range(n):
x, l = list(map(int, input().split()))
robot.append([x - l, x + l])
# startが被らないendが小さいもの
ans = 0
robot.sort(key=lambda x: x[1])
last = - float('inf')
for start, end in robot:
if start >= last:
ans += 1
last = end
print(... | import sys
input = sys.stdin.readline
n = int(eval(input()))
robot = []
for _ in range(n):
x, l = list(map(int, input().split()))
robot.append([x - l, x + l])
# startが被らないendが小さいもの
ans = 0
robot.sort(key=lambda x: x[1])
last = - float('inf')
for start, end in robot:
if start >= last:
... | 17 | 20 | 313 | 355 | n = int(eval(input()))
robot = []
for _ in range(n):
x, l = list(map(int, input().split()))
robot.append([x - l, x + l])
# startが被らないendが小さいもの
ans = 0
robot.sort(key=lambda x: x[1])
last = -float("inf")
for start, end in robot:
if start >= last:
ans += 1
last = end
print(ans)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
robot = []
for _ in range(n):
x, l = list(map(int, input().split()))
robot.append([x - l, x + l])
# startが被らないendが小さいもの
ans = 0
robot.sort(key=lambda x: x[1])
last = -float("inf")
for start, end in robot:
if start >= last:
ans += 1
... | false | 15 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.066762 | 0.068465 | 0.975131 | [
"s312972261",
"s940847409"
] |
u311379832 | p03013 | python | s638110299 | s746068852 | 179 | 150 | 11,884 | 13,640 | Accepted | Accepted | 16.2 | INF = (10 ** 9) + 7
N, M = list(map(int, input().split()))
aLst = set(int(eval(input())) for i in range(M))
ansLst = [0] * (N + 1)
ansLst[0] = 1
for i in range(1, N + 1):
if i in aLst:
continue
tmp = ansLst[i - 1]
if i > 1:
tmp += ansLst[i - 2]
ansLst[i] = tmp % INF
p... | INF = 10 ** 9 + 7
N, M = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(M)]
dp = [0] * (N + 1)
for i in range(M):
dp[a[i]] = -1
dp[0] = 1
for i in range(1, N + 1):
if dp[i] == -1: continue
tmp = 0
if dp[i - 1] != -1:
tmp += dp[i - 1]
if dp[i - 2] != -1... | 17 | 19 | 324 | 384 | INF = (10**9) + 7
N, M = list(map(int, input().split()))
aLst = set(int(eval(input())) for i in range(M))
ansLst = [0] * (N + 1)
ansLst[0] = 1
for i in range(1, N + 1):
if i in aLst:
continue
tmp = ansLst[i - 1]
if i > 1:
tmp += ansLst[i - 2]
ansLst[i] = tmp % INF
print((ansLst[N]))
| INF = 10**9 + 7
N, M = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(M)]
dp = [0] * (N + 1)
for i in range(M):
dp[a[i]] = -1
dp[0] = 1
for i in range(1, N + 1):
if dp[i] == -1:
continue
tmp = 0
if dp[i - 1] != -1:
tmp += dp[i - 1]
if dp[i - 2] != -1 and i > 1... | false | 10.526316 | [
"-INF = (10**9) + 7",
"+INF = 10**9 + 7",
"-aLst = set(int(eval(input())) for i in range(M))",
"-ansLst = [0] * (N + 1)",
"-ansLst[0] = 1",
"+a = [int(eval(input())) for _ in range(M)]",
"+dp = [0] * (N + 1)",
"+for i in range(M):",
"+ dp[a[i]] = -1",
"+dp[0] = 1",
"- if i in aLst:",
"+ ... | false | 0.106192 | 0.043686 | 2.430799 | [
"s638110299",
"s746068852"
] |
u821624310 | p02406 | python | s638076648 | s374421811 | 30 | 20 | 7,984 | 7,904 | Accepted | Accepted | 33.33 | n = int(input())
for N in range(3, n+1):
if N % 3 == 0\
or N % 10 == 3\
or str(N).find("3") != -1:
print(" {0}".format(N), end = "")
print()
| n = int(input())
for i in range(3, n+1):
if i % 3 == 0:
print(" " + str(i), end = "")
elif "3" in str(i):
print(" " + str(i), end = "")
print()
| 7 | 7 | 166 | 173 | n = int(input())
for N in range(3, n + 1):
if N % 3 == 0 or N % 10 == 3 or str(N).find("3") != -1:
print(" {0}".format(N), end="")
print()
| n = int(input())
for i in range(3, n + 1):
if i % 3 == 0:
print(" " + str(i), end="")
elif "3" in str(i):
print(" " + str(i), end="")
print()
| false | 0 | [
"-for N in range(3, n + 1):",
"- if N % 3 == 0 or N % 10 == 3 or str(N).find(\"3\") != -1:",
"- print(\" {0}\".format(N), end=\"\")",
"+for i in range(3, n + 1):",
"+ if i % 3 == 0:",
"+ print(\" \" + str(i), end=\"\")",
"+ elif \"3\" in str(i):",
"+ print(\" \" + str(i),... | false | 0.042508 | 0.044229 | 0.961092 | [
"s638076648",
"s374421811"
] |
u476604182 | p03112 | python | s848800058 | s395835659 | 961 | 571 | 45,268 | 36,612 | Accepted | Accepted | 40.58 | import numpy as np
A, B, Q, *L = list(map(int, open(0).read().split()))
s = L[:A]
t = L[A:A+B]
x = L[A+B:]
s = [-float('inf')]+s+[float('inf')]
t = [-float('inf')]+t+[float('inf')]
sls = np.searchsorted(s,x)
tls = np.searchsorted(t,x)
for ar, br, c in zip(sls,tls,x):
bl = br-1
al = ar-1
n = s[ar]-t[... | from bisect import bisect_left
A, B, Q, *L = list(map(int, open(0).read().split()))
s = L[:A]
t = L[A:A+B]
x = L[A+B:]
s = [-float('inf')]+s+[float('inf')]
t = [-float('inf')]+t+[float('inf')]
for c in x:
br = bisect_left(t,c)
ar = bisect_left(s,c)
bl = br-1
al = ar-1
print((min(s[ar]-t[bl]+min(... | 18 | 15 | 453 | 416 | import numpy as np
A, B, Q, *L = list(map(int, open(0).read().split()))
s = L[:A]
t = L[A : A + B]
x = L[A + B :]
s = [-float("inf")] + s + [float("inf")]
t = [-float("inf")] + t + [float("inf")]
sls = np.searchsorted(s, x)
tls = np.searchsorted(t, x)
for ar, br, c in zip(sls, tls, x):
bl = br - 1
al = ar - 1
... | from bisect import bisect_left
A, B, Q, *L = list(map(int, open(0).read().split()))
s = L[:A]
t = L[A : A + B]
x = L[A + B :]
s = [-float("inf")] + s + [float("inf")]
t = [-float("inf")] + t + [float("inf")]
for c in x:
br = bisect_left(t, c)
ar = bisect_left(s, c)
bl = br - 1
al = ar - 1
print(
... | false | 16.666667 | [
"-import numpy as np",
"+from bisect import bisect_left",
"-sls = np.searchsorted(s, x)",
"-tls = np.searchsorted(t, x)",
"-for ar, br, c in zip(sls, tls, x):",
"+for c in x:",
"+ br = bisect_left(t, c)",
"+ ar = bisect_left(s, c)",
"- n = s[ar] - t[bl] + min(s[ar] - c, c - t[bl])",
"- ... | false | 0.307031 | 0.040599 | 7.562493 | [
"s848800058",
"s395835659"
] |
u229660384 | p03556 | python | s064028288 | s683091649 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | N = int(eval(input()))
print((int(pow(N,0.5)//1)**2)) | N = int(eval(input()))
print((int(N**0.5)**2)) | 2 | 2 | 46 | 39 | N = int(eval(input()))
print((int(pow(N, 0.5) // 1) ** 2))
| N = int(eval(input()))
print((int(N**0.5) ** 2))
| false | 0 | [
"-print((int(pow(N, 0.5) // 1) ** 2))",
"+print((int(N**0.5) ** 2))"
] | false | 0.052553 | 0.089066 | 0.590048 | [
"s064028288",
"s683091649"
] |
u824295380 | p02732 | python | s934911706 | s446223884 | 1,664 | 413 | 26,784 | 26,780 | Accepted | Accepted | 75.18 | import math
import collections
def cmb(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(eval(input()))
M = input().split()
total = 0
count = collections.Counter(M)
for i in list(count.values()):
if i >= 2:
total += cmb(i, 2)
for j in M:
... | import collections
N= int(eval(input()))
A = list(map(int, input().split()))
b = collections.Counter(A)
C=0
for i in list(b.values()):
C+=i*(i-1)/2
for i in range(N):
print((int(C-(b[A[i]])+1))) | 18 | 10 | 340 | 198 | import math
import collections
def cmb(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(eval(input()))
M = input().split()
total = 0
count = collections.Counter(M)
for i in list(count.values()):
if i >= 2:
total += cmb(i, 2)
for j in M:
print((total - (count... | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
b = collections.Counter(A)
C = 0
for i in list(b.values()):
C += i * (i - 1) / 2
for i in range(N):
print((int(C - (b[A[i]]) + 1)))
| false | 44.444444 | [
"-import math",
"-",
"-def cmb(n, r):",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-",
"-",
"-M = input().split()",
"-total = 0",
"-count = collections.Counter(M)",
"-for i in list(count.values()):",
"- if i >= 2:",
"- total += cmb(i, 2)",
"-fo... | false | 0.108277 | 0.105251 | 1.02875 | [
"s934911706",
"s446223884"
] |
u581187895 | p03071 | python | s268623134 | s342131836 | 380 | 17 | 18,024 | 2,940 | Accepted | Accepted | 95.53 | import sys
import numpy as np
arr = [int(i) for i in sys.stdin.readline().split()]
total = 0
select_botton = np.argmax(arr)
for i in range(2):
total += arr[select_botton]
arr[select_botton] = arr[select_botton]-1
select_botton = np.argmax(arr)
print(total) | import sys
a, b = list(map(int,sys.stdin.readline().split()))
total = 0
if a == b:
total = a + b
else:
select_btn = max(a, b)
total = select_btn*2-1
print(total) | 10 | 9 | 271 | 169 | import sys
import numpy as np
arr = [int(i) for i in sys.stdin.readline().split()]
total = 0
select_botton = np.argmax(arr)
for i in range(2):
total += arr[select_botton]
arr[select_botton] = arr[select_botton] - 1
select_botton = np.argmax(arr)
print(total)
| import sys
a, b = list(map(int, sys.stdin.readline().split()))
total = 0
if a == b:
total = a + b
else:
select_btn = max(a, b)
total = select_btn * 2 - 1
print(total)
| false | 10 | [
"-import numpy as np",
"-arr = [int(i) for i in sys.stdin.readline().split()]",
"+a, b = list(map(int, sys.stdin.readline().split()))",
"-select_botton = np.argmax(arr)",
"-for i in range(2):",
"- total += arr[select_botton]",
"- arr[select_botton] = arr[select_botton] - 1",
"- select_botton ... | false | 0.528171 | 0.036066 | 14.644536 | [
"s268623134",
"s342131836"
] |
u885634168 | p03295 | python | s349560642 | s178732357 | 888 | 695 | 65,624 | 65,368 | Accepted | Accepted | 21.73 | N, M = list(map(int,input().split()))
a = []
for i in range(M):
a.append(list(map(int,input().split())))
a = sorted(a, key=lambda x: x[1])
bridges = []
for i in range(M):
flag = 1
for bridge in bridges:
if a[i][0] <= bridge and bridge < a[i][1]:
flag = 0
break
... | N, M = list(map(int,input().split()))
a = []
for i in range(M):
a.append(list(map(int,input().split())))
a = sorted(a, key=lambda x: x[1])
left = -1
ans = 0
for i in range(M):
if left < a[i][0]:
left = a[i][1] - 1
ans += 1
print(ans) | 15 | 12 | 385 | 264 | N, M = list(map(int, input().split()))
a = []
for i in range(M):
a.append(list(map(int, input().split())))
a = sorted(a, key=lambda x: x[1])
bridges = []
for i in range(M):
flag = 1
for bridge in bridges:
if a[i][0] <= bridge and bridge < a[i][1]:
flag = 0
break
if flag:
... | N, M = list(map(int, input().split()))
a = []
for i in range(M):
a.append(list(map(int, input().split())))
a = sorted(a, key=lambda x: x[1])
left = -1
ans = 0
for i in range(M):
if left < a[i][0]:
left = a[i][1] - 1
ans += 1
print(ans)
| false | 20 | [
"-bridges = []",
"+left = -1",
"+ans = 0",
"- flag = 1",
"- for bridge in bridges:",
"- if a[i][0] <= bridge and bridge < a[i][1]:",
"- flag = 0",
"- break",
"- if flag:",
"- bridges.append(a[i][1] - 1)",
"-print((len(bridges)))",
"+ if left < a[... | false | 0.036391 | 0.037318 | 0.975156 | [
"s349560642",
"s178732357"
] |
u929569377 | p02952 | python | s784400451 | s105748781 | 60 | 17 | 3,064 | 3,060 | Accepted | Accepted | 71.67 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if i < 10 or (i >= 100 and i < 1000) or (i >= 10000 and i < 100000):
ans += 1
print(ans) | N = int(eval(input()))
if N >= 10:
ans = 9
if N >= 1000:
ans += 900
if N == 100000:
ans += 90000
else:
ans += max(0, N - 9999)
else:
ans += max(0, N - 99)
else:
ans = N
print(ans) | 9 | 16 | 153 | 208 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if i < 10 or (i >= 100 and i < 1000) or (i >= 10000 and i < 100000):
ans += 1
print(ans)
| N = int(eval(input()))
if N >= 10:
ans = 9
if N >= 1000:
ans += 900
if N == 100000:
ans += 90000
else:
ans += max(0, N - 9999)
else:
ans += max(0, N - 99)
else:
ans = N
print(ans)
| false | 43.75 | [
"-ans = 0",
"-for i in range(1, N + 1):",
"- if i < 10 or (i >= 100 and i < 1000) or (i >= 10000 and i < 100000):",
"- ans += 1",
"+if N >= 10:",
"+ ans = 9",
"+ if N >= 1000:",
"+ ans += 900",
"+ if N == 100000:",
"+ ans += 90000",
"+ else:",
"+... | false | 0.040388 | 0.075868 | 0.53234 | [
"s784400451",
"s105748781"
] |
u046187684 | p02881 | python | s373724941 | s097814585 | 127 | 101 | 3,060 | 3,060 | Accepted | Accepted | 20.47 | def solve(string):
n = int(string)
l = int(n**0.5)
while n % l > 0:
l -= 1
return str(l + n // l - 2)
if __name__ == '__main__':
print((solve(eval(input()))))
| def solve(string):
n = int(string)
for i in range(int(n**0.5) + 1, 0, -1):
if n % i:
continue
else:
return str(i + n // i - 2)
if __name__ == '__main__':
print((solve(eval(input()))))
| 10 | 11 | 190 | 240 | def solve(string):
n = int(string)
l = int(n**0.5)
while n % l > 0:
l -= 1
return str(l + n // l - 2)
if __name__ == "__main__":
print((solve(eval(input()))))
| def solve(string):
n = int(string)
for i in range(int(n**0.5) + 1, 0, -1):
if n % i:
continue
else:
return str(i + n // i - 2)
if __name__ == "__main__":
print((solve(eval(input()))))
| false | 9.090909 | [
"- l = int(n**0.5)",
"- while n % l > 0:",
"- l -= 1",
"- return str(l + n // l - 2)",
"+ for i in range(int(n**0.5) + 1, 0, -1):",
"+ if n % i:",
"+ continue",
"+ else:",
"+ return str(i + n // i - 2)"
] | false | 0.045273 | 0.046635 | 0.970797 | [
"s373724941",
"s097814585"
] |
u543954314 | p03388 | python | s733040578 | s026362662 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | def check(a, b):
if b < a:
a, b = b, a
if b - a <= 1:
return 2 * a - 2
d = a * b
c, ng = a, b
while ng - c > 1:
mid = (ng + c) // 2
if mid ** 2 < d:
c = mid
else:
ng = mid
return 2 * c - 1 - (c * (c + 1) >= a * b)
for _ in range(int(eval(input()))):
print((... | from math import sqrt
eps = 10**-7
def check(a, b):
if b < a:
a, b = b, a
if b - a <= 1:
return 2 * a - 2
c = int(sqrt(a*b) - eps)
assert(c**2 < a*b <= (c+1)**2)
return 2 * c - 1 - (c * (c + 1) >= a * b)
for _ in range(int(eval(input()))):
print((check(*list(map(int, input().split()... | 17 | 15 | 354 | 317 | def check(a, b):
if b < a:
a, b = b, a
if b - a <= 1:
return 2 * a - 2
d = a * b
c, ng = a, b
while ng - c > 1:
mid = (ng + c) // 2
if mid**2 < d:
c = mid
else:
ng = mid
return 2 * c - 1 - (c * (c + 1) >= a * b)
for _ in range(int... | from math import sqrt
eps = 10**-7
def check(a, b):
if b < a:
a, b = b, a
if b - a <= 1:
return 2 * a - 2
c = int(sqrt(a * b) - eps)
assert c**2 < a * b <= (c + 1) ** 2
return 2 * c - 1 - (c * (c + 1) >= a * b)
for _ in range(int(eval(input()))):
print((check(*list(map(int, ... | false | 11.764706 | [
"+from math import sqrt",
"+",
"+eps = 10**-7",
"+",
"+",
"- d = a * b",
"- c, ng = a, b",
"- while ng - c > 1:",
"- mid = (ng + c) // 2",
"- if mid**2 < d:",
"- c = mid",
"- else:",
"- ng = mid",
"+ c = int(sqrt(a * b) - eps)",
"+ ... | false | 0.043895 | 0.042857 | 1.024227 | [
"s733040578",
"s026362662"
] |
u952900471 | p03475 | python | s867622257 | s310490961 | 168 | 58 | 3,188 | 3,064 | Accepted | Accepted | 65.48 | n = int(eval(input()))
_list = []
for _ in range(n - 1):
a, b, c = list(map(int, input().split()))
_list.append([a, b, c])
for i in range(n - 1):
num = i
time = 0
while num < n - 1:
c, s, f = _list[num]
if num == i:
time += s + c
num += 1... | # test
def c_SpecialTrains(N, STATION):
ans = []
for i in range(N):
t = 0 # 駅iからNまでにかかる時間
for j in range(i, N - 1):
c, s, f = STATION[j]
if t < s:
t = s # まだ運行していないので、運行するまで待つ必要がある
elif t % f == 0:
# tがfで割り切れるなら、すぐに鉄... | 44 | 22 | 706 | 688 | n = int(eval(input()))
_list = []
for _ in range(n - 1):
a, b, c = list(map(int, input().split()))
_list.append([a, b, c])
for i in range(n - 1):
num = i
time = 0
while num < n - 1:
c, s, f = _list[num]
if num == i:
time += s + c
num += 1
continue
... | # test
def c_SpecialTrains(N, STATION):
ans = []
for i in range(N):
t = 0 # 駅iからNまでにかかる時間
for j in range(i, N - 1):
c, s, f = STATION[j]
if t < s:
t = s # まだ運行していないので、運行するまで待つ必要がある
elif t % f == 0:
# tがfで割り切れるなら、すぐに鉄道に乗ればよい
... | false | 50 | [
"-n = int(eval(input()))",
"-_list = []",
"-for _ in range(n - 1):",
"- a, b, c = list(map(int, input().split()))",
"- _list.append([a, b, c])",
"-for i in range(n - 1):",
"- num = i",
"- time = 0",
"- while num < n - 1:",
"- c, s, f = _list[num]",
"- if num == i:",
... | false | 0.03704 | 0.036717 | 1.008793 | [
"s867622257",
"s310490961"
] |
u227082700 | p03161 | python | s550844320 | s697998426 | 609 | 348 | 54,364 | 52,448 | Accepted | Accepted | 42.86 | import sys
input=sys.stdin.readline
n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
kk=max(i-k,0)
dp[i]=min(d+abs(hh-h[i])for d,hh in zip(dp[kk:i],h[kk:i]))
print((dp[n-1]))
| n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
dp[i]=dp[i-1]+abs(h[i-1]-h[i])
for j in range(2,min(k+1,i+1)):
dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
print((dp[-1]))
| 9 | 8 | 228 | 226 | import sys
input = sys.stdin.readline
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * n
for i in range(1, n):
kk = max(i - k, 0)
dp[i] = min(d + abs(hh - h[i]) for d, hh in zip(dp[kk:i], h[kk:i]))
print((dp[n - 1]))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * n
for i in range(1, n):
dp[i] = dp[i - 1] + abs(h[i - 1] - h[i])
for j in range(2, min(k + 1, i + 1)):
dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]))
print((dp[-1]))
| false | 11.111111 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"- kk = max(i - k, 0)",
"- dp[i] = min(d + abs(hh - h[i]) for d, hh in zip(dp[kk:i], h[kk:i]))",
"-print((dp[n - 1]))",
"+ dp[i] = dp[i - 1] + abs(h[i - 1] - h[i])",
"+ for j in range(2, min(k + 1, i + 1)):",
"+ dp[i] = min(dp[i],... | false | 0.097661 | 0.038292 | 2.550433 | [
"s550844320",
"s697998426"
] |
u415154163 | p02868 | python | s004713397 | s576369247 | 1,274 | 949 | 116,512 | 111,520 | Accepted | Accepted | 25.51 | N,M = list(map(int,input().split(' ')))
tree_list = [[] for _ in range(N) ]
LRC = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x: (x[0], x[1]))
inf = float('inf')
dp = [inf] * N
dp[0] = 0
flag = False
if LRC[0][0] != 1:
print((-1))
else:
for l, r, c in LRC:
l = l ... | N,M = list(map(int,input().split(' ')))
tree_list = [[] for _ in range(N) ]
for _ in range(M):
L,R,C = list(map(int,input().split(' ')))
tree_list[R-1].append([C,L-1])
inf = float('inf')
dp = [inf] * N
dp[N-1] = 0
current_num = -1
flag = False
if len(tree_list[N-1]) > 0:
for i in reversed(list(r... | 30 | 31 | 733 | 931 | N, M = list(map(int, input().split(" ")))
tree_list = [[] for _ in range(N)]
LRC = sorted(
[list(map(int, input().split())) for i in range(M)], key=lambda x: (x[0], x[1])
)
inf = float("inf")
dp = [inf] * N
dp[0] = 0
flag = False
if LRC[0][0] != 1:
print((-1))
else:
for l, r, c in LRC:
l = l - 1
... | N, M = list(map(int, input().split(" ")))
tree_list = [[] for _ in range(N)]
for _ in range(M):
L, R, C = list(map(int, input().split(" ")))
tree_list[R - 1].append([C, L - 1])
inf = float("inf")
dp = [inf] * N
dp[N - 1] = 0
current_num = -1
flag = False
if len(tree_list[N - 1]) > 0:
for i in reversed(list(... | false | 3.225806 | [
"-LRC = sorted(",
"- [list(map(int, input().split())) for i in range(M)], key=lambda x: (x[0], x[1])",
"-)",
"+for _ in range(M):",
"+ L, R, C = list(map(int, input().split(\" \")))",
"+ tree_list[R - 1].append([C, L - 1])",
"-dp[0] = 0",
"+dp[N - 1] = 0",
"+current_num = -1",
"-if LRC[0]... | false | 0.045391 | 0.075243 | 0.603257 | [
"s004713397",
"s576369247"
] |
u252828980 | p03494 | python | s260657323 | s140300528 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | n = int(eval(input()))
li = list(map(int,input().split()))
flag = False
num = 0
while True:
for i in range(len(li)):
if li[i]%2 == 0:
li[i] = li[i]//2
if i == n-1:
flag = True
num += 1
else:
print(num)
ex... | n = int(eval(input()))
li = list(map(int,input().split()))
li = [bin(x) for x in li]
ans = 10**6
for i in range(len(li)):
ans = min(ans,len(li[i])-li[i].rfind("1")-1)
print(ans) | 14 | 8 | 318 | 183 | n = int(eval(input()))
li = list(map(int, input().split()))
flag = False
num = 0
while True:
for i in range(len(li)):
if li[i] % 2 == 0:
li[i] = li[i] // 2
if i == n - 1:
flag = True
num += 1
else:
print(num)
exit()
| n = int(eval(input()))
li = list(map(int, input().split()))
li = [bin(x) for x in li]
ans = 10**6
for i in range(len(li)):
ans = min(ans, len(li[i]) - li[i].rfind("1") - 1)
print(ans)
| false | 42.857143 | [
"-flag = False",
"-num = 0",
"-while True:",
"- for i in range(len(li)):",
"- if li[i] % 2 == 0:",
"- li[i] = li[i] // 2",
"- if i == n - 1:",
"- flag = True",
"- num += 1",
"- else:",
"- print(num)",
"- ... | false | 0.046704 | 0.047137 | 0.990812 | [
"s260657323",
"s140300528"
] |
u001024152 | p03363 | python | s368434494 | s740611971 | 1,510 | 215 | 41,984 | 39,668 | Accepted | Accepted | 85.76 | # a 200
from collections import Counter
from math import factorial
N = int(eval(input()))
a = list(map(int, input().split()))
#累計和
wa = [0]
for ai in a:
wa.append(wa[-1]+ai)
wa = wa[1:]
def combination(n, r):
return factorial(n)//(factorial(r)*factorial(n-r))
c = Counter(wa)
ans = 0
for ... | N = int(eval(input()))
a = list(map(int , input().split()))
s = [0]
d = {0:1}
for i in range(N):
nex = s[-1]+a[i]
s.append(nex)
if nex not in d:
d[nex] = 0
d[nex] += 1
ans = 0
for v in list(d.values()):
if v >= 2:
ans += int(v*(v-1)/2)
print(ans)
| 25 | 16 | 414 | 291 | # a 200
from collections import Counter
from math import factorial
N = int(eval(input()))
a = list(map(int, input().split()))
# 累計和
wa = [0]
for ai in a:
wa.append(wa[-1] + ai)
wa = wa[1:]
def combination(n, r):
return factorial(n) // (factorial(r) * factorial(n - r))
c = Counter(wa)
ans = 0
for k, v in li... | N = int(eval(input()))
a = list(map(int, input().split()))
s = [0]
d = {0: 1}
for i in range(N):
nex = s[-1] + a[i]
s.append(nex)
if nex not in d:
d[nex] = 0
d[nex] += 1
ans = 0
for v in list(d.values()):
if v >= 2:
ans += int(v * (v - 1) / 2)
print(ans)
| false | 36 | [
"-# a 200",
"-from collections import Counter",
"-from math import factorial",
"-",
"-# 累計和",
"-wa = [0]",
"-for ai in a:",
"- wa.append(wa[-1] + ai)",
"-wa = wa[1:]",
"-",
"-",
"-def combination(n, r):",
"- return factorial(n) // (factorial(r) * factorial(n - r))",
"-",
"-",
"-c... | false | 0.03483 | 0.090101 | 0.386571 | [
"s368434494",
"s740611971"
] |
u103341055 | p04045 | python | s266447039 | s994781977 | 306 | 74 | 2,940 | 2,940 | Accepted | Accepted | 75.82 | Num = [int(n) for n in input().rstrip().split()]
D = [int(n) for n in input().rstrip().split()]
for i in range(Num[0],100000):
if len(set([str(n) for n in D]) & set(str(i))) == 0:
print((int(i)))
break
| Num = [int(n) for n in input().rstrip().split()]
D = [int(n) for n in input().rstrip().split()]
# numbers = [ n for n in range(10) if not n in D]
flag = 0
for i in range(Num[0],10*Num[0]+1):
for j in str(i):
if int(j) in D:
flag = 1
break
if flag == 0:
... | 10 | 20 | 237 | 383 | Num = [int(n) for n in input().rstrip().split()]
D = [int(n) for n in input().rstrip().split()]
for i in range(Num[0], 100000):
if len(set([str(n) for n in D]) & set(str(i))) == 0:
print((int(i)))
break
| Num = [int(n) for n in input().rstrip().split()]
D = [int(n) for n in input().rstrip().split()]
# numbers = [ n for n in range(10) if not n in D]
flag = 0
for i in range(Num[0], 10 * Num[0] + 1):
for j in str(i):
if int(j) in D:
flag = 1
break
if flag == 0:
print(i)
... | false | 50 | [
"-for i in range(Num[0], 100000):",
"- if len(set([str(n) for n in D]) & set(str(i))) == 0:",
"- print((int(i)))",
"+# numbers = [ n for n in range(10) if not n in D]",
"+flag = 0",
"+for i in range(Num[0], 10 * Num[0] + 1):",
"+ for j in str(i):",
"+ if int(j) in D:",
"+ ... | false | 0.052664 | 0.047049 | 1.119351 | [
"s266447039",
"s994781977"
] |
u763249708 | p02689 | python | s621445200 | s062251314 | 374 | 279 | 30,396 | 20,948 | Accepted | Accepted | 25.4 | import copy
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
roads = []
for i in range(n): roads.append([])
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
roads[a].append(b)
roads[b].append(a)
ans = 0
for i in range(n):
flg = Tru... | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
roads = []
for i in range(n): roads.append([])
is_good_peak_arr = [True] * n
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
if h[a] >= h[b]: is_good_peak_arr[b] = False
if h[b] >= h[a]: i... | 23 | 14 | 439 | 374 | import copy
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
roads = []
for i in range(n):
roads.append([])
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
roads[a].append(b)
roads[b].append(a)
ans = 0
for i in range(n):
flg = True
for... | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
roads = []
for i in range(n):
roads.append([])
is_good_peak_arr = [True] * n
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
if h[a] >= h[b]:
is_good_peak_arr[b] = False
if h[b] >= h[a]:
... | false | 39.130435 | [
"-import copy",
"-",
"+is_good_peak_arr = [True] * n",
"- roads[a].append(b)",
"- roads[b].append(a)",
"-ans = 0",
"-for i in range(n):",
"- flg = True",
"- for j in roads[i]:",
"- if h[i] <= h[j]:",
"- flg = False",
"- break",
"- if flg:",
"- ... | false | 0.044692 | 0.037546 | 1.190316 | [
"s621445200",
"s062251314"
] |
u800058906 | p02641 | python | s093934289 | s060546923 | 29 | 25 | 9,108 | 9,152 | Accepted | Accepted | 13.79 | x,n=list(map(int,input().split()))
a=list(map(int,input().split()))
i=0
while True:
if not x-i in a:
print((x-i))
break
if not x+i in a:
print((x+i))
break
i+=1 | import sys
x,n=list(map(int,input().split()))
p=list(map(int,input().split()))
p.sort()
if n==0:
print(x)
sys.exit()
if x not in p:
print(x)
sys.exit()
q=list(i for i in range(p[0]-1,p[-1]+2))
for i in p:
q.remove(i)
ans=[]
c=x+n
for i in q:
if c>abs(x-i):
... | 13 | 30 | 208 | 433 | x, n = list(map(int, input().split()))
a = list(map(int, input().split()))
i = 0
while True:
if not x - i in a:
print((x - i))
break
if not x + i in a:
print((x + i))
break
i += 1
| import sys
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
if n == 0:
print(x)
sys.exit()
if x not in p:
print(x)
sys.exit()
q = list(i for i in range(p[0] - 1, p[-1] + 2))
for i in p:
q.remove(i)
ans = []
c = x + n
for i in q:
if c > abs(x - i):
c = ... | false | 56.666667 | [
"+import sys",
"+",
"-a = list(map(int, input().split()))",
"-i = 0",
"-while True:",
"- if not x - i in a:",
"- print((x - i))",
"- break",
"- if not x + i in a:",
"- print((x + i))",
"- break",
"- i += 1",
"+p = list(map(int, input().split()))",
"+p.s... | false | 0.038999 | 0.040008 | 0.974771 | [
"s093934289",
"s060546923"
] |
u086566114 | p02271 | python | s658416168 | s726143436 | 480 | 10 | 6,444 | 6,424 | Accepted | Accepted | 97.92 | # -*- coding: utf-8 -*-
def check_solvable_recursively(number, is_solvable, candidate_numbers):
"""exhaustively search representable as summation of numbers in candidate_numbers
Args:
number: representable number
is_solvable: is solvable list
candidate_numbers: candidate numb... | # -*- coding: utf-8 -*-
def main():
input() # pass length
candidate_number_list = [int(x) for x in input().strip().split(' ')]
input() # pass length
target_number_list = [int(x) for x in input().strip().split(' ')]
representable_number_set = {0}
for candidate_number in candidate_n... | 39 | 22 | 1,196 | 675 | # -*- coding: utf-8 -*-
def check_solvable_recursively(number, is_solvable, candidate_numbers):
"""exhaustively search representable as summation of numbers in candidate_numbers
Args:
number: representable number
is_solvable: is solvable list
candidate_numbers: candidate numbers to be us... | # -*- coding: utf-8 -*-
def main():
input() # pass length
candidate_number_list = [int(x) for x in input().strip().split(" ")]
input() # pass length
target_number_list = [int(x) for x in input().strip().split(" ")]
representable_number_set = {0}
for candidate_number in candidate_number_list:
... | false | 43.589744 | [
"-def check_solvable_recursively(number, is_solvable, candidate_numbers):",
"- \"\"\"exhaustively search representable as summation of numbers in candidate_numbers",
"- Args:",
"- number: representable number",
"- is_solvable: is solvable list",
"- candidate_numbers: candidate n... | false | 0.088139 | 0.043921 | 2.006734 | [
"s658416168",
"s726143436"
] |
u256464928 | p02928 | python | s891444364 | s353003191 | 1,740 | 1,291 | 3,188 | 3,188 | Accepted | Accepted | 25.8 | n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
inner_count=0
other_count=0
for i in range(n):
for j in range(n):
if i==j or i>j:
pass
else:
if A[i]>A[j]:
inner_count+=1
for x in range(n):
for y in range(n):
if A[x]>A[y]:
other_count+=1
in... | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
tmp = 0
tmp2 = 0
ans = 0
MOD = 10**9+7
for i in range(N):
for j in range(i,N):
if i == j:
pass
else:
if A[i] > A[j]:
tmp += 1
for k in range(N):
if A[i] > A[k]:
tmp2 += 1
ans += tmp2*K... | 18 | 22 | 423 | 378 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
inner_count = 0
other_count = 0
for i in range(n):
for j in range(n):
if i == j or i > j:
pass
else:
if A[i] > A[j]:
inner_count += 1
for x in range(n):
for y in range(n):
i... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
tmp = 0
tmp2 = 0
ans = 0
MOD = 10**9 + 7
for i in range(N):
for j in range(i, N):
if i == j:
pass
else:
if A[i] > A[j]:
tmp += 1
for k in range(N):
if A[i] > A[k]:
... | false | 18.181818 | [
"-n, k = list(map(int, input().split()))",
"+N, K = list(map(int, input().split()))",
"-inner_count = 0",
"-other_count = 0",
"-for i in range(n):",
"- for j in range(n):",
"- if i == j or i > j:",
"+tmp = 0",
"+tmp2 = 0",
"+ans = 0",
"+MOD = 10**9 + 7",
"+for i in range(N):",
"+ ... | false | 0.042387 | 0.038652 | 1.096609 | [
"s891444364",
"s353003191"
] |
u606033239 | p03478 | python | s933976147 | s068298681 | 45 | 35 | 3,292 | 3,060 | Accepted | Accepted | 22.22 | n,a,b = list(map(int,input().split()))
f = []
s = []
for i in range(a,n+1):
c = str(i)
for j in range(len(c)):
s.append(int(c[j]))
if sum(s[:5])>=a and sum(s[:5])<=b:
f.append(i)
s=[]
print((sum(f))) | n,a,b = list(map(int,input().split()))
s = 0
for i in range(1,n+1):
d = sum(list(map(int,str(i))))
if d>=a and d<=b:
s+=i
print(s) | 11 | 7 | 233 | 146 | n, a, b = list(map(int, input().split()))
f = []
s = []
for i in range(a, n + 1):
c = str(i)
for j in range(len(c)):
s.append(int(c[j]))
if sum(s[:5]) >= a and sum(s[:5]) <= b:
f.append(i)
s = []
print((sum(f)))
| n, a, b = list(map(int, input().split()))
s = 0
for i in range(1, n + 1):
d = sum(list(map(int, str(i))))
if d >= a and d <= b:
s += i
print(s)
| false | 36.363636 | [
"-f = []",
"-s = []",
"-for i in range(a, n + 1):",
"- c = str(i)",
"- for j in range(len(c)):",
"- s.append(int(c[j]))",
"- if sum(s[:5]) >= a and sum(s[:5]) <= b:",
"- f.append(i)",
"- s = []",
"-print((sum(f)))",
"+s = 0",
"+for i in range(1, n + 1):",
"+ d = ... | false | 0.040253 | 0.116242 | 0.34629 | [
"s933976147",
"s068298681"
] |
u987326700 | p02684 | python | s634122893 | s961453210 | 160 | 124 | 32,376 | 32,384 | Accepted | Accepted | 22.5 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = [1]
for i in range(n):
l.append(a[l[i]-1])
p = l.index(l[n])
#print(p,l[n])
if k<=n:
print((l[k]))
else:
x = (k-n+1)%(n-p)
if x ==0:
x += (n-p)
print((l[x-1]))
else:
print((l[x+p-1]))
| n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
l = [1]
for i in range(n):
l.append(a[l[i]-1])
p = l.index(l[-1])
if k<=n:
print((l[k]))
exit()
x = (k-n+1)%(n-p)
if x==0:
print((l[n-1]))
else:
print((l[x+p-1]))
| 17 | 16 | 290 | 260 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = [1]
for i in range(n):
l.append(a[l[i] - 1])
p = l.index(l[n])
# print(p,l[n])
if k <= n:
print((l[k]))
else:
x = (k - n + 1) % (n - p)
if x == 0:
x += n - p
print((l[x - 1]))
else:
print((l[x + p ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = [1]
for i in range(n):
l.append(a[l[i] - 1])
p = l.index(l[-1])
if k <= n:
print((l[k]))
exit()
x = (k - n + 1) % (n - p)
if x == 0:
print((l[n - 1]))
else:
print((l[x + p - 1]))
| false | 5.882353 | [
"-p = l.index(l[n])",
"-# print(p,l[n])",
"+p = l.index(l[-1])",
"+ exit()",
"+x = (k - n + 1) % (n - p)",
"+if x == 0:",
"+ print((l[n - 1]))",
"- x = (k - n + 1) % (n - p)",
"- if x == 0:",
"- x += n - p",
"- print((l[x - 1]))",
"- else:",
"- print((l[x ... | false | 0.03896 | 0.037444 | 1.040484 | [
"s634122893",
"s961453210"
] |
u808427016 | p03448 | python | s157906318 | s798433766 | 45 | 18 | 3,060 | 3,060 | Accepted | Accepted | 60 |
def solve(A, B, C, X):
r = 0
for i in range(0, A + 1):
for j in range(0, B + 1):
for k in range(0, C + 1):
t = i * 500 + j * 100 + k * 50
if t == X:
r += 1
return r
A = int(eval(input()))
B = int(eval(input()))
C = int(ev... |
def solve(A, B, C, X):
r = 0
for i in range(0, A + 1):
for j in range(0, B + 1):
t = i * 500 + j * 100
if t > X:
break
if 0 <= (X - t) / 50 <= C:
r += 1
return r
A = int(eval(input()))
B = int(eval(input()))
C = int(... | 18 | 19 | 393 | 395 | def solve(A, B, C, X):
r = 0
for i in range(0, A + 1):
for j in range(0, B + 1):
for k in range(0, C + 1):
t = i * 500 + j * 100 + k * 50
if t == X:
r += 1
return r
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
... | def solve(A, B, C, X):
r = 0
for i in range(0, A + 1):
for j in range(0, B + 1):
t = i * 500 + j * 100
if t > X:
break
if 0 <= (X - t) / 50 <= C:
r += 1
return r
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))... | false | 5.263158 | [
"- for k in range(0, C + 1):",
"- t = i * 500 + j * 100 + k * 50",
"- if t == X:",
"- r += 1",
"+ t = i * 500 + j * 100",
"+ if t > X:",
"+ break",
"+ if 0 <= (X - t) / 50 <= C:",
"+ ... | false | 0.076931 | 0.039256 | 1.95971 | [
"s157906318",
"s798433766"
] |
u271934630 | p02952 | python | s938142932 | s407340043 | 184 | 17 | 38,384 | 3,064 | Accepted | Accepted | 90.76 | n = eval(input())
if len(n) == 1:
print(n)
elif len(n) == 2:
print((9))
elif len(n) == 3:
print((9+(int(n)-100+1)))
elif len(n) == 4:
print((909))
elif len(n) == 5:
print((9+900+(int(n)-10000+1)))
elif len(n) == 6:
print((90909))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
N = i_i()
l = len(str(N))
if l == 1 or l == 2:
print((min(9, N)))
elif l == 3 or l == 4:
print((min(9 + N - 100 +... | 14 | 18 | 252 | 382 | n = eval(input())
if len(n) == 1:
print(n)
elif len(n) == 2:
print((9))
elif len(n) == 3:
print((9 + (int(n) - 100 + 1)))
elif len(n) == 4:
print((909))
elif len(n) == 5:
print((9 + 900 + (int(n) - 10000 + 1)))
elif len(n) == 6:
print((90909))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
N = i_i()
l = len(str(N))
if l == 1 or l == 2:
print((min(9, N)))
elif l == 3 or l == 4:
print((min(9 + N - 100 + 1, 909)))
else:
... | false | 22.222222 | [
"-n = eval(input())",
"-if len(n) == 1:",
"- print(n)",
"-elif len(n) == 2:",
"- print((9))",
"-elif len(n) == 3:",
"- print((9 + (int(n) - 100 + 1)))",
"-elif len(n) == 4:",
"- print((909))",
"-elif len(n) == 5:",
"- print((9 + 900 + (int(n) - 10000 + 1)))",
"-elif len(n) == 6:... | false | 0.038647 | 0.007763 | 4.978116 | [
"s938142932",
"s407340043"
] |
u879870653 | p03946 | python | s779534015 | s699643916 | 347 | 185 | 33,332 | 23,368 | Accepted | Accepted | 46.69 | import numpy as np
N,T = list(map(int,input().split()))
A = np.array(input().split(), dtype=np.int64)
A_cummin = np.minimum.accumulate(A)
profit = A - A_cummin
ans = (profit == profit.max()).sum()
print(ans)
| import numpy as np
N,T = list(map(int,input().split()))
A = np.array(list(map(int,input().split())))
A_cummin = np.minimum.accumulate(A)
profit = A - A_cummin
ans = (profit == profit.max()).sum()
print(ans)
| 11 | 7 | 216 | 207 | import numpy as np
N, T = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int64)
A_cummin = np.minimum.accumulate(A)
profit = A - A_cummin
ans = (profit == profit.max()).sum()
print(ans)
| import numpy as np
N, T = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A_cummin = np.minimum.accumulate(A)
profit = A - A_cummin
ans = (profit == profit.max()).sum()
print(ans)
| false | 36.363636 | [
"-A = np.array(input().split(), dtype=np.int64)",
"+A = np.array(list(map(int, input().split())))"
] | false | 0.224876 | 0.235244 | 0.955924 | [
"s779534015",
"s699643916"
] |
u498487134 | p02971 | python | s304238951 | s185773272 | 380 | 130 | 52,304 | 77,324 | Accepted | Accepted | 65.79 | import sys
input = sys.stdin.readline
N=int(eval(input()))
a=[0]*N
max1=[0,0]
max2=[0,0]
for i in range(N):
a=int(eval(input()))
if max1[0]<=a:
max2=max1
max1=[a,i]
elif max2[0]<=a:
max2=[a,i]
for i in range(N):
if i==max1[1]:
print((max2[0]))
el... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
A=[0]*N
Mi=-1
M=0
for i in range(N):
A[i]=I()
if A[i]>M:
... | 21 | 28 | 333 | 491 | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = [0] * N
max1 = [0, 0]
max2 = [0, 0]
for i in range(N):
a = int(eval(input()))
if max1[0] <= a:
max2 = max1
max1 = [a, i]
elif max2[0] <= a:
max2 = [a, i]
for i in range(N):
if i == max1[1]:
print((max2[0]))... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
A = [0] * N
Mi = -1
M = 0
for i in range(N):
A[i] = I()
... | false | 25 | [
"-N = int(eval(input()))",
"-a = [0] * N",
"-max1 = [0, 0]",
"-max2 = [0, 0]",
"-for i in range(N):",
"- a = int(eval(input()))",
"- if max1[0] <= a:",
"- max2 = max1",
"- max1 = [a, i]",
"- elif max2[0] <= a:",
"- max2 = [a, i]",
"-for i in range(N):",
"- if... | false | 0.035905 | 0.034993 | 1.026073 | [
"s304238951",
"s185773272"
] |
u761529120 | p03420 | python | s553354287 | s555765650 | 198 | 94 | 39,408 | 64,024 | Accepted | Accepted | 52.53 | def main():
N, K = list(map(int, input().split()))
cnt = 0
for b in range(1,N+1):
cnt += (N // b) * max(0, b - K)
cnt += max(0, (N % b) + 1 - K)
if K == 0:
cnt -= N
print(cnt)
if __name__ == "__main__":
main() | def num_divisors_cnt(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
def main():
N, K = list(map(int, input().split()))
ans = 0
for i in range(K+1,N+1):
cnt = i - K
cnt *=... | 15 | 25 | 269 | 474 | def main():
N, K = list(map(int, input().split()))
cnt = 0
for b in range(1, N + 1):
cnt += (N // b) * max(0, b - K)
cnt += max(0, (N % b) + 1 - K)
if K == 0:
cnt -= N
print(cnt)
if __name__ == "__main__":
main()
| def num_divisors_cnt(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
def main():
N, K = list(map(int, input().split()))
ans = 0
for i in range(K + 1, N + 1):
cnt = i - K
cnt *= N // i
cnt +=... | false | 40 | [
"+def num_divisors_cnt(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",
"+",
"+",
"- cnt = 0",
"- for b in range(1, N + 1):",
"- cnt += (N // b) * max(0, b - K)",
"- ... | false | 0.050362 | 0.038224 | 1.317545 | [
"s553354287",
"s555765650"
] |
u225202950 | p03075 | python | s448527285 | s561157841 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
k = int(eval(input()))
ant = [a, b, c, d, e]
f = False
for i in range(0, 5):
for ii in range(i + 1, 5):
sa = ant[i] - ant[ii]
if -sa <= k:
continue
el... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
k = int(eval(input()))
if e-a > k:
print(":(")
else:
print("Yay!") | 22 | 11 | 402 | 164 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
k = int(eval(input()))
ant = [a, b, c, d, e]
f = False
for i in range(0, 5):
for ii in range(i + 1, 5):
sa = ant[i] - ant[ii]
if -sa <= k:
continue
else:
... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
k = int(eval(input()))
if e - a > k:
print(":(")
else:
print("Yay!")
| false | 50 | [
"-ant = [a, b, c, d, e]",
"-f = False",
"-for i in range(0, 5):",
"- for ii in range(i + 1, 5):",
"- sa = ant[i] - ant[ii]",
"- if -sa <= k:",
"- continue",
"- else:",
"- print(\":(\")",
"- f = True",
"- break",
"- break",
... | false | 0.04773 | 0.047785 | 0.998848 | [
"s448527285",
"s561157841"
] |
u131984977 | p02413 | python | s262392587 | s516864079 | 60 | 40 | 6,724 | 6,728 | Accepted | Accepted | 33.33 | (r, c) = [int(i) for i in input().split()]
ct = [0 for d in range(c)]
tmp = []
for rc in range(r):
tmp = [int(i) for i in input().split()]
total = 0
for cc in range(c):
ct[cc] += tmp[cc]
total += tmp[cc]
print(tmp[cc], end=' ')
print(total)
total = sum(ct)
print(' '... | (r, c) = [int(i) for i in input().split()]
table = []
for rc in range(r):
table.append([int(i) for i in input().split()])
table.append([0 for _ in range(c + 1)])
for rc in range(r):
row_total = 0
for cc in range(c):
table[r][cc] += table[rc][cc]
row_total += table[rc][cc]
... | 14 | 19 | 355 | 455 | (r, c) = [int(i) for i in input().split()]
ct = [0 for d in range(c)]
tmp = []
for rc in range(r):
tmp = [int(i) for i in input().split()]
total = 0
for cc in range(c):
ct[cc] += tmp[cc]
total += tmp[cc]
print(tmp[cc], end=" ")
print(total)
total = sum(ct)
print(" ".join([str(i) ... | (r, c) = [int(i) for i in input().split()]
table = []
for rc in range(r):
table.append([int(i) for i in input().split()])
table.append([0 for _ in range(c + 1)])
for rc in range(r):
row_total = 0
for cc in range(c):
table[r][cc] += table[rc][cc]
row_total += table[rc][cc]
table[rc].appen... | false | 26.315789 | [
"-ct = [0 for d in range(c)]",
"-tmp = []",
"+table = []",
"- tmp = [int(i) for i in input().split()]",
"- total = 0",
"+ table.append([int(i) for i in input().split()])",
"+table.append([0 for _ in range(c + 1)])",
"+for rc in range(r):",
"+ row_total = 0",
"- ct[cc] += tmp[cc]... | false | 0.008826 | 0.056012 | 0.157569 | [
"s262392587",
"s516864079"
] |
u677121387 | p02642 | python | s604382386 | s912940484 | 240 | 217 | 125,196 | 125,080 | Accepted | Accepted | 9.58 | from collections import Counter
n = int(eval(input()))
a = [int(i) for i in input().split()]
mx = max(a)
flag = [True]*(mx+1)
c = Counter(a)
a.sort()
ans = 0
for i in range(n):
if flag[a[i]]:
if c[a[i]] == 1: ans += 1
for j in range(2*a[i],mx+1,a[i]): flag[j] = False
print(ans) | from collections import Counter
n = int(eval(input()))
a = [int(i) for i in input().split()]
mx = max(a)
flag = [True]*(mx+1)
c = Counter(a)
a.sort()
ans = 0
for i in range(n):
if flag[a[i]]:
if c[a[i]] == 1: ans += 1
for j in range(a[i],mx+1,a[i]): flag[j] = False
print(ans) | 13 | 13 | 304 | 302 | from collections import Counter
n = int(eval(input()))
a = [int(i) for i in input().split()]
mx = max(a)
flag = [True] * (mx + 1)
c = Counter(a)
a.sort()
ans = 0
for i in range(n):
if flag[a[i]]:
if c[a[i]] == 1:
ans += 1
for j in range(2 * a[i], mx + 1, a[i]):
flag[j] = Fal... | from collections import Counter
n = int(eval(input()))
a = [int(i) for i in input().split()]
mx = max(a)
flag = [True] * (mx + 1)
c = Counter(a)
a.sort()
ans = 0
for i in range(n):
if flag[a[i]]:
if c[a[i]] == 1:
ans += 1
for j in range(a[i], mx + 1, a[i]):
flag[j] = False
p... | false | 0 | [
"- for j in range(2 * a[i], mx + 1, a[i]):",
"+ for j in range(a[i], mx + 1, a[i]):"
] | false | 0.078133 | 0.06866 | 1.137963 | [
"s604382386",
"s912940484"
] |
u153335839 | p02984 | python | s251527170 | s212379681 | 167 | 150 | 14,028 | 14,092 | Accepted | Accepted | 10.18 | n = int(eval(input()))
a_list = list(map(int, input().split()))
s = 0
for a in a_list:
s += a
hoge = 0
for i in range(n-1):
if i%2 == 0:
continue
hoge += a_list[i]
x1 = s - (2 * hoge)
result = []
# result.append(x1)
print(x1)
xi = x1
for i in range(n-1):
hoge = (a_list[i] * 2) - ... | n = int(eval(input()))
a_list = list(map(int, input().split()))
s = 0
for a in a_list:
s += a
x1 = s - (2 * sum(a_list[1::2]))
result = []
# result.append(x1)
print(x1)
xi = x1
for i in range(n-1):
hoge = (a_list[i] * 2) - xi
# result.append(hoge)
print(hoge)
xi = hoge
# print(r... | 25 | 19 | 393 | 321 | n = int(eval(input()))
a_list = list(map(int, input().split()))
s = 0
for a in a_list:
s += a
hoge = 0
for i in range(n - 1):
if i % 2 == 0:
continue
hoge += a_list[i]
x1 = s - (2 * hoge)
result = []
# result.append(x1)
print(x1)
xi = x1
for i in range(n - 1):
hoge = (a_list[i] * 2) - xi
# r... | n = int(eval(input()))
a_list = list(map(int, input().split()))
s = 0
for a in a_list:
s += a
x1 = s - (2 * sum(a_list[1::2]))
result = []
# result.append(x1)
print(x1)
xi = x1
for i in range(n - 1):
hoge = (a_list[i] * 2) - xi
# result.append(hoge)
print(hoge)
xi = hoge
# print(result)
| false | 24 | [
"-hoge = 0",
"-for i in range(n - 1):",
"- if i % 2 == 0:",
"- continue",
"- hoge += a_list[i]",
"-x1 = s - (2 * hoge)",
"+x1 = s - (2 * sum(a_list[1::2]))"
] | false | 0.037857 | 0.077556 | 0.488125 | [
"s251527170",
"s212379681"
] |
u677121387 | p03160 | python | s716946110 | s491383738 | 243 | 139 | 52,848 | 13,928 | Accepted | Accepted | 42.8 | n = int(eval(input()))
h = [0]
for i in input().split(): h.append(int(i))
def cost(i,j): return abs(h[i]-h[j])
#dp[i]:= 足場iにたどり着く為の最小コスト
#dp[0]:= 0
#dp[1]:= 0
#dp[2]:= abs(h[1]-h[2])
dp = [0 for _ in range(n+1)]
dp[2] = cost(1,2)
for i in range(3,n+1):
dp[i] = min(dp[i-1]+cost(i,i-1),dp[i-2]+cost(i,i-2... | n = int(eval(input()))
h = [int(i) for i in input().split()]
INF = float("INF")
dp = [INF]*n
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(2,n):
dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]))
print((dp[n-1])) | 15 | 9 | 332 | 230 | n = int(eval(input()))
h = [0]
for i in input().split():
h.append(int(i))
def cost(i, j):
return abs(h[i] - h[j])
# dp[i]:= 足場iにたどり着く為の最小コスト
# dp[0]:= 0
# dp[1]:= 0
# dp[2]:= abs(h[1]-h[2])
dp = [0 for _ in range(n + 1)]
dp[2] = cost(1, 2)
for i in range(3, n + 1):
dp[i] = min(dp[i - 1] + cost(i, i - 1)... | n = int(eval(input()))
h = [int(i) for i in input().split()]
INF = float("INF")
dp = [INF] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, n):
dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]))
print((dp[n - 1]))
| false | 40 | [
"-h = [0]",
"-for i in input().split():",
"- h.append(int(i))",
"-",
"-",
"-def cost(i, j):",
"- return abs(h[i] - h[j])",
"-",
"-",
"-# dp[i]:= 足場iにたどり着く為の最小コスト",
"-# dp[0]:= 0",
"-# dp[1]:= 0",
"-# dp[2]:= abs(h[1]-h[2])",
"-dp = [0 for _ in range(n + 1)]",
"-dp[2] = cost(1, 2)",... | false | 0.037756 | 0.03686 | 1.024314 | [
"s716946110",
"s491383738"
] |
u952708174 | p03294 | python | s436873441 | s256841611 | 26 | 18 | 3,316 | 3,316 | Accepted | Accepted | 30.77 | def c_modulo_summation(N, A):
ans = 0
for a in A:
ans += a-1
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((c_modulo_summation(N, A))) | def c_modulo_summation(N, A):
return sum(a-1 for a in A)
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((c_modulo_summation(N, A))) | 9 | 6 | 187 | 153 | def c_modulo_summation(N, A):
ans = 0
for a in A:
ans += a - 1
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((c_modulo_summation(N, A)))
| def c_modulo_summation(N, A):
return sum(a - 1 for a in A)
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((c_modulo_summation(N, A)))
| false | 33.333333 | [
"- ans = 0",
"- for a in A:",
"- ans += a - 1",
"- return ans",
"+ return sum(a - 1 for a in A)"
] | false | 0.12344 | 0.15146 | 0.815 | [
"s436873441",
"s256841611"
] |
u068862866 | p03329 | python | s800337962 | s204687555 | 570 | 392 | 94,504 | 10,584 | Accepted | Accepted | 31.23 | import sys
sys.setrecursionlimit(2147483647)
memo = [float("inf")]*100005
def rec(n):
if n==0:
return 0
if memo[n]!=float("inf"):
return memo[n]
res = float("inf")
val = 1
while val<=n:
res = min(res,rec(n-val)+1)
val*=6
val = 1
while ... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
memo = [float("inf")]*100005
def rec(n):
if n==0:
return 0
if memo[n]!=float("inf"):
return memo[n]
res = float("inf")
val = 1
while val<=n:
res = min(res,rec(n-val)+1)
val*=6
... | 26 | 49 | 488 | 896 | import sys
sys.setrecursionlimit(2147483647)
memo = [float("inf")] * 100005
def rec(n):
if n == 0:
return 0
if memo[n] != float("inf"):
return memo[n]
res = float("inf")
val = 1
while val <= n:
res = min(res, rec(n - val) + 1)
val *= 6
val = 1
while val <= ... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
memo = [float("inf")] * 100005
def rec(n):
if n == 0:
return 0
if memo[n] != float("inf"):
return memo[n]
res = float("inf")
val = 1
while val <= n:
res = min(res, rec(n - val) + 1)
val *= 6
val = ... | false | 46.938776 | [
"+INF = float(\"inf\")",
"+dp = [INF] * 100005",
"+",
"+",
"+def morau_dp():",
"+ # min(dp[n-x]+1....)",
"+ N = int(eval(input()))",
"+ dp[0] = 0",
"+ for i in range(1, N + 1):",
"+ val = 1",
"+ while val <= N:",
"+ dp[i] = min(dp[i], dp[i - val] + 1)",
"... | false | 0.103891 | 0.105494 | 0.984803 | [
"s800337962",
"s204687555"
] |
u729133443 | p03565 | python | s883603194 | s461367359 | 172 | 26 | 38,960 | 9,076 | Accepted | Accepted | 84.88 | from re import*
s,t=open(0)
t=t[:-1]
u=''.join('(%s|\?)'%t for t in t)
a=[]
j=len(t)
for i in range(len(s)-j):
if match(u,s[i:i+j]):
a.append(sub('\?','a',s[:i])+t+sub('\?','a',s[i+j:]))
print((min(a or['UNRESTORABLE']))) | s,t=open(0)
m=len(t:=t[:-1])
for i in range(len(s)):
if all(c in'?'+d for c,d in zip(s[-i-m:],t)):s=s.replace(*'?a');exit(print(s[:-i-m]+t+s[-i:]))
print('UNRESTORABLE')
| 10 | 5 | 234 | 174 | from re import *
s, t = open(0)
t = t[:-1]
u = "".join("(%s|\?)" % t for t in t)
a = []
j = len(t)
for i in range(len(s) - j):
if match(u, s[i : i + j]):
a.append(sub("\?", "a", s[:i]) + t + sub("\?", "a", s[i + j :]))
print((min(a or ["UNRESTORABLE"])))
| s, t = open(0)
m = len(t := t[:-1])
for i in range(len(s)):
if all(c in "?" + d for c, d in zip(s[-i - m :], t)):
s = s.replace(*"?a")
exit(print(s[: -i - m] + t + s[-i:]))
print("UNRESTORABLE")
| false | 50 | [
"-from re import *",
"-",
"-t = t[:-1]",
"-u = \"\".join(\"(%s|\\?)\" % t for t in t)",
"-a = []",
"-j = len(t)",
"-for i in range(len(s) - j):",
"- if match(u, s[i : i + j]):",
"- a.append(sub(\"\\?\", \"a\", s[:i]) + t + sub(\"\\?\", \"a\", s[i + j :]))",
"-print((min(a or [\"UNRESTORA... | false | 0.04072 | 0.053091 | 0.766986 | [
"s883603194",
"s461367359"
] |
u977389981 | p02995 | python | s914674177 | s993293379 | 165 | 29 | 38,256 | 9,140 | Accepted | Accepted | 82.42 | A, B, C, D = list(map(int, input().split()))
def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
def lcm(x, y):
return (x * y) // gcd(x, y)
c = (A - 1) // C
d = (A - 1) // D
cd = (A - 1) // lcm(C, D)
tmp1 = c + d - cd
c = B // C
d = B // D
cd = B // lcm(C, D)
tmp2 = c + d ... | import math
a, b, c, d = list(map(int, input().split()))
lcm = (c * d) // math.gcd(c, d)
a -= 1
x = a // c
y = a // d
z = a // lcm
ans1 = a - (x + y - z)
x = b // c
y = b // d
z = b // lcm
ans2 = b - (x + y - z)
print((ans2 - ans1)) | 23 | 20 | 355 | 250 | A, B, C, D = list(map(int, input().split()))
def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
def lcm(x, y):
return (x * y) // gcd(x, y)
c = (A - 1) // C
d = (A - 1) // D
cd = (A - 1) // lcm(C, D)
tmp1 = c + d - cd
c = B // C
d = B // D
cd = B // lcm(C, D)
tmp2 = c + d - cd
print(((B - A +... | import math
a, b, c, d = list(map(int, input().split()))
lcm = (c * d) // math.gcd(c, d)
a -= 1
x = a // c
y = a // d
z = a // lcm
ans1 = a - (x + y - z)
x = b // c
y = b // d
z = b // lcm
ans2 = b - (x + y - z)
print((ans2 - ans1))
| false | 13.043478 | [
"-A, B, C, D = list(map(int, input().split()))",
"+import math",
"-",
"-def gcd(x, y):",
"- while y > 0:",
"- x, y = y, x % y",
"- return x",
"-",
"-",
"-def lcm(x, y):",
"- return (x * y) // gcd(x, y)",
"-",
"-",
"-c = (A - 1) // C",
"-d = (A - 1) // D",
"-cd = (A - 1)... | false | 0.068817 | 0.077598 | 0.886844 | [
"s914674177",
"s993293379"
] |
u874395007 | p02384 | python | s813470923 | s612300040 | 60 | 50 | 7,164 | 7,168 | Accepted | Accepted | 16.67 | from typing import List
class Dice:
sur = [i for i in range(6)]
def __init__(self, s: List[int]):
self.s = s # surfaceリスト
# indexが面の番号。リストの値は、それに接する面の番号。
self.sur[0] = [1, 2, 4, 3]
self.sur[1] = [0, 3, 5, 2]
self.sur[2] = [1, 5, 4, 0]
self.sur[... | from typing import List
class Dice:
sur = [i for i in range(6)]
def __init__(self, s: List[int]):
self.s = s # surfaceリスト
# indexが面の番号。リストの値は、それに接する面の番号。
self.sur[0] = [1, 2, 4, 3]
self.sur[1] = [0, 3, 5, 2]
self.sur[2] = [1, 5, 4, 0]
self.sur[... | 59 | 59 | 1,844 | 1,865 | from typing import List
class Dice:
sur = [i for i in range(6)]
def __init__(self, s: List[int]):
self.s = s # surfaceリスト
# indexが面の番号。リストの値は、それに接する面の番号。
self.sur[0] = [1, 2, 4, 3]
self.sur[1] = [0, 3, 5, 2]
self.sur[2] = [1, 5, 4, 0]
self.sur[3] = [1, 0, 4, 5... | from typing import List
class Dice:
sur = [i for i in range(6)]
def __init__(self, s: List[int]):
self.s = s # surfaceリスト
# indexが面の番号。リストの値は、それに接する面の番号。
self.sur[0] = [1, 2, 4, 3]
self.sur[1] = [0, 3, 5, 2]
self.sur[2] = [1, 5, 4, 0]
self.sur[3] = [1, 0, 4, 5... | false | 0 | [
"- def get_right_face_index(self, upper: int, front: int) -> int:",
"- for i, num in enumerate(self.sur[upper]):",
"- if num == front:",
"- return self.sur[upper][(i + 1) % 4]",
"+ def get_right_face_num(self, upper_num: int, front_num: int) -> int:",
"+ for i... | false | 0.061347 | 0.058726 | 1.044627 | [
"s813470923",
"s612300040"
] |
u226108478 | p03329 | python | s386195275 | s471142156 | 614 | 309 | 4,632 | 12,884 | Accepted | Accepted | 49.67 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
n = int(eval(input()))
dp = [0] + [100001 for _ in range(n + 1)]
# See:
# https://www.youtube.com/watch?v=I-8BnRkq6Ow
for i in range(1, n + 1):
power = 1
while power <= i:
... | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
dp = [float('inf') for _ in range(n + 100)]
dp[0] = 0
for i in range(1, n + 1):
dp[i] = min(dp[i - 1] + 1, dp[i])
six = 6
while six <= i:
dp[i] = min(dp[i - six] + 1, dp[i])
six... | 25 | 28 | 530 | 505 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
n = int(eval(input()))
dp = [0] + [100001 for _ in range(n + 1)]
# See:
# https://www.youtube.com/watch?v=I-8BnRkq6Ow
for i in range(1, n + 1):
power = 1
while power <= i:
dp[i] = mi... | # -*- coding: utf-8 -*-
def main():
n = int(eval(input()))
dp = [float("inf") for _ in range(n + 100)]
dp[0] = 0
for i in range(1, n + 1):
dp[i] = min(dp[i - 1] + 1, dp[i])
six = 6
while six <= i:
dp[i] = min(dp[i - six] + 1, dp[i])
six *= 6
nine =... | false | 10.714286 | [
"-# AtCoder Beginner Contest",
"-# Problem C",
"+def main():",
"+ n = int(eval(input()))",
"+ dp = [float(\"inf\") for _ in range(n + 100)]",
"+ dp[0] = 0",
"+ for i in range(1, n + 1):",
"+ dp[i] = min(dp[i - 1] + 1, dp[i])",
"+ six = 6",
"+ while six <= i:",
"+... | false | 0.105287 | 0.105334 | 0.99956 | [
"s386195275",
"s471142156"
] |
u844789719 | p03855 | python | s871230002 | s684227550 | 1,760 | 1,537 | 106,648 | 63,248 | Accepted | Accepted | 12.67 | N, K, L = [int(_) for _ in input().split()]
class UFT():
def __init__(self):
self.par = {}
self.rank = {}
for i in range(1, N + 1):
self.par[i] = i
self.rank[i] = 0
def find(self, x):
if self.par[x] == x:
return x
else:... | N, K, L = [int(_) for _ in input().split()]
class UFT():
def __init__(self):
self.par = [i for i in range(N + 1)]
self.rank = [0] * (N + 1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
... | 49 | 46 | 1,250 | 1,190 | N, K, L = [int(_) for _ in input().split()]
class UFT:
def __init__(self):
self.par = {}
self.rank = {}
for i in range(1, N + 1):
self.par[i] = i
self.rank[i] = 0
def find(self, x):
if self.par[x] == x:
return x
else:
sel... | N, K, L = [int(_) for _ in input().split()]
class UFT:
def __init__(self):
self.par = [i for i in range(N + 1)]
self.rank = [0] * (N + 1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self... | false | 6.122449 | [
"- self.par = {}",
"- self.rank = {}",
"- for i in range(1, N + 1):",
"- self.par[i] = i",
"- self.rank[i] = 0",
"+ self.par = [i for i in range(N + 1)]",
"+ self.rank = [0] * (N + 1)"
] | false | 0.046867 | 0.047982 | 0.976762 | [
"s871230002",
"s684227550"
] |
u227082700 | p03003 | python | s985339459 | s052947633 | 345 | 171 | 72,668 | 98,660 | Accepted | Accepted | 50.43 | n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[(m+1)*[1]for _ in range(n+1)]
for i in range(n):
for j in range(m):
dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]
if s[i]!=t[j]:dp[i+1][j+1]-=dp[i][j]
dp[i+1][j+1]%=(10**9+7)
print((dp[-1][-1])) | n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[1]*(m+1)for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
for j in range(1,m+1):
dp[i][j]=dp[i-1][j]+dp[i][j-1]
if s[i-1]!=t[j-1]:
dp[i][j]-=dp[i-1][j-1]
dp[i]... | 10 | 12 | 303 | 343 | n, m = list(map(int, input().split()))
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [(m + 1) * [1] for _ in range(n + 1)]
for i in range(n):
for j in range(m):
dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]
if s[i] != t[j]:
dp[i + 1][j + 1] -= dp[i][j]
... | n, m = list(map(int, input().split()))
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [[1] * (m + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
for j in range(1, m + 1):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
if s[i - 1] != t[j - 1]:
dp[i]... | false | 16.666667 | [
"-dp = [(m + 1) * [1] for _ in range(n + 1)]",
"-for i in range(n):",
"- for j in range(m):",
"- dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]",
"- if s[i] != t[j]:",
"- dp[i + 1][j + 1] -= dp[i][j]",
"- dp[i + 1][j + 1] %= 10**9 + 7",
"-print((dp[-1][-1]))",
"+dp... | false | 0.045929 | 0.045853 | 1.001665 | [
"s985339459",
"s052947633"
] |
u017810624 | p02892 | python | s888271992 | s469933446 | 315 | 289 | 45,248 | 44,652 | Accepted | Accepted | 8.25 | import sys
sys.setrecursionlimit(10**7)
n=int(eval(input()))
l=[list(eval(input())) for i in range(n)]
connection=[[] for i in range(n)]
for i in range(n):
for j in range(n):
if l[i][j]=='1':
connection[i].append(j)
colors = [0]*n
def dfs(v,color):
colors[v] = color
for to in conne... | import sys
sys.setrecursionlimit(10**7)
n=int(eval(input()))
l=[list(eval(input())) for i in range(n)]
connection=[[] for i in range(n)]
for i in range(n):
for j in range(n):
if l[i][j]=='1':
connection[i].append(j)
colors = [0]*n
def dfs(v,color):
colors[v] = color
for to in conne... | 54 | 54 | 1,143 | 1,184 | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
l = [list(eval(input())) for i in range(n)]
connection = [[] for i in range(n)]
for i in range(n):
for j in range(n):
if l[i][j] == "1":
connection[i].append(j)
colors = [0] * n
def dfs(v, color):
colors[v] = color
for to ... | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
l = [list(eval(input())) for i in range(n)]
connection = [[] for i in range(n)]
for i in range(n):
for j in range(n):
if l[i][j] == "1":
connection[i].append(j)
colors = [0] * n
def dfs(v, color):
colors[v] = color
for to ... | false | 0 | [
"- while len(next) != 0 or visitct != n:",
"+ while len(next) != 0 and visitct != n:",
"- distance[next[i]] = ct",
"- visited[next[i]] = 1",
"- visitct += 1",
"- for j in range(len(connection[next[i]])):",
"- if visited[connection[next[i]]... | false | 0.050421 | 0.050954 | 0.989544 | [
"s888271992",
"s469933446"
] |
u020390084 | p03363 | python | s042699590 | s499146971 | 1,510 | 193 | 59,668 | 59,360 | Accepted | Accepted | 87.22 | #!/usr/bin/env python3
import sys
from itertools import accumulate
from collections import Counter
from math import factorial
def combinations_count(n, r):
if n<r:
return 0
return factorial(n) // (factorial(n - r) * factorial(r))
def solve(N: int, A: "List[int]"):
accum = accumulate(A)
... | #!/usr/bin/env python3
import sys
from itertools import accumulate
from collections import Counter
from math import factorial
def comb(n, k):
if n < k:
return 0
k = min(n-k,k)
ans = 1
for i in range(1, k + 1):
ans = (ans * (n + 1 - i) // i)
return ans
def solve(N: in... | 36 | 40 | 931 | 951 | #!/usr/bin/env python3
import sys
from itertools import accumulate
from collections import Counter
from math import factorial
def combinations_count(n, r):
if n < r:
return 0
return factorial(n) // (factorial(n - r) * factorial(r))
def solve(N: int, A: "List[int]"):
accum = accumulate(A)
cou... | #!/usr/bin/env python3
import sys
from itertools import accumulate
from collections import Counter
from math import factorial
def comb(n, k):
if n < k:
return 0
k = min(n - k, k)
ans = 1
for i in range(1, k + 1):
ans = ans * (n + 1 - i) // i
return ans
def solve(N: int, A: "List[... | false | 10 | [
"-def combinations_count(n, r):",
"- if n < r:",
"+def comb(n, k):",
"+ if n < k:",
"- return factorial(n) // (factorial(n - r) * factorial(r))",
"+ k = min(n - k, k)",
"+ ans = 1",
"+ for i in range(1, k + 1):",
"+ ans = ans * (n + 1 - i) // i",
"+ return ans",
"- ... | false | 0.062961 | 0.12051 | 0.522457 | [
"s042699590",
"s499146971"
] |
u975997984 | p03433 | python | s995809130 | s197772249 | 30 | 25 | 8,868 | 9,088 | Accepted | Accepted | 16.67 | N = int(eval(input()))
A = int(eval(input()))
ret = 'No'
for a in range(A+1):
if N%500==a:
ret='Yes'
break
print(ret)
| N = int(eval(input()))
A = int(eval(input()))
if N%500 <= A:
print('Yes')
else:
print('No') | 8 | 6 | 123 | 88 | N = int(eval(input()))
A = int(eval(input()))
ret = "No"
for a in range(A + 1):
if N % 500 == a:
ret = "Yes"
break
print(ret)
| N = int(eval(input()))
A = int(eval(input()))
if N % 500 <= A:
print("Yes")
else:
print("No")
| false | 25 | [
"-ret = \"No\"",
"-for a in range(A + 1):",
"- if N % 500 == a:",
"- ret = \"Yes\"",
"- break",
"-print(ret)",
"+if N % 500 <= A:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.038275 | 0.054404 | 0.703528 | [
"s995809130",
"s197772249"
] |
u969236097 | p02802 | python | s261054548 | s967825898 | 424 | 283 | 45,300 | 45,244 | Accepted | Accepted | 33.25 | import sys
from functools import reduce
n, m = list(map(int, input().split()))
ps = [r.split() for r in sys.stdin.read().split('\n') if r != '']
ps.sort(key=lambda t: int(t[0]))
log = []
for i in range(0, n):
log.append([])
for j in range(0, m):
i = int(ps[j][0])
log[i-1].append(ps[j][1])
wacou... | import sys
from functools import reduce
n, m = list(map(int, input().split()))
ps = [r.split() for r in sys.stdin.read().split('\n') if r != '']
log = []
for i in range(0, n):
log.append([])
for j in range(0, m):
i = int(ps[j][0])
log[i-1].append(ps[j][1])
wacount = sum([l.index('AC') for l in [... | 15 | 14 | 472 | 438 | import sys
from functools import reduce
n, m = list(map(int, input().split()))
ps = [r.split() for r in sys.stdin.read().split("\n") if r != ""]
ps.sort(key=lambda t: int(t[0]))
log = []
for i in range(0, n):
log.append([])
for j in range(0, m):
i = int(ps[j][0])
log[i - 1].append(ps[j][1])
wacount = sum([... | import sys
from functools import reduce
n, m = list(map(int, input().split()))
ps = [r.split() for r in sys.stdin.read().split("\n") if r != ""]
log = []
for i in range(0, n):
log.append([])
for j in range(0, m):
i = int(ps[j][0])
log[i - 1].append(ps[j][1])
wacount = sum([l.index("AC") for l in [e for e i... | false | 6.666667 | [
"-ps.sort(key=lambda t: int(t[0]))"
] | false | 0.060464 | 0.061355 | 0.985485 | [
"s261054548",
"s967825898"
] |
u905203728 | p03353 | python | s158072372 | s524866507 | 954 | 330 | 121,352 | 25,204 | Accepted | Accepted | 65.41 | s=list(eval(input()))
words=[]
for i in range(len(s)):words.append("".join(s[i:]))
words=sorted(words)
record=[]
k=int(eval(input()))
for i in words:
for j in range(len(i)):
if "".join(i[:j+1]) not in record:
record.append("".join(i[:j+1]))
if len(record)>=k:
print((reco... | s=eval(input())
k=int(eval(input()))
words=[]
for i in range(len(s)):words.append(s[i:])
words.sort()
record=[]
for i in words:
for j in range(len(i)):
word="".join(i[:j+1])
if word not in record:
record.append(word)
if len(record)>=k:
print((record[k-1]))
... | 14 | 16 | 331 | 318 | s = list(eval(input()))
words = []
for i in range(len(s)):
words.append("".join(s[i:]))
words = sorted(words)
record = []
k = int(eval(input()))
for i in words:
for j in range(len(i)):
if "".join(i[: j + 1]) not in record:
record.append("".join(i[: j + 1]))
if len(record) >= k:
p... | s = eval(input())
k = int(eval(input()))
words = []
for i in range(len(s)):
words.append(s[i:])
words.sort()
record = []
for i in words:
for j in range(len(i)):
word = "".join(i[: j + 1])
if word not in record:
record.append(word)
if len(record) >= k:
print((record[k - 1]... | false | 12.5 | [
"-s = list(eval(input()))",
"+s = eval(input())",
"+k = int(eval(input()))",
"- words.append(\"\".join(s[i:]))",
"-words = sorted(words)",
"+ words.append(s[i:])",
"+words.sort()",
"-k = int(eval(input()))",
"- if \"\".join(i[: j + 1]) not in record:",
"- record.append(\"\"... | false | 0.06022 | 0.04354 | 1.383101 | [
"s158072372",
"s524866507"
] |
u500376440 | p03061 | python | s785836243 | s108818267 | 141 | 101 | 25,088 | 85,812 | Accepted | Accepted | 28.37 | import math
N=int(eval(input()))
A=list(map(int,input().split()))
L=[0]*(N+1)
for i in range(N):
L[i+1]=math.gcd(L[i],A[i])
R=[0]*(N+1)
for i in range(N-1,-1,-1):
R[i]=math.gcd(R[i+1],A[i])
M=[]
for i in range(N):
M.append(math.gcd(L[i],R[i+1]))
print((max(M)))
| from math import *
N=int(eval(input()))
A=list(map(int,input().split()))
left=[0]*(N+1)
for i in range(N):
left[i+1]=gcd(left[i],A[i])
right=[0]*(N+1)
for i in range(N-1,-1,-1):
right[i]=gcd(right[i+1],A[i])
ans=0
for i in range(N):
ans=max(ans,gcd(left[i],right[i+1]))
print(ans)
| 14 | 18 | 274 | 303 | import math
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * (N + 1)
for i in range(N):
L[i + 1] = math.gcd(L[i], A[i])
R = [0] * (N + 1)
for i in range(N - 1, -1, -1):
R[i] = math.gcd(R[i + 1], A[i])
M = []
for i in range(N):
M.append(math.gcd(L[i], R[i + 1]))
print((max(M)))
| from math import *
N = int(eval(input()))
A = list(map(int, input().split()))
left = [0] * (N + 1)
for i in range(N):
left[i + 1] = gcd(left[i], A[i])
right = [0] * (N + 1)
for i in range(N - 1, -1, -1):
right[i] = gcd(right[i + 1], A[i])
ans = 0
for i in range(N):
ans = max(ans, gcd(left[i], right[i + 1])... | false | 22.222222 | [
"-import math",
"+from math import *",
"-L = [0] * (N + 1)",
"+left = [0] * (N + 1)",
"- L[i + 1] = math.gcd(L[i], A[i])",
"-R = [0] * (N + 1)",
"+ left[i + 1] = gcd(left[i], A[i])",
"+right = [0] * (N + 1)",
"- R[i] = math.gcd(R[i + 1], A[i])",
"-M = []",
"+ right[i] = gcd(right[i +... | false | 0.103584 | 0.041994 | 2.466642 | [
"s785836243",
"s108818267"
] |
u588341295 | p03480 | python | s285083463 | s772097285 | 59 | 40 | 3,188 | 4,084 | Accepted | Accepted | 32.2 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/arc088/editorial.pdf
・一番真ん中に近い境界の、始点か終点の遠い方の距離が最適
・中央付近から順に境界を1つずつ減らして最終的に全0にできる。
"""
S = eval(input())
dist = float('inf')
for i in range(1, len(S)):
if S[i] != S[i-1]:
# 境界を見つけたら、始点か終点の遠い方の距離を取る
tmp = max(i, len(S)-i)
... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 23 | 30 | 469 | 900 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/arc088/editorial.pdf
・一番真ん中に近い境界の、始点か終点の遠い方の距離が最適
・中央付近から順に境界を1つずつ減らして最終的に全0にできる。
"""
S = eval(input())
dist = float("inf")
for i in range(1, len(S)):
if S[i] != S[i - 1]:
# 境界を見つけたら、始点か終点の遠い方の距離を取る
tmp = max(i, len(S) - i)
# この値が小さい程中央に近... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 23.333333 | [
"-\"\"\"",
"-参考:https://img.atcoder.jp/arc088/editorial.pdf",
"-・一番真ん中に近い境界の、始点か終点の遠い方の距離が最適",
"-・中央付近から順に境界を1つずつ減らして最終的に全0にできる。",
"-\"\"\"",
"-S = eval(input())",
"-dist = float(\"inf\")",
"-for i in range(1, len(S)):",
"- if S[i] != S[i - 1]:",
"- # 境界を見つけたら、始点か終点の遠い方の距離を取る",
"- ... | false | 0.093473 | 0.135866 | 0.687984 | [
"s285083463",
"s772097285"
] |
u197955752 | p02549 | python | s189558925 | s774075927 | 1,292 | 913 | 16,792 | 16,860 | Accepted | Accepted | 29.33 | # 解説を見て解き直し
N, K = [int(x) for x in input().split()]
ranges = [tuple(int(x) for x in input().split()) for _ in range(K)]
ranges.sort()
p = 998244353
dpsum = [0] * (N + 1)
dpsum[1] = 1
for i in range(2, N + 1):
dp = 0
for l, r in ranges:
rj = max(0, i - l)
lj = max(1, i - r)
... | # 解説を見て解き直し
N, K = [int(x) for x in input().split()]
ranges = [tuple(int(x) for x in input().split()) for _ in range(K)]
ranges.sort()
p = 998244353
dpsum = [0] * (N + 1)
dpsum[1] = 1
for i in range(2, N + 1):
dp = 0
for l, r in ranges:
rj = i - l
lj = max(1, i - r) # 1以上
... | 21 | 22 | 439 | 468 | # 解説を見て解き直し
N, K = [int(x) for x in input().split()]
ranges = [tuple(int(x) for x in input().split()) for _ in range(K)]
ranges.sort()
p = 998244353
dpsum = [0] * (N + 1)
dpsum[1] = 1
for i in range(2, N + 1):
dp = 0
for l, r in ranges:
rj = max(0, i - l)
lj = max(1, i - r)
dp += dpsum[r... | # 解説を見て解き直し
N, K = [int(x) for x in input().split()]
ranges = [tuple(int(x) for x in input().split()) for _ in range(K)]
ranges.sort()
p = 998244353
dpsum = [0] * (N + 1)
dpsum[1] = 1
for i in range(2, N + 1):
dp = 0
for l, r in ranges:
rj = i - l
lj = max(1, i - r) # 1以上
if rj <= 0:
... | false | 4.545455 | [
"- rj = max(0, i - l)",
"- lj = max(1, i - r)",
"+ rj = i - l",
"+ lj = max(1, i - r) # 1以上",
"+ if rj <= 0:",
"+ continue"
] | false | 0.036309 | 0.038312 | 0.947724 | [
"s189558925",
"s774075927"
] |
u440566786 | p02913 | python | s429315433 | s531243099 | 1,152 | 538 | 232,200 | 47,196 | Accepted | Accepted | 53.3 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=sys.stdin.readline
def resolve():
n=int(eval(input()))
s=eval(input())
dp=[[0]*(n+1) for _ in range(n+1)]
from itertools import product
for i,j in product(reversed(list(range(n))),repeat=2):
if i>=j:... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=sys.stdin.readline
def resolve():
def Z(s):
"""
param s:str
return list of int with length len(s)
"""
# initialization
n=len(s)
z=[0]*n
z[0]=n
# cons... | 24 | 44 | 580 | 1,038 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
# input=sys.stdin.readline
def resolve():
n = int(eval(input()))
s = eval(input())
dp = [[0] * (n + 1) for _ in range(n + 1)]
from itertools import product
for i, j in product(reversed(list(range(n))), repeat=2):
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = sys.stdin.readline
def resolve():
def Z(s):
"""
param s:str
return list of int with length len(s)
"""
# initialization
n = len(s)
z = [0] * n
z[0] = n
# ... | false | 45.454545 | [
"-# input=sys.stdin.readline",
"+input = sys.stdin.readline",
"+",
"+",
"+ def Z(s):",
"+ \"\"\"",
"+ param s:str",
"+ return list of int with length len(s)",
"+ \"\"\"",
"+ # initialization",
"+ n = len(s)",
"+ z = [0] * n",
"+ z[0]... | false | 0.047029 | 0.047664 | 0.986679 | [
"s429315433",
"s531243099"
] |
u014333473 | p03041 | python | s593272970 | s593364875 | 29 | 23 | 9,072 | 8,944 | Accepted | Accepted | 20.69 | n,k=map(int,input().split());s=input();print(*[s[i] if k-1!=i else s[i].lower() for i in range(n)],sep='')
| n,k=list(map(int,input().split()));s=eval(input());print((s[:k-1]+s[k-1].lower()+s[k:])) | 1 | 1 | 106 | 74 | n, k = map(int, input().split())
s = input()
print(*[s[i] if k - 1 != i else s[i].lower() for i in range(n)], sep="")
| n, k = list(map(int, input().split()))
s = eval(input())
print((s[: k - 1] + s[k - 1].lower() + s[k:]))
| false | 0 | [
"-n, k = map(int, input().split())",
"-s = input()",
"-print(*[s[i] if k - 1 != i else s[i].lower() for i in range(n)], sep=\"\")",
"+n, k = list(map(int, input().split()))",
"+s = eval(input())",
"+print((s[: k - 1] + s[k - 1].lower() + s[k:]))"
] | false | 0.092277 | 0.036635 | 2.518833 | [
"s593272970",
"s593364875"
] |
u062484507 | p02837 | python | s046687801 | s047283473 | 602 | 167 | 10,996 | 8,948 | Accepted | Accepted | 72.26 | import itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
xy = []
for _ in range(n):
m = int(readline())
tmp = [list(map(int, readline().split())) for _ in range(m)]
xy.append(tmp)
ans = 0
for l ... | import itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
xy = []
for _ in range(n):
m = int(readline())
tmp = [list(map(int, readline().split())) for _ in range(m)]
xy.append(tmp)
# 逆から
for l ... | 25 | 26 | 588 | 638 | import itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
xy = []
for _ in range(n):
m = int(readline())
tmp = [list(map(int, readline().split())) for _ in range(m)]
xy.append(tmp)
ans = 0
for l in list(itertools... | import itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
xy = []
for _ in range(n):
m = int(readline())
tmp = [list(map(int, readline().split())) for _ in range(m)]
xy.append(tmp)
# 逆から
for l in sorted(itertools... | false | 3.846154 | [
"-ans = 0",
"-for l in list(itertools.product([0, 1], repeat=n)):",
"+# 逆から",
"+for l in sorted(itertools.product([0, 1], repeat=n), reverse=True):",
"+ break",
"- ans = max(ans, sum(l))",
"-print(ans)",
"+ print((sum(l)))",
"+ exit()",
"+print(\"0\")"
] | false | 0.097445 | 0.064621 | 1.507954 | [
"s046687801",
"s047283473"
] |
u573754721 | p02935 | python | s313813685 | s923803877 | 186 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.86 | N = int(eval(input()))
lis_v = list(map(int, input().split()))
lis_v.sort()
while len(lis_v) != 1:
before = lis_v.pop(0)
lis_v[0] = ((before + lis_v[0])/2)
print((lis_v[0]))
| n = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
v=L[0]
for i in range(1,n):
v = (v + L[i])/2
print(v)
| 11 | 9 | 192 | 137 | N = int(eval(input()))
lis_v = list(map(int, input().split()))
lis_v.sort()
while len(lis_v) != 1:
before = lis_v.pop(0)
lis_v[0] = (before + lis_v[0]) / 2
print((lis_v[0]))
| n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
v = L[0]
for i in range(1, n):
v = (v + L[i]) / 2
print(v)
| false | 18.181818 | [
"-N = int(eval(input()))",
"-lis_v = list(map(int, input().split()))",
"-lis_v.sort()",
"-while len(lis_v) != 1:",
"- before = lis_v.pop(0)",
"- lis_v[0] = (before + lis_v[0]) / 2",
"-print((lis_v[0]))",
"+n = int(eval(input()))",
"+L = list(map(int, input().split()))",
"+L.sort()",
"+v = ... | false | 0.054335 | 0.037087 | 1.465076 | [
"s313813685",
"s923803877"
] |
u579699847 | p03161 | python | s473745636 | s596834043 | 1,476 | 515 | 22,756 | 57,312 | Accepted | Accepted | 65.11 | import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,K = LI()
h = np.array(LI())
dp = np.full(N,10**10,dtype=int)
dp[0] = 0
for i in range(1,N):
dp[i:i+K] = np.fmin(dp[i:i+K],dp[i-1]+np.abs(h[i:i+K]-h[i-1]))
print((dp[-1]))
| import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,K = LI()
h = LI()
dp = [float('INF')]*N
dp[0] = 0
for i,j in itertools.product(list(range(N)),list(range(1,K+1))):
if i+j<=N-1:
dp[i+j] = min(dp[i+j],dp[i]... | 9 | 11 | 276 | 342 | import numpy as np, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, K = LI()
h = np.array(LI())
dp = np.full(N, 10**10, dtype=int)
dp[0] = 0
for i in range(1, N):
dp[i : i + K] = np.fmin(dp[i : i + K], dp[i - 1] + np.abs(h[i : i + K] - h[i - 1]))
print((dp[-1]))
| import itertools, sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, K = LI()
h = LI()
dp = [float("INF")] * N
dp[0] = 0
for i, j in itertools.product(list(range(N)), list(range(1, K + 1))):
if i + j <= N - 1:
dp[i +... | false | 18.181818 | [
"-import numpy as np, sys",
"+import itertools, sys",
"+",
"+",
"+def I():",
"+ return int(sys.stdin.readline().rstrip())",
"-h = np.array(LI())",
"-dp = np.full(N, 10**10, dtype=int)",
"+h = LI()",
"+dp = [float(\"INF\")] * N",
"-for i in range(1, N):",
"- dp[i : i + K] = np.fmin(dp[i :... | false | 0.198731 | 0.034502 | 5.759963 | [
"s473745636",
"s596834043"
] |
u881590806 | p02277 | python | s793214082 | s183810727 | 1,320 | 1,150 | 23,872 | 23,316 | Accepted | Accepted | 12.88 | import copy
n = int(input())
cards = []
for i in range(n):
suit,num = input().strip().split(' ')
num = int(num)
cards.append((suit,num))
def quick_sort(S,p,r):
if p < r:
q = partition(S,p,r)
quick_sort(S,p,q-1)
quick_sort(S,q+1,r)
def partition(S,p,r):
x = ... | def sort(a, p, r):
if p < r:
q = partition(a, p, r)
sort(a, p, q-1)
sort(a, q+1, r)
def partition(a, p, r):
pivot = a[r]
i = p-1
for j in range(p, r):
if compare(pivot, a[j]) >= 0:
i += 1
a[i], a[j] = a[j], a[i]
a[r], a[i+1] = a... | 64 | 52 | 1,338 | 1,014 | import copy
n = int(input())
cards = []
for i in range(n):
suit, num = input().strip().split(" ")
num = int(num)
cards.append((suit, num))
def quick_sort(S, p, r):
if p < r:
q = partition(S, p, r)
quick_sort(S, p, q - 1)
quick_sort(S, q + 1, r)
def partition(S, p, r):
x ... | def sort(a, p, r):
if p < r:
q = partition(a, p, r)
sort(a, p, q - 1)
sort(a, q + 1, r)
def partition(a, p, r):
pivot = a[r]
i = p - 1
for j in range(p, r):
if compare(pivot, a[j]) >= 0:
i += 1
a[i], a[j] = a[j], a[i]
a[r], a[i + 1] = a[i + 1... | false | 18.75 | [
"-import copy",
"-",
"-n = int(input())",
"-cards = []",
"-for i in range(n):",
"- suit, num = input().strip().split(\" \")",
"- num = int(num)",
"- cards.append((suit, num))",
"+def sort(a, p, r):",
"+ if p < r:",
"+ q = partition(a, p, r)",
"+ sort(a, p, q - 1)",
... | false | 0.062738 | 0.096212 | 0.652081 | [
"s793214082",
"s183810727"
] |
u254871849 | p03835 | python | s122003630 | s719486389 | 1,968 | 18 | 3,060 | 2,940 | Accepted | Accepted | 99.09 | k, s = [int(x) for x in input().split()]
count = 0
for x in range(k+1):
if x <= s:
for y in range(k+1):
if x + y <= s:
z = s - (x + y)
if z <= k:
count += 1
print(count) | K, S = [int(x) for x in input().split()]
count = 0
for x in range(K+1):
# y + z = S - x
if 0 <= S - x <= K:
count += S - x + 1
# yに選べるのは0から(y+z)までのy+z-0+1通りすなわちS-x+1
elif K < S - x <= 2 * K:
count += 2 * K - S + x + 1
# K - ((S - x) - K) + 1
# excess = (S... | 11 | 16 | 276 | 429 | k, s = [int(x) for x in input().split()]
count = 0
for x in range(k + 1):
if x <= s:
for y in range(k + 1):
if x + y <= s:
z = s - (x + y)
if z <= k:
count += 1
print(count)
| K, S = [int(x) for x in input().split()]
count = 0
for x in range(K + 1):
# y + z = S - x
if 0 <= S - x <= K:
count += S - x + 1
# yに選べるのは0から(y+z)までのy+z-0+1通りすなわちS-x+1
elif K < S - x <= 2 * K:
count += 2 * K - S + x + 1
# K - ((S - x) - K) + 1
# excess = (S-x)-K
e... | false | 31.25 | [
"-k, s = [int(x) for x in input().split()]",
"+K, S = [int(x) for x in input().split()]",
"-for x in range(k + 1):",
"- if x <= s:",
"- for y in range(k + 1):",
"- if x + y <= s:",
"- z = s - (x + y)",
"- if z <= k:",
"- count += ... | false | 0.047461 | 0.047272 | 1.004005 | [
"s122003630",
"s719486389"
] |
u631277801 | p03722 | python | s428800640 | s114443411 | 861 | 692 | 3,444 | 3,316 | Accepted | Accepted | 19.63 | # 入力
import sys
stdin = sys.stdin
def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc... | # 入力
import sys
stdin = sys.stdin
def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc... | 59 | 48 | 1,372 | 1,097 | # 入力
import sys
stdin = sys.stdin
def li():
return [int(x) for x in stdin.readline().split()]
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return [float(x) for x in stdin.readline().split()]
def ls():
return stdin.readline().split()
def ns():
return stdin.rea... | # 入力
import sys
stdin = sys.stdin
def li():
return [int(x) for x in stdin.readline().split()]
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return [float(x) for x in stdin.readline().split()]
def ls():
return stdin.readline().split()
def ns():
return stdin.rea... | false | 18.644068 | [
"- hasUpdate = True",
"- cnt = 0",
"- cur = neg",
"- while hasUpdate:",
"- hasUpdate = False",
"- cnt += 1",
"+ ansn_1 = neg",
"+ ans_n = neg",
"+ for i in range(n + 1):",
"- bef = dist[to]",
"- # 更新されたならupdateをTrueに",
"- ... | false | 0.039473 | 0.043598 | 0.905386 | [
"s428800640",
"s114443411"
] |
u046187684 | p03503 | python | s804704323 | s871287581 | 353 | 205 | 12,700 | 3,188 | Accepted | Accepted | 41.93 | from itertools import product
import numpy as np
def solve(string):
n, *fp = list(map(int, string.split()))
# f = np.asarray(fp[:10 * n]).reshape((n, 10))
f = fp[:10 * n]
p = fp[10 * n:]
ans = -n * 10**7
"""
for o in product([0, 1], repeat=10):
if sum(o) == 0:
... | def solve(string):
n, *fp = string.split()
n = int(n)
f = fp[:10 * n]
p = list(map(int, fp[10 * n:]))
ans = -n * 10**7
int_f = [int("".join(f[10 * i:10 * (i + 1)]), 2) for i in range(n)]
for o in range(1, 2**10):
tmp = [sum(map(int, "{:b}".format(o & _f))) for _f in int_f]
... | 29 | 16 | 931 | 547 | from itertools import product
import numpy as np
def solve(string):
n, *fp = list(map(int, string.split()))
# f = np.asarray(fp[:10 * n]).reshape((n, 10))
f = fp[: 10 * n]
p = fp[10 * n :]
ans = -n * 10**7
"""
for o in product([0, 1], repeat=10):
if sum(o) == 0:
continu... | def solve(string):
n, *fp = string.split()
n = int(n)
f = fp[: 10 * n]
p = list(map(int, fp[10 * n :]))
ans = -n * 10**7
int_f = [int("".join(f[10 * i : 10 * (i + 1)]), 2) for i in range(n)]
for o in range(1, 2**10):
tmp = [sum(map(int, "{:b}".format(o & _f))) for _f in int_f]
... | false | 44.827586 | [
"-from itertools import product",
"-import numpy as np",
"-",
"-",
"- n, *fp = list(map(int, string.split()))",
"- # f = np.asarray(fp[:10 * n]).reshape((n, 10))",
"+ n, *fp = string.split()",
"+ n = int(n)",
"- p = fp[10 * n :]",
"+ p = list(map(int, fp[10 * n :]))",
"- \"\... | false | 0.035395 | 0.100863 | 0.350925 | [
"s804704323",
"s871287581"
] |
u785989355 | p03504 | python | s039435572 | s082438371 | 1,321 | 888 | 48,636 | 27,948 | Accepted | Accepted | 32.78 | N,C = list(map(int,input().split()))
P = [[] for i in range(C)]
for i in range(N):
s,t,c = list(map(int,input().split()))
P[c-1].append([s,"S"])
P[c-1].append([t,"T"])
P = [sorted(sorted(P[i],key=lambda x:x[1]),key=lambda x: x[0]) for i in range(C)]
#print(P)
P2 = []
for i in range(C):
... | N,C = list(map(int,input().split()))
program_list = []
for i in range(N):
s,t,c = list(map(int,input().split()))
program_list.append((s-0.5,"s",c-1))
program_list.append((t,"t",c-1))
program_list.sort(key=lambda x:x[0])
c_list=[0 for i in range(C)]
count_list=[0 for i in range(C)]
max_num... | 53 | 27 | 1,193 | 648 | N, C = list(map(int, input().split()))
P = [[] for i in range(C)]
for i in range(N):
s, t, c = list(map(int, input().split()))
P[c - 1].append([s, "S"])
P[c - 1].append([t, "T"])
P = [sorted(sorted(P[i], key=lambda x: x[1]), key=lambda x: x[0]) for i in range(C)]
# print(P)
P2 = []
for i in range(C):
fo... | N, C = list(map(int, input().split()))
program_list = []
for i in range(N):
s, t, c = list(map(int, input().split()))
program_list.append((s - 0.5, "s", c - 1))
program_list.append((t, "t", c - 1))
program_list.sort(key=lambda x: x[0])
c_list = [0 for i in range(C)]
count_list = [0 for i in range(C)]
max_nu... | false | 49.056604 | [
"-P = [[] for i in range(C)]",
"+program_list = []",
"- P[c - 1].append([s, \"S\"])",
"- P[c - 1].append([t, \"T\"])",
"-P = [sorted(sorted(P[i], key=lambda x: x[1]), key=lambda x: x[0]) for i in range(C)]",
"-# print(P)",
"-P2 = []",
"-for i in range(C):",
"- for j in range(len(P[i])):",
... | false | 0.098626 | 0.106742 | 0.923968 | [
"s039435572",
"s082438371"
] |
u780475861 | p03061 | python | s913005396 | s327118928 | 628 | 205 | 14,652 | 14,652 | Accepted | Accepted | 67.36 | import sys
from functools import lru_cache
@lru_cache(maxsize=None)
def gcd(a, b):
if b == 0:
return a
if a % b == 0:
return b
else:
return gcd(b, a % b)
N, *A = list(map(int, sys.stdin.read().split()))
L = [0] * (N + 2)
R = [0] * (N + 2)
for i in range(N):
L[... | import sys
from functools import lru_cache
sys.setrecursionlimit(1000000)
@lru_cache(maxsize=None)
def main():
def gcd(a, b):
if b == 0:
return a
if a % b == 0:
return b
else:
return gcd(b, a % b)
N, *A = list(map(int, sys.stdin.read(... | 21 | 26 | 446 | 584 | import sys
from functools import lru_cache
@lru_cache(maxsize=None)
def gcd(a, b):
if b == 0:
return a
if a % b == 0:
return b
else:
return gcd(b, a % b)
N, *A = list(map(int, sys.stdin.read().split()))
L = [0] * (N + 2)
R = [0] * (N + 2)
for i in range(N):
L[i + 2] = gcd(L[i... | import sys
from functools import lru_cache
sys.setrecursionlimit(1000000)
@lru_cache(maxsize=None)
def main():
def gcd(a, b):
if b == 0:
return a
if a % b == 0:
return b
else:
return gcd(b, a % b)
N, *A = list(map(int, sys.stdin.read().split()))
... | false | 19.230769 | [
"+sys.setrecursionlimit(1000000)",
"+",
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- if a % b == 0:",
"- return b",
"- else:",
"- return gcd(b, a % b)",
"+def main():",
"+ def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ if ... | false | 0.043609 | 0.039425 | 1.106118 | [
"s913005396",
"s327118928"
] |
u491763171 | p00004 | python | s498558737 | s319318111 | 20 | 10 | 4,256 | 4,256 | Accepted | Accepted | 50 | while 1:
try:
a, b, c, d, e, f = list(map(float, input().split()))
matrix = [[a, b, c], [d, e, f]]
for i in range(2):
tmp = matrix[i][i]
for j in range(3):
matrix[i][j] = matrix[i][j] / tmp
for j in range(2):
if i =... | def gauss(matrix):
dimension = len(matrix)
for i in range(dimension):
tmp = matrix[i][i]
for j in range(dimension + 1):
matrix[i][j] /= tmp
for j in range(dimension):
if i == j:
continue
else:
tmp2 = matrix[j][... | 18 | 22 | 614 | 653 | while 1:
try:
a, b, c, d, e, f = list(map(float, input().split()))
matrix = [[a, b, c], [d, e, f]]
for i in range(2):
tmp = matrix[i][i]
for j in range(3):
matrix[i][j] = matrix[i][j] / tmp
for j in range(2):
if i == j:
... | def gauss(matrix):
dimension = len(matrix)
for i in range(dimension):
tmp = matrix[i][i]
for j in range(dimension + 1):
matrix[i][j] /= tmp
for j in range(dimension):
if i == j:
continue
else:
tmp2 = matrix[j][i]
... | false | 18.181818 | [
"+def gauss(matrix):",
"+ dimension = len(matrix)",
"+ for i in range(dimension):",
"+ tmp = matrix[i][i]",
"+ for j in range(dimension + 1):",
"+ matrix[i][j] /= tmp",
"+ for j in range(dimension):",
"+ if i == j:",
"+ continue",
"+ ... | false | 0.034546 | 0.03864 | 0.894055 | [
"s498558737",
"s319318111"
] |
u561083515 | p03660 | python | s861604000 | s139958211 | 1,215 | 528 | 31,716 | 29,336 | Accepted | Accepted | 56.54 | import numpy as np
from collections import deque
N = int(eval(input()))
E = [[] for _ in range(N)]
for _ in range(N-1):
a,b = list(map(int,input().split()))
E[a-1].append(b-1)
E[b-1].append(a-1)
# BFS
def dist_from_X(X:int):
dist = np.full(N, -1)
que = deque([X])
dist[X] = 0
... | from collections import deque
N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N - 1):
a,b = list(map(int, input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
def dist_from_X(X:int):
""" BFSで距離を求める """
dist = [-1] * N
que = deque([X])
dist[X] = 0
... | 34 | 38 | 687 | 768 | import numpy as np
from collections import deque
N = int(eval(input()))
E = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
E[a - 1].append(b - 1)
E[b - 1].append(a - 1)
# BFS
def dist_from_X(X: int):
dist = np.full(N, -1)
que = deque([X])
dist[X] = 0
wh... | from collections import deque
N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
def dist_from_X(X: int):
"""BFSで距離を求める"""
dist = [-1] * N
que = deque([X])
dist[X] = 0
w... | false | 10.526316 | [
"-import numpy as np",
"-E = [[] for _ in range(N)]",
"+edge = [[] for _ in range(N)]",
"- E[a - 1].append(b - 1)",
"- E[b - 1].append(a - 1)",
"-# BFS",
"+ edge[a - 1].append(b - 1)",
"+ edge[b - 1].append(a - 1)",
"+",
"+",
"- dist = np.full(N, -1)",
"+ \"\"\"BFSで距離を求める\"\"... | false | 0.230135 | 0.043631 | 5.274623 | [
"s861604000",
"s139958211"
] |
u222668979 | p03018 | python | s123634764 | s098556085 | 73 | 67 | 68,100 | 66,736 | Accepted | Accepted | 8.22 | s = eval(input())
ans, cnta = 0, 0
for i in range(len(s)):
if s[i] == 'A':
cnta += 1
elif s[i:i + 2] == 'BC':
ans += cnta
elif s[i - 1:i + 1] != 'BC':
cnta = 0
print(ans)
| s = input().replace('BC','a')
ans, cnta = 0, 0
for i in range(len(s)):
if s[i] == 'A':
cnta += 1
elif s[i] == 'a':
ans += cnta
else:
cnta = 0
print(ans)
| 11 | 11 | 212 | 200 | s = eval(input())
ans, cnta = 0, 0
for i in range(len(s)):
if s[i] == "A":
cnta += 1
elif s[i : i + 2] == "BC":
ans += cnta
elif s[i - 1 : i + 1] != "BC":
cnta = 0
print(ans)
| s = input().replace("BC", "a")
ans, cnta = 0, 0
for i in range(len(s)):
if s[i] == "A":
cnta += 1
elif s[i] == "a":
ans += cnta
else:
cnta = 0
print(ans)
| false | 0 | [
"-s = eval(input())",
"+s = input().replace(\"BC\", \"a\")",
"- elif s[i : i + 2] == \"BC\":",
"+ elif s[i] == \"a\":",
"- elif s[i - 1 : i + 1] != \"BC\":",
"+ else:"
] | false | 0.033086 | 0.037867 | 0.873739 | [
"s123634764",
"s098556085"
] |
u581187895 | p03846 | python | s970760530 | s608902187 | 90 | 81 | 14,008 | 13,880 | Accepted | Accepted | 10 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 0
flag = True
if N % 2 == 1:
# 奇数個の場合、0,2,2,4,4,~みたいに並んでるはず
if A[0] == 0:
for i in range(1, N, 2):
if A[i] != i+1 or A[i+1] != i+1:
flag = False
break
if flag:
ans = 2**(N//2) % (10**9+7)
else... | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9+7
if N % 2 == 1: # 0を2個にする
A.append(0)
A.sort()
od = tuple(A[::2])
ev = tuple(A[1::2])
# Ai と Biで、ある値の登場する回数が等しくなかった場合、明らかに答えは 0
if od == ev:
comb = (2**(N//2)) % MOD
print(comb)
else:
# 左右対称じゃなく報告と矛盾
print((0)) | 24 | 17 | 544 | 303 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 0
flag = True
if N % 2 == 1:
# 奇数個の場合、0,2,2,4,4,~みたいに並んでるはず
if A[0] == 0:
for i in range(1, N, 2):
if A[i] != i + 1 or A[i + 1] != i + 1:
flag = False
break
if flag:
... | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
if N % 2 == 1: # 0を2個にする
A.append(0)
A.sort()
od = tuple(A[::2])
ev = tuple(A[1::2])
# Ai と Biで、ある値の登場する回数が等しくなかった場合、明らかに答えは 0
if od == ev:
comb = (2 ** (N // 2)) % MOD
print(comb)
else:
# 左右対称じゃなく報告と矛盾
print((0))
| false | 29.166667 | [
"+MOD = 10**9 + 7",
"+if N % 2 == 1: # 0を2個にする",
"+ A.append(0)",
"-ans = 0",
"-flag = True",
"-if N % 2 == 1:",
"- # 奇数個の場合、0,2,2,4,4,~みたいに並んでるはず",
"- if A[0] == 0:",
"- for i in range(1, N, 2):",
"- if A[i] != i + 1 or A[i + 1] != i + 1:",
"- flag = F... | false | 0.046486 | 0.046891 | 0.991353 | [
"s970760530",
"s608902187"
] |
u556594202 | p02627 | python | s499389449 | s980653641 | 28 | 25 | 8,808 | 9,036 | Accepted | Accepted | 10.71 | alpha=eval(input())
Cap=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if alpha in Cap:
print("a")
else:
print("A")
| alpha=eval(input())
print(("a" if alpha.islower() else "A")) | 6 | 2 | 182 | 53 | alpha = eval(input())
Cap = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
if alpha in Cap:
print("a")
else:
print("A")
| alpha = eval(input())
print(("a" if alpha.islower() else "A"))
| false | 66.666667 | [
"-Cap = [",
"- \"a\",",
"- \"b\",",
"- \"c\",",
"- \"d\",",
"- \"e\",",
"- \"f\",",
"- \"g\",",
"- \"h\",",
"- \"i\",",
"- \"j\",",
"- \"k\",",
"- \"l\",",
"- \"m\",",
"- \"n\",",
"- \"o\",",
"- \"p\",",
"- \"q\",",
"- \"r\","... | false | 0.074172 | 0.037305 | 1.988266 | [
"s499389449",
"s980653641"
] |
u040442732 | p02814 | python | s444019587 | s879996820 | 248 | 77 | 16,416 | 13,296 | Accepted | Accepted | 68.95 | from functools import reduce
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def lcm_all(A):
return reduce(lcm, A, 1)
n, M = list(map(int, input().split()))
A = tuple([int(x)//2 for x in input().split()])
scm_core = lcm_all(A)
canmake_scm = True
for a in A:
if scm_core ... | from functools import reduce
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def lcm_all(A):
return reduce(lcm, A, 1)
n, M = list(map(int, input().split()))
A = set([int(x)//2 for x in input().split()])
scm_core = lcm_all(A)
canmake_scm = True
for a in A:
if scm_core //... | 23 | 23 | 454 | 452 | from functools import reduce
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def lcm_all(A):
return reduce(lcm, A, 1)
n, M = list(map(int, input().split()))
A = tuple([int(x) // 2 for x in input().split()])
scm_core = lcm_all(A)
canmake_scm = True
for a in A:
if scm_core // a % 2 ==... | from functools import reduce
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def lcm_all(A):
return reduce(lcm, A, 1)
n, M = list(map(int, input().split()))
A = set([int(x) // 2 for x in input().split()])
scm_core = lcm_all(A)
canmake_scm = True
for a in A:
if scm_core // a % 2 == 0... | false | 0 | [
"-A = tuple([int(x) // 2 for x in input().split()])",
"+A = set([int(x) // 2 for x in input().split()])"
] | false | 0.085705 | 0.055886 | 1.533575 | [
"s444019587",
"s879996820"
] |
u048945791 | p03339 | python | s905637690 | s641748778 | 77 | 68 | 5,928 | 3,700 | Accepted | Accepted | 11.69 | N = int(eval(input()))
S = eval(input())
cost = list(S).count("E")
ans = 1000000
for si in S:
if si == "E":
cost -= 1
else:
if cost < ans:
ans = cost
cost += 1
else:
if cost < ans:
ans = cost
print(ans) | N = int(eval(input()))
S = eval(input())
cost = S.count("E")
ans = 1000000
for si in S:
if si == "E":
cost -= 1
else:
if cost < ans:
ans = cost
cost += 1
else:
if cost < ans:
ans = cost
print(ans) | 17 | 17 | 264 | 258 | N = int(eval(input()))
S = eval(input())
cost = list(S).count("E")
ans = 1000000
for si in S:
if si == "E":
cost -= 1
else:
if cost < ans:
ans = cost
cost += 1
else:
if cost < ans:
ans = cost
print(ans)
| N = int(eval(input()))
S = eval(input())
cost = S.count("E")
ans = 1000000
for si in S:
if si == "E":
cost -= 1
else:
if cost < ans:
ans = cost
cost += 1
else:
if cost < ans:
ans = cost
print(ans)
| false | 0 | [
"-cost = list(S).count(\"E\")",
"+cost = S.count(\"E\")"
] | false | 0.108858 | 0.044246 | 2.460303 | [
"s905637690",
"s641748778"
] |
u518042385 | p03681 | python | s665370830 | s288345007 | 704 | 40 | 5,184 | 3,064 | Accepted | Accepted | 94.32 | import math
n,m=list(map(int,input().split()))
a=math.factorial(n)
b=math.factorial(m)
if n==m:
print(((2*a**2)%(10**9+7)))
elif abs(n-m)==1:
print(((a*b)%(10**9+7)))
else:
print((0))
| def fact(n):
if n==1:
return 1
else:
c=1
for i in range(1,n+1):
c=(c*i)%(10**9+7)
return c
n,m=list(map(int,input().split()))
if n==m:
print(((2*(fact(n)**2))%(10**9+7)))
elif abs(n-m)==1:
print((fact(n)*fact(m)%(10**9+7)))
else:
print((0)) | 10 | 15 | 187 | 274 | import math
n, m = list(map(int, input().split()))
a = math.factorial(n)
b = math.factorial(m)
if n == m:
print(((2 * a**2) % (10**9 + 7)))
elif abs(n - m) == 1:
print(((a * b) % (10**9 + 7)))
else:
print((0))
| def fact(n):
if n == 1:
return 1
else:
c = 1
for i in range(1, n + 1):
c = (c * i) % (10**9 + 7)
return c
n, m = list(map(int, input().split()))
if n == m:
print(((2 * (fact(n) ** 2)) % (10**9 + 7)))
elif abs(n - m) == 1:
print((fact(n) * fact(m) % (10**9 + ... | false | 33.333333 | [
"-import math",
"+def fact(n):",
"+ if n == 1:",
"+ return 1",
"+ else:",
"+ c = 1",
"+ for i in range(1, n + 1):",
"+ c = (c * i) % (10**9 + 7)",
"+ return c",
"+",
"-a = math.factorial(n)",
"-b = math.factorial(m)",
"- print(((2 * a**2) % (10... | false | 0.076091 | 0.036689 | 2.073947 | [
"s665370830",
"s288345007"
] |
u366959492 | p02803 | python | s722704231 | s392711392 | 1,680 | 273 | 136,200 | 48,476 | Accepted | Accepted | 83.75 | h,w=list(map(int,input().split()))
s=[list(eval(input())) for _ in range(h)]
def warshall_floyd(d):
#d[i][j]: iからjへの最短距離
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j],d[i][k] + d[k][j])
return d
n=h*w
INF=1<<20
d = [[float("inf"... | h,w=list(map(int,input().split()))
s=[list(eval(input())) for _ in range(h)]
dyx=[(1,0),(-1,0),(0,1),(0,-1)]
from collections import deque
q=deque()
ans=0
for i in range(h):
for j in range(w):
if s[i][j]=="#":
continue
q.append((i,j))
d=[[0]*w for _ in range(h)]
... | 38 | 24 | 937 | 713 | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
def warshall_floyd(d):
# d[i][j]: iからjへの最短距離
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
n = h * w
INF = 1 << 20
d = [[fl... | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
dyx = [(1, 0), (-1, 0), (0, 1), (0, -1)]
from collections import deque
q = deque()
ans = 0
for i in range(h):
for j in range(w):
if s[i][j] == "#":
continue
q.append((i, j))
d = [[0] * w for _ in ... | false | 36.842105 | [
"+dyx = [(1, 0), (-1, 0), (0, 1), (0, -1)]",
"+from collections import deque",
"-",
"-def warshall_floyd(d):",
"- # d[i][j]: iからjへの最短距離",
"- for k in range(n):",
"- for i in range(n):",
"- for j in range(n):",
"- d[i][j] = min(d[i][j], d[i][k] + d[k][j])",
"-... | false | 0.035203 | 0.035826 | 0.982631 | [
"s722704231",
"s392711392"
] |
u255555420 | p03773 | python | s395932771 | s533318331 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | ab=(eval(input()))
a_,b_=ab.split()
a=int(a_)
b=int(b_)
if a+b>24:
print((a+b-24))
elif a+b==24:
print("0")
else:
print((a+b)) | A,B =list(map(int,input().split()))
if A+B>=24:
print((A+B-24))
else:
print((A+B)) | 12 | 7 | 149 | 88 | ab = eval(input())
a_, b_ = ab.split()
a = int(a_)
b = int(b_)
if a + b > 24:
print((a + b - 24))
elif a + b == 24:
print("0")
else:
print((a + b))
| A, B = list(map(int, input().split()))
if A + B >= 24:
print((A + B - 24))
else:
print((A + B))
| false | 41.666667 | [
"-ab = eval(input())",
"-a_, b_ = ab.split()",
"-a = int(a_)",
"-b = int(b_)",
"-if a + b > 24:",
"- print((a + b - 24))",
"-elif a + b == 24:",
"- print(\"0\")",
"+A, B = list(map(int, input().split()))",
"+if A + B >= 24:",
"+ print((A + B - 24))",
"- print((a + b))",
"+ pri... | false | 0.046518 | 0.048889 | 0.951504 | [
"s395932771",
"s533318331"
] |
u380772254 | p03017 | python | s406233627 | s407978519 | 105 | 19 | 3,572 | 3,572 | Accepted | Accepted | 81.9 | N, A, B, C, D = list(map(int, input().split()))
S = '#' + eval(input())
for i in range(C - A):
if S[A + i: A + i + 2] == '##':
print('No')
exit(0)
for i in range(D - B):
if S[B + i: B + i + 2] == '##':
print('No')
exit(0)
if C > D:
if '...' not in S[B - 1: D + ... | N, A, B, C, D = list(map(int, input().split()))
S = '#' + eval(input())
if '##' in S[A: C] or '##' in S[B: D]:
print('No')
exit(0)
if C > D:
if '...' not in S[B - 1: D + 2]:
print('No')
exit(0)
print('Yes')
| 18 | 13 | 366 | 238 | N, A, B, C, D = list(map(int, input().split()))
S = "#" + eval(input())
for i in range(C - A):
if S[A + i : A + i + 2] == "##":
print("No")
exit(0)
for i in range(D - B):
if S[B + i : B + i + 2] == "##":
print("No")
exit(0)
if C > D:
if "..." not in S[B - 1 : D + 2]:
... | N, A, B, C, D = list(map(int, input().split()))
S = "#" + eval(input())
if "##" in S[A:C] or "##" in S[B:D]:
print("No")
exit(0)
if C > D:
if "..." not in S[B - 1 : D + 2]:
print("No")
exit(0)
print("Yes")
| false | 27.777778 | [
"-for i in range(C - A):",
"- if S[A + i : A + i + 2] == \"##\":",
"- print(\"No\")",
"- exit(0)",
"-for i in range(D - B):",
"- if S[B + i : B + i + 2] == \"##\":",
"- print(\"No\")",
"- exit(0)",
"+if \"##\" in S[A:C] or \"##\" in S[B:D]:",
"+ print(\"No\")",... | false | 0.037324 | 0.037612 | 0.992343 | [
"s406233627",
"s407978519"
] |
u600402037 | p03213 | python | s561004464 | s894433595 | 40 | 20 | 4,084 | 3,188 | Accepted | Accepted | 50 | # coding: utf-8
import sys
from collections import defaultdict
import itertools
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def prime_factorize(n): # Nの素因数分解
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
power = [0] * (N+1)
for x in range(2, N+1):
for p in range(2, x+1):
while x % p == 0:
power[p] += 1
x //= p
def num(x):
... | 54 | 22 | 1,107 | 531 | # coding: utf-8
import sys
from collections import defaultdict
import itertools
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def prime_factorize(n): # Nの素因数分解
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
power = [0] * (N + 1)
for x in range(2, N + 1):
for p in range(2, x + 1):
while x % p == 0:
power[p] += 1
x //= p
def num(x):
"""約数がx... | false | 59.259259 | [
"-from collections import defaultdict",
"-import itertools",
"+N = ir()",
"+power = [0] * (N + 1)",
"+for x in range(2, N + 1):",
"+ for p in range(2, x + 1):",
"+ while x % p == 0:",
"+ power[p] += 1",
"+ x //= p",
"-def prime_factorize(n): # Nの素因数分解",
"- a =... | false | 0.039125 | 0.035877 | 1.090531 | [
"s561004464",
"s894433595"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.