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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u121161758 | p03200 | python | s183126008 | s813854841 | 74 | 60 | 4,840 | 3,500 | Accepted | Accepted | 18.92 | S = list(eval(input()))
#print(S)
n = 1 if S[0] == "W" else 0# number of white string
count = 0
for i in range(1, len(S)):
if S[i] == "W":
count += i - n
n += 1
#print("n is", n)
#print("count is ", count)
print(count)
| S = eval(input())
bcount = 0
ans = 0
for i in range(len(S)):
if S[i] == "B":# countup B(= empty space)
bcount += 1
else: # countup W shift value
ans += bcount
print(ans)
| 15 | 9 | 267 | 205 | S = list(eval(input()))
# print(S)
n = 1 if S[0] == "W" else 0 # number of white string
count = 0
for i in range(1, len(S)):
if S[i] == "W":
count += i - n
n += 1
# print("n is", n)
# print("count is ", count)
print(count)
| S = eval(input())
bcount = 0
ans = 0
for i in range(len(S)):
if S[i] == "B": # countup B(= empty space)
bcount += 1
else: # countup W shift value
ans += bcount
print(ans)
| false | 40 | [
"-S = list(eval(input()))",
"-# print(S)",
"-n = 1 if S[0] == \"W\" else 0 # number of white string",
"-count = 0",
"-for i in range(1, len(S)):",
"- if S[i] == \"W\":",
"- count += i - n",
"- n += 1",
"- # print(\"n is\", n)",
"- # print(\"count is \", count)",
"... | false | 0.037681 | 0.048769 | 0.772645 | [
"s183126008",
"s813854841"
] |
u867848444 | p03141 | python | s601086218 | s209697858 | 411 | 274 | 31,876 | 31,600 | Accepted | Accepted | 33.33 | n=int(eval(input()))
ab=[list(map(int,input().split())) for i in range(n)]
a_b=[]
x=0
for a,b in ab:
a_b.append(a+b)
x-=b
a_b.sort(reverse=True)
ans=0
for i in range(0,n,2):
ans+=a_b[i]
print((ans+x)) | n = int(eval(input()))
ab = [list(map(int,input().split())) for _ in range(n)]
sum_a = 0
sum_ab = []
for a, b in ab:
sum_a += a
sum_ab.append(a + b)
sum_ab.sort(reverse=True)
for i in range(1, n, 2):
sum_a -= sum_ab[i]
print(sum_a) | 14 | 13 | 219 | 251 | n = int(eval(input()))
ab = [list(map(int, input().split())) for i in range(n)]
a_b = []
x = 0
for a, b in ab:
a_b.append(a + b)
x -= b
a_b.sort(reverse=True)
ans = 0
for i in range(0, n, 2):
ans += a_b[i]
print((ans + x))
| n = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
sum_a = 0
sum_ab = []
for a, b in ab:
sum_a += a
sum_ab.append(a + b)
sum_ab.sort(reverse=True)
for i in range(1, n, 2):
sum_a -= sum_ab[i]
print(sum_a)
| false | 7.142857 | [
"-ab = [list(map(int, input().split())) for i in range(n)]",
"-a_b = []",
"-x = 0",
"+ab = [list(map(int, input().split())) for _ in range(n)]",
"+sum_a = 0",
"+sum_ab = []",
"- a_b.append(a + b)",
"- x -= b",
"-a_b.sort(reverse=True)",
"-ans = 0",
"-for i in range(0, n, 2):",
"- ans ... | false | 0.113602 | 0.03717 | 3.056241 | [
"s601086218",
"s209697858"
] |
u940395729 | p02267 | python | s288601591 | s016680870 | 100 | 50 | 6,324 | 6,312 | Accepted | Accepted | 50 | # input the number for array of a[]
n = int(eval(input()))
a = list(map(int, input().split()))
# input the number for array of b[]
m = int(eval(input()))
b = list(map(int, input().split()))
# do the linear search
count = 0
for i in range(m):
for j in range(n):
if(b[i] == a[j]):
co... | n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
# T < S
cnt = 0
for i in T:
for j in S:
if i == j:
cnt += 1
break
print(cnt)
# LinearSearch: 線形探索
# 線形探索は、配列の先頭から各要素が目的の値と等しいかどうかを順番に調べる。
# 等しいものが見つ... | 18 | 18 | 354 | 332 | # input the number for array of a[]
n = int(eval(input()))
a = list(map(int, input().split()))
# input the number for array of b[]
m = int(eval(input()))
b = list(map(int, input().split()))
# do the linear search
count = 0
for i in range(m):
for j in range(n):
if b[i] == a[j]:
count += 1
... | n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
# T < S
cnt = 0
for i in T:
for j in S:
if i == j:
cnt += 1
break
print(cnt)
# LinearSearch: 線形探索
# 線形探索は、配列の先頭から各要素が目的の値と等しいかどうかを順番に調べる。
# 等しいものが見つかった時点でその位置を返し探索を終了... | false | 0 | [
"-# input the number for array of a[]",
"-a = list(map(int, input().split()))",
"-# input the number for array of b[]",
"-m = int(eval(input()))",
"-b = list(map(int, input().split()))",
"-# do the linear search",
"-count = 0",
"-for i in range(m):",
"- for j in range(n):",
"- if b[i] ==... | false | 0.175033 | 0.070419 | 2.485586 | [
"s288601591",
"s016680870"
] |
u512212329 | p02691 | python | s521464527 | s360639747 | 231 | 171 | 67,192 | 46,404 | Accepted | Accepted | 25.97 | class Map(dict):
default_value = 0
def __missing__(self, key):
self[key] = self.default_value
return self.default_value
def main():
int(eval(input()))
d = Map()
ans = 0
for i, height in enumerate(input().split()):
height = int(height)
d[i + heig... | class Map(dict):
def __missing__(self, key):
return 0
def main():
int(eval(input()))
d = Map()
ans = 0
for i, height in enumerate(input().split()):
height = int(height)
d[i + height] += 1
ans += d[i - height]
return ans
if __name__ == '__ma... | 26 | 23 | 489 | 407 | class Map(dict):
default_value = 0
def __missing__(self, key):
self[key] = self.default_value
return self.default_value
def main():
int(eval(input()))
d = Map()
ans = 0
for i, height in enumerate(input().split()):
height = int(height)
d[i + height] += 1
... | class Map(dict):
def __missing__(self, key):
return 0
def main():
int(eval(input()))
d = Map()
ans = 0
for i, height in enumerate(input().split()):
height = int(height)
d[i + height] += 1
ans += d[i - height]
return ans
if __name__ == "__main__":
print((ma... | false | 11.538462 | [
"- default_value = 0",
"-",
"- self[key] = self.default_value",
"- return self.default_value",
"+ return 0"
] | false | 0.044201 | 0.03594 | 1.229847 | [
"s521464527",
"s360639747"
] |
u811967730 | p03827 | python | s471499803 | s432816249 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
S = eval(input())
x = 0
x_max = 0
for i in range(N):
if S[i] == "I":
x += 1
else:
x -= 1
if x > x_max:
x_max = x
print(x_max)
| N = int(eval(input()))
S = eval(input())
x = 0
x_max = 0
for i in range(N):
if S[i] == "I":
x += 1
else:
x -= 1
x_max = max(x, x_max)
print(x_max)
| 15 | 14 | 190 | 179 | N = int(eval(input()))
S = eval(input())
x = 0
x_max = 0
for i in range(N):
if S[i] == "I":
x += 1
else:
x -= 1
if x > x_max:
x_max = x
print(x_max)
| N = int(eval(input()))
S = eval(input())
x = 0
x_max = 0
for i in range(N):
if S[i] == "I":
x += 1
else:
x -= 1
x_max = max(x, x_max)
print(x_max)
| false | 6.666667 | [
"- if x > x_max:",
"- x_max = x",
"+ x_max = max(x, x_max)"
] | false | 0.04938 | 0.007503 | 6.581343 | [
"s471499803",
"s432816249"
] |
u827202523 | p02928 | python | s438786813 | s201267933 | 216 | 100 | 41,840 | 75,464 | Accepted | Accepted | 53.7 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
MOD = 10 ** 9 + 7
n, k = getList()
anums = getList()
space = [[] for i in range(2002)]
remain = [1 for j in r... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList... | 48 | 92 | 865 | 2,172 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
MOD = 10**9 + 7
n, k = getList()
anums = getList()
space = [[] for i in range(2002)]
remain = [1 for j in range(n)]
yet = n
for i, ... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(i... | false | 47.826087 | [
"+from collections import defaultdict, deque, Counter",
"+import math",
"+# import copy",
"+from bisect import bisect_left, bisect_right",
"+",
"+# import heapq",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"-sys.setrecursionlimit(1000000)",
"+getS = lambda: input().strip()",
"+getN... | false | 0.03771 | 0.045094 | 0.836251 | [
"s438786813",
"s201267933"
] |
u202634017 | p02771 | python | s988230500 | s802411641 | 168 | 18 | 38,256 | 3,060 | Accepted | Accepted | 89.29 | A,B,C = list(map(int,input().split()))
if (A == B)and(A == C):
print("No")
elif (A != B)and(B != C)and(A != C):
print("No")
else:
print("Yes") | A,B,C = list(map(int,input().split()))
if (A == B)and(A==C):
print("No")
elif (A != B)and(A != C)and(B != C):
print("No")
else:
print("Yes") | 7 | 8 | 154 | 154 | A, B, C = list(map(int, input().split()))
if (A == B) and (A == C):
print("No")
elif (A != B) and (B != C) and (A != C):
print("No")
else:
print("Yes")
| A, B, C = list(map(int, input().split()))
if (A == B) and (A == C):
print("No")
elif (A != B) and (A != C) and (B != C):
print("No")
else:
print("Yes")
| false | 12.5 | [
"-elif (A != B) and (B != C) and (A != C):",
"+elif (A != B) and (A != C) and (B != C):"
] | false | 0.08223 | 0.034467 | 2.385769 | [
"s988230500",
"s802411641"
] |
u113835532 | p03795 | python | s582998880 | s944658192 | 28 | 25 | 8,988 | 9,032 | Accepted | Accepted | 10.71 | meals = int(eval(input()))
print((800 * meals - meals // 15 * 200))
| unit_price = 800
reward_money = 200
meals = int(eval(input()))
print((unit_price * meals - meals // 15 * reward_money))
| 3 | 6 | 63 | 119 | meals = int(eval(input()))
print((800 * meals - meals // 15 * 200))
| unit_price = 800
reward_money = 200
meals = int(eval(input()))
print((unit_price * meals - meals // 15 * reward_money))
| false | 50 | [
"+unit_price = 800",
"+reward_money = 200",
"-print((800 * meals - meals // 15 * 200))",
"+print((unit_price * meals - meals // 15 * reward_money))"
] | false | 0.042217 | 0.043219 | 0.976805 | [
"s582998880",
"s944658192"
] |
u919633157 | p03160 | python | s013741353 | s019740358 | 137 | 126 | 13,928 | 13,928 | Accepted | Accepted | 8.03 | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0],dp[1]=0,abs(h[1]-h[0])
for i in range(2,n):
pre1=abs(h[i]-h[i-1])+dp[i-1]
pre2=abs(h[i]-h[i-2])+dp[i-2]
dp[i]=min(pre1,pre2)
print((dp[-1])) | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | 10 | 12 | 234 | 208 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0], dp[1] = 0, abs(h[1] - h[0])
for i in range(2, n):
pre1 = abs(h[i] - h[i - 1]) + dp[i - 1]
pre2 = abs(h[i] - h[i - 2]) + dp[i - 2]
dp[i] = min(pre1, pre2)
print((dp[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 16.666667 | [
"-dp[0], dp[1] = 0, abs(h[1] - h[0])",
"+dp[0] = 0",
"+dp[1] = abs(h[1] - h[0])",
"- pre1 = abs(h[i] - h[i - 1]) + dp[i - 1]",
"- pre2 = abs(h[i] - h[i - 2]) + dp[i - 2]",
"- dp[i] = min(pre1, pre2)",
"+ dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))"
] | false | 0.035378 | 0.036113 | 0.979657 | [
"s013741353",
"s019740358"
] |
u462329577 | p03679 | python | s779830043 | s086157692 | 166 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.76 | x,a,b = list(map(int,input().split()))
print(("delicious" if b-a <= 0 else "safe" if b-a <= x else "dangerous"))
| #!/usr/bin/env python3
x,a,b = list(map(int,input().split()))
if b <= a: print("delicious")
elif b <= a + x: print("safe")
else: print("dangerous") | 2 | 5 | 106 | 145 | x, a, b = list(map(int, input().split()))
print(("delicious" if b - a <= 0 else "safe" if b - a <= x else "dangerous"))
| #!/usr/bin/env python3
x, a, b = list(map(int, input().split()))
if b <= a:
print("delicious")
elif b <= a + x:
print("safe")
else:
print("dangerous")
| false | 60 | [
"+#!/usr/bin/env python3",
"-print((\"delicious\" if b - a <= 0 else \"safe\" if b - a <= x else \"dangerous\"))",
"+if b <= a:",
"+ print(\"delicious\")",
"+elif b <= a + x:",
"+ print(\"safe\")",
"+else:",
"+ print(\"dangerous\")"
] | false | 0.040782 | 0.035558 | 1.146936 | [
"s779830043",
"s086157692"
] |
u836737505 | p03136 | python | s876546107 | s741933617 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
a = sorted(list(map(int,input().split())))
print(("Yes" if a[-1]<sum(a[:-1]) else "No")) | n = int(eval(input()))
l = list(map(int,input().split()))
if max(l)< sum(l)-max(l):
print("Yes")
else:
print("No") | 3 | 6 | 105 | 121 | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
print(("Yes" if a[-1] < sum(a[:-1]) else "No"))
| n = int(eval(input()))
l = list(map(int, input().split()))
if max(l) < sum(l) - max(l):
print("Yes")
else:
print("No")
| false | 50 | [
"-a = sorted(list(map(int, input().split())))",
"-print((\"Yes\" if a[-1] < sum(a[:-1]) else \"No\"))",
"+l = list(map(int, input().split()))",
"+if max(l) < sum(l) - max(l):",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.06085 | 0.067628 | 0.899774 | [
"s876546107",
"s741933617"
] |
u172569352 | p03325 | python | s554945912 | s746219709 | 288 | 66 | 4,148 | 4,148 | Accepted | Accepted | 77.08 | import math
def q77(N, a):
i = 0
o = 0
while True:
b = False
for j in range(o, N):
a[j] = a[j]/2
if a[j].is_integer():
i += 1
b = True
break
else:
o = j
if not b:
... | def q77(N, a):
i = 0
for b in a:
while True:
b = b/2
if not b.is_integer():
break
else:
i += 1
return i
N = int(eval(input()))
a = [int(i) for i in input().split()]
print((q77(N, a))) | 22 | 15 | 424 | 279 | import math
def q77(N, a):
i = 0
o = 0
while True:
b = False
for j in range(o, N):
a[j] = a[j] / 2
if a[j].is_integer():
i += 1
b = True
break
else:
o = j
if not b:
break... | def q77(N, a):
i = 0
for b in a:
while True:
b = b / 2
if not b.is_integer():
break
else:
i += 1
return i
N = int(eval(input()))
a = [int(i) for i in input().split()]
print((q77(N, a)))
| false | 31.818182 | [
"-import math",
"-",
"-",
"- o = 0",
"- while True:",
"- b = False",
"- for j in range(o, N):",
"- a[j] = a[j] / 2",
"- if a[j].is_integer():",
"- i += 1",
"- b = True",
"+ for b in a:",
"+ while True:",
"+ ... | false | 0.037399 | 0.041119 | 0.909532 | [
"s554945912",
"s746219709"
] |
u797550216 | p03163 | python | s168382866 | s361884048 | 576 | 203 | 121,068 | 92,120 | Accepted | Accepted | 64.76 | n,w = list(map(int,input().split()))
items = [list(map(int,input().split())) for i in range(n)]
dp = [[0]*(w+1) for i in range(n+1)]
for i in range(n):
for j in range(w+1):
if j >= items[i][0]:
dp[i+1][j] = max(dp[i+1][j], dp[i][j-items[i][0]] + items[i][1])
dp... | import numpy as np
n, w = list(map(int, input().split()))
l = [list(map(int,input().split())) for i in range(n)]
dp = np.zeros((n + 1, w + 1), dtype=np.int64)
for i in range(n):
tmp = np.zeros(w + 1, dtype=int)
tmp[l[i][0]:] = dp[i][:-l[i][0]] + l[i][1]
dp[i + 1] = np.maximum(dp[i], tmp)
... | 14 | 14 | 369 | 332 | n, w = list(map(int, input().split()))
items = [list(map(int, input().split())) for i in range(n)]
dp = [[0] * (w + 1) for i in range(n + 1)]
for i in range(n):
for j in range(w + 1):
if j >= items[i][0]:
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - items[i][0]] + items[i][1])
dp[i + 1][j]... | import numpy as np
n, w = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
dp = np.zeros((n + 1, w + 1), dtype=np.int64)
for i in range(n):
tmp = np.zeros(w + 1, dtype=int)
tmp[l[i][0] :] = dp[i][: -l[i][0]] + l[i][1]
dp[i + 1] = np.maximum(dp[i], tmp)
print((dp[n][w]... | false | 0 | [
"+import numpy as np",
"+",
"-items = [list(map(int, input().split())) for i in range(n)]",
"-dp = [[0] * (w + 1) for i in range(n + 1)]",
"+l = [list(map(int, input().split())) for i in range(n)]",
"+dp = np.zeros((n + 1, w + 1), dtype=np.int64)",
"- for j in range(w + 1):",
"- if j >= item... | false | 0.139852 | 0.608661 | 0.229769 | [
"s168382866",
"s361884048"
] |
u691018832 | p03141 | python | s322074809 | s261355265 | 267 | 195 | 31,792 | 7,448 | Accepted | Accepted | 26.97 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
ab = [list(map(int, readline().split())) for i in range(n)]
memo = [0] * n
ans = 0
for i, ab_ in enumerate(ab):
memo[i] = ab_[0] + ab_[1]... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
ab = []
ans = 0
for _ in range(n):
a, b = list(map(int, readline().split()))
ab.append(a + b)
ans -= b
ab.sort(reverse=True)
a... | 18 | 16 | 441 | 345 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
ab = [list(map(int, readline().split())) for i in range(n)]
memo = [0] * n
ans = 0
for i, ab_ in enumerate(ab):
memo[i] = ab_[0] + ab_[1]
ans -= a... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
ab = []
ans = 0
for _ in range(n):
a, b = list(map(int, readline().split()))
ab.append(a + b)
ans -= b
ab.sort(reverse=True)
ans += sum(ab[::2... | false | 11.111111 | [
"-ab = [list(map(int, readline().split())) for i in range(n)]",
"-memo = [0] * n",
"+ab = []",
"-for i, ab_ in enumerate(ab):",
"- memo[i] = ab_[0] + ab_[1]",
"- ans -= ab_[1]",
"-memo.sort(reverse=True)",
"-for i in range(n):",
"- if i % 2 == 0:",
"- ans += memo[i]",
"+for _ in ... | false | 0.032867 | 0.035426 | 0.927755 | [
"s322074809",
"s261355265"
] |
u530383736 | p03485 | python | s306962858 | s125418064 | 38 | 17 | 5,076 | 2,940 | Accepted | Accepted | 55.26 | # -*- coding: utf-8 -*-
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
nums = list(map(int, input().rstrip().split()))
#----------
average = (nums[0] + nums[1]) / 2
print(( Decimal(str(average)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)))
| # -*- coding: utf-8 -*-
a,b = [int(i) for i in input().rstrip().split()]
print(( ((a+b) + (2-1)) // 2 ))
| 9 | 4 | 266 | 107 | # -*- coding: utf-8 -*-
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
nums = list(map(int, input().rstrip().split()))
# ----------
average = (nums[0] + nums[1]) / 2
print((Decimal(str(average)).quantize(Decimal("0"), rounding=ROUND_HALF_UP)))
| # -*- coding: utf-8 -*-
a, b = [int(i) for i in input().rstrip().split()]
print((((a + b) + (2 - 1)) // 2))
| false | 55.555556 | [
"-from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN",
"-",
"-nums = list(map(int, input().rstrip().split()))",
"-average = (nums[0] + nums[1]) / 2",
"-print((Decimal(str(average)).quantize(Decimal(\"0\"), rounding=ROUND_HALF_UP)))",
"+a, b = [int(i) for i in input().rstrip().split()]",
"+print... | false | 0.043833 | 0.042326 | 1.035622 | [
"s306962858",
"s125418064"
] |
u027685417 | p03013 | python | s824840468 | s219329932 | 380 | 179 | 460,020 | 6,900 | Accepted | Accepted | 52.89 | n, m = list(map(int, input().split()))
S = [1] * (n + 1)
for _ in range(m):
a = int(eval(input()))
S[a] = 0
i = -3
for _ in range(n - 1):
if S[i] != 0:
S[i] = S[i + 1] + S[i + 2]
i -= 1
ans = S[0] % (10**9 + 7)
print(ans)
| n, m = list(map(int, input().split()))
S = [1] * (n + 1)
for _ in range(m):
a = int(eval(input()))
S[a] = 0
mod = 10**9 + 7
for i in range(2, n + 1):
if S[i] != 0:
S[i] = (S[i - 1] + S[i - 2]) % mod
ans = S[n]
print(ans)
| 15 | 14 | 251 | 245 | n, m = list(map(int, input().split()))
S = [1] * (n + 1)
for _ in range(m):
a = int(eval(input()))
S[a] = 0
i = -3
for _ in range(n - 1):
if S[i] != 0:
S[i] = S[i + 1] + S[i + 2]
i -= 1
ans = S[0] % (10**9 + 7)
print(ans)
| n, m = list(map(int, input().split()))
S = [1] * (n + 1)
for _ in range(m):
a = int(eval(input()))
S[a] = 0
mod = 10**9 + 7
for i in range(2, n + 1):
if S[i] != 0:
S[i] = (S[i - 1] + S[i - 2]) % mod
ans = S[n]
print(ans)
| false | 6.666667 | [
"-i = -3",
"-for _ in range(n - 1):",
"+mod = 10**9 + 7",
"+for i in range(2, n + 1):",
"- S[i] = S[i + 1] + S[i + 2]",
"- i -= 1",
"-ans = S[0] % (10**9 + 7)",
"+ S[i] = (S[i - 1] + S[i - 2]) % mod",
"+ans = S[n]"
] | false | 0.037787 | 0.041047 | 0.920577 | [
"s824840468",
"s219329932"
] |
u816631826 | p02766 | python | s327495655 | s775777070 | 170 | 25 | 38,448 | 3,772 | Accepted | Accepted | 85.29 | import math
number,base=input().split()
num=int(number)
bas=int(base)
converted=0
reminder=0
i=0
#counter=0
while num!=0:
reminder=num%bas
num=num//bas
converted=converted+reminder*10**i
i+=1
#print(converted)
#To convert integer into string
y=str(converted)
print((len(y))) | import string
d = string.digits + string.ascii_letters
def con(x, base):
if x < 0:
sign = -1
elif x == 0:
return d[0]
else:
sign = 1
x *= sign
digits = []
while x:
digits.append(d[int(x % base)])
x = int(x / base)
if sign < 0:
... | 18 | 26 | 306 | 466 | import math
number, base = input().split()
num = int(number)
bas = int(base)
converted = 0
reminder = 0
i = 0
# counter=0
while num != 0:
reminder = num % bas
num = num // bas
converted = converted + reminder * 10**i
i += 1
# print(converted)
# To convert integer into string
y = str(converted)
print((l... | import string
d = string.digits + string.ascii_letters
def con(x, base):
if x < 0:
sign = -1
elif x == 0:
return d[0]
else:
sign = 1
x *= sign
digits = []
while x:
digits.append(d[int(x % base)])
x = int(x / base)
if sign < 0:
digits.append(... | false | 30.769231 | [
"-import math",
"+import string",
"-number, base = input().split()",
"-num = int(number)",
"-bas = int(base)",
"-converted = 0",
"-reminder = 0",
"-i = 0",
"-# counter=0",
"-while num != 0:",
"- reminder = num % bas",
"- num = num // bas",
"- converted = converted + reminder * 10**i... | false | 0.046004 | 0.046287 | 0.993899 | [
"s327495655",
"s775777070"
] |
u102126195 | p02786 | python | s175829636 | s384164158 | 179 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.5 | h = int(eval(input()))
cnt = 0
while h > 0:
if h == 1:
cnt += 1
break
else:
h //= 2
cnt += 1
print((2 ** cnt - 1)) | import math
h = int(eval(input()))
# cnt = 0
# while h > 0:
# if h == 1:
# cnt += 1
# break
# else:
# h //= 2
# cnt += 1
ans = math.log2(h)
ans = int(ans)
#
# print(2 ** cnt - 1)
print((2 ** (int(ans) + 1) - 1)) | 11 | 16 | 157 | 259 | h = int(eval(input()))
cnt = 0
while h > 0:
if h == 1:
cnt += 1
break
else:
h //= 2
cnt += 1
print((2**cnt - 1))
| import math
h = int(eval(input()))
# cnt = 0
# while h > 0:
# if h == 1:
# cnt += 1
# break
# else:
# h //= 2
# cnt += 1
ans = math.log2(h)
ans = int(ans)
#
# print(2 ** cnt - 1)
print((2 ** (int(ans) + 1) - 1))
| false | 31.25 | [
"+import math",
"+",
"-cnt = 0",
"-while h > 0:",
"- if h == 1:",
"- cnt += 1",
"- break",
"- else:",
"- h //= 2",
"- cnt += 1",
"-print((2**cnt - 1))",
"+# cnt = 0",
"+# while h > 0:",
"+# if h == 1:",
"+# cnt += 1",
"+# break",
... | false | 0.046168 | 0.0464 | 0.99499 | [
"s175829636",
"s384164158"
] |
u955248595 | p03456 | python | s235291928 | s776683270 | 27 | 23 | 9,044 | 9,028 | Accepted | Accepted | 14.81 | import math
A,B = input().split()
Num = int(A+B)
SqN = math.sqrt(Num)
Flag = False
for T in range(math.floor(SqN),math.ceil(SqN)+1):
if T*T==Num:
Flag = True
break
if Flag:
print('Yes')
else:
print('No') | import math
A,B = input().split()
Num = int(A+B)
SqN = math.sqrt(Num)
if math.floor(SqN)**2==Num or math.ceil(SqN)**2==Num:
print('Yes')
else:
print('No') | 13 | 8 | 243 | 169 | import math
A, B = input().split()
Num = int(A + B)
SqN = math.sqrt(Num)
Flag = False
for T in range(math.floor(SqN), math.ceil(SqN) + 1):
if T * T == Num:
Flag = True
break
if Flag:
print("Yes")
else:
print("No")
| import math
A, B = input().split()
Num = int(A + B)
SqN = math.sqrt(Num)
if math.floor(SqN) ** 2 == Num or math.ceil(SqN) ** 2 == Num:
print("Yes")
else:
print("No")
| false | 38.461538 | [
"-Flag = False",
"-for T in range(math.floor(SqN), math.ceil(SqN) + 1):",
"- if T * T == Num:",
"- Flag = True",
"- break",
"-if Flag:",
"+if math.floor(SqN) ** 2 == Num or math.ceil(SqN) ** 2 == Num:"
] | false | 0.040404 | 0.042633 | 0.947718 | [
"s235291928",
"s776683270"
] |
u281303342 | p03544 | python | s211061550 | s523582687 | 22 | 18 | 3,060 | 3,060 | Accepted | Accepted | 18.18 | N = int(eval(input()))
dp = [0]*87
dp[0],dp[1] = 2,1
for i in range(2,87):
dp[i] = dp[i-1]+dp[i-2]
print((dp[N])) | # atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7
# main
N = int(eval(input()))
num = [2,1]
for i in range(N):
num.append(num[-2]+num[-1])
print((num[N])) | 9 | 14 | 120 | 225 | N = int(eval(input()))
dp = [0] * 87
dp[0], dp[1] = 2, 1
for i in range(2, 87):
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[N]))
| # atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9 + 7
# main
N = int(eval(input()))
num = [2, 1]
for i in range(N):
num.append(num[-2] + num[-1])
print((num[N]))
| false | 35.714286 | [
"+# atcoder : python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**6)",
"+mod = 10**9 + 7",
"+# main",
"-dp = [0] * 87",
"-dp[0], dp[1] = 2, 1",
"-for i in range(2, 87):",
"- dp[i] = dp[i - 1] + dp[i - 2]",
"-print((dp[N]))",
"+num = [2, 1]",
... | false | 0.034248 | 0.03517 | 0.973791 | [
"s211061550",
"s523582687"
] |
u835534360 | p03168 | python | s092721691 | s088118601 | 291 | 93 | 223,880 | 69,128 | Accepted | Accepted | 68.04 | import sys
def main():
N=int(sys.stdin.readline())
p=[float(x) for x in sys.stdin.readline().split()]
dp=[[0 for _ in range(N+1)] for _ in range(N+1)]
dp[0][0]=1.0
for i in range(1,N+1):
dp[i][0]=dp[i-1][0]*(1-p[i-1])
for j in range(1,i+1):dp[i][j]=dp[i-1][j-1]*p[i-1]+dp[i-1]... | import sys
def main():
N=int(sys.stdin.readline())
p=[float(x) for x in sys.stdin.readline().split()]
dp=[0 for _ in range(N+1)]
dp[0]=1.0
for i in range(1,N+1):
for j in range(i,0,-1):dp[j]=dp[j-1]*p[i-1]+dp[j]*(1-p[i-1])
dp[0]=dp[0]*(1-p[i-1])
print((sum(dp[N//2+1:])))... | 11 | 11 | 399 | 351 | import sys
def main():
N = int(sys.stdin.readline())
p = [float(x) for x in sys.stdin.readline().split()]
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0] = 1.0
for i in range(1, N + 1):
dp[i][0] = dp[i - 1][0] * (1 - p[i - 1])
for j in range(1, i + 1):
d... | import sys
def main():
N = int(sys.stdin.readline())
p = [float(x) for x in sys.stdin.readline().split()]
dp = [0 for _ in range(N + 1)]
dp[0] = 1.0
for i in range(1, N + 1):
for j in range(i, 0, -1):
dp[j] = dp[j - 1] * p[i - 1] + dp[j] * (1 - p[i - 1])
dp[0] = dp[0] *... | false | 0 | [
"- dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]",
"- dp[0][0] = 1.0",
"+ dp = [0 for _ in range(N + 1)]",
"+ dp[0] = 1.0",
"- dp[i][0] = dp[i - 1][0] * (1 - p[i - 1])",
"- for j in range(1, i + 1):",
"- dp[i][j] = dp[i - 1][j - 1] * p[i - 1] + dp[i - 1][j] ... | false | 0.043401 | 0.036886 | 1.176644 | [
"s092721691",
"s088118601"
] |
u914948583 | p02702 | python | s700644531 | s906590976 | 339 | 305 | 9,252 | 9,332 | Accepted | Accepted | 10.03 | S=eval(input())
N=len(S)
M=2019
remainder=[0]*M
val=0
for i in range(N):
val=(int(S[N-1-i])*pow(10,i,M)+val)%M
remainder[val]+=1
ans=remainder[0]
for i in range(2019):
ans+=remainder[i]*(remainder[i]-1)//2
print(ans)
| def solve():
s = eval(input())
n = len(s)
mod = 2019
reminder = [0]*mod
pre_rem = 0
for i in range(n):
pre_rem = (int(s[n-i-1])*pow(10, i, mod) + pre_rem) % mod
reminder[pre_rem] += 1
ans = reminder[0]
for rem_num in reminder:
if rem_num >= 2:
... | 14 | 19 | 232 | 389 | S = eval(input())
N = len(S)
M = 2019
remainder = [0] * M
val = 0
for i in range(N):
val = (int(S[N - 1 - i]) * pow(10, i, M) + val) % M
remainder[val] += 1
ans = remainder[0]
for i in range(2019):
ans += remainder[i] * (remainder[i] - 1) // 2
print(ans)
| def solve():
s = eval(input())
n = len(s)
mod = 2019
reminder = [0] * mod
pre_rem = 0
for i in range(n):
pre_rem = (int(s[n - i - 1]) * pow(10, i, mod) + pre_rem) % mod
reminder[pre_rem] += 1
ans = reminder[0]
for rem_num in reminder:
if rem_num >= 2:
... | false | 26.315789 | [
"-S = eval(input())",
"-N = len(S)",
"-M = 2019",
"-remainder = [0] * M",
"-val = 0",
"-for i in range(N):",
"- val = (int(S[N - 1 - i]) * pow(10, i, M) + val) % M",
"- remainder[val] += 1",
"-ans = remainder[0]",
"-for i in range(2019):",
"- ans += remainder[i] * (remainder[i] - 1) // ... | false | 0.086016 | 0.0441 | 1.950492 | [
"s700644531",
"s906590976"
] |
u692746605 | p02642 | python | s244242029 | s813154666 | 230 | 201 | 40,188 | 40,120 | Accepted | Accepted | 12.61 | def main():
N=int(eval(input()))
D=[0]*(10**6+1)
for a in sorted(map(int,input().split())):
if D[a]==0:
D[a]=1
for i in range(2*a,10**6+1,a):
D[i]=-1
else:
D[a]=-1
print((D.count(1)))
main()
| def main():
N=int(eval(input()))
D=[0]*(10**6+1)
A=sorted(map(int,input().split()))
m=max(A)+1
for a in A:
if D[a]==0:
D[a]=1
for i in range(2*a,m,a):
D[i]=-1
else:
D[a]=-1
print((D.count(1)))
main()
| 15 | 17 | 242 | 257 | def main():
N = int(eval(input()))
D = [0] * (10**6 + 1)
for a in sorted(map(int, input().split())):
if D[a] == 0:
D[a] = 1
for i in range(2 * a, 10**6 + 1, a):
D[i] = -1
else:
D[a] = -1
print((D.count(1)))
main()
| def main():
N = int(eval(input()))
D = [0] * (10**6 + 1)
A = sorted(map(int, input().split()))
m = max(A) + 1
for a in A:
if D[a] == 0:
D[a] = 1
for i in range(2 * a, m, a):
D[i] = -1
else:
D[a] = -1
print((D.count(1)))
main()... | false | 11.764706 | [
"- for a in sorted(map(int, input().split())):",
"+ A = sorted(map(int, input().split()))",
"+ m = max(A) + 1",
"+ for a in A:",
"- for i in range(2 * a, 10**6 + 1, a):",
"+ for i in range(2 * a, m, a):"
] | false | 0.092232 | 0.062118 | 1.484782 | [
"s244242029",
"s813154666"
] |
u408620326 | p03478 | python | s879694385 | s245923988 | 223 | 38 | 42,604 | 3,060 | Accepted | Accepted | 82.96 | N,A,B=[int(x) for x in input().split()]
res=0
for i in range(1,N+1):
t=sum([int(x) for x in list(str(i))])
if t>=A and t<=B:
res+=i
print(res) | N,A,B=[int(x) for x in input().split()]
res=0
for i in range(1,N+1):
t=sum([int(x) for x in list(str(i))])
if A<=t<=B:
res+=i
print(res) | 7 | 7 | 156 | 150 | N, A, B = [int(x) for x in input().split()]
res = 0
for i in range(1, N + 1):
t = sum([int(x) for x in list(str(i))])
if t >= A and t <= B:
res += i
print(res)
| N, A, B = [int(x) for x in input().split()]
res = 0
for i in range(1, N + 1):
t = sum([int(x) for x in list(str(i))])
if A <= t <= B:
res += i
print(res)
| false | 0 | [
"- if t >= A and t <= B:",
"+ if A <= t <= B:"
] | false | 0.035206 | 0.035959 | 0.979053 | [
"s879694385",
"s245923988"
] |
u840310460 | p02713 | python | s952843417 | s175412409 | 1,968 | 1,402 | 9,172 | 69,224 | Accepted | Accepted | 28.76 | from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for l in range(1, K + 1):
ans += gcd(i, gcd(j, l))
print(ans)
| K = int(eval(input()))
def func_gcd(a, b):
if b > a:
a, b = b, a
while b > 0:
r = a % b
a = b
b = r
return a
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for l in range(1, K + 1):
temp = func_gcd(j, l)
... | 11 | 22 | 224 | 382 | from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for l in range(1, K + 1):
ans += gcd(i, gcd(j, l))
print(ans)
| K = int(eval(input()))
def func_gcd(a, b):
if b > a:
a, b = b, a
while b > 0:
r = a % b
a = b
b = r
return a
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for l in range(1, K + 1):
temp = func_gcd(j, l)
temp2 = func_gcd(i,... | false | 50 | [
"-from math import gcd",
"+K = int(eval(input()))",
"-K = int(eval(input()))",
"+",
"+def func_gcd(a, b):",
"+ if b > a:",
"+ a, b = b, a",
"+ while b > 0:",
"+ r = a % b",
"+ a = b",
"+ b = r",
"+ return a",
"+",
"+",
"- ans += gcd(i, gcd(... | false | 0.114891 | 0.040376 | 2.845535 | [
"s952843417",
"s175412409"
] |
u687044304 | p03031 | python | s687561097 | s985571702 | 46 | 33 | 3,568 | 3,444 | Accepted | Accepted | 28.26 | # -*- coding:utf-8 -*-
from itertools import combinations
import copy
def solve():
N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
_in = list(map(int, input().split()))
K.append(_in[0])
S.append(_in[1:])
P = list(map(int, input().split()))... | # -*- coding:utf-8 -*-
from itertools import combinations
import copy
def solve2():
"""
itertools.productを使えばもっとすっきり?
"""
import itertools as it
N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
_in = list(map(int, input().split()))
K.... | 46 | 84 | 1,198 | 2,082 | # -*- coding:utf-8 -*-
from itertools import combinations
import copy
def solve():
N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
_in = list(map(int, input().split()))
K.append(_in[0])
S.append(_in[1:])
P = list(map(int, input().split()))
def d... | # -*- coding:utf-8 -*-
from itertools import combinations
import copy
def solve2():
"""
itertools.productを使えばもっとすっきり?
"""
import itertools as it
N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
_in = list(map(int, input().split()))
K.append(_in[0... | false | 45.238095 | [
"+",
"+",
"+def solve2():",
"+ \"\"\"",
"+ itertools.productを使えばもっとすっきり?",
"+ \"\"\"",
"+ import itertools as it",
"+",
"+ N, M = list(map(int, input().split()))",
"+ K = []",
"+ S = []",
"+ for i in range(M):",
"+ _in = list(map(int, input().split()))",
"+ ... | false | 0.056457 | 0.086258 | 0.654506 | [
"s687561097",
"s985571702"
] |
u377989038 | p03294 | python | s243462985 | s123792439 | 176 | 18 | 5,344 | 3,316 | Accepted | Accepted | 89.77 | import fractions
n = int(eval(input()))
a = list(map(int, input().split()))
lcm = a[0]
for i in a:
lcm = lcm * i // fractions.gcd(lcm, i)
ans = 0
for i in a:
ans += (lcm-1) % i
print((int(ans)))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
ans += i - 1
print(ans) | 13 | 7 | 210 | 107 | import fractions
n = int(eval(input()))
a = list(map(int, input().split()))
lcm = a[0]
for i in a:
lcm = lcm * i // fractions.gcd(lcm, i)
ans = 0
for i in a:
ans += (lcm - 1) % i
print((int(ans)))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
ans += i - 1
print(ans)
| false | 46.153846 | [
"-import fractions",
"-",
"-lcm = a[0]",
"-for i in a:",
"- lcm = lcm * i // fractions.gcd(lcm, i)",
"- ans += (lcm - 1) % i",
"-print((int(ans)))",
"+ ans += i - 1",
"+print(ans)"
] | false | 0.089437 | 0.036848 | 2.427207 | [
"s243462985",
"s123792439"
] |
u102445737 | p03464 | python | s059777892 | s297235744 | 354 | 237 | 87,528 | 63,856 | Accepted | Accepted | 33.05 | from sys import stdout
import sys,resource
printn = lambda x: stdout.write(x)
inn = lambda : int(eval(input()))
inl = lambda: list(map(int, input().split()))
inm = lambda: list(map(int, input().split()))
DBG = True and False
BIG = 999999999
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
... | from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(eval(input()))
inl = lambda: list(map(int, input().split()))
inm = lambda: list(map(int, input().split()))
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7
def ddprint(x):
if DBG:
... | 32 | 27 | 627 | 619 | from sys import stdout
import sys, resource
printn = lambda x: stdout.write(x)
inn = lambda: int(eval(input()))
inl = lambda: list(map(int, input().split()))
inm = lambda: list(map(int, input().split()))
DBG = True and False
BIG = 999999999
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
k = inn()
a = i... | from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda: int(eval(input()))
inl = lambda: list(map(int, input().split()))
inm = lambda: list(map(int, input().split()))
ins = lambda: input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
... | false | 15.625 | [
"-import sys, resource",
"-printn = lambda x: stdout.write(x)",
"+printn = lambda x: stdout.write(str(x))",
"-DBG = True and False",
"+ins = lambda: input().strip()",
"+DBG = True # and False",
"-if k == 1:",
"- if a[0] == 2:",
"- print(\"2 3\")",
"- else:",
"- print((-1))",... | false | 0.046269 | 0.04426 | 1.04539 | [
"s059777892",
"s297235744"
] |
u174603263 | p03221 | python | s209446007 | s874416047 | 1,088 | 619 | 49,004 | 42,564 | Accepted | Accepted | 43.11 | import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercas... | import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercas... | 56 | 56 | 1,098 | 1,095 | import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digi... | import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digi... | false | 0 | [
"-lis = deepcopy(py)",
"+lis = py.copy()"
] | false | 0.036986 | 0.079529 | 0.465069 | [
"s209446007",
"s874416047"
] |
u203843959 | p03221 | python | s095456019 | s094698978 | 802 | 677 | 70,968 | 47,296 | Accepted | Accepted | 15.59 | N,M=list(map(int,input().split()))
yp_dic={}
yplist=[]
for i in range(M):
p,y=list(map(int,input().split()))
if p not in yp_dic:
yp_dic[p]=[]
yp_dic[p].append(y)
yplist.append((y,p))
for key in yp_dic:
yp_dic[key].sort()
#print(yp_dic)
all_dic={}
for pref,ylist in list(yp_dic.items()):
... | N,M=list(map(int,input().split()))
yp_dic={}
yplist=[]
for i in range(M):
p,y=list(map(int,input().split()))
if p not in yp_dic:
yp_dic[p]=[]
yp_dic[p].append(y)
yplist.append((y,p))
all_dic={}
for key in yp_dic:
yp_dic[key].sort()
for i,y in enumerate(yp_dic[key]):
all_dic[y]=i+1
... | 27 | 22 | 522 | 430 | N, M = list(map(int, input().split()))
yp_dic = {}
yplist = []
for i in range(M):
p, y = list(map(int, input().split()))
if p not in yp_dic:
yp_dic[p] = []
yp_dic[p].append(y)
yplist.append((y, p))
for key in yp_dic:
yp_dic[key].sort()
# print(yp_dic)
all_dic = {}
for pref, ylist in list(yp_... | N, M = list(map(int, input().split()))
yp_dic = {}
yplist = []
for i in range(M):
p, y = list(map(int, input().split()))
if p not in yp_dic:
yp_dic[p] = []
yp_dic[p].append(y)
yplist.append((y, p))
all_dic = {}
for key in yp_dic:
yp_dic[key].sort()
for i, y in enumerate(yp_dic[key]):
... | false | 18.518519 | [
"+all_dic = {}",
"-# print(yp_dic)",
"-all_dic = {}",
"-for pref, ylist in list(yp_dic.items()):",
"- pref_dic = {}",
"- for i, y in enumerate(ylist):",
"- pref_dic[y] = i + 1",
"- all_dic[pref] = pref_dic",
"+ for i, y in enumerate(yp_dic[key]):",
"+ all_dic[y] = i + 1",... | false | 0.1928 | 0.046158 | 4.176931 | [
"s095456019",
"s094698978"
] |
u941407962 | p03040 | python | s082991169 | s008097145 | 1,668 | 1,234 | 126,040 | 122,332 | Accepted | Accepted | 26.02 | from heapq import *
Q, = list(map(int, input().split()))
qs = []
c = 0
for i in range(Q):
q = input().split()
if len(q) == 1:
c += 1
else:
a, b = int(q[1]), int(q[2])
qs.append((a, b, c, i))
c = 0
if c:
qs.append((a, b, c, i))
R = [10**18]
L = [10**18]
s... | from heapq import *
import sys;input=sys.stdin.readline
Q, = list(map(int, input().split()))
qs = []
c = 0
for i in range(Q):
q = input().split()
if len(q) == 1:
c += 1
else:
a, b = int(q[1]), int(q[2])
qs.append((a, b, c))
c = 0
if c:
qs.append((a, b, c))
... | 45 | 46 | 899 | 927 | from heapq import *
(Q,) = list(map(int, input().split()))
qs = []
c = 0
for i in range(Q):
q = input().split()
if len(q) == 1:
c += 1
else:
a, b = int(q[1]), int(q[2])
qs.append((a, b, c, i))
c = 0
if c:
qs.append((a, b, c, i))
R = [10**18]
L = [10**18]
ss = 0
for a, b,... | from heapq import *
import sys
input = sys.stdin.readline
(Q,) = list(map(int, input().split()))
qs = []
c = 0
for i in range(Q):
q = input().split()
if len(q) == 1:
c += 1
else:
a, b = int(q[1]), int(q[2])
qs.append((a, b, c))
c = 0
if c:
qs.append((a, b, c))
R = [10**1... | false | 2.173913 | [
"+import sys",
"+input = sys.stdin.readline",
"- qs.append((a, b, c, i))",
"+ qs.append((a, b, c))",
"- qs.append((a, b, c, i))",
"+ qs.append((a, b, c))",
"-for a, b, c, i in qs:",
"+for a, b, c in qs:"
] | false | 0.093347 | 0.040235 | 2.320084 | [
"s082991169",
"s008097145"
] |
u807028974 | p02629 | python | s921070890 | s871429143 | 69 | 29 | 61,868 | 9,056 | Accepted | Accepted | 57.97 | # import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
# combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operato... | n = int(eval(input()))
s = []
while n!=0:
if n<=26:
s.append(n)
n = 0
else:
x = n % 26
if not x:
x = 26
s.append(x)
n = (n - 1) // 26
t = []
for i in range(len(s)-1,-1,-1):
t.append(chr(s[i]+96))
print((''.join(t))) | 43 | 16 | 947 | 294 | # import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
# combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import it... | n = int(eval(input()))
s = []
while n != 0:
if n <= 26:
s.append(n)
n = 0
else:
x = n % 26
if not x:
x = 26
s.append(x)
n = (n - 1) // 26
t = []
for i in range(len(s) - 1, -1, -1):
t.append(chr(s[i] + 96))
print(("".join(t)))
| false | 62.790698 | [
"-# import sys",
"-# import math #sqrt,gcd,pi",
"-# import decimal",
"-# import queue # queue",
"-# import bisect",
"-# import heapq # priolity-queue",
"-# import time",
"-# from itertools import product,permutations,\\",
"-# combinations,combinations_with_replacement",
"-# 重複あり順列、順列、組み合わせ、重複あ... | false | 0.082029 | 0.080019 | 1.025126 | [
"s921070890",
"s871429143"
] |
u803617136 | p02953 | python | s245644327 | s468804851 | 223 | 57 | 63,984 | 14,396 | Accepted | Accepted | 74.44 | N = int(eval(input()))
h = list(map(int, input().split()))[::-1]
f = [0] * N
ans = 'Yes'
last = 10 ** 10
for hi in h:
if last >= hi:
last = hi
elif last >= hi - 1:
last = hi - 1
else:
ans = 'No'
print(ans)
| N = int(eval(input()))
H = list(map(int, input().split()))[::-1]
last = 10 ** 10
ans = 'Yes'
for hi in H:
if last >= hi:
last = hi
elif last >= hi - 1:
last = hi - 1
else:
ans = 'No'
print(ans)
| 13 | 12 | 248 | 235 | N = int(eval(input()))
h = list(map(int, input().split()))[::-1]
f = [0] * N
ans = "Yes"
last = 10**10
for hi in h:
if last >= hi:
last = hi
elif last >= hi - 1:
last = hi - 1
else:
ans = "No"
print(ans)
| N = int(eval(input()))
H = list(map(int, input().split()))[::-1]
last = 10**10
ans = "Yes"
for hi in H:
if last >= hi:
last = hi
elif last >= hi - 1:
last = hi - 1
else:
ans = "No"
print(ans)
| false | 7.692308 | [
"-h = list(map(int, input().split()))[::-1]",
"-f = [0] * N",
"+H = list(map(int, input().split()))[::-1]",
"+last = 10**10",
"-last = 10**10",
"-for hi in h:",
"+for hi in H:"
] | false | 0.037484 | 0.037268 | 1.005799 | [
"s245644327",
"s468804851"
] |
u760248716 | p03911 | python | s046137315 | s359007790 | 872 | 804 | 172,296 | 147,844 | Accepted | Accepted | 7.8 | from networkx import*
print(('NYOE S'[is_connected(Graph((i,j)for i,t in[*enumerate(open(0))][1:]for j in t.split()[1:]))::2])) | from networkx import*
print(('NYOE S'[is_connected(Graph((t,j)for t in[*open(0)][1:]for j in t.split()[1:]))::2])) | 2 | 2 | 126 | 113 | from networkx import *
print(
(
"NYOE S"[
is_connected(
Graph(
(i, j) for i, t in [*enumerate(open(0))][1:] for j in t.split()[1:]
)
) :: 2
]
)
)
| from networkx import *
print(
(
"NYOE S"[
is_connected(
Graph((t, j) for t in [*open(0)][1:] for j in t.split()[1:])
) :: 2
]
)
)
| false | 0 | [
"- Graph(",
"- (i, j) for i, t in [*enumerate(open(0))][1:] for j in t.split()[1:]",
"- )",
"+ Graph((t, j) for t in [*open(0)][1:] for j in t.split()[1:])"
] | false | 0.045435 | 0.047537 | 0.955766 | [
"s046137315",
"s359007790"
] |
u436519884 | p03163 | python | s747945046 | s015478933 | 535 | 154 | 217,860 | 73,688 | Accepted | Accepted | 71.21 | # what is dp relation
# dp[n][w]=max(dp[n-1][w-wt[n]]+p[n],dp[n-1][w])
n,W=list(map(int,input().split()))
wt,p=[],[]
for _ in range(n):
a,b=list(map(int,input().split()))
wt.append(a)
p.append(b)
dp=[[0 for i in range(W+1)]for j in range(n+1)]
for x in range(1,n+1):
for y in range(1,W+1):
... | n,W=list(map(int,input().split()))
wt,p=[],[]
for _ in range(n):
a,b=list(map(int,input().split()))
wt.append(a)
p.append(b)
dp=[0 for i in range(W+1)]
for x in range(1,n+1):
for y in range(W,0,-1):
if wt[x-1]<=y:
dp[y]=max(dp[y-wt[x-1]]+p[x-1],dp[y])
else:
... | 17 | 17 | 461 | 334 | # what is dp relation
# dp[n][w]=max(dp[n-1][w-wt[n]]+p[n],dp[n-1][w])
n, W = list(map(int, input().split()))
wt, p = [], []
for _ in range(n):
a, b = list(map(int, input().split()))
wt.append(a)
p.append(b)
dp = [[0 for i in range(W + 1)] for j in range(n + 1)]
for x in range(1, n + 1):
for y in range(... | n, W = list(map(int, input().split()))
wt, p = [], []
for _ in range(n):
a, b = list(map(int, input().split()))
wt.append(a)
p.append(b)
dp = [0 for i in range(W + 1)]
for x in range(1, n + 1):
for y in range(W, 0, -1):
if wt[x - 1] <= y:
dp[y] = max(dp[y - wt[x - 1]] + p[x - 1], dp[... | false | 0 | [
"-# what is dp relation",
"-# dp[n][w]=max(dp[n-1][w-wt[n]]+p[n],dp[n-1][w])",
"-dp = [[0 for i in range(W + 1)] for j in range(n + 1)]",
"+dp = [0 for i in range(W + 1)]",
"- for y in range(1, W + 1):",
"+ for y in range(W, 0, -1):",
"- dp[x][y] = max(dp[x - 1][y - wt[x - 1]] + p[x - 1... | false | 0.035507 | 0.038446 | 0.92356 | [
"s747945046",
"s015478933"
] |
u102461423 | p03216 | python | s441178074 | s365765332 | 1,946 | 1,611 | 71,552 | 63,324 | Accepted | Accepted | 17.21 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(readline().rstrip(),'S1')
Q = int(readline())
query = list(map(int,read().split()))
isD = S == b'D'
isM = S == b'M'
isC = S == b'C... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(readline().rstrip(),'S1')
Q = int(readline())
query = list(map(int,read().split()))
isD = S == b'D'
isM = S == b'M'
isC = S == b'C... | 37 | 37 | 859 | 860 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(readline().rstrip(), "S1")
Q = int(readline())
query = list(map(int, read().split()))
isD = S == b"D"
isM = S == b"M"
isC = S == b"C"
cumD = isD.... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(readline().rstrip(), "S1")
Q = int(readline())
query = list(map(int, read().split()))
isD = S == b"D"
isM = S == b"M"
isC = S == b"C"
cumD = isD.... | false | 0 | [
"- return DM[isC].sum()",
"+ return (DM * isC).sum()"
] | false | 0.304688 | 0.277532 | 1.097846 | [
"s441178074",
"s365765332"
] |
u411923565 | p03329 | python | s874840656 | s120215043 | 1,273 | 1,150 | 9,428 | 106,448 | Accepted | Accepted | 9.66 | # C - Strange Bank
import math
N = int(eval(input()))
INF = 10**10
dp = [0]*(N+1)
for i in range(N+1):
dp[i] = INF
dp[0] = 0
W = [1,6,9]
# dp{N} に最小値を記録する
# 今の金額
for v in range(1,N+1):
for w in range(3):
for x in range(int(math.log(N+1,6))+1):
# 選ぶ数
n = W... | import sys
import math
sys.setrecursionlimit(10**6)
N = int(eval(input()))
INF = 10**10
dp = [0]*(N+1)
for i in range(N+1):
dp[i] = INF
W = [1,6,9]
def rec(v):
if dp[v] < INF:
return dp[v]
if v == 0:
dp[v] = 0
return 0
# v-n を再帰
res = INF... | 25 | 35 | 429 | 585 | # C - Strange Bank
import math
N = int(eval(input()))
INF = 10**10
dp = [0] * (N + 1)
for i in range(N + 1):
dp[i] = INF
dp[0] = 0
W = [1, 6, 9]
# dp{N} に最小値を記録する
# 今の金額
for v in range(1, N + 1):
for w in range(3):
for x in range(int(math.log(N + 1, 6)) + 1):
# 選ぶ数
n = W[w] ** x... | import sys
import math
sys.setrecursionlimit(10**6)
N = int(eval(input()))
INF = 10**10
dp = [0] * (N + 1)
for i in range(N + 1):
dp[i] = INF
W = [1, 6, 9]
def rec(v):
if dp[v] < INF:
return dp[v]
if v == 0:
dp[v] = 0
return 0
# v-n を再帰
res = INF
for w in range(3):
... | false | 28.571429 | [
"-# C - Strange Bank",
"+import sys",
"+sys.setrecursionlimit(10**6)",
"-dp[0] = 0",
"-# dp{N} に最小値を記録する",
"-# 今の金額",
"-for v in range(1, N + 1):",
"+",
"+",
"+def rec(v):",
"+ if dp[v] < INF:",
"+ return dp[v]",
"+ if v == 0:",
"+ dp[v] = 0",
"+ return 0",
"... | false | 0.534405 | 0.159616 | 3.348071 | [
"s874840656",
"s120215043"
] |
u366963613 | p02596 | python | s710190733 | s310810201 | 502 | 366 | 42,076 | 42,392 | Accepted | Accepted | 27.09 | # -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)
# lis_of_lis = [[] for _ in range(N)]
def zz()... | # -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)
# lis_of_lis = [[] for _ in range(N)]
def zz()... | 55 | 55 | 905 | 903 | # -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)
# lis_of_lis = [[] for _ in range(N)]
def zz():
return list(... | # -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)
# lis_of_lis = [[] for _ in range(N)]
def zz():
return list(... | false | 0 | [
"-for i in range(1, K * 2):",
"+for i in range(1, K + 1):"
] | false | 0.2211 | 0.086362 | 2.560156 | [
"s710190733",
"s310810201"
] |
u761529120 | p02936 | python | s708393471 | s202897479 | 1,762 | 797 | 230,928 | 93,588 | Accepted | Accepted | 54.77 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def dfs(v, p, tree, ans):
for u in tree[v]:
if u == p:
continue
ans[u] += ans[v]
dfs(u, v, tree, ans)
def main():
N, Q = list(map(int, input().split()))
tree = [[] for _ in range(N)]
fo... | import sys
from collections import deque
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
tree = [[] for _ in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append(b)
tree[b... | 31 | 37 | 642 | 756 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def dfs(v, p, tree, ans):
for u in tree[v]:
if u == p:
continue
ans[u] += ans[v]
dfs(u, v, tree, ans)
def main():
N, Q = list(map(int, input().split()))
tree = [[] for _ in range(N)]
for i in rang... | import sys
from collections import deque
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
tree = [[] for _ in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
... | false | 16.216216 | [
"+from collections import deque",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-def dfs(v, p, tree, ans):",
"- for u in tree[v]:",
"- if u == p:",
"- continue",
"- ans[u] += ans[v]",
"- dfs(u, v, tree, ans)",
"- dfs(0, -1, tree, ans)",
"+ visited = [Fals... | false | 0.031131 | 0.036348 | 0.856464 | [
"s708393471",
"s202897479"
] |
u580093517 | p02990 | python | s684884906 | s158093558 | 880 | 202 | 15,384 | 3,316 | Accepted | Accepted | 77.05 | n,k = list(map(int, input().split()))
mod = 10**9+7
from scipy.misc import comb
for i in range(1,k+1):
print(((comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True))%mod)) | from math import factorial
n,k = list(map(int, input().split()))
mod = 10**9+7
def comb(n,r):
return factorial(n) // (factorial(r) * factorial(n - r))
for i in range(1,k+1):
if n -k + 1 >= i :
a = comb(n-k+1,i)
b = comb(k-1,i-1)
print(((a*b)%mod))
else:
print((0)) | 6 | 12 | 169 | 309 | n, k = list(map(int, input().split()))
mod = 10**9 + 7
from scipy.misc import comb
for i in range(1, k + 1):
print(((comb(n - k + 1, i, exact=True) * comb(k - 1, i - 1, exact=True)) % mod))
| from math import factorial
n, k = list(map(int, input().split()))
mod = 10**9 + 7
def comb(n, r):
return factorial(n) // (factorial(r) * factorial(n - r))
for i in range(1, k + 1):
if n - k + 1 >= i:
a = comb(n - k + 1, i)
b = comb(k - 1, i - 1)
print(((a * b) % mod))
else:
... | false | 50 | [
"+from math import factorial",
"+",
"-from scipy.misc import comb",
"+",
"+",
"+def comb(n, r):",
"+ return factorial(n) // (factorial(r) * factorial(n - r))",
"+",
"- print(((comb(n - k + 1, i, exact=True) * comb(k - 1, i - 1, exact=True)) % mod))",
"+ if n - k + 1 >= i:",
"+ a ... | false | 0.655079 | 0.072413 | 9.046436 | [
"s684884906",
"s158093558"
] |
u308787251 | p02712 | python | s953954788 | s783036333 | 183 | 148 | 52,676 | 9,168 | Accepted | Accepted | 19.13 | # 入力N
N = int(eval(input()))
ary2 = []
for x in list(range(1, N + 1, 1)):
if x % 3 != 0 and x % 5 != 0:
ary2.append(x)
print((sum(ary2))) | # 入力N
N = int(eval(input()))
ans = 0
for x in range(1, N + 1):
if x % 3 != 0 and x % 5 != 0:
ans += x
print(ans) | 10 | 10 | 153 | 130 | # 入力N
N = int(eval(input()))
ary2 = []
for x in list(range(1, N + 1, 1)):
if x % 3 != 0 and x % 5 != 0:
ary2.append(x)
print((sum(ary2)))
| # 入力N
N = int(eval(input()))
ans = 0
for x in range(1, N + 1):
if x % 3 != 0 and x % 5 != 0:
ans += x
print(ans)
| false | 0 | [
"-ary2 = []",
"-for x in list(range(1, N + 1, 1)):",
"+ans = 0",
"+for x in range(1, N + 1):",
"- ary2.append(x)",
"-print((sum(ary2)))",
"+ ans += x",
"+print(ans)"
] | false | 0.203242 | 0.162737 | 1.248899 | [
"s953954788",
"s783036333"
] |
u606878291 | p03294 | python | s255049059 | s605490846 | 22 | 18 | 3,440 | 3,316 | Accepted | Accepted | 18.18 | eval(input())
numbers = tuple(map(int, input().split(' ')))
print((sum([n - 1 for n in numbers])))
| N = int(eval(input()))
print((sum(tuple(map(int, input().split(' ')))) - N))
| 3 | 2 | 93 | 70 | eval(input())
numbers = tuple(map(int, input().split(" ")))
print((sum([n - 1 for n in numbers])))
| N = int(eval(input()))
print((sum(tuple(map(int, input().split(" ")))) - N))
| false | 33.333333 | [
"-eval(input())",
"-numbers = tuple(map(int, input().split(\" \")))",
"-print((sum([n - 1 for n in numbers])))",
"+N = int(eval(input()))",
"+print((sum(tuple(map(int, input().split(\" \")))) - N))"
] | false | 0.109779 | 0.177483 | 0.618533 | [
"s255049059",
"s605490846"
] |
u311379832 | p04020 | python | s051607464 | s658253378 | 244 | 190 | 7,840 | 13,000 | Accepted | Accepted | 22.13 | N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)] + [0]
ans = 0
for i in range(N):
if a[i] != 0:
add, mod = divmod(a[i], 2)
ans += add
if a[i + 1] != 0:
a[i + 1] += mod
print(ans) | N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
ans = 0
for i in range(N):
cnt, mod = divmod(a[i], 2)
ans += cnt
if i < N - 1 and a[i + 1] != 0:
a[i + 1] += mod
print(ans) | 12 | 10 | 236 | 207 | N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)] + [0]
ans = 0
for i in range(N):
if a[i] != 0:
add, mod = divmod(a[i], 2)
ans += add
if a[i + 1] != 0:
a[i + 1] += mod
print(ans)
| N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
ans = 0
for i in range(N):
cnt, mod = divmod(a[i], 2)
ans += cnt
if i < N - 1 and a[i + 1] != 0:
a[i + 1] += mod
print(ans)
| false | 16.666667 | [
"-a = [int(eval(input())) for _ in range(N)] + [0]",
"+a = [int(eval(input())) for _ in range(N)]",
"- if a[i] != 0:",
"- add, mod = divmod(a[i], 2)",
"- ans += add",
"- if a[i + 1] != 0:",
"- a[i + 1] += mod",
"+ cnt, mod = divmod(a[i], 2)",
"+ ans += cnt",
... | false | 0.007883 | 0.035564 | 0.221658 | [
"s051607464",
"s658253378"
] |
u633068244 | p00769 | python | s977646392 | s328749495 | 190 | 150 | 9,424 | 9,424 | Accepted | Accepted | 21.05 | def solve(a):
if type(a[0]) is int:
a = [a[i]/2+1 for i in range(len(a))]
return sum(sorted(a)[:len(a)/2+1])
else:
return sum(sorted(solve(a[i]) for i in range(len(a)))[:len(a)/2+1])
for i in range(eval(input())):
A = eval(input().replace("][","],["))
print(solve(A))
| def solve(a):
if type(a[0]) is int:
return sum(sorted(a)[:len(a)/2+1])/2 + len(a)
else:
return sum(sorted(solve(i) for i in a)[:len(a)/2+1])
for i in range(eval(input())):
A = eval(input().replace("][","],["))
print(solve(A)) | 10 | 8 | 285 | 237 | def solve(a):
if type(a[0]) is int:
a = [a[i] / 2 + 1 for i in range(len(a))]
return sum(sorted(a)[: len(a) / 2 + 1])
else:
return sum(sorted(solve(a[i]) for i in range(len(a)))[: len(a) / 2 + 1])
for i in range(eval(input())):
A = eval(input().replace("][", "],["))
print(solve... | def solve(a):
if type(a[0]) is int:
return sum(sorted(a)[: len(a) / 2 + 1]) / 2 + len(a)
else:
return sum(sorted(solve(i) for i in a)[: len(a) / 2 + 1])
for i in range(eval(input())):
A = eval(input().replace("][", "],["))
print(solve(A))
| false | 20 | [
"- a = [a[i] / 2 + 1 for i in range(len(a))]",
"- return sum(sorted(a)[: len(a) / 2 + 1])",
"+ return sum(sorted(a)[: len(a) / 2 + 1]) / 2 + len(a)",
"- return sum(sorted(solve(a[i]) for i in range(len(a)))[: len(a) / 2 + 1])",
"+ return sum(sorted(solve(i) for i in a)[: l... | false | 0.034755 | 0.038753 | 0.896839 | [
"s977646392",
"s328749495"
] |
u945181840 | p02732 | python | s778649068 | s731922559 | 397 | 343 | 25,932 | 51,512 | Accepted | Accepted | 13.6 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
N, *A = list(map(int, read().split()))
a = Counter(A)
s = sum(i * (i - 1) // 2 for i in list(a.values()))
for i in A:
v = a[i]
answer = s - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2
print(answer)
| import sys
from collections import Counter
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
N, *A = list(map(int, read().split()))
a = Counter(A)
s = sum(i * (i - 1) // 2 for i in list(a.values()))
val = np.array([a[i] for i in A], np.int64)
answer = s - val * (val - 1) // 2 + (val - ... | 14 | 13 | 307 | 373 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
N, *A = list(map(int, read().split()))
a = Counter(A)
s = sum(i * (i - 1) // 2 for i in list(a.values()))
for i in A:
v = a[i]
answer = s - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2
print(answer)
| import sys
from collections import Counter
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
N, *A = list(map(int, read().split()))
a = Counter(A)
s = sum(i * (i - 1) // 2 for i in list(a.values()))
val = np.array([a[i] for i in A], np.int64)
answer = s - val * (val - 1) // 2 + (val - 1) * (val - ... | false | 7.142857 | [
"+import numpy as np",
"-for i in A:",
"- v = a[i]",
"- answer = s - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2",
"- print(answer)",
"+val = np.array([a[i] for i in A], np.int64)",
"+answer = s - val * (val - 1) // 2 + (val - 1) * (val - 2) // 2",
"+print((\"\\n\".join(map(str, answer.tolist()... | false | 0.044534 | 0.384731 | 0.115753 | [
"s778649068",
"s731922559"
] |
u797673668 | p02467 | python | s579413495 | s068463274 | 530 | 30 | 8,200 | 8,120 | Accepted | Accepted | 94.34 | from math import sqrt, floor
from collections import deque
def prime_generator():
prime = set()
yield 2
i = 3
while True:
for d in prime:
if not (i % d):
break
else:
yield i
prime.add(i)
i += 2
nstr = eval(... | from math import sqrt, floor
from collections import deque
def divide_repeat(p):
global n, a, limit
while not (n % p):
a.append(p)
n = n // p
limit = floor(sqrt(n))
nstr = input()
n, p = int(nstr), 3
limit = floor(sqrt(n))
a, i = deque(), 3
divide_repeat(2)
while... | 35 | 28 | 619 | 437 | from math import sqrt, floor
from collections import deque
def prime_generator():
prime = set()
yield 2
i = 3
while True:
for d in prime:
if not (i % d):
break
else:
yield i
prime.add(i)
i += 2
nstr = eval(input())
n = int(n... | from math import sqrt, floor
from collections import deque
def divide_repeat(p):
global n, a, limit
while not (n % p):
a.append(p)
n = n // p
limit = floor(sqrt(n))
nstr = input()
n, p = int(nstr), 3
limit = floor(sqrt(n))
a, i = deque(), 3
divide_repeat(2)
while p <= limit:
divi... | false | 20 | [
"-def prime_generator():",
"- prime = set()",
"- yield 2",
"- i = 3",
"- while True:",
"- for d in prime:",
"- if not (i % d):",
"- break",
"- else:",
"- yield i",
"- prime.add(i)",
"- i += 2",
"-",
"-",
"-n... | false | 0.037728 | 0.033997 | 1.109743 | [
"s579413495",
"s068463274"
] |
u227082700 | p03674 | python | s722460180 | s459100444 | 1,696 | 958 | 13,812 | 14,264 | Accepted | Accepted | 43.51 | mod=10**9+7
n=int(eval(input()))
a=list(map(int,input().split()))
c=[0]*n
for i in a:c[i-1]+=1
ind=c.index(2)
x=[]
for i in range(n+1):
if a[i]==ind+1:x.append(i)
m=n+x[0]-x[1]
f=[1]
for i in range(1,n+2):f.append(f[-1]*i%mod)
def comb(n,r):return f[n]*pow(f[r],mod-2,mod)*pow(f[n-r],mod-2,mod)%mod
for ... | mod=10**9+7
n=int(eval(input()))
a=list(map(int,input().split()))
c=[0]*n
for i in a:c[i-1]+=1
ind=c.index(2)
x=[]
for i in range(n+1):
if a[i]==ind+1:x.append(i)
m=n+x[0]-x[1]
ans=1
anss=1
for k in range(1,n+2):
ans=(ans*(n-k+2))%mod
ans=ans*pow(k,mod-2,mod)%mod
if k==1:print(n);continue... | 18 | 20 | 458 | 442 | mod = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
c = [0] * n
for i in a:
c[i - 1] += 1
ind = c.index(2)
x = []
for i in range(n + 1):
if a[i] == ind + 1:
x.append(i)
m = n + x[0] - x[1]
f = [1]
for i in range(1, n + 2):
f.append(f[-1] * i % mod)
def comb(n, r):
return... | mod = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
c = [0] * n
for i in a:
c[i - 1] += 1
ind = c.index(2)
x = []
for i in range(n + 1):
if a[i] == ind + 1:
x.append(i)
m = n + x[0] - x[1]
ans = 1
anss = 1
for k in range(1, n + 2):
ans = (ans * (n - k + 2)) % mod
ans = ans... | false | 10 | [
"-f = [1]",
"-for i in range(1, n + 2):",
"- f.append(f[-1] * i % mod)",
"-",
"-",
"-def comb(n, r):",
"- return f[n] * pow(f[r], mod - 2, mod) * pow(f[n - r], mod - 2, mod) % mod",
"-",
"-",
"+ans = 1",
"+anss = 1",
"+ ans = (ans * (n - k + 2)) % mod",
"+ ans = ans * pow(k, mod ... | false | 0.007749 | 0.041305 | 0.187602 | [
"s722460180",
"s459100444"
] |
u057964173 | p03149 | python | s453282214 | s731244821 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | def resolve():
l=list(map(int, input().split()))
a=l.count(1)
b=l.count(9)
c=l.count(7)
d=l.count(4)
if a==b==c==d==1:
print('YES')
else:
print('NO')
resolve() | def resolve():
l=list(map(int, input().split()))
l.sort()
if l==[1,4,7,9]:
print('YES')
else:
print('NO')
resolve()
| 11 | 8 | 204 | 149 | def resolve():
l = list(map(int, input().split()))
a = l.count(1)
b = l.count(9)
c = l.count(7)
d = l.count(4)
if a == b == c == d == 1:
print("YES")
else:
print("NO")
resolve()
| def resolve():
l = list(map(int, input().split()))
l.sort()
if l == [1, 4, 7, 9]:
print("YES")
else:
print("NO")
resolve()
| false | 27.272727 | [
"- a = l.count(1)",
"- b = l.count(9)",
"- c = l.count(7)",
"- d = l.count(4)",
"- if a == b == c == d == 1:",
"+ l.sort()",
"+ if l == [1, 4, 7, 9]:"
] | false | 0.048971 | 0.044572 | 1.098704 | [
"s453282214",
"s731244821"
] |
u886747123 | p03361 | python | s392385584 | s126417899 | 22 | 20 | 3,064 | 3,064 | Accepted | Accepted | 9.09 | H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)] # .を0に置換しておく。文字列にしか置換できないので注意
# #の座標(i,j)を与え、隣接している#があるならばTrue、そうでなければNoを出力して終了する
def exist_neighbor_black_cell(i,j):
if "#" in [S[max(0,i-1)][j], S[min(H-1,i+1)][j], S[i][max(0,j-1)], S[i][min(W-1,j+1)]]:
return Tr... | H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
# #の座標(i,j)を与え、隣接している#があるならばTrue、そうでなければNoを出力して終了する
def exist_neighbor_black_cell(i,j):
if "#" in [S[max(0,i-1)][j], S[min(H-1,i+1)][j], S[i][max(0,j-1)], S[i][min(W-1,j+1)]]:
return True
else:
print("N... | 19 | 19 | 527 | 496 | H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)] # .を0に置換しておく。文字列にしか置換できないので注意
# #の座標(i,j)を与え、隣接している#があるならばTrue、そうでなければNoを出力して終了する
def exist_neighbor_black_cell(i, j):
if "#" in [
S[max(0, i - 1)][j],
S[min(H - 1, i + 1)][j],
S[i][max(0, j - 1)],
S[... | H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
# #の座標(i,j)を与え、隣接している#があるならばTrue、そうでなければNoを出力して終了する
def exist_neighbor_black_cell(i, j):
if "#" in [
S[max(0, i - 1)][j],
S[min(H - 1, i + 1)][j],
S[i][max(0, j - 1)],
S[i][min(W - 1, j + 1)],
]:
... | false | 0 | [
"-S = [list(eval(input())) for _ in range(H)] # .を0に置換しておく。文字列にしか置換できないので注意",
"+S = [list(eval(input())) for _ in range(H)]"
] | false | 0.040489 | 0.035824 | 1.130226 | [
"s392385584",
"s126417899"
] |
u645250356 | p02572 | python | s711779221 | s686299830 | 430 | 147 | 110,352 | 97,440 | Accepted | Accepted | 65.81 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,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()))
n = ... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 23 | 18 | 528 | 463 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, 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().s... | 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 | 21.73913 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"-b = []",
"-now = 0",
"-for i in range(n)[::-1]:",
"- no... | false | 0.090286 | 0.153828 | 0.58693 | [
"s711779221",
"s686299830"
] |
u760569096 | p02947 | python | s647212029 | s138076516 | 369 | 247 | 22,444 | 22,456 | Accepted | Accepted | 33.06 | from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
cnt = 0
for _ in range(n):
a = eval(input())
b = ''
for i in sorted(a):
b += i
cnt += d[b]
d[b] += 1
print(cnt) | from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
cnt = 0
for _ in range(n):
s = "".join(sorted(eval(input())))
cnt += d[s]
d[s] += 1
print(cnt) | 12 | 9 | 204 | 176 | from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
cnt = 0
for _ in range(n):
a = eval(input())
b = ""
for i in sorted(a):
b += i
cnt += d[b]
d[b] += 1
print(cnt)
| from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
cnt = 0
for _ in range(n):
s = "".join(sorted(eval(input())))
cnt += d[s]
d[s] += 1
print(cnt)
| false | 25 | [
"- a = eval(input())",
"- b = \"\"",
"- for i in sorted(a):",
"- b += i",
"- cnt += d[b]",
"- d[b] += 1",
"+ s = \"\".join(sorted(eval(input())))",
"+ cnt += d[s]",
"+ d[s] += 1"
] | false | 0.03758 | 0.043553 | 0.862854 | [
"s647212029",
"s138076516"
] |
u849151695 | p02720 | python | s080646766 | s742307448 | 124 | 107 | 11,880 | 11,948 | Accepted | Accepted | 13.71 | from collections import deque
k = int(eval(input()))
Q = deque(list(range(1, 10)))
for _ in range(k):
x = Q.popleft()
y = x % 10
z = 10*x + y
if y != 0:
Q += [z-1]
Q += [z]
if y != 9:
Q += [z+1]
print(x) | from collections import deque
k = int(eval(input()))
Q = deque(list(range(1, 10))) #るんるん数を格納するキュー
# Q: 1 2 3 4 5 6 7 8 9
for i in range(k):
x = Q.popleft()
#x = 1 <-- Q: 2 3 4 5 6 7 8 9
last_digit = x % 10 # 1 一番目の桁の値
if last_digit == 0:
Q.append(10*x + 0)
Q.append(10*x + 1)
... | 13 | 23 | 223 | 545 | from collections import deque
k = int(eval(input()))
Q = deque(list(range(1, 10)))
for _ in range(k):
x = Q.popleft()
y = x % 10
z = 10 * x + y
if y != 0:
Q += [z - 1]
Q += [z]
if y != 9:
Q += [z + 1]
print(x)
| from collections import deque
k = int(eval(input()))
Q = deque(list(range(1, 10))) # るんるん数を格納するキュー
# Q: 1 2 3 4 5 6 7 8 9
for i in range(k):
x = Q.popleft()
# x = 1 <-- Q: 2 3 4 5 6 7 8 9
last_digit = x % 10 # 1 一番目の桁の値
if last_digit == 0:
Q.append(10 * x + 0)
Q.append(10 * x + 1)
... | false | 43.478261 | [
"-Q = deque(list(range(1, 10)))",
"-for _ in range(k):",
"+Q = deque(list(range(1, 10))) # るんるん数を格納するキュー",
"+# Q: 1 2 3 4 5 6 7 8 9",
"+for i in range(k):",
"- y = x % 10",
"- z = 10 * x + y",
"- if y != 0:",
"- Q += [z - 1]",
"- Q += [z]",
"- if y != 9:",
"- Q +=... | false | 0.051981 | 0.050125 | 1.037031 | [
"s080646766",
"s742307448"
] |
u254871849 | p02861 | python | s000366456 | s305868517 | 404 | 151 | 3,064 | 12,500 | Accepted | Accepted | 62.62 | # 2019-11-16 21:01:15(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# im... | import sys
import numpy as np
n, *xy = list(map(int, sys.stdin.read().split()))
x, y = np.array(xy).reshape(-1, 2).T
def main():
dx = (x[:, None] - x) ** 2
dy = (y[:, None] - y) ** 2
ans = np.sqrt(dx + dy).sum() / n
print(ans)
if __name__ == '__main__':
main() | 36 | 14 | 918 | 291 | # 2019-11-16 21:01:15(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import nu... | import sys
import numpy as np
n, *xy = list(map(int, sys.stdin.read().split()))
x, y = np.array(xy).reshape(-1, 2).T
def main():
dx = (x[:, None] - x) ** 2
dy = (y[:, None] - y) ** 2
ans = np.sqrt(dx + dy).sum() / n
print(ans)
if __name__ == "__main__":
main()
| false | 61.111111 | [
"-# 2019-11-16 21:01:15(JST)",
"+import numpy as np",
"-# import collections",
"-import math",
"-",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-import itertools",
"-",
"-# from functools import reduce",
"-... | false | 0.043413 | 0.183544 | 0.236526 | [
"s000366456",
"s305868517"
] |
u047796752 | p02850 | python | s457184808 | s441322368 | 499 | 309 | 83,104 | 102,664 | Accepted | Accepted | 38.08 | import sys
input = sys.stdin.readline
from collections import deque, defaultdict
def bfs():
q = deque([(0, 0)])
visited = [False]*N
visited[0] = True
while q:
v, c = q.popleft()
now = 1
for nv in G[v]:
if not visited[nv]:
... | import sys
input = sys.stdin.readline
from collections import *
def bfs():
q = deque([(0, -1)])
visited = [False]*N
visited[0] = True
ans = [-1]*(N-1)
while q:
v, prev = q.popleft()
now = 0
for nv in G[v]:
if not visited[nv]:
if ... | 44 | 41 | 896 | 839 | import sys
input = sys.stdin.readline
from collections import deque, defaultdict
def bfs():
q = deque([(0, 0)])
visited = [False] * N
visited[0] = True
while q:
v, c = q.popleft()
now = 1
for nv in G[v]:
if not visited[nv]:
if now == c:
... | import sys
input = sys.stdin.readline
from collections import *
def bfs():
q = deque([(0, -1)])
visited = [False] * N
visited[0] = True
ans = [-1] * (N - 1)
while q:
v, prev = q.popleft()
now = 0
for nv in G[v]:
if not visited[nv]:
if now == pre... | false | 6.818182 | [
"-from collections import deque, defaultdict",
"+from collections import *",
"- q = deque([(0, 0)])",
"+ q = deque([(0, -1)])",
"+ ans = [-1] * (N - 1)",
"- v, c = q.popleft()",
"- now = 1",
"+ v, prev = q.popleft()",
"+ now = 0",
"- if now == c:... | false | 0.154481 | 0.086157 | 1.793016 | [
"s457184808",
"s441322368"
] |
u706414019 | p03363 | python | s002917756 | s281138489 | 175 | 147 | 44,232 | 44,332 | Accepted | Accepted | 16 | import sys,math,collections,itertools
input = sys.stdin.readline
N=int(eval(input()))
a=list(map(int,input().split()))
A =[0]
for i in range(N):
A.append(A[-1]+a[i])
Ac = collections.Counter(A)
cnt = 0
for val in list(Ac.values()):
cnt += val*(val-1)//2
print(cnt)
| import sys,collections,itertools
input = sys.stdin.readline
N=int(eval(input()))
a=list(map(int,input().split()))
A =[0]+list(itertools.accumulate(a))
Ac = collections.Counter(A)
cnt = 0
for val in list(Ac.values()):
cnt += val*(val-1)//2
print(cnt) | 14 | 10 | 276 | 250 | import sys, math, collections, itertools
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
A = [0]
for i in range(N):
A.append(A[-1] + a[i])
Ac = collections.Counter(A)
cnt = 0
for val in list(Ac.values()):
cnt += val * (val - 1) // 2
print(cnt)
| import sys, collections, itertools
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
A = [0] + list(itertools.accumulate(a))
Ac = collections.Counter(A)
cnt = 0
for val in list(Ac.values()):
cnt += val * (val - 1) // 2
print(cnt)
| false | 28.571429 | [
"-import sys, math, collections, itertools",
"+import sys, collections, itertools",
"-A = [0]",
"-for i in range(N):",
"- A.append(A[-1] + a[i])",
"+A = [0] + list(itertools.accumulate(a))"
] | false | 0.037186 | 0.035613 | 1.044155 | [
"s002917756",
"s281138489"
] |
u843318346 | p02696 | python | s500735043 | s669008958 | 23 | 20 | 9,200 | 9,156 | Accepted | Accepted | 13.04 | a, b,n = list(map(int, input().split()))
if n<b:
ans = (a*n)//b-a*(n//b)
else:
m = int(n//b)
m = m*b-1
ans = (a*m)//b-a*(m//b)
print(ans)
| a, b,n = list(map(int, input().split()))
from math import floor
if n<b:
ans = floor(a*n/b)-a*floor(n/b)
else:
m = n//b
m = m*b-1
ans = a*m//b-a*floor(m/b)
print(ans)
| 10 | 10 | 161 | 188 | a, b, n = list(map(int, input().split()))
if n < b:
ans = (a * n) // b - a * (n // b)
else:
m = int(n // b)
m = m * b - 1
ans = (a * m) // b - a * (m // b)
print(ans)
| a, b, n = list(map(int, input().split()))
from math import floor
if n < b:
ans = floor(a * n / b) - a * floor(n / b)
else:
m = n // b
m = m * b - 1
ans = a * m // b - a * floor(m / b)
print(ans)
| false | 0 | [
"+from math import floor",
"+",
"- ans = (a * n) // b - a * (n // b)",
"+ ans = floor(a * n / b) - a * floor(n / b)",
"- m = int(n // b)",
"+ m = n // b",
"- ans = (a * m) // b - a * (m // b)",
"+ ans = a * m // b - a * floor(m / b)"
] | false | 0.08134 | 0.061648 | 1.319422 | [
"s500735043",
"s669008958"
] |
u935558307 | p04015 | python | s679424121 | s114272384 | 394 | 188 | 92,380 | 41,328 | Accepted | Accepted | 52.28 | """
普通に数え上げDPで行けそう
dp[i][j][k] -> カードをi枚使う/j種類目のカードまで見る/カードの数字の合計がkになる
j種類目のカードを使う場合:
dp[i][j][k] += dp[i-1][j-1][k-x]
j種類目のカードを使わない場合:
dp[i][j][k] += dp[i][j-1][k]
という風に計算していって、最終的に各iごとにk/i=Aとなるようなkを見出して、dp[i][-1][k]をanswerとして加算する。
"""
N,A = list(map(int,input().split()))
X = list(map(int,input().split()))... | N,A = list(map(int,input().split()))
X = list(map(int,input().split()))
Y = [x-A for x in X]
t = sum(X)
dp = [[0]*(t*2+1) for _ in range(N+1)]
#dp[i][j] -> i枚目まで見る。合計をj-tにするパターン数
#i枚目を使う場合 -> dp[i][j] += dp[i-1][j-Yi]
#i枚目を使わない場合 -> dp[i][j] += dp[i-1][j]
dp[0][t] = 1
for i in range(1,N+1):
y = Y[i-1]
... | 31 | 18 | 785 | 461 | """
普通に数え上げDPで行けそう
dp[i][j][k] -> カードをi枚使う/j種類目のカードまで見る/カードの数字の合計がkになる
j種類目のカードを使う場合:
dp[i][j][k] += dp[i-1][j-1][k-x]
j種類目のカードを使わない場合:
dp[i][j][k] += dp[i][j-1][k]
という風に計算していって、最終的に各iごとにk/i=Aとなるようなkを見出して、dp[i][-1][k]をanswerとして加算する。
"""
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
sumX = s... | N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = [x - A for x in X]
t = sum(X)
dp = [[0] * (t * 2 + 1) for _ in range(N + 1)]
# dp[i][j] -> i枚目まで見る。合計をj-tにするパターン数
# i枚目を使う場合 -> dp[i][j] += dp[i-1][j-Yi]
# i枚目を使わない場合 -> dp[i][j] += dp[i-1][j]
dp[0][t] = 1
for i in range(1, N + 1):
y = Y... | false | 41.935484 | [
"-\"\"\"",
"-普通に数え上げDPで行けそう",
"-dp[i][j][k] -> カードをi枚使う/j種類目のカードまで見る/カードの数字の合計がkになる",
"-j種類目のカードを使う場合:",
"-dp[i][j][k] += dp[i-1][j-1][k-x]",
"-j種類目のカードを使わない場合:",
"-dp[i][j][k] += dp[i][j-1][k]",
"-という風に計算していって、最終的に各iごとにk/i=Aとなるようなkを見出して、dp[i][-1][k]をanswerとして加算する。",
"-\"\"\"",
"-sumX = sum(X)",
... | false | 0.065857 | 0.042683 | 1.542924 | [
"s679424121",
"s114272384"
] |
u645250356 | p02814 | python | s711780632 | s369980776 | 422 | 123 | 85,352 | 91,300 | Accepted | Accepted | 70.85 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 33 | 32 | 749 | 717 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 3.030303 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"-mod2 = 998244353",
"-def inpln(n):",
"- return li... | false | 0.047234 | 0.042806 | 1.103446 | [
"s711780632",
"s369980776"
] |
u308684517 | p03352 | python | s912779841 | s477120504 | 25 | 17 | 2,940 | 2,940 | Accepted | Accepted | 32 | x = int(eval(input()))
for i in range(x, 0, -1):
for j in range(2, i):
s = i
while s%j == 0:
t = s % j
s = s // j
if s == 1 and t == 0:
print(i)
exit()
print((1)) | x = int(eval(input()))
ans = [1]
for i in range(2, x):
for j in range(2,11):
ad = i**j
if ad > x:
break
ans.append(ad)
print((max(ans))) | 12 | 9 | 261 | 176 | x = int(eval(input()))
for i in range(x, 0, -1):
for j in range(2, i):
s = i
while s % j == 0:
t = s % j
s = s // j
if s == 1 and t == 0:
print(i)
exit()
print((1))
| x = int(eval(input()))
ans = [1]
for i in range(2, x):
for j in range(2, 11):
ad = i**j
if ad > x:
break
ans.append(ad)
print((max(ans)))
| false | 25 | [
"-for i in range(x, 0, -1):",
"- for j in range(2, i):",
"- s = i",
"- while s % j == 0:",
"- t = s % j",
"- s = s // j",
"- if s == 1 and t == 0:",
"- print(i)",
"- exit()",
"-print((1))",
"+ans = [1]",
"+for i in... | false | 0.083241 | 0.063239 | 1.316295 | [
"s912779841",
"s477120504"
] |
u057109575 | p03062 | python | s174883614 | s672996575 | 257 | 102 | 72,332 | 90,888 | Accepted | Accepted | 60.31 | N, *A = list(map(int, open(0).read().split()))
dp = [[0] * 2 for _ in range(N + 1)]
dp[0][1] = -float('inf')
for i in range(N):
dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])
dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])
print((dp[N][0]))
|
N = int(eval(input()))
X = list(map(int, input().split()))
y = [abs(v) for v in X]
if sum(v < 0 for v in X) % 2 == 0:
print((sum(y)))
else:
print((sum(y) - 2 * min(y)))
| 11 | 9 | 270 | 177 | N, *A = list(map(int, open(0).read().split()))
dp = [[0] * 2 for _ in range(N + 1)]
dp[0][1] = -float("inf")
for i in range(N):
dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])
dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])
print((dp[N][0]))
| N = int(eval(input()))
X = list(map(int, input().split()))
y = [abs(v) for v in X]
if sum(v < 0 for v in X) % 2 == 0:
print((sum(y)))
else:
print((sum(y) - 2 * min(y)))
| false | 18.181818 | [
"-N, *A = list(map(int, open(0).read().split()))",
"-dp = [[0] * 2 for _ in range(N + 1)]",
"-dp[0][1] = -float(\"inf\")",
"-for i in range(N):",
"- dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])",
"- dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])",
"-print((dp[N][0]))",
"+N = int(ev... | false | 0.041627 | 0.159963 | 0.260229 | [
"s174883614",
"s672996575"
] |
u957390897 | p03478 | python | s040882941 | s097965940 | 37 | 33 | 3,188 | 2,940 | Accepted | Accepted | 10.81 | n, a, b = list(map(int, input().split()))
result = 0
for i in range(n + 1):
if a <= sum(list(map(int, list(str(i))))) <= b:
result += i
print(result) | n, a, b = list(map(int, input().split()))
result = 0
for i in range(n + 1):
if a <= sum(map(int, list(str(i)))) <= b:
result += i
print(result)
| 8 | 8 | 158 | 153 | n, a, b = list(map(int, input().split()))
result = 0
for i in range(n + 1):
if a <= sum(list(map(int, list(str(i))))) <= b:
result += i
print(result)
| n, a, b = list(map(int, input().split()))
result = 0
for i in range(n + 1):
if a <= sum(map(int, list(str(i)))) <= b:
result += i
print(result)
| false | 0 | [
"- if a <= sum(list(map(int, list(str(i))))) <= b:",
"+ if a <= sum(map(int, list(str(i)))) <= b:"
] | false | 0.040637 | 0.046253 | 0.878587 | [
"s040882941",
"s097965940"
] |
u562935282 | p03331 | python | s678178289 | s079416783 | 107 | 17 | 3,060 | 2,940 | Accepted | Accepted | 84.11 | def d_sum(x):
res = 0
while x > 0:
res += x % 10
x //= 10
return res
n = int(eval(input()))
ans = float('inf')
for a in range(1, n // 2 + 1):
b = n - a
ans = min(ans, d_sum(a) + d_sum(b))
print(ans) | from math import log
n = int(eval(input()))
if log(n, 10) % 1 == 0:
ans = 10
else:
ans = sum(map(int, list(str(n))))
print(ans) | 15 | 8 | 245 | 137 | def d_sum(x):
res = 0
while x > 0:
res += x % 10
x //= 10
return res
n = int(eval(input()))
ans = float("inf")
for a in range(1, n // 2 + 1):
b = n - a
ans = min(ans, d_sum(a) + d_sum(b))
print(ans)
| from math import log
n = int(eval(input()))
if log(n, 10) % 1 == 0:
ans = 10
else:
ans = sum(map(int, list(str(n))))
print(ans)
| false | 46.666667 | [
"-def d_sum(x):",
"- res = 0",
"- while x > 0:",
"- res += x % 10",
"- x //= 10",
"- return res",
"-",
"+from math import log",
"-ans = float(\"inf\")",
"-for a in range(1, n // 2 + 1):",
"- b = n - a",
"- ans = min(ans, d_sum(a) + d_sum(b))",
"+if log(n, 10) % 1... | false | 0.143142 | 0.035698 | 4.009865 | [
"s678178289",
"s079416783"
] |
u923668099 | p02412 | python | s998357005 | s817535788 | 130 | 30 | 7,668 | 7,612 | Accepted | Accepted | 76.92 | # coding: utf-8
while True:
n,x = list(map(int, input().split()))
if n == x == 0:
break
list = [i for i in range(1,n+1)]
count = 0
for i in list:
for j in list[i:]:
k = x - (i + j)
if list[j:].count(k) == 1:
count +... | # coding: utf-8
while True:
n,x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1,int(x/3)+1):
for j in range(i+1,int((x-i)/2)+1):
k = x - (i + j)
if j < k <= n:
count += 1
... | 17 | 16 | 353 | 331 | # coding: utf-8
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
list = [i for i in range(1, n + 1)]
count = 0
for i in list:
for j in list[i:]:
k = x - (i + j)
if list[j:].count(k) == 1:
count += 1
print(count)
| # coding: utf-8
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1, int(x / 3) + 1):
for j in range(i + 1, int((x - i) / 2) + 1):
k = x - (i + j)
if j < k <= n:
count += 1
print(count)
| false | 5.882353 | [
"- list = [i for i in range(1, n + 1)]",
"- for i in list:",
"- for j in list[i:]:",
"+ for i in range(1, int(x / 3) + 1):",
"+ for j in range(i + 1, int((x - i) / 2) + 1):",
"- if list[j:].count(k) == 1:",
"+ if j < k <= n:"
] | false | 0.007227 | 0.037289 | 0.193812 | [
"s998357005",
"s817535788"
] |
u127499732 | p03329 | python | s630527024 | s273502306 | 936 | 290 | 3,864 | 3,864 | Accepted | Accepted | 69.02 | def main():
n = int(eval(input()))
m = [10 ** 5 for _ in range(n + 1)]
m[0] = 0
for i in range(1, n + 1):
j = 0
while i - 6 ** j >= 0:
m[i] = min(1 + m[i - 6 ** j], m[i])
j += 1
j = 0
while i - 9 ** j >= 0:
m[i] = min(1 + m[i... | def main():
import bisect
n = int(eval(input()))
m = [10 ** 5 for _ in range(n + 1)]
m[0] = 0
a = [6 ** i for i in range(7)]
b = [9 ** i for i in range(6)]
c = sorted(a + b)
for i in range(1, n + 1):
j = bisect.bisect_right(c, i)
k = [1 + m[i - x] for l, x in en... | 19 | 18 | 416 | 422 | def main():
n = int(eval(input()))
m = [10**5 for _ in range(n + 1)]
m[0] = 0
for i in range(1, n + 1):
j = 0
while i - 6**j >= 0:
m[i] = min(1 + m[i - 6**j], m[i])
j += 1
j = 0
while i - 9**j >= 0:
m[i] = min(1 + m[i - 9**j], m[i])
... | def main():
import bisect
n = int(eval(input()))
m = [10**5 for _ in range(n + 1)]
m[0] = 0
a = [6**i for i in range(7)]
b = [9**i for i in range(6)]
c = sorted(a + b)
for i in range(1, n + 1):
j = bisect.bisect_right(c, i)
k = [1 + m[i - x] for l, x in enumerate(c) if l... | false | 5.263158 | [
"+ import bisect",
"+",
"+ a = [6**i for i in range(7)]",
"+ b = [9**i for i in range(6)]",
"+ c = sorted(a + b)",
"- j = 0",
"- while i - 6**j >= 0:",
"- m[i] = min(1 + m[i - 6**j], m[i])",
"- j += 1",
"- j = 0",
"- while i - 9**j >=... | false | 0.242761 | 0.065374 | 3.713388 | [
"s630527024",
"s273502306"
] |
u462976050 | p02819 | python | s170575578 | s624411335 | 54 | 18 | 3,064 | 3,060 | Accepted | Accepted | 66.67 | X=int(eval(input()))
flag = True
if X == 2:
print(X)
else:
while flag:
i = 2
while i<X:
if X%i == 0:
break
if i == X-1:
print(X)
flag = False
break
i = i+1
X = X+1 | X=int(eval(input()))
def is_prime(q,k=100):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
for i in range(3,k):
x,y = q,i
while y:
x, y = y, x % y
if x != 1: continue
if pow(i, q-1, q) != 1:
return False
retur... | 16 | 20 | 304 | 436 | X = int(eval(input()))
flag = True
if X == 2:
print(X)
else:
while flag:
i = 2
while i < X:
if X % i == 0:
break
if i == X - 1:
print(X)
flag = False
break
i = i + 1
X = X + 1
| X = int(eval(input()))
def is_prime(q, k=100):
q = abs(q)
if q == 2:
return True
if q < 2 or q & 1 == 0:
return False
for i in range(3, k):
x, y = q, i
while y:
x, y = y, x % y
if x != 1:
continue
if pow(i, q - 1, q) != 1:
... | false | 20 | [
"-flag = True",
"-if X == 2:",
"- print(X)",
"-else:",
"- while flag:",
"- i = 2",
"- while i < X:",
"- if X % i == 0:",
"- break",
"- if i == X - 1:",
"- print(X)",
"- flag = False",
"- bre... | false | 0.051292 | 0.044509 | 1.152401 | [
"s170575578",
"s624411335"
] |
u969190727 | p02793 | python | s830660044 | s832041100 | 1,485 | 430 | 67,432 | 46,300 | Accepted | Accepted | 71.04 | import fractions
n=int(eval(input()))
A=[int(i) for i in input().split()]
mod=10**9+7
lcm=A[0]
for i in range(1,n):
if lcm%A[i]!=0:
lcm=lcm*A[i]//fractions.gcd(lcm,A[i])
lcm%=mod
ans=0
for i in range(n):
ans=(ans+lcm*pow(A[i],mod-2,mod))%mod
print(ans)
| n=int(eval(input()))
A=[int(i) for i in input().split()]
mod=10**9+7
import collections
P=collections.defaultdict(int)
ans=0
for a in A:
ans=(ans+pow(a,mod-2,mod))%mod
pf={}
for i in range(2,int(a**0.5)+1):
while a%i==0:
pf[i]=pf.get(i,0)+1
a//=i
if a>1:
pf[a]=1
for p in l... | 14 | 23 | 269 | 418 | import fractions
n = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
lcm = A[0]
for i in range(1, n):
if lcm % A[i] != 0:
lcm = lcm * A[i] // fractions.gcd(lcm, A[i])
lcm %= mod
ans = 0
for i in range(n):
ans = (ans + lcm * pow(A[i], mod - 2, mod)) % mod
print(ans)
| n = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 10**9 + 7
import collections
P = collections.defaultdict(int)
ans = 0
for a in A:
ans = (ans + pow(a, mod - 2, mod)) % mod
pf = {}
for i in range(2, int(a**0.5) + 1):
while a % i == 0:
pf[i] = pf.get(i, 0) + 1
... | false | 39.130435 | [
"-import fractions",
"-",
"-lcm = A[0]",
"-for i in range(1, n):",
"- if lcm % A[i] != 0:",
"- lcm = lcm * A[i] // fractions.gcd(lcm, A[i])",
"-lcm %= mod",
"+import collections",
"+",
"+P = collections.defaultdict(int)",
"-for i in range(n):",
"- ans = (ans + lcm * pow(A[i], mod ... | false | 0.159471 | 0.04419 | 3.608776 | [
"s830660044",
"s832041100"
] |
u566924053 | p03644 | python | s364521487 | s211236979 | 18 | 16 | 2,940 | 2,940 | Accepted | Accepted | 11.11 | print((2**(len(bin(int(eval(input())))[2:])-1))) | print((2**(len(bin(int(eval(input()))))-3))) | 1 | 1 | 40 | 36 | print((2 ** (len(bin(int(eval(input())))[2:]) - 1)))
| print((2 ** (len(bin(int(eval(input())))) - 3)))
| false | 0 | [
"-print((2 ** (len(bin(int(eval(input())))[2:]) - 1)))",
"+print((2 ** (len(bin(int(eval(input())))) - 3)))"
] | false | 0.041497 | 0.037711 | 1.10041 | [
"s364521487",
"s211236979"
] |
u575431498 | p03339 | python | s126934276 | s623136538 | 433 | 254 | 118,808 | 16,564 | Accepted | Accepted | 41.34 | N = int(eval(input()))
S = eval(input())
c = 0
for i in range(1, N):
if S[i] == 'E':
c += 1
dp = [{'i': 0, 'c': c}]
for i in range(1, N):
c = dp[i-1]['c']
if S[i-1] == 'W':
c += 1
if S[i] == 'E':
c -= 1
dp.append({'i': i, 'c': c})
dp.sort(key=lambda x:x['c']... | N = int(eval(input()))
S = eval(input())
c = 0
for i in range(1, N):
if S[i] == 'E':
c += 1
dp = [c]
for i in range(1, N):
c = dp[i-1]
if S[i-1] == 'W':
c += 1
if S[i] == 'E':
c -= 1
dp.append(c)
dp.sort()
print((dp[0])) | 18 | 18 | 328 | 269 | N = int(eval(input()))
S = eval(input())
c = 0
for i in range(1, N):
if S[i] == "E":
c += 1
dp = [{"i": 0, "c": c}]
for i in range(1, N):
c = dp[i - 1]["c"]
if S[i - 1] == "W":
c += 1
if S[i] == "E":
c -= 1
dp.append({"i": i, "c": c})
dp.sort(key=lambda x: x["c"])
print((dp[0... | N = int(eval(input()))
S = eval(input())
c = 0
for i in range(1, N):
if S[i] == "E":
c += 1
dp = [c]
for i in range(1, N):
c = dp[i - 1]
if S[i - 1] == "W":
c += 1
if S[i] == "E":
c -= 1
dp.append(c)
dp.sort()
print((dp[0]))
| false | 0 | [
"-dp = [{\"i\": 0, \"c\": c}]",
"+dp = [c]",
"- c = dp[i - 1][\"c\"]",
"+ c = dp[i - 1]",
"- dp.append({\"i\": i, \"c\": c})",
"-dp.sort(key=lambda x: x[\"c\"])",
"-print((dp[0][\"c\"]))",
"+ dp.append(c)",
"+dp.sort()",
"+print((dp[0]))"
] | false | 0.042448 | 0.043031 | 0.986443 | [
"s126934276",
"s623136538"
] |
u864197622 | p03128 | python | s883256769 | s636195267 | 83 | 18 | 3,188 | 3,064 | Accepted | Accepted | 78.31 | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i-1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i]-1]] for i in range(M)]
best = sorted(B, key = lambda x: x[1... | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i-1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i]-1]] for i in range(M)]
best = sorted(B, key = lambda x: x[1... | 38 | 38 | 892 | 847 | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i - 1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i] - 1]] for i in range(M)]
best = sorted(B, key=lambda x: x[1] * 10 - x[0])[0]... | def intlog10(n):
if n <= 0:
return -1
i = 0
while 10**i <= n:
i += 1
return i - 1
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
L = [2, 5, 5, 4, 5, 6, 3, 7, 6]
B = [[A[i], L[A[i] - 1]] for i in range(M)]
best = sorted(B, key=lambda x: x[1] * 10 - x[0])[0]... | false | 0 | [
"- X[i] = max(",
"- X[i],",
"- X[i - b[1]] * 10 + b[0],",
"- X[i - b[1]] + b[0] * (10 ** intlog10(X[i - b[1]])),",
"- )",
"+ X[i] = max(X[i], X[i - b[1]] * 10 + b[0])"
] | false | 0.035138 | 0.035468 | 0.990701 | [
"s883256769",
"s636195267"
] |
u580273604 | p02678 | python | s916558692 | s460887470 | 782 | 706 | 37,260 | 33,984 | Accepted | Accepted | 9.72 | from collections import deque
N,M=list(map(int,input().split()))
A=[0]*M;B=[0]*M
C=[[] for i in range(N+1)]
for i in range(M):
A[i],B[i]=sorted(list(map(int,input().split())))
C[A[i]].append(B[i])
C[B[i]].append(A[i])
d=[-1]*(N+1)
d[0]=0
d[1]=0
queue=deque([1])
while queue:
now = queue.poplef... | from collections import deque
N,M=list(map(int,input().split()))
C=[[] for i in range(N+1)]
for i in range(M):
A,B=sorted(list(map(int,input().split())))
C[A].append(B)
C[B].append(A)
d=[-1]*(N+1)
d[0]=0
d[1]=0
queue=deque([1])
while queue:
now = queue.popleft()
for i in C[now]:
if d[i]!... | 26 | 24 | 487 | 450 | from collections import deque
N, M = list(map(int, input().split()))
A = [0] * M
B = [0] * M
C = [[] for i in range(N + 1)]
for i in range(M):
A[i], B[i] = sorted(list(map(int, input().split())))
C[A[i]].append(B[i])
C[B[i]].append(A[i])
d = [-1] * (N + 1)
d[0] = 0
d[1] = 0
queue = deque([1])
while queue:
... | from collections import deque
N, M = list(map(int, input().split()))
C = [[] for i in range(N + 1)]
for i in range(M):
A, B = sorted(list(map(int, input().split())))
C[A].append(B)
C[B].append(A)
d = [-1] * (N + 1)
d[0] = 0
d[1] = 0
queue = deque([1])
while queue:
now = queue.popleft()
for i in C[n... | false | 7.692308 | [
"-A = [0] * M",
"-B = [0] * M",
"- A[i], B[i] = sorted(list(map(int, input().split())))",
"- C[A[i]].append(B[i])",
"- C[B[i]].append(A[i])",
"+ A, B = sorted(list(map(int, input().split())))",
"+ C[A].append(B)",
"+ C[B].append(A)"
] | false | 0.039416 | 0.039348 | 1.001719 | [
"s916558692",
"s460887470"
] |
u133936772 | p03221 | python | s326279847 | s345422572 | 726 | 598 | 86,108 | 38,096 | Accepted | Accepted | 17.63 | import sys
f=lambda:list(map(int,sys.stdin.readline().split()))
n,m=f()
lt=[]
for i in range(m):
p,y=f()
lt+=[(p,y,i)]
lt.sort()
d={}
t=c=0
for p,y,i in lt:
if p>t: t,c=p,1
else: c+=1
d[i]=str(p).zfill(6)+str(c).zfill(6)
for _,v in sorted(d.items()): print(v) | import sys
f=lambda:list(map(int,sys.stdin.readline().split()))
_,m=f()
d,t,c={},0,0
for p,y,i in sorted(list(f())+[i] for i in range(m)):
if p>t: t,c=p,1
else: c+=1
d[i]=str(p).zfill(6)+str(c).zfill(6)
for _,v in sorted(d.items()): print(v) | 15 | 9 | 277 | 249 | import sys
f = lambda: list(map(int, sys.stdin.readline().split()))
n, m = f()
lt = []
for i in range(m):
p, y = f()
lt += [(p, y, i)]
lt.sort()
d = {}
t = c = 0
for p, y, i in lt:
if p > t:
t, c = p, 1
else:
c += 1
d[i] = str(p).zfill(6) + str(c).zfill(6)
for _, v in sorted(d.items... | import sys
f = lambda: list(map(int, sys.stdin.readline().split()))
_, m = f()
d, t, c = {}, 0, 0
for p, y, i in sorted(list(f()) + [i] for i in range(m)):
if p > t:
t, c = p, 1
else:
c += 1
d[i] = str(p).zfill(6) + str(c).zfill(6)
for _, v in sorted(d.items()):
print(v)
| false | 40 | [
"-n, m = f()",
"-lt = []",
"-for i in range(m):",
"- p, y = f()",
"- lt += [(p, y, i)]",
"-lt.sort()",
"-d = {}",
"-t = c = 0",
"-for p, y, i in lt:",
"+_, m = f()",
"+d, t, c = {}, 0, 0",
"+for p, y, i in sorted(list(f()) + [i] for i in range(m)):"
] | false | 0.041346 | 0.040469 | 1.021666 | [
"s326279847",
"s345422572"
] |
u116038906 | p02844 | python | s932582222 | s492775185 | 706 | 290 | 9,664 | 9,676 | Accepted | Accepted | 58.92 | import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
# 初期入力 2020-0727 21:50
from collections import Counter
import sys
input = sys.stdin.readline #文字列では使わない
N = int(eval(input()))
*S, =input().strip()
"""
c =Counter(S)
ans =combinations_c... | # forしながらif、ifでないときはforしないので、計算量減
# 初期入力 2020-0727 21:50
from collections import Counter
import sys
input = sys.stdin.readline #文字列では使わない
N = int(eval(input()))
*S, =input().strip()
"""
c =Counter(S)
ans =combinations_count(N, 3) -len(c)
"""
count =0
x100=0
x10=0
x1=0
for i in range(10):
if str(i)... | 32 | 28 | 840 | 738 | import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
# 初期入力 2020-0727 21:50
from collections import Counter
import sys
input = sys.stdin.readline # 文字列では使わない
N = int(eval(input()))
(*S,) = input().strip()
"""
c =Counter(S)
ans =combinations_count(N... | # forしながらif、ifでないときはforしないので、計算量減
# 初期入力 2020-0727 21:50
from collections import Counter
import sys
input = sys.stdin.readline # 文字列では使わない
N = int(eval(input()))
(*S,) = input().strip()
"""
c =Counter(S)
ans =combinations_count(N, 3) -len(c)
"""
count = 0
x100 = 0
x10 = 0
x1 = 0
for i in range(10):
if str(i) in ... | false | 12.5 | [
"-import math",
"-",
"-",
"-def combinations_count(n, r):",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-",
"-",
"+# forしながらif、ifでないときはforしないので、計算量減",
"- for j in range(10):",
"- for k in range(10):",
"- if str(i) in S:",
"- ... | false | 0.042612 | 0.08613 | 0.494742 | [
"s932582222",
"s492775185"
] |
u136090046 | p04031 | python | s792457459 | s359020510 | 27 | 17 | 3,060 | 3,060 | Accepted | Accepted | 37.04 | num = int(eval(input()))
val = [int(x) for x in input().split()]
val2 = [int(x) for x in range(min(val), max(val))]
array = []
for i in val2:
res = 0
for j in val:
res += pow(abs(i - j), 2)
array.append(res)
print((min(array) if len(array) != 0 else 0))
| import math
n = int(eval(input()))
array = [int(x) for x in input().split()]
tmp = math.ceil(sum(array)/n)
tmp2 = math.floor(sum(array)/n)
print((min(sum([pow(abs(x-tmp2),2) for x in array]), sum([pow(abs(x-tmp),2) for x in array])))) | 14 | 9 | 283 | 237 | num = int(eval(input()))
val = [int(x) for x in input().split()]
val2 = [int(x) for x in range(min(val), max(val))]
array = []
for i in val2:
res = 0
for j in val:
res += pow(abs(i - j), 2)
array.append(res)
print((min(array) if len(array) != 0 else 0))
| import math
n = int(eval(input()))
array = [int(x) for x in input().split()]
tmp = math.ceil(sum(array) / n)
tmp2 = math.floor(sum(array) / n)
print(
(
min(
sum([pow(abs(x - tmp2), 2) for x in array]),
sum([pow(abs(x - tmp), 2) for x in array]),
)
)
)
| false | 35.714286 | [
"-num = int(eval(input()))",
"-val = [int(x) for x in input().split()]",
"-val2 = [int(x) for x in range(min(val), max(val))]",
"-array = []",
"-for i in val2:",
"- res = 0",
"- for j in val:",
"- res += pow(abs(i - j), 2)",
"- array.append(res)",
"-print((min(array) if len(array) ... | false | 0.034514 | 0.035192 | 0.980745 | [
"s792457459",
"s359020510"
] |
u906501980 | p02901 | python | s391778468 | s693249211 | 1,288 | 887 | 3,188 | 3,188 | Accepted | Accepted | 31.13 | n, m = list(map(int, input().split()))
dp = [float('inf')] * 2**n
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([2**(int(i)-1) for i in input().split()])
for s in range(2**n):
t = s|c
if dp[t] > dp[s] + a:
dp[t] = dp[s] + a
ans ... | def main():
n, m = list(map(int, input().split()))
p = 2**n
dp = [float('inf')]*p
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([2**(int(i)-1) for i in input().split()])
for s in range(p):
t = s|c
if dp[t... | 14 | 19 | 367 | 484 | n, m = list(map(int, input().split()))
dp = [float("inf")] * 2**n
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([2 ** (int(i) - 1) for i in input().split()])
for s in range(2**n):
t = s | c
if dp[t] > dp[s] + a:
dp[t] = dp[s] + a
ans = dp[-1]
if ans ... | def main():
n, m = list(map(int, input().split()))
p = 2**n
dp = [float("inf")] * p
dp[0] = 0
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([2 ** (int(i) - 1) for i in input().split()])
for s in range(p):
t = s | c
if dp[t] > dp[s] ... | false | 26.315789 | [
"-n, m = list(map(int, input().split()))",
"-dp = [float(\"inf\")] * 2**n",
"-dp[0] = 0",
"-for _ in range(m):",
"- a, _ = list(map(int, input().split()))",
"- c = sum([2 ** (int(i) - 1) for i in input().split()])",
"- for s in range(2**n):",
"- t = s | c",
"- if dp[t] > dp[s]... | false | 0.123025 | 0.036299 | 3.389172 | [
"s391778468",
"s693249211"
] |
u699089116 | p03478 | python | s246744934 | s737994134 | 188 | 33 | 40,048 | 3,060 | Accepted | Accepted | 82.45 | n, a, b = list(map(int, input().split()))
total = 0
for i in range(1, n+1):
s = str(i)
tmp = 0
for j in s:
tmp += int(j)
if a <= tmp <= b:
total += i
print(total) | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
tmp = 0
for j in str(i):
tmp += int(j)
if a <= tmp <= b:
ans += i
print(ans) | 11 | 11 | 199 | 184 | n, a, b = list(map(int, input().split()))
total = 0
for i in range(1, n + 1):
s = str(i)
tmp = 0
for j in s:
tmp += int(j)
if a <= tmp <= b:
total += i
print(total)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
tmp = 0
for j in str(i):
tmp += int(j)
if a <= tmp <= b:
ans += i
print(ans)
| false | 0 | [
"-total = 0",
"+ans = 0",
"- s = str(i)",
"- for j in s:",
"+ for j in str(i):",
"- total += i",
"-print(total)",
"+ ans += i",
"+print(ans)"
] | false | 0.047227 | 0.040066 | 1.178732 | [
"s246744934",
"s737994134"
] |
u896741788 | p03341 | python | s448056887 | s311468491 | 284 | 222 | 8,144 | 8,352 | Accepted | Accepted | 21.83 | n=int(eval(input()))
S=eval(input())
w,e='W','E'
if e not in S or w not in S:print((0));exit()
ecnt=len([1 for i in list(S) if i==e])
p0,p1=0,ecnt-int(S[0]==e)
ans=p0+p1
p=S[0]
for i in S[1:]:
p0,p1=(p0+int(p==w),p1-int(i==e))
#(l and gyaku,r and gyaku)
ans=min(ans,p0+p1)
p=i
print(ans) | n=int(eval(input()))
S=eval(input())
w,e='W','E'
if e not in S or w not in S:print((0));exit()
ecnt=len([1 for i in list(S) if i==e])
p0,p1=0,ecnt-(S[0]==e)
ans=p0+p1
p=S[0]
for i in S[1:]:
p0,p1=(p0+(p==w),p1-(i==e))
#(l and gyaku,r and gyaku)
ans=min(ans,p0+p1)
p=i
print(ans) | 14 | 14 | 294 | 285 | n = int(eval(input()))
S = eval(input())
w, e = "W", "E"
if e not in S or w not in S:
print((0))
exit()
ecnt = len([1 for i in list(S) if i == e])
p0, p1 = 0, ecnt - int(S[0] == e)
ans = p0 + p1
p = S[0]
for i in S[1:]:
p0, p1 = (p0 + int(p == w), p1 - int(i == e))
# (l and gyaku,r and gyaku)
ans = ... | n = int(eval(input()))
S = eval(input())
w, e = "W", "E"
if e not in S or w not in S:
print((0))
exit()
ecnt = len([1 for i in list(S) if i == e])
p0, p1 = 0, ecnt - (S[0] == e)
ans = p0 + p1
p = S[0]
for i in S[1:]:
p0, p1 = (p0 + (p == w), p1 - (i == e))
# (l and gyaku,r and gyaku)
ans = min(ans, ... | false | 0 | [
"-p0, p1 = 0, ecnt - int(S[0] == e)",
"+p0, p1 = 0, ecnt - (S[0] == e)",
"- p0, p1 = (p0 + int(p == w), p1 - int(i == e))",
"+ p0, p1 = (p0 + (p == w), p1 - (i == e))"
] | false | 0.128221 | 0.04644 | 2.761008 | [
"s448056887",
"s311468491"
] |
u423665486 | p03721 | python | s908080098 | s524201954 | 695 | 563 | 63,704 | 45,400 | Accepted | Accepted | 18.99 | class Node():
def __init__(self, v, w):
self._v = v
self._w = w
def v(self):
return self._v
def w(self):
return self._w
def resolve():
n, k = list(map(int, input().split()))
arr = []
for i in range(n):
a, b = list(map(int, input().split()))
arr.append(Node(a, b))
arr.sort(key=lambda x: ... | def resolve():
n, k = list(map(int, input().split()))
arr = [0]*(10**5+1)
for i in range(n):
a, b = list(map(int, input().split()))
arr[a] += b
for i in range(len(arr)):
if arr[i] >= k:
print(i)
break
k -= arr[i]
resolve() | 21 | 12 | 400 | 239 | class Node:
def __init__(self, v, w):
self._v = v
self._w = w
def v(self):
return self._v
def w(self):
return self._w
def resolve():
n, k = list(map(int, input().split()))
arr = []
for i in range(n):
a, b = list(map(int, input().split()))
arr.a... | def resolve():
n, k = list(map(int, input().split()))
arr = [0] * (10**5 + 1)
for i in range(n):
a, b = list(map(int, input().split()))
arr[a] += b
for i in range(len(arr)):
if arr[i] >= k:
print(i)
break
k -= arr[i]
resolve()
| false | 42.857143 | [
"-class Node:",
"- def __init__(self, v, w):",
"- self._v = v",
"- self._w = w",
"-",
"- def v(self):",
"- return self._v",
"-",
"- def w(self):",
"- return self._w",
"-",
"-",
"- arr = []",
"+ arr = [0] * (10**5 + 1)",
"- arr.append(Node... | false | 0.080004 | 0.07679 | 1.041858 | [
"s908080098",
"s524201954"
] |
u597374218 | p02694 | python | s196446605 | s101234937 | 24 | 22 | 9,180 | 9,192 | Accepted | Accepted | 8.33 | X=int(eval(input()))
year=0
deposit=100
while deposit<X:
deposit=deposit+int(deposit*0.01)
year+=1
print(year) | X=int(eval(input()))
year=0
deposit=100
while deposit<X:
deposit=deposit*101//100
year+=1
print(year) | 7 | 7 | 118 | 109 | X = int(eval(input()))
year = 0
deposit = 100
while deposit < X:
deposit = deposit + int(deposit * 0.01)
year += 1
print(year)
| X = int(eval(input()))
year = 0
deposit = 100
while deposit < X:
deposit = deposit * 101 // 100
year += 1
print(year)
| false | 0 | [
"- deposit = deposit + int(deposit * 0.01)",
"+ deposit = deposit * 101 // 100"
] | false | 0.060456 | 0.059474 | 1.016519 | [
"s196446605",
"s101234937"
] |
u633068244 | p00205 | python | s511254740 | s262512827 | 20 | 10 | 4,212 | 4,208 | Accepted | Accepted | 50 | while 1:
try:
h=[eval(input()) for i in [1]*5]
l=set(h)
if 1 in l and 2 in l:w=1
elif 1 in l and 3 in l:w=3
else:w=2
if len(l)!=2:
for i in h:print(3)
else:
for i in h:print(1 if i==w else 2)
except:break | while 1:
try:
h=[eval(input()) for i in [1]*5]
if 1 in h and 2 in h:w=1
elif 1 in h:w=3
else:w=2
if len(set( h))!=2:
for i in h:print(3)
else:
for i in h:print(1 if i==w else 2)
except:break | 12 | 11 | 229 | 212 | while 1:
try:
h = [eval(input()) for i in [1] * 5]
l = set(h)
if 1 in l and 2 in l:
w = 1
elif 1 in l and 3 in l:
w = 3
else:
w = 2
if len(l) != 2:
for i in h:
print(3)
else:
for i in ... | while 1:
try:
h = [eval(input()) for i in [1] * 5]
if 1 in h and 2 in h:
w = 1
elif 1 in h:
w = 3
else:
w = 2
if len(set(h)) != 2:
for i in h:
print(3)
else:
for i in h:
print(... | false | 8.333333 | [
"- l = set(h)",
"- if 1 in l and 2 in l:",
"+ if 1 in h and 2 in h:",
"- elif 1 in l and 3 in l:",
"+ elif 1 in h:",
"- if len(l) != 2:",
"+ if len(set(h)) != 2:"
] | false | 0.041209 | 0.048986 | 0.841231 | [
"s511254740",
"s262512827"
] |
u648212584 | p02769 | python | s201395766 | s172785585 | 1,135 | 671 | 51,108 | 27,356 | Accepted | Accepted | 40.88 | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N,K = list(map(int,input().split()))
MOD = 10**9+7
fac = [0 for _ in range(4*10**5+1)]
fac[0],fac[1] = 1,1
inv = copy.deepcopy(fac)
invfac = copy.deepcopy(fac)
for i in range(2,4*10**5+1):
fac[i... | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N,K = list(map(int,input().split()))
MOD = 10**9+7
fac = [0 for _ in range(2*10**5+1)]
fac[0],fac[1] = 1,1
inv = copy.deepcopy(fac)
invfac = copy.deepcopy(fac)
for i in range(2,2*10**5+1):
fac[i... | 32 | 32 | 734 | 734 | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
fac = [0 for _ in range(4 * 10**5 + 1)]
fac[0], fac[1] = 1, 1
inv = copy.deepcopy(fac)
invfac = copy.deepcopy(fac)
for i in range(2, 4 * 10**5 + 1):
fac[i] =... | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
fac = [0 for _ in range(2 * 10**5 + 1)]
fac[0], fac[1] = 1, 1
inv = copy.deepcopy(fac)
invfac = copy.deepcopy(fac)
for i in range(2, 2 * 10**5 + 1):
fac[i] =... | false | 0 | [
"- fac = [0 for _ in range(4 * 10**5 + 1)]",
"+ fac = [0 for _ in range(2 * 10**5 + 1)]",
"- for i in range(2, 4 * 10**5 + 1):",
"+ for i in range(2, 2 * 10**5 + 1):"
] | false | 0.886304 | 1.142394 | 0.77583 | [
"s201395766",
"s172785585"
] |
u818349438 | p02888 | python | s027755179 | s937350141 | 863 | 785 | 43,868 | 43,116 | Accepted | Accepted | 9.04 | n= int(eval(input()))
l = list(map(int,input().split()))
l.sort()
def ok(a,b,c):
return a < b+c and b < a+c and c < a+b
ans = 0
for i in range(n):
for j in range(i+1,n):
e1 = l[i]
e2 = l[j]
top = n
bot = j
while top - bot > 1:
mid = (top+bot)//2
... | n = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
ans = 0
def ok(a,b,c):
return c < a+b
for i in range(n):
for j in range(i+1,n):
bot = j
top = n
while top-bot > 1:
mid = (top+bot)//2
if ok(l[i],l[j],l[mid]):bot = mid
else... | 22 | 16 | 456 | 360 | n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
def ok(a, b, c):
return a < b + c and b < a + c and c < a + b
ans = 0
for i in range(n):
for j in range(i + 1, n):
e1 = l[i]
e2 = l[j]
top = n
bot = j
while top - bot > 1:
mid = (top + bot... | n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
def ok(a, b, c):
return c < a + b
for i in range(n):
for j in range(i + 1, n):
bot = j
top = n
while top - bot > 1:
mid = (top + bot) // 2
if ok(l[i], l[j], l[mid]):
bo... | false | 27.272727 | [
"+ans = 0",
"- return a < b + c and b < a + c and c < a + b",
"+ return c < a + b",
"-ans = 0",
"- e1 = l[i]",
"- e2 = l[j]",
"+ bot = j",
"- bot = j",
"- if ok(l[mid], e1, e2):",
"+ if ok(l[i], l[j], l[mid]):",
"- ans += top - j - 1... | false | 0.044954 | 0.043834 | 1.025553 | [
"s027755179",
"s937350141"
] |
u190405389 | p03618 | python | s943780905 | s842770824 | 27 | 23 | 3,500 | 3,500 | Accepted | Accepted | 14.81 | a = eval(input())
total = 1 + (len(a) * (len(a) - 1) // 2)
for i in range(97, 97 + 26):
atoz = (a.count(chr(i)) * (a.count(chr(i)) - 1)) // 2
total -= atoz
print(total)
| a=eval(input())
b=1+(len(a)*(len(a)-1)//2)
for i in range(97,123):
c=a.count(chr(i))
d=(c*(c-1))//2
b-=d
print(b) | 8 | 7 | 180 | 125 | a = eval(input())
total = 1 + (len(a) * (len(a) - 1) // 2)
for i in range(97, 97 + 26):
atoz = (a.count(chr(i)) * (a.count(chr(i)) - 1)) // 2
total -= atoz
print(total)
| a = eval(input())
b = 1 + (len(a) * (len(a) - 1) // 2)
for i in range(97, 123):
c = a.count(chr(i))
d = (c * (c - 1)) // 2
b -= d
print(b)
| false | 12.5 | [
"-total = 1 + (len(a) * (len(a) - 1) // 2)",
"-for i in range(97, 97 + 26):",
"- atoz = (a.count(chr(i)) * (a.count(chr(i)) - 1)) // 2",
"- total -= atoz",
"-print(total)",
"+b = 1 + (len(a) * (len(a) - 1) // 2)",
"+for i in range(97, 123):",
"+ c = a.count(chr(i))",
"+ d = (c * (c - 1))... | false | 0.043932 | 0.038626 | 1.137371 | [
"s943780905",
"s842770824"
] |
u480472958 | p03634 | python | s604863342 | s209594431 | 1,089 | 752 | 68,096 | 68,112 | Accepted | Accepted | 30.95 | def dfs(k, path, n):
"""連結情報path,頂点の個数Nが与えられたとき
頂点Kから各頂点までの距離をlistで返す"""
from collections import deque # deque(),popleft()
dist = [-1] * n
dist[k] = 0
que = deque([])
que.append(k)
while que:
label = que.popleft()
for i,c in path[label]: # 頂点labelと連結している頂点iと距離c
... | from sys import stdin
input = stdin.readline
def dfs(k, path, n):
"""連結情報path,頂点の個数Nが与えられたとき
頂点Kから各頂点までの距離をlistで返す"""
from collections import deque # deque(),popleft()
dist = [-1] * n
dist[k] = 0
que = deque([])
que.append(k)
while que:
label = que.popleft()
... | 31 | 34 | 868 | 917 | def dfs(k, path, n):
"""連結情報path,頂点の個数Nが与えられたとき
頂点Kから各頂点までの距離をlistで返す"""
from collections import deque # deque(),popleft()
dist = [-1] * n
dist[k] = 0
que = deque([])
que.append(k)
while que:
label = que.popleft()
for i, c in path[label]: # 頂点labelと連結している頂点iと距離c
... | from sys import stdin
input = stdin.readline
def dfs(k, path, n):
"""連結情報path,頂点の個数Nが与えられたとき
頂点Kから各頂点までの距離をlistで返す"""
from collections import deque # deque(),popleft()
dist = [-1] * n
dist[k] = 0
que = deque([])
que.append(k)
while que:
label = que.popleft()
for i, c... | false | 8.823529 | [
"+from sys import stdin",
"+",
"+input = stdin.readline",
"+",
"+"
] | false | 0.157035 | 0.115223 | 1.36288 | [
"s604863342",
"s209594431"
] |
u669360983 | p02389 | python | s179936237 | s580620369 | 30 | 20 | 6,724 | 4,180 | Accepted | Accepted | 33.33 | (x,y)=list(map(int, input().split(" ")))
print((x * y, 2 * x + 2* y)) | x,y=list(map(int,input().split()))
print(x*y,2*(x+y)) | 2 | 2 | 62 | 51 | (x, y) = list(map(int, input().split(" ")))
print((x * y, 2 * x + 2 * y))
| x, y = list(map(int, input().split()))
print(x * y, 2 * (x + y))
| false | 0 | [
"-(x, y) = list(map(int, input().split(\" \")))",
"-print((x * y, 2 * x + 2 * y))",
"+x, y = list(map(int, input().split()))",
"+print(x * y, 2 * (x + y))"
] | false | 0.051697 | 0.050245 | 1.028898 | [
"s179936237",
"s580620369"
] |
u189023301 | p02559 | python | s090381911 | s433460157 | 1,548 | 624 | 132,588 | 175,832 | Accepted | Accepted | 59.69 | class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * n
def sum(self, i):
s = 0
while i > 0:
s += self.data[i - 1]
i &= i - 1
return s
def update(self, i, x):
while i < self.n:
self.data[i] += x
... | import sys
input = lambda: sys.stdin.readline()
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * n
def sum(self, i):
s = 0
while i > 0:
s += self.data[i - 1]
i &= i - 1
return s
def update(self, i, x):
w... | 31 | 36 | 636 | 736 | class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * n
def sum(self, i):
s = 0
while i > 0:
s += self.data[i - 1]
i &= i - 1
return s
def update(self, i, x):
while i < self.n:
self.data[i] += x
i |= i... | import sys
input = lambda: sys.stdin.readline()
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * n
def sum(self, i):
s = 0
while i > 0:
s += self.data[i - 1]
i &= i - 1
return s
def update(self, i, x):
while i < self.... | false | 13.888889 | [
"+import sys",
"+",
"+input = lambda: sys.stdin.readline()",
"+",
"+",
"+res = []",
"- print((b.sum(y) - b.sum(x)))",
"+ res.append(b.sum(y) - b.sum(x))",
"+print((\"\\n\".join(map(str, res))))"
] | false | 0.046514 | 0.046884 | 0.992103 | [
"s090381911",
"s433460157"
] |
u069699931 | p02621 | python | s967426437 | s633500623 | 28 | 24 | 9,040 | 8,920 | Accepted | Accepted | 14.29 | a=int(eval(input()))
print((a+(a**2)+(a**3))) | a=int(eval(input()))
print((a+a**2+a**3)) | 2 | 2 | 38 | 34 | a = int(eval(input()))
print((a + (a**2) + (a**3)))
| a = int(eval(input()))
print((a + a**2 + a**3))
| false | 0 | [
"-print((a + (a**2) + (a**3)))",
"+print((a + a**2 + a**3))"
] | false | 0.036379 | 0.036213 | 1.004604 | [
"s967426437",
"s633500623"
] |
u311379832 | p03162 | python | s824983508 | s134884090 | 820 | 385 | 53,444 | 28,768 | Accepted | Accepted | 53.05 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
def chmax(a, b):
if a < b:
a = b
return b
return a
N = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(N)]
dp = [list([0] * 3) for _ in range(N + 1)]
for i in range(N):
for j in range(3)... | N = int(eval(input()))
dp = [[0 for _ in range(3)] for _ in range(N + 1)]
a, b, c = list(map(int, input().split()))
dp[1][0] = a
dp[1][1] = b
dp[1][2] = c
for i in range(2, N + 1):
a, b, c = list(map(int, input().split()))
dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)
dp[i][1] = max(dp[i - 1][... | 25 | 13 | 536 | 404 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
def chmax(a, b):
if a < b:
a = b
return b
return a
N = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(N)]
dp = [list([0] * 3) for _ in range(N + 1)]
for i in range(N):
for j in range(3):
f... | N = int(eval(input()))
dp = [[0 for _ in range(3)] for _ in range(N + 1)]
a, b, c = list(map(int, input().split()))
dp[1][0] = a
dp[1][1] = b
dp[1][2] = c
for i in range(2, N + 1):
a, b, c = list(map(int, input().split()))
dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)
dp[i][1] = max(dp[i - 1][0] + b, d... | false | 48 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**8)",
"-",
"-",
"-def chmax(a, b):",
"- if a < b:",
"- a = b",
"- return b",
"- return a",
"-",
"-",
"-a = [list(map(int, input().split())) for _ in range(N)]",
"-dp = [list([0] * 3) for _ i... | false | 0.042881 | 0.042641 | 1.005614 | [
"s824983508",
"s134884090"
] |
u580920947 | p02952 | python | s594885316 | s596127516 | 192 | 177 | 40,148 | 39,024 | Accepted | Accepted | 7.81 | #!/usr/bin/env python
def main(N):
ans = 0
for i in range(1, N+1):
if len(str(i)) % 2 == 1:
ans += 1
return(ans)
if __name__ == '__main__':
N = int(eval(input()))
print((main(N)))
| #!/usr/bin/env python
def main():
N = int(eval(input()))
ans = 0
for i in range(1, N+1):
if len(str(i)) %2 == 1:
ans += 1
print(ans)
if __name__ == '__main__':
main()
| 12 | 12 | 230 | 214 | #!/usr/bin/env python
def main(N):
ans = 0
for i in range(1, N + 1):
if len(str(i)) % 2 == 1:
ans += 1
return ans
if __name__ == "__main__":
N = int(eval(input()))
print((main(N)))
| #!/usr/bin/env python
def main():
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if len(str(i)) % 2 == 1:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"-def main(N):",
"+def main():",
"+ N = int(eval(input()))",
"- return ans",
"+ print(ans)",
"- N = int(eval(input()))",
"- print((main(N)))",
"+ main()"
] | false | 0.039629 | 0.054672 | 0.724852 | [
"s594885316",
"s596127516"
] |
u498487134 | p02861 | python | s401694866 | s569397938 | 168 | 81 | 38,384 | 73,656 | Accepted | Accepted | 51.79 | import math
N = int(eval(input()))
x = [0]*N
y = [0]*N
for i in range(N):
x[i],y[i]=list(map(int,input().split()))
ans=0
for i in range(N):
for j in range(i):
ans+=math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
print((ans*2/N)) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
X=[0]*N
Y=[0]*N
d=[[0]*N for _ in range(N)]
for i in range(N):
X[i],Y[i... | 13 | 39 | 241 | 808 | import math
N = int(eval(input()))
x = [0] * N
y = [0] * N
for i in range(N):
x[i], y[i] = list(map(int, input().split()))
ans = 0
for i in range(N):
for j in range(i):
ans += math.sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2)
print((ans * 2 / N))
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
X = [0] * N
Y = [0] * N
d = [[0] * N for _ in range(N)]
for i in ran... | false | 66.666667 | [
"-import math",
"+import sys",
"-N = int(eval(input()))",
"-x = [0] * N",
"-y = [0] * N",
"-for i in range(N):",
"- x[i], y[i] = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(N):",
"- for j in range(i):",
"- ans += math.sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2)"... | false | 0.039573 | 0.060242 | 0.656905 | [
"s401694866",
"s569397938"
] |
u761529120 | p03329 | python | s244298932 | s796094204 | 216 | 87 | 44,112 | 74,708 | Accepted | Accepted | 59.72 | def main():
N = int(eval(input()))
dp = [float('inf')] * (N + 10)
dp[0] = 0
for i in range(1, N+1):
power = 1
while(power <= i):
dp[i] = min(dp[i], dp[i-power] + 1)
power *= 6
power = 1
while(power <= i):
dp[i] = mi... | def main():
N = int(eval(input()))
cand = [1]
dp = [float('inf')] * (N + 5)
tmp = 6
cnt = 1
while tmp**cnt <= N:
cand.append(tmp**cnt)
cnt += 1
tmp = 9
cnt = 1
while tmp**cnt <= N:
cand.append(tmp**cnt)
cnt += 1
cand.sort()
dp[0]... | 20 | 24 | 393 | 507 | def main():
N = int(eval(input()))
dp = [float("inf")] * (N + 10)
dp[0] = 0
for i in range(1, N + 1):
power = 1
while power <= i:
dp[i] = min(dp[i], dp[i - power] + 1)
power *= 6
power = 1
while power <= i:
dp[i] = min(dp[i], dp[i - pow... | def main():
N = int(eval(input()))
cand = [1]
dp = [float("inf")] * (N + 5)
tmp = 6
cnt = 1
while tmp**cnt <= N:
cand.append(tmp**cnt)
cnt += 1
tmp = 9
cnt = 1
while tmp**cnt <= N:
cand.append(tmp**cnt)
cnt += 1
cand.sort()
dp[0] = 0
for i ... | false | 16.666667 | [
"- dp = [float(\"inf\")] * (N + 10)",
"+ cand = [1]",
"+ dp = [float(\"inf\")] * (N + 5)",
"+ tmp = 6",
"+ cnt = 1",
"+ while tmp**cnt <= N:",
"+ cand.append(tmp**cnt)",
"+ cnt += 1",
"+ tmp = 9",
"+ cnt = 1",
"+ while tmp**cnt <= N:",
"+ cand.ap... | false | 0.083494 | 0.083388 | 1.001275 | [
"s244298932",
"s796094204"
] |
u821432765 | p03013 | python | s859906634 | s024117307 | 457 | 198 | 460,020 | 11,884 | Accepted | Accepted | 56.67 | N, M = list(map(int, input().split()))
A = set([int(eval(input())) for _ in range(M)])
dp = [0, 1]
for i in range(N):
if i+1 in A: dp.append(0)
else: dp.append(dp[i]+dp[i+1])
print((dp[N+1]%1000000007)) | N, M = [int(i) for i in input().split()]
A = {int(eval(input())) for _ in range(M)}
dp = [0] * 101000
dp[0] = 1
dp[1] = 0 if 1 in A else 1
for i in range(2, N+1):
if not i-1 in A:
dp[i] += dp[i-1]
if not i-2 in A:
dp[i] += dp[i-2]
dp[i] %= 1000000007
print((dp[N]))
| 8 | 15 | 204 | 303 | N, M = list(map(int, input().split()))
A = set([int(eval(input())) for _ in range(M)])
dp = [0, 1]
for i in range(N):
if i + 1 in A:
dp.append(0)
else:
dp.append(dp[i] + dp[i + 1])
print((dp[N + 1] % 1000000007))
| N, M = [int(i) for i in input().split()]
A = {int(eval(input())) for _ in range(M)}
dp = [0] * 101000
dp[0] = 1
dp[1] = 0 if 1 in A else 1
for i in range(2, N + 1):
if not i - 1 in A:
dp[i] += dp[i - 1]
if not i - 2 in A:
dp[i] += dp[i - 2]
dp[i] %= 1000000007
print((dp[N]))
| false | 46.666667 | [
"-N, M = list(map(int, input().split()))",
"-A = set([int(eval(input())) for _ in range(M)])",
"-dp = [0, 1]",
"-for i in range(N):",
"- if i + 1 in A:",
"- dp.append(0)",
"- else:",
"- dp.append(dp[i] + dp[i + 1])",
"-print((dp[N + 1] % 1000000007))",
"+N, M = [int(i) for i in... | false | 0.040747 | 0.035823 | 1.137465 | [
"s859906634",
"s024117307"
] |
u844789719 | p03215 | python | s810477153 | s620562923 | 2,263 | 163 | 34,664 | 39,796 | Accepted | Accepted | 92.8 | N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = []
for i in range(N):
B += [A[i]]
for j in range(i+1,N):
B += [B[-1] + A[j]]
ans = 0
for i in range(40, -1, -1):
B_new = []
for b in B:
if b & 2 ** i:
B_new += [b]
if len(B_n... | import numpy as np
N, K = [int(_) for _ in input().split()]
A = np.array([0] + [int(_) for _ in input().split()])
C = np.cumsum(A)
X = np.zeros(N * (N + 1) // 2, dtype=int)
il = 0
for l in range(N):
X[il:il + N - l] = C[l + 1:N + 1] - C[l]
il += N - l
ans = 0
for i in range(40, -1, -1):
Y = (X //... | 20 | 17 | 453 | 422 | N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = []
for i in range(N):
B += [A[i]]
for j in range(i + 1, N):
B += [B[-1] + A[j]]
ans = 0
for i in range(40, -1, -1):
B_new = []
for b in B:
if b & 2**i:
B_new += [b]
if len(B_new) >= K:
... | import numpy as np
N, K = [int(_) for _ in input().split()]
A = np.array([0] + [int(_) for _ in input().split()])
C = np.cumsum(A)
X = np.zeros(N * (N + 1) // 2, dtype=int)
il = 0
for l in range(N):
X[il : il + N - l] = C[l + 1 : N + 1] - C[l]
il += N - l
ans = 0
for i in range(40, -1, -1):
Y = X // (2**i)... | false | 15 | [
"+import numpy as np",
"+",
"-A = [int(_) for _ in input().split()]",
"-B = []",
"-for i in range(N):",
"- B += [A[i]]",
"- for j in range(i + 1, N):",
"- B += [B[-1] + A[j]]",
"+A = np.array([0] + [int(_) for _ in input().split()])",
"+C = np.cumsum(A)",
"+X = np.zeros(N * (N + 1) ... | false | 0.036758 | 0.160813 | 0.228578 | [
"s810477153",
"s620562923"
] |
u022407960 | p02371 | python | s944872880 | s558608176 | 560 | 450 | 59,724 | 63,124 | Accepted | Accepted | 19.64 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
0 1 2
1 2 1
1 3 3
output:
5
"""
import sys
from collections import deque
from math import isinf
def generate_adj_table(v_table):
for each in v_table:
source, target, cost = list(map(int, each))
init_adj_table[sourc... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
0 1 2
1 2 1
1 3 3
output:
5
"""
import sys
from math import isinf
from collections import deque
def generate_adj_table(v_table, init_adj_table):
for each in v_table:
source, target, cost = list(map(int, each))
init... | 77 | 80 | 1,683 | 1,829 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
0 1 2
1 2 1
1 3 3
output:
5
"""
import sys
from collections import deque
from math import isinf
def generate_adj_table(v_table):
for each in v_table:
source, target, cost = list(map(int, each))
init_adj_table[source].setdefault(target, cos... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
0 1 2
1 2 1
1 3 3
output:
5
"""
import sys
from math import isinf
from collections import deque
def generate_adj_table(v_table, init_adj_table):
for each in v_table:
source, target, cost = list(map(int, each))
init_adj_table[source][target... | false | 3.75 | [
"+from math import isinf",
"-from math import isinf",
"-def generate_adj_table(v_table):",
"+def generate_adj_table(v_table, init_adj_table):",
"- init_adj_table[source].setdefault(target, cost)",
"- init_adj_table[target].setdefault(source, cost)",
"+ init_adj_table[source][target]... | false | 0.038948 | 0.044989 | 0.865724 | [
"s944872880",
"s558608176"
] |
u318127926 | p02888 | python | s437492323 | s309064725 | 1,497 | 1,244 | 3,188 | 3,316 | Accepted | Accepted | 16.9 | from bisect import bisect_left
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n-2):
for j in range(i+1, n-1):
ans += bisect_left(l, l[i]+l[j], j+1, n) - j - 1
print(ans)
| from bisect import bisect_left
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for a in range(n-2):
for b in range(a+1, n-1):
ans += bisect_left(l, l[a]+l[b]) - b - 1
print(ans) | 9 | 9 | 222 | 219 | from bisect import bisect_left
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
ans += bisect_left(l, l[i] + l[j], j + 1, n) - j - 1
print(ans)
| from bisect import bisect_left
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for a in range(n - 2):
for b in range(a + 1, n - 1):
ans += bisect_left(l, l[a] + l[b]) - b - 1
print(ans)
| false | 0 | [
"-for i in range(n - 2):",
"- for j in range(i + 1, n - 1):",
"- ans += bisect_left(l, l[i] + l[j], j + 1, n) - j - 1",
"+for a in range(n - 2):",
"+ for b in range(a + 1, n - 1):",
"+ ans += bisect_left(l, l[a] + l[b]) - b - 1"
] | false | 0.039869 | 0.064509 | 0.618042 | [
"s437492323",
"s309064725"
] |
u043211170 | p04012 | python | s561696983 | s043661059 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | w=eval(input())
x={}
for s in w:
if s in list(x.keys()):
x[s]+=1
else:
x[s]=1
for v in list(x.values()):
if v%2==1:
print('No')
exit()
print('Yes') | w=eval(input())
x={}
for s in w:
if s in list(x.keys()):
x[s]+=1
else:
x[s]=1
f=False
for v in list(x.values()):
if v%2==1:
print('No')
f=True
break
if not(f):
print('Yes') | 12 | 15 | 184 | 224 | w = eval(input())
x = {}
for s in w:
if s in list(x.keys()):
x[s] += 1
else:
x[s] = 1
for v in list(x.values()):
if v % 2 == 1:
print("No")
exit()
print("Yes")
| w = eval(input())
x = {}
for s in w:
if s in list(x.keys()):
x[s] += 1
else:
x[s] = 1
f = False
for v in list(x.values()):
if v % 2 == 1:
print("No")
f = True
break
if not (f):
print("Yes")
| false | 20 | [
"+f = False",
"- exit()",
"-print(\"Yes\")",
"+ f = True",
"+ break",
"+if not (f):",
"+ print(\"Yes\")"
] | false | 0.042932 | 0.041889 | 1.024915 | [
"s561696983",
"s043661059"
] |
u941407962 | p02626 | python | s304797280 | s079258807 | 73 | 62 | 62,140 | 61,888 | Accepted | Accepted | 15.07 | import sys
N, = list(map(int, input().split()))
X = list(map(int, input().split()))
S = X[0]+X[1]
T = 0
for i in range(2, N):
T ^= X[i]
if S<T or (S-T)%2:
print((-1))
sys.exit()
D = (S-T)//2
if D&T:
print((-1))
sys.exit()
Y = D
for i in range(T.bit_length()+1, -1, -1):
if T&(... | import sys
N, = list(map(int, input().split()))
X = list(map(int, input().split()))
S = X[0]+X[1]
T = 0
for i in range(2, N):
T ^= X[i]
D = (S-T)//2
if S<T or (S-T)%2 or T&D:
print((-1))
sys.exit()
for i in range(T.bit_length()+1, -1, -1):
if T&(1<<i)|D <= X[0]:
D |= T&(1<<i)
if 0<... | 24 | 18 | 406 | 362 | import sys
(N,) = list(map(int, input().split()))
X = list(map(int, input().split()))
S = X[0] + X[1]
T = 0
for i in range(2, N):
T ^= X[i]
if S < T or (S - T) % 2:
print((-1))
sys.exit()
D = (S - T) // 2
if D & T:
print((-1))
sys.exit()
Y = D
for i in range(T.bit_length() + 1, -1, -1):
if T & ... | import sys
(N,) = list(map(int, input().split()))
X = list(map(int, input().split()))
S = X[0] + X[1]
T = 0
for i in range(2, N):
T ^= X[i]
D = (S - T) // 2
if S < T or (S - T) % 2 or T & D:
print((-1))
sys.exit()
for i in range(T.bit_length() + 1, -1, -1):
if T & (1 << i) | D <= X[0]:
D |= T &... | false | 25 | [
"-if S < T or (S - T) % 2:",
"+D = (S - T) // 2",
"+if S < T or (S - T) % 2 or T & D:",
"-D = (S - T) // 2",
"-if D & T:",
"- print((-1))",
"- sys.exit()",
"-Y = D",
"- if T & (1 << i) | Y <= X[0]:",
"- Y |= T & (1 << i)",
"-if 0 < Y <= X[0]:",
"- print((X[0] - Y))",
"+ ... | false | 0.083848 | 0.042488 | 1.973456 | [
"s304797280",
"s079258807"
] |
u265154666 | p02683 | python | s792138565 | s686692905 | 135 | 98 | 69,452 | 68,676 | Accepted | Accepted | 27.41 | # -*- coding: utf-8 -*-
# C
import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
# 再起回数上限変更
# sys.setrecursionlimit(1000000)
import itertools
N, M, X = list(map(int, input().split()))
data = []
for i in range(N):
data.append(list(ma... | # -*- coding: utf-8 -*-
# C
import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
# 再起回数上限変更
# sys.setrecursionlimit(1000000)
import itertools
N, M, X = list(map(int, input().split()))
data = []
for i in range(N):
data.append(list(ma... | 42 | 44 | 826 | 887 | # -*- coding: utf-8 -*-
# C
import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
# 再起回数上限変更
# sys.setrecursionlimit(1000000)
import itertools
N, M, X = list(map(int, input().split()))
data = []
for i in range(N):
data.append(list(map(int, input().spli... | # -*- coding: utf-8 -*-
# C
import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
# 再起回数上限変更
# sys.setrecursionlimit(1000000)
import itertools
N, M, X = list(map(int, input().split()))
data = []
for i in range(N):
data.append(list(map(int, input().spli... | false | 4.545455 | [
"-for case in list(itertools.product(\"01\", repeat=N)):",
"+for case in range(2**N):",
"+ # for case in list(itertools.product('01', repeat=N)):",
"- if case[j] == \"1\":",
"+ # if case[j]=='1':",
"+ if case >> j & 1:"
] | false | 0.104384 | 0.038044 | 2.74381 | [
"s792138565",
"s686692905"
] |
u929569377 | p03162 | python | s634823652 | s622885940 | 634 | 422 | 47,380 | 3,060 | Accepted | Accepted | 33.44 | N = int(eval(input()))
abc = [list([int(x) for x in input().split()]) for _ in range(N)]
happy = [[0] * 3 for _ in range(N)]
for i in range(3):
happy[0][i] = abc[0][i]
for i in range(1, N):
happy[i][0] = max(happy[i - 1][1], happy[i - 1][2]) + abc[i][0]
happy[i][1] = max(happy[i - 1][0], happy[i - 1][2]... | N = int(eval(input()))
l = [0] * 3
for i in range(N):
a = [int(x) for x in input().split()]
c = [a[0] + max(l[1], l[2]), a[1] + max(l[2], l[0]), a[2] + max(l[0], l[1])]
l = c
print((max(l))) | 14 | 8 | 463 | 202 | N = int(eval(input()))
abc = [list([int(x) for x in input().split()]) for _ in range(N)]
happy = [[0] * 3 for _ in range(N)]
for i in range(3):
happy[0][i] = abc[0][i]
for i in range(1, N):
happy[i][0] = max(happy[i - 1][1], happy[i - 1][2]) + abc[i][0]
happy[i][1] = max(happy[i - 1][0], happy[i - 1][2]) + ... | N = int(eval(input()))
l = [0] * 3
for i in range(N):
a = [int(x) for x in input().split()]
c = [a[0] + max(l[1], l[2]), a[1] + max(l[2], l[0]), a[2] + max(l[0], l[1])]
l = c
print((max(l)))
| false | 42.857143 | [
"-abc = [list([int(x) for x in input().split()]) for _ in range(N)]",
"-happy = [[0] * 3 for _ in range(N)]",
"-for i in range(3):",
"- happy[0][i] = abc[0][i]",
"-for i in range(1, N):",
"- happy[i][0] = max(happy[i - 1][1], happy[i - 1][2]) + abc[i][0]",
"- happy[i][1] = max(happy[i - 1][0], ... | false | 0.050888 | 0.0349 | 1.45811 | [
"s634823652",
"s622885940"
] |
u762420987 | p03821 | python | s303884507 | s195138179 | 351 | 191 | 17,380 | 16,624 | Accepted | Accepted | 45.58 | N = int(eval(input()))
ABlist = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for a, b in ABlist[::-1]:
a += ans
if a % b == 0:
continue
else:
ans += (b - a % b)
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
ABlist = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for a, b in reversed(ABlist):
if (a + ans) % b == 0:
continue
else:
ans += b - (a + ans) % b
print(ans)
| 10 | 12 | 219 | 265 | N = int(eval(input()))
ABlist = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for a, b in ABlist[::-1]:
a += ans
if a % b == 0:
continue
else:
ans += b - a % b
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
ABlist = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for a, b in reversed(ABlist):
if (a + ans) % b == 0:
continue
else:
ans += b - (a + ans) % b
print(ans)
| false | 16.666667 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-for a, b in ABlist[::-1]:",
"- a += ans",
"- if a % b == 0:",
"+for a, b in reversed(ABlist):",
"+ if (a + ans) % b == 0:",
"- ans += b - a % b",
"+ ans += b - (a + ans) % b"
] | false | 0.136512 | 0.064165 | 2.127495 | [
"s303884507",
"s195138179"
] |
u062147869 | p03298 | python | s602096525 | s872008614 | 2,845 | 1,311 | 150,488 | 200,060 | Accepted | Accepted | 53.92 | from collections import defaultdict
N=int(eval(input()))
S=eval(input())
A=S[:N]
B=S[N:]
B=B[::-1]
def f(A):
dd=defaultdict(int)
for i in range(1<<N):
a=''
b=''
for j in range(N):
if i&(1<<j):
a+=A[j]
else:
b+=A[j]
... | from collections import defaultdict
N=int(eval(input()))
S=eval(input())
A=S[:N]
B=S[N:]
B=B[::-1]
def f(A):
dd=defaultdict(int)
for i in range(1<<N):
a=[]
b=[]
for j in range(N):
if i&(1<<j):
a.append(A[j])
else:
b.a... | 24 | 27 | 425 | 486 | from collections import defaultdict
N = int(eval(input()))
S = eval(input())
A = S[:N]
B = S[N:]
B = B[::-1]
def f(A):
dd = defaultdict(int)
for i in range(1 << N):
a = ""
b = ""
for j in range(N):
if i & (1 << j):
a += A[j]
else:
... | from collections import defaultdict
N = int(eval(input()))
S = eval(input())
A = S[:N]
B = S[N:]
B = B[::-1]
def f(A):
dd = defaultdict(int)
for i in range(1 << N):
a = []
b = []
for j in range(N):
if i & (1 << j):
a.append(A[j])
else:
... | false | 11.111111 | [
"- a = \"\"",
"- b = \"\"",
"+ a = []",
"+ b = []",
"- a += A[j]",
"+ a.append(A[j])",
"- b += A[j]",
"- dd[(a, b)] += 1",
"+ b.append(A[j])",
"+ s = \"\".join(a)",
"+ t = \"\".join(b)",
... | false | 0.0378 | 0.055485 | 0.681274 | [
"s602096525",
"s872008614"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.