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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u775421443 | p03160 | python | s646649816 | s585693691 | 114 | 92 | 14,236 | 14,108 | Accepted | Accepted | 19.3 | n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
c = hs[i]
a, b = b, min(a + abs(c - hs[i-2]), b + abs(c - hs[i-1]))
print(b)
| def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
c = hs[i]
a, b = b, min(a + abs(c - hs[i-2]), b + abs(c - hs[i-1]))
print(b)
if __name__ == "__main__":
main() | 10 | 14 | 199 | 297 | n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
c = hs[i]
a, b = b, min(a + abs(c - hs[i - 2]), b + abs(c - hs[i - 1]))
print(b)
| def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
c = hs[i]
a, b = b, min(a + abs(c - hs[i - 2]), b + abs(c - hs[i - 1]))
print(b)
if __name__ == "__main__":
main()
| false | 28.571429 | [
"-n = int(eval(input()))",
"-hs = tuple(map(int, input().split()))",
"-a, b = 0, abs(hs[1] - hs[0])",
"-for i in range(2, n):",
"- c = hs[i]",
"- a, b = b, min(a + abs(c - hs[i - 2]), b + abs(c - hs[i - 1]))",
"-print(b)",
"+def main():",
"+ n = int(eval(input()))",
"+ hs = tuple(map(i... | false | 0.037641 | 0.043039 | 0.874567 | [
"s646649816",
"s585693691"
] |
u047034794 | p04006 | python | s469308700 | s167143295 | 1,844 | 1,467 | 3,188 | 3,316 | Accepted | Accepted | 20.44 | def mygets():
return list(map(int, input().strip().split(' ')))
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
def f(k, u):
j = k - 1
if j < 0:
j = n - 1
w = b1[j]
if u < w:
return u
return w
for i in range(1, n):
b2 = [f(k, u) for k, u in enumerate... | def mygets():
return [int(v) for v in input().strip().split(' ')]
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
for i in range(1, n):
b2 = [u if u < b1[k - 1] else b1[k - 1] for k, u in enumerate(a)]
ans = min(ans, sum(b2) + i * x)
b1 = b2
print(ans) | 25 | 16 | 388 | 289 | def mygets():
return list(map(int, input().strip().split(" ")))
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
def f(k, u):
j = k - 1
if j < 0:
j = n - 1
w = b1[j]
if u < w:
return u
return w
for i in range(1, n):
b2 = [f(k, u) for k, u in enumerate(a)]
ans = min(... | def mygets():
return [int(v) for v in input().strip().split(" ")]
n, x = mygets()
a = mygets()
b1 = a
ans = sum(a)
for i in range(1, n):
b2 = [u if u < b1[k - 1] else b1[k - 1] for k, u in enumerate(a)]
ans = min(ans, sum(b2) + i * x)
b1 = b2
print(ans)
| false | 36 | [
"- return list(map(int, input().strip().split(\" \")))",
"+ return [int(v) for v in input().strip().split(\" \")]",
"-",
"-",
"-def f(k, u):",
"- j = k - 1",
"- if j < 0:",
"- j = n - 1",
"- w = b1[j]",
"- if u < w:",
"- return u",
"- return w",
"-",
"-",... | false | 0.037498 | 0.044765 | 0.83765 | [
"s469308700",
"s167143295"
] |
u022979415 | p02803 | python | s217016350 | s917932162 | 951 | 664 | 3,444 | 3,436 | Accepted | Accepted | 30.18 | from copy import deepcopy
def solve(maze, i, j, h, w, count):
distance = 0
if maze[i][j] == ".":
distance = 0
next_search = [(i, j)]
while not next_search == []:
now = next_search.pop(0)
if maze[now[0]][now[1]] == ".":
maze[now[0]][now... | from collections import deque
from copy import deepcopy
def main():
h, w = list(map(int, input().split()))
grid = [list(eval(input())) for _ in range(h)]
ans = 0
d = [[0, 1], [1, 0], [0, -1], [-1, 0]]
for i in range(h):
for j in range(w):
if grid[i][j] == "#":
... | 40 | 36 | 1,387 | 1,212 | from copy import deepcopy
def solve(maze, i, j, h, w, count):
distance = 0
if maze[i][j] == ".":
distance = 0
next_search = [(i, j)]
while not next_search == []:
now = next_search.pop(0)
if maze[now[0]][now[1]] == ".":
maze[now[0]][now[1]] = "#"
... | from collections import deque
from copy import deepcopy
def main():
h, w = list(map(int, input().split()))
grid = [list(eval(input())) for _ in range(h)]
ans = 0
d = [[0, 1], [1, 0], [0, -1], [-1, 0]]
for i in range(h):
for j in range(w):
if grid[i][j] == "#":
c... | false | 10 | [
"+from collections import deque",
"-def solve(maze, i, j, h, w, count):",
"- distance = 0",
"- if maze[i][j] == \".\":",
"- distance = 0",
"- next_search = [(i, j)]",
"- while not next_search == []:",
"- now = next_search.pop(0)",
"- if maze[now[0]][n... | false | 0.087007 | 0.039489 | 2.203297 | [
"s217016350",
"s917932162"
] |
u285891772 | p02910 | python | s356524406 | s908700915 | 54 | 38 | 5,656 | 5,200 | Accepted | Accepted | 29.63 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | 39 | 35 | 1,056 | 988 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | false | 10.25641 | [
"-if N % 2 == 1:",
"- if S[N - 1] == \"L\":",
"- print(\"No\")",
"- exit()"
] | false | 0.037937 | 0.037225 | 1.019111 | [
"s356524406",
"s908700915"
] |
u347640436 | p02607 | python | s724576702 | s197838510 | 29 | 26 | 9,100 | 8,876 | Accepted | Accepted | 10.34 | N = int(eval(input()))
a = list(map(int, input().split()))
result = 0
for i in range(N):
if (i + 1) % 2 == 1 and a[i] % 2 == 1:
result += 1
print(result)
| N, *a = list(map(int, open(0).read().split()))
print((sum(1 for e in a[::2] if e % 2 == 1)))
| 8 | 3 | 168 | 88 | N = int(eval(input()))
a = list(map(int, input().split()))
result = 0
for i in range(N):
if (i + 1) % 2 == 1 and a[i] % 2 == 1:
result += 1
print(result)
| N, *a = list(map(int, open(0).read().split()))
print((sum(1 for e in a[::2] if e % 2 == 1)))
| false | 62.5 | [
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-result = 0",
"-for i in range(N):",
"- if (i + 1) % 2 == 1 and a[i] % 2 == 1:",
"- result += 1",
"-print(result)",
"+N, *a = list(map(int, open(0).read().split()))",
"+print((sum(1 for e in a[::2] if e % 2 == 1)))"
] | false | 0.039153 | 0.040067 | 0.977207 | [
"s724576702",
"s197838510"
] |
u130900604 | p02678 | python | s235616395 | s588805951 | 525 | 404 | 100,628 | 95,688 | Accepted | Accepted | 23.05 | def LI():return list(map(int,input().split()))
def yes():print("Yes")
def no():print("No")
from collections import deque
def main():
n,m=LI()
edge=[[]for i in range(n)]
for i in range(m):
a,b=LI()
edge[a-1]+=b-1,
edge[b-1]+=a-1,
dq=deque([0])
ans=[-1]*n
while dq:
g=dq.pople... | from collections import deque
def main():
n,m=list(map(int,input().split()))
e=[[] for _ in range(n)]
for _ in range(m):
a,b=list(map(int,input().split()))
a-=1
b-=1
e[a].append(b)
e[b].append(a)
ans=[-1]*n
dq=deque([0])
while dq:
g=dq.popleft()
for v in e[g]:
... | 23 | 21 | 451 | 408 | def LI():
return list(map(int, input().split()))
def yes():
print("Yes")
def no():
print("No")
from collections import deque
def main():
n, m = LI()
edge = [[] for i in range(n)]
for i in range(m):
a, b = LI()
edge[a - 1] += (b - 1,)
edge[b - 1] += (a - 1,)
dq... | from collections import deque
def main():
n, m = list(map(int, input().split()))
e = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
e[a].append(b)
e[b].append(a)
ans = [-1] * n
dq = deque([0])
while dq:
... | false | 8.695652 | [
"-def LI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def yes():",
"- print(\"Yes\")",
"-",
"-",
"-def no():",
"- print(\"No\")",
"-",
"-",
"- n, m = LI()",
"- edge = [[] for i in range(n)]",
"- for i in range(m):",
"- a, b = LI()",
"- ... | false | 0.044144 | 0.039251 | 1.124635 | [
"s235616395",
"s588805951"
] |
u923668099 | p02241 | python | s992055592 | s787999177 | 30 | 20 | 7,872 | 7,804 | Accepted | Accepted | 33.33 | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def solve():
inf = float('inf')
n = int(input())
a = []
for i in range(n):
line = [int(i) for i... | import sys
inf = float('inf')
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def prim(n, As):
checked = [False] * n
d = [inf] * n
checked[0] = True
d[0] = 0
... | 50 | 51 | 1,006 | 1,022 | import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print("DEBUG:{} -> {}".format(name, val), file=sys.stderr)
return None
def solve():
inf = float("inf")
n = int(input())
a = []
for i in range(n):
line = [int(i) for i in input().s... | import sys
inf = float("inf")
def debug(x, table):
for name, val in table.items():
if x is val:
print("DEBUG:{} -> {}".format(name, val), file=sys.stderr)
return None
def prim(n, As):
checked = [False] * n
d = [inf] * n
checked[0] = True
d[0] = 0
nxt = 0
... | false | 1.960784 | [
"+",
"+inf = float(\"inf\")",
"-def solve():",
"- inf = float(\"inf\")",
"- n = int(input())",
"- a = []",
"- for i in range(n):",
"- line = [int(i) for i in input().split()]",
"- line = [i if i != -1 else inf for i in line]",
"- a.append(line)",
"+def prim(n, As... | false | 0.081242 | 0.062463 | 1.300656 | [
"s992055592",
"s787999177"
] |
u089230684 | p02772 | python | s317199207 | s441912689 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | n = int(eval(input()))
A = list(map(int, input().split()))
ret = 'APPROVED'
for a in A:
if a % 2 == 1:
continue
if a % 3 == 0 or a % 5 == 0:
continue
ret = 'DENIED'
break
print(ret)
| n = int (eval(input ()))
a = list (map (int, input ().split ()))
flag = True
for k in a:
if (k & 1 == 0 and k % 3 != 0 and k % 5 != 0):
flag = False
print(("APPROVED" if flag else "DENIED")) | 11 | 8 | 202 | 203 | n = int(eval(input()))
A = list(map(int, input().split()))
ret = "APPROVED"
for a in A:
if a % 2 == 1:
continue
if a % 3 == 0 or a % 5 == 0:
continue
ret = "DENIED"
break
print(ret)
| n = int(eval(input()))
a = list(map(int, input().split()))
flag = True
for k in a:
if k & 1 == 0 and k % 3 != 0 and k % 5 != 0:
flag = False
print(("APPROVED" if flag else "DENIED"))
| false | 27.272727 | [
"-A = list(map(int, input().split()))",
"-ret = \"APPROVED\"",
"-for a in A:",
"- if a % 2 == 1:",
"- continue",
"- if a % 3 == 0 or a % 5 == 0:",
"- continue",
"- ret = \"DENIED\"",
"- break",
"-print(ret)",
"+a = list(map(int, input().split()))",
"+flag = True",
"... | false | 0.04392 | 0.037426 | 1.17352 | [
"s317199207",
"s441912689"
] |
u654470292 | p02767 | python | s094516202 | s217087928 | 290 | 77 | 65,644 | 70,656 | Accepted | Accepted | 73.45 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
n=int(eval(input... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 22 | 25 | 489 | 636 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations, accumulate, combinations, product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
mod = pow(10, 9) + 7
n = int(eval(i... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 12 | [
"-import sys",
"+import bisect, copy, heapq, math, sys",
"-import heapq",
"-import math",
"-import bisect",
"-from itertools import permutations, accumulate, combinations, product",
"-from fractions import gcd",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, pe... | false | 0.060884 | 0.037242 | 1.634805 | [
"s094516202",
"s217087928"
] |
u747515887 | p02952 | python | s143133313 | s825276696 | 52 | 37 | 2,940 | 2,940 | Accepted | Accepted | 28.85 | def main():
n = int(eval(input()))
c = 0
for i in range(n + 1)[1:]:
if len(str(i)) % 2 == 1:
c += 1
print(c)
if __name__ == '__main__':
main()
| def main():
n = int(eval(input()))
c = 0
for i in range(n + 1)[1:]:
if (1 <= i and i <= 9) or (100 <= i and i <= 999) or (10000 <= i and i <= 99999):
c += 1
print(c)
if __name__ == '__main__':
main()
| 13 | 13 | 193 | 250 | def main():
n = int(eval(input()))
c = 0
for i in range(n + 1)[1:]:
if len(str(i)) % 2 == 1:
c += 1
print(c)
if __name__ == "__main__":
main()
| def main():
n = int(eval(input()))
c = 0
for i in range(n + 1)[1:]:
if (
(1 <= i and i <= 9)
or (100 <= i and i <= 999)
or (10000 <= i and i <= 99999)
):
c += 1
print(c)
if __name__ == "__main__":
main()
| false | 0 | [
"- if len(str(i)) % 2 == 1:",
"+ if (",
"+ (1 <= i and i <= 9)",
"+ or (100 <= i and i <= 999)",
"+ or (10000 <= i and i <= 99999)",
"+ ):"
] | false | 0.053676 | 0.050918 | 1.05417 | [
"s143133313",
"s825276696"
] |
u227550284 | p02700 | python | s757487105 | s106266077 | 22 | 20 | 9,176 | 9,068 | Accepted | Accepted | 9.09 | import sys
input = sys.stdin.readline
def main():
a, b, c, d = list(map(int, input().split()))
flg = False
while a > 0 and b > 0:
c -= b
if c > 0:
a -= d
else:
flg = True
break
if flg == False:
print('No')
el... |
a, b, c, d = list(map(int, input().split()))
x = (a+d-1)//d
y = (c+b-1)//b
print(('Yes' if x >= y else 'No'))
| 26 | 7 | 386 | 111 | import sys
input = sys.stdin.readline
def main():
a, b, c, d = list(map(int, input().split()))
flg = False
while a > 0 and b > 0:
c -= b
if c > 0:
a -= d
else:
flg = True
break
if flg == False:
print("No")
else:
print("Ye... | a, b, c, d = list(map(int, input().split()))
x = (a + d - 1) // d
y = (c + b - 1) // b
print(("Yes" if x >= y else "No"))
| false | 73.076923 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"-def main():",
"- a, b, c, d = list(map(int, input().split()))",
"- flg = False",
"- while a > 0 and b > 0:",
"- c -= b",
"- if c > 0:",
"- a -= d",
"- else:",
"- flg = True",
... | false | 0.16412 | 0.045525 | 3.605087 | [
"s757487105",
"s106266077"
] |
u281303342 | p03380 | python | s369461771 | s961854743 | 92 | 77 | 14,428 | 14,060 | Accepted | Accepted | 16.3 | N = int(eval(input()))
A = list(map(int,input().split()))
maxA = max(A)
half = maxA/2
t = 10000000000
for i in range(N):
if A[i] != maxA and abs(A[i]-half) < abs(t-half):
t = A[i]
print((maxA,t)) | N = int(eval(input()))
A = list(map(int,input().split()))
maxA = max(A)
half = maxA/2
diff = 10**10
ans = 0
for i in range(N):
if A[i] != maxA and abs(A[i]-half) < diff:
diff = abs(A[i]-half)
ans = A[i]
print((maxA, ans)) | 9 | 13 | 207 | 247 | N = int(eval(input()))
A = list(map(int, input().split()))
maxA = max(A)
half = maxA / 2
t = 10000000000
for i in range(N):
if A[i] != maxA and abs(A[i] - half) < abs(t - half):
t = A[i]
print((maxA, t))
| N = int(eval(input()))
A = list(map(int, input().split()))
maxA = max(A)
half = maxA / 2
diff = 10**10
ans = 0
for i in range(N):
if A[i] != maxA and abs(A[i] - half) < diff:
diff = abs(A[i] - half)
ans = A[i]
print((maxA, ans))
| false | 30.769231 | [
"-t = 10000000000",
"+diff = 10**10",
"+ans = 0",
"- if A[i] != maxA and abs(A[i] - half) < abs(t - half):",
"- t = A[i]",
"-print((maxA, t))",
"+ if A[i] != maxA and abs(A[i] - half) < diff:",
"+ diff = abs(A[i] - half)",
"+ ans = A[i]",
"+print((maxA, ans))"
] | false | 0.042985 | 0.106392 | 0.404024 | [
"s369461771",
"s961854743"
] |
u781262926 | p03645 | python | s873672499 | s946589451 | 664 | 169 | 37,168 | 56,536 | Accepted | Accepted | 74.55 | n, m = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(m)]
C, D = set(), set()
for a, b in AB:
if a == 1:
C.add(b)
elif b == n:
D.add(a)
if len(C & D):
print('POSSIBLE')
else:
print('IMPOSSIBLE') | n, m, *AB = list(map(int, open(0).read().split()))
C, D = set(), set()
for a, b in zip(AB[::2], AB[1::2]):
if a == 1:
C.add(b)
if b == n:
D.add(a)
if len(C & D):
print('POSSIBLE')
else:
print('IMPOSSIBLE') | 14 | 13 | 258 | 229 | n, m = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(m)]
C, D = set(), set()
for a, b in AB:
if a == 1:
C.add(b)
elif b == n:
D.add(a)
if len(C & D):
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| n, m, *AB = list(map(int, open(0).read().split()))
C, D = set(), set()
for a, b in zip(AB[::2], AB[1::2]):
if a == 1:
C.add(b)
if b == n:
D.add(a)
if len(C & D):
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 7.142857 | [
"-n, m = list(map(int, input().split()))",
"-AB = [tuple(map(int, input().split())) for _ in range(m)]",
"+n, m, *AB = list(map(int, open(0).read().split()))",
"-for a, b in AB:",
"+for a, b in zip(AB[::2], AB[1::2]):",
"- elif b == n:",
"+ if b == n:"
] | false | 0.039699 | 0.040105 | 0.989878 | [
"s873672499",
"s946589451"
] |
u459689470 | p03087 | python | s439884076 | s965191711 | 934 | 500 | 7,748 | 15,788 | Accepted | Accepted | 46.47 | n, q = (int(x) for x in input().split())
s = eval(input())
t = [0]*(n+1)
for i in range(n):
t[i+1] = t[i] + (1 if s[i : i + 2] == 'AC' else 0)
for i in range(q):
l,r = (int(x) for x in input().split())
print((t[r-1]-t[l-1])) | n, q = (int(x) for x in input().split())
s = (eval(input()))
l = [0]*q
r = [0]*q
t = [0]*n
for i in range(q):
l[i], r[i] = (int(x) for x in input().split())
for i in range(n-1):
t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)
for i in range(q):
print((t[r[i]-1] - t[l[i]-1])) | 8 | 13 | 229 | 292 | n, q = (int(x) for x in input().split())
s = eval(input())
t = [0] * (n + 1)
for i in range(n):
t[i + 1] = t[i] + (1 if s[i : i + 2] == "AC" else 0)
for i in range(q):
l, r = (int(x) for x in input().split())
print((t[r - 1] - t[l - 1]))
| n, q = (int(x) for x in input().split())
s = eval(input())
l = [0] * q
r = [0] * q
t = [0] * n
for i in range(q):
l[i], r[i] = (int(x) for x in input().split())
for i in range(n - 1):
t[i + 1] = t[i] + (1 if s[i : i + 2] == "AC" else 0)
for i in range(q):
print((t[r[i] - 1] - t[l[i] - 1]))
| false | 38.461538 | [
"-t = [0] * (n + 1)",
"-for i in range(n):",
"+l = [0] * q",
"+r = [0] * q",
"+t = [0] * n",
"+for i in range(q):",
"+ l[i], r[i] = (int(x) for x in input().split())",
"+for i in range(n - 1):",
"- l, r = (int(x) for x in input().split())",
"- print((t[r - 1] - t[l - 1]))",
"+ print(... | false | 0.087305 | 0.075729 | 1.152862 | [
"s439884076",
"s965191711"
] |
u595375942 | p03160 | python | s690343811 | s594566877 | 136 | 124 | 13,924 | 13,900 | Accepted | Accepted | 8.82 | n=int(eval(input()))
H=list(map(int,input().split()))
dp=[10**9]*n
dp[0]=0
dp[1]=abs(H[1]-H[0])
for i in range(2,n):
step1=dp[i-1]+abs(H[i]-H[i-1])
step2=dp[i-2]+abs(H[i]-H[i-2])
dp[i]=min(step1,step2)
print((dp[-1])) | N = int(eval(input()))
H = list(map(int, input().split()))
DP = [0]*N
DP[1] = abs(H[1]-H[0])
for i in range(2, N):
two = abs(H[i]-H[i-2])
one = abs(H[i]-H[i-1])
if DP[i-2]+two <= DP[i-1]+one:
DP[i] = DP[i-2]+two
else:
DP[i] = DP[i-1]+one
print((DP[-1])) | 10 | 15 | 230 | 294 | n = int(eval(input()))
H = list(map(int, input().split()))
dp = [10**9] * n
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(2, n):
step1 = dp[i - 1] + abs(H[i] - H[i - 1])
step2 = dp[i - 2] + abs(H[i] - H[i - 2])
dp[i] = min(step1, step2)
print((dp[-1]))
| N = int(eval(input()))
H = list(map(int, input().split()))
DP = [0] * N
DP[1] = abs(H[1] - H[0])
for i in range(2, N):
two = abs(H[i] - H[i - 2])
one = abs(H[i] - H[i - 1])
if DP[i - 2] + two <= DP[i - 1] + one:
DP[i] = DP[i - 2] + two
else:
DP[i] = DP[i - 1] + one
print((DP[-1]))
| false | 33.333333 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-dp = [10**9] * n",
"-dp[0] = 0",
"-dp[1] = abs(H[1] - H[0])",
"-for i in range(2, n):",
"- step1 = dp[i - 1] + abs(H[i] - H[i - 1])",
"- step2 = dp[i - 2] + abs(H[i] - H[i - 2])",
"- dp[i] = min(step1, step2)",
"-print((dp[-1]))",
... | false | 0.082922 | 0.089197 | 0.929647 | [
"s690343811",
"s594566877"
] |
u508486691 | p02821 | python | s568343837 | s375796945 | 993 | 646 | 55,528 | 35,928 | Accepted | Accepted | 34.94 | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(eval(input()))
def II(): return list(map(int, input().split()))
def III(): return list(map(int, input().split()))
def Line(N,num):... | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(eval(input()))
def II(): return list(map(int, input().split()))
def III(): return list(map(int, input().split()))
def Line(N,num):... | 56 | 54 | 1,232 | 1,209 | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I():
return int(eval(input()))
def II():
return list(map(int, input().split()))
def III():
return list(map(int, input().split()))
def Lin... | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I():
return int(eval(input()))
def II():
return list(map(int, input().split()))
def III():
return list(map(int, input().split()))
def Lin... | false | 3.571429 | [
"-# a = np.array([a1,a2,a3]), b= np.array([b1,b2,b3])",
"-# c = np.array([a1b1,a1b2+a2b1,a1a3+a2b2+a3b1,a2b3+a3b2,a3b3])",
"+# a = [a1,a2,a3], b= [b1,b2,b3]",
"+# return np.array([a1b1,a1b2+a2b1,a1a3+a2b2+a3b1,a2b3+a3b2,a3b3])",
"-def FFT(a, b):",
"- bit = (len(a) + len(b)).bit_length() + 1",
"+def C... | false | 0.792035 | 0.27678 | 2.861602 | [
"s568343837",
"s375796945"
] |
u903005414 | p02555 | python | s628376238 | s369604282 | 31 | 28 | 9,148 | 9,160 | Accepted | Accepted | 9.68 | S = int(eval(input()))
if S == 1:
print((0))
exit()
MOD = 10**9 + 7
A = [0] * (S + 1)
A[0] = 1
A[1] = 0
A[2] = 0
cumsum = 1
for i in range(3, len(A)):
A[i] = cumsum
cumsum += A[i - 2]
cumsum %= MOD
print((A[-1]))
| S = int(eval(input()))
if S == 1:
print((0))
exit()
MOD = 10**9 + 7
A = [0] * (S + 1)
A[0] = 1
A[1] = 0
A[2] = 0
cumsum = 1
for i in range(3, len(A)):
A[i] = (A[i - 1] + A[i - 3]) % MOD
print((A[-1]))
| 16 | 14 | 239 | 217 | S = int(eval(input()))
if S == 1:
print((0))
exit()
MOD = 10**9 + 7
A = [0] * (S + 1)
A[0] = 1
A[1] = 0
A[2] = 0
cumsum = 1
for i in range(3, len(A)):
A[i] = cumsum
cumsum += A[i - 2]
cumsum %= MOD
print((A[-1]))
| S = int(eval(input()))
if S == 1:
print((0))
exit()
MOD = 10**9 + 7
A = [0] * (S + 1)
A[0] = 1
A[1] = 0
A[2] = 0
cumsum = 1
for i in range(3, len(A)):
A[i] = (A[i - 1] + A[i - 3]) % MOD
print((A[-1]))
| false | 12.5 | [
"- A[i] = cumsum",
"- cumsum += A[i - 2]",
"- cumsum %= MOD",
"+ A[i] = (A[i - 1] + A[i - 3]) % MOD"
] | false | 0.046772 | 0.04896 | 0.955303 | [
"s628376238",
"s369604282"
] |
u553987207 | p02861 | python | s378058033 | s661603354 | 381 | 209 | 12,080 | 10,664 | Accepted | Accepted | 45.14 | from itertools import permutations
from math import sqrt, fsum
N = int(eval(input()))
towns = [tuple(map(int, input().split())) for _ in range(N)]
ds = []
n = 0
for rt in permutations(towns, N):
for i in range(1, N):
x1, y1 = rt[i-1]
x2, y2 = rt[i]
d = sqrt((x1 - x2) ** 2 + (y1 -... | import math
N = int(eval(input()))
P = [tuple(map(int, input().split())) for _ in range(N)]
DONE = (1 << N) - 1
ds = []
todo = [(0, i, (1 << i)) for i in range(N)]
while todo:
d, i, state = todo.pop()
x, y = P[i]
for ni in range(N):
if state & (1 << ni):
continue
nx... | 16 | 22 | 390 | 577 | from itertools import permutations
from math import sqrt, fsum
N = int(eval(input()))
towns = [tuple(map(int, input().split())) for _ in range(N)]
ds = []
n = 0
for rt in permutations(towns, N):
for i in range(1, N):
x1, y1 = rt[i - 1]
x2, y2 = rt[i]
d = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2... | import math
N = int(eval(input()))
P = [tuple(map(int, input().split())) for _ in range(N)]
DONE = (1 << N) - 1
ds = []
todo = [(0, i, (1 << i)) for i in range(N)]
while todo:
d, i, state = todo.pop()
x, y = P[i]
for ni in range(N):
if state & (1 << ni):
continue
nx, ny = P[ni]
... | false | 27.272727 | [
"-from itertools import permutations",
"-from math import sqrt, fsum",
"+import math",
"-towns = [tuple(map(int, input().split())) for _ in range(N)]",
"+P = [tuple(map(int, input().split())) for _ in range(N)]",
"+DONE = (1 << N) - 1",
"-n = 0",
"-for rt in permutations(towns, N):",
"- for i in ... | false | 0.062996 | 0.039618 | 1.59011 | [
"s378058033",
"s661603354"
] |
u028973125 | p02579 | python | s748846312 | s397305065 | 1,506 | 970 | 222,784 | 138,528 | Accepted | Accepted | 35.59 | import sys
from collections import deque
H, W = list(map(int, sys.stdin.readline().split()))
cy, cx = list(map(int, sys.stdin.readline().split()))
gy, gx = list(map(int, sys.stdin.readline().split()))
cy -= 1
cx -= 1
gy -= 1
gx -= 1
grid = []
for _ in range(H):
grid.append(sys.stdin.readline().stri... | import sys
from collections import deque
H, W = list(map(int, sys.stdin.readline().split()))
cy, cx = list(map(int, sys.stdin.readline().split()))
gy, gx = list(map(int, sys.stdin.readline().split()))
cy -= 1
cx -= 1
gy -= 1
gx -= 1
grid = []
for _ in range(H):
grid.append(sys.stdin.readline().stri... | 68 | 77 | 2,070 | 2,399 | import sys
from collections import deque
H, W = list(map(int, sys.stdin.readline().split()))
cy, cx = list(map(int, sys.stdin.readline().split()))
gy, gx = list(map(int, sys.stdin.readline().split()))
cy -= 1
cx -= 1
gy -= 1
gx -= 1
grid = []
for _ in range(H):
grid.append(sys.stdin.readline().strip())
q = deque()... | import sys
from collections import deque
H, W = list(map(int, sys.stdin.readline().split()))
cy, cx = list(map(int, sys.stdin.readline().split()))
gy, gx = list(map(int, sys.stdin.readline().split()))
cy -= 1
cx -= 1
gy -= 1
gx -= 1
grid = []
for _ in range(H):
grid.append(sys.stdin.readline().strip())
q = deque()... | false | 11.688312 | [
"+q2 = set()",
"- x, y, c = q.popleft()",
"- # if (x, y) in visited and visited[(x, y)] < c:",
"- if visited[y][x] < c:",
"- # print(\"here1\")",
"- continue",
"- # print(x, y, c, d, e)",
"- for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):",
"- nx = x + dx",
"-... | false | 0.037323 | 0.007116 | 5.24465 | [
"s748846312",
"s397305065"
] |
u647087591 | p02683 | python | s534887638 | s802346640 | 140 | 96 | 73,748 | 74,264 | Accepted | Accepted | 31.43 | n, m, x = list(map(int, input().split()))
cl = []
al = []
for _ in range(n):
c, *a = list(map(int, input().split()))
cl.append(c)
al.append(a)
ans = float('inf')
for i in range(2 ** n):
sum = 0
l = [0] * m
flg = False
for j in range(n):
if i >> j & 1:
... | n, m, x = list(map(int, input().split()))
cl = []
al = []
for _ in range(n):
c, *a = list(map(int, input().split()))
cl.append(c)
al.append(a)
ans = float('inf')
for i in range(2 ** n):
sum = 0
l = [0] * m
for j in range(n):
if i >> j & 1:
sum += cl[j]
... | 30 | 26 | 560 | 496 | n, m, x = list(map(int, input().split()))
cl = []
al = []
for _ in range(n):
c, *a = list(map(int, input().split()))
cl.append(c)
al.append(a)
ans = float("inf")
for i in range(2**n):
sum = 0
l = [0] * m
flg = False
for j in range(n):
if i >> j & 1:
sum += cl[j]
... | n, m, x = list(map(int, input().split()))
cl = []
al = []
for _ in range(n):
c, *a = list(map(int, input().split()))
cl.append(c)
al.append(a)
ans = float("inf")
for i in range(2**n):
sum = 0
l = [0] * m
for j in range(n):
if i >> j & 1:
sum += cl[j]
for k in rang... | false | 13.333333 | [
"- flg = False",
"- for e in l:",
"- if e < x:",
"- flg = True",
"- break",
"- if not flg:",
"+ flg = all([e >= x for e in l])",
"+ if flg:"
] | false | 0.110574 | 0.095983 | 1.152023 | [
"s534887638",
"s802346640"
] |
u063052907 | p02971 | python | s360431752 | s216875946 | 526 | 295 | 14,112 | 14,112 | Accepted | Accepted | 43.92 | N = int(eval(input()))
lst_A = [int(eval(input())) for _ in range(N)]
srt_A = sorted(lst_A, reverse=True)
m1 = srt_A[0]
m2 = srt_A[1]
for v in lst_A:
print((m2 if v == m1 else m1)) | import sys
input = sys.stdin.readline
N = int(eval(input()))
lst_A = [int(eval(input())) for _ in range(N)]
srt_A = sorted(lst_A, reverse=True)
m1 = srt_A[0]
m2 = srt_A[1]
for v in lst_A:
print((m2 if v == m1 else m1)) | 9 | 13 | 180 | 224 | N = int(eval(input()))
lst_A = [int(eval(input())) for _ in range(N)]
srt_A = sorted(lst_A, reverse=True)
m1 = srt_A[0]
m2 = srt_A[1]
for v in lst_A:
print((m2 if v == m1 else m1))
| import sys
input = sys.stdin.readline
N = int(eval(input()))
lst_A = [int(eval(input())) for _ in range(N)]
srt_A = sorted(lst_A, reverse=True)
m1 = srt_A[0]
m2 = srt_A[1]
for v in lst_A:
print((m2 if v == m1 else m1))
| false | 30.769231 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.034577 | 0.043635 | 0.79241 | [
"s360431752",
"s216875946"
] |
u969850098 | p03073 | python | s965107188 | s643852514 | 65 | 50 | 4,652 | 4,652 | Accepted | Accepted | 23.08 | S = list(map(int, list(eval(input()))))
colors = [0, 1]
cnt_b, cnt_w = 0, 0
b_list = [colors[i % 2] for i in range(len(S))]
for i in range(len(S)):
if S[i] == b_list[i]:
cnt_w += 1
else:
cnt_b += 1
print((min([cnt_w, cnt_b]))) | def main():
S = list(map(int, list(eval(input()))))
cnt1, cnt2 = 0, 0
for i, s in enumerate(S):
if i % 2 == 0:
if s:
cnt1 += 1
else:
cnt2 += 1
else:
if s:
cnt2 += 1
else:
... | 12 | 19 | 263 | 399 | S = list(map(int, list(eval(input()))))
colors = [0, 1]
cnt_b, cnt_w = 0, 0
b_list = [colors[i % 2] for i in range(len(S))]
for i in range(len(S)):
if S[i] == b_list[i]:
cnt_w += 1
else:
cnt_b += 1
print((min([cnt_w, cnt_b])))
| def main():
S = list(map(int, list(eval(input()))))
cnt1, cnt2 = 0, 0
for i, s in enumerate(S):
if i % 2 == 0:
if s:
cnt1 += 1
else:
cnt2 += 1
else:
if s:
cnt2 += 1
else:
cnt1 += 1... | false | 36.842105 | [
"-S = list(map(int, list(eval(input()))))",
"-colors = [0, 1]",
"-cnt_b, cnt_w = 0, 0",
"-b_list = [colors[i % 2] for i in range(len(S))]",
"-for i in range(len(S)):",
"- if S[i] == b_list[i]:",
"- cnt_w += 1",
"- else:",
"- cnt_b += 1",
"-print((min([cnt_w, cnt_b])))",
"+def... | false | 0.087602 | 0.104125 | 0.841321 | [
"s965107188",
"s643852514"
] |
u678505520 | p02983 | python | s876777221 | s267244047 | 158 | 68 | 65,192 | 65,256 | Accepted | Accepted | 56.96 | l,r=list(map(int,input().split()))
if r - l >= 2018:
print((0))
exit()
l %= 2019
r %= 2019
m=10000
for i in range(l,r):
for j in range(i+1,r+1):
m = min(m,(i*j)%2019)
print(m) | l,r=list(map(int,input().split()))
if r - l >= 2018:
print((0))
exit()
m=10000
for i in range(l,r):
for j in range(i+1,r+1):
m = min(m,(i*j)%2019)
print(m) | 13 | 11 | 201 | 179 | l, r = list(map(int, input().split()))
if r - l >= 2018:
print((0))
exit()
l %= 2019
r %= 2019
m = 10000
for i in range(l, r):
for j in range(i + 1, r + 1):
m = min(m, (i * j) % 2019)
print(m)
| l, r = list(map(int, input().split()))
if r - l >= 2018:
print((0))
exit()
m = 10000
for i in range(l, r):
for j in range(i + 1, r + 1):
m = min(m, (i * j) % 2019)
print(m)
| false | 15.384615 | [
"-l %= 2019",
"-r %= 2019"
] | false | 0.041605 | 0.048939 | 0.850146 | [
"s876777221",
"s267244047"
] |
u191874006 | p03273 | python | s532469562 | s306232098 | 261 | 175 | 44,780 | 39,408 | Accepted | Accepted | 32.95 | #!/usr/bin/env python3
#ABC107 B
h,w = list(map(int,input().split()))
a = [list(eval(input())) for _ in range(h)]
ans = [['.']*w for _ in range(h)]
for i in range(h):
for j in range(w):
if a[i][j] == '.':
for k in range(h):
if a[k][j] == '.':
con... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 33 | 46 | 892 | 1,109 | #!/usr/bin/env python3
# ABC107 B
h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
ans = [["."] * w for _ in range(h)]
for i in range(h):
for j in range(w):
if a[i][j] == ".":
for k in range(h):
if a[k][j] == ".":
continue
... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 28.26087 | [
"-# ABC107 B",
"-h, w = list(map(int, input().split()))",
"-a = [list(eval(input())) for _ in range(h)]",
"-ans = [[\".\"] * w for _ in range(h)]",
"+import sys",
"+import math",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"+",
"+sys.setrecursionlimit(2147483... | false | 0.036149 | 0.044925 | 0.804648 | [
"s532469562",
"s306232098"
] |
u634873566 | p02712 | python | s066253490 | s943569468 | 137 | 95 | 43,348 | 9,064 | Accepted | Accepted | 30.66 | print((sum(set(i for i in range(1,int(eval(input()))+1,1) if not(i%3==0 or i%5==0))))) | print((sum((i for i in range(int(eval(input()))+1) if i%3 and i%5)))) | 1 | 1 | 78 | 61 | print(
(
sum(
set(
i
for i in range(1, int(eval(input())) + 1, 1)
if not (i % 3 == 0 or i % 5 == 0)
)
)
)
)
| print((sum((i for i in range(int(eval(input())) + 1) if i % 3 and i % 5))))
| false | 0 | [
"-print(",
"- (",
"- sum(",
"- set(",
"- i",
"- for i in range(1, int(eval(input())) + 1, 1)",
"- if not (i % 3 == 0 or i % 5 == 0)",
"- )",
"- )",
"- )",
"-)",
"+print((sum((i for i in range(int(eval(input(... | false | 0.674321 | 0.316 | 2.133925 | [
"s066253490",
"s943569468"
] |
u215334265 | p02712 | python | s532080253 | s445627685 | 67 | 58 | 64,696 | 61,728 | Accepted | Accepted | 13.43 | n = int(eval(input()))
s3 = 0
s5 = 0
s15 = 0
count = 0
for i in range(int(n / 3)):
s3 += (i+1) * 3
for i in range(int(n / 5)):
s5 += (i + 1) * 5
for i in range(int(n / 15)):
s15 += (i + 1) * 15
for i in range(n):
count += (i+1)
print((count-s3-s5+s15)) | n = int(eval(input()))
Sum = 0.5 * n * (1 + n)
# n < 3やn < 5のときでもint(n/3) = int(n/5) = 0のため問題なし
Sum3_5 = 0.5*(int(n/3)*(3+3*int(n/3))+int(n/5)*(5 + 5*int(n/5)))
Sum15 = 0.5 * (int(n / 15) * (15 + int(n / 15) * 15))
# 問題の回答が整数値のため
print((int(Sum-Sum3_5+Sum15))) | 14 | 7 | 273 | 258 | n = int(eval(input()))
s3 = 0
s5 = 0
s15 = 0
count = 0
for i in range(int(n / 3)):
s3 += (i + 1) * 3
for i in range(int(n / 5)):
s5 += (i + 1) * 5
for i in range(int(n / 15)):
s15 += (i + 1) * 15
for i in range(n):
count += i + 1
print((count - s3 - s5 + s15))
| n = int(eval(input()))
Sum = 0.5 * n * (1 + n)
# n < 3やn < 5のときでもint(n/3) = int(n/5) = 0のため問題なし
Sum3_5 = 0.5 * (int(n / 3) * (3 + 3 * int(n / 3)) + int(n / 5) * (5 + 5 * int(n / 5)))
Sum15 = 0.5 * (int(n / 15) * (15 + int(n / 15) * 15))
# 問題の回答が整数値のため
print((int(Sum - Sum3_5 + Sum15)))
| false | 50 | [
"-s3 = 0",
"-s5 = 0",
"-s15 = 0",
"-count = 0",
"-for i in range(int(n / 3)):",
"- s3 += (i + 1) * 3",
"-for i in range(int(n / 5)):",
"- s5 += (i + 1) * 5",
"-for i in range(int(n / 15)):",
"- s15 += (i + 1) * 15",
"-for i in range(n):",
"- count += i + 1",
"-print((count - s3 -... | false | 0.444162 | 0.008118 | 54.712887 | [
"s532080253",
"s445627685"
] |
u138546245 | p02271 | python | s952341572 | s175132698 | 6,900 | 20 | 609,240 | 5,780 | Accepted | Accepted | 99.71 | class Tree:
class Node:
def __init__(self, n, left, right):
self.left = left
self.right = right
self.n = n
if left is not None:
lt = {t + n for t in left.totals}
else:
lt = set()
if right is not... | def create_sums(ns):
if len(ns) == 0:
return set()
s = create_sums(ns[1:])
return {e + ns[0] for e in s} | s | {ns[0]}
def run_set():
_ = int(eval(input())) # flake8: noqa
ns = [int(i) for i in input().split()]
sums = create_sums(ns)
_ = int(eval(input())) # flake8... | 65 | 26 | 1,570 | 506 | class Tree:
class Node:
def __init__(self, n, left, right):
self.left = left
self.right = right
self.n = n
if left is not None:
lt = {t + n for t in left.totals}
else:
lt = set()
if right is not None:
... | def create_sums(ns):
if len(ns) == 0:
return set()
s = create_sums(ns[1:])
return {e + ns[0] for e in s} | s | {ns[0]}
def run_set():
_ = int(eval(input())) # flake8: noqa
ns = [int(i) for i in input().split()]
sums = create_sums(ns)
_ = int(eval(input())) # flake8: noqa
for ... | false | 60 | [
"-class Tree:",
"- class Node:",
"- def __init__(self, n, left, right):",
"- self.left = left",
"- self.right = right",
"- self.n = n",
"- if left is not None:",
"- lt = {t + n for t in left.totals}",
"- else:",
"- ... | false | 0.051214 | 0.052059 | 0.98377 | [
"s952341572",
"s175132698"
] |
u208713671 | p02696 | python | s260519883 | s487642640 | 66 | 60 | 61,740 | 61,716 | Accepted | Accepted | 9.09 | [A,B,N] = list(map(int,input().split()))
X = N
Y = min(B-1,N)
out1 = int(A*X/B) - A*int(X/B)
out2 = int(A*Y/B) - A*int(Y/B)
print(out2)
| [A,B,N] = list(map(int,input().split()))
X = N
Y = min(B-1,N)
out1 = A*X//B - A*(X//B)
out2 = A*Y//B - A*(Y//B)
print((max(out1,out2))) | 8 | 8 | 145 | 144 | [A, B, N] = list(map(int, input().split()))
X = N
Y = min(B - 1, N)
out1 = int(A * X / B) - A * int(X / B)
out2 = int(A * Y / B) - A * int(Y / B)
print(out2)
| [A, B, N] = list(map(int, input().split()))
X = N
Y = min(B - 1, N)
out1 = A * X // B - A * (X // B)
out2 = A * Y // B - A * (Y // B)
print((max(out1, out2)))
| false | 0 | [
"-out1 = int(A * X / B) - A * int(X / B)",
"-out2 = int(A * Y / B) - A * int(Y / B)",
"-print(out2)",
"+out1 = A * X // B - A * (X // B)",
"+out2 = A * Y // B - A * (Y // B)",
"+print((max(out1, out2)))"
] | false | 0.035899 | 0.034802 | 1.031512 | [
"s260519883",
"s487642640"
] |
u970197315 | p03971 | python | s901196556 | s002333012 | 120 | 102 | 4,016 | 4,016 | Accepted | Accepted | 15 | n,a,b=list(map(int,input().split()))
s=eval(input())
yosen_ok=0
kaigai=0
for i,ss in enumerate(s):
if yosen_ok<a+b:
if ss=='a':
yosen_ok+=1
print('Yes')
elif ss=='b':
kaigai+=1
if kaigai<=b:
yosen_ok+=1
pr... | n,a,b=list(map(int,input().split()))
s=eval(input())
yosen=0
kaigai=0
for ss in s:
if ss=="a" and yosen<a+b:
yosen+=1
print('Yes')
elif ss=="b" and yosen<a+b:
if kaigai<b:
yosen+=1
kaigai+=1
print('Yes')
else:
print('No')
else:
print('No') | 22 | 17 | 457 | 293 | n, a, b = list(map(int, input().split()))
s = eval(input())
yosen_ok = 0
kaigai = 0
for i, ss in enumerate(s):
if yosen_ok < a + b:
if ss == "a":
yosen_ok += 1
print("Yes")
elif ss == "b":
kaigai += 1
if kaigai <= b:
yosen_ok += 1
... | n, a, b = list(map(int, input().split()))
s = eval(input())
yosen = 0
kaigai = 0
for ss in s:
if ss == "a" and yosen < a + b:
yosen += 1
print("Yes")
elif ss == "b" and yosen < a + b:
if kaigai < b:
yosen += 1
kaigai += 1
print("Yes")
else:
... | false | 22.727273 | [
"-yosen_ok = 0",
"+yosen = 0",
"-for i, ss in enumerate(s):",
"- if yosen_ok < a + b:",
"- if ss == \"a\":",
"- yosen_ok += 1",
"+for ss in s:",
"+ if ss == \"a\" and yosen < a + b:",
"+ yosen += 1",
"+ print(\"Yes\")",
"+ elif ss == \"b\" and yosen < a +... | false | 0.044058 | 0.042929 | 1.02629 | [
"s901196556",
"s002333012"
] |
u310245677 | p02570 | python | s897657210 | s850651451 | 33 | 27 | 9,156 | 8,992 | Accepted | Accepted | 18.18 | d,t,s=list(map(int,input().split()))
if d/s<=t:
print('Yes')
else:
print('No')
| #!/usr/bin/env python3
#誤差対策で掛け算にする
d,t,s=list(map(int,input().split()))
print(("Yes" if d<=t*s else "No"))
| 5 | 4 | 81 | 103 | d, t, s = list(map(int, input().split()))
if d / s <= t:
print("Yes")
else:
print("No")
| #!/usr/bin/env python3
# 誤差対策で掛け算にする
d, t, s = list(map(int, input().split()))
print(("Yes" if d <= t * s else "No"))
| false | 20 | [
"+#!/usr/bin/env python3",
"+# 誤差対策で掛け算にする",
"-if d / s <= t:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((\"Yes\" if d <= t * s else \"No\"))"
] | false | 0.044269 | 0.048104 | 0.920263 | [
"s897657210",
"s850651451"
] |
u268181283 | p02912 | python | s972542824 | s986521111 | 190 | 173 | 15,044 | 14,180 | Accepted | Accepted | 8.95 | import heapq
N,M = list(map(int,input().split()))
original_value = list(map(int,input().split()))
value = []
for v in original_value:
heapq.heappush(value,v*(-1))
for i in range(M):
num = (heapq.heappop(value)*(-1)//2)*(-1)
heapq.heappush(value,num)
print((sum(list([x*(-1) for x in value]))))
| import heapq
N,M = list(map(int,input().split()))
value = list(map(int,input().split()))
value = list([x*(-1) for x in value])
heapq.heapify(value)
for i in range(M):
num = (heapq.heappop(value)*(-1)//2)*(-1)
heapq.heappush(value,num)
print((sum(list([x*(-1) for x in value]))))
| 14 | 12 | 314 | 299 | import heapq
N, M = list(map(int, input().split()))
original_value = list(map(int, input().split()))
value = []
for v in original_value:
heapq.heappush(value, v * (-1))
for i in range(M):
num = (heapq.heappop(value) * (-1) // 2) * (-1)
heapq.heappush(value, num)
print((sum(list([x * (-1) for x in value])))... | import heapq
N, M = list(map(int, input().split()))
value = list(map(int, input().split()))
value = list([x * (-1) for x in value])
heapq.heapify(value)
for i in range(M):
num = (heapq.heappop(value) * (-1) // 2) * (-1)
heapq.heappush(value, num)
print((sum(list([x * (-1) for x in value]))))
| false | 14.285714 | [
"-original_value = list(map(int, input().split()))",
"-value = []",
"-for v in original_value:",
"- heapq.heappush(value, v * (-1))",
"+value = list(map(int, input().split()))",
"+value = list([x * (-1) for x in value])",
"+heapq.heapify(value)"
] | false | 0.048683 | 0.043021 | 1.131608 | [
"s972542824",
"s986521111"
] |
u833543158 | p03044 | python | s139993399 | s049449250 | 700 | 637 | 56,040 | 56,020 | Accepted | Accepted | 9 | N = int(eval(input()))
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1 for _ in range(N)]
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
if dist % ... | N = int(eval(input()))
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1] * N
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
if dist % 2 == 0:
... | 27 | 27 | 516 | 502 | N = int(eval(input()))
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1 for _ in range(N)]
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
if dist % 2 == 0:
ans... | N = int(eval(input()))
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1] * N
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
if dist % 2 == 0:
ans[v] = 0
el... | false | 0 | [
"-ans = [-1 for _ in range(N)]",
"+ans = [-1] * N"
] | false | 0.10501 | 0.042122 | 2.492994 | [
"s139993399",
"s049449250"
] |
u955125992 | p02659 | python | s648552515 | s666943276 | 28 | 25 | 10,048 | 9,968 | Accepted | Accepted | 10.71 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(Decimal(a*b)))) | from decimal import Decimal
a, b = list(map(str, input().split()))
print((int(Decimal(a)*Decimal(b)))) | 5 | 5 | 95 | 100 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(Decimal(a * b))))
| from decimal import Decimal
a, b = list(map(str, input().split()))
print((int(Decimal(a) * Decimal(b))))
| false | 0 | [
"-a, b = list(map(Decimal, input().split()))",
"-print((int(Decimal(a * b))))",
"+a, b = list(map(str, input().split()))",
"+print((int(Decimal(a) * Decimal(b))))"
] | false | 0.110232 | 0.080188 | 1.374667 | [
"s648552515",
"s666943276"
] |
u892251744 | p03044 | python | s077767577 | s266572390 | 1,265 | 1,022 | 59,668 | 59,668 | Accepted | Accepted | 19.21 | from collections import deque
N = int(eval(input()))
branch = [list(map(int, input().split())) for _ in range(N-1)]
adj = [[] for _ in range(N+1)]
for b in branch:
adj[b[0]].append([b[1],b[2]])
adj[b[1]].append([b[0],b[2]])
ans = [-1] * (N+1)
deq = deque()
deq.appendleft(1)
while len(deq) > 0:
v ... | from collections import deque
N = int(eval(input()))
branch = [list(map(int, input().split())) for _ in range(N-1)]
adj = [[] for _ in range(N+1)]
for b in branch:
adj[b[0]].append([b[1],b[2]])
adj[b[1]].append([b[0],b[2]])
ans = [-1] * (N+1)
deq = deque()
deq.appendleft(1)
while len(deq) > 0:
v ... | 37 | 40 | 774 | 809 | from collections import deque
N = int(eval(input()))
branch = [list(map(int, input().split())) for _ in range(N - 1)]
adj = [[] for _ in range(N + 1)]
for b in branch:
adj[b[0]].append([b[1], b[2]])
adj[b[1]].append([b[0], b[2]])
ans = [-1] * (N + 1)
deq = deque()
deq.appendleft(1)
while len(deq) > 0:
v = ... | from collections import deque
N = int(eval(input()))
branch = [list(map(int, input().split())) for _ in range(N - 1)]
adj = [[] for _ in range(N + 1)]
for b in branch:
adj[b[0]].append([b[1], b[2]])
adj[b[1]].append([b[0], b[2]])
ans = [-1] * (N + 1)
deq = deque()
deq.appendleft(1)
while len(deq) > 0:
v = ... | false | 7.5 | [
"-for i in range(1, N + 1):",
"- print((ans[i]))",
"+if N == 1:",
"+ print((0))",
"+else:",
"+ for i in range(1, N + 1):",
"+ print((ans[i]))"
] | false | 0.079305 | 0.041896 | 1.892923 | [
"s077767577",
"s266572390"
] |
u437638594 | p03289 | python | s147361674 | s045971910 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | S = list(eval(input()))
ans = "AC"
tmp = S[2:-1]
if S[0] != "A":
ans = "WA"
else:
S.remove("A")
count = 0
for item in tmp:
if item == "C":
count += 1
if count != 1:
ans = "WA"
elif count == 1:
S.remove("C")
if "".join(S).lower() != "".join(S):
ans = "WA"
print(ans) | S = eval(input())
ans = "AC"
tmp = S[2:-1]
if S[0] != "A":
ans = "WA"
else:
S = S.replace("A", "")
count = 0
for item in tmp:
if item == "C":
count += 1
if count != 1:
ans = "WA"
elif count == 1:
S = S.replace("C", "")
if not S.islower():
ans = "WA"
print(ans) | 25 | 24 | 312 | 305 | S = list(eval(input()))
ans = "AC"
tmp = S[2:-1]
if S[0] != "A":
ans = "WA"
else:
S.remove("A")
count = 0
for item in tmp:
if item == "C":
count += 1
if count != 1:
ans = "WA"
elif count == 1:
S.remove("C")
if "".join(S).lower() != "".join(S):
ans = "WA"
print(ans)
| S = eval(input())
ans = "AC"
tmp = S[2:-1]
if S[0] != "A":
ans = "WA"
else:
S = S.replace("A", "")
count = 0
for item in tmp:
if item == "C":
count += 1
if count != 1:
ans = "WA"
elif count == 1:
S = S.replace("C", "")
if not S.islower():
ans = "WA"
print(ans)
| false | 4 | [
"-S = list(eval(input()))",
"+S = eval(input())",
"- S.remove(\"A\")",
"+ S = S.replace(\"A\", \"\")",
"- S.remove(\"C\")",
"-if \"\".join(S).lower() != \"\".join(S):",
"+ S = S.replace(\"C\", \"\")",
"+if not S.islower():"
] | false | 0.049063 | 0.049773 | 0.985734 | [
"s147361674",
"s045971910"
] |
u197300260 | p03624 | python | s949679790 | s887455263 | 41 | 27 | 3,316 | 3,316 | Accepted | Accepted | 34.15 | # Problem: https://atcoder.jp/contests/abc071/tasks/abc071_b
# Python 2nd Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): return list(map(... | # Problem:
# Python 3rd Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_... | 29 | 38 | 970 | 1,124 | # Problem: https://atcoder.jp/contests/abc071/tasks/abc071_b
# Python 2nd Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return li... | # Problem:
# Python 3rd Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return list(map(int, sys.stdin.readline().split()))
def L... | false | 23.684211 | [
"-# Problem: https://atcoder.jp/contests/abc071/tasks/abc071_b",
"-# Python 2nd Try",
"+# Problem:",
"+# Python 3rd Try",
"-def solver(inputStr):",
"- # print(\"STR={}\".format(inputStr))",
"- # バケツを用意する",
"- bucket = [0] * 26",
"- result = \"None\"",
"- # print(\"Bucket:{}\".format... | false | 0.048426 | 0.04833 | 1.002004 | [
"s949679790",
"s887455263"
] |
u631025015 | p02713 | python | s683803627 | s786289763 | 983 | 605 | 9,168 | 9,216 | Accepted | Accepted | 38.45 | def gcd(a, b):
while b != 0 :
t = a % b
a = b
b = t
return a
sum = 0
N=int(eval(input("")))
for a in range(1, N + 1):
for b in range(1, N + 1):
x = gcd(a, b)
if x == 1:
sum = sum + N
else:
for c in range(1, N + 1... | def gcd(a, b):
while b != 0 :
t = a % b
a = b
b = t
return a
sum = 0
N=int(eval(input("")))
for a in range(1, N + 1):
for b in range(1, N + 1):
x = gcd(a, b)
if x == 1:
sum = sum + N
elif x == 2:
sum = sum + (N +... | 18 | 20 | 367 | 440 | def gcd(a, b):
while b != 0:
t = a % b
a = b
b = t
return a
sum = 0
N = int(eval(input("")))
for a in range(1, N + 1):
for b in range(1, N + 1):
x = gcd(a, b)
if x == 1:
sum = sum + N
else:
for c in range(1, N + 1):
su... | def gcd(a, b):
while b != 0:
t = a % b
a = b
b = t
return a
sum = 0
N = int(eval(input("")))
for a in range(1, N + 1):
for b in range(1, N + 1):
x = gcd(a, b)
if x == 1:
sum = sum + N
elif x == 2:
sum = sum + (N + 1) // 2 + N // 2 * 2... | false | 10 | [
"+ elif x == 2:",
"+ sum = sum + (N + 1) // 2 + N // 2 * 2"
] | false | 0.178657 | 0.134455 | 1.328748 | [
"s683803627",
"s786289763"
] |
u668503853 | p02683 | python | s360220729 | s860259045 | 87 | 58 | 9,176 | 9,164 | Accepted | Accepted | 33.33 | N,M,X=list(map(int,input().split()))
li=[list(map(int,input().split())) for _ in range(N)]
ans=float("inf")
for i in range(2**N):
price=0
abil=[0]*M
for j in range(N):
if (i>>j)&1:
price+=li[j][0]
for k in range(1,M+1):
abil[k-1]+=li[j][k]
if min(abil)>=X:
ans=min(ans,pri... | N,M,X=list(map(int,input().split()))
li=[list(map(int,input().split())) for _ in range(N)]
ans=float("inf")
for i in range(2**N):
PriceAbil=[0]*(M+1)
for j in range(N):
if (i>>j)&1:
PriceAbil=[x+y for (x,y) in zip(PriceAbil,li[j])]
if min(PriceAbil[1:])>=X:
ans=min(ans,PriceAbil[0])
if ans... | 17 | 14 | 375 | 363 | N, M, X = list(map(int, input().split()))
li = [list(map(int, input().split())) for _ in range(N)]
ans = float("inf")
for i in range(2**N):
price = 0
abil = [0] * M
for j in range(N):
if (i >> j) & 1:
price += li[j][0]
for k in range(1, M + 1):
abil[k - 1] += ... | N, M, X = list(map(int, input().split()))
li = [list(map(int, input().split())) for _ in range(N)]
ans = float("inf")
for i in range(2**N):
PriceAbil = [0] * (M + 1)
for j in range(N):
if (i >> j) & 1:
PriceAbil = [x + y for (x, y) in zip(PriceAbil, li[j])]
if min(PriceAbil[1:]) >= X:
... | false | 17.647059 | [
"- price = 0",
"- abil = [0] * M",
"+ PriceAbil = [0] * (M + 1)",
"- price += li[j][0]",
"- for k in range(1, M + 1):",
"- abil[k - 1] += li[j][k]",
"- if min(abil) >= X:",
"- ans = min(ans, price)",
"+ PriceAbil = [x + y for (x, y) ... | false | 0.107764 | 0.044649 | 2.413599 | [
"s360220729",
"s860259045"
] |
u141610915 | p02816 | python | s461882182 | s334831777 | 1,996 | 623 | 263,616 | 119,632 | Accepted | Accepted | 68.79 | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ta = [[0] * N for _ in range(30)]
tb = [[0] * N for _ in range(30)]
mxl = max(max(a), max(b)).bit_length()
for i in range(mxl):
x = 1 << i
for j in range(N):
ta[i][j] =... | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
class KmpSearch:
def __init__(self, word):
self.word = word
self.table = [0] * (len(word) + 1)
self.table[0] = -1
i, j = 0, 1
while j < len(self.word):
... | 68 | 51 | 1,705 | 1,161 | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ta = [[0] * N for _ in range(30)]
tb = [[0] * N for _ in range(30)]
mxl = max(max(a), max(b)).bit_length()
for i in range(mxl):
x = 1 << i
for j in range(N):
ta[i][j] = i... | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
class KmpSearch:
def __init__(self, word):
self.word = word
self.table = [0] * (len(word) + 1)
self.table[0] = -1
i, j = 0, 1
while j < len(... | false | 25 | [
"-ta = [[0] * N for _ in range(30)]",
"-tb = [[0] * N for _ in range(30)]",
"-mxl = max(max(a), max(b)).bit_length()",
"-for i in range(mxl):",
"- x = 1 << i",
"- for j in range(N):",
"- ta[i][j] = int((a[j] & x) > 0)",
"- tb[i][j] = int((b[j] & x) > 0)",
"-res = [0] * N",
"-vi... | false | 0.036137 | 0.037391 | 0.966442 | [
"s461882182",
"s334831777"
] |
u189487046 | p02954 | python | s883401367 | s426097597 | 130 | 116 | 6,400 | 17,220 | Accepted | Accepted | 10.77 | S = eval(input())
N = len(S)
ans = [0]*N
cnt = 0
for i in range(N-1):
if S[i] == 'R':
cnt += 1
if S[i+1] == 'L':
ans[i+1] = cnt//2
ans[i] = (cnt+1)//2
else:
cnt = 0
cnt = 0
for i in reversed(list(range(1, N))):
if S[i] == 'L':
cnt ... | S = eval(input())
N = len(S)
ans = [0]*N
lr_idx = 0
for i in range(N-1):
if S[i] == 'R' and S[i+1] == 'L':
r_odd = 0 # 奇数
r_even = 0 # 偶数
for c, j in enumerate(reversed(list(range(lr_idx, i)))):
if S[j] == 'R':
if (c+1) % 2 == 0:
... | 26 | 34 | 449 | 817 | S = eval(input())
N = len(S)
ans = [0] * N
cnt = 0
for i in range(N - 1):
if S[i] == "R":
cnt += 1
if S[i + 1] == "L":
ans[i + 1] = cnt // 2
ans[i] = (cnt + 1) // 2
else:
cnt = 0
cnt = 0
for i in reversed(list(range(1, N))):
if S[i] == "L":
cnt += 1
... | S = eval(input())
N = len(S)
ans = [0] * N
lr_idx = 0
for i in range(N - 1):
if S[i] == "R" and S[i + 1] == "L":
r_odd = 0 # 奇数
r_even = 0 # 偶数
for c, j in enumerate(reversed(list(range(lr_idx, i)))):
if S[j] == "R":
if (c + 1) % 2 == 0:
r_ev... | false | 23.529412 | [
"-cnt = 0",
"+lr_idx = 0",
"- if S[i] == \"R\":",
"- cnt += 1",
"- if S[i + 1] == \"L\":",
"- ans[i + 1] = cnt // 2",
"- ans[i] = (cnt + 1) // 2",
"- else:",
"- cnt = 0",
"-cnt = 0",
"-for i in reversed(list(range(1, N))):",
"- if S[i] == \"L... | false | 0.038397 | 0.037424 | 1.026001 | [
"s883401367",
"s426097597"
] |
u807772568 | p02770 | python | s876011269 | s894229328 | 1,538 | 1,385 | 90,756 | 92,292 | Accepted | Accepted | 9.95 | import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
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): ... | import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
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): ... | 120 | 120 | 2,441 | 2,458 | import sys, collections as cl, bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
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()))
... | import sys, collections as cl, bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
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()))
... | false | 0 | [
"- po.append(d[j] % mm if d[j] % mm > 0 else mm)",
"- \"\"\"",
"+ # po.append(d[j] % mm if d[j] % mm > 0 else mm)",
"+ po.append(d[j] % mm)",
"- ccc = ((n-1)//k)",
"- if (n-1)%k >= j:",
"+ ccc = (n - 1) // k",
"+ if (n - 1) % k >= j +... | false | 0.675411 | 0.793018 | 0.851697 | [
"s876011269",
"s894229328"
] |
u932465688 | p03611 | python | s729443798 | s091368811 | 151 | 103 | 14,092 | 14,008 | Accepted | Accepted | 31.79 | N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
L.append(1000000)
M = [0]*((10**5)+1)
c = 0
d = 1
num = L[0]
if N == 1:
print((1))
elif N == 2:
if abs(L[0]-L[1]) <=1 :
print((2))
else:
print((1))
else:
while c <= N-1:
if L[c] == L[c+1]:
d += 1
c += 1... | N = int(eval(input()))
A = list(map(int,input().split()))
if N == 1:
print((1))
elif N == 2:
if abs(A[1]-A[0]) <= 2:
print((2))
else:
print((1))
else:
L = [0]*(10**5+1)
for i in range(N):
L[A[i]+1] += 1
for j in range(1,len(L)):
L[j] = L[j-1]+L[j]
ans = 0
for k in range(3... | 32 | 21 | 535 | 385 | N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
L.append(1000000)
M = [0] * ((10**5) + 1)
c = 0
d = 1
num = L[0]
if N == 1:
print((1))
elif N == 2:
if abs(L[0] - L[1]) <= 1:
print((2))
else:
print((1))
else:
while c <= N - 1:
if L[c] == L[c + 1]:
d... | N = int(eval(input()))
A = list(map(int, input().split()))
if N == 1:
print((1))
elif N == 2:
if abs(A[1] - A[0]) <= 2:
print((2))
else:
print((1))
else:
L = [0] * (10**5 + 1)
for i in range(N):
L[A[i] + 1] += 1
for j in range(1, len(L)):
L[j] = L[j - 1] + L[j]
... | false | 34.375 | [
"-L = list(map(int, input().split()))",
"-L.sort()",
"-L.append(1000000)",
"-M = [0] * ((10**5) + 1)",
"-c = 0",
"-d = 1",
"-num = L[0]",
"+A = list(map(int, input().split()))",
"- if abs(L[0] - L[1]) <= 1:",
"+ if abs(A[1] - A[0]) <= 2:",
"- while c <= N - 1:",
"- if L[c] == L... | false | 0.079427 | 0.0942 | 0.843171 | [
"s729443798",
"s091368811"
] |
u102461423 | p03687 | python | s782507901 | s740533244 | 164 | 136 | 12,548 | 27,196 | Accepted | Accepted | 17.07 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 目標の文字を決める -> シミュレーション
import numpy as np
S = np.array(list(read().rstrip()))
def F(S,x):
A = (S == x)
t = 0
while True:
if np.all(A):
return t
... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = np.array(list(read().rstrip().decode()))
def f(S, a):
S = S == a
if not np.any(S):
return len(S)
for n in range(len(S)):
if np.all(S):
... | 22 | 20 | 413 | 409 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 目標の文字を決める -> シミュレーション
import numpy as np
S = np.array(list(read().rstrip()))
def F(S, x):
A = S == x
t = 0
while True:
if np.all(A):
return t
A = A[:-1] | A[1... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = np.array(list(read().rstrip().decode()))
def f(S, a):
S = S == a
if not np.any(S):
return len(S)
for n in range(len(S)):
if np.all(S):
ret... | false | 9.090909 | [
"+import numpy as np",
"-# 目標の文字を決める -> シミュレーション",
"-import numpy as np",
"-",
"-S = np.array(list(read().rstrip()))",
"+S = np.array(list(read().rstrip().decode()))",
"-def F(S, x):",
"- A = S == x",
"- t = 0",
"- while True:",
"- if np.all(A):",
"- return t",
"- ... | false | 0.390391 | 0.507426 | 0.769355 | [
"s782507901",
"s740533244"
] |
u882620594 | p03329 | python | s272158325 | s601673190 | 758 | 363 | 3,992 | 3,992 | Accepted | Accepted | 52.11 | N = int(eval(input()))
dp = [0 for i in range(N+1)]
dp[1] = 1
roku = 0
kyu = 0
for i in range(2, N+1):
if i == 6**(roku+1):
roku += 1
if i == 9**(kyu+1):
kyu += 1
kouho = [1]
for j in range(roku):
kouho.append(6**(j+1))
for j in range(kyu):
kouho.append(... | N = int(eval(input()))
dp = [0 for i in range(N+1)]
dp[1] = 1
kazu = [1]
i = 6
while i <= N:
kazu.append(i)
i*=6
i = 9
while i <= N:
kazu.append(i)
i*=9
kazu.sort()
kazulazor = len(kazu)
temp = [1]
lentemp = 1
index = 1
for i in range(2, N+1):
kouho = []
if index < kazulazor a... | 23 | 27 | 518 | 512 | N = int(eval(input()))
dp = [0 for i in range(N + 1)]
dp[1] = 1
roku = 0
kyu = 0
for i in range(2, N + 1):
if i == 6 ** (roku + 1):
roku += 1
if i == 9 ** (kyu + 1):
kyu += 1
kouho = [1]
for j in range(roku):
kouho.append(6 ** (j + 1))
for j in range(kyu):
kouho.appen... | N = int(eval(input()))
dp = [0 for i in range(N + 1)]
dp[1] = 1
kazu = [1]
i = 6
while i <= N:
kazu.append(i)
i *= 6
i = 9
while i <= N:
kazu.append(i)
i *= 9
kazu.sort()
kazulazor = len(kazu)
temp = [1]
lentemp = 1
index = 1
for i in range(2, N + 1):
kouho = []
if index < kazulazor and i == kaz... | false | 14.814815 | [
"-roku = 0",
"-kyu = 0",
"+kazu = [1]",
"+i = 6",
"+while i <= N:",
"+ kazu.append(i)",
"+ i *= 6",
"+i = 9",
"+while i <= N:",
"+ kazu.append(i)",
"+ i *= 9",
"+kazu.sort()",
"+kazulazor = len(kazu)",
"+temp = [1]",
"+lentemp = 1",
"+index = 1",
"- if i == 6 ** (roku ... | false | 0.151556 | 0.00701 | 21.618453 | [
"s272158325",
"s601673190"
] |
u133936772 | p02720 | python | s870109108 | s447029427 | 119 | 108 | 7,608 | 7,480 | Accepted | Accepted | 9.24 | n=int(eval(input()))
if n<10: print(n); exit()
l=[[[] for _ in range(10)] for _ in range(10)]
l[0]=[[i] for i in range(10)]
c=9
for i in range(9):
for j in range(10):
for k in (-1,0,1):
if 0<=j+k<=9:
for h in l[i][j+k]:
if j: c+=1
t=j*10**(i+1)+h
l[i+1][j]+=... | n=int(eval(input()))
if n<10: print(n); exit()
r=range
l=[[[] for _ in r(10)] for _ in r(10)]
l[0]=[[i] for i in r(10)]
c=9
for i in r(9):
for j in r(10):
for k in r(-1,2):
if 0<=j+k<=9:
for h in l[i][j+k]:
if j: c+=1
t=j*10**(i+1)+h
l[i+1][j]+=[t]
... | 14 | 15 | 354 | 342 | n = int(eval(input()))
if n < 10:
print(n)
exit()
l = [[[] for _ in range(10)] for _ in range(10)]
l[0] = [[i] for i in range(10)]
c = 9
for i in range(9):
for j in range(10):
for k in (-1, 0, 1):
if 0 <= j + k <= 9:
for h in l[i][j + k]:
if j:
... | n = int(eval(input()))
if n < 10:
print(n)
exit()
r = range
l = [[[] for _ in r(10)] for _ in r(10)]
l[0] = [[i] for i in r(10)]
c = 9
for i in r(9):
for j in r(10):
for k in r(-1, 2):
if 0 <= j + k <= 9:
for h in l[i][j + k]:
if j:
... | false | 6.666667 | [
"-l = [[[] for _ in range(10)] for _ in range(10)]",
"-l[0] = [[i] for i in range(10)]",
"+r = range",
"+l = [[[] for _ in r(10)] for _ in r(10)]",
"+l[0] = [[i] for i in r(10)]",
"-for i in range(9):",
"- for j in range(10):",
"- for k in (-1, 0, 1):",
"+for i in r(9):",
"+ for j in ... | false | 0.062316 | 0.059696 | 1.043891 | [
"s870109108",
"s447029427"
] |
u554781254 | p02659 | python | s555687558 | s663914619 | 24 | 21 | 9,084 | 9,048 | Accepted | Accepted | 12.5 | import sys
import math
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
A, B = list(map(float, input().split()))
A = int(A)
B_tmp = int(B * 10**2 + 0.5)
total = A * B_tmp
total //= 100
# total = math.floor(total)
print((int(total)))
| import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
A, B = list(map(float, input().split()))
A = int(A)
B = int(B * 10**2 + 0.5)
total = A * B
total //= 100
print(total)
| 14 | 12 | 250 | 195 | import sys
import math
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
A, B = list(map(float, input().split()))
A = int(A)
B_tmp = int(B * 10**2 + 0.5)
total = A * B_tmp
total //= 100
# total = math.floor(total)
print((int(total)))
| import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
A, B = list(map(float, input().split()))
A = int(A)
B = int(B * 10**2 + 0.5)
total = A * B
total //= 100
print(total)
| false | 14.285714 | [
"-import math",
"-B_tmp = int(B * 10**2 + 0.5)",
"-total = A * B_tmp",
"+B = int(B * 10**2 + 0.5)",
"+total = A * B",
"-# total = math.floor(total)",
"-print((int(total)))",
"+print(total)"
] | false | 0.038338 | 0.044241 | 0.86657 | [
"s555687558",
"s663914619"
] |
u562935282 | p03095 | python | s866281002 | s799485875 | 83 | 33 | 3,960 | 3,444 | Accepted | Accepted | 60.24 | import string
N = int(eval(input()))
s = eval(input())
MOD = 10 ** 9 + 7
d = dict()
for ss in s:
d[ss] = d.get(ss, 0) + 1
ans = 1
for c in string.ascii_lowercase:
ans *= (d.get(c, 0) + 1)
ans %= MOD
ans -= 1
print(ans)
| from collections import defaultdict
MOD = 10 ** 9 + 7
N = int(eval(input()))
s = eval(input())
d = defaultdict(int)
for ss in s:
d[ss] += 1
ans = 1
for k, v in list(d.items()):
ans *= (v + 1)
ans %= MOD
# v通りの選び方 + 選ばない1通り
ans -= 1
print(ans)
| 16 | 18 | 237 | 262 | import string
N = int(eval(input()))
s = eval(input())
MOD = 10**9 + 7
d = dict()
for ss in s:
d[ss] = d.get(ss, 0) + 1
ans = 1
for c in string.ascii_lowercase:
ans *= d.get(c, 0) + 1
ans %= MOD
ans -= 1
print(ans)
| from collections import defaultdict
MOD = 10**9 + 7
N = int(eval(input()))
s = eval(input())
d = defaultdict(int)
for ss in s:
d[ss] += 1
ans = 1
for k, v in list(d.items()):
ans *= v + 1
ans %= MOD
# v通りの選び方 + 選ばない1通り
ans -= 1
print(ans)
| false | 11.111111 | [
"-import string",
"+from collections import defaultdict",
"+MOD = 10**9 + 7",
"-MOD = 10**9 + 7",
"-d = dict()",
"+d = defaultdict(int)",
"- d[ss] = d.get(ss, 0) + 1",
"+ d[ss] += 1",
"-for c in string.ascii_lowercase:",
"- ans *= d.get(c, 0) + 1",
"+for k, v in list(d.items()):",
"+ ... | false | 0.0463 | 0.057241 | 0.808856 | [
"s866281002",
"s799485875"
] |
u247830763 | p02572 | python | s132316080 | s476422441 | 130 | 116 | 105,356 | 106,864 | Accepted | Accepted | 10.77 | n = int(eval(input()))
ls = list(map(int,input().split()))
di = [0]*(n+1)
mod = 10**9+7
ans = 0
for i in range(1,n+1):
di[i] = di[i-1] + ls[i-1]
for j in range(n-1):
ans += ls[j]*(di[n]-di[j+1]) % mod
print((ans%mod)) | n = int(eval(input()))
mod = 10**9+7
ls = list(map(int,input().split()))
di = [i**2 for i in ls]
print(((((sum(ls)**2)-(sum(di)))//2)%mod)) | 10 | 5 | 226 | 135 | n = int(eval(input()))
ls = list(map(int, input().split()))
di = [0] * (n + 1)
mod = 10**9 + 7
ans = 0
for i in range(1, n + 1):
di[i] = di[i - 1] + ls[i - 1]
for j in range(n - 1):
ans += ls[j] * (di[n] - di[j + 1]) % mod
print((ans % mod))
| n = int(eval(input()))
mod = 10**9 + 7
ls = list(map(int, input().split()))
di = [i**2 for i in ls]
print(((((sum(ls) ** 2) - (sum(di))) // 2) % mod))
| false | 50 | [
"+mod = 10**9 + 7",
"-di = [0] * (n + 1)",
"-mod = 10**9 + 7",
"-ans = 0",
"-for i in range(1, n + 1):",
"- di[i] = di[i - 1] + ls[i - 1]",
"-for j in range(n - 1):",
"- ans += ls[j] * (di[n] - di[j + 1]) % mod",
"-print((ans % mod))",
"+di = [i**2 for i in ls]",
"+print(((((sum(ls) ** 2) ... | false | 0.067309 | 0.054398 | 1.237346 | [
"s132316080",
"s476422441"
] |
u454760747 | p02949 | python | s558004374 | s592324201 | 1,169 | 1,027 | 74,548 | 74,944 | Accepted | Accepted | 12.15 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M, P = list(map(int, input().split()))
edges = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
edges.append([a-1, b-1, -c+P])
def bellnabFord(edges, src, N):
inf = float('inf')
dist = [inf for i in ra... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M, P = list(map(int, input().split()))
edges = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
edges.append([a-1, b-1, -c+P])
def bellnabFord(edges, src, N):
inf = float('inf')
dist = [inf for i in ra... | 35 | 35 | 795 | 782 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M, P = list(map(int, input().split()))
edges = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
edges.append([a - 1, b - 1, -c + P])
def bellnabFord(edges, src, N):
inf = float("inf")
dist = [inf for i in range(N)]
... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M, P = list(map(int, input().split()))
edges = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
edges.append([a - 1, b - 1, -c + P])
def bellnabFord(edges, src, N):
inf = float("inf")
dist = [inf for i in range(N)]
... | false | 0 | [
"- if s != inf and dist[d] > dist[s] + c:",
"+ if dist[d] > dist[s] + c:"
] | false | 0.042317 | 0.007938 | 5.33128 | [
"s558004374",
"s592324201"
] |
u512212329 | p02597 | python | s135582402 | s474057004 | 55 | 34 | 17,196 | 9,244 | Accepted | Accepted | 38.18 | def main():
eval(input()) # n
stones = eval(input())
white_counter = []
white_stones = 0
red_stones = 0
for color in stones:
if color == 'W':
white_stones += 1
else:
red_stones += 1
white_counter.append(white_stones)
if red_stone... | def main():
eval(input()) # n
stones = eval(input())
reds = stones.count('R')
print((stones[:reds].count('W')))
if __name__ == '__main__':
main()
| 21 | 8 | 435 | 161 | def main():
eval(input()) # n
stones = eval(input())
white_counter = []
white_stones = 0
red_stones = 0
for color in stones:
if color == "W":
white_stones += 1
else:
red_stones += 1
white_counter.append(white_stones)
if red_stones == 0:
... | def main():
eval(input()) # n
stones = eval(input())
reds = stones.count("R")
print((stones[:reds].count("W")))
if __name__ == "__main__":
main()
| false | 61.904762 | [
"- white_counter = []",
"- white_stones = 0",
"- red_stones = 0",
"- for color in stones:",
"- if color == \"W\":",
"- white_stones += 1",
"- else:",
"- red_stones += 1",
"- white_counter.append(white_stones)",
"- if red_stones == 0:",
"-... | false | 0.040593 | 0.040577 | 1.000398 | [
"s135582402",
"s474057004"
] |
u033606236 | p03449 | python | s459573837 | s392196273 | 21 | 17 | 3,064 | 3,064 | Accepted | Accepted | 19.05 | nums = int(eval(input()))
ary = [0,0]
for i in range(2):
ary[i] = list(map(int,input().split()))
max = 0
for i in range(nums):
h = 0
w = 0
count = ary[h][w]
for x in range(nums):
if i == x :
h = 1
count += ary[h][w]
continue
w += ... | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))[::-1]
dp = [b[0] for _ in range(n)]
for i in range(1,n):
dp[i] = dp[i-1]+b[i]
dp = dp[::-1]
c = 0
dp2 = [0 for _ in range(n)]
for i in range(n):
c += a[i]
dp2[i] = c +dp[i]
print((max(dp2))) | 21 | 13 | 398 | 299 | nums = int(eval(input()))
ary = [0, 0]
for i in range(2):
ary[i] = list(map(int, input().split()))
max = 0
for i in range(nums):
h = 0
w = 0
count = ary[h][w]
for x in range(nums):
if i == x:
h = 1
count += ary[h][w]
continue
w += 1
count +... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))[::-1]
dp = [b[0] for _ in range(n)]
for i in range(1, n):
dp[i] = dp[i - 1] + b[i]
dp = dp[::-1]
c = 0
dp2 = [0 for _ in range(n)]
for i in range(n):
c += a[i]
dp2[i] = c + dp[i]
print((max(dp2)))
| false | 38.095238 | [
"-nums = int(eval(input()))",
"-ary = [0, 0]",
"-for i in range(2):",
"- ary[i] = list(map(int, input().split()))",
"-max = 0",
"-for i in range(nums):",
"- h = 0",
"- w = 0",
"- count = ary[h][w]",
"- for x in range(nums):",
"- if i == x:",
"- h = 1",
"- ... | false | 0.007359 | 0.036825 | 0.199834 | [
"s459573837",
"s392196273"
] |
u374103100 | p03013 | python | s074976172 | s132416912 | 597 | 441 | 471,416 | 460,404 | Accepted | Accepted | 26.13 | #
import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop
def main():
MOD = 1000000007
N, M = list(map(int, input().split()))
A = set()
for _ in range(M):
a = int(eval(input()))
A.add(a)
... | #
import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop
def main():
MOD = 1000000007
N, M = list(map(int, input().split()))
A = set()
for _ in range(M):
a = int(eval(input()))
A.add(a)
... | 32 | 33 | 612 | 627 | #
import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop
def main():
MOD = 1000000007
N, M = list(map(int, input().split()))
A = set()
for _ in range(M):
a = int(eval(input()))
A.add(a)
dp = [0] * (N + ... | #
import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop
def main():
MOD = 1000000007
N, M = list(map(int, input().split()))
A = set()
for _ in range(M):
a = int(eval(input()))
A.add(a)
dp = [0] * (N + ... | false | 3.030303 | [
"- print((dp[N] % MOD))",
"+ ans = dp[N] % MOD",
"+ print(ans)"
] | false | 0.048119 | 0.048644 | 0.989213 | [
"s074976172",
"s132416912"
] |
u281303342 | p03112 | python | s316700941 | s796628095 | 961 | 718 | 16,128 | 18,044 | Accepted | Accepted | 25.29 | A,B,Q = list(map(int,input().split()))
S = [-float("inf")]+[int(eval(input())) for _ in range(A)]+[float("inf")]
T = [-float("inf")]+[int(eval(input())) for _ in range(B)]+[float("inf")]
X = [int(eval(input())) for _ in range(Q)]
from bisect import bisect_left
for x in X:
Si,Ti = bisect_left(S,x),bisect_l... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 12 | 29 | 473 | 1,010 | A, B, Q = list(map(int, input().split()))
S = [-float("inf")] + [int(eval(input())) for _ in range(A)] + [float("inf")]
T = [-float("inf")] + [int(eval(input())) for _ in range(B)] + [float("inf")]
X = [int(eval(input())) for _ in range(Q)]
from bisect import bisect_left
for x in X:
Si, Ti = bisect_left(S, x), bis... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 58.62069 | [
"+# Python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# function",
"+# main",
"-S = [-float(\"inf\")] + [int(eval(input())) for _ in range(A)] + [float(\"inf\")]",
"-T = [-float(\"inf\")] + [int(eval(input())) for _ in range(B)] + [float(\"inf\")]",
"+S = (",
"+ [-float(\"i... | false | 0.082046 | 0.079863 | 1.027336 | [
"s316700941",
"s796628095"
] |
u201234972 | p03700 | python | s759017480 | s420923596 | 1,481 | 1,276 | 7,072 | 7,076 | Accepted | Accepted | 13.84 | N, A, B = list(map( int, input().split()))
hmax = 0
H = [ int( eval(input())) for _ in range(N)]
#hmax = max(H)
L = 0
R = 10**9+1#hmax//B + 1
add = A-B
while L != R:
now = (L+R)//2
need = 0
for i in range(N):
r = H[i] - now*B
if r > 0:
need += (r-1)//add+1
if ne... | N, A, B = list(map( int, input().split()))
hmax = 0
H = [ int( eval(input())) for _ in range(N)]
hmax = max(H)
L = 0
R = hmax//B + 1
add = A-B
while R-L != 1:#L != R:
now = (L+R)//2
need = 0
for i in range(N):
r = H[i] - now*B
if r > 0:
need += (r-1)//add+1
if n... | 19 | 19 | 427 | 429 | N, A, B = list(map(int, input().split()))
hmax = 0
H = [int(eval(input())) for _ in range(N)]
# hmax = max(H)
L = 0
R = 10**9 + 1 # hmax//B + 1
add = A - B
while L != R:
now = (L + R) // 2
need = 0
for i in range(N):
r = H[i] - now * B
if r > 0:
need += (r - 1) // add + 1
if... | N, A, B = list(map(int, input().split()))
hmax = 0
H = [int(eval(input())) for _ in range(N)]
hmax = max(H)
L = 0
R = hmax // B + 1
add = A - B
while R - L != 1: # L != R:
now = (L + R) // 2
need = 0
for i in range(N):
r = H[i] - now * B
if r > 0:
need += (r - 1) // add + 1
... | false | 0 | [
"-# hmax = max(H)",
"+hmax = max(H)",
"-R = 10**9 + 1 # hmax//B + 1",
"+R = hmax // B + 1",
"-while L != R:",
"+while R - L != 1: # L != R:",
"- L = now + 1 # うまく行かないので+1している.これがないと無限ループが発生する。",
"-print(L)",
"+ L = now # +1#うまく行かないので+1している.これがないと無限ループが発生する。",
"+print(R)"
] | false | 0.035581 | 0.057515 | 0.618646 | [
"s759017480",
"s420923596"
] |
u186838327 | p03152 | python | s613909121 | s919786858 | 1,755 | 842 | 3,316 | 45,096 | Accepted | Accepted | 52.02 | n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9+7
A_ = set(A)
B_ = set(B)
if len(A) != len(A_) or len(B) != len(B_):
print((0))
exit()
A.sort()
B.sort()
import bisect
ans = 1
for i in reversed(list(range(1, n*m+1... | n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9+7
SA = set(A)
SB = set(B)
A.sort()
B.sort()
if len(SA) != len(A) or len(SB) != len(B):
print((0))
exit()
ans = 1
import bisect
for i in reversed(list(range(1, n*m+1))):... | 33 | 32 | 700 | 660 | n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9 + 7
A_ = set(A)
B_ = set(B)
if len(A) != len(A_) or len(B) != len(B_):
print((0))
exit()
A.sort()
B.sort()
import bisect
ans = 1
for i in reversed(list(range(1, n * m + 1))):
if i in A... | n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9 + 7
SA = set(A)
SB = set(B)
A.sort()
B.sort()
if len(SA) != len(A) or len(SB) != len(B):
print((0))
exit()
ans = 1
import bisect
for i in reversed(list(range(1, n * m + 1))):
if i in S... | false | 3.030303 | [
"-A_ = set(A)",
"-B_ = set(B)",
"-if len(A) != len(A_) or len(B) != len(B_):",
"+SA = set(A)",
"+SB = set(B)",
"+A.sort()",
"+B.sort()",
"+if len(SA) != len(A) or len(SB) != len(B):",
"-A.sort()",
"-B.sort()",
"+ans = 1",
"-ans = 1",
"- if i in A_ and i in B_:",
"+ if i in SA and i i... | false | 0.038821 | 0.048169 | 0.805931 | [
"s613909121",
"s919786858"
] |
u076917070 | p03103 | python | s096815961 | s438190449 | 308 | 284 | 20,072 | 16,944 | Accepted | Accepted | 7.79 | import sys
input=sys.stdin.readline
N,M = list(map(int, input().split()))
A = []
for i in range(N):
a,b = list(map(int, input().split()))
A.append([a,b])
A.sort()
x = 0
for a in A:
if M == 0:
break
while a[1] > 0:
a[1] -= 1
M -= 1
x += a[0]
i... | import sys
input=sys.stdin.readline
N,M = list(map(int, input().split()))
A = []
for i in range(N):
a,b = list(map(int, input().split()))
A.append((a,b))
A.sort()
ans = 0
for a,b in A:
if M == 0:
break
n = M if M <= b else b
M -= n
ans += n * a
print(ans)
| 22 | 19 | 347 | 303 | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append([a, b])
A.sort()
x = 0
for a in A:
if M == 0:
break
while a[1] > 0:
a[1] -= 1
M -= 1
x += a[0]
if M == 0:
... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append((a, b))
A.sort()
ans = 0
for a, b in A:
if M == 0:
break
n = M if M <= b else b
M -= n
ans += n * a
print(ans)
| false | 13.636364 | [
"- A.append([a, b])",
"+ A.append((a, b))",
"-x = 0",
"-for a in A:",
"+ans = 0",
"+for a, b in A:",
"- while a[1] > 0:",
"- a[1] -= 1",
"- M -= 1",
"- x += a[0]",
"- if M == 0:",
"- break",
"-print(x)",
"+ n = M if M <= b else b",
"+ ... | false | 0.040716 | 0.036404 | 1.118463 | [
"s096815961",
"s438190449"
] |
u497596438 | p03287 | python | s896698754 | s227579230 | 367 | 126 | 68,332 | 15,084 | Accepted | Accepted | 65.67 | from math import factorial
from math import sqrt
from math import ceil
from itertools import permutations
from heapq import *
from collections import defaultdict
from copy import deepcopy
from math import log
N,M=list(map(int,input().split()))
def nCr(n,r):
a=factorial(n)
b=factorial(n-r)
c=fa... | from collections import defaultdict
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
B=[0]*(N+1)
C=defaultdict(int)
C[0]+=1
for i in range(N):
B[i+1]=(B[i]+A[i])%M
C[B[i+1]]+=1
ans=0
for i in list(C.values()):
ans+=i*(i-1)//2
print(ans)
| 28 | 14 | 592 | 270 | from math import factorial
from math import sqrt
from math import ceil
from itertools import permutations
from heapq import *
from collections import defaultdict
from copy import deepcopy
from math import log
N, M = list(map(int, input().split()))
def nCr(n, r):
a = factorial(n)
b = factorial(n - r)
c = ... | from collections import defaultdict
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0] * (N + 1)
C = defaultdict(int)
C[0] += 1
for i in range(N):
B[i + 1] = (B[i] + A[i]) % M
C[B[i + 1]] += 1
ans = 0
for i in list(C.values()):
ans += i * (i - 1) // 2
print(ans)
| false | 50 | [
"-from math import factorial",
"-from math import sqrt",
"-from math import ceil",
"-from itertools import permutations",
"-from heapq import *",
"-from copy import deepcopy",
"-from math import log",
"-",
"-",
"-def nCr(n, r):",
"- a = factorial(n)",
"- b = factorial(n - r)",
"- c ... | false | 0.040565 | 0.039882 | 1.017113 | [
"s896698754",
"s227579230"
] |
u368249389 | p02717 | python | s869286067 | s373832369 | 188 | 168 | 38,384 | 38,256 | Accepted | Accepted | 10.64 | # Problem A
A, B, C = list(map(int, input().split()))
tmp = B
B = A
A = tmp
tmp = A
A = C
C = tmp
# output
print(("%d %d %d"%(A, B, C)))
| # Problem A - ABC Swap
# input
X, Y, Z = list(map(int, input().split()))
# swap
tmp = X
X = Y
Y = tmp
tmp = X
X = Z
Z = tmp
# output
print(("%d %d %d"%(X, Y, Z)))
| 13 | 15 | 144 | 172 | # Problem A
A, B, C = list(map(int, input().split()))
tmp = B
B = A
A = tmp
tmp = A
A = C
C = tmp
# output
print(("%d %d %d" % (A, B, C)))
| # Problem A - ABC Swap
# input
X, Y, Z = list(map(int, input().split()))
# swap
tmp = X
X = Y
Y = tmp
tmp = X
X = Z
Z = tmp
# output
print(("%d %d %d" % (X, Y, Z)))
| false | 13.333333 | [
"-# Problem A",
"-A, B, C = list(map(int, input().split()))",
"-tmp = B",
"-B = A",
"-A = tmp",
"-tmp = A",
"-A = C",
"-C = tmp",
"+# Problem A - ABC Swap",
"+# input",
"+X, Y, Z = list(map(int, input().split()))",
"+# swap",
"+tmp = X",
"+X = Y",
"+Y = tmp",
"+tmp = X",
"+X = Z",
... | false | 0.078676 | 0.04118 | 1.910515 | [
"s869286067",
"s373832369"
] |
u250583425 | p03274 | python | s377118514 | s220425643 | 75 | 69 | 15,028 | 15,028 | Accepted | Accepted | 8 | import sys
def input(): return sys.stdin.readline().rstrip()
def solve(l, m):
if l < m:
return l * 2 + m
else:
return l + m * 2
def main():
N, K = list(map(int, input().split()))
x = tuple(map(int, input().split()))
right_x = [i for i in x if i >= 0][:K]
left_x = [... | import sys
def input(): return sys.stdin.readline().rstrip()
def solve(l, r):
lv = abs(l)
rv = abs(r)
if (l < 0) ^ (r < 0):
return lv + rv + min(lv, rv)
else:
return max(lv, rv)
def main():
N, K = list(map(int, input().split()))
x = tuple(map(int, input().split()))... | 34 | 25 | 817 | 527 | import sys
def input():
return sys.stdin.readline().rstrip()
def solve(l, m):
if l < m:
return l * 2 + m
else:
return l + m * 2
def main():
N, K = list(map(int, input().split()))
x = tuple(map(int, input().split()))
right_x = [i for i in x if i >= 0][:K]
left_x = [-i fo... | import sys
def input():
return sys.stdin.readline().rstrip()
def solve(l, r):
lv = abs(l)
rv = abs(r)
if (l < 0) ^ (r < 0):
return lv + rv + min(lv, rv)
else:
return max(lv, rv)
def main():
N, K = list(map(int, input().split()))
x = tuple(map(int, input().split()))
... | false | 26.470588 | [
"-def solve(l, m):",
"- if l < m:",
"- return l * 2 + m",
"+def solve(l, r):",
"+ lv = abs(l)",
"+ rv = abs(r)",
"+ if (l < 0) ^ (r < 0):",
"+ return lv + rv + min(lv, rv)",
"- return l + m * 2",
"+ return max(lv, rv)",
"- right_x = [i for i in x if i >... | false | 0.103451 | 0.042993 | 2.40622 | [
"s377118514",
"s220425643"
] |
u970197315 | p03834 | python | s110030752 | s738516650 | 184 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.76 | s=eval(input())
print((s.replace(',',' '))) |
s=eval(input())
s=s.replace(","," ")
print(s)
| 2 | 6 | 36 | 48 | s = eval(input())
print((s.replace(",", " ")))
| s = eval(input())
s = s.replace(",", " ")
print(s)
| false | 66.666667 | [
"-print((s.replace(\",\", \" \")))",
"+s = s.replace(\",\", \" \")",
"+print(s)"
] | false | 0.035641 | 0.066776 | 0.533735 | [
"s110030752",
"s738516650"
] |
u603234915 | p04025 | python | s450451586 | s062214179 | 25 | 23 | 3,064 | 3,188 | Accepted | Accepted | 8 | def abss(x, y):
return abs(x-y)**2
def main():
N = int(eval(input()))
l = list(map(int, input().split()))
ans = 10000000
min_l = min(l)
max_l = max(l)
for y in range(min_l, max_l+1):
temp = 0
for x in l:
temp += abss(x, y)
ans = min(ans, temp... | def main():
N = int(eval(input()))
l = list(map(int, input().split()))
ans = 10000000
min_l = min(l)
max_l = max(l)
for y in range(min_l, max_l+1):
temp = 0
for x in l:
temp += (x - y) ** 2
ans = min(ans, temp)
print(ans)
if __name__ == '__ma... | 18 | 15 | 373 | 332 | def abss(x, y):
return abs(x - y) ** 2
def main():
N = int(eval(input()))
l = list(map(int, input().split()))
ans = 10000000
min_l = min(l)
max_l = max(l)
for y in range(min_l, max_l + 1):
temp = 0
for x in l:
temp += abss(x, y)
ans = min(ans, temp)
... | def main():
N = int(eval(input()))
l = list(map(int, input().split()))
ans = 10000000
min_l = min(l)
max_l = max(l)
for y in range(min_l, max_l + 1):
temp = 0
for x in l:
temp += (x - y) ** 2
ans = min(ans, temp)
print(ans)
if __name__ == "__main__":
... | false | 16.666667 | [
"-def abss(x, y):",
"- return abs(x - y) ** 2",
"-",
"-",
"- temp += abss(x, y)",
"+ temp += (x - y) ** 2"
] | false | 0.042035 | 0.032558 | 1.291068 | [
"s450451586",
"s062214179"
] |
u352394527 | p00439 | python | s710589448 | s886282413 | 310 | 280 | 9,604 | 9,612 | Accepted | Accepted | 9.68 | while True:
n,k = list(map(int,input().split()))
if n == 0 and k == 0:
break
lst = []
for i in range(n):
lst.append(int(eval(input())))
count = 0
for i in range(k):
count += lst[i]
ans = count
for i in range(k, n):
count += lst[i]
count -= lst[i - k]
ans = max(ans,c... | def main():
while True:
n,k = list(map(int,input().split()))
if n == 0 and k == 0:
break
lst = []
for i in range(n):
lst.append(int(eval(input())))
count = 0
for i in range(k):
count += lst[i]
ans = count
for i in range(k, n):
count += lst[i]
... | 17 | 20 | 330 | 415 | while True:
n, k = list(map(int, input().split()))
if n == 0 and k == 0:
break
lst = []
for i in range(n):
lst.append(int(eval(input())))
count = 0
for i in range(k):
count += lst[i]
ans = count
for i in range(k, n):
count += lst[i]
count -= lst[i ... | def main():
while True:
n, k = list(map(int, input().split()))
if n == 0 and k == 0:
break
lst = []
for i in range(n):
lst.append(int(eval(input())))
count = 0
for i in range(k):
count += lst[i]
ans = count
for i in ... | false | 15 | [
"-while True:",
"- n, k = list(map(int, input().split()))",
"- if n == 0 and k == 0:",
"- break",
"- lst = []",
"- for i in range(n):",
"- lst.append(int(eval(input())))",
"- count = 0",
"- for i in range(k):",
"- count += lst[i]",
"- ans = count",
"- ... | false | 0.036132 | 0.036237 | 0.997115 | [
"s710589448",
"s886282413"
] |
u537782349 | p03775 | python | s209837606 | s373015590 | 243 | 33 | 3,188 | 3,060 | Accepted | Accepted | 86.42 | def m_c_d(x, y):
if x == 0:
return y
elif y == 0:
return x
else:
return m_c_d(y, x % y)
a = int(eval(input()))
b = 0
for i in range(int(a ** 0.5 + 1), 1, -1):
b = max(m_c_d(a, i), b)
print((max(len(str(b)), len(str(a // b)))))
| a = int(eval(input()))
b = 10 ** 10
for i in range(1, int(a ** 0.5) + 1):
if a % i == 0:
b = min(b, max(len(str(i)), len(str(a // i))))
print(b)
| 15 | 6 | 276 | 156 | def m_c_d(x, y):
if x == 0:
return y
elif y == 0:
return x
else:
return m_c_d(y, x % y)
a = int(eval(input()))
b = 0
for i in range(int(a**0.5 + 1), 1, -1):
b = max(m_c_d(a, i), b)
print((max(len(str(b)), len(str(a // b)))))
| a = int(eval(input()))
b = 10**10
for i in range(1, int(a**0.5) + 1):
if a % i == 0:
b = min(b, max(len(str(i)), len(str(a // i))))
print(b)
| false | 60 | [
"-def m_c_d(x, y):",
"- if x == 0:",
"- return y",
"- elif y == 0:",
"- return x",
"- else:",
"- return m_c_d(y, x % y)",
"-",
"-",
"-b = 0",
"-for i in range(int(a**0.5 + 1), 1, -1):",
"- b = max(m_c_d(a, i), b)",
"-print((max(len(str(b)), len(str(a // b))))... | false | 0.094036 | 0.04209 | 2.234158 | [
"s209837606",
"s373015590"
] |
u339199690 | p02981 | python | s889882240 | s760242832 | 39 | 29 | 5,244 | 9,092 | Accepted | Accepted | 25.64 | import sys, heapq, bisect, math, fractions
from collections import deque
N, A, B = list(map(int, input().split()))
print((min(A * N, B))) | N, A, B = list(map(int, input().split()))
print((min(A * N, B)))
| 6 | 3 | 136 | 60 | import sys, heapq, bisect, math, fractions
from collections import deque
N, A, B = list(map(int, input().split()))
print((min(A * N, B)))
| N, A, B = list(map(int, input().split()))
print((min(A * N, B)))
| false | 50 | [
"-import sys, heapq, bisect, math, fractions",
"-from collections import deque",
"-"
] | false | 0.077019 | 0.056594 | 1.360891 | [
"s889882240",
"s760242832"
] |
u034128150 | p02728 | python | s772703580 | s771507968 | 1,513 | 1,344 | 196,180 | 185,452 | Accepted | Accepted | 11.17 | from itertools import accumulate
MOD = 10 ** 9 + 7
table_len = 2 * 10 ** 5 + 10
fac = [1, 1]
for i in range(2, table_len):
fac.append(fac[-1] * i % MOD)
finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(table_len-1, -1, -1):
finv[i-1] = finv[i] * i % MOD
N = int... | from itertools import accumulate
MOD = 10 ** 9 + 7
table_len = 2 * 10 ** 5 + 10
fac = [1, 1]
for i in range(2, table_len):
fac.append(fac[-1] * i % MOD)
finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(table_len-1, -1, -1):
finv[i-1] = finv[i] * i % MOD
N = int... | 89 | 64 | 2,768 | 1,768 | from itertools import accumulate
MOD = 10**9 + 7
table_len = 2 * 10**5 + 10
fac = [1, 1]
for i in range(2, table_len):
fac.append(fac[-1] * i % MOD)
finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(table_len - 1, -1, -1):
finv[i - 1] = finv[i] * i % MOD
N = int(eval(input()))
adj = [... | from itertools import accumulate
MOD = 10**9 + 7
table_len = 2 * 10**5 + 10
fac = [1, 1]
for i in range(2, table_len):
fac.append(fac[-1] * i % MOD)
finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(table_len - 1, -1, -1):
finv[i - 1] = finv[i] * i % MOD
N = int(eval(input()))
adj = [... | false | 28.089888 | [
"-dp1_size = [1] * (N + 1)",
"-for node in reversed(dfs_order):",
"- for child in adj[node]:",
"- if child != parent[node]:",
"- dp1_size[node] += dp1_size[child]",
"-dp2_size = [0] * (N + 1)",
"-for node in dfs_order:",
"- around = [",
"- dp1_size[next_node] if next_n... | false | 0.266589 | 0.426508 | 0.625051 | [
"s772703580",
"s771507968"
] |
u461513098 | p03031 | python | s146263161 | s269271720 | 45 | 23 | 3,064 | 3,444 | Accepted | Accepted | 48.89 | N, M = list(map(int, input().split()))
S = []
for _ in range(M):
ipt = [int(i) for i in input().split()]
S.append([True if i in ipt[1:] else False for i in range(1, N+1)])
P = [int(p) for p in input().split()]
ans = 0
for cmb in range(0, 2**N):
b = list(str(bin(cmb)))[2:]
cmb_b = ["0"]*(N-len... | import sys
input = sys.stdin.readline
def make_switch_set(i, s):
if i == N:
return [s]
else:
cs = s.copy()
cs.add(i+1)
return make_switch_set(i+1, s) + make_switch_set(i+1, cs)
def main():
ans = 0
for ss in switch_set:
count = 0
fo... | 20 | 37 | 577 | 809 | N, M = list(map(int, input().split()))
S = []
for _ in range(M):
ipt = [int(i) for i in input().split()]
S.append([True if i in ipt[1:] else False for i in range(1, N + 1)])
P = [int(p) for p in input().split()]
ans = 0
for cmb in range(0, 2**N):
b = list(str(bin(cmb)))[2:]
cmb_b = ["0"] * (N - len(b)) ... | import sys
input = sys.stdin.readline
def make_switch_set(i, s):
if i == N:
return [s]
else:
cs = s.copy()
cs.add(i + 1)
return make_switch_set(i + 1, s) + make_switch_set(i + 1, cs)
def main():
ans = 0
for ss in switch_set:
count = 0
for switches, p ... | false | 45.945946 | [
"-N, M = list(map(int, input().split()))",
"-S = []",
"-for _ in range(M):",
"- ipt = [int(i) for i in input().split()]",
"- S.append([True if i in ipt[1:] else False for i in range(1, N + 1)])",
"-P = [int(p) for p in input().split()]",
"-ans = 0",
"-for cmb in range(0, 2**N):",
"- b = lis... | false | 0.051279 | 0.047925 | 1.069972 | [
"s146263161",
"s269271720"
] |
u645250356 | p02753 | python | s914033660 | s012486470 | 171 | 46 | 5,676 | 5,504 | Accepted | Accepted | 73.1 | from collections import Counter,defaultdict,deque
from bisect import bisect_left
import sys,math,itertools,pprint,fractions,time
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
s = eval(in... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | 13 | 12 | 391 | 439 | from collections import Counter, defaultdict, deque
from bisect import bisect_left
import sys, math, itertools, pprint, fractions, time
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | false | 7.692308 | [
"-from bisect import bisect_left",
"-import sys, math, itertools, pprint, fractions, time",
"+from heapq import heappop, heappush, heapify",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"-if s[0] != s[1] or s[1] != s[2]:",
"- print(\"Yes\")",
"... | false | 0.038691 | 0.047219 | 0.819389 | [
"s914033660",
"s012486470"
] |
u699089116 | p03147 | python | s212632981 | s401096786 | 180 | 164 | 39,280 | 38,256 | Accepted | Accepted | 8.89 | n = int(eval(input()))
h = list(map(int, input().split()))
cnt = 0
while max(set(h)) > 0:
flg = False
for i in h:
if i <= 0:
flg = False
continue
else:
if not flg:
cnt += 1
flg = True
h = list([x-1 for x in h])
... | n = int(eval(input()))
h = list(map(int, input().split()))
ans = h[0]
for i in range(n-1):
ans += h[i+1] - h[i] if h[i] < h[i+1] else 0
print(ans) | 17 | 8 | 330 | 153 | n = int(eval(input()))
h = list(map(int, input().split()))
cnt = 0
while max(set(h)) > 0:
flg = False
for i in h:
if i <= 0:
flg = False
continue
else:
if not flg:
cnt += 1
flg = True
h = list([x - 1 for x in h])
print(cnt)
| n = int(eval(input()))
h = list(map(int, input().split()))
ans = h[0]
for i in range(n - 1):
ans += h[i + 1] - h[i] if h[i] < h[i + 1] else 0
print(ans)
| false | 52.941176 | [
"-cnt = 0",
"-while max(set(h)) > 0:",
"- flg = False",
"- for i in h:",
"- if i <= 0:",
"- flg = False",
"- continue",
"- else:",
"- if not flg:",
"- cnt += 1",
"- flg = True",
"- h = list([x - 1 for x in h])",
... | false | 0.043882 | 0.03753 | 1.169228 | [
"s212632981",
"s401096786"
] |
u503228842 | p03700 | python | s181439422 | s507504802 | 771 | 648 | 76,504 | 76,504 | Accepted | Accepted | 15.95 | import math
N,A,B = list(map(int,input().split()))
H = [int(eval(input())) for _ in range(N)]
def enough(T):
temp = 0
ch = H[:]
for h in ch:
left = h - B*T
if left > 0:
#temp += (left + A-B+1)//(A-B)
temp += math.ceil(left/(A-B))
#print(temp... | import math
N,A,B = list(map(int,input().split()))
H = [int(eval(input())) for _ in range(N)]
def enough(T):
temp = 0
ch = H[:]
for h in ch:
left = h - B*T
if left > 0:
temp += (left + A-B-1)//(A-B)
#temp += math.ceil(left/(A-B))
#print(temp... | 32 | 32 | 569 | 569 | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
def enough(T):
temp = 0
ch = H[:]
for h in ch:
left = h - B * T
if left > 0:
# temp += (left + A-B+1)//(A-B)
temp += math.ceil(left / (A - B))
# print(temp)... | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
def enough(T):
temp = 0
ch = H[:]
for h in ch:
left = h - B * T
if left > 0:
temp += (left + A - B - 1) // (A - B)
# temp += math.ceil(left/(A-B))
# print(t... | false | 0 | [
"- # temp += (left + A-B+1)//(A-B)",
"- temp += math.ceil(left / (A - B))",
"+ temp += (left + A - B - 1) // (A - B)",
"+ # temp += math.ceil(left/(A-B))"
] | false | 0.045476 | 0.048212 | 0.943268 | [
"s181439422",
"s507504802"
] |
u353797797 | p03607 | python | s588783923 | s751658782 | 240 | 85 | 15,452 | 12,268 | Accepted | Accepted | 64.58 | from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(r... | from itertools import permutations
import sys
sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
de... | 18 | 29 | 511 | 821 | from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in... | from itertools import permutations
import sys
sys.setrecursionlimit(10**6)
from bisect import *
from collections import *
from heapq import *
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split())... | false | 37.931034 | [
"-from collections import defaultdict",
"+from itertools import permutations",
"-int1 = lambda x: int(x) - 1",
"-p2D = lambda x: print(*x, sep=\"\\n\")",
"+from bisect import *",
"+from collections import *",
"+from heapq import *",
"+",
"+",
"+def II():",
"+ return int(sys.stdin.readline())"... | false | 0.042135 | 0.039115 | 1.077209 | [
"s588783923",
"s751658782"
] |
u141786930 | p02695 | python | s008781992 | s732856134 | 958 | 691 | 21,304 | 9,152 | Accepted | Accepted | 27.87 | # C - Many Requirements
import itertools
N, M, Q = list(map(int, input().split()))
TEST = [0] * Q
for i in range(Q):
TEST[i] = list(int(x) for x in input().split())
nums = [i+1 for i in range(M)]
ans = 0
for l in list(itertools.combinations_with_replacement(nums, N)):
tmp = 0
for t in TEST... | # C - Many Requirements
# DFSで解く
N, M, Q = list(map(int, input().split()))
A = [0] * Q
B = [0] * Q
C = [0] * Q
D = [0] * Q
for i in range(Q):
A[i], B[i], C[i], D[i] = list(map(int, input().split()))
def dfs(L):
global ans
if len(L)==N+1:
tmp = 0
for i in range(Q):
... | 22 | 27 | 456 | 530 | # C - Many Requirements
import itertools
N, M, Q = list(map(int, input().split()))
TEST = [0] * Q
for i in range(Q):
TEST[i] = list(int(x) for x in input().split())
nums = [i + 1 for i in range(M)]
ans = 0
for l in list(itertools.combinations_with_replacement(nums, N)):
tmp = 0
for t in TEST:
if l[... | # C - Many Requirements
# DFSで解く
N, M, Q = list(map(int, input().split()))
A = [0] * Q
B = [0] * Q
C = [0] * Q
D = [0] * Q
for i in range(Q):
A[i], B[i], C[i], D[i] = list(map(int, input().split()))
def dfs(L):
global ans
if len(L) == N + 1:
tmp = 0
for i in range(Q):
if L[B[i]... | false | 18.518519 | [
"-import itertools",
"+# DFSで解く",
"+N, M, Q = list(map(int, input().split()))",
"+A = [0] * Q",
"+B = [0] * Q",
"+C = [0] * Q",
"+D = [0] * Q",
"+for i in range(Q):",
"+ A[i], B[i], C[i], D[i] = list(map(int, input().split()))",
"-N, M, Q = list(map(int, input().split()))",
"-TEST = [0] * Q",... | false | 0.047987 | 0.049231 | 0.974722 | [
"s008781992",
"s732856134"
] |
u652656291 | p03854 | python | s340385734 | s417595950 | 23 | 18 | 6,516 | 3,188 | Accepted | Accepted | 21.74 | import re
S = eval(input())
'''
メタ文字:
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
'''
if re.match("^(dream|dreamer|erase|eraser)+$", S):
print('YES')
else:
print('NO') | s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
print("NO")
else:
print("YES")
| 13 | 5 | 189 | 142 | import re
S = eval(input())
"""
メタ文字:
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
"""
if re.match("^(dream|dreamer|erase|eraser)+$", S):
print("YES")
else:
print("NO")
| s = (
input()
.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
)
if s:
print("NO")
else:
print("YES")
| false | 61.538462 | [
"-import re",
"-",
"-S = eval(input())",
"-\"\"\"",
"-メタ文字:",
"-^ = 文字列の先頭、",
"-| = OR",
"-+ = 直前のパターンを1回以上繰り返し、",
"-$ = 文字列の末尾",
"-\"\"\"",
"-if re.match(\"^(dream|dreamer|erase|eraser)+$\", S):",
"+s = (",
"+ input()",
"+ .replace(\"eraser\", \"\")",
"+ .replace(\"erase\", \"\... | false | 0.043249 | 0.042027 | 1.029072 | [
"s340385734",
"s417595950"
] |
u223646582 | p03634 | python | s437119808 | s114705847 | 1,664 | 1,523 | 96,356 | 145,404 | Accepted | Accepted | 8.47 | from collections import deque
N = int(eval(input()))
G = [set() for i in range(N)]
for _ in range(N-1):
a, b, c = list(map(int, input().split()))
G[a-1].add((b, c))
G[b-1].add((a, c))
Q, K = list(map(int, input().split()))
visited = [False] * N
visited[K-1] = True
distance = [-1]*N
qu... | import sys
sys.setrecursionlimit(1000000)
N = int(eval(input()))
G = [set() for i in range(N)]
for _ in range(N-1):
a, b, c = list(map(int, input().split()))
G[a-1].add((b, c))
G[b-1].add((a, c))
Q, K = list(map(int, input().split()))
visited = [False] * N
visited[K-1] = True
distance =... | 30 | 34 | 624 | 649 | from collections import deque
N = int(eval(input()))
G = [set() for i in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a - 1].add((b, c))
G[b - 1].add((a, c))
Q, K = list(map(int, input().split()))
visited = [False] * N
visited[K - 1] = True
distance = [-1] * N
que = deque([(... | import sys
sys.setrecursionlimit(1000000)
N = int(eval(input()))
G = [set() for i in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a - 1].add((b, c))
G[b - 1].add((a, c))
Q, K = list(map(int, input().split()))
visited = [False] * N
visited[K - 1] = True
distance = [-1] * N
... | false | 11.764706 | [
"-from collections import deque",
"+import sys",
"+sys.setrecursionlimit(1000000)",
"-que = deque([(K, 0)])",
"-while que:",
"- cur, d = que.popleft()",
"- distance[cur - 1] = d",
"- for nx, nd in G[cur - 1]:",
"- if visited[nx - 1] is False:",
"- visited[nx - 1] = True"... | false | 0.114344 | 0.089388 | 1.279195 | [
"s437119808",
"s114705847"
] |
u138486156 | p03945 | python | s714308193 | s098404288 | 381 | 41 | 3,188 | 3,188 | Accepted | Accepted | 89.24 | s = eval(input())
ans = 0
while len(s):
c = s[0]
for i in range(len(s)):
if s[i] != c:
idx = i
break
idx2 = i
if idx2 == len(s)-1:
break
s = s[idx:]
ans += 1
print(ans)
| s = eval(input())
ans = 0
c = s[0]
for i in range(len(s)):
if s[i] != c:
ans += 1
c = s[i]
print(ans)
| 15 | 8 | 246 | 123 | s = eval(input())
ans = 0
while len(s):
c = s[0]
for i in range(len(s)):
if s[i] != c:
idx = i
break
idx2 = i
if idx2 == len(s) - 1:
break
s = s[idx:]
ans += 1
print(ans)
| s = eval(input())
ans = 0
c = s[0]
for i in range(len(s)):
if s[i] != c:
ans += 1
c = s[i]
print(ans)
| false | 46.666667 | [
"-while len(s):",
"- c = s[0]",
"- for i in range(len(s)):",
"- if s[i] != c:",
"- idx = i",
"- break",
"- idx2 = i",
"- if idx2 == len(s) - 1:",
"- break",
"- s = s[idx:]",
"- ans += 1",
"+c = s[0]",
"+for i in range(len(s)):",
"+ ... | false | 0.046753 | 0.037453 | 1.248328 | [
"s714308193",
"s098404288"
] |
u678167152 | p03045 | python | s107213896 | s662956869 | 491 | 302 | 109,760 | 81,484 | Accepted | Accepted | 38.49 | import sys
sys.setrecursionlimit(10**8)
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(M):
a,b,c = list(map(int, input().split()))
edge[a-1].append(b-1)
edge[b-1].append(a-1)
def dfs(v):
if len(edge[v])==0:
return 0
for u in edge[v]:
if visited[u]==Fa... | N, M = list(map(int, input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y)... | 26 | 39 | 497 | 756 | import sys
sys.setrecursionlimit(10**8)
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
def dfs(v):
if len(edge[v]) == 0:
return 0
for u in edge[v]:
... | N, M = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
... | false | 33.333333 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**8)",
"-edge = [[] for _ in range(N)]",
"-for i in range(M):",
"- a, b, c = list(map(int, input().split()))",
"- edge[a - 1].append(b - 1)",
"- edge[b - 1].append(a - 1)",
"-def dfs(v):",
"- if len(edge[v]) == 0:",
"- return 0",
... | false | 0.054449 | 0.041313 | 1.317966 | [
"s107213896",
"s662956869"
] |
u047796752 | p02687 | python | s781418957 | s088153636 | 73 | 61 | 64,576 | 61,852 | Accepted | Accepted | 16.44 | from collections import *
S = eval(input())
if S=='ABC':
print('ARC')
else:
print('ABC') | S = eval(input())
if S=='ABC':
print('ARC')
else:
print('ABC') | 8 | 6 | 99 | 70 | from collections import *
S = eval(input())
if S == "ABC":
print("ARC")
else:
print("ABC")
| S = eval(input())
if S == "ABC":
print("ARC")
else:
print("ABC")
| false | 25 | [
"-from collections import *",
"-"
] | false | 0.039776 | 0.1068 | 0.372435 | [
"s781418957",
"s088153636"
] |
u780025254 | p02401 | python | s443436509 | s526785673 | 30 | 20 | 7,448 | 5,596 | Accepted | Accepted | 33.33 | while True:
data = eval(input())
if '?' in data:
break
print((eval(data.replace('/', '//')))) | while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == "?":
break
elif op == "+":
print((a + b))
elif op == "-":
print((a - b))
elif op == "*":
print((a * b))
elif op == "/":
print((a // b))
| 5 | 15 | 109 | 285 | while True:
data = eval(input())
if "?" in data:
break
print((eval(data.replace("/", "//"))))
| while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == "?":
break
elif op == "+":
print((a + b))
elif op == "-":
print((a - b))
elif op == "*":
print((a * b))
elif op == "/":
print((a // b))
| false | 66.666667 | [
"- data = eval(input())",
"- if \"?\" in data:",
"+ a, op, b = input().split()",
"+ a = int(a)",
"+ b = int(b)",
"+ if op == \"?\":",
"- print((eval(data.replace(\"/\", \"//\"))))",
"+ elif op == \"+\":",
"+ print((a + b))",
"+ elif op == \"-\":",
"+ prin... | false | 0.176145 | 0.039654 | 4.442008 | [
"s443436509",
"s526785673"
] |
u644907318 | p02888 | python | s840392899 | s796391884 | 1,572 | 638 | 48,744 | 75,288 | Accepted | Accepted | 59.41 | from bisect import bisect_left,bisect_right
from itertools import combinations
N = int(eval(input()))
L = sorted(list(map(int,input().split())))
cnt = 0
for x in combinations(list(range(N)),2):
i,j = x[0],x[1]
if j<i:
i,j = j,i
indr = bisect_left(L,L[i]+L[j])
indl = bisect_right(L,abs(... | from bisect import bisect_right,bisect_left
N = int(eval(input()))
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N-1):
for j in range(i+1,N):
a = L[i]
b = L[j]
indU = bisect_left(L,a+b)
indL = bisect_right(L,b-a)
if j<indU and i>= indL:
... | 20 | 17 | 571 | 513 | from bisect import bisect_left, bisect_right
from itertools import combinations
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
cnt = 0
for x in combinations(list(range(N)), 2):
i, j = x[0], x[1]
if j < i:
i, j = j, i
indr = bisect_left(L, L[i] + L[j])
indl = bisect_right(L, ... | from bisect import bisect_right, bisect_left
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
cnt = 0
for i in range(N - 1):
for j in range(i + 1, N):
a = L[i]
b = L[j]
indU = bisect_left(L, a + b)
indL = bisect_right(L, b - a)
if j < indU and i >= indL:
... | false | 15 | [
"-from bisect import bisect_left, bisect_right",
"-from itertools import combinations",
"+from bisect import bisect_right, bisect_left",
"-for x in combinations(list(range(N)), 2):",
"- i, j = x[0], x[1]",
"- if j < i:",
"- i, j = j, i",
"- indr = bisect_left(L, L[i] + L[j])",
"- ... | false | 0.03966 | 0.035542 | 1.115871 | [
"s840392899",
"s796391884"
] |
u185896732 | p03087 | python | s285356478 | s479501738 | 842 | 289 | 6,060 | 6,640 | Accepted | Accepted | 65.68 | n,q=list(map(int,input().split()))
s=eval(input())
ac=[0]*(n)
for i in range(len(s)-1):
if s[i]=="A" and s[i+1]=="C":
ac[i+1]=ac[i]+1
else:
ac[i+1]=ac[i]
#print(ac)
# 01122233
# ACACTACG
for i in range(q):
l,r=list(map(int,input().split()))
#print(ac[l:r])
print((ac[r-1... | #import pysnooper
#import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy
setrecursionlimit(10**6)
... | 15 | 22 | 311 | 597 | n, q = list(map(int, input().split()))
s = eval(input())
ac = [0] * (n)
for i in range(len(s) - 1):
if s[i] == "A" and s[i + 1] == "C":
ac[i + 1] = ac[i] + 1
else:
ac[i + 1] = ac[i]
# print(ac)
# 01122233
# ACACTACG
for i in range(q):
l, r = list(map(int, input().split()))
# print(ac[l:r... | # import pysnooper
# import os,re,sys,operator,math,heapq,string
from collections import Counter, deque
# from operator import itemgetter
# from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin, setrecursionlimit
# from copy import deepcopy
setrecursionlimit(10**6)
... | false | 31.818182 | [
"+# import pysnooper",
"+# import os,re,sys,operator,math,heapq,string",
"+from collections import Counter, deque",
"+",
"+# from operator import itemgetter",
"+# from itertools import accumulate,combinations,groupby,combinations_with_replacement",
"+from sys import stdin, setrecursionlimit",
"+",
"... | false | 0.007318 | 0.03481 | 0.210241 | [
"s285356478",
"s479501738"
] |
u200887663 | p02946 | python | s946087374 | s708078274 | 33 | 18 | 3,064 | 3,060 | Accepted | Accepted | 45.45 | k,x=list(map(int,input().split()))
right= (1000000)*(-1)
left=1000000
al=[]
for i in range(x-(k-1),x+1):
if i<right or left<i:
continue
for j in range(k):
t=i+j
if (i+j in al)!=True and (t<right)==False and (left <t)==False:
al.append(i+j)
al.sort()
print((*al))
| #n=int(input())
k,x=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
l=[i for i in range(max(x-k+1,-1000000),min(x+k-1,1000000)+1)]
print(*l,sep=" ")
| 19 | 8 | 303 | 223 | k, x = list(map(int, input().split()))
right = (1000000) * (-1)
left = 1000000
al = []
for i in range(x - (k - 1), x + 1):
if i < right or left < i:
continue
for j in range(k):
t = i + j
if (i + j in al) != True and (t < right) == False and (left < t) == False:
al.append(i + ... | # n=int(input())
k, x = map(int, input().split())
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
l = [i for i in range(max(x - k + 1, -1000000), min(x + k - 1, 1000000) + 1)]
print(*l, sep=" ")
| false | 57.894737 | [
"-k, x = list(map(int, input().split()))",
"-right = (1000000) * (-1)",
"-left = 1000000",
"-al = []",
"-for i in range(x - (k - 1), x + 1):",
"- if i < right or left < i:",
"- continue",
"- for j in range(k):",
"- t = i + j",
"- if (i + j in al) != True and (t < right) ... | false | 0.105412 | 0.046789 | 2.252912 | [
"s946087374",
"s708078274"
] |
u651235280 | p03127 | python | s785069670 | s059208002 | 174 | 142 | 19,932 | 22,328 | Accepted | Accepted | 18.39 | import sys
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
heapify(a)
while len(a) != 1:
f = heappop(a)
s = heappop(a)
s %= f
if s != 0:
heappush(a, s)
heappush(... | import sys
from fractions import gcd
# from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
g = a[0]
for i in range(1, n):
g = gcd(g, a[i])
print(g)
# heapify(a)
# while len(a) != 1:
# f... | 19 | 23 | 341 | 451 | import sys
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
heapify(a)
while len(a) != 1:
f = heappop(a)
s = heappop(a)
s %= f
if s != 0:
heappush(a, s)
heappush(a, f)
print((heapp... | import sys
from fractions import gcd
# from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
g = a[0]
for i in range(1, n):
g = gcd(g, a[i])
print(g)
# heapify(a)
# while len(a) != 1:
# f = heappop(a)
# ... | false | 17.391304 | [
"-from heapq import heapify, heappop, heappush",
"+from fractions import gcd",
"+# from heapq import heapify, heappop, heappush",
"-heapify(a)",
"-while len(a) != 1:",
"- f = heappop(a)",
"- s = heappop(a)",
"- s %= f",
"- if s != 0:",
"- heappush(a, s)",
"- heappush(a, f)"... | false | 0.04648 | 0.04932 | 0.942423 | [
"s785069670",
"s059208002"
] |
u969850098 | p02983 | python | s676620586 | s820168236 | 752 | 57 | 3,064 | 3,064 | Accepted | Accepted | 92.42 | def main():
L, R = list(map(int, input().split()))
if R // 2019 > L // 2019:
print((0))
return
retval = 2019
for i in range(L, R):
for j in range(i+1, R+1):
retval = min(retval, (i % 2019 * j % 2019) % 2019)
print(retval)
return
if __name__ ==... | def main():
L, R = list(map(int, input().split()))
if R // 2019 > L // 2019:
print((0))
return
retval = 2019
for i in range(L, R):
for j in range(i+1, R+1):
retval = min(retval, (i % 2019 * j % 2019) % 2019)
if retval == 0:
print(... | 14 | 18 | 336 | 429 | def main():
L, R = list(map(int, input().split()))
if R // 2019 > L // 2019:
print((0))
return
retval = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
retval = min(retval, (i % 2019 * j % 2019) % 2019)
print(retval)
return
if __name__ == "__main__"... | def main():
L, R = list(map(int, input().split()))
if R // 2019 > L // 2019:
print((0))
return
retval = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
retval = min(retval, (i % 2019 * j % 2019) % 2019)
if retval == 0:
print((0))
... | false | 22.222222 | [
"+ if retval == 0:",
"+ print((0))",
"+ return"
] | false | 0.068221 | 0.036404 | 1.873982 | [
"s676620586",
"s820168236"
] |
u905203728 | p02792 | python | s841923781 | s138330521 | 200 | 183 | 3,064 | 3,064 | Accepted | Accepted | 8.5 | n=int(eval(input()))
A=[[0 for i in range(9)] for j in range(9)]
for i in range(1,n+1):
if i%10!=0:
num=str(i)
A[int(num[0])-1][int(num[-1])-1] +=1
cnt=0
for i in range(9):
for j in range(9):
cnt +=A[i][j]*A[j][i]
print(cnt) | n=int(eval(input()))
A=[[0 for i in range(10)] for j in range(10)]
for i in range(1,n+1):
num=str(i)
A[int(num[0])][int(num[-1])] +=1
ans=0
for i in range(1,10):
for j in range(1,10):
ans +=A[i][j]*A[j][i]
print(ans) | 14 | 13 | 266 | 253 | n = int(eval(input()))
A = [[0 for i in range(9)] for j in range(9)]
for i in range(1, n + 1):
if i % 10 != 0:
num = str(i)
A[int(num[0]) - 1][int(num[-1]) - 1] += 1
cnt = 0
for i in range(9):
for j in range(9):
cnt += A[i][j] * A[j][i]
print(cnt)
| n = int(eval(input()))
A = [[0 for i in range(10)] for j in range(10)]
for i in range(1, n + 1):
num = str(i)
A[int(num[0])][int(num[-1])] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += A[i][j] * A[j][i]
print(ans)
| false | 7.142857 | [
"-A = [[0 for i in range(9)] for j in range(9)]",
"+A = [[0 for i in range(10)] for j in range(10)]",
"- if i % 10 != 0:",
"- num = str(i)",
"- A[int(num[0]) - 1][int(num[-1]) - 1] += 1",
"-cnt = 0",
"-for i in range(9):",
"- for j in range(9):",
"- cnt += A[i][j] * A[j][i... | false | 0.048509 | 0.046546 | 1.042165 | [
"s841923781",
"s138330521"
] |
u223646582 | p03295 | python | s242191062 | s049850178 | 909 | 681 | 58,840 | 57,560 | Accepted | Accepted | 25.08 | N, M = list(map(int, input().split()))
AB = []
for _ in range(M):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB = sorted(AB, key=lambda x: (x[1], x[0]))
ans = 1
D = AB[0][1]
for i in range(1, M):
if AB[i][0] >= D:
ans += 1
D = AB[i][1]
print(ans)
| N, M = list(map(int, input().split()))
AB = []
for _ in range(M):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB = sorted(AB, key=lambda x: x[1])
ans = 1
D = AB[0][1]
for i in range(1, M):
if AB[i][0] >= D:
ans += 1
D = AB[i][1]
print(ans)
| 15 | 15 | 293 | 285 | N, M = list(map(int, input().split()))
AB = []
for _ in range(M):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB = sorted(AB, key=lambda x: (x[1], x[0]))
ans = 1
D = AB[0][1]
for i in range(1, M):
if AB[i][0] >= D:
ans += 1
D = AB[i][1]
print(ans)
| N, M = list(map(int, input().split()))
AB = []
for _ in range(M):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB = sorted(AB, key=lambda x: x[1])
ans = 1
D = AB[0][1]
for i in range(1, M):
if AB[i][0] >= D:
ans += 1
D = AB[i][1]
print(ans)
| false | 0 | [
"-AB = sorted(AB, key=lambda x: (x[1], x[0]))",
"+AB = sorted(AB, key=lambda x: x[1])"
] | false | 0.06943 | 0.048451 | 1.432997 | [
"s242191062",
"s049850178"
] |
u227082700 | p03078 | python | s375408106 | s088922517 | 963 | 805 | 156,636 | 152,792 | Accepted | Accepted | 16.41 | x,y,z,k=list(map(int,input().split()));a,b,c=list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))
aa=[]
for i in a:
for j in b:aa.append(i+j)
aa.sort(reverse=1)
aa=aa[:k+1]
s=[]
for i in aa:
for j in c:s.append(i+j)
s.sort(reverse=1)
for i in range(k):print((s[i])) | from heapq import heappop,heappush;import sys;input=sys.stdin.readline
x,y,z,k=list(map(int,input().split()));a,b,c=list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))
q,h,l=[],[],0
for i in a:
for j in b:heappush(q,-(i+j));l+=1
for _ in range(min(l,k)):
t=heappop(q)
... | 11 | 9 | 311 | 380 | x, y, z, k = list(map(int, input().split()))
a, b, c = (
list(map(int, input().split())),
list(map(int, input().split())),
list(map(int, input().split())),
)
aa = []
for i in a:
for j in b:
aa.append(i + j)
aa.sort(reverse=1)
aa = aa[: k + 1]
s = []
for i in aa:
for j in c:
s.append(... | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
x, y, z, k = list(map(int, input().split()))
a, b, c = (
list(map(int, input().split())),
list(map(int, input().split())),
list(map(int, input().split())),
)
q, h, l = [], [], 0
for i in a:
for j in b:
heappush(q, -(i + j... | false | 18.181818 | [
"+from heapq import heappop, heappush",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-aa = []",
"+q, h, l = [], [], 0",
"- aa.append(i + j)",
"-aa.sort(reverse=1)",
"-aa = aa[: k + 1]",
"-s = []",
"-for i in aa:",
"- for j in c:",
"- s.append(i + j)",
"-s.sort(rever... | false | 0.039001 | 0.086449 | 0.451144 | [
"s375408106",
"s088922517"
] |
u768896740 | p02861 | python | s243333023 | s431804227 | 351 | 18 | 7,972 | 3,188 | Accepted | Accepted | 94.87 | import itertools
import math
n = int(eval(input()))
li = []
for i in range(n):
a = list(map(int, input().split()))
li.append(a)
p_list = list(itertools.permutations(li, n))
def cal_distance(lis):
dis = 0
for i in range(n-1):
dis += math.sqrt((lis[i+1][0]-lis[i][0])**2 + (lis[i... | from itertools import combinations
import math
n = int(eval(input()))
towns = []
for _ in range(n):
array = list(map(int, input().split()))
towns.append(array)
distances = [[0 for _ in range(n)] for _ in range(n)]
town_num = list(range(n))
for i, j in combinations(town_num, 2):
dista... | 23 | 30 | 489 | 630 | import itertools
import math
n = int(eval(input()))
li = []
for i in range(n):
a = list(map(int, input().split()))
li.append(a)
p_list = list(itertools.permutations(li, n))
def cal_distance(lis):
dis = 0
for i in range(n - 1):
dis += math.sqrt(
(lis[i + 1][0] - lis[i][0]) ** 2 + (... | from itertools import combinations
import math
n = int(eval(input()))
towns = []
for _ in range(n):
array = list(map(int, input().split()))
towns.append(array)
distances = [[0 for _ in range(n)] for _ in range(n)]
town_num = list(range(n))
for i, j in combinations(town_num, 2):
distance = (
(towns[... | false | 23.333333 | [
"-import itertools",
"+from itertools import combinations",
"-li = []",
"+towns = []",
"+for _ in range(n):",
"+ array = list(map(int, input().split()))",
"+ towns.append(array)",
"+distances = [[0 for _ in range(n)] for _ in range(n)]",
"+town_num = list(range(n))",
"+for i, j in combinatio... | false | 0.041257 | 0.039708 | 1.039019 | [
"s243333023",
"s431804227"
] |
u894258749 | p03207 | python | s310417729 | s082276144 | 1,127 | 18 | 21,788 | 2,940 | Accepted | Accepted | 98.4 | import numpy as np
N = int(eval(input()))
p = np.array([ int(eval(input())) for i in range(N)])
p.sort()
print((p.sum() - p[-1]//2)) | N = int(eval(input()))
p = []
for _ in range(N):
p.append(int(eval(input())))
print((sum(p) - max(p)//2)) | 5 | 5 | 122 | 99 | import numpy as np
N = int(eval(input()))
p = np.array([int(eval(input())) for i in range(N)])
p.sort()
print((p.sum() - p[-1] // 2))
| N = int(eval(input()))
p = []
for _ in range(N):
p.append(int(eval(input())))
print((sum(p) - max(p) // 2))
| false | 0 | [
"-import numpy as np",
"-",
"-p = np.array([int(eval(input())) for i in range(N)])",
"-p.sort()",
"-print((p.sum() - p[-1] // 2))",
"+p = []",
"+for _ in range(N):",
"+ p.append(int(eval(input())))",
"+print((sum(p) - max(p) // 2))"
] | false | 0.257978 | 0.058097 | 4.440458 | [
"s310417729",
"s082276144"
] |
u729133443 | p02936 | python | s253941507 | s832871604 | 1,962 | 863 | 108,308 | 94,828 | Accepted | Accepted | 56.01 | I=lambda:list(map(int,input().split()))
n,q=I()
e=[[]for _ in range(n)]
d=[0]*n
for _ in range(n-1):
a,b=I()
e[a-1]+=b-1,
e[b-1]+=a-1,
for _ in range(q):
p,x=I()
d[p-1]+=x
f=[1]+[0]*n
q=[0]
while q:
v=q.pop()
for w in e[v]:
if f[w]:continue
f[w]=1
d[... | n,q,*t=list(map(int,open(0).read().split()))
e=[[]for _ in[0]*n]
s=[0]
d=s*n
f=[1]+s*n
for a,b in zip(*[iter(t[:-q-q])]*2):
e[a-1]+=b-1,
e[b-1]+=a-1,
for p,x in zip(*[iter(t[-q-q:])]*2):d[p-1]+=x
while s:
v=s.pop()
for w in e[v]:
if f[w]:continue
f[w]=1
d[w]+=d[v]
s+=w,
print((*d... | 21 | 17 | 348 | 314 | I = lambda: list(map(int, input().split()))
n, q = I()
e = [[] for _ in range(n)]
d = [0] * n
for _ in range(n - 1):
a, b = I()
e[a - 1] += (b - 1,)
e[b - 1] += (a - 1,)
for _ in range(q):
p, x = I()
d[p - 1] += x
f = [1] + [0] * n
q = [0]
while q:
v = q.pop()
for w in e[v]:
if f[w]:... | n, q, *t = list(map(int, open(0).read().split()))
e = [[] for _ in [0] * n]
s = [0]
d = s * n
f = [1] + s * n
for a, b in zip(*[iter(t[: -q - q])] * 2):
e[a - 1] += (b - 1,)
e[b - 1] += (a - 1,)
for p, x in zip(*[iter(t[-q - q :])] * 2):
d[p - 1] += x
while s:
v = s.pop()
for w in e[v]:
if f... | false | 19.047619 | [
"-I = lambda: list(map(int, input().split()))",
"-n, q = I()",
"-e = [[] for _ in range(n)]",
"-d = [0] * n",
"-for _ in range(n - 1):",
"- a, b = I()",
"+n, q, *t = list(map(int, open(0).read().split()))",
"+e = [[] for _ in [0] * n]",
"+s = [0]",
"+d = s * n",
"+f = [1] + s * n",
"+for a,... | false | 0.039235 | 0.035702 | 1.09894 | [
"s253941507",
"s832871604"
] |
u238084414 | p02952 | python | s983107383 | s898009625 | 64 | 18 | 3,064 | 3,060 | Accepted | Accepted | 71.88 | N = int(eval(input()))
i = 1
cnt = 0
while i <= N:
cnt += 1
i += 1
if len(str(i)) % 2 == 0:
i *= 10
print(cnt) | N = int(eval(input()))
cnt = 0
i = 0
for i in range(0, 5, 2):
m = 10 ** i
if len(str(m)) > len(str(N)):
break
M = int("9" * (i + 1))
if M > N:
M = N
cnt += M - m + 1
print(cnt) | 11 | 16 | 126 | 211 | N = int(eval(input()))
i = 1
cnt = 0
while i <= N:
cnt += 1
i += 1
if len(str(i)) % 2 == 0:
i *= 10
print(cnt)
| N = int(eval(input()))
cnt = 0
i = 0
for i in range(0, 5, 2):
m = 10**i
if len(str(m)) > len(str(N)):
break
M = int("9" * (i + 1))
if M > N:
M = N
cnt += M - m + 1
print(cnt)
| false | 31.25 | [
"-i = 1",
"-while i <= N:",
"- cnt += 1",
"- i += 1",
"- if len(str(i)) % 2 == 0:",
"- i *= 10",
"+i = 0",
"+for i in range(0, 5, 2):",
"+ m = 10**i",
"+ if len(str(m)) > len(str(N)):",
"+ break",
"+ M = int(\"9\" * (i + 1))",
"+ if M > N:",
"+ M =... | false | 0.073204 | 0.037582 | 1.947839 | [
"s983107383",
"s898009625"
] |
u879870653 | p03206 | python | s277865796 | s635913020 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | N = int(eval(input()))
if N == 25 :
print("Christmas")
elif N == 24 :
print("Christmas Eve")
elif N == 23 :
print("Christmas Eve Eve")
elif N == 22 :
print("Christmas Eve Eve Eve")
| N = int(eval(input()))
plus = " Eve"
ans = "Christmas" + plus*(25-N)
print(ans)
| 9 | 4 | 199 | 77 | N = int(eval(input()))
if N == 25:
print("Christmas")
elif N == 24:
print("Christmas Eve")
elif N == 23:
print("Christmas Eve Eve")
elif N == 22:
print("Christmas Eve Eve Eve")
| N = int(eval(input()))
plus = " Eve"
ans = "Christmas" + plus * (25 - N)
print(ans)
| false | 55.555556 | [
"-if N == 25:",
"- print(\"Christmas\")",
"-elif N == 24:",
"- print(\"Christmas Eve\")",
"-elif N == 23:",
"- print(\"Christmas Eve Eve\")",
"-elif N == 22:",
"- print(\"Christmas Eve Eve Eve\")",
"+plus = \" Eve\"",
"+ans = \"Christmas\" + plus * (25 - N)",
"+print(ans)"
] | false | 0.036163 | 0.037116 | 0.974327 | [
"s277865796",
"s635913020"
] |
u745087332 | p03240 | python | s951178409 | s446653402 | 1,597 | 30 | 3,064 | 3,064 | Accepted | Accepted | 98.12 | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
def solve():
for x in range(101):
for y in range(101):
for h in range(h_min, h_min + 201):
for i in range(N):
if D[i][0] != max(h - abs(D[i][1] - x) - abs(D[... | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
def solve():
for cx in range(101):
for cy in range(101):
ch = D[0][0] + abs(D[0][1] - cx) + abs(D[0][2] - cy)
for h, x, y in D:
if h != max(ch - (abs(x - cx) + abs(y... | 29 | 29 | 651 | 645 | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
def solve():
for x in range(101):
for y in range(101):
for h in range(h_min, h_min + 201):
for i in range(N):
if D[i][0] != max(h - abs(D[i][1] - x) - abs(D[i][2] - y)... | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
def solve():
for cx in range(101):
for cy in range(101):
ch = D[0][0] + abs(D[0][1] - cx) + abs(D[0][2] - cy)
for h, x, y in D:
if h != max(ch - (abs(x - cx) + abs(y - cy)), 0... | false | 0 | [
"- for x in range(101):",
"- for y in range(101):",
"- for h in range(h_min, h_min + 201):",
"- for i in range(N):",
"- if D[i][0] != max(h - abs(D[i][1] - x) - abs(D[i][2] - y), 0):",
"- break",
"- else:",
"-... | false | 0.701662 | 0.049644 | 14.133864 | [
"s951178409",
"s446653402"
] |
u562016607 | p03294 | python | s504018176 | s010164568 | 55 | 20 | 3,316 | 3,316 | Accepted | Accepted | 63.64 | N=int(eval(input()))
A=[int(i) for i in input().split()]
ans=0
for i in range(N):
ans+=A[i]-1
print(ans)
| N=int(eval(input()))
A=[int(i) for i in input().split()]
print((sum(A)-N))
| 6 | 3 | 108 | 69 | N = int(eval(input()))
A = [int(i) for i in input().split()]
ans = 0
for i in range(N):
ans += A[i] - 1
print(ans)
| N = int(eval(input()))
A = [int(i) for i in input().split()]
print((sum(A) - N))
| false | 50 | [
"-ans = 0",
"-for i in range(N):",
"- ans += A[i] - 1",
"-print(ans)",
"+print((sum(A) - N))"
] | false | 0.065538 | 0.04607 | 1.42258 | [
"s504018176",
"s010164568"
] |
u472696272 | p02899 | python | s935681296 | s615845513 | 243 | 201 | 21,196 | 13,880 | Accepted | Accepted | 17.28 | n = int(input())
l = list(map(int, input().split()))
ans = [0]*n
for a in list(enumerate(l)):
a = list(a)
ans[a[1]-1] = a[0]+1
for _ in ans:
print(_, ' ', end='')
| n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i,j in enumerate(a,start=1):
ans[j-1] = i
for i in range(n):
print(ans[i],' ', end='')
| 10 | 7 | 179 | 165 | n = int(input())
l = list(map(int, input().split()))
ans = [0] * n
for a in list(enumerate(l)):
a = list(a)
ans[a[1] - 1] = a[0] + 1
for _ in ans:
print(_, " ", end="")
| n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i, j in enumerate(a, start=1):
ans[j - 1] = i
for i in range(n):
print(ans[i], " ", end="")
| false | 30 | [
"-l = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"-for a in list(enumerate(l)):",
"- a = list(a)",
"- ans[a[1] - 1] = a[0] + 1",
"-for _ in ans:",
"- print(_, \" \", end=\"\")",
"+for i, j in enumerate(a, start=1):",
"+ ans[j - 1] = i",
"+for i in range(n... | false | 0.04563 | 0.046009 | 0.991752 | [
"s935681296",
"s615845513"
] |
u252828980 | p03286 | python | s888951429 | s827247519 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n=int(eval(input()))
if n == 0:
print((0))
k=-2
bi=''
while n!=0:
bi+=str(n%abs(k))
if k<0:n=-(-n//k)
else:n=n//k
print((bi[::-1])) | n=int(eval(input()))
if n == 0:
print((0))
s = ""
while n != 0:
if n%2 == 0:
s = "0" + s
elif n%2 == 1:
n -= 1
s = "1" +s
n = (n//-2)
print(s) | 10 | 15 | 146 | 199 | n = int(eval(input()))
if n == 0:
print((0))
k = -2
bi = ""
while n != 0:
bi += str(n % abs(k))
if k < 0:
n = -(-n // k)
else:
n = n // k
print((bi[::-1]))
| n = int(eval(input()))
if n == 0:
print((0))
s = ""
while n != 0:
if n % 2 == 0:
s = "0" + s
elif n % 2 == 1:
n -= 1
s = "1" + s
n = n // -2
print(s)
| false | 33.333333 | [
"-k = -2",
"-bi = \"\"",
"+s = \"\"",
"- bi += str(n % abs(k))",
"- if k < 0:",
"- n = -(-n // k)",
"- else:",
"- n = n // k",
"-print((bi[::-1]))",
"+ if n % 2 == 0:",
"+ s = \"0\" + s",
"+ elif n % 2 == 1:",
"+ n -= 1",
"+ s = \"1\" + s",... | false | 0.045791 | 0.046276 | 0.989525 | [
"s888951429",
"s827247519"
] |
u831244171 | p02265 | python | s985292989 | s845990116 | 3,890 | 1,580 | 71,796 | 214,284 | Accepted | Accepted | 59.38 | from collections import deque
n = int(eval(input()))
Q = deque()
for i in range(n):
command = input().split()
if command[0] == "insert":
Q.appendleft(command[1])
elif command[0] == "deleteFirst":
Q.popleft()
elif command[0] == "deleteLast":
Q.pop()
elif command[0... | import sys
from collections import deque
n = int(sys.stdin.readline())
lines = sys.stdin.readlines()
Q = deque()
for i in range(n):
command = lines[i].split()
if command[0] == "insert":
Q.appendleft(command[1])
elif command[0] == "deleteFirst":
Q.popleft()
elif command[0] ==... | 18 | 20 | 431 | 488 | from collections import deque
n = int(eval(input()))
Q = deque()
for i in range(n):
command = input().split()
if command[0] == "insert":
Q.appendleft(command[1])
elif command[0] == "deleteFirst":
Q.popleft()
elif command[0] == "deleteLast":
Q.pop()
elif command[0] == "delete... | import sys
from collections import deque
n = int(sys.stdin.readline())
lines = sys.stdin.readlines()
Q = deque()
for i in range(n):
command = lines[i].split()
if command[0] == "insert":
Q.appendleft(command[1])
elif command[0] == "deleteFirst":
Q.popleft()
elif command[0] == "deleteLast... | false | 10 | [
"+import sys",
"-n = int(eval(input()))",
"+n = int(sys.stdin.readline())",
"+lines = sys.stdin.readlines()",
"- command = input().split()",
"+ command = lines[i].split()"
] | false | 0.034834 | 0.035499 | 0.981268 | [
"s985292989",
"s845990116"
] |
u318029285 | p03785 | python | s830596209 | s011149463 | 276 | 252 | 13,396 | 8,036 | Accepted | Accepted | 8.7 | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
bus = []
indexes = [i for i in range(N)]
sorted_indexes = sorted(indexes, key=lambda i: T[i])
count = 0
for i in range(N):
if count == 0:
first = T[sorted_indexes[i]]
count += 1
else:
if... | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
bus = []
count = 0
for i in range(N):
if count == 0:
first = T[i]
count += 1
else:
if T[i] - first <= K:
count += 1
else:
bus.append(count)
... | 28 | 27 | 603 | 478 | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
bus = []
indexes = [i for i in range(N)]
sorted_indexes = sorted(indexes, key=lambda i: T[i])
count = 0
for i in range(N):
if count == 0:
first = T[sorted_indexes[i]]
count += 1
else:
if T[sorted_indexes... | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
bus = []
count = 0
for i in range(N):
if count == 0:
first = T[i]
count += 1
else:
if T[i] - first <= K:
count += 1
else:
bus.append(count)
first = T[... | false | 3.571429 | [
"+T.sort()",
"-indexes = [i for i in range(N)]",
"-sorted_indexes = sorted(indexes, key=lambda i: T[i])",
"- first = T[sorted_indexes[i]]",
"+ first = T[i]",
"- if T[sorted_indexes[i]] - first <= K:",
"+ if T[i] - first <= K:",
"- first = T[sorted_indexes[i]]",
... | false | 0.042551 | 0.042792 | 0.994366 | [
"s830596209",
"s011149463"
] |
u720483676 | p03107 | python | s681696551 | s919583115 | 20 | 18 | 3,188 | 3,188 | Accepted | Accepted | 10 | s=eval(input())
print((min(s.count("1"),s.count("0"))*2)) | s=eval(input());print((min(s.count("0"),s.count("1"))*2)) | 2 | 1 | 50 | 49 | s = eval(input())
print((min(s.count("1"), s.count("0")) * 2))
| s = eval(input())
print((min(s.count("0"), s.count("1")) * 2))
| false | 50 | [
"-print((min(s.count(\"1\"), s.count(\"0\")) * 2))",
"+print((min(s.count(\"0\"), s.count(\"1\")) * 2))"
] | false | 0.04 | 0.041652 | 0.960327 | [
"s681696551",
"s919583115"
] |
u869265610 | p02813 | python | s617354512 | s424401197 | 42 | 38 | 13,772 | 9,136 | Accepted | Accepted | 9.52 | import itertools
N=int(eval(input()))
a=tuple(map(int,input().split()))
b=tuple(map(int,input().split()))
K=list(itertools.permutations(list(range(1,N+1))))
print((abs(K.index(a)-K.index(b)))) | import itertools as it
N=int(eval(input()))
W=list(range(1,N+1))
c1=-1
c2=-1
c=0
L=tuple(map(int,input().split()))
M=tuple(map(int,input().split()))
if L==M:
print((0))
exit()
for i in it.permutations(W,N):
c+=1
if i==L:
c1=c
elif i==M:
c2=c
print((abs(c1-c2))) | 6 | 18 | 183 | 286 | import itertools
N = int(eval(input()))
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
K = list(itertools.permutations(list(range(1, N + 1))))
print((abs(K.index(a) - K.index(b))))
| import itertools as it
N = int(eval(input()))
W = list(range(1, N + 1))
c1 = -1
c2 = -1
c = 0
L = tuple(map(int, input().split()))
M = tuple(map(int, input().split()))
if L == M:
print((0))
exit()
for i in it.permutations(W, N):
c += 1
if i == L:
c1 = c
elif i == M:
c2 = c
print((ab... | false | 66.666667 | [
"-import itertools",
"+import itertools as it",
"-a = tuple(map(int, input().split()))",
"-b = tuple(map(int, input().split()))",
"-K = list(itertools.permutations(list(range(1, N + 1))))",
"-print((abs(K.index(a) - K.index(b))))",
"+W = list(range(1, N + 1))",
"+c1 = -1",
"+c2 = -1",
"+c = 0",
... | false | 0.047815 | 0.047112 | 1.014903 | [
"s617354512",
"s424401197"
] |
u325956328 | p03163 | python | s409828485 | s709861328 | 402 | 220 | 118,512 | 15,464 | Accepted | Accepted | 45.27 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N, W = list(map(int, input().split()))
w = [0]
v = [0]
for i in range(N):
weight, value = list(map(int, input().split()))
w.append(weight)
v.append(value)
dp = [[0] * (W + 1) f... | import sys
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def main():
N, W = list(map(int, input().split()))
w = [0]
v = [0]
for i in range(N):
weight, value = list(map(int, input().split()))
w.append(weight)
v.append(value)
#... | 30 | 29 | 652 | 584 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def main():
N, W = list(map(int, input().split()))
w = [0]
v = [0]
for i in range(N):
weight, value = list(map(int, input().split()))
w.append(weight)
v.append(value)
dp = [[0] * (W + 1) for _ in range(N + ... | import sys
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def main():
N, W = list(map(int, input().split()))
w = [0]
v = [0]
for i in range(N):
weight, value = list(map(int, input().split()))
w.append(weight)
v.append(value)
# dp = [[0] * (W + 1... | false | 3.333333 | [
"+import numpy as np",
"- dp = [[0] * (W + 1) for _ in range(N + 1)]",
"+ # dp = [[0] * (W + 1) for _ in range(N + 1)]",
"+ dp = np.zeros(W + 1, dtype=np.int64)",
"- for j in range(1, W + 1):",
"- if j - w[i] < 0:",
"- dp[i][j] = dp[i - 1][j]",
"- e... | false | 0.049029 | 0.356341 | 0.137591 | [
"s409828485",
"s709861328"
] |
u073549161 | p03671 | python | s075337504 | s906740448 | 165 | 18 | 38,384 | 2,940 | Accepted | Accepted | 89.09 | a,b,c = list(map(int, input().split()))
if a == max(a, b, c):
print((b + c))
elif b == max(a, b, c):
print((a + c))
elif c == max(a, b, c):
print((a+b))
| a,b,c = list(map(int, input().split()))
s = list([a,b,c])
s.sort()
print((s[0] + s[1])) | 7 | 4 | 159 | 82 | a, b, c = list(map(int, input().split()))
if a == max(a, b, c):
print((b + c))
elif b == max(a, b, c):
print((a + c))
elif c == max(a, b, c):
print((a + b))
| a, b, c = list(map(int, input().split()))
s = list([a, b, c])
s.sort()
print((s[0] + s[1]))
| false | 42.857143 | [
"-if a == max(a, b, c):",
"- print((b + c))",
"-elif b == max(a, b, c):",
"- print((a + c))",
"-elif c == max(a, b, c):",
"- print((a + b))",
"+s = list([a, b, c])",
"+s.sort()",
"+print((s[0] + s[1]))"
] | false | 0.21752 | 0.04389 | 4.95598 | [
"s075337504",
"s906740448"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.