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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u941438707 | p03261 | python | s912471679 | s257793461 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n=int(eval(input()))
w=[eval(input()) for _ in range(n)]
if len(set(w))==n:
ans=0
else:
ans=1
for i in range(n-1):
if w[i][-1]!=w[i+1][0]:
ans=1
print(("No" if ans else "Yes")) | n=int(eval(input()))
w=[eval(input()) for _ in range(n)]
print(("Yes" if len(set(w))==n and all(i[-1]==j[0] for i,j in zip(w,w[1:])) else "No")) | 10 | 3 | 191 | 132 | n = int(eval(input()))
w = [eval(input()) for _ in range(n)]
if len(set(w)) == n:
ans = 0
else:
ans = 1
for i in range(n - 1):
if w[i][-1] != w[i + 1][0]:
ans = 1
print(("No" if ans else "Yes"))
| n = int(eval(input()))
w = [eval(input()) for _ in range(n)]
print(
(
"Yes"
if len(set(w)) == n and all(i[-1] == j[0] for i, j in zip(w, w[1:]))
else "No"
)
)
| false | 70 | [
"-if len(set(w)) == n:",
"- ans = 0",
"-else:",
"- ans = 1",
"-for i in range(n - 1):",
"- if w[i][-1] != w[i + 1][0]:",
"- ans = 1",
"-print((\"No\" if ans else \"Yes\"))",
"+print(",
"+ (",
"+ \"Yes\"",
"+ if len(set(w)) == n and all(i[-1] == j[0] for i, j in... | false | 0.043299 | 0.04424 | 0.978719 | [
"s912471679",
"s257793461"
] |
u500396695 | p00108 | python | s013688740 | s170821224 | 40 | 30 | 7,608 | 7,668 | Accepted | Accepted | 25 | def FOA(a, count):
b = [a.count(a[i]) for i in range(len(a))]
if b == a:
print(count)
print((" ".join(map(str, b))))
return
else:
return FOA(b, count+1)
while True:
n = int(eval(input()))
if n == 0:
break
a = list(map(int, input().split()))
FOA(a, 0) | def FOA(a, count):
b = [a.count(a[i]) for i in range(len(a))]
if b == a:
print(count)
print((" ".join(map(str, b))))
else:
return FOA(b, count+1)
while True:
n = int(eval(input()))
if n == 0:
break
a = list(map(int, input().split()))
FOA(a, 0) | 15 | 14 | 275 | 265 | def FOA(a, count):
b = [a.count(a[i]) for i in range(len(a))]
if b == a:
print(count)
print((" ".join(map(str, b))))
return
else:
return FOA(b, count + 1)
while True:
n = int(eval(input()))
if n == 0:
break
a = list(map(int, input().split()))
FOA(a, ... | def FOA(a, count):
b = [a.count(a[i]) for i in range(len(a))]
if b == a:
print(count)
print((" ".join(map(str, b))))
else:
return FOA(b, count + 1)
while True:
n = int(eval(input()))
if n == 0:
break
a = list(map(int, input().split()))
FOA(a, 0)
| false | 6.666667 | [
"- return"
] | false | 0.045813 | 0.045855 | 0.999079 | [
"s013688740",
"s170821224"
] |
u391819434 | p03556 | python | s199527983 | s703720358 | 43 | 39 | 3,188 | 3,188 | Accepted | Accepted | 9.3 | N=int(eval(input()))
while N:
if N**0.5%1==0:print(N);break
N-=1 | N = int(eval(input()))
while N**0.5 % 1:
N -= 1
print(N) | 4 | 4 | 69 | 57 | N = int(eval(input()))
while N:
if N**0.5 % 1 == 0:
print(N)
break
N -= 1
| N = int(eval(input()))
while N**0.5 % 1:
N -= 1
print(N)
| false | 0 | [
"-while N:",
"- if N**0.5 % 1 == 0:",
"- print(N)",
"- break",
"+while N**0.5 % 1:",
"+print(N)"
] | false | 0.039705 | 0.037889 | 1.047937 | [
"s199527983",
"s703720358"
] |
u367965715 | p03695 | python | s319175126 | s083634023 | 148 | 17 | 12,216 | 3,064 | Accepted | Accepted | 88.51 | from bisect import bisect_left
import numpy as np
n = int(input())
a = map(int, input().split())
border = np.arange(399, 3200, 400)
cnt = [0] * (len(border) + 1)
for i in a:
cnt[bisect_left(border, i)] += 1
k = np.count_nonzero(cnt[:-1])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])
| n = int(input())
a = map(int, input().split())
border = list(range(400, 3201, 400))
cnt = [0] * (len(border) + 1)
for aa in a:
for i, k in enumerate(border):
if aa < k:
cnt[i] += 1
break
else:
cnt[i+1] += 1
k = len([i for i in cnt[:-1] if i > 0])
print(k, ... | 13 | 15 | 312 | 365 | from bisect import bisect_left
import numpy as np
n = int(input())
a = map(int, input().split())
border = np.arange(399, 3200, 400)
cnt = [0] * (len(border) + 1)
for i in a:
cnt[bisect_left(border, i)] += 1
k = np.count_nonzero(cnt[:-1])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])
| n = int(input())
a = map(int, input().split())
border = list(range(400, 3201, 400))
cnt = [0] * (len(border) + 1)
for aa in a:
for i, k in enumerate(border):
if aa < k:
cnt[i] += 1
break
else:
cnt[i + 1] += 1
k = len([i for i in cnt[:-1] if i > 0])
print(k, k + cnt[-1]) i... | false | 13.333333 | [
"-from bisect import bisect_left",
"-import numpy as np",
"-",
"-border = np.arange(399, 3200, 400)",
"+border = list(range(400, 3201, 400))",
"-for i in a:",
"- cnt[bisect_left(border, i)] += 1",
"-k = np.count_nonzero(cnt[:-1])",
"+for aa in a:",
"+ for i, k in enumerate(border):",
"+ ... | false | 0.006639 | 0.037166 | 0.178626 | [
"s319175126",
"s083634023"
] |
u745087332 | p03212 | python | s943179294 | s520506568 | 93 | 70 | 3,060 | 3,064 | Accepted | Accepted | 24.73 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
def DFS(s):
if int(s) > N:
return 0
if all(s.count(c) > 0 for c in '753'):
ret = 1
else:
... | # coding:utf-8
import itertools
N = int(eval(input()))
ans = 0
for i in range(2, len(str(N))):
for s in itertools.product('753', repeat=i+1):
if int(''.join(s)) > N:
continue
if all(s.count(c) > 0 for c in '753'):
ans += 1
print(ans)
| 31 | 15 | 411 | 290 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float("inf")
MOD = 10**9 + 7
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
def DFS(s):
if int(s) > N:
return 0
if all(s.count(c) > 0 for c in "753"):
ret = 1
else:
ret = 0
for c in "... | # coding:utf-8
import itertools
N = int(eval(input()))
ans = 0
for i in range(2, len(str(N))):
for s in itertools.product("753", repeat=i + 1):
if int("".join(s)) > N:
continue
if all(s.count(c) > 0 for c in "753"):
ans += 1
print(ans)
| false | 51.612903 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-INF = float(\"inf\")",
"-MOD = 10**9 + 7",
"-",
"-",
"-def inpl():",
"- return list(map(int, input().split()))",
"-",
"+import itertools",
"-",
"-",
"-def DFS(s):",
"- if int(s) > N:",
"- return 0",
"- if all(s.coun... | false | 0.048395 | 0.046743 | 1.035338 | [
"s943179294",
"s520506568"
] |
u089230684 | p02767 | python | s900054882 | s186960217 | 21 | 17 | 3,060 | 3,064 | Accepted | Accepted | 19.05 | n = int (eval(input()))
x = list (map (int, input().split()))
ans = int (2e9)
l, r = min (x), max (x)
for p in range (l, r + 1) :
tmp = 0
for loc in x:
tmp += (loc - p) ** 2
ans = min (ans, tmp)
print (ans) | import math
N=eval(input())
n=int(N)
p=input().split()
for i in range (len(p)):
p[i]=int(p[i])
sum1=0
q=p.copy()
for i in range (len(q)):
sum1=sum1+q[i]
avg=sum1/n
if avg-math.floor(avg)>=0.5:
avg=math.floor(avg)+1
else:
avg=math.floor(avg)
stamina=0
for i in range(le... | 13 | 30 | 235 | 377 | n = int(eval(input()))
x = list(map(int, input().split()))
ans = int(2e9)
l, r = min(x), max(x)
for p in range(l, r + 1):
tmp = 0
for loc in x:
tmp += (loc - p) ** 2
ans = min(ans, tmp)
print(ans)
| import math
N = eval(input())
n = int(N)
p = input().split()
for i in range(len(p)):
p[i] = int(p[i])
sum1 = 0
q = p.copy()
for i in range(len(q)):
sum1 = sum1 + q[i]
avg = sum1 / n
if avg - math.floor(avg) >= 0.5:
avg = math.floor(avg) + 1
else:
avg = math.floor(avg)
stamina = 0
for i in range(len(p))... | false | 56.666667 | [
"-n = int(eval(input()))",
"-x = list(map(int, input().split()))",
"-ans = int(2e9)",
"-l, r = min(x), max(x)",
"-for p in range(l, r + 1):",
"- tmp = 0",
"- for loc in x:",
"- tmp += (loc - p) ** 2",
"- ans = min(ans, tmp)",
"-print(ans)",
"+import math",
"+",
"+N = eval(inp... | false | 0.040968 | 0.044579 | 0.919013 | [
"s900054882",
"s186960217"
] |
u116002573 | p02792 | python | s068341570 | s126133175 | 280 | 128 | 41,964 | 67,888 | Accepted | Accepted | 54.29 | import collections
def main():
N = int(eval(input()))
d = collections.defaultdict(int)
for i in range(1, N+1):
s = str(i)
d[(s[0], s[-1])] += 1
ans = 0
for a in d:
b = (a[1], a[0])
if b in d:
ans += d[a] * d[b]
return ans
if __... | def main():
N = int(eval(input()))
d = dict()
for i in range(1, N+1):
u = int(str(i)[0])
v = int(str(i)[-1])
d[(u, v)] = d.get((u, v), 0) + 1
ans = 0
for u, v in d:
if (v, u) in d:
ans += d[(u, v)] * d[(v, u)]
return ans
if __name... | 21 | 19 | 354 | 351 | import collections
def main():
N = int(eval(input()))
d = collections.defaultdict(int)
for i in range(1, N + 1):
s = str(i)
d[(s[0], s[-1])] += 1
ans = 0
for a in d:
b = (a[1], a[0])
if b in d:
ans += d[a] * d[b]
return ans
if __name__ == "__main__... | def main():
N = int(eval(input()))
d = dict()
for i in range(1, N + 1):
u = int(str(i)[0])
v = int(str(i)[-1])
d[(u, v)] = d.get((u, v), 0) + 1
ans = 0
for u, v in d:
if (v, u) in d:
ans += d[(u, v)] * d[(v, u)]
return ans
if __name__ == "__main__":
... | false | 9.52381 | [
"-import collections",
"-",
"-",
"- d = collections.defaultdict(int)",
"+ d = dict()",
"- s = str(i)",
"- d[(s[0], s[-1])] += 1",
"+ u = int(str(i)[0])",
"+ v = int(str(i)[-1])",
"+ d[(u, v)] = d.get((u, v), 0) + 1",
"- for a in d:",
"- b = (a... | false | 0.042405 | 0.0573 | 0.740048 | [
"s068341570",
"s126133175"
] |
u425177436 | p02678 | python | s840356219 | s871241816 | 706 | 439 | 42,000 | 41,632 | Accepted | Accepted | 37.82 | from collections import deque
n, m = list(map(int, input().split()))
G = [[] for _ in range(n+1)]
for _ in range(m):
u, v = list(map(int, input().split()))
G[u].append(v)
G[v].append(u)
q = deque([1])
p = [0]*(n+1)
while q:
v = q.popleft()
for u in G[v]:
if p[u] == 0:
... | import sys
input = sys.stdin.readline
from collections import deque
n, m = list(map(int, input().split()))
G = [[] for _ in range(n+1)]
for _ in range(m):
u, v = list(map(int, input().split()))
G[u].append(v)
G[v].append(u)
q = deque([1])
p = [0]*(n+1)
while q:
v = q.popleft()
for u in ... | 16 | 18 | 386 | 426 | from collections import deque
n, m = list(map(int, input().split()))
G = [[] for _ in range(n + 1)]
for _ in range(m):
u, v = list(map(int, input().split()))
G[u].append(v)
G[v].append(u)
q = deque([1])
p = [0] * (n + 1)
while q:
v = q.popleft()
for u in G[v]:
if p[u] == 0:
p[u]... | import sys
input = sys.stdin.readline
from collections import deque
n, m = list(map(int, input().split()))
G = [[] for _ in range(n + 1)]
for _ in range(m):
u, v = list(map(int, input().split()))
G[u].append(v)
G[v].append(u)
q = deque([1])
p = [0] * (n + 1)
while q:
v = q.popleft()
for u in G[v]:... | false | 11.111111 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.058483 | 0.085049 | 0.68764 | [
"s840356219",
"s871241816"
] |
u883048396 | p03645 | python | s813082960 | s388581421 | 678 | 309 | 104,548 | 53,548 | Accepted | Accepted | 54.42 | import sys
def 解():
iN,iM = [int(_) for _ in input().split()]
aAB = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]
dT = {}
def addTree(dT,a,b):
if a in dT:
dT[a].add(b)
else:
dT[a] = {b}
for a,b in aAB:
addTree(dT,a,b)
... | import sys
def 解():
iN,iM = [int(_) for _ in input().split()]
aAB = [[int(_) for _ in sLine.split() ] for sLine in sys.stdin.readlines()]
d1 = set()
dN = set()
for a,b in aAB:
if a == 1 :
d1.add(b)
if b == iN:
dN.add(a)
if d1 & dN == set():
... | 20 | 16 | 521 | 388 | import sys
def 解():
iN, iM = [int(_) for _ in input().split()]
aAB = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]
dT = {}
def addTree(dT, a, b):
if a in dT:
dT[a].add(b)
else:
dT[a] = {b}
for a, b in aAB:
addTree(dT, a, b)
... | import sys
def 解():
iN, iM = [int(_) for _ in input().split()]
aAB = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]
d1 = set()
dN = set()
for a, b in aAB:
if a == 1:
d1.add(b)
if b == iN:
dN.add(a)
if d1 & dN == set():
print... | false | 20 | [
"- dT = {}",
"-",
"- def addTree(dT, a, b):",
"- if a in dT:",
"- dT[a].add(b)",
"- else:",
"- dT[a] = {b}",
"-",
"+ d1 = set()",
"+ dN = set()",
"- addTree(dT, a, b)",
"- addTree(dT, b, a)",
"- if 1 not in dT or iN not in dT:"... | false | 0.041415 | 0.040841 | 1.014055 | [
"s813082960",
"s388581421"
] |
u095021077 | p03603 | python | s469394934 | s764909574 | 235 | 123 | 148,880 | 97,968 | Accepted | Accepted | 47.66 | N=int(input())
P=list(map(int, input().split()))
X=[0]+list(map(int, input().split()))
ko=[[] for _ in range(N+1)]
for i, p in enumerate(P, 2):
ko[p].append(i)
def f(p):
n=len(ko[p])
if n==0:
return X[p], 0
dp=[[float('inf')]*5001 for _ in range(n+1)]
dp[0][0]=0
for i, c in enumerate... | N=int(input())
P=list(map(int, input().split()))
X=[0]+list(map(int, input().split()))
ko=[[] for _ in range(N+1)]
for i, p in enumerate(P, 2):
ko[p].append(i)
def f(p):
n=len(ko[p])
if n==0:
return X[p], 0
dp=[[float('inf')]*(X[p]+1) for _ in range(n+1)]
dp[0][0]=0
for i, c in enume... | 31 | 31 | 734 | 733 | N = int(input())
P = list(map(int, input().split()))
X = [0] + list(map(int, input().split()))
ko = [[] for _ in range(N + 1)]
for i, p in enumerate(P, 2):
ko[p].append(i)
def f(p):
n = len(ko[p])
if n == 0:
return X[p], 0
dp = [[float("inf")] * 5001 for _ in range(n + 1)]
dp[0][0] = 0
... | N = int(input())
P = list(map(int, input().split()))
X = [0] + list(map(int, input().split()))
ko = [[] for _ in range(N + 1)]
for i, p in enumerate(P, 2):
ko[p].append(i)
def f(p):
n = len(ko[p])
if n == 0:
return X[p], 0
dp = [[float("inf")] * (X[p] + 1) for _ in range(n + 1)]
dp[0][0] =... | false | 0 | [
"- dp = [[float(\"inf\")] * 5001 for _ in range(n + 1)]",
"+ dp = [[float(\"inf\")] * (X[p] + 1) for _ in range(n + 1)]",
"- for j in range(a, 5001):",
"+ for j in range(a, X[p] + 1):",
"- for j in range(b, 5001):",
"+ for j in range(b, X[p] + 1):",
"- out = min(dp[-... | false | 0.082023 | 0.08567 | 0.957427 | [
"s469394934",
"s764909574"
] |
u281303342 | p04013 | python | s517853141 | s171970957 | 1,166 | 1,063 | 65,520 | 65,504 | Accepted | Accepted | 8.83 | N,A = list(map(int,input().split()))
X = [0]+list(map(int,input().split()))
# dp[n][k][s] : n枚目までからk枚選んで合計をsにする場合の数
dp = [[[0 for _ in range(2501)] for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1
for n in range(1,N+1):
for k in range(n+1):
for s in range(50*k+1):
if s<X[n]:... | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
N,A = list(map(int,input().split()))
X = [0] + list(map(int,input().split()))
# dp[n][k][d] : n枚からk枚選んで合計dにする選び方
dp = [[[0 for _ in range(50*N+1)] for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1
for n in range(N+1):
for k in ra... | 20 | 30 | 538 | 763 | N, A = list(map(int, input().split()))
X = [0] + list(map(int, input().split()))
# dp[n][k][s] : n枚目までからk枚選んで合計をsにする場合の数
dp = [[[0 for _ in range(2501)] for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0][0] = 1
for n in range(1, N + 1):
for k in range(n + 1):
for s in range(50 * k + 1):
if s... | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
N, A = list(map(int, input().split()))
X = [0] + list(map(int, input().split()))
# dp[n][k][d] : n枚からk枚選んで合計dにする選び方
dp = [[[0 for _ in range(50 * N + 1)] for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0][0] = 1
for n in range(N + 1):
for k in rang... | false | 33.333333 | [
"+# python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# main",
"-# dp[n][k][s] : n枚目までからk枚選んで合計をsにする場合の数",
"-dp = [[[0 for _ in range(2501)] for _ in range(N + 1)] for _ in range(N + 1)]",
"+# dp[n][k][d] : n枚からk枚選んで合計dにする選び方",
"+dp = [[[0 for _ in range(50 * N + 1)] for _ in ra... | false | 0.140033 | 0.06303 | 2.221702 | [
"s517853141",
"s171970957"
] |
u287500079 | p02861 | python | s210493061 | s265058764 | 476 | 288 | 9,924 | 66,284 | Accepted | Accepted | 39.5 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import asci... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string... | 29 | 36 | 1,081 | 1,256 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowe... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
radians,
acos,
atan,
asin,
log,
log10,
)
from itertools import permutations, combinations, product, accumulate
from operator import it... | false | 19.444444 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin",
"+from math import (",
"+ ceil,",
"+ sqrt,",
"+ hypot,",
"+ factorial,",
"+ pi,",
"+ sin,",
"+ cos,",
"+ radians,",
"+ acos,",
"+ atan,",
"+ asin,",
"+ log,",
"+... | false | 0.03976 | 0.049854 | 0.797531 | [
"s210493061",
"s265058764"
] |
u645250356 | p03951 | python | s540216060 | s312422168 | 280 | 37 | 64,492 | 10,352 | Accepted | Accepted | 86.79 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 23 | 22 | 610 | 551 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 4.347826 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"-mod2 = 998244353",
"-",
"-",
"-def inpln(n):",
"... | false | 0.070641 | 0.037295 | 1.894103 | [
"s540216060",
"s312422168"
] |
u021019433 | p02888 | python | s651529623 | s137104874 | 1,557 | 962 | 3,188 | 3,188 | Accepted | Accepted | 38.21 | from bisect import bisect_right
n = int(eval(input()))
a = sorted(map(int, input().split()))
r = 0
for i in range(2, n):
j = i - 1
while j and a[j - 1] + a[j] > a[i]:
r += j - bisect_right(a, a[i] - a[j], 0, j)
j -= 1
print(r)
| from bisect import bisect_right
n = int(eval(input()))
a = sorted(map(int, input().split()))
print((sum(j - bisect_right(a, a[i] - a[j], 0, j)
for i in range(2, n) for j in range(1, i))))
| 11 | 6 | 256 | 196 | from bisect import bisect_right
n = int(eval(input()))
a = sorted(map(int, input().split()))
r = 0
for i in range(2, n):
j = i - 1
while j and a[j - 1] + a[j] > a[i]:
r += j - bisect_right(a, a[i] - a[j], 0, j)
j -= 1
print(r)
| from bisect import bisect_right
n = int(eval(input()))
a = sorted(map(int, input().split()))
print(
(
sum(
j - bisect_right(a, a[i] - a[j], 0, j)
for i in range(2, n)
for j in range(1, i)
)
)
)
| false | 45.454545 | [
"-r = 0",
"-for i in range(2, n):",
"- j = i - 1",
"- while j and a[j - 1] + a[j] > a[i]:",
"- r += j - bisect_right(a, a[i] - a[j], 0, j)",
"- j -= 1",
"-print(r)",
"+print(",
"+ (",
"+ sum(",
"+ j - bisect_right(a, a[i] - a[j], 0, j)",
"+ f... | false | 0.091402 | 0.081661 | 1.119276 | [
"s651529623",
"s137104874"
] |
u021019433 | p02866 | python | s799646641 | s572474442 | 196 | 166 | 22,636 | 22,636 | Accepted | Accepted | 15.31 | from collections import Counter
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
x, c, r = next(a), Counter(a), 0
if x == c[0] == 0:
r = p = i = 1
while c[i]:
r = r * pow(p, c[i], M) % M
p = c[i]; n -= p; i += 1
print(((r, 0)[n > 1]))
| from collections import Counter
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
x, c = next(a), Counter(a)
r = 0
if x == c[0] == 0:
r = p = i = 1
try:
while True:
x = c.get(i)
r = r * pow(p, x, M) % M
p = x; n -= p; i += 1
... | 12 | 17 | 282 | 352 | from collections import Counter
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
x, c, r = next(a), Counter(a), 0
if x == c[0] == 0:
r = p = i = 1
while c[i]:
r = r * pow(p, c[i], M) % M
p = c[i]
n -= p
i += 1
print(((r, 0)[n > 1]))
| from collections import Counter
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
x, c = next(a), Counter(a)
r = 0
if x == c[0] == 0:
r = p = i = 1
try:
while True:
x = c.get(i)
r = r * pow(p, x, M) % M
p = x
n -= p
i +=... | false | 29.411765 | [
"-x, c, r = next(a), Counter(a), 0",
"+x, c = next(a), Counter(a)",
"+r = 0",
"- while c[i]:",
"- r = r * pow(p, c[i], M) % M",
"- p = c[i]",
"- n -= p",
"- i += 1",
"+ try:",
"+ while True:",
"+ x = c.get(i)",
"+ r = r * pow(p, x,... | false | 0.043027 | 0.046133 | 0.932682 | [
"s799646641",
"s572474442"
] |
u086566114 | p02412 | python | s748955745 | s980382665 | 40 | 20 | 6,376 | 6,356 | Accepted | Accepted | 50 | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(n2 - 1, 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
return ans
dat... | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
r... | 25 | 25 | 602 | 620 | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(n2 - 1, 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
return ans
data = []
whil... | def get_num(n, x):
ans = 0
for n3 in range(min(n, x), (x + 2) / 3, -1):
for n2 in range(min(n3 - 1, x - n3), (x - n3 + 1) / 2 - 1, -1):
for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1):
if n1 + n2 + n3 == x:
ans += 1
break
return an... | false | 0 | [
"- for n1 in range(n2 - 1, 0, -1):",
"+ for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1):"
] | false | 0.043545 | 0.035674 | 1.220634 | [
"s748955745",
"s980382665"
] |
u279955105 | p02397 | python | s137587374 | s086514122 | 90 | 80 | 7,584 | 7,540 | Accepted | Accepted | 11.11 | i = 1
while True:
a,b = list(map(int, input().split()))
if (a == 0 and b == 0):
break
elif (b < a):
print((b, a))
else:
print((a, b))
| while True:
a,b = list(map(int, input().split()))
if a == 0 and b ==0:
break
elif a < b:
print((a,b))
else:
print((b,a)) | 11 | 8 | 155 | 163 | i = 1
while True:
a, b = list(map(int, input().split()))
if a == 0 and b == 0:
break
elif b < a:
print((b, a))
else:
print((a, b))
| while True:
a, b = list(map(int, input().split()))
if a == 0 and b == 0:
break
elif a < b:
print((a, b))
else:
print((b, a))
| false | 27.272727 | [
"-i = 1",
"- elif b < a:",
"+ elif a < b:",
"+ print((a, b))",
"+ else:",
"- else:",
"- print((a, b))"
] | false | 0.042847 | 0.043616 | 0.982368 | [
"s137587374",
"s086514122"
] |
u332906195 | p03805 | python | s417801207 | s224587665 | 44 | 33 | 4,340 | 3,064 | Accepted | Accepted | 25 | # -*- coding: utf-8 -*-
from collections import deque
N, M = list(map(int, input().split()))
Ms = {i:set() for i in range(1, N + 1)}
for _ in range(M):
a, b = list(map(int, input().split()))
Ms[a].add(b)
Ms[b].add(a)
all = set(range(1, N + 1))
q = deque()
q.append((1, [1]))
ans = 0
while... | N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
A, B = list(map(int, input().split()))
G[A - 1].append(B - 1)
G[B - 1].append(A - 1)
path, ans = [[0]], 0
while len(path) > 0:
p = path.pop()
if len(p) == N:
ans += 1
else:
for g in... | 26 | 18 | 494 | 399 | # -*- coding: utf-8 -*-
from collections import deque
N, M = list(map(int, input().split()))
Ms = {i: set() for i in range(1, N + 1)}
for _ in range(M):
a, b = list(map(int, input().split()))
Ms[a].add(b)
Ms[b].add(a)
all = set(range(1, N + 1))
q = deque()
q.append((1, [1]))
ans = 0
while q:
n, v = q.p... | N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
A, B = list(map(int, input().split()))
G[A - 1].append(B - 1)
G[B - 1].append(A - 1)
path, ans = [[0]], 0
while len(path) > 0:
p = path.pop()
if len(p) == N:
ans += 1
else:
for g in G[p[-1]]:
... | false | 30.769231 | [
"-# -*- coding: utf-8 -*-",
"-from collections import deque",
"-",
"-Ms = {i: set() for i in range(1, N + 1)}",
"+G = [[] for _ in range(N)]",
"- a, b = list(map(int, input().split()))",
"- Ms[a].add(b)",
"- Ms[b].add(a)",
"-all = set(range(1, N + 1))",
"-q = deque()",
"-q.append((1, [1... | false | 0.039678 | 0.045829 | 0.865778 | [
"s417801207",
"s224587665"
] |
u732870425 | p03578 | python | s737154822 | s510879125 | 361 | 325 | 56,788 | 56,672 | Accepted | Accepted | 9.97 | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
dicD = {}
dicT = {}
for d in D:
if d not in dicD:
dicD[d] = 0
dicD[d] += 1
for t in T:
if t not in dicT:
dicT[t] = 0
dicT[t] += 1
for t in dicT:
... | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
dicD = {}
dicT = {}
for d in D:
if d not in dicD:
dicD[d] = 0
dicD[d] += 1
for t in T:
if t not in dicT:
dicT[t] = 0
dicT[t] += 1
for t in dicT:
... | 27 | 24 | 453 | 413 | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
dicD = {}
dicT = {}
for d in D:
if d not in dicD:
dicD[d] = 0
dicD[d] += 1
for t in T:
if t not in dicT:
dicT[t] = 0
dicT[t] += 1
for t in dicT:
if t not in dicD:
... | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
dicD = {}
dicT = {}
for d in D:
if d not in dicD:
dicD[d] = 0
dicD[d] += 1
for t in T:
if t not in dicT:
dicT[t] = 0
dicT[t] += 1
for t in dicT:
if (t not in dicD) or... | false | 11.111111 | [
"- if t not in dicD:",
"- print(\"NO\")",
"- break",
"- elif dicT[t] > dicD[t]:",
"+ if (t not in dicD) or (dicT[t] > dicD[t]):"
] | false | 0.039338 | 0.041199 | 0.95483 | [
"s737154822",
"s510879125"
] |
u924691798 | p03762 | python | s665559978 | s493052521 | 161 | 135 | 106,908 | 24,372 | Accepted | Accepted | 16.15 | MOD = 10**9+7
n, m = list(map(int, input().split()))
X = list(map(int ,input().split()))
Y = list(map(int ,input().split()))
X.sort()
Y.sort()
mx, my = X[n-1], Y[m-1]
SX, SY = [0], [0]
for i in range(n):
SX.append(mx-X[i])
for i in range(n):
SX[i+1] += SX[i]
for i in range(m):
SY.append(my-Y[i]... | MOD = 10**9+7
n, m = list(map(int, input().split()))
X = list(map(int ,input().split()))
Y = list(map(int ,input().split()))
X.sort()
Y.sort()
xx, yy = 0, 0
for i in range(n):
xx += X[i]*i
xx -= X[i]*(n-i-1)
for i in range(m):
yy += Y[i]*i
yy -= Y[i]*(m-i-1)
print((xx*yy%MOD))
| 31 | 14 | 632 | 299 | MOD = 10**9 + 7
n, m = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
X.sort()
Y.sort()
mx, my = X[n - 1], Y[m - 1]
SX, SY = [0], [0]
for i in range(n):
SX.append(mx - X[i])
for i in range(n):
SX[i + 1] += SX[i]
for i in range(m):
SY.append(my - Y[i])... | MOD = 10**9 + 7
n, m = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
X.sort()
Y.sort()
xx, yy = 0, 0
for i in range(n):
xx += X[i] * i
xx -= X[i] * (n - i - 1)
for i in range(m):
yy += Y[i] * i
yy -= Y[i] * (m - i - 1)
print((xx * yy % MOD))
| false | 54.83871 | [
"-mx, my = X[n - 1], Y[m - 1]",
"-SX, SY = [0], [0]",
"+xx, yy = 0, 0",
"- SX.append(mx - X[i])",
"-for i in range(n):",
"- SX[i + 1] += SX[i]",
"+ xx += X[i] * i",
"+ xx -= X[i] * (n - i - 1)",
"- SY.append(my - Y[i])",
"-for i in range(m):",
"- SY[i + 1] += SY[i]",
"-xx = 0... | false | 0.045738 | 0.092626 | 0.49379 | [
"s665559978",
"s493052521"
] |
u418996726 | p02257 | python | s853625473 | s761446592 | 70 | 60 | 5,628 | 5,620 | Accepted | Accepted | 14.29 | f=lambda x: 1 if x==2 or x==3 or (not x<2 and not x&1==0 and pow(2,x-1,x)==1) else 0
print((sum(f(int(eval(input()))) for _ in range(int(eval(input()))))))
| f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print((sum(f(int(eval(input()))) for _ in range(int(eval(input()))))))
| 2 | 2 | 143 | 141 | f = (
lambda x: 1
if x == 2 or x == 3 or (not x < 2 and not x & 1 == 0 and pow(2, x - 1, x) == 1)
else 0
)
print((sum(f(int(eval(input()))) for _ in range(int(eval(input()))))))
| f = (
lambda x: 1
if x == 2 or x == 3 or (x > 3 and x & 1 == 1 and pow(2, x - 1, x) == 1)
else 0
)
print((sum(f(int(eval(input()))) for _ in range(int(eval(input()))))))
| false | 0 | [
"- if x == 2 or x == 3 or (not x < 2 and not x & 1 == 0 and pow(2, x - 1, x) == 1)",
"+ if x == 2 or x == 3 or (x > 3 and x & 1 == 1 and pow(2, x - 1, x) == 1)"
] | false | 0.102553 | 0.045092 | 2.274317 | [
"s853625473",
"s761446592"
] |
u671861352 | p03007 | python | s214620428 | s362152960 | 1,803 | 300 | 18,904 | 20,828 | Accepted | Accepted | 83.36 | def successive_subtraction(N, A, i=1, l=[]):
mx = max(A)
mn = min(A)
if i == N - 1:
print((mx - mn))
return l
l.append((mn, mx))
A.remove(mn)
A.remove(mx)
A.append(mn - mx)
return successive_subtraction(N, A, i + 1, l)
N = int(eval(input()))
A = [int(e) for ... | from collections import deque
N = int(eval(input()))
A = deque(maxlen=N)
x = [int(e) for e in input().split()]
x.sort()
for a in x:
A.append(a)
l = []
for i in range(N - 2):
(a, b, c) = (A[0], A[1], A[-1])
if b < 0:
l.append((c, a))
A[-1] = c - a
else:
l.append((a... | 29 | 22 | 629 | 438 | def successive_subtraction(N, A, i=1, l=[]):
mx = max(A)
mn = min(A)
if i == N - 1:
print((mx - mn))
return l
l.append((mn, mx))
A.remove(mn)
A.remove(mx)
A.append(mn - mx)
return successive_subtraction(N, A, i + 1, l)
N = int(eval(input()))
A = [int(e) for e in input()... | from collections import deque
N = int(eval(input()))
A = deque(maxlen=N)
x = [int(e) for e in input().split()]
x.sort()
for a in x:
A.append(a)
l = []
for i in range(N - 2):
(a, b, c) = (A[0], A[1], A[-1])
if b < 0:
l.append((c, a))
A[-1] = c - a
else:
l.append((a, b))
A... | false | 24.137931 | [
"-def successive_subtraction(N, A, i=1, l=[]):",
"- mx = max(A)",
"- mn = min(A)",
"- if i == N - 1:",
"- print((mx - mn))",
"- return l",
"- l.append((mn, mx))",
"- A.remove(mn)",
"- A.remove(mx)",
"- A.append(mn - mx)",
"- return successive_subtraction(N, ... | false | 0.062825 | 0.05055 | 1.242839 | [
"s214620428",
"s362152960"
] |
u057109575 | p02720 | python | s593419152 | s235169285 | 516 | 92 | 82,856 | 74,484 | Accepted | Accepted | 82.17 |
from collections import deque
K = int(eval(input()))
q = deque(list(range(1, 10)))
cnt = 0
ans = 0
while True:
u = q.popleft()
cnt += 1
if cnt == K:
ans = u
break
ll = u % 10
for i in range(max(0, ll - 1), min(9, ll + 1) + 1):
q.append(u * 10 + i)
print(... |
from collections import deque
K = int(eval(input()))
q = deque(list(range(1, 10)))
for _ in range(K - 1):
u = q.popleft()
n = u % 10
for x in range(max(0, n - 1), min(9, n + 1) + 1):
q.append(u * 10 + x)
print((q.popleft()))
| 19 | 12 | 319 | 251 | from collections import deque
K = int(eval(input()))
q = deque(list(range(1, 10)))
cnt = 0
ans = 0
while True:
u = q.popleft()
cnt += 1
if cnt == K:
ans = u
break
ll = u % 10
for i in range(max(0, ll - 1), min(9, ll + 1) + 1):
q.append(u * 10 + i)
print(ans)
| from collections import deque
K = int(eval(input()))
q = deque(list(range(1, 10)))
for _ in range(K - 1):
u = q.popleft()
n = u % 10
for x in range(max(0, n - 1), min(9, n + 1) + 1):
q.append(u * 10 + x)
print((q.popleft()))
| false | 36.842105 | [
"-cnt = 0",
"-ans = 0",
"-while True:",
"+for _ in range(K - 1):",
"- cnt += 1",
"- if cnt == K:",
"- ans = u",
"- break",
"- ll = u % 10",
"- for i in range(max(0, ll - 1), min(9, ll + 1) + 1):",
"- q.append(u * 10 + i)",
"-print(ans)",
"+ n = u % 10",
... | false | 0.057517 | 0.123857 | 0.464384 | [
"s593419152",
"s235169285"
] |
u228232845 | p02761 | python | s900778170 | s843869794 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | n, m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
ans = float('inf')
k = 0
if n == 2: k = 10
elif n == 3: k = 100
for i in reversed(list(range(k, 1000))):
#print(f'i: {i}')
flg = True
for s, c in sc:
#print(f'{s}桁目が{c}?', end=' ')
if l... | n, m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
ans = float('inf')
k = 0
if n == 2: k = 10
elif n == 3: k = 100
for i in range(k, 1000):
flg = True
for s, c in sc:
if list(str(i))[s-1] == str(c): continue
flg = False
if flg:
... | 20 | 16 | 510 | 384 | n, m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
ans = float("inf")
k = 0
if n == 2:
k = 10
elif n == 3:
k = 100
for i in reversed(list(range(k, 1000))):
# print(f'i: {i}')
flg = True
for s, c in sc:
# print(f'{s}桁目が{c}?', end=' ')
if li... | n, m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
ans = float("inf")
k = 0
if n == 2:
k = 10
elif n == 3:
k = 100
for i in range(k, 1000):
flg = True
for s, c in sc:
if list(str(i))[s - 1] == str(c):
continue
flg = False
if fl... | false | 20 | [
"-for i in reversed(list(range(k, 1000))):",
"- # print(f'i: {i}')",
"+for i in range(k, 1000):",
"- # print(f'{s}桁目が{c}?', end=' ')",
"- # print('No!')",
"- ans = min(ans, i)",
"- # print('ans: ', ans)",
"+ ans = i",
"+ break"
] | false | 0.039738 | 0.03752 | 1.059117 | [
"s900778170",
"s843869794"
] |
u832039789 | p03845 | python | s487260807 | s128132573 | 31 | 18 | 3,444 | 2,940 | Accepted | Accepted | 41.94 | import copy
n=int(eval(input()))
t=list(map(int,input().split()))
m=int(eval(input()))
for i in range(m):
p,q=list(map(int,input().split()))
tmp=copy.deepcopy(t)
tmp[p-1]=q
print((sum(tmp)))
| n = int(eval(input()))
t = list(map(int,input().split()))
s = sum(t)
m = int(eval(input()))
for i in range(m):
p,x = list(map(int,input().split()))
print((s - t[p-1] + x))
| 9 | 7 | 195 | 166 | import copy
n = int(eval(input()))
t = list(map(int, input().split()))
m = int(eval(input()))
for i in range(m):
p, q = list(map(int, input().split()))
tmp = copy.deepcopy(t)
tmp[p - 1] = q
print((sum(tmp)))
| n = int(eval(input()))
t = list(map(int, input().split()))
s = sum(t)
m = int(eval(input()))
for i in range(m):
p, x = list(map(int, input().split()))
print((s - t[p - 1] + x))
| false | 22.222222 | [
"-import copy",
"-",
"+s = sum(t)",
"- p, q = list(map(int, input().split()))",
"- tmp = copy.deepcopy(t)",
"- tmp[p - 1] = q",
"- print((sum(tmp)))",
"+ p, x = list(map(int, input().split()))",
"+ print((s - t[p - 1] + x))"
] | false | 0.048254 | 0.067555 | 0.714294 | [
"s487260807",
"s128132573"
] |
u151005508 | p03805 | python | s822158710 | s603704506 | 32 | 29 | 3,064 | 3,064 | Accepted | Accepted | 9.38 | import itertools
N, M = list(map(int, input().split()))
ab=[]
for _ in range(M):
ab.append(tuple(map(int, input().split())))
lst=[[] for _ in range(N+1)]
for el in ab:
lst[el[0]].append(el[1])
lst[el[1]].append(el[0])
#print(lst)
count=0
for permu in itertools.permutations(list(range(1,N+1)... | N, M = list(map(int, input().split()))
ab=[]
for _ in range(M):
ab.append(tuple(map(int, input().split())))
lst=[[] for _ in range(N+1)]
for el in ab:
lst[el[0]].append(el[1])
lst[el[1]].append(el[0])
#print(lst)
seen=[False]*(N+1)
todo=[]
counter=0
def func(n):
global counter
... | 26 | 31 | 556 | 610 | import itertools
N, M = list(map(int, input().split()))
ab = []
for _ in range(M):
ab.append(tuple(map(int, input().split())))
lst = [[] for _ in range(N + 1)]
for el in ab:
lst[el[0]].append(el[1])
lst[el[1]].append(el[0])
# print(lst)
count = 0
for permu in itertools.permutations(list(range(1, N + 1))):
... | N, M = list(map(int, input().split()))
ab = []
for _ in range(M):
ab.append(tuple(map(int, input().split())))
lst = [[] for _ in range(N + 1)]
for el in ab:
lst[el[0]].append(el[1])
lst[el[1]].append(el[0])
# print(lst)
seen = [False] * (N + 1)
todo = []
counter = 0
def func(n):
global counter
# p... | false | 16.129032 | [
"-import itertools",
"-",
"-count = 0",
"-for permu in itertools.permutations(list(range(1, N + 1))):",
"- if permu[0] == 1:",
"- for i in range(0, N - 1):",
"- if permu[i + 1] in lst[permu[i]]:",
"- pass",
"- else:",
"- break",
"- ... | false | 0.053937 | 0.046435 | 1.161555 | [
"s822158710",
"s603704506"
] |
u692746605 | p02756 | python | s386710527 | s297882136 | 394 | 225 | 8,420 | 8,676 | Accepted | Accepted | 42.89 | import sys
#input=sys.stdin.readline
from collections import deque
r=False
d=deque(list(eval(input())))
for i in range(int(eval(input()))):
Q=input().split()
if Q[0]=='1':
r=not r
else:
if (Q[1]=='1' and not r) or (Q[1]=='2' and r):
d.appendleft(Q[2])
else:
d.append(Q[2])
... | import sys
input=lambda:sys.stdin.readline().rstrip()
from collections import deque
r=False
d=deque(list(eval(input())))
for i in range(int(eval(input()))):
Q=input().split()
if Q[0]=='1':
r=not r
else:
if (Q[1]=='1' and not r) or (Q[1]=='2' and r):
d.appendleft(Q[2])
else:
... | 20 | 20 | 357 | 374 | import sys
# input=sys.stdin.readline
from collections import deque
r = False
d = deque(list(eval(input())))
for i in range(int(eval(input()))):
Q = input().split()
if Q[0] == "1":
r = not r
else:
if (Q[1] == "1" and not r) or (Q[1] == "2" and r):
d.appendleft(Q[2])
els... | import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
r = False
d = deque(list(eval(input())))
for i in range(int(eval(input()))):
Q = input().split()
if Q[0] == "1":
r = not r
else:
if (Q[1] == "1" and not r) or (Q[1] == "2" and r):
d.appendlef... | false | 0 | [
"-# input=sys.stdin.readline",
"+input = lambda: sys.stdin.readline().rstrip()"
] | false | 0.148837 | 0.038173 | 3.899056 | [
"s386710527",
"s297882136"
] |
u673361376 | p03829 | python | s417926364 | s389658970 | 248 | 220 | 62,832 | 62,704 | Accepted | Accepted | 11.29 | N,A,B = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = 0
for i in range(N-1):
ans += min((X[i+1]-X[i])*A,B)
print(ans) | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
pos = X[0]
for i in range(1, N):
ans += min(A * (X[i] - pos), B)
pos = X[i]
print(ans)
| 6 | 8 | 144 | 182 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
ans += min((X[i + 1] - X[i]) * A, B)
print(ans)
| N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
pos = X[0]
for i in range(1, N):
ans += min(A * (X[i] - pos), B)
pos = X[i]
print(ans)
| false | 25 | [
"-for i in range(N - 1):",
"- ans += min((X[i + 1] - X[i]) * A, B)",
"+pos = X[0]",
"+for i in range(1, N):",
"+ ans += min(A * (X[i] - pos), B)",
"+ pos = X[i]"
] | false | 0.034869 | 0.035416 | 0.984551 | [
"s417926364",
"s389658970"
] |
u145950990 | p03238 | python | s264345865 | s801762353 | 166 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.76 | n = int(eval(input()))
if n==1:
print('Hello World')
else:
a = int(eval(input()))
b = int(eval(input()))
print((a+b))
| n = int(eval(input()))
if n==1:
print('Hello World')
exit()
a = int(eval(input()))
b = int(eval(input()))
print((a+b)) | 7 | 7 | 120 | 112 | n = int(eval(input()))
if n == 1:
print("Hello World")
else:
a = int(eval(input()))
b = int(eval(input()))
print((a + b))
| n = int(eval(input()))
if n == 1:
print("Hello World")
exit()
a = int(eval(input()))
b = int(eval(input()))
print((a + b))
| false | 0 | [
"-else:",
"- a = int(eval(input()))",
"- b = int(eval(input()))",
"- print((a + b))",
"+ exit()",
"+a = int(eval(input()))",
"+b = int(eval(input()))",
"+print((a + b))"
] | false | 0.08473 | 0.043863 | 1.93171 | [
"s264345865",
"s801762353"
] |
u268402865 | p02612 | python | s330655905 | s453383024 | 32 | 26 | 9,156 | 9,108 | Accepted | Accepted | 18.75 | N = int(eval(input()))
print(((1000-N%1000)%1000)) | N = int(eval(input()))
tmp = N%1000
if tmp == 0:
print((0))
else:
print((1000 - tmp)) | 2 | 6 | 43 | 88 | N = int(eval(input()))
print(((1000 - N % 1000) % 1000))
| N = int(eval(input()))
tmp = N % 1000
if tmp == 0:
print((0))
else:
print((1000 - tmp))
| false | 66.666667 | [
"-print(((1000 - N % 1000) % 1000))",
"+tmp = N % 1000",
"+if tmp == 0:",
"+ print((0))",
"+else:",
"+ print((1000 - tmp))"
] | false | 0.088556 | 0.113154 | 0.782612 | [
"s330655905",
"s453383024"
] |
u102461423 | p02913 | python | s458979573 | s642962303 | 917 | 163 | 14,796 | 12,932 | Accepted | Accepted | 82.22 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np
N = int(eval(input()))
S = np.array([ord(x) for x in input().rstrip()],dtype=np.int64)
MOD = 10**9 + 7
base = 1234
def cumprod(arr):
L = len(arr); Lsq = int(L**.5+1)
arr = np.resize(arr,Lsq**2).reshape(Lsq,... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np
N = int(eval(input()))
S = np.array([ord(x) for x in input().rstrip()],dtype=np.int64)
MOD = 10**9 + 7
base = 1234
def cumprod(arr):
L = len(arr); Lsq = int(L**.5+1)
arr = np.resize(arr,Lsq**2).reshape(Lsq,... | 51 | 58 | 1,152 | 1,427 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import numpy as np
N = int(eval(input()))
S = np.array([ord(x) for x in input().rstrip()], dtype=np.int64)
MOD = 10**9 + 7
base = 1234
def cumprod(arr):
L = len(arr)
Lsq = int(L**0.5 + 1)
arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import numpy as np
N = int(eval(input()))
S = np.array([ord(x) for x in input().rstrip()], dtype=np.int64)
MOD = 10**9 + 7
base = 1234
def cumprod(arr):
L = len(arr)
Lsq = int(L**0.5 + 1)
arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
... | false | 12.068966 | [
"- for i, a in np.ndenumerate(x):",
"- if (x[i[0] + n :] == a).any():",
"- return True",
"- return False",
"+ # 距離n以上離れたところで連番が存在しないといけない",
"+ ind = np.lexsort((np.arange(N - n + 1), x))",
"+ x = x[ind]",
"+ is_left_end = np.zeros(N - n + 1, np.bool)",
"+ is_le... | false | 0.234086 | 0.338069 | 0.692421 | [
"s458979573",
"s642962303"
] |
u623819879 | p03264 | python | s989454277 | s040896648 | 120 | 67 | 61,604 | 61,624 | Accepted | Accepted | 44.17 | k=int(eval(input()));print((k*k//4)) | print((int(eval(input()))**2//4)) | 1 | 1 | 28 | 25 | k = int(eval(input()))
print((k * k // 4))
| print((int(eval(input())) ** 2 // 4))
| false | 0 | [
"-k = int(eval(input()))",
"-print((k * k // 4))",
"+print((int(eval(input())) ** 2 // 4))"
] | false | 0.04138 | 0.078242 | 0.528876 | [
"s989454277",
"s040896648"
] |
u471797506 | p03599 | python | s260680898 | s918719530 | 788 | 130 | 2,692 | 2,692 | Accepted | Accepted | 83.5 | A, B, C, D, E, F = list(map(int, input().split()))
mx = 0
mx_x = 100*A
mx_y = 0
for i in range(31):
for j in range(16):
for k in range(101):
for l in range(51):
if 100*A*i + 100*B*j + C*k + D*l > F: continue
if (A*i + B*j)*E < C*k + D*l: continue
... | A, B, C, D, E, F = list(map(int, input().split()))
mx = 0
mx_x = 100*A
mx_y = 0
for i in range(31):
for j in range(16):
if i + j == 0 or 100*A*i + 100*B*j >= F: continue
for k in range(101):
for l in range(51):
if 100*A*i + 100*B*j + C*k + D*l > F: continue
... | 18 | 19 | 562 | 611 | A, B, C, D, E, F = list(map(int, input().split()))
mx = 0
mx_x = 100 * A
mx_y = 0
for i in range(31):
for j in range(16):
for k in range(101):
for l in range(51):
if 100 * A * i + 100 * B * j + C * k + D * l > F:
continue
if (A * i + B * j) * E... | A, B, C, D, E, F = list(map(int, input().split()))
mx = 0
mx_x = 100 * A
mx_y = 0
for i in range(31):
for j in range(16):
if i + j == 0 or 100 * A * i + 100 * B * j >= F:
continue
for k in range(101):
for l in range(51):
if 100 * A * i + 100 * B * j + C * k + ... | false | 5.263158 | [
"+ if i + j == 0 or 100 * A * i + 100 * B * j >= F:",
"+ continue",
"- if a > 0 and 100.0 * b / (a + b) > mx:",
"+ if 100.0 * b / (a + b) > mx:"
] | false | 1.217498 | 0.330195 | 3.68721 | [
"s260680898",
"s918719530"
] |
u547085427 | p03332 | python | s916787220 | s742497327 | 648 | 541 | 64,580 | 26,720 | Accepted | Accepted | 16.51 | n, a, b, k = list(map(int, input().split()))
MOD = 998244353
a_max = min(k // a, n) + 1
pair = []
for i in range(a_max):
if (k - a * i) % b == 0:
j = (k - a * i) // b
if j <= n:
pair.append([i % MOD,j % MOD])
inv = [0] * (n + 1)
inv[1] = 1
for i in range(2, n + 1):
i... | # coding: utf-8
# Your code here!
n, a, b, k = list(map(int, input().split()))
MOD = 998244353
inv = [0] * ( n + 1)
inv[1] = 1
for i in range(2, n + 1):
inv[i] = (-(MOD // i) * inv[MOD % i]) % MOD
nCr = [0] * ( n + 1)
nCr[0] = 1
for i in range(1, n+1):
nCr[i] = (nCr[i-1] * (n - i + 1) * inv[i])... | 29 | 27 | 622 | 574 | n, a, b, k = list(map(int, input().split()))
MOD = 998244353
a_max = min(k // a, n) + 1
pair = []
for i in range(a_max):
if (k - a * i) % b == 0:
j = (k - a * i) // b
if j <= n:
pair.append([i % MOD, j % MOD])
inv = [0] * (n + 1)
inv[1] = 1
for i in range(2, n + 1):
inv[i] = (-(MOD /... | # coding: utf-8
# Your code here!
n, a, b, k = list(map(int, input().split()))
MOD = 998244353
inv = [0] * (n + 1)
inv[1] = 1
for i in range(2, n + 1):
inv[i] = (-(MOD // i) * inv[MOD % i]) % MOD
nCr = [0] * (n + 1)
nCr[0] = 1
for i in range(1, n + 1):
nCr[i] = (nCr[i - 1] * (n - i + 1) * inv[i]) % MOD
result =... | false | 6.896552 | [
"+# coding: utf-8",
"+# Your code here!",
"-a_max = min(k // a, n) + 1",
"-pair = []",
"-for i in range(a_max):",
"- if (k - a * i) % b == 0:",
"- j = (k - a * i) // b",
"- if j <= n:",
"- pair.append([i % MOD, j % MOD])",
"-for r in range(1, n + 1):",
"- nCr[r] = ... | false | 0.073304 | 0.094881 | 0.772585 | [
"s916787220",
"s742497327"
] |
u502389123 | p03240 | python | s510227931 | s085384855 | 108 | 38 | 3,064 | 3,064 | Accepted | Accepted | 64.81 | N = int(eval(input()))
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split()))
flag = False
for cx in range(101):
for cy in range(101):
needH = -1
for i in range(N):
if h[i] > 0:
H = abs(x[i] - cx) + abs(... | N = int(eval(input()))
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh.sort(key=lambda x: x[2])
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
x[i], y[i], h[i] = xyh[i][0], xyh[i][1], xyh[i][2]
flag = False
for cx in range(101):
for cy in range(101):
needH = -1
... | 40 | 39 | 1,012 | 1,022 | N = int(eval(input()))
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split()))
flag = False
for cx in range(101):
for cy in range(101):
needH = -1
for i in range(N):
if h[i] > 0:
H = abs(x[i] - cx) + abs(y[i] - cy) + h... | N = int(eval(input()))
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh.sort(key=lambda x: x[2])
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
x[i], y[i], h[i] = xyh[i][0], xyh[i][1], xyh[i][2]
flag = False
for cx in range(101):
for cy in range(101):
needH = -1
for i in ran... | false | 2.5 | [
"+xyh = [list(map(int, input().split())) for _ in range(N)]",
"+xyh.sort(key=lambda x: x[2])",
"- x[i], y[i], h[i] = list(map(int, input().split()))",
"+ x[i], y[i], h[i] = xyh[i][0], xyh[i][1], xyh[i][2]",
"- for i in range(N):",
"+ for i in range(N - 1, -1, -1):",
"- if need... | false | 0.047455 | 0.041252 | 1.150362 | [
"s510227931",
"s085384855"
] |
u936985471 | p03660 | python | s927737244 | s605648281 | 677 | 463 | 29,036 | 29,156 | Accepted | Accepted | 31.61 | N=int(eval(input()))
E=[[] for i in range(N)]
for i in range(N-1):
a,b=list(map(int,input().split()))
a,b=a-1,b-1
E[a].append(b)
E[b].append(a)
F=[0]*N
S=[0]*N
stack=[]
# 番号、距離、親
stack.append([0,0,-1])
while stack:
node=stack.pop()
v=node[0]
dist=node[1]
parent=node[2]
F[v]=dist
... | # 全ての頂点について、フェネックからの距離とすぬけくんからの距離を求める
# フェネックからの距離 <= すぬけくんから距離 の頂点は黒 そうでなければ白
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a,b = list(map(int,readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
dist_from_fen = [-1 ... | 49 | 45 | 820 | 980 | N = int(eval(input()))
E = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
E[a].append(b)
E[b].append(a)
F = [0] * N
S = [0] * N
stack = []
# 番号、距離、親
stack.append([0, 0, -1])
while stack:
node = stack.pop()
v = node[0]
dist = node[1]
... | # 全ての頂点について、フェネックからの距離とすぬけくんからの距離を求める
# フェネックからの距離 <= すぬけくんから距離 の頂点は黒 そうでなければ白
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
dist_from_fen = [-1 for i in ... | false | 8.163265 | [
"-N = int(eval(input()))",
"-E = [[] for i in range(N)]",
"+# 全ての頂点について、フェネックからの距離とすぬけくんからの距離を求める",
"+# フェネックからの距離 <= すぬけくんから距離 の頂点は黒 そうでなければ白",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+G = [[] for i in range(N)]",
"- a, b = list(map(int, input().split()))... | false | 0.049001 | 0.044991 | 1.089114 | [
"s927737244",
"s605648281"
] |
u497952650 | p03719 | python | s229700236 | s125837280 | 21 | 17 | 9,140 | 2,940 | Accepted | Accepted | 19.05 | A,B,C = list(map(int,input().split()))
if A <= C <= B:
print("Yes")
else:
print("No") | A,B,C = list(map(int,input().split()))
print(("Yes" if A <= C <= B else "No")) | 6 | 3 | 93 | 73 | A, B, C = list(map(int, input().split()))
if A <= C <= B:
print("Yes")
else:
print("No")
| A, B, C = list(map(int, input().split()))
print(("Yes" if A <= C <= B else "No"))
| false | 50 | [
"-if A <= C <= B:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((\"Yes\" if A <= C <= B else \"No\"))"
] | false | 0.119613 | 0.045462 | 2.631055 | [
"s229700236",
"s125837280"
] |
u411203878 | p02888 | python | s842470768 | s975582887 | 737 | 341 | 44,424 | 74,216 | Accepted | Accepted | 53.73 | import bisect
N = int(eval(input()))
L = sorted([int(x) for x in input().split()])
cnt = 0
#print(L)
for i in range(N-2):
for j in range(i+1, N-1):
#print(i, j)
#print(bisect.bisect_left(L, L[i]+L[j]))
cnt += bisect.bisect_left(L, L[i]+L[j]) - (j+1)
print(cnt) | import bisect
N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(N-2):
for j in range(i+1,N-1):
tmp = L[i]+L[j]
point = bisect.bisect_left(L,tmp)
ans += point - j - 1
print(ans)
| 11 | 13 | 293 | 260 | import bisect
N = int(eval(input()))
L = sorted([int(x) for x in input().split()])
cnt = 0
# print(L)
for i in range(N - 2):
for j in range(i + 1, N - 1):
# print(i, j)
# print(bisect.bisect_left(L, L[i]+L[j]))
cnt += bisect.bisect_left(L, L[i] + L[j]) - (j + 1)
print(cnt)
| import bisect
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
tmp = L[i] + L[j]
point = bisect.bisect_left(L, tmp)
ans += point - j - 1
print(ans)
| false | 15.384615 | [
"-L = sorted([int(x) for x in input().split()])",
"-cnt = 0",
"-# print(L)",
"+L = list(map(int, input().split()))",
"+L.sort()",
"+ans = 0",
"- # print(i, j)",
"- # print(bisect.bisect_left(L, L[i]+L[j]))",
"- cnt += bisect.bisect_left(L, L[i] + L[j]) - (j + 1)",
"-print(cnt)... | false | 0.082304 | 0.043591 | 1.888085 | [
"s842470768",
"s975582887"
] |
u546285759 | p00004 | python | s204887286 | s293430305 | 30 | 20 | 7,568 | 7,636 | Accepted | Accepted | 33.33 | while True:
try:
a, b, c, d, e, f = list(map(int, input().split()))
tb, tc = d*b, d*c
te, tf = a*e, a*f
y = (tc-tf)/(tb-te)
x = (c-(y*b))/a
print(("{0:.3f} {1:.3f}".format(x, y)))
except:
break | while True:
try:
a, b, c, d, e, f = list(map(int, input().split()))
except:
break
y = (c*d-f*a) / (b*d-e*a)
x = (c - b*y) / a
print(("{:.3f} {:.3f}".format(x, y))) | 11 | 8 | 260 | 198 | while True:
try:
a, b, c, d, e, f = list(map(int, input().split()))
tb, tc = d * b, d * c
te, tf = a * e, a * f
y = (tc - tf) / (tb - te)
x = (c - (y * b)) / a
print(("{0:.3f} {1:.3f}".format(x, y)))
except:
break
| while True:
try:
a, b, c, d, e, f = list(map(int, input().split()))
except:
break
y = (c * d - f * a) / (b * d - e * a)
x = (c - b * y) / a
print(("{:.3f} {:.3f}".format(x, y)))
| false | 27.272727 | [
"- tb, tc = d * b, d * c",
"- te, tf = a * e, a * f",
"- y = (tc - tf) / (tb - te)",
"- x = (c - (y * b)) / a",
"- print((\"{0:.3f} {1:.3f}\".format(x, y)))",
"+ y = (c * d - f * a) / (b * d - e * a)",
"+ x = (c - b * y) / a",
"+ print((\"{:.3f} {:.3f}\".for... | false | 0.049752 | 0.137967 | 0.36061 | [
"s204887286",
"s293430305"
] |
u607563136 | p02791 | python | s923760318 | s605166962 | 127 | 109 | 32,224 | 32,320 | Accepted | Accepted | 14.17 | n = int(eval(input()))
p = list(map(int,input().split()))
minp = p[0]
cnt = 0
for i in range(n):
if p[i]<=minp:cnt+=1
minp = min(minp,p[i])
print(cnt) | def main():
n = int(eval(input()))
p = list(map(int,input().split()))
minp = p[0]
cnt = 0
for i in range(n):
if p[i]<=minp:cnt+=1
minp = min(minp,p[i])
print(cnt)
main() | 8 | 10 | 159 | 212 | n = int(eval(input()))
p = list(map(int, input().split()))
minp = p[0]
cnt = 0
for i in range(n):
if p[i] <= minp:
cnt += 1
minp = min(minp, p[i])
print(cnt)
| def main():
n = int(eval(input()))
p = list(map(int, input().split()))
minp = p[0]
cnt = 0
for i in range(n):
if p[i] <= minp:
cnt += 1
minp = min(minp, p[i])
print(cnt)
main()
| false | 20 | [
"-n = int(eval(input()))",
"-p = list(map(int, input().split()))",
"-minp = p[0]",
"-cnt = 0",
"-for i in range(n):",
"- if p[i] <= minp:",
"- cnt += 1",
"- minp = min(minp, p[i])",
"-print(cnt)",
"+def main():",
"+ n = int(eval(input()))",
"+ p = list(map(int, input().split... | false | 0.045881 | 0.042351 | 1.08335 | [
"s923760318",
"s605166962"
] |
u947883560 | p02621 | python | s935022190 | s863483368 | 28 | 25 | 9,180 | 9,200 | Accepted | Accepted | 10.71 | #!/usr/bin/env python3
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
def main():
sys.setrecursion... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
I... | 19 | 23 | 440 | 455 | #!/usr/bin/env python3
import sys
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
def ZIP(n):
return list(zip(*(MAP() for _ in range(n))))
def main()... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
def ZIP(n):
return list(zip(*(MAP() for... | false | 17.391304 | [
"+",
"+sys.setrecursionlimit(10**8)",
"+INF = float(\"inf\")",
"+MOD = 10**9 + 7",
"+",
"+",
"- sys.setrecursionlimit(10**8)",
"- INF = float(\"inf\")"
] | false | 0.087381 | 0.091487 | 0.955118 | [
"s935022190",
"s863483368"
] |
u057415180 | p02854 | python | s936962768 | s358690807 | 258 | 216 | 30,572 | 26,396 | Accepted | Accepted | 16.28 | n = int(eval(input()))
a = list(map(int, input().split())) # 横入力
x = [0]
aaa = 0
aa = sum(a)
y = [aa]
for i in range(n):
aaa += a[i]
x.append(aaa)
aa -= a[i]
y.append(aa)
ans = 202020202020
for i in range(n+1):
ans = min(ans, abs(x[i] - y[i]))
print(ans) | n = int(eval(input()))
a = list(map(int, input().split())) # 横入力
x = [0]
aaa = 0
aa = sum(a)
# y = [aa]
for i in range(n):
aaa += a[i]
x.append(aaa)
# aa -= a[i]
# y.append(aa)
ans = 202020202020
for i in range(n+1):
ans = min(ans, abs(aa - x[i]*2))
print(ans) | 18 | 18 | 288 | 294 | n = int(eval(input()))
a = list(map(int, input().split())) # 横入力
x = [0]
aaa = 0
aa = sum(a)
y = [aa]
for i in range(n):
aaa += a[i]
x.append(aaa)
aa -= a[i]
y.append(aa)
ans = 202020202020
for i in range(n + 1):
ans = min(ans, abs(x[i] - y[i]))
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split())) # 横入力
x = [0]
aaa = 0
aa = sum(a)
# y = [aa]
for i in range(n):
aaa += a[i]
x.append(aaa)
# aa -= a[i]
# y.append(aa)
ans = 202020202020
for i in range(n + 1):
ans = min(ans, abs(aa - x[i] * 2))
print(ans)
| false | 0 | [
"-y = [aa]",
"+# y = [aa]",
"- aa -= a[i]",
"- y.append(aa)",
"+ # aa -= a[i]",
"+ # y.append(aa)",
"- ans = min(ans, abs(x[i] - y[i]))",
"+ ans = min(ans, abs(aa - x[i] * 2))"
] | false | 0.031847 | 0.071909 | 0.442885 | [
"s936962768",
"s358690807"
] |
u646412443 | p02725 | python | s136262957 | s496499819 | 150 | 114 | 26,444 | 26,436 | Accepted | Accepted | 24 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(k + a[0])
dist = 0
for i in range(n):
dist = max(dist, a[i + 1] - a[i])
print((k - dist))
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(k + a[0])
dist = [0]*n
for i in range(n):
dist[i] = a[i + 1] - a[i]
print((k - max(dist)))
| 7 | 7 | 176 | 177 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(k + a[0])
dist = 0
for i in range(n):
dist = max(dist, a[i + 1] - a[i])
print((k - dist))
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(k + a[0])
dist = [0] * n
for i in range(n):
dist[i] = a[i + 1] - a[i]
print((k - max(dist)))
| false | 0 | [
"-dist = 0",
"+dist = [0] * n",
"- dist = max(dist, a[i + 1] - a[i])",
"-print((k - dist))",
"+ dist[i] = a[i + 1] - a[i]",
"+print((k - max(dist)))"
] | false | 0.070543 | 0.083647 | 0.843349 | [
"s136262957",
"s496499819"
] |
u546285759 | p00022 | python | s642251307 | s020896341 | 2,320 | 40 | 7,784 | 7,776 | Accepted | Accepted | 98.28 | while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
ans = a[0]
for i in range(n):
tmp = 0
for j in range(i, n):
tmp += a[j]
ans = max(ans, tmp)
print(ans) | while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
minv = tmp = 0
maxv = -500000
for i in range(n):
tmp += a[i]
maxv = max(maxv, tmp - minv)
minv = min(minv, tmp)
print(maxv) | 12 | 12 | 268 | 277 | while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
ans = a[0]
for i in range(n):
tmp = 0
for j in range(i, n):
tmp += a[j]
ans = max(ans, tmp)
print(ans)
| while True:
n = int(eval(input()))
if n == 0:
break
a = [int(eval(input())) for _ in range(n)]
minv = tmp = 0
maxv = -500000
for i in range(n):
tmp += a[i]
maxv = max(maxv, tmp - minv)
minv = min(minv, tmp)
print(maxv)
| false | 0 | [
"- ans = a[0]",
"+ minv = tmp = 0",
"+ maxv = -500000",
"- tmp = 0",
"- for j in range(i, n):",
"- tmp += a[j]",
"- ans = max(ans, tmp)",
"- print(ans)",
"+ tmp += a[i]",
"+ maxv = max(maxv, tmp - minv)",
"+ minv = min(minv, tm... | false | 0.039235 | 0.042164 | 0.930515 | [
"s642251307",
"s020896341"
] |
u933341648 | p03352 | python | s748649808 | s271554964 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | x = int(eval(input()))
list_ = []
if x == 1:
print((1))
else:
b = 2
while b**2 <= x:
p = 2
while b**p <= x:
list_.append(b**p)
p += 1
b += 1
print((max(list_))) | x = int(eval(input()))
ans = 1
if x == 1:
print((1))
else:
b = 2
while b**2 <= x:
p = 2
while b**p <= x:
ans = max(b**p, ans)
p += 1
b += 1
print(ans) | 14 | 13 | 228 | 218 | x = int(eval(input()))
list_ = []
if x == 1:
print((1))
else:
b = 2
while b**2 <= x:
p = 2
while b**p <= x:
list_.append(b**p)
p += 1
b += 1
print((max(list_)))
| x = int(eval(input()))
ans = 1
if x == 1:
print((1))
else:
b = 2
while b**2 <= x:
p = 2
while b**p <= x:
ans = max(b**p, ans)
p += 1
b += 1
print(ans)
| false | 7.142857 | [
"-list_ = []",
"+ans = 1",
"- list_.append(b**p)",
"+ ans = max(b**p, ans)",
"- print((max(list_)))",
"+ print(ans)"
] | false | 0.037178 | 0.058956 | 0.630612 | [
"s748649808",
"s271554964"
] |
u554784585 | p02713 | python | s836602384 | s178204043 | 1,288 | 1,161 | 9,084 | 9,040 | Accepted | Accepted | 9.86 | K=int(eval(input()))+1
Ans=0
from math import gcd
for i in range(1,K):
for j in range(1,K):
tempA=gcd(i,j)
for k in range(K-1):
Ans+=gcd(tempA,k+1)
print(Ans)
| K=int(eval(input()))+1
Ans=0
from math import gcd
for i in range(K-1):
for j in range(K-1):
tempA=gcd(i+1,j+1)
for k in range(1,K):
Ans+=gcd(tempA,k)
print(Ans)
| 11 | 11 | 209 | 211 | K = int(eval(input())) + 1
Ans = 0
from math import gcd
for i in range(1, K):
for j in range(1, K):
tempA = gcd(i, j)
for k in range(K - 1):
Ans += gcd(tempA, k + 1)
print(Ans)
| K = int(eval(input())) + 1
Ans = 0
from math import gcd
for i in range(K - 1):
for j in range(K - 1):
tempA = gcd(i + 1, j + 1)
for k in range(1, K):
Ans += gcd(tempA, k)
print(Ans)
| false | 0 | [
"-for i in range(1, K):",
"- for j in range(1, K):",
"- tempA = gcd(i, j)",
"- for k in range(K - 1):",
"- Ans += gcd(tempA, k + 1)",
"+for i in range(K - 1):",
"+ for j in range(K - 1):",
"+ tempA = gcd(i + 1, j + 1)",
"+ for k in range(1, K):",
"+ ... | false | 0.042879 | 0.080924 | 0.529866 | [
"s836602384",
"s178204043"
] |
u753803401 | p02911 | python | s846439833 | s221939608 | 400 | 306 | 75,352 | 49,756 | Accepted | Accepted | 23.5 | def slove():
import sys
import bisect
import collections
import fractions
import heapq
input = sys.stdin.readline
n, k, q = list(map(int, input().rstrip('\n').split()))
a = [int(input().rstrip('\n')) for _ in range(q)]
ls = [k-q] * n
for v in a:
ls[v-1] += 1
... | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, k, q = list(map(int, input().rstrip('\n').split()))
a = [int(input().rstrip('\n')) for _ in range(q)]
ls = [0] * n
for v in a:
ls[v-1] += 1
for i in range(n):
if q - ls[i] < k:
... | 21 | 20 | 482 | 418 | def slove():
import sys
import bisect
import collections
import fractions
import heapq
input = sys.stdin.readline
n, k, q = list(map(int, input().rstrip("\n").split()))
a = [int(input().rstrip("\n")) for _ in range(q)]
ls = [k - q] * n
for v in a:
ls[v - 1] += 1
for ... | import sys
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, k, q = list(map(int, input().rstrip("\n").split()))
a = [int(input().rstrip("\n")) for _ in range(q)]
ls = [0] * n
for v in a:
ls[v - 1] += 1
for i in range(n):
if q - ls[i] < k:
print("Yes")
... | false | 4.761905 | [
"-def slove():",
"- import sys",
"- import bisect",
"- import collections",
"- import fractions",
"- import heapq",
"+import sys",
"+",
"+def solve():",
"+ mod = 10**9 + 7",
"- ls = [k - q] * n",
"+ ls = [0] * n",
"- for i in range(len(ls)):",
"- if ls[i] ... | false | 0.037133 | 0.036225 | 1.025069 | [
"s846439833",
"s221939608"
] |
u049979154 | p02773 | python | s236732666 | s062875572 | 746 | 655 | 32,220 | 32,096 | Accepted | Accepted | 12.2 | n = int(eval(input()))
dictionary = {}
for i in range(n) :
new_word = eval(input())
if new_word in list(dictionary.keys()) :
dictionary[new_word] += 1
else :
dictionary[new_word] = 1
max_val = max(dictionary.values())
keys_of_max_val = [key for key in dictionary if dictionary[key]... | n = int(eval(input()))
words = {}
for i in range(n) :
new_word = eval(input())
if new_word in list(words.keys()) :
words[new_word] += 1
else :
words[new_word] = 1
mx_freq = max(words.values())
mx_words = [k for k, v in list(words.items()) if words[k] == mx_freq]
mx_words.sort... | 16 | 17 | 390 | 347 | n = int(eval(input()))
dictionary = {}
for i in range(n):
new_word = eval(input())
if new_word in list(dictionary.keys()):
dictionary[new_word] += 1
else:
dictionary[new_word] = 1
max_val = max(dictionary.values())
keys_of_max_val = [key for key in dictionary if dictionary[key] == max_val]
k... | n = int(eval(input()))
words = {}
for i in range(n):
new_word = eval(input())
if new_word in list(words.keys()):
words[new_word] += 1
else:
words[new_word] = 1
mx_freq = max(words.values())
mx_words = [k for k, v in list(words.items()) if words[k] == mx_freq]
mx_words.sort()
for mx_word in m... | false | 5.882353 | [
"-dictionary = {}",
"+words = {}",
"- if new_word in list(dictionary.keys()):",
"- dictionary[new_word] += 1",
"+ if new_word in list(words.keys()):",
"+ words[new_word] += 1",
"- dictionary[new_word] = 1",
"-max_val = max(dictionary.values())",
"-keys_of_max_val = [key fo... | false | 0.144476 | 0.073712 | 1.960006 | [
"s236732666",
"s062875572"
] |
u933341648 | p03262 | python | s238273472 | s425997295 | 81 | 72 | 11,100 | 11,168 | Accepted | Accepted | 11.11 | def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x-y) for y in town)
res = next(distance)
for d in distance:
res = gcd(res, d)
print(res)
| import sys
input = sys.stdin.readline
def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
def main():
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x-y) for y in town)
res = next(distan... | 16 | 23 | 298 | 422 | def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x - y) for y in town)
res = next(distance)
for d in distance:
res = gcd(res, d)
print(res)
| import sys
input = sys.stdin.readline
def gcd(a, b):
while a > 0:
if a < b:
a, b = b, a
a = a % b
return b
def main():
n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x - y) for y in town)
res = next(distance)
for... | false | 30.434783 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"-n, x = list(map(int, input().split()))",
"-town = list(map(int, input().split()))",
"-distance = (abs(x - y) for y in town)",
"-res = next(distance)",
"-for d in distance:",
"- res = gcd(res, d)",
"-print(res)",
"+def main():"... | false | 0.037795 | 0.035471 | 1.065518 | [
"s238273472",
"s425997295"
] |
u347640436 | p02863 | python | s109742226 | s582767384 | 1,640 | 1,497 | 3,936 | 3,956 | Accepted | Accepted | 8.72 | def main():
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [-1] * (T + 3000)
dp[0] = 0
c = 0
for a, b in sorted(AB):
for j in range(c, -1, -1):
if dp[j] == -1:
continue
t = dp[j] + b... | def main():
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [-1] * (T + 3000)
dp[0] = 0
for a, b in sorted(AB):
for i in range(T - 1, -1, -1):
if dp[i] == -1:
continue
if dp[i + a] < dp[i]... | 19 | 16 | 440 | 391 | def main():
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [-1] * (T + 3000)
dp[0] = 0
c = 0
for a, b in sorted(AB):
for j in range(c, -1, -1):
if dp[j] == -1:
continue
t = dp[j] + b
... | def main():
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [-1] * (T + 3000)
dp[0] = 0
for a, b in sorted(AB):
for i in range(T - 1, -1, -1):
if dp[i] == -1:
continue
if dp[i + a] < dp[i] + b:
... | false | 15.789474 | [
"- c = 0",
"- for j in range(c, -1, -1):",
"- if dp[j] == -1:",
"+ for i in range(T - 1, -1, -1):",
"+ if dp[i] == -1:",
"- t = dp[j] + b",
"- if dp[j + a] < t:",
"- dp[j + a] = t",
"- c = min(c + a, T - 1)",
"+ ... | false | 0.088385 | 0.037252 | 2.372636 | [
"s109742226",
"s582767384"
] |
u992910889 | p03449 | python | s100159907 | s109338324 | 283 | 165 | 18,584 | 38,384 | Accepted | Accepted | 41.7 | import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
def resolve():
N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))[::-1]
from itertools import accumulate
AA = list(accumulate([0] + A))+[0] # 累積和を格納し... | # from functools import reduce
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
def resolve():
N=int(eval(input()))
A=list(map(in... | 22 | 30 | 466 | 699 | import numpy as np
import sys
sys.setrecursionlimit(10**5 + 10)
# input = sys.stdin.readline
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))[::-1]
from itertools import accumulate
AA = list(accumulate([0] + A)) + [0] # 累積和を格納したリスト作成
... | # from functools import reduce
from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
groupby,
product,
)
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10**5 + 10)
# input = sys.stdin.readline
def resolve():
N = int(eval(input()... | false | 26.666667 | [
"-import numpy as np",
"+# from functools import reduce",
"+from itertools import (",
"+ accumulate,",
"+ permutations,",
"+ combinations,",
"+ combinations_with_replacement,",
"+ groupby,",
"+ product,",
"+)",
"+",
"+# import math",
"+# import numpy as np",
"- AA = li... | false | 0.333287 | 0.044258 | 7.530562 | [
"s100159907",
"s109338324"
] |
u761320129 | p02983 | python | s153565909 | s872502813 | 1,876 | 784 | 3,060 | 3,060 | Accepted | Accepted | 58.21 | L,R = list(map(int,input().split()))
MOD = 2019
ans = MOD
for l in range(L,L+MOD+2):
for r in reversed(list(range(R-MOD-2,R+1))):
if l>=r: break
ans = min(ans, (l*r)%MOD)
print(ans) | L,R = list(map(int,input().split()))
if R-L >= 2019:
print((0))
exit()
ans = 2019
for i in range(L,R):
for j in range(i+1,R+1):
ans = min(ans, (i*j)%2019)
print(ans) | 9 | 10 | 198 | 187 | L, R = list(map(int, input().split()))
MOD = 2019
ans = MOD
for l in range(L, L + MOD + 2):
for r in reversed(list(range(R - MOD - 2, R + 1))):
if l >= r:
break
ans = min(ans, (l * r) % MOD)
print(ans)
| L, R = list(map(int, input().split()))
if R - L >= 2019:
print((0))
exit()
ans = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, (i * j) % 2019)
print(ans)
| false | 10 | [
"-MOD = 2019",
"-ans = MOD",
"-for l in range(L, L + MOD + 2):",
"- for r in reversed(list(range(R - MOD - 2, R + 1))):",
"- if l >= r:",
"- break",
"- ans = min(ans, (l * r) % MOD)",
"+if R - L >= 2019:",
"+ print((0))",
"+ exit()",
"+ans = 2019",
"+for i in ... | false | 0.193446 | 0.056921 | 3.398498 | [
"s153565909",
"s872502813"
] |
u476604182 | p04006 | python | s503235008 | s067492681 | 1,497 | 1,288 | 37,876 | 38,492 | Accepted | Accepted | 13.96 | from itertools import accumulate as acc
N, x, *A = list(map(int, open(0).read().split()))
dp = []
for i in range(N):
dp.append(list(acc((A[(i-j)%N] for j in range(N)),min)))
ans = 10**60
for i,a in enumerate(zip(*dp)):
ans = min(ans,i*x+sum(a))
print(ans)
| from itertools import accumulate
from functools import reduce
N,x,*A = list(map(int, open(0).read().split()))
dp = [0]*N
for i in range(N):
dp[i] = list(accumulate((A[i-j] for j in range(N)),min))
ans = reduce(min, (i*x+sum(a) for i,a in enumerate(zip(*dp))))
print(ans) | 10 | 8 | 264 | 273 | from itertools import accumulate as acc
N, x, *A = list(map(int, open(0).read().split()))
dp = []
for i in range(N):
dp.append(list(acc((A[(i - j) % N] for j in range(N)), min)))
ans = 10**60
for i, a in enumerate(zip(*dp)):
ans = min(ans, i * x + sum(a))
print(ans)
| from itertools import accumulate
from functools import reduce
N, x, *A = list(map(int, open(0).read().split()))
dp = [0] * N
for i in range(N):
dp[i] = list(accumulate((A[i - j] for j in range(N)), min))
ans = reduce(min, (i * x + sum(a) for i, a in enumerate(zip(*dp))))
print(ans)
| false | 20 | [
"-from itertools import accumulate as acc",
"+from itertools import accumulate",
"+from functools import reduce",
"-dp = []",
"+dp = [0] * N",
"- dp.append(list(acc((A[(i - j) % N] for j in range(N)), min)))",
"-ans = 10**60",
"-for i, a in enumerate(zip(*dp)):",
"- ans = min(ans, i * x + sum(... | false | 0.044972 | 0.0451 | 0.997161 | [
"s503235008",
"s067492681"
] |
u716530146 | p03814 | python | s709162520 | s233189606 | 164 | 21 | 42,864 | 3,896 | Accepted | Accepted | 87.2 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1
s=eval(input())
i=s.find('A')
s=s[::-1]
j=s.find('Z')
print((len(s)-i-j))
| #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
minans = inf ;ans = 0 ;count = 0 ;pro = 1
s=eval(input())
a=s.find("A")
s=s[::-1]
z=s.find("Z")
print((len(s)-z-a)) | 12 | 11 | 267 | 293 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
ans = 0
count = 0
pro = 1
s = eval(input())
i = s.find("A")
s = s[::-1]
j = s.find("Z")
print((len(s) - i - j))
| #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
minans = inf
ans = 0
count = 0
pro = 1
s = eval(input())
a = s.find("A")
s = s[::-1]
z = s.find("Z")
print((len(s) - z - a))
| false | 8.333333 | [
"+mod = 10**9 + 7",
"+minans = inf",
"-i = s.find(\"A\")",
"+a = s.find(\"A\")",
"-j = s.find(\"Z\")",
"-print((len(s) - i - j))",
"+z = s.find(\"Z\")",
"+print((len(s) - z - a))"
] | false | 0.06983 | 0.037705 | 1.851996 | [
"s709162520",
"s233189606"
] |
u966207392 | p02628 | python | s728866373 | s687771347 | 29 | 24 | 9,200 | 9,236 | Accepted | Accepted | 17.24 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
count = 0
for i in range(K):
count += p[i]
print(count) | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
pin = p.sort()
print((sum(p[:K]))) | 9 | 4 | 147 | 104 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
count = 0
for i in range(K):
count += p[i]
print(count)
| N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
pin = p.sort()
print((sum(p[:K])))
| false | 55.555556 | [
"-p.sort()",
"-count = 0",
"-for i in range(K):",
"- count += p[i]",
"-print(count)",
"+pin = p.sort()",
"+print((sum(p[:K])))"
] | false | 0.043089 | 0.067573 | 0.637667 | [
"s728866373",
"s687771347"
] |
u759412327 | p04031 | python | s558833586 | s634130880 | 23 | 17 | 3,060 | 2,940 | Accepted | Accepted | 26.09 | N = int(eval(input()))
A = list(map(int,input().split()))
cost = []
for n in range(min(A),max(A)+1):
cost.append(sum([(a-n)**2 for a in A]))
print((min(cost))) | N = int(eval(input()))
A = list(map(int,input().split()))
m = round(sum(A)/N)
print((sum([(a-m)**2 for a in A]))) | 8 | 4 | 162 | 108 | N = int(eval(input()))
A = list(map(int, input().split()))
cost = []
for n in range(min(A), max(A) + 1):
cost.append(sum([(a - n) ** 2 for a in A]))
print((min(cost)))
| N = int(eval(input()))
A = list(map(int, input().split()))
m = round(sum(A) / N)
print((sum([(a - m) ** 2 for a in A])))
| false | 50 | [
"-cost = []",
"-for n in range(min(A), max(A) + 1):",
"- cost.append(sum([(a - n) ** 2 for a in A]))",
"-print((min(cost)))",
"+m = round(sum(A) / N)",
"+print((sum([(a - m) ** 2 for a in A])))"
] | false | 0.068844 | 0.046256 | 1.48833 | [
"s558833586",
"s634130880"
] |
u847467233 | p00789 | python | s741236918 | s546292881 | 110 | 20 | 5,716 | 5,600 | Accepted | Accepted | 81.82 | # AOJ 1209: Square Coins
#Python3 2018.7.19 bal4u
N = 18
tbl = [i**2 for i in range(0, N)]
dp = [[0 for j in range(600)] for i in range(N)]
dp[0][0] = 1
for i in range(1, N):
for n in range(300):
dp[i][n] += dp[i-1][n]
for j in range(tbl[i], 300, tbl[i]):
dp[i][n+j] += dp[i-1... | # AOJ 1209: Square Coins
#Python3 2018.7.19 bal4u
dp = [1]*300
for i in range(2, 18):
for j in range(i**2, 300): dp[j] += dp[j-i**2]
while True:
n = int(eval(input()))
if n == 0: break
print((dp[n]))
| 19 | 12 | 411 | 222 | # AOJ 1209: Square Coins
# Python3 2018.7.19 bal4u
N = 18
tbl = [i**2 for i in range(0, N)]
dp = [[0 for j in range(600)] for i in range(N)]
dp[0][0] = 1
for i in range(1, N):
for n in range(300):
dp[i][n] += dp[i - 1][n]
for j in range(tbl[i], 300, tbl[i]):
dp[i][n + j] += dp[i - 1][n]
... | # AOJ 1209: Square Coins
# Python3 2018.7.19 bal4u
dp = [1] * 300
for i in range(2, 18):
for j in range(i**2, 300):
dp[j] += dp[j - i**2]
while True:
n = int(eval(input()))
if n == 0:
break
print((dp[n]))
| false | 36.842105 | [
"-N = 18",
"-tbl = [i**2 for i in range(0, N)]",
"-dp = [[0 for j in range(600)] for i in range(N)]",
"-dp[0][0] = 1",
"-for i in range(1, N):",
"- for n in range(300):",
"- dp[i][n] += dp[i - 1][n]",
"- for j in range(tbl[i], 300, tbl[i]):",
"- dp[i][n + j] += dp[i - 1][... | false | 0.116938 | 0.037633 | 3.107343 | [
"s741236918",
"s546292881"
] |
u238940874 | p02881 | python | s555115649 | s162742788 | 272 | 144 | 3,060 | 3,064 | Accepted | Accepted | 47.06 | n=int(eval(input()))
ans=n-1
for i in range(2,int(n**0.5)*2):
if n % i == 0:
tmp=i+n//i-2
ans=min(ans,tmp)
print(ans) | n=int(eval(input()))
ans=n-1
for i in range(2,int(n**0.5)+1):
if n%i==0:
tmp=i+n//i-2
ans=min(ans,tmp)
print(ans) | 7 | 7 | 137 | 133 | n = int(eval(input()))
ans = n - 1
for i in range(2, int(n**0.5) * 2):
if n % i == 0:
tmp = i + n // i - 2
ans = min(ans, tmp)
print(ans)
| n = int(eval(input()))
ans = n - 1
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
tmp = i + n // i - 2
ans = min(ans, tmp)
print(ans)
| false | 0 | [
"-for i in range(2, int(n**0.5) * 2):",
"+for i in range(2, int(n**0.5) + 1):"
] | false | 0.041218 | 0.044854 | 0.918934 | [
"s555115649",
"s162742788"
] |
u745087332 | p03095 | python | s803534061 | s038519666 | 471 | 26 | 3,564 | 3,484 | Accepted | Accepted | 94.48 | # coding:utf-8
import sys
from collections import Counter, defaultdict
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return in... | # coding:utf-8
import sys
from collections import Counter, defaultdict
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return in... | 38 | 29 | 787 | 579 | # coding:utf-8
import sys
from collections import Counter, defaultdict
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
... | # coding:utf-8
import sys
from collections import Counter, defaultdict
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
... | false | 23.684211 | [
"- cnt = [0] * 27",
"- res = 0",
"- for c in s:",
"- k = ord(c) - 97",
"- cnt[k] += 1",
"- tmp = 1",
"- for i in range(27):",
"- if not cnt[i]:",
"- continue",
"- if i == k:",
"- continue",
"- t... | false | 0.141473 | 0.036095 | 3.91947 | [
"s803534061",
"s038519666"
] |
u347640436 | p02659 | python | s220265295 | s366986355 | 27 | 23 | 10,060 | 9,148 | Accepted | Accepted | 14.81 | from decimal import *
A, B = list(map(Decimal, input().split()))
print((int(A * B)))
| A, B = input().split()
print((int(A) * int(float(B) * 100 + 0.5) // 100))
| 5 | 3 | 83 | 75 | from decimal import *
A, B = list(map(Decimal, input().split()))
print((int(A * B)))
| A, B = input().split()
print((int(A) * int(float(B) * 100 + 0.5) // 100))
| false | 40 | [
"-from decimal import *",
"-",
"-A, B = list(map(Decimal, input().split()))",
"-print((int(A * B)))",
"+A, B = input().split()",
"+print((int(A) * int(float(B) * 100 + 0.5) // 100))"
] | false | 0.077415 | 0.069235 | 1.118152 | [
"s220265295",
"s366986355"
] |
u540762794 | p03308 | python | s020610610 | s354793381 | 30 | 27 | 9,152 | 9,088 | Accepted | Accepted | 10 | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
max_diff = A[N-1] - A[0]
print(max_diff)
| # -*- coding: utf-8 -*-
N = int(eval(input()))
A = list(map(int, input().split()))
max_A = min_A = A[0]
for i in range(1,N,1):
if A[i] > max_A:
max_A = A[i]
if A[i] < min_A:
min_A = A[i]
max_diff = max_A - min_A
print(max_diff)
| 8 | 14 | 136 | 262 | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
max_diff = A[N - 1] - A[0]
print(max_diff)
| # -*- coding: utf-8 -*-
N = int(eval(input()))
A = list(map(int, input().split()))
max_A = min_A = A[0]
for i in range(1, N, 1):
if A[i] > max_A:
max_A = A[i]
if A[i] < min_A:
min_A = A[i]
max_diff = max_A - min_A
print(max_diff)
| false | 42.857143 | [
"-A.sort()",
"-max_diff = A[N - 1] - A[0]",
"+max_A = min_A = A[0]",
"+for i in range(1, N, 1):",
"+ if A[i] > max_A:",
"+ max_A = A[i]",
"+ if A[i] < min_A:",
"+ min_A = A[i]",
"+max_diff = max_A - min_A"
] | false | 0.04103 | 0.037491 | 1.094393 | [
"s020610610",
"s354793381"
] |
u093861603 | p02948 | python | s776259944 | s262976927 | 658 | 601 | 28,080 | 28,272 | Accepted | Accepted | 8.66 | import heapq
N,M=list(map(int,input().split()))
AB=[list(map(int,input().split())) for _ in range(N)]
AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
for i in range(1,M+1):
day=M-i
latest=i
while AB and AB[-1][0]<=latest:
a,b=AB.pop(-1)
heapq.heappush(works,-b)
if not works:
... | import heapq
N,M=list(map(int,input().split()))
AB=[list(map(int,input().split())) for _ in range(N)]
AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
AB=AB+[[0,0]]
for i in range(1,M+1):
day=M-i
latest=i
while len(AB)>=2 and AB[-2][0]<=latest:
a,b=AB.pop(-2)
heapq.heappush(works,-... | 19 | 20 | 368 | 391 | import heapq
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(reverse=True)
works = []
heapq.heapify(works)
ans = 0
for i in range(1, M + 1):
day = M - i
latest = i
while AB and AB[-1][0] <= latest:
a, b = AB.pop(-1)
heapq.heappush(work... | import heapq
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(reverse=True)
works = []
heapq.heapify(works)
ans = 0
AB = AB + [[0, 0]]
for i in range(1, M + 1):
day = M - i
latest = i
while len(AB) >= 2 and AB[-2][0] <= latest:
a, b = AB.pop(-2... | false | 5 | [
"+AB = AB + [[0, 0]]",
"- while AB and AB[-1][0] <= latest:",
"- a, b = AB.pop(-1)",
"+ while len(AB) >= 2 and AB[-2][0] <= latest:",
"+ a, b = AB.pop(-2)"
] | false | 0.034367 | 0.036335 | 0.94584 | [
"s776259944",
"s262976927"
] |
u631277801 | p03291 | python | s219060772 | s421556522 | 1,834 | 373 | 3,316 | 15,216 | Accepted | Accepted | 79.66 | # 自然数aをn乗してmodを取った数
def fast_pow(a:int, n:int, mod:int) -> int:
res = 1
while n>0:
if n & 1:
res = res*a % mod
a = a*a % mod
n >>= 1
return res
S = eval(input())
N = len(S)
mod = 10**9+7
# 初期設定
a_left = 0
q_left = 0
... | # Input
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): retur... | 51 | 53 | 940 | 1,180 | # 自然数aをn乗してmodを取った数
def fast_pow(a: int, n: int, mod: int) -> int:
res = 1
while n > 0:
if n & 1:
res = res * a % mod
a = a * a % mod
n >>= 1
return res
S = eval(input())
N = len(S)
mod = 10**9 + 7
# 初期設定
a_left = 0
q_left = 0
c_right = S.count("C")
q_right = S.count("?... | # Input
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
de... | false | 3.773585 | [
"-# 自然数aをn乗してmodを取った数",
"-def fast_pow(a: int, n: int, mod: int) -> int:",
"- res = 1",
"- while n > 0:",
"- if n & 1:",
"- res = res * a % mod",
"- a = a * a % mod",
"- n >>= 1",
"- return res",
"+# Input",
"+import sys",
"+",
"+stdin = sys.stdin",
... | false | 0.036795 | 0.036998 | 0.994519 | [
"s219060772",
"s421556522"
] |
u371467115 | p03494 | python | s513195783 | s630758016 | 20 | 17 | 2,940 | 3,060 | Accepted | Accepted | 15 | length = int(eval(input()))
a_list = list(map(int, input().split()))
num_list = []
for a in a_list:
t = a
num = 0
while t % 2 == 0:
num += 1
t = t / 2
num_list.append(num)
print((min(num_list)))
#こぴぺです。
| eval(input())
n=eval(input().replace(' ','|'))
print((len(bin(n&-n))-3))
#コピペです。
| 14 | 4 | 236 | 76 | length = int(eval(input()))
a_list = list(map(int, input().split()))
num_list = []
for a in a_list:
t = a
num = 0
while t % 2 == 0:
num += 1
t = t / 2
num_list.append(num)
print((min(num_list)))
# こぴぺです。
| eval(input())
n = eval(input().replace(" ", "|"))
print((len(bin(n & -n)) - 3))
# コピペです。
| false | 71.428571 | [
"-length = int(eval(input()))",
"-a_list = list(map(int, input().split()))",
"-num_list = []",
"-for a in a_list:",
"- t = a",
"- num = 0",
"- while t % 2 == 0:",
"- num += 1",
"- t = t / 2",
"- num_list.append(num)",
"-print((min(num_list)))",
"-# こぴぺです。",
"+eval(i... | false | 0.049462 | 0.049399 | 1.00129 | [
"s513195783",
"s630758016"
] |
u943057856 | p03160 | python | s717972830 | s989755748 | 142 | 119 | 13,800 | 20,548 | Accepted | Accepted | 16.2 | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[0]*n
def dis(a,b):
return abs(h[a]-h[b])
dp[1]=dis(1,0)
for i in range(2,n):
dp[i]=min(dp[i-1]+dis(i,i-1),dp[i-2]+dis(i,i-2))
print((dp[-1])) | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[10**7]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(n-2):
dp[i+2]=min(dp[i+1]+abs(h[i+2]-h[i+1]),dp[i]+abs(h[i+2]-h[i]))
print((dp[n-1])) | 9 | 8 | 207 | 199 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
def dis(a, b):
return abs(h[a] - h[b])
dp[1] = dis(1, 0)
for i in range(2, n):
dp[i] = min(dp[i - 1] + dis(i, i - 1), dp[i - 2] + dis(i, i - 2))
print((dp[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [10**7] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(n - 2):
dp[i + 2] = min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]))
print((dp[n - 1]))
| false | 11.111111 | [
"-dp = [0] * n",
"-",
"-",
"-def dis(a, b):",
"- return abs(h[a] - h[b])",
"-",
"-",
"-dp[1] = dis(1, 0)",
"-for i in range(2, n):",
"- dp[i] = min(dp[i - 1] + dis(i, i - 1), dp[i - 2] + dis(i, i - 2))",
"-print((dp[-1]))",
"+dp = [10**7] * n",
"+dp[0] = 0",
"+dp[1] = abs(h[1] - h[0]... | false | 0.037357 | 0.035234 | 1.060252 | [
"s717972830",
"s989755748"
] |
u107639613 | p02781 | python | s323726017 | s306662969 | 1,525 | 744 | 49,880 | 58,072 | Accepted | Accepted | 51.21 | N = int(eval(input()))
K = int(eval(input()))
memo = {}
def F(N, K):
"""
F(N, K) = (1以上N以下で0でない桁がちょうどK個なものの個数)
Nを一の桁から見ていくことで再帰で求める
(例)F(314,3) = F(31,2)*4 + F(30,2)*5 + F(31,3)
= {F(3,1) + F(2,1)*8 + F(3,2)} * 4
+ {F(2,1)*9 + F(3,2)} * 5
... | from functools import lru_cache
N = int(eval(input()))
K = int(eval(input()))
memo = {}
@lru_cache(maxsize = 128)
def F(N, K):
"""
F(N, K) = (1以上N以下で0でない桁がちょうどK個なものの個数)
Nを一の桁から見ていくことで再帰で求める
(例)F(314,3) = F(31,2)*4 + F(30,2)*5 + F(31,3)
= {F(3,1) + F(2,1)*8 + F(3,2)} *... | 26 | 29 | 670 | 732 | N = int(eval(input()))
K = int(eval(input()))
memo = {}
def F(N, K):
"""
F(N, K) = (1以上N以下で0でない桁がちょうどK個なものの個数)
Nを一の桁から見ていくことで再帰で求める
(例)F(314,3) = F(31,2)*4 + F(30,2)*5 + F(31,3)
= {F(3,1) + F(2,1)*8 + F(3,2)} * 4
+ {F(2,1)*9 + F(3,2)} * 5
... | from functools import lru_cache
N = int(eval(input()))
K = int(eval(input()))
memo = {}
@lru_cache(maxsize=128)
def F(N, K):
"""
F(N, K) = (1以上N以下で0でない桁がちょうどK個なものの個数)
Nを一の桁から見ていくことで再帰で求める
(例)F(314,3) = F(31,2)*4 + F(30,2)*5 + F(31,3)
= {F(3,1) + F(2,1)*8 + F(3,2)} * 4
... | false | 10.344828 | [
"+from functools import lru_cache",
"+",
"+@lru_cache(maxsize=128)"
] | false | 0.307393 | 0.121377 | 2.532558 | [
"s323726017",
"s306662969"
] |
u315485238 | p03674 | python | s442133796 | s503833779 | 1,279 | 847 | 31,316 | 31,328 | Accepted | Accepted | 33.78 | n = int(eval(input()))
A= list(map(int, input().split()))
mod = int(1e9+7)
def powermod(a, n, mod):
r = 1
while n>=1:
if n%2:
r = (r*a)%mod
a = (a*a)%mod
n = n//2
return r
memo={}
for i, a in enumerate(A):
if a in memo:
L = memo[a]
C = i - m... | n = int(eval(input()))
A= list(map(int, input().split()))
mod = int(1e9+7)
def invmod(a, mod):
if a==1:
return 1
return -invmod(mod%a, mod) * (mod//a) %mod
memo={}
for i, a in enumerate(A):
if a in memo:
L = memo[a]
C = i - memo[a] -1
R = len(A) - i-1
break
else:
... | 60 | 57 | 1,232 | 1,169 | n = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e9 + 7)
def powermod(a, n, mod):
r = 1
while n >= 1:
if n % 2:
r = (r * a) % mod
a = (a * a) % mod
n = n // 2
return r
memo = {}
for i, a in enumerate(A):
if a in memo:
L = memo[a]
... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e9 + 7)
def invmod(a, mod):
if a == 1:
return 1
return -invmod(mod % a, mod) * (mod // a) % mod
memo = {}
for i, a in enumerate(A):
if a in memo:
L = memo[a]
C = i - memo[a] - 1
R = len(A) - i - 1
... | false | 5 | [
"-def powermod(a, n, mod):",
"- r = 1",
"- while n >= 1:",
"- if n % 2:",
"- r = (r * a) % mod",
"- a = (a * a) % mod",
"- n = n // 2",
"- return r",
"+def invmod(a, mod):",
"+ if a == 1:",
"+ return 1",
"+ return -invmod(mod % a, mod) * (m... | false | 0.062219 | 0.03432 | 1.812932 | [
"s442133796",
"s503833779"
] |
u270681687 | p03745 | python | s515071596 | s580137548 | 85 | 67 | 14,480 | 14,252 | Accepted | Accepted | 21.18 | n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
sign = 0
num = 0
ans = 0
for i, ai in enumerate(a):
if count == 0:
num = ai
sign = 0
count += 1
elif count == 1:
if ai > num:
sign = 1
elif ai < num:
sign = -1
... | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
up = None
for l, r in zip(a, a[1:]):
if l == r:
continue
if l < r:
if up is None:
up = True
elif not up:
ans += 1
up = None
else:
if up is None:
... | 52 | 22 | 1,054 | 403 | n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
sign = 0
num = 0
ans = 0
for i, ai in enumerate(a):
if count == 0:
num = ai
sign = 0
count += 1
elif count == 1:
if ai > num:
sign = 1
elif ai < num:
sign = -1
else:
... | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
up = None
for l, r in zip(a, a[1:]):
if l == r:
continue
if l < r:
if up is None:
up = True
elif not up:
ans += 1
up = None
else:
if up is None:
up = False
... | false | 57.692308 | [
"-count = 0",
"-sign = 0",
"-num = 0",
"-ans = 0",
"-for i, ai in enumerate(a):",
"- if count == 0:",
"- num = ai",
"- sign = 0",
"- count += 1",
"- elif count == 1:",
"- if ai > num:",
"- sign = 1",
"- elif ai < num:",
"- sign... | false | 0.043887 | 0.047945 | 0.915374 | [
"s515071596",
"s580137548"
] |
u427344224 | p03038 | python | s176382612 | s506837975 | 667 | 411 | 106,392 | 43,068 | Accepted | Accepted | 38.38 | import sys
N, M = list(map(int, sys.stdin.readline().split()))
a_list = list(map(int, sys.stdin.readline().split()))
items = []
for i in range(M):
items.append(tuple(map(int, sys.stdin.readline().split())))
from collections import defaultdict
tar = defaultdict(int)
for a in a_list:
tar[a] += 1
... | import sys
N, M = list(map(int, sys.stdin.readline().split()))
a_list = list(map(int, sys.stdin.readline().split()))
items = []
for i in range(M):
items.append(tuple(map(int, sys.stdin.readline().split())))
from heapq import *
que = []
for i in range(N):
a = a_list[i]
heappush(que, (-a, 1)... | 33 | 30 | 620 | 563 | import sys
N, M = list(map(int, sys.stdin.readline().split()))
a_list = list(map(int, sys.stdin.readline().split()))
items = []
for i in range(M):
items.append(tuple(map(int, sys.stdin.readline().split())))
from collections import defaultdict
tar = defaultdict(int)
for a in a_list:
tar[a] += 1
for i in range(... | import sys
N, M = list(map(int, sys.stdin.readline().split()))
a_list = list(map(int, sys.stdin.readline().split()))
items = []
for i in range(M):
items.append(tuple(map(int, sys.stdin.readline().split())))
from heapq import *
que = []
for i in range(N):
a = a_list[i]
heappush(que, (-a, 1))
for b, c in it... | false | 9.090909 | [
"-from collections import defaultdict",
"+from heapq import *",
"-tar = defaultdict(int)",
"-for a in a_list:",
"- tar[a] += 1",
"-for i in range(M):",
"- b, c = items[i]",
"- tar[c] += b",
"-tar = sorted(list(tar.items()), key=lambda x: -x[0])",
"+que = []",
"+for i in range(N):",
"+... | false | 0.040575 | 0.040631 | 0.998639 | [
"s176382612",
"s506837975"
] |
u059940903 | p02714 | python | s932363190 | s046937328 | 620 | 552 | 73,816 | 68,400 | Accepted | Accepted | 10.97 | N = int(eval(input()))
S = eval(input())
bad_list = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
RGB = {'R': 0, 'G': 0, 'B': 0}
other_map = {'R': 'GB', 'G': 'RB', 'B': 'RG'}
res = 0
for (i, s) in enumerate(S):
other = other_map[s]
res += RGB[other[0]] * RGB[other[1]]
for j in range(((i+1)//2)+1)[1:]:... | N = int(eval(input()))
S = eval(input())
bad_list = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
res = S.count("R") * S.count("G") * S.count("B")
for (i, s) in enumerate(S):
for j in range(((i+1)//2)+1)[1:]:
if S[i::-j][:3] in bad_list:
res -= 1
print(res) | 19 | 13 | 391 | 272 | N = int(eval(input()))
S = eval(input())
bad_list = ["RGB", "RBG", "GRB", "GBR", "BRG", "BGR"]
RGB = {"R": 0, "G": 0, "B": 0}
other_map = {"R": "GB", "G": "RB", "B": "RG"}
res = 0
for (i, s) in enumerate(S):
other = other_map[s]
res += RGB[other[0]] * RGB[other[1]]
for j in range(((i + 1) // 2) + 1)[1:]:
... | N = int(eval(input()))
S = eval(input())
bad_list = ["RGB", "RBG", "GRB", "GBR", "BRG", "BGR"]
res = S.count("R") * S.count("G") * S.count("B")
for (i, s) in enumerate(S):
for j in range(((i + 1) // 2) + 1)[1:]:
if S[i::-j][:3] in bad_list:
res -= 1
print(res)
| false | 31.578947 | [
"-RGB = {\"R\": 0, \"G\": 0, \"B\": 0}",
"-other_map = {\"R\": \"GB\", \"G\": \"RB\", \"B\": \"RG\"}",
"-res = 0",
"+res = S.count(\"R\") * S.count(\"G\") * S.count(\"B\")",
"- other = other_map[s]",
"- res += RGB[other[0]] * RGB[other[1]]",
"- RGB[s] += 1"
] | false | 0.061824 | 0.036821 | 1.679025 | [
"s932363190",
"s046937328"
] |
u156815136 | p02683 | python | s889341918 | s254419444 | 443 | 102 | 73,728 | 10,408 | Accepted | Accepted | 76.98 | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdi... | 57 | 51 | 1,412 | 1,256 | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate, product # (string,3) 3回
# from collections import deque
from collections import deque, defaul... | false | 10.526316 | [
"-from statistics import median",
"-",
"+# from statistics import median",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"-from collections import defaultdict",
"-import bisect",
"+from itertools import combinations, permutations, accumulate, product # (str... | false | 0.040499 | 0.039244 | 1.031969 | [
"s889341918",
"s254419444"
] |
u156815136 | p02969 | python | s995593910 | s665841662 | 35 | 20 | 5,048 | 3,316 | Accepted | Accepted | 42.86 | import itertools
import fractions
def main():
r = int(eval(input()))
print((3 * (r**2)))
if __name__ == '__main__':
main() | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import defaultdict
#import bisect
#
# d = m - k... | 8 | 28 | 130 | 627 | import itertools
import fractions
def main():
r = int(eval(input()))
print((3 * (r**2)))
if __name__ == "__main__":
main()
| # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
from collections import defaultdict
# import bisect
#
# d = m - k[... | false | 71.428571 | [
"-import itertools",
"-import fractions",
"+# from statistics import median",
"+# import collections",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+# from fractions import gcd",
"+# from itertools import combinations # (string,3) 3回",
"+# from collections i... | false | 0.042872 | 0.035727 | 1.199991 | [
"s995593910",
"s665841662"
] |
u227082700 | p02620 | python | s257246969 | s417922307 | 628 | 433 | 22,080 | 22,180 | Accepted | Accepted | 31.05 | d=int(eval(input()))
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
t=[int(eval(input()))for _ in range(d)]
m=int(eval(input()))
dq=[list(map(int,input().split()))for _ in range(m)]
x=[[0]for _ in range(26)]
ans=0
for i in range(d):
x[t[i]-1].append(i+1)
ans+=s[i][t[i... | from bisect import bisect_left,insort_left
d=int(eval(input()))
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
t=[int(eval(input()))for _ in range(d)]
m=int(eval(input()))
dq=[list(map(int,input().split()))for _ in range(m)]
x=[[0]for _ in range(26)]
ans=0
for i in range(d... | 31 | 31 | 735 | 769 | d = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [int(eval(input())) for _ in range(d)]
m = int(eval(input()))
dq = [list(map(int, input().split())) for _ in range(m)]
x = [[0] for _ in range(26)]
ans = 0
for i in range(d):
x[t[i] - 1].append(i +... | from bisect import bisect_left, insort_left
d = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [int(eval(input())) for _ in range(d)]
m = int(eval(input()))
dq = [list(map(int, input().split())) for _ in range(m)]
x = [[0] for _ in range(26)]
ans = 0
... | false | 0 | [
"+from bisect import bisect_left, insort_left",
"+",
"- pi = qi = 0",
"- while x[p - 1][pi] != dd:",
"- pi += 1",
"- while x[q - 1][qi] < dd:",
"- qi += 1",
"+ pi = bisect_left(x[p - 1], dd)",
"+ qi = bisect_left(x[q - 1], dd)",
"- x[q - 1].insert(qi, dd)",
"+ ... | false | 0.143349 | 0.081491 | 1.75908 | [
"s257246969",
"s417922307"
] |
u580273604 | p02713 | python | s617926545 | s740255273 | 1,791 | 367 | 9,104 | 9,180 | Accepted | Accepted | 79.51 | from math import gcd
K=int(eval(input()))
k=[1,1,1]
g=0
for a in range(1,K+1):
for b in range(1,K+1):
for c in range(1,K+1):
g+=gcd(gcd(a,b),c)
print(g) | from math import gcd
K=int(eval(input()))
g=0
for a in range(1,K-1):
for b in range(a+1,K):
for c in range(b+1,K+1):
g+=gcd(gcd(a,b),c)*6
for d in range(1,K):
for e in range(d+1,K+1):
g+=gcd(d,e)*6
g+=K*(K+1)//2
print(g) | 11 | 12 | 182 | 244 | from math import gcd
K = int(eval(input()))
k = [1, 1, 1]
g = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
g += gcd(gcd(a, b), c)
print(g)
| from math import gcd
K = int(eval(input()))
g = 0
for a in range(1, K - 1):
for b in range(a + 1, K):
for c in range(b + 1, K + 1):
g += gcd(gcd(a, b), c) * 6
for d in range(1, K):
for e in range(d + 1, K + 1):
g += gcd(d, e) * 6
g += K * (K + 1) // 2
print(g)
| false | 8.333333 | [
"-k = [1, 1, 1]",
"-for a in range(1, K + 1):",
"- for b in range(1, K + 1):",
"- for c in range(1, K + 1):",
"- g += gcd(gcd(a, b), c)",
"+for a in range(1, K - 1):",
"+ for b in range(a + 1, K):",
"+ for c in range(b + 1, K + 1):",
"+ g += gcd(gcd(a, b), c... | false | 0.039581 | 0.081406 | 0.486216 | [
"s617926545",
"s740255273"
] |
u761989513 | p03576 | python | s213566382 | s165155980 | 1,699 | 27 | 53,340 | 3,188 | Accepted | Accepted | 98.41 | import itertools
n, k = list(map(int, input().split()))
xy = [tuple(map(int, input().split())) for i in range(n)]
ans = float("INF")
for a, b in itertools.combinations(xy, 2):
for c, d in itertools.combinations(xy, 2):
x1, x2 = sorted([a[0], b[0]])
y1, y2 = sorted([c[1], d[1]])
cou... | n, k = list(map(int, input().split()))
xy = sorted([tuple(map(int, input().split())) for i in range(n)])
ans = float("INF")
en = tuple(enumerate(xy))
for i, (a, b) in en[:n - k + 1]:
for j, (c, d) in en[i + k - 1:]:
r = sorted(y for x, y in xy[i:j + 1])
r2 = r[k - 1:]
for i2, j2 in z... | 16 | 12 | 509 | 426 | import itertools
n, k = list(map(int, input().split()))
xy = [tuple(map(int, input().split())) for i in range(n)]
ans = float("INF")
for a, b in itertools.combinations(xy, 2):
for c, d in itertools.combinations(xy, 2):
x1, x2 = sorted([a[0], b[0]])
y1, y2 = sorted([c[1], d[1]])
count = 0
... | n, k = list(map(int, input().split()))
xy = sorted([tuple(map(int, input().split())) for i in range(n)])
ans = float("INF")
en = tuple(enumerate(xy))
for i, (a, b) in en[: n - k + 1]:
for j, (c, d) in en[i + k - 1 :]:
r = sorted(y for x, y in xy[i : j + 1])
r2 = r[k - 1 :]
for i2, j2 in zip(... | false | 25 | [
"-import itertools",
"-",
"-xy = [tuple(map(int, input().split())) for i in range(n)]",
"+xy = sorted([tuple(map(int, input().split())) for i in range(n)])",
"-for a, b in itertools.combinations(xy, 2):",
"- for c, d in itertools.combinations(xy, 2):",
"- x1, x2 = sorted([a[0], b[0]])",
"- ... | false | 0.083607 | 0.040228 | 2.078333 | [
"s213566382",
"s165155980"
] |
u437351386 | p02912 | python | s031936342 | s574925471 | 167 | 132 | 14,224 | 20,020 | Accepted | Accepted | 20.96 | #リストの挿入と最大値の取得を同時に行う
#そのようなものを高速でできるデータ構造としてheapq(優先度つきqがあげられる)
#最大値を取得する関数はheapqには入ってないためリストの要素を-1倍してから最小値を求めればいい
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a=list([x*(-1) for x in a])
import heapq
heapq.heapify(a)
for i in range(m):
min_a=heapq.heappop(a)*(-1)
heapq.heappush(a... | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a=list([x*(-1) for x in a])
import heapq
heapq.heapify(a)
for i in range(m):
q=heapq.heappop(a)
heapq.heappush(a,int(q/2))
print((sum(a)*(-1)))
| 15 | 13 | 363 | 236 | # リストの挿入と最大値の取得を同時に行う
# そのようなものを高速でできるデータ構造としてheapq(優先度つきqがあげられる)
# 最大値を取得する関数はheapqには入ってないためリストの要素を-1倍してから最小値を求めればいい
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list([x * (-1) for x in a])
import heapq
heapq.heapify(a)
for i in range(m):
min_a = heapq.heappop(a) * (-1)
heapq... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list([x * (-1) for x in a])
import heapq
heapq.heapify(a)
for i in range(m):
q = heapq.heappop(a)
heapq.heappush(a, int(q / 2))
print((sum(a) * (-1)))
| false | 13.333333 | [
"-# リストの挿入と最大値の取得を同時に行う",
"-# そのようなものを高速でできるデータ構造としてheapq(優先度つきqがあげられる)",
"-# 最大値を取得する関数はheapqには入ってないためリストの要素を-1倍してから最小値を求めればいい",
"- min_a = heapq.heappop(a) * (-1)",
"- heapq.heappush(a, min_a // 2 * (-1))",
"+ q = heapq.heappop(a)",
"+ heapq.heappush(a, int(q / 2))"
] | false | 0.148939 | 0.046601 | 3.19602 | [
"s031936342",
"s574925471"
] |
u678167152 | p03096 | python | s530038995 | s093243075 | 982 | 890 | 52,120 | 52,120 | Accepted | Accepted | 9.37 | from collections import defaultdict
from bisect import *
def solve():
mod = 10**9+7
d = defaultdict(lambda: [])
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
d[a].append(i)
selist = []
ends = [-1]
for l in list(d.values()):
for i in rang... | from collections import defaultdict
from bisect import *
def solve():
mod = 10**9+7
d = defaultdict(lambda: [])
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
d[a].append(i)
selist = []
ends = [-1]
for l in list(d.values()):
for i in rang... | 31 | 32 | 858 | 875 | from collections import defaultdict
from bisect import *
def solve():
mod = 10**9 + 7
d = defaultdict(lambda: [])
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
d[a].append(i)
selist = []
ends = [-1]
for l in list(d.values()):
for i in range(len(l)... | from collections import defaultdict
from bisect import *
def solve():
mod = 10**9 + 7
d = defaultdict(lambda: [])
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
d[a].append(i)
selist = []
ends = [-1]
for l in list(d.values()):
for i in range(len(l)... | false | 3.125 | [
"- dp[i] = (dp[i - 1] + 1) % mod",
"+ dp[i] = dp[i - 1] + 1",
"+ dp[i] %= mod"
] | false | 0.094198 | 0.048977 | 1.92333 | [
"s530038995",
"s093243075"
] |
u488401358 | p03133 | python | s978661914 | s307614413 | 99 | 35 | 3,064 | 3,060 | Accepted | Accepted | 64.65 | N,M=list(map(int,input().split()));mod=998244353;base=[]
for i in range(N):
A=input().split();s=sum(int(A[j])*2**j for j in range(M))
for b in base:s=min(s,s^b)
if s!=0:base.append(s)
res=N-len(base);print(((pow(2,N+M-1,mod)-pow(2,M-1+res,mod))%mod)) | N,M=list(map(int,input().split()));mod=998244353;B=[]
for i in range(N):
s=int(input().replace(" ",""),2)
for b in B:s=min(s,s^b)
if s!=0:B.append(s)
print(((pow(2,N+M-1,mod)*(1-pow(2,mod-1-len(B),mod)))%mod))
| 6 | 6 | 259 | 219 | N, M = list(map(int, input().split()))
mod = 998244353
base = []
for i in range(N):
A = input().split()
s = sum(int(A[j]) * 2**j for j in range(M))
for b in base:
s = min(s, s ^ b)
if s != 0:
base.append(s)
res = N - len(base)
print(((pow(2, N + M - 1, mod) - pow(2, M - 1 + res, mod)) % ... | N, M = list(map(int, input().split()))
mod = 998244353
B = []
for i in range(N):
s = int(input().replace(" ", ""), 2)
for b in B:
s = min(s, s ^ b)
if s != 0:
B.append(s)
print(((pow(2, N + M - 1, mod) * (1 - pow(2, mod - 1 - len(B), mod))) % mod))
| false | 0 | [
"-base = []",
"+B = []",
"- A = input().split()",
"- s = sum(int(A[j]) * 2**j for j in range(M))",
"- for b in base:",
"+ s = int(input().replace(\" \", \"\"), 2)",
"+ for b in B:",
"- base.append(s)",
"-res = N - len(base)",
"-print(((pow(2, N + M - 1, mod) - pow(2, M - 1 + ... | false | 0.035696 | 0.036791 | 0.970243 | [
"s978661914",
"s307614413"
] |
u671060652 | p03219 | python | s873198436 | s768321027 | 265 | 66 | 63,980 | 61,796 | Accepted | Accepted | 75.09 | import itertools
import math
import fractions
import functools
import copy
x, y = list(map(int, input().split()))
print((x+y//2)) | def main():
# n = int(input())
x, y = list(map(int, input().split()))
# a = list(map(int, input().split()))
# s = input()
print((x+y//2))
if __name__ == '__main__':
main()
| 8 | 10 | 129 | 199 | import itertools
import math
import fractions
import functools
import copy
x, y = list(map(int, input().split()))
print((x + y // 2))
| def main():
# n = int(input())
x, y = list(map(int, input().split()))
# a = list(map(int, input().split()))
# s = input()
print((x + y // 2))
if __name__ == "__main__":
main()
| false | 20 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-import copy",
"+def main():",
"+ # n = int(input())",
"+ x, y = list(map(int, input().split()))",
"+ # a = list(map(int, input().split()))",
"+ # s = input()",
"+ print((x + y // 2))",
"-x, y = list... | false | 0.047631 | 0.040853 | 1.165928 | [
"s873198436",
"s768321027"
] |
u102461423 | p03725 | python | s268647897 | s206853028 | 1,642 | 209 | 40,040 | 34,168 | Accepted | Accepted | 87.27 | import sys
input = sys.stdin.readline
import itertools
# 初日以外は何も気にせず動けるとしてよい。初日に到達可能な場所のうち、最もゴールに近いものはどこか
H,W,K = list(map(int,input().split()))
A = '#' * (W+2)
for _ in range(H):
A += '#' + input().rstrip() + '#'
A += '#' * (W+2)
start = A.find('S')
dxs = (1,-1,(W+2),-(W+2))
visited = set()
q... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(A, H, W, K, S):
INF = 10**9
dist = np.full(H * W, INF, np.int32)
q = np.empty(H * W + 100, np.int32)
q[:2] = 2, 2
def push(q, x):
q... | 40 | 67 | 786 | 1,642 | import sys
input = sys.stdin.readline
import itertools
# 初日以外は何も気にせず動けるとしてよい。初日に到達可能な場所のうち、最もゴールに近いものはどこか
H, W, K = list(map(int, input().split()))
A = "#" * (W + 2)
for _ in range(H):
A += "#" + input().rstrip() + "#"
A += "#" * (W + 2)
start = A.find("S")
dxs = (1, -1, (W + 2), -(W + 2))
visited = set()
q = [st... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(A, H, W, K, S):
INF = 10**9
dist = np.full(H * W, INF, np.int32)
q = np.empty(H * W + 100, np.int32)
q[:2] = 2, 2
def push(q, x):
q[q[1]] = x
... | false | 40.298507 | [
"+import numpy as np",
"-input = sys.stdin.readline",
"-import itertools",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-# 初日以外は何も気にせず動けるとしてよい。初日に到達可能な場所のうち、最もゴールに近いものはどこか",
"-H, W, K = list(map(int, input().split()))",
"-A = \... | false | 0.03491 | 0.214582 | 0.16269 | [
"s268647897",
"s206853028"
] |
u968166680 | p02814 | python | s487517878 | s703991862 | 112 | 61 | 16,232 | 13,352 | Accepted | Accepted | 45.54 | import sys
from fractions import gcd
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def lcm(x, y):
return x * y // gcd(x, y)
def main():
N, M = list(map(int, input().split()))
A = list(map(int, input().spl... | import sys
from fractions import gcd
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def lcm(x, y):
return x * y // gcd(x, y)
def main():
N, M = list(map(int, input().split()))
A = list(set(map(int, input()... | 32 | 36 | 616 | 690 | import sys
from fractions import gcd
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def lcm(x, y):
return x * y // gcd(x, y)
def main():
N, M = list(map(int, input().split()))
A = list(map(int, input().split(" ")))
A = ... | import sys
from fractions import gcd
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def lcm(x, y):
return x * y // gcd(x, y)
def main():
N, M = list(map(int, input().split()))
A = list(set(map(int, input().split(" "))))
... | false | 11.111111 | [
"- A = list(map(int, input().split(\" \")))",
"+ A = list(set(map(int, input().split(\" \"))))",
"- if semi_lcm > M or semi_lcm // a % 2 == 0:",
"+ if semi_lcm > M:",
"+ print((0))",
"+ return",
"+ for a in A:",
"+ if semi_lcm // a % 2 == 0:"
] | false | 0.046694 | 0.077256 | 0.604411 | [
"s487517878",
"s703991862"
] |
u767664985 | p03160 | python | s185179909 | s808993312 | 204 | 172 | 13,980 | 13,980 | Accepted | Accepted | 15.69 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < N - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print((dp[N - 1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
list = [float("inf") for _ in range(N)]
# 一般に足場 i までの最小コストを求める関数を作り、それは足場 i-1, i-2 までの最小コストがわかっていればいい
def cost(i):
if i == 0:
list[i] = 0
list[i] = min(list[i], list[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
list[i] = min(list[i], list[i - 2] + a... | 9 | 13 | 281 | 385 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < N - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print((dp[N - 1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
list = [float("inf") for _ in range(N)]
# 一般に足場 i までの最小コストを求める関数を作り、それは足場 i-1, i-2 までの最小コストがわかっていればいい
def cost(i):
if i == 0:
list[i] = 0
list[i] = min(list[i], list[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
list[i] = min(list[i], lis... | false | 30.769231 | [
"-dp = [float(\"inf\") for _ in range(N)]",
"-dp[0] = 0",
"-for i in range(N - 1):",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))",
"- if i < N - 2:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))",
"-print((dp[N - 1]))",
"+list = [float(\"inf\") for _ in rang... | false | 0.034377 | 0.035875 | 0.958235 | [
"s185179909",
"s808993312"
] |
u581187895 | p03043 | python | s014114225 | s284671541 | 50 | 46 | 2,940 | 2,940 | Accepted | Accepted | 8 | import sys
input = sys.stdin.readline
n, k = list(map(int, input().split()))
prob = 0
for i in range(1, n+1):
count = 0
total = i
while total < k:
total *= 2
count += 1
prob += 1/2**count
print((prob/n))
| N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N+1):
cnt = 0
point = i
while point < K:
point *= 2
cnt += 1
ans += 1/N * (0.5**cnt)
print(ans) | 13 | 12 | 226 | 187 | import sys
input = sys.stdin.readline
n, k = list(map(int, input().split()))
prob = 0
for i in range(1, n + 1):
count = 0
total = i
while total < k:
total *= 2
count += 1
prob += 1 / 2**count
print((prob / n))
| N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
cnt = 0
point = i
while point < K:
point *= 2
cnt += 1
ans += 1 / N * (0.5**cnt)
print(ans)
| false | 7.692308 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-n, k = list(map(int, input().split()))",
"-prob = 0",
"-for i in range(1, n + 1):",
"- count = 0",
"- total = i",
"- while total < k:",
"- total *= 2",
"- count += 1",
"- prob += 1 / 2**count",
"-print((prob / n))... | false | 0.116216 | 0.077476 | 1.500032 | [
"s014114225",
"s284671541"
] |
u929569377 | p02844 | python | s443679484 | s973181054 | 142 | 20 | 4,496 | 3,188 | Accepted | Accepted | 85.92 | n = int(eval(input()))
s = list(map(int, list(eval(input()))))
idx = [[] for _ in range(10)]
for i, v in enumerate(s):
idx[v].append(i)
ans = 0
for i in range(1000):
c = 0
p = -1
chk = True
while c < 3 and chk:
chk = False
for j in idx[i // 100]:
if j > p:
... | n = int(eval(input()))
s = eval(input())
def chk_substr(s, t):
p = -1
for i in t:
p = s.find(i, p + 1)
if p == -1:
return False
return True
ans = 0
for i in range(1000):
t = str(i).zfill(3)
if chk_substr(s, t):
ans += 1
print(ans) | 23 | 17 | 485 | 292 | n = int(eval(input()))
s = list(map(int, list(eval(input()))))
idx = [[] for _ in range(10)]
for i, v in enumerate(s):
idx[v].append(i)
ans = 0
for i in range(1000):
c = 0
p = -1
chk = True
while c < 3 and chk:
chk = False
for j in idx[i // 100]:
if j > p:
... | n = int(eval(input()))
s = eval(input())
def chk_substr(s, t):
p = -1
for i in t:
p = s.find(i, p + 1)
if p == -1:
return False
return True
ans = 0
for i in range(1000):
t = str(i).zfill(3)
if chk_substr(s, t):
ans += 1
print(ans)
| false | 26.086957 | [
"-s = list(map(int, list(eval(input()))))",
"-idx = [[] for _ in range(10)]",
"-for i, v in enumerate(s):",
"- idx[v].append(i)",
"+s = eval(input())",
"+",
"+",
"+def chk_substr(s, t):",
"+ p = -1",
"+ for i in t:",
"+ p = s.find(i, p + 1)",
"+ if p == -1:",
"+ ... | false | 0.057803 | 0.099934 | 0.578413 | [
"s443679484",
"s973181054"
] |
u404678206 | p03493 | python | s637537340 | s342909604 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s=eval(input())
print((s.count("1"))) | print((input().count("1"))) | 2 | 1 | 30 | 25 | s = eval(input())
print((s.count("1")))
| print((input().count("1")))
| false | 50 | [
"-s = eval(input())",
"-print((s.count(\"1\")))",
"+print((input().count(\"1\")))"
] | false | 0.082582 | 0.085658 | 0.964094 | [
"s637537340",
"s342909604"
] |
u228223940 | p03805 | python | s416329177 | s619747524 | 67 | 28 | 3,064 | 3,064 | Accepted | Accepted | 58.21 | import sys
sys.setrecursionlimit(1000000)
N,M = list(map(int, input().split()))
P = [list(map(int, input().split())) for _ in range(M)]
vis_N = [-1]*(N+1)
count = 0
vis_N[1] = 1
def search(a):
global count,vis_N,vis_Nij
#print(count,vis_N)
if sum(vis_N)+1 == N:
count = count + 1
... | N, M = list(map(int, input().split()))
adj_matrix = [[0]* N for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
adj_matrix[a-1][b-1] = 1
adj_matrix[b-1][a-1] = 1
def dfs(v, used):
if not False in used:
return 1
ans = 0
for i in range(N):
... | 32 | 29 | 750 | 572 | import sys
sys.setrecursionlimit(1000000)
N, M = list(map(int, input().split()))
P = [list(map(int, input().split())) for _ in range(M)]
vis_N = [-1] * (N + 1)
count = 0
vis_N[1] = 1
def search(a):
global count, vis_N, vis_Nij
# print(count,vis_N)
if sum(vis_N) + 1 == N:
count = count + 1
... | N, M = list(map(int, input().split()))
adj_matrix = [[0] * N for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
adj_matrix[a - 1][b - 1] = 1
adj_matrix[b - 1][a - 1] = 1
def dfs(v, used):
if not False in used:
return 1
ans = 0
for i in range(N):
if not... | false | 9.375 | [
"-import sys",
"-",
"-sys.setrecursionlimit(1000000)",
"-P = [list(map(int, input().split())) for _ in range(M)]",
"-vis_N = [-1] * (N + 1)",
"-count = 0",
"-vis_N[1] = 1",
"+adj_matrix = [[0] * N for _ in range(N)]",
"+for i in range(M):",
"+ a, b = list(map(int, input().split()))",
"+ ad... | false | 0.007133 | 0.033389 | 0.213646 | [
"s416329177",
"s619747524"
] |
u654470292 | p02844 | python | s460535231 | s645244178 | 353 | 210 | 41,180 | 49,264 | Accepted | Accepted | 40.51 | n=int(eval(input()))
s=eval(input())
ans=0
for i in range(1000):
tmp=str(i)
while len(tmp)<3:
tmp="0"+tmp
j=0
for k in range(n):
if tmp[j]==s[k]:
j+=1
if j==3:
ans+=1
break
print(ans) | import sys
def input():
return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(eval(input()))
s=eval(input())
li=[[-1]*10 for i in range(n+1)]
for i in range(n):
li[-i-2]=li[-i-1][:]
li[-i-2][int(s[-i-1])]=n-1-i
ans=0
for i in range(1000):
tmp=str(i)
while len(tmp)!=3:
tmp= ... | 16 | 24 | 225 | 493 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
tmp = str(i)
while len(tmp) < 3:
tmp = "0" + tmp
j = 0
for k in range(n):
if tmp[j] == s[k]:
j += 1
if j == 3:
ans += 1
break
print(ans)
| import sys
def input():
return sys.stdin.readline()[:-1]
inf = float("inf")
n = int(eval(input()))
s = eval(input())
li = [[-1] * 10 for i in range(n + 1)]
for i in range(n):
li[-i - 2] = li[-i - 1][:]
li[-i - 2][int(s[-i - 1])] = n - 1 - i
ans = 0
for i in range(1000):
tmp = str(i)
while len(tm... | false | 33.333333 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+inf = float(\"inf\")",
"+li = [[-1] * 10 for i in range(n + 1)]",
"+for i in range(n):",
"+ li[-i - 2] = li[-i - 1][:]",
"+ li[-i - 2][int(s[-i - 1])] = n - 1 - i",
"- while len(tmp) < 3:"... | false | 0.069532 | 0.078565 | 0.885026 | [
"s460535231",
"s645244178"
] |
u235210692 | p03846 | python | s914334609 | s318988918 | 99 | 87 | 13,880 | 19,992 | Accepted | Accepted | 12.12 | n=int(eval(input()))
#データを並び替える
rowdata=[int(i) for i in input().split()]
rowdata.sort()
#nが偶数の時
if n%2==0:
check=[]
a=1
for i in range(1,n,2):
check.append(i)
check.append(i)
if check==rowdata:
for i in range(int(n/2)):
a*=2
a=a%10000000... | n=int(eval(input()))
a=[int(i) for i in input().split()]
def somosomo(a):
ans=[]
if n%2==1:
ans.append(0)
for i in range(1,n//2+1):
ans.append(i*2)
ans.append(i*2)
b=sorted(a)
if b==ans:
return True
return False
else:... | 41 | 34 | 784 | 675 | n = int(eval(input()))
# データを並び替える
rowdata = [int(i) for i in input().split()]
rowdata.sort()
# nが偶数の時
if n % 2 == 0:
check = []
a = 1
for i in range(1, n, 2):
check.append(i)
check.append(i)
if check == rowdata:
for i in range(int(n / 2)):
a *= 2
a = a % ... | n = int(eval(input()))
a = [int(i) for i in input().split()]
def somosomo(a):
ans = []
if n % 2 == 1:
ans.append(0)
for i in range(1, n // 2 + 1):
ans.append(i * 2)
ans.append(i * 2)
b = sorted(a)
if b == ans:
return True
return False... | false | 17.073171 | [
"-# データを並び替える",
"-rowdata = [int(i) for i in input().split()]",
"-rowdata.sort()",
"-# nが偶数の時",
"-if n % 2 == 0:",
"- check = []",
"- a = 1",
"- for i in range(1, n, 2):",
"- check.append(i)",
"- check.append(i)",
"- if check == rowdata:",
"- for i in range(int... | false | 0.042968 | 0.041217 | 1.042499 | [
"s914334609",
"s318988918"
] |
u729972685 | p03163 | python | s199224521 | s203320020 | 520 | 463 | 120,172 | 59,144 | Accepted | Accepted | 10.96 | # using dp with memoization, TLE
from sys import stdin
N, W = list(map(int, input().split()))
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]
dp = [[0] * (W + 1) for _ in range(N + 1)]
dp[0][0] = 0
for n in range(1, N + 1):
for w in range(0, W + 1):
if w == 0:
... | # using dp with memoization, TLE
from sys import stdin
N, W = list(map(int, input().split()))
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]
dp = [0] * (W + 1)
next_dp = [0] * (W + 1)
for n in range(1, N + 1):
for w in range(0, W + 1):
if w >= s[n - 1][0]:
... | 21 | 15 | 573 | 457 | # using dp with memoization, TLE
from sys import stdin
N, W = list(map(int, input().split()))
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]
dp = [[0] * (W + 1) for _ in range(N + 1)]
dp[0][0] = 0
for n in range(1, N + 1):
for w in range(0, W + 1):
if w == 0:
d... | # using dp with memoization, TLE
from sys import stdin
N, W = list(map(int, input().split()))
m = stdin.read().splitlines()
s = [[int(i) for i in line.split()] for line in m]
dp = [0] * (W + 1)
next_dp = [0] * (W + 1)
for n in range(1, N + 1):
for w in range(0, W + 1):
if w >= s[n - 1][0]:
next... | false | 28.571429 | [
"-dp = [[0] * (W + 1) for _ in range(N + 1)]",
"-dp[0][0] = 0",
"+dp = [0] * (W + 1)",
"+next_dp = [0] * (W + 1)",
"- if w == 0:",
"- dp[n][0] = 0",
"- continue",
"- if w < s[n - 1][0]:",
"- dp[n][w] = dp[n - 1][w]",
"- else:",
"- ... | false | 0.080086 | 0.040708 | 1.967347 | [
"s199224521",
"s203320020"
] |
u150984829 | p00056 | python | s426035945 | s528025576 | 4,690 | 1,440 | 8,448 | 8,456 | Accepted | Accepted | 69.3 | import bisect,sys
from itertools import *
n=list(range(50001));a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
for x in map(int,sys.stdin):
if x:y=x//2+1;print((sum(1 for d in compress(n[:y],a[:y])if a[x-d])))
| import bisect,sys
from itertools import *
n=list(range(50001));a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in sys.stdin:
x=int(x)
if x:print((sum(1 for d in p[:bisect.bisect(p,x//2)]if a[x-d])))
| 6 | 8 | 228 | 248 | import bisect, sys
from itertools import *
n = list(range(50001))
a = list(n)
a[1] = 0
for i in range(2, 224):
a[i * 2 :: i] = [0] * len(a[i * 2 :: i])
for x in map(int, sys.stdin):
if x:
y = x // 2 + 1
print((sum(1 for d in compress(n[:y], a[:y]) if a[x - d])))
| import bisect, sys
from itertools import *
n = list(range(50001))
a = list(n)
a[1] = 0
for i in range(2, 224):
a[i * 2 :: i] = [0] * len(a[i * 2 :: i])
p = list(compress(n, a))
for x in sys.stdin:
x = int(x)
if x:
print((sum(1 for d in p[: bisect.bisect(p, x // 2)] if a[x - d])))
| false | 25 | [
"-for x in map(int, sys.stdin):",
"+p = list(compress(n, a))",
"+for x in sys.stdin:",
"+ x = int(x)",
"- y = x // 2 + 1",
"- print((sum(1 for d in compress(n[:y], a[:y]) if a[x - d])))",
"+ print((sum(1 for d in p[: bisect.bisect(p, x // 2)] if a[x - d])))"
] | false | 0.095314 | 0.045789 | 2.081599 | [
"s426035945",
"s528025576"
] |
u384793271 | p03262 | python | s664658205 | s100514156 | 498 | 109 | 62,832 | 16,276 | Accepted | Accepted | 78.11 | N, X = list(map(int, input().split()))
x = list([abs(int(i) - X) for i in input().split()])
x_min = min(x)
for i in range(x_min, 0, -1):
cnt = 0
for j in x:
if j % i != 0:
break
else:
cnt += 1
if cnt == N:
print(i)
exit() | from fractions import gcd
def main():
n, X = list(map(int, input().split()))
x = list([abs(int(x) - X) for x in input().split()])
M = x[0]
for i in x[1:]:
M = gcd(M, i)
print(M)
if __name__ == "__main__":
main() | 15 | 15 | 304 | 261 | N, X = list(map(int, input().split()))
x = list([abs(int(i) - X) for i in input().split()])
x_min = min(x)
for i in range(x_min, 0, -1):
cnt = 0
for j in x:
if j % i != 0:
break
else:
cnt += 1
if cnt == N:
print(i)
exit()
| from fractions import gcd
def main():
n, X = list(map(int, input().split()))
x = list([abs(int(x) - X) for x in input().split()])
M = x[0]
for i in x[1:]:
M = gcd(M, i)
print(M)
if __name__ == "__main__":
main()
| false | 0 | [
"-N, X = list(map(int, input().split()))",
"-x = list([abs(int(i) - X) for i in input().split()])",
"-x_min = min(x)",
"-for i in range(x_min, 0, -1):",
"- cnt = 0",
"- for j in x:",
"- if j % i != 0:",
"- break",
"- else:",
"- cnt += 1",
"- if cnt ==... | false | 0.067053 | 0.109694 | 0.611277 | [
"s664658205",
"s100514156"
] |
u493520238 | p02720 | python | s669949579 | s219965509 | 157 | 124 | 17,312 | 13,656 | Accepted | Accepted | 21.02 | ln_l = [1,2,3,4,5,6,7,8,9]
def dps(curr_num):
end_num = curr_num[-1]
for i in [-1,0,1]:
added_num = int(end_num) + i
if added_num == -1 or added_num == 10:
continue
curr_num_plus = curr_num + str(added_num)
ln_l.append(int(curr_num_plus))
if len(cur... | def dfs(lls, curr_num, lim):
if curr_num > lim: return
lls.append(curr_num)
last_num = int(str(curr_num)[-1])
if last_num > 0:
dfs(lls, curr_num*10+last_num-1, lim)
if last_num < 9:
dfs(lls, curr_num*10+last_num+1, lim)
dfs(lls, curr_num*10+last_num, lim)
def main():... | 22 | 24 | 536 | 505 | ln_l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def dps(curr_num):
end_num = curr_num[-1]
for i in [-1, 0, 1]:
added_num = int(end_num) + i
if added_num == -1 or added_num == 10:
continue
curr_num_plus = curr_num + str(added_num)
ln_l.append(int(curr_num_plus))
if len(cu... | def dfs(lls, curr_num, lim):
if curr_num > lim:
return
lls.append(curr_num)
last_num = int(str(curr_num)[-1])
if last_num > 0:
dfs(lls, curr_num * 10 + last_num - 1, lim)
if last_num < 9:
dfs(lls, curr_num * 10 + last_num + 1, lim)
dfs(lls, curr_num * 10 + last_num, lim)
... | false | 8.333333 | [
"-ln_l = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-",
"-",
"-def dps(curr_num):",
"- end_num = curr_num[-1]",
"- for i in [-1, 0, 1]:",
"- added_num = int(end_num) + i",
"- if added_num == -1 or added_num == 10:",
"- continue",
"- curr_num_plus = curr_num + str(added_nu... | false | 0.230333 | 0.172549 | 1.334887 | [
"s669949579",
"s219965509"
] |
u145950990 | p03220 | python | s050228367 | s549019253 | 169 | 28 | 38,384 | 9,008 | Accepted | Accepted | 83.43 | n = int(eval(input()))
t,a = list(map(int,input().split()))
h = list(map(int,input().split()))
ans = 1
min_dif = abs(t-h[0]*0.006-a)
for i in range(1,n):
dif = abs(t-h[i]*0.006-a)
if min_dif > dif: min_dif,ans = dif,i+1
print(ans) | n = int(eval(input()))
t,a = list(map(int,input().split()))
h = list(map(int,input().split()))
dif = 10**10
ans = 0
for i in range(n):
z = t-h[i]*0.006
if dif>abs(a-z):
dif = abs(a-z)
ans = i+1
print(ans) | 9 | 11 | 234 | 226 | n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
ans = 1
min_dif = abs(t - h[0] * 0.006 - a)
for i in range(1, n):
dif = abs(t - h[i] * 0.006 - a)
if min_dif > dif:
min_dif, ans = dif, i + 1
print(ans)
| n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
dif = 10**10
ans = 0
for i in range(n):
z = t - h[i] * 0.006
if dif > abs(a - z):
dif = abs(a - z)
ans = i + 1
print(ans)
| false | 18.181818 | [
"-ans = 1",
"-min_dif = abs(t - h[0] * 0.006 - a)",
"-for i in range(1, n):",
"- dif = abs(t - h[i] * 0.006 - a)",
"- if min_dif > dif:",
"- min_dif, ans = dif, i + 1",
"+dif = 10**10",
"+ans = 0",
"+for i in range(n):",
"+ z = t - h[i] * 0.006",
"+ if dif > abs(a - z):",
"+... | false | 0.092404 | 0.03809 | 2.425905 | [
"s050228367",
"s549019253"
] |
u134302690 | p03693 | python | s914362335 | s040377704 | 168 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.88 | r,g,b = list(map(int,input().split()))
if (r*100+g*10+b)%4 == 0:
print("YES")
else:
print("NO") | r,g,b = input().split()
l = int(r+g+b)
print(("YES" if l%4 == 0 else "NO")) | 5 | 3 | 101 | 75 | r, g, b = list(map(int, input().split()))
if (r * 100 + g * 10 + b) % 4 == 0:
print("YES")
else:
print("NO")
| r, g, b = input().split()
l = int(r + g + b)
print(("YES" if l % 4 == 0 else "NO"))
| false | 40 | [
"-r, g, b = list(map(int, input().split()))",
"-if (r * 100 + g * 10 + b) % 4 == 0:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+r, g, b = input().split()",
"+l = int(r + g + b)",
"+print((\"YES\" if l % 4 == 0 else \"NO\"))"
] | false | 0.121169 | 0.043851 | 2.763226 | [
"s914362335",
"s040377704"
] |
u888092736 | p02713 | python | s718419685 | s069068061 | 22 | 20 | 9,172 | 8,972 | Accepted | Accepted | 9.09 | k = int(eval(input()))
n = 3
cnt = [0] * (k + 1)
for i in range(k, 0, -1):
cnt[i] = (k // i) ** n
for j in range(i * 2, k + 1, i):
cnt[i] -= cnt[j]
print((sum((i* cnt[i] for i in range(1, k + 1)))))
| k = int(eval(input()))
cnt = [0] * (k + 1)
for i in range(k, 0, -1):
cnt[i] = (k // i) ** 3
for j in range(i * 2, k + 1, i):
cnt[i] -= cnt[j]
print((sum((i* cnt[i] for i in range(1, k + 1)))))
| 10 | 9 | 218 | 211 | k = int(eval(input()))
n = 3
cnt = [0] * (k + 1)
for i in range(k, 0, -1):
cnt[i] = (k // i) ** n
for j in range(i * 2, k + 1, i):
cnt[i] -= cnt[j]
print((sum((i * cnt[i] for i in range(1, k + 1)))))
| k = int(eval(input()))
cnt = [0] * (k + 1)
for i in range(k, 0, -1):
cnt[i] = (k // i) ** 3
for j in range(i * 2, k + 1, i):
cnt[i] -= cnt[j]
print((sum((i * cnt[i] for i in range(1, k + 1)))))
| false | 10 | [
"-n = 3",
"- cnt[i] = (k // i) ** n",
"+ cnt[i] = (k // i) ** 3"
] | false | 0.114948 | 0.070335 | 1.634281 | [
"s718419685",
"s069068061"
] |
u297574184 | p02889 | python | s612407132 | s561427648 | 1,973 | 1,382 | 84,440 | 76,632 | Accepted | Accepted | 29.95 | def solve():
INF = float('inf')
def Dijkstra(adjList, vSt):
numV = len(adjList)
useds = [False] * numV
numUsed = 0
costs = [INF] * numV
costs[vSt] = 0
while True:
cNow, vNow = INF, -1
for v in range(numV):
if us... | def solve():
INF = float('inf')
def Dijkstra(adjList, vSt):
numV = len(adjList)
useds = [False] * numV
fuels = [-1] * numV
fuels[vSt] = L
nums = [INF] * numV
num = 0
vs = set([vSt])
while vs:
vNexts = set()
fue... | 57 | 68 | 1,579 | 1,872 | def solve():
INF = float("inf")
def Dijkstra(adjList, vSt):
numV = len(adjList)
useds = [False] * numV
numUsed = 0
costs = [INF] * numV
costs[vSt] = 0
while True:
cNow, vNow = INF, -1
for v in range(numV):
if useds[v]:
... | def solve():
INF = float("inf")
def Dijkstra(adjList, vSt):
numV = len(adjList)
useds = [False] * numV
fuels = [-1] * numV
fuels[vSt] = L
nums = [INF] * numV
num = 0
vs = set([vSt])
while vs:
vNexts = set()
fuelNexts = [-1]... | false | 16.176471 | [
"- numUsed = 0",
"- costs = [INF] * numV",
"- costs[vSt] = 0",
"- while True:",
"- cNow, vNow = INF, -1",
"- for v in range(numV):",
"- if useds[v]:",
"- continue",
"- if costs[v] < cNow:",
"- ... | false | 0.03861 | 0.047038 | 0.820836 | [
"s612407132",
"s561427648"
] |
u064434060 | p02936 | python | s055530591 | s203902774 | 1,965 | 793 | 105,492 | 94,100 | Accepted | Accepted | 59.64 | #import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions import gcd
#input=sys.stdin.readline
#import bisect
n,q=list(map(int,input().split()))
node=[[] for ... | import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions import gcd
input=sys.stdin.readline
#import bisect
n,q=list(map(int,input().split()))
node=[[] for _ ... | 37 | 37 | 763 | 761 | # import sys
# import numpy as np
import math
# import itertools
# from fractions import Fraction
# import itertools
from collections import deque
from collections import Counter
# import heapq
# from fractions import gcd
# input=sys.stdin.readline
# import bisect
n, q = list(map(int, input().split()))
node = [[] fo... | import sys
# import numpy as np
import math
# import itertools
# from fractions import Fraction
# import itertools
from collections import deque
from collections import Counter
# import heapq
# from fractions import gcd
input = sys.stdin.readline
# import bisect
n, q = list(map(int, input().split()))
node = [[] for... | false | 0 | [
"-# import sys",
"+import sys",
"+",
"-# input=sys.stdin.readline",
"+input = sys.stdin.readline"
] | false | 0.14777 | 0.039113 | 3.778006 | [
"s055530591",
"s203902774"
] |
u137542041 | p02585 | python | s475207417 | s483086471 | 1,585 | 623 | 143,144 | 81,080 | Accepted | Accepted | 60.69 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
P = [None] + P
C = [None] + C
all_max = C[1]
for st in range(1, N + 1):
scores = []
visit = set()
p = st
while p not in visit and len(visit) < K:
next_p = P[p]
... | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
P = [None] + P
C = [None] + C
all_max = C[1]
for st in range(1, N + 1):
p = P[st]
scores = [C[p]]
while p != st and len(scores) < K:
p = P[p]
scores.append(C[p])
... | 50 | 47 | 1,068 | 998 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
P = [None] + P
C = [None] + C
all_max = C[1]
for st in range(1, N + 1):
scores = []
visit = set()
p = st
while p not in visit and len(visit) < K:
next_p = P[p]
scores.append(C[n... | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
P = [None] + P
C = [None] + C
all_max = C[1]
for st in range(1, N + 1):
p = P[st]
scores = [C[p]]
while p != st and len(scores) < K:
p = P[p]
scores.append(C[p])
num_elem = len(... | false | 6 | [
"- scores = []",
"- visit = set()",
"- p = st",
"- while p not in visit and len(visit) < K:",
"- next_p = P[p]",
"- scores.append(C[next_p])",
"- visit.add(p)",
"- p = next_p",
"+ p = P[st]",
"+ scores = [C[p]]",
"+ while p != st and len(scores) <... | false | 0.03639 | 0.035274 | 1.031637 | [
"s475207417",
"s483086471"
] |
u207097826 | p02743 | python | s521372544 | s092221835 | 300 | 268 | 60,140 | 60,012 | Accepted | Accepted | 10.67 |
from decimal import Decimal
from decimal import *
a, b, c = list(map(str, input().split()))
getcontext().prec = 500
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if a**Decimal("0.5") + b**Decimal("0.5") < c**Decimal("0.5"):
print("Yes")
else:
print("No")
|
from decimal import Decimal
from decimal import *
a, b, c = list(map(str, input().split()))
#getcontext().prec = 1000
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if a**Decimal("0.5") + b**Decimal("0.5") < c**Decimal("0.5"):
print("Yes")
else:
print("No")
| 16 | 16 | 277 | 279 | from decimal import Decimal
from decimal import *
a, b, c = list(map(str, input().split()))
getcontext().prec = 500
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if a ** Decimal("0.5") + b ** Decimal("0.5") < c ** Decimal("0.5"):
print("Yes")
else:
print("No")
| from decimal import Decimal
from decimal import *
a, b, c = list(map(str, input().split()))
# getcontext().prec = 1000
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if a ** Decimal("0.5") + b ** Decimal("0.5") < c ** Decimal("0.5"):
print("Yes")
else:
print("No")
| false | 0 | [
"-getcontext().prec = 500",
"+# getcontext().prec = 1000"
] | false | 0.068558 | 0.048969 | 1.400035 | [
"s521372544",
"s092221835"
] |
u428341537 | p02627 | python | s888359415 | s029239539 | 29 | 26 | 8,972 | 9,024 | Accepted | Accepted | 10.34 | x=eval(input())
if x.islower():
print('a')
else:
print('A') | a=eval(input())
print(('A' if a.isupper() else 'a')) | 6 | 2 | 64 | 45 | x = eval(input())
if x.islower():
print("a")
else:
print("A")
| a = eval(input())
print(("A" if a.isupper() else "a"))
| false | 66.666667 | [
"-x = eval(input())",
"-if x.islower():",
"- print(\"a\")",
"-else:",
"- print(\"A\")",
"+a = eval(input())",
"+print((\"A\" if a.isupper() else \"a\"))"
] | false | 0.037383 | 0.034816 | 1.073747 | [
"s888359415",
"s029239539"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.