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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u170183831 | p03425 | python | s878257334 | s730640411 | 169 | 155 | 9,772 | 16,236 | Accepted | Accepted | 8.28 | import itertools
def solve(n, S):
initials = ('M', 'A', 'R', 'C', 'H')
d = {}
for s in S:
if s[0] in initials:
d[s[0]] = d.get(s[0], 0) + 1
return sum(d[x] * d[y] * d[z] for x, y, z in itertools.combinations(list(d.keys()), 3))
_n = int(eval(input()))
_S = [eval(input())... | from itertools import combinations
n = int(eval(input()))
S = [eval(input()) for _ in range(n)]
initials = ('M', 'A', 'R', 'C', 'H')
d = {}
for s in S:
if s[0] in initials:
d[s[0]] = d.get(s[0], 0) + 1
print((sum(d[x] * d[y] * d[z] for x, y, z in combinations(list(d.keys()), 3)))) | 13 | 11 | 344 | 279 | import itertools
def solve(n, S):
initials = ("M", "A", "R", "C", "H")
d = {}
for s in S:
if s[0] in initials:
d[s[0]] = d.get(s[0], 0) + 1
return sum(
d[x] * d[y] * d[z] for x, y, z in itertools.combinations(list(d.keys()), 3)
)
_n = int(eval(input()))
_S = [eval(inp... | from itertools import combinations
n = int(eval(input()))
S = [eval(input()) for _ in range(n)]
initials = ("M", "A", "R", "C", "H")
d = {}
for s in S:
if s[0] in initials:
d[s[0]] = d.get(s[0], 0) + 1
print((sum(d[x] * d[y] * d[z] for x, y, z in combinations(list(d.keys()), 3))))
| false | 15.384615 | [
"-import itertools",
"+from itertools import combinations",
"-",
"-def solve(n, S):",
"- initials = (\"M\", \"A\", \"R\", \"C\", \"H\")",
"- d = {}",
"- for s in S:",
"- if s[0] in initials:",
"- d[s[0]] = d.get(s[0], 0) + 1",
"- return sum(",
"- d[x] * d[y] ... | false | 0.037917 | 0.032989 | 1.149382 | [
"s878257334",
"s730640411"
] |
u764956288 | p02689 | python | s147136676 | s940800028 | 245 | 139 | 20,132 | 20,220 | Accepted | Accepted | 43.27 | # import numpy as np
# import queue
# import heapq
def main():
N, M = list(map(int, input().split()))
heights = list(map(int, input().split()))
towers = [True for _ in range(N)]
pathes = (list(map(int, input().split())) for _ in range(M))
for path in pathes:
a = path[0] ... | import sys
input = sys.stdin.readline
def main():
n_obss, n_roads = list(map(int, input().split()))
elevations = list(map(int, input().split()))
is_good_obs = [True for _ in range(n_obss)]
roads = (list(map(int, input().split())) for _ in range(n_roads))
for road in roads:
... | 34 | 33 | 650 | 741 | # import numpy as np
# import queue
# import heapq
def main():
N, M = list(map(int, input().split()))
heights = list(map(int, input().split()))
towers = [True for _ in range(N)]
pathes = (list(map(int, input().split())) for _ in range(M))
for path in pathes:
a = path[0] - 1
b = path[... | import sys
input = sys.stdin.readline
def main():
n_obss, n_roads = list(map(int, input().split()))
elevations = list(map(int, input().split()))
is_good_obs = [True for _ in range(n_obss)]
roads = (list(map(int, input().split())) for _ in range(n_roads))
for road in roads:
idx_a = road[0]... | false | 2.941176 | [
"-# import numpy as np",
"-# import queue",
"-# import heapq",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"- N, M = list(map(int, input().split()))",
"- heights = list(map(int, input().split()))",
"- towers = [True for _ in range(N)]",
"- pathes = (list(map(int, i... | false | 0.046206 | 0.078165 | 0.59113 | [
"s147136676",
"s940800028"
] |
u629540524 | p03416 | python | s783576660 | s017717829 | 72 | 52 | 9,052 | 9,108 | Accepted | Accepted | 27.78 | a,b = list(map(int, input().split()))
c = 0
while a <= b:
if str(a)[::-1] == str(a):
c += 1
a += 1
print(c) | a,b = list(map(int, input().split()))
c = 0
for i in map(str,list(range(a,b+1))):
if i==i[::-1]:
c += 1
print(c) | 7 | 6 | 123 | 117 | a, b = list(map(int, input().split()))
c = 0
while a <= b:
if str(a)[::-1] == str(a):
c += 1
a += 1
print(c)
| a, b = list(map(int, input().split()))
c = 0
for i in map(str, list(range(a, b + 1))):
if i == i[::-1]:
c += 1
print(c)
| false | 14.285714 | [
"-while a <= b:",
"- if str(a)[::-1] == str(a):",
"+for i in map(str, list(range(a, b + 1))):",
"+ if i == i[::-1]:",
"- a += 1"
] | false | 0.049585 | 0.044279 | 1.119825 | [
"s783576660",
"s017717829"
] |
u323680411 | p03030 | python | s511951542 | s012684086 | 23 | 18 | 3,064 | 3,064 | Accepted | Accepted | 21.74 | n = int(eval(input()))
dic = [[x for x in input().split()] for i in range(n)]
for i in range(n):
dic[i][1] = int(dic[i][1])
dic[i].append(i + 1)
dic.sort(key= lambda x: x[1], reverse= True)
dic.sort(key= lambda x: x[0])
for i in range(n):
print((dic[i][2])) | n = int(eval(input()))
dic = []
for i in range(n):
tmp = input().split()
dic.append([tmp[0], int(tmp[1]), i + 1])
dic.sort(key= lambda x: x[1], reverse= True)
dic.sort(key= lambda x: x[0])
for i in range(n):
print((dic[i][2])) | 12 | 12 | 275 | 245 | n = int(eval(input()))
dic = [[x for x in input().split()] for i in range(n)]
for i in range(n):
dic[i][1] = int(dic[i][1])
dic[i].append(i + 1)
dic.sort(key=lambda x: x[1], reverse=True)
dic.sort(key=lambda x: x[0])
for i in range(n):
print((dic[i][2]))
| n = int(eval(input()))
dic = []
for i in range(n):
tmp = input().split()
dic.append([tmp[0], int(tmp[1]), i + 1])
dic.sort(key=lambda x: x[1], reverse=True)
dic.sort(key=lambda x: x[0])
for i in range(n):
print((dic[i][2]))
| false | 0 | [
"-dic = [[x for x in input().split()] for i in range(n)]",
"+dic = []",
"- dic[i][1] = int(dic[i][1])",
"- dic[i].append(i + 1)",
"+ tmp = input().split()",
"+ dic.append([tmp[0], int(tmp[1]), i + 1])"
] | false | 0.0364 | 0.042386 | 0.85877 | [
"s511951542",
"s012684086"
] |
u768256617 | p02678 | python | s221359166 | s654527213 | 705 | 636 | 33,876 | 34,080 | Accepted | Accepted | 9.79 | from collections import deque
n,m=list(map(int,input().split()))
adjacent_list=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
adjacent_list[a].append(b)
adjacent_list[b].append(a)
#print(adjacent_list)
visited=[0]*(n+1)
que=deque()
que.append(1)
while que:
node=que.... | def mi(): return list(map(int,input().split()))
def lmi(): return list(map(int,input().split()))
def ii(): return int(eval(input()))
def isp(): return input().split()
from collections import deque
n,m=mi()
adjacent_list=[[] for i in range(n+1)]
for i in range(m):
a,b=mi()
adjacent_list[a].append(b)
adja... | 22 | 27 | 484 | 576 | from collections import deque
n, m = list(map(int, input().split()))
adjacent_list = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
adjacent_list[a].append(b)
adjacent_list[b].append(a)
# print(adjacent_list)
visited = [0] * (n + 1)
que = deque()
que.append(1)
while qu... | def mi():
return list(map(int, input().split()))
def lmi():
return list(map(int, input().split()))
def ii():
return int(eval(input()))
def isp():
return input().split()
from collections import deque
n, m = mi()
adjacent_list = [[] for i in range(n + 1)]
for i in range(m):
a, b = mi()
ad... | false | 18.518519 | [
"+def mi():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def lmi():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def ii():",
"+ return int(eval(input()))",
"+",
"+",
"+def isp():",
"+ return input().split()",
"+",
"+",
"-n, m = list(map(int, inpu... | false | 0.043292 | 0.042009 | 1.03054 | [
"s221359166",
"s654527213"
] |
u567380442 | p02361 | python | s819849449 | s222166278 | 3,580 | 2,910 | 110,172 | 108,588 | Accepted | Accepted | 18.72 | from sys import stdin
from collections import defaultdict, deque
import math
readline = stdin.readline
v, e, r = list(map(int, readline().split()))
g = defaultdict(list)
for i in range(e):
s, t, length = list(map(int, readline().split()))
g[s].append((length, t))
d = [float('inf')] * v
d[r] = ... | from sys import stdin
from collections import defaultdict
from heapq import heappush, heappop
import math
readline = stdin.readline
v, e, r = list(map(int, readline().split()))
g = defaultdict(list)
for i in range(e):
s, t, length = list(map(int, readline().split()))
g[s].append((length, t))
d =... | 24 | 24 | 559 | 585 | from sys import stdin
from collections import defaultdict, deque
import math
readline = stdin.readline
v, e, r = list(map(int, readline().split()))
g = defaultdict(list)
for i in range(e):
s, t, length = list(map(int, readline().split()))
g[s].append((length, t))
d = [float("inf")] * v
d[r] = 0
que = deque([(d... | from sys import stdin
from collections import defaultdict
from heapq import heappush, heappop
import math
readline = stdin.readline
v, e, r = list(map(int, readline().split()))
g = defaultdict(list)
for i in range(e):
s, t, length = list(map(int, readline().split()))
g[s].append((length, t))
d = [float("inf")]... | false | 0 | [
"-from collections import defaultdict, deque",
"+from collections import defaultdict",
"+from heapq import heappush, heappop",
"-que = deque([(d[r], r)])",
"-while que:",
"- du, u = que.popleft()",
"+heap = [(d[r], r)]",
"+while heap:",
"+ du, u = heappop(heap)",
"- que.append((d[... | false | 0.007661 | 0.117191 | 0.065371 | [
"s819849449",
"s222166278"
] |
u416011173 | p03281 | python | s677982448 | s380989578 | 29 | 25 | 9,064 | 9,212 | Accepted | Accepted | 13.79 | # -*- coding: utf-8 -*-
# 標準入力を取得
N = int(eval(input()))
# 求解処理
ans = 0
for n in range(1, N + 1, 2):
divisors_count = 0
for i in range(1, n + 1):
if n % i == 0:
divisors_count += 1
if divisors_count == 8:
ans += 1
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> int:
"""
標準入力を取得する.
Returns:\n
int: 標準入力
"""
N = int(eval(input()))
return N
def main(N: int) -> None:
"""
メイン処理.
Args:\n
N (int): 1以上200以下の整数
"""
# 求解処理
ans = 0
for n in range(1, ... | 16 | 41 | 283 | 634 | # -*- coding: utf-8 -*-
# 標準入力を取得
N = int(eval(input()))
# 求解処理
ans = 0
for n in range(1, N + 1, 2):
divisors_count = 0
for i in range(1, n + 1):
if n % i == 0:
divisors_count += 1
if divisors_count == 8:
ans += 1
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> int:
"""
標準入力を取得する.
Returns:\n
int: 標準入力
"""
N = int(eval(input()))
return N
def main(N: int) -> None:
"""
メイン処理.
Args:\n
N (int): 1以上200以下の整数
"""
# 求解処理
ans = 0
for n in range(1, N + 1, 2):
divisors... | false | 60.97561 | [
"-# 標準入力を取得",
"-N = int(eval(input()))",
"-# 求解処理",
"-ans = 0",
"-for n in range(1, N + 1, 2):",
"- divisors_count = 0",
"- for i in range(1, n + 1):",
"- if n % i == 0:",
"- divisors_count += 1",
"- if divisors_count == 8:",
"- ans += 1",
"-# 結果出力",
"-print... | false | 0.04099 | 0.038747 | 1.057889 | [
"s677982448",
"s380989578"
] |
u818349438 | p03240 | python | s538880241 | s417921063 | 234 | 46 | 43,888 | 3,064 | Accepted | Accepted | 80.34 | n = int(eval(input()))
xyh = [list(map(int,input().split())) for _ in range(n)]
for i in range(n):
if(xyh[i][2]!= 0):
x = xyh[i][0]
h = xyh[i][2]
y = xyh[i][1]
break
for i in range(101):
for j in range(101):
H = h+ abs(x - i)+abs(y - j)
ok = True
... | n = int(eval(input()))
xyh = [list(map(int,input().split())) for _ in range(n)]
#h != 0 であるようなhをさがし、そのときのx,y.hを変数に保存(このようなhが少なくとも一つ存在)
for i in range(n):
if(xyh[i][2]!= 0):
x = xyh[i][0]
h = xyh[i][2]
y = xyh[i][1]
break
for i in range(101):
for j in range(101):
... | 24 | 27 | 624 | 844 | n = int(eval(input()))
xyh = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
if xyh[i][2] != 0:
x = xyh[i][0]
h = xyh[i][2]
y = xyh[i][1]
break
for i in range(101):
for j in range(101):
H = h + abs(x - i) + abs(y - j)
ok = True
for k... | n = int(eval(input()))
xyh = [list(map(int, input().split())) for _ in range(n)]
# h != 0 であるようなhをさがし、そのときのx,y.hを変数に保存(このようなhが少なくとも一つ存在)
for i in range(n):
if xyh[i][2] != 0:
x = xyh[i][0]
h = xyh[i][2]
y = xyh[i][1]
break
for i in range(101):
for j in range(101):
# 中心座標を... | false | 11.111111 | [
"+# h != 0 であるようなhをさがし、そのときのx,y.hを変数に保存(このようなhが少なくとも一つ存在)",
"- H = h + abs(x - i) + abs(y - j)",
"- ok = True",
"+ # 中心座標を(i,j)で決め打つ",
"+ H = h + abs(x - i) + abs(y - j) # さっきの(x,y,h)をつかうと、ピラミッドの高さはこうなる",
"+ ok = True # フラグをTrueで初期化、もし条件を満たさないものが一つでもあればダメなので、ok= Falseし... | false | 0.068688 | 0.151946 | 0.452057 | [
"s538880241",
"s417921063"
] |
u649373416 | p03283 | python | s231229453 | s483126940 | 2,662 | 1,802 | 57,048 | 113,880 | Accepted | Accepted | 32.31 | N,M,Q = [ int(it) for it in input().split()]
grid = [ [0]*N for i in range(N) ]
gridsml = [ [0]*N for i in range(N) ]
for i in range(M):
s,g = [ int(it)-1 for it in input().split()]
grid[s][g]+=1
for i in range(N):
gridsml[i][0]=grid[i][0]
for j in range(1,N):
gridsml[i][j]+=gridsml[i][j-1]+g... | N,M,Q = [ int(it) for it in input().split() ]
lit = [ [ int(it)-1 for it in input().split() ] for i in range(M) ]
liq = [ [ int(it)-1 for it in input().split() ] for i in range(Q) ]
li = [[0]*(N+1) for i in range(N+1)]
for p,q in lit:
li[p+1][q+1]+=1
for i in range(N+1):
for j in range(N):
li[i][j+1... | 21 | 20 | 471 | 439 | N, M, Q = [int(it) for it in input().split()]
grid = [[0] * N for i in range(N)]
gridsml = [[0] * N for i in range(N)]
for i in range(M):
s, g = [int(it) - 1 for it in input().split()]
grid[s][g] += 1
for i in range(N):
gridsml[i][0] = grid[i][0]
for j in range(1, N):
gridsml[i][j] += gridsml[i]... | N, M, Q = [int(it) for it in input().split()]
lit = [[int(it) - 1 for it in input().split()] for i in range(M)]
liq = [[int(it) - 1 for it in input().split()] for i in range(Q)]
li = [[0] * (N + 1) for i in range(N + 1)]
for p, q in lit:
li[p + 1][q + 1] += 1
for i in range(N + 1):
for j in range(N):
li... | false | 4.761905 | [
"-grid = [[0] * N for i in range(N)]",
"-gridsml = [[0] * N for i in range(N)]",
"-for i in range(M):",
"- s, g = [int(it) - 1 for it in input().split()]",
"- grid[s][g] += 1",
"-for i in range(N):",
"- gridsml[i][0] = grid[i][0]",
"- for j in range(1, N):",
"- gridsml[i][j] += gr... | false | 0.036719 | 0.08006 | 0.458641 | [
"s231229453",
"s483126940"
] |
u785578220 | p02546 | python | s886567319 | s464094049 | 29 | 26 | 9,088 | 9,024 | Accepted | Accepted | 10.34 | a = eval(input())
if a[-1] == "s" :print((a+"es"))
else :print((a+"s")) | a = eval(input())
print((a + "e"*(a[-1]=='s') + 's')) | 3 | 2 | 63 | 46 | a = eval(input())
if a[-1] == "s":
print((a + "es"))
else:
print((a + "s"))
| a = eval(input())
print((a + "e" * (a[-1] == "s") + "s"))
| false | 33.333333 | [
"-if a[-1] == \"s\":",
"- print((a + \"es\"))",
"-else:",
"- print((a + \"s\"))",
"+print((a + \"e\" * (a[-1] == \"s\") + \"s\"))"
] | false | 0.075795 | 0.089838 | 0.843689 | [
"s886567319",
"s464094049"
] |
u076503518 | p03221 | python | s096518887 | s084036010 | 728 | 612 | 31,180 | 38,444 | Accepted | Accepted | 15.93 | N, M = list(map(int, input().split()))
A = []
B = []
for i in range(M):
p, y = list(map(int, input().split()))
A.append([p, y, i])
A.sort()
cur = 1
cnt = 1
for i in range(M):
if A[i][0] == cur:
A[i].append(cnt)
cnt += 1
else:
cur = A[i][0]
cnt = 1
... | from collections import defaultdict
from bisect import bisect_left
N, M = list(map(int, input().split()))
A = []
B = defaultdict(list)
for i in range(M):
p, y = list(map(int, input().split()))
A.append([p, y])
B[p].append(y)
for key in list(B.keys()):
B[key].sort()
for a in A:
pr... | 23 | 17 | 425 | 356 | N, M = list(map(int, input().split()))
A = []
B = []
for i in range(M):
p, y = list(map(int, input().split()))
A.append([p, y, i])
A.sort()
cur = 1
cnt = 1
for i in range(M):
if A[i][0] == cur:
A[i].append(cnt)
cnt += 1
else:
cur = A[i][0]
cnt = 1
A[i].append(cnt)... | from collections import defaultdict
from bisect import bisect_left
N, M = list(map(int, input().split()))
A = []
B = defaultdict(list)
for i in range(M):
p, y = list(map(int, input().split()))
A.append([p, y])
B[p].append(y)
for key in list(B.keys()):
B[key].sort()
for a in A:
print(("%06d%06d" % (... | false | 26.086957 | [
"+from collections import defaultdict",
"+from bisect import bisect_left",
"+",
"-B = []",
"+B = defaultdict(list)",
"- A.append([p, y, i])",
"-A.sort()",
"-cur = 1",
"-cnt = 1",
"-for i in range(M):",
"- if A[i][0] == cur:",
"- A[i].append(cnt)",
"- cnt += 1",
"- el... | false | 0.037435 | 0.037496 | 0.998358 | [
"s096518887",
"s084036010"
] |
u707187541 | p02584 | python | s995060504 | s902411009 | 72 | 27 | 61,960 | 9,152 | Accepted | Accepted | 62.5 | def pm(x):
if X>=0:
return 1
else:
return -1
X,K,D=list(map(int,input().split()))
if (abs(X))<D :
if K%2==0:
print((int(abs(X))))
else:
a=X-pm(X)*D
print((int(abs(a))))
else:
if abs(X)//D>=K:
a=X-(pm(X))*D*K
print((int(abs(a))))
else:
K=K-int(abs(X)//D)
... | def pm(x):
if x>=0:
return 1
else:
return -1
X,K,D=list(map(int,input().split()))
if (abs(X))<D :
if K%2==0:
print((int(abs(X))))
else:
a=X-pm(X)*D
print((int(abs(a))))
else:
if abs(X)//D>=K:
a=X-(pm(X))*D*K
print((int(abs(a))))
else:
K=K-int(abs(X)//D)
... | 25 | 25 | 467 | 467 | def pm(x):
if X >= 0:
return 1
else:
return -1
X, K, D = list(map(int, input().split()))
if (abs(X)) < D:
if K % 2 == 0:
print((int(abs(X))))
else:
a = X - pm(X) * D
print((int(abs(a))))
else:
if abs(X) // D >= K:
a = X - (pm(X)) * D * K
prin... | def pm(x):
if x >= 0:
return 1
else:
return -1
X, K, D = list(map(int, input().split()))
if (abs(X)) < D:
if K % 2 == 0:
print((int(abs(X))))
else:
a = X - pm(X) * D
print((int(abs(a))))
else:
if abs(X) // D >= K:
a = X - (pm(X)) * D * K
prin... | false | 0 | [
"- if X >= 0:",
"+ if x >= 0:"
] | false | 0.096782 | 0.115742 | 0.836192 | [
"s995060504",
"s902411009"
] |
u969190727 | p03476 | python | s611697077 | s829905530 | 1,980 | 319 | 6,716 | 5,476 | Accepted | Accepted | 83.89 | q=int(eval(input()))
P2017=[]
def primes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for i in... | import sys
input=lambda: sys.stdin.readline().rstrip()
n=10**5
is_prime=[True]*(n+1)
is_prime[0]=False
is_prime[1]=False
for i in range(2,int(n**0.5)+1):
if not is_prime[i]:
continue
for j in range(i*2,n+1,i):
is_prime[j]=False
A=[0]*n
def f(x):
return is_prime[x] and is_prime[(x+1)//2]
fo... | 24 | 25 | 580 | 499 | q = int(eval(input()))
P2017 = []
def primes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for i in rang... | import sys
input = lambda: sys.stdin.readline().rstrip()
n = 10**5
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
A = [0] * n
def f(x):
return is_prim... | false | 4 | [
"-q = int(eval(input()))",
"-P2017 = []",
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip()",
"+n = 10**5",
"+is_prime = [True] * (n + 1)",
"+is_prime[0] = False",
"+is_prime[1] = False",
"+for i in range(2, int(n**0.5) + 1):",
"+ if not is_prime[i]:",
"+ continue",... | false | 1.090478 | 0.133095 | 8.19323 | [
"s611697077",
"s829905530"
] |
u297574184 | p02912 | python | s324742195 | s456136889 | 302 | 147 | 14,184 | 14,180 | Accepted | Accepted | 51.32 | from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
PQ = [-A for A in As]
heapify(PQ)
for _ in range(M):
A = -heappop(PQ)
heappush(PQ, -A/2)
ans = 0
while PQ:
A = -heappop(PQ)
ans += int(A)
print(ans)
| from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
PQ = [-A for A in As]
heapify(PQ)
for _ in range(M):
A = -heappop(PQ)
heappush(PQ, -(A//2))
#print('PQ:', PQ)
print((-sum(PQ)))
| 18 | 15 | 302 | 268 | from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
PQ = [-A for A in As]
heapify(PQ)
for _ in range(M):
A = -heappop(PQ)
heappush(PQ, -A / 2)
ans = 0
while PQ:
A = -heappop(PQ)
ans += int(A)
print(ans)
| from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
PQ = [-A for A in As]
heapify(PQ)
for _ in range(M):
A = -heappop(PQ)
heappush(PQ, -(A // 2))
# print('PQ:', PQ)
print((-sum(PQ)))
| false | 16.666667 | [
"- heappush(PQ, -A / 2)",
"-ans = 0",
"-while PQ:",
"- A = -heappop(PQ)",
"- ans += int(A)",
"-print(ans)",
"+ heappush(PQ, -(A // 2))",
"+# print('PQ:', PQ)",
"+print((-sum(PQ)))"
] | false | 0.054006 | 0.139273 | 0.38777 | [
"s324742195",
"s456136889"
] |
u133936772 | p03087 | python | s599386779 | s261607670 | 1,047 | 892 | 52,204 | 7,748 | Accepted | Accepted | 14.8 | f = lambda : list(map(int,input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0]*n
for i in range(1,n):
if s[i-1:i+1] == 'AC':
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r-1]-ln[l-1])) | f = lambda : list(map(int,input().split()))
n, q = f()
s = eval(input())
ln = [0]*n
for i in range(1,n):
ln[i] = ln[i-1] + (s[i-1:i+1]=='AC')
for _ in range(q):
l, r = f()
print((ln[r-1]-ln[l-1])) | 14 | 12 | 224 | 202 | f = lambda: list(map(int, input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0] * n
for i in range(1, n):
if s[i - 1 : i + 1] == "AC":
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r - 1] - ln[l - 1]))
| f = lambda: list(map(int, input().split()))
n, q = f()
s = eval(input())
ln = [0] * n
for i in range(1, n):
ln[i] = ln[i - 1] + (s[i - 1 : i + 1] == "AC")
for _ in range(q):
l, r = f()
print((ln[r - 1] - ln[l - 1]))
| false | 14.285714 | [
"-cnt = 0",
"- if s[i - 1 : i + 1] == \"AC\":",
"- cnt += 1",
"- ln[i] = cnt",
"+ ln[i] = ln[i - 1] + (s[i - 1 : i + 1] == \"AC\")"
] | false | 0.041776 | 0.038151 | 1.095028 | [
"s599386779",
"s261607670"
] |
u561231954 | p03142 | python | s205771303 | s170211228 | 600 | 449 | 48,972 | 30,096 | Accepted | Accepted | 25.17 | INF = 10 ** 15
MOD = 10 ** 9 + 7
from collections import deque
def main():
N,M = list(map(int,input().split()))
G = [[] for _ in range(N)]
G_inv = [[] for _ in range(N)]
deg = [0] * N
for _ in range(N + M - 1):
a,b = list(map(int,input().split()))
a -= 1
b -= 1
... | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
from collections import deque,defaultdict,Counter
def main():
N,M = list(map(int,input().split()))
G = [[] for _ in range(N)]
deg = [0] * N
for _ in range(M + N - 1):
a,b = list(map(int,input().split()))
... | 43 | 35 | 1,004 | 806 | INF = 10**15
MOD = 10**9 + 7
from collections import deque
def main():
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
G_inv = [[] for _ in range(N)]
deg = [0] * N
for _ in range(N + M - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
deg[... | import sys
sys.setrecursionlimit(10000000)
MOD = 10**9 + 7
INF = 10**15
from collections import deque, defaultdict, Counter
def main():
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
deg = [0] * N
for _ in range(M + N - 1):
a, b = list(map(int, input().split()))
a -... | false | 18.604651 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10000000)",
"+MOD = 10**9 + 7",
"-MOD = 10**9 + 7",
"-from collections import deque",
"+from collections import deque, defaultdict, Counter",
"- G_inv = [[] for _ in range(N)]",
"- for _ in range(N + M - 1):",
"+ for _ in range(M + N - 1):",
"... | false | 0.08136 | 0.081885 | 0.993589 | [
"s205771303",
"s170211228"
] |
u077898957 | p03012 | python | s542664262 | s400438979 | 395 | 18 | 21,180 | 3,064 | Accepted | Accepted | 95.44 | import numpy as np
import sys
n = int(eval(input()))
w = list(map(int,input().split()))
print((min(abs(sum(w[:i+1])-sum(w[i+1:])) for i in range(n-1))))
| n=int(eval(input()))
W=list(map(int,input().split()))
ans=100
for i in range(n):
lw=sum(W[:i+1])
rw=sum(W[i+1:])
ans=min(ans,abs(lw-rw))
print(ans) | 5 | 8 | 149 | 160 | import numpy as np
import sys
n = int(eval(input()))
w = list(map(int, input().split()))
print((min(abs(sum(w[: i + 1]) - sum(w[i + 1 :])) for i in range(n - 1))))
| n = int(eval(input()))
W = list(map(int, input().split()))
ans = 100
for i in range(n):
lw = sum(W[: i + 1])
rw = sum(W[i + 1 :])
ans = min(ans, abs(lw - rw))
print(ans)
| false | 37.5 | [
"-import numpy as np",
"-import sys",
"-",
"-w = list(map(int, input().split()))",
"-print((min(abs(sum(w[: i + 1]) - sum(w[i + 1 :])) for i in range(n - 1))))",
"+W = list(map(int, input().split()))",
"+ans = 100",
"+for i in range(n):",
"+ lw = sum(W[: i + 1])",
"+ rw = sum(W[i + 1 :])",
... | false | 0.107902 | 0.035276 | 3.05878 | [
"s542664262",
"s400438979"
] |
u767821815 | p02608 | python | s714285234 | s431318717 | 826 | 250 | 9,256 | 9,224 | Accepted | Accepted | 69.73 | n = int(eval(input()))
A = [0]*(n+1)
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
a = x**2+y**2+z**2+x*y+y*z+z*x
if a <= n:
A[a] += 1
for i in range(n):
print((A[i+1]))
| n = int(eval(input()))
A = [0]*(n+1)
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
a = x**2+y**2+z**2+x*y+y*z+z*x
if a <= n:
A[a] += 1
else:
break
for i in range(n):
p... | 13 | 16 | 280 | 336 | n = int(eval(input()))
A = [0] * (n + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
a = x**2 + y**2 + z**2 + x * y + y * z + z * x
if a <= n:
A[a] += 1
for i in range(n):
print((A[i + 1]))
| n = int(eval(input()))
A = [0] * (n + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
a = x**2 + y**2 + z**2 + x * y + y * z + z * x
if a <= n:
A[a] += 1
else:
break
for i in range(n):
print((A[i + 1]))
| false | 18.75 | [
"+ else:",
"+ break"
] | false | 1.961049 | 0.107595 | 18.22623 | [
"s714285234",
"s431318717"
] |
u745087332 | p03112 | python | s657836813 | s637452242 | 1,084 | 929 | 82,012 | 12,812 | Accepted | Accepted | 14.3 | # coding:utf-8
import sys
import bisect
# from collections import Counter, defaultdict
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
de... | # coding:utf-8
import sys
from bisect import bisect_left
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readli... | 38 | 32 | 1,068 | 787 | # coding:utf-8
import sys
import bisect
# from collections import Counter, defaultdict
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
... | # coding:utf-8
import sys
from bisect import bisect_left
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin... | false | 15.789474 | [
"-import bisect",
"+from bisect import bisect_left",
"-# from collections import Counter, defaultdict",
"-INF = float(\"inf\")",
"+INF = 10**18",
"- ans = INF",
"- x_a = bisect.bisect_left(A, x)",
"- for k in [-1, 0]:",
"- tmp = abs(x - A[x_a + k])",
"- x_b = bisect.bisect_l... | false | 0.12184 | 0.204698 | 0.59522 | [
"s657836813",
"s637452242"
] |
u301461168 | p02271 | python | s522282617 | s889154247 | 5,820 | 630 | 79,524 | 58,252 | Accepted | Accepted | 89.18 | import itertools
numA = int(input().rstrip())
listA = list(map(int,input().rstrip().split(" ")))
numQ = int(input().rstrip())
listQ = list(map(int,input().rstrip().split(" ")))
sumA = []
cnt = 0
for i in range(1,numA+1):
tmpComb = list(itertools.combinations(listA, i))
for nums in tmpComb:
... | import itertools
numA = int(input().rstrip())
listA = list(map(int,input().rstrip().split(" ")))
numQ = int(input().rstrip())
listQ = list(map(int,input().rstrip().split(" ")))
sumA = set([])
cnt = 0
for i in range(1,numA+1):
tmpComb = list(itertools.combinations(listA, i))
for nums in tmpC... | 22 | 22 | 462 | 462 | import itertools
numA = int(input().rstrip())
listA = list(map(int, input().rstrip().split(" ")))
numQ = int(input().rstrip())
listQ = list(map(int, input().rstrip().split(" ")))
sumA = []
cnt = 0
for i in range(1, numA + 1):
tmpComb = list(itertools.combinations(listA, i))
for nums in tmpComb:
sumA.ap... | import itertools
numA = int(input().rstrip())
listA = list(map(int, input().rstrip().split(" ")))
numQ = int(input().rstrip())
listQ = list(map(int, input().rstrip().split(" ")))
sumA = set([])
cnt = 0
for i in range(1, numA + 1):
tmpComb = list(itertools.combinations(listA, i))
for nums in tmpComb:
su... | false | 0 | [
"-sumA = []",
"+sumA = set([])",
"- sumA.append(sum(nums))",
"+ sumA.add(sum(nums))",
"- if sumA.count(listQ[i]) > 0:",
"+ if listQ[i] in sumA:"
] | false | 0.035791 | 0.035747 | 1.001231 | [
"s522282617",
"s889154247"
] |
u576432509 | p03557 | python | s307283266 | s355966111 | 379 | 334 | 22,720 | 23,232 | Accepted | Accepted | 11.87 | icase=0
if icase==0:
n=int(eval(input())) #数値入力 「N」だけの入力のとき
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))
elif icase==1:
n=2
a=[1,5]
b=[2,4]
c=[3,6]
elif icase==2:
n=6
a=[3, 14, 159, 2, 6, 53]
b=[58, 9, 79... | from bisect import bisect_left,bisect
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
lenc=len(c)
a.sort()
b.sort()
c.sort()
jsum=0
for j in b:
ai=bisect(a,j-1)
ci=lenc-bisect_left(c,j+1)
# print(j,ai,ci)
jsum+=a... | 48 | 20 | 1,045 | 333 | icase = 0
if icase == 0:
n = int(eval(input())) # 数値入力 「N」だけの入力のとき
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
elif icase == 1:
n = 2
a = [1, 5]
b = [2, 4]
c = [3, 6]
elif icase == 2:
n = 6
a = [3, 14, 159, 2, 6, 53... | from bisect import bisect_left, bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
lenc = len(c)
a.sort()
b.sort()
c.sort()
jsum = 0
for j in b:
ai = bisect(a, j - 1)
ci = lenc - bisect_left(c, j + 1)
# print(j,ai,ci)... | false | 58.333333 | [
"-icase = 0",
"-if icase == 0:",
"- n = int(eval(input())) # 数値入力 「N」だけの入力のとき",
"- a = list(map(int, input().split()))",
"- b = list(map(int, input().split()))",
"- c = list(map(int, input().split()))",
"-elif icase == 1:",
"- n = 2",
"- a = [1, 5]",
"- b = [2, 4]",
"- c... | false | 0.040057 | 0.048805 | 0.820766 | [
"s307283266",
"s355966111"
] |
u197237612 | p02570 | python | s827571926 | s881632839 | 34 | 26 | 9,144 | 9,104 | Accepted | Accepted | 23.53 | d, t, s = list(map(int, input().split()))
ans = d / s
if t >= ans:
print("Yes")
else:
print("No")
| D, T, S = list(map(int, input().split()))
if D/S <= T:
print("Yes")
else:
print("No") | 8 | 6 | 111 | 89 | d, t, s = list(map(int, input().split()))
ans = d / s
if t >= ans:
print("Yes")
else:
print("No")
| D, T, S = list(map(int, input().split()))
if D / S <= T:
print("Yes")
else:
print("No")
| false | 25 | [
"-d, t, s = list(map(int, input().split()))",
"-ans = d / s",
"-if t >= ans:",
"+D, T, S = list(map(int, input().split()))",
"+if D / S <= T:"
] | false | 0.067167 | 0.037506 | 1.790822 | [
"s827571926",
"s881632839"
] |
u996672406 | p03069 | python | s961470465 | s951804177 | 95 | 77 | 3,500 | 3,500 | Accepted | Accepted | 18.95 | n = int(eval(input()))
minv = res = rd = 0
for e in eval(input()):
if e == ".":
res += 1
rd -= 1
minv = min(minv, rd)
else:
rd += 1
print((res + minv))
| eval(input())
minv = res = rd = 0
for e in eval(input()):
if e == ".":
res += 1
rd -= 1
if rd < minv:
minv = rd
else:
rd += 1
print((res + minv))
| 12 | 13 | 191 | 198 | n = int(eval(input()))
minv = res = rd = 0
for e in eval(input()):
if e == ".":
res += 1
rd -= 1
minv = min(minv, rd)
else:
rd += 1
print((res + minv))
| eval(input())
minv = res = rd = 0
for e in eval(input()):
if e == ".":
res += 1
rd -= 1
if rd < minv:
minv = rd
else:
rd += 1
print((res + minv))
| false | 7.692308 | [
"-n = int(eval(input()))",
"+eval(input())",
"- minv = min(minv, rd)",
"+ if rd < minv:",
"+ minv = rd"
] | false | 0.049895 | 0.048791 | 1.02262 | [
"s961470465",
"s951804177"
] |
u188827677 | p02702 | python | s002316497 | s649060911 | 138 | 111 | 16,924 | 9,368 | Accepted | Accepted | 19.57 | import collections
s = eval(input())
n = len(s)
m = [0]
mod = 0
ten = 1
for i in s[::-1]:
mod += (int(i)*ten)%2019
mod %= 2019
m.append(mod)
ten *= 10
ten %= 2019
count = collections.Counter(m)
print((sum([c*(c-1)//2 for c in list(count.values())])))
| s = input()[::-1]
counts = [0]*2019 # 剰余の余りの回数を保存
counts[0] = 1 # 0%2019を累積和として含めることを想定
num, d = 0,1 # numは余りの累積和、dはcharの桁数
'''
charに一桁ずつ取り出す。そのmod2019を考え、累積和をとる。
しかし、それぞれの数字には10の累乗がかかっているので、それについては別途dを用意してmod2019をとる
つまり、numは1桁目のmod2019、2桁目のmod2019に1桁目のmod2019を加える
'''
for char in s:
num += int(char) * d... | 17 | 23 | 268 | 445 | import collections
s = eval(input())
n = len(s)
m = [0]
mod = 0
ten = 1
for i in s[::-1]:
mod += (int(i) * ten) % 2019
mod %= 2019
m.append(mod)
ten *= 10
ten %= 2019
count = collections.Counter(m)
print((sum([c * (c - 1) // 2 for c in list(count.values())])))
| s = input()[::-1]
counts = [0] * 2019 # 剰余の余りの回数を保存
counts[0] = 1 # 0%2019を累積和として含めることを想定
num, d = 0, 1 # numは余りの累積和、dはcharの桁数
"""
charに一桁ずつ取り出す。そのmod2019を考え、累積和をとる。
しかし、それぞれの数字には10の累乗がかかっているので、それについては別途dを用意してmod2019をとる
つまり、numは1桁目のmod2019、2桁目のmod2019に1桁目のmod2019を加える
"""
for char in s:
num += int(char) * d
n... | false | 26.086957 | [
"-import collections",
"-",
"-s = eval(input())",
"-n = len(s)",
"-m = [0]",
"-mod = 0",
"-ten = 1",
"-for i in s[::-1]:",
"- mod += (int(i) * ten) % 2019",
"- mod %= 2019",
"- m.append(mod)",
"- ten *= 10",
"- ten %= 2019",
"-count = collections.Counter(m)",
"-print((sum(... | false | 0.036459 | 0.036354 | 1.002882 | [
"s002316497",
"s649060911"
] |
u080986047 | p03835 | python | s813231000 | s542422009 | 280 | 257 | 40,940 | 40,940 | Accepted | Accepted | 8.21 | k,s = list(map(int,input().split()))
count = 0
for x in range(k+1):
for y in range(k+1):
if 0<=s-x-y<=k:
count+=1
print(count)
| k,s = list(map(int,input().split()))
count = 0
for x in range(min(s+1,k+1)):
for y in range(min(s+1-x,k+1)):
if 0<=s-x-y<=k:
count+=1
print(count) | 7 | 7 | 151 | 170 | k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
if 0 <= s - x - y <= k:
count += 1
print(count)
| k, s = list(map(int, input().split()))
count = 0
for x in range(min(s + 1, k + 1)):
for y in range(min(s + 1 - x, k + 1)):
if 0 <= s - x - y <= k:
count += 1
print(count)
| false | 0 | [
"-for x in range(k + 1):",
"- for y in range(k + 1):",
"+for x in range(min(s + 1, k + 1)):",
"+ for y in range(min(s + 1 - x, k + 1)):"
] | false | 0.049486 | 0.045991 | 1.075988 | [
"s813231000",
"s542422009"
] |
u361826811 | p02898 | python | s831511962 | s845761615 | 180 | 46 | 19,464 | 10,344 | Accepted | Accepted | 74.44 | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
# N = int(readline())
# D = [int(d) for d in readline().split()]
import numpy as np
N, K = list(map(int,... | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
N, K, *H = list(map(int, read().split()))
print((sum(x >= K for x in H)))
| 21 | 14 | 420 | 276 | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
# N = int(readline())
# D = [int(d) for d in readline().split()]
import numpy as np
N, K = list(map(int, readline().split()))
... | """
author : halo2halo
date : 9, Jan, 2020
"""
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
N, K, *H = list(map(int, read().split()))
print((sum(x >= K for x in H)))
| false | 33.333333 | [
"-# N = int(readline())",
"-# D = [int(d) for d in readline().split()]",
"-import numpy as np",
"-",
"-N, K = list(map(int, readline().split()))",
"-h = [int(x) for x in readline().split()]",
"-print((len([x for x in h if x - K >= 0])))",
"+N, K, *H = list(map(int, read().split()))",
"+print((sum(x ... | false | 0.066481 | 0.03832 | 1.73489 | [
"s831511962",
"s845761615"
] |
u371132735 | p03208 | python | s869215714 | s475564185 | 514 | 238 | 50,392 | 11,036 | Accepted | Accepted | 53.7 | N, K = list(map(int,input().split()))
a = []
for i in range(N):
a.append(int(eval(input())))
a.sort()
ans = 10**9 + 7
for i in range(N-K+1):
if ans > a[K-1+i] - a[i]:
ans = a[K-1+i] - a[i]
print(ans) | # 20200612_yorukatsu_c.py
N, K = list(map(int,input().split()))
M = [int(eval(input())) for i in range(N)]
M.sort()
lis = [0]*(N-K+1)
for i in range(N-K+1):
lis[i] = abs(M[i]-M[i+K-1])
print((min(lis)))
| 10 | 8 | 212 | 200 | N, K = list(map(int, input().split()))
a = []
for i in range(N):
a.append(int(eval(input())))
a.sort()
ans = 10**9 + 7
for i in range(N - K + 1):
if ans > a[K - 1 + i] - a[i]:
ans = a[K - 1 + i] - a[i]
print(ans)
| # 20200612_yorukatsu_c.py
N, K = list(map(int, input().split()))
M = [int(eval(input())) for i in range(N)]
M.sort()
lis = [0] * (N - K + 1)
for i in range(N - K + 1):
lis[i] = abs(M[i] - M[i + K - 1])
print((min(lis)))
| false | 20 | [
"+# 20200612_yorukatsu_c.py",
"-a = []",
"-for i in range(N):",
"- a.append(int(eval(input())))",
"-a.sort()",
"-ans = 10**9 + 7",
"+M = [int(eval(input())) for i in range(N)]",
"+M.sort()",
"+lis = [0] * (N - K + 1)",
"- if ans > a[K - 1 + i] - a[i]:",
"- ans = a[K - 1 + i] - a[i]"... | false | 0.044507 | 0.044511 | 0.999905 | [
"s869215714",
"s475564185"
] |
u919633157 | p03424 | python | s708341457 | s001035570 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | eval(input())
s=input().split()
print(('Four' if 'Y' in s else 'Three')) | n=int(eval(input()))
s=set(input().split())
print(('Three' if len(s)==3 else 'Four')) | 3 | 4 | 66 | 81 | eval(input())
s = input().split()
print(("Four" if "Y" in s else "Three"))
| n = int(eval(input()))
s = set(input().split())
print(("Three" if len(s) == 3 else "Four"))
| false | 25 | [
"-eval(input())",
"-s = input().split()",
"-print((\"Four\" if \"Y\" in s else \"Three\"))",
"+n = int(eval(input()))",
"+s = set(input().split())",
"+print((\"Three\" if len(s) == 3 else \"Four\"))"
] | false | 0.050531 | 0.048831 | 1.034818 | [
"s708341457",
"s001035570"
] |
u077291787 | p03221 | python | s556277436 | s649087156 | 647 | 430 | 46,100 | 30,600 | Accepted | Accepted | 33.54 | # ABC113C - ID
import sys
input = sys.stdin.readline
def main():
N, M = tuple(map(int, input().split()))
P = [[] for _ in range(N + 1)] # prefectures
for num in range(M):
pref, year = tuple(map(int, input().split()))
P[pref] += [(year, num)]
ans = []
P = [sorted(p) for p... | # ABC113C - ID
import sys
input = sys.stdin.readline
def main():
N, M = map(int, input().split())
ans, A, cnt = [""] * M, [], 1
for i in range(M):
p, y = map(int, input().split())
A += [(p, y, i)]
A.sort()
ans[A[0][2]] = "{:06}{:06}".format(A[0][0], cnt)
for i in r... | 21 | 24 | 640 | 554 | # ABC113C - ID
import sys
input = sys.stdin.readline
def main():
N, M = tuple(map(int, input().split()))
P = [[] for _ in range(N + 1)] # prefectures
for num in range(M):
pref, year = tuple(map(int, input().split()))
P[pref] += [(year, num)]
ans = []
P = [sorted(p) for p in P]
... | # ABC113C - ID
import sys
input = sys.stdin.readline
def main():
N, M = map(int, input().split())
ans, A, cnt = [""] * M, [], 1
for i in range(M):
p, y = map(int, input().split())
A += [(p, y, i)]
A.sort()
ans[A[0][2]] = "{:06}{:06}".format(A[0][0], cnt)
for i in range(1, M):
... | false | 12.5 | [
"- N, M = tuple(map(int, input().split()))",
"- P = [[] for _ in range(N + 1)] # prefectures",
"- for num in range(M):",
"- pref, year = tuple(map(int, input().split()))",
"- P[pref] += [(year, num)]",
"- ans = []",
"- P = [sorted(p) for p in P]",
"- for pref_idx, pref... | false | 0.073662 | 0.160799 | 0.458099 | [
"s556277436",
"s649087156"
] |
u638456847 | p02763 | python | s352739765 | s742006213 | 593 | 540 | 47,400 | 46,628 | Accepted | Accepted | 8.94 | # AC: 577 msec (Python3)
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def string_to_number(a):
return 1 << (ord(a) - 97)
class SegmentTree:
def __init__(self, A):
self.n = 2**(len(A)-1).bit_length()
self.identity = 0
self... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def string_to_number(a):
return 1 << (ord(a) - 97)
class SegmentTree:
"""
セグ木は 1-indexed
"""
def __init__(self, n, initial=0):
self.offset = 2**(n-1).bit_length()
self.ini... | 72 | 68 | 1,770 | 1,593 | # AC: 577 msec (Python3)
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def string_to_number(a):
return 1 << (ord(a) - 97)
class SegmentTree:
def __init__(self, A):
self.n = 2 ** (len(A) - 1).bit_length()
self.identity = 0
self.seg = [... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def string_to_number(a):
return 1 << (ord(a) - 97)
class SegmentTree:
"""
セグ木は 1-indexed
"""
def __init__(self, n, initial=0):
self.offset = 2 ** (n - 1).bit_length()
self.initial = i... | false | 5.555556 | [
"-# AC: 577 msec (Python3)",
"- def __init__(self, A):",
"- self.n = 2 ** (len(A) - 1).bit_length()",
"- self.identity = 0",
"- self.seg = [self.identity] * (2 * self.n)",
"- for i, a in enumerate(A):",
"- self.seg[self.n - 1 + i] = string_to_number(a)",
"- ... | false | 0.147586 | 0.043757 | 3.372874 | [
"s352739765",
"s742006213"
] |
u281303342 | p03137 | python | s408096333 | s801279049 | 124 | 111 | 13,968 | 13,188 | Accepted | Accepted | 10.48 | N,M = list(map(int,input().split()))
X = list(map(int,input().split()))
if N >= M:
print((0))
else:
X.sort()
D = []
for i in range(M-1):
D.append(X[i+1]-X[i])
D.sort()
print((sum(D[0:M-N]))) | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 12 | 24 | 224 | 569 | N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
if N >= M:
print((0))
else:
X.sort()
D = []
for i in range(M - 1):
D.append(X[i + 1] - X[i])
D.sort()
print((sum(D[0 : M - N])))
| # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 50 | [
"+# Python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# function",
"+# main"
] | false | 0.065984 | 0.040528 | 1.628122 | [
"s408096333",
"s801279049"
] |
u624475441 | p03147 | python | s949947459 | s874142347 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | N, *H = list(map(int, open(0).read().split()))
cnt = 0
prv = 0
for h in H:
cnt += max(0, h - prv)
prv = h
print(cnt) | N, *H = list(map(int, open(0).read().split()))
diff = [H[0]] + [abs(prv - cur) for prv, cur in zip(H, H[1:])] + [H[-1]]
print((sum(diff) // 2)) | 7 | 3 | 124 | 137 | N, *H = list(map(int, open(0).read().split()))
cnt = 0
prv = 0
for h in H:
cnt += max(0, h - prv)
prv = h
print(cnt)
| N, *H = list(map(int, open(0).read().split()))
diff = [H[0]] + [abs(prv - cur) for prv, cur in zip(H, H[1:])] + [H[-1]]
print((sum(diff) // 2))
| false | 57.142857 | [
"-cnt = 0",
"-prv = 0",
"-for h in H:",
"- cnt += max(0, h - prv)",
"- prv = h",
"-print(cnt)",
"+diff = [H[0]] + [abs(prv - cur) for prv, cur in zip(H, H[1:])] + [H[-1]]",
"+print((sum(diff) // 2))"
] | false | 0.068447 | 0.036543 | 1.873072 | [
"s949947459",
"s874142347"
] |
u023515228 | p04013 | python | s071054716 | s944201294 | 212 | 27 | 8,688 | 3,572 | Accepted | Accepted | 87.26 | import collections
N, A = list(map(int, input().split()))
xs = list(map(int, input().split()))
dp = collections.defaultdict(lambda: 0)
dp[(0, 0)] = 1
for n, x in enumerate(xs, start=1):
for (k, accum), count in list(dp.items()):
dp[(k + 1, accum + x)] += count
found = 0
for (k, accum), count in l... | import collections
N, A = list(map(int, input().split()))
ys = [int(x) - A for x in input().split()]
dp = collections.defaultdict(lambda: 0)
dp[0] = 1
for y in ys:
for accum, count in list(dp.items()):
dp[accum + y] += count
found = -1 # for dp[0]
for accum, count in list(dp.items()):
if acc... | 14 | 14 | 396 | 354 | import collections
N, A = list(map(int, input().split()))
xs = list(map(int, input().split()))
dp = collections.defaultdict(lambda: 0)
dp[(0, 0)] = 1
for n, x in enumerate(xs, start=1):
for (k, accum), count in list(dp.items()):
dp[(k + 1, accum + x)] += count
found = 0
for (k, accum), count in list(dp.ite... | import collections
N, A = list(map(int, input().split()))
ys = [int(x) - A for x in input().split()]
dp = collections.defaultdict(lambda: 0)
dp[0] = 1
for y in ys:
for accum, count in list(dp.items()):
dp[accum + y] += count
found = -1 # for dp[0]
for accum, count in list(dp.items()):
if accum == 0:
... | false | 0 | [
"-xs = list(map(int, input().split()))",
"+ys = [int(x) - A for x in input().split()]",
"-dp[(0, 0)] = 1",
"-for n, x in enumerate(xs, start=1):",
"- for (k, accum), count in list(dp.items()):",
"- dp[(k + 1, accum + x)] += count",
"-found = 0",
"-for (k, accum), count in list(dp.items()):",... | false | 0.084459 | 0.039583 | 2.133745 | [
"s071054716",
"s944201294"
] |
u523743252 | p02389 | python | s213403675 | s041425645 | 30 | 20 | 7,648 | 7,664 | Accepted | Accepted | 33.33 | input = list([int(n) for n in input().split(' ')])
a = int(input[0])
b = int(input[1])
x = a * b
y = (a + b) * 2
print(("{} {}".format(x, y))) | input = list([int(n) for n in input().split(' ')])
a = input[0]
b = input[1]
x = a * b
y = (a + b) * 2
print(("{} {}".format(x, y))) | 6 | 6 | 150 | 140 | input = list([int(n) for n in input().split(" ")])
a = int(input[0])
b = int(input[1])
x = a * b
y = (a + b) * 2
print(("{} {}".format(x, y)))
| input = list([int(n) for n in input().split(" ")])
a = input[0]
b = input[1]
x = a * b
y = (a + b) * 2
print(("{} {}".format(x, y)))
| false | 0 | [
"-a = int(input[0])",
"-b = int(input[1])",
"+a = input[0]",
"+b = input[1]"
] | false | 0.088858 | 0.037407 | 2.375455 | [
"s213403675",
"s041425645"
] |
u071680334 | p02773 | python | s823989193 | s550730262 | 795 | 627 | 46,556 | 32,988 | Accepted | Accepted | 21.13 | def main():
dic = {}
n = int(eval(input()))
for i in range(n):
s = input().rstrip()
if s in list(dic.keys()):
dic[s] += 1
else:
dic[s] = 1
m = 0
for v in list(dic.values()):
if m < v:
m = v
s_dic = sorted(list(dic.... | def main():
dic = {}
n = int(eval(input()))
for _ in range(n):
s = input().rstrip()
if s in list(dic.keys()):
dic[s] += 1
else:
dic[s] = 1
m = max(dic.values())
ans = [key for key, val in list(dic.items()) if val == m]
for a in sorted(a... | 20 | 16 | 432 | 366 | def main():
dic = {}
n = int(eval(input()))
for i in range(n):
s = input().rstrip()
if s in list(dic.keys()):
dic[s] += 1
else:
dic[s] = 1
m = 0
for v in list(dic.values()):
if m < v:
m = v
s_dic = sorted(list(dic.items()), key=... | def main():
dic = {}
n = int(eval(input()))
for _ in range(n):
s = input().rstrip()
if s in list(dic.keys()):
dic[s] += 1
else:
dic[s] = 1
m = max(dic.values())
ans = [key for key, val in list(dic.items()) if val == m]
for a in sorted(ans):
... | false | 20 | [
"- for i in range(n):",
"+ for _ in range(n):",
"- m = 0",
"- for v in list(dic.values()):",
"- if m < v:",
"- m = v",
"- s_dic = sorted(list(dic.items()), key=lambda x: x[0])",
"- for k, v in s_dic:",
"- if v == m:",
"- print(k)",
"+ m = ... | false | 0.06116 | 0.040984 | 1.492279 | [
"s823989193",
"s550730262"
] |
u509516894 | p02748 | python | s296481984 | s223586126 | 339 | 155 | 25,108 | 97,592 | Accepted | Accepted | 54.28 | na, nb, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
min_a = min_b = 10**9
for i in range(na):
min_a = min(min_a, a[i])
for i in range(nb):
min_b = min(min_b, b[i])
ans = min_a + min_b
for i in range(m):
x, y, c = list(map(int, input()... | from sys import stdin
input = lambda: stdin.readline().rstrip()
na, nb, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)
for i in range(m):
x, y, c = list(map(int, input().split()))
x -= 1
y -= 1
ans = min(ans, a[... | 15 | 12 | 392 | 335 | na, nb, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
min_a = min_b = 10**9
for i in range(na):
min_a = min(min_a, a[i])
for i in range(nb):
min_b = min(min_b, b[i])
ans = min_a + min_b
for i in range(m):
x, y, c = list(map(int, input().split()))... | from sys import stdin
input = lambda: stdin.readline().rstrip()
na, nb, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)
for i in range(m):
x, y, c = list(map(int, input().split()))
x -= 1
y -= 1
ans = min(ans, a[x] + b[y]... | false | 20 | [
"+from sys import stdin",
"+",
"+input = lambda: stdin.readline().rstrip()",
"-min_a = min_b = 10**9",
"-for i in range(na):",
"- min_a = min(min_a, a[i])",
"-for i in range(nb):",
"- min_b = min(min_b, b[i])",
"-ans = min_a + min_b",
"+ans = min(a) + min(b)"
] | false | 0.041406 | 0.042907 | 0.965028 | [
"s296481984",
"s223586126"
] |
u796842765 | p02772 | python | s440298953 | s262371407 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | N = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
if a % 2 == 1:
continue
if a % 3 == 0 or a % 5 == 0:
continue
print("DENIED")
exit()
print("APPROVED")
| N = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
if a % 2 == 1:
continue
if a % 3 == 0:
continue
if a % 5 == 0:
continue
print("DENIED")
exit()
print("APPROVED") | 10 | 14 | 193 | 260 | N = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
if a % 2 == 1:
continue
if a % 3 == 0 or a % 5 == 0:
continue
print("DENIED")
exit()
print("APPROVED")
| N = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
if a % 2 == 1:
continue
if a % 3 == 0:
continue
if a % 5 == 0:
continue
print("DENIED")
exit()
print("APPROVED")
| false | 28.571429 | [
"- if a % 3 == 0 or a % 5 == 0:",
"+ if a % 3 == 0:",
"+ continue",
"+ if a % 5 == 0:"
] | false | 0.040433 | 0.039942 | 1.012274 | [
"s440298953",
"s262371407"
] |
u782098901 | p02837 | python | s820971643 | s507089735 | 788 | 683 | 3,064 | 3,064 | Accepted | Accepted | 13.32 | N = int(eval(input()))
A = [[list(map(int, input().split())) for _ in range(int(eval(input())))] for _ in range(N)]
res = 0
for k in range(1 << N):
bits = [(k >> i) & 1 for i in range(N)]
flag = True
for i, a in enumerate(A):
if bits[i] == 0:
continue
for x, y in a:
... | N = int(eval(input()))
XY = [[list(map(int, input().split())) for _ in range(int(eval(input())))] for _ in range(N)]
res = 0
for k in range(1 << N):
bits = [(k >> i) & 1 for i in range(N)]
flag = True
for i in range(N):
if (k >> i) & 1 == 0:
continue
for x, y in XY[i]:... | 18 | 17 | 455 | 456 | N = int(eval(input()))
A = [
[list(map(int, input().split())) for _ in range(int(eval(input())))]
for _ in range(N)
]
res = 0
for k in range(1 << N):
bits = [(k >> i) & 1 for i in range(N)]
flag = True
for i, a in enumerate(A):
if bits[i] == 0:
continue
for x, y in a:
... | N = int(eval(input()))
XY = [
[list(map(int, input().split())) for _ in range(int(eval(input())))]
for _ in range(N)
]
res = 0
for k in range(1 << N):
bits = [(k >> i) & 1 for i in range(N)]
flag = True
for i in range(N):
if (k >> i) & 1 == 0:
continue
for x, y in XY[i]:
... | false | 5.555556 | [
"-A = [",
"+XY = [",
"- for i, a in enumerate(A):",
"- if bits[i] == 0:",
"+ for i in range(N):",
"+ if (k >> i) & 1 == 0:",
"- for x, y in a:",
"+ for x, y in XY[i]:"
] | false | 0.035225 | 0.033794 | 1.042354 | [
"s820971643",
"s507089735"
] |
u729133443 | p03408 | python | s920533597 | s429221605 | 168 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.88 | I=lambda:[eval(input())for _ in[0]*int(eval(input()))];s=I();t=I();print((max(0,*[s.count(i)-t.count(i)for i in s]))) | n,*s=open(0).read().split();n=int(n);print((max(0,*[s[:n].count(i)-s[n:].count(i)for i in s[:n]]))) | 1 | 1 | 103 | 97 | I = lambda: [eval(input()) for _ in [0] * int(eval(input()))]
s = I()
t = I()
print((max(0, *[s.count(i) - t.count(i) for i in s])))
| n, *s = open(0).read().split()
n = int(n)
print((max(0, *[s[:n].count(i) - s[n:].count(i) for i in s[:n]])))
| false | 0 | [
"-I = lambda: [eval(input()) for _ in [0] * int(eval(input()))]",
"-s = I()",
"-t = I()",
"-print((max(0, *[s.count(i) - t.count(i) for i in s])))",
"+n, *s = open(0).read().split()",
"+n = int(n)",
"+print((max(0, *[s[:n].count(i) - s[n:].count(i) for i in s[:n]])))"
] | false | 0.064616 | 0.04566 | 1.415143 | [
"s920533597",
"s429221605"
] |
u392319141 | p02873 | python | s953390037 | s023648231 | 535 | 442 | 23,352 | 31,516 | Accepted | Accepted | 17.38 | S = eval(input())
N = len(S)
A = [0] * (N + 1)
left = 0
while left < N and S[left] == '<':
A[left + 1] = A[left] + 1
left += 1
while left < N:
mid = left + 1
while mid < N and S[mid] == '>':
mid += 1
right = mid
while right < N and S[right] == '<':
right += 1... | S = eval(input())
N = len(S)
A = [0] * (N + 1)
now = 0
for i, s in enumerate(S, start=1):
if s == '<':
now += 1
else:
now = 0
A[i] = now
B = [0] * (N + 1)
now = 0
for i, s in enumerate(S[::-1], start=1):
if s == '>':
now += 1
else:
now = 0
B[i... | 27 | 26 | 522 | 434 | S = eval(input())
N = len(S)
A = [0] * (N + 1)
left = 0
while left < N and S[left] == "<":
A[left + 1] = A[left] + 1
left += 1
while left < N:
mid = left + 1
while mid < N and S[mid] == ">":
mid += 1
right = mid
while right < N and S[right] == "<":
right += 1
for l in range(l... | S = eval(input())
N = len(S)
A = [0] * (N + 1)
now = 0
for i, s in enumerate(S, start=1):
if s == "<":
now += 1
else:
now = 0
A[i] = now
B = [0] * (N + 1)
now = 0
for i, s in enumerate(S[::-1], start=1):
if s == ">":
now += 1
else:
now = 0
B[i] = now
B = B[::-1]
a... | false | 3.703704 | [
"-left = 0",
"-while left < N and S[left] == \"<\":",
"- A[left + 1] = A[left] + 1",
"- left += 1",
"-while left < N:",
"- mid = left + 1",
"- while mid < N and S[mid] == \">\":",
"- mid += 1",
"- right = mid",
"- while right < N and S[right] == \"<\":",
"- right ... | false | 0.045472 | 0.047551 | 0.956266 | [
"s953390037",
"s023648231"
] |
u270825463 | p03206 | python | s964394702 | s869400612 | 17 | 11 | 2,940 | 2,568 | Accepted | Accepted | 35.29 | D = int(input())
D -= 25
print('Christmas',end='')
while D<0:
print(' Eve',end='')
D += 1
| import sys
D = int(eval(input()))
D -= 25
sys.stdout.write('Christmas')
while D<0:
sys.stdout.write(' Eve')
D += 1 | 6 | 7 | 102 | 122 | D = int(input())
D -= 25
print("Christmas", end="")
while D < 0:
print(" Eve", end="")
D += 1
| import sys
D = int(eval(input()))
D -= 25
sys.stdout.write("Christmas")
while D < 0:
sys.stdout.write(" Eve")
D += 1
| false | 14.285714 | [
"-D = int(input())",
"+import sys",
"+",
"+D = int(eval(input()))",
"-print(\"Christmas\", end=\"\")",
"+sys.stdout.write(\"Christmas\")",
"- print(\" Eve\", end=\"\")",
"+ sys.stdout.write(\" Eve\")"
] | false | 0.039702 | 0.044043 | 0.901424 | [
"s964394702",
"s869400612"
] |
u641406334 | p03401 | python | s626953136 | s661040901 | 1,367 | 231 | 13,760 | 14,048 | Accepted | Accepted | 83.1 | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
A.appendleft(0)
A.append(0)
ans = 0
for i in range(1, n+2):
ans+=abs(A[i]-A[i-1])
for i in range(1, n+1):
d = abs(A[i]-A[i-1])+abs(A[i+1]-A[i])
print((ans-d+abs(A[i-1]-A[i+1])))
| n = int(eval(input()))
A = list(map(int, input().split()))
A.append(0)
A.insert(0, 0)
ans = 0
for i in range(1, n+2):
ans+=abs(A[i]-A[i-1])
for i in range(1, n+1):
d = abs(A[i]-A[i-1])+abs(A[i+1]-A[i])
print((ans-d+abs(A[i-1]-A[i+1])))
| 11 | 10 | 282 | 249 | from collections import deque
n = int(eval(input()))
A = deque(list(map(int, input().split())))
A.appendleft(0)
A.append(0)
ans = 0
for i in range(1, n + 2):
ans += abs(A[i] - A[i - 1])
for i in range(1, n + 1):
d = abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i])
print((ans - d + abs(A[i - 1] - A[i + 1])))
| n = int(eval(input()))
A = list(map(int, input().split()))
A.append(0)
A.insert(0, 0)
ans = 0
for i in range(1, n + 2):
ans += abs(A[i] - A[i - 1])
for i in range(1, n + 1):
d = abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i])
print((ans - d + abs(A[i - 1] - A[i + 1])))
| false | 9.090909 | [
"-from collections import deque",
"-",
"-A = deque(list(map(int, input().split())))",
"-A.appendleft(0)",
"+A = list(map(int, input().split()))",
"+A.insert(0, 0)"
] | false | 0.047957 | 0.047281 | 1.014298 | [
"s626953136",
"s661040901"
] |
u998733244 | p02743 | python | s992529297 | s286042301 | 35 | 17 | 5,076 | 2,940 | Accepted | Accepted | 51.43 | #!/usr/bin/env python3
from decimal import *
a, b, c = list(map(int, input().split()))
if a+b>c:
print('No')
exit()
X = (a+b-c)**2
Y = a*b*4
if (Y<X):
print('Yes')
else:
print('No')
| #!/usr/bin/env python3
a, b, c = list(map(int, input().split()))
if a+b>c:
print('No')
exit()
f1 = 4*a*b - 2*a*b + 2*c*a + 2*b*c
f2 = c**2 + b**2 + a**2
if f1 < f2:
print('Yes')
else:
print('No')
| 14 | 16 | 207 | 226 | #!/usr/bin/env python3
from decimal import *
a, b, c = list(map(int, input().split()))
if a + b > c:
print("No")
exit()
X = (a + b - c) ** 2
Y = a * b * 4
if Y < X:
print("Yes")
else:
print("No")
| #!/usr/bin/env python3
a, b, c = list(map(int, input().split()))
if a + b > c:
print("No")
exit()
f1 = 4 * a * b - 2 * a * b + 2 * c * a + 2 * b * c
f2 = c**2 + b**2 + a**2
if f1 < f2:
print("Yes")
else:
print("No")
| false | 12.5 | [
"-from decimal import *",
"-",
"-X = (a + b - c) ** 2",
"-Y = a * b * 4",
"-if Y < X:",
"+f1 = 4 * a * b - 2 * a * b + 2 * c * a + 2 * b * c",
"+f2 = c**2 + b**2 + a**2",
"+if f1 < f2:"
] | false | 0.091446 | 0.078134 | 1.17037 | [
"s992529297",
"s286042301"
] |
u887207211 | p03086 | python | s894483305 | s916999030 | 23 | 19 | 3,316 | 3,188 | Accepted | Accepted | 17.39 | import re
ptn = re.compile(r"(A|C|T|G)*")
S = eval(input())
T = set()
xx=ptn.match("FAFA")
for i in range(len(S)):
for j in range(len(S)):
x = ptn.match(S[i:i+j+1])
if(x.group(0)):
T.add(len(x.group(0)))
try:
print((max(T)))
except:
print((0)) | import re
ptn = re.compile(r"(A|C|G|T)*")
S = eval(input())
ans = 0
for i in range(len(S)):
for j in range(len(S)):
x = ptn.match(S[i:i+j+1]).group(0)
if(x):
ans = max(ans, len(x))
print(ans) | 15 | 12 | 268 | 214 | import re
ptn = re.compile(r"(A|C|T|G)*")
S = eval(input())
T = set()
xx = ptn.match("FAFA")
for i in range(len(S)):
for j in range(len(S)):
x = ptn.match(S[i : i + j + 1])
if x.group(0):
T.add(len(x.group(0)))
try:
print((max(T)))
except:
print((0))
| import re
ptn = re.compile(r"(A|C|G|T)*")
S = eval(input())
ans = 0
for i in range(len(S)):
for j in range(len(S)):
x = ptn.match(S[i : i + j + 1]).group(0)
if x:
ans = max(ans, len(x))
print(ans)
| false | 20 | [
"-ptn = re.compile(r\"(A|C|T|G)*\")",
"+ptn = re.compile(r\"(A|C|G|T)*\")",
"-T = set()",
"-xx = ptn.match(\"FAFA\")",
"+ans = 0",
"- x = ptn.match(S[i : i + j + 1])",
"- if x.group(0):",
"- T.add(len(x.group(0)))",
"-try:",
"- print((max(T)))",
"-except:",
"- pr... | false | 0.054024 | 0.053656 | 1.006862 | [
"s894483305",
"s916999030"
] |
u936985471 | p02792 | python | s923145262 | s920280872 | 172 | 155 | 3,316 | 9,444 | Accepted | Accepted | 9.88 | from collections import defaultdict as d
dic=d(int)
for i in range(1,int(eval(input()))+1):
dic[(int(str(i)[0]),i%10)]+=1
ans=0
for i in range(10):
for j in range(10):
ans+=dic[(i,j)]*dic[(j,i)]
print(ans) | import sys
readline = sys.stdin.readline
N = int(readline())
from collections import defaultdict
dic = defaultdict(int)
for i in range(1, N + 1):
s = str(i)
dic[(int(s[0]),int(s[-1]))] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += dic[(i,j)] * dic[(j,i)]
print(a... | 9 | 18 | 215 | 323 | from collections import defaultdict as d
dic = d(int)
for i in range(1, int(eval(input())) + 1):
dic[(int(str(i)[0]), i % 10)] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += dic[(i, j)] * dic[(j, i)]
print(ans)
| import sys
readline = sys.stdin.readline
N = int(readline())
from collections import defaultdict
dic = defaultdict(int)
for i in range(1, N + 1):
s = str(i)
dic[(int(s[0]), int(s[-1]))] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += dic[(i, j)] * dic[(j, i)]
print(ans)
| false | 50 | [
"-from collections import defaultdict as d",
"+import sys",
"-dic = d(int)",
"-for i in range(1, int(eval(input())) + 1):",
"- dic[(int(str(i)[0]), i % 10)] += 1",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+from collections import defaultdict",
"+",
"+dic = defaultdict(int)",
... | false | 0.070873 | 0.07362 | 0.962691 | [
"s923145262",
"s920280872"
] |
u945181840 | p03971 | python | s760069981 | s999492400 | 100 | 85 | 4,016 | 4,016 | Accepted | Accepted | 15 | N, A, B = list(map(int, input().split()))
S = eval(input())
total = A + B
domestic = 0
overseas = 0
for i in S:
if i == 'a':
if domestic + overseas < total:
print('Yes')
domestic += 1
continue
elif i == 'b':
if domestic + overseas < total and o... | def main():
N, A, B = list(map(int, input().split()))
S = eval(input())
total = A + B
domestic = 0
overseas = 0
for i in S:
if i == 'a':
if domestic + overseas < total:
print('Yes')
domestic += 1
continue
... | 20 | 25 | 414 | 539 | N, A, B = list(map(int, input().split()))
S = eval(input())
total = A + B
domestic = 0
overseas = 0
for i in S:
if i == "a":
if domestic + overseas < total:
print("Yes")
domestic += 1
continue
elif i == "b":
if domestic + overseas < total and overseas < B:
... | def main():
N, A, B = list(map(int, input().split()))
S = eval(input())
total = A + B
domestic = 0
overseas = 0
for i in S:
if i == "a":
if domestic + overseas < total:
print("Yes")
domestic += 1
continue
elif i == "b":
... | false | 20 | [
"-N, A, B = list(map(int, input().split()))",
"-S = eval(input())",
"-total = A + B",
"-domestic = 0",
"-overseas = 0",
"-for i in S:",
"- if i == \"a\":",
"- if domestic + overseas < total:",
"- print(\"Yes\")",
"- domestic += 1",
"- continue",
"- ... | false | 0.04347 | 0.044425 | 0.978506 | [
"s760069981",
"s999492400"
] |
u914198331 | p02659 | python | s965543441 | s544904682 | 24 | 21 | 10,012 | 9,172 | Accepted | Accepted | 12.5 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a*b))) | a, b = list(map(int, input().replace('.', '').split()))
print((a*b//100)) | 3 | 2 | 82 | 66 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| a, b = list(map(int, input().replace(".", "").split()))
print((a * b // 100))
| false | 33.333333 | [
"-from decimal import Decimal",
"-",
"-a, b = list(map(Decimal, input().split()))",
"-print((int(a * b)))",
"+a, b = list(map(int, input().replace(\".\", \"\").split()))",
"+print((a * b // 100))"
] | false | 0.039798 | 0.109294 | 0.364139 | [
"s965543441",
"s544904682"
] |
u677267454 | p02675 | python | s664751689 | s437402109 | 23 | 21 | 9,164 | 9,164 | Accepted | Accepted | 8.7 | N = int(eval(input()))
amari = N % 10
if amari in [2, 4, 5, 7, 9]:
print('hon')
elif amari in [0, 1, 6, 8]:
print('pon')
else:
print('bon')
| N = int(eval(input()))
amari = N % 10
if amari in {2, 4, 5, 7, 9}:
print('hon')
elif amari in {0, 1, 6, 8}:
print('pon')
else:
print('bon')
| 9 | 9 | 155 | 155 | N = int(eval(input()))
amari = N % 10
if amari in [2, 4, 5, 7, 9]:
print("hon")
elif amari in [0, 1, 6, 8]:
print("pon")
else:
print("bon")
| N = int(eval(input()))
amari = N % 10
if amari in {2, 4, 5, 7, 9}:
print("hon")
elif amari in {0, 1, 6, 8}:
print("pon")
else:
print("bon")
| false | 0 | [
"-if amari in [2, 4, 5, 7, 9]:",
"+if amari in {2, 4, 5, 7, 9}:",
"-elif amari in [0, 1, 6, 8]:",
"+elif amari in {0, 1, 6, 8}:"
] | false | 0.035463 | 0.041948 | 0.845424 | [
"s664751689",
"s437402109"
] |
u499381410 | p03553 | python | s248368340 | s367618878 | 224 | 172 | 44,652 | 83,416 | Accepted | Accepted | 23.21 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 107 | 105 | 3,066 | 3,048 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | false | 1.869159 | [
"-A = LI()",
"-score = 0",
"+A = LI()",
"+total = 0",
"- if A[i - 1] > 0:",
"- score += A[i - 1]",
"+ if A[i - 1] >= 0:",
"+ total += A[i - 1]",
"- ret = i",
"- while ret + i <= n:",
"- ret += i",
"- dinic.add_edge(i, ret, INF)",
"-print((score - dinic... | false | 0.038178 | 0.048511 | 0.787004 | [
"s248368340",
"s367618878"
] |
u218834617 | p02947 | python | s532340004 | s126060155 | 150 | 138 | 22,080 | 22,032 | Accepted | Accepted | 8 | import sys
N=int(eval(input()))
ans,c=0,{}
for _ in range(N):
s=''.join(sorted(next(sys.stdin)))
if s not in c:
c[s]=0
ans+=c[s]
c[s]+=1
print(ans)
| import sys
eval(input())
ans,c=0,{}
for ln in sys.stdin:
s=''.join(sorted(ln))
ans+=c.setdefault(s,0)
c[s]+=1
print(ans)
| 10 | 8 | 176 | 134 | import sys
N = int(eval(input()))
ans, c = 0, {}
for _ in range(N):
s = "".join(sorted(next(sys.stdin)))
if s not in c:
c[s] = 0
ans += c[s]
c[s] += 1
print(ans)
| import sys
eval(input())
ans, c = 0, {}
for ln in sys.stdin:
s = "".join(sorted(ln))
ans += c.setdefault(s, 0)
c[s] += 1
print(ans)
| false | 20 | [
"-N = int(eval(input()))",
"+eval(input())",
"-for _ in range(N):",
"- s = \"\".join(sorted(next(sys.stdin)))",
"- if s not in c:",
"- c[s] = 0",
"- ans += c[s]",
"+for ln in sys.stdin:",
"+ s = \"\".join(sorted(ln))",
"+ ans += c.setdefault(s, 0)"
] | false | 0.059842 | 0.100312 | 0.596559 | [
"s532340004",
"s126060155"
] |
u311379832 | p03317 | python | s151680046 | s044802743 | 47 | 40 | 13,812 | 13,812 | Accepted | Accepted | 14.89 | import math
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
tmp = a.index(min(a))
amri = ((tmp) % (K - 1))
if amri == 0:
ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - (K- amri)) / (K - 1)) + 1... | import math
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = math.ceil((N - 1)/ (K - 1))
print(ans) | 11 | 5 | 326 | 129 | import math
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
tmp = a.index(min(a))
amri = (tmp) % (K - 1)
if amri == 0:
ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - (K - amri)) / (K - 1)) + 1
print(ans... | import math
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = math.ceil((N - 1) / (K - 1))
print(ans)
| false | 54.545455 | [
"-tmp = a.index(min(a))",
"-amri = (tmp) % (K - 1)",
"-if amri == 0:",
"- ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))",
"-else:",
"- ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - (K - amri)) / (K - 1)) + 1",
"+ans = math.ceil((N - 1) / (K - 1))"
] | false | 0.073804 | 0.07334 | 1.006321 | [
"s151680046",
"s044802743"
] |
u692336506 | p03160 | python | s220073194 | s089963810 | 193 | 151 | 95,376 | 20,556 | Accepted | Accepted | 21.76 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [-1] * (N+1)
def rec(i):
if i == 0:
return 0
if dp[i] != -1:
return dp[i]
dp[i] = 2**60 # 十分大きな値
if i - 1 >= 0:
dp[i] = min(dp[i], rec(i - 1) + abs(h[i - 1] - h... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [2**60] * N
dp[0] = 0
for i in range(N):
if i - 1 >= 0:
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i - 2 >= 0:
dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print((dp[N-1]))
| 20 | 10 | 440 | 275 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [-1] * (N + 1)
def rec(i):
if i == 0:
return 0
if dp[i] != -1:
return dp[i]
dp[i] = 2**60 # 十分大きな値
if i - 1 >= 0:
dp[i] = min(dp[i], rec(i - 1) + abs(h[i - 1] - h[i]))
... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [2**60] * N
dp[0] = 0
for i in range(N):
if i - 1 >= 0:
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i - 2 >= 0:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| false | 50 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-dp = [-1] * (N + 1)",
"-",
"-",
"-def rec(i):",
"- if i == 0:",
"- return 0",
"- if dp[i] != -1:",
"- return dp[i]",
"- dp[i] = 2**60 # 十分大きな値",
"+dp = [2**60] * N",
"+dp[0] = 0",
"+for i in range(N):",
"- ... | false | 0.046075 | 0.047391 | 0.972231 | [
"s220073194",
"s089963810"
] |
u297046168 | p02713 | python | s424998860 | s506447354 | 1,362 | 629 | 135,400 | 69,588 | Accepted | Accepted | 53.82 | import math
K = int(eval(input()))
ans = 0
result = 0
dp = [[[0 for i in range(K+1)] for i in range(K+1)]for i in range(K+1)]
for i in range(1,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
if dp[i][j][k] == 0:
x = math.gcd(i,j)
y = math.gcd(j,k)
... | import math
K = int(eval(input()))
ans = 0
for i in range(1,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
x = math.gcd(i,j)
y = math.gcd(j,k)
ans += math.gcd(x,y)
print(ans) | 20 | 10 | 633 | 230 | import math
K = int(eval(input()))
ans = 0
result = 0
dp = [[[0 for i in range(K + 1)] for i in range(K + 1)] for i in range(K + 1)]
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
if dp[i][j][k] == 0:
x = math.gcd(i, j)
y = math.gcd... | import math
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
x = math.gcd(i, j)
y = math.gcd(j, k)
ans += math.gcd(x, y)
print(ans)
| false | 50 | [
"-result = 0",
"-dp = [[[0 for i in range(K + 1)] for i in range(K + 1)] for i in range(K + 1)]",
"- if dp[i][j][k] == 0:",
"- x = math.gcd(i, j)",
"- y = math.gcd(j, k)",
"- ans = math.gcd(x, y)",
"- dp[i][j][k] = ans",
"- ... | false | 0.054223 | 0.038312 | 1.415292 | [
"s424998860",
"s506447354"
] |
u887207211 | p03606 | python | s571661677 | s884102251 | 21 | 19 | 3,060 | 3,060 | Accepted | Accepted | 9.52 | N = int(eval(input()))
ans = 0
for i in range(N):
l, r = list(map(int,input().split()))
ans += r - l + 1
print(ans) | N = int(eval(input()))
cnt = 0
for i in range(N):
l, r = list(map(int,input().split()))
cnt += r - l + 1
print(cnt) | 6 | 7 | 112 | 114 | N = int(eval(input()))
ans = 0
for i in range(N):
l, r = list(map(int, input().split()))
ans += r - l + 1
print(ans)
| N = int(eval(input()))
cnt = 0
for i in range(N):
l, r = list(map(int, input().split()))
cnt += r - l + 1
print(cnt)
| false | 14.285714 | [
"-ans = 0",
"+cnt = 0",
"- ans += r - l + 1",
"-print(ans)",
"+ cnt += r - l + 1",
"+print(cnt)"
] | false | 0.035596 | 0.035806 | 0.994125 | [
"s571661677",
"s884102251"
] |
u373047809 | p03565 | python | s591493841 | s870697523 | 37 | 27 | 9,688 | 9,120 | Accepted | Accepted | 27.03 | import re
s,t=input().replace(*"?."),eval(input())
l,m,*c=len(s),len(t)
for i in range(l-m+1):
if re.match(s[i:i+m],t):c+=(s[:i]+t+s[i+m:]).replace(*".a"),
print((c and min(c)or"UNRESTORABLE")) | s,t=input(),input();l,m=len(s),len(t)
for i in range(l-m+1):
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[l-i:]))
print("UNRESTORABLE")
| 6 | 4 | 191 | 182 | import re
s, t = input().replace(*"?."), eval(input())
l, m, *c = len(s), len(t)
for i in range(l - m + 1):
if re.match(s[i : i + m], t):
c += ((s[:i] + t + s[i + m :]).replace(*".a"),)
print((c and min(c) or "UNRESTORABLE"))
| s, t = input(), input()
l, m = len(s), len(t)
for i in range(l - m + 1):
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[l - i :]))
print("UNRESTORABLE")
| false | 33.333333 | [
"-import re",
"-",
"-s, t = input().replace(*\"?.\"), eval(input())",
"-l, m, *c = len(s), len(t)",
"+s, t = input(), input()",
"+l, m = len(s), len(t)",
"- if re.match(s[i : i + m], t):",
"- c += ((s[:i] + t + s[i + m :]).replace(*\".a\"),)",
"-print((c and min(c) or \"UNRESTORABLE\"))",
... | false | 0.039301 | 0.036869 | 1.065973 | [
"s591493841",
"s870697523"
] |
u978313283 | p03164 | python | s530826250 | s806296245 | 736 | 312 | 171,656 | 14,988 | Accepted | Accepted | 57.61 | N,W=list(map(int,input().split()))
WV=[]
for i in range(N):
WV.append(list(map(int,input().split())))
dp=[[0 for i in range(10**5+1)] for j in range(N+1)]
dp[0][1:]=[10**18 for i in range(10**5)]
for i in range(N+1):
for j in range(10**5+1):
if i>0:
if j-WV[i-1][1]>=0:
... | import numpy as np
MaxW=int(1e5)
N,W=list(map(int,input().split()))
WV=[]
for i in range(N):
WV.append(list(map(int,input().split())))
dp=[1e30 for i in range(MaxW+1)]
dp[0]=0
dp=np.array(dp)
for i in range(N):
dp[WV[i][1]:]=np.minimum(dp[WV[i][1]:],dp[:MaxW-WV[i][1]+1]+WV[i][0])
for i in reversed(li... | 17 | 16 | 522 | 388 | N, W = list(map(int, input().split()))
WV = []
for i in range(N):
WV.append(list(map(int, input().split())))
dp = [[0 for i in range(10**5 + 1)] for j in range(N + 1)]
dp[0][1:] = [10**18 for i in range(10**5)]
for i in range(N + 1):
for j in range(10**5 + 1):
if i > 0:
if j - WV[i - 1][1] >... | import numpy as np
MaxW = int(1e5)
N, W = list(map(int, input().split()))
WV = []
for i in range(N):
WV.append(list(map(int, input().split())))
dp = [1e30 for i in range(MaxW + 1)]
dp[0] = 0
dp = np.array(dp)
for i in range(N):
dp[WV[i][1] :] = np.minimum(dp[WV[i][1] :], dp[: MaxW - WV[i][1] + 1] + WV[i][0])
f... | false | 5.882353 | [
"+import numpy as np",
"+",
"+MaxW = int(1e5)",
"-dp = [[0 for i in range(10**5 + 1)] for j in range(N + 1)]",
"-dp[0][1:] = [10**18 for i in range(10**5)]",
"-for i in range(N + 1):",
"- for j in range(10**5 + 1):",
"- if i > 0:",
"- if j - WV[i - 1][1] >= 0:",
"- ... | false | 0.857304 | 0.007764 | 110.42049 | [
"s530826250",
"s806296245"
] |
u493520238 | p02579 | python | s541625971 | s431098592 | 1,068 | 779 | 171,000 | 151,532 | Accepted | Accepted | 27.06 | from collections import deque
def bfs(sl, visited, sy, sx, gy, gx, h, w):
q = deque([[sy,sx]])
visited[sy][sx] = 0
qn = deque([[sy,sx]])
while q:
# print('---q')
while q:
y, x = q.popleft()
qn.append([y,x])
if [y, x] == [gy, gx]:
... | from collections import deque
def bfs(sl, visited, sy, sx, gy, gx, h, w):
q = deque([[sy,sx]])
q_warp = deque([])
# q_warp = deque([[sy,sx]])
visited[sy][sx] = 0
while q:
while q:
y, x = q.popleft()
q_warp.append([y,x])
if [y, x] == [gy, gx]:
... | 52 | 41 | 1,697 | 1,386 | from collections import deque
def bfs(sl, visited, sy, sx, gy, gx, h, w):
q = deque([[sy, sx]])
visited[sy][sx] = 0
qn = deque([[sy, sx]])
while q:
# print('---q')
while q:
y, x = q.popleft()
qn.append([y, x])
if [y, x] == [gy, gx]:
r... | from collections import deque
def bfs(sl, visited, sy, sx, gy, gx, h, w):
q = deque([[sy, sx]])
q_warp = deque([])
# q_warp = deque([[sy,sx]])
visited[sy][sx] = 0
while q:
while q:
y, x = q.popleft()
q_warp.append([y, x])
if [y, x] == [gy, gx]:
... | false | 21.153846 | [
"+ q_warp = deque([])",
"+ # q_warp = deque([[sy,sx]])",
"- qn = deque([[sy, sx]])",
"- qn.append([y, x])",
"+ q_warp.append([y, x])",
"- qn.append([ny, nx])",
"- # print(q)",
"- # print(qn)",
"- # print()",
"- ... | false | 0.129063 | 0.033528 | 3.849367 | [
"s541625971",
"s431098592"
] |
u811733736 | p00436 | python | s451649244 | s600604529 | 70 | 30 | 7,776 | 7,796 | Accepted | Accepted | 57.14 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
def main(args)... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
cards = []
de... | 38 | 39 | 819 | 831 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
def main(args):
global ca... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
cards = []
def main(args):
... | false | 2.564103 | [
"+",
"+",
"+cards = []"
] | false | 0.079006 | 0.07203 | 1.096843 | [
"s451649244",
"s600604529"
] |
u620084012 | p03599 | python | s360653226 | s702405879 | 1,930 | 166 | 12,552 | 12,528 | Accepted | Accepted | 91.4 | A,B,C,D,E,F = list(map(int,input().split()))
M = []
S = []
for a in range(1+F//100):
for b in range(1+F//100):
if 100*(a*A+b*B)<=F:
M.append(100*(a*A+b*B))
for c in range(1+F//C):
for d in range(1+F//D):
if c*C+d*D<=F:
S.append(c*C+d*D)
ans1 = 0
ans2 = 0... | A,B,C,D,E,F = list(map(int,input().split()))
M = []
S = []
for a in range(1+F//100):
for b in range(1+F//100):
if 100*(a*A+b*B)<=F:
M.append(100*(a*A+b*B))
for c in range(F//C):
for d in range(F//D):
if c*C+d*D<=F:
S.append(c*C+d*D)
M = set(M)
S = set(S)
... | 27 | 28 | 547 | 565 | A, B, C, D, E, F = list(map(int, input().split()))
M = []
S = []
for a in range(1 + F // 100):
for b in range(1 + F // 100):
if 100 * (a * A + b * B) <= F:
M.append(100 * (a * A + b * B))
for c in range(1 + F // C):
for d in range(1 + F // D):
if c * C + d * D <= F:
S.app... | A, B, C, D, E, F = list(map(int, input().split()))
M = []
S = []
for a in range(1 + F // 100):
for b in range(1 + F // 100):
if 100 * (a * A + b * B) <= F:
M.append(100 * (a * A + b * B))
for c in range(F // C):
for d in range(F // D):
if c * C + d * D <= F:
S.append(c * ... | false | 3.571429 | [
"-for c in range(1 + F // C):",
"- for d in range(1 + F // D):",
"+for c in range(F // C):",
"+ for d in range(F // D):",
"+M = set(M)",
"+S = set(S)",
"+t = -1",
"-t = -1",
"- elif m + s <= F and s <= E * m // 100 and t < (100 * s) / (s + m):",
"- t = (100 * s) / (s + m)",... | false | 0.499394 | 0.068183 | 7.324301 | [
"s360653226",
"s702405879"
] |
u620084012 | p02990 | python | s851613268 | s469256356 | 831 | 289 | 3,316 | 27,160 | Accepted | Accepted | 65.22 | import math
N, K = list(map(int,input().split()))
MOD = 10**9 + 7
def nCr(n,r):
if n <= 0 or r <= 0:
return 1
elif n-r < 0:
return 0
else:
return (math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))%MOD
for i in range(1,K+1):
ans = 1
b = K-i
ans *... | N, K = list(map(int,input().split()))
MOD = 10**9 + 7
fac = [1 for k in range(200010)]
inv = [1 for k in range(200010)]
finv = [1 for k in range(200010)]
for k in range(2,200010):
fac[k] = (fac[k-1]*k)%MOD
inv[k] = (MOD - inv[MOD%k] * (MOD // k))%MOD
finv[k] = (finv[k - 1] * inv[k]) % MOD;
def nCr(... | 18 | 17 | 374 | 486 | import math
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
def nCr(n, r):
if n <= 0 or r <= 0:
return 1
elif n - r < 0:
return 0
else:
return (math.factorial(n) // (math.factorial(r) * math.factorial(n - r))) % MOD
for i in range(1, K + 1):
ans = 1
b = K - i
... | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
fac = [1 for k in range(200010)]
inv = [1 for k in range(200010)]
finv = [1 for k in range(200010)]
for k in range(2, 200010):
fac[k] = (fac[k - 1] * k) % MOD
inv[k] = (MOD - inv[MOD % k] * (MOD // k)) % MOD
finv[k] = (finv[k - 1] * inv[k]) % MOD
def ... | false | 5.555556 | [
"-import math",
"-",
"+fac = [1 for k in range(200010)]",
"+inv = [1 for k in range(200010)]",
"+finv = [1 for k in range(200010)]",
"+for k in range(2, 200010):",
"+ fac[k] = (fac[k - 1] * k) % MOD",
"+ inv[k] = (MOD - inv[MOD % k] * (MOD // k)) % MOD",
"+ finv[k] = (finv[k - 1] * inv[k]) ... | false | 0.042129 | 0.629528 | 0.066922 | [
"s851613268",
"s469256356"
] |
u340781749 | p03395 | python | s840509996 | s227523963 | 430 | 241 | 26,624 | 15,400 | Accepted | Accepted | 43.95 | from scipy.sparse.csgraph import dijkstra
def make_graph(m, subset):
matrix = [[0] * (m + 1) for _ in range(m + 1)]
for k in subset:
for s in range(k, m + 1):
matrix[s][s % k] = 1
return dijkstra(matrix)
def solve(n, aaa, bbb):
for a, b in zip(aaa, bbb):
if a... | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
def make_graph(m):
matrix = np.zeros([m + 1, m + 1, m + 1])
for k in range(1, m + 1):
for s in range(k, m + 1):
matrix[k, s, s % k] = 1
return matrix
def is_disable(matrix, subset, aaa, bbb):
if subse... | 33 | 42 | 854 | 1,061 | from scipy.sparse.csgraph import dijkstra
def make_graph(m, subset):
matrix = [[0] * (m + 1) for _ in range(m + 1)]
for k in subset:
for s in range(k, m + 1):
matrix[s][s % k] = 1
return dijkstra(matrix)
def solve(n, aaa, bbb):
for a, b in zip(aaa, bbb):
if a < b:
... | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
def make_graph(m):
matrix = np.zeros([m + 1, m + 1, m + 1])
for k in range(1, m + 1):
for s in range(k, m + 1):
matrix[k, s, s % k] = 1
return matrix
def is_disable(matrix, subset, aaa, bbb):
if subset:
su... | false | 21.428571 | [
"-from scipy.sparse.csgraph import dijkstra",
"+from scipy.sparse.csgraph import floyd_warshall",
"+import numpy as np",
"-def make_graph(m, subset):",
"- matrix = [[0] * (m + 1) for _ in range(m + 1)]",
"- for k in subset:",
"+def make_graph(m):",
"+ matrix = np.zeros([m + 1, m + 1, m + 1])"... | false | 0.591643 | 0.796142 | 0.743137 | [
"s840509996",
"s227523963"
] |
u152283104 | p02983 | python | s323022089 | s241496180 | 592 | 428 | 75,432 | 3,064 | Accepted | Accepted | 27.7 | L, R = list(map(int, (input().split())))
Lmod, Rmod = L%2019, R%2019
if Lmod < Rmod and (R - L >= 2019):
print((0))
elif Lmod < Rmod and (R - L < 2019):
ch_list =[]
for i in range(L,R,1):
for j in range(i+1, R+1, 1):
ch_list.append((i*j)%2019)
print((min(ch_list)))
elif Lmo... | L, R = list(map(int, (input().split())))
Lmod, Rmod = L%2019, R%2019
result = 2019
if Lmod < Rmod and (R - L >= 2019):
print((0))
elif Lmod < Rmod and (R - L < 2019):
for i in range(L,R,1):
for j in range(i+1, R+1, 1):
if result > (i*j)%2019:
result = (i*j)%2019
... | 12 | 13 | 333 | 359 | L, R = list(map(int, (input().split())))
Lmod, Rmod = L % 2019, R % 2019
if Lmod < Rmod and (R - L >= 2019):
print((0))
elif Lmod < Rmod and (R - L < 2019):
ch_list = []
for i in range(L, R, 1):
for j in range(i + 1, R + 1, 1):
ch_list.append((i * j) % 2019)
print((min(ch_list)))
eli... | L, R = list(map(int, (input().split())))
Lmod, Rmod = L % 2019, R % 2019
result = 2019
if Lmod < Rmod and (R - L >= 2019):
print((0))
elif Lmod < Rmod and (R - L < 2019):
for i in range(L, R, 1):
for j in range(i + 1, R + 1, 1):
if result > (i * j) % 2019:
result = (i * j) % ... | false | 7.692308 | [
"+result = 2019",
"- ch_list = []",
"- ch_list.append((i * j) % 2019)",
"- print((min(ch_list)))",
"+ if result > (i * j) % 2019:",
"+ result = (i * j) % 2019",
"+ print(result)"
] | false | 0.116541 | 0.114245 | 1.020091 | [
"s323022089",
"s241496180"
] |
u573754721 | p02958 | python | s119271483 | s817150075 | 179 | 18 | 38,384 | 3,060 | Accepted | Accepted | 89.94 | N = int(eval(input()))
lis_p = list(map(int, input().split()))
lis_ans = sorted(lis_p)
count = 0
for i in range(N):
if lis_p[i] != lis_ans[i]:
count += 1
if count == 2 or count == 0:
print("YES")
else:
print("NO") | n=int(eval(input()))
p=list(map(int,input().split()))
g=sum((1 for i in range(n) if i+1 !=p[i]))
print(("YNEOS"[::2] if g==2 or g==0 else "YNEOS"[1::2])) | 14 | 4 | 243 | 148 | N = int(eval(input()))
lis_p = list(map(int, input().split()))
lis_ans = sorted(lis_p)
count = 0
for i in range(N):
if lis_p[i] != lis_ans[i]:
count += 1
if count == 2 or count == 0:
print("YES")
else:
print("NO")
| n = int(eval(input()))
p = list(map(int, input().split()))
g = sum((1 for i in range(n) if i + 1 != p[i]))
print(("YNEOS"[::2] if g == 2 or g == 0 else "YNEOS"[1::2]))
| false | 71.428571 | [
"-N = int(eval(input()))",
"-lis_p = list(map(int, input().split()))",
"-lis_ans = sorted(lis_p)",
"-count = 0",
"-for i in range(N):",
"- if lis_p[i] != lis_ans[i]:",
"- count += 1",
"-if count == 2 or count == 0:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+n = int(ev... | false | 0.041682 | 0.066241 | 0.629253 | [
"s119271483",
"s817150075"
] |
u284854859 | p04049 | python | s377776494 | s144673676 | 1,421 | 1,165 | 126,680 | 124,380 | Accepted | Accepted | 18.02 | import sys
#input = sys.stdin.readline
n,k = list(map(int,input().split()))
edge = [[] for i in range(n)]
alledge = []
for i in range(n-1):
a,b = list(map(int,input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
alledge.append((a-1,b-1))
def f(x,y,c):
global tmp
c += 1
... | import sys
input = sys.stdin.readline
n,k = list(map(int,input().split()))
edge = [[] for i in range(n)]
alledge = []
for i in range(n-1):
a,b = list(map(int,input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
alledge.append((a-1,b-1))
def f(x,y,c):
global tmp
c += 1
... | 40 | 40 | 792 | 791 | import sys
# input = sys.stdin.readline
n, k = list(map(int, input().split()))
edge = [[] for i in range(n)]
alledge = []
for i in range(n - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
alledge.append((a - 1, b - 1))
def f(x, y, c):
global tmp
... | import sys
input = sys.stdin.readline
n, k = list(map(int, input().split()))
edge = [[] for i in range(n)]
alledge = []
for i in range(n - 1):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
alledge.append((a - 1, b - 1))
def f(x, y, c):
global tmp
c... | false | 0 | [
"-# input = sys.stdin.readline",
"+input = sys.stdin.readline"
] | false | 0.084821 | 0.177257 | 0.478519 | [
"s377776494",
"s144673676"
] |
u028973125 | p02806 | python | s540024591 | s408659426 | 178 | 24 | 38,384 | 9,168 | Accepted | Accepted | 86.52 | import sys
from pprint import pprint
def solve(n, s, t, x):
ans = 0
slept = False
for i in range(n):
if slept:
ans += t[i]
if s[i] == x:
slept = True
print(ans)
if __name__ == '__main__':
n = int(sys.stdin.readline().strip())
s = [""] * n
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
musics = []
for _ in range(N):
s, t = input().split()
musics.append((s.strip(), int(t)))
X = input().strip()
ans = 0
flag = False
for s, t in musics:
if flag:
ans += t
if s == X:
flag = True
print(ans) | 22 | 19 | 507 | 309 | import sys
from pprint import pprint
def solve(n, s, t, x):
ans = 0
slept = False
for i in range(n):
if slept:
ans += t[i]
if s[i] == x:
slept = True
print(ans)
if __name__ == "__main__":
n = int(sys.stdin.readline().strip())
s = [""] * n
t = [0] *... | import sys
input = sys.stdin.readline
N = int(eval(input()))
musics = []
for _ in range(N):
s, t = input().split()
musics.append((s.strip(), int(t)))
X = input().strip()
ans = 0
flag = False
for s, t in musics:
if flag:
ans += t
if s == X:
flag = True
print(ans)
| false | 13.636364 | [
"-from pprint import pprint",
"-",
"-def solve(n, s, t, x):",
"- ans = 0",
"- slept = False",
"- for i in range(n):",
"- if slept:",
"- ans += t[i]",
"- if s[i] == x:",
"- slept = True",
"- print(ans)",
"-",
"-",
"-if __name__ == \"__main__\"... | false | 0.051059 | 0.036183 | 1.411151 | [
"s540024591",
"s408659426"
] |
u585482323 | p02924 | python | s576484172 | s984939076 | 203 | 183 | 38,384 | 38,384 | Accepted | Accepted | 9.85 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 35 | 35 | 841 | 855 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
r... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 0 | [
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())"
] | false | 0.092656 | 0.039336 | 2.355472 | [
"s576484172",
"s984939076"
] |
u935558307 | p03452 | python | s385437420 | s023553215 | 932 | 857 | 89,376 | 88,224 | Accepted | Accepted | 8.05 | """
unionFind木を使う。
根に対する距離を記録していく。
"""
import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind():
def __init__(self,n):
self.n=n
self.parents = [i for i in range(n+1)]
self.distance = [0]*(n+1)
def find(self,x):
if self.parents[x]==x:
... | import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind():
def __init__(self,n):
self.n=n
self.parents = [i for i in range(n+1)]
#dist[x]はxとその親との間の距離を保持している
self.dist = [0]*(n+1)
def find(self,x):
if self.parents[x]==x:
... | 48 | 40 | 1,296 | 1,241 | """
unionFind木を使う。
根に対する距離を記録していく。
"""
import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [i for i in range(n + 1)]
self.distance = [0] * (n + 1)
def find(self, x):
if self.parents[x] == x:
... | import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [i for i in range(n + 1)]
# dist[x]はxとその親との間の距離を保持している
self.dist = [0] * (n + 1)
def find(self, x):
if self.parents[x] == x:
... | false | 16.666667 | [
"-\"\"\"",
"-unionFind木を使う。",
"-根に対する距離を記録していく。",
"-\"\"\"",
"- self.distance = [0] * (n + 1)",
"+ # dist[x]はxとその親との間の距離を保持している",
"+ self.dist = [0] * (n + 1)",
"- return x, 0",
"+ return x",
"- self.parents[x], dist2 = self.find(self.parents[x... | false | 0.125961 | 0.037297 | 3.377276 | [
"s385437420",
"s023553215"
] |
u623819879 | p02745 | python | s213327674 | s736298773 | 756 | 515 | 51,308 | 51,804 | Accepted | Accepted | 31.88 | from itertools import permutations
def chk(a,b):
A,B=len(a),len(b)
rt=[0]*A
for i in range(A):
f=1
for j in range(min(A-i,B)):
if a[i+j]!=b[j] and a[i+j]!='?' and b[j]!='?':
f=0;break
rt[i]=f
return rt+[1]
def tri_chk(ix):
i1,i2,i3=ix... | from itertools import permutations
def chk(a,b):
A,B=len(a),len(b)
rt=[0]*A
for i in range(A):
f=1
for j in range(min(A-i,B)):
if a[i+j]!=b[j] and a[i+j]!='?' and b[j]!='?':
f=0;break
rt[i]=f
return rt+[1]
def tri_chk(ix):
i1,i2,i3=... | 35 | 38 | 899 | 908 | from itertools import permutations
def chk(a, b):
A, B = len(a), len(b)
rt = [0] * A
for i in range(A):
f = 1
for j in range(min(A - i, B)):
if a[i + j] != b[j] and a[i + j] != "?" and b[j] != "?":
f = 0
break
rt[i] = f
return rt + [1... | from itertools import permutations
def chk(a, b):
A, B = len(a), len(b)
rt = [0] * A
for i in range(A):
f = 1
for j in range(min(A - i, B)):
if a[i + j] != b[j] and a[i + j] != "?" and b[j] != "?":
f = 0
break
rt[i] = f
return rt + [1... | false | 7.894737 | [
"+ if ab[l] == 0:",
"+ continue",
"- if ab[l] == 1 and (B < r - l or bc[r - l] == 1) and ac[min(A, r)] == 1:",
"+ if (B < r - l or bc[r - l] == 1) and ac[min(A, r)] == 1:"
] | false | 0.036797 | 0.034481 | 1.067178 | [
"s213327674",
"s736298773"
] |
u679520304 | p02900 | python | s374385739 | s982102568 | 305 | 131 | 65,640 | 77,824 | Accepted | Accepted | 57.05 | import fractions
import collections
A,B = list(map(int,input().split()))
p = fractions.gcd(A,B)
#print(p)
num = []
for i in range(2,int(p**0.5)+1):
while p%i==0:
num.append(i)
p //= i
if p != 1:
num.append(p)
#print(num)
pp = collections.Counter(num)
print((len(pp)+1)) | A,B = list(map(int,input().split()))
from fractions import gcd
C = gcd(A,B)
num = []
for i in range(2,int(C**0.5)+1):
while C%i==0:
num.append(i)
C //= i
if C != 1:
num.append(C)
from collections import Counter
CC = Counter(num)
print((len(CC)+1)) | 15 | 13 | 299 | 275 | import fractions
import collections
A, B = list(map(int, input().split()))
p = fractions.gcd(A, B)
# print(p)
num = []
for i in range(2, int(p**0.5) + 1):
while p % i == 0:
num.append(i)
p //= i
if p != 1:
num.append(p)
# print(num)
pp = collections.Counter(num)
print((len(pp) + 1))
| A, B = list(map(int, input().split()))
from fractions import gcd
C = gcd(A, B)
num = []
for i in range(2, int(C**0.5) + 1):
while C % i == 0:
num.append(i)
C //= i
if C != 1:
num.append(C)
from collections import Counter
CC = Counter(num)
print((len(CC) + 1))
| false | 13.333333 | [
"-import fractions",
"-import collections",
"+A, B = list(map(int, input().split()))",
"+from fractions import gcd",
"-A, B = list(map(int, input().split()))",
"-p = fractions.gcd(A, B)",
"-# print(p)",
"+C = gcd(A, B)",
"-for i in range(2, int(p**0.5) + 1):",
"- while p % i == 0:",
"+for i i... | false | 0.047159 | 0.046361 | 1.017218 | [
"s374385739",
"s982102568"
] |
u627600101 | p02598 | python | s519146553 | s610471301 | 664 | 399 | 64,408 | 58,064 | Accepted | Accepted | 39.91 | import math
from collections import deque
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int64)
S = np.sum(A)
cut = K*A//S
length = []
for k in range(N):
length.append([A[k] / (cut[k]+1), k])
length.sort(key = lambda x: x[0], reverse=True)
def nibun_i... | import math
from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
S = sum(A)
cut = []
for k in range(N):
cut.append(K*A[k]//S)
length = []
for k in range(N):
length.append([A[k] / (cut[k]+1), k])
length.sort(key = lambda x: x[0], reverse=True)
def... | 45 | 46 | 982 | 987 | import math
from collections import deque
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int64)
S = np.sum(A)
cut = K * A // S
length = []
for k in range(N):
length.append([A[k] / (cut[k] + 1), k])
length.sort(key=lambda x: x[0], reverse=True)
def nibun_insert(li... | import math
from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
S = sum(A)
cut = []
for k in range(N):
cut.append(K * A[k] // S)
length = []
for k in range(N):
length.append([A[k] / (cut[k] + 1), k])
length.sort(key=lambda x: x[0], reverse=True)
def nibun_... | false | 2.173913 | [
"-import numpy as np",
"-A = np.array(input().split(), dtype=np.int64)",
"-S = np.sum(A)",
"-cut = K * A // S",
"+A = list(map(int, input().split()))",
"+S = sum(A)",
"+cut = []",
"+for k in range(N):",
"+ cut.append(K * A[k] // S)",
"-C = np.sum(cut)",
"+C = sum(cut)"
] | false | 0.630617 | 0.096522 | 6.533397 | [
"s519146553",
"s610471301"
] |
u107639613 | p04045 | python | s714478346 | s489115036 | 83 | 67 | 73,480 | 73,252 | Accepted | Accepted | 19.28 | import sys
from bisect import bisect_left
def input(): return sys.stdin.readline().strip()
def main():
N, K = list(map(int, input().split()))
D = set(map(int, input().split()))
while True:
check = True
for c in str(N):
if int(c) in D:
check = False
... | import sys
from itertools import product
def input(): return sys.stdin.readline().strip()
def main():
"""
itertools.productを使うと高速なようなので写経
参考:https://atcoder.jp/contests/abc042/submissions/16188969
"""
N, K = list(map(int, input().split()))
D = set(map(int, input().split()))
ok = ... | 20 | 29 | 432 | 737 | import sys
from bisect import bisect_left
def input():
return sys.stdin.readline().strip()
def main():
N, K = list(map(int, input().split()))
D = set(map(int, input().split()))
while True:
check = True
for c in str(N):
if int(c) in D:
check = False
... | import sys
from itertools import product
def input():
return sys.stdin.readline().strip()
def main():
"""
itertools.productを使うと高速なようなので写経
参考:https://atcoder.jp/contests/abc042/submissions/16188969
"""
N, K = list(map(int, input().split()))
D = set(map(int, input().split()))
ok = [i f... | false | 31.034483 | [
"-from bisect import bisect_left",
"+from itertools import product",
"+ \"\"\"",
"+ itertools.productを使うと高速なようなので写経",
"+ 参考:https://atcoder.jp/contests/abc042/submissions/16188969",
"+ \"\"\"",
"- while True:",
"- check = True",
"- for c in str(N):",
"- if i... | false | 0.132379 | 0.049667 | 2.6653 | [
"s714478346",
"s489115036"
] |
u803848678 | p03164 | python | s499632746 | s542664623 | 1,574 | 317 | 14,216 | 14,820 | Accepted | Accepted | 79.86 | n, ww = list(map(int, input().split()))
wv = [list(map(int, input().split())) for i in range(n)]
wv.sort(key=lambda x:x[1])
dp = {0:0}
for w, v in wv:
dp_next = dp.copy()
for key in dp:
dp_next[key+v] = min(dp[key]+ w, dp.get(key+v, float("inf")))
dp = dp_next
for key in sorted(list(dp.ke... | import numpy as np
n, ww = list(map(int, input().split()))
wv = [list(map(int, input().split())) for i in range(n)]
dp = np.full(n*10**3+1, np.inf)
dp[0] = 0
for w, v in wv:
dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
for i in range(n*10**3+1)[::-1]:
if dp[i] <= ww:
print(i)
exit(... | 14 | 16 | 388 | 315 | n, ww = list(map(int, input().split()))
wv = [list(map(int, input().split())) for i in range(n)]
wv.sort(key=lambda x: x[1])
dp = {0: 0}
for w, v in wv:
dp_next = dp.copy()
for key in dp:
dp_next[key + v] = min(dp[key] + w, dp.get(key + v, float("inf")))
dp = dp_next
for key in sorted(list(dp.keys()... | import numpy as np
n, ww = list(map(int, input().split()))
wv = [list(map(int, input().split())) for i in range(n)]
dp = np.full(n * 10**3 + 1, np.inf)
dp[0] = 0
for w, v in wv:
dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
for i in range(n * 10**3 + 1)[::-1]:
if dp[i] <= ww:
print(i)
exit()
| false | 12.5 | [
"+import numpy as np",
"+",
"-wv.sort(key=lambda x: x[1])",
"-dp = {0: 0}",
"+dp = np.full(n * 10**3 + 1, np.inf)",
"+dp[0] = 0",
"- dp_next = dp.copy()",
"- for key in dp:",
"- dp_next[key + v] = min(dp[key] + w, dp.get(key + v, float(\"inf\")))",
"- dp = dp_next",
"-for key in ... | false | 0.037284 | 0.372031 | 0.100218 | [
"s499632746",
"s542664623"
] |
u832039789 | p02999 | python | s690961787 | s913041931 | 38 | 18 | 5,368 | 2,940 | Accepted | Accepted | 52.63 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print('Yes')
... | x,a = list(map(int,input().split()))
if x < a:
print((0))
elif x >= a:
print((10))
| 24 | 5 | 507 | 85 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print("Yes")
else:... | x, a = list(map(int, input().split()))
if x < a:
print((0))
elif x >= a:
print((10))
| false | 79.166667 | [
"-import sys",
"-from fractions import gcd",
"-from itertools import groupby as gb",
"-from itertools import permutations as perm",
"-from itertools import combinations as comb",
"-from collections import Counter as C",
"-from collections import defaultdict as dd",
"-",
"-sys.setrecursionlimit(10**5... | false | 0.034909 | 0.04024 | 0.867513 | [
"s690961787",
"s913041931"
] |
u991134049 | p02694 | python | s546506289 | s970746845 | 61 | 55 | 63,832 | 63,592 | Accepted | Accepted | 9.84 | X = int(eval(input()))
y = 100
flag = 1
con = 0
while flag:
y *= 1.01
y = int(y)
con += 1
if y >= X:
flag = 0
print(con)
| X = int(eval(input()))
money = 100
ans = 0
while money < X:
ans += 1
money = int(money*1.01)
print(ans) | 12 | 7 | 140 | 107 | X = int(eval(input()))
y = 100
flag = 1
con = 0
while flag:
y *= 1.01
y = int(y)
con += 1
if y >= X:
flag = 0
print(con)
| X = int(eval(input()))
money = 100
ans = 0
while money < X:
ans += 1
money = int(money * 1.01)
print(ans)
| false | 41.666667 | [
"-y = 100",
"-flag = 1",
"-con = 0",
"-while flag:",
"- y *= 1.01",
"- y = int(y)",
"- con += 1",
"- if y >= X:",
"- flag = 0",
"-print(con)",
"+money = 100",
"+ans = 0",
"+while money < X:",
"+ ans += 1",
"+ money = int(money * 1.01)",
"+print(ans)"
] | false | 0.048201 | 0.046965 | 1.026313 | [
"s546506289",
"s970746845"
] |
u971091945 | p02819 | python | s218664189 | s653819308 | 147 | 18 | 2,940 | 3,064 | Accepted | Accepted | 87.76 | x = int(eval(input()))
num = 0
for i in range(x,x*2):
for j in range(2,x//2):
if i%j == 0:
num += 1
continue
if num == 0:
print(i)
exit(0)
num = 0 | import math
x = int(eval(input()))
for i in range(x, x * 2):
flag = True
for j in range(2, math.floor(math.sqrt(x))+1):
if i % j == 0:
flag = False
break
if flag:
print(i)
exit(0) | 12 | 11 | 212 | 243 | x = int(eval(input()))
num = 0
for i in range(x, x * 2):
for j in range(2, x // 2):
if i % j == 0:
num += 1
continue
if num == 0:
print(i)
exit(0)
num = 0
| import math
x = int(eval(input()))
for i in range(x, x * 2):
flag = True
for j in range(2, math.floor(math.sqrt(x)) + 1):
if i % j == 0:
flag = False
break
if flag:
print(i)
exit(0)
| false | 8.333333 | [
"+import math",
"+",
"-num = 0",
"- for j in range(2, x // 2):",
"+ flag = True",
"+ for j in range(2, math.floor(math.sqrt(x)) + 1):",
"- num += 1",
"- continue",
"- if num == 0:",
"+ flag = False",
"+ break",
"+ if flag:",
"- nu... | false | 0.076146 | 0.036998 | 2.058084 | [
"s218664189",
"s653819308"
] |
u576335153 | p02616 | python | s712326737 | s666600517 | 194 | 156 | 31,720 | 30,776 | Accepted | Accepted | 19.59 | MOD = 10 ** 9 + 7
ans = 1
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == k:
for x in a:
ans *= x
ans %= MOD
print((ans % MOD))
exit()
pos = []
neg = []
for x in a:
if x >= 0:
pos.append(x)
else:
neg.append(x)... | MOD = 10 ** 9 + 7
ans = 1
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == k:
for x in a:
ans *= x
ans %= MOD
print((ans % MOD))
exit()
pos = []
neg = []
for x in a:
if x >= 0:
pos.append(x)
else:
neg.append(x)... | 61 | 52 | 925 | 793 | MOD = 10**9 + 7
ans = 1
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == k:
for x in a:
ans *= x
ans %= MOD
print((ans % MOD))
exit()
pos = []
neg = []
for x in a:
if x >= 0:
pos.append(x)
else:
neg.append(x)
pos.sort(reverse=True)
ne... | MOD = 10**9 + 7
ans = 1
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == k:
for x in a:
ans *= x
ans %= MOD
print((ans % MOD))
exit()
pos = []
neg = []
for x in a:
if x >= 0:
pos.append(x)
else:
neg.append(x)
pos.sort(reverse=True)
ne... | false | 14.754098 | [
"-pi = 0",
"-ni = 0",
"- ans *= pos[pi]",
"- pi += 1",
"+ ans *= pos.pop(0)",
"-while k > 0:",
"- if pi < len(pos) - 1:",
"- sp = pos[pi] * pos[pi + 1]",
"- else:",
"- sp = 0",
"- if ni < len(neg) - 1:",
"- sn = neg[ni] * neg[ni + 1]",
"- else:",
"... | false | 0.034376 | 0.03888 | 0.884158 | [
"s712326737",
"s666600517"
] |
u997521090 | p03209 | python | s937351331 | s938010171 | 13 | 11 | 2,936 | 2,568 | Accepted | Accepted | 15.38 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(1000000)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def func(lv, id):
sz = 4 * 2 ** lv - 3
num = 2 * 2 ** lv - 1
mid = (sz + 1) / 2
if lv == 0:
return 1
if id =... | def func(lv, id):
sz = 4 * 2 ** lv - 3
num = 2 * 2 ** lv - 1
mid = (sz + 1) / 2
if lv == 0:
return 1
if id == 1:
return 0
if id == mid:
return (num - 1) / 2 + 1
if id == sz:
return num
if 1 < id < mid:
return func(lv - 1, id - 1)
... | 30 | 18 | 634 | 456 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(1000000)
INF = 10**18
MOD = 10**9 + 7
def func(lv, id):
sz = 4 * 2**lv - 3
num = 2 * 2**lv - 1
mid = (sz + 1) / 2
if lv == 0:
return 1
if id == 1:
return 0
i... | def func(lv, id):
sz = 4 * 2**lv - 3
num = 2 * 2**lv - 1
mid = (sz + 1) / 2
if lv == 0:
return 1
if id == 1:
return 0
if id == mid:
return (num - 1) / 2 + 1
if id == sz:
return num
if 1 < id < mid:
return func(lv - 1, id - 1)
if mid < id < sz:
... | false | 40 | [
"-#!/usr/bin/env python",
"-from collections import deque",
"-import itertools as it",
"-import sys",
"-import math",
"-",
"-sys.setrecursionlimit(1000000)",
"-INF = 10**18",
"-MOD = 10**9 + 7",
"-",
"-"
] | false | 0.032624 | 0.03745 | 0.871137 | [
"s937351331",
"s938010171"
] |
u837673618 | p02746 | python | s990725450 | s475624479 | 726 | 514 | 3,316 | 3,316 | Accepted | Accepted | 29.2 | def solve(a, b, c, d):
for k in range(29, -1, -1):
block_size = 3**k
box_size = block_size * 3
x1, y1, x2, y2 = [x//block_size for x in (a, b, c, d)]
x1, x2 = sorted([x1, x2])
y1, y2 = sorted([y1, y2])
if x1!=x2 and y1!=y2:
return abs(a-c)+abs(b-d)
if x1==x2 and x1%3==1 and ... | def solve(a, b, c, d):
a, c = sorted([a, c])
b, d = sorted([b, d])
for k in range(30, 0, -1):
block_size = 3**k
box_size = block_size // 3
x1, y1, x2, y2 = [x//box_size for x in (a, b, c, d)]
if x1 != x2 and y1 != y2:
return c-a + d-b
elif x1 == x2 and x1%3 == 1 and (y1+1)//3*3+... | 19 | 19 | 736 | 712 | def solve(a, b, c, d):
for k in range(29, -1, -1):
block_size = 3**k
box_size = block_size * 3
x1, y1, x2, y2 = [x // block_size for x in (a, b, c, d)]
x1, x2 = sorted([x1, x2])
y1, y2 = sorted([y1, y2])
if x1 != x2 and y1 != y2:
return abs(a - c) + abs(b ... | def solve(a, b, c, d):
a, c = sorted([a, c])
b, d = sorted([b, d])
for k in range(30, 0, -1):
block_size = 3**k
box_size = block_size // 3
x1, y1, x2, y2 = [x // box_size for x in (a, b, c, d)]
if x1 != x2 and y1 != y2:
return c - a + d - b
elif x1 == x2 a... | false | 0 | [
"- for k in range(29, -1, -1):",
"+ a, c = sorted([a, c])",
"+ b, d = sorted([b, d])",
"+ for k in range(30, 0, -1):",
"- box_size = block_size * 3",
"- x1, y1, x2, y2 = [x // block_size for x in (a, b, c, d)]",
"- x1, x2 = sorted([x1, x2])",
"- y1, y2 = sorted(... | false | 0.037701 | 0.038433 | 0.980944 | [
"s990725450",
"s475624479"
] |
u294485299 | p02684 | python | s059741224 | s958452329 | 181 | 154 | 102,980 | 125,800 | Accepted | Accepted | 14.92 | import math
def fact(n):
ans = 1
for i in range(2, n+1):
ans*= i
return ans
def comb(n, c):
return fact(n)//(fact(n-c)*c)
'''
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt= 0
i = 1
cycle = ['1']
for c in range(n):
i = a[i-1]
if(i in cycle):
... | import math
def fact(n):
ans = 1
for i in range(2, n+1):
ans*= i
return ans
def comb(n, c):
return fact(n)//(fact(n-c)*c)
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt= 0
i = 1
cycle = ['1']
set = {'1'}
for c in range(n):
i = a[i-1]
if(i ... | 55 | 30 | 955 | 548 | import math
def fact(n):
ans = 1
for i in range(2, n + 1):
ans *= i
return ans
def comb(n, c):
return fact(n) // (fact(n - c) * c)
"""
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt= 0
i = 1
cycle = ['1']
for c in range(n):
i = a[i-1]
if(i in cycle):
... | import math
def fact(n):
ans = 1
for i in range(2, n + 1):
ans *= i
return ans
def comb(n, c):
return fact(n) // (fact(n - c) * c)
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 0
i = 1
cycle = ["1"]
set = {"1"}
for c in range(n):
i = a[i - 1]
if i... | false | 45.454545 | [
"-\"\"\"",
"-n, k = map(int, input().split())",
"+n, k = list(map(int, input().split()))",
"-cnt= 0",
"+cnt = 0",
"-cycle = ['1']",
"+cycle = [\"1\"]",
"+set = {\"1\"}",
"- i = a[i-1]",
"- if(i in cycle):",
"+ i = a[i - 1]",
"+ if i in set:",
"+ set.add(i)",
"-k-= ind",... | false | 0.041414 | 0.039889 | 1.038228 | [
"s059741224",
"s958452329"
] |
u968404618 | p03476 | python | s272812932 | s261577639 | 688 | 453 | 21,120 | 22,036 | Accepted | Accepted | 34.16 | import math
from itertools import accumulate
def is_prime(n):
if n == 1: return False
for k in range(2, int(math.sqrt(n))+1):
if n % k == 0: return False
return True
MAX = (10**5)+1
q = int(eval(input()))
A = [1 if is_prime(i)and is_prime((i + 1)//2) else 0 for i in range(MAX) ]
S = [0] + list(a... | from itertools import accumulate
def primes(n):
prime = ([False]*2) + ([True]*(n-2))
for i in range(2, n):
if prime[i]:
for j in range(i*2, n, i):
prime[j] = False
return prime
MAX = (10**5)+1
is_prime = primes(MAX)
q = int(eval(input()))
A = [1 if is_prime[i] and is_prime[(i + 1)... | 22 | 24 | 487 | 536 | import math
from itertools import accumulate
def is_prime(n):
if n == 1:
return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
MAX = (10**5) + 1
q = int(eval(input()))
A = [1 if is_prime(i) and is_prime((i + 1) // 2) else 0 for i in ra... | from itertools import accumulate
def primes(n):
prime = ([False] * 2) + ([True] * (n - 2))
for i in range(2, n):
if prime[i]:
for j in range(i * 2, n, i):
prime[j] = False
return prime
MAX = (10**5) + 1
is_prime = primes(MAX)
q = int(eval(input()))
A = [1 if is_prime[... | false | 8.333333 | [
"-import math",
"-def is_prime(n):",
"- if n == 1:",
"- return False",
"- for k in range(2, int(math.sqrt(n)) + 1):",
"- if n % k == 0:",
"- return False",
"- return True",
"+def primes(n):",
"+ prime = ([False] * 2) + ([True] * (n - 2))",
"+ for i in rang... | false | 0.48553 | 0.100211 | 4.845068 | [
"s272812932",
"s261577639"
] |
u306773664 | p02898 | python | s870038066 | s836133110 | 177 | 47 | 20,896 | 11,908 | Accepted | Accepted | 73.45 | import numpy as np
N , K = list(map(int,input().split()))
h = list(map(int,input().split()))
print((sum(x >= K for x in h))) | N , K = list(map(int,input().split()))
h = list(map(int,input().split()))
print((sum(x >= K for x in h))) | 4 | 3 | 119 | 99 | import numpy as np
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
print((sum(x >= K for x in h)))
| N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
print((sum(x >= K for x in h)))
| false | 25 | [
"-import numpy as np",
"-"
] | false | 0.040744 | 0.035911 | 1.134579 | [
"s870038066",
"s836133110"
] |
u314050667 | p02781 | python | s800113847 | s732591133 | 149 | 18 | 12,484 | 3,064 | Accepted | Accepted | 87.92 | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(eval(input()))
K = int(eval(input()))
if int('1' * K) > N:
print((0))
sys.exit()
N = str(N)
L = len(N)
def C(a,b):
out = 1
for _ in range(b):
out *=... | N = list(map(int, eval(input())))
K = int(eval(input()))
DP_conf = [[0] * (K+1) for _ in range(len(N))]
DP_unco = [[0] * (K+1) for _ in range(len(N))]
DP_conf[0][0] = 1
DP_conf[0][1] = N[0] - 1
DP_unco[0][0] = 0
DP_unco[0][1] = 1
for i in range(1,len(N)):
for j in range(K+1):
if j > i+1:
break
... | 63 | 30 | 942 | 660 | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(eval(input()))
K = int(eval(input()))
if int("1" * K) > N:
print((0))
sys.exit()
N = str(N)
L = len(N)
def C(a, b):
out = 1
for _ in range(b):
out *= ... | N = list(map(int, eval(input())))
K = int(eval(input()))
DP_conf = [[0] * (K + 1) for _ in range(len(N))]
DP_unco = [[0] * (K + 1) for _ in range(len(N))]
DP_conf[0][0] = 1
DP_conf[0][1] = N[0] - 1
DP_unco[0][0] = 0
DP_unco[0][1] = 1
for i in range(1, len(N)):
for j in range(K + 1):
if j > i + 1:
... | false | 52.380952 | [
"-import numpy as np",
"-import sys",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-N = int(eval(input()))",
"+N = list(map(int, eval(input())))",
"-if int(\"1\" * K) > N:",
"- print((0))",
"- sys.exit()",
"-N ... | false | 0.043471 | 0.037327 | 1.164606 | [
"s800113847",
"s732591133"
] |
u695811449 | p02956 | python | s075566723 | s909329172 | 1,782 | 1,470 | 125,796 | 126,848 | Accepted | Accepted | 17.51 | import sys
input = sys.stdin.readline
N=int(eval(input()))
POINT=[list(map(int,input().split())) for i in range(N)]
mod=998244353
PX=[p[0] for p in POINT]
PY=[p[1] for p in POINT]
compression_dict_x={a: ind for ind, a in enumerate(sorted(set(PX)))}
compression_dict_y={a: ind for ind, a in enumerate(sorted... | import sys
input = sys.stdin.readline
N=int(eval(input()))
POINT=[list(map(int,input().split())) for i in range(N)]
mod=998244353
compression_dict_x={a: ind for ind, a in enumerate(sorted(set([p[0] for p in POINT])))}
POINT=[[compression_dict_x[x]+1,y] for x,y in POINT]
P_Y=sorted(POINT,key=lambda x:x[1])
... | 66 | 47 | 1,273 | 1,024 | import sys
input = sys.stdin.readline
N = int(eval(input()))
POINT = [list(map(int, input().split())) for i in range(N)]
mod = 998244353
PX = [p[0] for p in POINT]
PY = [p[1] for p in POINT]
compression_dict_x = {a: ind for ind, a in enumerate(sorted(set(PX)))}
compression_dict_y = {a: ind for ind, a in enumerate(sort... | import sys
input = sys.stdin.readline
N = int(eval(input()))
POINT = [list(map(int, input().split())) for i in range(N)]
mod = 998244353
compression_dict_x = {
a: ind for ind, a in enumerate(sorted(set([p[0] for p in POINT])))
}
POINT = [[compression_dict_x[x] + 1, y] for x, y in POINT]
P_Y = sorted(POINT, key=lam... | false | 28.787879 | [
"-PX = [p[0] for p in POINT]",
"-PY = [p[1] for p in POINT]",
"-compression_dict_x = {a: ind for ind, a in enumerate(sorted(set(PX)))}",
"-compression_dict_y = {a: ind for ind, a in enumerate(sorted(set(PY)))}",
"-for i in range(N):",
"- POINT[i] = [",
"- compression_dict_x[POINT[i][0]] + 1,",... | false | 0.063466 | 0.051213 | 1.239251 | [
"s075566723",
"s909329172"
] |
u141610915 | p02724 | python | s113751692 | s697721661 | 176 | 62 | 38,256 | 61,924 | Accepted | Accepted | 64.77 | import sys
input = sys.stdin.readline
X = int(eval(input()))
print((X // 500 * 1000 + (X % 500) // 5 * 5)) | import sys
input = sys.stdin.readline
X = int(eval(input()))
res = X // 500 * 1000
print((res + (X % 500) // 5 * 5)) | 4 | 5 | 101 | 112 | import sys
input = sys.stdin.readline
X = int(eval(input()))
print((X // 500 * 1000 + (X % 500) // 5 * 5))
| import sys
input = sys.stdin.readline
X = int(eval(input()))
res = X // 500 * 1000
print((res + (X % 500) // 5 * 5))
| false | 20 | [
"-print((X // 500 * 1000 + (X % 500) // 5 * 5))",
"+res = X // 500 * 1000",
"+print((res + (X % 500) // 5 * 5))"
] | false | 0.057483 | 0.035202 | 1.632953 | [
"s113751692",
"s697721661"
] |
u753803401 | p03147 | python | s275083764 | s511954355 | 210 | 168 | 40,944 | 38,384 | Accepted | Accepted | 20 | n = int(eval(input()))
h = list(map(int, input().split()))
h.insert(0, 0)
h.append(0)
cnt = 0
while True:
s = -1
e = -1
m_n = 10 ** 10
for i in range(1, n + 2):
if h[i] != 0 and h[i-1] == 0:
s = i
m_n = min(m_n, h[i])
for j in range(i + 1, n + 2):... | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
h = list(map(int, input().rstrip('\n').split()))
l = 0
cnt = 0
for i in range(n):
if l < h[i]:
cnt += h[i] - l
l = h[i]
print(cnt)
if __name__ == '__main__':
... | 27 | 16 | 645 | 328 | n = int(eval(input()))
h = list(map(int, input().split()))
h.insert(0, 0)
h.append(0)
cnt = 0
while True:
s = -1
e = -1
m_n = 10**10
for i in range(1, n + 2):
if h[i] != 0 and h[i - 1] == 0:
s = i
m_n = min(m_n, h[i])
for j in range(i + 1, n + 2):
... | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
h = list(map(int, input().rstrip("\n").split()))
l = 0
cnt = 0
for i in range(n):
if l < h[i]:
cnt += h[i] - l
l = h[i]
print(cnt)
if __name__ == "__main__":
slove()
| false | 40.740741 | [
"-n = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-h.insert(0, 0)",
"-h.append(0)",
"-cnt = 0",
"-while True:",
"- s = -1",
"- e = -1",
"- m_n = 10**10",
"- for i in range(1, n + 2):",
"- if h[i] != 0 and h[i - 1] == 0:",
"- s = i",
"- ... | false | 0.042896 | 0.035218 | 1.218007 | [
"s275083764",
"s511954355"
] |
u345966487 | p02629 | python | s519021576 | s657680079 | 33 | 28 | 9,212 | 9,216 | Accepted | Accepted | 15.15 | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)
N = ini()
def solve():
k = 26
a... | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)
N = ini()
def solve():
k = 26
a... | 33 | 31 | 632 | 617 | import sys
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)
N = ini()
def solve():
k = 26
a = k
p = k
... | import sys
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)
N = ini()
def solve():
k = 26
a = k
p = k
... | false | 6.060606 | [
"- b = 1",
"- x = N - 1",
"+ x = N - (a - p) - 1",
"- name[l - 1 - i] = chr(ord(\"a\") + c)",
"+ name[i] = chr(ord(\"a\") + c)",
"- x -= 1",
"- return \"\".join(name)",
"+ return \"\".join(reversed(name))"
] | false | 0.035464 | 0.034296 | 1.034033 | [
"s519021576",
"s657680079"
] |
u336564899 | p03844 | python | s486234140 | s063761859 | 27 | 23 | 9,172 | 9,016 | Accepted | Accepted | 14.81 | '''
ABC050 A - Addition and Subtraction Easy
https://atcoder.jp/contests/abc050/tasks/abc050_a
'''
a, op, b = input().split()
a, b = int(a), int(b)
if op == '+':
ans = a+b
elif op == '-':
ans = a-b
print(ans)
| '''
ABC050 A - Addition and Subtraction Easy
https://atcoder.jp/contests/abc050/tasks/abc050_a
'''
def main():
a, op, b = input().split()
a, b = int(a), int(b)
if op == '+':
ans = a+b
elif op == '-':
ans = a-b
print(ans)
if __name__ == '__main__':
main()
| 12 | 16 | 229 | 312 | """
ABC050 A - Addition and Subtraction Easy
https://atcoder.jp/contests/abc050/tasks/abc050_a
"""
a, op, b = input().split()
a, b = int(a), int(b)
if op == "+":
ans = a + b
elif op == "-":
ans = a - b
print(ans)
| """
ABC050 A - Addition and Subtraction Easy
https://atcoder.jp/contests/abc050/tasks/abc050_a
"""
def main():
a, op, b = input().split()
a, b = int(a), int(b)
if op == "+":
ans = a + b
elif op == "-":
ans = a - b
print(ans)
if __name__ == "__main__":
main()
| false | 25 | [
"-a, op, b = input().split()",
"-a, b = int(a), int(b)",
"-if op == \"+\":",
"- ans = a + b",
"-elif op == \"-\":",
"- ans = a - b",
"-print(ans)",
"+",
"+",
"+def main():",
"+ a, op, b = input().split()",
"+ a, b = int(a), int(b)",
"+ if op == \"+\":",
"+ ans = a + b... | false | 0.070613 | 0.074806 | 0.943954 | [
"s486234140",
"s063761859"
] |
u130900604 | p02971 | python | s662809886 | s877891819 | 527 | 282 | 14,208 | 25,156 | Accepted | Accepted | 46.49 | n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
b=sorted(a)
m1=b[-1]
m2=b[-2]
for c in a:
if c == m1:
print(m2)
else:
print(m1)
| n,*a=list(map(int,open(0).read().split()))
b=sorted(a)[::-1]
ma1=b[0]
ma2=b[1]
for i in a:
if ma1==i:
print(ma2)
else:
print(ma1)
| 11 | 10 | 154 | 149 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
b = sorted(a)
m1 = b[-1]
m2 = b[-2]
for c in a:
if c == m1:
print(m2)
else:
print(m1)
| n, *a = list(map(int, open(0).read().split()))
b = sorted(a)[::-1]
ma1 = b[0]
ma2 = b[1]
for i in a:
if ma1 == i:
print(ma2)
else:
print(ma1)
| false | 9.090909 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for i in range(n)]",
"-b = sorted(a)",
"-m1 = b[-1]",
"-m2 = b[-2]",
"-for c in a:",
"- if c == m1:",
"- print(m2)",
"+n, *a = list(map(int, open(0).read().split()))",
"+b = sorted(a)[::-1]",
"+ma1 = b[0]",
"+ma2 = b[1]",
"+for i... | false | 0.111244 | 0.124714 | 0.891992 | [
"s662809886",
"s877891819"
] |
u116002573 | p02790 | python | s265391769 | s460230107 | 188 | 64 | 38,256 | 61,820 | Accepted | Accepted | 65.96 | def main():
a, b = input().split()
aa = a*int(b)
bb = b*int(a)
if aa < bb:
return aa
return bb
if __name__ == '__main__':
print((main()))
| def main():
a, b = input().split()
s = a * int(b)
t = b * int(a)
if s < t:
return s
return t
if __name__ == '__main__':
print((main()))
| 12 | 12 | 182 | 180 | def main():
a, b = input().split()
aa = a * int(b)
bb = b * int(a)
if aa < bb:
return aa
return bb
if __name__ == "__main__":
print((main()))
| def main():
a, b = input().split()
s = a * int(b)
t = b * int(a)
if s < t:
return s
return t
if __name__ == "__main__":
print((main()))
| false | 0 | [
"- aa = a * int(b)",
"- bb = b * int(a)",
"- if aa < bb:",
"- return aa",
"- return bb",
"+ s = a * int(b)",
"+ t = b * int(a)",
"+ if s < t:",
"+ return s",
"+ return t"
] | false | 0.035443 | 0.0327 | 1.083889 | [
"s265391769",
"s460230107"
] |
u143509139 | p03151 | python | s568215316 | s812027409 | 150 | 113 | 19,188 | 19,536 | Accepted | Accepted | 24.67 | from bisect import bisect_right
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) == sum(b):
print(n)
mp = 0
ans = 0
l = []
for i in range(n):
if a[i] < b[i]:
mp -= b[i] - a[i]
elif a[i] >= b[i]:
mp += a[i] - b[i]
l... | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(a)<sum(b):
print((-1))
exit(0)
t=sum(a)-sum(b)
l=[]
for i in range(n):
if a[i] >= b[i]:
l.append(a[i]-b[i])
l.sort()
ans=0
for x in l:
t-=x
if t<0:
break
ans+=1
print((n-ans)) | 22 | 19 | 473 | 297 | from bisect import bisect_right
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) == sum(b):
print(n)
mp = 0
ans = 0
l = []
for i in range(n):
if a[i] < b[i]:
mp -= b[i] - a[i]
elif a[i] >= b[i]:
mp += a[i] - b[i]
l.append(a[i] ... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < sum(b):
print((-1))
exit(0)
t = sum(a) - sum(b)
l = []
for i in range(n):
if a[i] >= b[i]:
l.append(a[i] - b[i])
l.sort()
ans = 0
for x in l:
t -= x
if t < 0:
break
ans += 1... | false | 13.636364 | [
"-from bisect import bisect_right",
"-",
"-if sum(a) == sum(b):",
"- print(n)",
"-mp = 0",
"-ans = 0",
"+if sum(a) < sum(b):",
"+ print((-1))",
"+ exit(0)",
"+t = sum(a) - sum(b)",
"- if a[i] < b[i]:",
"- mp -= b[i] - a[i]",
"- elif a[i] >= b[i]:",
"- mp += a[i... | false | 0.038964 | 0.042597 | 0.914711 | [
"s568215316",
"s812027409"
] |
u600402037 | p02793 | python | s204474557 | s454972479 | 1,478 | 1,080 | 6,136 | 6,136 | Accepted | Accepted | 26.93 | import sys
from fractions import gcd
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10 ** 9 + 7
N = ir()
A = lr()
# lcm
lcm = 1
answer = 0
for a in A:
coef = a // gcd(lcm, a)
answer *= coef
lcm *= coef
answer += lcm /... | import sys
from fractions import gcd
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10 ** 9 + 7
N = ir()
A = lr()
lcm = 1
answer = 0
for a in A:
coef = a // gcd(lcm, a)
answer *= coef
lcm *= coef
answer += lcm // a
... | 21 | 19 | 364 | 338 | import sys
from fractions import gcd
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10**9 + 7
N = ir()
A = lr()
# lcm
lcm = 1
answer = 0
for a in A:
coef = a // gcd(lcm, a)
answer *= coef
lcm *= coef
answer += lcm // a
answer %= MOD... | import sys
from fractions import gcd
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10**9 + 7
N = ir()
A = lr()
lcm = 1
answer = 0
for a in A:
coef = a // gcd(lcm, a)
answer *= coef
lcm *= coef
answer += lcm // a
print((answer % MOD))
| false | 9.52381 | [
"-# lcm",
"- answer %= MOD"
] | false | 0.046747 | 0.045568 | 1.025872 | [
"s204474557",
"s454972479"
] |
u588341295 | p02901 | python | s398265620 | s950444620 | 380 | 309 | 49,500 | 46,044 | Accepted | Accepted | 18.68 | # -*- 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 ... | # -*- 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 ... | 55 | 54 | 1,470 | 1,437 | # -*- 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... | # -*- 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 | 1.818182 | [
"-cur = 0",
"-nxt = 1",
"+ cur = i % 2",
"+ nxt = (i + 1) % 2",
"+ # 今回の鍵を買わない遷移",
"+ dp[nxt] = dp[cur][:]",
"- # 今回の鍵を買わない遷移",
"- dp[nxt][j] = min(dp[nxt][j], dp[cur][j])",
"- cur, nxt = nxt, cur"
] | false | 0.03347 | 0.035767 | 0.935763 | [
"s398265620",
"s950444620"
] |
u609061751 | p03481 | python | s445183826 | s246904396 | 180 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.56 | import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]
ans = 0
while x <= y:
x *= 2
ans += 1
print(ans)
| import sys
input = lambda: sys.stdin.readline().rstrip()
x, y = list(map(int, input().split()))
cnt = 1
while True:
if x*2 <= y:
cnt += 1
x *= 2
else:
break
print(cnt)
| 13 | 14 | 153 | 211 | import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]
ans = 0
while x <= y:
x *= 2
ans += 1
print(ans)
| import sys
input = lambda: sys.stdin.readline().rstrip()
x, y = list(map(int, input().split()))
cnt = 1
while True:
if x * 2 <= y:
cnt += 1
x *= 2
else:
break
print(cnt)
| false | 7.142857 | [
"-input = sys.stdin.readline",
"-x, y = [int(x) for x in input().split()]",
"-ans = 0",
"-while x <= y:",
"- x *= 2",
"- ans += 1",
"-print(ans)",
"+input = lambda: sys.stdin.readline().rstrip()",
"+x, y = list(map(int, input().split()))",
"+cnt = 1",
"+while True:",
"+ if x * 2 <= y:... | false | 0.041413 | 0.039903 | 1.037835 | [
"s445183826",
"s246904396"
] |
u284854859 | p03162 | python | s940719649 | s835933156 | 503 | 324 | 24,332 | 27,492 | Accepted | Accepted | 35.59 | n = int(eval(input()))
a,b,c = list(map(int,input().split()))
dp = [0,0,0] * n
dp[0] = [a,b,c]
for i in range(1,n):
a,b,c = list(map(int,input().split()))
dp[i] = [max(dp[i-1][1],dp[i-1][2])+a,max(dp[i-1][0],dp[i-1][2])+b,max(dp[i-1][0],dp[i-1][1])+c]
print((max(dp[n-1]))) | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = [0]*n
b = [0]*n
c = [0]*n
for i in range(n):
a[i],b[i],c[i] = list(map(int,input().split()))
dpa = [a[0]]+[0]*(n-1)
dpb = [b[0]]+[0]*(n-1)
dpc = [c[0]]+[0]*(n-1)
for i in range(1,n):
dpa[i] = max(dpb[i-1],dpc[i-1]) + a[i]
dpb[i]... | 9 | 17 | 270 | 422 | n = int(eval(input()))
a, b, c = list(map(int, input().split()))
dp = [0, 0, 0] * n
dp[0] = [a, b, c]
for i in range(1, n):
a, b, c = list(map(int, input().split()))
dp[i] = [
max(dp[i - 1][1], dp[i - 1][2]) + a,
max(dp[i - 1][0], dp[i - 1][2]) + b,
max(dp[i - 1][0], dp[i - 1][1]) + c,
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = [0] * n
b = [0] * n
c = [0] * n
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
dpa = [a[0]] + [0] * (n - 1)
dpb = [b[0]] + [0] * (n - 1)
dpc = [c[0]] + [0] * (n - 1)
for i in range(1, n):
dpa[i] = max(dpb[i - 1], dpc[i - 1]... | false | 47.058824 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-a, b, c = list(map(int, input().split()))",
"-dp = [0, 0, 0] * n",
"-dp[0] = [a, b, c]",
"+a = [0] * n",
"+b = [0] * n",
"+c = [0] * n",
"+for i in range(n):",
"+ a[i], b[i], c[i] = list(map(int, input().split()))",
"+dpa = [a[0]] + [0] *... | false | 0.036706 | 0.035852 | 1.023809 | [
"s940719649",
"s835933156"
] |
u837286475 | p03014 | python | s934974659 | s216944238 | 1,987 | 742 | 184,196 | 179,844 | Accepted | Accepted | 62.66 |
import copy
h, w = list(map(int , input().split() ))
board = [eval(input()) for _ in range(h)]
left = [ [0]*w for _ in range(h)]
right = copy.deepcopy(left ) #いくつ右のマスを照らせるか
down = copy.deepcopy(left)
up = copy.deepcopy(left)
for hi in range(h):
for wi in range(w):
if board[h... |
import copy
h, w = list(map(int , input().split() ))
board = [eval(input()) for _ in range(h)]
left = [ [0]*w for _ in range(h)]
right = [ [0]*w for _ in range(h)] #いくつ右のマスを照らせるか
down = [ [0]*w for _ in range(h)]
up = [ [0]*w for _ in range(h)]
for hi in range(h):
for wi in range(w):
... | 61 | 61 | 1,215 | 1,235 | import copy
h, w = list(map(int, input().split()))
board = [eval(input()) for _ in range(h)]
left = [[0] * w for _ in range(h)]
right = copy.deepcopy(left) # いくつ右のマスを照らせるか
down = copy.deepcopy(left)
up = copy.deepcopy(left)
for hi in range(h):
for wi in range(w):
if board[hi][wi] == ".":
left[... | import copy
h, w = list(map(int, input().split()))
board = [eval(input()) for _ in range(h)]
left = [[0] * w for _ in range(h)]
right = [[0] * w for _ in range(h)] # いくつ右のマスを照らせるか
down = [[0] * w for _ in range(h)]
up = [[0] * w for _ in range(h)]
for hi in range(h):
for wi in range(w):
if board[hi][wi] =... | false | 0 | [
"-right = copy.deepcopy(left) # いくつ右のマスを照らせるか",
"-down = copy.deepcopy(left)",
"-up = copy.deepcopy(left)",
"+right = [[0] * w for _ in range(h)] # いくつ右のマスを照らせるか",
"+down = [[0] * w for _ in range(h)]",
"+up = [[0] * w for _ in range(h)]"
] | false | 0.044231 | 0.041722 | 1.060132 | [
"s934974659",
"s216944238"
] |
u298297089 | p03329 | python | s825804214 | s244418630 | 400 | 189 | 7,064 | 44,784 | Accepted | Accepted | 52.75 | N = int(eval(input()))
A = []
for i in range(1, N+1):
if 6**i > N:
break
else:
A.append(6**i)
if 9**i <= N:
A.append(9**i)
A.sort(reverse=True)
money = [i for i in range(N+1)]
for i in A:
for j in range(i,N+1):
money[j] = min(money[j], money[j-i]+1)
prin... | n = int(eval(input()))
ans = float('INF')
hand = []
tmp = 1
while tmp * 6 <= n:
tmp *= 6
hand.append(tmp)
tmp = 1
while tmp * 9 <= n:
tmp *= 9
hand.append(tmp)
hand.sort()
hand = hand[::-1]
dp = [i for i in range(n+1)]
for v in hand:
for i in range(n+1-v):
if dp[i] + 1 < d... | 17 | 20 | 326 | 369 | N = int(eval(input()))
A = []
for i in range(1, N + 1):
if 6**i > N:
break
else:
A.append(6**i)
if 9**i <= N:
A.append(9**i)
A.sort(reverse=True)
money = [i for i in range(N + 1)]
for i in A:
for j in range(i, N + 1):
money[j] = min(money[j], money[j - i] + 1)
print((mone... | n = int(eval(input()))
ans = float("INF")
hand = []
tmp = 1
while tmp * 6 <= n:
tmp *= 6
hand.append(tmp)
tmp = 1
while tmp * 9 <= n:
tmp *= 9
hand.append(tmp)
hand.sort()
hand = hand[::-1]
dp = [i for i in range(n + 1)]
for v in hand:
for i in range(n + 1 - v):
if dp[i] + 1 < dp[i + v]:
... | false | 15 | [
"-N = int(eval(input()))",
"-A = []",
"-for i in range(1, N + 1):",
"- if 6**i > N:",
"- break",
"- else:",
"- A.append(6**i)",
"- if 9**i <= N:",
"- A.append(9**i)",
"-A.sort(reverse=True)",
"-money = [i for i in range(N + 1)]",
"-for i in A:",
"- for j in r... | false | 0.072959 | 0.071858 | 1.015327 | [
"s825804214",
"s244418630"
] |
u469254913 | p02624 | python | s840586097 | s555630302 | 1,415 | 783 | 9,160 | 108,856 | Accepted | Accepted | 44.66 | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
def main():
N = int(eval(input()))
res = 0
for i in range(1,N+1):
end = N // i
res += end * (end + 1) * i // 2
prin... | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit
@njit
def sum_g(N):
res = 0
for i in range(1,N+1):
end = N // i
res += end * (end + 1) * i // 2
retur... | 24 | 28 | 338 | 418 | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
def main():
N = int(eval(input()))
res = 0
for i in range(1, N + 1):
end = N // i
res += end * (end + 1) * i // 2
print(res)
main()
| # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit
@njit
def sum_g(N):
res = 0
for i in range(1, N + 1):
end = N // i
res += end * (end + 1) * i // 2
return res
def ... | false | 14.285714 | [
"-def main():",
"- N = int(eval(input()))",
"+from numba import njit",
"+",
"+",
"+@njit",
"+def sum_g(N):",
"+ return res",
"+",
"+",
"+def main():",
"+ N = int(eval(input()))",
"+ res = sum_g(N)"
] | false | 1.01977 | 0.038373 | 26.575207 | [
"s840586097",
"s555630302"
] |
u013513417 | p03163 | python | s869207544 | s105310544 | 450 | 405 | 180,504 | 181,976 | Accepted | Accepted | 10 | N,W=list(map(int,input().split()))
S = [[0 for j in range(2)] for i in range(N+1)]
DP= [[0 for j in range(100010)] for i in range(110)]
def chmax(a,b):
if a>b:
return a
else:
return b
for i in range(N):
w,v=list(map(int,input().split()))
S[i][0]=w
S[i][1]=v
for ... |
N,W=list(map(int,input().split()))
w=[]
v=[]
jmax=100010
nmax=110
for i in range(N):
a,b=list(map(int,input().split()))
w.append(a)
v.append(b)
DP= [[0 for j in range(jmax)] for i in range(nmax)]
def chmax(a,b):
if a>b:
return a
else:
return b
for i i... | 27 | 31 | 539 | 510 | N, W = list(map(int, input().split()))
S = [[0 for j in range(2)] for i in range(N + 1)]
DP = [[0 for j in range(100010)] for i in range(110)]
def chmax(a, b):
if a > b:
return a
else:
return b
for i in range(N):
w, v = list(map(int, input().split()))
S[i][0] = w
S[i][1] = v
for ... | N, W = list(map(int, input().split()))
w = []
v = []
jmax = 100010
nmax = 110
for i in range(N):
a, b = list(map(int, input().split()))
w.append(a)
v.append(b)
DP = [[0 for j in range(jmax)] for i in range(nmax)]
def chmax(a, b):
if a > b:
return a
else:
return b
for i in range(N... | false | 12.903226 | [
"-S = [[0 for j in range(2)] for i in range(N + 1)]",
"-DP = [[0 for j in range(100010)] for i in range(110)]",
"+w = []",
"+v = []",
"+jmax = 100010",
"+nmax = 110",
"+for i in range(N):",
"+ a, b = list(map(int, input().split()))",
"+ w.append(a)",
"+ v.append(b)",
"+DP = [[0 for j in... | false | 0.578722 | 0.007419 | 78.004717 | [
"s869207544",
"s105310544"
] |
u596276291 | p03612 | python | s255611442 | s177261401 | 67 | 54 | 14,196 | 14,196 | Accepted | Accepted | 19.4 | from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10
def main():
N = int(eval(input()))
p_list = list(map(int, input().split()))
a_list = list(range(1, N +... | from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10
def main():
N = int(eval(input()))
p_list = list(map(int, input().split()))
ans = 0
i = 0
wh... | 27 | 23 | 661 | 492 | from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10**10
def main():
N = int(eval(input()))
p_list = list(map(int, input().split()))
a_list = list(range(1, N + 1))
ans... | from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10**10
def main():
N = int(eval(input()))
p_list = list(map(int, input().split()))
ans = 0
i = 0
while i < N:
... | false | 14.814815 | [
"- a_list = list(range(1, N + 1))",
"- if i + 1 < N and p_list[i] == a_list[i] and p_list[i + 1] == a_list[i + 1]:",
"- ans += 1",
"- i += 2",
"- elif p_list[i] == a_list[i]:",
"+ if p_list[i] == i + 1:"
] | false | 0.038866 | 0.073935 | 0.525681 | [
"s255611442",
"s177261401"
] |
u296518383 | p03476 | python | s499149594 | s808282499 | 967 | 672 | 9,344 | 70,488 | Accepted | Accepted | 30.51 | # -*- coding:utf-8 -*-
import math
def get_sieve_of_eratosthenes(n):
if not isinstance(n, int):
raise TypeError('n is int type.')
if n < 2:
raise ValueError('n is more than 2')
prime = []
limit = math.sqrt(n)
data = [i + 1 for i in range(1, n)]
while True:
... | Q = int(eval(input()))
LR = [list(map(int, input().split())) for _ in range(Q)]
SIZE = 10 ** 5
P = [-1] * (SIZE + 1)
P[0], P[1] = 0, 0
for i in range(2, SIZE + 1):
if P[i] == -1:
P[i] = 1
k = 2
while i * k <= SIZE:
P[i * k] = 0
k += 1
PP = [0] * (SIZE + 1)
for i in ran... | 41 | 29 | 955 | 532 | # -*- coding:utf-8 -*-
import math
def get_sieve_of_eratosthenes(n):
if not isinstance(n, int):
raise TypeError("n is int type.")
if n < 2:
raise ValueError("n is more than 2")
prime = []
limit = math.sqrt(n)
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
... | Q = int(eval(input()))
LR = [list(map(int, input().split())) for _ in range(Q)]
SIZE = 10**5
P = [-1] * (SIZE + 1)
P[0], P[1] = 0, 0
for i in range(2, SIZE + 1):
if P[i] == -1:
P[i] = 1
k = 2
while i * k <= SIZE:
P[i * k] = 0
k += 1
PP = [0] * (SIZE + 1)
for i in rang... | false | 29.268293 | [
"-# -*- coding:utf-8 -*-",
"-import math",
"-",
"-",
"-def get_sieve_of_eratosthenes(n):",
"- if not isinstance(n, int):",
"- raise TypeError(\"n is int type.\")",
"- if n < 2:",
"- raise ValueError(\"n is more than 2\")",
"- prime = []",
"- limit = math.sqrt(n)",
"- ... | false | 0.265955 | 0.217448 | 1.223074 | [
"s499149594",
"s808282499"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.