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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u428199834 | p02845 | python | s299638353 | s723044178 | 129 | 110 | 20,688 | 20,628 | Accepted | Accepted | 14.73 | n=int(eval(input()))
a=list(map(int,input().split()))
a_=max(a)
con=[0]*(a_+1)
tou=[0]*(a_+1)
ans=[]
for i in range(len(a)):
u=a[i]
if u==0:
con[0]+=1
tou[0]+=1
ans.append(4-con[0])
else:
con[u]+=1
tou[u]+=1
ans.append(min(tou[u-1]-con[u]+1... | n=int(eval(input()))
a=list(map(int,input().split()))
a_=max(a)
con=[0]*(a_+1)
tou=[0]*(a_+1)
ans=[]
for i in range(len(a)):
u=a[i]
if u==0:
con[0]+=1
tou[0]+=1
ans.append(4-con[0])
else:
con[u]+=1
tou[u]+=1
ans.append(tou[u-1]-con[u]+1)
c... | 23 | 23 | 417 | 403 | n = int(eval(input()))
a = list(map(int, input().split()))
a_ = max(a)
con = [0] * (a_ + 1)
tou = [0] * (a_ + 1)
ans = []
for i in range(len(a)):
u = a[i]
if u == 0:
con[0] += 1
tou[0] += 1
ans.append(4 - con[0])
else:
con[u] += 1
tou[u] += 1
ans.append(min(to... | n = int(eval(input()))
a = list(map(int, input().split()))
a_ = max(a)
con = [0] * (a_ + 1)
tou = [0] * (a_ + 1)
ans = []
for i in range(len(a)):
u = a[i]
if u == 0:
con[0] += 1
tou[0] += 1
ans.append(4 - con[0])
else:
con[u] += 1
tou[u] += 1
ans.append(tou[u ... | false | 0 | [
"- ans.append(min(tou[u - 1] - con[u] + 1, 4 - con[u]))",
"+ ans.append(tou[u - 1] - con[u] + 1)"
] | false | 0.040729 | 0.040565 | 1.00404 | [
"s299638353",
"s723044178"
] |
u499381410 | p03008 | python | s407274598 | s114875504 | 1,717 | 1,336 | 422,960 | 230,424 | Accepted | Accepted | 22.19 | def dfs():
n = int(eval(input()))
weight = list(map(int, input().split()))
value = list(map(int, input().split()))
def knapsack(n, weight, value):
dp = [i for i in range(n+1)]
for i in range(3):
for j in range(weight[i], n+1):
dp[j] = max(d... | # W
# N K
# A1 B1
# A2 B2
# :
# AN BN
n = int(eval(input()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
dp = list(range(n + 1))
for ci in range(3):
for wi in range(a_list[ci], n + 1):
dp[wi] = max(dp[wi - a_list[ci]] + b_list[ci], dp[wi])
n... | 19 | 33 | 510 | 501 | def dfs():
n = int(eval(input()))
weight = list(map(int, input().split()))
value = list(map(int, input().split()))
def knapsack(n, weight, value):
dp = [i for i in range(n + 1)]
for i in range(3):
for j in range(weight[i], n + 1):
dp[j] = max(dp[j], dp[j - we... | # W
# N K
# A1 B1
# A2 B2
# :
# AN BN
n = int(eval(input()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
dp = list(range(n + 1))
for ci in range(3):
for wi in range(a_list[ci], n + 1):
dp[wi] = max(dp[wi - a_list[ci]] + b_list[ci], dp[wi])
n = dp[-1]
dp = list(range(n +... | false | 42.424242 | [
"-def dfs():",
"- n = int(eval(input()))",
"- weight = list(map(int, input().split()))",
"- value = list(map(int, input().split()))",
"-",
"- def knapsack(n, weight, value):",
"- dp = [i for i in range(n + 1)]",
"- for i in range(3):",
"- for j in range(weight[i]... | false | 0.048757 | 0.165116 | 0.295289 | [
"s407274598",
"s114875504"
] |
u893962649 | p03494 | python | s978730668 | s140537080 | 28 | 25 | 9,152 | 9,180 | Accepted | Accepted | 10.71 | N = int(eval(input()))
A = list(map(int, input().split()))
j=0
while True:
i=0
for a in A:
if a%2 == 0:
A[i]=a//2
else:
break
i+=1
if i != N:
break
j +=1
print(j) | def calc(a):
ans=0
while a%2==0:
a/=2
ans+=1
return ans
N = int(eval(input()))
A = list(map(int, input().split()))
print((min(list(map(calc, A))))) | 17 | 13 | 212 | 169 | N = int(eval(input()))
A = list(map(int, input().split()))
j = 0
while True:
i = 0
for a in A:
if a % 2 == 0:
A[i] = a // 2
else:
break
i += 1
if i != N:
break
j += 1
print(j)
| def calc(a):
ans = 0
while a % 2 == 0:
a /= 2
ans += 1
return ans
N = int(eval(input()))
A = list(map(int, input().split()))
print((min(list(map(calc, A)))))
| false | 23.529412 | [
"+def calc(a):",
"+ ans = 0",
"+ while a % 2 == 0:",
"+ a /= 2",
"+ ans += 1",
"+ return ans",
"+",
"+",
"-j = 0",
"-while True:",
"- i = 0",
"- for a in A:",
"- if a % 2 == 0:",
"- A[i] = a // 2",
"- else:",
"- break",
... | false | 0.033234 | 0.044868 | 0.740701 | [
"s978730668",
"s140537080"
] |
u562016607 | p03276 | python | s124972689 | s736774934 | 122 | 104 | 14,844 | 14,228 | Accepted | Accepted | 14.75 | N,K=list(map(int,input().split()))
x=[int(i) for i in input().split()]
ans=10**9
A=[]
B=[]
for i in range(N):
if x[i]>=0:
A.append(x[i])
else:
B.append(-x[i])
B=B[::-1]
if len(A)>=K:
ans=min([ans,A[K-1]])
if len(B)>=K:
ans=min([ans,B[K-1]])
C=len(A)
D=len(B)
for i in ran... | N,K=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=10**9
for i in range(N-K+1):
tmp1=abs(x[i])+abs(x[i]-x[i+K-1])
tmp2=abs(x[i+K-1])+abs(x[i]-x[i+K-1])
ans=min([ans,tmp1,tmp2])
print(ans)
| 23 | 8 | 468 | 222 | N, K = list(map(int, input().split()))
x = [int(i) for i in input().split()]
ans = 10**9
A = []
B = []
for i in range(N):
if x[i] >= 0:
A.append(x[i])
else:
B.append(-x[i])
B = B[::-1]
if len(A) >= K:
ans = min([ans, A[K - 1]])
if len(B) >= K:
ans = min([ans, B[K - 1]])
C = len(A)
D = le... | N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(N - K + 1):
tmp1 = abs(x[i]) + abs(x[i] - x[i + K - 1])
tmp2 = abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1])
ans = min([ans, tmp1, tmp2])
print(ans)
| false | 65.217391 | [
"-x = [int(i) for i in input().split()]",
"+x = list(map(int, input().split()))",
"-A = []",
"-B = []",
"-for i in range(N):",
"- if x[i] >= 0:",
"- A.append(x[i])",
"- else:",
"- B.append(-x[i])",
"-B = B[::-1]",
"-if len(A) >= K:",
"- ans = min([ans, A[K - 1]])",
"-i... | false | 0.049445 | 0.160888 | 0.307327 | [
"s124972689",
"s736774934"
] |
u729939940 | p02701 | python | s165484819 | s332681786 | 112 | 92 | 41,780 | 39,132 | Accepted | Accepted | 17.86 | import sys
from collections import Counter
N = int(eval(input()))
S = [str(s) for s in sys.stdin.read().split()]
items = list(dict.fromkeys(S))
print((len(items))) | import sys
N = int(eval(input()))
S = [str(s) for s in sys.stdin.read().split()]
print((len(set(S)))) | 6 | 4 | 160 | 96 | import sys
from collections import Counter
N = int(eval(input()))
S = [str(s) for s in sys.stdin.read().split()]
items = list(dict.fromkeys(S))
print((len(items)))
| import sys
N = int(eval(input()))
S = [str(s) for s in sys.stdin.read().split()]
print((len(set(S))))
| false | 33.333333 | [
"-from collections import Counter",
"-items = list(dict.fromkeys(S))",
"-print((len(items)))",
"+print((len(set(S))))"
] | false | 0.04866 | 0.050425 | 0.965003 | [
"s165484819",
"s332681786"
] |
u372144784 | p02631 | python | s246410267 | s779606542 | 153 | 138 | 111,704 | 110,992 | Accepted | Accepted | 9.8 | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
全員が自分以外の全員のxorを把握しているので、全員の値を求めよ
nは偶数
桁ごとに独立に考える。
テストケースで検証すると、
その桁において1の数が偶数個の場合は、自分自身の桁の数字を入れる
奇数個の場合は、自分自身の桁の値をbit反転したものを入れる
ことが正解であることが分かる。
これを実装するだけ。
"""
n = int(readline())
lst1 = list(map(int,readline().spl... | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))
res = 0
for i in lst1:
res = res^i
ans = []
for i in lst1:
ans.append(res^i)
print((*ans)) | 23 | 12 | 430 | 255 | import sys
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
"""
全員が自分以外の全員のxorを把握しているので、全員の値を求めよ
nは偶数
桁ごとに独立に考える。
テストケースで検証すると、
その桁において1の数が偶数個の場合は、自分自身の桁の数字を入れる
奇数個の場合は、自分自身の桁の値をbit反転したものを入れる
ことが正解であることが分かる。
これを実装するだけ。
"""
n = int(readline())
lst1 = list(map(int, readline().split... | import sys
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
n = int(readline())
lst1 = list(map(int, readline().split()))
res = 0
for i in lst1:
res = res ^ i
ans = []
for i in lst1:
ans.append(res ^ i)
print((*ans))
| false | 47.826087 | [
"-\"\"\"",
"-全員が自分以外の全員のxorを把握しているので、全員の値を求めよ",
"-nは偶数",
"-桁ごとに独立に考える。",
"-テストケースで検証すると、",
"-その桁において1の数が偶数個の場合は、自分自身の桁の数字を入れる",
"-奇数個の場合は、自分自身の桁の値をbit反転したものを入れる",
"-ことが正解であることが分かる。",
"-これを実装するだけ。",
"-\"\"\""
] | false | 0.039442 | 0.097102 | 0.406196 | [
"s246410267",
"s779606542"
] |
u672475305 | p03846 | python | s934238681 | s910402795 | 92 | 63 | 17,756 | 14,820 | Accepted | Accepted | 31.52 | from collections import Counter
n = int(eval(input()))
lst = [int(i) for i in input().split()]
mod = 10**9 + 7
lst_c = Counter(lst)
lst_c = sorted(list(lst_c.items()),key = lambda x:x[0])
ideal = []
if n%2!=0:
ideal.append((0,1))
for i in range(1,n//2+1):
ideal.append((2*i,2))
else:
... | from collections import Counter
n = int(eval(input()))
A = list(map(int,input().split()))
mod = 10**9 + 7
c = Counter(A)
flg = True
for k,v in list(c.items()):
if k==0:
if v!=1:
flg = False
else:
if v!=2:
flg = False
if flg is False:
print((0))
else:
... | 24 | 17 | 480 | 333 | from collections import Counter
n = int(eval(input()))
lst = [int(i) for i in input().split()]
mod = 10**9 + 7
lst_c = Counter(lst)
lst_c = sorted(list(lst_c.items()), key=lambda x: x[0])
ideal = []
if n % 2 != 0:
ideal.append((0, 1))
for i in range(1, n // 2 + 1):
ideal.append((2 * i, 2))
else:
fo... | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
c = Counter(A)
flg = True
for k, v in list(c.items()):
if k == 0:
if v != 1:
flg = False
else:
if v != 2:
flg = False
if flg is False:
print((0))
else:
prin... | false | 29.166667 | [
"-lst = [int(i) for i in input().split()]",
"+A = list(map(int, input().split()))",
"-lst_c = Counter(lst)",
"-lst_c = sorted(list(lst_c.items()), key=lambda x: x[0])",
"-ideal = []",
"-if n % 2 != 0:",
"- ideal.append((0, 1))",
"- for i in range(1, n // 2 + 1):",
"- ideal.append((2 * i... | false | 0.110075 | 0.061653 | 1.785388 | [
"s934238681",
"s910402795"
] |
u759412327 | p03037 | python | s804011658 | s507407307 | 480 | 206 | 29,212 | 16,656 | Accepted | Accepted | 57.08 | import numpy as np
N,M = list(map(int,input().split()))
A = (N+2)*[0]
for m in range(M):
L,R = list(map(int,input().split()))
A[L]+=1
A[R+1]-=1
A = np.cumsum(A)
print((sum(a==M for a in A))) | N,M = list(map(int,input().split()))
L = []
R = []
for m in range(M):
l,r = list(map(int,input().split()))
L+=[l]
R+=[r]
print((max(0,min(R)-max(L)+1))) | 11 | 10 | 194 | 155 | import numpy as np
N, M = list(map(int, input().split()))
A = (N + 2) * [0]
for m in range(M):
L, R = list(map(int, input().split()))
A[L] += 1
A[R + 1] -= 1
A = np.cumsum(A)
print((sum(a == M for a in A)))
| N, M = list(map(int, input().split()))
L = []
R = []
for m in range(M):
l, r = list(map(int, input().split()))
L += [l]
R += [r]
print((max(0, min(R) - max(L) + 1)))
| false | 9.090909 | [
"-import numpy as np",
"-",
"-A = (N + 2) * [0]",
"+L = []",
"+R = []",
"- L, R = list(map(int, input().split()))",
"- A[L] += 1",
"- A[R + 1] -= 1",
"-A = np.cumsum(A)",
"-print((sum(a == M for a in A)))",
"+ l, r = list(map(int, input().split()))",
"+ L += [l]",
"+ R += [... | false | 0.53124 | 0.045325 | 11.72079 | [
"s804011658",
"s507407307"
] |
u714378447 | p03379 | python | s875474163 | s492978804 | 414 | 318 | 93,780 | 26,772 | Accepted | Accepted | 23.19 | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = sorted(A)
l = B[N//2 -1]
r = B[N//2]
for a in A:
if a<=l:
print(r)
else:
print(l)
| N = int(eval(input()))
A = [int(x) for x in input().split()]
B = sorted(A)
l = B[N//2 -1]
r = B[N//2]
for a in A:
if a<r:
print(r)
else:
print(l)
| 14 | 14 | 173 | 172 | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = sorted(A)
l = B[N // 2 - 1]
r = B[N // 2]
for a in A:
if a <= l:
print(r)
else:
print(l)
| N = int(eval(input()))
A = [int(x) for x in input().split()]
B = sorted(A)
l = B[N // 2 - 1]
r = B[N // 2]
for a in A:
if a < r:
print(r)
else:
print(l)
| false | 0 | [
"- if a <= l:",
"+ if a < r:"
] | false | 0.192002 | 0.085473 | 2.246338 | [
"s875474163",
"s492978804"
] |
u729133443 | p02954 | python | s743791293 | s154964305 | 190 | 174 | 5,516 | 10,248 | Accepted | Accepted | 8.42 | from itertools import*
s=(len(list(t))for _,t in groupby(eval(input())))
for r,l in zip(s,s):t=-~r//2+l//2;print((*[0]*~-r+[t,r+l-t]+[0]*~-l)) | d=[i+(c>'L'or-1)for i,c in enumerate(eval(input()))]
exec('d=[d[i]for i in d];'*19)
a=[0]*len(d)
for i in d:a[i]+=1
print((*a)) | 3 | 5 | 136 | 123 | from itertools import *
s = (len(list(t)) for _, t in groupby(eval(input())))
for r, l in zip(s, s):
t = -~r // 2 + l // 2
print((*[0] * ~-r + [t, r + l - t] + [0] * ~-l))
| d = [i + (c > "L" or -1) for i, c in enumerate(eval(input()))]
exec("d=[d[i]for i in d];" * 19)
a = [0] * len(d)
for i in d:
a[i] += 1
print((*a))
| false | 40 | [
"-from itertools import *",
"-",
"-s = (len(list(t)) for _, t in groupby(eval(input())))",
"-for r, l in zip(s, s):",
"- t = -~r // 2 + l // 2",
"- print((*[0] * ~-r + [t, r + l - t] + [0] * ~-l))",
"+d = [i + (c > \"L\" or -1) for i, c in enumerate(eval(input()))]",
"+exec(\"d=[d[i]for i in d];... | false | 0.086367 | 0.0785 | 1.100216 | [
"s743791293",
"s154964305"
] |
u606045429 | p03148 | python | s442818356 | s891146857 | 405 | 312 | 32,964 | 32,964 | Accepted | Accepted | 22.96 | from heapq import heappush, heappop, heapreplace
INF = 10 ** 9 + 5
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
else:
e.append(-INF)
E.sort(key=lamb... | from heapq import heappush, heapreplace
def main():
INF = 10 ** 9 + 5
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
else:
... | 40 | 42 | 726 | 853 | from heapq import heappush, heappop, heapreplace
INF = 10**9 + 5
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
else:
e.append(-INF)
E.sort(key=lambda x: -x[0])
cur = 0... | from heapq import heappush, heapreplace
def main():
INF = 10**9 + 5
N, K, *TD = list(map(int, open(0).read().split()))
E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
E[t - 1].append(d)
for e in E:
if e:
e.sort(reverse=True)
else:
e.appe... | false | 4.761905 | [
"-from heapq import heappush, heappop, heapreplace",
"+from heapq import heappush, heapreplace",
"-INF = 10**9 + 5",
"-N, K, *TD = list(map(int, open(0).read().split()))",
"-E = [[] for _ in range(N)]",
"-for t, d in zip(*[iter(TD)] * 2):",
"- E[t - 1].append(d)",
"-for e in E:",
"- if e:",
... | false | 0.036044 | 0.035895 | 1.004143 | [
"s442818356",
"s891146857"
] |
u859987056 | p03999 | python | s835791480 | s967239944 | 33 | 30 | 9,056 | 9,024 | Accepted | Accepted | 9.09 | S = eval(input())
n = len(S)
ans = 0
for bit in range(1 << (n-1)):
tmp = S[0]
for i in range(n-1):
if bit & (1 << i):
tmp += "+"
tmp += S[i+1]
ans += sum(map(int, tmp.split("+")))
print(ans) | s = eval(input())
n = len(s)
def dfs(i,tmp):
if i == n-1:
return sum(list(map(int,tmp.split("+"))))
return dfs(i+1, tmp+s[i+1]) + dfs(i+1,tmp+"+"+s[i+1])
print((dfs(0,s[0]))) | 14 | 10 | 244 | 198 | S = eval(input())
n = len(S)
ans = 0
for bit in range(1 << (n - 1)):
tmp = S[0]
for i in range(n - 1):
if bit & (1 << i):
tmp += "+"
tmp += S[i + 1]
ans += sum(map(int, tmp.split("+")))
print(ans)
| s = eval(input())
n = len(s)
def dfs(i, tmp):
if i == n - 1:
return sum(list(map(int, tmp.split("+"))))
return dfs(i + 1, tmp + s[i + 1]) + dfs(i + 1, tmp + "+" + s[i + 1])
print((dfs(0, s[0])))
| false | 28.571429 | [
"-S = eval(input())",
"-n = len(S)",
"-ans = 0",
"-for bit in range(1 << (n - 1)):",
"- tmp = S[0]",
"- for i in range(n - 1):",
"- if bit & (1 << i):",
"- tmp += \"+\"",
"- tmp += S[i + 1]",
"- ans += sum(map(int, tmp.split(\"+\")))",
"-print(ans)",
"+s = eva... | false | 0.047386 | 0.061136 | 0.77509 | [
"s835791480",
"s967239944"
] |
u413021823 | p02844 | python | s233817463 | s614374796 | 346 | 29 | 41,068 | 9,304 | Accepted | Accepted | 91.62 | import sys
from collections import deque
from itertools import *
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
... | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
s = S()
ans = 0
for i in range(1000):
num = str(i).zfill... | 32 | 23 | 613 | 560 | import sys
from collections import deque
from itertools import *
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def S():
return sys.stdin.readline().rstrip()
def LS():
return list(sys.stdin.readline().rstrip().split())
... | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def S():
return sys.stdin.readline().rstrip()
def LS():
return list(sys.stdin.readline().rstrip().split())
N = I()
s = S()
ans = 0
for i in range(1000):
num ... | false | 28.125 | [
"-from collections import deque",
"-from itertools import *",
"-n = I()",
"+N = I()",
"- t = str(i).zfill(3)",
"- t_index = 0",
"- for s_index in range(n):",
"- if s[s_index] == t[t_index]:",
"- t_index += 1",
"- if t_index == 3:",
"- break",
... | false | 0.046611 | 0.006827 | 6.826951 | [
"s233817463",
"s614374796"
] |
u359358631 | p03013 | python | s679354874 | s317252558 | 572 | 180 | 500,984 | 70,748 | Accepted | Accepted | 68.53 | def main():
n, m = list(map(int, input().split()))
dp = [0] * (n + 1)
dp[0] = 1
for _ in range(m):
a = int(eval(input()))
dp[a] = -1
mod = 10 ** 9 + 7
for i in range(n + 1):
if dp[i] == 0:
if i - 1 >= 0 and dp[i - 1] != -1:
dp[i] +... | def main():
n, m = list(map(int, input().split()))
dp = [0] * (n + 1)
dp[0] = 1
for _ in range(m):
a = int(eval(input()))
dp[a] = -1
mod = 10 ** 9 + 7
for i in range(n + 1):
if dp[i] != -1:
if i + 1 <= n and dp[i + 1] != -1:
dp[i +... | 21 | 21 | 475 | 514 | def main():
n, m = list(map(int, input().split()))
dp = [0] * (n + 1)
dp[0] = 1
for _ in range(m):
a = int(eval(input()))
dp[a] = -1
mod = 10**9 + 7
for i in range(n + 1):
if dp[i] == 0:
if i - 1 >= 0 and dp[i - 1] != -1:
dp[i] += dp[i - 1]
... | def main():
n, m = list(map(int, input().split()))
dp = [0] * (n + 1)
dp[0] = 1
for _ in range(m):
a = int(eval(input()))
dp[a] = -1
mod = 10**9 + 7
for i in range(n + 1):
if dp[i] != -1:
if i + 1 <= n and dp[i + 1] != -1:
dp[i + 1] = (dp[i + 1... | false | 0 | [
"- if dp[i] == 0:",
"- if i - 1 >= 0 and dp[i - 1] != -1:",
"- dp[i] += dp[i - 1]",
"- if i - 2 >= 0 and dp[i - 2] != -1:",
"- dp[i] += dp[i - 2]",
"+ if dp[i] != -1:",
"+ if i + 1 <= n and dp[i + 1] != -1:",
"+ ... | false | 0.03385 | 0.035742 | 0.947056 | [
"s679354874",
"s317252558"
] |
u628335443 | p03162 | python | s442001246 | s314983266 | 1,856 | 1,077 | 56,224 | 56,144 | Accepted | Accepted | 41.97 | import numpy as np
N = int(eval(input()))
# a = np.array([int(i) for i in input().split()])
a = np.array([input().split() for i in range(N)], dtype=int)
dp = np.zeros((N, 3), dtype=int)
dp[0] = a[0]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j == k:
... | import numpy as np
N = int(eval(input()))
a = np.array([input().split() for i in range(N)], dtype=int)
dp = np.zeros((N, 3), dtype=int)
dp[0] = a[0]
for i in range(1, N):
dp[i] = [
a[i][0] + max(dp[i - 1][1], dp[i - 1][2]),
a[i][1] + max(dp[i - 1][2], dp[i - 1][0]),
a[i][2] + ... | 17 | 16 | 414 | 379 | import numpy as np
N = int(eval(input()))
# a = np.array([int(i) for i in input().split()])
a = np.array([input().split() for i in range(N)], dtype=int)
dp = np.zeros((N, 3), dtype=int)
dp[0] = a[0]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j == k:
continue
... | import numpy as np
N = int(eval(input()))
a = np.array([input().split() for i in range(N)], dtype=int)
dp = np.zeros((N, 3), dtype=int)
dp[0] = a[0]
for i in range(1, N):
dp[i] = [
a[i][0] + max(dp[i - 1][1], dp[i - 1][2]),
a[i][1] + max(dp[i - 1][2], dp[i - 1][0]),
a[i][2] + max(dp[i - 1][... | false | 5.882353 | [
"-# a = np.array([int(i) for i in input().split()])",
"- for j in range(3):",
"- for k in range(3):",
"- if j == k:",
"- continue",
"- dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i][k])",
"+ dp[i] = [",
"+ a[i][0] + max(dp[i - 1][1], dp[i - 1][2])... | false | 0.257008 | 0.27003 | 0.951775 | [
"s442001246",
"s314983266"
] |
u937092222 | p03078 | python | s157883097 | s024459300 | 1,777 | 771 | 207,944 | 4,468 | Accepted | Accepted | 56.61 | x,y,z,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
b=sorted(list(map(int,input().split())),reverse=True)
c=sorted(list(map(int,input().split())),reverse=True)
ab=[i+j for j in b for i in a]
ab.sort(reverse=True)
abc=[i+j for j in c[:k] for i in ab[:k]]
abc.sort(reverse=True)... | import heapq
x,y,z,k = list(map(int,input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
al = []
hq = []
heapq.heappush(hq,(-(a[0]+b[0]+c[0]),0,0,0))
for i in range(... | 11 | 24 | 349 | 799 | x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)
ab = [i + j for j in b for i in a]
ab.sort(reverse=True)
abc = [i + j for j in c[:k] for i in ab[:k]]
abc.s... | import heapq
x, y, z, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
al = []
hq = []
heapq.heappush(hq, (-(a[0] + b[0] + c[0]), 0, 0, 0))
for i in range(... | false | 54.166667 | [
"-x, y, z, k = map(int, input().split())",
"-a = sorted(list(map(int, input().split())), reverse=True)",
"-b = sorted(list(map(int, input().split())), reverse=True)",
"-c = sorted(list(map(int, input().split())), reverse=True)",
"-ab = [i + j for j in b for i in a]",
"-ab.sort(reverse=True)",
"-abc = [i... | false | 0.034721 | 0.035655 | 0.973821 | [
"s157883097",
"s024459300"
] |
u533713111 | p04043 | python | s708870556 | s608203000 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | A,B,C = list(map(int,input().split()))
if A == 5 and B == 5 and C == 7:
print('YES')
elif (A == 5 and B == 7 and C == 5):
print('YES')
elif (A == 7 and B == 5 and C == 5):
print('YES')
else:print('NO') | L = list(map(int,input().split()))
L.sort()
if L == [5,5,7]:
print('YES')
else:print('NO') | 8 | 5 | 208 | 96 | A, B, C = list(map(int, input().split()))
if A == 5 and B == 5 and C == 7:
print("YES")
elif A == 5 and B == 7 and C == 5:
print("YES")
elif A == 7 and B == 5 and C == 5:
print("YES")
else:
print("NO")
| L = list(map(int, input().split()))
L.sort()
if L == [5, 5, 7]:
print("YES")
else:
print("NO")
| false | 37.5 | [
"-A, B, C = list(map(int, input().split()))",
"-if A == 5 and B == 5 and C == 7:",
"- print(\"YES\")",
"-elif A == 5 and B == 7 and C == 5:",
"- print(\"YES\")",
"-elif A == 7 and B == 5 and C == 5:",
"+L = list(map(int, input().split()))",
"+L.sort()",
"+if L == [5, 5, 7]:"
] | false | 0.073401 | 0.113324 | 0.647707 | [
"s708870556",
"s608203000"
] |
u838644735 | p03645 | python | s241980430 | s838201160 | 1,241 | 1,078 | 100,952 | 101,080 | Accepted | Accepted | 13.13 | N, M = list(map(int, input().split()))
T = {}
for i in range(M):
a, b = list(map(int, input().split()))
if a not in T:
T[a] = []
T[a].append(b)
if b not in T:
T[b] = []
T[b].append(a)
# print(N, M, T)
FROM_1 = T[1]
for f in FROM_1:
if N in T[f]:
print('POS... | def solve():
N, M = list(map(int, input().split()))
T = {}
for i in range(M):
a, b = list(map(int, input().split()))
if a not in T:
T[a] = []
T[a].append(b)
if b not in T:
T[b] = []
T[b].append(a)
# print(N, M, T)
FROM_1 = T... | 18 | 22 | 353 | 478 | N, M = list(map(int, input().split()))
T = {}
for i in range(M):
a, b = list(map(int, input().split()))
if a not in T:
T[a] = []
T[a].append(b)
if b not in T:
T[b] = []
T[b].append(a)
# print(N, M, T)
FROM_1 = T[1]
for f in FROM_1:
if N in T[f]:
print("POSSIBLE")
... | def solve():
N, M = list(map(int, input().split()))
T = {}
for i in range(M):
a, b = list(map(int, input().split()))
if a not in T:
T[a] = []
T[a].append(b)
if b not in T:
T[b] = []
T[b].append(a)
# print(N, M, T)
FROM_1 = T[1]
for ... | false | 18.181818 | [
"-N, M = list(map(int, input().split()))",
"-T = {}",
"-for i in range(M):",
"- a, b = list(map(int, input().split()))",
"- if a not in T:",
"- T[a] = []",
"- T[a].append(b)",
"- if b not in T:",
"- T[b] = []",
"- T[b].append(a)",
"-# print(N, M, T)",
"-FROM_1 = T[... | false | 0.128165 | 0.037386 | 3.428182 | [
"s241980430",
"s838201160"
] |
u216928054 | p02558 | python | s984112993 | s455121729 | 479 | 430 | 81,512 | 82,336 | Accepted | Accepted | 10.23 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
# dsu / UnionFind
def init_unionfind(N):
global parent, rank
parent = [-1] * N
rank = [0] * N
def find_root(x):
p = parent[x]
if p == -1:
re... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
# dsu / UnionFind
def init_unionfind(N):
global parent, rank
parent = [-1] * N
rank = [0] * N
def find_root(x):
p = parent[x]
if p == -1:
re... | 133 | 124 | 2,090 | 1,994 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10**9 + 1 # sys.maxsize # float("inf")
MOD = 10**9 + 7
# dsu / UnionFind
def init_unionfind(N):
global parent, rank
parent = [-1] * N
rank = [0] * N
def find_root(x):
p = parent[x]
if p == -1:
return x
p2 = find_roo... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10**9 + 1 # sys.maxsize # float("inf")
MOD = 10**9 + 7
# dsu / UnionFind
def init_unionfind(N):
global parent, rank
parent = [-1] * N
rank = [0] * N
def find_root(x):
p = parent[x]
if p == -1:
return x
p2 = find_roo... | false | 6.766917 | [
"-def init(n):",
"- init_unionfind(n)",
"-",
"-",
"-def merge(a, b):",
"- unite(a, b)",
"- # FIXME: return value",
"-",
"-",
"-def same(a, b):",
"- return is_connected(a, b)",
"-",
"-",
"-def leader(a):",
"- return find_root(a)",
"+init = init_unionfind",
"+merge = uni... | false | 0.045593 | 0.036919 | 1.234961 | [
"s984112993",
"s455121729"
] |
u022979415 | p03038 | python | s129746056 | s110832071 | 588 | 515 | 43,040 | 45,148 | Accepted | Accepted | 12.41 | def main():
n, m = list(map(int, input().split()))
a = [int(x) for x in input().split()]
cards = {}
for aa in a:
if aa in cards:
cards[aa] += 1
else:
cards[aa] = 1
for _ in range(m):
b, c = list(map(int, input().split()))
if c in car... | from collections import Counter
def main():
n, m = list(map(int, input().split()))
a = Counter(list(map(int, input().split())))
cards = []
for i, v in list(a.items()):
cards.append([i, v])
for _ in range(m):
cards.append(list(map(int, input().split()))[::-1])
cards.s... | 29 | 22 | 689 | 499 | def main():
n, m = list(map(int, input().split()))
a = [int(x) for x in input().split()]
cards = {}
for aa in a:
if aa in cards:
cards[aa] += 1
else:
cards[aa] = 1
for _ in range(m):
b, c = list(map(int, input().split()))
if c in cards:
... | from collections import Counter
def main():
n, m = list(map(int, input().split()))
a = Counter(list(map(int, input().split())))
cards = []
for i, v in list(a.items()):
cards.append([i, v])
for _ in range(m):
cards.append(list(map(int, input().split()))[::-1])
cards.sort(key=lam... | false | 24.137931 | [
"+from collections import Counter",
"+",
"+",
"- a = [int(x) for x in input().split()]",
"- cards = {}",
"- for aa in a:",
"- if aa in cards:",
"- cards[aa] += 1",
"- else:",
"- cards[aa] = 1",
"+ a = Counter(list(map(int, input().split())))",
"+... | false | 0.108206 | 0.114346 | 0.946304 | [
"s129746056",
"s110832071"
] |
u941753895 | p03846 | python | s054700592 | s786978794 | 113 | 104 | 16,300 | 16,300 | Accepted | Accepted | 7.96 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n=I(... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n=I(... | 33 | 30 | 622 | 578 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 9.090909 | [
"- for i in range(n):",
"- if (i // 2) * 2 + 1 != l[i]:",
"+ for i in range(n // 2):",
"+ if l[i] != i // 2 * 2 + 1:",
"- return pow(2, n // 2) % mod",
"- l = l[1:]",
"- for i in range(n - 1):",
"- if (i // 2) * 2 + 2 != l[i]:",
"+ ... | false | 0.086771 | 0.069345 | 1.251282 | [
"s054700592",
"s786978794"
] |
u869790980 | p02660 | python | s429259553 | s959334334 | 349 | 77 | 85,952 | 66,116 | Accepted | Accepted | 77.94 | def f(exponent):
#reurns how many times a prime raised to exponent can be used
step = 1
cumul = 0
count = 0
while( cumul <= exponent):
cumul += step
count +=1
step +=1
return count - (1 if cumul > exponent else 0)
def answer(n):
if n == 1: return 0
res = 0
on = n
p = True
for d in rang... | def f(exponent):
#reurns how many times a prime raised to exponent can be used
step = 1
cumul = 0
count = 0
while( cumul <= exponent):
cumul += step
count +=1
step +=1
return count - (1 if cumul > exponent else 0)
def answer(n):
if n == 1: return 0
res = 0
for d in range(2, int(n ** 0.5) +... | 28 | 25 | 513 | 478 | def f(exponent):
# reurns how many times a prime raised to exponent can be used
step = 1
cumul = 0
count = 0
while cumul <= exponent:
cumul += step
count += 1
step += 1
return count - (1 if cumul > exponent else 0)
def answer(n):
if n == 1:
return 0
res ... | def f(exponent):
# reurns how many times a prime raised to exponent can be used
step = 1
cumul = 0
count = 0
while cumul <= exponent:
cumul += step
count += 1
step += 1
return count - (1 if cumul > exponent else 0)
def answer(n):
if n == 1:
return 0
res ... | false | 10.714286 | [
"- on = n",
"- p = True",
"- for d in range(2, int(on**0.5) + 2):",
"+ for d in range(2, int(n**0.5) + 2):",
"- p = False"
] | false | 0.070478 | 0.091307 | 0.771881 | [
"s429259553",
"s959334334"
] |
u847467233 | p02452 | python | s479881358 | s516574462 | 340 | 150 | 36,680 | 45,628 | Accepted | Accepted | 55.88 | # AOJ ITP2_6_B: Includes
# Python3 2018.6.24 bal4u
from bisect import bisect_left
n = int(eval(input()))
a = list(map(int, input().split()))
a.append(1000000001) # > 1,000,000,000
m = int(eval(input()))
b = list(map(int, input().split()))
if len(b) > len(a): print((0))
else:
p, f = 0, 1
for k in b:
p... | # AOJ ITP2_6_B: Includes
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = set(list(map(int, input().split())))
m = int(eval(input()))
b = set(list(map(int, input().split())))
print((1 if b.issubset(a) else 0))
| 18 | 8 | 378 | 208 | # AOJ ITP2_6_B: Includes
# Python3 2018.6.24 bal4u
from bisect import bisect_left
n = int(eval(input()))
a = list(map(int, input().split()))
a.append(1000000001) # > 1,000,000,000
m = int(eval(input()))
b = list(map(int, input().split()))
if len(b) > len(a):
print((0))
else:
p, f = 0, 1
for k in b:
... | # AOJ ITP2_6_B: Includes
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = set(list(map(int, input().split())))
m = int(eval(input()))
b = set(list(map(int, input().split())))
print((1 if b.issubset(a) else 0))
| false | 55.555556 | [
"-from bisect import bisect_left",
"-",
"-a = list(map(int, input().split()))",
"-a.append(1000000001) # > 1,000,000,000",
"+a = set(list(map(int, input().split())))",
"-b = list(map(int, input().split()))",
"-if len(b) > len(a):",
"- print((0))",
"-else:",
"- p, f = 0, 1",
"- for k in... | false | 0.041266 | 0.034457 | 1.197606 | [
"s479881358",
"s516574462"
] |
u349444371 | p04034 | python | s775554657 | s325912997 | 1,397 | 217 | 29,400 | 92,064 | Accepted | Accepted | 84.47 | n,m=list(map(int,input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
l=[1]*n
out_=[0]*n
in_=[0]*n#入れられたことがある履歴。0番目だけは初期値1
c=1
#print(in_)
check=0
for i in range(m):
if check==0:
if xy[i][0]==1:#箱1に入ってくる前に初めて箱1から赤いボールを移す場合
in_[xy[i][1]-1]+=1
check=1
... | n,m=list(map(int,input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
l=[1]*n
out_=[0]*n
in_=[0]*n
c=1
check=0
for i in range(m):
if check==0:
if xy[i][0]==1:
in_[xy[i][1]-1]+=1
check=1
else:
if xy[i][1]==1:
in... | 35 | 32 | 924 | 747 | n, m = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
l = [1] * n
out_ = [0] * n
in_ = [0] * n # 入れられたことがある履歴。0番目だけは初期値1
c = 1
# print(in_)
check = 0
for i in range(m):
if check == 0:
if xy[i][0] == 1: # 箱1に入ってくる前に初めて箱1から赤いボールを移す場合
in_[xy[i][1] - 1] +=... | n, m = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
l = [1] * n
out_ = [0] * n
in_ = [0] * n
c = 1
check = 0
for i in range(m):
if check == 0:
if xy[i][0] == 1:
in_[xy[i][1] - 1] += 1
check = 1
else:
if xy[i][1] == 1:
... | false | 8.571429 | [
"-in_ = [0] * n # 入れられたことがある履歴。0番目だけは初期値1",
"+in_ = [0] * n",
"-# print(in_)",
"- if xy[i][0] == 1: # 箱1に入ってくる前に初めて箱1から赤いボールを移す場合",
"+ if xy[i][0] == 1:",
"- else: # 箱1から赤いボールを移す前に白いボールが入ってくる場合",
"+ else:",
"- # print(l,in_)",
"- if l[xy[i][0] - 1] == 0 a... | false | 0.045615 | 0.045376 | 1.005251 | [
"s775554657",
"s325912997"
] |
u508732591 | p02257 | python | s175629123 | s554257822 | 80 | 60 | 7,788 | 7,716 | Accepted | Accepted | 25 | def maybe_prime(d,s,n):
for a in (2,3,5,7):
p = False
x = pow(a,d,n)
if x==1 or x==n-1:
continue
for i in range(1,s):
x = x*x%n
if x==1: return False
elif x == n-1:
p = True
break
if n... | def maybe_prime(d,s,n):
for a in (2,3,5,7):
p = False
x = pow(a,d,n)
if x==1 or x==n-1:
continue
for i in range(1,s):
x = x*x%n
if x==1: return False
elif x == n-1:
p = True
break
if n... | 31 | 30 | 754 | 693 | def maybe_prime(d, s, n):
for a in (2, 3, 5, 7):
p = False
x = pow(a, d, n)
if x == 1 or x == n - 1:
continue
for i in range(1, s):
x = x * x % n
if x == 1:
return False
elif x == n - 1:
p = True
... | def maybe_prime(d, s, n):
for a in (2, 3, 5, 7):
p = False
x = pow(a, d, n)
if x == 1 or x == n - 1:
continue
for i in range(1, s):
x = x * x % n
if x == 1:
return False
elif x == n - 1:
p = True
... | false | 3.225806 | [
"- if n in (2, 3, 5, 7):",
"+ if n in (2, 3, 5, 7, 11):",
"- elif 0 in (n % 2, n % 3, n % 5, n % 7):",
"- return False",
"- elif 0 in [n % i for i in range(11, min(n - 1, 20), 2)]:",
"+ elif 0 in (n % 2, n % 3, n % 5, n % 7, n % 11):"
] | false | 0.064201 | 0.111137 | 0.57767 | [
"s175629123",
"s554257822"
] |
u525065967 | p02586 | python | s016809954 | s840288032 | 1,340 | 1,055 | 432,444 | 153,572 | Accepted | Accepted | 21.27 | R, C, K = list(map(int, input().split()))
V = [[0]*(C+1) for _ in range(R+1)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
V[r][c] = v
dp0 = [[0]*(C+1) for _ in range(R+1)]
dp1 = [[0]*(C+1) for _ in range(R+1)]
dp2 = [[0]*(C+1) for _ in range(R+1)]
dp3 = [[0]*(C+1) for _ in range(R+1... | R, C, K = list(map(int, input().split()))
V = [[0]*(C+1) for _ in range(R+1)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
V[r][c] = v
pre0 = [0]*(C+1)
pre1 = [0]*(C+1)
pre2 = [0]*(C+1)
pre3 = [0]*(C+1)
for i in range(R+1):
now0 = [0]*(C+1)
now1 = [0]*(C+1)
now2 = [0]... | 30 | 34 | 926 | 901 | R, C, K = list(map(int, input().split()))
V = [[0] * (C + 1) for _ in range(R + 1)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
V[r][c] = v
dp0 = [[0] * (C + 1) for _ in range(R + 1)]
dp1 = [[0] * (C + 1) for _ in range(R + 1)]
dp2 = [[0] * (C + 1) for _ in range(R + 1)]
dp3 = [[0] * (C + 1) fo... | R, C, K = list(map(int, input().split()))
V = [[0] * (C + 1) for _ in range(R + 1)]
for _ in range(K):
r, c, v = list(map(int, input().split()))
V[r][c] = v
pre0 = [0] * (C + 1)
pre1 = [0] * (C + 1)
pre2 = [0] * (C + 1)
pre3 = [0] * (C + 1)
for i in range(R + 1):
now0 = [0] * (C + 1)
now1 = [0] * (C + 1... | false | 11.764706 | [
"-dp0 = [[0] * (C + 1) for _ in range(R + 1)]",
"-dp1 = [[0] * (C + 1) for _ in range(R + 1)]",
"-dp2 = [[0] * (C + 1) for _ in range(R + 1)]",
"-dp3 = [[0] * (C + 1) for _ in range(R + 1)]",
"+pre0 = [0] * (C + 1)",
"+pre1 = [0] * (C + 1)",
"+pre2 = [0] * (C + 1)",
"+pre3 = [0] * (C + 1)",
"+ no... | false | 0.04931 | 0.044148 | 1.116925 | [
"s016809954",
"s840288032"
] |
u994988729 | p03166 | python | s961759652 | s692238369 | 478 | 280 | 67,516 | 61,220 | Accepted | Accepted | 41.42 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, readline().split()))
outdeg = {i: [] for i in range(N)}
for _ in range(M):
a, b = list(map(int, readline().split()))
a -= 1
b -=... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for _ in range(M):
s, t = list(map(int, input().split()))
s -= 1
t -= 1
edge[s].append(t)
dp = [-1]*N
def dfs(s):
if dp[s] != -1:
... | 32 | 31 | 595 | 547 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
N, M = list(map(int, readline().split()))
outdeg = {i: [] for i in range(N)}
for _ in range(M):
a, b = list(map(int, readline().split()))
a -= 1
b -= 1
outdeg... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for _ in range(M):
s, t = list(map(int, input().split()))
s -= 1
t -= 1
edge[s].append(t)
dp = [-1] * N
def dfs(s):
if dp[s] != -1:
return dp[s]
... | false | 3.125 | [
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"+input = sys.stdin.buffer.readline",
"-N, M = list(map(int, readline().split()))",
"-outdeg = {i: [] for i in range(N)}",
"+N, M = list(map(int, input().split()))",
"+edge = [[] for _ ... | false | 0.039469 | 0.037769 | 1.044991 | [
"s961759652",
"s692238369"
] |
u137226361 | p02578 | python | s273551116 | s147086403 | 179 | 122 | 32,368 | 31,504 | Accepted | Accepted | 31.84 | n = int(eval(input()))
an = list(map(int, input().split()))
maxi = 0
humi = 0
maxi = an[0]
for i in range(1, n):
if an[i] < maxi:
hu = maxi -an[i]
humi += hu
maxi = max(maxi, an[i])
print(humi) | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
an = list(map(int, input().split()))
humi = 0
maxi = an[0]
for i in range(1, n):
if an[i] < maxi:
hu = maxi -an[i]
humi += hu
maxi = max(maxi, an[i])
print(humi)
if __n... | 13 | 16 | 225 | 346 | n = int(eval(input()))
an = list(map(int, input().split()))
maxi = 0
humi = 0
maxi = an[0]
for i in range(1, n):
if an[i] < maxi:
hu = maxi - an[i]
humi += hu
maxi = max(maxi, an[i])
print(humi)
| import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
an = list(map(int, input().split()))
humi = 0
maxi = an[0]
for i in range(1, n):
if an[i] < maxi:
hu = maxi - an[i]
humi += hu
maxi = max(maxi, an[i])
print(humi)
if __name__ == ... | false | 18.75 | [
"-n = int(eval(input()))",
"-an = list(map(int, input().split()))",
"-maxi = 0",
"-humi = 0",
"-maxi = an[0]",
"-for i in range(1, n):",
"- if an[i] < maxi:",
"- hu = maxi - an[i]",
"- humi += hu",
"- maxi = max(maxi, an[i])",
"-print(humi)",
"+import sys",
"+",
"+input... | false | 0.106436 | 0.073497 | 1.448171 | [
"s273551116",
"s147086403"
] |
u488401358 | p03083 | python | s644090215 | s870671441 | 486 | 416 | 91,256 | 85,084 | Accepted | Accepted | 14.4 | def cmb(n, r, mod):#コンビネーションの高速計算
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod ... | def cmb(n, r, mod):#コンビネーションの高速計算
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod ... | 37 | 40 | 828 | 876 | def cmb(n, r, mod): # コンビネーションの高速計算
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7 # 出力の制限
N = 2 * 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
... | def cmb(n, r, mod): # コンビネーションの高速計算
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7 # 出力の制限
N = 2 * 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
... | false | 7.5 | [
"+import sys",
"+",
"+write = sys.stdout.write",
"- print(ans)",
"+ write(str(ans) + \"\\n\")"
] | false | 0.508295 | 0.71471 | 0.71119 | [
"s644090215",
"s870671441"
] |
u392319141 | p03645 | python | s856042114 | s169992416 | 1,160 | 899 | 46,812 | 71,932 | Accepted | Accepted | 22.5 | from collections import deque
N, M = list(map(int, input().split()))
edges = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
def dfs(start, end):
minDist = [-1 for _ in range(N)]
minDist[s... | N, M = list(map(int, input().split()))
edges =[set() for _ in range(N + 1)]
one = set()
for _ in range(M):
fr, to = list(map(int, input().split()))
edges[fr].add(to)
edges[to].add(fr)
if fr == 1:
one.add(to)
if to == 1:
one.add(fr)
for fr in one:
if N in edges[fr]... | 38 | 19 | 742 | 376 | from collections import deque
N, M = list(map(int, input().split()))
edges = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
def dfs(start, end):
minDist = [-1 for _ in range(N)]
minDist[start] = 0
qu... | N, M = list(map(int, input().split()))
edges = [set() for _ in range(N + 1)]
one = set()
for _ in range(M):
fr, to = list(map(int, input().split()))
edges[fr].add(to)
edges[to].add(fr)
if fr == 1:
one.add(to)
if to == 1:
one.add(fr)
for fr in one:
if N in edges[fr]:
print... | false | 50 | [
"-from collections import deque",
"-",
"-edges = [[] for _ in range(N)]",
"+edges = [set() for _ in range(N + 1)]",
"+one = set()",
"- a, b = list(map(int, input().split()))",
"- a -= 1",
"- b -= 1",
"- edges[a].append(b)",
"- edges[b].append(a)",
"-",
"-",
"-def dfs(start, en... | false | 0.047068 | 0.0471 | 0.999332 | [
"s856042114",
"s169992416"
] |
u037430802 | p03290 | python | s416815980 | s985944625 | 28 | 25 | 3,064 | 3,064 | Accepted | Accepted | 10.71 | import math
d, g = list(map(int, input().split()))
ps = []
cs = []
for i in range(d):
p, c = list(map(int, input().split()))
ps.append(p)
cs.append(c)
ans = []
def solve(s):
global ans
if len(s) == d:
total = 0
cnt = 0
for i in range(len(s)):
total += int(s[i]) * (ps[i... | # ビット演算を使おう
D, G = list(map(int, input().split()))
pc = [tuple(map(int,input().split())) for i in range(D)]
import math
ans = 10**5
for i in range(2**D):
# 使い切る部分が1、選ばない部分が0
b = str(bin(i))[2:].zfill(D)
cnt = 0
point = 0
first_zero_idx = 0
flag = False
#print(b)
fo... | 45 | 37 | 898 | 1,045 | import math
d, g = list(map(int, input().split()))
ps = []
cs = []
for i in range(d):
p, c = list(map(int, input().split()))
ps.append(p)
cs.append(c)
ans = []
def solve(s):
global ans
if len(s) == d:
total = 0
cnt = 0
for i in range(len(s)):
total += int(s[i])... | # ビット演算を使おう
D, G = list(map(int, input().split()))
pc = [tuple(map(int, input().split())) for i in range(D)]
import math
ans = 10**5
for i in range(2**D):
# 使い切る部分が1、選ばない部分が0
b = str(bin(i))[2:].zfill(D)
cnt = 0
point = 0
first_zero_idx = 0
flag = False
# print(b)
for j in range(len(b))... | false | 17.777778 | [
"+# ビット演算を使おう",
"+D, G = list(map(int, input().split()))",
"+pc = [tuple(map(int, input().split())) for i in range(D)]",
"-d, g = list(map(int, input().split()))",
"-ps = []",
"-cs = []",
"-for i in range(d):",
"- p, c = list(map(int, input().split()))",
"- ps.append(p)",
"- cs.append(c)"... | false | 0.04617 | 0.107728 | 0.428579 | [
"s416815980",
"s985944625"
] |
u226108478 | p03804 | python | s295929826 | s674702518 | 140 | 32 | 3,064 | 3,064 | Accepted | Accepted | 77.14 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == '__main__':
n, m = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(n)]
b = [list(eval(input())) for _ in range(m)]
for i in range(n - m + 1):
for j in range(n - m + 1):
... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == '__main__':
n, m = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(n)]
b = [list(eval(input())) for _ in range(m)]
for i in range(n - m + 1):
for j in range(n - m + 1):
... | 25 | 26 | 599 | 630 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == "__main__":
n, m = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(n)]
b = [list(eval(input())) for _ in range(m)]
for i in range(n - m + 1):
for j in range(n - m + 1):
is_exist = Tr... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == "__main__":
n, m = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(n)]
b = [list(eval(input())) for _ in range(m)]
for i in range(n - m + 1):
for j in range(n - m + 1):
is_exist = Tr... | false | 3.846154 | [
"+ break"
] | false | 0.038234 | 0.039436 | 0.969511 | [
"s295929826",
"s674702518"
] |
u790012205 | p02614 | python | s630570904 | s138233940 | 129 | 65 | 9,344 | 9,192 | Accepted | Accepted | 49.61 | from copy import deepcopy
H, W, K = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(H)]
A = 0
for bit in range(2 ** H):
D = deepcopy(c)
for i in range(H):
if (bit & (1 << i)):
for k in range(W):
D[i][k] = '.'
for bit2 in range(2 ** W):
... | H, W, K = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(H)]
A = 0
for ibit in range(2 ** H):
for jbit in range(2 ** W):
B = 0
for i in range(H):
for j in range(W):
if (ibit & (1 << i)) or (jbit & (1 << j)):
continue... | 24 | 16 | 595 | 422 | from copy import deepcopy
H, W, K = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(H)]
A = 0
for bit in range(2**H):
D = deepcopy(c)
for i in range(H):
if bit & (1 << i):
for k in range(W):
D[i][k] = "."
for bit2 in range(2**W):
E = deepc... | H, W, K = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(H)]
A = 0
for ibit in range(2**H):
for jbit in range(2**W):
B = 0
for i in range(H):
for j in range(W):
if (ibit & (1 << i)) or (jbit & (1 << j)):
continue
... | false | 33.333333 | [
"-from copy import deepcopy",
"-",
"-for bit in range(2**H):",
"- D = deepcopy(c)",
"- for i in range(H):",
"- if bit & (1 << i):",
"- for k in range(W):",
"- D[i][k] = \".\"",
"- for bit2 in range(2**W):",
"- E = deepcopy(D)",
"- for j in ... | false | 0.04441 | 0.042773 | 1.038264 | [
"s630570904",
"s138233940"
] |
u562935282 | p03039 | python | s089281414 | s972264013 | 185 | 144 | 54,128 | 18,804 | Accepted | Accepted | 22.16 | def solve():
mod = 10 ** 9 + 7
def cmb(n, r):
def build():
fs = [1]
t = 1
for x in range(1, h * w):
t = (t * x) % mod
fs.append(t)
invs = [1] * (h * w)
t = pow(t, mod - 2, mod)
invs[-1]... | class Calc:
def __init__(self, max_value, mod):
"""combination(max_value, all)"""
fact = [-1] * (max_value + 1)
fact[0] = 1
fact[1] = 1
for x in range(2, max_value + 1):
fact[x] = x * fact[x - 1] % mod
invs = [1] * (max_value + 1)
invs[m... | 40 | 63 | 990 | 1,493 | def solve():
mod = 10**9 + 7
def cmb(n, r):
def build():
fs = [1]
t = 1
for x in range(1, h * w):
t = (t * x) % mod
fs.append(t)
invs = [1] * (h * w)
t = pow(t, mod - 2, mod)
invs[-1] = t
... | class Calc:
def __init__(self, max_value, mod):
"""combination(max_value, all)"""
fact = [-1] * (max_value + 1)
fact[0] = 1
fact[1] = 1
for x in range(2, max_value + 1):
fact[x] = x * fact[x - 1] % mod
invs = [1] * (max_value + 1)
invs[max_value] =... | false | 36.507937 | [
"-def solve():",
"- mod = 10**9 + 7",
"+class Calc:",
"+ def __init__(self, max_value, mod):",
"+ \"\"\"combination(max_value, all)\"\"\"",
"+ fact = [-1] * (max_value + 1)",
"+ fact[0] = 1",
"+ fact[1] = 1",
"+ for x in range(2, max_value + 1):",
"+ ... | false | 0.128957 | 0.054046 | 2.386046 | [
"s089281414",
"s972264013"
] |
u227082700 | p03651 | python | s232872795 | s910879506 | 88 | 70 | 14,252 | 19,788 | Accepted | Accepted | 20.45 | 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()))
g=a[0]
for i in a[1:]:g=gcd(g,i)
ans="IMPOSSIBLE"
for i in a:
if k>i:continue
if abs(k-i)%g==0:ans="POSSIBLE"
print(ans) | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
def gcd(a,b):
while b:a,b=b,a%b
return a
g=a[0]
for i in a:g=gcd(g,i)
if max(a)>=k and k%g==0:print("POSSIBLE")
else:print("IMPOSSIBLE") | 12 | 9 | 242 | 210 | 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()))
g = a[0]
for i in a[1:]:
g = gcd(g, i)
ans = "IMPOSSIBLE"
for i in a:
if k > i:
continue
if abs(k - i) % g == 0:
ans = "POSSIBLE"
print(ans)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
g = a[0]
for i in a:
g = gcd(g, i)
if max(a) >= k and k % g == 0:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 25 | [
"+n, k = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"+",
"+",
"-n, k = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-for i in a[1:]:",
"+for i in a:",
"-ans = \"IMPOSSIBLE\"",
"-for i in a:",
"- if k > i:",
"- continue",
... | false | 0.037137 | 0.036219 | 1.025356 | [
"s232872795",
"s910879506"
] |
u461454424 | p02659 | python | s564910571 | s939358518 | 61 | 30 | 61,992 | 10,536 | Accepted | Accepted | 50.82 | #atcoder template
def main():
import sys
imput = sys.stdin.readline
#文字列入力の時は上記はerrorとなる。
#ここにコード
#input
A, B = list(map(str, input().split()))
#output
A = int(A)
C = int(B[0])
D = int(B[2])
E = int(B[3])
print((A * (100*C + 10*D + E) // 100))
#N =... | #あるいは
import math
from fractions import Fraction
#input
a, b = input().split()
#output
a = int(a)
b = Fraction(b)
print((math.floor(a*b))) | 20 | 10 | 374 | 146 | # atcoder template
def main():
import sys
imput = sys.stdin.readline
# 文字列入力の時は上記はerrorとなる。
# ここにコード
# input
A, B = list(map(str, input().split()))
# output
A = int(A)
C = int(B[0])
D = int(B[2])
E = int(B[3])
print((A * (100 * C + 10 * D + E) // 100))
# N = 1のときなどco... | # あるいは
import math
from fractions import Fraction
# input
a, b = input().split()
# output
a = int(a)
b = Fraction(b)
print((math.floor(a * b)))
| false | 50 | [
"-# atcoder template",
"-def main():",
"- import sys",
"+# あるいは",
"+import math",
"+from fractions import Fraction",
"- imput = sys.stdin.readline",
"- # 文字列入力の時は上記はerrorとなる。",
"- # ここにコード",
"- # input",
"- A, B = list(map(str, input().split()))",
"- # output",
"- A =... | false | 0.119433 | 0.055692 | 2.144537 | [
"s564910571",
"s939358518"
] |
u968404618 | p03352 | python | s177387521 | s010247359 | 26 | 24 | 9,464 | 9,332 | Accepted | Accepted | 7.69 | x = int(eval(input()))
ans = 0
tmp = 1
for i in range(1, int(x**0.5)+1):
for j in range(2, x):
tmp = pow(i, j)
if tmp > x:
tmp = pow(i, j-1)
#print(tmp, i, j)
break
ans = max(tmp, ans)
print(ans) | X = int(eval(input()))
ans = 0
for i in range(1, int(X**0.5)+1):
for j in range(2, 1000):
tmp = pow(i, j)
if tmp > X:
break
ans = max(ans, tmp)
print(ans) | 15 | 11 | 256 | 200 | x = int(eval(input()))
ans = 0
tmp = 1
for i in range(1, int(x**0.5) + 1):
for j in range(2, x):
tmp = pow(i, j)
if tmp > x:
tmp = pow(i, j - 1)
# print(tmp, i, j)
break
ans = max(tmp, ans)
print(ans)
| X = int(eval(input()))
ans = 0
for i in range(1, int(X**0.5) + 1):
for j in range(2, 1000):
tmp = pow(i, j)
if tmp > X:
break
ans = max(ans, tmp)
print(ans)
| false | 26.666667 | [
"-x = int(eval(input()))",
"+X = int(eval(input()))",
"-tmp = 1",
"-for i in range(1, int(x**0.5) + 1):",
"- for j in range(2, x):",
"+for i in range(1, int(X**0.5) + 1):",
"+ for j in range(2, 1000):",
"- if tmp > x:",
"- tmp = pow(i, j - 1)",
"- # print(tmp, i,... | false | 0.040603 | 0.039592 | 1.025541 | [
"s177387521",
"s010247359"
] |
u263830634 | p03241 | python | s100159661 | s594850744 | 475 | 20 | 40,044 | 3,064 | Accepted | Accepted | 95.79 | #全探索すると終わらない
import math
N, M = list(map(int, input().split()))
ans = 1
for i in range((M+N-1)//N, 0, -1):
if M%i == 0:
if (M//i)//N >= 1:
print (i)
exit()
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
# nの約数をO(root(n))で全列挙、
# sortするなら O(root(n) * root(n)log(root(n))) --> O(n * log(n))
def make_divisors(n):
import math
divisors = []
for i in range(1, int(math.sqrt(n)... | 10 | 26 | 200 | 607 | # 全探索すると終わらない
import math
N, M = list(map(int, input().split()))
ans = 1
for i in range((M + N - 1) // N, 0, -1):
if M % i == 0:
if (M // i) // N >= 1:
print(i)
exit()
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
# nの約数をO(root(n))で全列挙、
# sortするなら O(root(n) * root(n)log(root(n))) --> O(n * log(n))
def make_divisors(n):
import math
divisors = []
for i in range(1, int(math.sqrt(n)) + 1):
... | false | 61.538462 | [
"-# 全探索すると終わらない",
"-import math",
"+import sys",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-ans = 1",
"-for i in range((M + N - 1) // N, 0, -1):",
"- if M % i == 0:",
"- if (M // i) // N >= 1:",
"- print(i)",
"- exit()"... | false | 0.069633 | 0.03655 | 1.90515 | [
"s100159661",
"s594850744"
] |
u638795007 | p03760 | python | s355097100 | s825161614 | 183 | 39 | 38,256 | 4,720 | Accepted | Accepted | 78.69 |
def examB():
O = S()
E = S()
E += " "
ans = ""
for i in range(len(O)):
ans = ans + O[i] + E[i]
if len(O)!=len(O):
ans = ans[:len(E)+1]
print(ans)
import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(s... | def examA():
O = SI()
E = SI()
ans = ""
for i in range(len(O)+len(E)):
if i%2==0:
ans += O[i//2]
else:
ans += E[i//2]
print(ans)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
ret... | 26 | 61 | 544 | 1,167 | def examB():
O = S()
E = S()
E += " "
ans = ""
for i in range(len(O)):
ans = ans + O[i] + E[i]
if len(O) != len(O):
ans = ans[: len(E) + 1]
print(ans)
import sys
import copy
import bisect
from collections import Counter, defaultdict, deque
def I():
return int(sys.stdi... | def examA():
O = SI()
E = SI()
ans = ""
for i in range(len(O) + len(E)):
if i % 2 == 0:
ans += O[i // 2]
else:
ans += E[i // 2]
print(ans)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
de... | false | 57.377049 | [
"-def examB():",
"- O = S()",
"- E = S()",
"- E += \" \"",
"+def examA():",
"+ O = SI()",
"+ E = SI()",
"- for i in range(len(O)):",
"- ans = ans + O[i] + E[i]",
"- if len(O) != len(O):",
"- ans = ans[: len(E) + 1]",
"+ for i in range(len(O) + len(E)):",
... | false | 0.076598 | 0.039527 | 1.937899 | [
"s355097100",
"s825161614"
] |
u678167152 | p03575 | python | s730398628 | s924702022 | 31 | 22 | 3,568 | 3,192 | Accepted | Accepted | 29.03 | N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
edges = [(0,0) for _ in range(M)]
for i in range(M):
a,b = list(map(int, input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
edges[i] = (a-1,b-1)
import sys
sys.setrecursionlimit(10**8)
def dfs(v, es):
#pri... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 42 | 55 | 907 | 1,343 | N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
edges = [(0, 0) for _ in range(M)]
for i in range(M):
a, b = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
edges[i] = (a - 1, b - 1)
import sys
sys.setrecursionlimit(10**8)
def dfs(v, es):
#... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.f... | false | 23.636364 | [
"-N, M = list(map(int, input().split()))",
"-edge = [[] for _ in range(N)]",
"-edges = [(0, 0) for _ in range(M)]",
"-for i in range(M):",
"- a, b = list(map(int, input().split()))",
"- edge[a - 1].append(b - 1)",
"- edge[b - 1].append(a - 1)",
"- edges[i] = (a - 1, b - 1)",
"-import sys... | false | 0.082643 | 0.042499 | 1.944556 | [
"s730398628",
"s924702022"
] |
u263830634 | p03767 | python | s802339176 | s038516458 | 240 | 209 | 39,492 | 37,084 | Accepted | Accepted | 12.92 | N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(N, 3 * N, 2):
ans += a[i]
print (ans) | N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
# ans = 0
# for i in range(N, 3 * N, 2):
# ans += a[i]
# print (ans)
print((sum(a[N::2]))) | 9 | 11 | 136 | 168 | N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(N, 3 * N, 2):
ans += a[i]
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
# ans = 0
# for i in range(N, 3 * N, 2):
# ans += a[i]
# print (ans)
print((sum(a[N::2])))
| false | 18.181818 | [
"-ans = 0",
"-for i in range(N, 3 * N, 2):",
"- ans += a[i]",
"-print(ans)",
"+# ans = 0",
"+# for i in range(N, 3 * N, 2):",
"+# ans += a[i]",
"+# print (ans)",
"+print((sum(a[N::2])))"
] | false | 0.037764 | 0.039015 | 0.96793 | [
"s802339176",
"s038516458"
] |
u593590006 | p03806 | python | s939439646 | s752755661 | 1,174 | 738 | 141,404 | 100,956 | Accepted | Accepted | 37.14 | def main():
n,ma,mb = list(map(int,input().split()))
dp = [[[float("inf") for _ in range(401)] for _ in range(401)] for _ in range(n+1)]
dp[0][0][0]=0
for i in range(1,n+1):
a,b,c = list(map(int,input().split()))
for j in range(401):
for k in range(401):
... | n,ma,mb=list(map(int,input().split()))
dp=[[[10**30 for j in range(401)]for i in range(401)]for k in range(n+1)]
dp[0][0][0]=0
l=[]
for i in range(n):
a,b,c=list(map(int,input().split()))
l.append([a,b,c])
for i in range(1,n+1):
a,b,c=l[i-1][0],l[i-1][1],l[i-1][2]
for x in range(401):
... | 24 | 23 | 752 | 638 | def main():
n, ma, mb = list(map(int, input().split()))
dp = [
[[float("inf") for _ in range(401)] for _ in range(401)] for _ in range(n + 1)
]
dp[0][0][0] = 0
for i in range(1, n + 1):
a, b, c = list(map(int, input().split()))
for j in range(401):
for k in range(... | n, ma, mb = list(map(int, input().split()))
dp = [[[10**30 for j in range(401)] for i in range(401)] for k in range(n + 1)]
dp[0][0][0] = 0
l = []
for i in range(n):
a, b, c = list(map(int, input().split()))
l.append([a, b, c])
for i in range(1, n + 1):
a, b, c = l[i - 1][0], l[i - 1][1], l[i - 1][2]
fo... | false | 4.166667 | [
"-def main():",
"- n, ma, mb = list(map(int, input().split()))",
"- dp = [",
"- [[float(\"inf\") for _ in range(401)] for _ in range(401)] for _ in range(n + 1)",
"- ]",
"- dp[0][0][0] = 0",
"- for i in range(1, n + 1):",
"- a, b, c = list(map(int, input().split()))",
"-... | false | 0.487605 | 0.537185 | 0.907705 | [
"s939439646",
"s752755661"
] |
u255595446 | p02879 | python | s238154321 | s019761573 | 195 | 17 | 38,256 | 3,060 | Accepted | Accepted | 91.28 | num = [int(_) for _ in input().split(" ")]
if 0<num[0]<10 and 0<num[1]<10:
print((num[0]*num[1]))
else:
print((-1))
| """
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)]
print(*S,sep="")
"""
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限
a,b = list(map(int,input().split()))
if 0<a<... | 5 | 17 | 120 | 366 | num = [int(_) for _ in input().split(" ")]
if 0 < num[0] < 10 and 0 < num[1] < 10:
print((num[0] * num[1]))
else:
print((-1))
| """
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)]
print(*S,sep="")
"""
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限
a, b = list(map(int, input().split()))
if 0 < a < 10 and ... | false | 70.588235 | [
"-num = [int(_) for _ in input().split(\" \")]",
"-if 0 < num[0] < 10 and 0 < num[1] < 10:",
"- print((num[0] * num[1]))",
"+\"\"\"",
"+N = list(map(int,input().split()))",
"+S = [str(input()) for _ in range(N)]",
"+S = [list(map(int,list(input()))) for _ in range(h)]",
"+print(*S,sep=\"\")",
"+\... | false | 0.040425 | 0.035689 | 1.132692 | [
"s238154321",
"s019761573"
] |
u645250356 | p02925 | python | s516631833 | s244139106 | 1,762 | 662 | 37,688 | 106,712 | Accepted | Accepted | 62.43 | from collections import Counter,defaultdict,deque
from bisect import bisect_left
import sys,math,itertools,pprint,fractions,time
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
st = time.t... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 41 | 35 | 1,016 | 846 | from collections import Counter, defaultdict, deque
from bisect import bisect_left
import sys, math, itertools, pprint, fractions, time
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, copy
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readli... | false | 14.634146 | [
"-from bisect import bisect_left",
"-import sys, math, itertools, pprint, fractions, time",
"+from heapq import heappop, heappush, heapify",
"+import sys, bisect, math, itertools, fractions, copy",
"-st = time.time()",
"+for _ in range(n):",
"+ tmp = inpl()",
"+ tmp = [x - 1 for x in tmp] + [-1]... | false | 0.099391 | 0.042934 | 2.314973 | [
"s516631833",
"s244139106"
] |
u297574184 | p02815 | python | s243022888 | s021835235 | 373 | 190 | 26,024 | 31,740 | Accepted | Accepted | 49.06 | MOD = 10**9 + 7
N = int(eval(input()))
Cs = list(map(int, input().split()))
As = [1]
accA = 1
m = 2
for i in range(1, N):
A = (accA + m) % MOD
As.append(A)
accA = (accA + A) % MOD
m = m * 2 % MOD
m = 1
for i in reversed(list(range(N))):
As[i] = As[i] * m % MOD
m = m * 2 % MOD... | MOD = 10**9 + 7
N = int(eval(input()))
Cs = list(map(int, input().split()))
Cs.sort(reverse=True)
pow2 = pow(2, 2*N-2, MOD)
ans = 0
for i, C in enumerate(Cs, start=1):
ans += C*(i+1)*pow2
ans %= MOD
print(ans)
| 26 | 15 | 432 | 231 | MOD = 10**9 + 7
N = int(eval(input()))
Cs = list(map(int, input().split()))
As = [1]
accA = 1
m = 2
for i in range(1, N):
A = (accA + m) % MOD
As.append(A)
accA = (accA + A) % MOD
m = m * 2 % MOD
m = 1
for i in reversed(list(range(N))):
As[i] = As[i] * m % MOD
m = m * 2 % MOD
Cs.sort(reverse=Tru... | MOD = 10**9 + 7
N = int(eval(input()))
Cs = list(map(int, input().split()))
Cs.sort(reverse=True)
pow2 = pow(2, 2 * N - 2, MOD)
ans = 0
for i, C in enumerate(Cs, start=1):
ans += C * (i + 1) * pow2
ans %= MOD
print(ans)
| false | 42.307692 | [
"-As = [1]",
"-accA = 1",
"-m = 2",
"-for i in range(1, N):",
"- A = (accA + m) % MOD",
"- As.append(A)",
"- accA = (accA + A) % MOD",
"- m = m * 2 % MOD",
"-m = 1",
"-for i in reversed(list(range(N))):",
"- As[i] = As[i] * m % MOD",
"- m = m * 2 % MOD",
"+pow2 = pow(2, 2 *... | false | 0.036147 | 0.035732 | 1.011592 | [
"s243022888",
"s021835235"
] |
u836737505 | p02957 | python | s342498357 | s981968769 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | a,b = list(map(int,input().split()))
c = ((a*a)-(b*b))/(2*(a-b))
print((int(c) if c%1.0==0 else "IMPOSSIBLE")) | a,b = list(map(int,input().split()))
c = ((a*a)-(b*b))/(2*(a-b))
print((int(c) if c == int(c) else "IMPOSSIBLE")) | 3 | 3 | 104 | 107 | a, b = list(map(int, input().split()))
c = ((a * a) - (b * b)) / (2 * (a - b))
print((int(c) if c % 1.0 == 0 else "IMPOSSIBLE"))
| a, b = list(map(int, input().split()))
c = ((a * a) - (b * b)) / (2 * (a - b))
print((int(c) if c == int(c) else "IMPOSSIBLE"))
| false | 0 | [
"-print((int(c) if c % 1.0 == 0 else \"IMPOSSIBLE\"))",
"+print((int(c) if c == int(c) else \"IMPOSSIBLE\"))"
] | false | 0.040518 | 0.039454 | 1.026988 | [
"s342498357",
"s981968769"
] |
u644907318 | p03107 | python | s882705877 | s603854655 | 165 | 66 | 39,280 | 64,648 | Accepted | Accepted | 60 | S = input().strip()
N = len(S)
cnt = 0
for i in range(N):
if S[i]=="1":
cnt += 1
print((min(cnt,N-cnt)*2)) | S = input().strip()
cnt0 = 0
cnt1 = 0
for i in range(len(S)):
if S[i]=="0":
cnt0 += 1
else:
cnt1 += 1
print((min(cnt0,cnt1)*2)) | 7 | 9 | 122 | 157 | S = input().strip()
N = len(S)
cnt = 0
for i in range(N):
if S[i] == "1":
cnt += 1
print((min(cnt, N - cnt) * 2))
| S = input().strip()
cnt0 = 0
cnt1 = 0
for i in range(len(S)):
if S[i] == "0":
cnt0 += 1
else:
cnt1 += 1
print((min(cnt0, cnt1) * 2))
| false | 22.222222 | [
"-N = len(S)",
"-cnt = 0",
"-for i in range(N):",
"- if S[i] == \"1\":",
"- cnt += 1",
"-print((min(cnt, N - cnt) * 2))",
"+cnt0 = 0",
"+cnt1 = 0",
"+for i in range(len(S)):",
"+ if S[i] == \"0\":",
"+ cnt0 += 1",
"+ else:",
"+ cnt1 += 1",
"+print((min(cnt0, c... | false | 0.007684 | 0.036313 | 0.211611 | [
"s882705877",
"s603854655"
] |
u751717561 | p04033 | python | s388777216 | s181812234 | 155 | 18 | 12,196 | 3,060 | Accepted | Accepted | 88.39 | import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
#N = I()
... | a, b = list(map(int, input().split()))
if a > 0:
print('Positive')
elif a <= 0 and b >= 0:
print('Zero')
else:
if (a+b)%2 == 0:
print('Negative')
else:
print('Positive') | 20 | 11 | 538 | 206 | import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
def S():
return sys.stdin.readline().rstrip()
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LS():
return list(sys.stdin.readline().rs... | a, b = list(map(int, input().split()))
if a > 0:
print("Positive")
elif a <= 0 and b >= 0:
print("Zero")
else:
if (a + b) % 2 == 0:
print("Negative")
else:
print("Positive")
| false | 45 | [
"-import bisect, collections, copy, heapq, itertools, math, numpy, string",
"-import sys",
"-",
"-",
"-def S():",
"- return sys.stdin.readline().rstrip()",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-",
"-",
"-def LI():",
"- return list(map(int, sys.std... | false | 0.034355 | 0.041464 | 0.828543 | [
"s388777216",
"s181812234"
] |
u077291787 | p03721 | python | s339277394 | s896786011 | 351 | 312 | 28,640 | 28,640 | Accepted | Accepted | 11.11 | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cur, cnt, ans = 0, 0, 0
while cnt < k:
cnt += arr[cur][1]
ans = arr[cur][0]
... | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cur, cnt, ans = 0, 0, 0
for i, j in arr:
ans = i
cnt += j
if cnt >= k:
... | 17 | 18 | 391 | 396 | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cur, cnt, ans = 0, 0, 0
while cnt < k:
cnt += arr[cur][1]
ans = arr[cur][0]
cur +=... | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cur, cnt, ans = 0, 0, 0
for i, j in arr:
ans = i
cnt += j
if cnt >= k:
... | false | 5.555556 | [
"- while cnt < k:",
"- cnt += arr[cur][1]",
"- ans = arr[cur][0]",
"- cur += 1",
"+ for i, j in arr:",
"+ ans = i",
"+ cnt += j",
"+ if cnt >= k:",
"+ break"
] | false | 0.059677 | 0.035775 | 1.668121 | [
"s339277394",
"s896786011"
] |
u077291787 | p03160 | python | s702172749 | s832459971 | 85 | 76 | 14,184 | 14,276 | Accepted | Accepted | 10.59 | # dpA - Frog 1
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
x, y = 0, abs(A[1] - A[0])
for i in range(2, n):
dif1 = x + abs(A[i] - A[i - 2])
dif2 = y + abs(A[i] - A[i - 1])
x, y = y, min(dif1, dif2)
print(y)
if __name__ == "__... | # dpA - Frog 1
"""
Example:
x y
x y
x y ...
x y (y: answer)
"""
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
x, y = 0, abs(A[1] - A[0])
for i in range(2, n):
dif1 = x + abs(A[i] - A[i - 2])
dif2 = y + abs(A[i] - A[i - 1])
x ... | 14 | 22 | 334 | 419 | # dpA - Frog 1
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
x, y = 0, abs(A[1] - A[0])
for i in range(2, n):
dif1 = x + abs(A[i] - A[i - 2])
dif2 = y + abs(A[i] - A[i - 1])
x, y = y, min(dif1, dif2)
print(y)
if __name__ == "__main__":
... | # dpA - Frog 1
"""
Example:
x y
x y
x y ...
x y (y: answer)
"""
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
x, y = 0, abs(A[1] - A[0])
for i in range(2, n):
dif1 = x + abs(A[i] - A[i - 2])
dif2 = y + abs(A[i] - A[i - 1])
x = y
y... | false | 36.363636 | [
"+\"\"\"",
"+Example:",
"+x y",
"+ x y",
"+ x y ...",
"+ x y (y: answer)",
"+\"\"\"",
"+",
"+",
"- A = tuple(map(int, input().rstrip().split()))",
"+ A = tuple(map(int, input().split()))",
"- x, y = y, min(dif1, dif2)",
"+ x = y",
"+ y = dif1 if dif1 <... | false | 0.084626 | 0.043291 | 1.954811 | [
"s702172749",
"s832459971"
] |
u185896732 | p02935 | python | s242056609 | s125842061 | 186 | 18 | 38,640 | 3,060 | Accepted | Accepted | 90.32 | #import pysnooper
import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
setrecursionlimit(10**6)
n=int(stdin.readline().rstrip()... | #import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy
setrecursionlimit(10**6)... | 16 | 17 | 459 | 480 | # import pysnooper
import os, re, sys, operator, math, heapq, string
from collections import Counter, deque
from operator import itemgetter
from itertools import accumulate, combinations, groupby
from sys import stdin, setrecursionlimit
from copy import deepcopy
setrecursionlimit(10**6)
n = int(stdin.readline().rstrip... | # import pysnooper
# import os,re,sys,operator,math,heapq,string
# from collections import Counter,deque
# from operator import itemgetter
# from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin, setrecursionlimit
# from copy import deepcopy
setrecursionlimit(10**6)
... | false | 5.882353 | [
"-import os, re, sys, operator, math, heapq, string",
"-from collections import Counter, deque",
"-from operator import itemgetter",
"-from itertools import accumulate, combinations, groupby",
"+# import os,re,sys,operator,math,heapq,string",
"+# from collections import Counter,deque",
"+# from operator... | false | 0.036013 | 0.035921 | 1.002565 | [
"s242056609",
"s125842061"
] |
u510829608 | p02260 | python | s109274365 | s925467501 | 30 | 20 | 7,692 | 7,732 | Accepted | Accepted | 33.33 | n = int(eval(input()))
li = list(map(int, input().split()))
cnt = 0
for i in range(n):
minj = i
for j in range(i, n):
if li[j] < li[minj]:
minj = j
if li[i] != li[minj]:
li[i], li[minj] = li[minj], li[i]
cnt += 1
print((*li))
print(cnt) | N = int(eval(input()))
A = list(map(int, input().split()))
def selectionSort(A,N):
cnt = 0
for i in range(N-1):
minj = i
for j in range(i, N):
if A[j] < A[minj]:
minj = j
if i != minj:
cnt += 1
A[i], A[minj] = A[minj], A[... | 15 | 18 | 256 | 374 | n = int(eval(input()))
li = list(map(int, input().split()))
cnt = 0
for i in range(n):
minj = i
for j in range(i, n):
if li[j] < li[minj]:
minj = j
if li[i] != li[minj]:
li[i], li[minj] = li[minj], li[i]
cnt += 1
print((*li))
print(cnt)
| N = int(eval(input()))
A = list(map(int, input().split()))
def selectionSort(A, N):
cnt = 0
for i in range(N - 1):
minj = i
for j in range(i, N):
if A[j] < A[minj]:
minj = j
if i != minj:
cnt += 1
A[i], A[minj] = A[minj], A[i]
print((... | false | 16.666667 | [
"-n = int(eval(input()))",
"-li = list(map(int, input().split()))",
"-cnt = 0",
"-for i in range(n):",
"- minj = i",
"- for j in range(i, n):",
"- if li[j] < li[minj]:",
"- minj = j",
"- if li[i] != li[minj]:",
"- li[i], li[minj] = li[minj], li[i]",
"- cn... | false | 0.035845 | 0.035023 | 1.023492 | [
"s109274365",
"s925467501"
] |
u087731474 | p03319 | python | s214258957 | s644425845 | 54 | 48 | 20,404 | 20,668 | Accepted | Accepted | 11.11 | n,k=list(map(int, input().split()))
a=list(map(int,input().split()))
ans=0
if n==k:
print((1))
exit()
if (n-1)%(k-1) == 0:
print(((n-1)//(k-1)))
else:
print(((n-1)//(k-1)+1)) | n,k=list(map(int, input().split()))
a=list(map(int,input().split()))
ans=0
if (n-1)%(k-1) == 0:
print(((n-1)//(k-1)))
else:
print(((n-1)//(k-1)+1))
| 12 | 9 | 183 | 152 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
if n == k:
print((1))
exit()
if (n - 1) % (k - 1) == 0:
print(((n - 1) // (k - 1)))
else:
print(((n - 1) // (k - 1) + 1))
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
if (n - 1) % (k - 1) == 0:
print(((n - 1) // (k - 1)))
else:
print(((n - 1) // (k - 1) + 1))
| false | 25 | [
"-if n == k:",
"- print((1))",
"- exit()"
] | false | 0.050453 | 0.049059 | 1.028422 | [
"s214258957",
"s644425845"
] |
u379720557 | p02702 | python | s103311523 | s625258228 | 135 | 124 | 9,368 | 9,304 | Accepted | Accepted | 8.15 | s=eval(input())
n=len(s)
mod=2019
d=0
p=1
ml=[0]*mod
for i in range(1,n+1):
k=int(s[-i])
d+=p*k
d%=mod
ml[d]+=1
p*=10
p%=mod
ans=0
for i in ml:
ans+=i*(i-1)//2
print((ans+ml[0])) | S = input()[::-1]
m = 2019
cnt = [0] * m
cnt[0] = 1
total = 0
x = 1
ans = 0
for i in range(len(S)):
total += int(S[i])*x
total %= m
cnt[total] += 1
x = 10*x
x %= m
for i in range(2019):
ans += cnt[i]*(cnt[i]-1)//2
print(ans) | 17 | 20 | 200 | 271 | s = eval(input())
n = len(s)
mod = 2019
d = 0
p = 1
ml = [0] * mod
for i in range(1, n + 1):
k = int(s[-i])
d += p * k
d %= mod
ml[d] += 1
p *= 10
p %= mod
ans = 0
for i in ml:
ans += i * (i - 1) // 2
print((ans + ml[0]))
| S = input()[::-1]
m = 2019
cnt = [0] * m
cnt[0] = 1
total = 0
x = 1
ans = 0
for i in range(len(S)):
total += int(S[i]) * x
total %= m
cnt[total] += 1
x = 10 * x
x %= m
for i in range(2019):
ans += cnt[i] * (cnt[i] - 1) // 2
print(ans)
| false | 15 | [
"-s = eval(input())",
"-n = len(s)",
"-mod = 2019",
"-d = 0",
"-p = 1",
"-ml = [0] * mod",
"-for i in range(1, n + 1):",
"- k = int(s[-i])",
"- d += p * k",
"- d %= mod",
"- ml[d] += 1",
"- p *= 10",
"- p %= mod",
"+S = input()[::-1]",
"+m = 2019",
"+cnt = [0] * m",
... | false | 0.039271 | 0.068398 | 0.574152 | [
"s103311523",
"s625258228"
] |
u673173160 | p02899 | python | s725399337 | s682519223 | 395 | 103 | 93,480 | 88,232 | Accepted | Accepted | 73.92 | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n=int(eval(input()))
A=[(e,i) for i,e in enumerate(list(map(int,input().split())))]
#print(A)
A.sort(key=lambda tup:... | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n = int(eval(input()))
A = list(map(int, input().split()))
ans = [-1]*n
for i, a in enumerate(A):
ans[a-1] = i+... | 12 | 12 | 364 | 346 | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n = int(eval(input()))
A = [(e, i) for i, e in enumerate(list(map(int, input().split())))]
# print(A)
A.sort(key=lambda tup: tup[... | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n = int(eval(input()))
A = list(map(int, input().split()))
ans = [-1] * n
for i, a in enumerate(A):
ans[a - 1] = i + 1
# ... | false | 0 | [
"-A = [(e, i) for i, e in enumerate(list(map(int, input().split())))]",
"-# print(A)",
"-A.sort(key=lambda tup: tup[0])",
"-# print(A)",
"-for e, i in A:",
"- print((i + 1))",
"+A = list(map(int, input().split()))",
"+ans = [-1] * n",
"+for i, a in enumerate(A):",
"+ ans[a - 1] = i + 1",
"... | false | 0.075749 | 0.039232 | 1.930801 | [
"s725399337",
"s682519223"
] |
u970197315 | p02792 | python | s317759972 | s802369771 | 198 | 142 | 3,188 | 9,132 | Accepted | Accepted | 28.28 | # ABC 152 D
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
snm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
n=ni()
c=[[0]*10 for _ in range(10)]
for i in range(1,n+1):
sl=str(i)
sl_s=int(sl[0])
sl... | n=int(eval(input()))
c=[[0]*10 for i in range(10)]
for a in range(1,n+1):
a=str(a)
c[int(a[-1])][int(a[0])]+=1
ans=0
for i in range(1,10):
for j in range(1,10):
ans+=c[i][j]*c[j][i]
print(ans)
| 20 | 11 | 433 | 208 | # ABC 152 D
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
snm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
n = ni()
c = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
sl = str(i)
sl_s = int(sl[0])
sl... | n = int(eval(input()))
c = [[0] * 10 for i in range(10)]
for a in range(1, n + 1):
a = str(a)
c[int(a[-1])][int(a[0])] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += c[i][j] * c[j][i]
print(ans)
| false | 45 | [
"-# ABC 152 D",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(int, input().split()))",
"-snm = lambda: list(map(str, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-n = ni()",
"-c = [[0] * 10 for _ in range(10)]",
"-for i in range(1... | false | 0.067895 | 0.066011 | 1.028541 | [
"s317759972",
"s802369771"
] |
u179169725 | p03166 | python | s442659175 | s678587632 | 266 | 241 | 96,904 | 96,752 | Accepted | Accepted | 9.4 | # DAGの最長経路...トポロジカルソートもどきか?
# 普通にDAGに沿ったdpをすればいいのでは?
# 再帰だと実装楽そうだけどどうしよう
# 問題は終了と最初がわからんこと
# いや最初は全部長さ0をセットすればいいだろ
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv... | # DAGの最長経路...トポロジカルソートもどきか?
# 普通にDAGに沿ったdpをすればいいのでは?
# 再帰だと実装楽そうだけどどうしよう
# 問題は終了と最初がわからんこと
# いや最初は全部長さ0をセットすればいいだろ
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv... | 67 | 67 | 1,621 | 1,624 | # DAGの最長経路...トポロジカルソートもどきか?
# 普通にDAGに沿ったdpをすればいいのでは?
# 再帰だと実装楽そうだけどどうしよう
# 問題は終了と最初がわからんこと
# いや最初は全部長さ0をセットすればいいだろ
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
... | # DAGの最長経路...トポロジカルソートもどきか?
# 普通にDAGに沿ったdpをすればいいのでは?
# 再帰だと実装楽そうだけどどうしよう
# 問題は終了と最初がわからんこと
# いや最初は全部長さ0をセットすればいいだろ
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
... | false | 0 | [
"- q.append(u)",
"+ q.append((u, 0))",
"- u = q.popleft()",
"+ u, l = q.popleft()",
"+ dp[u] = max(dp[u], l)",
"- dp[nx] = max(dp[nx], dp[u] + 1)",
"- q.append(nx)",
"+ q.append((nx, l + 1))"
] | false | 0.047742 | 0.086592 | 0.551349 | [
"s442659175",
"s678587632"
] |
u621935300 | p02733 | python | s097130463 | s889565641 | 1,629 | 755 | 34,588 | 33,900 | Accepted | Accepted | 53.65 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
H,W,K=list(map(int, sys.stdin.readline().split()))
S=[ sys.stdin.readline().strip() for _ in range(H) ]
#print H,W,K
#print S
ans=float("inf")
for bit in range(2**H):
cnt=0
group_num=0
GROUP={}
for i,s in enumerate(S)... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
H,W,K=list(map(int, sys.stdin.readline().split()))
S=[ sys.stdin.readline().strip() for _ in range(H) ]
#print H,W,K
#print S
ans=float("inf")
for bit in range(2**H):
cnt=0
group_num=0
GROUP={}
for i,s in enumerate(S)... | 51 | 56 | 1,429 | 1,605 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
H, W, K = list(map(int, sys.stdin.readline().split()))
S = [sys.stdin.readline().strip() for _ in range(H)]
# print H,W,K
# print S
ans = float("inf")
for bit in range(2**H):
cnt = 0
group_num = 0
GROUP = {}
for i, s in enumerate(S)... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
H, W, K = list(map(int, sys.stdin.readline().split()))
S = [sys.stdin.readline().strip() for _ in range(H)]
# print H,W,K
# print S
ans = float("inf")
for bit in range(2**H):
cnt = 0
group_num = 0
GROUP = {}
for i, s in enumerate(S)... | false | 8.928571 | [
"+ break_flag = False",
"+ if break_flag: # breakフラグがTrueならループを止める",
"+ break",
"+ break_flag = True # breakフラグにTrueを代入",
"+ break"
] | false | 0.03997 | 0.075647 | 0.528376 | [
"s097130463",
"s889565641"
] |
u784022244 | p03393 | python | s498710150 | s048062533 | 161 | 88 | 61,888 | 61,828 | Accepted | Accepted | 45.34 | S=list(eval(input()))
N=len(S)
abc=list("abcdefghijklmnopqrstuvwxyz")
D={}
for a in abc:
D[a]=0
idx={}
for i in range(26):
idx[abc[i]]=i
for s in S:
D[s]+=1
L=[]
for k,v in list(D.items()):
if v==0:
L.append(k)
L=sorted(L)
if len(L)==0:
lis=[]
for i in range(25,-1,-... | S=list(eval(input()))
abc=list("abcdefghijklmnopqrstuvwxyz")
idx={}
for i in range(26):
idx[abc[i]]=i
D=[0]*26
for s in S:
D[idx[s]]+=1
if len(S)!=26:
for i in range(26):
if D[idx[abc[i]]]==0:
ans="".join(S)+abc[i]
break
else:
ans=-1
now=S[-... | 42 | 36 | 718 | 725 | S = list(eval(input()))
N = len(S)
abc = list("abcdefghijklmnopqrstuvwxyz")
D = {}
for a in abc:
D[a] = 0
idx = {}
for i in range(26):
idx[abc[i]] = i
for s in S:
D[s] += 1
L = []
for k, v in list(D.items()):
if v == 0:
L.append(k)
L = sorted(L)
if len(L) == 0:
lis = []
for i in range(25... | S = list(eval(input()))
abc = list("abcdefghijklmnopqrstuvwxyz")
idx = {}
for i in range(26):
idx[abc[i]] = i
D = [0] * 26
for s in S:
D[idx[s]] += 1
if len(S) != 26:
for i in range(26):
if D[idx[abc[i]]] == 0:
ans = "".join(S) + abc[i]
break
else:
ans = -1
now = S[-1... | false | 14.285714 | [
"-N = len(S)",
"-D = {}",
"-for a in abc:",
"- D[a] = 0",
"+D = [0] * 26",
"- D[s] += 1",
"-L = []",
"-for k, v in list(D.items()):",
"- if v == 0:",
"- L.append(k)",
"-L = sorted(L)",
"-if len(L) == 0:",
"- lis = []",
"- for i in range(25, -1, -1):",
"- s = ... | false | 0.047175 | 0.047326 | 0.99681 | [
"s498710150",
"s048062533"
] |
u691018832 | p02647 | python | s648213638 | s228757607 | 366 | 230 | 204,252 | 98,308 | Accepted | Accepted | 37.16 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
n, k = list(map(int, readline().split()))
a = list(map(int, readline().split()))... | def main():
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()))
a = list(map(int, readline().split()))
memo = [0] * (n + 1)
for _ in ran... | 25 | 30 | 651 | 803 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from itertools import accumulate
n, k = list(map(int, readline().split()))
a = list(map(int, readline().split()))
check = [n]... | def main():
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()))
a = list(map(int, readline().split()))
memo = [0] * (n + 1)
for _ in range(k):
... | false | 16.666667 | [
"- from itertools import accumulate",
"-",
"- check = [n] * n",
"- for i in range(k):",
"- memo = [0] * (n + 1)",
"- for j, aa in enumerate(a):",
"- memo[max(0, j - aa)] += 1",
"- memo[min(n, j + aa + 1)] -= 1",
"- a = list(accumulate(memo))[:-1]",... | false | 0.057474 | 0.058746 | 0.978336 | [
"s648213638",
"s228757607"
] |
u567281053 | p02240 | python | s938704362 | s462869167 | 480 | 400 | 29,128 | 28,972 | Accepted | Accepted | 16.67 | def bfs(i, c):
global V, C
q = []
j = i
while True:
if C[j] == -1:
C[j] = c
q += V[j]
if len(q) == 0:
break
j = q.pop()
n, m = list(map(int, input().split()))
V = [[] for _ in range(n)]
C = [-1] * n
for _ in range(m):
l, ... | def bfs(i, c):
global V, C
q = [i]
while len(q) > 0:
j = q.pop()
if C[j] == -1:
C[j] = c
q += V[j]
n, m = list(map(int, input().split()))
V = [[] for _ in range(n)]
C = [-1] * n
for _ in range(m):
l, r = list(map(int, input().split()))
V[l].ap... | 34 | 31 | 635 | 587 | def bfs(i, c):
global V, C
q = []
j = i
while True:
if C[j] == -1:
C[j] = c
q += V[j]
if len(q) == 0:
break
j = q.pop()
n, m = list(map(int, input().split()))
V = [[] for _ in range(n)]
C = [-1] * n
for _ in range(m):
l, r = list(map(int,... | def bfs(i, c):
global V, C
q = [i]
while len(q) > 0:
j = q.pop()
if C[j] == -1:
C[j] = c
q += V[j]
n, m = list(map(int, input().split()))
V = [[] for _ in range(n)]
C = [-1] * n
for _ in range(m):
l, r = list(map(int, input().split()))
V[l].append(r)
V[r... | false | 8.823529 | [
"- q = []",
"- j = i",
"- while True:",
"+ q = [i]",
"+ while len(q) > 0:",
"+ j = q.pop()",
"- if len(q) == 0:",
"- break",
"- j = q.pop()"
] | false | 0.035667 | 0.036712 | 0.971537 | [
"s938704362",
"s462869167"
] |
u279955105 | p02401 | python | s163832214 | s189300061 | 30 | 20 | 7,556 | 5,596 | Accepted | Accepted | 33.33 | while True:
a,b,c = input().split()
if b=='?':
break
elif b =='+':
d = int(a) + int(c)
elif b=='-':
d = int(a) - int(c)
elif b=='*':
d = int(a)*int(c)
else :
d = int(a)/int(c)
print((int(d))) | while True:
Input = input().split()
a = int(Input[0])
op = Input[1]
b = int(Input[2])
if op == '?':
break
if op == '+':
print((a+b))
elif op == '-':
print((a-b))
elif op == '*':
print((a*b))
else:
print((a//b))
| 13 | 17 | 269 | 305 | while True:
a, b, c = input().split()
if b == "?":
break
elif b == "+":
d = int(a) + int(c)
elif b == "-":
d = int(a) - int(c)
elif b == "*":
d = int(a) * int(c)
else:
d = int(a) / int(c)
print((int(d)))
| while True:
Input = input().split()
a = int(Input[0])
op = Input[1]
b = int(Input[2])
if op == "?":
break
if op == "+":
print((a + b))
elif op == "-":
print((a - b))
elif op == "*":
print((a * b))
else:
print((a // b))
| false | 23.529412 | [
"- a, b, c = input().split()",
"- if b == \"?\":",
"+ Input = input().split()",
"+ a = int(Input[0])",
"+ op = Input[1]",
"+ b = int(Input[2])",
"+ if op == \"?\":",
"- elif b == \"+\":",
"- d = int(a) + int(c)",
"- elif b == \"-\":",
"- d = int(a) - int(... | false | 0.033537 | 0.042828 | 0.783067 | [
"s163832214",
"s189300061"
] |
u672220554 | p02781 | python | s797459324 | s326671009 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | N = eval(input())
L = len(N)
K = int(eval(input()))
if L < K:
print((0))
else:
def main(d, k):
if (L - d) < k:
return 0
if N[d] == "0":
return main(d + 1, k)
if k == 1:
return ((L - d) - 1) * 9 + int(N[d])
elif k == 2:
... | N = eval(input())
L = len(N)
K = int(eval(input()))
def main(d, k):
if (L - d) < k:
return 0
if N[d] == "0":
return main(d + 1, k)
if k == 1:
return ((L - d) - 1) * 9 + int(N[d])
elif k == 2:
return (
((((L - d) - 1) * ((L - d) - 2)) // 2) * 81... | 29 | 28 | 775 | 667 | N = eval(input())
L = len(N)
K = int(eval(input()))
if L < K:
print((0))
else:
def main(d, k):
if (L - d) < k:
return 0
if N[d] == "0":
return main(d + 1, k)
if k == 1:
return ((L - d) - 1) * 9 + int(N[d])
elif k == 2:
return (
... | N = eval(input())
L = len(N)
K = int(eval(input()))
def main(d, k):
if (L - d) < k:
return 0
if N[d] == "0":
return main(d + 1, k)
if k == 1:
return ((L - d) - 1) * 9 + int(N[d])
elif k == 2:
return (
((((L - d) - 1) * ((L - d) - 2)) // 2) * 81
+... | false | 3.448276 | [
"-if L < K:",
"- print((0))",
"-else:",
"- def main(d, k):",
"- if (L - d) < k:",
"- return 0",
"- if N[d] == \"0\":",
"- return main(d + 1, k)",
"- if k == 1:",
"- return ((L - d) - 1) * 9 + int(N[d])",
"- elif k == 2:",
"- ... | false | 0.048199 | 0.048025 | 1.003625 | [
"s797459324",
"s326671009"
] |
u021019433 | p02947 | python | s548178285 | s712363061 | 1,514 | 404 | 74,704 | 23,908 | Accepted | Accepted | 73.32 | from collections import Counter
c = Counter(tuple(sorted(Counter(eval(input())).items())) for _ in range(int(eval(input()))))
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| from collections import Counter
c = Counter(tuple(sorted(eval(input()))) for _ in range(int(eval(input()))))
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| 3 | 3 | 165 | 148 | from collections import Counter
c = Counter(
tuple(sorted(Counter(eval(input())).items())) for _ in range(int(eval(input())))
)
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| from collections import Counter
c = Counter(tuple(sorted(eval(input()))) for _ in range(int(eval(input()))))
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| false | 0 | [
"-c = Counter(",
"- tuple(sorted(Counter(eval(input())).items())) for _ in range(int(eval(input())))",
"-)",
"+c = Counter(tuple(sorted(eval(input()))) for _ in range(int(eval(input()))))"
] | false | 0.047061 | 0.038732 | 1.215051 | [
"s548178285",
"s712363061"
] |
u564589929 | p02707 | python | s489619409 | s146382619 | 182 | 137 | 33,484 | 32,288 | Accepted | Accepted | 24.73 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(... | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): retur... | 27 | 28 | 576 | 625 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LLI(rows_number):
return [L... | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def... | false | 3.571429 | [
"-# import sys",
"-# sys.setrecursionlimit(10 ** 6)",
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+# input = sys.stdin.readline ####",
"+def LI1():",
"+ return list(map(int1, input().split()))",
"+",
"+",
"+",
"+",
"+INF = float(\"inf\")",
"- j = {}",
"- for a in A:... | false | 0.038835 | 0.046879 | 0.8284 | [
"s489619409",
"s146382619"
] |
u905895868 | p03238 | python | s160268925 | s262094480 | 28 | 24 | 9,028 | 9,056 | Accepted | Accepted | 14.29 | age = int(eval(input()))
if age == 1:
print('Hello World')
elif age == 2:
a = int(eval(input()))
b = int(eval(input()))
print((a + b)) | n = int(eval(input()))
if n == 1:
print('Hello World')
else:
a = int(eval(input()))
b = int(eval(input()))
print((a + b))
| 8 | 8 | 138 | 126 | age = int(eval(input()))
if age == 1:
print("Hello World")
elif age == 2:
a = int(eval(input()))
b = int(eval(input()))
print((a + b))
| n = int(eval(input()))
if n == 1:
print("Hello World")
else:
a = int(eval(input()))
b = int(eval(input()))
print((a + b))
| false | 0 | [
"-age = int(eval(input()))",
"-if age == 1:",
"+n = int(eval(input()))",
"+if n == 1:",
"-elif age == 2:",
"+else:"
] | false | 0.038016 | 0.038661 | 0.983322 | [
"s160268925",
"s262094480"
] |
u076917070 | p02936 | python | s814495297 | s248644672 | 1,148 | 944 | 102,472 | 102,448 | Accepted | Accepted | 17.77 | import sys
input=sys.stdin.readline
N,Q = list(map(int, input().split()))
edge = [[] for _ in range(N+1)]
for _ in range(N-1):
a,b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
P = []
for i in range(Q):
x,y = list(map(int, input().split()))
P.append((x,y))
... | import sys
input=sys.stdin.readline
def main():
N,Q = list(map(int, input().split()))
edge = [[] for _ in range(N+1)]
for _ in range(N-1):
a,b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
P = []
for i in range(Q):
x,y = list(m... | 33 | 37 | 645 | 800 | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
P = []
for i in range(Q):
x, y = list(map(int, input().split()))
P.append((x, y))
V = [0] ... | import sys
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
P = []
for i in range(Q):
x, y = list(map(in... | false | 10.810811 | [
"-N, Q = list(map(int, input().split()))",
"-edge = [[] for _ in range(N + 1)]",
"-for _ in range(N - 1):",
"- a, b = list(map(int, input().split()))",
"- edge[a].append(b)",
"- edge[b].append(a)",
"-P = []",
"-for i in range(Q):",
"- x, y = list(map(int, input().split()))",
"- P.ap... | false | 0.046137 | 0.112322 | 0.410754 | [
"s814495297",
"s248644672"
] |
u334712262 | p02919 | python | s095605040 | s973887980 | 1,828 | 1,466 | 124,820 | 118,136 | Accepted | Accepted | 19.8 | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def read_float():
retu... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | 123 | 125 | 2,704 | 2,736 | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def read_float():
return float(buff_re... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | false | 1.6 | [
"-buff_readline = sys.stdin.buffer.readline",
"+# buff_readline = sys.stdin.buffer.readline",
"+buff_readline = sys.stdin.readline",
"+@mt",
"- lst = SegmentTree([0] * (N + 1), max, 0)",
"- rst = SegmentTree([N + 1] * (N + 1), min, N + 1)",
"- pi = [(p, i + 1) for i, p in enumerate(P)]",
"- ... | false | 0.064159 | 0.080661 | 0.795418 | [
"s095605040",
"s973887980"
] |
u788068140 | p02936 | python | s762001058 | s048274748 | 1,959 | 1,749 | 131,628 | 352,804 | Accepted | Accepted | 10.72 | from sys import setrecursionlimit
setrecursionlimit(100000)
from collections import deque
S = input().split(" ")
N = int(S[0])
Q = int(S[1])
arr = []
prr = []
for i in range(N-1):
S = input().split(" ")
ar = [int(S[0]),int(S[1])]
arr.append(ar)
for i in range(Q):
S = input().split(" "... | import sys
sys.setrecursionlimit(10000000)
N, Q = list(map(int, input().split()))
ARR = []
for i in range(N-1):
ARR.append(list(map(int, input().split())))
BRR = []
for i in range(Q):
BRR.append(list(map(int, input().split())))
def prepare(n, q, arr, brr):
nodePoints = [0 for i in rang... | 60 | 48 | 1,327 | 1,136 | from sys import setrecursionlimit
setrecursionlimit(100000)
from collections import deque
S = input().split(" ")
N = int(S[0])
Q = int(S[1])
arr = []
prr = []
for i in range(N - 1):
S = input().split(" ")
ar = [int(S[0]), int(S[1])]
arr.append(ar)
for i in range(Q):
S = input().split(" ")
pr = [in... | import sys
sys.setrecursionlimit(10000000)
N, Q = list(map(int, input().split()))
ARR = []
for i in range(N - 1):
ARR.append(list(map(int, input().split())))
BRR = []
for i in range(Q):
BRR.append(list(map(int, input().split())))
def prepare(n, q, arr, brr):
nodePoints = [0 for i in range(n)]
for i i... | false | 20 | [
"-from sys import setrecursionlimit",
"+import sys",
"-setrecursionlimit(100000)",
"-from collections import deque",
"-",
"-S = input().split(\" \")",
"-N = int(S[0])",
"-Q = int(S[1])",
"-arr = []",
"-prr = []",
"+sys.setrecursionlimit(10000000)",
"+N, Q = list(map(int, input().split()))",
... | false | 0.034448 | 0.069961 | 0.492396 | [
"s762001058",
"s048274748"
] |
u535803878 | p02815 | python | s103352921 | s304724754 | 1,343 | 382 | 26,024 | 26,024 | Accepted | Accepted | 71.56 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
M = 10**9+7
ans = 0
ans += a[0]*(pow(2, 0, M))*pow(2, n-1,M)
for i in range(1,n):
... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(eval(input()))
a = list(map(int, input().split()))
M = 10**9+7
pp = [None]*n
v = 1
for i in range(n):
pp[i] = v
v *= 2
v %= M
a.sort()
a ... | 19 | 28 | 443 | 513 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
M = 10**9 + 7
ans = 0
ans += a[0] * (pow(2, 0, M)) * pow(2, n - 1, M)
for i in range(1, n):
n... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n = int(eval(input()))
a = list(map(int, input().split()))
M = 10**9 + 7
pp = [None] * n
v = 1
for i in range(n):
pp[i] = v
v *= 2
v %= M
a.sort()
a = a[::-1]
ans = ... | false | 32.142857 | [
"+M = 10**9 + 7",
"+pp = [None] * n",
"+v = 1",
"+for i in range(n):",
"+ pp[i] = v",
"+ v *= 2",
"+ v %= M",
"-M = 10**9 + 7",
"- ans += num * (pow(2, i, M) + i * pow(2, i - 1, M)) * pow(2, n - i - 1, M)",
"+ ans += num * (pp[i] + i * pp[i - 1]) * pp[n - i - 1]"
] | false | 0.084923 | 0.037761 | 2.248971 | [
"s103352921",
"s304724754"
] |
u864197622 | p03157 | python | s483969144 | s343300228 | 1,420 | 635 | 170,224 | 5,996 | Accepted | Accepted | 55.28 | import sys
sys.setrecursionlimit(180000)
def dfs(i,j):
for m in move:
ni = i + m[0]
nj = j + m[1]
if ni < 0 or ni >= H or nj < 0 or nj >= W:
continue
if ch[ni][nj]:
continue
if X[i][j] == X[ni][nj]:
continue
... | from collections import deque
H, W = list(map(int, input().split()))
X = [[[0, 1][a=="#"] for a in eval(input())] for i in range(H)]
ch = [[0] * W for _ in range(H)]
move = [[-1,0], [1,0], [0,-1], [0,1]]
ans = 0
for i in range(H):
for j in range(W):
if ch[i][j]:
continue
... | 38 | 31 | 821 | 848 | import sys
sys.setrecursionlimit(180000)
def dfs(i, j):
for m in move:
ni = i + m[0]
nj = j + m[1]
if ni < 0 or ni >= H or nj < 0 or nj >= W:
continue
if ch[ni][nj]:
continue
if X[i][j] == X[ni][nj]:
continue
ch[ni][nj] = 1
... | from collections import deque
H, W = list(map(int, input().split()))
X = [[[0, 1][a == "#"] for a in eval(input())] for i in range(H)]
ch = [[0] * W for _ in range(H)]
move = [[-1, 0], [1, 0], [0, -1], [0, 1]]
ans = 0
for i in range(H):
for j in range(W):
if ch[i][j]:
continue
q = deque... | false | 18.421053 | [
"-import sys",
"-",
"-sys.setrecursionlimit(180000)",
"-",
"-",
"-def dfs(i, j):",
"- for m in move:",
"- ni = i + m[0]",
"- nj = j + m[1]",
"- if ni < 0 or ni >= H or nj < 0 or nj >= W:",
"- continue",
"- if ch[ni][nj]:",
"- continue",
... | false | 0.044219 | 0.043703 | 1.011796 | [
"s483969144",
"s343300228"
] |
u278057806 | p02732 | python | s137230736 | s194046792 | 500 | 345 | 29,808 | 25,912 | Accepted | Accepted | 31 | from collections import Counter
from sys import stdin
N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
cnt = Counter(A)
tmp = cnt.most_common()
def comb(n):
return n * (n - 1) // 2
sumall = 0
for i in range(len(cnt)):
sumall += comb(tmp[i][1])
for a in A:
... | from collections import Counter
from sys import stdin
N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
cnt = Counter(A)
def comb(n):
return n * (n - 1) // 2
sumall = 0
for i in list(cnt.values()):
sumall += comb(i)
for a in A:
ans = sumall - (cnt[a] - 1)
... | 23 | 21 | 385 | 326 | from collections import Counter
from sys import stdin
N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
cnt = Counter(A)
tmp = cnt.most_common()
def comb(n):
return n * (n - 1) // 2
sumall = 0
for i in range(len(cnt)):
sumall += comb(tmp[i][1])
for a in A:
ans = sumall - (comb(cnt[... | from collections import Counter
from sys import stdin
N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
cnt = Counter(A)
def comb(n):
return n * (n - 1) // 2
sumall = 0
for i in list(cnt.values()):
sumall += comb(i)
for a in A:
ans = sumall - (cnt[a] - 1)
print(ans)
| false | 8.695652 | [
"-tmp = cnt.most_common()",
"-for i in range(len(cnt)):",
"- sumall += comb(tmp[i][1])",
"+for i in list(cnt.values()):",
"+ sumall += comb(i)",
"- ans = sumall - (comb(cnt[a]) - comb(cnt[a] - 1))",
"+ ans = sumall - (cnt[a] - 1)"
] | false | 0.038955 | 0.0788 | 0.494348 | [
"s137230736",
"s194046792"
] |
u562935282 | p03659 | python | s408201900 | s242835911 | 172 | 107 | 24,832 | 25,068 | Accepted | Accepted | 37.79 | n = int(eval(input()))
*a, = list(map(int, input().split()))
ret = 10 ** 15
s = 0
t = sum(a)
a.pop() # 最後の要素は取れない
for x in a:
s += x
t -= x
ret = min(ret, abs(s - t))
print(ret)
| def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
tot = sum(A)
ans = (10 ** 9) * (2 * 10 ** 5) + 1
s = 0
for x in A[:-1]:
s += x + x
diff = abs(tot - s)
if ans > diff:
ans = diff
print(ans)
if __name__ == '__main... | 14 | 19 | 195 | 331 | n = int(eval(input()))
(*a,) = list(map(int, input().split()))
ret = 10**15
s = 0
t = sum(a)
a.pop() # 最後の要素は取れない
for x in a:
s += x
t -= x
ret = min(ret, abs(s - t))
print(ret)
| def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
tot = sum(A)
ans = (10**9) * (2 * 10**5) + 1
s = 0
for x in A[:-1]:
s += x + x
diff = abs(tot - s)
if ans > diff:
ans = diff
print(ans)
if __name__ == "__main__":
main()
| false | 26.315789 | [
"-n = int(eval(input()))",
"-(*a,) = list(map(int, input().split()))",
"-ret = 10**15",
"-s = 0",
"-t = sum(a)",
"-a.pop() # 最後の要素は取れない",
"-for x in a:",
"- s += x",
"- t -= x",
"- ret = min(ret, abs(s - t))",
"-print(ret)",
"+def main():",
"+ N = int(eval(input()))",
"+ A ... | false | 0.0395 | 0.038268 | 1.032187 | [
"s408201900",
"s242835911"
] |
u883048396 | p03495 | python | s581946696 | s591160273 | 191 | 101 | 39,064 | 27,264 | Accepted | Accepted | 47.12 | def 解():
iN,iK = [int(_) for _ in input().split()]
#aA = [int(_) for _ in input().split()]
dA = {}
def addD(d,a):
if a in d:
d[a] += 1
else:
d[a] = 1
for a in [int(_) for _ in input().split()]:
addD(dA,a)
aList = sorted(list(dA.items()),... | def 解():
iN,iK = [int(_) for _ in input().split()]
aA = [0]*(iN+1)
for a in [int(_) for _ in input().split()]:
aA[a] += 1
print((sum(sorted(aA)[0:iN-iK+1])))
解()
| 14 | 7 | 403 | 190 | def 解():
iN, iK = [int(_) for _ in input().split()]
# aA = [int(_) for _ in input().split()]
dA = {}
def addD(d, a):
if a in d:
d[a] += 1
else:
d[a] = 1
for a in [int(_) for _ in input().split()]:
addD(dA, a)
aList = sorted(list(dA.items()), key=... | def 解():
iN, iK = [int(_) for _ in input().split()]
aA = [0] * (iN + 1)
for a in [int(_) for _ in input().split()]:
aA[a] += 1
print((sum(sorted(aA)[0 : iN - iK + 1])))
解()
| false | 50 | [
"- # aA = [int(_) for _ in input().split()]",
"- dA = {}",
"-",
"- def addD(d, a):",
"- if a in d:",
"- d[a] += 1",
"- else:",
"- d[a] = 1",
"-",
"+ aA = [0] * (iN + 1)",
"- addD(dA, a)",
"- aList = sorted(list(dA.items()), key=lambda x... | false | 0.038167 | 0.038791 | 0.983904 | [
"s581946696",
"s591160273"
] |
u391819434 | p03274 | python | s038295756 | s357403266 | 99 | 80 | 20,364 | 20,084 | Accepted | Accepted | 19.19 | N,K=list(map(int,input().split()))
*X,=list(map(int,input().split()))
A=[]
B=[]
for x in X:
if x>=0:
A.append(x)
else:
B.append(abs(x))
B.sort()
i=min(K,len(A))
j=K-i
ans=[]
while i>=0 and j<=len(B):
if i==0:
ans.append(B[j-1])
elif j==0:
ans.append(A[i-1... | N,K=list(map(int,input().split()))
*X,=list(map(int,input().split()))
i=0
ans=[]
while i+K-1<N:
a,b=X[i],X[i+K-1]
if b<0:
ans.append(abs(a))
elif a>0:
ans.append(b)
else:
a=abs(a)
ans.append(a+b+min(a,b))
i+=1
print((min(ans))) | 24 | 15 | 419 | 279 | N, K = list(map(int, input().split()))
(*X,) = list(map(int, input().split()))
A = []
B = []
for x in X:
if x >= 0:
A.append(x)
else:
B.append(abs(x))
B.sort()
i = min(K, len(A))
j = K - i
ans = []
while i >= 0 and j <= len(B):
if i == 0:
ans.append(B[j - 1])
elif j == 0:
... | N, K = list(map(int, input().split()))
(*X,) = list(map(int, input().split()))
i = 0
ans = []
while i + K - 1 < N:
a, b = X[i], X[i + K - 1]
if b < 0:
ans.append(abs(a))
elif a > 0:
ans.append(b)
else:
a = abs(a)
ans.append(a + b + min(a, b))
i += 1
print((min(ans)))
| false | 37.5 | [
"-A = []",
"-B = []",
"-for x in X:",
"- if x >= 0:",
"- A.append(x)",
"+i = 0",
"+ans = []",
"+while i + K - 1 < N:",
"+ a, b = X[i], X[i + K - 1]",
"+ if b < 0:",
"+ ans.append(abs(a))",
"+ elif a > 0:",
"+ ans.append(b)",
"- B.append(abs(x))",
"... | false | 0.046259 | 0.007645 | 6.051186 | [
"s038295756",
"s357403266"
] |
u871934301 | p02812 | python | s490084171 | s780897412 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N=int(eval(input()))
S=eval(input())
Y=len(S.replace("ABC",""))
print(((N-Y)//3))
| N=int(eval(input()))
S=eval(input())
S=S.replace("ABC","")
print(((N-len(S))//3))
| 9 | 37 | 89 | 149 | N = int(eval(input()))
S = eval(input())
Y = len(S.replace("ABC", ""))
print(((N - Y) // 3))
| N = int(eval(input()))
S = eval(input())
S = S.replace("ABC", "")
print(((N - len(S)) // 3))
| false | 75.675676 | [
"-Y = len(S.replace(\"ABC\", \"\"))",
"-print(((N - Y) // 3))",
"+S = S.replace(\"ABC\", \"\")",
"+print(((N - len(S)) // 3))"
] | false | 0.049064 | 0.164468 | 0.298321 | [
"s490084171",
"s780897412"
] |
u477320129 | p03262 | python | s913390973 | s797661834 | 142 | 106 | 22,612 | 21,432 | Accepted | Accepted | 25.35 | #!/usr/bin/env python3
import sys
from functools import reduce
def solve(N: int, X: int, x: "List[int]"):
from fractions import gcd
from functools import reduce
Y = sorted(x+[X])
Z = [x2-x1 for x1, x2 in zip(Y, Y[1:])]
return reduce(gcd, Z)
# Generated by 1.1.6 https://github.com/kyu... | #!/usr/bin/env python3
import sys
from functools import reduce
def solve(N: int, X: int, x: "List[int]"):
from fractions import gcd
from functools import reduce
return reduce(gcd, [abs(xx-X) for xx in x])
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
def... | 31 | 29 | 774 | 728 | #!/usr/bin/env python3
import sys
from functools import reduce
def solve(N: int, X: int, x: "List[int]"):
from fractions import gcd
from functools import reduce
Y = sorted(x + [X])
Z = [x2 - x1 for x1, x2 in zip(Y, Y[1:])]
return reduce(gcd, Z)
# Generated by 1.1.6 https://github.com/kyuridenam... | #!/usr/bin/env python3
import sys
from functools import reduce
def solve(N: int, X: int, x: "List[int]"):
from fractions import gcd
from functools import reduce
return reduce(gcd, [abs(xx - X) for xx in x])
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
def iterate_... | false | 6.451613 | [
"- Y = sorted(x + [X])",
"- Z = [x2 - x1 for x1, x2 in zip(Y, Y[1:])]",
"- return reduce(gcd, Z)",
"+ return reduce(gcd, [abs(xx - X) for xx in x])"
] | false | 0.045781 | 0.043496 | 1.052521 | [
"s913390973",
"s797661834"
] |
u627600101 | p02733 | python | s495144983 | s111819951 | 1,351 | 198 | 9,312 | 74,776 | Accepted | Accepted | 85.34 | H, W, K = list(map(int, input().split()))
S = []
for _ in range(H):
S.append(eval(input()))
hsummation = [[int(S[0][k])]for k in range(W)]
for k in range(W):
for j in range(1, H):
hsummation[k].append(hsummation[k][j-1] + int(S[j][k]))
#print(hsummation)
ans = float('inf')
anskouho = 0
h = 2**(H-1)
... | H, W, K = list(map(int, input().split()))
S = []
for _ in range(H):
S.append(eval(input()))
hsummation = [[int(S[0][k])]for k in range(W)]
for k in range(W):
for j in range(1, H):
hsummation[k].append(hsummation[k][j-1] + int(S[j][k]))
ans = float('inf')
anskouho = 0
h = -1
binhh = []
for j in ran... | 45 | 53 | 1,099 | 1,305 | H, W, K = list(map(int, input().split()))
S = []
for _ in range(H):
S.append(eval(input()))
hsummation = [[int(S[0][k])] for k in range(W)]
for k in range(W):
for j in range(1, H):
hsummation[k].append(hsummation[k][j - 1] + int(S[j][k]))
# print(hsummation)
ans = float("inf")
anskouho = 0
h = 2 ** (H -... | H, W, K = list(map(int, input().split()))
S = []
for _ in range(H):
S.append(eval(input()))
hsummation = [[int(S[0][k])] for k in range(W)]
for k in range(W):
for j in range(1, H):
hsummation[k].append(hsummation[k][j - 1] + int(S[j][k]))
ans = float("inf")
anskouho = 0
h = -1
binhh = []
for j in range(... | false | 15.09434 | [
"-# print(hsummation)",
"-h = 2 ** (H - 1)",
"+h = -1",
"+binhh = []",
"- h -= 1",
"+ h += 1",
"+ c = 0",
"+ for k in range(len(binh)):",
"+ if binh[k] == \"1\":",
"+ c += 1",
"+ binhh.append([binh, c])",
"+binhh.sort(key=lambda x: x[1], reverse=True)",
"+# p... | false | 0.065493 | 0.036199 | 1.809227 | [
"s495144983",
"s111819951"
] |
u411203878 | p04019 | python | s958423694 | s637144967 | 166 | 103 | 38,256 | 61,764 | Accepted | Accepted | 37.95 | a=list(eval(input()))
n = 0
s = 0
e = 0
w = 0
for i in a:
if i == 'N':
n += 1
elif i == 'S':
s += 1
elif i == 'E':
e += 1
elif i == 'W':
w += 1
if n > 0 and s == 0 or n == 0 and s > 0 or e > 0 and w == 0 or e == 0 and w > 0:
print('No')
else:
print('Yes') | s= list(eval(input()))
s=set(s)
if len(s)%2==1:
print('No')
else:
if len(s) == 2:
if "W" in s and "E" in s or "S" in s and "N" in s:
print("Yes")
else:
print('No')
else:
print('Yes')
| 24 | 12 | 306 | 248 | a = list(eval(input()))
n = 0
s = 0
e = 0
w = 0
for i in a:
if i == "N":
n += 1
elif i == "S":
s += 1
elif i == "E":
e += 1
elif i == "W":
w += 1
if n > 0 and s == 0 or n == 0 and s > 0 or e > 0 and w == 0 or e == 0 and w > 0:
print("No")
else:
print("Yes")
| s = list(eval(input()))
s = set(s)
if len(s) % 2 == 1:
print("No")
else:
if len(s) == 2:
if "W" in s and "E" in s or "S" in s and "N" in s:
print("Yes")
else:
print("No")
else:
print("Yes")
| false | 50 | [
"-a = list(eval(input()))",
"-n = 0",
"-s = 0",
"-e = 0",
"-w = 0",
"-for i in a:",
"- if i == \"N\":",
"- n += 1",
"- elif i == \"S\":",
"- s += 1",
"- elif i == \"E\":",
"- e += 1",
"- elif i == \"W\":",
"- w += 1",
"-if n > 0 and s == 0 or n == ... | false | 0.077604 | 0.064145 | 1.209829 | [
"s958423694",
"s637144967"
] |
u281303342 | p03835 | python | s154084731 | s959015070 | 1,890 | 1,419 | 3,060 | 2,940 | Accepted | Accepted | 24.92 | K,S = list(map(int,input().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
z = S-(x+y)
if 0 <= z and z <= K:
ans += 1
print(ans)
| # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
K,S = list(map(int,input().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
if 0 <= S-(x+y) <= K:
ans += 1
print(ans) | 10 | 14 | 178 | 225 | K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - (x + y)
if 0 <= z and z <= K:
ans += 1
print(ans)
| # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
if 0 <= S - (x + y) <= K:
ans += 1
print(ans)
| false | 28.571429 | [
"+# python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# main",
"- z = S - (x + y)",
"- if 0 <= z and z <= K:",
"+ if 0 <= S - (x + y) <= K:"
] | false | 0.047 | 0.045046 | 1.043397 | [
"s154084731",
"s959015070"
] |
u912237403 | p00051 | python | s029213857 | s501598611 | 20 | 10 | 4,184 | 4,192 | Accepted | Accepted | 50 | n=eval(input())
while n:
n-=1
a="".join(sorted(str(eval(input()))))
print(int(a[::-1])-int(a)) | n=eval(input())
while n:
n-=1
a="".join(sorted(input()))
print(int(a[::-1])-int(a)) | 5 | 5 | 97 | 96 | n = eval(input())
while n:
n -= 1
a = "".join(sorted(str(eval(input()))))
print(int(a[::-1]) - int(a))
| n = eval(input())
while n:
n -= 1
a = "".join(sorted(input()))
print(int(a[::-1]) - int(a))
| false | 0 | [
"- a = \"\".join(sorted(str(eval(input()))))",
"+ a = \"\".join(sorted(input()))"
] | false | 0.036441 | 0.03629 | 1.004153 | [
"s029213857",
"s501598611"
] |
u552143188 | p02596 | python | s292688143 | s610002213 | 325 | 277 | 9,132 | 9,060 | Accepted | Accepted | 14.77 | K = int(eval(input()))
x = 7 % K #mod(K)
if K == 1 or K == 7:
print((1))
exit()
ans = 1
i = 0
while i < K:
ans += 1
x = (x * 10 + 7) % K
if x == 7 % K:
print('-1')
exit()
if x == 0:
print(ans)
exit()
i += 1
print('-1') | K = int(eval(input()))
x = 7 % K #mod(K)
if K == 1 or K == 7:
print((1))
exit()
ans = 1
i = 0
while i < K:
ans += 1
x = (x * 10 + 7) % K
if x == 0:
print(ans)
exit()
i += 1
print('-1') | 19 | 17 | 261 | 218 | K = int(eval(input()))
x = 7 % K # mod(K)
if K == 1 or K == 7:
print((1))
exit()
ans = 1
i = 0
while i < K:
ans += 1
x = (x * 10 + 7) % K
if x == 7 % K:
print("-1")
exit()
if x == 0:
print(ans)
exit()
i += 1
print("-1")
| K = int(eval(input()))
x = 7 % K # mod(K)
if K == 1 or K == 7:
print((1))
exit()
ans = 1
i = 0
while i < K:
ans += 1
x = (x * 10 + 7) % K
if x == 0:
print(ans)
exit()
i += 1
print("-1")
| false | 10.526316 | [
"- if x == 7 % K:",
"- print(\"-1\")",
"- exit()"
] | false | 0.095954 | 0.087208 | 1.100283 | [
"s292688143",
"s610002213"
] |
u030726788 | p03673 | python | s872927628 | s231641247 | 167 | 138 | 26,180 | 31,016 | Accepted | Accepted | 17.37 | n=int(eval(input()))
a=list(map(int,input().split()))
b=a[::-2]
if(n%2==1):c=a[1::2]
else:c=a[::2]
#print(b)
#print(c)
outp=str(b[0])
for i in range(1,len(b)):outp+=" "+str(b[i])
for i in range(len(c)):outp+=" "+str(c[i])
print(outp) | n = int(eval(input()))
a = list(map(int,input().split()))
o = []
for i in range(n)[::-2]:
o.append(a[i])
for i in range(n)[n%2::2]:
o.append(a[i])
print((*o)) | 11 | 10 | 237 | 169 | n = int(eval(input()))
a = list(map(int, input().split()))
b = a[::-2]
if n % 2 == 1:
c = a[1::2]
else:
c = a[::2]
# print(b)
# print(c)
outp = str(b[0])
for i in range(1, len(b)):
outp += " " + str(b[i])
for i in range(len(c)):
outp += " " + str(c[i])
print(outp)
| n = int(eval(input()))
a = list(map(int, input().split()))
o = []
for i in range(n)[::-2]:
o.append(a[i])
for i in range(n)[n % 2 :: 2]:
o.append(a[i])
print((*o))
| false | 9.090909 | [
"-b = a[::-2]",
"-if n % 2 == 1:",
"- c = a[1::2]",
"-else:",
"- c = a[::2]",
"-# print(b)",
"-# print(c)",
"-outp = str(b[0])",
"-for i in range(1, len(b)):",
"- outp += \" \" + str(b[i])",
"-for i in range(len(c)):",
"- outp += \" \" + str(c[i])",
"-print(outp)",
"+o = []",
... | false | 0.048185 | 0.05153 | 0.93509 | [
"s872927628",
"s231641247"
] |
u282277161 | p02725 | python | s522738386 | s409395485 | 249 | 140 | 33,688 | 32,128 | Accepted | Accepted | 43.78 | #!/usr/bin/env python3
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = k
for i in range(len(a)):
if i == 0:
r = a[-1] - a[i]
l = a[i] + (k - a[i + 1])
elif i == n - 1:
r = (k - a[i]) + a[i - 1]
l = a[i] - a[0]
else:
r =... | #!/usr/bin/env python3
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 0
maxku = 0
for i in range(n-1):
ku = a[i + 1] - a[i]
maxku = max(ku, maxku)
cnt += ku
ku = a[0] + (k - a[-1])
maxku = max(ku, maxku)
cnt += ku
print((cnt - maxku))
| 20 | 16 | 461 | 294 | #!/usr/bin/env python3
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = k
for i in range(len(a)):
if i == 0:
r = a[-1] - a[i]
l = a[i] + (k - a[i + 1])
elif i == n - 1:
r = (k - a[i]) + a[i - 1]
l = a[i] - a[0]
else:
r = (a[n - 1] - a[i... | #!/usr/bin/env python3
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 0
maxku = 0
for i in range(n - 1):
ku = a[i + 1] - a[i]
maxku = max(ku, maxku)
cnt += ku
ku = a[0] + (k - a[-1])
maxku = max(ku, maxku)
cnt += ku
print((cnt - maxku))
| false | 20 | [
"-ans = k",
"-for i in range(len(a)):",
"- if i == 0:",
"- r = a[-1] - a[i]",
"- l = a[i] + (k - a[i + 1])",
"- elif i == n - 1:",
"- r = (k - a[i]) + a[i - 1]",
"- l = a[i] - a[0]",
"- else:",
"- r = (a[n - 1] - a[i]) + ((k - a[n - 1]) + a[i - 1])",
"... | false | 0.084556 | 0.10313 | 0.819899 | [
"s522738386",
"s409395485"
] |
u347640436 | p02693 | python | s065766148 | s043213469 | 23 | 21 | 9,156 | 9,092 | Accepted | Accepted | 8.7 | K = int(eval(input()))
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
if i % K == 0:
print('OK')
exit()
print('NG')
| K = int(eval(input()))
A, B = list(map(int, input().split()))
if (B // K) * K >= A:
print('OK')
else:
print('NG')
| 8 | 7 | 150 | 117 | K = int(eval(input()))
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
if i % K == 0:
print("OK")
exit()
print("NG")
| K = int(eval(input()))
A, B = list(map(int, input().split()))
if (B // K) * K >= A:
print("OK")
else:
print("NG")
| false | 12.5 | [
"-for i in range(A, B + 1):",
"- if i % K == 0:",
"- print(\"OK\")",
"- exit()",
"-print(\"NG\")",
"+if (B // K) * K >= A:",
"+ print(\"OK\")",
"+else:",
"+ print(\"NG\")"
] | false | 0.046942 | 0.007735 | 6.068448 | [
"s065766148",
"s043213469"
] |
u320567105 | p03252 | python | s248438074 | s404687582 | 160 | 64 | 20,400 | 6,832 | Accepted | Accepted | 60 | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
S=input()
T=input()
dT = dict(... | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
S=input()
T=input()
def n2l(s)... | 42 | 24 | 982 | 534 | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
yn = lambda b: print("Yes") if b else print("No")
OE = lambda x: print("Odd") if x % 2 else print("Even")
INF = 10**18
S = input()
T = input()
dT = dict()
dS =... | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
yn = lambda b: print("Yes") if b else print("No")
OE = lambda x: print("Odd") if x % 2 else print("Even")
INF = 10**18
S = input()
T = input()
def n2l(s):
... | false | 42.857143 | [
"-dT = dict()",
"-dS = dict()",
"-for i, t in enumerate(T):",
"- if t not in dT:",
"- dT[t] = [i]",
"- else:",
"- dT[t].append(i)",
"-for i, s in enumerate(S):",
"- if s not in dS:",
"- dS[s] = [i]",
"- else:",
"- dS[s].append(i)",
"-def ans():",
"- ... | false | 0.042148 | 0.063734 | 0.661315 | [
"s248438074",
"s404687582"
] |
u893063840 | p02757 | python | s479572965 | s580434976 | 507 | 171 | 12,036 | 12,016 | Accepted | Accepted | 66.27 | from collections import Counter
n, p = list(map(int, input().split()))
s = eval(input())
if p == 2 or p == 5:
ans = 0
for i, e in enumerate(s, 1):
if int(e) % p == 0:
ans += i
print(ans)
else:
li = [0]
for i, e in enumerate(s[::-1], 1):
li.append((li[-... | from collections import Counter
n, p = list(map(int, input().split()))
s = eval(input())
if p == 2 or p == 5:
d = {2: "02468", 5: "05"}
ans = 0
for i, e in enumerate(s, 1):
if e in d[p]:
ans += i
print(ans)
else:
li = [0]
power = 1
for e in s[::-1]:
... | 24 | 28 | 455 | 511 | from collections import Counter
n, p = list(map(int, input().split()))
s = eval(input())
if p == 2 or p == 5:
ans = 0
for i, e in enumerate(s, 1):
if int(e) % p == 0:
ans += i
print(ans)
else:
li = [0]
for i, e in enumerate(s[::-1], 1):
li.append((li[-1] + int(e) * pow(1... | from collections import Counter
n, p = list(map(int, input().split()))
s = eval(input())
if p == 2 or p == 5:
d = {2: "02468", 5: "05"}
ans = 0
for i, e in enumerate(s, 1):
if e in d[p]:
ans += i
print(ans)
else:
li = [0]
power = 1
for e in s[::-1]:
power *= 10
... | false | 14.285714 | [
"+ d = {2: \"02468\", 5: \"05\"}",
"- if int(e) % p == 0:",
"+ if e in d[p]:",
"- for i, e in enumerate(s[::-1], 1):",
"- li.append((li[-1] + int(e) * pow(10, i, p)) % p)",
"+ power = 1",
"+ for e in s[::-1]:",
"+ power *= 10",
"+ power %= p",
"+ ... | false | 0.044195 | 0.05587 | 0.791041 | [
"s479572965",
"s580434976"
] |
u706929073 | p03164 | python | s331671948 | s234580272 | 1,623 | 639 | 403,896 | 171,376 | Accepted | Accepted | 60.63 | #E
inf = float("inf")
N,W = list(map(int,input().split()))
WV = [list(map(int,input().split())) for _ in range(N)]
dp = [[inf for j in range(10**5+1)] for i in range(N+1)] #dp[i][v] = W
for i in range(N):
dp[i][0] = 0
for i in range(N):
w,v = WV[i]
for j in range(10**5+1):
if j+v <= ... |
n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
v_max = 10 ** 5
w_max = 10 ** 18
dp = [[w_max for _ in range(v_max + 1)] for _ in range(n + 1)]
for i in range(n):
dp[i][0] = 0
for i in range(n):
w_, v_ = wv[i]
for j in range(v_max + 1):
... | 25 | 25 | 545 | 554 | # E
inf = float("inf")
N, W = list(map(int, input().split()))
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [[inf for j in range(10**5 + 1)] for i in range(N + 1)] # dp[i][v] = W
for i in range(N):
dp[i][0] = 0
for i in range(N):
w, v = WV[i]
for j in range(10**5 + 1):
if j + v <= 1... | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
v_max = 10**5
w_max = 10**18
dp = [[w_max for _ in range(v_max + 1)] for _ in range(n + 1)]
for i in range(n):
dp[i][0] = 0
for i in range(n):
w_, v_ = wv[i]
for j in range(v_max + 1):
if j + v_ <= v_max:... | false | 0 | [
"-# E",
"-inf = float(\"inf\")",
"-N, W = list(map(int, input().split()))",
"-WV = [list(map(int, input().split())) for _ in range(N)]",
"-dp = [[inf for j in range(10**5 + 1)] for i in range(N + 1)] # dp[i][v] = W",
"-for i in range(N):",
"+n, w = list(map(int, input().split()))",
"+wv = [list(map(i... | false | 2.422764 | 0.63556 | 3.812012 | [
"s331671948",
"s234580272"
] |
u968166680 | p02972 | python | s642821988 | s270291682 | 644 | 161 | 106,672 | 111,524 | Accepted | Accepted | 75 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
lower.append(i)
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
B = [False] * (N + 1)
for i, a in reversed(list(enumerate(A, 1))):
tmp ... | 47 | 31 | 914 | 600 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def divisors(n):
lower = []
upper = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
lower.append(i)
if i != n //... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
B = [False] * (N + 1)
for i, a in reversed(list(enumerate(A, 1))):
tmp = 0
for j in... | false | 34.042553 | [
"-def divisors(n):",
"- lower = []",
"- upper = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- lower.append(i)",
"- if i != n // i:",
"- upper.append(n // i)",
"- lower.extend(reversed(upper))",
"- return lower",
"-... | false | 0.030467 | 0.033638 | 0.905734 | [
"s642821988",
"s270291682"
] |
u562935282 | p02793 | python | s207706510 | s517674496 | 1,135 | 297 | 75,612 | 15,512 | Accepted | Accepted | 73.83 | from functools import reduce
def main():
from functools import reduce
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(a, b)
mod = 10 ** 9 + 7
n = int(eval(input()))
*a, = list(map(int, input().split()))
L = reduce(lcm... | # 解説放送を見た
class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]: continue
primes.append(i)
f[i] = i # 素数には自身を代入
for j ... | 25 | 71 | 451 | 1,736 | from functools import reduce
def main():
from functools import reduce
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(a, b)
mod = 10**9 + 7
n = int(eval(input()))
(*a,) = list(map(int, input().split()))
L = reduce(lcm, a)
ret =... | # 解説放送を見た
class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]:
continue
primes.append(i)
f[i] = i # 素数には自身を代入
for ... | false | 64.788732 | [
"-from functools import reduce",
"+# 解説放送を見た",
"+class Sieve:",
"+ \"\"\"区間[2,n]の値を素因数分解する\"\"\"",
"+",
"+ def __init__(self, n=1):",
"+ primes = []",
"+ f = [0] * (n + 1)",
"+ f[0] = f[1] = -1",
"+ for i in range(2, n + 1): # 素数を探す",
"+ if f[i]:",
... | false | 0.035616 | 0.481536 | 0.073963 | [
"s207706510",
"s517674496"
] |
u970308980 | p03503 | python | s206893095 | s879353817 | 177 | 131 | 3,064 | 3,188 | Accepted | Accepted | 25.99 | ans = -10 ** 9
A = [0] * 10
def func():
if sum(A) == 0:
return
score = 0
for i in range(N):
days = sum([a * f for a, f in zip(A, F[i])])
score += P[i][days]
global ans
ans = max(ans, score)
def dfs(pos):
if pos == 10:
func()
return
... | def calc(days):
if sum(days) == 0:
return
profit = 0
for i in range(N):
both = 0
for f, d in zip(F[i], days):
if f == d == 1:
both += 1
profit += P[i][both]
global ans
ans = max(ans, profit)
def dfs(days):
if len(days) ... | 36 | 29 | 582 | 586 | ans = -(10**9)
A = [0] * 10
def func():
if sum(A) == 0:
return
score = 0
for i in range(N):
days = sum([a * f for a, f in zip(A, F[i])])
score += P[i][days]
global ans
ans = max(ans, score)
def dfs(pos):
if pos == 10:
func()
return
A[pos] = 0
d... | def calc(days):
if sum(days) == 0:
return
profit = 0
for i in range(N):
both = 0
for f, d in zip(F[i], days):
if f == d == 1:
both += 1
profit += P[i][both]
global ans
ans = max(ans, profit)
def dfs(days):
if len(days) == 10:
... | false | 19.444444 | [
"-ans = -(10**9)",
"-A = [0] * 10",
"+def calc(days):",
"+ if sum(days) == 0:",
"+ return",
"+ profit = 0",
"+ for i in range(N):",
"+ both = 0",
"+ for f, d in zip(F[i], days):",
"+ if f == d == 1:",
"+ both += 1",
"+ profit += P[... | false | 0.054356 | 0.054397 | 0.999235 | [
"s206893095",
"s879353817"
] |
u983918956 | p03476 | python | s862670842 | s967760892 | 558 | 435 | 31,500 | 14,284 | Accepted | Accepted | 22.04 | import sys
input = sys.stdin.readline
from itertools import accumulate
import math
def is_prime(n):
if n <= 0: return None
if n == 1: return False
sup = math.floor(pow(n,1/2))
for i in range(2,sup+1):
if n % i == 0:
return False
return True
Q = int(eval(input(... | def sieve(N):
global table,prime
table = [True]*(N+1)
table[0] = False
table[1] = False
prime = []
for i in range(2,N+1):
if table[i]:
prime.append(i)
for j in range(2*i,N+1,i):
table[j] = False
def accmulate(array):
global cs
... | 30 | 40 | 605 | 786 | import sys
input = sys.stdin.readline
from itertools import accumulate
import math
def is_prime(n):
if n <= 0:
return None
if n == 1:
return False
sup = math.floor(pow(n, 1 / 2))
for i in range(2, sup + 1):
if n % i == 0:
return False
return True
Q = int(eval... | def sieve(N):
global table, prime
table = [True] * (N + 1)
table[0] = False
table[1] = False
prime = []
for i in range(2, N + 1):
if table[i]:
prime.append(i)
for j in range(2 * i, N + 1, i):
table[j] = False
def accmulate(array):
global cs
... | false | 25 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-from itertools import accumulate",
"-import math",
"+def sieve(N):",
"+ global table, prime",
"+ table = [True] * (N + 1)",
"+ table[0] = False",
"+ table[1] = False",
"+ prime = []",
"+ for i in range(2, N + 1):",
"+ ... | false | 0.311909 | 0.185244 | 1.683777 | [
"s862670842",
"s967760892"
] |
u366959492 | p03161 | python | s532373028 | s651152558 | 468 | 400 | 55,264 | 55,008 | Accepted | Accepted | 14.53 | n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
h+=[0]*k
inf=float('inf')
dp=[inf]*(n+k)
dp[0]=0
for i in range(n):
for j in range(1,k+1):
dp[i+j]=min(dp[i]+abs(h[i]-h[i+j]),dp[i+j])
print((dp[n-1]))
| n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
dp=[float("inf")]*n
dp[0]=0
for i in range(1,n):
for j in range(max(0,i-k),i):
dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print((dp[n-1]))
| 10 | 9 | 233 | 215 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h += [0] * k
inf = float("inf")
dp = [inf] * (n + k)
dp[0] = 0
for i in range(n):
for j in range(1, k + 1):
dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j])
print((dp[n - 1]))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
for j in range(max(0, i - k), i):
dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
print((dp[n - 1]))
| false | 10 | [
"-h += [0] * k",
"-inf = float(\"inf\")",
"-dp = [inf] * (n + k)",
"+dp = [float(\"inf\")] * n",
"-for i in range(n):",
"- for j in range(1, k + 1):",
"- dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j])",
"+for i in range(1, n):",
"+ for j in range(max(0, i - k), i):",
"+ ... | false | 0.065984 | 0.066568 | 0.991237 | [
"s532373028",
"s651152558"
] |
u528748570 | p03031 | python | s279161304 | s827643068 | 34 | 27 | 3,064 | 3,064 | Accepted | Accepted | 20.59 | N, M = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
ans = 0
temp = [0]*N
for i in range(2**N):
for j in range(N):
if((i >> j) & 1):
temp[j] = 1
for k in range(M):
count = 0
for l i... | import itertools
N, M = list(map(int, input().split()))
data = [list(map(int, input().split())) for _ in range(M)]
P = list(map(int, input().split()))
# スイッチが付いているか付いていないかを表す集合
ans = 0
for bit in itertools.product([0, 1], repeat=N):
for d, p in zip(data, P):
cnt = 0
for i in d[1:]:
... | 24 | 20 | 516 | 456 | N, M = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
ans = 0
temp = [0] * N
for i in range(2**N):
for j in range(N):
if (i >> j) & 1:
temp[j] = 1
for k in range(M):
count = 0
for l in range(1, len(S... | import itertools
N, M = list(map(int, input().split()))
data = [list(map(int, input().split())) for _ in range(M)]
P = list(map(int, input().split()))
# スイッチが付いているか付いていないかを表す集合
ans = 0
for bit in itertools.product([0, 1], repeat=N):
for d, p in zip(data, P):
cnt = 0
for i in d[1:]:
if b... | false | 16.666667 | [
"+import itertools",
"+",
"-S = [list(map(int, input().split())) for _ in range(M)]",
"-p = list(map(int, input().split()))",
"+data = [list(map(int, input().split())) for _ in range(M)]",
"+P = list(map(int, input().split()))",
"+# スイッチが付いているか付いていないかを表す集合",
"-temp = [0] * N",
"-for i in range(2**N)... | false | 0.122937 | 0.106546 | 1.153846 | [
"s279161304",
"s827643068"
] |
u858742833 | p03167 | python | s049964923 | s770751639 | 238 | 198 | 3,444 | 3,444 | Accepted | Accepted | 16.81 | def main():
H, W = list(map(int, input().split()))
a = [i == '.' for i in eval(input())]
v = [0] * W
v[0] = 1
for j in range(1, W):
if not a[j]:
break
v[j] = 1
for i in range(1, H):
a = [i == '.' for i in eval(input())]
u = v
v = ... | def main():
H, W = list(map(int, input().split()))
a = eval(input())
k = a.find('#')
if k == -1:
k = W
v = [1] * k + [0] * (W - k)
u = [0] * W
for _ in range(1, H):
a = eval(input())
u, v = v, u
v[0] = t = u[0] if a[0] == '.' else 0
for j... | 21 | 19 | 474 | 443 | def main():
H, W = list(map(int, input().split()))
a = [i == "." for i in eval(input())]
v = [0] * W
v[0] = 1
for j in range(1, W):
if not a[j]:
break
v[j] = 1
for i in range(1, H):
a = [i == "." for i in eval(input())]
u = v
v = [0] * W
... | def main():
H, W = list(map(int, input().split()))
a = eval(input())
k = a.find("#")
if k == -1:
k = W
v = [1] * k + [0] * (W - k)
u = [0] * W
for _ in range(1, H):
a = eval(input())
u, v = v, u
v[0] = t = u[0] if a[0] == "." else 0
for j, uu, aa in zi... | false | 9.52381 | [
"- a = [i == \".\" for i in eval(input())]",
"- v = [0] * W",
"- v[0] = 1",
"- for j in range(1, W):",
"- if not a[j]:",
"- break",
"- v[j] = 1",
"- for i in range(1, H):",
"- a = [i == \".\" for i in eval(input())]",
"- u = v",
"- v =... | false | 0.075229 | 0.044091 | 1.706195 | [
"s049964923",
"s770751639"
] |
u037430802 | p03862 | python | s448612454 | s218692686 | 146 | 105 | 14,252 | 14,132 | Accepted | Accepted | 28.08 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(1, n):
if a[i-1] + a[i] > x:
tmp = a[i]
a[i] = max(x-a[i-1], 0)
ans += tmp - a[i]
if a[i] == 0 and a[i-1] > x:
tmp = a[i-1]
a[i-1] = x
ans += tmp - a[i-1]
print(ans) |
N,x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
if A[0] > x:
ans += A[0] - x
A[0] = x
for i in range(1,N):
if A[i] + A[i-1] > x:
tmp = A[i] + A[i-1] - x
ans += tmp
A[i] -= tmp
print(ans) | 14 | 18 | 299 | 273 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(1, n):
if a[i - 1] + a[i] > x:
tmp = a[i]
a[i] = max(x - a[i - 1], 0)
ans += tmp - a[i]
if a[i] == 0 and a[i - 1] > x:
tmp = a[i - 1]
a[i - 1] = x
ans += tmp - a[i - ... | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
if A[0] > x:
ans += A[0] - x
A[0] = x
for i in range(1, N):
if A[i] + A[i - 1] > x:
tmp = A[i] + A[i - 1] - x
ans += tmp
A[i] -= tmp
print(ans)
| false | 22.222222 | [
"-n, x = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"+N, x = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"-for i in range(1, n):",
"- if a[i - 1] + a[i] > x:",
"- tmp = a[i]",
"- a[i] = max(x - a[i - 1], 0)",
"- ans... | false | 0.090394 | 0.036573 | 2.47163 | [
"s448612454",
"s218692686"
] |
u759651152 | p03846 | python | s023592654 | s392386779 | 130 | 67 | 14,820 | 14,812 | Accepted | Accepted | 48.46 | #-*-coding:utf-8-*-
from collections import Counter
def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
counter = Counter(a_list)
ans = 1
if n % 2 != 0:
for i in range(0, n, 2):
c = counter[i]
if (i == 0 and c != 1) or c == 0:
... | #-*-coding:utf-8-*-
from collections import Counter
def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
counter = Counter(a_list)
ans = 1
if n % 2 == 0:
if all(counter[i] == 2 for i in range(1, n, 2)):
ans = 2 ** (n // 2)
else:
... | 29 | 23 | 679 | 568 | # -*-coding:utf-8-*-
from collections import Counter
def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
counter = Counter(a_list)
ans = 1
if n % 2 != 0:
for i in range(0, n, 2):
c = counter[i]
if (i == 0 and c != 1) or c == 0:
... | # -*-coding:utf-8-*-
from collections import Counter
def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
counter = Counter(a_list)
ans = 1
if n % 2 == 0:
if all(counter[i] == 2 for i in range(1, n, 2)):
ans = 2 ** (n // 2)
else:
ans =... | false | 20.689655 | [
"- if n % 2 != 0:",
"- for i in range(0, n, 2):",
"- c = counter[i]",
"- if (i == 0 and c != 1) or c == 0:",
"- print((0))",
"- exit()",
"- else:",
"- ans *= c",
"+ if n % 2 == 0:",
"+ if all(counter[... | false | 0.094085 | 0.046123 | 2.03989 | [
"s023592654",
"s392386779"
] |
u723345499 | p02694 | python | s823352889 | s219986055 | 25 | 23 | 9,164 | 9,164 | Accepted | Accepted | 8 | import math
x = int(eval(input()))
m = 100
cnt = 0
while 1:
cnt += 1
m = m + math.floor(m * 0.01)
if m >= x:
break
print(cnt) | import math
x = int(eval(input()))
m = 100
cnt = 0
while 1:
cnt += 1
m = math.floor(m * 1.01)
if m >= x:
break
print(cnt) | 11 | 11 | 150 | 146 | import math
x = int(eval(input()))
m = 100
cnt = 0
while 1:
cnt += 1
m = m + math.floor(m * 0.01)
if m >= x:
break
print(cnt)
| import math
x = int(eval(input()))
m = 100
cnt = 0
while 1:
cnt += 1
m = math.floor(m * 1.01)
if m >= x:
break
print(cnt)
| false | 0 | [
"- m = m + math.floor(m * 0.01)",
"+ m = math.floor(m * 1.01)"
] | false | 0.063231 | 0.097372 | 0.649375 | [
"s823352889",
"s219986055"
] |
u764956288 | p02623 | python | s812749907 | s952920538 | 170 | 151 | 48,608 | 48,512 | Accepted | Accepted | 11.18 | from itertools import chain
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
answer = 0
sum_b = sum(B)
idx_b = M
remain = K
for i, a in enumerate(chain([0], A)):
remain -= a
... | from itertools import chain
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
answer = 0
sum_b = sum(B)
idx_b = M
remain = K
for i, a in enumerate(chain([0], A)):
remain -= a
... | 38 | 37 | 647 | 645 | from itertools import chain
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
answer = 0
sum_b = sum(B)
idx_b = M
remain = K
for i, a in enumerate(chain([0], A)):
remain -= a
if remain < 0:
... | from itertools import chain
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
answer = 0
sum_b = sum(B)
idx_b = M
remain = K
for i, a in enumerate(chain([0], A)):
remain -= a
if remain < 0:
... | false | 2.631579 | [
"- while sum_b > remain:",
"- if idx_b < 0:",
"- break",
"+ while sum_b > remain and idx_b >= 0:",
"- answer = max(answer, i + idx_b)",
"+ i += idx_b",
"+ answer = i if answer < i else answer"
] | false | 0.036234 | 0.046065 | 0.786584 | [
"s812749907",
"s952920538"
] |
u633255271 | p02624 | python | s594511905 | s281268634 | 1,038 | 192 | 388,732 | 73,248 | Accepted | Accepted | 81.5 | N = int(eval(input()))
X = [N//i for i in range(1, N+1)]
print((sum([x*(x+1)*i//2 for x, i in zip(X, list(range(1, N+1)))]))) | N = int(eval(input()))
ans = 0
for i in range(1, N+1):
x = N//i
ans += x*(x+1)*i/2
print((int(ans))) | 3 | 6 | 113 | 105 | N = int(eval(input()))
X = [N // i for i in range(1, N + 1)]
print((sum([x * (x + 1) * i // 2 for x, i in zip(X, list(range(1, N + 1)))])))
| N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
x = N // i
ans += x * (x + 1) * i / 2
print((int(ans)))
| false | 50 | [
"-X = [N // i for i in range(1, N + 1)]",
"-print((sum([x * (x + 1) * i // 2 for x, i in zip(X, list(range(1, N + 1)))])))",
"+ans = 0",
"+for i in range(1, N + 1):",
"+ x = N // i",
"+ ans += x * (x + 1) * i / 2",
"+print((int(ans)))"
] | false | 0.726558 | 0.680766 | 1.067265 | [
"s594511905",
"s281268634"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.