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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u746419473 | p03243 | python | s152148889 | s858246458 | 19 | 16 | 2,940 | 2,940 | Accepted | Accepted | 15.79 | n=str(eval(input()))
if n[0] == n[1] and n[1] == n[2]:
print(n)
else:
for i in [111,222,333,444,555,666,777,888,999]:
if int(n) < i:
print(i)
quit()
| n = int(eval(input()))
for i in range(1, 10):
ans = int(str(i)*3)
if n <= ans:
print(ans)
break
| 8 | 7 | 190 | 121 | n = str(eval(input()))
if n[0] == n[1] and n[1] == n[2]:
print(n)
else:
for i in [111, 222, 333, 444, 555, 666, 777, 888, 999]:
if int(n) < i:
print(i)
quit()
| n = int(eval(input()))
for i in range(1, 10):
ans = int(str(i) * 3)
if n <= ans:
print(ans)
break
| false | 12.5 | [
"-n = str(eval(input()))",
"-if n[0] == n[1] and n[1] == n[2]:",
"- print(n)",
"-else:",
"- for i in [111, 222, 333, 444, 555, 666, 777, 888, 999]:",
"- if int(n) < i:",
"- print(i)",
"- quit()",
"+n = int(eval(input()))",
"+for i in range(1, 10):",
"+ ans =... | false | 0.033629 | 0.041559 | 0.809188 | [
"s152148889",
"s858246458"
] |
u633068244 | p00009 | python | s248358892 | s254019173 | 970 | 720 | 43,964 | 43,964 | Accepted | Accepted | 25.77 | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2,r/2):
prime[2*i-1] = 0
for i in range(3,sqrt,2):
mx = 2*i
while mx <= r:
prime[mx-1] = 0
mx += i
while True:
try:
n = int(input())
print(sum(prim... | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2,r/2):
prime[2*i-1] = 0
for i in range(3,sqrt,2):
for j in range(2*i,r+1,i):
prime[j-1] = 0
while True:
try:
n = int(input())
print(sum(prime[:n]))
except:... | 20 | 18 | 358 | 338 | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2, r / 2):
prime[2 * i - 1] = 0
for i in range(3, sqrt, 2):
mx = 2 * i
while mx <= r:
prime[mx - 1] = 0
mx += i
while True:
try:
n = int(input())
print(sum(prime[:n]... | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2, r / 2):
prime[2 * i - 1] = 0
for i in range(3, sqrt, 2):
for j in range(2 * i, r + 1, i):
prime[j - 1] = 0
while True:
try:
n = int(input())
print(sum(prime[:n]))
except:... | false | 10 | [
"- mx = 2 * i",
"- while mx <= r:",
"- prime[mx - 1] = 0",
"- mx += i",
"+ for j in range(2 * i, r + 1, i):",
"+ prime[j - 1] = 0"
] | false | 0.087429 | 0.086196 | 1.014311 | [
"s248358892",
"s254019173"
] |
u991567869 | p02762 | python | s312237464 | s227935338 | 1,192 | 1,096 | 84,584 | 65,168 | Accepted | Accepted | 8.05 | import sys
sys.setrecursionlimit(10**9)
n, m, k = list(map(int, input().split()))
F = [[] for i in range(n)]
B = [set() for i in range(n)]
l = [0]*n
for i in range(m):
a, b = list(map(int, input().split()))
F[a - 1].append(b - 1)
F[b - 1].append(a - 1)
for i in range(k):
c, d = list(map... | import sys
sys.setrecursionlimit(10**9)
n, m, k = list(map(int, input().split()))
F = [[] for i in range(n)]
B = [[] for i in range(n)]
l = [0]*n
for i in range(m):
a, b = list(map(int, input().split()))
F[a - 1].append(b - 1)
F[b - 1].append(a - 1)
for i in range(k):
c, d = list(map(in... | 43 | 43 | 768 | 776 | import sys
sys.setrecursionlimit(10**9)
n, m, k = list(map(int, input().split()))
F = [[] for i in range(n)]
B = [set() for i in range(n)]
l = [0] * n
for i in range(m):
a, b = list(map(int, input().split()))
F[a - 1].append(b - 1)
F[b - 1].append(a - 1)
for i in range(k):
c, d = list(map(int, input().... | import sys
sys.setrecursionlimit(10**9)
n, m, k = list(map(int, input().split()))
F = [[] for i in range(n)]
B = [[] for i in range(n)]
l = [0] * n
for i in range(m):
a, b = list(map(int, input().split()))
F[a - 1].append(b - 1)
F[b - 1].append(a - 1)
for i in range(k):
c, d = list(map(int, input().spl... | false | 0 | [
"-B = [set() for i in range(n)]",
"+B = [[] for i in range(n)]",
"- B[c - 1].add(d - 1)",
"- B[d - 1].add(c - 1)",
"+ B[c - 1].append(d - 1)",
"+ B[d - 1].append(c - 1)",
"- ans[j] = lr - len(F[j]) - len(i & B[j]) - 1",
"+ ans[j] = lr - len(F[j]) - len(i & set(B[j])) - 1"
] | false | 0.08072 | 0.077689 | 1.03902 | [
"s312237464",
"s227935338"
] |
u513081876 | p03861 | python | s464176772 | s450155567 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a, b, x = list(map(int, input().split()))
print((b // x - (a-1) // x)) | a, b, x = list(map(int, input().split()))
print(((b // x) - ((a - 1)// x))) | 2 | 3 | 63 | 70 | a, b, x = list(map(int, input().split()))
print((b // x - (a - 1) // x))
| a, b, x = list(map(int, input().split()))
print(((b // x) - ((a - 1) // x)))
| false | 33.333333 | [
"-print((b // x - (a - 1) // x))",
"+print(((b // x) - ((a - 1) // x)))"
] | false | 0.046999 | 0.046479 | 1.011176 | [
"s464176772",
"s450155567"
] |
u314050667 | p02735 | python | s781180773 | s134121795 | 311 | 163 | 17,632 | 12,564 | Accepted | Accepted | 47.59 | import sys
import numpy as np
H, W = list(map(int, input().split()))
I = np.array([list(map(str, eval(input()))) for _ in range(H)])
grid = np.zeros([H,W], np.int16)
grid[np.where(I=='#')] = 1
inf = np.inf
dp = np.full([H,W], inf)
if grid[0,0] == 1:
dp[0,0] = 1
else:
dp[0,0] = 0
for i in range(H):... | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W = list(map(int, input().split()))
I = [list(map(str, eval(input()))) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0 and j == 0:
... | 29 | 35 | 796 | 790 | import sys
import numpy as np
H, W = list(map(int, input().split()))
I = np.array([list(map(str, eval(input()))) for _ in range(H)])
grid = np.zeros([H, W], np.int16)
grid[np.where(I == "#")] = 1
inf = np.inf
dp = np.full([H, W], inf)
if grid[0, 0] == 1:
dp[0, 0] = 1
else:
dp[0, 0] = 0
for i in range(H):
f... | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W = list(map(int, input().split()))
I = [list(map(str, eval(input()))) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0 and j == 0:
... | false | 17.142857 | [
"+import numpy as np",
"-import numpy as np",
"+read = sys.stdin.read",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"-I = np.array([list(map(str, eval(input()))) for _ in range(H)])",
"-grid = np.zeros([H, W], np.int16)",
"-grid[np.where(I == \"#\")] = 1",
"-inf = np.inf",
... | false | 0.269162 | 0.042802 | 6.288584 | [
"s781180773",
"s134121795"
] |
u821432765 | p03075 | python | s094829758 | s006306687 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | b=True
a=[int(eval(input())) for i in range(5)]
k=int(eval(input()))
for j in range(5):
for l in range(5):
if a[j]-a[l] > k:
b=False
if b:
print("Yay!")
else:
print(":(") | antenna = [int(eval(input())) for _ in range(5)]
k = int(eval(input()))
print(("Yay!" if max(antenna) - min(antenna) <= k else ":(")) | 11 | 4 | 184 | 123 | b = True
a = [int(eval(input())) for i in range(5)]
k = int(eval(input()))
for j in range(5):
for l in range(5):
if a[j] - a[l] > k:
b = False
if b:
print("Yay!")
else:
print(":(")
| antenna = [int(eval(input())) for _ in range(5)]
k = int(eval(input()))
print(("Yay!" if max(antenna) - min(antenna) <= k else ":("))
| false | 63.636364 | [
"-b = True",
"-a = [int(eval(input())) for i in range(5)]",
"+antenna = [int(eval(input())) for _ in range(5)]",
"-for j in range(5):",
"- for l in range(5):",
"- if a[j] - a[l] > k:",
"- b = False",
"-if b:",
"- print(\"Yay!\")",
"-else:",
"- print(\":(\")",
"+print... | false | 0.040168 | 0.041601 | 0.965546 | [
"s094829758",
"s006306687"
] |
u545368057 | p03160 | python | s901211246 | s018359941 | 557 | 137 | 23,092 | 13,924 | Accepted | Accepted | 75.4 | import numpy as np
N = int(eval(input()))
hs = [int(i) for i in input().split()]
dp = np.zeros(N)
for i,h in enumerate(hs):
if i == 0:
# 0は初期化されている
dp[i] = 0
continue
elif i == 1:
# 1は1通りしか無い
dp[i] = dp[i-1] + abs(hs[i-1]-h)
else:
# 1個前か2個... | N = int(eval(input()))
hs = [int(i) for i in input().split()]
dp = [10000000] * N
for i,h in enumerate(hs):
if i == 0:
# 0は初期化されている
dp[i] = 0
continue
elif i == 1:
# 1は1通りしか無い
dp[i] = dp[i-1] + abs(hs[i-1]-h)
else:
# 1個前か2個前で、コストが最小になるやつ
... | 17 | 16 | 429 | 407 | import numpy as np
N = int(eval(input()))
hs = [int(i) for i in input().split()]
dp = np.zeros(N)
for i, h in enumerate(hs):
if i == 0:
# 0は初期化されている
dp[i] = 0
continue
elif i == 1:
# 1は1通りしか無い
dp[i] = dp[i - 1] + abs(hs[i - 1] - h)
else:
# 1個前か2個前で、コストが最小になるや... | N = int(eval(input()))
hs = [int(i) for i in input().split()]
dp = [10000000] * N
for i, h in enumerate(hs):
if i == 0:
# 0は初期化されている
dp[i] = 0
continue
elif i == 1:
# 1は1通りしか無い
dp[i] = dp[i - 1] + abs(hs[i - 1] - h)
else:
# 1個前か2個前で、コストが最小になるやつ
dp[i] =... | false | 5.882353 | [
"-import numpy as np",
"-",
"-dp = np.zeros(N)",
"+dp = [10000000] * N",
"-print((int(dp[-1])))",
"+print((dp[-1]))"
] | false | 0.268158 | 0.037085 | 7.230977 | [
"s901211246",
"s018359941"
] |
u029000441 | p02984 | python | s141982576 | s363454020 | 151 | 123 | 14,484 | 21,116 | Accepted | Accepted | 18.54 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
f... | #float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import h... | 28 | 41 | 813 | 1,071 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from ... | # float型を許すな
# numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapif... | false | 31.707317 | [
"+# float型を許すな",
"+# numpyはpythonで",
"-",
"-# from collections import defaultdict",
"+from collections import defaultdict",
"-from math import floor, ceil, pi",
"+from math import floor, ceil, pi, factorial",
"+from operator import itemgetter",
"-# from operator import itemgetter",
"+",
"- re... | false | 0.106953 | 0.094037 | 1.137349 | [
"s141982576",
"s363454020"
] |
u314188085 | p03611 | python | s706398918 | s798890912 | 121 | 95 | 24,148 | 20,724 | Accepted | Accepted | 21.49 | N = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
numcnt = {i:0 for i in range(100001)}
for i in a:
numcnt[i]+=1
for x in range(1,100000):
subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]
ans = max(ans,subans)
print(ans) | N = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
numcnt = [0]*100001
for i in a:
numcnt[i]+=1
for x in range(1,100000):
subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]
ans = max(ans,subans)
print(ans) | 15 | 15 | 271 | 253 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
numcnt = {i: 0 for i in range(100001)}
for i in a:
numcnt[i] += 1
for x in range(1, 100000):
subans = numcnt[x - 1] + numcnt[x] + numcnt[x + 1]
ans = max(ans, subans)
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
numcnt = [0] * 100001
for i in a:
numcnt[i] += 1
for x in range(1, 100000):
subans = numcnt[x - 1] + numcnt[x] + numcnt[x + 1]
ans = max(ans, subans)
print(ans)
| false | 0 | [
"-numcnt = {i: 0 for i in range(100001)}",
"+numcnt = [0] * 100001"
] | false | 0.161415 | 0.118513 | 1.362011 | [
"s706398918",
"s798890912"
] |
u756388720 | p02586 | python | s000070219 | s519165914 | 2,320 | 2,032 | 146,920 | 147,032 | Accepted | Accepted | 12.41 | H, W, K = list(map(int, input().split()))
A = [[0] * W for _ in range(H)]
for i in range(K):
y, x, v = list(map(int, input().split()))
A[y - 1][x - 1] = v
dp = [[0] * 4 for i in range(W)]
pre = []
dp[0][1] = A[0][0]
for i in range(H):
for j in range(W):
for k in range(4):
if i... | H, W, K = list(map(int, input().split()))
A = [[0] * W for _ in range(H)]
for i in range(K):
y, x, v = list(map(int, input().split()))
A[y - 1][x - 1] = v
dp = [[0] * 4 for i in range(W)]
pre = []
dp[0][1] = A[0][0]
for i in range(H):
for j in range(W):
if i:
dp[j][0] = max(dp... | 25 | 23 | 765 | 681 | H, W, K = list(map(int, input().split()))
A = [[0] * W for _ in range(H)]
for i in range(K):
y, x, v = list(map(int, input().split()))
A[y - 1][x - 1] = v
dp = [[0] * 4 for i in range(W)]
pre = []
dp[0][1] = A[0][0]
for i in range(H):
for j in range(W):
for k in range(4):
if i:
... | H, W, K = list(map(int, input().split()))
A = [[0] * W for _ in range(H)]
for i in range(K):
y, x, v = list(map(int, input().split()))
A[y - 1][x - 1] = v
dp = [[0] * 4 for i in range(W)]
pre = []
dp[0][1] = A[0][0]
for i in range(H):
for j in range(W):
if i:
dp[j][0] = max(dp[j][0], max... | false | 8 | [
"+ if i:",
"+ dp[j][0] = max(dp[j][0], max(pre[j]))",
"+ dp[j][1] = max(dp[j][1], max(pre[j]) + A[i][j])",
"- if i:",
"- if k == 1:",
"- dp[j][k] = max(dp[j][k], max(pre[j]) + A[i][j])",
"- if k == 0:",
"- ... | false | 0.047717 | 0.046225 | 1.032283 | [
"s000070219",
"s519165914"
] |
u440566786 | p03178 | python | s096577390 | s480934668 | 1,101 | 1,009 | 129,628 | 45,020 | Accepted | Accepted | 8.36 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
k=eval(input())
d=int(eval(input()))
n=len(k)
dp=[[[0]*2 for _ in range(d)] for _ in range(n+1)]
dp[0][0][0]=1
for i in range(n):
a=int(k[i])
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
from itertools import product
def resolve():
k = eval(input())
modulo = int(eval(input()))
dp = [[0] * 2 for _ in range(modulo)]
dp[0][0] = 1
for d in... | 25 | 28 | 770 | 815 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
k = eval(input())
d = int(eval(input()))
n = len(k)
dp = [[[0] * 2 for _ in range(d)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i in range(n):
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
from itertools import product
def resolve():
k = eval(input())
modulo = int(eval(input()))
dp = [[0] * 2 for _ in range(modulo)]
dp[0][0] = 1
for d in k:
... | false | 10.714286 | [
"-MOD = 10**9 + 7",
"+MOD = 10**9 + 7 # 998244353",
"+from itertools import product",
"- d = int(eval(input()))",
"- n = len(k)",
"- dp = [[[0] * 2 for _ in range(d)] for _ in range(n + 1)]",
"- dp[0][0][0] = 1",
"- for i in range(n):",
"- a = int(k[i])",
"- for j in ... | false | 0.050064 | 0.046393 | 1.079118 | [
"s096577390",
"s480934668"
] |
u133936772 | p02773 | python | s671921430 | s593508106 | 742 | 432 | 49,804 | 35,392 | Accepted | Accepted | 41.78 | n = int(input())
l = [input() for _ in range(n)]
d = {}
for w in l:
d[w] = d.get(w,0)+1
m = max(d.values())
lt = sorted(d.items(),key=lambda k:-k[1])
ans = sorted([k for k,v in lt if v==m])
print(*ans,sep='\n')
| n=int(eval(input()))
c={}
for _ in range(n): s=eval(input()); c[s]=c.get(s,0)+1
m=max(c.values())
print((*sorted(k for k,v in list(c.items()) if v==m))) | 9 | 5 | 220 | 136 | n = int(input())
l = [input() for _ in range(n)]
d = {}
for w in l:
d[w] = d.get(w, 0) + 1
m = max(d.values())
lt = sorted(d.items(), key=lambda k: -k[1])
ans = sorted([k for k, v in lt if v == m])
print(*ans, sep="\n")
| n = int(eval(input()))
c = {}
for _ in range(n):
s = eval(input())
c[s] = c.get(s, 0) + 1
m = max(c.values())
print((*sorted(k for k, v in list(c.items()) if v == m)))
| false | 44.444444 | [
"-n = int(input())",
"-l = [input() for _ in range(n)]",
"-d = {}",
"-for w in l:",
"- d[w] = d.get(w, 0) + 1",
"-m = max(d.values())",
"-lt = sorted(d.items(), key=lambda k: -k[1])",
"-ans = sorted([k for k, v in lt if v == m])",
"-print(*ans, sep=\"\\n\")",
"+n = int(eval(input()))",
"+c = ... | false | 0.047144 | 0.047313 | 0.996415 | [
"s671921430",
"s593508106"
] |
u188827677 | p03549 | python | s715015931 | s421341813 | 30 | 27 | 9,064 | 9,128 | Accepted | Accepted | 10 | n,m = list(map(int, input().split()))
print(((1900*m + ((n-m)*100))*(2**m))) | n,m = list(map(int, input().split()))
print(((1900*m+100*(n-m))*(2**m))) | 3 | 3 | 71 | 67 | n, m = list(map(int, input().split()))
print(((1900 * m + ((n - m) * 100)) * (2**m)))
| n, m = list(map(int, input().split()))
print(((1900 * m + 100 * (n - m)) * (2**m)))
| false | 0 | [
"-print(((1900 * m + ((n - m) * 100)) * (2**m)))",
"+print(((1900 * m + 100 * (n - m)) * (2**m)))"
] | false | 0.043718 | 0.04582 | 0.95412 | [
"s715015931",
"s421341813"
] |
u767664985 | p03352 | python | s296886206 | s248005768 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | X = int(eval(input()))
ans = 0
for b in range(X + 1):
for p in range(2, 10): #2^10=1024
tmp = b ** p
if tmp <= X and tmp > ans:
ans = tmp
print(ans)
| from bisect import bisect_right
expo = sorted(list(set([b**p for b in range(1, int(1000**0.5)+1) for p in range(2, 10) if b**p <= 1000])))
X = int(eval(input()))
print((expo[bisect_right(expo, X)-1]))
| 8 | 6 | 159 | 200 | X = int(eval(input()))
ans = 0
for b in range(X + 1):
for p in range(2, 10): # 2^10=1024
tmp = b**p
if tmp <= X and tmp > ans:
ans = tmp
print(ans)
| from bisect import bisect_right
expo = sorted(
list(
set(
[
b**p
for b in range(1, int(1000**0.5) + 1)
for p in range(2, 10)
if b**p <= 1000
]
)
)
)
X = int(eval(input()))
print((expo[bisect_right(expo, X) -... | false | 25 | [
"+from bisect import bisect_right",
"+",
"+expo = sorted(",
"+ list(",
"+ set(",
"+ [",
"+ b**p",
"+ for b in range(1, int(1000**0.5) + 1)",
"+ for p in range(2, 10)",
"+ if b**p <= 1000",
"+ ]",
"+ ... | false | 0.276323 | 0.269714 | 1.024504 | [
"s296886206",
"s248005768"
] |
u238801602 | p02657 | python | s266029589 | s347914686 | 23 | 21 | 9,108 | 9,164 | Accepted | Accepted | 8.7 | A, B = list(map(float, input().split()))
A = int(A)
B = int(float(str(B*100)))
print((int(A*B/100))) | A, B = input().split()
A = int(A)
B = int(float(B)*100)
print((int(A*B/100))) | 4 | 4 | 95 | 78 | A, B = list(map(float, input().split()))
A = int(A)
B = int(float(str(B * 100)))
print((int(A * B / 100)))
| A, B = input().split()
A = int(A)
B = int(float(B) * 100)
print((int(A * B / 100)))
| false | 0 | [
"-A, B = list(map(float, input().split()))",
"+A, B = input().split()",
"-B = int(float(str(B * 100)))",
"+B = int(float(B) * 100)"
] | false | 0.12215 | 0.106808 | 1.143643 | [
"s266029589",
"s347914686"
] |
u596276291 | p03999 | python | s448617927 | s828765571 | 37 | 32 | 3,564 | 3,316 | Accepted | Accepted | 13.51 | from collections import defaultdict
# all_split("abc") -> [['abc'], ['ab', 'c'], ['a', 'bc'], ['a', 'b', 'c']]
def all_split(s):
if len(s) == 1:
return [s]
ans = []
for i in range(2 ** (len(s) - 1)):
b = list(map(int, format(i, "0" + str(len(s) - 1) + "b")))
ans.append(... | from collections import defaultdict
def main():
S = eval(input())
ans = 0
# 2 ^ nの組み合わせの全列挙
n = len(S) - 1
for b in range(2 ** n):
p_list = [i for i in range(n) if b & 1 << i]
x, s = [], S[:]
for p in p_list[::-1]:
a, s = s[p + 1:], s[:p + 1]
... | 39 | 22 | 811 | 466 | from collections import defaultdict
# all_split("abc") -> [['abc'], ['ab', 'c'], ['a', 'bc'], ['a', 'b', 'c']]
def all_split(s):
if len(s) == 1:
return [s]
ans = []
for i in range(2 ** (len(s) - 1)):
b = list(map(int, format(i, "0" + str(len(s) - 1) + "b")))
ans.append(split(s, b))
... | from collections import defaultdict
def main():
S = eval(input())
ans = 0
# 2 ^ nの組み合わせの全列挙
n = len(S) - 1
for b in range(2**n):
p_list = [i for i in range(n) if b & 1 << i]
x, s = [], S[:]
for p in p_list[::-1]:
a, s = s[p + 1 :], s[: p + 1]
x.appen... | false | 43.589744 | [
"-",
"-# all_split(\"abc\") -> [['abc'], ['ab', 'c'], ['a', 'bc'], ['a', 'b', 'c']]",
"-def all_split(s):",
"- if len(s) == 1:",
"- return [s]",
"- ans = []",
"- for i in range(2 ** (len(s) - 1)):",
"- b = list(map(int, format(i, \"0\" + str(len(s) - 1) + \"b\")))",
"- ... | false | 0.044222 | 0.042867 | 1.031606 | [
"s448617927",
"s828765571"
] |
u006425112 | p02707 | python | s895772024 | s670816516 | 303 | 221 | 54,560 | 37,420 | Accepted | Accepted | 27.06 | import numpy as np
import math
from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
A = list(map(int, input().split()))
for i in A:
d[i] += 1
for i in range(1, n+1):
print((d[i])) | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
d = defaultdict(int)
for i in A:
d[i] += 1
for i in range(1, n+1):
print((d[i])) | 14 | 10 | 223 | 186 | import numpy as np
import math
from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
A = list(map(int, input().split()))
for i in A:
d[i] += 1
for i in range(1, n + 1):
print((d[i]))
| from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
d = defaultdict(int)
for i in A:
d[i] += 1
for i in range(1, n + 1):
print((d[i]))
| false | 28.571429 | [
"-import numpy as np",
"-import math",
"-d = defaultdict(int)",
"+d = defaultdict(int)"
] | false | 0.037153 | 0.033504 | 1.108918 | [
"s895772024",
"s670816516"
] |
u312025627 | p02947 | python | s741564718 | s957339885 | 267 | 240 | 17,808 | 17,808 | Accepted | Accepted | 10.11 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ans = 0
used_s = {}
for _ in range(n):
s = "".join(sorted(eval(input())))
if not s in list(used_s.keys()):
used_s[s] = 0
else:
used_s[s] += 1
ans += 1 * used_s[s]
print(ans) | def main():
import sys
input = sys.stdin.readline
n = int(eval(input()))
ans = 0
used_s = {}
for _ in range(n):
s = "".join(sorted(eval(input())))
if not s in list(used_s.keys()):
used_s[s] = 0
else:
used_s[s] += 1
ans += ... | 15 | 19 | 268 | 375 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ans = 0
used_s = {}
for _ in range(n):
s = "".join(sorted(eval(input())))
if not s in list(used_s.keys()):
used_s[s] = 0
else:
used_s[s] += 1
ans += 1 * used_s[s]
print(ans)
| def main():
import sys
input = sys.stdin.readline
n = int(eval(input()))
ans = 0
used_s = {}
for _ in range(n):
s = "".join(sorted(eval(input())))
if not s in list(used_s.keys()):
used_s[s] = 0
else:
used_s[s] += 1
ans += 1 * used_s[s]... | false | 21.052632 | [
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-ans = 0",
"-used_s = {}",
"-for _ in range(n):",
"- s = \"\".join(sorted(eval(input())))",
"- if not s in list(used_s.keys()):",
"- used_s[s] = 0",
"- else:",
"- ... | false | 0.041734 | 0.036421 | 1.14589 | [
"s741564718",
"s957339885"
] |
u506858457 | p03814 | python | s083203344 | s100004138 | 69 | 35 | 4,840 | 3,512 | Accepted | Accepted | 49.28 | s=list(eval(input()))
a=200000
z=0
for i in range(len(s)):
if s[i]=='A'and a>i:
a=i
if s[i]=='Z'and z<i:
z=i
print((z-a+1)) | S=eval(input())
N=len(S)
A=0
Z=0
for i in range(N):
if S[i]=='A':
A=i
#print(A)
break
for i in range(N)[::-1]:
if S[i]=='Z':
Z=i
#print(Z)
break
ans=Z-A+1
print(ans) | 10 | 18 | 137 | 214 | s = list(eval(input()))
a = 200000
z = 0
for i in range(len(s)):
if s[i] == "A" and a > i:
a = i
if s[i] == "Z" and z < i:
z = i
print((z - a + 1))
| S = eval(input())
N = len(S)
A = 0
Z = 0
for i in range(N):
if S[i] == "A":
A = i
# print(A)
break
for i in range(N)[::-1]:
if S[i] == "Z":
Z = i
# print(Z)
break
ans = Z - A + 1
print(ans)
| false | 44.444444 | [
"-s = list(eval(input()))",
"-a = 200000",
"-z = 0",
"-for i in range(len(s)):",
"- if s[i] == \"A\" and a > i:",
"- a = i",
"- if s[i] == \"Z\" and z < i:",
"- z = i",
"-print((z - a + 1))",
"+S = eval(input())",
"+N = len(S)",
"+A = 0",
"+Z = 0",
"+for i in range(N):"... | false | 0.035821 | 0.075186 | 0.476432 | [
"s083203344",
"s100004138"
] |
u758815106 | p03167 | python | s782640433 | s433844692 | 637 | 138 | 48,144 | 117,096 | Accepted | Accepted | 78.34 |
def mod(num):
return num % (10 ** 9 + 7)
H, W = list(map(int, input().split()))
dp = [[0] * W for _ in range(H)]
for i in range(H):
a = eval(input())
for j in range(W):
if a[j] == "#":
dp[i][j] = -1
dp[0][0] = 1
for col in range(1, W):
if dp[0][col] != -1:
... | #!/usr/bin/env python3
#import
#import math
#import numpy as np
H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
def mod(num):
return num % (10 ** 9 + 7)
dp = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0 and j == 0:
... | 32 | 30 | 691 | 631 | def mod(num):
return num % (10**9 + 7)
H, W = list(map(int, input().split()))
dp = [[0] * W for _ in range(H)]
for i in range(H):
a = eval(input())
for j in range(W):
if a[j] == "#":
dp[i][j] = -1
dp[0][0] = 1
for col in range(1, W):
if dp[0][col] != -1:
dp[0][col] = dp[0][... | #!/usr/bin/env python3
# import
# import math
# import numpy as np
H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
def mod(num):
return num % (10**9 + 7)
dp = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0 and j == 0:
dp[i][... | false | 6.25 | [
"+#!/usr/bin/env python3",
"+# import",
"+# import math",
"+# import numpy as np",
"+H, W = list(map(int, input().split()))",
"+A = [list(eval(input())) for _ in range(H)]",
"+",
"+",
"-H, W = list(map(int, input().split()))",
"- a = eval(input())",
"- if a[j] == \"#\":",
"- ... | false | 0.036882 | 0.035797 | 1.030331 | [
"s782640433",
"s433844692"
] |
u102461423 | p02712 | python | s912934363 | s364628433 | 144 | 112 | 43,268 | 34,424 | Accepted | Accepted | 22.22 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(read())
x = np.arange(1, N + 1, dtype=np.int64)
x[x % 3 == 0] = 0
x[x % 5 == 0] = 0
print((x.sum()))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(read())
x = np.arange(N + 1, dtype=np.int64)
x[::3] = 0
x[::5] = 0
print((x.sum()))
| 11 | 11 | 253 | 236 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(read())
x = np.arange(1, N + 1, dtype=np.int64)
x[x % 3 == 0] = 0
x[x % 5 == 0] = 0
print((x.sum()))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(read())
x = np.arange(N + 1, dtype=np.int64)
x[::3] = 0
x[::5] = 0
print((x.sum()))
| false | 0 | [
"-x = np.arange(1, N + 1, dtype=np.int64)",
"-x[x % 3 == 0] = 0",
"-x[x % 5 == 0] = 0",
"+x = np.arange(N + 1, dtype=np.int64)",
"+x[::3] = 0",
"+x[::5] = 0"
] | false | 0.474943 | 0.757045 | 0.627364 | [
"s912934363",
"s364628433"
] |
u077291787 | p04020 | python | s354431622 | s648607888 | 83 | 58 | 14,240 | 14,252 | Accepted | Accepted | 30.12 | # AGC003B - Simplified mahjong
import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = list(map(int, [eval(input()) for _ in range(N)])) + [0]
ans = 0
for i in range(N): # make pairs greedily
ans += A[i] // 2 # pairs with same cards
if A[i] % 2 and A[i +... | # AGC003B - Simplified mahjong
import sys
input = sys.stdin.readline
def main():
# split in subsequences when 0 appears -> sum up cur // 2
N = int(eval(input()))
A = list(map(int, [eval(input()) for _ in range(N)])) + [0]
ans, cur = 0, 0
for i in A:
if i:
cur += i
... | 18 | 20 | 446 | 429 | # AGC003B - Simplified mahjong
import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = list(map(int, [eval(input()) for _ in range(N)])) + [0]
ans = 0
for i in range(N): # make pairs greedily
ans += A[i] // 2 # pairs with same cards
if A[i] % 2 and A[i + 1]: # ... | # AGC003B - Simplified mahjong
import sys
input = sys.stdin.readline
def main():
# split in subsequences when 0 appears -> sum up cur // 2
N = int(eval(input()))
A = list(map(int, [eval(input()) for _ in range(N)])) + [0]
ans, cur = 0, 0
for i in A:
if i:
cur += i
else... | false | 10 | [
"+ # split in subsequences when 0 appears -> sum up cur // 2",
"- ans = 0",
"- for i in range(N): # make pairs greedily",
"- ans += A[i] // 2 # pairs with same cards",
"- if A[i] % 2 and A[i + 1]: # pairs with a neighbor",
"- ans += 1",
"- A[i + 1] -= 1",
... | false | 0.062922 | 0.071996 | 0.87396 | [
"s354431622",
"s648607888"
] |
u843175622 | p03078 | python | s873689985 | s193773020 | 105 | 46 | 16,840 | 10,720 | Accepted | Accepted | 56.19 | x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
ans = []
for i in range(x):
for j in range(y):
if (i + 1) * (j + 1) > K:
break
for... | import heapq
from collections import defaultdict
x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
used = defaultdict(bool)
pq = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
u... | 16 | 24 | 488 | 887 | x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
ans = []
for i in range(x):
for j in range(y):
if (i + 1) * (j + 1) > K:
break
for k in range... | import heapq
from collections import defaultdict
x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
used = defaultdict(bool)
pq = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
used[(0, 0... | false | 33.333333 | [
"+import heapq",
"+from collections import defaultdict",
"+",
"-ans = []",
"-for i in range(x):",
"- for j in range(y):",
"- if (i + 1) * (j + 1) > K:",
"- break",
"- for k in range(z):",
"- if (i + 1) * (j + 1) * (k + 1) > K:",
"- break",
... | false | 0.036494 | 0.037212 | 0.98071 | [
"s873689985",
"s193773020"
] |
u127499732 | p02780 | python | s051028718 | s472072651 | 131 | 121 | 23,896 | 23,892 | Accepted | Accepted | 7.63 | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
*exp, = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ll = [l[k - 1]] + [l[i + k] - l[i] for i in range(n-k)]
ans = max(ll)
print(ans)
if __name__ == '__main__':... | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
*exp, = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ll = [l[k - 1]] + [j - i for i, j in zip(l, l[k:])]
ans = max(ll)
print(ans)
if __name__ == '__main__':
... | 13 | 13 | 332 | 328 | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
(*exp,) = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ll = [l[k - 1]] + [l[i + k] - l[i] for i in range(n - k)]
ans = max(ll)
print(ans)
if __name__ == "__main__":
m... | def main():
from itertools import accumulate
n, k = list(map(int, input().split()))
(*exp,) = [(int(x) + 1) / 2 for x in input().split()]
l = accumulate(exp)
l = list(l)
ll = [l[k - 1]] + [j - i for i, j in zip(l, l[k:])]
ans = max(ll)
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- ll = [l[k - 1]] + [l[i + k] - l[i] for i in range(n - k)]",
"+ ll = [l[k - 1]] + [j - i for i, j in zip(l, l[k:])]"
] | false | 0.041484 | 0.046793 | 0.886528 | [
"s051028718",
"s472072651"
] |
u484229314 | p03253 | python | s669809074 | s617693649 | 443 | 351 | 10,968 | 16,968 | Accepted | Accepted | 20.77 | from math import sqrt
N, M = [int(_) for _ in input().split()]
p = []
m = M
max_x = 1
for i in range(2, int(sqrt(m)) + 1):
if m % i == 0:
cnt = 0
while m % i == 0:
cnt += 1
m //= i
p.append((i, cnt))
if cnt > max_x:
max_x = cnt
if... | def prime_factorization(n):
"""
nを素因数分解
:param n:
:return:素因数分解結果 [(素数S1, count S1),(素数S2, count S2), ...]
"""
from math import sqrt
if (n == 0): return []
if (n == 1): return [(1, 1)]
res = []
for i in range(2, int(sqrt(n)) + 1):
if n == 1: break
... | 38 | 77 | 826 | 1,688 | from math import sqrt
N, M = [int(_) for _ in input().split()]
p = []
m = M
max_x = 1
for i in range(2, int(sqrt(m)) + 1):
if m % i == 0:
cnt = 0
while m % i == 0:
cnt += 1
m //= i
p.append((i, cnt))
if cnt > max_x:
max_x = cnt
if m > 1:
p.app... | def prime_factorization(n):
"""
nを素因数分解
:param n:
:return:素因数分解結果 [(素数S1, count S1),(素数S2, count S2), ...]
"""
from math import sqrt
if n == 0:
return []
if n == 1:
return [(1, 1)]
res = []
for i in range(2, int(sqrt(n)) + 1):
if n == 1:
break... | false | 50.649351 | [
"-from math import sqrt",
"+def prime_factorization(n):",
"+ \"\"\"",
"+ nを素因数分解",
"+ :param n:",
"+ :return:素因数分解結果 [(素数S1, count S1),(素数S2, count S2), ...]",
"+ \"\"\"",
"+ from math import sqrt",
"+",
"+ if n == 0:",
"+ return []",
"+ if n == 1:",
"+ ... | false | 0.192033 | 0.187145 | 1.026119 | [
"s669809074",
"s617693649"
] |
u956530786 | p02781 | python | s537689308 | s577431459 | 240 | 170 | 46,552 | 38,256 | Accepted | Accepted | 29.17 | s=eval(input())*2;n=len(s)/2
def f(i,t,k):
if k>n-i:return 0
a=max(t,int(s[i]));i+=1;
if t:return f(i,9,k)+a*f(i,9,k-1)if k else 1
else:return(f(i,9,k)+(a-1)*f(i,9,k-1)+f(i,0,k-1)if k else 1)if a else f(i,0,k)
print((f(0,0,int(eval(input()))))) | s=eval(input())*2;n=len(s)//2;X=[(0,0)]*4
for j in range(n+1):
for k in range(3,-1,-1):
a=int(s[n-j])
if k>j+1:X[k]=(0,0)
else:X[k]=(X[k][0]+9*X[k-1][0]if k else 1,(X[k][0]+(a-1)*X[k-1][0]+X[k-1][1]if k else 1)if a else X[k][1])
print((X[int(eval(input()))][1])) | 7 | 7 | 240 | 261 | s = eval(input()) * 2
n = len(s) / 2
def f(i, t, k):
if k > n - i:
return 0
a = max(t, int(s[i]))
i += 1
if t:
return f(i, 9, k) + a * f(i, 9, k - 1) if k else 1
else:
return (
(f(i, 9, k) + (a - 1) * f(i, 9, k - 1) + f(i, 0, k - 1) if k else 1)
if a... | s = eval(input()) * 2
n = len(s) // 2
X = [(0, 0)] * 4
for j in range(n + 1):
for k in range(3, -1, -1):
a = int(s[n - j])
if k > j + 1:
X[k] = (0, 0)
else:
X[k] = (
X[k][0] + 9 * X[k - 1][0] if k else 1,
(X[k][0] + (a - 1) * X[k - 1][0... | false | 0 | [
"-n = len(s) / 2",
"-",
"-",
"-def f(i, t, k):",
"- if k > n - i:",
"- return 0",
"- a = max(t, int(s[i]))",
"- i += 1",
"- if t:",
"- return f(i, 9, k) + a * f(i, 9, k - 1) if k else 1",
"- else:",
"- return (",
"- (f(i, 9, k) + (a - 1) * f(i, ... | false | 0.212074 | 0.0367 | 5.778582 | [
"s537689308",
"s577431459"
] |
u845333844 | p04045 | python | s810772020 | s468859311 | 260 | 88 | 3,064 | 2,940 | Accepted | Accepted | 66.15 | n,k=list(map(int,input().split()))
d=list(map(int,input().split()))
a=[]
for i in range(10):
sum=0
for x in d:
if x==i:
break
else:
sum+=1
if sum==k:
a.append(i)
a=set(a)
for i in range(n,10*n+1):
b=[]
x=len(str(i))
y=str(i)
fo... | n,k=list(map(int,input().split()))
d=set(input().split())
while len(d&set(str(n)))!=0:
n+=1
print(n) | 23 | 6 | 420 | 104 | n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
a = []
for i in range(10):
sum = 0
for x in d:
if x == i:
break
else:
sum += 1
if sum == k:
a.append(i)
a = set(a)
for i in range(n, 10 * n + 1):
b = []
x = len(str(i))
y = ... | n, k = list(map(int, input().split()))
d = set(input().split())
while len(d & set(str(n))) != 0:
n += 1
print(n)
| false | 73.913043 | [
"-d = list(map(int, input().split()))",
"-a = []",
"-for i in range(10):",
"- sum = 0",
"- for x in d:",
"- if x == i:",
"- break",
"- else:",
"- sum += 1",
"- if sum == k:",
"- a.append(i)",
"-a = set(a)",
"-for i in range(n, 10 * n + 1):"... | false | 0.045284 | 0.039009 | 1.160858 | [
"s810772020",
"s468859311"
] |
u454022848 | p02392 | python | s356139091 | s785693719 | 30 | 10 | 6,324 | 6,424 | Accepted | Accepted | 66.67 | # encoding:utf-8
input = list(map(int, input().split()))
a = input[0]
b = input[1]
c = input[2]
if a < b and b < c:
print("Yes")
else:
print("No") | # encoding:utf-8
input = list(map(int, input().split()))
a, b, c = input
if a < b and b < c:
print("Yes")
else:
print("No") | 11 | 9 | 158 | 133 | # encoding:utf-8
input = list(map(int, input().split()))
a = input[0]
b = input[1]
c = input[2]
if a < b and b < c:
print("Yes")
else:
print("No")
| # encoding:utf-8
input = list(map(int, input().split()))
a, b, c = input
if a < b and b < c:
print("Yes")
else:
print("No")
| false | 18.181818 | [
"-a = input[0]",
"-b = input[1]",
"-c = input[2]",
"+a, b, c = input"
] | false | 0.038105 | 0.034627 | 1.100447 | [
"s356139091",
"s785693719"
] |
u416758623 | p03102 | python | s748535913 | s894313373 | 177 | 18 | 13,168 | 3,060 | Accepted | Accepted | 89.83 | import numpy as np
ans = 0
n,m,c = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
a = list(map(int, input().split()))
arrayA = np.array(a)
arrayB = np.array(b)
array = arrayA * arrayB
if array.sum() + c > 0:
ans += 1
print(ans) | n,m,c = list(map(int,input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
total = c
a = list(map(int, input().split()))
for i in range(m):
total += a[i] * b[i]
if total > 0:
ans += 1
print(ans) | 13 | 11 | 306 | 257 | import numpy as np
ans = 0
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
a = list(map(int, input().split()))
arrayA = np.array(a)
arrayB = np.array(b)
array = arrayA * arrayB
if array.sum() + c > 0:
ans += 1
print(ans)
| n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
total = c
a = list(map(int, input().split()))
for i in range(m):
total += a[i] * b[i]
if total > 0:
ans += 1
print(ans)
| false | 15.384615 | [
"-import numpy as np",
"-",
"-ans = 0",
"+ans = 0",
"+ total = c",
"- arrayA = np.array(a)",
"- arrayB = np.array(b)",
"- array = arrayA * arrayB",
"- if array.sum() + c > 0:",
"+ for i in range(m):",
"+ total += a[i] * b[i]",
"+ if total > 0:"
] | false | 0.543146 | 0.0399 | 13.61276 | [
"s748535913",
"s894313373"
] |
u375616706 | p03741 | python | s537607960 | s979165891 | 121 | 92 | 14,468 | 14,332 | Accepted | Accepted | 23.97 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
def func(A, flag):
l = [0]*N
ans = 0
acc = 0
for i in range(N):
l[i] = A[i]
for i in range(0, N):
acc = acc+l[i]
if i % 2 == flag:
if acc >= 0:
l[i] = l[i] - (1 +... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
def func(A, flag):
ans = 0
acc = 0
for i in range(0, N):
acc = acc+A[i]
if i % 2 == flag:
if acc >= 0:
ans += 1+acc
acc = -1
else:
if acc <= 0... | 28 | 23 | 565 | 427 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
def func(A, flag):
l = [0] * N
ans = 0
acc = 0
for i in range(N):
l[i] = A[i]
for i in range(0, N):
acc = acc + l[i]
if i % 2 == flag:
if acc >= 0:
l[i] = l[i] - (1 + acc)
... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
def func(A, flag):
ans = 0
acc = 0
for i in range(0, N):
acc = acc + A[i]
if i % 2 == flag:
if acc >= 0:
ans += 1 + acc
acc = -1
else:
if acc <= 0:
... | false | 17.857143 | [
"- l = [0] * N",
"- for i in range(N):",
"- l[i] = A[i]",
"- acc = acc + l[i]",
"+ acc = acc + A[i]",
"- l[i] = l[i] - (1 + acc)",
"- l[i] = l[i] + (1 - acc)"
] | false | 0.041043 | 0.040661 | 1.009416 | [
"s537607960",
"s979165891"
] |
u893132811 | p03160 | python | s921190192 | s105799472 | 172 | 133 | 13,924 | 13,980 | Accepted | Accepted | 22.67 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] + [1000000000] * (N-1)
for i in range(N-1):
if i < N-2:
dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2] - h[i]))
dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]))
print((dp[N-1])) | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(2,N):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print((dp[-1])) | 11 | 10 | 252 | 211 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] + [1000000000] * (N - 1)
for i in range(N - 1):
if i < N - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
print((dp[N - 1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 9.090909 | [
"-dp = [0] + [1000000000] * (N - 1)",
"-for i in range(N - 1):",
"- if i < N - 2:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))",
"-print((dp[N - 1]))",
"+dp = [0] * N",
"+dp[1] = abs(h[1] - h[0])",
"+for i in... | false | 0.066197 | 0.086309 | 0.766981 | [
"s921190192",
"s105799472"
] |
u926678805 | p03651 | python | s338260158 | s669753508 | 75 | 69 | 14,252 | 14,596 | Accepted | Accepted | 8 | # coding: utf-8
# Your code here!
def gcd(a,b):
while b:
a,b=b,a%b
return a
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
if n==1:
if k==a[0]:
print('POSSIBLE')
else:
print('IMPOSSIBLE')
exit()
g=gcd(a[0],a[1])
mx=max(a)
for i in range(... | from functools import reduce
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
def gcd(a, b):
while a != 0:
a,b=b%a,a
return b
def lcm(x, y):
return (x * y)//gcd(x, y)
t=reduce(gcd,a)
if t==1:
if max(a)>=k:
print('POSSIBLE')
exit()
else:
if k ... | 23 | 22 | 416 | 457 | # coding: utf-8
# Your code here!
def gcd(a, b):
while b:
a, b = b, a % b
return a
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == 1:
if k == a[0]:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
exit()
g = gcd(a[0], a[1])
mx = max(a)
for i in... | from functools import reduce
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def gcd(a, b):
while a != 0:
a, b = b % a, a
return b
def lcm(x, y):
return (x * y) // gcd(x, y)
t = reduce(gcd, a)
if t == 1:
if max(a) >= k:
print("POSSIBLE")
exit()
e... | false | 4.347826 | [
"-# coding: utf-8",
"-# Your code here!",
"-def gcd(a, b):",
"- while b:",
"- a, b = b, a % b",
"- return a",
"-",
"+from functools import reduce",
"-if n == 1:",
"- if k == a[0]:",
"+",
"+",
"+def gcd(a, b):",
"+ while a != 0:",
"+ a, b = b % a, a",
"+ ret... | false | 0.044494 | 0.043364 | 1.026043 | [
"s338260158",
"s669753508"
] |
u489959379 | p03197 | python | s540957342 | s366269512 | 208 | 65 | 7,084 | 7,084 | Accepted | Accepted | 68.75 | n = int(eval(input()))
a = list(int(eval(input())) for _ in range(n))
cnt = 0
for i in range(n):
if a[i] % 2 == 0:
cnt += 1
if cnt == n:
print("second")
else:
print("first") | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(int(eval(input())) for _ in range(n))
for a in A:
if a % 2 != 0:
print("first")
break
else:
... | 12 | 22 | 194 | 375 | n = int(eval(input()))
a = list(int(eval(input())) for _ in range(n))
cnt = 0
for i in range(n):
if a[i] % 2 == 0:
cnt += 1
if cnt == n:
print("second")
else:
print("first")
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(int(eval(input())) for _ in range(n))
for a in A:
if a % 2 != 0:
print("first")
break
else:
print("second")
... | false | 45.454545 | [
"-n = int(eval(input()))",
"-a = list(int(eval(input())) for _ in range(n))",
"-cnt = 0",
"-for i in range(n):",
"- if a[i] % 2 == 0:",
"- cnt += 1",
"-if cnt == n:",
"- print(\"second\")",
"-else:",
"- print(\"first\")",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
... | false | 0.03949 | 0.056683 | 0.696669 | [
"s540957342",
"s366269512"
] |
u852690916 | p04020 | python | s270401579 | s989589377 | 230 | 205 | 3,060 | 3,060 | Accepted | Accepted | 10.87 | N=int(eval(input()))
pre=int(eval(input()))
ans=pre//2
pre=pre&1
for i in range(2,N+1):
Ai=int(eval(input()))
if pre and Ai>=1:
ans+=1
Ai-=1
ans+=Ai//2
pre=Ai&1
print(ans) | N=int(eval(input()))
ans=0
s=0
for i in range(1,N+1):
Ai=int(eval(input()))
if Ai==0:
ans+=s//2
s=0
else:
s+=Ai
ans+=s//2
print(ans) | 12 | 12 | 196 | 167 | N = int(eval(input()))
pre = int(eval(input()))
ans = pre // 2
pre = pre & 1
for i in range(2, N + 1):
Ai = int(eval(input()))
if pre and Ai >= 1:
ans += 1
Ai -= 1
ans += Ai // 2
pre = Ai & 1
print(ans)
| N = int(eval(input()))
ans = 0
s = 0
for i in range(1, N + 1):
Ai = int(eval(input()))
if Ai == 0:
ans += s // 2
s = 0
else:
s += Ai
ans += s // 2
print(ans)
| false | 0 | [
"-pre = int(eval(input()))",
"-ans = pre // 2",
"-pre = pre & 1",
"-for i in range(2, N + 1):",
"+ans = 0",
"+s = 0",
"+for i in range(1, N + 1):",
"- if pre and Ai >= 1:",
"- ans += 1",
"- Ai -= 1",
"- ans += Ai // 2",
"- pre = Ai & 1",
"+ if Ai == 0:",
"+ ... | false | 0.043091 | 0.043363 | 0.993724 | [
"s270401579",
"s989589377"
] |
u600402037 | p02781 | python | s483071217 | s530345539 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = sr()
K = ir()
length = len(N)
top = int(N[0])
dp_dec = [[0] * 4 for _ in range(length)] #decided
dp_pen = [[0] * 4 for _ in range(length)] #pending
dp_dec[0][1] = (top-1)
dp_dec[0][0... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = sr()
K = ir()
length = len(N)
top = int(N[0])
dp_de = [[0] * 4 for _ in range(length)] #decided
dp_pend = [[0] * 4 for _ in range(length)] #pending
dp_de[0][1] = (top-1)
dp_de[0][0] ... | 31 | 33 | 879 | 922 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = sr()
K = ir()
length = len(N)
top = int(N[0])
dp_dec = [[0] * 4 for _ in range(length)] # decided
dp_pen = [[0] * 4 for _ in range(length)] # pending
dp_dec[0][1] = top - 1
dp_dec[0][0] = 1
dp_p... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = sr()
K = ir()
length = len(N)
top = int(N[0])
dp_de = [[0] * 4 for _ in range(length)] # decided
dp_pend = [[0] * 4 for _ in range(length)] # pending
dp_de[0][1] = top - 1
dp_de[0][0] = 1
dp_pen... | false | 6.060606 | [
"-dp_dec = [[0] * 4 for _ in range(length)] # decided",
"-dp_pen = [[0] * 4 for _ in range(length)] # pending",
"-dp_dec[0][1] = top - 1",
"-dp_dec[0][0] = 1",
"-dp_pen[0][1] = 1",
"+dp_de = [[0] * 4 for _ in range(length)] # decided",
"+dp_pend = [[0] * 4 for _ in range(length)] # pending",
"+dp_... | false | 0.049143 | 0.049974 | 0.983385 | [
"s483071217",
"s530345539"
] |
u062147869 | p03092 | python | s526240172 | s980963658 | 1,607 | 1,060 | 78,044 | 87,900 | Accepted | Accepted | 34.04 | N,A,B=list(map(int,input().split()))
P=[int(i) for i in input().split()]
dp=[10**19]*(N+1)
dp[0]=0
for i in range(1,N+1):
ndp=[10**19]*(N+1)
for j in range(N+1):
if j < P[i-1]:
ndp[P[i-1]]=min(ndp[P[i-1]],dp[j])
ndp[j]=min(ndp[j],dp[j]+A)
else:
ndp[... | N,A,B=list(map(int,input().split()))
P=[int(i) for i in input().split()]
s=1e19
d=[s]*(N+1)
d[0]=0
for i in range(N):
e=[s]*(N+1)
for j in range(N+1):
if j < P[i]:
e[P[i]]=min(e[P[i]],d[j])
e[j]=min(e[j],d[j]+A)
else:
e[j]=min(e[j],d[j]+B)
d=e... | 14 | 15 | 365 | 330 | N, A, B = list(map(int, input().split()))
P = [int(i) for i in input().split()]
dp = [10**19] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
ndp = [10**19] * (N + 1)
for j in range(N + 1):
if j < P[i - 1]:
ndp[P[i - 1]] = min(ndp[P[i - 1]], dp[j])
ndp[j] = min(ndp[j], dp[j] + A)
... | N, A, B = list(map(int, input().split()))
P = [int(i) for i in input().split()]
s = 1e19
d = [s] * (N + 1)
d[0] = 0
for i in range(N):
e = [s] * (N + 1)
for j in range(N + 1):
if j < P[i]:
e[P[i]] = min(e[P[i]], d[j])
e[j] = min(e[j], d[j] + A)
else:
e[j] = mi... | false | 6.666667 | [
"-dp = [10**19] * (N + 1)",
"-dp[0] = 0",
"-for i in range(1, N + 1):",
"- ndp = [10**19] * (N + 1)",
"+s = 1e19",
"+d = [s] * (N + 1)",
"+d[0] = 0",
"+for i in range(N):",
"+ e = [s] * (N + 1)",
"- if j < P[i - 1]:",
"- ndp[P[i - 1]] = min(ndp[P[i - 1]], dp[j])",
"- ... | false | 0.067666 | 0.069035 | 0.980174 | [
"s526240172",
"s980963658"
] |
u094191970 | p02779 | python | s014203109 | s837712490 | 93 | 83 | 25,324 | 26,808 | Accepted | Accepted | 10.75 | n=int(eval(input()))
a=list(map(int,input().split()))
print(('YES' if len(list(set(a)))==n else 'NO')) | n=int(eval(input()))
a=list(map(int,input().split()))
print(('YES' if len(set(a))==n else 'NO')) | 3 | 3 | 96 | 90 | n = int(eval(input()))
a = list(map(int, input().split()))
print(("YES" if len(list(set(a))) == n else "NO"))
| n = int(eval(input()))
a = list(map(int, input().split()))
print(("YES" if len(set(a)) == n else "NO"))
| false | 0 | [
"-print((\"YES\" if len(list(set(a))) == n else \"NO\"))",
"+print((\"YES\" if len(set(a)) == n else \"NO\"))"
] | false | 0.082513 | 0.034842 | 2.368216 | [
"s014203109",
"s837712490"
] |
u375616706 | p03090 | python | s295500066 | s066654517 | 23 | 20 | 3,588 | 3,440 | Accepted | Accepted | 13.04 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
edges = []
if N % 2 == 0:
D = N+1
else:
D = N
for i in range(1, D):
for j in range(i+1, D):
if i+j == D:
continue
else:
edges.append(str(i)+" "+str(j))
if N % 2 ... | N = int(eval(input()))
D = N if N % 2 == 1 else N+1
edges = [str(i)+" "+str(j) for i in range(1, D)
for j in range(i+1, D) if i+j != D]
edges2 = [str(v)+" "+str(N) for v in range(1, N)] if N % 2 == 1 else []
print((len(edges)+len(edges2)))
print(("\n".join(edges+edges2)))
| 22 | 7 | 438 | 278 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
edges = []
if N % 2 == 0:
D = N + 1
else:
D = N
for i in range(1, D):
for j in range(i + 1, D):
if i + j == D:
continue
else:
edges.append(str(i) + " " + str(j))
if N % 2 == 1:
... | N = int(eval(input()))
D = N if N % 2 == 1 else N + 1
edges = [
str(i) + " " + str(j) for i in range(1, D) for j in range(i + 1, D) if i + j != D
]
edges2 = [str(v) + " " + str(N) for v in range(1, N)] if N % 2 == 1 else []
print((len(edges) + len(edges2)))
print(("\n".join(edges + edges2)))
| false | 68.181818 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"-input = sys.stdin.readline",
"-edges = []",
"-if N % 2 == 0:",
"- D = N + 1",
"-else:",
"- D = N",
"-for i in range(1, D):",
"- for j in range(i + 1, D):",
"- if i + j == D:",
"- continue",
"- else:",
... | false | 0.147087 | 0.150724 | 0.97587 | [
"s295500066",
"s066654517"
] |
u519968172 | p02726 | python | s635371551 | s368649190 | 1,043 | 951 | 9,340 | 9,284 | Accepted | Accepted | 8.82 | n,x,y=list(map(int,input().split()))
l=[0 for _ in range(n)]
for i in range (1,n+1):
for j in range(i+1,n+1):
if i<=x:
l[j-i if j<=x else min(x-i+1+(y-j), j-i) if x<j<y else j-i-(y-x)+1]+=1
elif x<i<y:
l[min(j-i,i-x+1+abs(j-y))]+=1
else:
l[j-i]+=1
for m in l[1:]:
pr... | n,x,y=list(map(int,input().split()))
l=[0]*n
for i in range (1,n+1):
for j in range(i+1,n+1):
l[min(j-i,abs(x-i)+1+abs(y-j))]+=1
for m in l[1:]:
print(m)
| 20 | 15 | 358 | 207 | n, x, y = list(map(int, input().split()))
l = [0 for _ in range(n)]
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
if i <= x:
l[
j - i
if j <= x
else min(x - i + 1 + (y - j), j - i)
if x < j < y
else j - i -... | n, x, y = list(map(int, input().split()))
l = [0] * n
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
l[min(j - i, abs(x - i) + 1 + abs(y - j))] += 1
for m in l[1:]:
print(m)
| false | 25 | [
"-l = [0 for _ in range(n)]",
"+l = [0] * n",
"- if i <= x:",
"- l[",
"- j - i",
"- if j <= x",
"- else min(x - i + 1 + (y - j), j - i)",
"- if x < j < y",
"- else j - i - (y - x) + 1",
"- ] += ... | false | 0.044445 | 0.046822 | 0.949236 | [
"s635371551",
"s368649190"
] |
u111497285 | p03557 | python | s349595139 | s395035776 | 2,000 | 1,549 | 24,140 | 22,720 | Accepted | Accepted | 22.55 | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
def check_a(a_num, b_num):
res = False
if a_num < b_num:
res = True
return res
def check_c(c_num, b_num):
res = False
if b... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
cnt = [0] * len(b)
a = sorted(a)
c = sorted(c)
for i in range(len(b)):
target = b[i]
# decide a cnt
l = 0
r = len(a) - 1
if a[l] >= target:
cn... | 53 | 51 | 1,239 | 961 | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
def check_a(a_num, b_num):
res = False
if a_num < b_num:
res = True
return res
def check_c(c_num, b_num):
res = False
if b_num < c_nu... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
cnt = [0] * len(b)
a = sorted(a)
c = sorted(c)
for i in range(len(b)):
target = b[i]
# decide a cnt
l = 0
r = len(a) - 1
if a[l] >= target:
cnt[i] += 0
elif ... | false | 3.773585 | [
"-a = sorted(list(map(int, input().split())))",
"-b = sorted(list(map(int, input().split())))",
"-c = sorted(list(map(int, input().split())))",
"-",
"-",
"-def check_a(a_num, b_num):",
"- res = False",
"- if a_num < b_num:",
"- res = True",
"- return res",
"-",
"-",
"-def che... | false | 0.03436 | 0.043163 | 0.796039 | [
"s349595139",
"s395035776"
] |
u227082700 | p02644 | python | s851258007 | s940144655 | 2,759 | 1,491 | 36,884 | 113,852 | Accepted | Accepted | 45.96 | import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
si,sj,ti,tj=map(int,input().split())
si-=1
sj-=1
ti-=1
tj-=1
b=[input()for _ in range(h)]
ans=[[-1]*w for _ in range(h)]
ans[si][sj]=0
from collections import deque
d=deque()
d.append((si,sj))
while d:
x,y=d.popleft()
if x==ti and y=... | def main():
import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
sx,sy,tx,ty=map(int,input().split())
b=[[-1]*(w+2)]
for i in range(h):
s=input()
bb=[-1]
for j in s:
if j==".":bb.append(0)
else:bb.append(-1)
bb.append(-1)
b.append(bb)
b.append([-... | 27 | 40 | 647 | 1,083 | import sys
input = sys.stdin.readline
h, w, k = map(int, input().split())
si, sj, ti, tj = map(int, input().split())
si -= 1
sj -= 1
ti -= 1
tj -= 1
b = [input() for _ in range(h)]
ans = [[-1] * w for _ in range(h)]
ans[si][sj] = 0
from collections import deque
d = deque()
d.append((si, sj))
while d:
x, y = d.pop... | def main():
import sys
input = sys.stdin.readline
h, w, k = map(int, input().split())
sx, sy, tx, ty = map(int, input().split())
b = [[-1] * (w + 2)]
for i in range(h):
s = input()
bb = [-1]
for j in s:
if j == ".":
bb.append(0)
el... | false | 32.5 | [
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-h, w, k = map(int, input().split())",
"-si, sj, ti, tj = map(int, input().split())",
"-si -= 1",
"-sj -= 1",
"-ti -= 1",
"-tj -= 1",
"-b = [input() for _ in range(h)]",
"-ans = [[-1] * w for _ in range(h)]",
"... | false | 0.068871 | 0.067038 | 1.027345 | [
"s851258007",
"s940144655"
] |
u797016134 | p02983 | python | s899824887 | s744988294 | 484 | 193 | 40,556 | 39,408 | Accepted | Accepted | 60.12 | l,r = list(map(int,input().split()))
r = min(r, l+4038)
ans = 2018
for i in range(l,r):
for j in range(l+1,r+1):
if ans > i*j%2019:
ans = i*j%2019
print(ans) | l,r = list(map(int,input().split()))
r = min(r, l+673)
ans = 2018
for i in range(l,r):
for j in range(l+1,r+1):
if ans > i*j%2019:
ans = i*j%2019
print(ans) | 8 | 8 | 182 | 181 | l, r = list(map(int, input().split()))
r = min(r, l + 4038)
ans = 2018
for i in range(l, r):
for j in range(l + 1, r + 1):
if ans > i * j % 2019:
ans = i * j % 2019
print(ans)
| l, r = list(map(int, input().split()))
r = min(r, l + 673)
ans = 2018
for i in range(l, r):
for j in range(l + 1, r + 1):
if ans > i * j % 2019:
ans = i * j % 2019
print(ans)
| false | 0 | [
"-r = min(r, l + 4038)",
"+r = min(r, l + 673)"
] | false | 0.089854 | 0.039446 | 2.277911 | [
"s899824887",
"s744988294"
] |
u163783894 | p02621 | python | s958497875 | s012776774 | 1,874 | 346 | 12,576 | 9,036 | Accepted | Accepted | 81.54 | N = 10**7
M = 10**5
arr = list(range(M))
def f(x):
return x
for i in range(N):
b = arr[i % M]
b = f(b)
a = int(eval(input()))
print((a + a**2 + a**3))
| N = 10**7
# M = 10**5
# arr = list(range(M))
# def f(x):
# return x
for i in range(N):
pass
# 答え
a = int(eval(input()))
print((a + a**2 + a**3))
| 16 | 16 | 176 | 166 | N = 10**7
M = 10**5
arr = list(range(M))
def f(x):
return x
for i in range(N):
b = arr[i % M]
b = f(b)
a = int(eval(input()))
print((a + a**2 + a**3))
| N = 10**7
# M = 10**5
# arr = list(range(M))
# def f(x):
# return x
for i in range(N):
pass
# 答え
a = int(eval(input()))
print((a + a**2 + a**3))
| false | 0 | [
"-M = 10**5",
"-arr = list(range(M))",
"-",
"-",
"-def f(x):",
"- return x",
"-",
"-",
"+# M = 10**5",
"+# arr = list(range(M))",
"+# def f(x):",
"+# return x",
"- b = arr[i % M]",
"- b = f(b)",
"+ pass",
"+# 答え"
] | false | 3.676792 | 0.922132 | 3.987272 | [
"s958497875",
"s012776774"
] |
u699944218 | p02831 | python | s921507575 | s915598090 | 35 | 28 | 5,048 | 9,084 | Accepted | Accepted | 20 | from fractions import gcd
A, B = list(map(int,input().split()))
print((int((A * B)/gcd(A,B)))) | from math import gcd
A, B = list(map(int,input().split()))
print((A * B // gcd(A, B))) | 3 | 5 | 94 | 90 | from fractions import gcd
A, B = list(map(int, input().split()))
print((int((A * B) / gcd(A, B))))
| from math import gcd
A, B = list(map(int, input().split()))
print((A * B // gcd(A, B)))
| false | 40 | [
"-from fractions import gcd",
"+from math import gcd",
"-print((int((A * B) / gcd(A, B))))",
"+print((A * B // gcd(A, B)))"
] | false | 0.112212 | 0.035455 | 3.164868 | [
"s921507575",
"s915598090"
] |
u439396449 | p03855 | python | s599526402 | s362345382 | 1,509 | 1,270 | 56,052 | 56,052 | Accepted | Accepted | 15.84 | from collections import defaultdict
N, K, L = list(map(int, input().split()))
class UnionFind(object):
def __init__(self, n=1):
self.par = [i for i in range(n)]
self.rank = [0 for _ in range(n)]
def find(self, x):
if self.par[x] == x:
return x
else:
... | import sys
from collections import defaultdict
input = sys.stdin.readline
class UnionFind(object):
def __init__(self, n=1):
self.par = [i for i in range(n)]
self.rank = [0 for _ in range(n)]
def find(self, x):
if self.par[x] == x:
return x
else:
... | 47 | 55 | 1,125 | 1,230 | from collections import defaultdict
N, K, L = list(map(int, input().split()))
class UnionFind(object):
def __init__(self, n=1):
self.par = [i for i in range(n)]
self.rank = [0 for _ in range(n)]
def find(self, x):
if self.par[x] == x:
return x
else:
se... | import sys
from collections import defaultdict
input = sys.stdin.readline
class UnionFind(object):
def __init__(self, n=1):
self.par = [i for i in range(n)]
self.rank = [0 for _ in range(n)]
def find(self, x):
if self.par[x] == x:
return x
else:
self.p... | false | 14.545455 | [
"+import sys",
"-N, K, L = list(map(int, input().split()))",
"+input = sys.stdin.readline",
"+N, K, L = map(int, input().split())",
"-for i in range(K):",
"- p, q = list(map(int, input().split()))",
"+for _ in range(K):",
"+ p, q = map(int, input().split())",
"-for i in range(L):",
"- r, ... | false | 0.040458 | 0.050026 | 0.808743 | [
"s599526402",
"s362345382"
] |
u332385682 | p03739 | python | s295302156 | s107263363 | 101 | 90 | 14,468 | 14,468 | Accepted | Accepted | 10.89 | import sys
def solve():
n = int(eval(input()))
a = [int(i) for i in input().split()]
ans1 = 0 if a[0] > 0 else abs(a[0] - 1)
v = a[0] if a[0] > 0 else 1
for i in range(1, n):
if v * (v + a[i]) < 0:
v += a[i]
else:
if v > 0:
ans... | import sys
def solve():
n = int(eval(input()))
a = [int(i) for i in input().split()]
ans1 = scan(a, -1)
ans2 = scan(a, 1)
ans = min(ans1, ans2)
print(ans)
def scan(a, sgn):
if a[0] * sgn > 0:
res = 0
v = a[0]
else:
res = abs(a[0] - sgn)
... | 40 | 36 | 890 | 646 | import sys
def solve():
n = int(eval(input()))
a = [int(i) for i in input().split()]
ans1 = 0 if a[0] > 0 else abs(a[0] - 1)
v = a[0] if a[0] > 0 else 1
for i in range(1, n):
if v * (v + a[i]) < 0:
v += a[i]
else:
if v > 0:
ans1 += abs(v + a[... | import sys
def solve():
n = int(eval(input()))
a = [int(i) for i in input().split()]
ans1 = scan(a, -1)
ans2 = scan(a, 1)
ans = min(ans1, ans2)
print(ans)
def scan(a, sgn):
if a[0] * sgn > 0:
res = 0
v = a[0]
else:
res = abs(a[0] - sgn)
v = sgn
for... | false | 10 | [
"- ans1 = 0 if a[0] > 0 else abs(a[0] - 1)",
"- v = a[0] if a[0] > 0 else 1",
"- for i in range(1, n):",
"- if v * (v + a[i]) < 0:",
"- v += a[i]",
"- else:",
"- if v > 0:",
"- ans1 += abs(v + a[i] + 1)",
"- v = -1",
"- ... | false | 0.044931 | 0.038928 | 1.154214 | [
"s295302156",
"s107263363"
] |
u312025627 | p02954 | python | s937069059 | s994950179 | 173 | 121 | 6,400 | 6,400 | Accepted | Accepted | 30.06 |
S = eval(input())
n = len(S)
ans = [0 for i in range(n)]
for i in range(n):
if S[i:i+2] == "RL":
for j in range(i,-1,-1):
if S[j] == "R":
ans[i + (i-j) % 2] += 1
else:
break
for j in range(i+1,n):
if S[j] == "L":
... | def main():
S = eval(input())
N = len(S)
idx = 0
cur = 1
pre = S[0]
ans = [0]*N
for i in range(1, N):
#print(i, idx, cur, ans)
if pre == S[i] == "R":
idx += 1
cur += 1
elif pre == S[i] == "L":
cur += 1
elif pre... | 18 | 38 | 405 | 888 | S = eval(input())
n = len(S)
ans = [0 for i in range(n)]
for i in range(n):
if S[i : i + 2] == "RL":
for j in range(i, -1, -1):
if S[j] == "R":
ans[i + (i - j) % 2] += 1
else:
break
for j in range(i + 1, n):
if S[j] == "L":
... | def main():
S = eval(input())
N = len(S)
idx = 0
cur = 1
pre = S[0]
ans = [0] * N
for i in range(1, N):
# print(i, idx, cur, ans)
if pre == S[i] == "R":
idx += 1
cur += 1
elif pre == S[i] == "L":
cur += 1
elif pre != S[i] ==... | false | 52.631579 | [
"-S = eval(input())",
"-n = len(S)",
"-ans = [0 for i in range(n)]",
"-for i in range(n):",
"- if S[i : i + 2] == \"RL\":",
"- for j in range(i, -1, -1):",
"- if S[j] == \"R\":",
"- ans[i + (i - j) % 2] += 1",
"+def main():",
"+ S = eval(input())",
"+ N ... | false | 0.042277 | 0.042704 | 0.989985 | [
"s937069059",
"s994950179"
] |
u413165887 | p03069 | python | s041159356 | s744726273 | 109 | 90 | 3,500 | 3,500 | Accepted | Accepted | 17.43 | N=int(eval(input()))
S=eval(input())
b=0
w=S.count(".")
ans=b+w
for s in S:
if s=="#":
b+=1
else:
w-=1
ans=min(ans, b+w)
print(ans) | n = int(eval(input()))
s = eval(input())
counter = 0
counter = s.count('.')
result = counter
for i in s:
if i == '#':
counter += 1
else:
counter -= 1
result = min(result, counter)
print(result) | 12 | 12 | 158 | 220 | N = int(eval(input()))
S = eval(input())
b = 0
w = S.count(".")
ans = b + w
for s in S:
if s == "#":
b += 1
else:
w -= 1
ans = min(ans, b + w)
print(ans)
| n = int(eval(input()))
s = eval(input())
counter = 0
counter = s.count(".")
result = counter
for i in s:
if i == "#":
counter += 1
else:
counter -= 1
result = min(result, counter)
print(result)
| false | 0 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-b = 0",
"-w = S.count(\".\")",
"-ans = b + w",
"-for s in S:",
"- if s == \"#\":",
"- b += 1",
"+n = int(eval(input()))",
"+s = eval(input())",
"+counter = 0",
"+counter = s.count(\".\")",
"+result = counter",
"+for i in s:",
"... | false | 0.045917 | 0.08817 | 0.520778 | [
"s041159356",
"s744726273"
] |
u691018832 | p03721 | python | s876001634 | s420463199 | 384 | 254 | 27,844 | 16,980 | Accepted | Accepted | 33.85 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, k = list(map(int, readline().split()))
ab = [list(map(int, readline().split())) for _ in range(n)]
ab.sort()
for a, b in ab:
if b >= k:
print(a)
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, k = list(map(int, readline().split()))
ab = [tuple(map(int, readline().split())) for _ in range(n)]
ab.sort()
for a, b in ab:
k -= b
if k <= 0:
... | 14 | 14 | 341 | 341 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n, k = list(map(int, readline().split()))
ab = [list(map(int, readline().split())) for _ in range(n)]
ab.sort()
for a, b in ab:
if b >= k:
print(a)
exit()... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n, k = list(map(int, readline().split()))
ab = [tuple(map(int, readline().split())) for _ in range(n)]
ab.sort()
for a, b in ab:
k -= b
if k <= 0:
print(a)
... | false | 0 | [
"-ab = [list(map(int, readline().split())) for _ in range(n)]",
"+ab = [tuple(map(int, readline().split())) for _ in range(n)]",
"- if b >= k:",
"+ k -= b",
"+ if k <= 0:",
"- exit()",
"- k -= b",
"+ break"
] | false | 0.07911 | 0.041455 | 1.908339 | [
"s876001634",
"s420463199"
] |
u017415492 | p02727 | python | s983090903 | s890668078 | 291 | 172 | 23,328 | 29,536 | Accepted | Accepted | 40.89 | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
rcount=0
ans=[]
for i in range(x):
ans.append(p[-1-i])
for i in range(y):
ans.append(q[-1-i])
ans.sort()
for i in range(min... | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
ans=[]
for i in range(x):
r.append(p[i])
for i in range(y):
r.append(q[i])
r.sort(reverse=True)
print((sum(r[0:x+y])))
... | 19 | 16 | 407 | 317 | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
rcount = 0
ans = []
for i in range(x):
ans.append(p[-1 - i])
for i in range(y):
ans.append(q[-1 - i])
ans.sort()
for ... | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
ans = []
for i in range(x):
r.append(p[i])
for i in range(y):
r.append(q[i])
r.sort(reverse=True)
print((sum(r[0 :... | false | 15.789474 | [
"-p.sort()",
"-q.sort()",
"-r.sort(reverse=True)",
"-rcount = 0",
"+p.sort(reverse=True)",
"+q.sort(reverse=True)",
"- ans.append(p[-1 - i])",
"+ r.append(p[i])",
"- ans.append(q[-1 - i])",
"-ans.sort()",
"-for i in range(min(len(ans), c)):",
"- if ans[i] <= r[rcount]:",
"- ... | false | 0.042852 | 0.04272 | 1.003092 | [
"s983090903",
"s890668078"
] |
u914198331 | p02657 | python | s786556848 | s694560416 | 23 | 21 | 9,088 | 9,040 | Accepted | Accepted | 8.7 | A, B = list(map(int, input().split()))
print((A*B)) | a, b = list(map(int, input().split()))
print((a*b)) | 2 | 2 | 44 | 44 | A, B = list(map(int, input().split()))
print((A * B))
| a, b = list(map(int, input().split()))
print((a * b))
| false | 0 | [
"-A, B = list(map(int, input().split()))",
"-print((A * B))",
"+a, b = list(map(int, input().split()))",
"+print((a * b))"
] | false | 0.037988 | 0.038706 | 0.981452 | [
"s786556848",
"s694560416"
] |
u909643606 | p03286 | python | s545480068 | s768848303 | 677 | 18 | 32,744 | 3,064 | Accepted | Accepted | 97.34 | #import sys
#input = sys.stdin.readline
#template input
import bisect
def IT():
return int(eval(input()))
def IL():
return [int(_) for _ in input().split()]
def SL():
return [int(_) for _ in input().split()]
def ILS(n):
return [int(eval(input())) for _ in range(n)]
def SLS(n):
return ... | #import sys
#input = sys.stdin.readline
#template input
import bisect
def IT():
return int(eval(input()))
def IL():
return [int(_) for _ in input().split()]
def SL():
return [int(_) for _ in input().split()]
def ILS(n):
return [int(eval(input())) for _ in range(n)]
def SLS(n):
return ... | 68 | 32 | 1,864 | 676 | # import sys
# input = sys.stdin.readline
# template input
import bisect
def IT():
return int(eval(input()))
def IL():
return [int(_) for _ in input().split()]
def SL():
return [int(_) for _ in input().split()]
def ILS(n):
return [int(eval(input())) for _ in range(n)]
def SLS(n):
return [e... | # import sys
# input = sys.stdin.readline
# template input
import bisect
def IT():
return int(eval(input()))
def IL():
return [int(_) for _ in input().split()]
def SL():
return [int(_) for _ in input().split()]
def ILS(n):
return [int(eval(input())) for _ in range(n)]
def SLS(n):
return [e... | false | 52.941176 | [
"-# template technique",
"-def bit_full_search(ss):",
"- n = len(ss)",
"- for i in range(1 << n):",
"- s = \"\"",
"- for j in range(n + 1):",
"- if (1 & i >> j) == 1:",
"- s += ss[j]",
"- print(s)",
"-",
"-",
"-def bit_full_search2(A):",
"... | false | 2.042555 | 0.036733 | 55.605885 | [
"s545480068",
"s768848303"
] |
u226155577 | p03013 | python | s058312265 | s060417926 | 174 | 60 | 3,828 | 13,812 | Accepted | Accepted | 65.52 | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
F = [0]*(N+1)
for i in range(M):
F[int(eval(input()))-1] = 1
a = 1; b = 0
for i in range(N):
if F[i]:
a, b = 0, a
else:
a, b = (a+b) % MOD, a
print(a)
| N, M, *C = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
F = [0]*(N+1)
for c in C:
F[c-1] = 1
a = 1; b = 0
for i in range(N):
if F[i]:
a, b = 0, a
else:
a, b = ((a+b) % MOD), a
print(a) | 13 | 13 | 235 | 229 | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
F = [0] * (N + 1)
for i in range(M):
F[int(eval(input())) - 1] = 1
a = 1
b = 0
for i in range(N):
if F[i]:
a, b = 0, a
else:
a, b = (a + b) % MOD, a
print(a)
| N, M, *C = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
F = [0] * (N + 1)
for c in C:
F[c - 1] = 1
a = 1
b = 0
for i in range(N):
if F[i]:
a, b = 0, a
else:
a, b = ((a + b) % MOD), a
print(a)
| false | 0 | [
"-N, M = list(map(int, input().split()))",
"+N, M, *C = list(map(int, open(0).read().split()))",
"-for i in range(M):",
"- F[int(eval(input())) - 1] = 1",
"+for c in C:",
"+ F[c - 1] = 1",
"- a, b = (a + b) % MOD, a",
"+ a, b = ((a + b) % MOD), a"
] | false | 0.036574 | 0.035958 | 1.017144 | [
"s058312265",
"s060417926"
] |
u222668979 | p02732 | python | s294870797 | s839024608 | 399 | 351 | 26,140 | 25,644 | Accepted | Accepted | 12.03 | n = int(eval(input()))
a = list(map(int, input().split()))
num = [0] * n
cnt = 0
for i in a:
num[i - 1] += 1
for i in num:
cnt += i * (i - 1)//2
for i in range(n):
tmp = num[a[i]-1]
ans = cnt - (tmp * (tmp-1) // 2)
ans += ((tmp-2) * (tmp-1) // 2)
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
num = [0] * n
cnt = 0
for i in a:
num[i - 1] += 1
for i in num:
cnt += i * (i - 1)//2
for i in range(n):
tmp = num[a[i]-1]
ans = cnt - ((tmp-(tmp-2)) * (tmp-1) // 2)
print(ans)
| 16 | 15 | 294 | 267 | n = int(eval(input()))
a = list(map(int, input().split()))
num = [0] * n
cnt = 0
for i in a:
num[i - 1] += 1
for i in num:
cnt += i * (i - 1) // 2
for i in range(n):
tmp = num[a[i] - 1]
ans = cnt - (tmp * (tmp - 1) // 2)
ans += (tmp - 2) * (tmp - 1) // 2
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
num = [0] * n
cnt = 0
for i in a:
num[i - 1] += 1
for i in num:
cnt += i * (i - 1) // 2
for i in range(n):
tmp = num[a[i] - 1]
ans = cnt - ((tmp - (tmp - 2)) * (tmp - 1) // 2)
print(ans)
| false | 6.25 | [
"- ans = cnt - (tmp * (tmp - 1) // 2)",
"- ans += (tmp - 2) * (tmp - 1) // 2",
"+ ans = cnt - ((tmp - (tmp - 2)) * (tmp - 1) // 2)"
] | false | 0.04444 | 0.039911 | 1.11346 | [
"s294870797",
"s839024608"
] |
u798818115 | p03162 | python | s184456879 | s828749450 | 1,010 | 504 | 22,820 | 22,772 | Accepted | Accepted | 50.1 | # coding: utf-8
# Your code here!
N=int(eval(input()))
dp=[[0]*3 for i in range(N)]
if N==1:
print((max(list(map(int,input().split())))))
else:
for i in range(0,N):
l=list(map(int,input().split()))
if i==0:
dp[0]=l
else:
for j in range(3):
... | # coding: utf-8
# Your code here!
N=int(eval(input()))
l=[[0]*3 for i in range(N)]
A,B,C=list(map(int,input().split()))
l[0][0]=A
l[0][1]=B
l[0][2]=C
for i in range(1,N):
A,B,C=list(map(int,input().split()))
l[i][0]=A+(max(l[i-1][1],l[i-1][2]))
l[i][1]=B+(max(l[i-1][0],l[i-1][2]))
l[i][2... | 21 | 17 | 548 | 354 | # coding: utf-8
# Your code here!
N = int(eval(input()))
dp = [[0] * 3 for i in range(N)]
if N == 1:
print((max(list(map(int, input().split())))))
else:
for i in range(0, N):
l = list(map(int, input().split()))
if i == 0:
dp[0] = l
else:
for j in range(3):
... | # coding: utf-8
# Your code here!
N = int(eval(input()))
l = [[0] * 3 for i in range(N)]
A, B, C = list(map(int, input().split()))
l[0][0] = A
l[0][1] = B
l[0][2] = C
for i in range(1, N):
A, B, C = list(map(int, input().split()))
l[i][0] = A + (max(l[i - 1][1], l[i - 1][2]))
l[i][1] = B + (max(l[i - 1][0],... | false | 19.047619 | [
"-dp = [[0] * 3 for i in range(N)]",
"-if N == 1:",
"- print((max(list(map(int, input().split())))))",
"-else:",
"- for i in range(0, N):",
"- l = list(map(int, input().split()))",
"- if i == 0:",
"- dp[0] = l",
"- else:",
"- for j in range(3):",
... | false | 0.039559 | 0.039782 | 0.994378 | [
"s184456879",
"s828749450"
] |
u102461423 | p02793 | python | s257193513 | s883170363 | 1,895 | 1,514 | 5,880 | 6,008 | Accepted | Accepted | 20.11 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from fractions import gcd
from functools import reduce
N,*A = list(map(int,read().split()))
MOD = 10 ** 9 + 7
lcm = reduce(lambda x,y: x//gcd(x,y)*y, A)
answer = sum(lcm//x for x in A)
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from fractions import gcd
from functools import reduce
N,*A = list(map(int,read().split()))
MOD = 10 ** 9 + 7
lcm = reduce(lambda x,y: y//gcd(x,y)*x, A)
answer = sum(lcm//x for x in A)
... | 17 | 17 | 343 | 344 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from fractions import gcd
from functools import reduce
N, *A = list(map(int, read().split()))
MOD = 10**9 + 7
lcm = reduce(lambda x, y: x // gcd(x, y) * y, A)
answer = sum(lcm // x for x in A)
answer %=... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from fractions import gcd
from functools import reduce
N, *A = list(map(int, read().split()))
MOD = 10**9 + 7
lcm = reduce(lambda x, y: y // gcd(x, y) * x, A)
answer = sum(lcm // x for x in A)
answer %=... | false | 0 | [
"-lcm = reduce(lambda x, y: x // gcd(x, y) * y, A)",
"+lcm = reduce(lambda x, y: y // gcd(x, y) * x, A)"
] | false | 0.051851 | 0.164331 | 0.315528 | [
"s257193513",
"s883170363"
] |
u257374434 | p04001 | python | s585027409 | s330643037 | 24 | 19 | 2,940 | 3,064 | Accepted | Accepted | 20.83 | S = eval(input())
def solve(current = '', index=0):
if index is len(S) - 1:
return eval(current + S[index])
return solve(current + S[index], index + 1) + solve(current + S[index] + '+', index + 1)
print((solve()))
| S = eval(input())
def solve(current='', index=0):
if index is len(S) - 1:
return eval(current + S[index])
return solve(current + S[index], index + 1) + solve(current + S[index] + '+', index + 1)
def solve2():
total = 0
for source in range(1 << (len(S) - 1)):
# in binary '... | 10 | 24 | 235 | 662 | S = eval(input())
def solve(current="", index=0):
if index is len(S) - 1:
return eval(current + S[index])
return solve(current + S[index], index + 1) + solve(
current + S[index] + "+", index + 1
)
print((solve()))
| S = eval(input())
def solve(current="", index=0):
if index is len(S) - 1:
return eval(current + S[index])
return solve(current + S[index], index + 1) + solve(
current + S[index] + "+", index + 1
)
def solve2():
total = 0
for source in range(1 << (len(S) - 1)):
# in binary... | false | 58.333333 | [
"-print((solve()))",
"+def solve2():",
"+ total = 0",
"+ for source in range(1 << (len(S) - 1)):",
"+ # in binary '1' means '+'",
"+ # 125 -> 1 (source bit:0 ) + 2 + '(+ if (source bit: 1) & 1)",
"+ current = \"\"",
"+ for i, s in enumerate(S):",
"+ curr... | false | 0.086788 | 0.08541 | 1.016137 | [
"s585027409",
"s330643037"
] |
u596536048 | p03136 | python | s774005798 | s196157618 | 33 | 27 | 9,044 | 9,028 | Accepted | Accepted | 18.18 | N = eval(input())
L = sorted(list(map(int, input().split())))
print(('No' if max(L) >= sum(L[:-1]) else 'Yes')) | polygon_side = int(eval(input()))
side_length = list(map(int, input().split()))
if max(side_length) * 2 < sum(side_length):
print('Yes')
else:
print('No') | 3 | 6 | 105 | 161 | N = eval(input())
L = sorted(list(map(int, input().split())))
print(("No" if max(L) >= sum(L[:-1]) else "Yes"))
| polygon_side = int(eval(input()))
side_length = list(map(int, input().split()))
if max(side_length) * 2 < sum(side_length):
print("Yes")
else:
print("No")
| false | 50 | [
"-N = eval(input())",
"-L = sorted(list(map(int, input().split())))",
"-print((\"No\" if max(L) >= sum(L[:-1]) else \"Yes\"))",
"+polygon_side = int(eval(input()))",
"+side_length = list(map(int, input().split()))",
"+if max(side_length) * 2 < sum(side_length):",
"+ print(\"Yes\")",
"+else:",
"+ ... | false | 0.114652 | 0.047968 | 2.390167 | [
"s774005798",
"s196157618"
] |
u392319141 | p02792 | python | s752938581 | s554025674 | 167 | 149 | 3,316 | 9,420 | Accepted | Accepted | 10.78 | from collections import defaultdict
N = int(eval(input()))
cnt = defaultdict(int)
for a in range(1, N + 1):
cnt[(str(a)[0], str(a)[-1])] += 1
ans = 0
for head in range(1, 10):
for tail in range(1, 10):
ans += cnt[(str(head), str(tail))] * cnt[(str(tail), str(head))]
print(ans) | from collections import defaultdict
N = int(eval(input()))
cnt = defaultdict(int)
for i in range(1, N + 1):
i = str(i)
l = i[0]
r = i[-1]
cnt[(l, r)] += 1
cnt[(r, l)] += 0
ans = 0
for (l, r), c in list(cnt.items()):
ans += cnt[(r, l)] * c
print(ans)
| 14 | 17 | 304 | 282 | from collections import defaultdict
N = int(eval(input()))
cnt = defaultdict(int)
for a in range(1, N + 1):
cnt[(str(a)[0], str(a)[-1])] += 1
ans = 0
for head in range(1, 10):
for tail in range(1, 10):
ans += cnt[(str(head), str(tail))] * cnt[(str(tail), str(head))]
print(ans)
| from collections import defaultdict
N = int(eval(input()))
cnt = defaultdict(int)
for i in range(1, N + 1):
i = str(i)
l = i[0]
r = i[-1]
cnt[(l, r)] += 1
cnt[(r, l)] += 0
ans = 0
for (l, r), c in list(cnt.items()):
ans += cnt[(r, l)] * c
print(ans)
| false | 17.647059 | [
"-for a in range(1, N + 1):",
"- cnt[(str(a)[0], str(a)[-1])] += 1",
"+for i in range(1, N + 1):",
"+ i = str(i)",
"+ l = i[0]",
"+ r = i[-1]",
"+ cnt[(l, r)] += 1",
"+ cnt[(r, l)] += 0",
"-for head in range(1, 10):",
"- for tail in range(1, 10):",
"- ans += cnt[(str(... | false | 0.062487 | 0.076007 | 0.822124 | [
"s752938581",
"s554025674"
] |
u477977638 | p02845 | python | s708296045 | s053788227 | 136 | 68 | 21,844 | 12,488 | Accepted | Accepted | 50 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
import bisect
# from heapq import heapify,heap... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(m... | 66 | 40 | 1,454 | 734 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
MOD = 10**9 + 7
# sys.setrecursionlimit(2147483647)
# import math
# import numpy as np
# import operator
import bisect
# from heapq import heapify,heappop,heappus... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
re... | false | 39.393939 | [
"+input = sys.stdin.readline",
"-inputs = sys.stdin.buffer.readlines",
"+# sys.setrecursionlimit(10**9)",
"+# from functools import lru_cache",
"+def RD():",
"+ return sys.stdin.read()",
"+",
"+",
"+def II():",
"+ return int(eval(input()))",
"+",
"+",
"+def MI():",
"+ return list(... | false | 0.051324 | 0.035257 | 1.455716 | [
"s708296045",
"s053788227"
] |
u620480037 | p03557 | python | s501951249 | s415152842 | 342 | 219 | 22,516 | 104,280 | Accepted | Accepted | 35.96 | import bisect
N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
A.sort()
B.sort()
C.sort()
for i in range(len(B)):
ans+=bisect.bisect_left(A,B[i])*(len(C)-bisect.bisect_right(C,B[i]))
print(ans) | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
#print(A)
A.sort()
B.sort()
C.sort()
#print(A)
import bisect
ans=0
for i in range(N):
cnt=bisect.bisect_left(A,B[i])*(N-bisect.bisect_right(C,B[i]))
ans+=cnt
print(ans) | 14 | 16 | 283 | 306 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
A.sort()
B.sort()
C.sort()
for i in range(len(B)):
ans += bisect.bisect_left(A, B[i]) * (len(C) - bisect.bisect_right(C, B[i]))
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# print(A)
A.sort()
B.sort()
C.sort()
# print(A)
import bisect
ans = 0
for i in range(N):
cnt = bisect.bisect_left(A, B[i]) * (N - bisect.bisect_right(C, B[i]))
ans += cnt
print(an... | false | 12.5 | [
"-import bisect",
"-",
"-ans = 0",
"+# print(A)",
"-for i in range(len(B)):",
"- ans += bisect.bisect_left(A, B[i]) * (len(C) - bisect.bisect_right(C, B[i]))",
"+# print(A)",
"+import bisect",
"+",
"+ans = 0",
"+for i in range(N):",
"+ cnt = bisect.bisect_left(A, B[i]) * (N - bisect.bise... | false | 0.043096 | 0.11429 | 0.377076 | [
"s501951249",
"s415152842"
] |
u201234972 | p03713 | python | s602016493 | s787641655 | 312 | 170 | 3,064 | 3,064 | Accepted | Accepted | 45.51 | H, W = list(map( int, input().split()))
if H%3 == 0 or W%3 == 0:
ans = 0
else:
ans = min( max((H//3+1)*W, (H//3)*W)- min((H//3+1)*W, (H//3)*W), max((W//3+1)*H, (W//3)*H)- min((W//3+1)*H, (W//3)*H))
for i in range(H+1):
ans = min( ans, max(W*i, (H-i)*(W//2), (H-i)*(W - W//2)) - min(W*i, (H-i)*... | #import sys
#input = sys.stdin.readline
def main():
H, W = list(map( int, input().split()))
ans = min(H,W)
if H%3 == 0 or W%3 == 0:
ans = 0
for i in range(1,H):
L = [W*i]
L.append(W//2*(H-i))
if W%2 == 1:
L.append((W//2+1)*(H-i))
if max(L) ... | 10 | 24 | 488 | 626 | H, W = list(map(int, input().split()))
if H % 3 == 0 or W % 3 == 0:
ans = 0
else:
ans = min(
max((H // 3 + 1) * W, (H // 3) * W) - min((H // 3 + 1) * W, (H // 3) * W),
max((W // 3 + 1) * H, (W // 3) * H) - min((W // 3 + 1) * H, (W // 3) * H),
)
for i in range(H + 1):
ans = min(
... | # import sys
# input = sys.stdin.readline
def main():
H, W = list(map(int, input().split()))
ans = min(H, W)
if H % 3 == 0 or W % 3 == 0:
ans = 0
for i in range(1, H):
L = [W * i]
L.append(W // 2 * (H - i))
if W % 2 == 1:
L.append((W // 2 + 1) * (H - i))
... | false | 58.333333 | [
"-H, W = list(map(int, input().split()))",
"-if H % 3 == 0 or W % 3 == 0:",
"- ans = 0",
"-else:",
"- ans = min(",
"- max((H // 3 + 1) * W, (H // 3) * W) - min((H // 3 + 1) * W, (H // 3) * W),",
"- max((W // 3 + 1) * H, (W // 3) * H) - min((W // 3 + 1) * H, (W // 3) * H),",
"- )... | false | 0.509502 | 0.143445 | 3.55189 | [
"s602016493",
"s787641655"
] |
u519939795 | p03073 | python | s082723728 | s314030890 | 82 | 49 | 3,996 | 3,956 | Accepted | Accepted | 40.24 | s=[int(i) for i in eval(input())]
ans=0
for i in range(1,len(s)):
ans+=s[~-i]==s[i]
s[i]=not s[~-i]
print(ans)
| s = list(eval(input()))
p = ["0", "1"]
f = 1
ans = [0, 0]
for i in s:
if (p[f] != i):
ans[0] += 1
else:
ans[1] += 1
f ^= 1
print((min(ans)))
| 6 | 14 | 112 | 177 | s = [int(i) for i in eval(input())]
ans = 0
for i in range(1, len(s)):
ans += s[~-i] == s[i]
s[i] = not s[~-i]
print(ans)
| s = list(eval(input()))
p = ["0", "1"]
f = 1
ans = [0, 0]
for i in s:
if p[f] != i:
ans[0] += 1
else:
ans[1] += 1
f ^= 1
print((min(ans)))
| false | 57.142857 | [
"-s = [int(i) for i in eval(input())]",
"-ans = 0",
"-for i in range(1, len(s)):",
"- ans += s[~-i] == s[i]",
"- s[i] = not s[~-i]",
"-print(ans)",
"+s = list(eval(input()))",
"+p = [\"0\", \"1\"]",
"+f = 1",
"+ans = [0, 0]",
"+for i in s:",
"+ if p[f] != i:",
"+ ans[0] += 1"... | false | 0.045673 | 0.043746 | 1.044051 | [
"s082723728",
"s314030890"
] |
u137226361 | p03356 | python | s736914889 | s708334263 | 488 | 415 | 49,508 | 20,276 | Accepted | Accepted | 14.96 | n, m = list(map(int, input().split()))
pn = list([int(x)-1 for x in input().split()])
ls = [-1] * n
for i in pn:
ls[pn[i]] = i
#print(ls)
par = [i for i in range(n)]
def find(x):
if par[x] == x:
return x
else:
s = find(par[x])
par[x] = s
return s
def unite... | n, m = list(map(int, input().split()))
pn = list([int(x)-1 for x in input().split()])
ls = [-1] * n
for i in pn:
ls[pn[i]] = i
#print(ls)
par = [i for i in range(n)]
def find(x):
if par[x] == x:
return x
else:
s = find(par[x])
par[x] = s
return s
def unite... | 44 | 39 | 767 | 688 | n, m = list(map(int, input().split()))
pn = list([int(x) - 1 for x in input().split()])
ls = [-1] * n
for i in pn:
ls[pn[i]] = i
# print(ls)
par = [i for i in range(n)]
def find(x):
if par[x] == x:
return x
else:
s = find(par[x])
par[x] = s
return s
def unite(x, y):
s... | n, m = list(map(int, input().split()))
pn = list([int(x) - 1 for x in input().split()])
ls = [-1] * n
for i in pn:
ls[pn[i]] = i
# print(ls)
par = [i for i in range(n)]
def find(x):
if par[x] == x:
return x
else:
s = find(par[x])
par[x] = s
return s
def unite(x, y):
s... | false | 11.363636 | [
"-dic = {}",
"-for i in range(n):",
"- a = find(i)",
"- if a in dic:",
"- dic[a].add(ls[i])",
"- else:",
"- dic[a] = set([ls[i]])",
"-# print(dic)",
"-# print(par)",
"-ans = 0",
"-for i in range(n):",
"- if i in dic[find(i)]:",
"- ans += 1",
"-print(ans)",
... | false | 0.042922 | 0.046513 | 0.922798 | [
"s736914889",
"s708334263"
] |
u806976856 | p03645 | python | s710820260 | s354094337 | 516 | 307 | 112,472 | 107,280 | Accepted | Accepted | 40.5 | import sys
def ipnput():
return sys.stdin.readline()[:-1]
from _collections import deque
n,m=list(map(int,input().split()))
edg=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
edg[a].append(b)
edg[b].append(a)
dep=[-1]*(n+1)
dep[1]=0
data=deque([1])
while len(... | import sys
input=sys.stdin.readline
from _collections import deque
n,m=list(map(int,input().split()))
edg=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
edg[a].append(b)
edg[b].append(a)
dep=[-1]*(n+1)
dep[1]=0
data=deque([1])
while len(data)>0:
p=data.poplef... | 20 | 19 | 492 | 465 | import sys
def ipnput():
return sys.stdin.readline()[:-1]
from _collections import deque
n, m = list(map(int, input().split()))
edg = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
edg[a].append(b)
edg[b].append(a)
dep = [-1] * (n + 1)
dep[1] = 0
data = deque([... | import sys
input = sys.stdin.readline
from _collections import deque
n, m = list(map(int, input().split()))
edg = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
edg[a].append(b)
edg[b].append(a)
dep = [-1] * (n + 1)
dep[1] = 0
data = deque([1])
while len(data) > 0:
... | false | 5 | [
"-",
"-def ipnput():",
"- return sys.stdin.readline()[:-1]",
"-",
"-",
"+input = sys.stdin.readline"
] | false | 0.041699 | 0.052973 | 0.787183 | [
"s710820260",
"s354094337"
] |
u707498674 | p02623 | python | s681195464 | s593589725 | 364 | 224 | 53,728 | 47,376 | Accepted | Accepted | 38.46 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | from bisect import bisect_right
def main():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
CUSUM_A = [0] * (N+1)
CUSUM_B = [0] * (M+1)
for i, a in enumerate(A):
CUSUM_A[i+1] = CUSUM_A[i] + a
for i, ... | 64 | 38 | 1,595 | 847 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | from bisect import bisect_right
def main():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
CUSUM_A = [0] * (N + 1)
CUSUM_B = [0] * (M + 1)
for i, a in enumerate(A):
CUSUM_A[i + 1] = CUSUM_A[i] + a
for i, b in enumer... | false | 40.625 | [
"-import sys, re",
"-from collections import deque, defaultdict, Counter",
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"-from itertools import accumulate, permutations, combinations, product",
"-from operator import itemgetter, mul",
"-from copy import deepcopy",
"-from stri... | false | 0.065637 | 0.05338 | 1.229633 | [
"s681195464",
"s593589725"
] |
u755801379 | p02838 | python | s000933584 | s144596031 | 1,309 | 521 | 168,300 | 122,936 | Accepted | Accepted | 60.2 | n=int(eval(input()))
lis=list([format(int(x),'b') for x in input().split()])
l=0
for i in range(n):
l=max(l,len(lis[i]))
d0=[0]*60
d1=[0]*60
for i in range(n):
lis[i]=lis[i].zfill(l)
for j in range(l):
if lis[i][-j-1]=='0':
d0[j]+=1
else:
d1[j]+=1
... | n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in range(60):
l=0
for ai in a:
l+=(ai>>i)&1
ans=(ans + 2**i * l * (n-l))%(10**9+7)
print(ans) | 21 | 9 | 404 | 181 | n = int(eval(input()))
lis = list([format(int(x), "b") for x in input().split()])
l = 0
for i in range(n):
l = max(l, len(lis[i]))
d0 = [0] * 60
d1 = [0] * 60
for i in range(n):
lis[i] = lis[i].zfill(l)
for j in range(l):
if lis[i][-j - 1] == "0":
d0[j] += 1
else:
d1[... | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(60):
l = 0
for ai in a:
l += (ai >> i) & 1
ans = (ans + 2**i * l * (n - l)) % (10**9 + 7)
print(ans)
| false | 57.142857 | [
"-lis = list([format(int(x), \"b\") for x in input().split()])",
"-l = 0",
"-for i in range(n):",
"- l = max(l, len(lis[i]))",
"-d0 = [0] * 60",
"-d1 = [0] * 60",
"-for i in range(n):",
"- lis[i] = lis[i].zfill(l)",
"- for j in range(l):",
"- if lis[i][-j - 1] == \"0\":",
"- ... | false | 0.041531 | 0.03677 | 1.129455 | [
"s000933584",
"s144596031"
] |
u580093517 | p03631 | python | s177464934 | s579347686 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = eval(input())
print(("Yes" if n[0] == n[2] else "No")) | s = eval(input())
print(("Yes" if s[0] == s[-1] else "No")) | 2 | 2 | 51 | 52 | n = eval(input())
print(("Yes" if n[0] == n[2] else "No"))
| s = eval(input())
print(("Yes" if s[0] == s[-1] else "No"))
| false | 0 | [
"-n = eval(input())",
"-print((\"Yes\" if n[0] == n[2] else \"No\"))",
"+s = eval(input())",
"+print((\"Yes\" if s[0] == s[-1] else \"No\"))"
] | false | 0.043753 | 0.044207 | 0.989729 | [
"s177464934",
"s579347686"
] |
u621935300 | p03608 | python | s205628489 | s264816565 | 1,272 | 486 | 38,812 | 39,964 | Accepted | Accepted | 61.79 | import sys
import itertools
N,M,R=list(map(int, input().split()))
d=[ [ float("inf") for j in range(N+1) ] for i in range(N+1) ]
r=list(map(int, sys.stdin.readline().split()))
for _ in range(M):
a,b,c=list(map(int, sys.stdin.readline().split()))
d[a][b]=c
d[b][a]=c
for _ in range(3):
for i i... | import sys
import itertools
N,M,R=list(map(int, input().split()))
d=[ [ float("inf") for j in range(N+1) ] for i in range(N+1) ]
r=list(map(int, sys.stdin.readline().split()))
for _ in range(M):
a,b,c=list(map(int, sys.stdin.readline().split()))
d[a][b]=c
d[b][a]=c
for k in range(1,N+1):
for i... | 36 | 34 | 615 | 589 | import sys
import itertools
N, M, R = list(map(int, input().split()))
d = [[float("inf") for j in range(N + 1)] for i in range(N + 1)]
r = list(map(int, sys.stdin.readline().split()))
for _ in range(M):
a, b, c = list(map(int, sys.stdin.readline().split()))
d[a][b] = c
d[b][a] = c
for _ in range(3):
fo... | import sys
import itertools
N, M, R = list(map(int, input().split()))
d = [[float("inf") for j in range(N + 1)] for i in range(N + 1)]
r = list(map(int, sys.stdin.readline().split()))
for _ in range(M):
a, b, c = list(map(int, sys.stdin.readline().split()))
d[a][b] = c
d[b][a] = c
for k in range(1, N + 1):... | false | 5.555556 | [
"-for _ in range(3):",
"+for k in range(1, N + 1):",
"- for k in range(1, N + 1):",
"- d[i][j] = min(d[i][j], d[i][k] + d[k][j])",
"+ d[i][j] = min(d[i][j], d[i][k] + d[k][j])"
] | false | 0.055732 | 0.085717 | 0.650181 | [
"s205628489",
"s264816565"
] |
u923279197 | p03127 | python | s478941003 | s010087627 | 434 | 91 | 88,428 | 16,240 | Accepted | Accepted | 79.03 | import fractions
n = int(eval(input()))
a = list(map(int,input().split()))
#入力
def gcd(a):
ans = a[0]
n = len(a)
for i in range(1,n):
ans = fractions.gcd(ans,a[i])
return ans
print((gcd(a))) | from fractions import gcd
n = int(eval(input()))
a = list(map(int,input().split()))
x = a[0]
for i in range(1,n):
x = gcd(x,a[i])
print(x) | 13 | 9 | 220 | 146 | import fractions
n = int(eval(input()))
a = list(map(int, input().split()))
# 入力
def gcd(a):
ans = a[0]
n = len(a)
for i in range(1, n):
ans = fractions.gcd(ans, a[i])
return ans
print((gcd(a)))
| from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
x = a[0]
for i in range(1, n):
x = gcd(x, a[i])
print(x)
| false | 30.769231 | [
"-import fractions",
"+from fractions import gcd",
"-# 入力",
"-def gcd(a):",
"- ans = a[0]",
"- n = len(a)",
"- for i in range(1, n):",
"- ans = fractions.gcd(ans, a[i])",
"- return ans",
"-",
"-",
"-print((gcd(a)))",
"+x = a[0]",
"+for i in range(1, n):",
"+ x = gcd... | false | 0.045461 | 0.041068 | 1.106951 | [
"s478941003",
"s010087627"
] |
u586960661 | p03164 | python | s672379260 | s754568542 | 276 | 253 | 41,580 | 43,132 | Accepted | Accepted | 8.33 | n,w=list(map(int,input().split()))
dp=[999999999999999]*(100001)
dp[0]=0
for i in range(n):
wt,val=list(map(int,input().split()))
for j in range(100000,val-1,-1):
dp[j]=min(dp[j],dp[j-val]+wt)
for i in range(100000,-1,-1):
if dp[i]<=w:
print(i)
exit() | n,w=list(map(int,input().split()))
l=(n*1000)+1
dp=[9999999999]*(l)
dp[0]=0
for i in range(n):
wt,val=list(map(int,input().split()))
for j in range(l-1,val-1,-1):
dp[j]=min(dp[j],dp[j-val]+wt)
for i in range(l-1,-1,-1):
if dp[i]<=w:
print(i)
exit() | 11 | 12 | 258 | 256 | n, w = list(map(int, input().split()))
dp = [999999999999999] * (100001)
dp[0] = 0
for i in range(n):
wt, val = list(map(int, input().split()))
for j in range(100000, val - 1, -1):
dp[j] = min(dp[j], dp[j - val] + wt)
for i in range(100000, -1, -1):
if dp[i] <= w:
print(i)
exit()
| n, w = list(map(int, input().split()))
l = (n * 1000) + 1
dp = [9999999999] * (l)
dp[0] = 0
for i in range(n):
wt, val = list(map(int, input().split()))
for j in range(l - 1, val - 1, -1):
dp[j] = min(dp[j], dp[j - val] + wt)
for i in range(l - 1, -1, -1):
if dp[i] <= w:
print(i)
exi... | false | 8.333333 | [
"-dp = [999999999999999] * (100001)",
"+l = (n * 1000) + 1",
"+dp = [9999999999] * (l)",
"- for j in range(100000, val - 1, -1):",
"+ for j in range(l - 1, val - 1, -1):",
"-for i in range(100000, -1, -1):",
"+for i in range(l - 1, -1, -1):"
] | false | 0.669638 | 0.122298 | 5.475443 | [
"s672379260",
"s754568542"
] |
u863370423 | p03487 | python | s283364366 | s766547836 | 86 | 79 | 21,744 | 11,964 | Accepted | Accepted | 8.14 | from collections import Counter
a = int(eval(input()))
l = list(map(int, input().split()))
#i = 1
c=Counter(l)
d = dict(c)
kv = []
for k,v in list(d.items()):
if k>v:
kv.append(v)
elif k<v:
t = v-k
kv.append(t)
s = sum(kv)
print(s)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
cnt = [0] * n + [0]
for i in a:
if i > n:
ans += 1
else:
cnt[i] += 1
for i in range(n + 1):
ans += cnt[i] - i if cnt[i] >= i else cnt[i]
print(ans) | 16 | 12 | 268 | 227 | from collections import Counter
a = int(eval(input()))
l = list(map(int, input().split()))
# i = 1
c = Counter(l)
d = dict(c)
kv = []
for k, v in list(d.items()):
if k > v:
kv.append(v)
elif k < v:
t = v - k
kv.append(t)
s = sum(kv)
print(s)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
cnt = [0] * n + [0]
for i in a:
if i > n:
ans += 1
else:
cnt[i] += 1
for i in range(n + 1):
ans += cnt[i] - i if cnt[i] >= i else cnt[i]
print(ans)
| false | 25 | [
"-from collections import Counter",
"-",
"-a = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-# i = 1",
"-c = Counter(l)",
"-d = dict(c)",
"-kv = []",
"-for k, v in list(d.items()):",
"- if k > v:",
"- kv.append(v)",
"- elif k < v:",
"- t = v - k",
"- ... | false | 0.047508 | 0.047148 | 1.007641 | [
"s283364366",
"s766547836"
] |
u461513098 | p02579 | python | s875878792 | s105988922 | 806 | 688 | 148,236 | 132,588 | Accepted | Accepted | 14.64 | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
if __name__ == "__main__":
H, W = list(map(int, input().split()))
ch, cw = [int(x)-1 for x in input().split()]
dh, dw = [int(x)-1 for x in input().split()]
maze = [list(eval(input())) for _ in range(H)]... | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
if __name__ == "__main__":
H, W = list(map(int, input().split()))
ch, cw = [int(x)-1 for x in input().split()]
dh, dw = [int(x)-1 for x in input().split()]
maze = [list(eval(input())) for _ in range(H)]... | 34 | 37 | 1,140 | 1,202 | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
if __name__ == "__main__":
H, W = list(map(int, input().split()))
ch, cw = [int(x) - 1 for x in input().split()]
dh, dw = [int(x) - 1 for x in input().split()]
maze = [list(eval(input())) for _ in range(H)]
INF =... | import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
if __name__ == "__main__":
H, W = list(map(int, input().split()))
ch, cw = [int(x) - 1 for x in input().split()]
dh, dw = [int(x) - 1 for x in input().split()]
maze = [list(eval(input())) for _ in range(H)]
INF =... | false | 8.108108 | [
"- walk_que = deque()",
"- walk_que.append((ch, cw, 0))",
"- while walk_que:",
"- y, x, w = walk_que.popleft()",
"- for ny, nx in [(y + 1, x), (y - 1, x), (y, x + 1), (y, x - 1)]:",
"+ walk = [(1, 0), (0, 1), (-1, 0), (0, -1)]",
"+ warp = [(y, x) for x in range(-2, 3) for y ... | false | 0.037995 | 0.040352 | 0.941575 | [
"s875878792",
"s105988922"
] |
u581187895 | p02632 | python | s719015701 | s546230203 | 1,316 | 655 | 230,268 | 223,252 | Accepted | Accepted | 50.23 |
def resolve():
MOD = 10 ** 9 + 7
def COMinit(n, MOD):
fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]
for i in range(2, n + 1):
fact.append((fact[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
fact_inv.append((fact_inv... |
def resolve():
def COMinit(n, MOD):
fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]
for i in range(2, n + 1):
fact.append((fact[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
fact_inv.append((fact_inv[-1] * inv[i]) % MOD)
... | 41 | 48 | 1,067 | 1,139 | def resolve():
MOD = 10**9 + 7
def COMinit(n, MOD):
fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]
for i in range(2, n + 1):
fact.append((fact[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
fact_inv.append((fact_inv[-1] * inv[i])... | def resolve():
def COMinit(n, MOD):
fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]
for i in range(2, n + 1):
fact.append((fact[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
fact_inv.append((fact_inv[-1] * inv[i]) % MOD)
retur... | false | 14.583333 | [
"- MOD = 10**9 + 7",
"-",
"+ MOD = 10**9 + 7",
"- n25 = [1]",
"- n26 = [1]",
"- for _ in range(K + N - N):",
"- n25.append((n25[-1] * 25) % MOD)",
"- n26.append((n26[-1] * 26) % MOD)",
"+ pow26 = [1] * (K + 1)",
"+ pow25 = [1] * (K + 1)",
"+ t1 = 1",
"+ ... | false | 0.046573 | 0.105931 | 0.439658 | [
"s719015701",
"s546230203"
] |
u394731058 | p02725 | python | s909081428 | s070850126 | 183 | 146 | 26,444 | 26,600 | Accepted | Accepted | 20.22 | k,n = list(map(int, input().split()))
l = list(map(int, input().split()))
d = []
for i in range(n):
if i + 1 < n:
d.append(l[i+1]-l[i])
else:
if 0 in l:
d.append(k - l[i])
else:
d.append(k - l[i] + l[0])
sum = sum(d)
a = []
for i in range(n):
a.append(sum - d[i])
print((min(... | k, n = list(map(int, input().split()))
l = list(map(int, input().split()))
d = []
for i in range(n):
if i+1<n:
d.append(abs(l[i+1]-l[i]))
else:
if 0 in l:
d.append(abs(k - l[i]))
else:
d.append(abs(k - l[i] + l[0]))
print((sum(d)-max(d))) | 16 | 12 | 316 | 269 | k, n = list(map(int, input().split()))
l = list(map(int, input().split()))
d = []
for i in range(n):
if i + 1 < n:
d.append(l[i + 1] - l[i])
else:
if 0 in l:
d.append(k - l[i])
else:
d.append(k - l[i] + l[0])
sum = sum(d)
a = []
for i in range(n):
a.append(sum... | k, n = list(map(int, input().split()))
l = list(map(int, input().split()))
d = []
for i in range(n):
if i + 1 < n:
d.append(abs(l[i + 1] - l[i]))
else:
if 0 in l:
d.append(abs(k - l[i]))
else:
d.append(abs(k - l[i] + l[0]))
print((sum(d) - max(d)))
| false | 25 | [
"- d.append(l[i + 1] - l[i])",
"+ d.append(abs(l[i + 1] - l[i]))",
"- d.append(k - l[i])",
"+ d.append(abs(k - l[i]))",
"- d.append(k - l[i] + l[0])",
"-sum = sum(d)",
"-a = []",
"-for i in range(n):",
"- a.append(sum - d[i])",
"-print((min(a)))",
... | false | 0.044046 | 0.044015 | 1.000709 | [
"s909081428",
"s070850126"
] |
u766510304 | p02995 | python | s135798305 | s354559603 | 36 | 18 | 5,076 | 3,064 | Accepted | Accepted | 50 | A, B, C, D=(int(x) for x in input().split(" "))
import fractions
def eks(x,a):
return a//x
def wai(x):
return eks(x,B)-eks(x,A-1)
def lcm(a,b):
return a*b//fractions.gcd(a,b)
zet=B-A+1-(wai(C)+wai(D)-wai(lcm(C,D)))
print (zet) |
A,B,C,D=(int(x) for x in input().split(" "))
def gcd(x,y):
while(y):
x, y = y, x % y
return x
def nb_divisers(n,m):
return n//m
def nb_d_btw(f,g,n):
if f%n==0:
return nb_divisers(g,n)-nb_divisers(f,n)+1
else:
return nb_divisers(g,n)-nb_divisers(f,n)
de... | 14 | 19 | 255 | 475 | A, B, C, D = (int(x) for x in input().split(" "))
import fractions
def eks(x, a):
return a // x
def wai(x):
return eks(x, B) - eks(x, A - 1)
def lcm(a, b):
return a * b // fractions.gcd(a, b)
zet = B - A + 1 - (wai(C) + wai(D) - wai(lcm(C, D)))
print(zet)
| A, B, C, D = (int(x) for x in input().split(" "))
def gcd(x, y):
while y:
x, y = y, x % y
return x
def nb_divisers(n, m):
return n // m
def nb_d_btw(f, g, n):
if f % n == 0:
return nb_divisers(g, n) - nb_divisers(f, n) + 1
else:
return nb_divisers(g, n) - nb_divisers(f,... | false | 26.315789 | [
"-import fractions",
"-def eks(x, a):",
"- return a // x",
"+def gcd(x, y):",
"+ while y:",
"+ x, y = y, x % y",
"+ return x",
"-def wai(x):",
"- return eks(x, B) - eks(x, A - 1)",
"+def nb_divisers(n, m):",
"+ return n // m",
"-def lcm(a, b):",
"- return a * b // fr... | false | 0.074948 | 0.12244 | 0.612121 | [
"s135798305",
"s354559603"
] |
u390901183 | p02684 | python | s372122360 | s763506778 | 400 | 217 | 40,076 | 41,616 | Accepted | Accepted | 45.75 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([x - 1 for x in A]) # 0-indexed
pos = 0
memo = [[False, 0] for _ in range(N)] # memo[i]: [bool, tel_cnt] , [数えたか、何回移動したか]
memo[0] = [True, 0]
distance = 0
l_pos = 0
tel_cnt = 0
while True:
next = A[pos]
tel_cnt += 1... | import sys
def inp(): return int(sys.stdin.readline())
def inp_list(): return list(map(int, sys.stdin.readline().split()))
N, K = inp_list()
A = inp_list()
A = list([x - 1 for x in A]) # 0-indexed
pos = 0 # 現在の位置を表す index
# memo = [[False, 0] for _ in range(N)] # memo[i]: [bool, tel_cnt] , [数えたか、何回移... | 35 | 55 | 858 | 1,420 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([x - 1 for x in A]) # 0-indexed
pos = 0
memo = [[False, 0] for _ in range(N)] # memo[i]: [bool, tel_cnt] , [数えたか、何回移動したか]
memo[0] = [True, 0]
distance = 0
l_pos = 0
tel_cnt = 0
while True:
next = A[pos]
tel_cnt += 1
if mem... | import sys
def inp():
return int(sys.stdin.readline())
def inp_list():
return list(map(int, sys.stdin.readline().split()))
N, K = inp_list()
A = inp_list()
A = list([x - 1 for x in A]) # 0-indexed
pos = 0 # 現在の位置を表す index
# memo = [[False, 0] for _ in range(N)] # memo[i]: [bool, tel_cnt] , [数えたか、何回移動したか... | false | 36.363636 | [
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"+import sys",
"+",
"+",
"+def inp():",
"+ return int(sys.stdin.readline())",
"+",
"+",
"+def inp_list():",
"+ return list(map(int, sys.stdin.readline().split()))",
"+",
"+",
"+N, K = inp_list()",
"+... | false | 0.007159 | 0.076214 | 0.093927 | [
"s372122360",
"s763506778"
] |
u393224521 | p02683 | python | s470995806 | s489018302 | 106 | 85 | 70,296 | 68,636 | Accepted | Accepted | 19.81 | import sys
n,m,x= list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [ [int(s) for s in line.split()] for line in sys.stdin ]
books = {}
num = 0
for a in range(2):
for b in range(2):
for c in range(2):
for d in range(2):
for e in range(2):
... | import sys
n,m,x= list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [ [int(s) for s in line.split()] for line in sys.stdin ]
price = -1
skill = {}
for i in range(2**n-1):
i = format(i+1, 'b').zfill(n)
price_ = 0
for j in range (m):
skill[j] = 0
for k in range(n):
... | 40 | 24 | 1,333 | 655 | import sys
n, m, x = list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [[int(s) for s in line.split()] for line in sys.stdin]
books = {}
num = 0
for a in range(2):
for b in range(2):
for c in range(2):
for d in range(2):
for e in range(2):
for... | import sys
n, m, x = list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [[int(s) for s in line.split()] for line in sys.stdin]
price = -1
skill = {}
for i in range(2**n - 1):
i = format(i + 1, "b").zfill(n)
price_ = 0
for j in range(m):
skill[j] = 0
for k in range(n):
if ... | false | 40 | [
"-books = {}",
"-num = 0",
"-for a in range(2):",
"- for b in range(2):",
"- for c in range(2):",
"- for d in range(2):",
"- for e in range(2):",
"- for f in range(2):",
"- for g in range(2):",
"- ... | false | 0.205308 | 0.039293 | 5.225016 | [
"s470995806",
"s489018302"
] |
u198440493 | p03103 | python | s450951476 | s943477377 | 421 | 230 | 29,024 | 25,828 | Accepted | Accepted | 45.37 | n,m=list(map(int,input().split()))
l=[list(map(int,input().split())) for _ in range(n)]
l.sort(key=lambda x:x[0])
ans=0
for i in range(n):
s,t=l[i]
if m-t<=0:
ans+=s*m
break
else:
m-=t
ans+=s*t
print(ans) | n,m,*l=list(map(int,open(0).read().split()))
ans=0
for s,t in sorted(zip(l[::2],l[1::2])):
ans+=s*min(m,t)
m=max(m-t,0)
if not m:
break
print(ans) | 13 | 8 | 232 | 157 | n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key=lambda x: x[0])
ans = 0
for i in range(n):
s, t = l[i]
if m - t <= 0:
ans += s * m
break
else:
m -= t
ans += s * t
print(ans)
| n, m, *l = list(map(int, open(0).read().split()))
ans = 0
for s, t in sorted(zip(l[::2], l[1::2])):
ans += s * min(m, t)
m = max(m - t, 0)
if not m:
break
print(ans)
| false | 38.461538 | [
"-n, m = list(map(int, input().split()))",
"-l = [list(map(int, input().split())) for _ in range(n)]",
"-l.sort(key=lambda x: x[0])",
"+n, m, *l = list(map(int, open(0).read().split()))",
"-for i in range(n):",
"- s, t = l[i]",
"- if m - t <= 0:",
"- ans += s * m",
"+for s, t in sorted(... | false | 0.034256 | 0.034148 | 1.003135 | [
"s450951476",
"s943477377"
] |
u678167152 | p02832 | python | s779567129 | s317977623 | 92 | 82 | 26,524 | 32,244 | Accepted | Accepted | 10.87 | import math
import itertools
N = int(eval(input()))
A = list(map(int, input().split()))
mark = 0
for a in A:
if a == mark+1:
mark += 1
if mark == 0:
print((-1))
else:
print((N-mark)) | def solve():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
p = 1
for a in A:
if a==p:
p += 1
else:
ans += 1
if p==1:
ans = -1
return ans
print((solve())) | 13 | 14 | 195 | 217 | import math
import itertools
N = int(eval(input()))
A = list(map(int, input().split()))
mark = 0
for a in A:
if a == mark + 1:
mark += 1
if mark == 0:
print((-1))
else:
print((N - mark))
| def solve():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
p = 1
for a in A:
if a == p:
p += 1
else:
ans += 1
if p == 1:
ans = -1
return ans
print((solve()))
| false | 7.142857 | [
"-import math",
"-import itertools",
"+def solve():",
"+ N = int(eval(input()))",
"+ A = list(map(int, input().split()))",
"+ ans = 0",
"+ p = 1",
"+ for a in A:",
"+ if a == p:",
"+ p += 1",
"+ else:",
"+ ans += 1",
"+ if p == 1:",
"+ ... | false | 0.040517 | 0.040794 | 0.993231 | [
"s779567129",
"s317977623"
] |
u198905553 | p02983 | python | s346152345 | s294866890 | 412 | 183 | 107,148 | 43,504 | Accepted | Accepted | 55.58 | l, r= list(map(int, input().split()))
if r - l >2017:
print((0))
else:
ij = []
for i in range(l, r):
for j in range(i+1, r+1):
ij.append((i*j)%2019)
print((min(ij))) | L, R = list(map(int, input().split()))
if R - L >= 2017:
print((0))
exit()
ans_list = []
for x in range(L, R):
for y in range(x+1, R+1):
ans_list.append((x * y) % 2019)
print((min(ans_list))) | 9 | 13 | 199 | 217 | l, r = list(map(int, input().split()))
if r - l > 2017:
print((0))
else:
ij = []
for i in range(l, r):
for j in range(i + 1, r + 1):
ij.append((i * j) % 2019)
print((min(ij)))
| L, R = list(map(int, input().split()))
if R - L >= 2017:
print((0))
exit()
ans_list = []
for x in range(L, R):
for y in range(x + 1, R + 1):
ans_list.append((x * y) % 2019)
print((min(ans_list)))
| false | 30.769231 | [
"-l, r = list(map(int, input().split()))",
"-if r - l > 2017:",
"+L, R = list(map(int, input().split()))",
"+if R - L >= 2017:",
"-else:",
"- ij = []",
"- for i in range(l, r):",
"- for j in range(i + 1, r + 1):",
"- ij.append((i * j) % 2019)",
"- print((min(ij)))",
"+... | false | 0.089798 | 0.044208 | 2.031281 | [
"s346152345",
"s294866890"
] |
u695079172 | p03633 | python | s099530781 | s595602439 | 30 | 23 | 3,700 | 3,572 | Accepted | Accepted | 23.33 | from functools import reduce
def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
#最小公倍数
def lcm(a,b):
return b//gcd(a,b) * a
if __name__ == "__main__":
n = int(eval(input()))
lst = []
for i in range(n):
lst.append(int(eval(input())))
print((reduce(lcm,lst))) | from functools import reduce
def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
#最小公倍数
def lcm(a,b):
return a * b // gcd(a,b)
if __name__ == "__main__":
n = int(eval(input()))
lst = []
for i in range(n):
lst.append(int(eval(input())))
print((reduce(lcm,lst))) | 18 | 19 | 292 | 297 | from functools import reduce
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
# 最小公倍数
def lcm(a, b):
return b // gcd(a, b) * a
if __name__ == "__main__":
n = int(eval(input()))
lst = []
for i in range(n):
lst.append(int(eval(input())))
print((reduce(lcm, lst)))
| from functools import reduce
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
# 最小公倍数
def lcm(a, b):
return a * b // gcd(a, b)
if __name__ == "__main__":
n = int(eval(input()))
lst = []
for i in range(n):
lst.append(int(eval(input())))
print((reduce(lcm, lst)))
| false | 5.263158 | [
"- return b // gcd(a, b) * a",
"+ return a * b // gcd(a, b)"
] | false | 0.11151 | 0.037174 | 2.999672 | [
"s099530781",
"s595602439"
] |
u796942881 | p03557 | python | s779646171 | s213255458 | 321 | 291 | 29,708 | 29,708 | Accepted | Accepted | 9.35 | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, input().split()))
Cn = list(map(int, input().split()))
A = sorted(An)
C = sorted(Cn)
print((sum(bisect_left(A, Bi... | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, input().split()))
Cn = list(map(int, input().split()))
A = sorted(An)
B = sorted(Bn)
C = sorted(Cn)
print((s... | 18 | 19 | 364 | 385 | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, input().split()))
Cn = list(map(int, input().split()))
A = sorted(An)
C = sorted(Cn)
print((sum(bisect_left(A, Bi) * (N - bisect_... | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, input().split()))
Cn = list(map(int, input().split()))
A = sorted(An)
B = sorted(Bn)
C = sorted(Cn)
print((sum([bisect_left(A... | false | 5.263158 | [
"+ B = sorted(Bn)",
"- print((sum(bisect_left(A, Bi) * (N - bisect_right(C, Bi)) for Bi in Bn)))",
"+ print((sum([bisect_left(A, Bi) * (N - bisect_right(C, Bi)) for Bi in B])))"
] | false | 0.045918 | 0.043941 | 1.045003 | [
"s779646171",
"s213255458"
] |
u354916249 | p03627 | python | s388912732 | s154334000 | 171 | 89 | 18,060 | 14,252 | Accepted | Accepted | 47.95 | N = int(eval(input()))
A = list(map(int, input().split()))
C = {}
count = 0
H = 0
W = 0
res1=res2=res3=0
for i in A:
C[i] = 0
for i in A:
C[i] += 1
for i in A:
if C[i] >= 2:
res1 = max(res1, i)
for i in A:
if C[i] >= 2 and i != res1:
res2 = max(res2, i)
f... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
wh = [0,0]
tmp = 0
for i in A:
if i == tmp:
wh.append(i)
tmp = 0
else:
tmp = i
print((wh[-1] * wh[-2]))
| 31 | 16 | 414 | 215 | N = int(eval(input()))
A = list(map(int, input().split()))
C = {}
count = 0
H = 0
W = 0
res1 = res2 = res3 = 0
for i in A:
C[i] = 0
for i in A:
C[i] += 1
for i in A:
if C[i] >= 2:
res1 = max(res1, i)
for i in A:
if C[i] >= 2 and i != res1:
res2 = max(res2, i)
for i in A:
if C[i] >= 4... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
wh = [0, 0]
tmp = 0
for i in A:
if i == tmp:
wh.append(i)
tmp = 0
else:
tmp = i
print((wh[-1] * wh[-2]))
| false | 48.387097 | [
"-C = {}",
"-count = 0",
"-H = 0",
"-W = 0",
"-res1 = res2 = res3 = 0",
"+A.sort()",
"+wh = [0, 0]",
"+tmp = 0",
"- C[i] = 0",
"-for i in A:",
"- C[i] += 1",
"-for i in A:",
"- if C[i] >= 2:",
"- res1 = max(res1, i)",
"-for i in A:",
"- if C[i] >= 2 and i != res1:",
... | false | 0.040875 | 0.039952 | 1.023107 | [
"s388912732",
"s154334000"
] |
u716530146 | p02919 | python | s774956505 | s498812966 | 519 | 185 | 62,700 | 20,196 | Accepted | Accepted | 64.35 | #!/usr/bin/env python3
N=int(eval(input()))
p=list(map(int,input().split()))
LL = [0] + [i for i in range(N+1)]
RR = [i+1 for i in range(N+1)] + [N+1]
E = [(v, i+1) for i, v in enumerate(p)]
E.sort()
ans=0
for v, i in E:
r0 = RR[i]
r1 = RR[r0]
l0 = LL[i]
l1 = LL[l0]
RR[l0] = r0
LL[r0] = l0
... | #!/usr/bin/env python3
ans=0
n=int(eval(input()))
p=list(map(int,input().split()))
b=[0]*(n+1)
for i in range(n):
b[p[i]]=i+1
LL=[0]+[i for i in range(n+1)]
RR=[i for i in range(1,n+2)]+[n+1]
for i in range(1,n+1):
l1=LL[b[i]]
l0=LL[l1]
r0=RR[b[i]]
r1=RR[r0]
ans+=((l1-l0)*(r0-b[i])... | 19 | 19 | 375 | 380 | #!/usr/bin/env python3
N = int(eval(input()))
p = list(map(int, input().split()))
LL = [0] + [i for i in range(N + 1)]
RR = [i + 1 for i in range(N + 1)] + [N + 1]
E = [(v, i + 1) for i, v in enumerate(p)]
E.sort()
ans = 0
for v, i in E:
r0 = RR[i]
r1 = RR[r0]
l0 = LL[i]
l1 = LL[l0]
RR[l0] = r0
... | #!/usr/bin/env python3
ans = 0
n = int(eval(input()))
p = list(map(int, input().split()))
b = [0] * (n + 1)
for i in range(n):
b[p[i]] = i + 1
LL = [0] + [i for i in range(n + 1)]
RR = [i for i in range(1, n + 2)] + [n + 1]
for i in range(1, n + 1):
l1 = LL[b[i]]
l0 = LL[l1]
r0 = RR[b[i]]
r1 = RR[r0... | false | 0 | [
"-N = int(eval(input()))",
"+ans = 0",
"+n = int(eval(input()))",
"-LL = [0] + [i for i in range(N + 1)]",
"-RR = [i + 1 for i in range(N + 1)] + [N + 1]",
"-E = [(v, i + 1) for i, v in enumerate(p)]",
"-E.sort()",
"-ans = 0",
"-for v, i in E:",
"- r0 = RR[i]",
"+b = [0] * (n + 1)",
"+for i... | false | 0.039142 | 0.052453 | 0.746227 | [
"s774956505",
"s498812966"
] |
u629540524 | p03146 | python | s065812121 | s614290771 | 82 | 64 | 61,816 | 61,880 | Accepted | Accepted | 21.95 | n = int(eval(input()))
c = 1
x = []
x.append(n)
while True:
if n%2 == 0:
n = n//2
else:
n = 3*n+1
c+=1
if n in x:
break
x.append(n)
print(c) | n = int(eval(input()))
c = 0
x = []
while True:
c+=1
if n in x:
print(c)
break
x.append(n)
if n%2 == 0:
n = n//2
else:
n = 3*n+1 | 14 | 13 | 191 | 186 | n = int(eval(input()))
c = 1
x = []
x.append(n)
while True:
if n % 2 == 0:
n = n // 2
else:
n = 3 * n + 1
c += 1
if n in x:
break
x.append(n)
print(c)
| n = int(eval(input()))
c = 0
x = []
while True:
c += 1
if n in x:
print(c)
break
x.append(n)
if n % 2 == 0:
n = n // 2
else:
n = 3 * n + 1
| false | 7.142857 | [
"-c = 1",
"+c = 0",
"-x.append(n)",
"+ c += 1",
"+ if n in x:",
"+ print(c)",
"+ break",
"+ x.append(n)",
"- c += 1",
"- if n in x:",
"- break",
"- x.append(n)",
"-print(c)"
] | false | 0.045418 | 0.044967 | 1.010031 | [
"s065812121",
"s614290771"
] |
u389910364 | p03324 | python | s753162613 | s982195161 | 158 | 18 | 13,672 | 2,940 | Accepted | Accepted | 88.61 | import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", ... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
d, n = list(map(int, sys.stdin.buffer.readline().split()))
if n == 100:
n += 1
ans = 100 ** d * n
print(ans)
| 26 | 18 | 488 | 317 | import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrec... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
d, n = list(map(int, sys.stdin.buffer.readline().split()))
if n == 100:
n += 1
ans = 100**d * n
print(ans)
| false | 30.769231 | [
"-import bisect",
"-from collections import Counter, deque",
"-from fractions import gcd",
"-from functools import lru_cache",
"-from functools import reduce",
"-import functools",
"-import heapq",
"-import itertools",
"-import math",
"-import numpy as np",
"-import re",
"-sys.setrecursionlimi... | false | 0.043085 | 0.117157 | 0.367755 | [
"s753162613",
"s982195161"
] |
u860829879 | p03165 | python | s119243887 | s413586426 | 1,086 | 766 | 385,032 | 425,092 | Accepted | Accepted | 29.47 | s=eval(input())
t=eval(input())
dp=[[0]*(len(t)+1) for _ in range(len(s)+1)]
ans=[[(-1,-1) for _ in range(len(t)+1)] for _ in range(len(s)+1)]
for i,c in enumerate(s):
for j,d in enumerate(t):
if c==d:
dp[i+1][j+1]=dp[i][j]+1
ans[i+1][j+1]=(i,j)
else:
... | s=eval(input())
t=eval(input())
m=len(s)
n=len(t)
dp=[[0]*(n+1) for _ in range(m+1)]
trans=[[(-1,-1)]*(n+1) for _ in range(m+1)]
for i in range(m):
for j in range(n):
if s[i]==t[j]:
dp[i+1][j+1]=dp[i][j]+1
trans[i+1][j+1]=(i,j)
else:
if dp[i][j+1... | 26 | 32 | 597 | 634 | s = eval(input())
t = eval(input())
dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]
ans = [[(-1, -1) for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]
for i, c in enumerate(s):
for j, d in enumerate(t):
if c == d:
dp[i + 1][j + 1] = dp[i][j] + 1
ans[i + 1][j + 1] = (i, j)
... | s = eval(input())
t = eval(input())
m = len(s)
n = len(t)
dp = [[0] * (n + 1) for _ in range(m + 1)]
trans = [[(-1, -1)] * (n + 1) for _ in range(m + 1)]
for i in range(m):
for j in range(n):
if s[i] == t[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
trans[i + 1][j + 1] = (i, j)
else:
... | false | 18.75 | [
"-dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]",
"-ans = [[(-1, -1) for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]",
"-for i, c in enumerate(s):",
"- for j, d in enumerate(t):",
"- if c == d:",
"+m = len(s)",
"+n = len(t)",
"+dp = [[0] * (n + 1) for _ in range(m + 1)]",
"+... | false | 0.073876 | 0.044421 | 1.663066 | [
"s119243887",
"s413586426"
] |
u790710233 | p03078 | python | s267115687 | s151566969 | 649 | 40 | 8,708 | 5,068 | Accepted | Accepted | 93.84 | x, y, z, K = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ans = []
for i in range(x):
for j in range(y):
for k in range(z):
if (i+1)*(j+1)*(k+1) ... | import heapq
from collections import defaultdict
x, y, z, K = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
visited = defaultdict(bool)
Q = [(-(A[0]+B[0]+C[0]), 0, 0, 0)]
... | 16 | 23 | 474 | 810 | x, y, z, K = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ans = []
for i in range(x):
for j in range(y):
for k in range(z):
if (i + 1) * (j + 1) * (k + 1... | import heapq
from collections import defaultdict
x, y, z, K = list(map(int, input().split()))
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
visited = defaultdict(bool)
Q = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]
fo... | false | 30.434783 | [
"+import heapq",
"+from collections import defaultdict",
"+",
"-ans = []",
"-for i in range(x):",
"- for j in range(y):",
"- for k in range(z):",
"- if (i + 1) * (j + 1) * (k + 1) <= K:",
"- ans.append(A[i] + B[j] + C[k])",
"- continue",
"- ... | false | 0.080832 | 0.036722 | 2.201215 | [
"s267115687",
"s151566969"
] |
u875291233 | p03685 | python | s909262201 | s829263412 | 606 | 447 | 27,724 | 52,944 | Accepted | Accepted | 26.24 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
r,c,n = [int(i) for i in readline().split()]
#xyxy = [[int(i) for i in readline().split()] for _ in range(n)]
#for i,(x1,y1,x2,y2) in enumerate(xyxy):
def addedge(x1,y1):
if y1 ==... | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
h,w,n, *xyxy = list(map(int,read().split()))
def f(x,y):
if y==0: return x
elif x==h: return h+y
elif y==w: return h+w+h-x
else: return h+w+h+w-y
m = iter(xyxy)
res = []
idx = 0
for x... | 56 | 47 | 994 | 713 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline # 文字列入力のときは注意
r, c, n = [int(i) for i in readline().split()]
# xyxy = [[int(i) for i in readline().split()] for _ in range(n)]
# for i,(x1,y1,x2,y2) in enumerate(xyxy):
def addedge(x1, y1):
if y1 == 0:
... | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
h, w, n, *xyxy = list(map(int, read().split()))
def f(x, y):
if y == 0:
return x
elif x == h:
return h + y
elif y == w:
return h + w + h - x
else:
return h + w + h + w - y
... | false | 16.071429 | [
"-sys.setrecursionlimit(10**6)",
"-readline = sys.stdin.readline # 文字列入力のときは注意",
"-r, c, n = [int(i) for i in readline().split()]",
"-# xyxy = [[int(i) for i in readline().split()] for _ in range(n)]",
"-# for i,(x1,y1,x2,y2) in enumerate(xyxy):",
"-def addedge(x1, y1):",
"- if y1 == 0:",
"- ... | false | 0.038521 | 0.043817 | 0.879142 | [
"s909262201",
"s829263412"
] |
u018679195 | p02613 | python | s792437776 | s572654510 | 177 | 91 | 74,064 | 74,144 | Accepted | Accepted | 48.59 | n = int(eval(input()))
c1 = 0
c2 = 0
c3 = 0
c4 = 0
for i in range(n):
verd = eval(input())
if verd == "AC":
c1 += 1
elif verd == "WA":
c2 += 1
elif verd == "TLE":
c3 += 1
else:
c4 += 1
print(("AC x " + str(c1)))
print(("WA x " + str(c2)))
print(("TLE ... | from sys import stdin
from collections import defaultdict
inp = lambda : stdin.readline().strip()
t = int(inp())
d = {"AC":0,"WA":0,"TLE":0,"RE":0}
for _ in range(t):
d[inp()] += 1
for i, j in list(d.items()):
print((i, 'x', j)) | 19 | 11 | 344 | 240 | n = int(eval(input()))
c1 = 0
c2 = 0
c3 = 0
c4 = 0
for i in range(n):
verd = eval(input())
if verd == "AC":
c1 += 1
elif verd == "WA":
c2 += 1
elif verd == "TLE":
c3 += 1
else:
c4 += 1
print(("AC x " + str(c1)))
print(("WA x " + str(c2)))
print(("TLE x " + str(c3)))
p... | from sys import stdin
from collections import defaultdict
inp = lambda: stdin.readline().strip()
t = int(inp())
d = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for _ in range(t):
d[inp()] += 1
for i, j in list(d.items()):
print((i, "x", j))
| false | 42.105263 | [
"-n = int(eval(input()))",
"-c1 = 0",
"-c2 = 0",
"-c3 = 0",
"-c4 = 0",
"-for i in range(n):",
"- verd = eval(input())",
"- if verd == \"AC\":",
"- c1 += 1",
"- elif verd == \"WA\":",
"- c2 += 1",
"- elif verd == \"TLE\":",
"- c3 += 1",
"- else:",
"- ... | false | 0.039312 | 0.076307 | 0.51519 | [
"s792437776",
"s572654510"
] |
u562935282 | p03108 | python | s632691940 | s846968283 | 959 | 811 | 24,048 | 92,140 | Accepted | Accepted | 15.43 | class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
... | class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
... | 58 | 53 | 1,324 | 1,268 | class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(... | class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(... | false | 8.62069 | [
"-n, m = map(int, input().split())",
"-bridges = []",
"-for _ in range(m):",
"- a, b = map(int, input().split())",
"- a -= 1",
"- b -= 1",
"- bridges.append((a, b))",
"-uf = UnionFind(n)",
"-incnv = (n - 1) * n // 2",
"-ans = [None] * m",
"-for i in range(m - 1, -1, -1):",
"- a,... | false | 0.043373 | 0.035902 | 1.208091 | [
"s632691940",
"s846968283"
] |
u990900604 | p02389 | python | s442228995 | s186698626 | 60 | 10 | 9,856 | 4,624 | Accepted | Accepted | 83.33 | import sys
if __name__ == '__main__':
import doctest
doctest.testmod()
a, b = list(map(int, sys.stdin.read().split()))
print(a * b, 2 * (a + b))
| #!/usr/bin/env python
#-*- coding: utf-8 -*-
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C
if __name__ == '__main__':
a, b = list(map(int, input().split()))
print(a * b, 2 * (a + b))
| 7 | 8 | 161 | 219 | import sys
if __name__ == "__main__":
import doctest
doctest.testmod()
a, b = list(map(int, sys.stdin.read().split()))
print(a * b, 2 * (a + b))
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C
if __name__ == "__main__":
a, b = list(map(int, input().split()))
print(a * b, 2 * (a + b))
| false | 12.5 | [
"-import sys",
"-",
"+#!/usr/bin/env python",
"+# -*- coding: utf-8 -*-",
"+# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C",
"- import doctest",
"-",
"- doctest.testmod()",
"- a, b = list(map(int, sys.stdin.read().split()))",
"+ a, b = list(map(int, input().split()... | false | 0.11282 | 0.040464 | 2.78817 | [
"s442228995",
"s186698626"
] |
u025501820 | p02990 | python | s169707647 | s584905046 | 625 | 29 | 3,444 | 3,572 | Accepted | Accepted | 95.36 | N, K = list(map(int, input().split()))
mod = 10 ** 9 + 7
def modinv(x):
return pow(x, mod - 2, mod)
modinv_table = [-1 for _ in range(N + 1)]
for i in range(1, N + 1):
modinv_table[i] = modinv(i)
def cmb(n, k):
ans = 1
for i in range(k):
ans *= n-i
ans *= modinv_table[... | N, K = list(map(int, input().split()))
mod = 10 ** 9 + 7
inv = [pow(i, mod - 2, mod) for i in range(1, N + 1)]
table = []
inv_table = []
tmp = 1
inv_tmp = 1
for i in range(N):
tmp *= (i + 1)
tmp %= mod
table.append(tmp)
inv_tmp *= inv[i]
inv_tmp %= mod
inv_table.append(inv_tmp)
... | 32 | 42 | 667 | 855 | N, K = list(map(int, input().split()))
mod = 10**9 + 7
def modinv(x):
return pow(x, mod - 2, mod)
modinv_table = [-1 for _ in range(N + 1)]
for i in range(1, N + 1):
modinv_table[i] = modinv(i)
def cmb(n, k):
ans = 1
for i in range(k):
ans *= n - i
ans *= modinv_table[i + 1]
... | N, K = list(map(int, input().split()))
mod = 10**9 + 7
inv = [pow(i, mod - 2, mod) for i in range(1, N + 1)]
table = []
inv_table = []
tmp = 1
inv_tmp = 1
for i in range(N):
tmp *= i + 1
tmp %= mod
table.append(tmp)
inv_tmp *= inv[i]
inv_tmp %= mod
inv_table.append(inv_tmp)
def cmb(n, k):
... | false | 23.809524 | [
"-",
"-",
"-def modinv(x):",
"- return pow(x, mod - 2, mod)",
"-",
"-",
"-modinv_table = [-1 for _ in range(N + 1)]",
"-for i in range(1, N + 1):",
"- modinv_table[i] = modinv(i)",
"+inv = [pow(i, mod - 2, mod) for i in range(1, N + 1)]",
"+table = []",
"+inv_table = []",
"+tmp = 1",
... | false | 0.038958 | 0.037604 | 1.035993 | [
"s169707647",
"s584905046"
] |
u266014018 | p02659 | python | s336311514 | s935051034 | 109 | 21 | 27,224 | 9,124 | Accepted | Accepted | 80.73 | from functools import reduce
def main():
import sys
import math
import numpy as np
a,b = list(map(str, input().split()))
a = [int(i) for i in a]
a += [0]*2
a = np.array(a)
b = b.replace('.','')
b = [int(i) for i in b]
ans = a*b[0]
ans[1:] += a[:-1]*b[1]
ans[... | def main():
import sys
import math
a,b = list(map(str, input().split()))
a = int(a)
b = int(b.replace('.',''))
c = a*b//100
print(c)
if __name__ == '__main__':
main() | 21 | 13 | 444 | 215 | from functools import reduce
def main():
import sys
import math
import numpy as np
a, b = list(map(str, input().split()))
a = [int(i) for i in a]
a += [0] * 2
a = np.array(a)
b = b.replace(".", "")
b = [int(i) for i in b]
ans = a * b[0]
ans[1:] += a[:-1] * b[1]
ans[2:]... | def main():
import sys
import math
a, b = list(map(str, input().split()))
a = int(a)
b = int(b.replace(".", ""))
c = a * b // 100
print(c)
if __name__ == "__main__":
main()
| false | 38.095238 | [
"-from functools import reduce",
"-",
"-",
"- import numpy as np",
"- a = [int(i) for i in a]",
"- a += [0] * 2",
"- a = np.array(a)",
"- b = b.replace(\".\", \"\")",
"- b = [int(i) for i in b]",
"- ans = a * b[0]",
"- ans[1:] += a[:-1] * b[1]",
"- ans[2:] += a[:-2] ... | false | 0.425042 | 0.063609 | 6.682129 | [
"s336311514",
"s935051034"
] |
u633068244 | p02255 | python | s609968322 | s776691938 | 20 | 10 | 4,220 | 4,224 | Accepted | Accepted | 50 | n = int(input())
a = list(map(int, input().split()))
print(" ".join(map(str, a)))
for j in range(1,n):
key = a[j]
i = j-1
while i >= 0 and a[i] > key:
a[i+1] = a[i]
i = i - 1
a[i+1] = key
print(" ".join(map(str, a))) | def isort(n,a):
print(" ".join(map(str, a)))
for j in range(1,n):
key = a[j]
i = j-1
while i >= 0 and a[i] > key:
a[i+1] = a[i]
i = i - 1
a[i+1] = key
print(" ".join(map(str, a)))
n = int(input())
a = list(map(int, input().split()))
i... | 11 | 14 | 262 | 329 | n = int(input())
a = list(map(int, input().split()))
print(" ".join(map(str, a)))
for j in range(1, n):
key = a[j]
i = j - 1
while i >= 0 and a[i] > key:
a[i + 1] = a[i]
i = i - 1
a[i + 1] = key
print(" ".join(map(str, a)))
| def isort(n, a):
print(" ".join(map(str, a)))
for j in range(1, n):
key = a[j]
i = j - 1
while i >= 0 and a[i] > key:
a[i + 1] = a[i]
i = i - 1
a[i + 1] = key
print(" ".join(map(str, a)))
n = int(input())
a = list(map(int, input().split()))
isort... | false | 21.428571 | [
"+def isort(n, a):",
"+ print(\" \".join(map(str, a)))",
"+ for j in range(1, n):",
"+ key = a[j]",
"+ i = j - 1",
"+ while i >= 0 and a[i] > key:",
"+ a[i + 1] = a[i]",
"+ i = i - 1",
"+ a[i + 1] = key",
"+ print(\" \".join(map(str, a... | false | 0.044706 | 0.056976 | 0.78464 | [
"s609968322",
"s776691938"
] |
u657361950 | p02234 | python | s481733988 | s517157797 | 130 | 120 | 5,724 | 5,668 | Accepted | Accepted | 7.69 | import sys
def get_min_cost(n, p):
m = [[0 for x in range(n+1)] for x in range(n+1)]
for s in range(n):
i = 1
for j in range(s+2, n+1):
m[i][j] = sys.maxsize
for k in range(i, j):
m[i][j] = min(m[i][j], m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j])
i+=1
return m[1][n]
n = int(eval(input()))
p... |
def mcm(p,n):
m=[[0 for x in range(n+1)] for x in range(n+1)]
for s in range(n):
for i,j in zip(list(range(1,n+1)),list(range(s+2,n+1))):
m[i][j] = 1 << 30
for k in range(i,j):
m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j])
return m[1][n]
n=int(eval(input()))
p=[0]*(n+1)
for i in r... | 26 | 22 | 490 | 449 | import sys
def get_min_cost(n, p):
m = [[0 for x in range(n + 1)] for x in range(n + 1)]
for s in range(n):
i = 1
for j in range(s + 2, n + 1):
m[i][j] = sys.maxsize
for k in range(i, j):
m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p... | def mcm(p, n):
m = [[0 for x in range(n + 1)] for x in range(n + 1)]
for s in range(n):
for i, j in zip(list(range(1, n + 1)), list(range(s + 2, n + 1))):
m[i][j] = 1 << 30
for k in range(i, j):
m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]... | false | 15.384615 | [
"-import sys",
"-",
"-",
"-def get_min_cost(n, p):",
"+def mcm(p, n):",
"- i = 1",
"- for j in range(s + 2, n + 1):",
"- m[i][j] = sys.maxsize",
"+ for i, j in zip(list(range(1, n + 1)), list(range(s + 2, n + 1))):",
"+ m[i][j] = 1 << 30",
"- ... | false | 0.081745 | 0.047041 | 1.737728 | [
"s481733988",
"s517157797"
] |
u368796742 | p02612 | python | s009847667 | s256597157 | 32 | 26 | 9,148 | 9,088 | Accepted | Accepted | 18.75 | n = int(eval(input()))
if n%1000 == 0:
print((0))
else:
print((1000-n%1000)) | n = int(eval(input()))
print(((1000-n%1000)%1000)) | 5 | 2 | 78 | 43 | n = int(eval(input()))
if n % 1000 == 0:
print((0))
else:
print((1000 - n % 1000))
| n = int(eval(input()))
print(((1000 - n % 1000) % 1000))
| false | 60 | [
"-if n % 1000 == 0:",
"- print((0))",
"-else:",
"- print((1000 - n % 1000))",
"+print(((1000 - n % 1000) % 1000))"
] | false | 0.035893 | 0.036032 | 0.996138 | [
"s009847667",
"s256597157"
] |
u025287757 | p03426 | python | s131729957 | s758336523 | 1,095 | 447 | 65,020 | 22,864 | Accepted | Accepted | 59.18 | def main():
H, W, D = list(map(int, input().split()))
num = [[] for _ in range(H*W)]
for i in range(H):
temp = list(map(int, input().split()))
for j in range(len(temp)):
num[temp[j]-1] = [i, j]
#num = np.array(num)
num_sum = [0]*(H*W)
for i in range(D, H*W):
num_sum[i] = num_sum... | def main():
H, W, D = map(int, input().split())
num = [[] for _ in range(H*W)]
for i in range(H):
temp = list(map(int, input().split()))
for j in range(len(temp)):
num[temp[j]-1] = [i, j]
#num = np.array(num)
num_sum = [0]*(H*W)
for i in range(D, H*W):
num_sum[i] = num_sum[i-D] ... | 17 | 19 | 534 | 576 | def main():
H, W, D = list(map(int, input().split()))
num = [[] for _ in range(H * W)]
for i in range(H):
temp = list(map(int, input().split()))
for j in range(len(temp)):
num[temp[j] - 1] = [i, j]
# num = np.array(num)
num_sum = [0] * (H * W)
for i in range(D, H * W)... | def main():
H, W, D = map(int, input().split())
num = [[] for _ in range(H * W)]
for i in range(H):
temp = list(map(int, input().split()))
for j in range(len(temp)):
num[temp[j] - 1] = [i, j]
# num = np.array(num)
num_sum = [0] * (H * W)
for i in range(D, H * W):
... | false | 10.526316 | [
"- H, W, D = list(map(int, input().split()))",
"+ H, W, D = map(int, input().split())",
"- Q = int(eval(input()))",
"+ Q = int(input())",
"+ ans = []",
"- L, R = list(map(int, input().split()))",
"- print((num_sum[R - 1] - num_sum[L - 1]))",
"+ L, R = map(int, input... | false | 0.035732 | 0.035791 | 0.998338 | [
"s131729957",
"s758336523"
] |
u410269178 | p02725 | python | s483296231 | s395218496 | 185 | 170 | 26,444 | 26,436 | Accepted | Accepted | 8.11 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d = [None] * n
sum = 0
for i in range(n):
if i == n-1:
d[n-1] = k - a[n-1] + a[0]
else:
d[i] = a[i+1] - a[i]
sum += d[i]
ans = 2 * 10**11
for i in range(n):
if sum - d[i] < ans:
ans = sum - ... | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d = [None] * n
sum = 0
for i in range(n):
if i == n-1:
d[n-1] = k - a[n-1] + a[0]
else:
d[i] = a[i+1] - a[i]
sum += d[i]
print((sum - max(d))) | 16 | 12 | 330 | 249 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d = [None] * n
sum = 0
for i in range(n):
if i == n - 1:
d[n - 1] = k - a[n - 1] + a[0]
else:
d[i] = a[i + 1] - a[i]
sum += d[i]
ans = 2 * 10**11
for i in range(n):
if sum - d[i] < ans:
ans = sum - d[i]
pr... | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d = [None] * n
sum = 0
for i in range(n):
if i == n - 1:
d[n - 1] = k - a[n - 1] + a[0]
else:
d[i] = a[i + 1] - a[i]
sum += d[i]
print((sum - max(d)))
| false | 25 | [
"-ans = 2 * 10**11",
"-for i in range(n):",
"- if sum - d[i] < ans:",
"- ans = sum - d[i]",
"-print(ans)",
"+print((sum - max(d)))"
] | false | 0.064532 | 0.064971 | 0.993238 | [
"s483296231",
"s395218496"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.