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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u083960235 | p02844 | python | s990996040 | s576527918 | 499 | 258 | 80,764 | 78,848 | Accepted | Accepted | 48.3 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 63 | 35 | 2,110 | 1,038 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 44.444444 | [
"-L = eval(input())",
"-S = list(map(int, list(L)))",
"-# print(S)",
"-cnt = 0",
"-# 000-999 1000",
"-for i in range(0, 10):",
"- for j in range(0, 10):",
"- for k in range(0, 10):",
"- num = 0",
"- flag = False",
"- exist = [False] * 3",
"- ... | false | 0.047674 | 0.045468 | 1.048514 | [
"s990996040",
"s576527918"
] |
u346812984 | p03311 | python | s049187866 | s356351967 | 244 | 205 | 26,180 | 25,196 | Accepted | Accepted | 15.98 | N = int(eval(input()))
A = list(map(int, input().split()))
A_i = [A[i] - i - 1 for i in range(N)]
A_i.sort()
if N % 2 == 1:
b = A_i[N // 2]
ans = 0
for a in A_i:
ans += abs(a - b)
print(ans)
else:
b1 = A_i[N // 2]
b2 = A_i[N // 2 - 1]
ans1 = 0
ans2 = 0
for ... | N = int(eval(input()))
A = list(map(int, input().split()))
A_i = [A[i] - i - 1 for i in range(N)]
A_i.sort()
b = A_i[N // 2]
ans = 0
for a in A_i:
ans += abs(a - b)
print(ans)
| 21 | 11 | 410 | 186 | N = int(eval(input()))
A = list(map(int, input().split()))
A_i = [A[i] - i - 1 for i in range(N)]
A_i.sort()
if N % 2 == 1:
b = A_i[N // 2]
ans = 0
for a in A_i:
ans += abs(a - b)
print(ans)
else:
b1 = A_i[N // 2]
b2 = A_i[N // 2 - 1]
ans1 = 0
ans2 = 0
for a in A_i:
a... | N = int(eval(input()))
A = list(map(int, input().split()))
A_i = [A[i] - i - 1 for i in range(N)]
A_i.sort()
b = A_i[N // 2]
ans = 0
for a in A_i:
ans += abs(a - b)
print(ans)
| false | 47.619048 | [
"-if N % 2 == 1:",
"- b = A_i[N // 2]",
"- ans = 0",
"- for a in A_i:",
"- ans += abs(a - b)",
"- print(ans)",
"-else:",
"- b1 = A_i[N // 2]",
"- b2 = A_i[N // 2 - 1]",
"- ans1 = 0",
"- ans2 = 0",
"- for a in A_i:",
"- ans1 += abs(a - b1)",
"- ... | false | 0.128892 | 0.047981 | 2.686297 | [
"s049187866",
"s356351967"
] |
u275934251 | p03095 | python | s898929330 | s299051630 | 302 | 185 | 49,136 | 45,296 | Accepted | Accepted | 38.74 | n=int(eval(input()))
s=list(eval(input()))
a=set(s)
ans=1
for i in a:
ans=ans*(s.count(i)+1)%(10**9+7)
print((ans-1)) | eval(input());s=eval(input());a=set(s)
ans=1
for i in a:ans=ans*(s.count(i)+1)%(10**9+7)
print((ans-1)) | 7 | 4 | 113 | 92 | n = int(eval(input()))
s = list(eval(input()))
a = set(s)
ans = 1
for i in a:
ans = ans * (s.count(i) + 1) % (10**9 + 7)
print((ans - 1))
| eval(input())
s = eval(input())
a = set(s)
ans = 1
for i in a:
ans = ans * (s.count(i) + 1) % (10**9 + 7)
print((ans - 1))
| false | 42.857143 | [
"-n = int(eval(input()))",
"-s = list(eval(input()))",
"+eval(input())",
"+s = eval(input())"
] | false | 0.081615 | 0.006856 | 11.903542 | [
"s898929330",
"s299051630"
] |
u214617707 | p03262 | python | s046593561 | s757619023 | 163 | 106 | 16,784 | 14,252 | Accepted | Accepted | 34.97 | n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
rec = set()
for i in range(n):
rec.add(abs(x[i] - X))
rec = sorted(list(rec))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
num = rec[0]
for k in range(1, len(rec)):
num = gc... | N, x = list(map(int, input().split()))
X = list([abs(int(p) - x) for p in input().split()])
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
q = X[0]
for i in range(1, N):
q = gcd(q, X[i])
print(q) | 22 | 16 | 345 | 257 | n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
rec = set()
for i in range(n):
rec.add(abs(x[i] - X))
rec = sorted(list(rec))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
num = rec[0]
for k in range(1, len(rec)):
num = gcd(num, rec[k])
prin... | N, x = list(map(int, input().split()))
X = list([abs(int(p) - x) for p in input().split()])
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
q = X[0]
for i in range(1, N):
q = gcd(q, X[i])
print(q)
| false | 27.272727 | [
"-n, X = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-rec = set()",
"-for i in range(n):",
"- rec.add(abs(x[i] - X))",
"-rec = sorted(list(rec))",
"+N, x = list(map(int, input().split()))",
"+X = list([abs(int(p) - x) for p in input().split()])",
"-num = rec[0]",
... | false | 0.042814 | 0.041695 | 1.026829 | [
"s046593561",
"s757619023"
] |
u785066634 | p02860 | python | s548920598 | s049075451 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n=int(eval(input()))
s=eval(input())
if n %2 !=0:
print('No')
elif s[:n//2]==s[n//2:]:
print('Yes')
else:
print('No')
| n=int(eval(input()))
s=list(str(eval(input())))
if n%2!=0:
print('No')
elif len(set(s[:n//2]))!=len(set(s[n//2:])):
print('No')
elif s[:n//2]!=s[n//2:]:
print('No')
else:
print('Yes')
| 9 | 14 | 163 | 297 | n = int(eval(input()))
s = eval(input())
if n % 2 != 0:
print("No")
elif s[: n // 2] == s[n // 2 :]:
print("Yes")
else:
print("No")
| n = int(eval(input()))
s = list(str(eval(input())))
if n % 2 != 0:
print("No")
elif len(set(s[: n // 2])) != len(set(s[n // 2 :])):
print("No")
elif s[: n // 2] != s[n // 2 :]:
print("No")
else:
print("Yes")
| false | 35.714286 | [
"-s = eval(input())",
"+s = list(str(eval(input())))",
"-elif s[: n // 2] == s[n // 2 :]:",
"+elif len(set(s[: n // 2])) != len(set(s[n // 2 :])):",
"+ print(\"No\")",
"+elif s[: n // 2] != s[n // 2 :]:",
"+ print(\"No\")",
"+else:",
"-else:",
"- print(\"No\")"
] | false | 0.041582 | 0.042535 | 0.977583 | [
"s548920598",
"s049075451"
] |
u729133443 | p02943 | python | s753545404 | s371851022 | 301 | 79 | 160,392 | 133,236 | Accepted | Accepted | 73.75 | n,k=list(map(int,input().split()))
s=eval(input())
r=list(range(n))
u=min((s+s[::-1])[i:]for i in r)
i=min(i for i in r if u[i]!=u[0])
print(((u[0]*min(i<<k-1,n)+u[i:])[:n])) | n,k=map(int,input().split())
s=input()
r=range(n)
u=min((s+s[::-1])[i:]for i in r)
for i in r:u[i]==u[0]or exit(print((u[0]*min(i<<k-1,n)+u[i:])[:n]))
| 6 | 5 | 159 | 154 | n, k = list(map(int, input().split()))
s = eval(input())
r = list(range(n))
u = min((s + s[::-1])[i:] for i in r)
i = min(i for i in r if u[i] != u[0])
print(((u[0] * min(i << k - 1, n) + u[i:])[:n]))
| n, k = map(int, input().split())
s = input()
r = range(n)
u = min((s + s[::-1])[i:] for i in r)
for i in r:
u[i] == u[0] or exit(print((u[0] * min(i << k - 1, n) + u[i:])[:n]))
| false | 16.666667 | [
"-n, k = list(map(int, input().split()))",
"-s = eval(input())",
"-r = list(range(n))",
"+n, k = map(int, input().split())",
"+s = input()",
"+r = range(n)",
"-i = min(i for i in r if u[i] != u[0])",
"-print(((u[0] * min(i << k - 1, n) + u[i:])[:n]))",
"+for i in r:",
"+ u[i] == u[0] or exit(pr... | false | 0.078944 | 0.060383 | 1.307385 | [
"s753545404",
"s371851022"
] |
u807772568 | p02913 | python | s257005253 | s386398519 | 1,175 | 1,064 | 9,976 | 9,876 | Accepted | Accepted | 9.45 | import sys,collections as cl,bisect as bs,heapq as hq
input = sys.stdin.readline
def l(): #intのlist
return list(map(int,input().split()))
def m(): #複数文字
return list(map(int,input().split()))
def onem(): #Nとかの取得
return int(eval(input()))
def jo(x): #listをスペースごとに分ける
return " ".join(map(str,x))
d... | import sys,collections as cl,bisect as bs , heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
return list(map(int,input().split()))
def m(): #複数文字
return list(map(int,input().split()))
def onem(): #Nとかの取得
return int(eval(input()))
def s(x): #圧縮
a = [... | 54 | 62 | 1,122 | 1,303 | import sys, collections as cl, bisect as bs, heapq as hq
input = sys.stdin.readline
def l(): # intのlist
return list(map(int, input().split()))
def m(): # 複数文字
return list(map(int, input().split()))
def onem(): # Nとかの取得
return int(eval(input()))
def jo(x): # listをスペースごとに分ける
return " ".join(m... | import sys, collections as cl, bisect as bs, heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9 + 7
Max = sys.maxsize
def l(): # intのlist
return list(map(int, input().split()))
def m(): # 複数文字
return list(map(int, input().split()))
def onem(): # Nとかの取得
return int(eval(input()))
def s(x): # 圧... | false | 12.903226 | [
"-input = sys.stdin.readline",
"+sys.setrecursionlimit(100000)",
"+mod = 10**9 + 7",
"+Max = sys.maxsize",
"+def s(x): # 圧縮",
"+ a = []",
"+ aa = x[0]",
"+ su = 1",
"+ for i in range(len(x) - 1):",
"+ if aa != x[i + 1]:",
"+ a.append([aa, su])",
"+ aa ... | false | 0.042391 | 0.043224 | 0.980739 | [
"s257005253",
"s386398519"
] |
u340781749 | p02794 | python | s352208651 | s081388689 | 2,185 | 656 | 43,832 | 42,344 | Accepted | Accepted | 69.98 | def dfs(s, t, links):
visited = set()
q = [(s, 0)]
while q:
v, used = q.pop()
if v == t:
return used
visited.add(v)
for lb, u in links[v]:
if u in visited:
continue
q.append((u, used | lb))
n = int(eval(input... | def dfs(s, t, links):
visited = set()
q = [(s, 0)]
while q:
v, used = q.pop()
if v == t:
return used
visited.add(v)
for lb, u in links[v]:
if u in visited:
continue
q.append((u, used | lb))
def bitcount32(n):... | 48 | 58 | 1,037 | 1,477 | def dfs(s, t, links):
visited = set()
q = [(s, 0)]
while q:
v, used = q.pop()
if v == t:
return used
visited.add(v)
for lb, u in links[v]:
if u in visited:
continue
q.append((u, used | lb))
n = int(eval(input()))
links = [... | def dfs(s, t, links):
visited = set()
q = [(s, 0)]
while q:
v, used = q.pop()
if v == t:
return used
visited.add(v)
for lb, u in links[v]:
if u in visited:
continue
q.append((u, used | lb))
def bitcount32(n):
n = ((n >... | false | 17.241379 | [
"+",
"+",
"+def bitcount32(n):",
"+ n = ((n >> 1) & 0x5555555555555555) + (n & 0x5555555555555555)",
"+ n = ((n >> 2) & 0x3333333333333333) + (n & 0x3333333333333333)",
"+ n = ((n >> 4) & 0x0F0F0F0F0F0F0F0F) + (n & 0x0F0F0F0F0F0F0F0F)",
"+ n = ((n >> 8) & 0x00FF00FF00FF00FF) + (n & 0x00FF00F... | false | 0.055729 | 0.081225 | 0.686111 | [
"s352208651",
"s081388689"
] |
u261103969 | p02695 | python | s871599169 | s331935500 | 1,099 | 642 | 9,200 | 9,420 | Accepted | Accepted | 41.58 | from itertools import combinations_with_replacement
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for seq in combinations_with_replacement(list(range(1, m + 1)), n):
score = 0
for a, b, c, d in req:
if seq[b - 1] - seq[a - 1] == c:... | from collections import deque
def calc(nums):
ret = 0
for a, b, c, d in req:
if nums[b - 1] - nums[a - 1] == c:
ret += d
return ret
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
que = deque()
# [1]~[... | 14 | 35 | 380 | 659 | from itertools import combinations_with_replacement
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for seq in combinations_with_replacement(list(range(1, m + 1)), n):
score = 0
for a, b, c, d in req:
if seq[b - 1] - seq[a - 1] == c:
... | from collections import deque
def calc(nums):
ret = 0
for a, b, c, d in req:
if nums[b - 1] - nums[a - 1] == c:
ret += d
return ret
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
que = deque()
# [1]~[m]までキューに追加します。実は[1]だけでも... | false | 60 | [
"-from itertools import combinations_with_replacement",
"+from collections import deque",
"+",
"+",
"+def calc(nums):",
"+ ret = 0",
"+ for a, b, c, d in req:",
"+ if nums[b - 1] - nums[a - 1] == c:",
"+ ret += d",
"+ return ret",
"+",
"-for seq in combinations_with_... | false | 0.135317 | 0.084401 | 1.603268 | [
"s871599169",
"s331935500"
] |
u693391925 | p02924 | python | s737157289 | s816419452 | 182 | 167 | 38,256 | 38,384 | Accepted | Accepted | 8.24 | n = int(eval(input()))
print((n * (n-1) // 2)) | n = int(eval(input()))
print(((n * (n-1)) // 2)) | 2 | 2 | 39 | 41 | n = int(eval(input()))
print((n * (n - 1) // 2))
| n = int(eval(input()))
print(((n * (n - 1)) // 2))
| false | 0 | [
"-print((n * (n - 1) // 2))",
"+print(((n * (n - 1)) // 2))"
] | false | 0.035088 | 0.035583 | 0.986083 | [
"s737157289",
"s816419452"
] |
u128456980 | p02775 | python | s596637826 | s417629625 | 413 | 298 | 138,044 | 53,136 | Accepted | Accepted | 27.85 | s = eval(input()); n = len(s)
dp = [ [0,1<<32] for i in range(n+1) ]
for i in range(n):
d = ord(s[i])-ord('0')
dp[i+1][0] = min(dp[i][0], dp[i][1])+d
dp[i+1][1] = min(dp[i][0], dp[i][1]-2)+11-d
print((min(dp[n][0],dp[n][1]))) | s = eval(input()); n = len(s)
dp = [ [0,1<<32] for i in range(2) ]
for i in range(n):
d = ord(s[i])-ord('0')
dp[(i+1)%2][0] = min(dp[i%2][0], dp[i%2][1])+d
dp[(i+1)%2][1] = min(dp[i%2][0], dp[i%2][1]-2)+11-d
print((min(dp[n%2][0],dp[n%2][1]))) | 7 | 7 | 229 | 247 | s = eval(input())
n = len(s)
dp = [[0, 1 << 32] for i in range(n + 1)]
for i in range(n):
d = ord(s[i]) - ord("0")
dp[i + 1][0] = min(dp[i][0], dp[i][1]) + d
dp[i + 1][1] = min(dp[i][0], dp[i][1] - 2) + 11 - d
print((min(dp[n][0], dp[n][1])))
| s = eval(input())
n = len(s)
dp = [[0, 1 << 32] for i in range(2)]
for i in range(n):
d = ord(s[i]) - ord("0")
dp[(i + 1) % 2][0] = min(dp[i % 2][0], dp[i % 2][1]) + d
dp[(i + 1) % 2][1] = min(dp[i % 2][0], dp[i % 2][1] - 2) + 11 - d
print((min(dp[n % 2][0], dp[n % 2][1])))
| false | 0 | [
"-dp = [[0, 1 << 32] for i in range(n + 1)]",
"+dp = [[0, 1 << 32] for i in range(2)]",
"- dp[i + 1][0] = min(dp[i][0], dp[i][1]) + d",
"- dp[i + 1][1] = min(dp[i][0], dp[i][1] - 2) + 11 - d",
"-print((min(dp[n][0], dp[n][1])))",
"+ dp[(i + 1) % 2][0] = min(dp[i % 2][0], dp[i % 2][1]) + d",
"+ ... | false | 0.046815 | 0.048403 | 0.967194 | [
"s596637826",
"s417629625"
] |
u721316601 | p02947 | python | s774952249 | s120854113 | 481 | 233 | 18,236 | 17,808 | Accepted | Accepted | 51.56 | from collections import Counter
count = Counter()
for i in range(int(eval(input()))):
s = sorted(eval(input()))
count[''.join(s)] += 1
ans = 0
for n in list(count.values()):
if n >= 2:
ans += (n**2 - n) // 2
print(ans) | import sys
input = sys.stdin.readline
def main():
x = {}
N = int(eval(input()))
for i in range(N):
s = sorted(eval(input()))
s = ''.join(s)
if s in x: x[s] += 1
else: x[s] = 1
ans = 0
for n in list(x.values()):
ans += (n*(n-1)... | 14 | 23 | 226 | 374 | from collections import Counter
count = Counter()
for i in range(int(eval(input()))):
s = sorted(eval(input()))
count["".join(s)] += 1
ans = 0
for n in list(count.values()):
if n >= 2:
ans += (n**2 - n) // 2
print(ans)
| import sys
input = sys.stdin.readline
def main():
x = {}
N = int(eval(input()))
for i in range(N):
s = sorted(eval(input()))
s = "".join(s)
if s in x:
x[s] += 1
else:
x[s] = 1
ans = 0
for n in list(x.values()):
ans += n * (n - 1) // ... | false | 39.130435 | [
"-from collections import Counter",
"+import sys",
"-count = Counter()",
"-for i in range(int(eval(input()))):",
"- s = sorted(eval(input()))",
"- count[\"\".join(s)] += 1",
"-ans = 0",
"-for n in list(count.values()):",
"- if n >= 2:",
"- ans += (n**2 - n) // 2",
"-print(ans)",
... | false | 0.11705 | 0.04702 | 2.489381 | [
"s774952249",
"s120854113"
] |
u250583425 | p02732 | python | s783761936 | s986186820 | 1,551 | 178 | 32,940 | 32,952 | Accepted | Accepted | 88.52 | import sys
from math import factorial
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
c = Counter(A)
data = [0] * (N+1)
sum_count = 0
for i, v in list(c.items()):
if v... | import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
c = Counter(A)
data = [0] * (N+1)
sum_count = 0
for i, v in list(c.items()):
if v < 2:
continue
... | 23 | 22 | 571 | 523 | import sys
from math import factorial
from collections import Counter
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
c = Counter(A)
data = [0] * (N + 1)
sum_count = 0
for i, v in list(c.items()):
if v < 2:... | import sys
from collections import Counter
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
c = Counter(A)
data = [0] * (N + 1)
sum_count = 0
for i, v in list(c.items()):
if v < 2:
continue
... | false | 4.347826 | [
"-from math import factorial",
"- value = factorial(v) // 2 // factorial(v - 2)",
"+ value = v * (v - 1) // 2"
] | false | 0.057888 | 0.036595 | 1.581874 | [
"s783761936",
"s986186820"
] |
u557168336 | p03262 | python | s017518003 | s735074156 | 361 | 254 | 89,236 | 64,024 | Accepted | Accepted | 29.64 | # from fractions import gcd
gcd = __import__("fractions").gcd
N, X = list(map(int, input().split()))
V = list(map(int, input().split()))
V.append(X)
V.sort()
vD = [V[i+1]-V[i] for i in range(len(V)-1)]
vD.sort()
res = vD[0]
for d in vD:
res = gcd(res, d)
print(res) | # from fractions import gcd
# gcd = __import__("fractions").gcd
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
N, X = list(map(int, input().split()))
V = list(map(int, input().split()))
V.append(X)
V.sort()
vD = [V[i+1]-V[i] for i in range(len(V)-1)]
vD.sort()
res = vD[0]
for d... | 14 | 21 | 278 | 389 | # from fractions import gcd
gcd = __import__("fractions").gcd
N, X = list(map(int, input().split()))
V = list(map(int, input().split()))
V.append(X)
V.sort()
vD = [V[i + 1] - V[i] for i in range(len(V) - 1)]
vD.sort()
res = vD[0]
for d in vD:
res = gcd(res, d)
print(res)
| # from fractions import gcd
# gcd = __import__("fractions").gcd
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
N, X = list(map(int, input().split()))
V = list(map(int, input().split()))
V.append(X)
V.sort()
vD = [V[i + 1] - V[i] for i in range(len(V) - 1)]
vD.sort()
res = vD[0]
for d in vD:
... | false | 33.333333 | [
"-gcd = __import__(\"fractions\").gcd",
"+# gcd = __import__(\"fractions\").gcd",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"+",
"+",
"+ if res <= 1:",
"+ break"
] | false | 0.093567 | 0.061129 | 1.530641 | [
"s017518003",
"s735074156"
] |
u847923740 | p03163 | python | s890944458 | s059762403 | 782 | 159 | 171,656 | 69,456 | Accepted | Accepted | 79.67 | N,W=list(map(int,input().split()))
wv=[[0,0]]+[list(map(int,input().split())) for _ in range(N)]
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
for j in range(W+1):
dp[i][j]=dp[i-1][j]
if j - wv[i][0] >= 0:
dp[i][j]=max(dp[i][j],dp[i-1][j-wv[i][0]]+wv[... | N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
wi, vi = list(map(int, input().split()))
w.append(wi)
v.append(vi)
dp = [0] * (W + 1)
dp[w[0]] = v[0]
for i in range(1, N):
for j in range(W, -1, -1):
if j - w[i] >= 0 and dp[j - w[i]] + v[i] > dp[j]:
dp[j] = max(dp[j], dp[... | 13 | 16 | 356 | 341 | N, W = list(map(int, input().split()))
wv = [[0, 0]] + [list(map(int, input().split())) for _ in range(N)]
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
for i in range(1, N + 1):
for j in range(W + 1):
dp[i][j] = dp[i - 1][j]
if j - wv[i][0] >= 0:
dp[i][j] = max(dp[i][j], dp[i -... | N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
wi, vi = list(map(int, input().split()))
w.append(wi)
v.append(vi)
dp = [0] * (W + 1)
dp[w[0]] = v[0]
for i in range(1, N):
for j in range(W, -1, -1):
if j - w[i] >= 0 and dp[j - w[i]] + v[i] > dp[j]:
dp[j] = max... | false | 18.75 | [
"-wv = [[0, 0]] + [list(map(int, input().split())) for _ in range(N)]",
"-dp = [[0 for i in range(W + 1)] for j in range(N + 1)]",
"-for i in range(1, N + 1):",
"- for j in range(W + 1):",
"- dp[i][j] = dp[i - 1][j]",
"- if j - wv[i][0] >= 0:",
"- dp[i][j] = max(dp[i][j], dp[... | false | 0.071024 | 0.074061 | 0.958995 | [
"s890944458",
"s059762403"
] |
u013629972 | p03089 | python | s565547400 | s168627676 | 291 | 174 | 65,388 | 38,640 | Accepted | Accepted | 40.21 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
d... | N = int(input())
B = [int(x) - 1 for x in input().split()]
# print('b', B)
ans = []
while B:
popped = -1
for i in reversed(range(len(B))):
if B[i] == i:
ans.append(i + 1)
popped = B.pop(i)
break
if popped == -1:
print(-1)
quit()
prin... | 38 | 15 | 1,069 | 344 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI... | N = int(input())
B = [int(x) - 1 for x in input().split()]
# print('b', B)
ans = []
while B:
popped = -1
for i in reversed(range(len(B))):
if B[i] == i:
ans.append(i + 1)
popped = B.pop(i)
break
if popped == -1:
print(-1)
quit()
print(*ans[::-1], ... | false | 60.526316 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools",
"-",
"-sys.setrecursionlimit(10**7)",
"-inf = 10**20",
"-eps = 1.0 / 10**10",
"-mod = 10**9 + 7",
"-dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]",
"-ddn = [(-1, 0), (-1, 1), (0, 1), (1, ... | false | 0.115274 | 0.034011 | 3.389349 | [
"s565547400",
"s168627676"
] |
u143492911 | p03487 | python | s289015428 | s026159962 | 105 | 88 | 23,800 | 18,132 | Accepted | Accepted | 16.19 | n=int(eval(input()))
a=list(map(int,input().split()))
set_a=set(a)
import collections
count=0
data=collections.Counter(a)
for i,j in list(data.items()):
if i<j:
count+=j-i
elif j<i:
count+=j
print(count) | n=int(eval(input()))
a=list(map(int,input().split()))
from collections import Counter
data=Counter(a)
ans=0
for i,j in list(data.items()):
if i<j:
ans+=j-i
elif j<i:
ans+=j
print(ans)
| 12 | 11 | 226 | 206 | n = int(eval(input()))
a = list(map(int, input().split()))
set_a = set(a)
import collections
count = 0
data = collections.Counter(a)
for i, j in list(data.items()):
if i < j:
count += j - i
elif j < i:
count += j
print(count)
| n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
data = Counter(a)
ans = 0
for i, j in list(data.items()):
if i < j:
ans += j - i
elif j < i:
ans += j
print(ans)
| false | 8.333333 | [
"-set_a = set(a)",
"-import collections",
"+from collections import Counter",
"-count = 0",
"-data = collections.Counter(a)",
"+data = Counter(a)",
"+ans = 0",
"- count += j - i",
"+ ans += j - i",
"- count += j",
"-print(count)",
"+ ans += j",
"+print(ans)"
] | false | 0.038678 | 0.039966 | 0.967779 | [
"s289015428",
"s026159962"
] |
u334712262 | p03488 | python | s654468951 | s849019724 | 520 | 316 | 84,952 | 92,252 | Accepted | Accepted | 39.23 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, perm... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 94 | 113 | 1,750 | 2,035 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 16.814159 | [
"+from collections import Counter, defaultdict, deque",
"+from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal",
"+from fractions import Fraction",
"+from functools import lru_cache, reduce",
"+from itertools import (",
"+ combinations,",
"+ combinations_with_replacement,",
"+ product,",... | false | 0.040416 | 0.037963 | 1.064625 | [
"s654468951",
"s849019724"
] |
u345966487 | p04005 | python | s874420163 | s318719003 | 28 | 25 | 9,108 | 9,160 | Accepted | Accepted | 10.71 | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
a, b, c = inl... | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
def solve():
A, B, C = inl(... | 25 | 19 | 575 | 461 | import sys
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
a, b, c = inl()
def solve... | import sys
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
def solve():
A, B, C = inl()
if A %... | false | 24 | [
"-inm = lambda: map(int, sys.stdin.readline().split())",
"-inl = lambda: list(inm())",
"+inl = lambda: [int(x) for x in sys.stdin.readline().split()]",
"-a, b, c = inl()",
"- ans = min(",
"- [",
"- abs((a // 2) - (a - a // 2)) * b * c,",
"- abs((b // 2) - (b - b // 2)) ... | false | 0.071774 | 0.037329 | 1.922722 | [
"s874420163",
"s318719003"
] |
u512212329 | p02579 | python | s599166305 | s469822619 | 1,503 | 1,249 | 312,864 | 247,836 | Accepted | Accepted | 16.9 | # 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in input().split()]
dest_h, dest_w = [int(x) - 1 for x in input().split()]
grid = [list(e... | # 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in input().split()]
dest_h, dest_w = [int(x) - 1 for x in input().split()]
grid = [list(e... | 57 | 59 | 1,729 | 1,847 | # 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in input().split()]
dest_h, dest_w = [int(x) - 1 for x in input().split()]
grid = [list(eval(input... | # 参考: White_Pie_46
# https://atcoder.jp/contests/abc176/submissions/16168825
from collections import deque
def main():
height, width = [int(x) for x in input().split()]
init_h, init_w = [int(x) - 1 for x in input().split()]
dest_h, dest_w = [int(x) - 1 for x in input().split()]
grid = [list(eval(input... | false | 3.389831 | [
"- qu.appendleft((new_h, new_w, warps))",
"+ if (new_h, new_w) not in reached:",
"+ qu.appendleft((new_h, new_w, warps))",
"- qu.append((new_h, new_w, warps + 1))",
"+ if (new_h, new_w) not in reached:",
"+ ... | false | 0.037758 | 0.036705 | 1.028684 | [
"s599166305",
"s469822619"
] |
u018679195 | p03160 | python | s704395640 | s092494083 | 365 | 129 | 87,076 | 20,696 | Accepted | Accepted | 64.66 | def main():
n, height = getInputs()
cost = [0] * n
cost[1] = abs(height[0] - height[1])
for i in range(2, n):
cost[i] = min(
cost[i - 1] + abs(height[i] - height[i - 1]),
cost[i - 2] + abs(height[i] - height[i - 2])
)
print((cost[-1]))
def ge... | n = int(eval(input()))
pedras = list(map(int,input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(pedras[0] - pedras[1])
for i in range(2,n):
custo1 = dp[i-1] + abs(pedras[i-1] - pedras[i])
custo2 = dp[i-2] + abs(pedras[i-2] - pedras[i])
dp[i] = min(custo1,custo2)
print((dp[n-1]))
| 18 | 16 | 411 | 307 | def main():
n, height = getInputs()
cost = [0] * n
cost[1] = abs(height[0] - height[1])
for i in range(2, n):
cost[i] = min(
cost[i - 1] + abs(height[i] - height[i - 1]),
cost[i - 2] + abs(height[i] - height[i - 2]),
)
print((cost[-1]))
def getInputs():
... | n = int(eval(input()))
pedras = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(pedras[0] - pedras[1])
for i in range(2, n):
custo1 = dp[i - 1] + abs(pedras[i - 1] - pedras[i])
custo2 = dp[i - 2] + abs(pedras[i - 2] - pedras[i])
dp[i] = min(custo1, custo2)
print((dp[n - 1]))
| false | 11.111111 | [
"-def main():",
"- n, height = getInputs()",
"- cost = [0] * n",
"- cost[1] = abs(height[0] - height[1])",
"- for i in range(2, n):",
"- cost[i] = min(",
"- cost[i - 1] + abs(height[i] - height[i - 1]),",
"- cost[i - 2] + abs(height[i] - height[i - 2]),",
"- ... | false | 0.035794 | 0.051557 | 0.694251 | [
"s704395640",
"s092494083"
] |
u333945892 | p03260 | python | s842378830 | s794745130 | 130 | 17 | 4,848 | 2,940 | Accepted | Accepted | 86.92 | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
A,B = inpl()
if (A*B)%2 == 0:
prin... | A,B = list(map(int,input().split()))
if (A*B)%2 == 0:
print('No')
else:
print('Yes') | 15 | 5 | 350 | 86 | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inpl():
return list(map(int, input().split()))
def inpls():
return list(input().split())
A, B = inpl()
if (A * B)... | A, B = list(map(int, input().split()))
if (A * B) % 2 == 0:
print("No")
else:
print("Yes")
| false | 66.666667 | [
"-from collections import defaultdict, deque",
"-import sys, heapq, bisect, math, itertools, string, queue, datetime",
"-",
"-sys.setrecursionlimit(10**8)",
"-INF = float(\"inf\")",
"-mod = 10**9 + 7",
"-eps = 10**-7",
"-",
"-",
"-def inpl():",
"- return list(map(int, input().split()))",
"-... | false | 0.059577 | 0.055791 | 1.067865 | [
"s842378830",
"s794745130"
] |
u130900604 | p02707 | python | s335884551 | s314296581 | 170 | 145 | 36,364 | 31,648 | Accepted | Accepted | 14.71 | from collections import*
n,*a=list(map(int,open(0).read().split()));c=Counter(a)
for i in range(n):print((c[i+1])) | n,*a=list(map(int,open(0).read().split()));c=[0]*n
for q in a:c[q-1]+=1
for d in c:print(d) | 3 | 3 | 108 | 87 | from collections import *
n, *a = list(map(int, open(0).read().split()))
c = Counter(a)
for i in range(n):
print((c[i + 1]))
| n, *a = list(map(int, open(0).read().split()))
c = [0] * n
for q in a:
c[q - 1] += 1
for d in c:
print(d)
| false | 0 | [
"-from collections import *",
"-",
"-c = Counter(a)",
"-for i in range(n):",
"- print((c[i + 1]))",
"+c = [0] * n",
"+for q in a:",
"+ c[q - 1] += 1",
"+for d in c:",
"+ print(d)"
] | false | 0.041793 | 0.109988 | 0.379978 | [
"s335884551",
"s314296581"
] |
u307516601 | p02683 | python | s425272498 | s786746347 | 303 | 199 | 27,828 | 27,176 | Accepted | Accepted | 34.32 | n,m,x = list(map(int, input().split()))
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
ca = [[int(i) for i in readline().split()] for _ in range(n)]
from itertools import combinations
import numpy as np
lc = [i for i in range(n)]
ans = 1001001001
for nc in range(1,n+1):
lc... | n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
from itertools import product
import numpy as np
INF = 1001001001
ans = INF
for i in product(list(range(2)), repeat=n): # product(range(2),n)でn桁のbit全探索が可能
tmp_price = 0
tmp_und = np.zeros((m, ))
... | 29 | 24 | 694 | 748 | n, m, x = list(map(int, input().split()))
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
ca = [[int(i) for i in readline().split()] for _ in range(n)]
from itertools import combinations
import numpy as np
lc = [i for i in range(n)]
ans = 1001001001
for nc in range(1, n + 1):
lc_sub = list(c... | n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
from itertools import product
import numpy as np
INF = 1001001001
ans = INF
for i in product(list(range(2)), repeat=n): # product(range(2),n)でn桁のbit全探索が可能
tmp_price = 0
tmp_und = np.zeros((m,))
for j in rang... | false | 17.241379 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-readline = sys.stdin.readline",
"-ca = [[int(i) for i in readline().split()] for _ in range(n)]",
"-from itertools import combinations",
"+ca = [list(map(int, input().split())) for _ in range(n)]",
"+from itertools import product",
"-lc = [i for... | false | 0.725072 | 0.261619 | 2.771478 | [
"s425272498",
"s786746347"
] |
u028973125 | p02823 | python | s312765056 | s006103205 | 175 | 26 | 38,256 | 9,148 | Accepted | Accepted | 85.14 | import sys
from pprint import pprint
def solve(n, a, b):
ans = 0
if (b - a) % 2 == 0:
ans = (b - a) // 2
else:
# 両端で試合するパターン
simple = min(b - 1, n - a)
# 両端に一回残留してから端以外で試合するパターン
mix_a = a + (b - a) // 2
mix_b = n - b + 1 + (b - a - 1) // 2
... | import sys
N, A, B = list(map(int, sys.stdin.readline().split()))
if (B - A) % 2 == 0:
print(((B - A) // 2))
else:
print((min(A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2))) | 21 | 7 | 488 | 184 | import sys
from pprint import pprint
def solve(n, a, b):
ans = 0
if (b - a) % 2 == 0:
ans = (b - a) // 2
else:
# 両端で試合するパターン
simple = min(b - 1, n - a)
# 両端に一回残留してから端以外で試合するパターン
mix_a = a + (b - a) // 2
mix_b = n - b + 1 + (b - a - 1) // 2
ans = min(... | import sys
N, A, B = list(map(int, sys.stdin.readline().split()))
if (B - A) % 2 == 0:
print(((B - A) // 2))
else:
print((min(A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2)))
| false | 66.666667 | [
"-from pprint import pprint",
"-",
"-def solve(n, a, b):",
"- ans = 0",
"- if (b - a) % 2 == 0:",
"- ans = (b - a) // 2",
"- else:",
"- # 両端で試合するパターン",
"- simple = min(b - 1, n - a)",
"- # 両端に一回残留してから端以外で試合するパターン",
"- mix_a = a + (b - a) // 2",
"- ... | false | 0.057474 | 0.04047 | 1.420181 | [
"s312765056",
"s006103205"
] |
u624613992 | p02761 | python | s990318578 | s554979467 | 30 | 27 | 9,224 | 9,220 | Accepted | Accepted | 10 | n,m = list(map(int,input().split()))
done = [0]*n
ans = [0]*n
for i in range(m):
s,c = list(map(int,input().split()))
if done[s-1] != 0 and ans[s-1] != c:
print((-1))
exit()
elif n != 1 and s == 1 and c == 0:
print((-1))
exit()
else:
done[s-1] = 1
ans[s-1] = c
ans_f = str()... | n,m = list(map(int,input().split()))
ans = [0]*n
for i in range(m):
s,c = list(map(int,input().split()))
if ans[s-1] != 0 and ans[s-1] != c:
print((-1))
exit()
elif n != 1 and s == 1 and c == 0:
print((-1))
exit()
else:
ans[s-1] = c
ans_f = "".join((list(map(str,ans))))
if n>1 a... | 21 | 17 | 415 | 365 | n, m = list(map(int, input().split()))
done = [0] * n
ans = [0] * n
for i in range(m):
s, c = list(map(int, input().split()))
if done[s - 1] != 0 and ans[s - 1] != c:
print((-1))
exit()
elif n != 1 and s == 1 and c == 0:
print((-1))
exit()
else:
done[s - 1] = 1
... | n, m = list(map(int, input().split()))
ans = [0] * n
for i in range(m):
s, c = list(map(int, input().split()))
if ans[s - 1] != 0 and ans[s - 1] != c:
print((-1))
exit()
elif n != 1 and s == 1 and c == 0:
print((-1))
exit()
else:
ans[s - 1] = c
ans_f = "".join((li... | false | 19.047619 | [
"-done = [0] * n",
"- if done[s - 1] != 0 and ans[s - 1] != c:",
"+ if ans[s - 1] != 0 and ans[s - 1] != c:",
"- done[s - 1] = 1",
"-ans_f = str()",
"-for j in ans:",
"- ans_f += str(j)",
"+ans_f = \"\".join((list(map(str, ans))))"
] | false | 0.163649 | 0.252859 | 0.647195 | [
"s990318578",
"s554979467"
] |
u814663076 | p03141 | python | s844182337 | s656295518 | 541 | 407 | 45,140 | 45,140 | Accepted | Accepted | 24.77 | import numpy as np
N = int(eval(input()))
arr = np.array([input().split() + [0] for _ in range(N)], dtype='int64')
for i in range(N):
arr[i, 2] = arr[i, 0] + arr[i, 1]
arr = arr[np.argsort(arr[:, 2])][::-1]
print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1]))) | import numpy as np
import sys
input = sys.stdin.readline
N = int(eval(input()))
arr = np.array([input().split() + [0] for _ in range(N)], dtype='int64')
for i in range(N):
arr[i, 2] = arr[i, 0] + arr[i, 1]
arr = arr[np.argsort(arr[:, 2])][::-1]
print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1]))) | 11 | 13 | 268 | 308 | import numpy as np
N = int(eval(input()))
arr = np.array([input().split() + [0] for _ in range(N)], dtype="int64")
for i in range(N):
arr[i, 2] = arr[i, 0] + arr[i, 1]
arr = arr[np.argsort(arr[:, 2])][::-1]
print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))
| import numpy as np
import sys
input = sys.stdin.readline
N = int(eval(input()))
arr = np.array([input().split() + [0] for _ in range(N)], dtype="int64")
for i in range(N):
arr[i, 2] = arr[i, 0] + arr[i, 1]
arr = arr[np.argsort(arr[:, 2])][::-1]
print((np.sum(arr[::2, 0]) - np.sum(arr[1::2, 1])))
| false | 15.384615 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.008214 | 0.226881 | 0.036203 | [
"s844182337",
"s656295518"
] |
u342869120 | p03946 | python | s651680067 | s753580577 | 269 | 223 | 66,668 | 62,704 | Accepted | Accepted | 17.1 | from collections import defaultdict
N, T = list(map(int, input().split()))
*a, = list(map(int, input().split()))
t = defaultdict(int)
m = a[0]
p = 0
ans = 0
for i in range(1, N):
c = a[i] - m
if t[m] < c:
t[m] = c
if a[i] < m:
m = a[i]
if c > p:
p = c
ans... | N, T = list(map(int, input().split()))
*a, = list(map(int, input().split()))
m = a[0]
p = 0
ans = 0
for i in range(1, N):
c = a[i] - m
if a[i] < m:
m = a[i]
if c > p:
p = c
ans = 1
elif c == p:
ans += 1
print(ans)
| 21 | 16 | 363 | 266 | from collections import defaultdict
N, T = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
t = defaultdict(int)
m = a[0]
p = 0
ans = 0
for i in range(1, N):
c = a[i] - m
if t[m] < c:
t[m] = c
if a[i] < m:
m = a[i]
if c > p:
p = c
ans = 1
elif ... | N, T = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
m = a[0]
p = 0
ans = 0
for i in range(1, N):
c = a[i] - m
if a[i] < m:
m = a[i]
if c > p:
p = c
ans = 1
elif c == p:
ans += 1
print(ans)
| false | 23.809524 | [
"-from collections import defaultdict",
"-",
"-t = defaultdict(int)",
"- if t[m] < c:",
"- t[m] = c"
] | false | 0.105542 | 0.042261 | 2.497404 | [
"s651680067",
"s753580577"
] |
u276115223 | p03243 | python | s863639098 | s070021319 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | # ABC 111: B – AtCoder Beginner Contest 111
n = int(eval(input()))
i = n // 111
if n % 111 != 0:
i += 1
print((i * 111)) | # ABC 111: B – AtCoder Beginner Contest 111
n = eval(input())
n = '10' if len(n) == 1 else n
while len(set(n)) != 1:
n = str(int(n) + 1)
print(n) | 8 | 9 | 125 | 154 | # ABC 111: B – AtCoder Beginner Contest 111
n = int(eval(input()))
i = n // 111
if n % 111 != 0:
i += 1
print((i * 111))
| # ABC 111: B – AtCoder Beginner Contest 111
n = eval(input())
n = "10" if len(n) == 1 else n
while len(set(n)) != 1:
n = str(int(n) + 1)
print(n)
| false | 11.111111 | [
"-n = int(eval(input()))",
"-i = n // 111",
"-if n % 111 != 0:",
"- i += 1",
"-print((i * 111))",
"+n = eval(input())",
"+n = \"10\" if len(n) == 1 else n",
"+while len(set(n)) != 1:",
"+ n = str(int(n) + 1)",
"+print(n)"
] | false | 0.04683 | 0.045358 | 1.032459 | [
"s863639098",
"s070021319"
] |
u593567568 | p03733 | python | s441807446 | s186085676 | 279 | 130 | 54,976 | 30,824 | Accepted | Accepted | 53.41 | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
LST = []
for a in A:
LST.append((a,1))
LST.append((a+T,-1))
LST.sort()
prev = -1
s = 0
ans = 0
for x,y in LST:
if y == 1:
s += 1
if s == 1:
prev = x
elif y == -1:
s -= 1
if s == 0:
ans +... | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = 0
for i in range(N-1):
ans += min(T,A[i+1] - A[i])
print((ans+T))
| 25 | 9 | 345 | 151 | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
LST = []
for a in A:
LST.append((a, 1))
LST.append((a + T, -1))
LST.sort()
prev = -1
s = 0
ans = 0
for x, y in LST:
if y == 1:
s += 1
if s == 1:
prev = x
elif y == -1:
s -= 1
if s == 0:... | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
ans += min(T, A[i + 1] - A[i])
print((ans + T))
| false | 64 | [
"-LST = []",
"-for a in A:",
"- LST.append((a, 1))",
"- LST.append((a + T, -1))",
"-LST.sort()",
"-prev = -1",
"-s = 0",
"-for x, y in LST:",
"- if y == 1:",
"- s += 1",
"- if s == 1:",
"- prev = x",
"- elif y == -1:",
"- s -= 1",
"- if ... | false | 0.040242 | 0.035422 | 1.136072 | [
"s441807446",
"s186085676"
] |
u945345165 | p00481 | python | s089974692 | s367532767 | 36,410 | 17,440 | 35,316 | 34,744 | Accepted | Accepted | 52.1 | import copy
import queue
def bfs(count, x, y, cheese):
q = queue.Queue()
q.put((count,x,y))
tempVisited = copy.deepcopy(visited)
tempVisited[x][y] = True
while q.qsize()>0:
tempc,tempx,tempy = q.get()
if geo[tempx][tempy] == cheese:
return tempc,tempx,temp... | import copy
from collections import deque
def bfs(count, x, y, cheese):
q = deque()
q.append((count,x,y))
tempVisited = copy.deepcopy(visited)
tempVisited[x][y] = True
while len(q)>0:
tempc,tempx,tempy = q.popleft()
if geo[tempx][tempy] == cheese:
return t... | 51 | 51 | 1,280 | 1,305 | import copy
import queue
def bfs(count, x, y, cheese):
q = queue.Queue()
q.put((count, x, y))
tempVisited = copy.deepcopy(visited)
tempVisited[x][y] = True
while q.qsize() > 0:
tempc, tempx, tempy = q.get()
if geo[tempx][tempy] == cheese:
return tempc, tempx, tempy
... | import copy
from collections import deque
def bfs(count, x, y, cheese):
q = deque()
q.append((count, x, y))
tempVisited = copy.deepcopy(visited)
tempVisited[x][y] = True
while len(q) > 0:
tempc, tempx, tempy = q.popleft()
if geo[tempx][tempy] == cheese:
return tempc, te... | false | 0 | [
"-import queue",
"+from collections import deque",
"- q = queue.Queue()",
"- q.put((count, x, y))",
"+ q = deque()",
"+ q.append((count, x, y))",
"- while q.qsize() > 0:",
"- tempc, tempx, tempy = q.get()",
"+ while len(q) > 0:",
"+ tempc, tempx, tempy = q.popleft()... | false | 0.047332 | 0.081683 | 0.579465 | [
"s089974692",
"s367532767"
] |
u780698286 | p03035 | python | s602809505 | s834741380 | 29 | 24 | 8,948 | 9,136 | Accepted | Accepted | 17.24 | a, b = list(map(int, input().split()))
if a >= 13:
print(b)
elif a <= 5:
print((0))
else:
print((b//2)) | a, b = list(map(int, input().split()))
if a <= 5:
print((0))
elif a <= 12:
print((b//2))
else:
print(b)
| 7 | 7 | 105 | 112 | a, b = list(map(int, input().split()))
if a >= 13:
print(b)
elif a <= 5:
print((0))
else:
print((b // 2))
| a, b = list(map(int, input().split()))
if a <= 5:
print((0))
elif a <= 12:
print((b // 2))
else:
print(b)
| false | 0 | [
"-if a >= 13:",
"+if a <= 5:",
"+ print((0))",
"+elif a <= 12:",
"+ print((b // 2))",
"+else:",
"-elif a <= 5:",
"- print((0))",
"-else:",
"- print((b // 2))"
] | false | 0.088684 | 0.087971 | 1.008096 | [
"s602809505",
"s834741380"
] |
u225388820 | p02558 | python | s883735596 | s658824296 | 467 | 302 | 83,344 | 76,592 | Accepted | Accepted | 35.33 | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x ==... | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x ==... | 59 | 59 | 1,718 | 1,702 | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x == y:
... | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x == y:
... | false | 0 | [
"- result = self.leader(self.parent_or_size[a])",
"- self.parent_or_size[a] = result",
"- return result",
"+ while self.parent_or_size[a] >= 0:",
"+ a = self.parent_or_size[a]",
"+ return a"
] | false | 0.044151 | 0.044936 | 0.982524 | [
"s883735596",
"s658824296"
] |
u596276291 | p03964 | python | s526397461 | s836489121 | 112 | 62 | 5,204 | 5,984 | Accepted | Accepted | 44.64 | import math
from decimal import Decimal
def main():
N = int(eval(input()))
t, a = 1, 1
for _ in range(N):
_t, _a = list(map(int, input().split()))
n = Decimal(max(math.ceil(t / _t), math.ceil(a / _a)))
t, a = _t * n, _a * n
print((t + a))
if __name__ == '__main_... | from math import ceil
from fractions import Fraction
def main():
N = int(eval(input()))
t, a = 1, 1
for _ in range(N):
_t, _a = list(map(int, input().split()))
n = ceil(max(Fraction(t, _t), Fraction(a, _a)))
t, a = _t * n, _a * n
print((t + a))
if __name__ == '__m... | 16 | 15 | 322 | 326 | import math
from decimal import Decimal
def main():
N = int(eval(input()))
t, a = 1, 1
for _ in range(N):
_t, _a = list(map(int, input().split()))
n = Decimal(max(math.ceil(t / _t), math.ceil(a / _a)))
t, a = _t * n, _a * n
print((t + a))
if __name__ == "__main__":
main()... | from math import ceil
from fractions import Fraction
def main():
N = int(eval(input()))
t, a = 1, 1
for _ in range(N):
_t, _a = list(map(int, input().split()))
n = ceil(max(Fraction(t, _t), Fraction(a, _a)))
t, a = _t * n, _a * n
print((t + a))
if __name__ == "__main__":
... | false | 6.25 | [
"-import math",
"-from decimal import Decimal",
"+from math import ceil",
"+from fractions import Fraction",
"- n = Decimal(max(math.ceil(t / _t), math.ceil(a / _a)))",
"+ n = ceil(max(Fraction(t, _t), Fraction(a, _a)))"
] | false | 0.050344 | 0.05425 | 0.927995 | [
"s526397461",
"s836489121"
] |
u024807881 | p03062 | python | s096986795 | s772222657 | 92 | 54 | 14,116 | 14,116 | Accepted | Accepted | 41.3 | from sys import stdin
readline = stdin.readline
_, *aa = list(map(int, open(0).read().split()))
r = 0
mi = 1000000000
m = 0
for a in aa:
if a < 0:
m += 1
b = abs(a)
r += b
mi = min(b, mi)
print((r - mi * 2 * (m % 2)))
| from sys import stdin
readline = stdin.readline
def main():
_, *A = list(map(int, open(0).read().split()))
B = tuple(map(abs, A))
C = tuple(a for a in A if a < 0)
print((sum(B) - min(B)*2*(len(C)%2)))
if __name__ == "__main__":
main() | 15 | 14 | 250 | 269 | from sys import stdin
readline = stdin.readline
_, *aa = list(map(int, open(0).read().split()))
r = 0
mi = 1000000000
m = 0
for a in aa:
if a < 0:
m += 1
b = abs(a)
r += b
mi = min(b, mi)
print((r - mi * 2 * (m % 2)))
| from sys import stdin
readline = stdin.readline
def main():
_, *A = list(map(int, open(0).read().split()))
B = tuple(map(abs, A))
C = tuple(a for a in A if a < 0)
print((sum(B) - min(B) * 2 * (len(C) % 2)))
if __name__ == "__main__":
main()
| false | 6.666667 | [
"-_, *aa = list(map(int, open(0).read().split()))",
"-r = 0",
"-mi = 1000000000",
"-m = 0",
"-for a in aa:",
"- if a < 0:",
"- m += 1",
"- b = abs(a)",
"- r += b",
"- mi = min(b, mi)",
"-print((r - mi * 2 * (m % 2)))",
"+",
"+",
"+def main():",
"+ _, *A = list(map(i... | false | 0.035783 | 0.065392 | 0.547205 | [
"s096986795",
"s772222657"
] |
u221886916 | p03163 | python | s160483148 | s094244860 | 772 | 404 | 171,892 | 118,512 | Accepted | Accepted | 47.67 | from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce
def input():
return sys.stdin.readline().strip()
def iinput():
return int(eval(input()))
def tinput():
retur... |
def main():
N,W = list(map(int, input().split()))
dp = [[0]*(W+1) for i in range(N+1)]
weight = [0]
value = [0]
for i in range(N):
w,v=list(map(int, input().split()))
weight.append(w)
value.append(v)
# dp[i][w] is the maximum value got with first i item... | 54 | 29 | 1,163 | 633 | from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce
def input():
return sys.stdin.readline().strip()
def iinput():
return int(eval(input()))
def tinput():
return input().split()
... | def main():
N, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for i in range(N + 1)]
weight = [0]
value = [0]
for i in range(N):
w, v = list(map(int, input().split()))
weight.append(w)
value.append(v)
# dp[i][w] is the maximum value got with first i items stored ... | false | 46.296296 | [
"-from collections import Counter",
"-from collections import defaultdict",
"-import math",
"-import random",
"-import heapq as hq",
"-from math import sqrt",
"-import sys",
"-from functools import reduce",
"+def main():",
"+ N, W = list(map(int, input().split()))",
"+ dp = [[0] * (W + 1) ... | false | 0.08512 | 0.040106 | 2.122362 | [
"s160483148",
"s094244860"
] |
u271176141 | p04029 | python | s943262952 | s164790954 | 26 | 24 | 8,896 | 9,088 | Accepted | Accepted | 7.69 | child_num = eval(input())
child_num = int(child_num)
candy_num = int((child_num**2 + child_num) / 2)
print(candy_num) | #子供の数を入力
child_num = int(eval(input()))
candy_num = int((child_num**2 + child_num) / 2)
print(candy_num) | 4 | 5 | 114 | 103 | child_num = eval(input())
child_num = int(child_num)
candy_num = int((child_num**2 + child_num) / 2)
print(candy_num)
| # 子供の数を入力
child_num = int(eval(input()))
candy_num = int((child_num**2 + child_num) / 2)
print(candy_num)
| false | 20 | [
"-child_num = eval(input())",
"-child_num = int(child_num)",
"+# 子供の数を入力",
"+child_num = int(eval(input()))"
] | false | 0.042847 | 0.040828 | 1.049434 | [
"s943262952",
"s164790954"
] |
u188827677 | p02983 | python | s318260479 | s042947993 | 659 | 398 | 9,064 | 9,048 | Accepted | Accepted | 39.61 | l,r = list(map(int, input().split()))
if r - l >= 2019:
print((0))
exit()
ans = 10**9
for i in range(l,r):
for j in range(i+1, r+1):
ans = min(ans, i*j%2019)
print(ans) | l,r = list(map(int, input().split()))
if r-l >= 2019:
print((0))
exit()
ans = float("inf")
for i in range(l,r):
for j in range(i+1,r+1):
if i*j%2019 < ans: ans = i*j%2019
print(ans) | 11 | 11 | 182 | 195 | l, r = list(map(int, input().split()))
if r - l >= 2019:
print((0))
exit()
ans = 10**9
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min(ans, i * j % 2019)
print(ans)
| l, r = list(map(int, input().split()))
if r - l >= 2019:
print((0))
exit()
ans = float("inf")
for i in range(l, r):
for j in range(i + 1, r + 1):
if i * j % 2019 < ans:
ans = i * j % 2019
print(ans)
| false | 0 | [
"-ans = 10**9",
"+ans = float(\"inf\")",
"- ans = min(ans, i * j % 2019)",
"+ if i * j % 2019 < ans:",
"+ ans = i * j % 2019"
] | false | 0.045367 | 0.041241 | 1.100043 | [
"s318260479",
"s042947993"
] |
u759938562 | p02891 | python | s088835852 | s988229131 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | S = eval(input())
K = eval(input())
if not(1 <= len(S) and len(S) <= 100):
exit()
if not (S.isalpha() and S.islower()):
exit()
if not float(K).is_integer():
exit()
if not (1 <= int(K) and int(K) <= 10 ** 9):
exit()
L = []
tmp = []
pre = ""
for s in S:
if len(tmp) == 0:
pre... | S = eval(input())
K = eval(input())
L = []
tmp = []
pre = ""
for s in S:
if len(tmp) == 0:
pre = s
tmp.append(s)
elif pre == s:
tmp.append(s)
else:
L.append(tmp)
pre = s
tmp = [s]
L.append(tmp)
count = 0
for l in L:
count += int(len(l... | 42 | 33 | 838 | 629 | S = eval(input())
K = eval(input())
if not (1 <= len(S) and len(S) <= 100):
exit()
if not (S.isalpha() and S.islower()):
exit()
if not float(K).is_integer():
exit()
if not (1 <= int(K) and int(K) <= 10**9):
exit()
L = []
tmp = []
pre = ""
for s in S:
if len(tmp) == 0:
pre = s
tmp.app... | S = eval(input())
K = eval(input())
L = []
tmp = []
pre = ""
for s in S:
if len(tmp) == 0:
pre = s
tmp.append(s)
elif pre == s:
tmp.append(s)
else:
L.append(tmp)
pre = s
tmp = [s]
L.append(tmp)
count = 0
for l in L:
count += int(len(l) / 2)
# print(l)
... | false | 21.428571 | [
"-if not (1 <= len(S) and len(S) <= 100):",
"- exit()",
"-if not (S.isalpha() and S.islower()):",
"- exit()",
"-if not float(K).is_integer():",
"- exit()",
"-if not (1 <= int(K) and int(K) <= 10**9):",
"- exit()"
] | false | 0.042059 | 0.042314 | 0.993964 | [
"s088835852",
"s988229131"
] |
u626337957 | p02579 | python | s537508411 | s002616356 | 842 | 718 | 167,872 | 163,396 | Accepted | Accepted | 14.73 | from collections import deque
H, W = list(map(int, input().split()))
cy, cx = list(map(int, input().split()))
sy, sx = list(map(int, input().split()))
tiles = [list(eval(input())) for _ in range(H)]
# initialization
INF = 10**4
arrived = [[INF for _ in range(W)] for __ in range(H)]
paths = deque()
warps = ... | from collections import deque
H, W = list(map(int, input().split()))
cy, cx = list(map(int, input().split()))
sy, sx = list(map(int, input().split()))
tiles = [list(eval(input())) for _ in range(H)]
# initialization
INF = 10**4
arrived = [[INF for _ in range(W)] for __ in range(H)]
paths = deque()
warps = ... | 42 | 41 | 1,198 | 1,194 | from collections import deque
H, W = list(map(int, input().split()))
cy, cx = list(map(int, input().split()))
sy, sx = list(map(int, input().split()))
tiles = [list(eval(input())) for _ in range(H)]
# initialization
INF = 10**4
arrived = [[INF for _ in range(W)] for __ in range(H)]
paths = deque()
warps = deque()
dx =... | from collections import deque
H, W = list(map(int, input().split()))
cy, cx = list(map(int, input().split()))
sy, sx = list(map(int, input().split()))
tiles = [list(eval(input())) for _ in range(H)]
# initialization
INF = 10**4
arrived = [[INF for _ in range(W)] for __ in range(H)]
paths = deque()
warps = deque()
dx =... | false | 2.380952 | [
"+ if ny == sy - 1 and nx == sx - 1:",
"+ print(count)",
"+ exit()",
"-if arrived[sy - 1][sx - 1] != INF:",
"- print((arrived[sy - 1][sx - 1]))",
"-else:",
"- print((-1))",
"+print((-1))"
] | false | 0.100252 | 0.102255 | 0.980415 | [
"s537508411",
"s002616356"
] |
u075012704 | p04045 | python | s692800942 | s141797748 | 119 | 108 | 2,940 | 2,940 | Accepted | Accepted | 9.24 | N, K = list(map(int, input().split()))
D = set(map(str, input().split()))
for i in range(N, 100000):
a = list(str(i))
a = set(a)
if a & D == set():
print(i)
break
| N, K = list(map(int, input().split()))
D = set(list(input().split()))
while True:
if set(list(str(N))) & D:
N += 1
else:
print(N)
exit()
| 9 | 9 | 194 | 172 | N, K = list(map(int, input().split()))
D = set(map(str, input().split()))
for i in range(N, 100000):
a = list(str(i))
a = set(a)
if a & D == set():
print(i)
break
| N, K = list(map(int, input().split()))
D = set(list(input().split()))
while True:
if set(list(str(N))) & D:
N += 1
else:
print(N)
exit()
| false | 0 | [
"-D = set(map(str, input().split()))",
"-for i in range(N, 100000):",
"- a = list(str(i))",
"- a = set(a)",
"- if a & D == set():",
"- print(i)",
"- break",
"+D = set(list(input().split()))",
"+while True:",
"+ if set(list(str(N))) & D:",
"+ N += 1",
"+ else... | false | 0.133037 | 0.092555 | 1.437388 | [
"s692800942",
"s141797748"
] |
u037430802 | p03418 | python | s014481419 | s885494917 | 106 | 85 | 3,064 | 3,060 | Accepted | Accepted | 19.81 | n, k = list(map(int, input().split()))
if k == 0:
print((n**2))
exit()
ans = 0
for b in range(1,n+1):
# 連続部分
if b - k > 0:
ans += (n // b) * (b-k)
# 繰り返し範囲外
if ((n - (n // b)*b) - (k-1)) > 0:
ans += ((n - (n // b)*b) - (k-1))
print(ans) | N,K = list(map(int, input().split()))
if K == 0:
print((N*N))
exit()
ans = 0
for b in range(K+1,N+1):
# N = b * num + rest
num = N // b
rest = N - (b*num)
# b一周期の中に、余りがK以上になる数字が(b-K)個、残りの中でさらに余りがKを超える物があればそれも加算
ans += (b - K) * num + max(0, rest-K+1)
print(ans) | 22 | 17 | 287 | 304 | n, k = list(map(int, input().split()))
if k == 0:
print((n**2))
exit()
ans = 0
for b in range(1, n + 1):
# 連続部分
if b - k > 0:
ans += (n // b) * (b - k)
# 繰り返し範囲外
if ((n - (n // b) * b) - (k - 1)) > 0:
ans += (n - (n // b) * b) - (k - 1)
print(ans)
| N, K = list(map(int, input().split()))
if K == 0:
print((N * N))
exit()
ans = 0
for b in range(K + 1, N + 1):
# N = b * num + rest
num = N // b
rest = N - (b * num)
# b一周期の中に、余りがK以上になる数字が(b-K)個、残りの中でさらに余りがKを超える物があればそれも加算
ans += (b - K) * num + max(0, rest - K + 1)
print(ans)
| false | 22.727273 | [
"-n, k = list(map(int, input().split()))",
"-if k == 0:",
"- print((n**2))",
"+N, K = list(map(int, input().split()))",
"+if K == 0:",
"+ print((N * N))",
"-for b in range(1, n + 1):",
"- # 連続部分",
"- if b - k > 0:",
"- ans += (n // b) * (b - k)",
"- # 繰り返し範囲外",
"- if (... | false | 0.038608 | 0.039719 | 0.972024 | [
"s014481419",
"s885494917"
] |
u971091945 | p02571 | python | s170452090 | s950155090 | 79 | 60 | 9,028 | 9,056 | Accepted | Accepted | 24.05 | s = eval(input())
t = eval(input())
l = len(t)
ls = len(s)
ans = 0
for i in range(ls-l+1):
num = 0
for j in range(l):
if s[i+j]==t[j]:
num += 1
ans = max(ans, num)
print((l-ans)) | s = eval(input())
t = eval(input())
lt = len(t)
ls = len(s)
ans = ls
for i in range(ls-lt+1):
num = 0
for j in range(lt):
if s[i+j] != t[j]:
num += 1
ans = min(ans, num)
print(ans) | 14 | 14 | 211 | 215 | s = eval(input())
t = eval(input())
l = len(t)
ls = len(s)
ans = 0
for i in range(ls - l + 1):
num = 0
for j in range(l):
if s[i + j] == t[j]:
num += 1
ans = max(ans, num)
print((l - ans))
| s = eval(input())
t = eval(input())
lt = len(t)
ls = len(s)
ans = ls
for i in range(ls - lt + 1):
num = 0
for j in range(lt):
if s[i + j] != t[j]:
num += 1
ans = min(ans, num)
print(ans)
| false | 0 | [
"-l = len(t)",
"+lt = len(t)",
"-ans = 0",
"-for i in range(ls - l + 1):",
"+ans = ls",
"+for i in range(ls - lt + 1):",
"- for j in range(l):",
"- if s[i + j] == t[j]:",
"+ for j in range(lt):",
"+ if s[i + j] != t[j]:",
"- ans = max(ans, num)",
"-print((l - ans))",
"... | false | 0.05654 | 0.137067 | 0.412498 | [
"s170452090",
"s950155090"
] |
u607155447 | p02658 | python | s745335978 | s732282052 | 97 | 55 | 21,648 | 21,672 | Accepted | Accepted | 43.3 | N = int(eval(input()))
Alst = list(map(int, input().split()))
Alst.sort()
ans = 1
rec = True
for i in range(N):
ans = ans * Alst[i]
if ans > 10**18:
rec = False
break
if rec:
print(ans)
else:
print((-1)) | N = int(eval(input()))
Alst = list(map(int, input().split()))
ans = 1
rec = True
if 0 in Alst:
print((0))
else:
for i in range(N):
ans = ans * Alst[i]
if ans > 10**18:
rec = False
break
if rec:
print(ans)
else:
print((-1)) | 15 | 18 | 242 | 303 | N = int(eval(input()))
Alst = list(map(int, input().split()))
Alst.sort()
ans = 1
rec = True
for i in range(N):
ans = ans * Alst[i]
if ans > 10**18:
rec = False
break
if rec:
print(ans)
else:
print((-1))
| N = int(eval(input()))
Alst = list(map(int, input().split()))
ans = 1
rec = True
if 0 in Alst:
print((0))
else:
for i in range(N):
ans = ans * Alst[i]
if ans > 10**18:
rec = False
break
if rec:
print(ans)
else:
print((-1))
| false | 16.666667 | [
"-Alst.sort()",
"-for i in range(N):",
"- ans = ans * Alst[i]",
"- if ans > 10**18:",
"- rec = False",
"- break",
"-if rec:",
"- print(ans)",
"+if 0 in Alst:",
"+ print((0))",
"- print((-1))",
"+ for i in range(N):",
"+ ans = ans * Alst[i]",
"+ ... | false | 0.108399 | 0.088429 | 1.225836 | [
"s745335978",
"s732282052"
] |
u677523557 | p03044 | python | s145935894 | s379573919 | 592 | 465 | 40,352 | 40,364 | Accepted | Accepted | 21.45 | import sys
input = sys.stdin.readline
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N-1):
a, b, w = map(int, input().split())
graph[a-1].append((b-1, w))
graph[b-1].append((a-1, w))
def dfs(s):
Ind = [0]*N
stack = [s]
Color = [0]*N
while stack:
p =... | import sys
input = sys.stdin.readline
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N-1):
a, b, w = map(int, input().split())
graph[a-1].append((b-1, w))
graph[b-1].append((a-1, w))
def dfs(s):
stack = [s]
Color = [-1]*N
Color[s] = 0
while stack:
p... | 30 | 26 | 694 | 575 | import sys
input = sys.stdin.readline
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N - 1):
a, b, w = map(int, input().split())
graph[a - 1].append((b - 1, w))
graph[b - 1].append((a - 1, w))
def dfs(s):
Ind = [0] * N
stack = [s]
Color = [0] * N
while stack:
p = s... | import sys
input = sys.stdin.readline
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N - 1):
a, b, w = map(int, input().split())
graph[a - 1].append((b - 1, w))
graph[b - 1].append((a - 1, w))
def dfs(s):
stack = [s]
Color = [-1] * N
Color[s] = 0
while stack:
p = s... | false | 13.333333 | [
"- Ind = [0] * N",
"- Color = [0] * N",
"+ Color = [-1] * N",
"+ Color[s] = 0",
"- p = stack[-1]",
"- if Ind[p] == len(graph[p]):",
"- stack.pop()",
"- elif len(stack) > 1 and stack[-2] == graph[p][Ind[p]][0]:",
"- Ind[p] += 1",
"- else... | false | 0.037946 | 0.038032 | 0.997728 | [
"s145935894",
"s379573919"
] |
u822044226 | p02947 | python | s861547568 | s747129978 | 770 | 375 | 19,756 | 19,760 | Accepted | Accepted | 51.3 | import math
from collections import Counter
N = int(eval(input()))
s = []
for _ in range(N):
s.append(''.join(sorted(str(eval(input())))))
c = Counter(s)
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
cnt = 0
for i in list(c.values())... | from collections import Counter
N = int(eval(input()))
s = []
for _ in range(N):
s.append(''.join(sorted(str(eval(input())))))
c = Counter(s)
cnt = 0
for i in list(c.values()):
if i >= 2:
cnt += (i*(i-1))//2
print(cnt) | 20 | 16 | 368 | 233 | import math
from collections import Counter
N = int(eval(input()))
s = []
for _ in range(N):
s.append("".join(sorted(str(eval(input())))))
c = Counter(s)
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
cnt = 0
for i in list(c.values()):
if i >= 2:
... | from collections import Counter
N = int(eval(input()))
s = []
for _ in range(N):
s.append("".join(sorted(str(eval(input())))))
c = Counter(s)
cnt = 0
for i in list(c.values()):
if i >= 2:
cnt += (i * (i - 1)) // 2
print(cnt)
| false | 20 | [
"-import math",
"-",
"-",
"-def combinations_count(n, r):",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-",
"-",
"- cnt += combinations_count(i, 2)",
"+ cnt += (i * (i - 1)) // 2"
] | false | 0.046036 | 0.090239 | 0.510151 | [
"s861547568",
"s747129978"
] |
u172873334 | p03796 | python | s996742296 | s540128233 | 56 | 36 | 2,940 | 2,940 | Accepted | Accepted | 35.71 | ans=1
for _ in range(int(eval(input()))):
ans*=_+1
ans%=int(1e9+7)
print(ans)
| mod = 1000000007
n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
ans = ans * i % mod
print(ans) | 5 | 6 | 84 | 107 | ans = 1
for _ in range(int(eval(input()))):
ans *= _ + 1
ans %= int(1e9 + 7)
print(ans)
| mod = 1000000007
n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
ans = ans * i % mod
print(ans)
| false | 16.666667 | [
"+mod = 1000000007",
"+n = int(eval(input()))",
"-for _ in range(int(eval(input()))):",
"- ans *= _ + 1",
"- ans %= int(1e9 + 7)",
"+for i in range(1, n + 1):",
"+ ans = ans * i % mod"
] | false | 0.107311 | 0.111211 | 0.964934 | [
"s996742296",
"s540128233"
] |
u063052907 | p03416 | python | s511344953 | s771959072 | 54 | 19 | 2,940 | 3,060 | Accepted | Accepted | 64.81 | # coding: utf-8
import sys
input = sys.stdin.readline
A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
i = str(i)
if i == i[::-1]:
ans += 1
print(ans)
| # coding: utf-8
import sys
input = sys.stdin.readline
A, B = list(map(int, input().split()))
ans = 0
for i in range(1, 10):
for j in range(10):
for k in range(10):
val = 10000*i + 1000*j + 100*k + 10*j + i
if A <= val <= B:
ans+=1
print(ans)
| 11 | 13 | 196 | 301 | # coding: utf-8
import sys
input = sys.stdin.readline
A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
i = str(i)
if i == i[::-1]:
ans += 1
print(ans)
| # coding: utf-8
import sys
input = sys.stdin.readline
A, B = list(map(int, input().split()))
ans = 0
for i in range(1, 10):
for j in range(10):
for k in range(10):
val = 10000 * i + 1000 * j + 100 * k + 10 * j + i
if A <= val <= B:
ans += 1
print(ans)
| false | 15.384615 | [
"-for i in range(A, B + 1):",
"- i = str(i)",
"- if i == i[::-1]:",
"- ans += 1",
"+for i in range(1, 10):",
"+ for j in range(10):",
"+ for k in range(10):",
"+ val = 10000 * i + 1000 * j + 100 * k + 10 * j + i",
"+ if A <= val <= B:",
"+ ... | false | 0.054614 | 0.081519 | 0.66996 | [
"s511344953",
"s771959072"
] |
u133936772 | p03103 | python | s789282159 | s039474039 | 574 | 462 | 28,648 | 16,988 | Accepted | Accepted | 19.51 | f = lambda : list(map(int,input().split()))
n,m = f()
ll = sorted([list(f()) for _ in range(n)])
ans = 0
for p, c in ll:
ans += p*min(m,c)
m -= c
if m < 1:
break
print(ans) | f=lambda:list(map(int,input().split()))
n,m=f()
l=[]
for _ in range(n):
l+=[tuple(f())]
l.sort()
c=0
for a,b in l:
if b<m:
m-=b
c+=a*b
else:
c+=a*m
break
print(c) | 10 | 15 | 185 | 192 | f = lambda: list(map(int, input().split()))
n, m = f()
ll = sorted([list(f()) for _ in range(n)])
ans = 0
for p, c in ll:
ans += p * min(m, c)
m -= c
if m < 1:
break
print(ans)
| f = lambda: list(map(int, input().split()))
n, m = f()
l = []
for _ in range(n):
l += [tuple(f())]
l.sort()
c = 0
for a, b in l:
if b < m:
m -= b
c += a * b
else:
c += a * m
break
print(c)
| false | 33.333333 | [
"-ll = sorted([list(f()) for _ in range(n)])",
"-ans = 0",
"-for p, c in ll:",
"- ans += p * min(m, c)",
"- m -= c",
"- if m < 1:",
"+l = []",
"+for _ in range(n):",
"+ l += [tuple(f())]",
"+l.sort()",
"+c = 0",
"+for a, b in l:",
"+ if b < m:",
"+ m -= b",
"+ ... | false | 0.044798 | 0.105807 | 0.423393 | [
"s789282159",
"s039474039"
] |
u186838327 | p02882 | python | s298597189 | s083083503 | 172 | 64 | 38,384 | 62,204 | Accepted | Accepted | 62.79 | a, b, x = list(map(int, input().split()))
if x == a**2*b:
print((0))
exit()
if x <= a**2*b/2:
t = (2*x)/(a*b**2)
else:
t = (a**3)/(2*(a**2*b-x))
#print(t)
import math
a = math.atan(t)
a = math.degrees(a)
print((90-a))
| a, b, x = list(map(int, input().split()))
if x >= a**2*b/2:
t = 2*(b*a**2-x)/(a**3)
else:
t = (a*b**2)/(2*x)
import math
p = math.atan(t)
p = math.degrees(p)
print(p)
| 16 | 11 | 234 | 181 | a, b, x = list(map(int, input().split()))
if x == a**2 * b:
print((0))
exit()
if x <= a**2 * b / 2:
t = (2 * x) / (a * b**2)
else:
t = (a**3) / (2 * (a**2 * b - x))
# print(t)
import math
a = math.atan(t)
a = math.degrees(a)
print((90 - a))
| a, b, x = list(map(int, input().split()))
if x >= a**2 * b / 2:
t = 2 * (b * a**2 - x) / (a**3)
else:
t = (a * b**2) / (2 * x)
import math
p = math.atan(t)
p = math.degrees(p)
print(p)
| false | 31.25 | [
"-if x == a**2 * b:",
"- print((0))",
"- exit()",
"-if x <= a**2 * b / 2:",
"- t = (2 * x) / (a * b**2)",
"+if x >= a**2 * b / 2:",
"+ t = 2 * (b * a**2 - x) / (a**3)",
"- t = (a**3) / (2 * (a**2 * b - x))",
"-# print(t)",
"+ t = (a * b**2) / (2 * x)",
"-a = math.atan(t)",
"-... | false | 0.039172 | 0.042745 | 0.916426 | [
"s298597189",
"s083083503"
] |
u968404618 | p02912 | python | s291026031 | s227521368 | 179 | 124 | 14,380 | 20,360 | Accepted | Accepted | 30.73 | from heapq import heappush, heappop
import math
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
A =list(map(int, input().split()))
Hq = []
for a in A:
heappush(Hq, -a)
for _ in range(m):
max = -heappop(Hq)
heappush(Hq, -math.floor(max/2))
print((-sum(Hq))) | from heapq import *
n, m = list(map(int, input().split()))
A = list([int(x)*(-1) for x in input().split()])
heapify(A)
for _ in range(m):
max_a = heappop(A)*(-1)
max_a //= 2
heappush(A, -max_a)
print((-sum(A))) | 15 | 11 | 302 | 231 | from heapq import heappush, heappop
import math
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
Hq = []
for a in A:
heappush(Hq, -a)
for _ in range(m):
max = -heappop(Hq)
heappush(Hq, -math.floor(max / 2))
print((-sum(Hq)))
| from heapq import *
n, m = list(map(int, input().split()))
A = list([int(x) * (-1) for x in input().split()])
heapify(A)
for _ in range(m):
max_a = heappop(A) * (-1)
max_a //= 2
heappush(A, -max_a)
print((-sum(A)))
| false | 26.666667 | [
"-from heapq import heappush, heappop",
"-import math",
"-import sys",
"+from heapq import *",
"-input = sys.stdin.readline",
"-A = list(map(int, input().split()))",
"-Hq = []",
"-for a in A:",
"- heappush(Hq, -a)",
"+A = list([int(x) * (-1) for x in input().split()])",
"+heapify(A)",
"- ... | false | 0.170747 | 0.167268 | 1.020799 | [
"s291026031",
"s227521368"
] |
u434630332 | p04029 | python | s779866426 | s076003719 | 27 | 23 | 9,068 | 9,020 | Accepted | Accepted | 14.81 | number = int(eval(input()))
print((int((number + 1) * number / 2))) | n = int(eval(input()))
answer = int((n + 1) * n / 2)
print(answer)
| 3 | 5 | 62 | 67 | number = int(eval(input()))
print((int((number + 1) * number / 2)))
| n = int(eval(input()))
answer = int((n + 1) * n / 2)
print(answer)
| false | 40 | [
"-number = int(eval(input()))",
"-print((int((number + 1) * number / 2)))",
"+n = int(eval(input()))",
"+answer = int((n + 1) * n / 2)",
"+print(answer)"
] | false | 0.049087 | 0.049617 | 0.98931 | [
"s779866426",
"s076003719"
] |
u062147869 | p03634 | python | s985908191 | s009626653 | 1,260 | 844 | 79,748 | 64,404 | Accepted | Accepted | 33.02 | from heapq import heappush,heappop
N = int(eval(input()))
table=[[]for i in range(N)]
for i in range(N-1):
a,b,c=list(map(int,input().split()))
table[a-1].append([b-1,c])
table[b-1].append([a-1,c])
Q,K=list(map(int,input().split()))
Que=[[int(i) for i in input().split()] for i in range(Q)]
inf=10**... | import sys
input = sys.stdin.readline
from heapq import heappop,heappush
N=int(eval(input()))
table=[[] for i in range(N)]
for i in range(N-1):
a,b,c=list(map(int,input().split()))
a,b=a-1,b-1
table[a].append((b,c))
table[b].append((a,c))
Q,K=list(map(int,input().split()))
query=[[int(i)-1 fo... | 26 | 27 | 645 | 662 | from heapq import heappush, heappop
N = int(eval(input()))
table = [[] for i in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
table[a - 1].append([b - 1, c])
table[b - 1].append([a - 1, c])
Q, K = list(map(int, input().split()))
Que = [[int(i) for i in input().split()] for i in... | import sys
input = sys.stdin.readline
from heapq import heappop, heappush
N = int(eval(input()))
table = [[] for i in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a, b = a - 1, b - 1
table[a].append((b, c))
table[b].append((a, c))
Q, K = list(map(int, input().split()))
qu... | false | 3.703704 | [
"-from heapq import heappush, heappop",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+from heapq import heappop, heappush",
"- table[a - 1].append([b - 1, c])",
"- table[b - 1].append([a - 1, c])",
"+ a, b = a - 1, b - 1",
"+ table[a].append((b, c))",
"+ table[b].append((a, c... | false | 0.045693 | 0.042877 | 1.065662 | [
"s985908191",
"s009626653"
] |
u075303794 | p02642 | python | s913861569 | s099191954 | 1,776 | 724 | 104,740 | 123,016 | Accepted | Accepted | 59.23 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
#@njit
def slove(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = 0
... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit
def slove(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = 0
f... | 23 | 23 | 436 | 435 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# @njit
def slove(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = ... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit
def slove(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = ... | false | 0 | [
"-# @njit",
"+",
"+",
"+@njit"
] | false | 0.839245 | 0.423858 | 1.980012 | [
"s913861569",
"s099191954"
] |
u579699847 | p03329 | python | s214974592 | s294353468 | 973 | 699 | 7,796 | 3,828 | Accepted | Accepted | 28.16 | import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
if N<=5:
print(N)
exit()
dp = [float('INF')]*(N+1)
dp[0] = 0
num6,num9 = 6,9
d6d9 = set()
while num6<=N:
d6d9.add(num6)
num6 *= 6
while num9<=N:
d6d9.add(num9)
num9 *= 9
for i,x in itertools.product(l... | import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
dp = [float('INF')]*(N+1)
dp[0] = 0
for i in range(N+1):
if i+1<=N:
dp[i+1] = min(dp[i+1],dp[i]+1)
num6,num9 = 6,9
while i+num6<=N:
dp[i+num6] = min(dp[i+num6],dp[i]+1)
num6 *= 6
while i+n... | 22 | 16 | 460 | 407 | import itertools, sys
def I():
return int(sys.stdin.readline().rstrip())
N = I()
if N <= 5:
print(N)
exit()
dp = [float("INF")] * (N + 1)
dp[0] = 0
num6, num9 = 6, 9
d6d9 = set()
while num6 <= N:
d6d9.add(num6)
num6 *= 6
while num9 <= N:
d6d9.add(num9)
num9 *= 9
for i, x in itertools.pro... | import itertools, sys
def I():
return int(sys.stdin.readline().rstrip())
N = I()
dp = [float("INF")] * (N + 1)
dp[0] = 0
for i in range(N + 1):
if i + 1 <= N:
dp[i + 1] = min(dp[i + 1], dp[i] + 1)
num6, num9 = 6, 9
while i + num6 <= N:
dp[i + num6] = min(dp[i + num6], dp[i] + 1)
... | false | 27.272727 | [
"-if N <= 5:",
"- print(N)",
"- exit()",
"-num6, num9 = 6, 9",
"-d6d9 = set()",
"-while num6 <= N:",
"- d6d9.add(num6)",
"- num6 *= 6",
"-while num9 <= N:",
"- d6d9.add(num9)",
"- num9 *= 9",
"-for i, x in itertools.product(list(range(N + 1)), d6d9):",
"- if i + x >= N +... | false | 0.174601 | 0.217255 | 0.803669 | [
"s214974592",
"s294353468"
] |
u832039789 | p03986 | python | s756547015 | s588640071 | 77 | 61 | 5,096 | 3,500 | Accepted | Accepted | 20.78 | stack = []
for c in eval(input()):
if c=='S' or len(stack)==0:
stack.append(c)
elif stack[-1]=='S':
stack.pop()
else:
stack.append(c)
#print(stack)
print((len(stack)))
| s = eval(input())
SSS = 0
len = 0
for c in s:
if c == 'S':
SSS += 1
len += 1
elif SSS == 0:
len += 1
else:
SSS -= 1
len -= 1
# print(len)
print(len)
| 12 | 14 | 213 | 212 | stack = []
for c in eval(input()):
if c == "S" or len(stack) == 0:
stack.append(c)
elif stack[-1] == "S":
stack.pop()
else:
stack.append(c)
# print(stack)
print((len(stack)))
| s = eval(input())
SSS = 0
len = 0
for c in s:
if c == "S":
SSS += 1
len += 1
elif SSS == 0:
len += 1
else:
SSS -= 1
len -= 1
# print(len)
print(len)
| false | 14.285714 | [
"-stack = []",
"-for c in eval(input()):",
"- if c == \"S\" or len(stack) == 0:",
"- stack.append(c)",
"- elif stack[-1] == \"S\":",
"- stack.pop()",
"+s = eval(input())",
"+SSS = 0",
"+len = 0",
"+for c in s:",
"+ if c == \"S\":",
"+ SSS += 1",
"+ len +=... | false | 0.037101 | 0.03704 | 1.001639 | [
"s756547015",
"s588640071"
] |
u631277801 | p04013 | python | s859525256 | s680765229 | 38 | 34 | 3,572 | 3,572 | Accepted | Accepted | 10.53 | import collections
N,A = list(map(int, input().split()))
X = list(map(int,input().split()))
for i in range(N):
X[i] -= A
sums = collections.Counter([0,X[0]])
for i in X[1:]:
c = collections.Counter()
for p,q in list(sums.items()):
c[i+p] = q
sums += c
print((sums[0]-1))
| from collections import Counter
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
for i in range(N):
X[i] -= A
sums = Counter([0,X[0]])
for i in range(1,N):
ith_x = X[i]
ith_hash = {}
for key, value in list(sums.items()):
ith_hash[ith_x + key] = val... | 17 | 19 | 306 | 366 | import collections
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
for i in range(N):
X[i] -= A
sums = collections.Counter([0, X[0]])
for i in X[1:]:
c = collections.Counter()
for p, q in list(sums.items()):
c[i + p] = q
sums += c
print((sums[0] - 1))
| from collections import Counter
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
for i in range(N):
X[i] -= A
sums = Counter([0, X[0]])
for i in range(1, N):
ith_x = X[i]
ith_hash = {}
for key, value in list(sums.items()):
ith_hash[ith_x + key] = value
sums += ith_... | false | 10.526316 | [
"-import collections",
"+from collections import Counter",
"-sums = collections.Counter([0, X[0]])",
"-for i in X[1:]:",
"- c = collections.Counter()",
"- for p, q in list(sums.items()):",
"- c[i + p] = q",
"- sums += c",
"+sums = Counter([0, X[0]])",
"+for i in range(1, N):",
"+... | false | 0.047966 | 0.047973 | 0.999866 | [
"s859525256",
"s680765229"
] |
u077291787 | p02755 | python | s681031683 | s782500615 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | # C - Tax Increase
from math import floor
def calc(a: int, b: int) -> int:
for i in range(1, 10001):
if floor(i * 0.08) == a and floor(i * 0.1) == b:
return i
return -1
def main():
A, B = list(map(int, input().split()))
print((calc(A, B)))
if __name__ == "__main__... | # C - Tax Increase
from math import floor
def calc(a: int, b: int) -> int:
for i in range(1, 1010):
if floor(i * 0.08) == a and floor(i * 0.1) == b:
return i
return -1
def main():
A, B = list(map(int, input().split()))
print((calc(A, B)))
if __name__ == "__main_... | 17 | 18 | 327 | 328 | # C - Tax Increase
from math import floor
def calc(a: int, b: int) -> int:
for i in range(1, 10001):
if floor(i * 0.08) == a and floor(i * 0.1) == b:
return i
return -1
def main():
A, B = list(map(int, input().split()))
print((calc(A, B)))
if __name__ == "__main__":
main()
| # C - Tax Increase
from math import floor
def calc(a: int, b: int) -> int:
for i in range(1, 1010):
if floor(i * 0.08) == a and floor(i * 0.1) == b:
return i
return -1
def main():
A, B = list(map(int, input().split()))
print((calc(A, B)))
if __name__ == "__main__":
main()
| false | 5.555556 | [
"- for i in range(1, 10001):",
"+ for i in range(1, 1010):"
] | false | 0.054261 | 0.051408 | 1.055487 | [
"s681031683",
"s782500615"
] |
u827885761 | p03014 | python | s650860271 | s935093989 | 1,726 | 1,018 | 91,352 | 102,232 | Accepted | Accepted | 41.02 | import sys
from bisect import bisect_left
sys.setrecursionlimit(10**7)
def lmi(): return list(map(int, input().split()))
h, w = lmi()
s = [eval(input()) for i in range(h)]
a = [[] for i in range(h)]
#al = [[] for i in range(h)]
b = [[] for i in range(w)]
bl = [[] for i in range(w)]
for i in range(h):
... | from bisect import bisect_left
def lmi(): return list(map(int, input().split()))
h, w = lmi()
s = [eval(input()) for i in range(h)]
cnt = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
j = 0
while j < w:
if s[i][j] == '#':
j += 1
continue
l = ... | 57 | 39 | 1,303 | 880 | import sys
from bisect import bisect_left
sys.setrecursionlimit(10**7)
def lmi():
return list(map(int, input().split()))
h, w = lmi()
s = [eval(input()) for i in range(h)]
a = [[] for i in range(h)]
# al = [[] for i in range(h)]
b = [[] for i in range(w)]
bl = [[] for i in range(w)]
for i in range(h):
k = ... | from bisect import bisect_left
def lmi():
return list(map(int, input().split()))
h, w = lmi()
s = [eval(input()) for i in range(h)]
cnt = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
j = 0
while j < w:
if s[i][j] == "#":
j += 1
continue
l = 0
... | false | 31.578947 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**7)",
"-a = [[] for i in range(h)]",
"-# al = [[] for i in range(h)]",
"-b = [[] for i in range(w)]",
"-bl = [[] for i in range(w)]",
"+cnt = [[0 for i in range(w)] for j in range(h)]",
"- k = 0",
"- for j in range(w):",
"- if s[i][j] =... | false | 0.037864 | 0.037811 | 1.001393 | [
"s650860271",
"s935093989"
] |
u588794534 | p03295 | python | s389018046 | s035191710 | 846 | 763 | 59,992 | 62,552 | Accepted | Accepted | 9.81 | n,m=list(map(int,input().split()))
ab=[]
for _ in range(m):
a,b=list(map(int,input().split()))
ab.append([a,b])
ab.sort()
ll=ab[0][0]
rr=ab[0][1]
cnt=1
#print(ab[0],ll,rr,cnt)
for item in ab[1:]:
l=item[0]
r=item[1]
if l>=rr:
cnt+=1
ll=l
rr=r
else... | n,m=list(map(int,input().split()))
ab=[]
for _ in range(m):
a,b=list(map(int,input().split()))
ab.append([a,b])
ab.sort(key=lambda x: x[1])
cnt=0
border=0
for item in ab:
if item[0]>=border:
border=item[1]
cnt+=1
print(cnt)
| 30 | 19 | 426 | 264 | n, m = list(map(int, input().split()))
ab = []
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
ab.sort()
ll = ab[0][0]
rr = ab[0][1]
cnt = 1
# print(ab[0],ll,rr,cnt)
for item in ab[1:]:
l = item[0]
r = item[1]
if l >= rr:
cnt += 1
ll = l
rr = r
... | n, m = list(map(int, input().split()))
ab = []
for _ in range(m):
a, b = list(map(int, input().split()))
ab.append([a, b])
ab.sort(key=lambda x: x[1])
cnt = 0
border = 0
for item in ab:
if item[0] >= border:
border = item[1]
cnt += 1
print(cnt)
| false | 36.666667 | [
"-ab.sort()",
"-ll = ab[0][0]",
"-rr = ab[0][1]",
"-cnt = 1",
"-# print(ab[0],ll,rr,cnt)",
"-for item in ab[1:]:",
"- l = item[0]",
"- r = item[1]",
"- if l >= rr:",
"+ab.sort(key=lambda x: x[1])",
"+cnt = 0",
"+border = 0",
"+for item in ab:",
"+ if item[0] >= border:",
"+ ... | false | 0.084498 | 0.040917 | 2.065122 | [
"s389018046",
"s035191710"
] |
u736149053 | p02802 | python | s303219300 | s862454476 | 462 | 398 | 37,092 | 14,016 | Accepted | Accepted | 13.85 | import numpy as np
def main():
N, M = list(map(int, input().split()))
PS = {}
for i in range(M):
row = input().split()
row[0] = int(row[0])
if row[0] not in PS:
PS[row[0]] = [row[1]]
else:
PS[row[0]].append(row[1])
n_correct = 0
... | import numpy as np
def main():
# N, M = map(int, input().split())
# PS = {}
# for i in range(M):
# row = input().split()
# row[0] = int(row[0])
# if row[0] not in PS:
# PS[row[0]] = [row[1]]
# else:
# PS[row[0]].append(row[1])
# n_co... | 30 | 49 | 679 | 1,210 | import numpy as np
def main():
N, M = list(map(int, input().split()))
PS = {}
for i in range(M):
row = input().split()
row[0] = int(row[0])
if row[0] not in PS:
PS[row[0]] = [row[1]]
else:
PS[row[0]].append(row[1])
n_correct = 0
n_penalty = 0... | import numpy as np
def main():
# N, M = map(int, input().split())
# PS = {}
# for i in range(M):
# row = input().split()
# row[0] = int(row[0])
# if row[0] not in PS:
# PS[row[0]] = [row[1]]
# else:
# PS[row[0]].append(row[1])
# n_correct = 0
... | false | 38.77551 | [
"+ # N, M = map(int, input().split())",
"+ # PS = {}",
"+ # for i in range(M):",
"+ # row = input().split()",
"+ # row[0] = int(row[0])",
"+ # if row[0] not in PS:",
"+ # PS[row[0]] = [row[1]]",
"+ # else:",
"+ # PS[row[0]].append(row[1])",
... | false | 0.047639 | 0.048525 | 0.981736 | [
"s303219300",
"s862454476"
] |
u104005543 | p02678 | python | s277211842 | s596271719 | 771 | 675 | 34,748 | 35,096 | Accepted | Accepted | 12.45 | from collections import deque
n, m = list(map(int, input().split()))
way = [[] for i in range(n + 1)]
ans = [-1 for i in range(n + 1)]
reached = [0 for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
way[a].append(b)
way[b].append(a)
D = deque([1])
while D:
go = D... | from collections import deque
n, m = list(map(int, input().split()))
route =[[] for i in range(n+1)]
for i in range(m):
a, b = list(map(int, input().split()))
route[a].append(b)
route[b].append(a)
visited = [0 for i in range(n+1)]
visited[1] = 1
ans = [0 for i in range(n+1)]
D = deque()
D.append(... | 20 | 22 | 508 | 541 | from collections import deque
n, m = list(map(int, input().split()))
way = [[] for i in range(n + 1)]
ans = [-1 for i in range(n + 1)]
reached = [0 for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
way[a].append(b)
way[b].append(a)
D = deque([1])
while D:
go = D.popleft()... | from collections import deque
n, m = list(map(int, input().split()))
route = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
route[a].append(b)
route[b].append(a)
visited = [0 for i in range(n + 1)]
visited[1] = 1
ans = [0 for i in range(n + 1)]
D = deque()
D.append(1)
... | false | 9.090909 | [
"-way = [[] for i in range(n + 1)]",
"-ans = [-1 for i in range(n + 1)]",
"-reached = [0 for i in range(n + 1)]",
"+route = [[] for i in range(n + 1)]",
"- way[a].append(b)",
"- way[b].append(a)",
"-D = deque([1])",
"+ route[a].append(b)",
"+ route[b].append(a)",
"+visited = [0 for i i... | false | 0.038059 | 0.040167 | 0.947517 | [
"s277211842",
"s596271719"
] |
u392319141 | p03775 | python | s050278819 | s712913301 | 34 | 28 | 3,064 | 3,064 | Accepted | Accepted | 17.65 | N = int(eval(input()))
def factor(n):
factList = []
i = 1
while i * i <= n:
if n % i == 0:
factList.append(i)
factList.append(n // i)
i += 1
factList.sort()
return factList
fact = factor(N)
ans = float('inf')
for i in range(len(fact)):
... | N = int(eval(input()))
# 約数の全列挙
def divisors(n):
divisors = []
R = int(n**(0.5)) + 1
for i in range(1, R):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort(reverse=True) # ソート
return divisors
an... | 22 | 19 | 403 | 431 | N = int(eval(input()))
def factor(n):
factList = []
i = 1
while i * i <= n:
if n % i == 0:
factList.append(i)
factList.append(n // i)
i += 1
factList.sort()
return factList
fact = factor(N)
ans = float("inf")
for i in range(len(fact)):
f = max(len(str(... | N = int(eval(input()))
# 約数の全列挙
def divisors(n):
divisors = []
R = int(n ** (0.5)) + 1
for i in range(1, R):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort(reverse=True) # ソート
return divisors
ans = len(str(... | false | 13.636364 | [
"+# 約数の全列挙",
"+def divisors(n):",
"+ divisors = []",
"+ R = int(n ** (0.5)) + 1",
"+ for i in range(1, R):",
"+ if n % i == 0:",
"+ divisors.append(i)",
"+ if i != n // i:",
"+ divisors.append(n // i)",
"+ # divisors.sort(reverse=True) # ソート... | false | 0.118118 | 0.046433 | 2.543874 | [
"s050278819",
"s712913301"
] |
u334712262 | p03078 | python | s862549377 | s483574392 | 1,379 | 277 | 86,492 | 85,916 | Accepted | Accepted | 79.91 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 101 | 95 | 2,016 | 1,887 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 5.940594 | [
"- A.sort(reverse=True)",
"- B.sort(reverse=True)",
"- C.sort(reverse=True)",
"- if len(A) > K:",
"- A = A[:K]",
"- if len(B) > K:",
"- B = B[:K]",
"- if len(C) > K:",
"- C = C[:K]",
"- heapq.heappush(q, a + b)",
"- if len(q) > K:",
... | false | 0.036515 | 0.037573 | 0.971836 | [
"s862549377",
"s483574392"
] |
u777283665 | p02996 | python | s356547969 | s040339933 | 1,182 | 899 | 74,712 | 53,600 | Accepted | Accepted | 23.94 | n = int(eval(input()))
task_list = []
for i in range(n):
a, b = list(map(int, input().split()))
task_list.append((a, b))
task_list = sorted(task_list, key=lambda x: x[1])
current = 0
for task in task_list:
current += task[0]
if current > task[1]:
print("No")
exit()
... | n = int(eval(input()))
tasks = [list(map(int, input().split())) for _ in range(n)]
tasks.sort(key=lambda x: x[1])
current_time = 0
for task in tasks:
current_time += task[0]
if current_time > task[1]:
print("No")
exit()
print("Yes") | 19 | 13 | 322 | 265 | n = int(eval(input()))
task_list = []
for i in range(n):
a, b = list(map(int, input().split()))
task_list.append((a, b))
task_list = sorted(task_list, key=lambda x: x[1])
current = 0
for task in task_list:
current += task[0]
if current > task[1]:
print("No")
exit()
print("Yes")
| n = int(eval(input()))
tasks = [list(map(int, input().split())) for _ in range(n)]
tasks.sort(key=lambda x: x[1])
current_time = 0
for task in tasks:
current_time += task[0]
if current_time > task[1]:
print("No")
exit()
print("Yes")
| false | 31.578947 | [
"-task_list = []",
"-for i in range(n):",
"- a, b = list(map(int, input().split()))",
"- task_list.append((a, b))",
"-task_list = sorted(task_list, key=lambda x: x[1])",
"-current = 0",
"-for task in task_list:",
"- current += task[0]",
"- if current > task[1]:",
"+tasks = [list(map(in... | false | 0.06577 | 0.067997 | 0.967255 | [
"s356547969",
"s040339933"
] |
u647999897 | p02726 | python | s161638224 | s811371249 | 1,677 | 1,218 | 3,956 | 62,812 | Accepted | Accepted | 27.37 | from collections import defaultdict, deque
def solve():
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
cnter = defaultdict(int)
for i in range(N):
for j in range(i,N):
n_step = min(abs(j-i), abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(j-X))
cnter[n_step] +... | from collections import deque
def solve():
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
ans = [0] * N
for start_vertex in range(N):
q = deque()
distance_list = [float('inf')] * N
def push(vertex, distance):
if distance_list[vertex] != float('inf... | 18 | 40 | 419 | 1,052 | from collections import defaultdict, deque
def solve():
N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
cnter = defaultdict(int)
for i in range(N):
for j in range(i, N):
n_step = min(
abs(j - i), abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(j - X)
... | from collections import deque
def solve():
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
ans = [0] * N
for start_vertex in range(N):
q = deque()
distance_list = [float("inf")] * N
def push(vertex, distance):
if distance_list[vertex] != float("inf"):
... | false | 55 | [
"-from collections import defaultdict, deque",
"+from collections import deque",
"- N, X, Y = list(map(int, input().split()))",
"+ N, X, Y = map(int, input().split())",
"- cnter = defaultdict(int)",
"- for i in range(N):",
"- for j in range(i, N):",
"- n_step = min(",
"... | false | 0.071826 | 0.034416 | 2.086984 | [
"s161638224",
"s811371249"
] |
u816872429 | p02775 | python | s895863835 | s130691846 | 148 | 117 | 76,892 | 75,636 | Accepted | Accepted | 20.95 | n = eval(input())
dp = [0, 10000]
for d in reversed('0' + n):
newdp = []
newdp.append(min(int(d) + dp[0], int(d) + 1 + dp[1]))
newdp.append(min(10 - int(d) + dp[0], 10 - int(d) - 1 + dp[1]))
dp = newdp
print((dp[0]))
| n = eval(input())
dp = [0, 10000]
for d in map(int, reversed(n)):
dp = [min(d + dp[0], d + 1 + dp[1]), min(10 - d + dp[0], 9 - d + dp[1])]
print((min(dp[0], 1 + dp[1])))
| 8 | 5 | 232 | 170 | n = eval(input())
dp = [0, 10000]
for d in reversed("0" + n):
newdp = []
newdp.append(min(int(d) + dp[0], int(d) + 1 + dp[1]))
newdp.append(min(10 - int(d) + dp[0], 10 - int(d) - 1 + dp[1]))
dp = newdp
print((dp[0]))
| n = eval(input())
dp = [0, 10000]
for d in map(int, reversed(n)):
dp = [min(d + dp[0], d + 1 + dp[1]), min(10 - d + dp[0], 9 - d + dp[1])]
print((min(dp[0], 1 + dp[1])))
| false | 37.5 | [
"-for d in reversed(\"0\" + n):",
"- newdp = []",
"- newdp.append(min(int(d) + dp[0], int(d) + 1 + dp[1]))",
"- newdp.append(min(10 - int(d) + dp[0], 10 - int(d) - 1 + dp[1]))",
"- dp = newdp",
"-print((dp[0]))",
"+for d in map(int, reversed(n)):",
"+ dp = [min(d + dp[0], d + 1 + dp[1])... | false | 0.03785 | 0.036576 | 1.034817 | [
"s895863835",
"s130691846"
] |
u440566786 | p04030 | python | s811549445 | s263567352 | 170 | 64 | 38,384 | 61,464 | Accepted | Accepted | 62.35 | S = eval(input())
ans = []
for s in S:
if s=='B' and ans:
ans.pop(-1)
elif s!='B':
ans.append(s)
print((''.join(ans))) | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
stack = []
for c in eval(input()):
if c != 'B':
stack.append(c)
else:
if stack:
stack.pop()
... | 8 | 15 | 141 | 346 | S = eval(input())
ans = []
for s in S:
if s == "B" and ans:
ans.pop(-1)
elif s != "B":
ans.append(s)
print(("".join(ans)))
| import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
stack = []
for c in eval(input()):
if c != "B":
stack.append(c)
else:
if stack:
stack.pop()
print(("... | false | 46.666667 | [
"-S = eval(input())",
"-ans = []",
"-for s in S:",
"- if s == \"B\" and ans:",
"- ans.pop(-1)",
"- elif s != \"B\":",
"- ans.append(s)",
"-print((\"\".join(ans)))",
"+import sys",
"+",
"+INF = 1 << 60",
"+MOD = 10**9 + 7 # 998244353",
"+sys.setrecursionlimit(2147483647)"... | false | 0.083545 | 0.073713 | 1.133379 | [
"s811549445",
"s263567352"
] |
u644907318 | p03599 | python | s108709253 | s977494396 | 1,829 | 186 | 3,064 | 40,048 | Accepted | Accepted | 89.83 | A,B,C,D,E,F = list(map(int,input().split()))
cmax = 0
x = 100*A
y = 0
for n in range(F//(100*A)+1):
for m in range((F-n*100*A)//(100*B)+1):
for l in range((F-n*100*A-m*100*B)//C+1):
for k in range((F-n*100*A-m*100*B-l*C)//D+1):
# print("n,m,l,k={},{},{},{}".format(n,m,l,k... | A,B,C,D,E,F = list(map(int,input().split()))
xmax = 100*A
kmax = 0
for n in range(31):
for m in range(31):
x = 100*(n*A+m*B)
ymax = min((n*A+m*B)*E,F-100*(n*A+m*B))
for k in range(ymax,ymax-C-1,-1):
t = 0
flag = 0
while k-t*D>=0:
... | 17 | 20 | 707 | 566 | A, B, C, D, E, F = list(map(int, input().split()))
cmax = 0
x = 100 * A
y = 0
for n in range(F // (100 * A) + 1):
for m in range((F - n * 100 * A) // (100 * B) + 1):
for l in range((F - n * 100 * A - m * 100 * B) // C + 1):
for k in range((F - n * 100 * A - m * 100 * B - l * C) // D + 1):
... | A, B, C, D, E, F = list(map(int, input().split()))
xmax = 100 * A
kmax = 0
for n in range(31):
for m in range(31):
x = 100 * (n * A + m * B)
ymax = min((n * A + m * B) * E, F - 100 * (n * A + m * B))
for k in range(ymax, ymax - C - 1, -1):
t = 0
flag = 0
w... | false | 15 | [
"-cmax = 0",
"-x = 100 * A",
"-y = 0",
"-for n in range(F // (100 * A) + 1):",
"- for m in range((F - n * 100 * A) // (100 * B) + 1):",
"- for l in range((F - n * 100 * A - m * 100 * B) // C + 1):",
"- for k in range((F - n * 100 * A - m * 100 * B - l * C) // D + 1):",
"- ... | false | 0.545934 | 0.04571 | 11.943433 | [
"s108709253",
"s977494396"
] |
u172147273 | p03415 | python | s118975421 | s112168481 | 68 | 60 | 61,332 | 61,636 | Accepted | Accepted | 11.76 | for i in range(3):
a=input()
print(a[i],end="")
| print(input()[0],end="")
print(input()[1],end="")
print(input()[2],end="")
| 3 | 3 | 57 | 76 | for i in range(3):
a = input()
print(a[i], end="")
| print(input()[0], end="")
print(input()[1], end="")
print(input()[2], end="")
| false | 0 | [
"-for i in range(3):",
"- a = input()",
"- print(a[i], end=\"\")",
"+print(input()[0], end=\"\")",
"+print(input()[1], end=\"\")",
"+print(input()[2], end=\"\")"
] | false | 0.041431 | 0.040392 | 1.025706 | [
"s118975421",
"s112168481"
] |
u230686312 | p02953 | python | s876928429 | s410863866 | 80 | 52 | 14,396 | 14,396 | Accepted | Accepted | 35 | N = int(eval(input()))
Hs = [int(x) for x in input().split()]
# 右端から見て, 単調減少/同じにできればいい.
# 右端から見て, 右側より大きければ1つ減らす.
# その上で比較していく. もし単調減少/同じにできなければ'No'を返す.
prev = 'init'
is_yes = True
for i in range(N):
current = Hs[N-1-i]
if prev == 'init':
prev = current
continue
elif prev >= ... | N = int(eval(input()))
Hs = [int(x) for x in input().split()]
# 右端から見て, 単調減少/同じにできればいい.
# 右端から見て, 右側より大きければ1つ減らす.
# その上で比較していく. もし単調減少/同じにできなければ'No'を返す.
def is_yes(Hs):
max = 0
for H in Hs:
# print("H: " + H)
if H > max:
max = H
# print("max: " + max)
... | 25 | 23 | 497 | 436 | N = int(eval(input()))
Hs = [int(x) for x in input().split()]
# 右端から見て, 単調減少/同じにできればいい.
# 右端から見て, 右側より大きければ1つ減らす.
# その上で比較していく. もし単調減少/同じにできなければ'No'を返す.
prev = "init"
is_yes = True
for i in range(N):
current = Hs[N - 1 - i]
if prev == "init":
prev = current
continue
elif prev >= current:
... | N = int(eval(input()))
Hs = [int(x) for x in input().split()]
# 右端から見て, 単調減少/同じにできればいい.
# 右端から見て, 右側より大きければ1つ減らす.
# その上で比較していく. もし単調減少/同じにできなければ'No'を返す.
def is_yes(Hs):
max = 0
for H in Hs:
# print("H: " + H)
if H > max:
max = H
# print("max: " + max)
if max - H >= 2:... | false | 8 | [
"-prev = \"init\"",
"-is_yes = True",
"-for i in range(N):",
"- current = Hs[N - 1 - i]",
"- if prev == \"init\":",
"- prev = current",
"- continue",
"- elif prev >= current:",
"- prev = current",
"- elif prev == current - 1:",
"- prev = current - 1",
"-... | false | 0.044897 | 0.044736 | 1.003586 | [
"s876928429",
"s410863866"
] |
u089230684 | p03073 | python | s577051869 | s797689896 | 82 | 67 | 3,956 | 3,188 | Accepted | Accepted | 18.29 | x = list(str(eval(input())))
i = 0
counter =0
while i<len(x)-1 :
if(x[i]==x[i+1]):
if x[i+1]=="0":
x[i+1]="1"
else:
x[i+1]="0"
# x[i+1]=x[i-1]
counter+=1
i+=1
print(counter) | receber = eval(input())
contador = 0
contaor = 0
casoUm=""
casoDois=""
if receber[0] == "1":
for i in range(len(receber)):
if i%2==0:
casoUm+="1"
else:
casoUm+="0"
for k in range(len(receber)):
if receber[k] != casoUm[k]:
contador+=1
else... | 13 | 25 | 242 | 557 | x = list(str(eval(input())))
i = 0
counter = 0
while i < len(x) - 1:
if x[i] == x[i + 1]:
if x[i + 1] == "0":
x[i + 1] = "1"
else:
x[i + 1] = "0"
# x[i+1]=x[i-1]
counter += 1
i += 1
print(counter)
| receber = eval(input())
contador = 0
contaor = 0
casoUm = ""
casoDois = ""
if receber[0] == "1":
for i in range(len(receber)):
if i % 2 == 0:
casoUm += "1"
else:
casoUm += "0"
for k in range(len(receber)):
if receber[k] != casoUm[k]:
contador += 1
else... | false | 48 | [
"-x = list(str(eval(input())))",
"-i = 0",
"-counter = 0",
"-while i < len(x) - 1:",
"- if x[i] == x[i + 1]:",
"- if x[i + 1] == \"0\":",
"- x[i + 1] = \"1\"",
"+receber = eval(input())",
"+contador = 0",
"+contaor = 0",
"+casoUm = \"\"",
"+casoDois = \"\"",
"+if receber... | false | 0.045117 | 0.035139 | 1.283943 | [
"s577051869",
"s797689896"
] |
u506689504 | p03457 | python | s325545107 | s978221350 | 423 | 323 | 27,324 | 3,060 | Accepted | Accepted | 23.64 | n = int(eval(input()))
txy = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
if i == 0:
ti, xi, yi = 0, 0, 0
else:
ti, xi, yi = txy[i-1]
tf,xf,yf = txy[i]
dt = tf - ti
dx = abs(xi-xf)
dy = abs(yi-yf)
if dt < dx + dy or (dt-(dx+dy))%2 != 0... | n = int(eval(input()))
for i in range(n):
t, x, y = list(map(int, input().split()))
if x+y > t or (x+y+t) % 2!=0:
print("No")
exit()
print("Yes") | 17 | 7 | 367 | 163 | n = int(eval(input()))
txy = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
if i == 0:
ti, xi, yi = 0, 0, 0
else:
ti, xi, yi = txy[i - 1]
tf, xf, yf = txy[i]
dt = tf - ti
dx = abs(xi - xf)
dy = abs(yi - yf)
if dt < dx + dy or (dt - (dx + dy)) % 2 != 0:... | n = int(eval(input()))
for i in range(n):
t, x, y = list(map(int, input().split()))
if x + y > t or (x + y + t) % 2 != 0:
print("No")
exit()
print("Yes")
| false | 58.823529 | [
"-txy = [list(map(int, input().split())) for i in range(n)]",
"- if i == 0:",
"- ti, xi, yi = 0, 0, 0",
"- else:",
"- ti, xi, yi = txy[i - 1]",
"- tf, xf, yf = txy[i]",
"- dt = tf - ti",
"- dx = abs(xi - xf)",
"- dy = abs(yi - yf)",
"- if dt < dx + dy or (dt - (d... | false | 0.040463 | 0.034915 | 1.158918 | [
"s325545107",
"s978221350"
] |
u363892646 | p02859 | python | s613133522 | s409138000 | 22 | 18 | 2,940 | 2,940 | Accepted | Accepted | 18.18 | r = int(eval(input()))
print((r * r)) | print((int(eval(input()))**2)) | 2 | 1 | 30 | 22 | r = int(eval(input()))
print((r * r))
| print((int(eval(input())) ** 2))
| false | 50 | [
"-r = int(eval(input()))",
"-print((r * r))",
"+print((int(eval(input())) ** 2))"
] | false | 0.034611 | 0.040367 | 0.857407 | [
"s613133522",
"s409138000"
] |
u561231954 | p03290 | python | s462102616 | s407132929 | 36 | 24 | 3,064 | 3,316 | Accepted | Accepted | 33.33 | import sys
input=sys.stdin.readline
INF = 10**9
def main():
d,g=list(map(int,input().split()))
P=[list(map(int,input().split())) for _ in range(d)]
ans=INF
for bit in range(1<<d):
score=0
p=0
cnt=0
for i in range(d):
if (bit>>i)&1:
... | INF = 10 ** 9
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from heapq import heappop,heapify,heappush
from bisect import bisect_left
def main():
d,g = list(map(int,input().split()))
problems = [list(map(int,input().split())) for _ in range(d)]
ans = INF
... | 34 | 37 | 776 | 942 | import sys
input = sys.stdin.readline
INF = 10**9
def main():
d, g = list(map(int, input().split()))
P = [list(map(int, input().split())) for _ in range(d)]
ans = INF
for bit in range(1 << d):
score = 0
p = 0
cnt = 0
for i in range(d):
if (bit >> i) & 1:
... | INF = 10**9
import sys
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
from heapq import heappop, heapify, heappush
from bisect import bisect_left
def main():
d, g = list(map(int, input().split()))
problems = [list(map(int, input().split())) for _ in range(d)]
ans = INF
for bit... | false | 8.108108 | [
"+INF = 10**9",
"-input = sys.stdin.readline",
"-INF = 10**9",
"+sys.setrecursionlimit(100000000)",
"+dy = (-1, 0, 1, 0)",
"+dx = (0, 1, 0, -1)",
"+from heapq import heappop, heapify, heappush",
"+from bisect import bisect_left",
"- P = [list(map(int, input().split())) for _ in range(d)]",
"+ ... | false | 0.062819 | 0.059025 | 1.06427 | [
"s462102616",
"s407132929"
] |
u762420987 | p03848 | python | s775222192 | s106331059 | 90 | 69 | 15,312 | 14,820 | Accepted | Accepted | 23.33 | from collections import Counter
N = int(eval(input()))
AC = Counter(list(map(int, input().split())))
if N % 2 == 1:
if N == 1:
ans = AC[0] == 1
else:
ans = AC[0] == 1
for k, v in AC.most_common(N//2):
if k > N-1 or k % 2 != 0 or v != 2:
ans = False
... | from collections import Counter
N = int(eval(input()))
Alist = list(map(int, input().split()))
Ac = Counter(Alist)
mod = 10**9+7
if N%2==0:
for i in range(1, N, 2):
if Ac[i] != 2:
print((0))
break
else:
print((pow(2, (N//2), mod)))
else:
if Ac[0] != 1:
... | 22 | 22 | 544 | 503 | from collections import Counter
N = int(eval(input()))
AC = Counter(list(map(int, input().split())))
if N % 2 == 1:
if N == 1:
ans = AC[0] == 1
else:
ans = AC[0] == 1
for k, v in AC.most_common(N // 2):
if k > N - 1 or k % 2 != 0 or v != 2:
ans = False
... | from collections import Counter
N = int(eval(input()))
Alist = list(map(int, input().split()))
Ac = Counter(Alist)
mod = 10**9 + 7
if N % 2 == 0:
for i in range(1, N, 2):
if Ac[i] != 2:
print((0))
break
else:
print((pow(2, (N // 2), mod)))
else:
if Ac[0] != 1:
... | false | 0 | [
"-AC = Counter(list(map(int, input().split())))",
"-if N % 2 == 1:",
"- if N == 1:",
"- ans = AC[0] == 1",
"+Alist = list(map(int, input().split()))",
"+Ac = Counter(Alist)",
"+mod = 10**9 + 7",
"+if N % 2 == 0:",
"+ for i in range(1, N, 2):",
"+ if Ac[i] != 2:",
"+ ... | false | 0.039512 | 0.039895 | 0.9904 | [
"s775222192",
"s106331059"
] |
u761529120 | p03295 | python | s550948646 | s404056399 | 844 | 308 | 55,384 | 92,008 | Accepted | Accepted | 63.51 | def main():
N, M = list(map(int, input().split()))
A = []
for _ in range(M):
a, b = list(map(int, input().split()))
A.append((a,b))
sort_A = sorted(A)
left = 0
right = N
cnt = 1
for i in range(M):
left = max(sort_A[i][0],left)
right = min(sor... | def main():
N, M = list(map(int, input().split()))
X = []
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
X.append([a,b])
X.sort(key=lambda x: x[1])
cnt = 1
now = X[0][1]
for a, b in X:
if now <= a:
... | 27 | 23 | 482 | 403 | def main():
N, M = list(map(int, input().split()))
A = []
for _ in range(M):
a, b = list(map(int, input().split()))
A.append((a, b))
sort_A = sorted(A)
left = 0
right = N
cnt = 1
for i in range(M):
left = max(sort_A[i][0], left)
right = min(sort_A[i][1], r... | def main():
N, M = list(map(int, input().split()))
X = []
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
X.append([a, b])
X.sort(key=lambda x: x[1])
cnt = 1
now = X[0][1]
for a, b in X:
if now <= a:
cnt += 1
... | false | 14.814815 | [
"- A = []",
"+ X = []",
"- A.append((a, b))",
"- sort_A = sorted(A)",
"- left = 0",
"- right = N",
"+ a -= 1",
"+ b -= 1",
"+ X.append([a, b])",
"+ X.sort(key=lambda x: x[1])",
"- for i in range(M):",
"- left = max(sort_A[i][0], left)",
... | false | 0.035949 | 0.035965 | 0.999557 | [
"s550948646",
"s404056399"
] |
u315485238 | p03241 | python | s866856518 | s113401021 | 1,898 | 21 | 3,060 | 3,060 | Accepted | Accepted | 98.89 | N, M = list(map(int, input().split()))
def solution():
if M-N < M//N:
for n in range(N, M+1):
if M%n==0:
return M//n
else:
for m in range(M//N, 0, -1):
if M%m==0:
return m
print((solution()))
| N, M = list(map(int, input().split()))
def solution():
answer = 1
for i in range(1, int(M**0.5)+1):
if M%i ==0:
if M//i>=N:
answer = max(answer , i)
if i>=N:
answer = max(answer, M//i)
return answer
print((solution())) | 14 | 13 | 297 | 306 | N, M = list(map(int, input().split()))
def solution():
if M - N < M // N:
for n in range(N, M + 1):
if M % n == 0:
return M // n
else:
for m in range(M // N, 0, -1):
if M % m == 0:
return m
print((solution()))
| N, M = list(map(int, input().split()))
def solution():
answer = 1
for i in range(1, int(M**0.5) + 1):
if M % i == 0:
if M // i >= N:
answer = max(answer, i)
if i >= N:
answer = max(answer, M // i)
return answer
print((solution()))
| false | 7.142857 | [
"- if M - N < M // N:",
"- for n in range(N, M + 1):",
"- if M % n == 0:",
"- return M // n",
"- else:",
"- for m in range(M // N, 0, -1):",
"- if M % m == 0:",
"- return m",
"+ answer = 1",
"+ for i in range(1, int(M**0... | false | 0.108477 | 0.073416 | 1.477569 | [
"s866856518",
"s113401021"
] |
u760802228 | p02659 | python | s702975392 | s920452902 | 24 | 22 | 9,128 | 9,148 | Accepted | Accepted | 8.33 | A, B = input().split()
ans = (int(A) * (int(B[0])*100 + int(B[2])*10 + int(B[3]))) // 100
print((int(ans))) | A, B = input().split()
ans = int(A) * round(float(B) * 100) // 100
print((int(ans))) | 3 | 3 | 107 | 84 | A, B = input().split()
ans = (int(A) * (int(B[0]) * 100 + int(B[2]) * 10 + int(B[3]))) // 100
print((int(ans)))
| A, B = input().split()
ans = int(A) * round(float(B) * 100) // 100
print((int(ans)))
| false | 0 | [
"-ans = (int(A) * (int(B[0]) * 100 + int(B[2]) * 10 + int(B[3]))) // 100",
"+ans = int(A) * round(float(B) * 100) // 100"
] | false | 0.036453 | 0.068575 | 0.53158 | [
"s702975392",
"s920452902"
] |
u657329920 | p02628 | python | s566823509 | s444990744 | 370 | 66 | 80,016 | 62,068 | Accepted | Accepted | 82.16 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
print((sum(sorted(p)[:K]))) | N, K = list(map(int, input().split()))
p = [int(num) for num in input().split()]
print((sum(sorted(p)[:K]))) | 3 | 3 | 96 | 102 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
print((sum(sorted(p)[:K])))
| N, K = list(map(int, input().split()))
p = [int(num) for num in input().split()]
print((sum(sorted(p)[:K])))
| false | 0 | [
"-p = list(map(int, input().split()))",
"+p = [int(num) for num in input().split()]"
] | false | 0.045158 | 0.08783 | 0.514153 | [
"s566823509",
"s444990744"
] |
u811434779 | p02363 | python | s398159926 | s393564642 | 680 | 490 | 6,856 | 6,880 | Accepted | Accepted | 27.94 | INF = 1<<31
V, E = list(map(int, input().split()))
l = [[INF]*V for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
l[s][t] = d
for k in range(V):
for i in range(V):
for j in range(V):
if l[i][k] != INF and l[k][j] != INF:
l[i][j] = m... | INF = float("inf")
V, E = list(map(int, input().split()))
l = [[INF]*V for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
l[s][t] = d
for k in range(V):
for i in range(V):
for j in range(V):
l[i][j] = min(l[i][j], l[i][k] + l[k][j])
for i in range(V... | 21 | 20 | 583 | 535 | INF = 1 << 31
V, E = list(map(int, input().split()))
l = [[INF] * V for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
l[s][t] = d
for k in range(V):
for i in range(V):
for j in range(V):
if l[i][k] != INF and l[k][j] != INF:
l[i][j] = min(l[i... | INF = float("inf")
V, E = list(map(int, input().split()))
l = [[INF] * V for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
l[s][t] = d
for k in range(V):
for i in range(V):
for j in range(V):
l[i][j] = min(l[i][j], l[i][k] + l[k][j])
for i in range(V):
i... | false | 4.761905 | [
"-INF = 1 << 31",
"+INF = float(\"inf\")",
"- if l[i][k] != INF and l[k][j] != INF:",
"- l[i][j] = min(l[i][j], l[i][k] + l[k][j])",
"+ l[i][j] = min(l[i][j], l[i][k] + l[k][j])"
] | false | 0.039304 | 0.035656 | 1.102322 | [
"s398159926",
"s393564642"
] |
u367701763 | p02861 | python | s238661265 | s056554468 | 300 | 103 | 3,316 | 74,436 | Accepted | Accepted | 65.67 | from itertools import permutations
from itertools import combinations
from math import sqrt
from math import factorial
from collections import defaultdict
N = int(eval(input()))
points = [list(map(int, input().split())) for _ in range(N) ]
length = defaultdict(float)
l_sum = 0
res = 0
for a, b in comb... | from itertools import permutations
from math import factorial
N = int(eval(input()))
data = []
for _ in range(N):
x, y = list(map(int, input().split()))
data.append((x,y))
res = 0
for a in permutations(data,N):
x0, y0 = a[0]
for x, y in a[1:]:
res += ((x-x0)**2 + (y-y0)**2)**(0.5)
... | 24 | 15 | 604 | 354 | from itertools import permutations
from itertools import combinations
from math import sqrt
from math import factorial
from collections import defaultdict
N = int(eval(input()))
points = [list(map(int, input().split())) for _ in range(N)]
length = defaultdict(float)
l_sum = 0
res = 0
for a, b in combinations(list(rang... | from itertools import permutations
from math import factorial
N = int(eval(input()))
data = []
for _ in range(N):
x, y = list(map(int, input().split()))
data.append((x, y))
res = 0
for a in permutations(data, N):
x0, y0 = a[0]
for x, y in a[1:]:
res += ((x - x0) ** 2 + (y - y0) ** 2) ** (0.5)
... | false | 37.5 | [
"-from itertools import combinations",
"-from math import sqrt",
"-from collections import defaultdict",
"-points = [list(map(int, input().split())) for _ in range(N)]",
"-length = defaultdict(float)",
"-l_sum = 0",
"+data = []",
"+for _ in range(N):",
"+ x, y = list(map(int, input().split()))",
... | false | 0.040822 | 0.036407 | 1.121256 | [
"s238661265",
"s056554468"
] |
u756829954 | p03163 | python | s748382919 | s065515684 | 386 | 349 | 118,256 | 117,232 | Accepted | Accepted | 9.59 | def p_d():
N, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
for j in range(1, W + 1):
if j - w >= 0:
dp[i][j] = max(v + dp[i - 1][j - w], dp[i - 1][j])
... | def p_e():
"""
ナップサック問題(制約厳しい版)
"""
N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
NEXT = [0] * (W + 1)
for j in range(1, W + 1):
if j - w >= 0:
NEXT[j] = m... | 17 | 21 | 446 | 471 | def p_d():
N, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
for j in range(1, W + 1):
if j - w >= 0:
dp[i][j] = max(v + dp[i - 1][j - w], dp[i - 1][j])
el... | def p_e():
"""
ナップサック問題(制約厳しい版)
"""
N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
NEXT = [0] * (W + 1)
for j in range(1, W + 1):
if j - w >= 0:
NEXT[j] = max(v + dp[j ... | false | 19.047619 | [
"-def p_d():",
"+def p_e():",
"+ \"\"\"",
"+ ナップサック問題(制約厳しい版)",
"+ \"\"\"",
"- dp = [[0] * (W + 1) for _ in range(N + 1)]",
"+ dp = [0] * (W + 1)",
"+ NEXT = [0] * (W + 1)",
"- dp[i][j] = max(v + dp[i - 1][j - w], dp[i - 1][j])",
"+ NEXT[j] = max... | false | 0.135443 | 0.046584 | 2.907477 | [
"s748382919",
"s065515684"
] |
u230621983 | p04034 | python | s961389816 | s116393949 | 387 | 246 | 12,652 | 10,652 | Accepted | Accepted | 36.43 | n, m = list(map(int, input().split()))
ball = [1] * n # 各箱のボールの個数。初めは各箱に1つずつ。
red = set([0]) # 赤いボールがある可能性のある箱のインデックス。初めは0番目の箱に赤いボールがある。
for _ in range(m):
x, y = list(map(int, input().split()))
ball[x-1] -= 1 # x-1番目の箱のボールを1つ減らす
ball[y-1] += 1 # y-1番目の箱のボールを1つ増やす
if x-1 in red: # x-1番目の箱に赤いボールがあるなら... | n, m = list(map(int, input().split()))
red = [0 for _ in range(n)]
red[0] = 1
balls = [1 for _ in range(n)]
for _ in range(m):
x, y = list(map(int, input().split()))
if balls[x-1]:
balls[x-1] -= 1
balls[y-1] += 1
if red[x-1]:
red[y-1] = 1
if balls[x-1] ... | 12 | 18 | 474 | 431 | n, m = list(map(int, input().split()))
ball = [1] * n # 各箱のボールの個数。初めは各箱に1つずつ。
red = set([0]) # 赤いボールがある可能性のある箱のインデックス。初めは0番目の箱に赤いボールがある。
for _ in range(m):
x, y = list(map(int, input().split()))
ball[x - 1] -= 1 # x-1番目の箱のボールを1つ減らす
ball[y - 1] += 1 # y-1番目の箱のボールを1つ増やす
if x - 1 in red: # x-1番目の箱に赤いボ... | n, m = list(map(int, input().split()))
red = [0 for _ in range(n)]
red[0] = 1
balls = [1 for _ in range(n)]
for _ in range(m):
x, y = list(map(int, input().split()))
if balls[x - 1]:
balls[x - 1] -= 1
balls[y - 1] += 1
if red[x - 1]:
red[y - 1] = 1
if balls[x - 1]... | false | 33.333333 | [
"-ball = [1] * n # 各箱のボールの個数。初めは各箱に1つずつ。",
"-red = set([0]) # 赤いボールがある可能性のある箱のインデックス。初めは0番目の箱に赤いボールがある。",
"+red = [0 for _ in range(n)]",
"+red[0] = 1",
"+balls = [1 for _ in range(n)]",
"- ball[x - 1] -= 1 # x-1番目の箱のボールを1つ減らす",
"- ball[y - 1] += 1 # y-1番目の箱のボールを1つ増やす",
"- if x - 1 in red... | false | 0.074961 | 0.066063 | 1.134691 | [
"s961389816",
"s116393949"
] |
u729133443 | p03694 | python | s504617956 | s201816887 | 177 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.4 | _,*a=list(map(int,open(0).read().split()));print((max(a)-min(a))) | _,t=open(0);*a,=list(map(int,t.split()));print((max(a)-min(a))) | 1 | 1 | 57 | 55 | _, *a = list(map(int, open(0).read().split()))
print((max(a) - min(a)))
| _, t = open(0)
(*a,) = list(map(int, t.split()))
print((max(a) - min(a)))
| false | 0 | [
"-_, *a = list(map(int, open(0).read().split()))",
"+_, t = open(0)",
"+(*a,) = list(map(int, t.split()))"
] | false | 0.041766 | 0.035541 | 1.175146 | [
"s504617956",
"s201816887"
] |
u737758066 | p02706 | python | s804537201 | s139342250 | 63 | 24 | 66,936 | 10,012 | Accepted | Accepted | 61.9 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
sm = sum(a)
if sm > n:
print((-1))
else:
print((n-sm))
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(a) > n:
print((-1))
else:
print((n-sum(a)))
| 8 | 7 | 136 | 131 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
sm = sum(a)
if sm > n:
print((-1))
else:
print((n - sm))
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(a) > n:
print((-1))
else:
print((n - sum(a)))
| false | 12.5 | [
"-sm = sum(a)",
"-if sm > n:",
"+if sum(a) > n:",
"- print((n - sm))",
"+ print((n - sum(a)))"
] | false | 0.041319 | 0.037236 | 1.109649 | [
"s804537201",
"s139342250"
] |
u382880969 | p03078 | python | s454185942 | s763016407 | 976 | 245 | 152,792 | 47,856 | Accepted | Accepted | 74.9 | import sys
if __name__ == "__main__":
(X, Y, Z, K) = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))
v = []
for a in A:
for b in B:
... | import sys
if __name__ == "__main__":
(X, Y, Z, K) = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))
A.sort(reverse=True)
B.sort(reverse=True... | 24 | 25 | 585 | 741 | import sys
if __name__ == "__main__":
(X, Y, Z, K) = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))
v = []
for a in A:
for b in B:
... | import sys
if __name__ == "__main__":
(X, Y, Z, K) = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.so... | false | 4 | [
"+ A.sort(reverse=True)",
"+ B.sort(reverse=True)",
"+ C.sort(reverse=True)",
"- for a in A:",
"- for b in B:",
"- v.append(a + b)",
"+ for a in range(len(A)):",
"+ for b in range(len(B)):",
"+ if (a + 1) * (b + 1) > K:",
"+ break",... | false | 0.042391 | 0.059918 | 0.707488 | [
"s454185942",
"s763016407"
] |
u058781705 | p02744 | python | s109731731 | s797022821 | 449 | 298 | 62,040 | 80,604 | Accepted | Accepted | 33.63 | import math
def div_with_mod(x, y, mod):
# Fermat's little theorem
return x*pow(y, mod - 2, mod)
def comb(n, r, mod):
# calculates C(n,r) with mod (assuming mod is prime)
nc = n
for rc in range(1, r):
nc -= 1
n = n*nc % mod
r = r*rc % mod
return div_w... | def solve():
N = int(input())
# ord("a") Unicode コードポイントを返す
codepoint = ord("a")
# たどるグラフの深さ
i = 1
# 標準形文字列とその次の辞書順
ans = [["a", 1]]
# 一つづつ潜る
while i < N:
# 次の深さをtmpとする
tmp = []
# 各ノード
for w, j in ans:
# 辞書順で追加していく
... | 39 | 30 | 728 | 674 | import math
def div_with_mod(x, y, mod):
# Fermat's little theorem
return x * pow(y, mod - 2, mod)
def comb(n, r, mod):
# calculates C(n,r) with mod (assuming mod is prime)
nc = n
for rc in range(1, r):
nc -= 1
n = n * nc % mod
r = r * rc % mod
return div_with_mod(n, ... | def solve():
N = int(input())
# ord("a") Unicode コードポイントを返す
codepoint = ord("a")
# たどるグラフの深さ
i = 1
# 標準形文字列とその次の辞書順
ans = [["a", 1]]
# 一つづつ潜る
while i < N:
# 次の深さをtmpとする
tmp = []
# 各ノード
for w, j in ans:
# 辞書順で追加していく
for k in rang... | false | 23.076923 | [
"-import math",
"-",
"-",
"-def div_with_mod(x, y, mod):",
"- # Fermat's little theorem",
"- return x * pow(y, mod - 2, mod)",
"-",
"-",
"-def comb(n, r, mod):",
"- # calculates C(n,r) with mod (assuming mod is prime)",
"- nc = n",
"- for rc in range(1, r):",
"- nc -= 1... | false | 0.039108 | 0.037851 | 1.033225 | [
"s109731731",
"s797022821"
] |
u775681539 | p02948 | python | s165389987 | s232503539 | 236 | 186 | 22,288 | 27,064 | Accepted | Accepted | 21.19 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush
def main():
N, M = list(map(int, readline().split()))
tasks = [[] for _ in range(M)]
for _ in range(N):
a, b = list(map(int, readline().sp... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush
def main():
N, M = list(map(int, readline().split()))
m = list(map(int, read().split()))
tasks = [[] for _ in range(M)]
for a, b in zip(m, m):... | 23 | 22 | 613 | 589 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush
def main():
N, M = list(map(int, readline().split()))
tasks = [[] for _ in range(M)]
for _ in range(N):
a, b = list(map(int, readline().split()))... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappop, heappush
def main():
N, M = list(map(int, readline().split()))
m = list(map(int, read().split()))
tasks = [[] for _ in range(M)]
for a, b in zip(m, m):
... | false | 4.347826 | [
"+ m = list(map(int, read().split()))",
"- for _ in range(N):",
"- a, b = list(map(int, readline().split()))",
"- if M - a < 0:",
"- continue",
"- tasks[M - a].append(b)",
"+ for a, b in zip(m, m):",
"+ if M - a >= 0:",
"+ tasks[M - a].appen... | false | 0.040058 | 0.040883 | 0.979806 | [
"s165389987",
"s232503539"
] |
u987164499 | p02597 | python | s248636480 | s192587490 | 58 | 48 | 9,468 | 9,396 | Accepted | Accepted | 17.24 | from sys import stdin
from sys import setrecursionlimit
import bisect
setrecursionlimit(10 ** 7)
n = int(eval(input()))
c = eval(input())
count = c.count("R")
point = 0
for i,j in enumerate(c,1):
if j == "R":
if i > count:
point += 1
print(point) | n = int(eval(input()))
s = eval(input())
num_r = s.count("R")
count = 0
for i in range(num_r):
if s[i] != "R":
count += 1
print(count) | 17 | 11 | 278 | 151 | from sys import stdin
from sys import setrecursionlimit
import bisect
setrecursionlimit(10**7)
n = int(eval(input()))
c = eval(input())
count = c.count("R")
point = 0
for i, j in enumerate(c, 1):
if j == "R":
if i > count:
point += 1
print(point)
| n = int(eval(input()))
s = eval(input())
num_r = s.count("R")
count = 0
for i in range(num_r):
if s[i] != "R":
count += 1
print(count)
| false | 35.294118 | [
"-from sys import stdin",
"-from sys import setrecursionlimit",
"-import bisect",
"-",
"-setrecursionlimit(10**7)",
"-c = eval(input())",
"-count = c.count(\"R\")",
"-point = 0",
"-for i, j in enumerate(c, 1):",
"- if j == \"R\":",
"- if i > count:",
"- point += 1",
"-pr... | false | 0.046714 | 0.043781 | 1.067001 | [
"s248636480",
"s192587490"
] |
u698919163 | p03168 | python | s332856505 | s584908710 | 740 | 361 | 263,048 | 112,092 | Accepted | Accepted | 51.22 | N = int(eval(input()))
p = list(map(float,input().split()))
dp = [[0]*(N+1) for i in range(N)]
dp[0][0] = 1-p[0]
dp[0][1] = p[0]
for i in range(1,N):
dp[i][0] = (1-p[i])*dp[i-1][0]
for j in range(1,i+2):
dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i])
print((sum(dp[-1][(N+1)/... | N = int(eval(input()))
p = list(map(float,input().split()))
dp = [[0.0]*(N+1) for i in range(N+1)]
dp[0][0] = 1.0
for i in range(1,N+1):
for j in range(0,N+1):
dp[i][j] = dp[i-1][j-1]*(p[i-1]) + dp[i-1][j]*(1-p[i-1])
res = 0.0
for i in range((N+1)//2,N+1):
res += dp[-1][i]
print(res) | 14 | 14 | 319 | 310 | N = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0] * (N + 1) for i in range(N)]
dp[0][0] = 1 - p[0]
dp[0][1] = p[0]
for i in range(1, N):
dp[i][0] = (1 - p[i]) * dp[i - 1][0]
for j in range(1, i + 2):
dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i])
print((sum(dp[-1][(N... | N = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0.0] * (N + 1) for i in range(N + 1)]
dp[0][0] = 1.0
for i in range(1, N + 1):
for j in range(0, N + 1):
dp[i][j] = dp[i - 1][j - 1] * (p[i - 1]) + dp[i - 1][j] * (1 - p[i - 1])
res = 0.0
for i in range((N + 1) // 2, N + 1):
res += dp[-... | false | 0 | [
"-dp = [[0] * (N + 1) for i in range(N)]",
"-dp[0][0] = 1 - p[0]",
"-dp[0][1] = p[0]",
"-for i in range(1, N):",
"- dp[i][0] = (1 - p[i]) * dp[i - 1][0]",
"- for j in range(1, i + 2):",
"- dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i])",
"-print((sum(dp[-1][(N + 1) // 2 :]... | false | 0.035582 | 0.034328 | 1.03652 | [
"s332856505",
"s584908710"
] |
u814781830 | p03241 | python | s180079483 | s697871342 | 193 | 178 | 39,280 | 38,768 | Accepted | Accepted | 7.77 | N, M = list(map(int, input().split()))
n = M
# 約数列挙(1,N)も含まれる
prime, i = set(), 1
while i * i <= n:
if n % i == 0:
prime.add(i)
prime.add(n//i)
i += 1
ans = 1
l = list(prime)
for i in l:
if i * N <= M:
ans = max(ans, i)
print(ans)
| N, M = list(map(int, input().split()))
prime, i = set(), 1
while i * i <= M:
if M % i == 0:
prime.add(i)
prime.add(M//i)
i += 1
ans = 0
for i in prime:
if i * N <= M:
ans = max(ans, i)
print(ans)
| 18 | 14 | 281 | 241 | N, M = list(map(int, input().split()))
n = M
# 約数列挙(1,N)も含まれる
prime, i = set(), 1
while i * i <= n:
if n % i == 0:
prime.add(i)
prime.add(n // i)
i += 1
ans = 1
l = list(prime)
for i in l:
if i * N <= M:
ans = max(ans, i)
print(ans)
| N, M = list(map(int, input().split()))
prime, i = set(), 1
while i * i <= M:
if M % i == 0:
prime.add(i)
prime.add(M // i)
i += 1
ans = 0
for i in prime:
if i * N <= M:
ans = max(ans, i)
print(ans)
| false | 22.222222 | [
"-n = M",
"-# 約数列挙(1,N)も含まれる",
"-while i * i <= n:",
"- if n % i == 0:",
"+while i * i <= M:",
"+ if M % i == 0:",
"- prime.add(n // i)",
"+ prime.add(M // i)",
"-ans = 1",
"-l = list(prime)",
"-for i in l:",
"+ans = 0",
"+for i in prime:"
] | false | 0.057023 | 0.135361 | 0.421266 | [
"s180079483",
"s697871342"
] |
u167647458 | p03944 | python | s147787700 | s330136910 | 294 | 18 | 3,064 | 3,064 | Accepted | Accepted | 93.88 | w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
field = [[1 for _ in range(w)] for _ in range(h)]
for x, y, a in xya:
for i in range(h):
for j in range(w):
if a == 1 and j < x:
field[i][j] = 0... | w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
w1 = 0
w2 = w
h1 = 0
h2 = h
for x, y, a in xya:
if a == 1:
w1= max(w1, x)
if a == 2:
w2 = min(w2, x)
if a == 3:
h1 = max(h1, y)
if a == 4:
h2 = min(h2, y)
... | 21 | 18 | 624 | 362 | w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
field = [[1 for _ in range(w)] for _ in range(h)]
for x, y, a in xya:
for i in range(h):
for j in range(w):
if a == 1 and j < x:
field[i][j] = 0
if a == 2 and j >= x:
... | w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
w1 = 0
w2 = w
h1 = 0
h2 = h
for x, y, a in xya:
if a == 1:
w1 = max(w1, x)
if a == 2:
w2 = min(w2, x)
if a == 3:
h1 = max(h1, y)
if a == 4:
h2 = min(h2, y)
print((max(0, (w... | false | 14.285714 | [
"-field = [[1 for _ in range(w)] for _ in range(h)]",
"+w1 = 0",
"+w2 = w",
"+h1 = 0",
"+h2 = h",
"- for i in range(h):",
"- for j in range(w):",
"- if a == 1 and j < x:",
"- field[i][j] = 0",
"- if a == 2 and j >= x:",
"- field[i][j]... | false | 0.134035 | 0.036886 | 3.633748 | [
"s147787700",
"s330136910"
] |
u864197622 | p02670 | python | s196367550 | s446766667 | 1,947 | 1,731 | 171,704 | 173,636 | Accepted | Accepted | 11.09 | from collections import deque
N = int(eval(input()))
A = [int(a)-1 for a in input().split()]
M = N + 2
X = [max(min(i-1, j-1, M-2-i, M-2-j), -1) for j in range(M) for i in range(M)]
Y = [min(x, 0) + 1 for x in X]
def calc(i0):
h = X[i0]
if h < 0: return
Q = deque([(i0, h)])
X[i0] -= 1
Y... | from collections import deque
N = int(eval(input()))
A = [int(a)-1 for a in input().split()]
M = N + 2
X = [max(min(i-1, j-1, M-2-i, M-2-j), -1) for j in range(M) for i in range(M)]
Y = [min(x, 0) + 1 for x in X]
ans = 0
for a in A:
aa = (a // N + 1) * M + a % N + 1
ans += X[aa]
h = X[aa]
i... | 28 | 26 | 669 | 642 | from collections import deque
N = int(eval(input()))
A = [int(a) - 1 for a in input().split()]
M = N + 2
X = [
max(min(i - 1, j - 1, M - 2 - i, M - 2 - j), -1) for j in range(M) for i in range(M)
]
Y = [min(x, 0) + 1 for x in X]
def calc(i0):
h = X[i0]
if h < 0:
return
Q = deque([(i0, h)])
... | from collections import deque
N = int(eval(input()))
A = [int(a) - 1 for a in input().split()]
M = N + 2
X = [
max(min(i - 1, j - 1, M - 2 - i, M - 2 - j), -1) for j in range(M) for i in range(M)
]
Y = [min(x, 0) + 1 for x in X]
ans = 0
for a in A:
aa = (a // N + 1) * M + a % N + 1
ans += X[aa]
h = X[a... | false | 7.142857 | [
"-",
"-",
"-def calc(i0):",
"- h = X[i0]",
"+ans = 0",
"+for a in A:",
"+ aa = (a // N + 1) * M + a % N + 1",
"+ ans += X[aa]",
"+ h = X[aa]",
"- return",
"- Q = deque([(i0, h)])",
"- X[i0] -= 1",
"- Y[i0] = 0",
"+ continue",
"+ Q = deque([(aa, h)])"... | false | 0.040663 | 0.036358 | 1.118385 | [
"s196367550",
"s446766667"
] |
u525065967 | p02767 | python | s681605767 | s375961827 | 23 | 21 | 3,060 | 3,060 | Accepted | Accepted | 8.7 | n = int(eval(input()))
X = list(map(int, input().split()))
ans = 1000000000
for p in range(1,100):
s = 0
for x in X:
s += (x-p)**2
ans = min(ans, s)
print(ans) | n = int(eval(input()))
X = list(map(int, input().split()))
ans = 1000000000
for p in range(1,101):
s = 0
for x in X:
s += (x-p)**2
ans = min(ans, s)
print(ans) | 9 | 9 | 181 | 181 | n = int(eval(input()))
X = list(map(int, input().split()))
ans = 1000000000
for p in range(1, 100):
s = 0
for x in X:
s += (x - p) ** 2
ans = min(ans, s)
print(ans)
| n = int(eval(input()))
X = list(map(int, input().split()))
ans = 1000000000
for p in range(1, 101):
s = 0
for x in X:
s += (x - p) ** 2
ans = min(ans, s)
print(ans)
| false | 0 | [
"-for p in range(1, 100):",
"+for p in range(1, 101):"
] | false | 0.043469 | 0.041462 | 1.048417 | [
"s681605767",
"s375961827"
] |
u989345508 | p03574 | python | s557217036 | s716463461 | 26 | 21 | 3,572 | 3,064 | Accepted | Accepted | 19.23 | h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
def count_8(i,j):
global h,w,s
cnt=0
if i-1>=0 and j-1>=0:
if s[i-1][j-1]=="#":
cnt+=1
if i-1>=0 and j+1<=w-1:
if s[i-1][j+1]=="#":
cnt+=1
if i+1<=h-1 and j-1>=0:
if s[i+1][j-... | h,w=list(map(int,input().split()))
s=[eval(input())+"." if i!=h else "."*(w+1) for i in range(h+1)]
def count_8(i,j):
global h,w,s
cnt=str((s[i-1][j-1]=="#")+(s[i-1][j+1]=="#")+(s[i+1][j-1]=="#")+(s[i+1][j+1]=="#") \
+(s[i-1][j]=="#")+(s[i][j-1]=="#")+(s[i+1][j]=="#")+(s[i][j+1]=="#"))
return ... | 37 | 15 | 880 | 486 | h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
def count_8(i, j):
global h, w, s
cnt = 0
if i - 1 >= 0 and j - 1 >= 0:
if s[i - 1][j - 1] == "#":
cnt += 1
if i - 1 >= 0 and j + 1 <= w - 1:
if s[i - 1][j + 1] == "#":
cnt += 1
if i + 1 ... | h, w = list(map(int, input().split()))
s = [eval(input()) + "." if i != h else "." * (w + 1) for i in range(h + 1)]
def count_8(i, j):
global h, w, s
cnt = str(
(s[i - 1][j - 1] == "#")
+ (s[i - 1][j + 1] == "#")
+ (s[i + 1][j - 1] == "#")
+ (s[i + 1][j + 1] == "#")
+ (... | false | 59.459459 | [
"-h, w = map(int, input().split())",
"-s = [list(input()) for i in range(h)]",
"+h, w = list(map(int, input().split()))",
"+s = [eval(input()) + \".\" if i != h else \".\" * (w + 1) for i in range(h + 1)]",
"- cnt = 0",
"- if i - 1 >= 0 and j - 1 >= 0:",
"- if s[i - 1][j - 1] == \"#\":",
... | false | 0.081552 | 0.038441 | 2.121499 | [
"s557217036",
"s716463461"
] |
u700388551 | p02577 | python | s822864524 | s555919261 | 204 | 48 | 9,236 | 10,544 | Accepted | Accepted | 76.47 | N = int(eval(input()))
if(N%9 == 0):
print("Yes")
else:
print("No") | N = list(map(int,eval(input())))
if(sum(N) % 9 == 0):
print("Yes")
else:
print("No") | 5 | 5 | 67 | 84 | N = int(eval(input()))
if N % 9 == 0:
print("Yes")
else:
print("No")
| N = list(map(int, eval(input())))
if sum(N) % 9 == 0:
print("Yes")
else:
print("No")
| false | 0 | [
"-N = int(eval(input()))",
"-if N % 9 == 0:",
"+N = list(map(int, eval(input())))",
"+if sum(N) % 9 == 0:"
] | false | 0.085719 | 0.038236 | 2.241872 | [
"s822864524",
"s555919261"
] |
u504836877 | p02757 | python | s567233143 | s240572570 | 498 | 327 | 3,628 | 9,516 | Accepted | Accepted | 34.34 | N,P = list(map(int, input().split()))
S = eval(input())
ans = 0
if P == 2:
for i in range(N-1, -1, -1):
if int(S[i])%2 == 0:
ans += i+1
elif P == 5:
for i in range(N-1, -1, -1):
if int(S[i])%5 == 0:
ans += i+1
else:
L = [0]*P
num = 0
for i in r... | N,P = list(map(int, input().split()))
S = eval(input())
if P == 2:
ans = 0
for i in range(N):
if int(S[i])%2 == 0:
ans += i+1
elif P == 5:
ans = 0
for i in range(N):
if S[i] == "0" or S[i] == "5":
ans += i+1
else:
L = [0]*P
num = 0
for... | 25 | 25 | 499 | 493 | N, P = list(map(int, input().split()))
S = eval(input())
ans = 0
if P == 2:
for i in range(N - 1, -1, -1):
if int(S[i]) % 2 == 0:
ans += i + 1
elif P == 5:
for i in range(N - 1, -1, -1):
if int(S[i]) % 5 == 0:
ans += i + 1
else:
L = [0] * P
num = 0
for i in ra... | N, P = list(map(int, input().split()))
S = eval(input())
if P == 2:
ans = 0
for i in range(N):
if int(S[i]) % 2 == 0:
ans += i + 1
elif P == 5:
ans = 0
for i in range(N):
if S[i] == "0" or S[i] == "5":
ans += i + 1
else:
L = [0] * P
num = 0
for i in ra... | false | 0 | [
"-ans = 0",
"- for i in range(N - 1, -1, -1):",
"+ ans = 0",
"+ for i in range(N):",
"- for i in range(N - 1, -1, -1):",
"- if int(S[i]) % 5 == 0:",
"+ ans = 0",
"+ for i in range(N):",
"+ if S[i] == \"0\" or S[i] == \"5\":",
"- for i in range(N - 1, -1, -1):",
... | false | 0.038867 | 0.038634 | 1.006022 | [
"s567233143",
"s240572570"
] |
u888092736 | p02975 | python | s896938666 | s947599443 | 85 | 58 | 14,704 | 20,080 | Accepted | Accepted | 31.76 | from functools import reduce
from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
if N % 3 and a != [0] * N:
print("No")
exit()
nums = Counter(a)
ks = sorted(nums)
vs = sorted(nums.values())
if (
(len(nums) == 1 and ks[0] == 0)
or (len(nums) == 2 a... | N, *A = map(int, open(0).read().split())
A_set = set(A)
if len(A_set) == 1:
print("Yes") if sum(A) == 0 else print("No")
elif len(A_set) == 2:
a1, a2 = sorted(A_set)
print("Yes") if a1 == 0 and A.count(a1) * 3 == N else print("No")
elif len(A_set) == 3:
a1, a2, a3 = list(A_set)
if a1 ^ a2... | 25 | 16 | 527 | 456 | from functools import reduce
from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
if N % 3 and a != [0] * N:
print("No")
exit()
nums = Counter(a)
ks = sorted(nums)
vs = sorted(nums.values())
if (
(len(nums) == 1 and ks[0] == 0)
or (len(nums) == 2 and ks[0] == 0 and... | N, *A = map(int, open(0).read().split())
A_set = set(A)
if len(A_set) == 1:
print("Yes") if sum(A) == 0 else print("No")
elif len(A_set) == 2:
a1, a2 = sorted(A_set)
print("Yes") if a1 == 0 and A.count(a1) * 3 == N else print("No")
elif len(A_set) == 3:
a1, a2, a3 = list(A_set)
if a1 ^ a2 ^ a3 == 0 ... | false | 36 | [
"-from functools import reduce",
"-from collections import Counter",
"-",
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-if N % 3 and a != [0] * N:",
"- print(\"No\")",
"- exit()",
"-nums = Counter(a)",
"-ks = sorted(nums)",
"-vs = sorted(nums.values())",
"-if (",
... | false | 0.075864 | 0.111303 | 0.681601 | [
"s896938666",
"s947599443"
] |
u084320347 | p02836 | python | s384647470 | s784538897 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | S = eval(input())
count=0
for i in range(len(S)//2):
if S[i] != S[-i-1]:
count+=1
print(count) | s = eval(input())
n_s = s[::-1]
ans = 0
for i in range(len(s)//2):
if s[i] != n_s[i]:
ans += 1
print(ans)
| 8 | 8 | 104 | 120 | S = eval(input())
count = 0
for i in range(len(S) // 2):
if S[i] != S[-i - 1]:
count += 1
print(count)
| s = eval(input())
n_s = s[::-1]
ans = 0
for i in range(len(s) // 2):
if s[i] != n_s[i]:
ans += 1
print(ans)
| false | 0 | [
"-S = eval(input())",
"-count = 0",
"-for i in range(len(S) // 2):",
"- if S[i] != S[-i - 1]:",
"- count += 1",
"-print(count)",
"+s = eval(input())",
"+n_s = s[::-1]",
"+ans = 0",
"+for i in range(len(s) // 2):",
"+ if s[i] != n_s[i]:",
"+ ans += 1",
"+print(ans)"
] | false | 0.047598 | 0.050716 | 0.938516 | [
"s384647470",
"s784538897"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.