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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u014333473 | p03207 | python | s438264335 | s502577346 | 30 | 27 | 9,028 | 9,092 | Accepted | Accepted | 10 | n=sorted([int(eval(input())) for _ in range(int(eval(input())))],reverse=True);print((max(n)//2+sum(n[1:]))) | n=sorted([int(eval(input())) for _ in range(int(eval(input())))],reverse=True);print((sum(n)-max(n)//2)) | 1 | 1 | 94 | 90 | n = sorted([int(eval(input())) for _ in range(int(eval(input())))], reverse=True)
print((max(n) // 2 + sum(n[1:])))
| n = sorted([int(eval(input())) for _ in range(int(eval(input())))], reverse=True)
print((sum(n) - max(n) // 2))
| false | 0 | [
"-print((max(n) // 2 + sum(n[1:])))",
"+print((sum(n) - max(n) // 2))"
] | false | 0.225871 | 0.097322 | 2.320861 | [
"s438264335",
"s502577346"
] |
u037441960 | p00084 | python | s293971397 | s472411017 | 40 | 30 | 6,512 | 6,528 | Accepted | Accepted | 25 | import re
s = re.split("[ .,]", input())
sl = len(s)
ans = list()
for i in range(sl) :
if(2 < len(s[i]) and len(s[i]) < 7) :
ans.append(s[i])
else :
pass
ansl = len(ans)
for i in range(ansl) :
if(i == ansl - 1) :
print(ans[i])
else :
print(ans[i], end = (" "))
| import re
I = input().split()
S = []
for i in range(len(I)) :
I[i] = re.split("[,.]", I[i])
if 2 < len(I[i][0]) and len(I[i][0]) < 7 :
S.append(I[i][0])
for i in range(len(S)) :
if i == len(S) - 1 :
print(S[i])
else :
print(S[i], " ", sep = "", end = "")
| 19 | 15 | 307 | 312 | import re
s = re.split("[ .,]", input())
sl = len(s)
ans = list()
for i in range(sl):
if 2 < len(s[i]) and len(s[i]) < 7:
ans.append(s[i])
else:
pass
ansl = len(ans)
for i in range(ansl):
if i == ansl - 1:
print(ans[i])
else:
print(ans[i], end=(" "))
| import re
I = input().split()
S = []
for i in range(len(I)):
I[i] = re.split("[,.]", I[i])
if 2 < len(I[i][0]) and len(I[i][0]) < 7:
S.append(I[i][0])
for i in range(len(S)):
if i == len(S) - 1:
print(S[i])
else:
print(S[i], " ", sep="", end="")
| false | 21.052632 | [
"-s = re.split(\"[ .,]\", input())",
"-sl = len(s)",
"-ans = list()",
"-for i in range(sl):",
"- if 2 < len(s[i]) and len(s[i]) < 7:",
"- ans.append(s[i])",
"+I = input().split()",
"+S = []",
"+for i in range(len(I)):",
"+ I[i] = re.split(\"[,.]\", I[i])",
"+ if 2 < len(I[i][0]) ... | false | 0.069875 | 0.04777 | 1.462741 | [
"s293971397",
"s472411017"
] |
u314050667 | p03295 | python | s104140246 | s049884815 | 597 | 276 | 28,656 | 26,744 | Accepted | Accepted | 53.77 | N, M = list(map(int,input().split()))
E = sorted([list(map(int, input().split())) for _ in range(M)])
c = E[0]
cnt = 0
for i in range(1,M):
if c[0] <= E[i][0] < c[1]:
c = [max(c[0],E[i][0]), min(c[1],E[i][1])]
else:
cnt += 1
c = E[i]
print((cnt+1)) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter
N,M = list(map(int,readline().split()))
m = list(map(int,read().split()))
AB = sorted(zip(m,m))
AB.sort(key = lambda x: x[1])
c = AB[0][1]
ans = 1
for ... | 13 | 23 | 262 | 405 | N, M = list(map(int, input().split()))
E = sorted([list(map(int, input().split())) for _ in range(M)])
c = E[0]
cnt = 0
for i in range(1, M):
if c[0] <= E[i][0] < c[1]:
c = [max(c[0], E[i][0]), min(c[1], E[i][1])]
else:
cnt += 1
c = E[i]
print((cnt + 1))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter
N, M = list(map(int, readline().split()))
m = list(map(int, read().split()))
AB = sorted(zip(m, m))
AB.sort(key=lambda x: x[1])
c = AB[0][1]
ans = 1
for i in range(1, M):... | false | 43.478261 | [
"-N, M = list(map(int, input().split()))",
"-E = sorted([list(map(int, input().split())) for _ in range(M)])",
"-c = E[0]",
"-cnt = 0",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+from operator import it... | false | 0.035836 | 0.03821 | 0.937879 | [
"s104140246",
"s049884815"
] |
u933341648 | p02695 | python | s870051910 | s135458692 | 1,126 | 589 | 22,944 | 9,196 | Accepted | Accepted | 47.69 | n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
arr = []
def f(p):
if len(p) == n+1:
arr.append(p[:-1])
return
while p[-1] <= m:
f(p + [p[-1]])
p[-1] += 1
f([1])
ans = 0
for p in arr:
score = 0
f... | n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def calc_score(p):
score = 0
for a, b, c, d in queries:
if p[b-1] - p[a-1] == c:
score += d
return score
def f(p):
if len(p) == n+1:
global ans
... | 23 | 23 | 439 | 456 | n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
arr = []
def f(p):
if len(p) == n + 1:
arr.append(p[:-1])
return
while p[-1] <= m:
f(p + [p[-1]])
p[-1] += 1
f([1])
ans = 0
for p in arr:
score = 0
for a, b, c, d ... | n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def calc_score(p):
score = 0
for a, b, c, d in queries:
if p[b - 1] - p[a - 1] == c:
score += d
return score
def f(p):
if len(p) == n + 1:
global ans
a... | false | 0 | [
"-arr = []",
"+ans = 0",
"+",
"+",
"+def calc_score(p):",
"+ score = 0",
"+ for a, b, c, d in queries:",
"+ if p[b - 1] - p[a - 1] == c:",
"+ score += d",
"+ return score",
"- arr.append(p[:-1])",
"+ global ans",
"+ ans = max(ans, calc_score(p)... | false | 0.232573 | 0.14071 | 1.65286 | [
"s870051910",
"s135458692"
] |
u634461820 | p03556 | python | s285747074 | s057091370 | 194 | 153 | 13,264 | 12,484 | Accepted | Accepted | 21.13 | import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input())
N... | import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(... | 16 | 17 | 392 | 373 | import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL():
return list(map(int, input().split()))
def SL():
return input().split()
def I():
return int(sys.stdin.readline())
def S():
return eva... | import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL():
return list(map(int, input().split()))
def SL():
return input().split()
def I():
return int(sys.stdin.readline())
def S():
... | false | 5.882353 | [
"+import math",
"-ans = [pow(i, 2) for i in range(100000) if pow(i, 2) <= N]",
"-print((ans[-1]))",
"+ans = int(math.sqrt(N))",
"+print((ans**2))"
] | false | 0.105802 | 0.118854 | 0.890185 | [
"s285747074",
"s057091370"
] |
u266113953 | p02659 | python | s701887323 | s559000321 | 28 | 24 | 9,996 | 9,088 | Accepted | Accepted | 14.29 | import math
from decimal import *
A, B = list(map(Decimal, input().split()))
print((math.floor(A*B))) | sp = input().split()
A = int(sp[0])
B = int(sp[1].replace(".",""))
print((A*B//100)) | 4 | 4 | 102 | 85 | import math
from decimal import *
A, B = list(map(Decimal, input().split()))
print((math.floor(A * B)))
| sp = input().split()
A = int(sp[0])
B = int(sp[1].replace(".", ""))
print((A * B // 100))
| false | 0 | [
"-import math",
"-from decimal import *",
"-",
"-A, B = list(map(Decimal, input().split()))",
"-print((math.floor(A * B)))",
"+sp = input().split()",
"+A = int(sp[0])",
"+B = int(sp[1].replace(\".\", \"\"))",
"+print((A * B // 100))"
] | false | 0.101283 | 0.039099 | 2.590427 | [
"s701887323",
"s559000321"
] |
u133936772 | p02834 | python | s005855933 | s260277829 | 896 | 662 | 117,048 | 28,464 | Accepted | Accepted | 26.12 | import sys
sys.setrecursionlimit(10**9)
f=lambda:list(map(int,input().split()))
n,st,sa=f()
st-=1
sa-=1
g=[[] for _ in range(n)]
for _ in range(n-1):
a,b=f()
g[a-1].append(b-1)
g[b-1].append(a-1)
def dfs(v,p=-1,d=0):
l[v]=d
for c in g[v]:
if c==p: continue
dfs(c,v,d+1)
def dist(s):
... | f=lambda:list(map(int,input().split()))
n,st,sa=f()
st-=1
sa-=1
g=[[] for _ in range(n)]
for _ in range(n-1):
a,b=f()
g[a-1].append(b-1)
g[b-1].append(a-1)
def bfs(s):
l=[-1]*n; l[s]=0; q=[s]
while q:
v=q.pop(); d=l[v]+1
for c in g[v]:
if l[c]<0: l[c]=d; q+=[c]
return l
lt=bfs(... | 27 | 22 | 452 | 400 | import sys
sys.setrecursionlimit(10**9)
f = lambda: list(map(int, input().split()))
n, st, sa = f()
st -= 1
sa -= 1
g = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = f()
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
def dfs(v, p=-1, d=0):
l[v] = d
for c in g[v]:
if c == p:
... | f = lambda: list(map(int, input().split()))
n, st, sa = f()
st -= 1
sa -= 1
g = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = f()
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
def bfs(s):
l = [-1] * n
l[s] = 0
q = [s]
while q:
v = q.pop()
d = l[v] + 1
for c i... | false | 18.518519 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"-def dfs(v, p=-1, d=0):",
"- l[v] = d",
"- for c in g[v]:",
"- if c == p:",
"- continue",
"- dfs(c, v, d + 1)",
"-",
"-",
"-def dist(s):",
"- global l",
"- l = [0] * n",
"- dfs(s)",
"+def bfs(... | false | 0.043954 | 0.037078 | 1.185455 | [
"s005855933",
"s260277829"
] |
u896741788 | p04015 | python | s730278526 | s589395554 | 74 | 33 | 3,188 | 9,528 | Accepted | Accepted | 55.41 | n,a=list(map(int,input().split()))
l=list(map(int,input().split()))
dp=[0]*5300
dp[l[0]-a]=1
for x in l[1:]:
b=x-a
if b>=0:
for i in range(2500,-2501,-1):
dp[i+b]+=dp[i]
else:
for i in range(-2500,2501):
dp[i+b]+=dp[i]
dp[b]+=1
print((dp[0])) | n,a=list(map(int,input().split()))
from collections import defaultdict
dp=defaultdict(int)
dp[0]=1
for i in map(int,input().split()):
i-=a
for k in sorted(list(dp.keys()),reverse=(i>=0)):
dp[k+i]+=dp[k]
print((dp[0]-1)) | 15 | 10 | 277 | 231 | n, a = list(map(int, input().split()))
l = list(map(int, input().split()))
dp = [0] * 5300
dp[l[0] - a] = 1
for x in l[1:]:
b = x - a
if b >= 0:
for i in range(2500, -2501, -1):
dp[i + b] += dp[i]
else:
for i in range(-2500, 2501):
dp[i + b] += dp[i]
dp[b] += 1
pr... | n, a = list(map(int, input().split()))
from collections import defaultdict
dp = defaultdict(int)
dp[0] = 1
for i in map(int, input().split()):
i -= a
for k in sorted(list(dp.keys()), reverse=(i >= 0)):
dp[k + i] += dp[k]
print((dp[0] - 1))
| false | 33.333333 | [
"-l = list(map(int, input().split()))",
"-dp = [0] * 5300",
"-dp[l[0] - a] = 1",
"-for x in l[1:]:",
"- b = x - a",
"- if b >= 0:",
"- for i in range(2500, -2501, -1):",
"- dp[i + b] += dp[i]",
"- else:",
"- for i in range(-2500, 2501):",
"- dp[i + b]... | false | 0.049809 | 0.036801 | 1.353485 | [
"s730278526",
"s589395554"
] |
u562935282 | p03999 | python | s532405995 | s145406636 | 28 | 24 | 3,060 | 2,940 | Accepted | Accepted | 14.29 | from itertools import zip_longest
s = eval(input())
s = list(s)
cnt_pos = len(s) - 1#記号の入り得る位置の数
formula_cnt = 2 ** (cnt_pos)#式数
ans = 0
for i in range(formula_cnt):
sgns = ['+' if (i & (2 ** x) != 0) else '' for x in range(cnt_pos)]
formula = ''
for c, sgn in zip_longest(s, sgns, fillvalue='')... | def main():
import sys
sys.setrecursionlimit(10 ** 7)
s = eval(input())
def calc(cur=1, t=s[0]):
if cur == len(s):
return eval(t)
return calc(cur + 1, t + s[cur]) + calc(cur + 1, t + '+' + s[cur])
print((calc()))
if __name__ == '__main__':
main()
| 16 | 16 | 415 | 311 | from itertools import zip_longest
s = eval(input())
s = list(s)
cnt_pos = len(s) - 1 # 記号の入り得る位置の数
formula_cnt = 2 ** (cnt_pos) # 式数
ans = 0
for i in range(formula_cnt):
sgns = ["+" if (i & (2**x) != 0) else "" for x in range(cnt_pos)]
formula = ""
for c, sgn in zip_longest(s, sgns, fillvalue=""):
... | def main():
import sys
sys.setrecursionlimit(10**7)
s = eval(input())
def calc(cur=1, t=s[0]):
if cur == len(s):
return eval(t)
return calc(cur + 1, t + s[cur]) + calc(cur + 1, t + "+" + s[cur])
print((calc()))
if __name__ == "__main__":
main()
| false | 0 | [
"-from itertools import zip_longest",
"+def main():",
"+ import sys",
"-s = eval(input())",
"-s = list(s)",
"-cnt_pos = len(s) - 1 # 記号の入り得る位置の数",
"-formula_cnt = 2 ** (cnt_pos) # 式数",
"-ans = 0",
"-for i in range(formula_cnt):",
"- sgns = [\"+\" if (i & (2**x) != 0) else \"\" for x in ran... | false | 0.142708 | 0.107185 | 1.331422 | [
"s532405995",
"s145406636"
] |
u878849567 | p02915 | python | s916357012 | s753710260 | 171 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.06 | n = int(eval(input()))
ans = 0
ans = n*n*n
print(ans) | n = int(eval(input()))
print((n ** 3))
| 4 | 2 | 50 | 32 | n = int(eval(input()))
ans = 0
ans = n * n * n
print(ans)
| n = int(eval(input()))
print((n**3))
| false | 50 | [
"-ans = 0",
"-ans = n * n * n",
"-print(ans)",
"+print((n**3))"
] | false | 0.041881 | 0.041848 | 1.000794 | [
"s916357012",
"s753710260"
] |
u721316601 | p02788 | python | s622672471 | s634672576 | 1,957 | 877 | 65,624 | 65,616 | Accepted | Accepted | 55.19 | from math import *
import sys
input = sys.stdin.readline
def main():
N, D, A = list(map(int, input().split()))
XH = sorted([list(map(int, input().split())) for i in range(N)])
t = 0
q = []
ans = 0
for X, H in XH:
while q and q[0][0] < X-D:
x, c = q.pop(0)
... | from math import *
import sys
from collections import *
input = sys.stdin.readline
def main():
N, D, A = list(map(int, input().split()))
XH = sorted([list(map(int, input().split())) for i in range(N)])
t = 0
q = deque([])
ans = 0
for X, H in XH:
while q and q[0][0] ... | 26 | 29 | 542 | 599 | from math import *
import sys
input = sys.stdin.readline
def main():
N, D, A = list(map(int, input().split()))
XH = sorted([list(map(int, input().split())) for i in range(N)])
t = 0
q = []
ans = 0
for X, H in XH:
while q and q[0][0] < X - D:
x, c = q.pop(0)
t -... | from math import *
import sys
from collections import *
input = sys.stdin.readline
def main():
N, D, A = list(map(int, input().split()))
XH = sorted([list(map(int, input().split())) for i in range(N)])
t = 0
q = deque([])
ans = 0
for X, H in XH:
while q and q[0][0] < X - D:
... | false | 10.344828 | [
"+from collections import *",
"- q = []",
"+ q = deque([])",
"- x, c = q.pop(0)",
"+ x, c = q.popleft()"
] | false | 0.036501 | 0.036582 | 0.997793 | [
"s622672471",
"s634672576"
] |
u540877546 | p03371 | python | s809398448 | s779358611 | 163 | 63 | 38,256 | 65,684 | Accepted | Accepted | 61.35 | a, b, c, x, y = list(map(int, input().split()))
ans = 0
if a+b <= c*2:
ans += min(x, y)*(a+b)
else:
ans += min(x, y)*c*2
if x > y:
if a <= c*2:
ans += (x-y)*a
else:
ans += (x-y)*c*2
else:
if b <= c*2:
ans += (y-x)*b
else:
ans += (y-x)*c*2
pri... | a, b, c, x, y = list(map(int, input().split()))
INF = float("inf")
ans = INF
for ab in range(max(x, y)*2+1):
if ab % 2 == 0:
ans = min(ans, ab*c + max(x-ab//2, 0)*a + max(y-ab//2, 0)*b)
print(ans)
| 20 | 7 | 322 | 215 | a, b, c, x, y = list(map(int, input().split()))
ans = 0
if a + b <= c * 2:
ans += min(x, y) * (a + b)
else:
ans += min(x, y) * c * 2
if x > y:
if a <= c * 2:
ans += (x - y) * a
else:
ans += (x - y) * c * 2
else:
if b <= c * 2:
ans += (y - x) * b
else:
ans += (y - ... | a, b, c, x, y = list(map(int, input().split()))
INF = float("inf")
ans = INF
for ab in range(max(x, y) * 2 + 1):
if ab % 2 == 0:
ans = min(ans, ab * c + max(x - ab // 2, 0) * a + max(y - ab // 2, 0) * b)
print(ans)
| false | 65 | [
"-ans = 0",
"-if a + b <= c * 2:",
"- ans += min(x, y) * (a + b)",
"-else:",
"- ans += min(x, y) * c * 2",
"-if x > y:",
"- if a <= c * 2:",
"- ans += (x - y) * a",
"- else:",
"- ans += (x - y) * c * 2",
"-else:",
"- if b <= c * 2:",
"- ans += (y - x) * b"... | false | 0.03675 | 0.154469 | 0.23791 | [
"s809398448",
"s779358611"
] |
u281610856 | p03730 | python | s602862074 | s899140282 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a, b, c = list(map(int, input().split()))
num = a
for i in range(b):
if num % b == c:
print('YES')
break
num += a
else:
print('NO') | a, b, c = list(map(int, input().split()))
num = a
for i in range(b):
if num % b == c:
print("YES")
exit()
num += a
print("NO") | 9 | 8 | 161 | 151 | a, b, c = list(map(int, input().split()))
num = a
for i in range(b):
if num % b == c:
print("YES")
break
num += a
else:
print("NO")
| a, b, c = list(map(int, input().split()))
num = a
for i in range(b):
if num % b == c:
print("YES")
exit()
num += a
print("NO")
| false | 11.111111 | [
"- break",
"+ exit()",
"-else:",
"- print(\"NO\")",
"+print(\"NO\")"
] | false | 0.052172 | 0.052236 | 0.99876 | [
"s602862074",
"s899140282"
] |
u968166680 | p02973 | python | s991925789 | s445342529 | 253 | 77 | 55,796 | 14,092 | Accepted | Accepted | 69.57 | def main():
import sys
import bisect
read = sys.stdin.buffer.read
bisect_right = bisect.bisect_right
N, *A = list(map(int, read().split()))
dp = [A[-1]]
for a in reversed(A[:-1]):
if a >= dp[-1]:
dp.append(a)
else:
dp[bisect_right(dp, ... | import sys
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N, *A = list(map(int, read().split()))
vec = [A[-1]]
for a in reversed(A[:-1]):
if a >= vec[-1]:
... | 22 | 26 | 400 | 478 | def main():
import sys
import bisect
read = sys.stdin.buffer.read
bisect_right = bisect.bisect_right
N, *A = list(map(int, read().split()))
dp = [A[-1]]
for a in reversed(A[:-1]):
if a >= dp[-1]:
dp.append(a)
else:
dp[bisect_right(dp, a)] = a
prin... | import sys
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, *A = list(map(int, read().split()))
vec = [A[-1]]
for a in reversed(A[:-1]):
if a >= vec[-1]:
vec.ap... | false | 15.384615 | [
"+import sys",
"+from bisect import bisect_right",
"+",
"+read = sys.stdin.read",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"+sys.setrecursionlimit(10**9)",
"+INF = 1 << 60",
"+",
"+",
"- import sys",
"- import bisect",
"-",
"- read = sys.stdin.buffer.r... | false | 0.046877 | 0.037686 | 1.243881 | [
"s991925789",
"s445342529"
] |
u875291233 | p02670 | python | s164448641 | s596652215 | 1,984 | 939 | 170,280 | 148,520 | Accepted | Accepted | 52.67 | # coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n,*p = list(map(int,read().split()))
N = n*n
dist = [0]*N
for a in range(n):
for b in range(n):
dist[a*n+b] = min(a,n-1-a,b,n-1-b)
#print(dist)
#ans = [0]*N
ans = 0
iru = [1]*N
for... | import sys
n,*p = list(map(int,sys.stdin.read().split()))
dist = [min(a,n-1-a,b,n-1-b) for a in range(n) for b in range(n)]
def update(v,nv):
if dist[nv] > dist[v] + iru[v]:
q.append(nv)
dist[nv] = dist[v] + iru[v]
ans = 0
iru = [1]*n*n
for pi in p:
pi -= 1
ans += dist[pi]
... | 54 | 23 | 824 | 528 | # coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n, *p = list(map(int, read().split()))
N = n * n
dist = [0] * N
for a in range(n):
for b in range(n):
dist[a * n + b] = min(a, n - 1 - a, b, n - 1 - b)
# print(dist)
# ans = [0]*N
ans = 0
iru = [1] * N
for pi i... | import sys
n, *p = list(map(int, sys.stdin.read().split()))
dist = [min(a, n - 1 - a, b, n - 1 - b) for a in range(n) for b in range(n)]
def update(v, nv):
if dist[nv] > dist[v] + iru[v]:
q.append(nv)
dist[nv] = dist[v] + iru[v]
ans = 0
iru = [1] * n * n
for pi in p:
pi -= 1
ans += dist... | false | 57.407407 | [
"-# coding: utf-8",
"-# Your code here!",
"-readline = sys.stdin.readline",
"-read = sys.stdin.read",
"-n, *p = list(map(int, read().split()))",
"-N = n * n",
"-dist = [0] * N",
"-for a in range(n):",
"- for b in range(n):",
"- dist[a * n + b] = min(a, n - 1 - a, b, n - 1 - b)",
"-# pr... | false | 0.117403 | 0.036093 | 3.252793 | [
"s164448641",
"s596652215"
] |
u923668099 | p02241 | python | s166171600 | s131406114 | 80 | 20 | 7,944 | 7,988 | Accepted | Accepted | 75 | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def solve():
n = int(input())
a = []
for i in range(n):
a.append([int(j) for j in input().split()])
... | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def solve():
inf = float('inf')
n = int(input())
a = []
for i in range(n):
line = [int(i) for i... | 40 | 49 | 837 | 992 | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print("DEBUG:{} -> {}".format(name, val), file=sys.stderr)
return None
def solve():
n = int(input())
a = []
for i in range(n):
a.append([int(j) for j in input().split()])
checked ... | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print("DEBUG:{} -> {}".format(name, val), file=sys.stderr)
return None
def solve():
inf = float("inf")
n = int(input())
a = []
for i in range(n):
line = [int(i) for i in input().s... | false | 18.367347 | [
"+ inf = float(\"inf\")",
"- a.append([int(j) for j in input().split()])",
"+ line = [int(i) for i in input().split()]",
"+ line = [i if i != -1 else inf for i in line]",
"+ a.append(line)",
"- tree = [0]",
"+ d = [inf] * n",
"+ nxt = 0",
"- min_w = flo... | false | 0.075779 | 0.15466 | 0.489971 | [
"s166171600",
"s131406114"
] |
u190405389 | p02920 | python | s108257582 | s838034999 | 1,969 | 438 | 113,608 | 120,768 | Accepted | Accepted | 77.76 | import time
start = time.time()
n = int(eval(input()))
s = list(map(int, input().split()))
s.sort()
s.reverse()
flag = True
for i in range(n):
a = s[0:2 ** i]
b = s[2 ** i:2 ** (i + 1)]
for j in range(len(a)):
if b[j] >= a[j]:
flag = False
break
if flag:... |
n = int(eval(input()))
s = list(map(int, input().split()))
s.sort()
a = [s[-1]]
b = s[:-1]
for i in range(n):
a2 = []
b2 = []
for x in a:
while b:
y = b.pop()
if x>y:
a2.append(y)
break
else:
b... | 42 | 29 | 761 | 480 | import time
start = time.time()
n = int(eval(input()))
s = list(map(int, input().split()))
s.sort()
s.reverse()
flag = True
for i in range(n):
a = s[0 : 2**i]
b = s[2**i : 2 ** (i + 1)]
for j in range(len(a)):
if b[j] >= a[j]:
flag = False
break
if flag:
print("Yes")
... | n = int(eval(input()))
s = list(map(int, input().split()))
s.sort()
a = [s[-1]]
b = s[:-1]
for i in range(n):
a2 = []
b2 = []
for x in a:
while b:
y = b.pop()
if x > y:
a2.append(y)
break
else:
b2.append(y)
a = a... | false | 30.952381 | [
"-import time",
"-",
"-start = time.time()",
"-s.reverse()",
"-flag = True",
"+a = [s[-1]]",
"+b = s[:-1]",
"- a = s[0 : 2**i]",
"- b = s[2**i : 2 ** (i + 1)]",
"- for j in range(len(a)):",
"- if b[j] >= a[j]:",
"- flag = False",
"- break",
"-if flag:"... | false | 0.038265 | 0.03815 | 1.003009 | [
"s108257582",
"s838034999"
] |
u391331433 | p03806 | python | s422222969 | s577519975 | 1,807 | 747 | 13,348 | 4,592 | Accepted | Accepted | 58.66 | import sys
from collections import deque
import copy
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def bfs(X, Ma, Mb):
#node_list = deque([0, 1])
drug_dict = {}
drug_dict[(0, 0)] = 0
drug_dict[(X[0][0], ... | import sys
from collections import deque
import copy
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def bfs(X, Ma, Mb):
#node_list = deque([0, 1])
drug_dict = {}
drug_dict[(0, 0)] = 0
drug_dict[(X[0][0], ... | 59 | 79 | 1,722 | 2,516 | import sys
from collections import deque
import copy
def get_read_func(fileobject):
if fileobject == None:
return raw_input
else:
return fileobject.readline
def bfs(X, Ma, Mb):
# node_list = deque([0, 1])
drug_dict = {}
drug_dict[(0, 0)] = 0
drug_dict[(X[0][0], X[0][1])] = X[... | import sys
from collections import deque
import copy
def get_read_func(fileobject):
if fileobject == None:
return raw_input
else:
return fileobject.readline
def bfs(X, Ma, Mb):
# node_list = deque([0, 1])
drug_dict = {}
drug_dict[(0, 0)] = 0
drug_dict[(X[0][0], X[0][1])] = X[... | false | 25.316456 | [
"+def dp_search(X, Ma, Mb, AMax, BMax):",
"+ dp = [[sys.maxsize for i in range(AMax + 1)] for j in range(BMax + 1)]",
"+ dp[0][0] = 0",
"+ for i in range(len(X)):",
"+ for a in range(AMax, -1, -1):",
"+ for b in range(BMax, -1, -1):",
"+ if dp[a][b] >= sys.maxsi... | false | 0.044005 | 0.044287 | 0.993638 | [
"s422222969",
"s577519975"
] |
u391731808 | p03911 | python | s060786164 | s910624714 | 589 | 510 | 57,968 | 48,692 | Accepted | Accepted | 13.41 | N,M = list(map(int,input().split()))
KL = [list(map(int,input().split())) for _ in [0]*N ]
E = [[[] for _ in [0]*N] , [[] for _ in [0]*M]]
for i,kl in enumerate(KL):
for l in kl[1:]:
E[0][i].append(l-1)
E[1][l-1].append(i)
Check = [[False]*N,[False]*M]
Check[0][0] = True
q = [[0,0]]
wh... | #二部グラフで連結判定
N,M = list(map(int,input().split()))
KL = [list(map(int,input().split())) for _ in [0]*N]
c = [False]*(N+M) #d[0] - d[N-1]:人, d[N] - D[N+M-1]:言語
E = [[] for _ in [0]*(N+M)]
for i,kl in enumerate(KL):
for l in kl[1:]:
E[i].append(N+l-1)
E[N+l-1].append(i)
start = 0
q = [star... | 23 | 25 | 527 | 531 | N, M = list(map(int, input().split()))
KL = [list(map(int, input().split())) for _ in [0] * N]
E = [[[] for _ in [0] * N], [[] for _ in [0] * M]]
for i, kl in enumerate(KL):
for l in kl[1:]:
E[0][i].append(l - 1)
E[1][l - 1].append(i)
Check = [[False] * N, [False] * M]
Check[0][0] = True
q = [[0, 0]... | # 二部グラフで連結判定
N, M = list(map(int, input().split()))
KL = [list(map(int, input().split())) for _ in [0] * N]
c = [False] * (N + M) # d[0] - d[N-1]:人, d[N] - D[N+M-1]:言語
E = [[] for _ in [0] * (N + M)]
for i, kl in enumerate(KL):
for l in kl[1:]:
E[i].append(N + l - 1)
E[N + l - 1].append(i)
start = ... | false | 8 | [
"+# 二部グラフで連結判定",
"-E = [[[] for _ in [0] * N], [[] for _ in [0] * M]]",
"+c = [False] * (N + M) # d[0] - d[N-1]:人, d[N] - D[N+M-1]:言語",
"+E = [[] for _ in [0] * (N + M)]",
"- E[0][i].append(l - 1)",
"- E[1][l - 1].append(i)",
"-Check = [[False] * N, [False] * M]",
"-Check[0][0] = True",... | false | 0.050325 | 0.049855 | 1.009437 | [
"s060786164",
"s910624714"
] |
u620238824 | p02695 | python | s078629948 | s304405815 | 1,973 | 1,793 | 86,784 | 73,924 | Accepted | Accepted | 9.12 | N, M, Q = list(map(int, input().split())) #数字
Q = [list(map(int, input().split())) for i in range(Q)] #数字複数列、複数行
A = []
for i in range(1,M+1):
A.append(i)
B = []
import itertools
for i in itertools.combinations_with_replacement(A,N):
B.append(i)
C = []
for i in range(len(B)):
score = 0
... | N, M, Q = list(map(int, input().split())) #数字
Q = [list(map(int, input().split())) for i in range(Q)] #数字複数列、複数行
import itertools
A = []
for i in itertools.combinations_with_replacement(list(range(M)),N):
score = 0
for j in range(len(Q)):
if i[Q[j][1]-1] - i[Q[j][0]-1] == Q[j][2]:
... | 21 | 13 | 470 | 368 | N, M, Q = list(map(int, input().split())) # 数字
Q = [list(map(int, input().split())) for i in range(Q)] # 数字複数列、複数行
A = []
for i in range(1, M + 1):
A.append(i)
B = []
import itertools
for i in itertools.combinations_with_replacement(A, N):
B.append(i)
C = []
for i in range(len(B)):
score = 0
for j in... | N, M, Q = list(map(int, input().split())) # 数字
Q = [list(map(int, input().split())) for i in range(Q)] # 数字複数列、複数行
import itertools
A = []
for i in itertools.combinations_with_replacement(list(range(M)), N):
score = 0
for j in range(len(Q)):
if i[Q[j][1] - 1] - i[Q[j][0] - 1] == Q[j][2]:
... | false | 38.095238 | [
"-A = []",
"-for i in range(1, M + 1):",
"- A.append(i)",
"-B = []",
"-for i in itertools.combinations_with_replacement(A, N):",
"- B.append(i)",
"-C = []",
"-for i in range(len(B)):",
"+A = []",
"+for i in itertools.combinations_with_replacement(list(range(M)), N):",
"- if B[i][Q[j... | false | 0.126297 | 0.075073 | 1.682338 | [
"s078629948",
"s304405815"
] |
u882370611 | p02982 | python | s615373486 | s222009398 | 150 | 17 | 12,472 | 3,060 | Accepted | Accepted | 88.67 | import numpy as np
n,d=list(map(int,input().split()))
v=[]
for i in range(n):
v.append(np.array(list(map(int,input().split()))))
ans=0
for i in range(n-1):
for j in range(i+1,n):
dist=np.linalg.norm(v[i]-v[j], ord = 2)
if int(dist) == dist:
ans += 1
print(ans) | n, d = list(map(int, input().split()))
v = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
for j in range(i+1, n):
dist = 0
for k in range(d):
dist += (v[i][k]-v[j][k])**2
dist = dist**(1/2)
if dist.is_integer():
ans += 1
print(ans)
| 14 | 12 | 289 | 305 | import numpy as np
n, d = list(map(int, input().split()))
v = []
for i in range(n):
v.append(np.array(list(map(int, input().split()))))
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
dist = np.linalg.norm(v[i] - v[j], ord=2)
if int(dist) == dist:
ans += 1
print(ans)
| n, d = list(map(int, input().split()))
v = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
for j in range(i + 1, n):
dist = 0
for k in range(d):
dist += (v[i][k] - v[j][k]) ** 2
dist = dist ** (1 / 2)
if dist.is_integer():
ans +=... | false | 14.285714 | [
"-import numpy as np",
"-",
"-v = []",
"+v = [list(map(int, input().split())) for i in range(n)]",
"+ans = 0",
"- v.append(np.array(list(map(int, input().split()))))",
"-ans = 0",
"-for i in range(n - 1):",
"- dist = np.linalg.norm(v[i] - v[j], ord=2)",
"- if int(dist) == dist:",
... | false | 0.252699 | 0.036315 | 6.958579 | [
"s615373486",
"s222009398"
] |
u133936772 | p03013 | python | s649185802 | s826282558 | 208 | 87 | 11,884 | 11,884 | Accepted | Accepted | 58.17 | n,m=list(map(int,input().split()))
l=set(int(eval(input()))-1 for _ in range(m))
s,t=0,1
for i in range(n): s,t=t,(s+t)%(10**9+7)*(1-(i in l))
print(t) | import sys
f=sys.stdin.readline
n,m=list(map(int,f().split()))
l=set(int(f())-1 for _ in range(m))
s,t=0,1
for i in range(n): s,t=t,(s+t)%(10**9+7)*(1-(i in l))
print(t) | 5 | 7 | 143 | 169 | n, m = list(map(int, input().split()))
l = set(int(eval(input())) - 1 for _ in range(m))
s, t = 0, 1
for i in range(n):
s, t = t, (s + t) % (10**9 + 7) * (1 - (i in l))
print(t)
| import sys
f = sys.stdin.readline
n, m = list(map(int, f().split()))
l = set(int(f()) - 1 for _ in range(m))
s, t = 0, 1
for i in range(n):
s, t = t, (s + t) % (10**9 + 7) * (1 - (i in l))
print(t)
| false | 28.571429 | [
"-n, m = list(map(int, input().split()))",
"-l = set(int(eval(input())) - 1 for _ in range(m))",
"+import sys",
"+",
"+f = sys.stdin.readline",
"+n, m = list(map(int, f().split()))",
"+l = set(int(f()) - 1 for _ in range(m))"
] | false | 0.040864 | 0.041697 | 0.98003 | [
"s649185802",
"s826282558"
] |
u571281863 | p02678 | python | s289420932 | s033146832 | 1,387 | 639 | 36,752 | 95,064 | Accepted | Accepted | 53.93 | from collections import deque
N,M=list(map(int,input().split()))
to=[[] for _ in range(N)]
for _ in range(M):
a,b=list(map(int,input().split()))
to[a-1].append(b-1)
to[b-1].append(a-1)
q=deque([0])
r=deque([None]*N)
r[0]=0
while q:
x=q.popleft()
for i in to[x]:
if r[i] is None:
q.app... | from collections import deque
N,M=list(map(int,input().split()))
to=[[] for _ in range(N)]
for _ in range(M):
a,b=list(map(int,input().split()))
to[a-1].append(b-1)
to[b-1].append(a-1)
q=deque([0])
r=[None]*N
r[0]=0
while q:
x=q.popleft()
for i in to[x]:
if r[i] is None:
q.append(i)
... | 22 | 22 | 409 | 397 | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
to[a - 1].append(b - 1)
to[b - 1].append(a - 1)
q = deque([0])
r = deque([None] * N)
r[0] = 0
while q:
x = q.popleft()
for i in to[x]:
i... | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
to[a - 1].append(b - 1)
to[b - 1].append(a - 1)
q = deque([0])
r = [None] * N
r[0] = 0
while q:
x = q.popleft()
for i in to[x]:
if r[i] ... | false | 0 | [
"-r = deque([None] * N)",
"+r = [None] * N",
"-r.popleft()",
"-for i in range(N - 1):",
"- print((r.popleft()))",
"+for i in range(N):",
"+ if r[i] != 0:",
"+ print((r[i]))"
] | false | 0.054411 | 0.053579 | 1.015531 | [
"s289420932",
"s033146832"
] |
u983918956 | p03035 | python | s396158548 | s923210444 | 22 | 17 | 3,064 | 2,940 | Accepted | Accepted | 22.73 | A,B = list(map(int,input().split()))
if A <= 5:
print((0))
elif 6 <= A <= 12:
print((B//2))
else:
print(B) | A,B = list(map(int,input().split()))
if A >= 13:
print(B)
elif A >= 6:
print((B//2))
else:
print((0)) | 7 | 8 | 114 | 111 | A, B = list(map(int, input().split()))
if A <= 5:
print((0))
elif 6 <= A <= 12:
print((B // 2))
else:
print(B)
| A, B = list(map(int, input().split()))
if A >= 13:
print(B)
elif A >= 6:
print((B // 2))
else:
print((0))
| false | 12.5 | [
"-if A <= 5:",
"- print((0))",
"-elif 6 <= A <= 12:",
"+if A >= 13:",
"+ print(B)",
"+elif A >= 6:",
"- print(B)",
"+ print((0))"
] | false | 0.041281 | 0.04407 | 0.936719 | [
"s396158548",
"s923210444"
] |
u815659544 | p03208 | python | s863947125 | s698905720 | 854 | 245 | 8,212 | 7,384 | Accepted | Accepted | 71.31 | import heapq
import queue
N, K = list(map(int, input().split()))
trees = []
heapq.heapify(trees)
for _ in range(N):
heapq.heappush(trees, int(eval(input())))
ans = 1 + 10**9
q = queue.Queue(maxsize=K-1)
for _ in range(K-1):
q.put(heapq.heappop(trees))
for _ in range(N-K+1):
curmin ... |
import sys
INPUT = sys.stdin.readline
def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return list(map(int, INPUT().split()))
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()
N, K = MULTIPLE_INT_MA... | 27 | 21 | 428 | 514 | import heapq
import queue
N, K = list(map(int, input().split()))
trees = []
heapq.heapify(trees)
for _ in range(N):
heapq.heappush(trees, int(eval(input())))
ans = 1 + 10**9
q = queue.Queue(maxsize=K - 1)
for _ in range(K - 1):
q.put(heapq.heappop(trees))
for _ in range(N - K + 1):
curmin = q.get()
nex... | import sys
INPUT = sys.stdin.readline
def SINGLE_INT():
return int(INPUT())
def MULTIPLE_INT_LIST():
return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP():
return list(map(int, INPUT().split()))
def SINGLE_STRING():
return INPUT()
def MULTIPLE_STRING():
return INPUT().split()
N,... | false | 22.222222 | [
"-import heapq",
"-import queue",
"+import sys",
"-N, K = list(map(int, input().split()))",
"-trees = []",
"-heapq.heapify(trees)",
"-for _ in range(N):",
"- heapq.heappush(trees, int(eval(input())))",
"-ans = 1 + 10**9",
"-q = queue.Queue(maxsize=K - 1)",
"-for _ in range(K - 1):",
"- q... | false | 0.041919 | 0.040755 | 1.028558 | [
"s863947125",
"s698905720"
] |
u028973125 | p02572 | python | s637307842 | s742275960 | 188 | 146 | 31,468 | 31,464 | Accepted | Accepted | 22.34 | import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
# N -> 1の累積和
acum = [0 for _ in range(N+1)]
acum[0] = sum(A)
for i in range(N):
acum[i+1] = acum[i] - A[i]
mod = 10**9 + 7
ans = 0
for i in range(N):
ans += acum[i+1] * A[i]
ans %= mod
print(ans) | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
sum_a = sum(A)
for i in range(N):
sum_a -= A[i]
ans += A[i] * sum_a
ans %= mod
print(ans) | 18 | 15 | 318 | 233 | import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
# N -> 1の累積和
acum = [0 for _ in range(N + 1)]
acum[0] = sum(A)
for i in range(N):
acum[i + 1] = acum[i] - A[i]
mod = 10**9 + 7
ans = 0
for i in range(N):
ans += acum[i + 1] * A[i]
ans %= mod
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
sum_a = sum(A)
for i in range(N):
sum_a -= A[i]
ans += A[i] * sum_a
ans %= mod
print(ans)
| false | 16.666667 | [
"-N = int(sys.stdin.readline())",
"-A = list(map(int, sys.stdin.readline().split()))",
"-# N -> 1の累積和",
"-acum = [0 for _ in range(N + 1)]",
"-acum[0] = sum(A)",
"-for i in range(N):",
"- acum[i + 1] = acum[i] - A[i]",
"+input = sys.stdin.readline",
"+N = int(eval(input()))",
"+A = list(map(int... | false | 0.037558 | 0.041678 | 0.901155 | [
"s637307842",
"s742275960"
] |
u150984829 | p00489 | python | s530607785 | s180429324 | 50 | 40 | 5,664 | 5,664 | Accepted | Accepted | 20 | N=int(input())
s=[0]*N
for _ in[0]*(N*~-N//2):
a,b,c,d=map(int,input().split())
s[a-1]+=3*(c>d)+(c==d)
s[b-1]+=3*(d>c)+(d==c)
b=[[]for _ in[0]*N*3]
for i in range(N):
b[s[i]]+=[i]
r=1
for x in b[::-1]:
for y in x:
s[y]=r
if x:r+=len(x)
print(*s,sep='\n')
| def f():
N=int(input())
s=[0]*N
for _ in[0]*(N*~-N//2):
a,b,c,d=map(int,input().split())
s[a-1]+=3*(c>d)+(c==d)
s[b-1]+=3*(d>c)+(d==c)
b=[[]for _ in[0]*N*3]
for i in range(N):b[s[i]]+=[i]
r=1
for x in b[::-1]:
for y in x:s[y]=r
if x:r+=len(x)
print(*s,sep='\n')
f()
| 15 | 15 | 277 | 298 | N = int(input())
s = [0] * N
for _ in [0] * (N * ~-N // 2):
a, b, c, d = map(int, input().split())
s[a - 1] += 3 * (c > d) + (c == d)
s[b - 1] += 3 * (d > c) + (d == c)
b = [[] for _ in [0] * N * 3]
for i in range(N):
b[s[i]] += [i]
r = 1
for x in b[::-1]:
for y in x:
s[y] = r
if x:
... | def f():
N = int(input())
s = [0] * N
for _ in [0] * (N * ~-N // 2):
a, b, c, d = map(int, input().split())
s[a - 1] += 3 * (c > d) + (c == d)
s[b - 1] += 3 * (d > c) + (d == c)
b = [[] for _ in [0] * N * 3]
for i in range(N):
b[s[i]] += [i]
r = 1
for x in b[:... | false | 0 | [
"-N = int(input())",
"-s = [0] * N",
"-for _ in [0] * (N * ~-N // 2):",
"- a, b, c, d = map(int, input().split())",
"- s[a - 1] += 3 * (c > d) + (c == d)",
"- s[b - 1] += 3 * (d > c) + (d == c)",
"-b = [[] for _ in [0] * N * 3]",
"-for i in range(N):",
"- b[s[i]] += [i]",
"-r = 1",
"... | false | 0.091718 | 0.041431 | 2.213745 | [
"s530607785",
"s180429324"
] |
u076917070 | p02837 | python | s423161264 | s095519540 | 350 | 247 | 3,064 | 3,188 | Accepted | Accepted | 29.43 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [[set(), set()] for _ in range(N)]
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
A[i][y].add(x)
ans = 0
for i in... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [[set(), set()] for _ in range(N)]
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
A[i][y].add(x)
ans = 0
for i in... | 36 | 37 | 778 | 801 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [[set(), set()] for _ in range(N)]
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
A[i][y].add(x)
ans = 0
for i in range(1 << N)... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [[set(), set()] for _ in range(N)]
for i in range(N):
m = int(eval(input()))
for j in range(m):
x, y = list(map(int, input().split()))
A[i][y].add(x)
ans = 0
for i in range(1 << N)... | false | 2.702703 | [
"+ break"
] | false | 0.043097 | 0.044566 | 0.967042 | [
"s423161264",
"s095519540"
] |
u489959379 | p03911 | python | s649907090 | s173709216 | 718 | 194 | 65,624 | 39,624 | Accepted | Accepted | 72.98 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
def dfs(v):
for u in edge[v]:
if visited[u]:
continue
else:
visited[u] = True
dfs(u)
n, ... | 43 | 37 | 934 | 778 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
def dfs(v):
for u in edge[v]:
if visited[u]:
continue
else:
visited[u] = True
dfs(u)
n, m = list(map(int, inp... | false | 13.953488 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.parents = [-1] * n",
"+import sys",
"- def find(self, x):",
"- if self.parents[x] < 0:",
"- return x",
"- else:",
"- self.parents[x] = self.find(self.parents[x])",
"- ... | false | 0.043523 | 0.040158 | 1.083782 | [
"s649907090",
"s173709216"
] |
u600402037 | p03494 | python | s420041647 | s310412946 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | N = int(eval(input()))
A = [int(l) for l in input().split()]
count = 0
while True:
for i in range(N):
if A[i] / 2 ** count % 2 !=0:
break
else:
count += 1
continue
break
print(count) | n = int(eval(input()))
a_list = list(map(int, input().split()))
min_a = min(a_list)
count = 0
while min_a % 2 == 0:
min_a /= 2
count += 1
for a in a_list:
if a % 2 ** count != 0:
a_count = 0
while a % 2 == 0:
a /= 2
a_count += 1
count = a_count
... | 14 | 17 | 243 | 330 | N = int(eval(input()))
A = [int(l) for l in input().split()]
count = 0
while True:
for i in range(N):
if A[i] / 2**count % 2 != 0:
break
else:
count += 1
continue
break
print(count)
| n = int(eval(input()))
a_list = list(map(int, input().split()))
min_a = min(a_list)
count = 0
while min_a % 2 == 0:
min_a /= 2
count += 1
for a in a_list:
if a % 2**count != 0:
a_count = 0
while a % 2 == 0:
a /= 2
a_count += 1
count = a_count
print(count)
| false | 17.647059 | [
"-N = int(eval(input()))",
"-A = [int(l) for l in input().split()]",
"+n = int(eval(input()))",
"+a_list = list(map(int, input().split()))",
"+min_a = min(a_list)",
"-while True:",
"- for i in range(N):",
"- if A[i] / 2**count % 2 != 0:",
"- break",
"- else:",
"- c... | false | 0.038182 | 0.140722 | 0.271328 | [
"s420041647",
"s310412946"
] |
u072053884 | p02324 | python | s497450967 | s801889060 | 690 | 430 | 8,012 | 7,984 | Accepted | Accepted | 37.68 | import sys
f_i = sys.stdin
V, E = list(map(int, f_i.readline().split()))
# adjacency matrix
no_edge = 14001
adj = [[no_edge] * V for i in range(V)]
for i in range(V):
adj[i][i] = 0
odd_b = 0 # bit DP to record odd vertex
ans = 0
# acceptance of input
for l_i in f_i:
s, t, d = list(ma... | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""Chinese Postman Problem."""
import sys
f_i = sys.stdin
V, E = list(map(int, f_i.readline().split()))
# adjacency matrix
no_edge = 14001
adj = [[no_edge] * V for i in range(V)]
for i in range(V):
adj[i][i] = 0
odd_b = 0 # bit DP to record odd v... | 57 | 72 | 1,292 | 1,590 | import sys
f_i = sys.stdin
V, E = list(map(int, f_i.readline().split()))
# adjacency matrix
no_edge = 14001
adj = [[no_edge] * V for i in range(V)]
for i in range(V):
adj[i][i] = 0
odd_b = 0 # bit DP to record odd vertex
ans = 0
# acceptance of input
for l_i in f_i:
s, t, d = list(map(int, l_i.split()))
t... | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""Chinese Postman Problem."""
import sys
f_i = sys.stdin
V, E = list(map(int, f_i.readline().split()))
# adjacency matrix
no_edge = 14001
adj = [[no_edge] * V for i in range(V)]
for i in range(V):
adj[i][i] = 0
odd_b = 0 # bit DP to record odd vertex
ans = 0
# acceptanc... | false | 20.833333 | [
"+#! /usr/bin/python",
"+# -*- coding: utf-8 -*-",
"+\"\"\"Chinese Postman Problem.\"\"\"",
"+# A function to check if the number of 1 is odd in binary notation",
"+def odd_one(n):",
"+ ans = 0",
"+ while n:",
"+ ans ^= n & 1",
"+ n >>= 1",
"+ return ans",
"+",
"+",
"+... | false | 0.044944 | 0.139535 | 0.322099 | [
"s497450967",
"s801889060"
] |
u014333473 | p04012 | python | s934877618 | s425086677 | 31 | 28 | 9,100 | 9,100 | Accepted | Accepted | 9.68 | s=[*eval(input())];print(('NYoe s'[all([1 if s.count(i)%2==0 else 0 for i in set(s)])::2])) | s=[*eval(input())];print(('NYoe s'[all([s.count(i)%2==0 for i in set(s)])::2])) | 1 | 1 | 83 | 71 | s = [*eval(input())]
print(("NYoe s"[all([1 if s.count(i) % 2 == 0 else 0 for i in set(s)]) :: 2]))
| s = [*eval(input())]
print(("NYoe s"[all([s.count(i) % 2 == 0 for i in set(s)]) :: 2]))
| false | 0 | [
"-print((\"NYoe s\"[all([1 if s.count(i) % 2 == 0 else 0 for i in set(s)]) :: 2]))",
"+print((\"NYoe s\"[all([s.count(i) % 2 == 0 for i in set(s)]) :: 2]))"
] | false | 0.045214 | 0.04697 | 0.962618 | [
"s934877618",
"s425086677"
] |
u724687935 | p03031 | python | s401668135 | s161272219 | 42 | 35 | 3,188 | 3,064 | Accepted | Accepted | 16.67 | N, M = list(map(int, input().split()))
switch = [list(map(int, input().split())) for _ in range(M)]
B = []
for K, *S in switch:
b = 0
for k in range(K):
b += (1 << (S[k] - 1))
B.append(b)
P = list(map(int, input().split()))
ans = 0
for i in range(2 ** N):
on = True
for j, b... | def cntBit(n):
cnt = 0
while n > 0:
cnt += (n & 1)
n >>= 1
return cnt
N, M = list(map(int, input().split()))
switch = [list(map(int, input().split())) for _ in range(M)]
B = []
for K, *S in switch:
b = 0
for k in range(K):
b += (1 << (S[k] - 1))
B.appen... | 25 | 30 | 515 | 571 | N, M = list(map(int, input().split()))
switch = [list(map(int, input().split())) for _ in range(M)]
B = []
for K, *S in switch:
b = 0
for k in range(K):
b += 1 << (S[k] - 1)
B.append(b)
P = list(map(int, input().split()))
ans = 0
for i in range(2**N):
on = True
for j, b in enumerate(B):
... | def cntBit(n):
cnt = 0
while n > 0:
cnt += n & 1
n >>= 1
return cnt
N, M = list(map(int, input().split()))
switch = [list(map(int, input().split())) for _ in range(M)]
B = []
for K, *S in switch:
b = 0
for k in range(K):
b += 1 << (S[k] - 1)
B.append(b)
P = list(map(int... | false | 16.666667 | [
"+def cntBit(n):",
"+ cnt = 0",
"+ while n > 0:",
"+ cnt += n & 1",
"+ n >>= 1",
"+ return cnt",
"+",
"+",
"- for j, b in enumerate(B):",
"- cnt = 0",
"- state = b & i",
"- while state > 0:",
"- cnt += state & 1",
"- stat... | false | 0.035506 | 0.03681 | 0.964583 | [
"s401668135",
"s161272219"
] |
u636683284 | p03038 | python | s197630912 | s234372578 | 602 | 390 | 115,432 | 97,264 | Accepted | Accepted | 35.22 | from collections import Counter
import heapq
n,m = list(map(int,input().split()))
l = list(map(int,input().split()))
hq = sorted(tuple(Counter(l).items()), key=lambda x:x[0])
heapq.heapify(hq)
# print(hq)
BC = [list(map(int, input().split())) for i in range(m)]
BC = sorted(BC,key = lambda x:-x[1])
for... | import sys
import heapq
input = sys.stdin.readline
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
heapq.heapify(A)
BC = [list(map(int, input().split())) for i in range(m)]
BC = sorted(BC,key = lambda x:-x[1])
for b,c in BC:
for i in range(b):
a = heapq.heappop(A)
... | 33 | 20 | 780 | 444 | from collections import Counter
import heapq
n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
hq = sorted(tuple(Counter(l).items()), key=lambda x: x[0])
heapq.heapify(hq)
# print(hq)
BC = [list(map(int, input().split())) for i in range(m)]
BC = sorted(BC, key=lambda x: -x[1])
for b, c in BC:
... | import sys
import heapq
input = sys.stdin.readline
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
heapq.heapify(A)
BC = [list(map(int, input().split())) for i in range(m)]
BC = sorted(BC, key=lambda x: -x[1])
for b, c in BC:
for i in range(b):
a = heapq.heappop(A)
if a <... | false | 39.393939 | [
"-from collections import Counter",
"+import sys",
"+input = sys.stdin.readline",
"-l = list(map(int, input().split()))",
"-hq = sorted(tuple(Counter(l).items()), key=lambda x: x[0])",
"-heapq.heapify(hq)",
"-# print(hq)",
"+A = list(map(int, input().split()))",
"+heapq.heapify(A)",
"- while b ... | false | 0.036754 | 0.035333 | 1.040234 | [
"s197630912",
"s234372578"
] |
u667135132 | p02936 | python | s635787690 | s951508305 | 1,891 | 828 | 121,236 | 120,084 | Accepted | Accepted | 56.21 | N,Q = list(map(int,input().split()))
G=[]
for i in range(N):
G.append([])
for i in range(N-1):
a,b = list(map(int,input().split()))
a-=1
b-=1
G[a].append(b)
G[b].append(a)
p=[0]*Q
x=[0]*Q
c=[0]*N
for i in range(Q):
p,x = list(map(int,input().split()))
p-=1
c[p] +=... | import sys
from collections import deque
#N,Q = list(map(int,input().split()))
N,Q = [int(i) for i in sys.stdin.readline().split()]
G=[]
for i in range(N):
G.append([])
for i in range(N-1):
#a,b = list(map(int,input().split()))
a,b = [int(j) for j in sys.stdin.readline().split()]
a-=1
b... | 35 | 41 | 569 | 794 | N, Q = list(map(int, input().split()))
G = []
for i in range(N):
G.append([])
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
p = [0] * Q
x = [0] * Q
c = [0] * N
for i in range(Q):
p, x = list(map(int, input().split()))
p -= 1
... | import sys
from collections import deque
# N,Q = list(map(int,input().split()))
N, Q = [int(i) for i in sys.stdin.readline().split()]
G = []
for i in range(N):
G.append([])
for i in range(N - 1):
# a,b = list(map(int,input().split()))
a, b = [int(j) for j in sys.stdin.readline().split()]
a -= 1
b -... | false | 14.634146 | [
"-N, Q = list(map(int, input().split()))",
"+import sys",
"+from collections import deque",
"+",
"+# N,Q = list(map(int,input().split()))",
"+N, Q = [int(i) for i in sys.stdin.readline().split()]",
"- a, b = list(map(int, input().split()))",
"+ # a,b = list(map(int,input().split()))",
"+ a,... | false | 0.046187 | 0.097987 | 0.47136 | [
"s635787690",
"s951508305"
] |
u135346354 | p02802 | python | s733799530 | s138607987 | 382 | 311 | 3,828 | 4,596 | Accepted | Accepted | 18.59 | N,M = [int(item) for item in input().split(" ")]
result = [0]*N
wa = 0
ac = 0
for i in range(M):
p,s = [i for i in input().split(" ")]
if result[int(p)-1] != -1:
if s == 'AC':
wa += result[int(p)-1]
result[int(p)-1] = -1
ac += 1
else:
... | N, M = list(map(int, input().split()))
ans = 0
pen = 0
w = [0]*(N+1)
ac = [False]*(N+1)
for _ in range(M):
p, s = input().split()
if s == "AC" and not ac[int(p)]:
pen += w[int(p)]
ac[int(p)] = True
ans += 1
elif s == "WA":
w[int(p)] += 1
print((ans, pen)) | 19 | 14 | 392 | 304 | N, M = [int(item) for item in input().split(" ")]
result = [0] * N
wa = 0
ac = 0
for i in range(M):
p, s = [i for i in input().split(" ")]
if result[int(p) - 1] != -1:
if s == "AC":
wa += result[int(p) - 1]
result[int(p) - 1] = -1
ac += 1
else:
res... | N, M = list(map(int, input().split()))
ans = 0
pen = 0
w = [0] * (N + 1)
ac = [False] * (N + 1)
for _ in range(M):
p, s = input().split()
if s == "AC" and not ac[int(p)]:
pen += w[int(p)]
ac[int(p)] = True
ans += 1
elif s == "WA":
w[int(p)] += 1
print((ans, pen))
| false | 26.315789 | [
"-N, M = [int(item) for item in input().split(\" \")]",
"-result = [0] * N",
"-wa = 0",
"-ac = 0",
"-for i in range(M):",
"- p, s = [i for i in input().split(\" \")]",
"- if result[int(p) - 1] != -1:",
"- if s == \"AC\":",
"- wa += result[int(p) - 1]",
"- result[... | false | 0.036567 | 0.040567 | 0.901399 | [
"s733799530",
"s138607987"
] |
u596276291 | p03804 | python | s464688949 | s465227811 | 720 | 98 | 3,316 | 3,316 | Accepted | Accepted | 86.39 | from collections import defaultdict
def main():
N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
for sy in range(N):
for sx in range(N):
ok = True
for y in range(M):
for x i... | from collections import defaultdict
def main():
N, M = list(map(int, input().split()))
A, B = [], []
for _ in range(N):
A.append(eval(input()))
for _ in range(M):
B.append(eval(input()))
for y in range(N - M + 1):
for x in range(N - M + 1):
ok = Tr... | 27 | 25 | 625 | 600 | from collections import defaultdict
def main():
N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
for sy in range(N):
for sx in range(N):
ok = True
for y in range(M):
for x in range(M):
... | from collections import defaultdict
def main():
N, M = list(map(int, input().split()))
A, B = [], []
for _ in range(N):
A.append(eval(input()))
for _ in range(M):
B.append(eval(input()))
for y in range(N - M + 1):
for x in range(N - M + 1):
ok = True
... | false | 7.407407 | [
"- A = [eval(input()) for _ in range(N)]",
"- B = [eval(input()) for _ in range(M)]",
"- for sy in range(N):",
"- for sx in range(N):",
"+ A, B = [], []",
"+ for _ in range(N):",
"+ A.append(eval(input()))",
"+ for _ in range(M):",
"+ B.append(eval(input()))",
... | false | 0.041474 | 0.03487 | 1.189377 | [
"s464688949",
"s465227811"
] |
u396181190 | p03228 | python | s394290101 | s690876509 | 147 | 17 | 12,496 | 3,064 | Accepted | Accepted | 88.44 | import numpy as np
def process(src, dst):
# 偶数:何もしない
# 奇数:1枚ならべる(1枚減る)
if src % 2 == 0:
pass
else:
src -= 1
# 半分を相手に渡す
# 自分:半分減
# 相手:半分の値増
src = src / 2
dst += src
return src, dst
# 入力
indata = input().split()
A = int(indata[0])
B = int(... | # coding: utf-8
def process(src, dst):
# 偶数:何もしない
# 奇数:1枚ならべる(1枚減る)
if src % 2 == 0:
pass
else:
src -= 1
# 半分を相手に渡す
# 自分:半分減
# 相手:半分の値増
src = src / 2
dst += src
return src, dst
# 入力
indata = input().split()
A = int(indata[0])
B = int(indat... | 40 | 39 | 637 | 632 | import numpy as np
def process(src, dst):
# 偶数:何もしない
# 奇数:1枚ならべる(1枚減る)
if src % 2 == 0:
pass
else:
src -= 1
# 半分を相手に渡す
# 自分:半分減
# 相手:半分の値増
src = src / 2
dst += src
return src, dst
# 入力
indata = input().split()
A = int(indata[0])
B = int(indata[1])
K = int(inda... | # coding: utf-8
def process(src, dst):
# 偶数:何もしない
# 奇数:1枚ならべる(1枚減る)
if src % 2 == 0:
pass
else:
src -= 1
# 半分を相手に渡す
# 自分:半分減
# 相手:半分の値増
src = src / 2
dst += src
return src, dst
# 入力
indata = input().split()
A = int(indata[0])
B = int(indata[1])
K = int(indata[2]... | false | 2.5 | [
"-import numpy as np",
"-",
"-",
"+# coding: utf-8"
] | false | 0.038122 | 0.039546 | 0.963992 | [
"s394290101",
"s690876509"
] |
u678167152 | p03473 | python | s227841949 | s517534197 | 172 | 66 | 38,384 | 61,668 | Accepted | Accepted | 61.63 | M = int(eval(input()))
ans = 48-M
print(ans) | def solve():
M = int(eval(input()))
ans = 48-M
return ans
print((solve())) | 4 | 5 | 42 | 82 | M = int(eval(input()))
ans = 48 - M
print(ans)
| def solve():
M = int(eval(input()))
ans = 48 - M
return ans
print((solve()))
| false | 20 | [
"-M = int(eval(input()))",
"-ans = 48 - M",
"-print(ans)",
"+def solve():",
"+ M = int(eval(input()))",
"+ ans = 48 - M",
"+ return ans",
"+",
"+",
"+print((solve()))"
] | false | 0.041328 | 0.076728 | 0.538625 | [
"s227841949",
"s517534197"
] |
u352394527 | p00465 | python | s942916288 | s340761941 | 2,270 | 1,940 | 58,420 | 61,844 | Accepted | Accepted | 14.54 | from heapq import heappop as pop
from heapq import heappush as push
INF = 1000000000000
while True:
R = int(eval(input()))
if not R:
break
w1, h1, x1, y1 = list(map(int, input().split()))
x1 -= 1
y1 -= 1
lst1 = [list(map(int, input().split())) for _ in range(h1)]
used1 = [[False] * w1 for _... | from heapq import heappop as pop
from heapq import heappush as push
INF = 1000000000000
def solve():
while True:
R = int(eval(input()))
if not R:
break
w1, h1, x1, y1 = list(map(int, input().split()))
x1 -= 1
y1 -= 1
lst1 = [list(map(int, input().split())) for _ in range(h1)... | 91 | 95 | 2,123 | 2,308 | from heapq import heappop as pop
from heapq import heappush as push
INF = 1000000000000
while True:
R = int(eval(input()))
if not R:
break
w1, h1, x1, y1 = list(map(int, input().split()))
x1 -= 1
y1 -= 1
lst1 = [list(map(int, input().split())) for _ in range(h1)]
used1 = [[False] * ... | from heapq import heappop as pop
from heapq import heappush as push
INF = 1000000000000
def solve():
while True:
R = int(eval(input()))
if not R:
break
w1, h1, x1, y1 = list(map(int, input().split()))
x1 -= 1
y1 -= 1
lst1 = [list(map(int, input().split(... | false | 4.210526 | [
"-while True:",
"- R = int(eval(input()))",
"- if not R:",
"- break",
"- w1, h1, x1, y1 = list(map(int, input().split()))",
"- x1 -= 1",
"- y1 -= 1",
"- lst1 = [list(map(int, input().split())) for _ in range(h1)]",
"- used1 = [[False] * w1 for _ in range(h1)]",
"- w2... | false | 0.051501 | 0.047821 | 1.076947 | [
"s942916288",
"s340761941"
] |
u760831084 | p03556 | python | s122080464 | s904048563 | 37 | 17 | 2,940 | 2,940 | Accepted | Accepted | 54.05 | import math
N = int(eval(input()))
for i in reversed(list(range(N))):
n = math.sqrt(N)
if n.is_integer():
print((int(n ** 2)))
exit()
N -= 1 | import math
N = int(eval(input()))
n = int(math.sqrt(N))
print((n ** 2)) | 9 | 5 | 163 | 69 | import math
N = int(eval(input()))
for i in reversed(list(range(N))):
n = math.sqrt(N)
if n.is_integer():
print((int(n**2)))
exit()
N -= 1
| import math
N = int(eval(input()))
n = int(math.sqrt(N))
print((n**2))
| false | 44.444444 | [
"-for i in reversed(list(range(N))):",
"- n = math.sqrt(N)",
"- if n.is_integer():",
"- print((int(n**2)))",
"- exit()",
"- N -= 1",
"+n = int(math.sqrt(N))",
"+print((n**2))"
] | false | 0.091338 | 0.05986 | 1.52586 | [
"s122080464",
"s904048563"
] |
u863370423 | p02987 | python | s559603973 | s467128526 | 162 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.51 | a = list(eval(input()))
s= set(a)
l = list(s)
if len(a) == 4 and len(s) == 2 and a.count(l[0]) ==2 and a.count(l[1]) ==2:
print('Yes')
else:
print('No') | let = set(eval(input()))
print(({True: 'Yes', False: 'No'}[len(let) == 2]))
| 7 | 2 | 167 | 69 | a = list(eval(input()))
s = set(a)
l = list(s)
if len(a) == 4 and len(s) == 2 and a.count(l[0]) == 2 and a.count(l[1]) == 2:
print("Yes")
else:
print("No")
| let = set(eval(input()))
print(({True: "Yes", False: "No"}[len(let) == 2]))
| false | 71.428571 | [
"-a = list(eval(input()))",
"-s = set(a)",
"-l = list(s)",
"-if len(a) == 4 and len(s) == 2 and a.count(l[0]) == 2 and a.count(l[1]) == 2:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+let = set(eval(input()))",
"+print(({True: \"Yes\", False: \"No\"}[len(let) == 2]))"
] | false | 0.082844 | 0.035698 | 2.320676 | [
"s559603973",
"s467128526"
] |
u013629972 | p03089 | python | s594009969 | s565547400 | 315 | 291 | 66,924 | 65,388 | Accepted | Accepted | 7.62 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
d... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
d... | 37 | 38 | 1,080 | 1,069 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI... | false | 2.631579 | [
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in input().split()]"
] | false | 0.042315 | 0.115274 | 0.367082 | [
"s594009969",
"s565547400"
] |
u411203878 | p03089 | python | s315735426 | s741459952 | 177 | 67 | 40,428 | 64,376 | Accepted | Accepted | 62.15 | n=int(eval(input()))
ball = list(map(int,input().split()))
ans = []
count = 0
while len(ball)>0:
count += 1
for i in range(len(ball)-1,-1,-1):
#print(ball,i)
if i+1 ==ball[i]:
move = ball.pop(i)
ans.insert(0,move)
break
if count ==10000... | n = int(eval(input()))
b = list(map(int,input().split()))
Flag = True
memo = []
while Flag:
Flag = False
index = -1
for i, v in enumerate(b):
if i == v-1:
Flag = True
index = i
if index != -1:
m = b.pop(index)
memo.append(m)
if len(b)... | 25 | 24 | 417 | 397 | n = int(eval(input()))
ball = list(map(int, input().split()))
ans = []
count = 0
while len(ball) > 0:
count += 1
for i in range(len(ball) - 1, -1, -1):
# print(ball,i)
if i + 1 == ball[i]:
move = ball.pop(i)
ans.insert(0, move)
break
if count == 100000:
... | n = int(eval(input()))
b = list(map(int, input().split()))
Flag = True
memo = []
while Flag:
Flag = False
index = -1
for i, v in enumerate(b):
if i == v - 1:
Flag = True
index = i
if index != -1:
m = b.pop(index)
memo.append(m)
if len(b):
print((-1))
e... | false | 4 | [
"-ball = list(map(int, input().split()))",
"-ans = []",
"-count = 0",
"-while len(ball) > 0:",
"- count += 1",
"- for i in range(len(ball) - 1, -1, -1):",
"- # print(ball,i)",
"- if i + 1 == ball[i]:",
"- move = ball.pop(i)",
"- ans.insert(0, move)",
"- ... | false | 0.309344 | 0.044859 | 6.89592 | [
"s315735426",
"s741459952"
] |
u179169725 | p02615 | python | s423876543 | s675589055 | 144 | 133 | 102,312 | 102,180 | Accepted | Accepted | 7.64 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int(): return int(read... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int(): return int(read... | 80 | 85 | 1,679 | 1,781 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int():
return int(read())
d... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int():
return int(read())
d... | false | 5.882353 | [
"-# 貪欲に大きい方だと思うんだけど違うのかな",
"-# 貪欲でない反例 (わからん)",
"+# https://atcoder.jp/contests/abc173/tasks/abc173_d",
"+# 大きい方から使いそう",
"-A.sort()",
"-ans = A.pop()",
"-N -= 2",
"-while N > 1:",
"- N -= 2",
"- ans += 2 * A.pop()",
"-if N == 1:",
"- ans += A.pop()",
"+A.sort(reverse=True)",
"+ans... | false | 0.049339 | 0.047199 | 1.045329 | [
"s423876543",
"s675589055"
] |
u392319141 | p03564 | python | s322945564 | s696362147 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | N = int(eval(input()))
K = int(eval(input()))
ans = 10**18
for state in range(1 << N):
now = 1
for d in range(N):
if (state & (1 << d)) == 0:
now *= 2
else:
now += K
ans = min(ans, now)
print(ans)
| N = int(eval(input()))
K = int(eval(input()))
ans = 1
for _ in range(N):
if ans < K:
ans *= 2
else:
ans += K
print(ans)
| 13 | 10 | 250 | 142 | N = int(eval(input()))
K = int(eval(input()))
ans = 10**18
for state in range(1 << N):
now = 1
for d in range(N):
if (state & (1 << d)) == 0:
now *= 2
else:
now += K
ans = min(ans, now)
print(ans)
| N = int(eval(input()))
K = int(eval(input()))
ans = 1
for _ in range(N):
if ans < K:
ans *= 2
else:
ans += K
print(ans)
| false | 23.076923 | [
"-ans = 10**18",
"-for state in range(1 << N):",
"- now = 1",
"- for d in range(N):",
"- if (state & (1 << d)) == 0:",
"- now *= 2",
"- else:",
"- now += K",
"- ans = min(ans, now)",
"+ans = 1",
"+for _ in range(N):",
"+ if ans < K:",
"+ ... | false | 0.049104 | 0.0461 | 1.065162 | [
"s322945564",
"s696362147"
] |
u969850098 | p03208 | python | s767603423 | s968510608 | 229 | 138 | 8,280 | 8,256 | Accepted | Accepted | 39.74 | N, K = list(map(int, input().split()))
heights = sorted([int(eval(input())) for _ in range(N)])
ans = float('inf')
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans) | import sys
input = sys.stdin.readline
N, K = list(map(int, input().rstrip().split()))
heights = sorted([int(input().rstrip()) for _ in range(N)])
ans = float('inf')
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans) | 7 | 9 | 248 | 306 | N, K = list(map(int, input().split()))
heights = sorted([int(eval(input())) for _ in range(N)])
ans = float("inf")
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans)
| import sys
input = sys.stdin.readline
N, K = list(map(int, input().rstrip().split()))
heights = sorted([int(input().rstrip()) for _ in range(N)])
ans = float("inf")
for i in range(N - K + 1):
if abs(heights[i] - heights[i + K - 1]) < ans:
ans = abs(heights[i] - heights[i + K - 1])
print(ans)
| false | 22.222222 | [
"-N, K = list(map(int, input().split()))",
"-heights = sorted([int(eval(input())) for _ in range(N)])",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+N, K = list(map(int, input().rstrip().split()))",
"+heights = sorted([int(input().rstrip()) for _ in range(N)])"
] | false | 0.085209 | 0.040168 | 2.121324 | [
"s767603423",
"s968510608"
] |
u465699806 | p03401 | python | s807964523 | s307140091 | 409 | 320 | 66,848 | 59,168 | Accepted | Accepted | 21.76 | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
args = sys.argv
input = sys.stdin.readline
def dump(*objects):
if len(args) == 2 and args[1] == "DEBUG":
print(*objects, file=sys.stderr)
N = int(input())
A = [0]... | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
args = sys.argv
input = sys.stdin.readline
def dump(*objects):
if len(args) == 2 and args[1] == "DEBUG":
print(*objects, file=sys.stderr)
N = int(input())
A = [0]... | 32 | 32 | 746 | 738 | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
args = sys.argv
input = sys.stdin.readline
def dump(*objects):
if len(args) == 2 and args[1] == "DEBUG":
print(*objects, file=sys.stderr)
N = int(input())
A = [0] + list(map(int... | import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
args = sys.argv
input = sys.stdin.readline
def dump(*objects):
if len(args) == 2 and args[1] == "DEBUG":
print(*objects, file=sys.stderr)
N = int(input())
A = [0] + list(map(int... | false | 0 | [
"-B = cp.deepcopy(A)",
"-C = cp.deepcopy(A)",
"+B = [0] * len(A)",
"+C = [0] * len(A)"
] | false | 0.050674 | 0.048699 | 1.04055 | [
"s807964523",
"s307140091"
] |
u853185302 | p03160 | python | s146669969 | s025715490 | 549 | 201 | 22,744 | 13,924 | Accepted | Accepted | 63.39 | import numpy as np
N = int(eval(input()))
h = list(map(int,input().split()))
memo = np.zeros(N)
memo[0] = 0
memo[1] = abs(h[0]-h[1])
for i in range(2,N):
a = memo[i-1] + abs(h[i] - h[i-1])
b = memo[i-2] + abs(h[i] - h[i-2])
memo[i] = min(a,b)
print((int(memo[N-1]))) | n = int(eval(input()))
h = list(map(int,input().split()))
dp = [10**7]*n
dp[0] = 0
for i in range(1,n):
dp[i] = min([dp[i-j]+abs(h[i]-h[i-j]) for j in range(1,min(3,i+1))])
print((dp[n-1]))
| 15 | 8 | 282 | 193 | import numpy as np
N = int(eval(input()))
h = list(map(int, input().split()))
memo = np.zeros(N)
memo[0] = 0
memo[1] = abs(h[0] - h[1])
for i in range(2, N):
a = memo[i - 1] + abs(h[i] - h[i - 1])
b = memo[i - 2] + abs(h[i] - h[i - 2])
memo[i] = min(a, b)
print((int(memo[N - 1])))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [10**7] * n
dp[0] = 0
for i in range(1, n):
dp[i] = min([dp[i - j] + abs(h[i] - h[i - j]) for j in range(1, min(3, i + 1))])
print((dp[n - 1]))
| false | 46.666667 | [
"-import numpy as np",
"-",
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-memo = np.zeros(N)",
"-memo[0] = 0",
"-memo[1] = abs(h[0] - h[1])",
"-for i in range(2, N):",
"- a = memo[i - 1] + abs(h[i] - h[i - 1])",
"- b = memo[i - 2] + abs(h[i] - h[i - 2])",
"- memo[i] = min(a, b... | false | 0.195226 | 0.036982 | 5.278979 | [
"s146669969",
"s025715490"
] |
u463630127 | p02924 | python | s482036881 | s293488360 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 | n=int(eval(input()))
ans=n*(n-1)//2
print((int(ans)))
| n=int(eval(input()))
ans=n*(n-1)/2
print((int(ans)))
| 3 | 3 | 48 | 48 | n = int(eval(input()))
ans = n * (n - 1) // 2
print((int(ans)))
| n = int(eval(input()))
ans = n * (n - 1) / 2
print((int(ans)))
| false | 0 | [
"-ans = n * (n - 1) // 2",
"+ans = n * (n - 1) / 2"
] | false | 0.097198 | 0.086386 | 1.125157 | [
"s482036881",
"s293488360"
] |
u123518636 | p03277 | python | s753162379 | s540209863 | 744 | 626 | 139,508 | 110,324 | Accepted | Accepted | 15.86 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq
# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7
def solve(f):
n = f.read_int()
a = f.read_int_list()
if n == 1: return a[0]
d... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq
# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7
def solve(f):
n = f.read_int()
a = f.read_int_list()
def check(num):
aa = [... | 107 | 98 | 2,983 | 2,734 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, collections, itertools, re, math, fractions, decimal, random, array, bisect, heapq
# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7
def solve(f):
n = f.read_int()
a = f.read_int_list()
if n == 1:
return a[0]
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, collections, itertools, re, math, fractions, decimal, random, array, bisect, heapq
# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7
def solve(f):
n = f.read_int()
a = f.read_int_list()
def check(num):
aa = [10**... | false | 8.411215 | [
"- if n == 1:",
"- return a[0]",
"- d = dict(list(zip(sorted(set(a)), list(range(len(a))))))",
"- a1 = [0] * (n + 1)",
"- a2 = [0] * (n + 1)",
"+ aa = [10**5 + 1] * (n + 1)",
"- a1[i + 1] = a1[i] + 1",
"- a2[i + 1] = a2[i]",
"+ ... | false | 1.269797 | 1.703776 | 0.745284 | [
"s753162379",
"s540209863"
] |
u192154323 | p03274 | python | s115427043 | s826913916 | 121 | 92 | 14,480 | 20,340 | Accepted | Accepted | 23.97 | n,k = list(map(int,input().split()))
x_ls = list(map(int, input().split()))
ans = float('inf')
for i in range(n-k+1):
if x_ls[i+k-1] < 0:
ans = min(ans, abs(x_ls[i]))
elif x_ls[i] < 0 and x_ls[i+k-1] >= 0:
near = min(abs(x_ls[i]),abs(x_ls[i+k-1]))
far = max(abs(x_ls[i]),abs(x_ls[... | import sys
n,k = list(map(int,input().split()))
x_ls = list(map(int, input().split()))
x_ls.sort()
if x_ls[0] >= 0:
print((x_ls[k-1]))
sys.exit()
elif x_ls[-1] <= 0:
x_ls.sort(reverse=True)
print((abs(x_ls[k-1])))
sys.exit()
l = 0
r = k - 1
ans = float('inf')
while r < n:
cost_1 =... | 13 | 23 | 435 | 483 | n, k = list(map(int, input().split()))
x_ls = list(map(int, input().split()))
ans = float("inf")
for i in range(n - k + 1):
if x_ls[i + k - 1] < 0:
ans = min(ans, abs(x_ls[i]))
elif x_ls[i] < 0 and x_ls[i + k - 1] >= 0:
near = min(abs(x_ls[i]), abs(x_ls[i + k - 1]))
far = max(abs(x_ls[i]... | import sys
n, k = list(map(int, input().split()))
x_ls = list(map(int, input().split()))
x_ls.sort()
if x_ls[0] >= 0:
print((x_ls[k - 1]))
sys.exit()
elif x_ls[-1] <= 0:
x_ls.sort(reverse=True)
print((abs(x_ls[k - 1])))
sys.exit()
l = 0
r = k - 1
ans = float("inf")
while r < n:
cost_1 = 2 * abs... | false | 43.478261 | [
"+import sys",
"+",
"+x_ls.sort()",
"+if x_ls[0] >= 0:",
"+ print((x_ls[k - 1]))",
"+ sys.exit()",
"+elif x_ls[-1] <= 0:",
"+ x_ls.sort(reverse=True)",
"+ print((abs(x_ls[k - 1])))",
"+ sys.exit()",
"+l = 0",
"+r = k - 1",
"-for i in range(n - k + 1):",
"- if x_ls[i + k -... | false | 0.066419 | 0.035055 | 1.894739 | [
"s115427043",
"s826913916"
] |
u272028993 | p03662 | python | s650739022 | s068676184 | 691 | 578 | 151,836 | 132,892 | Accepted | Accepted | 16.35 | import sys
sys.setrecursionlimit(10**8)
def find_path(now, par):
if now == n - 1:
path.append(n - 1)
return True
for to in g[now]:
if to == par: continue
if find_path(to, now):
path.append(now)
return True
return False
def dfs1(now, par... | import sys
sys.setrecursionlimit(10**8)
def find_path(now, par):
if now == n - 1:
path.append(n - 1)
return True
for to in g[now]:
if to == par: continue
if find_path(to, now):
path.append(now)
return True
return False
def dfs(now, par,... | 65 | 54 | 1,369 | 1,126 | import sys
sys.setrecursionlimit(10**8)
def find_path(now, par):
if now == n - 1:
path.append(n - 1)
return True
for to in g[now]:
if to == par:
continue
if find_path(to, now):
path.append(now)
return True
return False
def dfs1(now, pa... | import sys
sys.setrecursionlimit(10**8)
def find_path(now, par):
if now == n - 1:
path.append(n - 1)
return True
for to in g[now]:
if to == par:
continue
if find_path(to, now):
path.append(now)
return True
return False
def dfs(now, par... | false | 16.923077 | [
"-def dfs1(now, par, color):",
"+def dfs(now, par, color):",
"- dfs1(to, now, color)",
"-",
"-",
"-def dfs2(now, par, color):",
"- color[now] = \"w\"",
"- for to in g[now]:",
"- if to == par:",
"- continue",
"- if color[to] == \"b\":",
"- contin... | false | 0.007867 | 0.035672 | 0.220542 | [
"s650739022",
"s068676184"
] |
u133356863 | p02987 | python | s918233591 | s756224510 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | import collections
s=eval(input())
print(('Yes'if len(set(s))==2 and collections.Counter(s).most_common()[0][1]==2 else 'No')) | s=eval(input())
print(('Yes'if len(set(s))==2 and s.count(s[0])==2 else 'No')) | 4 | 2 | 122 | 71 | import collections
s = eval(input())
print(
(
"Yes"
if len(set(s)) == 2 and collections.Counter(s).most_common()[0][1] == 2
else "No"
)
)
| s = eval(input())
print(("Yes" if len(set(s)) == 2 and s.count(s[0]) == 2 else "No"))
| false | 50 | [
"-import collections",
"-",
"-print(",
"- (",
"- \"Yes\"",
"- if len(set(s)) == 2 and collections.Counter(s).most_common()[0][1] == 2",
"- else \"No\"",
"- )",
"-)",
"+print((\"Yes\" if len(set(s)) == 2 and s.count(s[0]) == 2 else \"No\"))"
] | false | 0.047304 | 0.046777 | 1.011263 | [
"s918233591",
"s756224510"
] |
u226108478 | p03681 | python | s408145845 | s297585087 | 57 | 29 | 3,060 | 3,064 | Accepted | Accepted | 49.12 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
n, m = list(map(int, input().split()))
diff = abs(n - m)
n_factorial = 1
m_factorial = 1
large_number = 10 ** 9 + 7
for i in range(1, n + 1):
n_factorial = (n_factorial * i) % large_... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
large_number = 10 ** 9 + 7
def factorial(number: int) -> int:
value = 1
for i in range(1, number + 1):
value = (value * i) % large_number
return value
if __name__ == '__main__':
n, m = list(map(int, input().spli... | 26 | 30 | 576 | 698 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
n, m = list(map(int, input().split()))
diff = abs(n - m)
n_factorial = 1
m_factorial = 1
large_number = 10**9 + 7
for i in range(1, n + 1):
n_factorial = (n_factorial * i) % large_number
for k i... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
large_number = 10**9 + 7
def factorial(number: int) -> int:
value = 1
for i in range(1, number + 1):
value = (value * i) % large_number
return value
if __name__ == "__main__":
n, m = list(map(int, input().split()))
diff = abs... | false | 13.333333 | [
"+large_number = 10**9 + 7",
"+",
"+",
"+def factorial(number: int) -> int:",
"+ value = 1",
"+ for i in range(1, number + 1):",
"+ value = (value * i) % large_number",
"+ return value",
"+",
"+",
"- n_factorial = 1",
"- m_factorial = 1",
"- large_number = 10**9 + 7"... | false | 0.03838 | 0.074014 | 0.518548 | [
"s408145845",
"s297585087"
] |
u844789719 | p03363 | python | s399180067 | s708515201 | 355 | 291 | 25,852 | 26,136 | Accepted | Accepted | 18.03 | import heapq
N = int(eval(input()))
A = [int(_) for _ in input().split()]
cumsum = [0]
for a in A:
cumsum += [cumsum[-1] + a]
heapq.heapify(cumsum)
before = 10 ** 10
count = 0
ans = 0
while cumsum:
now = heapq.heappop(cumsum)
count += before == now
if not (before == now and cumsum):
... | N = int(eval(input()))
A = [int(_) for _ in input().split()]
cumsum = [0]
for a in A:
cumsum += [cumsum[-1] + a]
cumsum.sort()
ans = 0
count = 0
for i in range(N):
if cumsum[i] == cumsum[i + 1]:
count += 1
if cumsum[i] != cumsum[i + 1] or i == N - 1:
ans += count * (count + 1) //... | 18 | 15 | 397 | 348 | import heapq
N = int(eval(input()))
A = [int(_) for _ in input().split()]
cumsum = [0]
for a in A:
cumsum += [cumsum[-1] + a]
heapq.heapify(cumsum)
before = 10**10
count = 0
ans = 0
while cumsum:
now = heapq.heappop(cumsum)
count += before == now
if not (before == now and cumsum):
ans += count ... | N = int(eval(input()))
A = [int(_) for _ in input().split()]
cumsum = [0]
for a in A:
cumsum += [cumsum[-1] + a]
cumsum.sort()
ans = 0
count = 0
for i in range(N):
if cumsum[i] == cumsum[i + 1]:
count += 1
if cumsum[i] != cumsum[i + 1] or i == N - 1:
ans += count * (count + 1) // 2
c... | false | 16.666667 | [
"-import heapq",
"-",
"-heapq.heapify(cumsum)",
"-before = 10**10",
"+cumsum.sort()",
"+ans = 0",
"-ans = 0",
"-while cumsum:",
"- now = heapq.heappop(cumsum)",
"- count += before == now",
"- if not (before == now and cumsum):",
"+for i in range(N):",
"+ if cumsum[i] == cumsum[i ... | false | 0.035266 | 0.034177 | 1.03186 | [
"s399180067",
"s708515201"
] |
u579699847 | p03497 | python | s477518223 | s634198986 | 125 | 113 | 32,564 | 32,540 | Accepted | Accepted | 9.6 | import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,K = LI()
A = collections.Counter(LI())
count_A = sorted([v for _,v in list(A.items())])
remainder = max(0,len(A)-K)
print((sum(count_A[:remainder])))
| import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,K = LI()
A = collections.Counter(LI())
count_A = sorted([v for v in list(A.values())])
remainder = max(0,len(A)-K)
print((sum(count_A[:remainder])))
| 7 | 7 | 243 | 242 | import collections, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, K = LI()
A = collections.Counter(LI())
count_A = sorted([v for _, v in list(A.items())])
remainder = max(0, len(A) - K)
print((sum(count_A[:remainder])))
| import collections, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, K = LI()
A = collections.Counter(LI())
count_A = sorted([v for v in list(A.values())])
remainder = max(0, len(A) - K)
print((sum(count_A[:remainder])))
| false | 0 | [
"-count_A = sorted([v for _, v in list(A.items())])",
"+count_A = sorted([v for v in list(A.values())])"
] | false | 0.03316 | 0.041883 | 0.791734 | [
"s477518223",
"s634198986"
] |
u086503932 | p03682 | python | s219762535 | s196432100 | 1,895 | 1,742 | 61,676 | 119,592 | Accepted | Accepted | 8.07 | from heapq import heappush, heappop
class UnionFind():
def __init__(self, n):
self.parents = list(range(n))
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
... | from heapq import heappop, heappush
class UnionFind():
def __init__(self, n):
self.parents = list(range(n))
self.size = [1] * n
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
... | 51 | 47 | 1,086 | 1,089 | from heapq import heappush, heappop
class UnionFind:
def __init__(self, n):
self.parents = list(range(n))
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(s... | from heapq import heappop, heappush
class UnionFind:
def __init__(self, n):
self.parents = list(range(n))
self.size = [1] * n
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self... | false | 7.843137 | [
"-from heapq import heappush, heappop",
"+from heapq import heappop, heappush",
"+ self.size = [1] * n",
"+ if self.size[x] < self.size[y]:",
"+ x, y = y, x",
"+ self.size[x] += self.size[y]",
"-q = []",
"-ans = 0",
"-S = UnionFind(N)",
"-x = []",
"-y ... | false | 0.047761 | 0.045471 | 1.050363 | [
"s219762535",
"s196432100"
] |
u118645446 | p03455 | python | s062228075 | s889654243 | 30 | 18 | 3,700 | 2,940 | Accepted | Accepted | 40 | import operator
import functools
number_list = list(map(int, input().split()))
product = functools.reduce(operator.mul, number_list)
if product % 2 == 0:
print('Even')
else:
print('Odd') | a, b = list(map(int, input().split()))
if (a * b % 2) == 0:
print('Even')
else:
print('Odd') | 8 | 5 | 201 | 98 | import operator
import functools
number_list = list(map(int, input().split()))
product = functools.reduce(operator.mul, number_list)
if product % 2 == 0:
print("Even")
else:
print("Odd")
| a, b = list(map(int, input().split()))
if (a * b % 2) == 0:
print("Even")
else:
print("Odd")
| false | 37.5 | [
"-import operator",
"-import functools",
"-",
"-number_list = list(map(int, input().split()))",
"-product = functools.reduce(operator.mul, number_list)",
"-if product % 2 == 0:",
"+a, b = list(map(int, input().split()))",
"+if (a * b % 2) == 0:"
] | false | 0.043212 | 0.085704 | 0.504202 | [
"s062228075",
"s889654243"
] |
u706695185 | p03493 | python | s439194300 | s469674344 | 176 | 19 | 38,256 | 2,940 | Accepted | Accepted | 89.2 | s = eval(input())
print((s.count('1'))) | abc = eval(input())
print((abc.count('1'))) | 2 | 2 | 32 | 36 | s = eval(input())
print((s.count("1")))
| abc = eval(input())
print((abc.count("1")))
| false | 0 | [
"-s = eval(input())",
"-print((s.count(\"1\")))",
"+abc = eval(input())",
"+print((abc.count(\"1\")))"
] | false | 0.121653 | 0.007323 | 16.612975 | [
"s439194300",
"s469674344"
] |
u912237403 | p00092 | python | s754013421 | s597638832 | 3,160 | 2,450 | 32,980 | 32,992 | Accepted | Accepted | 22.47 | import sys
while 1:
n=eval(input())+1
if n==1:break
A=[''*n]+[' '+input() for i in range(1,n)]
M=[[0]*n for i in range(n)]
for i in range(1,n):
for j in range(1,n):
if A[i][j]=='.': M[i][j]=min(M[i-1][j-1],M[i-1][j],M[i][j-1])+1
print(max(list(map(max,M)))) | import sys
while 1:
n=eval(input())+1
if n==1:break
N=list(range(n))
N1=N[1:]
A=[''*n]+[' '+input() for i in N1]
M=[[0]*n for i in N]
y=M[0]
for i in N1:
x=[0]*n
B=A[i]
for j in N1:
if B[j]=='.': x[j]=min(y[j-1],y[j],x[j-1])+1
M[i]=x
y=x
print(max(list(map(m... | 11 | 18 | 281 | 313 | import sys
while 1:
n = eval(input()) + 1
if n == 1:
break
A = ["" * n] + [" " + input() for i in range(1, n)]
M = [[0] * n for i in range(n)]
for i in range(1, n):
for j in range(1, n):
if A[i][j] == ".":
M[i][j] = min(M[i - 1][j - 1], M[i - 1][j], M[i][... | import sys
while 1:
n = eval(input()) + 1
if n == 1:
break
N = list(range(n))
N1 = N[1:]
A = ["" * n] + [" " + input() for i in N1]
M = [[0] * n for i in N]
y = M[0]
for i in N1:
x = [0] * n
B = A[i]
for j in N1:
if B[j] == ".":
... | false | 38.888889 | [
"- A = [\"\" * n] + [\" \" + input() for i in range(1, n)]",
"- M = [[0] * n for i in range(n)]",
"- for i in range(1, n):",
"- for j in range(1, n):",
"- if A[i][j] == \".\":",
"- M[i][j] = min(M[i - 1][j - 1], M[i - 1][j], M[i][j - 1]) + 1",
"+ N = list(ran... | false | 0.128771 | 0.044956 | 2.864384 | [
"s754013421",
"s597638832"
] |
u773265208 | p02780 | python | s646768605 | s980424379 | 254 | 159 | 71,816 | 25,604 | Accepted | Accepted | 37.4 | n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
iter_num = n - k + 1
num = sum(p[0:k])
ans = [(num+k)/2]
for i in range(iter_num-1):
num = num - p[i] + p[k+i]
ans.append((num+k)/2)
print((max(ans)))
| n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
tmp = sum(p[:k])
res = tmp
start = 0
end = k-1
for i in range(n-k):
tmp -= p[i]
tmp += p[k+i]
if res < tmp:
res = tmp
start = i+1
end = k+i
ans = 0
for i in range(start,end+1):
if p[i] % 2 == 0:
ans += ... | 13 | 23 | 233 | 425 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
iter_num = n - k + 1
num = sum(p[0:k])
ans = [(num + k) / 2]
for i in range(iter_num - 1):
num = num - p[i] + p[k + i]
ans.append((num + k) / 2)
print((max(ans)))
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
tmp = sum(p[:k])
res = tmp
start = 0
end = k - 1
for i in range(n - k):
tmp -= p[i]
tmp += p[k + i]
if res < tmp:
res = tmp
start = i + 1
end = k + i
ans = 0
for i in range(start, end + 1):
if p[i] % 2 == ... | false | 43.478261 | [
"-iter_num = n - k + 1",
"-num = sum(p[0:k])",
"-ans = [(num + k) / 2]",
"-for i in range(iter_num - 1):",
"- num = num - p[i] + p[k + i]",
"- ans.append((num + k) / 2)",
"-print((max(ans)))",
"+tmp = sum(p[:k])",
"+res = tmp",
"+start = 0",
"+end = k - 1",
"+for i in range(n - k):",
"... | false | 0.041764 | 0.135522 | 0.308175 | [
"s646768605",
"s980424379"
] |
u618251217 | p02706 | python | s241469052 | s054179233 | 29 | 26 | 9,856 | 9,796 | Accepted | Accepted | 10.34 | N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = max(N - sum(A), -1)
print(ans) | N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
print((max(-1, N - sum(A)))) | 5 | 4 | 109 | 98 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = max(N - sum(A), -1)
print(ans)
| N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
print((max(-1, N - sum(A))))
| false | 20 | [
"-ans = max(N - sum(A), -1)",
"-print(ans)",
"+print((max(-1, N - sum(A))))"
] | false | 0.046894 | 0.046548 | 1.007441 | [
"s241469052",
"s054179233"
] |
u823885866 | p03795 | python | s241139111 | s416189720 | 28 | 22 | 9,080 | 8,988 | Accepted | Accepted | 21.43 | a=int(eval(input()))
print((a*800-200*(a//15))) | a=int(eval(input()))
print((a*800-a//15*200))
| 2 | 2 | 40 | 39 | a = int(eval(input()))
print((a * 800 - 200 * (a // 15)))
| a = int(eval(input()))
print((a * 800 - a // 15 * 200))
| false | 0 | [
"-print((a * 800 - 200 * (a // 15)))",
"+print((a * 800 - a // 15 * 200))"
] | false | 0.046613 | 0.044361 | 1.05075 | [
"s241139111",
"s416189720"
] |
u606045429 | p02679 | python | s923447286 | s530746109 | 510 | 441 | 73,048 | 73,036 | Accepted | Accepted | 13.53 | from math import gcd
from collections import Counter
mod = 10 ** 9 + 7
N, *AB = list(map(int, open(0).read().split()))
def std(a, b):
if a == 0:
return (0, int(b != 0))
g = gcd(a, b)
a, b = a // g, b // g
return (a, b) if a > 0 else (-a, -b)
C = Counter()
for a, b in zip(*[i... | from math import gcd
from collections import Counter
mod = 10 ** 9 + 7
N, *AB = list(map(int, open(0).read().split()))
def std(a, b):
if a == 0:
return (0, int(b != 0))
g = gcd(a, b)
a, b = a // g, b // g
return (a, b) if a > 0 else (-a, -b)
C = Counter(std(a, b) for a, b in ... | 35 | 33 | 683 | 667 | from math import gcd
from collections import Counter
mod = 10**9 + 7
N, *AB = list(map(int, open(0).read().split()))
def std(a, b):
if a == 0:
return (0, int(b != 0))
g = gcd(a, b)
a, b = a // g, b // g
return (a, b) if a > 0 else (-a, -b)
C = Counter()
for a, b in zip(*[iter(AB)] * 2):
... | from math import gcd
from collections import Counter
mod = 10**9 + 7
N, *AB = list(map(int, open(0).read().split()))
def std(a, b):
if a == 0:
return (0, int(b != 0))
g = gcd(a, b)
a, b = a // g, b // g
return (a, b) if a > 0 else (-a, -b)
C = Counter(std(a, b) for a, b in zip(*[iter(AB)] *... | false | 5.714286 | [
"-C = Counter()",
"-for a, b in zip(*[iter(AB)] * 2):",
"- C[std(a, b)] += 1",
"+C = Counter(std(a, b) for a, b in zip(*[iter(AB)] * 2))"
] | false | 0.045293 | 0.115592 | 0.391838 | [
"s923447286",
"s530746109"
] |
u594956556 | p03612 | python | s393269514 | s927605532 | 63 | 57 | 14,008 | 13,880 | Accepted | Accepted | 9.52 | n=int(eval(input()))
p=list(map(int,input().split()))
sousa=0
flag=True
for i in range(n):
if i+1==p[i]:
if flag:
sousa+=1
flag=False
else:
flag=True
else:
flag=True
print(sousa) | n=int(eval(input()))
p=list(map(int,input().split()))
sousa=0
flag=False
for i in range(n):
if flag:
flag=False
continue
if i+1==p[i]:
sousa+=1
flag=True
print(sousa) | 14 | 12 | 219 | 191 | n = int(eval(input()))
p = list(map(int, input().split()))
sousa = 0
flag = True
for i in range(n):
if i + 1 == p[i]:
if flag:
sousa += 1
flag = False
else:
flag = True
else:
flag = True
print(sousa)
| n = int(eval(input()))
p = list(map(int, input().split()))
sousa = 0
flag = False
for i in range(n):
if flag:
flag = False
continue
if i + 1 == p[i]:
sousa += 1
flag = True
print(sousa)
| false | 14.285714 | [
"-flag = True",
"+flag = False",
"+ if flag:",
"+ flag = False",
"+ continue",
"- if flag:",
"- sousa += 1",
"- flag = False",
"- else:",
"- flag = True",
"- else:",
"+ sousa += 1"
] | false | 0.046659 | 0.046594 | 1.001396 | [
"s393269514",
"s927605532"
] |
u808427016 | p03460 | python | s712051102 | s550033693 | 1,316 | 1,140 | 102,560 | 67,232 | Accepted | Accepted | 13.37 | def calc(K, xyc):
K2 = K * 2
N = len(xyc)
p = [[0] * K2 for i in range(K2)]
for x, y, c in xyc:
y += c * K
p[x % K2][y % K2] += 1
p[(x + K) % K2][(y + K) % K2] += 1
def isum(xs):
r = 0
yield r
for x in xs:
r += x
... | def calc(K, xyc):
K2 = K * 2
N = len(xyc)
p = [[0] * K2 for i in range(K2)]
for x, y, c in xyc:
y += c * K
p[x % K2][y % K2] += 1
p[(x + K) % K2][(y + K) % K2] += 1
def calcsum(xs):
r = sum(xs[:K])
yield r
for a, b in zip(xs[:K], xs[K:])... | 33 | 32 | 882 | 853 | def calc(K, xyc):
K2 = K * 2
N = len(xyc)
p = [[0] * K2 for i in range(K2)]
for x, y, c in xyc:
y += c * K
p[x % K2][y % K2] += 1
p[(x + K) % K2][(y + K) % K2] += 1
def isum(xs):
r = 0
yield r
for x in xs:
r += x
yield r
p... | def calc(K, xyc):
K2 = K * 2
N = len(xyc)
p = [[0] * K2 for i in range(K2)]
for x, y, c in xyc:
y += c * K
p[x % K2][y % K2] += 1
p[(x + K) % K2][(y + K) % K2] += 1
def calcsum(xs):
r = sum(xs[:K])
yield r
for a, b in zip(xs[:K], xs[K:]):
... | false | 3.030303 | [
"- def isum(xs):",
"- r = 0",
"+ def calcsum(xs):",
"+ r = sum(xs[:K])",
"- for x in xs:",
"- r += x",
"+ for a, b in zip(xs[:K], xs[K:]):",
"+ r += -a + b",
"- psum = [list(isum(row)) for row in p]",
"- pksum = [[b - a for a, b in zip(... | false | 0.040387 | 0.0434 | 0.930567 | [
"s712051102",
"s550033693"
] |
u757274384 | p03352 | python | s521663723 | s017765010 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | import math
x = int(eval(input()))
L = []
for i in range(2,int(math.floor(math.sqrt(x)))+1):
for j in range(x//i + 1):
if i ** j <= x:
L.append(i ** j)
if L == []:
print("1")
else:
print((max(L)))
| import math
x = int(eval(input()))
if x == 1 or x== 2 or x==3:
print((1))
exit()
s = math.floor(math.sqrt(x))
def l(k,p):
return(int(math.floor(math.log(p)/math.log(k))))
ans = 0
for i in range(2,s+1):
if i ** (1 + l(i,x)) <= x:
ans = max(ans, i ** (1+l(i,x)))
else:
ans = max(ans,... | 13 | 22 | 225 | 383 | import math
x = int(eval(input()))
L = []
for i in range(2, int(math.floor(math.sqrt(x))) + 1):
for j in range(x // i + 1):
if i**j <= x:
L.append(i**j)
if L == []:
print("1")
else:
print((max(L)))
| import math
x = int(eval(input()))
if x == 1 or x == 2 or x == 3:
print((1))
exit()
s = math.floor(math.sqrt(x))
def l(k, p):
return int(math.floor(math.log(p) / math.log(k)))
ans = 0
for i in range(2, s + 1):
if i ** (1 + l(i, x)) <= x:
ans = max(ans, i ** (1 + l(i, x)))
else:
... | false | 40.909091 | [
"-L = []",
"-for i in range(2, int(math.floor(math.sqrt(x))) + 1):",
"- for j in range(x // i + 1):",
"- if i**j <= x:",
"- L.append(i**j)",
"-if L == []:",
"- print(\"1\")",
"-else:",
"- print((max(L)))",
"+if x == 1 or x == 2 or x == 3:",
"+ print((1))",
"+ e... | false | 0.073527 | 0.071542 | 1.027756 | [
"s521663723",
"s017765010"
] |
u145231176 | p02937 | python | s727262146 | s407097396 | 370 | 176 | 72,920 | 88,188 | Accepted | Accepted | 52.43 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 108 | 75 | 2,438 | 1,683 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 30.555556 | [
"-def rand_letter(size):",
"- ascii_original = \"programing\"",
"- digits_original = \"01\"",
"- digits = \"0123456789\"",
"- ascii_lowercase = \"abcdefghijklmnopqrstuvwxyz\"",
"- ascii_uppercase = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"",
"- # 好きなものを使ってね",
"- psuedo = ascii_original",
"... | false | 0.042867 | 0.047239 | 0.907454 | [
"s727262146",
"s407097396"
] |
u133936772 | p03408 | python | s300621871 | s193059114 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | d = {'':0}
for i in (1,-1):
for _ in range(int(eval(input()))):
s = eval(input())
d[s] = d.get(s,0)+i
print((max(d.values()))) | d={0:0}
for i in (1,-1):
for _ in [0]*int(eval(input())):s=eval(input());d[s]=d.get(s,0)+i
print((max(d.values()))) | 6 | 4 | 127 | 106 | d = {"": 0}
for i in (1, -1):
for _ in range(int(eval(input()))):
s = eval(input())
d[s] = d.get(s, 0) + i
print((max(d.values())))
| d = {0: 0}
for i in (1, -1):
for _ in [0] * int(eval(input())):
s = eval(input())
d[s] = d.get(s, 0) + i
print((max(d.values())))
| false | 33.333333 | [
"-d = {\"\": 0}",
"+d = {0: 0}",
"- for _ in range(int(eval(input()))):",
"+ for _ in [0] * int(eval(input())):"
] | false | 0.044107 | 0.043035 | 1.024892 | [
"s300621871",
"s193059114"
] |
u652155485 | p02792 | python | s932978338 | s799124551 | 71 | 64 | 32,668 | 32,668 | Accepted | Accepted | 9.86 | mod = 1e9+7
def add(a, b):
c = a + b
if c >= mod:
c -= mod
return c
def main():
m = {}
N = int(input())
for i in range(1, N+1):
s = str(i)
first = s[0]
last = s[-1]
key = first + last
m[key] = m.get(key, 0) + 1
ans ... | mod = 1e9+7
def add(a, b):
c = a + b
if c >= mod:
c -= mod
return c
def main():
m = {}
N = int(input())
for i in range(1, N+1):
s = str(i)
first = s[0]
last = s[-1]
key = first + last
m[key] = m.get(key, 0) + 1
ans ... | 35 | 42 | 607 | 783 | mod = 1e9 + 7
def add(a, b):
c = a + b
if c >= mod:
c -= mod
return c
def main():
m = {}
N = int(input())
for i in range(1, N + 1):
s = str(i)
first = s[0]
last = s[-1]
key = first + last
m[key] = m.get(key, 0) + 1
ans = 0
# print(m)
... | mod = 1e9 + 7
def add(a, b):
c = a + b
if c >= mod:
c -= mod
return c
def main():
m = {}
N = int(input())
for i in range(1, N + 1):
s = str(i)
first = s[0]
last = s[-1]
key = first + last
m[key] = m.get(key, 0) + 1
ans = 0
# print(m)
... | false | 16.666667 | [
"+ for k in m:",
"+ if k[0] == k[1]:",
"+ ans += m[k] * m[k]",
"+ else:",
"+ swap = k[1] + k[0]",
"+ ans += m[k] * m.get(swap, 0)",
"+ \"\"\"",
"- # if key1 == key2:",
"+ #if key1 == key2:",
"+ \"\"\""
] | false | 0.060335 | 0.044031 | 1.370272 | [
"s932978338",
"s799124551"
] |
u143492911 | p03721 | python | s139731113 | s239956188 | 479 | 442 | 27,872 | 29,144 | Accepted | Accepted | 7.72 | n,k=list(map(int,input().split()))
num=[list(map(int,input().split()))for _ in range(n)]
p=0
num.sort()
for i in range(n):
p+=num[i][1]
if k<=p:
ans=num[i][0]
print(ans)
exit()
| n,k=list(map(int,input().split()))
a=[list(map(int,input().split()))for i in range(n)]
a.sort(key=lambda x:x[0])
count=0
for i,j in a:
count+=j
if k<=count:
print(i)
exit() | 10 | 9 | 212 | 198 | n, k = list(map(int, input().split()))
num = [list(map(int, input().split())) for _ in range(n)]
p = 0
num.sort()
for i in range(n):
p += num[i][1]
if k <= p:
ans = num[i][0]
print(ans)
exit()
| n, k = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x: x[0])
count = 0
for i, j in a:
count += j
if k <= count:
print(i)
exit()
| false | 10 | [
"-num = [list(map(int, input().split())) for _ in range(n)]",
"-p = 0",
"-num.sort()",
"-for i in range(n):",
"- p += num[i][1]",
"- if k <= p:",
"- ans = num[i][0]",
"- print(ans)",
"+a = [list(map(int, input().split())) for i in range(n)]",
"+a.sort(key=lambda x: x[0])",
"+... | false | 0.106447 | 0.076579 | 1.390035 | [
"s139731113",
"s239956188"
] |
u727801592 | p03486 | python | s777098523 | s562147843 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | n=eval(input())
m=eval(input())
alphabet={'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}
a=[]
for i in range(len(n)):
a.append(alphabet[n[i]])
a.sort()
b=[]
for i in range(len(m)):
... | n=sorted(eval(input()))
m=sorted(eval(input()),reverse=True)
if n<m:
print('Yes')
else:
print('No') | 24 | 6 | 578 | 96 | n = eval(input())
m = eval(input())
alphabet = {
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6,
"g": 7,
"h": 8,
"i": 9,
"j": 10,
"k": 11,
"l": 12,
"m": 13,
"n": 14,
"o": 15,
"p": 16,
"q": 17,
"r": 18,
"s": 19,
"t": 20,
"u": 21,
"v"... | n = sorted(eval(input()))
m = sorted(eval(input()), reverse=True)
if n < m:
print("Yes")
else:
print("No")
| false | 75 | [
"-n = eval(input())",
"-m = eval(input())",
"-alphabet = {",
"- \"a\": 1,",
"- \"b\": 2,",
"- \"c\": 3,",
"- \"d\": 4,",
"- \"e\": 5,",
"- \"f\": 6,",
"- \"g\": 7,",
"- \"h\": 8,",
"- \"i\": 9,",
"- \"j\": 10,",
"- \"k\": 11,",
"- \"l\": 12,",
"- ... | false | 0.040298 | 0.049121 | 0.820374 | [
"s777098523",
"s562147843"
] |
u137228327 | p03261 | python | s727935577 | s605892763 | 32 | 29 | 9,332 | 9,024 | Accepted | Accepted | 9.38 | from collections import Counter
import sys
N = int(eval(input()))
lst = [str(eval(input())) for _ in range(N)]
#print(lst)
c = Counter(lst)
for i in c:
if lst.count(i) > 1:
print('No')
sys.exit()
for i in range(len(lst)-1):
if lst[i][-1] != lst[i+1][0]:
print('No')
... | import sys
N = int(eval(input()))
lst = [str(eval(input())) for _ in range(N)]
if len(set(lst)) != N:
print('No')
sys.exit()
for i in range(len(lst)-1):
if lst[i][-1] != lst[i+1][0]:
print('No')
sys.exit()
print('Yes') | 16 | 14 | 333 | 250 | from collections import Counter
import sys
N = int(eval(input()))
lst = [str(eval(input())) for _ in range(N)]
# print(lst)
c = Counter(lst)
for i in c:
if lst.count(i) > 1:
print("No")
sys.exit()
for i in range(len(lst) - 1):
if lst[i][-1] != lst[i + 1][0]:
print("No")
sys.exit... | import sys
N = int(eval(input()))
lst = [str(eval(input())) for _ in range(N)]
if len(set(lst)) != N:
print("No")
sys.exit()
for i in range(len(lst) - 1):
if lst[i][-1] != lst[i + 1][0]:
print("No")
sys.exit()
print("Yes")
| false | 12.5 | [
"-from collections import Counter",
"-# print(lst)",
"-c = Counter(lst)",
"-for i in c:",
"- if lst.count(i) > 1:",
"- print(\"No\")",
"- sys.exit()",
"+if len(set(lst)) != N:",
"+ print(\"No\")",
"+ sys.exit()"
] | false | 0.14551 | 0.098155 | 1.482442 | [
"s727935577",
"s605892763"
] |
u179169725 | p02609 | python | s151672485 | s066993514 | 401 | 370 | 97,068 | 125,776 | Accepted | Accepted | 7.73 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int(): return int(read... | import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ... | 115 | 109 | 2,740 | 2,479 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int():
return int(read())
d... | import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを... | false | 5.217391 | [
"-read = sys.stdin.readline",
"+readline = sys.stdin.buffer.readline",
"+read = sys.stdin.readline # 文字列読み込む時はこっち",
"- return int(read())",
"+ return int(readline())",
"- return list(map(int, read().split()))",
"+ return list(map(int, readline().split()))",
"- ret.append(list(map(i... | false | 0.038997 | 0.047802 | 0.815792 | [
"s151672485",
"s066993514"
] |
u476435125 | p03818 | python | s848478279 | s619302212 | 70 | 57 | 18,272 | 17,396 | Accepted | Accepted | 18.57 | N=int(eval(input()))
la=list(map(int,input().split()))
da={}
for ll in la:
if not ll in da:
da[ll]=1
elif da[ll]==1:
da[ll]=2
else:
da[ll]=1
nev=0
for dd in da:
if da[dd]==2:
nev+=1
if nev%2==0:
print((len(da)))
else:
print((len(da)-1))
| N=int(eval(input()))
la=list(map(int,input().split()))
da={}
for ll in la:
if not ll in da:
da[ll]=1
if (N-len(da))%2==0:
print((len(da)))
else:
print((len(da)-1))
| 18 | 10 | 300 | 183 | N = int(eval(input()))
la = list(map(int, input().split()))
da = {}
for ll in la:
if not ll in da:
da[ll] = 1
elif da[ll] == 1:
da[ll] = 2
else:
da[ll] = 1
nev = 0
for dd in da:
if da[dd] == 2:
nev += 1
if nev % 2 == 0:
print((len(da)))
else:
print((len(da) - 1))
| N = int(eval(input()))
la = list(map(int, input().split()))
da = {}
for ll in la:
if not ll in da:
da[ll] = 1
if (N - len(da)) % 2 == 0:
print((len(da)))
else:
print((len(da) - 1))
| false | 44.444444 | [
"- elif da[ll] == 1:",
"- da[ll] = 2",
"- else:",
"- da[ll] = 1",
"-nev = 0",
"-for dd in da:",
"- if da[dd] == 2:",
"- nev += 1",
"-if nev % 2 == 0:",
"+if (N - len(da)) % 2 == 0:"
] | false | 0.039029 | 0.040848 | 0.955457 | [
"s848478279",
"s619302212"
] |
u345966487 | p03160 | python | s337827604 | s917479813 | 234 | 210 | 50,288 | 51,696 | Accepted | Accepted | 10.26 | import sys
f = sys.stdin
n = int(f.readline())
h = list(map(int, f.readline().split()))
dp = [0]*n
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| import sys
import io
f = sys.stdin.buffer
n = int(f.readline())
h = list(map(int, f.readline().split()))
p0, p1 = 0, abs(h[1] - h[0])
for i in range(2, n):
p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
p0, p1 = p1, p2
print(p1)
| 9 | 11 | 252 | 264 | import sys
f = sys.stdin
n = int(f.readline())
h = list(map(int, f.readline().split()))
dp = [0] * n
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| import sys
import io
f = sys.stdin.buffer
n = int(f.readline())
h = list(map(int, f.readline().split()))
p0, p1 = 0, abs(h[1] - h[0])
for i in range(2, n):
p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
p0, p1 = p1, p2
print(p1)
| false | 18.181818 | [
"+import io",
"-f = sys.stdin",
"+f = sys.stdin.buffer",
"-dp = [0] * n",
"-dp[1] = abs(h[1] - h[0])",
"+p0, p1 = 0, abs(h[1] - h[0])",
"- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))",
"-print((dp[-1]))",
"+ p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] ... | false | 0.07204 | 0.038366 | 1.877698 | [
"s337827604",
"s917479813"
] |
u130900604 | p02713 | python | s641765920 | s675612452 | 493 | 82 | 68,240 | 71,936 | Accepted | Accepted | 83.37 | from math import gcd
k=int(eval(input()))
ans=0
for a in range(1,k+1):
for b in range(1,k+1):
for c in range(1,k+1):
ans+=gcd(gcd(a,b),c)
print(ans) | from math import gcd
from collections import Counter
k=int(eval(input()))
t=[]
for a in range(1,k+1):
for b in range(1,k+1):
t.append(gcd(a,b))
t=Counter(t)
ans=0
for d,e in list(t.items()):
for c in range(1,k+1):
g=gcd(c,d)
ans+=g*e
print(ans)
| 8 | 14 | 161 | 268 | from math import gcd
k = int(eval(input()))
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += gcd(gcd(a, b), c)
print(ans)
| from math import gcd
from collections import Counter
k = int(eval(input()))
t = []
for a in range(1, k + 1):
for b in range(1, k + 1):
t.append(gcd(a, b))
t = Counter(t)
ans = 0
for d, e in list(t.items()):
for c in range(1, k + 1):
g = gcd(c, d)
ans += g * e
print(ans)
| false | 42.857143 | [
"+from collections import Counter",
"-ans = 0",
"+t = []",
"- for c in range(1, k + 1):",
"- ans += gcd(gcd(a, b), c)",
"+ t.append(gcd(a, b))",
"+t = Counter(t)",
"+ans = 0",
"+for d, e in list(t.items()):",
"+ for c in range(1, k + 1):",
"+ g = gcd(c, d)",
... | false | 0.169301 | 0.039621 | 4.27301 | [
"s641765920",
"s675612452"
] |
u716530146 | p03103 | python | s960083746 | s187180228 | 721 | 404 | 61,528 | 57,180 | Accepted | Accepted | 43.97 | #!/anaconda3/bin/python
n,m=list(map(int,input().split()))
ab=[tuple(map(int,input().split())) for i in range(n)]
money=0
ab.sort(key=lambda tup:tup[0])
for a,b in ab:
if m-b>0:
money+=a*b
m-=b
else:
money+=a*m
break
print(money)
| #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1
n,m=list(map(int,input().split()))
AB=[tuple(map(int,input().s... | 14 | 20 | 286 | 503 | #!/anaconda3/bin/python
n, m = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(n)]
money = 0
ab.sort(key=lambda tup: tup[0])
for a, b in ab:
if m - b > 0:
money += a * b
m -= b
else:
money += a * m
break
print(money)
| #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**7)
inf = float("inf")
mod = 10**9 + 7
ans = 0
count = 0
pro = 1
n, m = list(map(int, input().split()))
AB = [tuple(map(int, input().split... | false | 30 | [
"-#!/anaconda3/bin/python",
"+#!/usr/bin/env python3",
"+import sys, math, itertools, heapq, collections, bisect, string",
"+",
"+input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")",
"+sys.setrecursionlimit(10**7)",
"+inf = float(\"inf\")",
"+mod = 10**9 + 7",
"+ans = 0",
"+cou... | false | 0.056106 | 0.099358 | 0.564684 | [
"s960083746",
"s187180228"
] |
u620084012 | p03069 | python | s551097168 | s291280120 | 248 | 205 | 13,032 | 56,268 | Accepted | Accepted | 17.34 | N = int(eval(input()))
S = eval(input())
t = S.count(".")
if t == N or t == 0:
print((0))
exit(0)
W = [0 for k in range(N+1)]
B = [0 for k in range(N+1)]
for k in range(N):
if S[k] == "#":
B[k] = B[k-1] + 1
else:
B[k] = B[k-1]
W[0] = t
for k in range(N):
if S[k] ... | n = int(eval(input()))
s = eval(input())
b = [0 for k in range(n+1)]
c = 0
for k in range(n):
if s[k] == "#":
c += 1
b[k+1] = c
w = [0 for k in range(n+1)]
c = 0
for k in range(n):
if s[-k-1] == ".":
c += 1
w[-k-2] = c
ans = 10**9
for k in range(n+1):
ans = min(... | 26 | 22 | 467 | 337 | N = int(eval(input()))
S = eval(input())
t = S.count(".")
if t == N or t == 0:
print((0))
exit(0)
W = [0 for k in range(N + 1)]
B = [0 for k in range(N + 1)]
for k in range(N):
if S[k] == "#":
B[k] = B[k - 1] + 1
else:
B[k] = B[k - 1]
W[0] = t
for k in range(N):
if S[k] == ".":
... | n = int(eval(input()))
s = eval(input())
b = [0 for k in range(n + 1)]
c = 0
for k in range(n):
if s[k] == "#":
c += 1
b[k + 1] = c
w = [0 for k in range(n + 1)]
c = 0
for k in range(n):
if s[-k - 1] == ".":
c += 1
w[-k - 2] = c
ans = 10**9
for k in range(n + 1):
ans = min(ans, b[k] ... | false | 15.384615 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-t = S.count(\".\")",
"-if t == N or t == 0:",
"- print((0))",
"- exit(0)",
"-W = [0 for k in range(N + 1)]",
"-B = [0 for k in range(N + 1)]",
"-for k in range(N):",
"- if S[k] == \"#\":",
"- B[k] = B[k - 1] + 1",
"- else:",... | false | 0.113444 | 0.040039 | 2.833326 | [
"s551097168",
"s291280120"
] |
u761320129 | p02781 | python | s198167995 | s637669404 | 464 | 22 | 3,188 | 3,064 | Accepted | Accepted | 95.26 | N = int(eval(input()))
K = int(eval(input()))
def solve(n,k):
if k==0: return 1
if n < 10:
return n if k==1 else 0
if n < 100 and k == 3:
return 0
m,d = divmod(n,10)
ret = d * solve(m,k-1)
ret += (9-d)*solve(m-1,k-1)
ret += solve(m,k)
return ret
print((so... | N = eval(input())
L = len(N)
K = int(eval(input()))
dp = [[[0]*2 for _ in range(K+1)] for _ in range(L+1)]
dp[0][0][0] = 1
for i,c in enumerate(N):
c = int(c)
for k in range(K+1):
for less in range(2):
for d in range(10):
nk = k + (d>0)
if nk > K:... | 16 | 17 | 316 | 494 | N = int(eval(input()))
K = int(eval(input()))
def solve(n, k):
if k == 0:
return 1
if n < 10:
return n if k == 1 else 0
if n < 100 and k == 3:
return 0
m, d = divmod(n, 10)
ret = d * solve(m, k - 1)
ret += (9 - d) * solve(m - 1, k - 1)
ret += solve(m, k)
return ... | N = eval(input())
L = len(N)
K = int(eval(input()))
dp = [[[0] * 2 for _ in range(K + 1)] for _ in range(L + 1)]
dp[0][0][0] = 1
for i, c in enumerate(N):
c = int(c)
for k in range(K + 1):
for less in range(2):
for d in range(10):
nk = k + (d > 0)
if nk > K:
... | false | 5.882353 | [
"-N = int(eval(input()))",
"+N = eval(input())",
"+L = len(N)",
"-",
"-",
"-def solve(n, k):",
"- if k == 0:",
"- return 1",
"- if n < 10:",
"- return n if k == 1 else 0",
"- if n < 100 and k == 3:",
"- return 0",
"- m, d = divmod(n, 10)",
"- ret = d * s... | false | 0.070384 | 0.034773 | 2.024072 | [
"s198167995",
"s637669404"
] |
u814781830 | p03273 | python | s811139483 | s340024708 | 234 | 42 | 44,760 | 9,316 | Accepted | Accepted | 82.05 | H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]
hl = []
wl = []
for h in range(H):
if sum([0 if i == "." else 1 for i in A[h]]) > 0:
hl.append(h)
for w in range(W):
if sum([0 if A[i][w] == "." else 1 for i in range(H)]) > 0:
wl.append(w)
for h in hl:
l... | H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
resH = [True] * H
resW = [True] * W
for h in range(H):
judge = False
for w in range(W):
if a[h][w] == "#":
judge = True
resH[h] = judge
for w in range(W):
judge = False
for h in range(H):
... | 18 | 26 | 403 | 582 | H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]
hl = []
wl = []
for h in range(H):
if sum([0 if i == "." else 1 for i in A[h]]) > 0:
hl.append(h)
for w in range(W):
if sum([0 if A[i][w] == "." else 1 for i in range(H)]) > 0:
wl.append(w)
for h in hl:
line = []
for ... | H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
resH = [True] * H
resW = [True] * W
for h in range(H):
judge = False
for w in range(W):
if a[h][w] == "#":
judge = True
resH[h] = judge
for w in range(W):
judge = False
for h in range(H):
if a[h][w] ==... | false | 30.769231 | [
"-A = [list(input()) for _ in range(H)]",
"-hl = []",
"-wl = []",
"+a = [list(input()) for _ in range(H)]",
"+resH = [True] * H",
"+resW = [True] * W",
"- if sum([0 if i == \".\" else 1 for i in A[h]]) > 0:",
"- hl.append(h)",
"+ judge = False",
"+ for w in range(W):",
"+ ... | false | 0.035978 | 0.040855 | 0.880619 | [
"s811139483",
"s340024708"
] |
u073729602 | p02534 | python | s435497509 | s070330346 | 30 | 25 | 9,128 | 9,040 | Accepted | Accepted | 16.67 | n = int(eval(input()))
print(("ACL"*n))
| k = int(eval(input()))
print(("ACL" * k)) | 2 | 2 | 33 | 34 | n = int(eval(input()))
print(("ACL" * n))
| k = int(eval(input()))
print(("ACL" * k))
| false | 0 | [
"-n = int(eval(input()))",
"-print((\"ACL\" * n))",
"+k = int(eval(input()))",
"+print((\"ACL\" * k))"
] | false | 0.045958 | 0.047837 | 0.960715 | [
"s435497509",
"s070330346"
] |
u057415180 | p02989 | python | s993733125 | s030763311 | 98 | 76 | 14,396 | 14,396 | Accepted | Accepted | 22.45 | n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
d.sort()
k = d[int(n/2)]
while k > d[int(n/2)-1]:
k -= 1
ans += 1
print(ans) | n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
print((d[n//2] - d[n//2 - 1])) | 9 | 6 | 151 | 97 | n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
d.sort()
k = d[int(n / 2)]
while k > d[int(n / 2) - 1]:
k -= 1
ans += 1
print(ans)
| n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
print((d[n // 2] - d[n // 2 - 1]))
| false | 33.333333 | [
"-ans = 0",
"-k = d[int(n / 2)]",
"-while k > d[int(n / 2) - 1]:",
"- k -= 1",
"- ans += 1",
"-print(ans)",
"+print((d[n // 2] - d[n // 2 - 1]))"
] | false | 0.048208 | 0.045577 | 1.057733 | [
"s993733125",
"s030763311"
] |
u790710233 | p03078 | python | s987685536 | s267115687 | 1,441 | 649 | 144,240 | 8,708 | Accepted | Accepted | 54.96 | from itertools import product
x, y, z, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
AB = [sum(ab) for ab in product(A, B)]
AB.sort(reverse=True)
AB = AB[:k]
ABC = [sum(abc) for abc in product(AB, C)]
ABC.sort(rev... | x, y, z, K = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ans = []
for i in range(x):
for j in range(y):
for k in range(z):
if (i+1)*(j+1)*(k+1) ... | 12 | 16 | 346 | 474 | from itertools import product
x, y, z, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
AB = [sum(ab) for ab in product(A, B)]
AB.sort(reverse=True)
AB = AB[:k]
ABC = [sum(abc) for abc in product(AB, C)]
ABC.sort(reverse=Tru... | x, y, z, K = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ans = []
for i in range(x):
for j in range(y):
for k in range(z):
if (i + 1) * (j + 1) * (k + 1... | false | 25 | [
"-from itertools import product",
"-",
"-x, y, z, k = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"-AB = [sum(ab) for ab in product(A, B)]",
"-AB.sort(reverse=True)",
"-AB = AB[:k]",
"-ABC... | false | 0.035078 | 0.080832 | 0.433961 | [
"s987685536",
"s267115687"
] |
u195054737 | p03160 | python | s776824873 | s141122893 | 196 | 165 | 13,800 | 13,980 | Accepted | Accepted | 15.82 |
n = int(eval(input()))
h = [int(i) for i in input().split()]
dp = [1e9] * n
dp[0] = 0
for i in range(1,n):
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i > 1:
dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print((dp[-1])) | n = int(eval(input()))
h = [int(i) for i in input().split()]
dp = [float('inf')] * n
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i > 0:
dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print((dp[-1])) | 13 | 13 | 254 | 264 | n = int(eval(input()))
h = [int(i) for i in input().split()]
dp = [1e9] * n
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| n = int(eval(input()))
h = [int(i) for i in input().split()]
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 0:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 0 | [
"-dp = [1e9] * n",
"+dp = [float(\"inf\")] * n",
"- if i > 1:",
"+ if i > 0:"
] | false | 0.036803 | 0.036861 | 0.998438 | [
"s776824873",
"s141122893"
] |
u107077660 | p03994 | python | s551621702 | s618648419 | 1,236 | 115 | 3,508 | 3,444 | Accepted | Accepted | 90.7 | s = eval(input())
s += " "
K = int(eval(input()))
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
k = 0
k = K
for i in range(len(s) - 1):
gap = (26 - alphabet.index(s[i])) % 26
if K >= gap:
K -= gap
s = s[:i] + "a" + s[i+1:]
s = s[:... | S = eval(input())
K = int(eval(input()))
ans = ""
for i in range(len(S)):
if(S[i] != 'a' and K >= (ord('a') - ord(S[i]))%26):
ans += 'a'
K -= (ord('a') - ord(S[i]))%26
else:
ans += S[i]
K %= 26
ans = ans[:-1] + chr(ord('a') + (ord(ans[-1])-ord('a') + K)%26)
print(ans)
| 21 | 13 | 406 | 302 | s = eval(input())
s += " "
K = int(eval(input()))
alphabet = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
k = 0
k = K
for i in ... | S = eval(input())
K = int(eval(input()))
ans = ""
for i in range(len(S)):
if S[i] != "a" and K >= (ord("a") - ord(S[i])) % 26:
ans += "a"
K -= (ord("a") - ord(S[i])) % 26
else:
ans += S[i]
K %= 26
ans = ans[:-1] + chr(ord("a") + (ord(ans[-1]) - ord("a") + K) % 26)
print(ans)
| false | 38.095238 | [
"-s = eval(input())",
"-s += \" \"",
"+S = eval(input())",
"-alphabet = [",
"- \"a\",",
"- \"b\",",
"- \"c\",",
"- \"d\",",
"- \"e\",",
"- \"f\",",
"- \"g\",",
"- \"h\",",
"- \"i\",",
"- \"j\",",
"- \"k\",",
"- \"l\",",
"- \"m\",",
"- \"n\"... | false | 0.037064 | 0.036318 | 1.020521 | [
"s551621702",
"s618648419"
] |
u038021590 | p03862 | python | s688530780 | s747945418 | 156 | 87 | 14,052 | 84,760 | Accepted | Accepted | 44.23 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
s = A[i] + A[i-1]
if s > x:
y = s-x
if A[i] > y:
A[i] -= y
A[i-1] -= y
ans += y
else:
z = y - A[i]
A[i] = 0
... | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
now = A[0]
if now > x:
ans += now - x
now = x
for i in range(1, N):
if now + A[i] > x:
y = now + A[i] - x
ans += y
A[i] = max(0, A[i] - y)
now = A[i]
print(ans)
| 23 | 14 | 458 | 291 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
s = A[i] + A[i - 1]
if s > x:
y = s - x
if A[i] > y:
A[i] -= y
A[i - 1] -= y
ans += y
else:
z = y - A[i]
A[i] = 0
... | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
now = A[0]
if now > x:
ans += now - x
now = x
for i in range(1, N):
if now + A[i] > x:
y = now + A[i] - x
ans += y
A[i] = max(0, A[i] - y)
now = A[i]
print(ans)
| false | 39.130435 | [
"+now = A[0]",
"+if now > x:",
"+ ans += now - x",
"+ now = x",
"- s = A[i] + A[i - 1]",
"- if s > x:",
"- y = s - x",
"- if A[i] > y:",
"- A[i] -= y",
"- A[i - 1] -= y",
"- ans += y",
"- else:",
"- z = y - A[i]",
... | false | 0.080137 | 0.046124 | 1.737415 | [
"s688530780",
"s747945418"
] |
u145231176 | p02720 | python | s210226439 | s653580593 | 592 | 301 | 83,676 | 95,804 | Accepted | Accepted | 49.16 | import collections
m = int(eval(input()))
n = 1000000000
ans = []
listnum = [
[0, 1],
[0, 1, 2],
[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9],
[8, 9]
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 26 | 88 | 576 | 1,756 | import collections
m = int(eval(input()))
n = 1000000000
ans = []
listnum = [
[0, 1],
[0, 1, 2],
[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9],
[8, 9],
]
def dfs(s):
if len(str(n)) + 1 > len(s):
ans.append(int(s))
lastnum = str... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 70.454545 | [
"-import collections",
"+def getN():",
"+ return int(eval(input()))",
"-m = int(eval(input()))",
"-n = 1000000000",
"-ans = []",
"-listnum = [",
"+",
"+def getNM():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def getList():",
"+ return list(map(int, input().split()))... | false | 0.704369 | 0.505439 | 1.393578 | [
"s210226439",
"s653580593"
] |
u625729943 | p03221 | python | s881496602 | s326580258 | 820 | 659 | 38,396 | 43,012 | Accepted | Accepted | 19.63 | N, M = list(map(int, input().split()))
PY = [[i,0] + list(map(int, input().split())) for i in range(M)]
# [index, nth city, pref num, birth year]
PY.sort(key=lambda x:(x[2],x[3]))
p = -1
num = 1
for i,py in enumerate(PY):
if p != py[2]:
p = py[2]
num = 1
PY[i][1] = num
else:
num += 1... | #import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.... | 21 | 33 | 428 | 859 | N, M = list(map(int, input().split()))
PY = [[i, 0] + list(map(int, input().split())) for i in range(M)]
# [index, nth city, pref num, birth year]
PY.sort(key=lambda x: (x[2], x[3]))
p = -1
num = 1
for i, py in enumerate(PY):
if p != py[2]:
p = py[2]
num = 1
PY[i][1] = num
else:
... | # import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial # , gcd
from bisect import bisect_left # bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9 + 7
def input():
retur... | false | 36.363636 | [
"-N, M = list(map(int, input().split()))",
"-PY = [[i, 0] + list(map(int, input().split())) for i in range(M)]",
"-# [index, nth city, pref num, birth year]",
"-PY.sort(key=lambda x: (x[2], x[3]))",
"-p = -1",
"-num = 1",
"-for i, py in enumerate(PY):",
"- if p != py[2]:",
"- p = py[2]",
... | false | 0.035576 | 0.042719 | 0.832776 | [
"s881496602",
"s326580258"
] |
u225388820 | p03177 | python | s836190805 | s033202077 | 1,591 | 496 | 69,724 | 41,904 | Accepted | Accepted | 68.82 | # dp[n][i][j]=(頂点iから頂点jへ行く長さnのパスの個数)
# dp[n][i][j]=sum(dp[n-1][i][k]*a[k][j])⇒DP[n]=DP[n-1]*A DP[0]=Eより DP[n]=A^n
n,k=list(map(int,input().split()))
a=[list(map(int,input().split())) for i in range(n)]
dp=[[0]*n for i in range(n)]
mod=10**9+7
for i in range(n):
for j in range(n):
dp[i][i]=1
def dot... | # dp[n][i][j]=(頂点iから頂点jへ行く長さnのパスの個数)
# dp[n][i][j]=sum(dp[n-1][i][k]*a[k][j])⇒DP[n]=DP[n-1]*A DP[0]=Eより DP[n]=A^n
import sys
input = sys.stdin.readline
def dot(A,B,MOD=1000000007):
N,M,L = len(A),len(A[0]),len(B[0])
res = [[0]*L for i in range(N)]
for i in range(N):
for j in range(L):
... | 26 | 39 | 646 | 998 | # dp[n][i][j]=(頂点iから頂点jへ行く長さnのパスの個数)
# dp[n][i][j]=sum(dp[n-1][i][k]*a[k][j])⇒DP[n]=DP[n-1]*A DP[0]=Eより DP[n]=A^n
n, k = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
dp = [[0] * n for i in range(n)]
mod = 10**9 + 7
for i in range(n):
for j in range(n):
dp[i][i] = 1... | # dp[n][i][j]=(頂点iから頂点jへ行く長さnのパスの個数)
# dp[n][i][j]=sum(dp[n-1][i][k]*a[k][j])⇒DP[n]=DP[n-1]*A DP[0]=Eより DP[n]=A^n
import sys
input = sys.stdin.readline
def dot(A, B, MOD=1000000007):
N, M, L = len(A), len(A[0]), len(B[0])
res = [[0] * L for i in range(N)]
for i in range(N):
for j in range(L):
... | false | 33.333333 | [
"-n, k = list(map(int, input().split()))",
"-a = [list(map(int, input().split())) for i in range(n)]",
"-dp = [[0] * n for i in range(n)]",
"-mod = 10**9 + 7",
"-for i in range(n):",
"- for j in range(n):",
"- dp[i][i] = 1",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-def dot(... | false | 0.065007 | 0.063734 | 1.019983 | [
"s836190805",
"s033202077"
] |
u690536347 | p02874 | python | s022480208 | s719730057 | 551 | 438 | 97,352 | 98,768 | Accepted | Accepted | 20.51 | from itertools import product
from operator import add
class SegTree():
def __init__(self, N, e, operator_func=add):
self.e = e # 単位元
self.size = N
self.node = [self.e] * (2*N)
self.operator_func = operator_func # 処理(add or xor max minなど)
def set_list(self, l):
... | import sys
input=sys.stdin.readline
class SegTree():
def __init__(self, N, e, operator_func):
self.e = e # 単位元
self.size = N
self.node = [self.e] * (2*N)
self.operator_func = operator_func # 処理(add or xor max minなど)
def set_list(self, l):
for i in range(sel... | 82 | 82 | 1,953 | 2,047 | from itertools import product
from operator import add
class SegTree:
def __init__(self, N, e, operator_func=add):
self.e = e # 単位元
self.size = N
self.node = [self.e] * (2 * N)
self.operator_func = operator_func # 処理(add or xor max minなど)
def set_list(self, l):
for i... | import sys
input = sys.stdin.readline
class SegTree:
def __init__(self, N, e, operator_func):
self.e = e # 単位元
self.size = N
self.node = [self.e] * (2 * N)
self.operator_func = operator_func # 処理(add or xor max minなど)
def set_list(self, l):
for i in range(self.size)... | false | 0 | [
"-from itertools import product",
"-from operator import add",
"+import sys",
"+",
"+input = sys.stdin.readline",
"- def __init__(self, N, e, operator_func=add):",
"+ def __init__(self, N, e, operator_func):",
"-N = int(eval(input()))",
"-l = [tuple(map(int, input().split())) for i in range(N)... | false | 0.035355 | 0.035356 | 0.99996 | [
"s022480208",
"s719730057"
] |
u577170763 | p02616 | python | s442504606 | s038089845 | 178 | 161 | 106,228 | 119,904 | Accepted | Accepted | 9.55 | from queue import PriorityQueue
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
mo... | from queue import PriorityQueue
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
mo... | 86 | 91 | 1,578 | 1,690 | from queue import PriorityQueue
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
mod = 10**9 + 7
... | from queue import PriorityQueue
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
mod = 10**9 + 7
... | false | 5.494505 | [
"+ if len(p) + len(n) < k:",
"+ print((0))",
"+ exit()",
"+ elif len(p) + len(n) == k:",
"+ if len(n) & 1 == 0:",
"+ print((prod(p) * prod(n) % mod))",
"+ exit()",
"+ else:",
"+ if z > 0:",
"+ print((0))",
"+ ... | false | 0.038536 | 0.035899 | 1.073442 | [
"s442504606",
"s038089845"
] |
u130900604 | p02647 | python | s209681474 | s849127411 | 1,602 | 376 | 187,484 | 178,908 | Accepted | Accepted | 76.53 | # coding: utf-8
# Your code here!
import time
t1=time.time()
def LI():return list(map(int,input().split()))
n,k=LI()
a=LI()
for _ in range(k):
tab=[0]*(n)
for i in range(n):
q=a[i]
if 0<=i-q:
tab[i-q]+=1
else:
tab[0]+=1
if i+q+1<=n-1:
... | # coding: utf-8
# Your code here!
import time
t1=time.time()
def LI():return list(map(int,input().split()))
n,k=LI()
a=LI()
for _ in range(k):
tab=[0]*(n)
for i in range(n):
q=a[i]
if 0<=i-q:
tab[i-q]+=1
else:
tab[0]+=1
if i+q+1<=n-1:
... | 28 | 31 | 538 | 587 | # coding: utf-8
# Your code here!
import time
t1 = time.time()
def LI():
return list(map(int, input().split()))
n, k = LI()
a = LI()
for _ in range(k):
tab = [0] * (n)
for i in range(n):
q = a[i]
if 0 <= i - q:
tab[i - q] += 1
else:
tab[0] += 1
if... | # coding: utf-8
# Your code here!
import time
t1 = time.time()
def LI():
return list(map(int, input().split()))
n, k = LI()
a = LI()
for _ in range(k):
tab = [0] * (n)
for i in range(n):
q = a[i]
if 0 <= i - q:
tab[i - q] += 1
else:
tab[0] += 1
if... | false | 9.677419 | [
"+ if a == b:",
"+ print((*a))",
"+ exit()"
] | false | 0.068604 | 0.03536 | 1.940146 | [
"s209681474",
"s849127411"
] |
u359007262 | p03448 | python | s866357730 | s101268310 | 66 | 31 | 3,064 | 9,180 | Accepted | Accepted | 53.03 | def check(a, b, c, x):
test = 500 * a + 100 * b + 50 * c
if test > x:
return 0
elif test == x:
return 1
else:
return 0
def resolve():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
result = 0
... | def resolve():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
n = 0
for i in range(a+1):
ni = 500*i
if ni > x:
continue
for j in range(b+1):
nj = ni + 100*j
if nj >... | 29 | 23 | 685 | 542 | def check(a, b, c, x):
test = 500 * a + 100 * b + 50 * c
if test > x:
return 0
elif test == x:
return 1
else:
return 0
def resolve():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
result = 0
# これは総当たり…
fo... | def resolve():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
n = 0
for i in range(a + 1):
ni = 500 * i
if ni > x:
continue
for j in range(b + 1):
nj = ni + 100 * j
if nj > x:
... | false | 20.689655 | [
"-def check(a, b, c, x):",
"- test = 500 * a + 100 * b + 50 * c",
"- if test > x:",
"- return 0",
"- elif test == x:",
"- return 1",
"- else:",
"- return 0",
"-",
"-",
"- result = 0",
"- # これは総当たり…",
"- for i in range(a, -1, -1):",
"- if 500... | false | 0.049766 | 0.039353 | 1.26462 | [
"s866357730",
"s101268310"
] |
u811841526 | p02412 | python | s314914682 | s640428619 | 520 | 460 | 7,656 | 5,596 | Accepted | Accepted | 11.54 | while True:
n, x = list(map(int, input().split()))
if n == 0:
break
count = 0
for n1 in range(1, n+1):
for n2 in range(n1+1, n+1):
for n3 in range(n2+1, n+1):
if n1 + n2 + n3 == x:
count += 1
print(count) | while True:
n, x = list(map(int, input().split()))
if n == 0 and x == 0:
break
count = 0
for i in range(1, n+1):
for j in range(i+1, n+1):
for k in range(j+1, n+1):
if i + k + j == x:
count += 1
print(count)
| 13 | 13 | 296 | 300 | while True:
n, x = list(map(int, input().split()))
if n == 0:
break
count = 0
for n1 in range(1, n + 1):
for n2 in range(n1 + 1, n + 1):
for n3 in range(n2 + 1, n + 1):
if n1 + n2 + n3 == x:
count += 1
print(count)
| while True:
n, x = list(map(int, input().split()))
if n == 0 and x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
for k in range(j + 1, n + 1):
if i + k + j == x:
count += 1
print(count)
| false | 0 | [
"- if n == 0:",
"+ if n == 0 and x == 0:",
"- for n1 in range(1, n + 1):",
"- for n2 in range(n1 + 1, n + 1):",
"- for n3 in range(n2 + 1, n + 1):",
"- if n1 + n2 + n3 == x:",
"+ for i in range(1, n + 1):",
"+ for j in range(i + 1, n + 1):",
"+ ... | false | 0.048332 | 0.04756 | 1.016222 | [
"s314914682",
"s640428619"
] |
u699089116 | p03611 | python | s252684645 | s991337035 | 226 | 84 | 56,900 | 20,808 | Accepted | Accepted | 62.83 | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
a = [i+1 for i in a]
imos = [0] * (10**5 + 3)
for i in a:
imos[i-1] += 1
imos[i+2] -= 1
i = accumulate(imos)
print((max(i)))
| N = int(eval(input()))
A = list(map(int, input().split()))
A = [i + 1 for i in A]
bucket = [0] * (10 ** 5 + 10)
for a in A:
bucket[a - 1] += 1
bucket[a] += 1
bucket[a+1] += 1
print((max(bucket))) | 13 | 12 | 232 | 213 | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
a = [i + 1 for i in a]
imos = [0] * (10**5 + 3)
for i in a:
imos[i - 1] += 1
imos[i + 2] -= 1
i = accumulate(imos)
print((max(i)))
| N = int(eval(input()))
A = list(map(int, input().split()))
A = [i + 1 for i in A]
bucket = [0] * (10**5 + 10)
for a in A:
bucket[a - 1] += 1
bucket[a] += 1
bucket[a + 1] += 1
print((max(bucket)))
| false | 7.692308 | [
"-from itertools import accumulate",
"-",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-a = [i + 1 for i in a]",
"-imos = [0] * (10**5 + 3)",
"-for i in a:",
"- imos[i - 1] += 1",
"- imos[i + 2] -= 1",
"-i = accumulate(imos)",
"-print((max(i)))",
"+N = int(eval(inp... | false | 0.090952 | 0.087058 | 1.044734 | [
"s252684645",
"s991337035"
] |
u633068244 | p00152 | python | s434962540 | s699659918 | 20 | 10 | 4,252 | 4,244 | Accepted | Accepted | 50 | def bowling(game):
game=list(map(int,game.split()))
score,thrw=0,1
for flame in range(10):
if game[thrw]==10:
score+=sum(game[thrw:thrw+3])
thrw+=1
elif game[thrw]+game[thrw+1]==10:
score+=10+game[thrw+2]
thrw+=2
else:
score+=game[thrw]+game[thrw+1]
thrw+=2
return game[0],score
... | def bowling(game):
game=list(map(int,game.split()))
score,thrw=0,1
for flame in range(10):
if game[thrw]==10:
score+=sum(game[thrw:thrw+3])
thrw+=1
elif game[thrw]+game[thrw+1]==10:
score+=10+game[thrw+2]
thrw+=2
else:
score+=sum(game[thrw:thrw+2])
thrw+=2
return game[0],score
... | 21 | 21 | 477 | 473 | def bowling(game):
game = list(map(int, game.split()))
score, thrw = 0, 1
for flame in range(10):
if game[thrw] == 10:
score += sum(game[thrw : thrw + 3])
thrw += 1
elif game[thrw] + game[thrw + 1] == 10:
score += 10 + game[thrw + 2]
thrw += 2
... | def bowling(game):
game = list(map(int, game.split()))
score, thrw = 0, 1
for flame in range(10):
if game[thrw] == 10:
score += sum(game[thrw : thrw + 3])
thrw += 1
elif game[thrw] + game[thrw + 1] == 10:
score += 10 + game[thrw + 2]
thrw += 2
... | false | 0 | [
"- score += game[thrw] + game[thrw + 1]",
"+ score += sum(game[thrw : thrw + 2])",
"- for k, s in sorted(sorted(ls), key=lambda x: x[1], reverse=True):",
"+ for k, s in sorted(sorted(ls), key=lambda x: x[1], reverse=1):"
] | false | 0.11462 | 0.046365 | 2.472116 | [
"s434962540",
"s699659918"
] |
u952656646 | p02912 | python | s749197653 | s756645118 | 224 | 163 | 14,180 | 14,180 | Accepted | Accepted | 27.23 | from heapq import heappush, heappop, heapify
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
heap = [-a for a in A]
heapify(heap)
for i in range(M):
hmax = heappop(heap)
heappush(heap, hmax/2)
print((sum([int(-x) for x in heap]))) | from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([-x for x in A])
heapify(A)
for i in range(M):
mx = heappop(A)
heappush(A, (-1)*(-mx//2))
A = list([-x for x in A])
print((sum(A))) | 9 | 10 | 269 | 279 | from heapq import heappush, heappop, heapify
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
heap = [-a for a in A]
heapify(heap)
for i in range(M):
hmax = heappop(heap)
heappush(heap, hmax / 2)
print((sum([int(-x) for x in heap])))
| from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([-x for x in A])
heapify(A)
for i in range(M):
mx = heappop(A)
heappush(A, (-1) * (-mx // 2))
A = list([-x for x in A])
print((sum(A)))
| false | 10 | [
"-from heapq import heappush, heappop, heapify",
"+from heapq import heapify, heappush, heappop",
"-heap = [-a for a in A]",
"-heapify(heap)",
"+A = list([-x for x in A])",
"+heapify(A)",
"- hmax = heappop(heap)",
"- heappush(heap, hmax / 2)",
"-print((sum([int(-x) for x in heap])))",
"+ ... | false | 0.042419 | 0.060977 | 0.695649 | [
"s749197653",
"s756645118"
] |
u708019102 | p03161 | python | s323969814 | s269335990 | 380 | 350 | 52,704 | 52,320 | Accepted | Accepted | 7.89 | N,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
DP = [1000000000]*N
DP[0] = 0
def handan(i,x):
if DP[i] > x:
DP[i] = x
for i in range(1,N):
for j in range(min(i,k)):
x = DP[i-j-1] + abs(h[i]-h[i-j-1])
handan(i,x)
print((DP[N-1])) | N,K = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
DP=[100000000000]*(N+1)
DP[0] = 0
DP[1] = 0
DP[2] = DP[1] + abs(h[0]-h[1])
for i in range(1,N):
for j in range(i+1,min(i+K+1,N+1)):
DP[j] = min(DP[j],DP[i]+abs(h[j-1]-h[i-1]))
print((DP[N])) | 12 | 10 | 300 | 287 | N, k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
DP = [1000000000] * N
DP[0] = 0
def handan(i, x):
if DP[i] > x:
DP[i] = x
for i in range(1, N):
for j in range(min(i, k)):
x = DP[i - j - 1] + abs(h[i] - h[i - j - 1])
handan(i, x)
print((DP[N - 1]))
| N, K = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
DP = [100000000000] * (N + 1)
DP[0] = 0
DP[1] = 0
DP[2] = DP[1] + abs(h[0] - h[1])
for i in range(1, N):
for j in range(i + 1, min(i + K + 1, N + 1)):
DP[j] = min(DP[j], DP[i] + abs(h[j - 1] - h[i - 1]))
print((DP[N]))
| false | 16.666667 | [
"-N, k = [int(x) for x in input().split()]",
"+N, K = [int(x) for x in input().split()]",
"-DP = [1000000000] * N",
"+DP = [100000000000] * (N + 1)",
"-",
"-",
"-def handan(i, x):",
"- if DP[i] > x:",
"- DP[i] = x",
"-",
"-",
"+DP[1] = 0",
"+DP[2] = DP[1] + abs(h[0] - h[1])",
"- ... | false | 0.059546 | 0.036869 | 1.615083 | [
"s323969814",
"s269335990"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.