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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u284854859 | p03450 | python | s722604506 | s750703771 | 1,167 | 767 | 8,968 | 8,948 | Accepted | Accepted | 34.28 | #重み付きUnion-Find
#xの根を求める
def find(x):
if par[x] < 0:
return x
else:
px = find(par[x])
wei[x] += wei[par[x]]
par[x] = px
return px
#xの根から距離
def weight(x):
find(x)
return wei[x]
#w[y]=w[x]+wとなるようにxとyを併合
def unite(x,y,w):
w += wei[x]-wei[y... | def main():
import sys
input = sys.stdin.readline
#重み付きUnion-Find
#xの根を求める
def find(x):
if par[x] < 0:
return x
else:
px = find(par[x])
wei[x] += wei[par[x]]
par[x] = px
return px
#xの根から距離
def weigh... | 67 | 72 | 1,135 | 1,463 | # 重み付きUnion-Find
# xの根を求める
def find(x):
if par[x] < 0:
return x
else:
px = find(par[x])
wei[x] += wei[par[x]]
par[x] = px
return px
# xの根から距離
def weight(x):
find(x)
return wei[x]
# w[y]=w[x]+wとなるようにxとyを併合
def unite(x, y, w):
w += wei[x] - wei[y]
x = fi... | def main():
import sys
input = sys.stdin.readline
# 重み付きUnion-Find
# xの根を求める
def find(x):
if par[x] < 0:
return x
else:
px = find(par[x])
wei[x] += wei[par[x]]
par[x] = px
return px
# xの根から距離
def weight(x):
... | false | 6.944444 | [
"-# 重み付きUnion-Find",
"-# xの根を求める",
"-def find(x):",
"- if par[x] < 0:",
"- return x",
"- else:",
"- px = find(par[x])",
"- wei[x] += wei[par[x]]",
"- par[x] = px",
"- return px",
"+def main():",
"+ import sys",
"+",
"+ input = sys.stdin.readli... | false | 0.039895 | 0.039919 | 0.999403 | [
"s722604506",
"s750703771"
] |
u497952650 | p02754 | python | s628592668 | s337983728 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N,A,B = list(map(int,input().split()))
ans = 0
tmp = N//(A+B)
ans += tmp*A
N -= (A+B)*tmp
ans += min(A,N)
print(ans) | N,A,B = list(map(int,input().split()))
a = N//(A+B)*A
b = N%(A+B)
print((a+min(A,b))) | 8 | 7 | 118 | 86 | N, A, B = list(map(int, input().split()))
ans = 0
tmp = N // (A + B)
ans += tmp * A
N -= (A + B) * tmp
ans += min(A, N)
print(ans)
| N, A, B = list(map(int, input().split()))
a = N // (A + B) * A
b = N % (A + B)
print((a + min(A, b)))
| false | 12.5 | [
"-ans = 0",
"-tmp = N // (A + B)",
"-ans += tmp * A",
"-N -= (A + B) * tmp",
"-ans += min(A, N)",
"-print(ans)",
"+a = N // (A + B) * A",
"+b = N % (A + B)",
"+print((a + min(A, b)))"
] | false | 0.042565 | 0.039627 | 1.074136 | [
"s628592668",
"s337983728"
] |
u513081876 | p03556 | python | s517332199 | s905171319 | 47 | 18 | 2,940 | 2,940 | Accepted | Accepted | 61.7 | N = int(eval(input()))
i = 1
ans = 1
while i**2 <= N:
if i**2 <= N:
ans = i**2
i += 1
print(ans) | import math
N = int(eval(input()))
print((int(math.sqrt(N)) ** 2)) | 8 | 4 | 113 | 62 | N = int(eval(input()))
i = 1
ans = 1
while i**2 <= N:
if i**2 <= N:
ans = i**2
i += 1
print(ans)
| import math
N = int(eval(input()))
print((int(math.sqrt(N)) ** 2))
| false | 50 | [
"+import math",
"+",
"-i = 1",
"-ans = 1",
"-while i**2 <= N:",
"- if i**2 <= N:",
"- ans = i**2",
"- i += 1",
"-print(ans)",
"+print((int(math.sqrt(N)) ** 2))"
] | false | 0.134812 | 0.084652 | 1.592535 | [
"s517332199",
"s905171319"
] |
u909643606 | p02901 | python | s050184553 | s733119067 | 1,036 | 411 | 134,920 | 56,924 | Accepted | Accepted | 60.33 | n, m = [int(i) for i in input().split()]
dp = [[float("inf") for i in range(2**n)] for j in range(m+1)]
dp[0][0] = 0
for i in range(m):
a, _ = [int(_) for _ in input().split()]
c = sum([2**(int(_)-1) for _ in input().split()])
for j in range(2**n):
dp[i+1][j|c] = min(dp[i][j|c], dp[i][j] ... | n, m = [int(i) for i in input().split()]
dp_prev = [float("inf") for i in range(2**n)]
dp_next = [float("inf") for i in range(2**n)]
dp_prev[0] = 0
for i in range(m):
a, _ = [int(_) for _ in input().split()]
c = sum([2**(int(_)-1) for _ in input().split()])
for j in range(2**n):
dp_next[... | 13 | 16 | 441 | 510 | n, m = [int(i) for i in input().split()]
dp = [[float("inf") for i in range(2**n)] for j in range(m + 1)]
dp[0][0] = 0
for i in range(m):
a, _ = [int(_) for _ in input().split()]
c = sum([2 ** (int(_) - 1) for _ in input().split()])
for j in range(2**n):
dp[i + 1][j | c] = min(dp[i][j | c], dp[i][j]... | n, m = [int(i) for i in input().split()]
dp_prev = [float("inf") for i in range(2**n)]
dp_next = [float("inf") for i in range(2**n)]
dp_prev[0] = 0
for i in range(m):
a, _ = [int(_) for _ in input().split()]
c = sum([2 ** (int(_) - 1) for _ in input().split()])
for j in range(2**n):
dp_next[j | c] =... | false | 18.75 | [
"-dp = [[float(\"inf\") for i in range(2**n)] for j in range(m + 1)]",
"-dp[0][0] = 0",
"+dp_prev = [float(\"inf\") for i in range(2**n)]",
"+dp_next = [float(\"inf\") for i in range(2**n)]",
"+dp_prev[0] = 0",
"- dp[i + 1][j | c] = min(dp[i][j | c], dp[i][j] + a, dp[i + 1][j | c])",
"- dp... | false | 0.042914 | 0.078828 | 0.544395 | [
"s050184553",
"s733119067"
] |
u998435601 | p02396 | python | s072884342 | s108103558 | 50 | 40 | 6,340 | 6,312 | Accepted | Accepted | 20 | i = 1
while True:
a = input()
if a == '0':
break
print("Case %d: %s" % (i,a))
i = i + 1 | i = 1
while True:
a = input()
if a == '0':
break
print("Case %d: %s" % (i,a))
i += 1 | 7 | 7 | 102 | 99 | i = 1
while True:
a = input()
if a == "0":
break
print("Case %d: %s" % (i, a))
i = i + 1
| i = 1
while True:
a = input()
if a == "0":
break
print("Case %d: %s" % (i, a))
i += 1
| false | 0 | [
"- i = i + 1",
"+ i += 1"
] | false | 0.039734 | 0.048481 | 0.819573 | [
"s072884342",
"s108103558"
] |
u157020659 | p02661 | python | s596242966 | s985831407 | 900 | 480 | 53,504 | 25,428 | Accepted | Accepted | 46.67 | min_li, max_li = [], []
n = int(eval(input()))
for _ in range(n):
a, b = list(map(int, input().split()))
min_li.append((a, b))
max_li.append((a, b))
min_li.sort()
max_li.sort(key=lambda x: x[1], reverse=True)
if n % 2 == 1:
mid = n // 2
blue_min = min_li[mid][0]
blue_max = min(min_li[... | lower, upper = [], []
n = int(eval(input()))
for _ in range(n):
a, b = list(map(int, input().split()))
lower.append(a)
upper.append(b)
lower.sort()
upper.sort(reverse=True)
if n % 2 == 1:
mid = n // 2
median_min = lower[mid]
median_max = upper[mid]
else:
mid = n // 2 - 1
me... | 27 | 17 | 828 | 428 | min_li, max_li = [], []
n = int(eval(input()))
for _ in range(n):
a, b = list(map(int, input().split()))
min_li.append((a, b))
max_li.append((a, b))
min_li.sort()
max_li.sort(key=lambda x: x[1], reverse=True)
if n % 2 == 1:
mid = n // 2
blue_min = min_li[mid][0]
blue_max = min(min_li[mid:], key=... | lower, upper = [], []
n = int(eval(input()))
for _ in range(n):
a, b = list(map(int, input().split()))
lower.append(a)
upper.append(b)
lower.sort()
upper.sort(reverse=True)
if n % 2 == 1:
mid = n // 2
median_min = lower[mid]
median_max = upper[mid]
else:
mid = n // 2 - 1
median_min = low... | false | 37.037037 | [
"-min_li, max_li = [], []",
"+lower, upper = [], []",
"- min_li.append((a, b))",
"- max_li.append((a, b))",
"-min_li.sort()",
"-max_li.sort(key=lambda x: x[1], reverse=True)",
"+ lower.append(a)",
"+ upper.append(b)",
"+lower.sort()",
"+upper.sort(reverse=True)",
"- blue_min = min... | false | 0.036529 | 0.037566 | 0.972384 | [
"s596242966",
"s985831407"
] |
u077291787 | p02912 | python | s642341370 | s524811314 | 153 | 133 | 14,180 | 20,432 | Accepted | Accepted | 13.07 | # ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush
pop_max, push_max = lambda heap: -heappop(heap), lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, input().split()))
A = [-i for i in map(int, input().split())]
heapify(A)
for _ in range(M):... | # ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush
def main():
_, M = list(map(int, input().split()))
A = [-i for i in map(int, input().split())]
heapify(A)
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
d... | 19 | 20 | 447 | 479 | # ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush
pop_max, push_max = lambda heap: -heappop(heap), lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, input().split()))
A = [-i for i in map(int, input().split())]
heapify(A)
for _ in range(M):
x... | # ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush
def main():
_, M = list(map(int, input().split()))
A = [-i for i in map(int, input().split())]
heapify(A)
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
discount = la... | false | 5 | [
"-pop_max, push_max = lambda heap: -heappop(heap), lambda heap, x: heappush(heap, -x)",
"-",
"- N, M = list(map(int, input().split()))",
"+ _, M = list(map(int, input().split()))",
"+ heappop_max = lambda heap: -heappop(heap)",
"+ heappush_max = lambda heap, x: heappush(heap, -x)",
"+ dis... | false | 0.040686 | 0.047597 | 0.854801 | [
"s642341370",
"s524811314"
] |
u119456964 | p02406 | python | s836539910 | s921394662 | 70 | 10 | 6,456 | 6,424 | Accepted | Accepted | 85.71 | n = int(input())
s = ''
for i in range(1, n+1):
if i%3 == 0:
s = s + ' ' + str(i)
else:
temp = ''
temp = str(i)
for j in range(len(temp)):
if temp[j] == '3':
s = s + ' ' + str(i)
break
print(s) | n = int(input())
i = 1
print("", end=' ')
while i <= n:
if i%3 == 0:
print(i, end=' ')
else:
I = str(i)
for j in range(len(I)):
if I[j] == '3':
print(I, end=' ')
break
i += 1 | 14 | 14 | 294 | 227 | n = int(input())
s = ""
for i in range(1, n + 1):
if i % 3 == 0:
s = s + " " + str(i)
else:
temp = ""
temp = str(i)
for j in range(len(temp)):
if temp[j] == "3":
s = s + " " + str(i)
break
print(s)
| n = int(input())
i = 1
print("", end=" ")
while i <= n:
if i % 3 == 0:
print(i, end=" ")
else:
I = str(i)
for j in range(len(I)):
if I[j] == "3":
print(I, end=" ")
break
i += 1
| false | 0 | [
"-s = \"\"",
"-for i in range(1, n + 1):",
"+i = 1",
"+print(\"\", end=\" \")",
"+while i <= n:",
"- s = s + \" \" + str(i)",
"+ print(i, end=\" \")",
"- temp = \"\"",
"- temp = str(i)",
"- for j in range(len(temp)):",
"- if temp[j] == \"3\":",
"- ... | false | 0.036795 | 0.036843 | 0.998697 | [
"s836539910",
"s921394662"
] |
u868701750 | p03485 | python | s172493982 | s120353646 | 38 | 17 | 5,152 | 2,940 | Accepted | Accepted | 55.26 | from math import ceil
from statistics import mean
ab = list(map(int, input().split()))
print((ceil(mean(ab))))
| from math import ceil
a, b = list(map(int, input().split()))
print((ceil((a+b)/2)))
| 5 | 3 | 114 | 78 | from math import ceil
from statistics import mean
ab = list(map(int, input().split()))
print((ceil(mean(ab))))
| from math import ceil
a, b = list(map(int, input().split()))
print((ceil((a + b) / 2)))
| false | 40 | [
"-from statistics import mean",
"-ab = list(map(int, input().split()))",
"-print((ceil(mean(ab))))",
"+a, b = list(map(int, input().split()))",
"+print((ceil((a + b) / 2)))"
] | false | 0.126249 | 0.080191 | 1.574358 | [
"s172493982",
"s120353646"
] |
u323680411 | p03804 | python | s919991827 | s369313738 | 154 | 20 | 12,516 | 3,064 | Accepted | Accepted | 87.01 | import numpy as np
from sys import stdin
def main() -> None:
global N, M, A, B
N = next_int()
M = next_int()
A = np.array([eval(input()) for _ in range(N)])
B = np.array([eval(input()) for _ in range(M)])
ans = "No"
for Ni in range(N):
for Nj in range(N):
... | from sys import stdin
def main() -> None:
global N, M, A, B
N = next_int()
M = next_int()
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
ans = "No"
for Ni in range(N):
for Nj in range(N):
if judge(Ni, Nj):
ans ... | 49 | 48 | 1,014 | 974 | import numpy as np
from sys import stdin
def main() -> None:
global N, M, A, B
N = next_int()
M = next_int()
A = np.array([eval(input()) for _ in range(N)])
B = np.array([eval(input()) for _ in range(M)])
ans = "No"
for Ni in range(N):
for Nj in range(N):
if judge(Ni, N... | from sys import stdin
def main() -> None:
global N, M, A, B
N = next_int()
M = next_int()
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
ans = "No"
for Ni in range(N):
for Nj in range(N):
if judge(Ni, Nj):
ans = "Yes"
... | false | 2.040816 | [
"-import numpy as np",
"- A = np.array([eval(input()) for _ in range(N)])",
"- B = np.array([eval(input()) for _ in range(M)])",
"+ A = [eval(input()) for _ in range(N)]",
"+ B = [eval(input()) for _ in range(M)]"
] | false | 0.281419 | 0.037477 | 7.509022 | [
"s919991827",
"s369313738"
] |
u327466606 | p03722 | python | s087665645 | s982306260 | 579 | 392 | 4,204 | 3,948 | Accepted | Accepted | 32.3 | N,M = list(map(int, input().split()))
from collections import defaultdict
neighbor = defaultdict(list)
rev_neighbor = defaultdict(list)
E = []
for i in range(M):
a,b,c = list(map(int, input().split()))
a,b = a-1, b-1
E += [(a,b,c)]
neighbor[a].append(b)
rev_neighbor[b].append(a)
def reachable... | N,M = list(map(int, input().split()))
from collections import defaultdict
E = []
for i in range(M):
a,b,c = list(map(int, input().split()))
a,b = a-1, b-1
E += [(a,b,c)]
def reachable_vertices(neighbor, s):
V = set()
V.add(s)
stack=[s]
while stack:
v = stack.pop()
for u in neigh... | 49 | 60 | 1,000 | 1,267 | N, M = list(map(int, input().split()))
from collections import defaultdict
neighbor = defaultdict(list)
rev_neighbor = defaultdict(list)
E = []
for i in range(M):
a, b, c = list(map(int, input().split()))
a, b = a - 1, b - 1
E += [(a, b, c)]
neighbor[a].append(b)
rev_neighbor[b].append(a)
def rea... | N, M = list(map(int, input().split()))
from collections import defaultdict
E = []
for i in range(M):
a, b, c = list(map(int, input().split()))
a, b = a - 1, b - 1
E += [(a, b, c)]
def reachable_vertices(neighbor, s):
V = set()
V.add(s)
stack = [s]
while stack:
v = stack.pop()
... | false | 18.333333 | [
"-neighbor = defaultdict(list)",
"-rev_neighbor = defaultdict(list)",
"- neighbor[a].append(b)",
"- rev_neighbor[b].append(a)",
"+def neighbor_dict(E):",
"+ neighbor = defaultdict(list)",
"+ for a, b, c in E:",
"+ neighbor[a].append(b)",
"+ return neighbor",
"+",
"+",
"+d... | false | 0.034569 | 0.036478 | 0.947659 | [
"s087665645",
"s982306260"
] |
u883048396 | p03681 | python | s815913901 | s019234781 | 49 | 34 | 3,064 | 3,320 | Accepted | Accepted | 30.61 | def 解():
iN,iM = [int(_) for _ in input().split()]
iD = 10**9+7
if abs(iN - iM) <= 1:
iFacM = 1
for i in range(1,iM+1):
iFacM *= i
iFacM %=iD
if iN == iM:
print(( iFacM * iFacM % iD * 2 % iD ))
else:
iFacN = 1
... | def 解():
iN,iM = [int(_) for _ in input().split()]
iD = 10**9+7
if abs(iN - iM) <= 1:
if iN < iM:
iN,iM = iM,iN
iFacM = 1
for i in range(1,iM+1):
iFacM *= i
iFacM %=iD
if iN == iM:
print(( iFacM * iFacM % iD * 2 % i... | 20 | 22 | 482 | 537 | def 解():
iN, iM = [int(_) for _ in input().split()]
iD = 10**9 + 7
if abs(iN - iM) <= 1:
iFacM = 1
for i in range(1, iM + 1):
iFacM *= i
iFacM %= iD
if iN == iM:
print((iFacM * iFacM % iD * 2 % iD))
else:
iFacN = 1
f... | def 解():
iN, iM = [int(_) for _ in input().split()]
iD = 10**9 + 7
if abs(iN - iM) <= 1:
if iN < iM:
iN, iM = iM, iN
iFacM = 1
for i in range(1, iM + 1):
iFacM *= i
iFacM %= iD
if iN == iM:
print((iFacM * iFacM % iD * 2 % iD))
... | false | 9.090909 | [
"+ if iN < iM:",
"+ iN, iM = iM, iN",
"- iFacN = 1",
"- for i in range(1, iN + 1):",
"+ iFacN = iFacM",
"+ for i in range(iM + 1, iN + 1):"
] | false | 0.038192 | 0.112646 | 0.339047 | [
"s815913901",
"s019234781"
] |
u145950990 | p03242 | python | s752519672 | s457003586 | 164 | 28 | 38,256 | 9,008 | Accepted | Accepted | 82.93 | n = list(input())
for i in n:
if i=='1':print('9',end='')
else:print('1',end='')
| n = eval(input())
ans = ''
for i in n:
if i == '9': ans += '1'
else: ans += '9'
print(ans)
| 4 | 6 | 91 | 98 | n = list(input())
for i in n:
if i == "1":
print("9", end="")
else:
print("1", end="")
| n = eval(input())
ans = ""
for i in n:
if i == "9":
ans += "1"
else:
ans += "9"
print(ans)
| false | 33.333333 | [
"-n = list(input())",
"+n = eval(input())",
"+ans = \"\"",
"- if i == \"1\":",
"- print(\"9\", end=\"\")",
"+ if i == \"9\":",
"+ ans += \"1\"",
"- print(\"1\", end=\"\")",
"+ ans += \"9\"",
"+print(ans)"
] | false | 0.03769 | 0.082542 | 0.456618 | [
"s752519672",
"s457003586"
] |
u941022948 | p02696 | python | s185805466 | s385754834 | 56 | 22 | 62,028 | 8,980 | Accepted | Accepted | 60.71 |
import math
def f(A, B, X):
return math.floor((A*X)/B) - A*math.floor(X/B)
A,B,N = list(map(int,input().split()))
if N < B:
print((f(A,B,N)))
else:
print((f(A,B,B-1)))
| a,b,c=list(map(int,input().split()))
if c+1>=b:
ans=int(a*(b-1)/b)
else:
ans=int(a*c/b)
print(ans) | 12 | 6 | 179 | 105 | import math
def f(A, B, X):
return math.floor((A * X) / B) - A * math.floor(X / B)
A, B, N = list(map(int, input().split()))
if N < B:
print((f(A, B, N)))
else:
print((f(A, B, B - 1)))
| a, b, c = list(map(int, input().split()))
if c + 1 >= b:
ans = int(a * (b - 1) / b)
else:
ans = int(a * c / b)
print(ans)
| false | 50 | [
"-import math",
"-",
"-",
"-def f(A, B, X):",
"- return math.floor((A * X) / B) - A * math.floor(X / B)",
"-",
"-",
"-A, B, N = list(map(int, input().split()))",
"-if N < B:",
"- print((f(A, B, N)))",
"+a, b, c = list(map(int, input().split()))",
"+if c + 1 >= b:",
"+ ans = int(a * ... | false | 0.037702 | 0.04242 | 0.88877 | [
"s185805466",
"s385754834"
] |
u077291787 | p03464 | python | s510064581 | s749941888 | 84 | 74 | 14,092 | 14,092 | Accepted | Accepted | 11.9 | # AGC020B - Ice Rink Game
def main():
K, *A = list(map(int, open(0).read().split()))
if A.pop() != 2:
print((-1))
return
mn, mx = 2, 3
for i in A[::-1]:
if i > mx:
print((-1))
return
mx = mx // i * i + i - 1
mn = ((mn + i - 1) /... | # AGC020B - Ice Rink Game
def main():
K, *A = list(map(int, open(0).read().split()))
l, h = 2, 2 # low, high
for i in A[::-1]:
l += -l % i
h += i - 1 - h % i
if l > h:
print((-1))
else:
print((l, h))
if __name__ == "__main__":
main() | 21 | 15 | 432 | 296 | # AGC020B - Ice Rink Game
def main():
K, *A = list(map(int, open(0).read().split()))
if A.pop() != 2:
print((-1))
return
mn, mx = 2, 3
for i in A[::-1]:
if i > mx:
print((-1))
return
mx = mx // i * i + i - 1
mn = ((mn + i - 1) // i) * i
... | # AGC020B - Ice Rink Game
def main():
K, *A = list(map(int, open(0).read().split()))
l, h = 2, 2 # low, high
for i in A[::-1]:
l += -l % i
h += i - 1 - h % i
if l > h:
print((-1))
else:
print((l, h))
if __name__ == "__main__":
main()
| false | 28.571429 | [
"- if A.pop() != 2:",
"- print((-1))",
"- return",
"- mn, mx = 2, 3",
"+ l, h = 2, 2 # low, high",
"- if i > mx:",
"- print((-1))",
"- return",
"- mx = mx // i * i + i - 1",
"- mn = ((mn + i - 1) // i) * i",
"- if mn > mx:",
... | false | 0.048945 | 0.048256 | 1.01428 | [
"s510064581",
"s749941888"
] |
u278886389 | p02838 | python | s548142421 | s198015837 | 1,606 | 1,382 | 234,352 | 236,124 | Accepted | Accepted | 13.95 | def bi(x):
x = int(x)
i = 0
o = [0]*61
while x > 0:
o[i] = x % 2
x //= 2
i += 1
return o
N = int(eval(input()))
A = list(map(bi,input().split()))
# print(*A,sep='\n')
a = 0
ruijoo = 1
bbb = 0
B = [0]*N
h = 0
while h < 61:
i = 0
isOne = 0
wh... | def bi(x):
x = int(x)
i = 0
o = [0]*61
while x > 0:
o[i] = x % 2
x //= 2
i += 1
return o
N = int(eval(input()))
A = list(map(bi,input().split()))
# print(*A,sep='\n')
ruijoo = 1
bbb = 0
B = [0]*N
h = 0
while h < 61:
i = 0
isOne = 0
while i <... | 44 | 35 | 706 | 572 | def bi(x):
x = int(x)
i = 0
o = [0] * 61
while x > 0:
o[i] = x % 2
x //= 2
i += 1
return o
N = int(eval(input()))
A = list(map(bi, input().split()))
# print(*A,sep='\n')
a = 0
ruijoo = 1
bbb = 0
B = [0] * N
h = 0
while h < 61:
i = 0
isOne = 0
while i < N:
... | def bi(x):
x = int(x)
i = 0
o = [0] * 61
while x > 0:
o[i] = x % 2
x //= 2
i += 1
return o
N = int(eval(input()))
A = list(map(bi, input().split()))
# print(*A,sep='\n')
ruijoo = 1
bbb = 0
B = [0] * N
h = 0
while h < 61:
i = 0
isOne = 0
while i < N:
aaaa... | false | 20.454545 | [
"-a = 0",
"- C = [isOne, isZero]",
"- bbbb = 0",
"- i = 0",
"- while i < N:",
"- bbbb += C[B[i]]",
"- i += 1",
"- bbbb *= ruijoo",
"- bbb += bbbb",
"+ bbb += ruijoo * isZero * isOne",
"-bbb *= 500000004"
] | false | 0.052645 | 0.121736 | 0.432453 | [
"s548142421",
"s198015837"
] |
u319778238 | p02688 | python | s922002657 | s820817990 | 30 | 27 | 9,172 | 9,096 | Accepted | Accepted | 10 | N, K = list(map(int, input().split()))
tmp = set()
for i in range(K):
eval(input())
tmp.update(list(map(int, input().split())))
print((N - len(tmp))) | N, K = list(map(int, input().split()))
tmp = [0] * N
for i in range(K):
eval(input())
for j in map(int, input().split()):
tmp[j-1] |= 1
print((N - sum(tmp)))
| 9 | 9 | 147 | 165 | N, K = list(map(int, input().split()))
tmp = set()
for i in range(K):
eval(input())
tmp.update(list(map(int, input().split())))
print((N - len(tmp)))
| N, K = list(map(int, input().split()))
tmp = [0] * N
for i in range(K):
eval(input())
for j in map(int, input().split()):
tmp[j - 1] |= 1
print((N - sum(tmp)))
| false | 0 | [
"-tmp = set()",
"+tmp = [0] * N",
"- tmp.update(list(map(int, input().split())))",
"-print((N - len(tmp)))",
"+ for j in map(int, input().split()):",
"+ tmp[j - 1] |= 1",
"+print((N - sum(tmp)))"
] | false | 0.036227 | 0.035952 | 1.007672 | [
"s922002657",
"s820817990"
] |
u211160392 | p02969 | python | s341439456 | s707968334 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | i = int(eval(input()))
print((3*i**2)) | print((3*int(eval(input()))**2)) | 2 | 1 | 31 | 24 | i = int(eval(input()))
print((3 * i**2))
| print((3 * int(eval(input())) ** 2))
| false | 50 | [
"-i = int(eval(input()))",
"-print((3 * i**2))",
"+print((3 * int(eval(input())) ** 2))"
] | false | 0.049128 | 0.048116 | 1.021035 | [
"s341439456",
"s707968334"
] |
u923668099 | p02269 | python | s494754264 | s438191299 | 4,150 | 1,450 | 33,224 | 33,672 | Accepted | Accepted | 65.06 |
n = int(eval(input()))
dic = set()
for i in range(n):
cmd = input().split()
if cmd[0] == "insert":
dic.add(cmd[1])
else:
print(("yes" if cmd[1] in dic else "no")) | import sys
n = int(eval(input()))
dic = set()
for i in range(n):
cmd = sys.stdin.readline().split()
if cmd[0] == "insert":
dic.add(cmd[1])
else:
print(("yes" if cmd[1] in dic else "no")) | 11 | 12 | 195 | 220 | n = int(eval(input()))
dic = set()
for i in range(n):
cmd = input().split()
if cmd[0] == "insert":
dic.add(cmd[1])
else:
print(("yes" if cmd[1] in dic else "no"))
| import sys
n = int(eval(input()))
dic = set()
for i in range(n):
cmd = sys.stdin.readline().split()
if cmd[0] == "insert":
dic.add(cmd[1])
else:
print(("yes" if cmd[1] in dic else "no"))
| false | 8.333333 | [
"+import sys",
"+",
"- cmd = input().split()",
"+ cmd = sys.stdin.readline().split()"
] | false | 0.038036 | 0.06534 | 0.582122 | [
"s494754264",
"s438191299"
] |
u678167152 | p03611 | python | s087913083 | s483911875 | 250 | 82 | 57,452 | 20,628 | Accepted | Accepted | 67.2 | from collections import Counter
def solve():
ans = 0
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
for i in range(1,10**5-1):
cnt = 0
if i-1 in c:
cnt += c[i-1]
if i in c:
cnt += c[i]
if i+1 in c:
... | def solve():
ans = 0
N = int(eval(input()))
A = list(map(int, input().split()))
lis = [0]*(10**5+2)
for i in range(N):
lis[A[i]-1] += 1
lis[A[i]] += 1
lis[A[i]+1] += 1
ans = max(lis)
return ans
print((solve())) | 17 | 12 | 396 | 239 | from collections import Counter
def solve():
ans = 0
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
for i in range(1, 10**5 - 1):
cnt = 0
if i - 1 in c:
cnt += c[i - 1]
if i in c:
cnt += c[i]
if i + 1 in c:
... | def solve():
ans = 0
N = int(eval(input()))
A = list(map(int, input().split()))
lis = [0] * (10**5 + 2)
for i in range(N):
lis[A[i] - 1] += 1
lis[A[i]] += 1
lis[A[i] + 1] += 1
ans = max(lis)
return ans
print((solve()))
| false | 29.411765 | [
"-from collections import Counter",
"-",
"-",
"- c = Counter(A)",
"- for i in range(1, 10**5 - 1):",
"- cnt = 0",
"- if i - 1 in c:",
"- cnt += c[i - 1]",
"- if i in c:",
"- cnt += c[i]",
"- if i + 1 in c:",
"- cnt += c[i + 1]"... | false | 0.098372 | 0.167762 | 0.586377 | [
"s087913083",
"s483911875"
] |
u075303794 | p03456 | python | s442941083 | s248618242 | 25 | 23 | 9,076 | 9,104 | Accepted | Accepted | 8 | import sys
import math
A,B=input().split()
X=int(A+B)
print(('Yes' if math.sqrt(X).is_integer() else 'No')) | import sys
A,B=input().split()
X=int(A+B)
L=[x*x for x in range(1,1001)]
if X in L:
print('Yes')
else:
print('No') | 7 | 10 | 113 | 131 | import sys
import math
A, B = input().split()
X = int(A + B)
print(("Yes" if math.sqrt(X).is_integer() else "No"))
| import sys
A, B = input().split()
X = int(A + B)
L = [x * x for x in range(1, 1001)]
if X in L:
print("Yes")
else:
print("No")
| false | 30 | [
"-import math",
"-print((\"Yes\" if math.sqrt(X).is_integer() else \"No\"))",
"+L = [x * x for x in range(1, 1001)]",
"+if X in L:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.039776 | 0.050059 | 0.794581 | [
"s442941083",
"s248618242"
] |
u143322814 | p02732 | python | s521476202 | s641433804 | 1,618 | 422 | 119,636 | 31,904 | Accepted | Accepted | 73.92 | import itertools
import math
def C(n,r):
if n-r < 0:
return 0
return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
d[i] = d.get(i, 0)+1
c = 0
cc = {}
for key, val in list(d.items()):
... | import itertools
import math
def C(n,r): return n*(n-1)//r
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
d[i] = d.get(i, 0)+1
c = 0
cc = {}
for key, val in list(d.items()):
temp = C(val,2)
c += temp
if cc.get(key) is None:
cc[key] = temp - C(val... | 22 | 19 | 442 | 349 | import itertools
import math
def C(n, r):
if n - r < 0:
return 0
return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
d[i] = d.get(i, 0) + 1
c = 0
cc = {}
for key, val in list(d.items()):
temp = ... | import itertools
import math
def C(n, r):
return n * (n - 1) // r
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
d[i] = d.get(i, 0) + 1
c = 0
cc = {}
for key, val in list(d.items()):
temp = C(val, 2)
c += temp
if cc.get(key) is None:
cc[key] = temp - C(val ... | false | 13.636364 | [
"- if n - r < 0:",
"- return 0",
"- return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))",
"+ return n * (n - 1) // r"
] | false | 0.037926 | 0.067917 | 0.558413 | [
"s521476202",
"s641433804"
] |
u688319022 | p02861 | python | s788995219 | s079142234 | 150 | 19 | 12,500 | 3,188 | Accepted | Accepted | 87.33 | import numpy as np
from math import sqrt,factorial
N = int(eval(input()))
M = [0]*N
edge = np.zeros([N,N])
sum=0
for i in range(N):
M[i] = list(map(int,input().split()))
for i in range(N):
for k in range(i+1,N):
edge[i,k] = sqrt((M[i][0]-M[k][0])**2 + (M[i][1]-M[k][1])**2)
sum+=edge[i... | N = int(eval(input()))
M = [0]*N
edge = [0]*N
for i in range(N):
edge[i]=[0]*N
sum=0
for i in range(N):
M[i] = list(map(int,input().split()))
for i in range(N):
for k in range(i+1,N):
edge[i][k] = pow(((M[i][0]-M[k][0])**2 + (M[i][1]-M[k][1])**2),0.5)
sum+=edge[i][k]
average = sum/... | 14 | 14 | 352 | 333 | import numpy as np
from math import sqrt, factorial
N = int(eval(input()))
M = [0] * N
edge = np.zeros([N, N])
sum = 0
for i in range(N):
M[i] = list(map(int, input().split()))
for i in range(N):
for k in range(i + 1, N):
edge[i, k] = sqrt((M[i][0] - M[k][0]) ** 2 + (M[i][1] - M[k][1]) ** 2)
su... | N = int(eval(input()))
M = [0] * N
edge = [0] * N
for i in range(N):
edge[i] = [0] * N
sum = 0
for i in range(N):
M[i] = list(map(int, input().split()))
for i in range(N):
for k in range(i + 1, N):
edge[i][k] = pow(((M[i][0] - M[k][0]) ** 2 + (M[i][1] - M[k][1]) ** 2), 0.5)
sum += edge[i][k]... | false | 0 | [
"-import numpy as np",
"-from math import sqrt, factorial",
"-",
"-edge = np.zeros([N, N])",
"+edge = [0] * N",
"+for i in range(N):",
"+ edge[i] = [0] * N",
"- edge[i, k] = sqrt((M[i][0] - M[k][0]) ** 2 + (M[i][1] - M[k][1]) ** 2)",
"- sum += edge[i, k]",
"+ edge[i][k] = p... | false | 0.170656 | 0.055075 | 3.09863 | [
"s788995219",
"s079142234"
] |
u994988729 | p03213 | python | s050896101 | s528624909 | 152 | 31 | 12,500 | 9,624 | Accepted | Accepted | 79.61 | #756
import numpy as np
N = int(eval(input()))
pf = np.zeros(N+1, dtype=int)
def prime_fact(N):
for i in range(2, int(N**0.5)+1):
if N%i == 0:
cnt = 0
while N%i==0:
cnt += 1
N //= i
pf[i] += cnt
if N != 1:
pf[... | from collections import Counter
from itertools import chain
def prime_set(N):
"""
Nまでの素数のsetを返す
"""
if N < 4:
return ({}, {}, {2}, {2, 3})[N]
Nsq = int(N ** 0.5 + 0.5) + 1
primes = {2, 3} | set(chain(list(range(5, N + 1, 6)), list(range(7, N + 1, 6))))
for i in range(5,... | 39 | 64 | 756 | 1,320 | # 756
import numpy as np
N = int(eval(input()))
pf = np.zeros(N + 1, dtype=int)
def prime_fact(N):
for i in range(2, int(N**0.5) + 1):
if N % i == 0:
cnt = 0
while N % i == 0:
cnt += 1
N //= i
pf[i] += cnt
if N != 1:
pf[N] +=... | from collections import Counter
from itertools import chain
def prime_set(N):
"""
Nまでの素数のsetを返す
"""
if N < 4:
return ({}, {}, {2}, {2, 3})[N]
Nsq = int(N**0.5 + 0.5) + 1
primes = {2, 3} | set(chain(list(range(5, N + 1, 6)), list(range(7, N + 1, 6))))
for i in range(5, Nsq, 2):
... | false | 39.0625 | [
"-# 756",
"-import numpy as np",
"+from collections import Counter",
"+from itertools import chain",
"+",
"+",
"+def prime_set(N):",
"+ \"\"\"",
"+ Nまでの素数のsetを返す",
"+ \"\"\"",
"+ if N < 4:",
"+ return ({}, {}, {2}, {2, 3})[N]",
"+ Nsq = int(N**0.5 + 0.5) + 1",
"+ p... | false | 1.146209 | 0.081434 | 14.075287 | [
"s050896101",
"s528624909"
] |
u017810624 | p02697 | python | s302591416 | s419742582 | 112 | 93 | 81,244 | 69,436 | Accepted | Accepted | 16.96 | n,m=list(map(int,input().split()))
ans=[]
for i in range(m):
ans.append([i+1,2*m-i])
if n%2==0:
ans.reverse()
flag=0
for i in range(len(ans)):
if ans[i][1]-ans[i][0]>=n//2:
flag=1
if flag==1:
ans[i][1]+=1
ans.reverse()
for i in range(len(ans)):
print((ans[i][0],ans[i][1])) | n,m=list(map(int,input().split()))
for i in range(m):
if n%2==0 and 2*m-i-i-1>=n//2:
print((i+1,2*m-i+1))
else:
print((i+1,2*m-i)) | 15 | 6 | 311 | 137 | n, m = list(map(int, input().split()))
ans = []
for i in range(m):
ans.append([i + 1, 2 * m - i])
if n % 2 == 0:
ans.reverse()
flag = 0
for i in range(len(ans)):
if ans[i][1] - ans[i][0] >= n // 2:
flag = 1
if flag == 1:
ans[i][1] += 1
ans.reverse()
for i in r... | n, m = list(map(int, input().split()))
for i in range(m):
if n % 2 == 0 and 2 * m - i - i - 1 >= n // 2:
print((i + 1, 2 * m - i + 1))
else:
print((i + 1, 2 * m - i))
| false | 60 | [
"-ans = []",
"- ans.append([i + 1, 2 * m - i])",
"-if n % 2 == 0:",
"- ans.reverse()",
"- flag = 0",
"- for i in range(len(ans)):",
"- if ans[i][1] - ans[i][0] >= n // 2:",
"- flag = 1",
"- if flag == 1:",
"- ans[i][1] += 1",
"- ans.reverse()",
... | false | 0.116321 | 0.039381 | 2.953716 | [
"s302591416",
"s419742582"
] |
u602860891 | p03687 | python | s357506512 | s867468717 | 54 | 17 | 3,444 | 2,940 | Accepted | Accepted | 68.52 | import copy
s = eval(input())
c_list = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
min_loop = len(s)
for c in c_list:
if s.count(c) == 0:
continue
s_ = copy.copy(s)
new_s = copy.copy(s)
loop = 0... | s = eval(input())
c_list = [chr(i) for i in range(97, 123)]
min_loop = len(s)
for c in c_list:
str_list = s.split(c)
loop = max(len(str) for str in str_list)
min_loop = min(min_loop, loop)
print(min_loop)
| 28 | 10 | 683 | 222 | import copy
s = eval(input())
c_list = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
min_loop = len(s)
for c in c_list:
if ... | s = eval(input())
c_list = [chr(i) for i in range(97, 123)]
min_loop = len(s)
for c in c_list:
str_list = s.split(c)
loop = max(len(str) for str in str_list)
min_loop = min(min_loop, loop)
print(min_loop)
| false | 64.285714 | [
"-import copy",
"-",
"-c_list = [",
"- \"a\",",
"- \"b\",",
"- \"c\",",
"- \"d\",",
"- \"e\",",
"- \"f\",",
"- \"g\",",
"- \"h\",",
"- \"i\",",
"- \"j\",",
"- \"k\",",
"- \"l\",",
"- \"m\",",
"- \"n\",",
"- \"o\",",
"- \"p\",",
"-... | false | 0.048527 | 0.037888 | 1.280819 | [
"s357506512",
"s867468717"
] |
u824326335 | p02984 | python | s553432201 | s597247709 | 170 | 138 | 19,912 | 19,144 | Accepted | Accepted | 18.82 | n = int(eval(input()))
a = list(map(int,input().split()))
x =0
for i,w in enumerate(a):
x += (-1)**i*w
ans = [x]
for i,t in enumerate(a):
ans.append(int(((ans[i]/2)-t)*(-2)))
print((' '.join(map(str, ans[:-1])))) | n = int(eval(input()))
a = list(map(int,input().split()))
x =0
for i,w in enumerate(a):
if i % 2:
w*=-1
x += w
ans = [x]
for i,t in enumerate(a[:-1]):
ans.append(int(((ans[i]/2)-t)*(-2)))
print((' '.join(map(str, ans)))) | 9 | 11 | 220 | 242 | n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i, w in enumerate(a):
x += (-1) ** i * w
ans = [x]
for i, t in enumerate(a):
ans.append(int(((ans[i] / 2) - t) * (-2)))
print((" ".join(map(str, ans[:-1]))))
| n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i, w in enumerate(a):
if i % 2:
w *= -1
x += w
ans = [x]
for i, t in enumerate(a[:-1]):
ans.append(int(((ans[i] / 2) - t) * (-2)))
print((" ".join(map(str, ans))))
| false | 18.181818 | [
"- x += (-1) ** i * w",
"+ if i % 2:",
"+ w *= -1",
"+ x += w",
"-for i, t in enumerate(a):",
"+for i, t in enumerate(a[:-1]):",
"-print((\" \".join(map(str, ans[:-1]))))",
"+print((\" \".join(map(str, ans))))"
] | false | 0.039285 | 0.151421 | 0.259444 | [
"s553432201",
"s597247709"
] |
u416011173 | p03048 | python | s490477891 | s112930918 | 1,874 | 1,630 | 3,060 | 3,064 | Accepted | Accepted | 13.02 | # -*- coding: utf-8 -*-
# 標準入力の取得
R, G, B, N = list(map(int, input().split()))
def main() -> None:
# 求解処理
r_max = N // R
g_max = N // G
result = 0
for r in range(r_max+1):
n_r = r * R
for g in range(g_max+1):
n_rg = n_r + g*G
if N < n_rg:
... | # -*- coding: utf-8 -*-
# 標準入力の取得
R, G, B, N = list(map(int, input().split()))
def main() -> None:
"""Entry point
"""
# 求解処理
"""
r, gをそれぞれ固定して探索を行う.
"""
r_max = N // R
g_max = N // G
result = 0
for r in range(r_max+1):
n_r = r * R
for g in range... | 25 | 32 | 484 | 640 | # -*- coding: utf-8 -*-
# 標準入力の取得
R, G, B, N = list(map(int, input().split()))
def main() -> None:
# 求解処理
r_max = N // R
g_max = N // G
result = 0
for r in range(r_max + 1):
n_r = r * R
for g in range(g_max + 1):
n_rg = n_r + g * G
if N < n_rg:
... | # -*- coding: utf-8 -*-
# 標準入力の取得
R, G, B, N = list(map(int, input().split()))
def main() -> None:
"""Entry point"""
# 求解処理
"""
r, gをそれぞれ固定して探索を行う.
"""
r_max = N // R
g_max = N // G
result = 0
for r in range(r_max + 1):
n_r = r * R
for g in range(g_max + 1):
... | false | 21.875 | [
"+ \"\"\"Entry point\"\"\"",
"+ \"\"\"",
"+ r, gをそれぞれ固定して探索を行う.",
"+ \"\"\"",
"+ # この時点でNよりも大きい場合、何もしない",
"+ # Nまでの不足分がBで割り切れる場合、条件を満たしたことになる"
] | false | 0.065776 | 0.093026 | 0.707065 | [
"s490477891",
"s112930918"
] |
u893063840 | p02623 | python | s903465307 | s870070240 | 278 | 240 | 47,312 | 50,936 | Accepted | Accepted | 13.67 | from itertools import accumulate
from bisect import bisect_right
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
acc_a = list(accumulate(a))
acc_b = list(accumulate(b))
ans = 0
for i, e in enumerate(acc_b):
if e > k:
bre... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
INF = 10 ** 18
acc_a = [0] + list(accumulate(a))
acc_b = [0] + list(accumulate(b))
j = m
ans = 0
for i, e in enumerate(acc_a):
while j >= 0 and acc_b[j] > ... | 18 | 21 | 402 | 421 | from itertools import accumulate
from bisect import bisect_right
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
acc_a = list(accumulate(a))
acc_b = list(accumulate(b))
ans = 0
for i, e in enumerate(acc_b):
if e > k:
break
a_cnt = ... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
INF = 10**18
acc_a = [0] + list(accumulate(a))
acc_b = [0] + list(accumulate(b))
j = m
ans = 0
for i, e in enumerate(acc_a):
while j >= 0 and acc_b[j] > k - acc_a[i]:
... | false | 14.285714 | [
"-from bisect import bisect_right",
"-b = [0] + list(map(int, input().split()))",
"-acc_a = list(accumulate(a))",
"-acc_b = list(accumulate(b))",
"+b = list(map(int, input().split()))",
"+INF = 10**18",
"+acc_a = [0] + list(accumulate(a))",
"+acc_b = [0] + list(accumulate(b))",
"+j = m",
"-for i, ... | false | 0.043609 | 0.115442 | 0.377753 | [
"s903465307",
"s870070240"
] |
u185896732 | p03633 | python | s579267662 | s135787521 | 36 | 17 | 5,176 | 3,060 | Accepted | Accepted | 52.78 | from fractions import gcd
n=int(eval(input()))
s=1
for i in range(n):
t=int(eval(input()))
s=s*t//gcd(s,t)
print(s) | def gcd(a,b):
if b==0:
return abs(a)
return gcd(b,a%b)
def lcm(a,b):
return (a*b)//gcd(a,b)
#n,m=map(int,input().split())
#print(gcd(n,m))
n=int(eval(input()))
a=[]
for i in range(n):
a.append(int(eval(input())))
#a=list(map(int,input().split()))
m=a[0]
for i in range(1,len(a))... | 7 | 20 | 117 | 340 | from fractions import gcd
n = int(eval(input()))
s = 1
for i in range(n):
t = int(eval(input()))
s = s * t // gcd(s, t)
print(s)
| def gcd(a, b):
if b == 0:
return abs(a)
return gcd(b, a % b)
def lcm(a, b):
return (a * b) // gcd(a, b)
# n,m=map(int,input().split())
# print(gcd(n,m))
n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
# a=list(map(int,input().split()))
m = a[0]
for i in range(1,... | false | 65 | [
"-from fractions import gcd",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return abs(a)",
"+ return gcd(b, a % b)",
"+",
"+def lcm(a, b):",
"+ return (a * b) // gcd(a, b)",
"+",
"+",
"+# n,m=map(int,input().split())",
"+# print(gcd(n,m))",
"-s = 1",
"+a = []",
"- t = int(eva... | false | 0.04803 | 0.071383 | 0.67285 | [
"s579267662",
"s135787521"
] |
u191394596 | p02762 | python | s200582048 | s261443676 | 1,146 | 785 | 77,096 | 19,504 | Accepted | Accepted | 31.5 | import sys
sys.setrecursionlimit(2 ** 30)
N, M, K = list(map(int, input().split()))
groups = [None] * N
visited = set()
# 連結成分を求める
def dfs(group, i):
if i in visited:
return
visited.add(i)
group.add(i)
groups[i] = group
# 他のノード
for c in graph[i]:
if not c in visited:
dfs... | from sys import stdin
input = stdin.readline
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n)]
self.size = [1] * n
def unite(self, a, b):
a = self.find(a)
b = self.find(b)
if a != b:
if self.size[a] < self.size[b]:
a, b = b, a
... | 54 | 58 | 999 | 1,256 | import sys
sys.setrecursionlimit(2**30)
N, M, K = list(map(int, input().split()))
groups = [None] * N
visited = set()
# 連結成分を求める
def dfs(group, i):
if i in visited:
return
visited.add(i)
group.add(i)
groups[i] = group
# 他のノード
for c in graph[i]:
if not c in visited:
d... | from sys import stdin
input = stdin.readline
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n)]
self.size = [1] * n
def unite(self, a, b):
a = self.find(a)
b = self.find(b)
if a != b:
if self.size[a] < self.size[b]:
a,... | false | 6.896552 | [
"-import sys",
"+from sys import stdin",
"-sys.setrecursionlimit(2**30)",
"-N, M, K = list(map(int, input().split()))",
"-groups = [None] * N",
"-visited = set()",
"-# 連結成分を求める",
"-def dfs(group, i):",
"- if i in visited:",
"- return",
"- visited.add(i)",
"- group.add(i)",
"-... | false | 0.032673 | 0.034495 | 0.94717 | [
"s200582048",
"s261443676"
] |
u078042885 | p00613 | python | s732928212 | s770197746 | 60 | 50 | 7,552 | 7,728 | Accepted | Accepted | 16.67 | while 1:
k=int(eval(input()))
if k==0:break
print((sum(map(int,input().split()))//(k-1))) | while 1:
k=int(eval(input()))-1
if k<0:break
print((sum(map(int,input().split()))//k)) | 4 | 4 | 96 | 93 | while 1:
k = int(eval(input()))
if k == 0:
break
print((sum(map(int, input().split())) // (k - 1)))
| while 1:
k = int(eval(input())) - 1
if k < 0:
break
print((sum(map(int, input().split())) // k))
| false | 0 | [
"- k = int(eval(input()))",
"- if k == 0:",
"+ k = int(eval(input())) - 1",
"+ if k < 0:",
"- print((sum(map(int, input().split())) // (k - 1)))",
"+ print((sum(map(int, input().split())) // k))"
] | false | 0.037956 | 0.079524 | 0.477288 | [
"s732928212",
"s770197746"
] |
u001024152 | p04044 | python | s231493780 | s751499822 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | N,L = list(map(int, input().split()))
s = [eval(input()) for _ in range(N)]
s.sort()
print(("".join(s))) | N, L = list(map(int, input().split()))
s = [eval(input()) for _ in range(N)]
ans = ""
s.sort()
for si in s:
ans += si
print(ans)
| 4 | 8 | 93 | 129 | N, L = list(map(int, input().split()))
s = [eval(input()) for _ in range(N)]
s.sort()
print(("".join(s)))
| N, L = list(map(int, input().split()))
s = [eval(input()) for _ in range(N)]
ans = ""
s.sort()
for si in s:
ans += si
print(ans)
| false | 50 | [
"+ans = \"\"",
"-print((\"\".join(s)))",
"+for si in s:",
"+ ans += si",
"+print(ans)"
] | false | 0.046827 | 0.047018 | 0.995953 | [
"s231493780",
"s751499822"
] |
u504335849 | p03835 | python | s264401587 | s829851588 | 1,826 | 1,685 | 2,940 | 2,940 | Accepted | Accepted | 7.72 | k,s = list(map(int,input().strip().split()))
count= 0
for x in range(k+1):
for y in range(k+1):
if s-x-y >= 0 and s-x-y <= k:
count += 1
print(count)
| k,s = list(map(int, input().split()))
count = 0
for x in range(k+1):
for y in range(k+1):
z = s - (x+y)
if k >= z and 0 <= z:
count += 1
print(count) | 9 | 10 | 194 | 192 | k, s = list(map(int, input().strip().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
if s - x - y >= 0 and s - x - y <= k:
count += 1
print(count)
| k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - (x + y)
if k >= z and 0 <= z:
count += 1
print(count)
| false | 10 | [
"-k, s = list(map(int, input().strip().split()))",
"+k, s = list(map(int, input().split()))",
"- if s - x - y >= 0 and s - x - y <= k:",
"+ z = s - (x + y)",
"+ if k >= z and 0 <= z:"
] | false | 0.044729 | 0.117679 | 0.380093 | [
"s264401587",
"s829851588"
] |
u150984829 | p02257 | python | s690212961 | s586428871 | 60 | 50 | 5,608 | 5,616 | Accepted | Accepted | 16.67 | import sys
eval(input());c=0
for x in map(int,sys.stdin):
if 2 in[x,pow(2,x,x)]:c+=1
print(c)
| import sys
eval(input())
print((sum(2 in[x,pow(2,x,x)]for x in map(int,sys.stdin))))
| 5 | 3 | 93 | 79 | import sys
eval(input())
c = 0
for x in map(int, sys.stdin):
if 2 in [x, pow(2, x, x)]:
c += 1
print(c)
| import sys
eval(input())
print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin))))
| false | 40 | [
"-c = 0",
"-for x in map(int, sys.stdin):",
"- if 2 in [x, pow(2, x, x)]:",
"- c += 1",
"-print(c)",
"+print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin))))"
] | false | 0.037953 | 0.039021 | 0.972639 | [
"s690212961",
"s586428871"
] |
u585482323 | p03025 | python | s782010863 | s510463961 | 383 | 233 | 55,024 | 54,384 | Accepted | Accepted | 39.16 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 57 | 62 | 1,434 | 1,528 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 8.064516 | [
"- def comb(a, b):",
"- return fact[a] * fact[a - b] * inv[b] % mod",
"-",
"- N = 200000",
"+ N = 2 * n",
"- pa = pow(a, n, mod)",
"- pb = pow(b, n, mod)",
"+ fa, fb, fc = pow(b, n, mod), pow(a, n, mod), pow(c, n + 1, mod)",
"- ans += (",
"- inv[n - 1]",
... | false | 0.387868 | 0.007246 | 53.525719 | [
"s782010863",
"s510463961"
] |
u497952650 | p03380 | python | s208908143 | s825680020 | 114 | 69 | 14,428 | 14,428 | Accepted | Accepted | 39.47 | n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
M = max(a)
m = M/2
tmp = 1e9
for i in range(n-1):
if tmp > abs(a[i]-m):
tmp = abs(a[i]-m)
ans = i
print((M,a[ans])) | n = int(eval(input()))
a = list(map(int,input().split()))
m = max(a)
res = 1e10
ans = 0
for i in a:
if i != m:
if abs(m//2-i) < res:
res = abs(m//2-i)
ans = i
print((m,ans)) | 12 | 13 | 206 | 215 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
M = max(a)
m = M / 2
tmp = 1e9
for i in range(n - 1):
if tmp > abs(a[i] - m):
tmp = abs(a[i] - m)
ans = i
print((M, a[ans]))
| n = int(eval(input()))
a = list(map(int, input().split()))
m = max(a)
res = 1e10
ans = 0
for i in a:
if i != m:
if abs(m // 2 - i) < res:
res = abs(m // 2 - i)
ans = i
print((m, ans))
| false | 7.692308 | [
"-a.sort()",
"-M = max(a)",
"-m = M / 2",
"-tmp = 1e9",
"-for i in range(n - 1):",
"- if tmp > abs(a[i] - m):",
"- tmp = abs(a[i] - m)",
"- ans = i",
"-print((M, a[ans]))",
"+m = max(a)",
"+res = 1e10",
"+ans = 0",
"+for i in a:",
"+ if i != m:",
"+ if abs(m //... | false | 0.074056 | 0.044503 | 1.664083 | [
"s208908143",
"s825680020"
] |
u861141787 | p03835 | python | s380810111 | s887770925 | 1,643 | 1,472 | 2,940 | 2,940 | Accepted | Accepted | 10.41 | 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 z < 0:
continue
if z <= k:
# print(x, y, z)
ans += 1
print(ans) | 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 <= k:
ans += 1
print(ans) | 13 | 10 | 243 | 177 | 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 z < 0:
continue
if z <= k:
# print(x, y, z)
ans += 1
print(ans)
| 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 <= k:
ans += 1
print(ans)
| false | 23.076923 | [
"- if z < 0:",
"- continue",
"- if z <= k:",
"- # print(x, y, z)",
"+ if 0 <= z <= k:"
] | false | 0.048151 | 0.047308 | 1.017821 | [
"s380810111",
"s887770925"
] |
u347640436 | p02732 | python | s186020149 | s776941160 | 448 | 384 | 26,268 | 25,716 | Accepted | Accepted | 14.29 | N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
s = 0
for k in d:
s += d[k] * (d[k] - 1) // 2
for i in range(N):
t = A[i]
result = s
result -= d[t] * (d[t] - 1) // 2
result += (d[t] - 1) * ... | N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
s = 0
for k in d:
s += d[k] * (d[k] - 1) // 2
for i in range(N):
t = d[A[i]]
print((s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2))
| 20 | 17 | 349 | 293 | N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
s = 0
for k in d:
s += d[k] * (d[k] - 1) // 2
for i in range(N):
t = A[i]
result = s
result -= d[t] * (d[t] - 1) // 2
result += (d[t] - 1) * (d[t] - 2) // 2
p... | N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
s = 0
for k in d:
s += d[k] * (d[k] - 1) // 2
for i in range(N):
t = d[A[i]]
print((s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2))
| false | 15 | [
"- t = A[i]",
"- result = s",
"- result -= d[t] * (d[t] - 1) // 2",
"- result += (d[t] - 1) * (d[t] - 2) // 2",
"- print(result)",
"+ t = d[A[i]]",
"+ print((s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2))"
] | false | 0.039092 | 0.038749 | 1.008849 | [
"s186020149",
"s776941160"
] |
u124589361 | p03107 | python | s026503879 | s080304566 | 26 | 24 | 4,212 | 3,964 | Accepted | Accepted | 7.69 | import re
s = eval(input())
n = len(s)
one = [1 if si=="1" else 0 for si in s]
tmp=sum(one)
ret = min(tmp, n-tmp)*2
print(ret) | s = eval(input())
n = len(s)
one = [1 if si=="1" else 0 for si in s]
tmp=sum(one)
ret = min(tmp, n-tmp)*2
print(ret) | 10 | 8 | 132 | 119 | import re
s = eval(input())
n = len(s)
one = [1 if si == "1" else 0 for si in s]
tmp = sum(one)
ret = min(tmp, n - tmp) * 2
print(ret)
| s = eval(input())
n = len(s)
one = [1 if si == "1" else 0 for si in s]
tmp = sum(one)
ret = min(tmp, n - tmp) * 2
print(ret)
| false | 20 | [
"-import re",
"-"
] | false | 0.074926 | 0.071098 | 1.053844 | [
"s026503879",
"s080304566"
] |
u325956328 | p03472 | python | s788522575 | s877586223 | 349 | 221 | 21,904 | 12,868 | Accepted | Accepted | 36.68 | import sys
import numpy as np
from bisect import bisect_left
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort()
B.sort(reverse=True)
... | 43 | 41 | 779 | 727 | import sys
import numpy as np
from bisect import bisect_left
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def main():
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort()
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def main():
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort()
B.sort(reverse=True)
throw = []
for i ... | false | 4.651163 | [
"-import numpy as np",
"-from bisect import bisect_left"
] | false | 0.046799 | 0.041452 | 1.129002 | [
"s788522575",
"s877586223"
] |
u906501980 | p03354 | python | s898422021 | s964051107 | 1,850 | 1,020 | 125,548 | 94,700 | Accepted | Accepted | 44.86 | def main():
cnt = 0
for _ in range(m):
x, y = list(map(int, input().split()))
unite(x, y)
for i in range(1, n+1):
if same(i, p[i]):
cnt += 1
print(cnt)
def root(x):
if par[x] == x:
return x
par[x] = root(par[x])
return par[x]... | def main():
cnt = 0
for _ in range(m):
x, y = list(map(int, input().split()))
unite(x, y)
for i in range(1, n+1):
if same(i, p[i]):
cnt += 1
print(cnt)
def root(x):
if parent[x] == x:
return x
parent[x] = root(parent[x])
retu... | 32 | 37 | 636 | 813 | def main():
cnt = 0
for _ in range(m):
x, y = list(map(int, input().split()))
unite(x, y)
for i in range(1, n + 1):
if same(i, p[i]):
cnt += 1
print(cnt)
def root(x):
if par[x] == x:
return x
par[x] = root(par[x])
return par[x]
def same(x, y):
... | def main():
cnt = 0
for _ in range(m):
x, y = list(map(int, input().split()))
unite(x, y)
for i in range(1, n + 1):
if same(i, p[i]):
cnt += 1
print(cnt)
def root(x):
if parent[x] == x:
return x
parent[x] = root(parent[x])
return parent[x]
def ... | false | 13.513514 | [
"- if par[x] == x:",
"+ if parent[x] == x:",
"- par[x] = root(par[x])",
"- return par[x]",
"+ parent[x] = root(parent[x])",
"+ return parent[x]",
"- rx = root(x)",
"- ry = root(y)",
"- return rx == ry",
"+ return root(x) == root(y)",
"- par[x] = y",
"+ ... | false | 0.037077 | 0.080746 | 0.459182 | [
"s898422021",
"s964051107"
] |
u797673668 | p02345 | python | s635374746 | s401883239 | 3,060 | 2,560 | 9,672 | 14,780 | Accepted | Accepted | 16.34 | from math import sqrt, ceil
def_val = 2 ** 31 - 1
n, q = list(map(int, input().split()))
unit = ceil(sqrt(n))
l = [(def_val, [def_val] * unit) for _ in range(unit)]
while q:
op, s, t = list(map(int, input().split()))
sd, sm = s // unit, s % unit
if op:
td, tm = t // unit, t % unit
... | class SegTreeMin:
def __init__(self, n):
n2 = 1
while n2 < n:
n2 <<= 1
self.n2 = n2
self.tree = [(1 << 31) - 1] * (n2 << 1)
self.output = []
def update(self, i, x):
i += self.n2
self.tree[i] = x
while i > 1:
se... | 25 | 39 | 756 | 1,059 | from math import sqrt, ceil
def_val = 2**31 - 1
n, q = list(map(int, input().split()))
unit = ceil(sqrt(n))
l = [(def_val, [def_val] * unit) for _ in range(unit)]
while q:
op, s, t = list(map(int, input().split()))
sd, sm = s // unit, s % unit
if op:
td, tm = t // unit, t % unit
if sd == td... | class SegTreeMin:
def __init__(self, n):
n2 = 1
while n2 < n:
n2 <<= 1
self.n2 = n2
self.tree = [(1 << 31) - 1] * (n2 << 1)
self.output = []
def update(self, i, x):
i += self.n2
self.tree[i] = x
while i > 1:
self.tree[i >> ... | false | 35.897436 | [
"-from math import sqrt, ceil",
"+class SegTreeMin:",
"+ def __init__(self, n):",
"+ n2 = 1",
"+ while n2 < n:",
"+ n2 <<= 1",
"+ self.n2 = n2",
"+ self.tree = [(1 << 31) - 1] * (n2 << 1)",
"+ self.output = []",
"-def_val = 2**31 - 1",
"-n, q = li... | false | 0.036823 | 0.040384 | 0.911831 | [
"s635374746",
"s401883239"
] |
u633068244 | p00033 | python | s408062430 | s148184105 | 30 | 10 | 4,216 | 4,200 | Accepted | Accepted | 66.67 | def s(a,i,b,c):
return b==sorted(b) and c==sorted(c) if i==10 else s(a,i+1,b+[a[i]],c) or s(a,i+1,b,c+[a[i]])
for roop in range(int(input())):
print("YES" if s(list(map(int,input().split())),0,[],[]) else "NO") | def s(a):
b = c = 0
for i in a:
if i > b:
b = i
elif i > c:
c = i
else:
return False
return True
for n in range(int(input())):
print("YES" if s(list(map(int,input().split()))) else "NO") | 5 | 13 | 220 | 220 | def s(a, i, b, c):
return (
b == sorted(b) and c == sorted(c)
if i == 10
else s(a, i + 1, b + [a[i]], c) or s(a, i + 1, b, c + [a[i]])
)
for roop in range(int(input())):
print("YES" if s(list(map(int, input().split())), 0, [], []) else "NO")
| def s(a):
b = c = 0
for i in a:
if i > b:
b = i
elif i > c:
c = i
else:
return False
return True
for n in range(int(input())):
print("YES" if s(list(map(int, input().split()))) else "NO")
| false | 61.538462 | [
"-def s(a, i, b, c):",
"- return (",
"- b == sorted(b) and c == sorted(c)",
"- if i == 10",
"- else s(a, i + 1, b + [a[i]], c) or s(a, i + 1, b, c + [a[i]])",
"- )",
"+def s(a):",
"+ b = c = 0",
"+ for i in a:",
"+ if i > b:",
"+ b = i",
"+ ... | false | 0.038267 | 0.044145 | 0.866835 | [
"s408062430",
"s148184105"
] |
u864090097 | p02572 | python | s489916327 | s146731322 | 177 | 160 | 31,440 | 31,612 | Accepted | Accepted | 9.6 | N = int(eval(input()))
A = list(map(int ,input().split()))
MOD = 10**9+7
sum = 0
for i in range (N):
sum += A[i] % MOD
ans = 0
for i in range(N):
sum -= A[i]
ans += (A[i] * sum) % MOD
ans = ans % MOD
print(ans) | N = int(eval(input()))
A = list(map(int ,input().split()))
MOD = 10**9+7
sum = 0
for i in range (N):
sum += A[i]
ans = 0
for i in range(N):
sum -= A[i]
ans += (A[i] * sum) % MOD
ans = ans % MOD
print(ans) | 15 | 15 | 233 | 227 | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
sum = 0
for i in range(N):
sum += A[i] % MOD
ans = 0
for i in range(N):
sum -= A[i]
ans += (A[i] * sum) % MOD
ans = ans % MOD
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
sum = 0
for i in range(N):
sum += A[i]
ans = 0
for i in range(N):
sum -= A[i]
ans += (A[i] * sum) % MOD
ans = ans % MOD
print(ans)
| false | 0 | [
"- sum += A[i] % MOD",
"+ sum += A[i]"
] | false | 0.043862 | 0.040971 | 1.070561 | [
"s489916327",
"s146731322"
] |
u409064224 | p03659 | python | s618840857 | s660690702 | 259 | 212 | 24,800 | 24,624 | Accepted | Accepted | 18.15 | a = int(eval(input()))
l = list(map(int,input().split()))
le,ri = 0,sum(l)
ans = 10**10
for i in range(len(l)-1):
le += l[i]
ri -= l[i]
if ans < min(ans,abs(le-ri)):
print(ans)
break
else:
ans = min(ans,abs(le-ri))
else:
print(ans) | a = int(eval(input()))
l = list(map(int,input().split()))
le,ri,le2,ri2 = 0,sum(l),sum(l),0
ans,ans2 = 10**10,10**10
for i in range(len(l)//2):
le += l[i]
ri -= l[i]
le2 -= l[-(i+1)]
ri2 += l[-(i+1)]
ans = min(ans,abs(le-ri))
ans2 = min(ans2, abs(le2-ri2))
# print(ans,ans2)
els... | 15 | 15 | 284 | 342 | a = int(eval(input()))
l = list(map(int, input().split()))
le, ri = 0, sum(l)
ans = 10**10
for i in range(len(l) - 1):
le += l[i]
ri -= l[i]
if ans < min(ans, abs(le - ri)):
print(ans)
break
else:
ans = min(ans, abs(le - ri))
else:
print(ans)
| a = int(eval(input()))
l = list(map(int, input().split()))
le, ri, le2, ri2 = 0, sum(l), sum(l), 0
ans, ans2 = 10**10, 10**10
for i in range(len(l) // 2):
le += l[i]
ri -= l[i]
le2 -= l[-(i + 1)]
ri2 += l[-(i + 1)]
ans = min(ans, abs(le - ri))
ans2 = min(ans2, abs(le2 - ri2))
# print(ans,ans... | false | 0 | [
"-le, ri = 0, sum(l)",
"-ans = 10**10",
"-for i in range(len(l) - 1):",
"+le, ri, le2, ri2 = 0, sum(l), sum(l), 0",
"+ans, ans2 = 10**10, 10**10",
"+for i in range(len(l) // 2):",
"- if ans < min(ans, abs(le - ri)):",
"- print(ans)",
"- break",
"- else:",
"- ans = min(... | false | 0.047477 | 0.047526 | 0.998967 | [
"s618840857",
"s660690702"
] |
u047796752 | p02694 | python | s240561239 | s261502797 | 75 | 60 | 68,156 | 62,872 | Accepted | Accepted | 20 | import sys
input = sys.stdin.readline
from collections import *
X = int(eval(input()))
now = 100
ans = 0
while now<X:
now = int(1.01*now)
ans += 1
print(ans) | X = int(eval(input()))
now = 100
ans = 0
while now<X:
now += now//100
ans += 1
print(ans) | 13 | 9 | 174 | 101 | import sys
input = sys.stdin.readline
from collections import *
X = int(eval(input()))
now = 100
ans = 0
while now < X:
now = int(1.01 * now)
ans += 1
print(ans)
| X = int(eval(input()))
now = 100
ans = 0
while now < X:
now += now // 100
ans += 1
print(ans)
| false | 30.769231 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-from collections import *",
"-",
"- now = int(1.01 * now)",
"+ now += now // 100"
] | false | 0.096693 | 0.041877 | 2.308973 | [
"s240561239",
"s261502797"
] |
u787988531 | p03557 | python | s059807891 | s852399276 | 590 | 524 | 57,144 | 42,388 | Accepted | Accepted | 11.19 |
N = int(input())
As = [(int(i), 2) for i in input().split(" ")]
Bs = [(int(i), 1) for i in input().split(" ")]
Cs = [(int(i), 0) for i in input().split(" ")]
l = sorted(As + Bs + Cs, key=lambda x: x[0] + x[1] * 0.1)
ac = 0
bc = 0
cc = 0
for i in l:
if i[1] == 2:
ac += 1
elif i[1] ==... |
N = int(input())
As = [(int(i), 2) for i in input().split(" ")]
Bs = [(int(i), 1) for i in input().split(" ")]
Cs = [(int(i), 0) for i in input().split(" ")]
l = sorted(As + Bs + Cs)
ac = 0
bc = 0
cc = 0
for i in l:
if i[1] == 2:
ac += 1
elif i[1] == 1:
bc += ac
elif i... | 21 | 21 | 406 | 373 | N = int(input())
As = [(int(i), 2) for i in input().split(" ")]
Bs = [(int(i), 1) for i in input().split(" ")]
Cs = [(int(i), 0) for i in input().split(" ")]
l = sorted(As + Bs + Cs, key=lambda x: x[0] + x[1] * 0.1)
ac = 0
bc = 0
cc = 0
for i in l:
if i[1] == 2:
ac += 1
elif i[1] == 1:
bc += ac
... | N = int(input())
As = [(int(i), 2) for i in input().split(" ")]
Bs = [(int(i), 1) for i in input().split(" ")]
Cs = [(int(i), 0) for i in input().split(" ")]
l = sorted(As + Bs + Cs)
ac = 0
bc = 0
cc = 0
for i in l:
if i[1] == 2:
ac += 1
elif i[1] == 1:
bc += ac
elif i[1] == 0:
cc +=... | false | 0 | [
"-l = sorted(As + Bs + Cs, key=lambda x: x[0] + x[1] * 0.1)",
"+l = sorted(As + Bs + Cs)"
] | false | 0.04043 | 0.045607 | 0.886492 | [
"s059807891",
"s852399276"
] |
u200887663 | p02958 | python | s225828244 | s528211623 | 115 | 27 | 3,444 | 3,064 | Accepted | Accepted | 76.52 | import copy
n=int(eval(input()))
numl=list(map(int,input().split()))
chk=sorted(numl)
flag=True
if chk==numl :
flag=True
else :
flag=False
for i in range(n) :
#print(i)
for j in range(n):
#print(j)
temp=copy.deepcopy(numl)
temp[i]=numl[j]
temp[j]=numl[i]
#print(temp)
... | n=int(eval(input()))
#a,b=map(int,input().split())
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
#sortedl=sorted(pl)
flag=False
if pl==sorted(pl):
flag=True
else:
for i in range(n):
for j in range(n):
templ=pl[:]
templ[i]=pl[j... | 33 | 21 | 432 | 482 | import copy
n = int(eval(input()))
numl = list(map(int, input().split()))
chk = sorted(numl)
flag = True
if chk == numl:
flag = True
else:
flag = False
for i in range(n):
# print(i)
for j in range(n):
# print(j)
temp = copy.deepcopy(numl)
temp[i] = numl[j]
temp[j] = numl... | n = int(eval(input()))
# a,b=map(int,input().split())
pl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
# sortedl=sorted(pl)
flag = False
if pl == sorted(pl):
flag = True
else:
for i in range(n):
for j in range(n):
templ = pl[:]
templ[i] ... | false | 36.363636 | [
"-import copy",
"-",
"-numl = list(map(int, input().split()))",
"-chk = sorted(numl)",
"-flag = True",
"-if chk == numl:",
"+# a,b=map(int,input().split())",
"+pl = list(map(int, input().split()))",
"+# l=[list(map(int,input().split())) for i in range(n)]",
"+# sortedl=sorted(pl)",
"+flag = Fals... | false | 0.048775 | 0.04189 | 1.164357 | [
"s225828244",
"s528211623"
] |
u057109575 | p02990 | python | s465115421 | s594114423 | 1,014 | 87 | 42,864 | 75,996 | Accepted | Accepted | 91.42 | MOD = 10 ** 9 + 7
N, K = list(map(int, input().split()))
def comb(n, k):
ret = 1
for i in range(1, k + 1):
ret = ret * (n - i + 1) % MOD
ret = ret * pow(i, MOD - 2, MOD) % MOD
return ret
for i in range(1, K + 1):
n = i - 1 + 2
k = N - K - (i - 1)
if k < 0:
... | N, K = list(map(int, input().split()))
MAX = 10 ** 5 + 1
MOD = 10 ** 9 + 7
# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1
for i in range(2, MAX + 1):
fac[i] = fac[i - 1] * i % MOD
# Inverse factorial
finv = [0] * (MAX + 1)
finv[MAX] = pow(fac[MAX], MOD - 2, MOD)
for i in reversed(list... | 19 | 26 | 426 | 570 | MOD = 10**9 + 7
N, K = list(map(int, input().split()))
def comb(n, k):
ret = 1
for i in range(1, k + 1):
ret = ret * (n - i + 1) % MOD
ret = ret * pow(i, MOD - 2, MOD) % MOD
return ret
for i in range(1, K + 1):
n = i - 1 + 2
k = N - K - (i - 1)
if k < 0:
print((0))
... | N, K = list(map(int, input().split()))
MAX = 10**5 + 1
MOD = 10**9 + 7
# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1
for i in range(2, MAX + 1):
fac[i] = fac[i - 1] * i % MOD
# Inverse factorial
finv = [0] * (MAX + 1)
finv[MAX] = pow(fac[MAX], MOD - 2, MOD)
for i in reversed(list(range(1, MAX + 1))):
... | false | 26.923077 | [
"+N, K = list(map(int, input().split()))",
"+MAX = 10**5 + 1",
"-N, K = list(map(int, input().split()))",
"+# Factorial",
"+fac = [0] * (MAX + 1)",
"+fac[0] = 1",
"+fac[1] = 1",
"+for i in range(2, MAX + 1):",
"+ fac[i] = fac[i - 1] * i % MOD",
"+# Inverse factorial",
"+finv = [0] * (MAX + 1)... | false | 0.077148 | 0.123529 | 0.62453 | [
"s465115421",
"s594114423"
] |
u353919145 | p02659 | python | s703321821 | s177496716 | 29 | 26 | 9,116 | 9,156 | Accepted | Accepted | 10.34 | A, B = list(map(str, input().split())) # take the input in one line
A = int(A) # convert A into integer
C = B[0]+B[2]+B[3]
C = int(C)
print((A*C//100)) # printing the output
# time complixity O(1) | import math
if __name__ == "__main__":
a, b = input().split()
print((int(a)*int(b.replace('.', ''))//100)) | 7 | 5 | 195 | 117 | A, B = list(map(str, input().split())) # take the input in one line
A = int(A) # convert A into integer
C = B[0] + B[2] + B[3]
C = int(C)
print((A * C // 100)) # printing the output
# time complixity O(1)
| import math
if __name__ == "__main__":
a, b = input().split()
print((int(a) * int(b.replace(".", "")) // 100))
| false | 28.571429 | [
"-A, B = list(map(str, input().split())) # take the input in one line",
"-A = int(A) # convert A into integer",
"-C = B[0] + B[2] + B[3]",
"-C = int(C)",
"-print((A * C // 100)) # printing the output",
"-# time complixity O(1)",
"+import math",
"+",
"+if __name__ == \"__main__\":",
"+ a, b =... | false | 0.047595 | 0.117824 | 0.403954 | [
"s703321821",
"s177496716"
] |
u644907318 | p02733 | python | s729979838 | s739484876 | 653 | 200 | 53,852 | 74,944 | Accepted | Accepted | 69.37 | from itertools import product
INFTY = 10**4
H,W,K = list(map(int,input().split()))
S = [list(map(int,list(eval(input())))) for _ in range(H)]
cmin = INFTY
for x in product((0,1),repeat=H-1):
cur = 0
cnt = 0
h = sum(x)+1
A = [0 for _ in range(h)]
for j in range(W):
ind = 0
... | from itertools import product
H,W,K = list(map(int,input().split()))
S = [input().strip() for _ in range(H)]
C = {i:[0 for _ in range(W+1)] for i in range(H)}
for i in range(H):
for j in range(1,W+1):
C[i][j] = C[i][j-1]+int(S[i][j-1])
cmin = (H-1)*(W-1)
for x in product((0,1),repeat=H-1):
A = ... | 31 | 40 | 809 | 1,067 | from itertools import product
INFTY = 10**4
H, W, K = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for _ in range(H)]
cmin = INFTY
for x in product((0, 1), repeat=H - 1):
cur = 0
cnt = 0
h = sum(x) + 1
A = [0 for _ in range(h)]
for j in range(W):
ind = 0
... | from itertools import product
H, W, K = list(map(int, input().split()))
S = [input().strip() for _ in range(H)]
C = {i: [0 for _ in range(W + 1)] for i in range(H)}
for i in range(H):
for j in range(1, W + 1):
C[i][j] = C[i][j - 1] + int(S[i][j - 1])
cmin = (H - 1) * (W - 1)
for x in product((0, 1), repeat... | false | 22.5 | [
"-INFTY = 10**4",
"-S = [list(map(int, list(eval(input())))) for _ in range(H)]",
"-cmin = INFTY",
"+S = [input().strip() for _ in range(H)]",
"+C = {i: [0 for _ in range(W + 1)] for i in range(H)}",
"+for i in range(H):",
"+ for j in range(1, W + 1):",
"+ C[i][j] = C[i][j - 1] + int(S[i][j ... | false | 0.033825 | 0.041653 | 0.81207 | [
"s729979838",
"s739484876"
] |
u596276291 | p03862 | python | s523971868 | s758817576 | 106 | 96 | 14,516 | 14,508 | Accepted | Accepted | 9.43 | from collections import defaultdict
def main():
N, x = list(map(int, input().split()))
a_list = list(map(int, input().split()))
ans = 0
for i in range(len(a_list)):
d = max(0, a_list[i] - x)
a_list[i] -= d
ans += d
for i in range(1, len(a_list)):
total... | from collections import defaultdict
def main():
N, x = list(map(int, input().split()))
a_list = list(map(int, input().split()))
pre_total = sum(a_list)
a_list = [min(a, x) for a in a_list]
for i in range(1, len(a_list)):
t = a_list[i - 1] + a_list[i]
a_list[i] -= max(... | 24 | 19 | 505 | 406 | from collections import defaultdict
def main():
N, x = list(map(int, input().split()))
a_list = list(map(int, input().split()))
ans = 0
for i in range(len(a_list)):
d = max(0, a_list[i] - x)
a_list[i] -= d
ans += d
for i in range(1, len(a_list)):
total = a_list[i - ... | from collections import defaultdict
def main():
N, x = list(map(int, input().split()))
a_list = list(map(int, input().split()))
pre_total = sum(a_list)
a_list = [min(a, x) for a in a_list]
for i in range(1, len(a_list)):
t = a_list[i - 1] + a_list[i]
a_list[i] -= max(0, t - x)
... | false | 20.833333 | [
"- ans = 0",
"- for i in range(len(a_list)):",
"- d = max(0, a_list[i] - x)",
"- a_list[i] -= d",
"- ans += d",
"+ pre_total = sum(a_list)",
"+ a_list = [min(a, x) for a in a_list]",
"- total = a_list[i - 1] + a_list[i]",
"- if total > x:",
"- ... | false | 0.040543 | 0.040474 | 1.00171 | [
"s523971868",
"s758817576"
] |
u729133443 | p03425 | python | s626453637 | s478244276 | 191 | 43 | 66,388 | 10,864 | Accepted | Accepted | 77.49 | d={t:0for t in'MARCH'};a=0
for t in open(0).read().split():
if t[0]in d:d[t[0]]+=1
for i in range(32):
c=t=1
for j,l in enumerate(d.values()):
if i>>j&1:t*=l;c+=1
a+=t*(c==4)
print(a) | from itertools import*;o=ord;d=[0]*128
for t in open(0).read().split():d[o(t[0])]+=1
print((sum(d[o(p)]*d[o(q)]*d[o(r)]for p,q,r in combinations('MARCH',3)))) | 9 | 3 | 197 | 158 | d = {t: 0 for t in "MARCH"}
a = 0
for t in open(0).read().split():
if t[0] in d:
d[t[0]] += 1
for i in range(32):
c = t = 1
for j, l in enumerate(d.values()):
if i >> j & 1:
t *= l
c += 1
a += t * (c == 4)
print(a)
| from itertools import *
o = ord
d = [0] * 128
for t in open(0).read().split():
d[o(t[0])] += 1
print((sum(d[o(p)] * d[o(q)] * d[o(r)] for p, q, r in combinations("MARCH", 3))))
| false | 66.666667 | [
"-d = {t: 0 for t in \"MARCH\"}",
"-a = 0",
"+from itertools import *",
"+",
"+o = ord",
"+d = [0] * 128",
"- if t[0] in d:",
"- d[t[0]] += 1",
"-for i in range(32):",
"- c = t = 1",
"- for j, l in enumerate(d.values()):",
"- if i >> j & 1:",
"- t *= l",
"... | false | 0.045396 | 0.035621 | 1.274405 | [
"s626453637",
"s478244276"
] |
u111202730 | p03369 | python | s463558674 | s230762675 | 172 | 19 | 38,256 | 3,060 | Accepted | Accepted | 88.95 | #注文の文字列をもらう
S = eval(input())
#oの数を数える
num = S.count("o")
#ラーメン代を計算
price = 700 + 100*num
#表示
print(price) | S = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] == "o":
cnt += 1
print((700 + 100*cnt)) | 8 | 6 | 107 | 106 | # 注文の文字列をもらう
S = eval(input())
# oの数を数える
num = S.count("o")
# ラーメン代を計算
price = 700 + 100 * num
# 表示
print(price)
| S = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] == "o":
cnt += 1
print((700 + 100 * cnt))
| false | 25 | [
"-# 注文の文字列をもらう",
"-# oの数を数える",
"-num = S.count(\"o\")",
"-# ラーメン代を計算",
"-price = 700 + 100 * num",
"-# 表示",
"-print(price)",
"+cnt = 0",
"+for i in range(len(S)):",
"+ if S[i] == \"o\":",
"+ cnt += 1",
"+print((700 + 100 * cnt))"
] | false | 0.076933 | 0.036394 | 2.113883 | [
"s463558674",
"s230762675"
] |
u548624367 | p03261 | python | s713198146 | s239311809 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | print(("No" if (lambda w:(sum([w.count(s)-1 for s in w])) or sum([1-(w[i][0] == w[i-1][-1]) for i in range(1,len(w))]))([eval(input()) for i in range(int(eval(input())))]) else "Yes")) | print(("No" if (lambda w:(sum([w.count(s)-1 for s in w])) or sum([w[i][0] != w[i-1][-1] for i in range(1,len(w))]))([eval(input()) for i in range(int(eval(input())))]) else "Yes")) | 1 | 1 | 170 | 166 | print(
(
"No"
if (
lambda w: (sum([w.count(s) - 1 for s in w]))
or sum([1 - (w[i][0] == w[i - 1][-1]) for i in range(1, len(w))])
)([eval(input()) for i in range(int(eval(input())))])
else "Yes"
)
)
| print(
(
"No"
if (
lambda w: (sum([w.count(s) - 1 for s in w]))
or sum([w[i][0] != w[i - 1][-1] for i in range(1, len(w))])
)([eval(input()) for i in range(int(eval(input())))])
else "Yes"
)
)
| false | 0 | [
"- or sum([1 - (w[i][0] == w[i - 1][-1]) for i in range(1, len(w))])",
"+ or sum([w[i][0] != w[i - 1][-1] for i in range(1, len(w))])"
] | false | 0.07025 | 0.052958 | 1.326506 | [
"s713198146",
"s239311809"
] |
u280552586 | p02683 | python | s233732683 | s844506604 | 83 | 76 | 9,216 | 9,224 | Accepted | Accepted | 8.43 | n, m, x = list(map(int, input().split()))
ca = []
for i in range(n):
l = list(map(int, input().split()))
ca.append(l)
INF = 10**18
ans = INF
for i in range(2**n):
ls = [0]*m
money = 0
for j in range(n):
if (i >> j & 1):
for k in range(m):
ls[k] += c... | from itertools import product
n, m, x = list(map(int, input().split()))
ca = [tuple(map(int, input().split())) for _ in range(n)]
INF = 10**18
ans = INF
for i in product([0, 1], repeat=n):
cost = 0
smart = [0]*m
for j in range(n):
if i[j] == 0:
continue
c, *a = ca[j]
... | 23 | 20 | 454 | 493 | n, m, x = list(map(int, input().split()))
ca = []
for i in range(n):
l = list(map(int, input().split()))
ca.append(l)
INF = 10**18
ans = INF
for i in range(2**n):
ls = [0] * m
money = 0
for j in range(n):
if i >> j & 1:
for k in range(m):
ls[k] += ca[j][k + 1]
... | from itertools import product
n, m, x = list(map(int, input().split()))
ca = [tuple(map(int, input().split())) for _ in range(n)]
INF = 10**18
ans = INF
for i in product([0, 1], repeat=n):
cost = 0
smart = [0] * m
for j in range(n):
if i[j] == 0:
continue
c, *a = ca[j]
c... | false | 13.043478 | [
"+from itertools import product",
"+",
"-ca = []",
"-for i in range(n):",
"- l = list(map(int, input().split()))",
"- ca.append(l)",
"+ca = [tuple(map(int, input().split())) for _ in range(n)]",
"-for i in range(2**n):",
"- ls = [0] * m",
"- money = 0",
"+for i in product([0, 1], rep... | false | 0.052339 | 0.041458 | 1.262444 | [
"s233732683",
"s844506604"
] |
u645250356 | p02762 | python | s232807573 | s089480494 | 1,247 | 762 | 131,672 | 144,164 | Accepted | Accepted | 38.89 | from collections import Counter,defaultdict,deque
from bisect import bisect_left
import sys,math,itertools,pprint,fractions
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()))
class UnionFind(... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 77 | 81 | 1,916 | 2,003 | from collections import Counter, defaultdict, deque
from bisect import bisect_left
import sys, math, itertools, pprint, fractions
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()))
cla... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 4.938272 | [
"-from bisect import bisect_left",
"-import sys, math, itertools, pprint, fractions",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"- # 根を返す",
"+ def all_group_members(self):",
"+ return {r: sel... | false | 0.110777 | 0.139201 | 0.795807 | [
"s232807573",
"s089480494"
] |
u722535636 | p02975 | python | s906455298 | s599340215 | 356 | 226 | 74,228 | 61,556 | Accepted | Accepted | 36.52 | N=int(eval(input()))
a=list(map(int,input().split()))
L=[str(bin(i))[2:] for i in a]
dic=dict([(i,0) for i in range(32)])
for s in L:
for i,c in enumerate(s[::-1]):
if c=='1':
dic[i]+=1
for i in list(dic.values()):
if i%2==1:
print("No")
exit(0)
else:
print("... | N=int(eval(input()))
A=list(map(int,input().split()))
sA=set(A)
flg=0
if all([x==0 for x in A]):
flg=1
elif len(sA)==2 and N%3==0:
a,b=[A.count(x) for x in sA]
if min(a,b)==N//3 and max(a,b)==N//3*2:
flg=1
elif len(sA)==3 and N%3==0:
a,b,c=[x for x in sA]
if a^b^c==0 and all([... | 15 | 16 | 316 | 395 | N = int(eval(input()))
a = list(map(int, input().split()))
L = [str(bin(i))[2:] for i in a]
dic = dict([(i, 0) for i in range(32)])
for s in L:
for i, c in enumerate(s[::-1]):
if c == "1":
dic[i] += 1
for i in list(dic.values()):
if i % 2 == 1:
print("No")
exit(0)
else:
p... | N = int(eval(input()))
A = list(map(int, input().split()))
sA = set(A)
flg = 0
if all([x == 0 for x in A]):
flg = 1
elif len(sA) == 2 and N % 3 == 0:
a, b = [A.count(x) for x in sA]
if min(a, b) == N // 3 and max(a, b) == N // 3 * 2:
flg = 1
elif len(sA) == 3 and N % 3 == 0:
a, b, c = [x for x i... | false | 6.25 | [
"-a = list(map(int, input().split()))",
"-L = [str(bin(i))[2:] for i in a]",
"-dic = dict([(i, 0) for i in range(32)])",
"-for s in L:",
"- for i, c in enumerate(s[::-1]):",
"- if c == \"1\":",
"- dic[i] += 1",
"-for i in list(dic.values()):",
"- if i % 2 == 1:",
"- ... | false | 0.042497 | 0.035776 | 1.187883 | [
"s906455298",
"s599340215"
] |
u774539708 | p02838 | python | s159039943 | s180397021 | 1,023 | 336 | 122,808 | 48,824 | Accepted | Accepted | 67.16 | #XORはビットごとに独立しているので各ビットで0*1の演算回数を数える
n=int(eval(input()))
A=list(map(int,input().split()))
B=[0]*62 #1の個数カウント
mod=10**9+7
for i in range(n):
a=bin(A[i])
for j in range(len(a)-2):
if a[-j-1]=="1":
B[-j-1]+=1
ans=0
cnt=1 #2の累乗管理
for b in range(len(B)):
prd=B[-b-1]*(n-B[-b-... | import numpy as np
n=int(eval(input()))
A=np.array(list(map(int,input().split())))
mod=10**9+7
ans=0
for i in range(62):
cnt=np.count_nonzero(A&1) #1とのANDで一番右の桁を抽出
ans+=cnt*(n-cnt)*(2**i)%mod
ans%=mod
A=A>>1 #ビットシフト
print(ans) | 21 | 13 | 391 | 250 | # XORはビットごとに独立しているので各ビットで0*1の演算回数を数える
n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * 62 # 1の個数カウント
mod = 10**9 + 7
for i in range(n):
a = bin(A[i])
for j in range(len(a) - 2):
if a[-j - 1] == "1":
B[-j - 1] += 1
ans = 0
cnt = 1 # 2の累乗管理
for b in range(len(B)):
prd... | import numpy as np
n = int(eval(input()))
A = np.array(list(map(int, input().split())))
mod = 10**9 + 7
ans = 0
for i in range(62):
cnt = np.count_nonzero(A & 1) # 1とのANDで一番右の桁を抽出
ans += cnt * (n - cnt) * (2**i) % mod
ans %= mod
A = A >> 1 # ビットシフト
print(ans)
| false | 38.095238 | [
"-# XORはビットごとに独立しているので各ビットで0*1の演算回数を数える",
"+import numpy as np",
"+",
"-A = list(map(int, input().split()))",
"-B = [0] * 62 # 1の個数カウント",
"+A = np.array(list(map(int, input().split())))",
"-for i in range(n):",
"- a = bin(A[i])",
"- for j in range(len(a) - 2):",
"- if a[-j - 1] == \"... | false | 0.036536 | 0.192774 | 0.189527 | [
"s159039943",
"s180397021"
] |
u525589885 | p02675 | python | s336704323 | s909561949 | 26 | 20 | 9,168 | 9,180 | Accepted | Accepted | 23.08 | n = int(eval(input()))
a = n % 10
if a == 3:
print('bon')
elif a == 0 or a==1 or a==6 or a==8:
print('pon')
else:
print('hon') | n = int(eval(input()))
a = n % 10
if a == 2 or a == 4 or a == 5 or a == 7 or a == 9:
print('hon')
if a== 0 or a== 1 or a== 6 or a== 8:
print('pon')
if a == 3:
print('bon')
| 8 | 8 | 133 | 179 | n = int(eval(input()))
a = n % 10
if a == 3:
print("bon")
elif a == 0 or a == 1 or a == 6 or a == 8:
print("pon")
else:
print("hon")
| n = int(eval(input()))
a = n % 10
if a == 2 or a == 4 or a == 5 or a == 7 or a == 9:
print("hon")
if a == 0 or a == 1 or a == 6 or a == 8:
print("pon")
if a == 3:
print("bon")
| false | 0 | [
"+if a == 2 or a == 4 or a == 5 or a == 7 or a == 9:",
"+ print(\"hon\")",
"+if a == 0 or a == 1 or a == 6 or a == 8:",
"+ print(\"pon\")",
"-elif a == 0 or a == 1 or a == 6 or a == 8:",
"- print(\"pon\")",
"-else:",
"- print(\"hon\")"
] | false | 0.10736 | 0.042584 | 2.521133 | [
"s336704323",
"s909561949"
] |
u038021590 | p03163 | python | s406553550 | s290620201 | 475 | 191 | 120,172 | 146,352 | Accepted | Accepted | 59.79 | N, W = list(map(int, input().split()))
Weight = [0]
Value = [0]
for i in range(N):
w, v = list(map(int, input().split()))
Weight.append(w)
Value.append(v)
DP = [[0]*(W+1) for i in range(N+1)]
for n in range(1, N + 1):
for wei in range(W+1):
if Weight[n] > wei:
DP[n][we... | N, W = list(map(int, input().split()))
Items = [tuple(map(int, input().split())) for _ in range(N)]
DP = [-1] * (W + 1)
DP[0] = 0
for w, v in Items:
D = DP[:]
for i, d in enumerate(DP):
if d < 0:
continue
if i + w > W:
break
D[i + w] = max(D[i + w], d... | 17 | 15 | 438 | 347 | N, W = list(map(int, input().split()))
Weight = [0]
Value = [0]
for i in range(N):
w, v = list(map(int, input().split()))
Weight.append(w)
Value.append(v)
DP = [[0] * (W + 1) for i in range(N + 1)]
for n in range(1, N + 1):
for wei in range(W + 1):
if Weight[n] > wei:
DP[n][wei] = DP... | N, W = list(map(int, input().split()))
Items = [tuple(map(int, input().split())) for _ in range(N)]
DP = [-1] * (W + 1)
DP[0] = 0
for w, v in Items:
D = DP[:]
for i, d in enumerate(DP):
if d < 0:
continue
if i + w > W:
break
D[i + w] = max(D[i + w], d + v)
DP ... | false | 11.764706 | [
"-Weight = [0]",
"-Value = [0]",
"-for i in range(N):",
"- w, v = list(map(int, input().split()))",
"- Weight.append(w)",
"- Value.append(v)",
"-DP = [[0] * (W + 1) for i in range(N + 1)]",
"-for n in range(1, N + 1):",
"- for wei in range(W + 1):",
"- if Weight[n] > wei:",
"-... | false | 0.041802 | 0.038469 | 1.086658 | [
"s406553550",
"s290620201"
] |
u017810624 | p03017 | python | s799678187 | s796975619 | 68 | 58 | 4,916 | 3,572 | Accepted | Accepted | 14.71 | n,a,b,c,d=list(map(int,input().split()))
s=list(eval(input()))
f=0
for i in range(b,d-1):
if s[i]=='#' and s[i+1]=='#':
f=1
break
for i in range(a,c-1):
if s[i]=='#' and s[i+1]=='#':
f=1
break
if c>d:
F=0
for i in range(b-2,d-1):
if s[i]=='.' and s[i+1]=='.' and s[i+2]=='.':
... | n,a,b,c,d=list(map(int,input().split()))
s=eval(input())
f=0;F=0
for i in range(a,max(c,d)-1):
if s[i]=='#' and s[i+1]=='#':
f=1
if c>d:
for i in range(b-2,d-1):
if s[i]=='.' and s[i+1]=='.' and s[i+2]=='.':
F=1
if F==0:
f=1
if f==1:print('No')
else:print('Yes') | 21 | 14 | 390 | 287 | n, a, b, c, d = list(map(int, input().split()))
s = list(eval(input()))
f = 0
for i in range(b, d - 1):
if s[i] == "#" and s[i + 1] == "#":
f = 1
break
for i in range(a, c - 1):
if s[i] == "#" and s[i + 1] == "#":
f = 1
break
if c > d:
F = 0
for i in range(b - 2, d - 1):
... | n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
f = 0
F = 0
for i in range(a, max(c, d) - 1):
if s[i] == "#" and s[i + 1] == "#":
f = 1
if c > d:
for i in range(b - 2, d - 1):
if s[i] == "." and s[i + 1] == "." and s[i + 2] == ".":
F = 1
if F == 0:
f = 1... | false | 33.333333 | [
"-s = list(eval(input()))",
"+s = eval(input())",
"-for i in range(b, d - 1):",
"+F = 0",
"+for i in range(a, max(c, d) - 1):",
"- break",
"-for i in range(a, c - 1):",
"- if s[i] == \"#\" and s[i + 1] == \"#\":",
"- f = 1",
"- break",
"- F = 0",
"- break"... | false | 0.040006 | 0.083609 | 0.478486 | [
"s799678187",
"s796975619"
] |
u749770850 | p02971 | python | s854867980 | s545468831 | 906 | 598 | 68,540 | 14,160 | Accepted | Accepted | 34 | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
max1 = max(a)
max2 = sorted(a)[-2]
if a.count(max1) >= 2:
for i in range(n):
print(max1)
elif a.count(max1) == 1:
for i in range(n):
if a[i] == max1:
print(max2)
else:
... | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
a2 = []
a2 = a.copy()
a2.sort()
mx = max(a)
mx2 = list(reversed(a2))[1]
mc = a.count(mx)
if mc > 1:
for i in range(n):
print(mx)
else:
for i in range(n):
if a[i] == mx:
print(mx2)
else:
... | 17 | 25 | 323 | 322 | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
max1 = max(a)
max2 = sorted(a)[-2]
if a.count(max1) >= 2:
for i in range(n):
print(max1)
elif a.count(max1) == 1:
for i in range(n):
if a[i] == max1:
print(max2)
else:
print(max1)
| n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
a2 = []
a2 = a.copy()
a2.sort()
mx = max(a)
mx2 = list(reversed(a2))[1]
mc = a.count(mx)
if mc > 1:
for i in range(n):
print(mx)
else:
for i in range(n):
if a[i] == mx:
print(mx2)
else:
... | false | 32 | [
"-max1 = max(a)",
"-max2 = sorted(a)[-2]",
"-if a.count(max1) >= 2:",
"+a2 = []",
"+a2 = a.copy()",
"+a2.sort()",
"+mx = max(a)",
"+mx2 = list(reversed(a2))[1]",
"+mc = a.count(mx)",
"+if mc > 1:",
"- print(max1)",
"-elif a.count(max1) == 1:",
"+ print(mx)",
"+else:",
"- ... | false | 0.09874 | 0.043451 | 2.272455 | [
"s854867980",
"s545468831"
] |
u102461423 | p04034 | python | s969889906 | s910636477 | 200 | 113 | 24,252 | 15,608 | Accepted | Accepted | 43.5 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N,M = list(map(int,input().split()))
XY = [[int(x) for x in input().split()] for _ in range(M)]
# 各時点でのボールの合計個数、赤の最大個数(0 or 1)を持つ
ball = [None] + [1] * N
red = [None] + [1] + [0] * (N-1)
for x,y in XY:
if red[x] == 0:
# 必... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M = list(map(int,readline().split()))
m = list(map(int,read().split()))
XY = list(zip(m,m))
red = [0] + [1] + [0] * (N-1)
ball = [0] + [1] * N
for x,y in XY:
if red[x]:
red[... | 38 | 21 | 725 | 417 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
XY = [[int(x) for x in input().split()] for _ in range(M)]
# 各時点でのボールの合計個数、赤の最大個数(0 or 1)を持つ
ball = [None] + [1] * N
red = [None] + [1] + [0] * (N - 1)
for x, y in XY:
if red[x] == 0:
# 必ず白をうつす
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
m = list(map(int, read().split()))
XY = list(zip(m, m))
red = [0] + [1] + [0] * (N - 1)
ball = [0] + [1] * N
for x, y in XY:
if red[x]:
red[y] = 1
... | false | 44.736842 | [
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-N, M = list(map(int, input().split()))",
"-XY = [[int(x) for x in input().split()] for _ in range(M)]",
"-# 各時点でのボールの合計個数、赤の最大個数(0 or 1)を持つ",
"-ball = [None] + [1] * N",
"-red = [None] + [1] + [0] * (N - 1)",
"+read = sys.stdin.buffer.r... | false | 0.041578 | 0.036519 | 1.138517 | [
"s969889906",
"s910636477"
] |
u671060652 | p03062 | python | s590699626 | s270922307 | 331 | 115 | 90,780 | 90,732 | Accepted | Accepted | 65.26 | import itertools
import math
import fractions
import functools
import copy
n = int(eval(input()))
a = list(map(int, input().split()))
pm = [0,0]
for i in range(n):
if a[i] == 0:
print((sum(list(map(abs,a)))))
quit()
elif a[i] > 0:
pm[0] += 1
else:
pm[1] +... | import math
def main():
n = int(eval(input()))
# a, b, t = map(int, input().split())
# h = list(map(int, input().split()))
# s = input()
# h = [int(input()) for _ in rane(n)]
a = list(map(int, input().split()))
abs_a = []
minus = 0
for ai in a:
if ai < 0:
... | 23 | 27 | 438 | 537 | import itertools
import math
import fractions
import functools
import copy
n = int(eval(input()))
a = list(map(int, input().split()))
pm = [0, 0]
for i in range(n):
if a[i] == 0:
print((sum(list(map(abs, a)))))
quit()
elif a[i] > 0:
pm[0] += 1
else:
pm[1] += 1
if pm[1] % 2 !... | import math
def main():
n = int(eval(input()))
# a, b, t = map(int, input().split())
# h = list(map(int, input().split()))
# s = input()
# h = [int(input()) for _ in rane(n)]
a = list(map(int, input().split()))
abs_a = []
minus = 0
for ai in a:
if ai < 0:
minus ... | false | 14.814815 | [
"-import itertools",
"-import fractions",
"-import functools",
"-import copy",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-pm = [0, 0]",
"-for i in range(n):",
"- if a[i] == 0:",
"- print((sum(list(map(abs, a)))))",
"- quit()",
"- elif a[i] > 0:",
... | false | 0.037625 | 0.04598 | 0.818296 | [
"s590699626",
"s270922307"
] |
u905203728 | p02726 | python | s374613905 | s314822318 | 1,904 | 531 | 131,972 | 50,524 | Accepted | Accepted | 72.11 | import heapq
def dijkstra(s):
color=["white" for _ in range(n)]
D=[inf for _ in range(n)]
M=[[] for _ in range(n)]
for i in range(n-1):
M[i].append((1,i+1))
M[i+1].append((1,i))
M[x-1].append((1,y-1))
M[y-1].append((1,x-1))
D[s]=0
H=[(0,s)]
heapq... | import sys
from collections import deque
sys.setrecursionlimit(10**7)
inf=10**7
def BFS(s):
color=["white" for _ in range(n)]
D=[inf for _ in range(n)]
color[s-1]="gray"
D[s-1]=0
queue=deque([s-1])
while len(queue)!=0:
u=queue.popleft()
for i in M[u]:
... | 45 | 42 | 906 | 763 | import heapq
def dijkstra(s):
color = ["white" for _ in range(n)]
D = [inf for _ in range(n)]
M = [[] for _ in range(n)]
for i in range(n - 1):
M[i].append((1, i + 1))
M[i + 1].append((1, i))
M[x - 1].append((1, y - 1))
M[y - 1].append((1, x - 1))
D[s] = 0
H = [(0, s)]
... | import sys
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**7
def BFS(s):
color = ["white" for _ in range(n)]
D = [inf for _ in range(n)]
color[s - 1] = "gray"
D[s - 1] = 0
queue = deque([s - 1])
while len(queue) != 0:
u = queue.popleft()
for i in M[u]:
... | false | 6.666667 | [
"-import heapq",
"+import sys",
"+from collections import deque",
"+",
"+sys.setrecursionlimit(10**7)",
"+inf = 10**7",
"-def dijkstra(s):",
"+def BFS(s):",
"- M = [[] for _ in range(n)]",
"- for i in range(n - 1):",
"- M[i].append((1, i + 1))",
"- M[i + 1].append((1, i))",... | false | 0.043318 | 0.034105 | 1.270139 | [
"s374613905",
"s314822318"
] |
u064408584 | p03745 | python | s920949370 | s979452810 | 91 | 80 | 14,252 | 14,252 | Accepted | Accepted | 12.09 | n=int(eval(input()))
a=list(map(int, input().split()))
ans,c,d=0,1,True
while c<n:
if a[c]==a[c-1]:
c+=1
continue
if d:
f=a[c]>a[c-1]
d=False
elif f:
if a[c]<a[c-1]:
ans+=1
d=True
else:
if a[c]>a[c-1]:
an... | n=int(eval(input()))
a=list(map(int, input().split()))
ans=1
d=0
for i in range(1,n):
diff=a[i]-a[i-1]
if d==0:
d=diff
elif d*diff<0:
d=0
ans+=1
print(ans) | 20 | 12 | 362 | 196 | n = int(eval(input()))
a = list(map(int, input().split()))
ans, c, d = 0, 1, True
while c < n:
if a[c] == a[c - 1]:
c += 1
continue
if d:
f = a[c] > a[c - 1]
d = False
elif f:
if a[c] < a[c - 1]:
ans += 1
d = True
else:
if a[c] > a[... | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
d = 0
for i in range(1, n):
diff = a[i] - a[i - 1]
if d == 0:
d = diff
elif d * diff < 0:
d = 0
ans += 1
print(ans)
| false | 40 | [
"-ans, c, d = 0, 1, True",
"-while c < n:",
"- if a[c] == a[c - 1]:",
"- c += 1",
"- continue",
"- if d:",
"- f = a[c] > a[c - 1]",
"- d = False",
"- elif f:",
"- if a[c] < a[c - 1]:",
"- ans += 1",
"- d = True",
"- else:",... | false | 0.037795 | 0.037918 | 0.996767 | [
"s920949370",
"s979452810"
] |
u472065247 | p03238 | python | s825505990 | s853982526 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | N = eval(input())
if N == '1':
print('Hello World')
else:
A = int(eval(input()))
B = int(eval(input()))
print((A + B)) | if eval(input()) == '1':
print('Hello World')
else:
print((int(eval(input())) + int(eval(input())))) | 7 | 4 | 120 | 91 | N = eval(input())
if N == "1":
print("Hello World")
else:
A = int(eval(input()))
B = int(eval(input()))
print((A + B))
| if eval(input()) == "1":
print("Hello World")
else:
print((int(eval(input())) + int(eval(input()))))
| false | 42.857143 | [
"-N = eval(input())",
"-if N == \"1\":",
"+if eval(input()) == \"1\":",
"- A = int(eval(input()))",
"- B = int(eval(input()))",
"- print((A + B))",
"+ print((int(eval(input())) + int(eval(input()))))"
] | false | 0.051175 | 0.062313 | 0.821251 | [
"s825505990",
"s853982526"
] |
u654470292 | p03584 | python | s323700775 | s269480583 | 1,595 | 528 | 88,996 | 84,776 | Accepted | Accepted | 66.9 | import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr... | 37 | 38 | 802 | 842 | import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
mod = pow(10, 9) + 7
al = [c... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
mod = pow(10, 9) + 7
al = [c... | false | 2.631579 | [
"+for i in range(len(klst)):",
"+ klst[i] = int(klst[i], 0)",
"- if a | int(i, 0) == int(i, 0):",
"+ if a | i == i:"
] | false | 0.044474 | 0.195147 | 0.227899 | [
"s323700775",
"s269480583"
] |
u624475441 | p03418 | python | s111795248 | s236362598 | 113 | 82 | 3,060 | 3,060 | Accepted | Accepted | 27.43 | N, K = list(map(int, input().split()))
ans = 0
for b in range(1, N + 1):
p, r = divmod(N, b)
ans += p * max(0, b - K) + max(0, r - K + 1)
if K == 0:
ans -= N
print(ans) | N, K = list(map(int, input().split()))
if K == 0:
print((N * N))
exit()
cnt = 0
for b in range(K + 1, N + 1):
p, r = divmod(N, b)
cnt += p * (b - K)
if r >= K:
cnt += r - K + 1
print(cnt) | 8 | 11 | 181 | 217 | N, K = list(map(int, input().split()))
ans = 0
for b in range(1, N + 1):
p, r = divmod(N, b)
ans += p * max(0, b - K) + max(0, r - K + 1)
if K == 0:
ans -= N
print(ans)
| N, K = list(map(int, input().split()))
if K == 0:
print((N * N))
exit()
cnt = 0
for b in range(K + 1, N + 1):
p, r = divmod(N, b)
cnt += p * (b - K)
if r >= K:
cnt += r - K + 1
print(cnt)
| false | 27.272727 | [
"-ans = 0",
"-for b in range(1, N + 1):",
"+if K == 0:",
"+ print((N * N))",
"+ exit()",
"+cnt = 0",
"+for b in range(K + 1, N + 1):",
"- ans += p * max(0, b - K) + max(0, r - K + 1)",
"-if K == 0:",
"- ans -= N",
"-print(ans)",
"+ cnt += p * (b - K)",
"+ if r >= K:",
"+ ... | false | 0.039939 | 0.03863 | 1.033906 | [
"s111795248",
"s236362598"
] |
u649202997 | p03073 | python | s690586021 | s720334224 | 42 | 18 | 3,188 | 3,188 | Accepted | Accepted | 57.14 | def main(n):
odd = "1"
even= "0"
if(n[0] =="0"):
# zero mode
odd = "0"
even= "1"
a = sum((((i % 2 != 0) and n[i] == odd)) for i in range(1, len(n),2))
b = sum((((i % 2 == 0) and n[i] == even)) for i in range(0, len(n),2))
return a+b
print((main(eval(input())))) | n=eval(input())
r=n[0::2].count("0")+n[1::2].count("1")
print((min(r,len(n)-r))) | 12 | 3 | 277 | 74 | def main(n):
odd = "1"
even = "0"
if n[0] == "0":
# zero mode
odd = "0"
even = "1"
a = sum((((i % 2 != 0) and n[i] == odd)) for i in range(1, len(n), 2))
b = sum((((i % 2 == 0) and n[i] == even)) for i in range(0, len(n), 2))
return a + b
print((main(eval(input()))))
| n = eval(input())
r = n[0::2].count("0") + n[1::2].count("1")
print((min(r, len(n) - r)))
| false | 75 | [
"-def main(n):",
"- odd = \"1\"",
"- even = \"0\"",
"- if n[0] == \"0\":",
"- # zero mode",
"- odd = \"0\"",
"- even = \"1\"",
"- a = sum((((i % 2 != 0) and n[i] == odd)) for i in range(1, len(n), 2))",
"- b = sum((((i % 2 == 0) and n[i] == even)) for i in range(0... | false | 0.043353 | 0.043396 | 0.999012 | [
"s690586021",
"s720334224"
] |
u562935282 | p03945 | python | s484988644 | s798016979 | 44 | 28 | 3,188 | 3,188 | Accepted | Accepted | 36.36 | s = eval(input())
c = s[0]
cnt = 0
for i in range(1, len(s)):
if s[i] != c:
cnt += 1
c = s[i]
print(cnt) | def main():
from itertools import tee
S = eval(input())
it1, it2 = tee(iter(S), 2)
next(it2)
ans = 0
for c1, c2 in zip(it1, it2):
if c1 != c2: ans += 1
print(ans)
if __name__ == '__main__':
main()
| 8 | 15 | 125 | 249 | s = eval(input())
c = s[0]
cnt = 0
for i in range(1, len(s)):
if s[i] != c:
cnt += 1
c = s[i]
print(cnt)
| def main():
from itertools import tee
S = eval(input())
it1, it2 = tee(iter(S), 2)
next(it2)
ans = 0
for c1, c2 in zip(it1, it2):
if c1 != c2:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 46.666667 | [
"-s = eval(input())",
"-c = s[0]",
"-cnt = 0",
"-for i in range(1, len(s)):",
"- if s[i] != c:",
"- cnt += 1",
"- c = s[i]",
"-print(cnt)",
"+def main():",
"+ from itertools import tee",
"+",
"+ S = eval(input())",
"+ it1, it2 = tee(iter(S), 2)",
"+ next(it2)",... | false | 0.036863 | 0.041189 | 0.894971 | [
"s484988644",
"s798016979"
] |
u019678978 | p02397 | python | s885576777 | s356572092 | 50 | 40 | 7,880 | 7,900 | Accepted | Accepted | 20 | import sys
while True :
ab = list(map(int,sys.stdin.readline().split()))
a = ab[0]
b = ab[1]
if a == 0 and b == 0 :
break
elif a > b :
print((b,a))
else :
print((a,b)) | import sys
while True :
ab = list(map(int,sys.stdin.readline().split()))
a = ab[0]
b = ab[1]
if a == 0 and b == 0 :
break
else :
ab = sorted(ab)
print((ab[0],ab[1])) | 11 | 10 | 221 | 216 | import sys
while True:
ab = list(map(int, sys.stdin.readline().split()))
a = ab[0]
b = ab[1]
if a == 0 and b == 0:
break
elif a > b:
print((b, a))
else:
print((a, b))
| import sys
while True:
ab = list(map(int, sys.stdin.readline().split()))
a = ab[0]
b = ab[1]
if a == 0 and b == 0:
break
else:
ab = sorted(ab)
print((ab[0], ab[1]))
| false | 9.090909 | [
"- elif a > b:",
"- print((b, a))",
"- print((a, b))",
"+ ab = sorted(ab)",
"+ print((ab[0], ab[1]))"
] | false | 0.036625 | 0.03669 | 0.998223 | [
"s885576777",
"s356572092"
] |
u968166680 | p02954 | python | s248470304 | s573925958 | 445 | 100 | 157,352 | 84,928 | Accepted | Accepted | 77.53 | 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():
S = readline().strip()
N = len(S)
A = list(range(N))
for _ in range(10):
for i, a in enumerate(A):
... | import sys
from itertools import groupby
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
N = len(S)
s = 0
ans = [0] * N
for k, g in groupby(S):
... | 39 | 33 | 717 | 616 | 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():
S = readline().strip()
N = len(S)
A = list(range(N))
for _ in range(10):
for i, a in enumerate(A):
if S[a] == "L":... | import sys
from itertools import groupby
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
N = len(S)
s = 0
ans = [0] * N
for k, g in groupby(S):
n = len(list(g... | false | 15.384615 | [
"+from itertools import groupby",
"- A = list(range(N))",
"- for _ in range(10):",
"- for i, a in enumerate(A):",
"- if S[a] == \"L\":",
"- A[i] -= 1",
"- else:",
"- A[i] += 1",
"- B = A",
"- for _ in range(99):",
"- A... | false | 0.121439 | 0.075719 | 1.603812 | [
"s248470304",
"s573925958"
] |
u525065967 | p02623 | python | s870532012 | s962563168 | 307 | 260 | 39,756 | 45,824 | Accepted | Accepted | 15.31 | from bisect import *
n, m, k = list(map(int, input().split()))
A = [0]
for x in map(int, input().split()):
x += A[-1]
if x > k: break
A.append(x)
B = [0]
for x in map(int, input().split()):
x += B[-1]
if x > k: break
B.append(x)
ans = 0
for i in range(len(A)):
ans = max(ans, i ... | from bisect import *
n, m, k = list(map(int, input().split()))
A, B = [0], [0]
for x in map(int, input().split()): A.append(A[-1]+x)
for x in map(int, input().split()): B.append(B[-1]+x)
ans, j = 0, m
for i in range(n+1):
if A[i] > k: break
while A[i] + B[j] > k: j -= 1
ans = max(ans, i+j)
print(a... | 16 | 11 | 359 | 318 | from bisect import *
n, m, k = list(map(int, input().split()))
A = [0]
for x in map(int, input().split()):
x += A[-1]
if x > k:
break
A.append(x)
B = [0]
for x in map(int, input().split()):
x += B[-1]
if x > k:
break
B.append(x)
ans = 0
for i in range(len(A)):
ans = max(ans,... | from bisect import *
n, m, k = list(map(int, input().split()))
A, B = [0], [0]
for x in map(int, input().split()):
A.append(A[-1] + x)
for x in map(int, input().split()):
B.append(B[-1] + x)
ans, j = 0, m
for i in range(n + 1):
if A[i] > k:
break
while A[i] + B[j] > k:
j -= 1
ans = ... | false | 31.25 | [
"-A = [0]",
"+A, B = [0], [0]",
"- x += A[-1]",
"- if x > k:",
"+ A.append(A[-1] + x)",
"+for x in map(int, input().split()):",
"+ B.append(B[-1] + x)",
"+ans, j = 0, m",
"+for i in range(n + 1):",
"+ if A[i] > k:",
"- A.append(x)",
"-B = [0]",
"-for x in map(int, input().s... | false | 0.050247 | 0.007918 | 6.345553 | [
"s870532012",
"s962563168"
] |
u227082700 | p03645 | python | s053368213 | s715821219 | 668 | 606 | 11,836 | 19,024 | Accepted | Accepted | 9.28 | n,m=list(map(int,input().split()));a=[]
for i in range(m):
aa,bb=list(map(int,input().split()))
if aa==1:a.append(bb)
if bb==n:a.append(aa)
a.sort()
for i in range(len(a)-1):
if a[i]==a[i+1]:print("POSSIBLE");exit()
print("IMPOSSIBLE") | n,m=list(map(int,input().split()))
s,t=set(),set()
for _ in range(m):
a,b=list(map(int,input().split()))
if a==1:t.add(b)
if b==n:s.add(a)
if s&t:print("POSSIBLE")
else:print("IMPOSSIBLE") | 9 | 8 | 239 | 189 | n, m = list(map(int, input().split()))
a = []
for i in range(m):
aa, bb = list(map(int, input().split()))
if aa == 1:
a.append(bb)
if bb == n:
a.append(aa)
a.sort()
for i in range(len(a) - 1):
if a[i] == a[i + 1]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE")
| n, m = list(map(int, input().split()))
s, t = set(), set()
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
t.add(b)
if b == n:
s.add(a)
if s & t:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 11.111111 | [
"-a = []",
"-for i in range(m):",
"- aa, bb = list(map(int, input().split()))",
"- if aa == 1:",
"- a.append(bb)",
"- if bb == n:",
"- a.append(aa)",
"-a.sort()",
"-for i in range(len(a) - 1):",
"- if a[i] == a[i + 1]:",
"- print(\"POSSIBLE\")",
"- exit(... | false | 0.051095 | 0.051328 | 0.995464 | [
"s053368213",
"s715821219"
] |
u736443076 | p02676 | python | s282227214 | s951994037 | 23 | 21 | 9,000 | 9,156 | Accepted | Accepted | 8.7 | k = int(eval(input()))
s = str(eval(input()))
if len(s) <= k:
print(s)
else:
print((s[:k]+"..."))
| k = int(eval(input()))
s = eval(input())
if len(s) <= k:
print(s)
else:
print((s[:k]+"..."))
| 7 | 7 | 99 | 94 | k = int(eval(input()))
s = str(eval(input()))
if len(s) <= k:
print(s)
else:
print((s[:k] + "..."))
| k = int(eval(input()))
s = eval(input())
if len(s) <= k:
print(s)
else:
print((s[:k] + "..."))
| false | 0 | [
"-s = str(eval(input()))",
"+s = eval(input())"
] | false | 0.032962 | 0.035641 | 0.924847 | [
"s282227214",
"s951994037"
] |
u846150137 | p03608 | python | s932959609 | s190309287 | 889 | 604 | 36,992 | 25,188 | Accepted | Accepted | 32.06 | from scipy.sparse import*
from itertools import permutations as pm
n,m,h = list(map(int,input().split()))
r = [int(i) for i in input().split()]
u,v,l = list(zip(*[list(map(int,input().split())) for i in range(m)]))
A=csgraph.dijkstra(csr_matrix((l,(u,v)),(n+1,n+1)),0)
s=min(sum(A[i][j] for i,j in zip(a[:-... | from scipy.sparse import*
from itertools import permutations as pm
n,m,h = list(map(int,input().split()))
r = [int(i) for i in input().split()]
u,v,l = list(zip(*[list(map(int,input().split())) for i in range(m)]))
A=csgraph.dijkstra(csr_matrix((l,(u,v)),[n+1]*2),0)
s=min(sum(A[i][j] for i,j in zip(a[:-1]... | 12 | 12 | 344 | 342 | from scipy.sparse import *
from itertools import permutations as pm
n, m, h = list(map(int, input().split()))
r = [int(i) for i in input().split()]
u, v, l = list(zip(*[list(map(int, input().split())) for i in range(m)]))
A = csgraph.dijkstra(csr_matrix((l, (u, v)), (n + 1, n + 1)), 0)
s = min(sum(A[i][j] for i, j in ... | from scipy.sparse import *
from itertools import permutations as pm
n, m, h = list(map(int, input().split()))
r = [int(i) for i in input().split()]
u, v, l = list(zip(*[list(map(int, input().split())) for i in range(m)]))
A = csgraph.dijkstra(csr_matrix((l, (u, v)), [n + 1] * 2), 0)
s = min(sum(A[i][j] for i, j in zip... | false | 0 | [
"-A = csgraph.dijkstra(csr_matrix((l, (u, v)), (n + 1, n + 1)), 0)",
"+A = csgraph.dijkstra(csr_matrix((l, (u, v)), [n + 1] * 2), 0)"
] | false | 0.316525 | 0.399885 | 0.791542 | [
"s932959609",
"s190309287"
] |
u395252999 | p02629 | python | s335188228 | s480994864 | 31 | 28 | 8,980 | 8,932 | Accepted | Accepted | 9.68 | def main():
N = int(eval(input())) - 1
digits = []
while True:
a, b = N // 26, N % 26
digits.append(b)
if a == 0:
break
N = a - 1
digits.reverse()
chars = list(map(to_alphabet, digits))
print((''.join(chars)))
def to_alphabet(x: int... | def main():
N = int(eval(input()))
ans = ''
while N > 0:
N -= 1
ans += chr(ord('a') + N % 26).lower()
N = N // 26
print((ans[::-1]))
if __name__ == "__main__":
main()
| 22 | 13 | 385 | 218 | def main():
N = int(eval(input())) - 1
digits = []
while True:
a, b = N // 26, N % 26
digits.append(b)
if a == 0:
break
N = a - 1
digits.reverse()
chars = list(map(to_alphabet, digits))
print(("".join(chars)))
def to_alphabet(x: int):
return chr(... | def main():
N = int(eval(input()))
ans = ""
while N > 0:
N -= 1
ans += chr(ord("a") + N % 26).lower()
N = N // 26
print((ans[::-1]))
if __name__ == "__main__":
main()
| false | 40.909091 | [
"- N = int(eval(input())) - 1",
"- digits = []",
"- while True:",
"- a, b = N // 26, N % 26",
"- digits.append(b)",
"- if a == 0:",
"- break",
"- N = a - 1",
"- digits.reverse()",
"- chars = list(map(to_alphabet, digits))",
"- print((\"\".... | false | 0.042845 | 0.1241 | 0.345247 | [
"s335188228",
"s480994864"
] |
u367130284 | p02984 | python | s183988463 | s212792375 | 278 | 147 | 30,024 | 14,508 | Accepted | Accepted | 47.12 | from itertools import*
n=int(input())
*a,=map(int,input().split())
a*=2
*odd,=accumulate([v if k%2 else -v for k,v in enumerate(a)])
*even,=accumulate([v if k%2==0 else -v for k,v in enumerate(a)])
#print(odd)
#print(even)
for i in range(n):
if i%2==0:
print(even[i+n-1]-even[i]+a[i],end=" ")
... | from itertools import*
n,*b=list(map(int,open(0).read().split()))
a1=sum(b[i]*(-1)**(i%2) for i in range(n))
l=[a1]
for i in range(n-1):
l.append((b[i]-l[-1]//2)*2)
print((*l)) | 14 | 12 | 374 | 188 | from itertools import *
n = int(input())
(*a,) = map(int, input().split())
a *= 2
(*odd,) = accumulate([v if k % 2 else -v for k, v in enumerate(a)])
(*even,) = accumulate([v if k % 2 == 0 else -v for k, v in enumerate(a)])
# print(odd)
# print(even)
for i in range(n):
if i % 2 == 0:
print(even[i + n - 1] ... | from itertools import *
n, *b = list(map(int, open(0).read().split()))
a1 = sum(b[i] * (-1) ** (i % 2) for i in range(n))
l = [a1]
for i in range(n - 1):
l.append((b[i] - l[-1] // 2) * 2)
print((*l))
| false | 14.285714 | [
"-n = int(input())",
"-(*a,) = map(int, input().split())",
"-a *= 2",
"-(*odd,) = accumulate([v if k % 2 else -v for k, v in enumerate(a)])",
"-(*even,) = accumulate([v if k % 2 == 0 else -v for k, v in enumerate(a)])",
"-# print(odd)",
"-# print(even)",
"-for i in range(n):",
"- if i % 2 == 0:",... | false | 0.038419 | 0.082337 | 0.46661 | [
"s183988463",
"s212792375"
] |
u121192152 | p02608 | python | s047178802 | s625274213 | 1,784 | 100 | 72,476 | 69,216 | Accepted | Accepted | 94.39 | import math
N = int(eval(input()))
def f(n):
m = int(math.sqrt(n)+0.5)
res = 0
for x in range(1, m+1):
for y in range(x, m+1):
k = n - (x * x + y * y + x * y)
if k < 1:
break
l = y
r = m+1
while r - l > 1:
... | import math
N = int(eval(input()))
ans = [0] * (10100)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
tmp = x*x + y*y + z*z + x*y + y*z + z*x
if tmp > 10000:
break
ans[tmp] += 1
for i in range(1, N+1):
print((a... | 40 | 15 | 977 | 320 | import math
N = int(eval(input()))
def f(n):
m = int(math.sqrt(n) + 0.5)
res = 0
for x in range(1, m + 1):
for y in range(x, m + 1):
k = n - (x * x + y * y + x * y)
if k < 1:
break
l = y
r = m + 1
while r - l > 1:
... | import math
N = int(eval(input()))
ans = [0] * (10100)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
tmp = x * x + y * y + z * z + x * y + y * z + z * x
if tmp > 10000:
break
ans[tmp] += 1
for i in range(1, N + 1):
print((ans... | false | 62.5 | [
"-",
"-",
"-def f(n):",
"- m = int(math.sqrt(n) + 0.5)",
"- res = 0",
"- for x in range(1, m + 1):",
"- for y in range(x, m + 1):",
"- k = n - (x * x + y * y + x * y)",
"- if k < 1:",
"+ans = [0] * (10100)",
"+for x in range(1, 101):",
"+ for y in range... | false | 0.220942 | 0.195603 | 1.129545 | [
"s047178802",
"s625274213"
] |
u604839890 | p02682 | python | s280495952 | s272986124 | 67 | 31 | 61,836 | 9,020 | Accepted | Accepted | 53.73 | a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif k <= (a+b):
print(a)
else:
print((a-(k-a-b))) | a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif k <= a+b:
print(a)
else:
print((a-(k-a-b)))
| 7 | 7 | 119 | 124 | a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif k <= (a + b):
print(a)
else:
print((a - (k - a - b)))
| a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif k <= a + b:
print(a)
else:
print((a - (k - a - b)))
| false | 0 | [
"-elif k <= (a + b):",
"+elif k <= a + b:"
] | false | 0.045376 | 0.066194 | 0.685499 | [
"s280495952",
"s272986124"
] |
u831244171 | p02386 | python | s811180060 | s855254376 | 900 | 30 | 7,736 | 7,996 | Accepted | Accepted | 96.67 | def move(d, r):
if r == 'N':
return (d[1], d[5], d[2], d[3], d[0], d[4])
if r == 'E':
return (d[3], d[1], d[0], d[5], d[4], d[2])
if r == 'W':
return (d[2], d[1], d[5], d[0], d[4], d[3])
if r == 'S':
return (d[4], d[0], d[2], d[3], d[5], d[1])
return d
... | n = int(eval(input()))
def rot(dice,rotation):
if rotation == "E":
dice = (dice[3],dice[1],dice[0],dice[5],dice[4],dice[2])
elif rotation == "W":
dice = (dice[2],dice[1],dice[5],dice[0],dice[4],dice[3])
elif rotation == "N":
dice = (dice[1],dice[5],dice[2],dice[3],dice[0],di... | 42 | 38 | 914 | 1,006 | def move(d, r):
if r == "N":
return (d[1], d[5], d[2], d[3], d[0], d[4])
if r == "E":
return (d[3], d[1], d[0], d[5], d[4], d[2])
if r == "W":
return (d[2], d[1], d[5], d[0], d[4], d[3])
if r == "S":
return (d[4], d[0], d[2], d[3], d[5], d[1])
return d
def gen_all(d... | n = int(eval(input()))
def rot(dice, rotation):
if rotation == "E":
dice = (dice[3], dice[1], dice[0], dice[5], dice[4], dice[2])
elif rotation == "W":
dice = (dice[2], dice[1], dice[5], dice[0], dice[4], dice[3])
elif rotation == "N":
dice = (dice[1], dice[5], dice[2], dice[3], di... | false | 9.52381 | [
"-def move(d, r):",
"- if r == \"N\":",
"- return (d[1], d[5], d[2], d[3], d[0], d[4])",
"- if r == \"E\":",
"- return (d[3], d[1], d[0], d[5], d[4], d[2])",
"- if r == \"W\":",
"- return (d[2], d[1], d[5], d[0], d[4], d[3])",
"- if r == \"S\":",
"- return (d[... | false | 0.075995 | 0.037498 | 2.026661 | [
"s811180060",
"s855254376"
] |
u695474809 | p02766 | python | s032346239 | s642869163 | 568 | 114 | 27,056 | 27,016 | Accepted | Accepted | 79.93 | import numpy as np
def cumsum(x):
return list(np.cumsum(x))
def cumsum_number(N,K,x):
ans=[0]*(N-K+1)
number_cumsum = cumsum(x)
number_cumsum.insert(0,0)
for i in range(N-K+1):
ans[i]=number_cumsum[i+K]-number_cumsum[i]
return ans
"""
int #整数
float #小数
#for
for name in ... | import numpy as np
def cumsum(x):
return list(np.cumsum(x))
def cumsum_number(N,K,x):
ans=[0]*(N-K+1)
number_cumsum = cumsum(x)
number_cumsum.insert(0,0)
for i in range(N-K+1):
ans[i]=number_cumsum[i+K]-number_cumsum[i]
return ans
"""
int #整数
float #小数
#for
for name in ... | 51 | 52 | 1,292 | 1,309 | import numpy as np
def cumsum(x):
return list(np.cumsum(x))
def cumsum_number(N, K, x):
ans = [0] * (N - K + 1)
number_cumsum = cumsum(x)
number_cumsum.insert(0, 0)
for i in range(N - K + 1):
ans[i] = number_cumsum[i + K] - number_cumsum[i]
return ans
"""
int #整数
float #小数
#for
for... | import numpy as np
def cumsum(x):
return list(np.cumsum(x))
def cumsum_number(N, K, x):
ans = [0] * (N - K + 1)
number_cumsum = cumsum(x)
number_cumsum.insert(0, 0)
for i in range(N - K + 1):
ans[i] = number_cumsum[i + K] - number_cumsum[i]
return ans
"""
int #整数
float #小数
#for
for... | false | 1.923077 | [
"+ exit(0)"
] | false | 0.617901 | 0.251208 | 2.459719 | [
"s032346239",
"s642869163"
] |
u989345508 | p03732 | python | s110679192 | s509220251 | 36 | 33 | 3,064 | 3,064 | Accepted | Accepted | 8.33 | from operator import itemgetter
n,w=list(map(int,input().split()))
wv=[tuple(map(int,input().split())) for i in range(n)]
wv.sort(key=itemgetter(1),reverse=True)#reverse
wv.sort(key=itemgetter(0))
#print(wv)
w0=wv[0][0]
x=[[0],[0],[0],[0]]
for i in range(n):
z=wv[i][0]-w0
k=wv[i][1]+x[z][-1]
l=le... | n,w=list(map(int,input().split()))
wv=[tuple(map(int,input().split())) for i in range(n)]
wv.sort(key=lambda x:-x[1])#reverse
wv.sort(key=lambda x:x[0])
w0=wv[0][0]
x=[[0],[0],[0],[0]]
for i in range(n):
z=wv[i][0]-w0
k=wv[i][1]+x[z][-1]
l=len(x[z])
if l*wv[i][0]<=w:
x[z].append(k)
... | 34 | 32 | 843 | 753 | from operator import itemgetter
n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for i in range(n)]
wv.sort(key=itemgetter(1), reverse=True) # reverse
wv.sort(key=itemgetter(0))
# print(wv)
w0 = wv[0][0]
x = [[0], [0], [0], [0]]
for i in range(n):
z = wv[i][0] - w0
k = wv[i][1] + ... | n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for i in range(n)]
wv.sort(key=lambda x: -x[1]) # reverse
wv.sort(key=lambda x: x[0])
w0 = wv[0][0]
x = [[0], [0], [0], [0]]
for i in range(n):
z = wv[i][0] - w0
k = wv[i][1] + x[z][-1]
l = len(x[z])
if l * wv[i][0] <= w:
... | false | 5.882353 | [
"-from operator import itemgetter",
"-",
"-wv.sort(key=itemgetter(1), reverse=True) # reverse",
"-wv.sort(key=itemgetter(0))",
"-# print(wv)",
"+wv.sort(key=lambda x: -x[1]) # reverse",
"+wv.sort(key=lambda x: x[0])",
"- ma_sub = x[3][i] + x[2][j] + x[1][k] + x[0][min(d // w0, l0 ... | false | 0.047773 | 0.115868 | 0.412307 | [
"s110679192",
"s509220251"
] |
u647999897 | p03261 | python | s883320577 | s082085191 | 184 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.76 | from collections import defaultdict
def solve():
N = int(eval(input()))
d = defaultdict(int)
prev = []
for i in range(N):
w = eval(input())
if d[w] == 1:
print('No')
return
d[w] += 1
w_list = list(w)
if i != 0 and w_list[0] !=... | def solve():
N = int(eval(input()))
W = [eval(input()) for i in range(N)]
for i in range(N):
for j in range(i+1,N):
if W[i] == W[j]:
print('No')
return
for i in range(N-1):
if W[i][-1] != W[i+1][0]:
print('No')
... | 23 | 19 | 465 | 391 | from collections import defaultdict
def solve():
N = int(eval(input()))
d = defaultdict(int)
prev = []
for i in range(N):
w = eval(input())
if d[w] == 1:
print("No")
return
d[w] += 1
w_list = list(w)
if i != 0 and w_list[0] != prev[-1]:
... | def solve():
N = int(eval(input()))
W = [eval(input()) for i in range(N)]
for i in range(N):
for j in range(i + 1, N):
if W[i] == W[j]:
print("No")
return
for i in range(N - 1):
if W[i][-1] != W[i + 1][0]:
print("No")
re... | false | 17.391304 | [
"-from collections import defaultdict",
"-",
"-",
"- d = defaultdict(int)",
"- prev = []",
"+ W = [eval(input()) for i in range(N)]",
"- w = eval(input())",
"- if d[w] == 1:",
"+ for j in range(i + 1, N):",
"+ if W[i] == W[j]:",
"+ print(\"... | false | 0.08127 | 0.038079 | 2.134262 | [
"s883320577",
"s082085191"
] |
u814781830 | p02813 | python | s912437229 | s283845736 | 230 | 181 | 43,868 | 41,072 | Accepted | Accepted | 21.3 | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
p = ""
q = ""
for i in P:
p += str(i)
p = int(p)
for i in Q:
q += str(i)
q = int(q)
tmp = itertools.permutations([i+1 for i in range(N)])
target = []
for a in tmp:
t = ""
f... | import itertools
N = int(eval(input()))
P = ''.join(input().split())
Q = ''.join(input().split())
tmp = itertools.permutations([str(i+1) for i in range(N)])
target = []
for a in tmp:
target.append(''.join(a))
print((abs(target.index(P)-target.index(Q))))
| 31 | 9 | 520 | 259 | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
p = ""
q = ""
for i in P:
p += str(i)
p = int(p)
for i in Q:
q += str(i)
q = int(q)
tmp = itertools.permutations([i + 1 for i in range(N)])
target = []
for a in tmp:
t = ""
for s in a:
... | import itertools
N = int(eval(input()))
P = "".join(input().split())
Q = "".join(input().split())
tmp = itertools.permutations([str(i + 1) for i in range(N)])
target = []
for a in tmp:
target.append("".join(a))
print((abs(target.index(P) - target.index(Q))))
| false | 70.967742 | [
"-P = list(map(int, input().split()))",
"-Q = list(map(int, input().split()))",
"-p = \"\"",
"-q = \"\"",
"-for i in P:",
"- p += str(i)",
"-p = int(p)",
"-for i in Q:",
"- q += str(i)",
"-q = int(q)",
"-tmp = itertools.permutations([i + 1 for i in range(N)])",
"+P = \"\".join(input().sp... | false | 0.036466 | 0.045514 | 0.801209 | [
"s912437229",
"s283845736"
] |
u840310460 | p03162 | python | s484440757 | s929116687 | 592 | 453 | 34,656 | 48,572 | Accepted | Accepted | 23.48 | N = int(eval(input()))
A, B, C = [0]*N, [0]*N, [0]*N
for i in range(N):
A[i], B[i], C[i] = [int(j) for j in input().split()]
ABC = [A, B, C]
dp = [[0]*3 for _ in range(N+1)]
for i in range(N):
for j in range(3):
dp[i+1][j] = max(dp[i][j-1], dp[i][j-2]) + ABC[j][i]
print((max(dp[-1]))) | N = int(eval(input()))
data = [[] for _ in range(N)]
for i in range(N):
data[i] = [int(i) for i in input().split()]
#%%
dp = [[0] * 3 for i in range(N + 1)]
for i in range(1, N + 1):
for j in range(3):
temp = max(dp[i - 1][j - 1], dp[i - 1][j - 2])
dp[i][j]= data[i - 1][j] + temp
a... | 13 | 17 | 309 | 385 | N = int(eval(input()))
A, B, C = [0] * N, [0] * N, [0] * N
for i in range(N):
A[i], B[i], C[i] = [int(j) for j in input().split()]
ABC = [A, B, C]
dp = [[0] * 3 for _ in range(N + 1)]
for i in range(N):
for j in range(3):
dp[i + 1][j] = max(dp[i][j - 1], dp[i][j - 2]) + ABC[j][i]
print((max(dp[-1])))
| N = int(eval(input()))
data = [[] for _ in range(N)]
for i in range(N):
data[i] = [int(i) for i in input().split()]
#%%
dp = [[0] * 3 for i in range(N + 1)]
for i in range(1, N + 1):
for j in range(3):
temp = max(dp[i - 1][j - 1], dp[i - 1][j - 2])
dp[i][j] = data[i - 1][j] + temp
ans = 0
for i ... | false | 23.529412 | [
"-A, B, C = [0] * N, [0] * N, [0] * N",
"+data = [[] for _ in range(N)]",
"- A[i], B[i], C[i] = [int(j) for j in input().split()]",
"-ABC = [A, B, C]",
"-dp = [[0] * 3 for _ in range(N + 1)]",
"-for i in range(N):",
"+ data[i] = [int(i) for i in input().split()]",
"+#%%",
"+dp = [[0] * 3 for i... | false | 0.045379 | 0.033434 | 1.357244 | [
"s484440757",
"s929116687"
] |
u968166680 | p03450 | python | s580079092 | s750456256 | 400 | 365 | 148,180 | 148,820 | Accepted | Accepted | 8.75 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
# https://at274.hatenablog.com/entry/2018/02/03/140504
class WeightedUnionFind:
def __init__(self, n):
s... | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
class UnionFindWeighted:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
... | 74 | 67 | 1,822 | 1,568 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
# https://at274.hatenablog.com/entry/2018/02/03/140504
class WeightedUnionFind:
def __init__(self, n):
self.par = [i for i... | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
class UnionFindWeighted:
# Reference: https://note.nkmk.me/python-union-find/
def __init__(self, n):
self.n = n
... | false | 9.459459 | [
"-# https://at274.hatenablog.com/entry/2018/02/03/140504",
"-class WeightedUnionFind:",
"+",
"+",
"+class UnionFindWeighted:",
"+ # Reference: https://note.nkmk.me/python-union-find/",
"- self.par = [i for i in range(n + 1)]",
"- self.rank = [0] * (n + 1)",
"- # 根への距離を管理",
... | false | 0.048066 | 0.045044 | 1.067095 | [
"s580079092",
"s750456256"
] |
u844789719 | p02889 | python | s316978620 | s976229237 | 804 | 614 | 36,184 | 35,428 | Accepted | Accepted | 23.63 | import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N, M, L = [int(_) for _ in input().split()]
ABC = [[int(_) for _ in input().split()] for _ in range(M)]
Q = int(eval(input()))
ST = [[int(_) for _ in input().split()] for _ in range(Q)]
edge = np.full((N, N), 10**10, dtype=in... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
N, M, L = [int(_) for _ in readline().split()]
ABCQST = np.array([int(_) for _ in read().sp... | 21 | 22 | 632 | 690 | import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N, M, L = [int(_) for _ in input().split()]
ABC = [[int(_) for _ in input().split()] for _ in range(M)]
Q = int(eval(input()))
ST = [[int(_) for _ in input().split()] for _ in range(Q)]
edge = np.full((N, N), 10**10, dtype=int)
for ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
N, M, L = [int(_) for _ in readline().split()]
ABCQST = np.array([int(_) for _ in read().split()], ... | false | 4.545455 | [
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"+from scipy.sparse.csgraph import floyd_warshall",
"+from scipy.sparse import csr_matrix",
... | false | 0.334524 | 0.721217 | 0.463832 | [
"s316978620",
"s976229237"
] |
u248424983 | p02414 | python | s408366253 | s183576845 | 450 | 150 | 8,672 | 8,688 | Accepted | Accepted | 66.67 | n,m,l=list(map(int,input().split()))
A = [tuple(map(int,input().split())) for _ in range(n)]
B = [tuple(map(int,input().split())) for _ in range(m)]
for nnum in range(n):
temp=[]
for lnum in range(l):
ret = 0
for mnum in range(m):
ret +=(A[nnum][mnum]*B[mnum][lnum])
... | n,m,l=list(map(int,input().split()))
A = [tuple(map(int,input().split())) for _ in range(n)]
B = [tuple(map(int,input().split())) for _ in range(m)]
BT = tuple(map(tuple,list(zip(*B))))
for a in A:
temp=[]
for b in BT:
temp.append(sum([x*y for (x,y) in zip(a,b)]))
print((*temp)) | 11 | 9 | 348 | 293 | n, m, l = list(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(n)]
B = [tuple(map(int, input().split())) for _ in range(m)]
for nnum in range(n):
temp = []
for lnum in range(l):
ret = 0
for mnum in range(m):
ret += A[nnum][mnum] * B[mnum][lnum]
... | n, m, l = list(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(n)]
B = [tuple(map(int, input().split())) for _ in range(m)]
BT = tuple(map(tuple, list(zip(*B))))
for a in A:
temp = []
for b in BT:
temp.append(sum([x * y for (x, y) in zip(a, b)]))
print((*temp))
| false | 18.181818 | [
"-for nnum in range(n):",
"+BT = tuple(map(tuple, list(zip(*B))))",
"+for a in A:",
"- for lnum in range(l):",
"- ret = 0",
"- for mnum in range(m):",
"- ret += A[nnum][mnum] * B[mnum][lnum]",
"- temp.append(ret)",
"+ for b in BT:",
"+ temp.append(sum([... | false | 0.043898 | 0.03412 | 1.286593 | [
"s408366253",
"s183576845"
] |
u790710233 | p03835 | python | s182601457 | s801999742 | 1,227 | 801 | 2,940 | 41,112 | Accepted | Accepted | 34.72 | k, s = list(map(int, input().split()))
print((sum(0 <= s-x-y <= k for x in range(k+1) for y in range(k+1))))
| k,s=list(map(int,input().split()))
print((len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))) | 2 | 2 | 102 | 100 | k, s = list(map(int, input().split()))
print((sum(0 <= s - x - y <= k for x in range(k + 1) for y in range(k + 1))))
| k, s = list(map(int, input().split()))
print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))
| false | 0 | [
"-print((sum(0 <= s - x - y <= k for x in range(k + 1) for y in range(k + 1))))",
"+print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))"
] | false | 0.041322 | 0.046809 | 0.882767 | [
"s182601457",
"s801999742"
] |
u477977638 | p02658 | python | s303889763 | s689652622 | 101 | 82 | 86,048 | 20,124 | Accepted | Accepted | 18.81 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(m... | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input... | 35 | 40 | 688 | 671 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
re... | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return ... | false | 12.5 | [
"-read = sys.stdin.buffer.read",
"-input = sys.stdin.readline",
"- return sys.stdin.read()",
"+ return input().rstrip().decode()",
"+ return int(eval(input()))",
"+",
"+",
"+def FI():",
"+ A.sort()",
"- A.sort()",
"- for i in range(n):",
"- ans *= A[i]",
"+ for i ... | false | 0.077859 | 0.04596 | 1.694049 | [
"s303889763",
"s689652622"
] |
u150984829 | p02264 | python | s602119577 | s522251788 | 180 | 120 | 17,732 | 17,736 | Accepted | Accepted | 33.33 | import sys
from collections import deque
s=sys.stdin.readlines()
q=int(s[0].split()[1])
f=lambda x,y:(x,int(y))
d=deque(f(*e.split())for e in s[1:])
t,a=0,[]
while d:
k,v=d.popleft()
if v>q:v-=q;t+=q;d.append([k,v])
else:t+=v;a+=[f'{k} {t}']
print(('\n'.join(a)))
| import sys
from collections import deque
def m():
s=sys.stdin.readlines()
q=int(s[0].split()[1])
f=lambda x,y:(x,int(y))
d=deque(f(*e.split())for e in s[1:])
t,a=0,[]
while d:
k,v=d.popleft()
if v>q:v-=q;t+=q;d.append([k,v])
else:t+=v;a+=[f'{k} {t}']
print(('\n'.join(a)))
if'__main__'==__name_... | 12 | 14 | 276 | 324 | import sys
from collections import deque
s = sys.stdin.readlines()
q = int(s[0].split()[1])
f = lambda x, y: (x, int(y))
d = deque(f(*e.split()) for e in s[1:])
t, a = 0, []
while d:
k, v = d.popleft()
if v > q:
v -= q
t += q
d.append([k, v])
else:
t += v
a += [f"{k}... | import sys
from collections import deque
def m():
s = sys.stdin.readlines()
q = int(s[0].split()[1])
f = lambda x, y: (x, int(y))
d = deque(f(*e.split()) for e in s[1:])
t, a = 0, []
while d:
k, v = d.popleft()
if v > q:
v -= q
t += q
d.appen... | false | 14.285714 | [
"-s = sys.stdin.readlines()",
"-q = int(s[0].split()[1])",
"-f = lambda x, y: (x, int(y))",
"-d = deque(f(*e.split()) for e in s[1:])",
"-t, a = 0, []",
"-while d:",
"- k, v = d.popleft()",
"- if v > q:",
"- v -= q",
"- t += q",
"- d.append([k, v])",
"- else:",
... | false | 0.05059 | 0.050554 | 1.000715 | [
"s602119577",
"s522251788"
] |
u934442292 | p02936 | python | s563023550 | s060907523 | 1,027 | 856 | 62,224 | 65,664 | Accepted | Accepted | 16.65 | import sys
from collections import deque
input = sys.stdin.readline
def dfs(G, v, p, counter):
stack = deque([(v, p)])
while stack:
v, p = stack.pop()
counter_v = counter[v]
for c in G[v]:
if c == p:
continue
counter[c] += counter_... | import sys
from collections import deque
input = sys.stdin.readline
def dfs(G, v, p, counter):
stack = deque([(v, p)])
while stack:
v, p = stack.pop()
for c in G[v]:
if c == p:
continue
counter[c] += counter[v]
stack.append((c,... | 42 | 41 | 824 | 812 | import sys
from collections import deque
input = sys.stdin.readline
def dfs(G, v, p, counter):
stack = deque([(v, p)])
while stack:
v, p = stack.pop()
counter_v = counter[v]
for c in G[v]:
if c == p:
continue
counter[c] += counter_v
... | import sys
from collections import deque
input = sys.stdin.readline
def dfs(G, v, p, counter):
stack = deque([(v, p)])
while stack:
v, p = stack.pop()
for c in G[v]:
if c == p:
continue
counter[c] += counter[v]
stack.append((c, v))
def mai... | false | 2.380952 | [
"- counter_v = counter[v]",
"- counter[c] += counter_v",
"+ counter[c] += counter[v]",
"- print((*counter))",
"+ print((\" \".join(map(str, counter))))"
] | false | 0.052739 | 0.043161 | 1.22191 | [
"s563023550",
"s060907523"
] |
u767664985 | p03380 | python | s651857244 | s102844507 | 94 | 85 | 16,208 | 15,692 | Accepted | Accepted | 9.57 | from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
numer = reduce(mul, list(range(n, n - r, -1)))
denom = reduce(mul, list(range(1, r + 1)))
return numer // denom
n = int(eval(input()))
a = list(map(int, input().split())... | n = int(eval(input()))
a = list(map(int, input().split()))
ai = max(a)
diff = float("inf")
for aj in set(a):
if abs(ai / 2 - aj) < diff:
ans = [ai, aj]
diff = abs(ai / 2 - aj)
print((' '.join(map(str, ans))))
| 21 | 9 | 479 | 229 | from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
numer = reduce(mul, list(range(n, n - r, -1)))
denom = reduce(mul, list(range(1, r + 1)))
return numer // denom
n = int(eval(input()))
a = list(map(int, input().split()))
ai = max(a... | n = int(eval(input()))
a = list(map(int, input().split()))
ai = max(a)
diff = float("inf")
for aj in set(a):
if abs(ai / 2 - aj) < diff:
ans = [ai, aj]
diff = abs(ai / 2 - aj)
print((" ".join(map(str, ans))))
| false | 57.142857 | [
"-from operator import mul",
"-from functools import reduce",
"-",
"-",
"-def cmb(n, r):",
"- r = min(n - r, r)",
"- if r == 0:",
"- return 1",
"- numer = reduce(mul, list(range(n, n - r, -1)))",
"- denom = reduce(mul, list(range(1, r + 1)))",
"- return numer // denom",
"... | false | 0.035496 | 0.035705 | 0.994143 | [
"s651857244",
"s102844507"
] |
u141786930 | p03371 | python | s525101838 | s511222468 | 126 | 104 | 3,060 | 8,940 | Accepted | Accepted | 17.46 | # C - Half and Half
A, B, C, X, Y = list(map(int, input().split()))
# 条件を満たすときのA, B, ABの買い方を全列挙したい
# A, Bの枚数は、ABの値が決まれば、一意に定まるため、
# ABのみループする。
ans = 10**18
for i in range(0, max(X, Y)*2+1, 2):
x = max(X-i//2, 0)
y = max(Y-i//2, 0)
ans = min(ans, x*A + y*B + i*C)
print(ans) | A, B, C, X, Y = list(map(int, input().split()))
ans = 10**18
for i in range(0, 2*max(X, Y)+2, 2):
ans = min(ans, i * C + max(X-(i//2), 0) * A + max(Y-(i//2), 0) * B)
print(ans) | 15 | 6 | 301 | 180 | # C - Half and Half
A, B, C, X, Y = list(map(int, input().split()))
# 条件を満たすときのA, B, ABの買い方を全列挙したい
# A, Bの枚数は、ABの値が決まれば、一意に定まるため、
# ABのみループする。
ans = 10**18
for i in range(0, max(X, Y) * 2 + 1, 2):
x = max(X - i // 2, 0)
y = max(Y - i // 2, 0)
ans = min(ans, x * A + y * B + i * C)
print(ans)
| A, B, C, X, Y = list(map(int, input().split()))
ans = 10**18
for i in range(0, 2 * max(X, Y) + 2, 2):
ans = min(ans, i * C + max(X - (i // 2), 0) * A + max(Y - (i // 2), 0) * B)
print(ans)
| false | 60 | [
"-# C - Half and Half",
"-# 条件を満たすときのA, B, ABの買い方を全列挙したい",
"-# A, Bの枚数は、ABの値が決まれば、一意に定まるため、",
"-# ABのみループする。",
"-for i in range(0, max(X, Y) * 2 + 1, 2):",
"- x = max(X - i // 2, 0)",
"- y = max(Y - i // 2, 0)",
"- ans = min(ans, x * A + y * B + i * C)",
"+for i in range(0, 2 * max(X, Y) + ... | false | 0.067007 | 0.164051 | 0.408453 | [
"s525101838",
"s511222468"
] |
u091051505 | p03290 | python | s268645931 | s731407152 | 23 | 18 | 3,064 | 3,064 | Accepted | Accepted | 21.74 | d, g = list(map(int, input().split()))
test = []
point = []
for i in range(1, d+1):
p, c = list(map(int, input().split()))
test.append([p, c])
point.append([c + (p * i * 100), p])
inf = 10 ** 9
ans = inf
for i in range(2 ** d):
b = bin(i)[2:]
b = (d - len(b)) * "0" + b
temp = 0
... | d, g = list(map(int, input().split()))
point = []
for i in range(d):
p, c = list(map(int, input().split()))
point.append([p, c])
def f(g, i):
if i == -1:
return 10000000
n = min(g // ((i + 1) * 100), point[i][0])
s = n * (i + 1) * 100
if n == point[i][0]:
s += ... | 28 | 18 | 843 | 414 | d, g = list(map(int, input().split()))
test = []
point = []
for i in range(1, d + 1):
p, c = list(map(int, input().split()))
test.append([p, c])
point.append([c + (p * i * 100), p])
inf = 10**9
ans = inf
for i in range(2**d):
b = bin(i)[2:]
b = (d - len(b)) * "0" + b
temp = 0
calc = 0
fo... | d, g = list(map(int, input().split()))
point = []
for i in range(d):
p, c = list(map(int, input().split()))
point.append([p, c])
def f(g, i):
if i == -1:
return 10000000
n = min(g // ((i + 1) * 100), point[i][0])
s = n * (i + 1) * 100
if n == point[i][0]:
s += point[i][1]
i... | false | 35.714286 | [
"-test = []",
"-for i in range(1, d + 1):",
"+for i in range(d):",
"- test.append([p, c])",
"- point.append([c + (p * i * 100), p])",
"-inf = 10**9",
"-ans = inf",
"-for i in range(2**d):",
"- b = bin(i)[2:]",
"- b = (d - len(b)) * \"0\" + b",
"- temp = 0",
"- calc = 0",
"-... | false | 0.060471 | 0.11549 | 0.523604 | [
"s268645931",
"s731407152"
] |
u968166680 | p03965 | python | s463160281 | s024545567 | 35 | 24 | 9,176 | 9,204 | Accepted | Accepted | 31.43 | 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():
S = readline().strip()
g, p = 0, 0
ans = 0
for c in S:
if g > p:
p += 1
if c == '... | 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():
S = readline().strip()
ans = len(S) // 2 - S.count('p')
print(ans)
return
if __name__ == '__main__':
mai... | 31 | 21 | 511 | 324 | 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():
S = readline().strip()
g, p = 0, 0
ans = 0
for c in S:
if g > p:
p += 1
if c == "g":
a... | 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():
S = readline().strip()
ans = len(S) // 2 - S.count("p")
print(ans)
return
if __name__ == "__main__":
main()
| false | 32.258065 | [
"- g, p = 0, 0",
"- ans = 0",
"- for c in S:",
"- if g > p:",
"- p += 1",
"- if c == \"g\":",
"- ans += 1",
"- else:",
"- g += 1",
"- if c == \"p\":",
"- ans -= 1",
"+ ans = len(S) // 2 - S.coun... | false | 0.09474 | 0.04279 | 2.214096 | [
"s463160281",
"s024545567"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.