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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u704703586 | p03389 | python | s217555713 | s843994233 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | def noofrupees(x,y,z):
if(x==y and x==z):
return 0
elif(x==y):
if(x<z):
return z-x
else:
if(x%2==0 and z%2==0):
return int((x-z)/2)
elif(x%2!=0 and z%2!=0):
return int((x-z)/2)
else:
... | #t=int(input())
t=1
for i in range(t):
x,y,z=list(map(int,input().split()))
ma=max(x,y,z)
mi=min(x,y,z)
if(x==ma):
if(y<z):
m=x-y
n=x-z
else:
m=x-z
n=x-y
elif(y==ma):
if(x<z):
m=y-x
n=y-z
else:
m=y-z
n=y-x
else:
if(x<y):
m=z-x
n=z-y
else:
m=z-y... | 58 | 32 | 1,432 | 386 | def noofrupees(x, y, z):
if x == y and x == z:
return 0
elif x == y:
if x < z:
return z - x
else:
if x % 2 == 0 and z % 2 == 0:
return int((x - z) / 2)
elif x % 2 != 0 and z % 2 != 0:
return int((x - z) / 2)
... | # t=int(input())
t = 1
for i in range(t):
x, y, z = list(map(int, input().split()))
ma = max(x, y, z)
mi = min(x, y, z)
if x == ma:
if y < z:
m = x - y
n = x - z
else:
m = x - z
n = x - y
elif y == ma:
if x < z:
m = ... | false | 44.827586 | [
"-def noofrupees(x, y, z):",
"- if x == y and x == z:",
"- return 0",
"- elif x == y:",
"+# t=int(input())",
"+t = 1",
"+for i in range(t):",
"+ x, y, z = list(map(int, input().split()))",
"+ ma = max(x, y, z)",
"+ mi = min(x, y, z)",
"+ if x == ma:",
"+ if y < ... | false | 0.034448 | 0.035131 | 0.980578 | [
"s217555713",
"s843994233"
] |
u766566560 | p03294 | python | s707422024 | s984133940 | 182 | 18 | 38,896 | 3,316 | Accepted | Accepted | 90.11 | # ans
N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
ans += a[i] - 1
print(ans) | N = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - N)) | 11 | 3 | 130 | 72 | # ans
N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
ans += a[i] - 1
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - N))
| false | 72.727273 | [
"-# ans",
"-ans = 0",
"-for i in range(N):",
"- ans += a[i] - 1",
"-print(ans)",
"+print((sum(a) - N))"
] | false | 0.121469 | 0.036043 | 3.370077 | [
"s707422024",
"s984133940"
] |
u761320129 | p03055 | python | s192838577 | s412212355 | 1,406 | 1,215 | 61,448 | 293,828 | Accepted | Accepted | 13.58 | N = int(eval(input()))
src = [tuple([int(x)-1 for x in input().split()]) for i in range(N-1)]
es = [[] for i in range(N)]
for a,b in src:
es[a].append(b)
es[b].append(a)
def farthest_node_and_dist(s):
dist = [N]*N
dist[s] = 0
stack = [s]
ret_node = -1
ret_dist = 0
while sta... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
N = int(eval(input()))
AB = [tuple(map(int,input().split())) for i in range(N-1)]
es = [[] for _ in range(N)]
for a,b in AB:
a,b = a-1,b-1
es[a].append(b)
es[b].append(a)
depth = [0] * N
def dfs(v,p=-1):
for to in es[v]:
... | 28 | 25 | 738 | 537 | N = int(eval(input()))
src = [tuple([int(x) - 1 for x in input().split()]) for i in range(N - 1)]
es = [[] for i in range(N)]
for a, b in src:
es[a].append(b)
es[b].append(a)
def farthest_node_and_dist(s):
dist = [N] * N
dist[s] = 0
stack = [s]
ret_node = -1
ret_dist = 0
while stack:
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
N = int(eval(input()))
AB = [tuple(map(int, input().split())) for i in range(N - 1)]
es = [[] for _ in range(N)]
for a, b in AB:
a, b = a - 1, b - 1
es[a].append(b)
es[b].append(a)
depth = [0] * N
def dfs(v, p=-1):
for to in es[v]:
... | false | 10.714286 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**8)",
"-src = [tuple([int(x) - 1 for x in input().split()]) for i in range(N - 1)]",
"-es = [[] for i in range(N)]",
"-for a, b in src:",
"+AB = [tuple(map(int, input().split())) for i in range(N - 1)]",
"+es = [[] for _ i... | false | 0.038205 | 0.037185 | 1.027429 | [
"s192838577",
"s412212355"
] |
u529012223 | p03127 | python | s418826200 | s305685448 | 96 | 87 | 16,240 | 14,756 | Accepted | Accepted | 9.38 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
ans = fractions.gcd(ans, A[i])
print(ans) | import math
from functools import reduce
def gcd(v1, v2):
if v1 == 0 or v2 == 0:
return max(v1, v2)
if v1 % v2 == 0:
return v2
return gcd(v2, v1%v2)
N = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(gcd, A))) | 9 | 14 | 162 | 267 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
ans = fractions.gcd(ans, A[i])
print(ans)
| import math
from functools import reduce
def gcd(v1, v2):
if v1 == 0 or v2 == 0:
return max(v1, v2)
if v1 % v2 == 0:
return v2
return gcd(v2, v1 % v2)
N = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(gcd, A)))
| false | 35.714286 | [
"-import fractions",
"+import math",
"+from functools import reduce",
"+",
"+",
"+def gcd(v1, v2):",
"+ if v1 == 0 or v2 == 0:",
"+ return max(v1, v2)",
"+ if v1 % v2 == 0:",
"+ return v2",
"+ return gcd(v2, v1 % v2)",
"+",
"-ans = A[0]",
"-for i in range(1, N):",
... | false | 0.062249 | 0.063924 | 0.973804 | [
"s418826200",
"s305685448"
] |
u285891772 | p02762 | python | s749397477 | s742823076 | 1,623 | 1,427 | 66,796 | 46,524 | Accepted | Accepted | 12.08 | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 105 | 91 | 3,202 | 2,819 | import sys, re
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from collections import deque, defaultdict, Counter
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from collections import deque, defaultdict, Counter
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 13.333333 | [
"-friends = defaultdict(list)",
"+friends = [[] for _ in range(N)]",
"-blocks = defaultdict(list)",
"+blocks = [[] for _ in range(N)]",
"- minus = 0",
"- for b in blocks[i]:",
"- if tree.same(i, b):",
"- minus += 1",
"- print(tree.size(i) - len(friends[i]) - 1 - minus, end... | false | 0.171607 | 0.050059 | 3.428114 | [
"s749397477",
"s742823076"
] |
u028973125 | p03013 | python | s666341568 | s744923174 | 243 | 86 | 52,312 | 17,184 | Accepted | Accepted | 64.61 | import sys
N, M = list(map(int, sys.stdin.readline().strip().split()))
A = set()
for _ in range(M):
A.add(int(sys.stdin.readline()))
# i段目の階段への到達方法の数
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 0 if 1 in A else 1
for i in range(2, N+1):
if i in A:
continue
dp[i] = dp[i-1] + dp[i... | import sys
mod = 1000000007
N, M = list(map(int, sys.stdin.readline().split()))
A = set()
for _ in range(M):
a = int(sys.stdin.readline())
A.add(a)
dp = [0] * (N+1)
dp[0] = 1
dp[1] = 0 if 1 in A else 1
for i in range(1, N):
if i+1 in A:
continue
dp[i+1] = dp[i] + dp[i-1]
... | 19 | 21 | 358 | 357 | import sys
N, M = list(map(int, sys.stdin.readline().strip().split()))
A = set()
for _ in range(M):
A.add(int(sys.stdin.readline()))
# i段目の階段への到達方法の数
dp = [0 for _ in range(N + 1)]
dp[0] = 1
dp[1] = 0 if 1 in A else 1
for i in range(2, N + 1):
if i in A:
continue
dp[i] = dp[i - 1] + dp[i - 2]
d... | import sys
mod = 1000000007
N, M = list(map(int, sys.stdin.readline().split()))
A = set()
for _ in range(M):
a = int(sys.stdin.readline())
A.add(a)
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in A else 1
for i in range(1, N):
if i + 1 in A:
continue
dp[i + 1] = dp[i] + dp[i - 1]
dp[i + 1] %... | false | 9.52381 | [
"-N, M = list(map(int, sys.stdin.readline().strip().split()))",
"+mod = 1000000007",
"+N, M = list(map(int, sys.stdin.readline().split()))",
"- A.add(int(sys.stdin.readline()))",
"-# i段目の階段への到達方法の数",
"-dp = [0 for _ in range(N + 1)]",
"+ a = int(sys.stdin.readline())",
"+ A.add(a)",
"+dp = ... | false | 0.043468 | 0.037473 | 1.160001 | [
"s666341568",
"s744923174"
] |
u707498674 | p03436 | python | s529025981 | s421502942 | 24 | 22 | 3,316 | 3,316 | Accepted | Accepted | 8.33 | from collections import deque
MAX_VAL = 10 ** 9
H, W = map(int, input().split())
border_row = "#"*(W+2)
field = [border_row]
num_blacks = 0
for i in range(H):
line = input()
num_blacks += line.count(".")
field.append("#"+line+"#")
field.append(border_row)
cost = [[MAX_VAL]*(W+2) for _... | import sys
from collections import deque
def input():return sys.stdin.readline().strip()
def main():
H, W = list(map(int, input().split()))
field = "#" * (W+2)
field += "#" + "##".join([eval(input()) for _ in range(H)]) + "#"
field += "#" * (W+2)
move = [-1, 1, -(W+2), W+2]
co... | 40 | 41 | 985 | 950 | from collections import deque
MAX_VAL = 10**9
H, W = map(int, input().split())
border_row = "#" * (W + 2)
field = [border_row]
num_blacks = 0
for i in range(H):
line = input()
num_blacks += line.count(".")
field.append("#" + line + "#")
field.append(border_row)
cost = [[MAX_VAL] * (W + 2) for _ in range(H ... | import sys
from collections import deque
def input():
return sys.stdin.readline().strip()
def main():
H, W = list(map(int, input().split()))
field = "#" * (W + 2)
field += "#" + "##".join([eval(input()) for _ in range(H)]) + "#"
field += "#" * (W + 2)
move = [-1, 1, -(W + 2), W + 2]
cost... | false | 2.439024 | [
"+import sys",
"-MAX_VAL = 10**9",
"-H, W = map(int, input().split())",
"-border_row = \"#\" * (W + 2)",
"-field = [border_row]",
"-num_blacks = 0",
"-for i in range(H):",
"- line = input()",
"- num_blacks += line.count(\".\")",
"- field.append(\"#\" + line + \"#\")",
"-field.append(bor... | false | 0.033951 | 0.037651 | 0.901735 | [
"s529025981",
"s421502942"
] |
u194894739 | p03111 | python | s272777654 | s815957584 | 447 | 70 | 3,316 | 3,064 | Accepted | Accepted | 84.34 | from collections import deque
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
minMP = 10**5
p = deque()
p.append([-1] * len(L))
while p:
stats = p.pop()
stats = list(stats)
a, b, c = 0, 0, 0
MP = 0
cntA = 0; cntB = 0; cntC = 0
for i in rang... | N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
INF = float('inf')
def dfs(cursor=0, a=0, b=0, c=0):
if cursor == N:
return abs(a-A) + abs(b-B) + abs(c-C) - 30 if a*b*c > 0 else INF
no_compound = dfs(cursor+1, a, b, c)
A_compound = dfs(cursor+1, a+L... | 38 | 15 | 889 | 522 | from collections import deque
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
minMP = 10**5
p = deque()
p.append([-1] * len(L))
while p:
stats = p.pop()
stats = list(stats)
a, b, c = 0, 0, 0
MP = 0
cntA = 0
cntB = 0
cntC = 0
for i in range(N):
... | N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
INF = float("inf")
def dfs(cursor=0, a=0, b=0, c=0):
if cursor == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if a * b * c > 0 else INF
no_compound = dfs(cursor + 1, a, b, c)
A_compound = dfs(cursor + 1... | false | 60.526316 | [
"-from collections import deque",
"-",
"-minMP = 10**5",
"-p = deque()",
"-p.append([-1] * len(L))",
"-while p:",
"- stats = p.pop()",
"- stats = list(stats)",
"- a, b, c = 0, 0, 0",
"- MP = 0",
"- cntA = 0",
"- cntB = 0",
"- cntC = 0",
"- for i in range(N):",
"- ... | false | 0.50364 | 0.064993 | 7.749111 | [
"s272777654",
"s815957584"
] |
u260980560 | p00966 | python | s627211902 | s996341069 | 1,950 | 1,640 | 89,780 | 89,776 | Accepted | Accepted | 15.9 | from bisect import bisect
n, a, b, q = map(int, input().split())
W = [input().split() for i in range(a)]
X = [int(x) for x, c in W]
C = [c for x, c in W]
P = [list(map(int, input().split())) for i in range(b)]
Y = [y for y, h in P] + [n+1]
D = [0]*b
for i in range(b):
y0, h = P[i]; y1 = Y[i+1]
l... | from bisect import bisect
n, a, b, q = map(int, input().split())
W = [input().split() for i in range(a)]
X = [int(x) for x, c in W]
C = [c for x, c in W]
P = [list(map(int, input().split())) for i in range(b)]
Y = [y for y, h in P] + [n+1]
D = [0]*b
for i in range(b):
y0, h = P[i]; y1 = Y[i+1]
D... | 48 | 45 | 1,097 | 1,007 | from bisect import bisect
n, a, b, q = map(int, input().split())
W = [input().split() for i in range(a)]
X = [int(x) for x, c in W]
C = [c for x, c in W]
P = [list(map(int, input().split())) for i in range(b)]
Y = [y for y, h in P] + [n + 1]
D = [0] * b
for i in range(b):
y0, h = P[i]
y1 = Y[i + 1]
l = y1 ... | from bisect import bisect
n, a, b, q = map(int, input().split())
W = [input().split() for i in range(a)]
X = [int(x) for x, c in W]
C = [c for x, c in W]
P = [list(map(int, input().split())) for i in range(b)]
Y = [y for y, h in P] + [n + 1]
D = [0] * b
for i in range(b):
y0, h = P[i]
y1 = Y[i + 1]
D[i] = ... | false | 6.25 | [
"- l = y1 - y0",
"- D[i] = min(y0 - h, l)",
"+ D[i] = min(y0 - h, y1 - y0)",
"- j = i",
"- y1 = Y[i + 1]",
"- assert x < y0",
"- y1 = Y[i + 1]",
"- assert z < y0",
"-Z = [int(input()) for i in range(q)]",
"+Z = (int(input()) for i in range(q))"
] | false | 0.047326 | 0.122288 | 0.387006 | [
"s627211902",
"s996341069"
] |
u541610817 | p03835 | python | s961437528 | s758984539 | 976 | 250 | 3,060 | 40,940 | Accepted | Accepted | 74.39 | k, s = [int(x) for x in input().split()]
cnt = 0
for x in range(k + 1):
if x > s:
continue
for y in range(x, k + 1):
if y > s:
break
z = s - x - y
if y <= z and z <= k:
if x + y + z == s:
if x == y == z:
cnt ... | def solve():
K, S = [int(x) for x in input().split()]
res = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
res += 1
return res
if __name__ == '__main__':
print((solve()))
| 18 | 12 | 460 | 280 | k, s = [int(x) for x in input().split()]
cnt = 0
for x in range(k + 1):
if x > s:
continue
for y in range(x, k + 1):
if y > s:
break
z = s - x - y
if y <= z and z <= k:
if x + y + z == s:
if x == y == z:
cnt += 1
... | def solve():
K, S = [int(x) for x in input().split()]
res = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
res += 1
return res
if __name__ == "__main__":
print((solve()))
| false | 33.333333 | [
"-k, s = [int(x) for x in input().split()]",
"-cnt = 0",
"-for x in range(k + 1):",
"- if x > s:",
"- continue",
"- for y in range(x, k + 1):",
"- if y > s:",
"- break",
"- z = s - x - y",
"- if y <= z and z <= k:",
"- if x + y + z == s:",
... | false | 0.074789 | 0.036168 | 2.067818 | [
"s961437528",
"s758984539"
] |
u735891571 | p03476 | python | s841958124 | s521176170 | 746 | 475 | 88,884 | 77,056 | Accepted | Accepted | 36.33 | from bisect import bisect_left, bisect_right
import random
def is_prime(q,k=50):
q = abs(q)
#計算するまでもなく判定できるものははじく
if q == 2: return True
if q < 2 or q&1 == 0: return False
#n-1=2^s*dとし(但しaは整数、dは奇数)、dを求める
d = (q-1)>>1
while d&1 == 0:
d >>= 1
#判定をk回繰り返す
for... | from bisect import bisect_left, bisect_right
def primes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
retu... | 41 | 23 | 940 | 624 | from bisect import bisect_left, bisect_right
import random
def is_prime(q, k=50):
q = abs(q)
# 計算するまでもなく判定できるものははじく
if q == 2:
return True
if q < 2 or q & 1 == 0:
return False
# n-1=2^s*dとし(但しaは整数、dは奇数)、dを求める
d = (q - 1) >> 1
while d & 1 == 0:
d >>= 1
# 判定をk回繰り返... | from bisect import bisect_left, bisect_right
def primes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i fo... | false | 43.902439 | [
"-import random",
"-def is_prime(q, k=50):",
"- q = abs(q)",
"- # 計算するまでもなく判定できるものははじく",
"- if q == 2:",
"- return True",
"- if q < 2 or q & 1 == 0:",
"- return False",
"- # n-1=2^s*dとし(但しaは整数、dは奇数)、dを求める",
"- d = (q - 1) >> 1",
"- while d & 1 == 0:",
"- ... | false | 2.800132 | 0.147826 | 18.942033 | [
"s841958124",
"s521176170"
] |
u581511366 | p02613 | python | s112856364 | s566055044 | 135 | 65 | 9,172 | 9,192 | Accepted | Accepted | 51.85 | def main():
N = int(eval(input()))
di = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for _ in range(N):
di[eval(input())] += 1
for k, v in list(di.items()):
print(f"{k} x {v}")
if __name__ == "__main__":
main()
| import sys
def input(): return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
di = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for _ in range(N):
di[eval(input())] += 1
for k, v in list(di.items()):
print(f"{k} x {v}")
if __name__ == "__main__":
m... | 13 | 19 | 238 | 308 | def main():
N = int(eval(input()))
di = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for _ in range(N):
di[eval(input())] += 1
for k, v in list(di.items()):
print(f"{k} x {v}")
if __name__ == "__main__":
main()
| import sys
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
di = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for _ in range(N):
di[eval(input())] += 1
for k, v in list(di.items()):
print(f"{k} x {v}")
if __name__ == "__main__":
main()
| false | 31.578947 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+"
] | false | 0.046374 | 0.040401 | 1.147849 | [
"s112856364",
"s566055044"
] |
u285891772 | p02984 | python | s441084695 | s988292529 | 141 | 118 | 21,992 | 22,028 | Accepted | Accepted | 16.31 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 41 | 31 | 1,166 | 1,070 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 24.390244 | [
"-tmp_A = [0] * N",
"-for i, x in enumerate(A):",
"- if i % 2 == 0:",
"- tmp_A[i] = x",
"- else:",
"- tmp_A[i] = -x",
"-tmp = sum(tmp_A) / 2",
"-ans = []",
"+tmp = sum(A[::2]) - sum(A[1::2])",
"- print(int(tmp * 2), end=\" \")",
"- tmp = A[i] - tmp",
"+ print(int(t... | false | 0.036735 | 0.037999 | 0.966753 | [
"s441084695",
"s988292529"
] |
u968166680 | p03283 | python | s274304835 | s379479630 | 779 | 469 | 21,184 | 56,156 | Accepted | Accepted | 39.79 | import sys
from itertools import accumulate
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
N, M, Q = map(int, input().split())
G = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = map(int, input().split())
G[l - 1][r - 1] += 1
csum = [[0... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
N, M, Q = map(int, readline().split())
G = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = map(int, readline().split())
... | 26 | 26 | 662 | 701 | import sys
from itertools import accumulate
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10**9)
INF = 1 << 60
N, M, Q = map(int, input().split())
G = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = map(int, input().split())
G[l - 1][r - 1] += 1
csum = [[0] * (N + 1) for _... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
N, M, Q = map(int, readline().split())
G = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = map(int, readline().split())
G[l - 1][r - 1... | false | 0 | [
"-",
"-def input():",
"- return sys.stdin.readline().strip()",
"-",
"-",
"+read = sys.stdin.read",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"-N, M, Q = map(int, input().split())",
"+N, M, Q = map(int, readline().split())",
"- l, r = map(int, input().split())",
... | false | 0.034716 | 0.045227 | 0.767593 | [
"s274304835",
"s379479630"
] |
u413165887 | p02713 | python | s258204163 | s299273910 | 1,316 | 946 | 76,536 | 76,128 | Accepted | Accepted | 28.12 | from fractions import gcd
k = int(eval(input()))
check = [[1 for _ in range(k+3)] for i in range(k+3)]
for i in range(1, k+2):
for j in range(i, k+2):
check[i][j] = gcd(i, j)
result = 0
for s in range(1, k+1):
for t in range(1, k+1):
for u in range(1, k+1):
n, m = sorted... | from fractions import gcd
k = int(eval(input()))
check = [[1 for _ in range(k+3)] for i in range(k+3)]
for i in range(1, k+2):
for j in range(i, k+2):
check[i][j] = gcd(i, j)
result = 0
for s in range(1, k+1):
for t in range(1, k+1):
n, m = sorted([s, t])
x = check[n][m]
... | 16 | 16 | 436 | 428 | from fractions import gcd
k = int(eval(input()))
check = [[1 for _ in range(k + 3)] for i in range(k + 3)]
for i in range(1, k + 2):
for j in range(i, k + 2):
check[i][j] = gcd(i, j)
result = 0
for s in range(1, k + 1):
for t in range(1, k + 1):
for u in range(1, k + 1):
n, m = sort... | from fractions import gcd
k = int(eval(input()))
check = [[1 for _ in range(k + 3)] for i in range(k + 3)]
for i in range(1, k + 2):
for j in range(i, k + 2):
check[i][j] = gcd(i, j)
result = 0
for s in range(1, k + 1):
for t in range(1, k + 1):
n, m = sorted([s, t])
x = check[n][m]
... | false | 0 | [
"+ n, m = sorted([s, t])",
"+ x = check[n][m]",
"- n, m = sorted([s, t])",
"- x = check[n][m]",
"- x, y = sorted([x, u])",
"- result += check[x][y]",
"+ y, z = sorted([x, u])",
"+ result += check[y][z]"
] | false | 0.102262 | 0.110078 | 0.928994 | [
"s258204163",
"s299273910"
] |
u761529120 | p02726 | python | s652547908 | s982089022 | 1,210 | 292 | 132,572 | 76,380 | Accepted | Accepted | 75.87 | import heapq
import sys
from collections import defaultdict
input = sys.stdin.readline
def dijkstra_heap(s,edge,n):
#始点sから各頂点への最短距離
d = [10**20] * n
used = [True] * n #True:未確定
d[s] = 0
used[s] = False
edgelist = []
for a,b in edge[s]:
heapq.heappush(edgelist,a*(10**6... | def main():
N, X, Y = list(map(int, input().split()))
tree = [[float('inf')] * N for _ in range(N)]
ans = [0] * (N + 1)
X -= 1
Y -= 1
for i in range(N):
for j in range(i,N):
dist = min(j - i, abs(X - i) + 1 + abs(Y - j))
ans[dist] += 1
for i in ran... | 56 | 17 | 1,332 | 389 | import heapq
import sys
from collections import defaultdict
input = sys.stdin.readline
def dijkstra_heap(s, edge, n):
# 始点sから各頂点への最短距離
d = [10**20] * n
used = [True] * n # True:未確定
d[s] = 0
used[s] = False
edgelist = []
for a, b in edge[s]:
heapq.heappush(edgelist, a * (10**6) + ... | def main():
N, X, Y = list(map(int, input().split()))
tree = [[float("inf")] * N for _ in range(N)]
ans = [0] * (N + 1)
X -= 1
Y -= 1
for i in range(N):
for j in range(i, N):
dist = min(j - i, abs(X - i) + 1 + abs(Y - j))
ans[dist] += 1
for i in range(1, N):
... | false | 69.642857 | [
"-import heapq",
"-import sys",
"-from collections import defaultdict",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"-def dijkstra_heap(s, edge, n):",
"- # 始点sから各頂点への最短距離",
"- d = [10**20] * n",
"- used = [True] * n # True:未確定",
"- d[s] = 0",
"- used[s] = False",
"- ed... | false | 0.046022 | 0.066662 | 0.69038 | [
"s652547908",
"s982089022"
] |
u727148417 | p02714 | python | s458546033 | s829744008 | 607 | 366 | 9,492 | 9,528 | Accepted | Accepted | 39.7 | N = int(eval(input()))
S = list(eval(input()))
R = []
G = []
B = []
Reval = {}
Geval = {}
Beval = {}
for i in range(N):
if S[i] == "R":
R.append(i)
Reval[2*i] = 2*i
elif S[i] == "G":
G.append(i)
Geval[2*i] = 2*i
elif S[i] == "B":
B.append(i)
B... | def main():
N = int(eval(input()))
S = list(eval(input()))
R = []
G = []
B = []
Reval = {}
Geval = {}
Beval = {}
for i in range(N):
if S[i] == "R":
R.append(i)
Reval[2*i] = 2*i
elif S[i] == "G":
G.append(i)
... | 33 | 37 | 621 | 805 | N = int(eval(input()))
S = list(eval(input()))
R = []
G = []
B = []
Reval = {}
Geval = {}
Beval = {}
for i in range(N):
if S[i] == "R":
R.append(i)
Reval[2 * i] = 2 * i
elif S[i] == "G":
G.append(i)
Geval[2 * i] = 2 * i
elif S[i] == "B":
B.append(i)
Beval[2 * ... | def main():
N = int(eval(input()))
S = list(eval(input()))
R = []
G = []
B = []
Reval = {}
Geval = {}
Beval = {}
for i in range(N):
if S[i] == "R":
R.append(i)
Reval[2 * i] = 2 * i
elif S[i] == "G":
G.append(i)
Geval[2 *... | false | 10.810811 | [
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-R = []",
"-G = []",
"-B = []",
"-Reval = {}",
"-Geval = {}",
"-Beval = {}",
"-for i in range(N):",
"- if S[i] == \"R\":",
"- R.append(i)",
"- Reval[2 * i] = 2 * i",
"- elif S[i] == \"G\":",
"- G.append(i)",... | false | 0.096897 | 0.039563 | 2.449183 | [
"s458546033",
"s829744008"
] |
u524534026 | p02713 | python | s501664362 | s701947573 | 975 | 72 | 69,388 | 9,416 | Accepted | Accepted | 92.62 | k = int(eval(input()))
import math
from functools import reduce
total = 0
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
total += reduce(math.gcd,(i,j,l))
print(total)
| import collections
def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
k=int(eval(input()))
cnt=collections.defaultdict(int)
for i in range(1,k+1): #すべての(a,b)の組についてgcd(a,b)を求め、その値の個数を数える
for j in range(1,k+1):
cnt[gcd(i,j)]+=1
ans=0
for i in range(1,k+1): #すべてのcについて、上で求めたgcd(a,b)のあり得る値との... | 10 | 18 | 218 | 396 | k = int(eval(input()))
import math
from functools import reduce
total = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
total += reduce(math.gcd, (i, j, l))
print(total)
| import collections
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
k = int(eval(input()))
cnt = collections.defaultdict(int)
for i in range(1, k + 1): # すべての(a,b)の組についてgcd(a,b)を求め、その値の個数を数える
for j in range(1, k + 1):
cnt[gcd(i, j)] += 1
ans = 0
for i in range(1, k ... | false | 44.444444 | [
"+import collections",
"+",
"+",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ else:",
"+ return gcd(b, a % b)",
"+",
"+",
"-import math",
"-from functools import reduce",
"-",
"-total = 0",
"-for i in range(1, k + 1):",
"+cnt = collections.defaultdict(int)",
... | false | 0.039326 | 0.007088 | 5.548611 | [
"s501664362",
"s701947573"
] |
u340500592 | p00002 | python | s129494563 | s027290782 | 30 | 20 | 7,600 | 7,544 | Accepted | Accepted | 33.33 | import sys
from math import log10
for line in sys.stdin:
a, b = list(map(int, line.split()))
digitNumber = int(log10((a + b))) + 1
print(digitNumber) | import sys
for line in sys.stdin:
a, b = list(map(int, line.split()))
digitNumber = len(str(a + b))
print(digitNumber) | 7 | 6 | 153 | 121 | import sys
from math import log10
for line in sys.stdin:
a, b = list(map(int, line.split()))
digitNumber = int(log10((a + b))) + 1
print(digitNumber)
| import sys
for line in sys.stdin:
a, b = list(map(int, line.split()))
digitNumber = len(str(a + b))
print(digitNumber)
| false | 14.285714 | [
"-from math import log10",
"- digitNumber = int(log10((a + b))) + 1",
"+ digitNumber = len(str(a + b))"
] | false | 0.036149 | 0.037426 | 0.965893 | [
"s129494563",
"s027290782"
] |
u197615397 | p02363 | python | s705311742 | s893054767 | 190 | 150 | 6,224 | 6,232 | Accepted | Accepted | 21.05 | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j in range(v_count):
c2 = matrix[j][i]
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
if c1 > c2+c3:
matrix[j][k] = c2+c3
return matrix
def ha... | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
if c1 > c2+c3:
matrix[j][k] = c2+c3
return matrix
... | 29 | 28 | 812 | 818 | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j in range(v_count):
c2 = matrix[j][i]
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
if c1 > c2 + c3:
matrix[j][k] = c2 + c3
return matrix
def has_negat... | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
if c1 > c2 + c3:
matrix[j][k] = c2 + c3
return matrix
def ha... | false | 3.448276 | [
"- for j in range(v_count):",
"- c2 = matrix[j][i]",
"+ for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):"
] | false | 0.036604 | 0.043098 | 0.849308 | [
"s705311742",
"s893054767"
] |
u273010357 | p03814 | python | s265123322 | s444056396 | 22 | 20 | 3,644 | 3,644 | Accepted | Accepted | 9.09 | import re
s = eval(input())
print((len(re.findall('A.*Z', s)[0]))) | import re
s = eval(input())
pattern = 'A.*Z'
print((len(re.search(pattern, s, flags=0).group()))) | 3 | 4 | 60 | 92 | import re
s = eval(input())
print((len(re.findall("A.*Z", s)[0])))
| import re
s = eval(input())
pattern = "A.*Z"
print((len(re.search(pattern, s, flags=0).group())))
| false | 25 | [
"-print((len(re.findall(\"A.*Z\", s)[0])))",
"+pattern = \"A.*Z\"",
"+print((len(re.search(pattern, s, flags=0).group())))"
] | false | 0.040304 | 0.03965 | 1.016499 | [
"s265123322",
"s444056396"
] |
u372144784 | p02913 | python | s459133813 | s127609819 | 611 | 99 | 48,988 | 74,856 | Accepted | Accepted | 83.8 | #ABC141-E Who Says a Pun?
"""
最長共通部分文字列を求める問題。
最長共通接頭辞(z-algorithm)を用いて、O(N**2)で求まる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
def Z_algorithm(s):
N = len(s)
Z_alg = [0]*N
Z_alg[0] = N
i = 1
j = 0
res = 0 #文字列非重複の場合の最大共通部分
whi... | #ABC141-E Who Says a Pun?
"""
ロリハ解
探索する文字列の長さを二分探索し、重複を探す。
計算量はO((n+m)*log(n//2)) ※mは探索する文字列の長さ
log部分は100には間違いなく収まるので、O(10^5)程度。十分に間に合う。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
s = readline().rstrip().decode('utf-8')
class RollingHas... | 46 | 72 | 934 | 2,106 | # ABC141-E Who Says a Pun?
"""
最長共通部分文字列を求める問題。
最長共通接頭辞(z-algorithm)を用いて、O(N**2)で求まる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
def Z_algorithm(s):
N = len(s)
Z_alg = [0] * N
Z_alg[0] = N
i = 1
j = 0
res = 0 # 文字列非重複の場合の最大共通部分
wh... | # ABC141-E Who Says a Pun?
"""
ロリハ解
探索する文字列の長さを二分探索し、重複を探す。
計算量はO((n+m)*log(n//2)) ※mは探索する文字列の長さ
log部分は100には間違いなく収まるので、O(10^5)程度。十分に間に合う。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
n = int(readline())
s = readline().rstrip().decode("utf-8")
class RollingHas... | false | 36.111111 | [
"-最長共通部分文字列を求める問題。",
"-最長共通接頭辞(z-algorithm)を用いて、O(N**2)で求まる。",
"+ロリハ解",
"+探索する文字列の長さを二分探索し、重複を探す。",
"+計算量はO((n+m)*log(n//2)) ※mは探索する文字列の長さ",
"+log部分は100には間違いなく収まるので、O(10^5)程度。十分に間に合う。",
"-def Z_algorithm(s):",
"- N = len(s)",
"- Z_alg = [0] * N",
"- Z_alg[0] = N",
"- i = 1",
"- ... | false | 0.036562 | 0.035339 | 1.034616 | [
"s459133813",
"s127609819"
] |
u242031676 | p02881 | python | s444319278 | s962935429 | 186 | 145 | 3,064 | 2,940 | Accepted | Accepted | 22.04 | n = int(eval(input()))
l = int(n**0.5)
while l:
if n%l: l-=1
else: break
print(((l-1)+(n//l-1))) | n = int(eval(input()))
x, y = 1, n
for i in range(1, int(n**0.5)+1):
if n%i==0: x = i
y = n//x
print((x+y-2)) | 6 | 6 | 101 | 114 | n = int(eval(input()))
l = int(n**0.5)
while l:
if n % l:
l -= 1
else:
break
print(((l - 1) + (n // l - 1)))
| n = int(eval(input()))
x, y = 1, n
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
x = i
y = n // x
print((x + y - 2))
| false | 0 | [
"-l = int(n**0.5)",
"-while l:",
"- if n % l:",
"- l -= 1",
"- else:",
"- break",
"-print(((l - 1) + (n // l - 1)))",
"+x, y = 1, n",
"+for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ x = i",
"+y = n // x",
"+print((x + y - 2))"
] | false | 0.046713 | 0.039315 | 1.188155 | [
"s444319278",
"s962935429"
] |
u991567869 | p03294 | python | s229352169 | s199110878 | 90 | 18 | 3,316 | 3,316 | Accepted | Accepted | 80 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
m = 1
for i in range(n):
m = m*a[i]
m -= 1
for i in range(n):
ans += m%a[i]
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - n)) | 14 | 4 | 172 | 74 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
m = 1
for i in range(n):
m = m * a[i]
m -= 1
for i in range(n):
ans += m % a[i]
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - n))
| false | 71.428571 | [
"-ans = 0",
"-m = 1",
"-for i in range(n):",
"- m = m * a[i]",
"-m -= 1",
"-for i in range(n):",
"- ans += m % a[i]",
"-print(ans)",
"+print((sum(a) - n))"
] | false | 0.039933 | 0.040567 | 0.984383 | [
"s229352169",
"s199110878"
] |
u645250356 | p02830 | python | s862127027 | s161918318 | 299 | 131 | 66,156 | 76,604 | Accepted | Accepted | 56.19 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions
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.std... | 17 | 13 | 511 | 428 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 23.529412 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions",
"-mod2 = 998244353",
"-def inpln(n):",
"- return list(int(s... | false | 0.054292 | 0.035056 | 1.548703 | [
"s862127027",
"s161918318"
] |
u792720861 | p03068 | python | s822749358 | s067596365 | 31 | 28 | 8,976 | 9,148 | Accepted | Accepted | 9.68 | n = int(input())
S = input()
k = int(input())
for s in S:
print(s if s == S[k-1] else '*', end="")
| n = int(input())
S = input()
k = S[int(input())-1]
print(*[s if s==k else '*' for s in S], sep='')
| 6 | 4 | 109 | 102 | n = int(input())
S = input()
k = int(input())
for s in S:
print(s if s == S[k - 1] else "*", end="")
| n = int(input())
S = input()
k = S[int(input()) - 1]
print(*[s if s == k else "*" for s in S], sep="")
| false | 33.333333 | [
"-k = int(input())",
"-for s in S:",
"- print(s if s == S[k - 1] else \"*\", end=\"\")",
"+k = S[int(input()) - 1]",
"+print(*[s if s == k else \"*\" for s in S], sep=\"\")"
] | false | 0.047329 | 0.048018 | 0.985639 | [
"s822749358",
"s067596365"
] |
u724687935 | p02610 | python | s764853214 | s554735912 | 1,607 | 605 | 141,620 | 94,540 | Accepted | Accepted | 62.35 | import sys
from heapq import heappop, heappush
ans_l = []
T = int(input())
for t in range(T):
ans = 0
N = int(input())
left = []
right = []
neutral = []
for i in range(N):
K, L, R = map(int, sys.stdin.readline().split())
if L > R:
heappush(left, (K, L -... | import sys
from heapq import heappop, heappush
ans_l = []
T = int(input())
for t in range(T):
N = int(input())
left, right = [], []
ans = 0
for i in range(N):
K, L, R = map(int, sys.stdin.readline().split())
if L > R:
ans += L
left.append((K, L - R))... | 53 | 53 | 1,227 | 1,209 | import sys
from heapq import heappop, heappush
ans_l = []
T = int(input())
for t in range(T):
ans = 0
N = int(input())
left = []
right = []
neutral = []
for i in range(N):
K, L, R = map(int, sys.stdin.readline().split())
if L > R:
heappush(left, (K, L - R, L, R))
... | import sys
from heapq import heappop, heappush
ans_l = []
T = int(input())
for t in range(T):
N = int(input())
left, right = [], []
ans = 0
for i in range(N):
K, L, R = map(int, sys.stdin.readline().split())
if L > R:
ans += L
left.append((K, L - R))
elif... | false | 0 | [
"+ N = int(input())",
"+ left, right = [], []",
"- N = int(input())",
"- left = []",
"- right = []",
"- neutral = []",
"- heappush(left, (K, L - R, L, R))",
"+ ans += L",
"+ left.append((K, L - R))",
"- heappush(right, (-K, R - L, L, R)... | false | 0.075023 | 0.079598 | 0.942516 | [
"s764853214",
"s554735912"
] |
u142415823 | p03073 | python | s535069193 | s627461452 | 143 | 82 | 3,188 | 3,188 | Accepted | Accepted | 42.66 | S = eval(input())
ans = [0, 0, 0, 0]
for i in range(len(S)):
if (i % 2 == 0 and S[i] != '1') or (i % 2 == 1 and S[i] != '0'):
ans[0] += 1
if (i % 2 == 0 and S[i] != '0') or (i % 2 == 1 and S[i] != '1'):
ans[1] += 1
j = len(S) - i - 1
if (j % 2 == 0 and S[j] != '1') or (j % 2 ==... | S = eval(input())
ans = [0, 0]
for i in range(len(S)):
if (i % 2 == 0 and S[i] != '1') or (i % 2 == 1 and S[i] != '0'):
ans[0] += 1
if (i % 2 == 0 and S[i] != '0') or (i % 2 == 1 and S[i] != '1'):
ans[1] += 1
print((min(ans)))
| 18 | 10 | 476 | 258 | S = eval(input())
ans = [0, 0, 0, 0]
for i in range(len(S)):
if (i % 2 == 0 and S[i] != "1") or (i % 2 == 1 and S[i] != "0"):
ans[0] += 1
if (i % 2 == 0 and S[i] != "0") or (i % 2 == 1 and S[i] != "1"):
ans[1] += 1
j = len(S) - i - 1
if (j % 2 == 0 and S[j] != "1") or (j % 2 == 1 and S[j... | S = eval(input())
ans = [0, 0]
for i in range(len(S)):
if (i % 2 == 0 and S[i] != "1") or (i % 2 == 1 and S[i] != "0"):
ans[0] += 1
if (i % 2 == 0 and S[i] != "0") or (i % 2 == 1 and S[i] != "1"):
ans[1] += 1
print((min(ans)))
| false | 44.444444 | [
"-ans = [0, 0, 0, 0]",
"+ans = [0, 0]",
"- j = len(S) - i - 1",
"- if (j % 2 == 0 and S[j] != \"1\") or (j % 2 == 1 and S[j] != \"0\"):",
"- ans[2] += 1",
"- if (j % 2 == 0 and S[j] != \"0\") or (j % 2 == 1 and S[j] != \"1\"):",
"- ans[3] += 1"
] | false | 0.038089 | 0.082072 | 0.46409 | [
"s535069193",
"s627461452"
] |
u189023301 | p03696 | python | s108452844 | s364848079 | 72 | 30 | 61,560 | 9,064 | Accepted | Accepted | 58.33 | n = int(eval(input()))
s = eval(input())
cnt_l, cnt_r = 0, 0
for x in s:
if x == "(":
cnt_l += 1
elif cnt_l > 0:
cnt_l -= 1
for x in s[::-1]:
if x == ")":
cnt_r += 1
elif cnt_r > 0:
cnt_r -= 1
print((cnt_r * "(" + s + cnt_l * ")"))
| n = int(eval(input()))
s = eval(input())
cnt_l, cnt_r = 0, 0
for x in s:
if x == "(":
cnt_l += 1
elif cnt_l > 0:
cnt_l -= 1
else:
cnt_r += 1
print((cnt_r * "(" + s + cnt_l * ")"))
| 17 | 13 | 249 | 189 | n = int(eval(input()))
s = eval(input())
cnt_l, cnt_r = 0, 0
for x in s:
if x == "(":
cnt_l += 1
elif cnt_l > 0:
cnt_l -= 1
for x in s[::-1]:
if x == ")":
cnt_r += 1
elif cnt_r > 0:
cnt_r -= 1
print((cnt_r * "(" + s + cnt_l * ")"))
| n = int(eval(input()))
s = eval(input())
cnt_l, cnt_r = 0, 0
for x in s:
if x == "(":
cnt_l += 1
elif cnt_l > 0:
cnt_l -= 1
else:
cnt_r += 1
print((cnt_r * "(" + s + cnt_l * ")"))
| false | 23.529412 | [
"-for x in s[::-1]:",
"- if x == \")\":",
"+ else:",
"- elif cnt_r > 0:",
"- cnt_r -= 1"
] | false | 0.052618 | 0.053526 | 0.983045 | [
"s108452844",
"s364848079"
] |
u762420987 | p03262 | python | s457020359 | s193043428 | 1,904 | 90 | 24,076 | 16,284 | Accepted | Accepted | 95.27 | from fractions import gcd
import numpy as np
N, X = list(map(int, input().split()))
xlist = np.array(list(map(int, input().split())))
xabs = np.abs(xlist - X)
num = xabs[0]
for x in xabs:
num = gcd(x, num)
print(num)
| from functools import reduce
import fractions
from warnings import simplefilter
simplefilter("ignore")
N, X = list(map(int, input().split()))
xlist = list(map(int, input().split()))
sbn = [abs(x - X) for x in xlist]
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
print((gcd_list(sbn)))... | 9 | 14 | 223 | 313 | from fractions import gcd
import numpy as np
N, X = list(map(int, input().split()))
xlist = np.array(list(map(int, input().split())))
xabs = np.abs(xlist - X)
num = xabs[0]
for x in xabs:
num = gcd(x, num)
print(num)
| from functools import reduce
import fractions
from warnings import simplefilter
simplefilter("ignore")
N, X = list(map(int, input().split()))
xlist = list(map(int, input().split()))
sbn = [abs(x - X) for x in xlist]
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
print((gcd_list(sbn)))
| false | 35.714286 | [
"-from fractions import gcd",
"-import numpy as np",
"+from functools import reduce",
"+import fractions",
"+from warnings import simplefilter",
"+simplefilter(\"ignore\")",
"-xlist = np.array(list(map(int, input().split())))",
"-xabs = np.abs(xlist - X)",
"-num = xabs[0]",
"-for x in xabs:",
"-... | false | 0.179859 | 0.041752 | 4.307752 | [
"s457020359",
"s193043428"
] |
u199948227 | p03448 | python | s951997872 | s318598224 | 47 | 38 | 9,056 | 9,056 | Accepted | Accepted | 19.15 | def main(n500, n100, n50, price):
count = 0
for i in range(n500 + 1):
for j in range(n100 + 1):
for k in range(n50 + 1):
p = i * 500 + j * 100 + k * 50
if p == price:
count += 1
print(count)
if __name__ == "__main__":
... | def main(n500, n100, n50, price):
count = 0
for i in range(n500 + 1):
if i * 500 <= price:
for j in range(n100 + 1):
if i * 500 + j * 100 <= price:
for k in range(n50 + 1):
p = i * 500 + j * 100 + k * 50
... | 17 | 19 | 449 | 563 | def main(n500, n100, n50, price):
count = 0
for i in range(n500 + 1):
for j in range(n100 + 1):
for k in range(n50 + 1):
p = i * 500 + j * 100 + k * 50
if p == price:
count += 1
print(count)
if __name__ == "__main__":
n500 = int(e... | def main(n500, n100, n50, price):
count = 0
for i in range(n500 + 1):
if i * 500 <= price:
for j in range(n100 + 1):
if i * 500 + j * 100 <= price:
for k in range(n50 + 1):
p = i * 500 + j * 100 + k * 50
if p... | false | 10.526316 | [
"- for j in range(n100 + 1):",
"- for k in range(n50 + 1):",
"- p = i * 500 + j * 100 + k * 50",
"- if p == price:",
"- count += 1",
"+ if i * 500 <= price:",
"+ for j in range(n100 + 1):",
"+ if i * 50... | false | 0.054839 | 0.03909 | 1.402867 | [
"s951997872",
"s318598224"
] |
u358957649 | p02773 | python | s894348538 | s361177926 | 817 | 590 | 41,672 | 35,564 | Accepted | Accepted | 27.78 | def main(n,s):
s.sort()
val = s[0]
idx = 0
maxcount = 1
lst = [[1, val]]
for i in range(1,len(s)):
if s[i] == val:
lst[idx][0] += 1
maxcount = max(maxcount, lst[idx][0])
else:
idx += 1
val = s[i]
lst.append(... | from collections import Counter
def main(n,s):
c = Counter(s)
maxVal = max(c.values())
res = sorted([k for k,v in list(c.items()) if v == maxVal])
return res
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
for i in main(n,s):
print(i) | 25 | 11 | 581 | 260 | def main(n, s):
s.sort()
val = s[0]
idx = 0
maxcount = 1
lst = [[1, val]]
for i in range(1, len(s)):
if s[i] == val:
lst[idx][0] += 1
maxcount = max(maxcount, lst[idx][0])
else:
idx += 1
val = s[i]
lst.append([1, val])
... | from collections import Counter
def main(n, s):
c = Counter(s)
maxVal = max(c.values())
res = sorted([k for k, v in list(c.items()) if v == maxVal])
return res
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
for i in main(n, s):
print(i)
| false | 56 | [
"+from collections import Counter",
"+",
"+",
"- s.sort()",
"- val = s[0]",
"- idx = 0",
"- maxcount = 1",
"- lst = [[1, val]]",
"- for i in range(1, len(s)):",
"- if s[i] == val:",
"- lst[idx][0] += 1",
"- maxcount = max(maxcount, lst[idx][0])",
... | false | 0.074677 | 0.03667 | 2.036474 | [
"s894348538",
"s361177926"
] |
u119148115 | p02571 | python | s358827938 | s134162105 | 87 | 69 | 65,344 | 65,364 | Accepted | Accepted | 20.69 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
S,T = LS2(),LS2()
a,b = len(S),len(T)
ans = 1000
for i in range(a-b+1):
x = 0
for j in range(b):
if S[i+j] != T[j]:
x += 1
ans = min(ans,x)
print(ans)
| 25 | 15 | 693 | 272 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def LS2():
return list(sys.stdin.readline().rstrip()) # 空白なし
S, T = LS2(), LS2()
a, b = len(S), len(T)
ans = 1000
for i in range(a - b + 1):
x = 0
for j in range(b):
if S[i + j] != T[j]:
x += 1
ans = min(ans, x)
print(ans)
| false | 40 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-",
"-",
"-def MI():",
"- return list(map(int, sys.stdin.readline().rstrip().split()))",
"-",
"-",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split... | false | 0.086556 | 0.077585 | 1.115631 | [
"s358827938",
"s134162105"
] |
u744920373 | p02972 | python | s894473258 | s100195227 | 1,109 | 972 | 10,004 | 8,600 | Accepted | Accepted | 12.35 | import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | 35 | 39 | 905 | 989 | import sys
sys.setrecursionlimit(10**8)
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 li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
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 li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | false | 10.25641 | [
"-A_f = A[: N // 2]",
"-A_l = A[N // 2 :]",
"-# table += A_l",
"+\"\"\"",
"+for i in range(N):",
"+ ind = 2*(i+1)",
"+ while(ind-1 < N):",
"+ A[i] += A[ind-1]",
"+ ind += i+1",
"+ A[i] %= 2",
"+\"\"\""
] | false | 0.041843 | 0.085605 | 0.488792 | [
"s894473258",
"s100195227"
] |
u923279197 | p02984 | python | s667116708 | s562997369 | 346 | 138 | 65,636 | 14,092 | Accepted | Accepted | 60.12 | n = int(input())
a = list(map(int,input().split()))
A = sum(a)
A_odd = [0]
A_even = [0]
for i in range((n+1)//2):
A_odd.append(A_odd[i] + a[2*i])
for i in range((n-1)//2):
A_even.append(A_even[i] + a[2*i+1])
for i in range(n):
if i %2 == 0:
x = A - 2*A_odd[i//2]-2*(A_even[(n-1)//2... | n = int(eval(input()))
a = list(map(int,input().split()))
ans = []
x = 0
for i in range(n):
if i%2 == 0:
x += a[i]
else:
x -= a[i]
ans.append(x)
for i in range(n-1):
ans.append(2*a[i]-ans[-1])
print((*ans)) | 21 | 16 | 451 | 246 | n = int(input())
a = list(map(int, input().split()))
A = sum(a)
A_odd = [0]
A_even = [0]
for i in range((n + 1) // 2):
A_odd.append(A_odd[i] + a[2 * i])
for i in range((n - 1) // 2):
A_even.append(A_even[i] + a[2 * i + 1])
for i in range(n):
if i % 2 == 0:
x = A - 2 * A_odd[i // 2] - 2 * (A_even[(n ... | n = int(eval(input()))
a = list(map(int, input().split()))
ans = []
x = 0
for i in range(n):
if i % 2 == 0:
x += a[i]
else:
x -= a[i]
ans.append(x)
for i in range(n - 1):
ans.append(2 * a[i] - ans[-1])
print((*ans))
| false | 23.809524 | [
"-n = int(input())",
"+n = int(eval(input()))",
"-A = sum(a)",
"-A_odd = [0]",
"-A_even = [0]",
"-for i in range((n + 1) // 2):",
"- A_odd.append(A_odd[i] + a[2 * i])",
"-for i in range((n - 1) // 2):",
"- A_even.append(A_even[i] + a[2 * i + 1])",
"+ans = []",
"+x = 0",
"- x = A -... | false | 0.075273 | 0.073776 | 1.020291 | [
"s667116708",
"s562997369"
] |
u179169725 | p03796 | python | s408559915 | s529572133 | 34 | 31 | 10,824 | 9,196 | Accepted | Accepted | 8.82 | mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
from libcpp.vect... | mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
ctypedef long long LL
cdef LL MOD = 10**9 + 7
cdef LL N = int(input())
cdef LL ans = 1
cdef i
for i in range(2, N + 1):
ans *= i
ans %= MOD
print(ans)
'''
import sys
... | 32 | 24 | 793 | 511 | mycode = """
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
from libcpp.vector cimp... | mycode = """
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
ctypedef long long LL
cdef LL MOD = 10**9 + 7
cdef LL N = int(input())
cdef LL ans = 1
cdef i
for i in range(2, N + 1):
ans *= i
ans %= MOD
print(ans)
"""
import sys
if sys.argv[-1] =... | false | 25 | [
"-# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。",
"-from libcpp.vector cimport vector",
"-cdef vector[LL] ansls",
"- ansls.push_back(ans)",
"-# print(type(ansls))"
] | false | 0.03704 | 0.038994 | 0.949868 | [
"s408559915",
"s529572133"
] |
u369133448 | p02554 | python | s387230495 | s438164523 | 397 | 27 | 11,032 | 9,168 | Accepted | Accepted | 93.2 | n=int(eval(input()))
print(((10**n-2*9**n+8**n)%(10**9+7))) | n=int(eval(input()))
mod=10**9+7
print(((pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod))%mod)) | 2 | 3 | 52 | 83 | n = int(eval(input()))
print(((10**n - 2 * 9**n + 8**n) % (10**9 + 7)))
| n = int(eval(input()))
mod = 10**9 + 7
print(((pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod))
| false | 33.333333 | [
"-print(((10**n - 2 * 9**n + 8**n) % (10**9 + 7)))",
"+mod = 10**9 + 7",
"+print(((pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod))"
] | false | 0.546542 | 0.034964 | 15.631529 | [
"s387230495",
"s438164523"
] |
u598229387 | p03633 | python | s077945977 | s461273088 | 35 | 18 | 5,176 | 3,064 | Accepted | Accepted | 48.57 | import fractions
n=int(eval(input()))
t=[int(eval(input())) for i in range(n)]
t.sort()
check=t[0]
if n==1:
print(check)
else:
for i in range(n-1):
f1=fractions.gcd(check,t[i+1])
f2=check*t[i+1]//f1
check=f2
print(f2) | n=int(eval(input()))
t=[int(eval(input())) for i in range(n)]
def gcd(a,b):
while b:
a,b=b,a%b
return a
if n==1:
print((t[0]))
exit()
check=gcd(t[0],t[1])
ans=t[0]*t[1]//check
for i in range(2,n):
check=gcd(ans,t[i])
ans=ans*t[i]//check
print(ans) | 13 | 19 | 253 | 264 | import fractions
n = int(eval(input()))
t = [int(eval(input())) for i in range(n)]
t.sort()
check = t[0]
if n == 1:
print(check)
else:
for i in range(n - 1):
f1 = fractions.gcd(check, t[i + 1])
f2 = check * t[i + 1] // f1
check = f2
print(f2)
| n = int(eval(input()))
t = [int(eval(input())) for i in range(n)]
def gcd(a, b):
while b:
a, b = b, a % b
return a
if n == 1:
print((t[0]))
exit()
check = gcd(t[0], t[1])
ans = t[0] * t[1] // check
for i in range(2, n):
check = gcd(ans, t[i])
ans = ans * t[i] // check
print(ans)
| false | 31.578947 | [
"-import fractions",
"-",
"-t.sort()",
"-check = t[0]",
"+",
"+",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"- print(check)",
"-else:",
"- for i in range(n - 1):",
"- f1 = fractions.gcd(check, t[i + 1])",
"- f2 = ch... | false | 0.088767 | 0.06558 | 1.353571 | [
"s077945977",
"s461273088"
] |
u988402778 | p03470 | python | s649370822 | s962100724 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | #8th
n = int(eval(input()))
a = set(float(eval(input())) for i in range(n))
# a_ = [[int(i) for i in input()] for j in range(n)]
# a = set(_[0] for _ in a_)
print((len(a))) | n = int(eval(input()))
print((len(set(map(int, [eval(input()) for i in range(n)]))))) | 6 | 2 | 163 | 72 | # 8th
n = int(eval(input()))
a = set(float(eval(input())) for i in range(n))
# a_ = [[int(i) for i in input()] for j in range(n)]
# a = set(_[0] for _ in a_)
print((len(a)))
| n = int(eval(input()))
print((len(set(map(int, [eval(input()) for i in range(n)])))))
| false | 66.666667 | [
"-# 8th",
"-a = set(float(eval(input())) for i in range(n))",
"-# a_ = [[int(i) for i in input()] for j in range(n)]",
"-# a = set(_[0] for _ in a_)",
"-print((len(a)))",
"+print((len(set(map(int, [eval(input()) for i in range(n)])))))"
] | false | 0.049912 | 0.049358 | 1.011231 | [
"s649370822",
"s962100724"
] |
u816872429 | p02999 | python | s943468032 | s025459472 | 174 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.23 | x, a = list(map(int, input().split()))
print((0 if x < a else 10)) | x, a = list(map(int, input().split()))
print((10 if x >= a else 0)) | 2 | 2 | 59 | 60 | x, a = list(map(int, input().split()))
print((0 if x < a else 10))
| x, a = list(map(int, input().split()))
print((10 if x >= a else 0))
| false | 0 | [
"-print((0 if x < a else 10))",
"+print((10 if x >= a else 0))"
] | false | 0.045869 | 0.041487 | 1.105613 | [
"s943468032",
"s025459472"
] |
u952708174 | p03732 | python | s473963435 | s573409984 | 78 | 67 | 3,996 | 4,012 | Accepted | Accepted | 14.1 | def d_simple_knapsack(N, W, Baggage):
from collections import defaultdict
# dp[w]:ナップサックに重さがwになるように荷物を入れたときの価値の最大値
dp = defaultdict(int)
dp[0] = 0 # 重さ0で達成できる価値は0とする
for w, v in Baggage:
# dpの各要素(現時点におけるナップサック内の荷物の重さ)に対して、
# 注目した荷物を入れても重さがWを超えなければ、
# ナップサックに荷物を入れて価値の... | def d_simple_knapsack(N, W, Baggage):
from collections import defaultdict
# dp[w]:ナップサックに重さがwになるように荷物を入れたときの価値の最大値
dp = defaultdict(int)
dp[0] = 0 # 重さ0で達成できる価値は0とする
for w, v in Baggage:
# dpの各要素(現時点におけるナップサック内の荷物の重さ)に対して、
# 注目した荷物を入れても重さがWを超えなければ、
# ナップサックに荷物を入れて価値の... | 24 | 19 | 869 | 677 | def d_simple_knapsack(N, W, Baggage):
from collections import defaultdict
# dp[w]:ナップサックに重さがwになるように荷物を入れたときの価値の最大値
dp = defaultdict(int)
dp[0] = 0 # 重さ0で達成できる価値は0とする
for w, v in Baggage:
# dpの各要素(現時点におけるナップサック内の荷物の重さ)に対して、
# 注目した荷物を入れても重さがWを超えなければ、
# ナップサックに荷物を入れて価値の最大値を更新す... | def d_simple_knapsack(N, W, Baggage):
from collections import defaultdict
# dp[w]:ナップサックに重さがwになるように荷物を入れたときの価値の最大値
dp = defaultdict(int)
dp[0] = 0 # 重さ0で達成できる価値は0とする
for w, v in Baggage:
# dpの各要素(現時点におけるナップサック内の荷物の重さ)に対して、
# 注目した荷物を入れても重さがWを超えなければ、
# ナップサックに荷物を入れて価値の最大値を更新す... | false | 20.833333 | [
"- tmp = defaultdict(int) # 価値の最大値を更新できた荷物の重さの情報",
"- for kw, kv in list(dp.items()):",
"+ latest_dp = list(dp.items())",
"+ for kw, kv in latest_dp:",
"- if kw + w in dp:",
"- tmp[kw + w] = max(dp[kw + w], kv + v)",
"- else:"... | false | 0.115425 | 0.041776 | 2.762946 | [
"s473963435",
"s573409984"
] |
u759412327 | p03624 | python | s228580409 | s120543111 | 59 | 32 | 9,968 | 9,000 | Accepted | Accepted | 45.76 | s1 = sorted(eval(input()))
s2 = "abcdefghijklmnopqrstuvwxyz"
for s in s2:
if s in s1:
pass
else:
print(s)
break
else:
print("None") | S = eval(input())
for a in "abcdefghijklmnopqrstuvwxyz":
if a not in S:
print(a)
exit()
print("None") | 11 | 8 | 154 | 114 | s1 = sorted(eval(input()))
s2 = "abcdefghijklmnopqrstuvwxyz"
for s in s2:
if s in s1:
pass
else:
print(s)
break
else:
print("None")
| S = eval(input())
for a in "abcdefghijklmnopqrstuvwxyz":
if a not in S:
print(a)
exit()
print("None")
| false | 27.272727 | [
"-s1 = sorted(eval(input()))",
"-s2 = \"abcdefghijklmnopqrstuvwxyz\"",
"-for s in s2:",
"- if s in s1:",
"- pass",
"- else:",
"- print(s)",
"- break",
"-else:",
"- print(\"None\")",
"+S = eval(input())",
"+for a in \"abcdefghijklmnopqrstuvwxyz\":",
"+ if a no... | false | 0.039527 | 0.081513 | 0.484914 | [
"s228580409",
"s120543111"
] |
u133936772 | p02802 | python | s978574011 | s579056823 | 280 | 202 | 14,824 | 10,436 | Accepted | Accepted | 27.86 | f=lambda:input().split()
n,m=list(map(int,f()))
sa,lw=set(),[0]*n
for _ in range(m):
p,s=f()
if p in sa: continue
if s=='AC': sa.add(p)
else: lw[int(p)-1]+=1
print((len(sa),sum(lw[int(p)-1] for p in sa))) | f=lambda:input().split()
n,m=list(map(int,f()))
n+=1
a,w=[0]*n,[0]*n
for _ in range(m):
p,s=f()
p=int(p)
if s=='AC': a[p]=1
elif a[p]<1: w[p]+=1
print((sum(a),sum(i*j for i,j in zip(a,w)))) | 9 | 10 | 212 | 198 | f = lambda: input().split()
n, m = list(map(int, f()))
sa, lw = set(), [0] * n
for _ in range(m):
p, s = f()
if p in sa:
continue
if s == "AC":
sa.add(p)
else:
lw[int(p) - 1] += 1
print((len(sa), sum(lw[int(p) - 1] for p in sa)))
| f = lambda: input().split()
n, m = list(map(int, f()))
n += 1
a, w = [0] * n, [0] * n
for _ in range(m):
p, s = f()
p = int(p)
if s == "AC":
a[p] = 1
elif a[p] < 1:
w[p] += 1
print((sum(a), sum(i * j for i, j in zip(a, w))))
| false | 10 | [
"-sa, lw = set(), [0] * n",
"+n += 1",
"+a, w = [0] * n, [0] * n",
"- if p in sa:",
"- continue",
"+ p = int(p)",
"- sa.add(p)",
"- else:",
"- lw[int(p) - 1] += 1",
"-print((len(sa), sum(lw[int(p) - 1] for p in sa)))",
"+ a[p] = 1",
"+ elif a[p] < 1:",
... | false | 0.039277 | 0.047608 | 0.825012 | [
"s978574011",
"s579056823"
] |
u969190727 | p02794 | python | s606670384 | s086710241 | 2,128 | 565 | 43,924 | 42,732 | Accepted | Accepted | 73.45 | import sys
input=sys.stdin.readline
n=int(eval(input()))
Edge=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
Edge[a-1].append((b-1,i))
Edge[b-1].append((a-1,i))
m=int(eval(input()))
M=[]
for i in range(m):
M.append(tuple(map(int,input().split())))
inf=float("inf")
... | import sys
input=sys.stdin.readline
n=int(eval(input()))
Edge=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
Edge[a-1].append((b-1,i))
Edge[b-1].append((a-1,i))
m=int(eval(input()))
M=[]
for i in range(m):
M.append(tuple(map(int,input().split())))
inf=float("inf")
... | 43 | 50 | 998 | 1,165 | import sys
input = sys.stdin.readline
n = int(eval(input()))
Edge = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
Edge[a - 1].append((b - 1, i))
Edge[b - 1].append((a - 1, i))
m = int(eval(input()))
M = []
for i in range(m):
M.append(tuple(map(int, input().split()... | import sys
input = sys.stdin.readline
n = int(eval(input()))
Edge = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
Edge[a - 1].append((b - 1, i))
Edge[b - 1].append((a - 1, i))
m = int(eval(input()))
M = []
for i in range(m):
M.append(tuple(map(int, input().split()... | false | 14 | [
"- return bin(x).count(\"1\")",
"+ x = x - ((x >> 1) & 0x5555555555555555)",
"+ x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)",
"+ x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0F",
"+ x = x + (x >> 8)",
"+ x = x + (x >> 16)",
"+ x = x + (x >> 32)",
"+ return x & 0x0000... | false | 0.032442 | 0.075824 | 0.427862 | [
"s606670384",
"s086710241"
] |
u240793404 | p03331 | python | s058427131 | s904275531 | 192 | 18 | 3,060 | 2,940 | Accepted | Accepted | 90.62 | def digit(a):
tmp = list(str(a))
x = 0
for j in tmp:
x += int(j)
return x
n=int(eval(input()))
min_ = n
for i in range(1,n//2):
y = digit(i)+digit(n-i)
min_ = min(min_,y)
print(min_) | n=list(eval(input()))
a=0
for i in n:a+=int(i)
print((10 if a==1 else a))
| 12 | 4 | 219 | 69 | def digit(a):
tmp = list(str(a))
x = 0
for j in tmp:
x += int(j)
return x
n = int(eval(input()))
min_ = n
for i in range(1, n // 2):
y = digit(i) + digit(n - i)
min_ = min(min_, y)
print(min_)
| n = list(eval(input()))
a = 0
for i in n:
a += int(i)
print((10 if a == 1 else a))
| false | 66.666667 | [
"-def digit(a):",
"- tmp = list(str(a))",
"- x = 0",
"- for j in tmp:",
"- x += int(j)",
"- return x",
"-",
"-",
"-n = int(eval(input()))",
"-min_ = n",
"-for i in range(1, n // 2):",
"- y = digit(i) + digit(n - i)",
"- min_ = min(min_, y)",
"-print(min_)",
"+n =... | false | 0.067249 | 0.034165 | 1.968374 | [
"s058427131",
"s904275531"
] |
u260980560 | p00713 | python | s856799877 | s419449567 | 24,730 | 19,350 | 6,580 | 6,492 | Accepted | Accepted | 21.75 | from math import sqrt
def circle_center(x1, y1, x2, y2):
xd = x2 - x1; yd = y2 - y1
d = xd**2 + yd**2
k = sqrt((4.0 - d) / d) / 2.0
xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
xd *= k; yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
n = int(input())
if n==0: bre... | from math import sqrt
def circle_center(x1, y1, x2, y2):
xd = x2 - x1; yd = y2 - y1
k = sqrt(1.0/(xd**2 + yd**2) - 0.25)
xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
xd *= k; yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
n = int(input())
if n==0: break
p = sort... | 32 | 37 | 1,212 | 1,438 | from math import sqrt
def circle_center(x1, y1, x2, y2):
xd = x2 - x1
yd = y2 - y1
d = xd**2 + yd**2
k = sqrt((4.0 - d) / d) / 2.0
xc = (x1 + x2) / 2.0
yc = (y1 + y2) / 2.0
xd *= k
yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
n = int(input())
if n == 0... | from math import sqrt
def circle_center(x1, y1, x2, y2):
xd = x2 - x1
yd = y2 - y1
k = sqrt(1.0 / (xd**2 + yd**2) - 0.25)
xc = (x1 + x2) / 2.0
yc = (y1 + y2) / 2.0
xd *= k
yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
n = int(input())
if n == 0:
bre... | false | 13.513514 | [
"- d = xd**2 + yd**2",
"- k = sqrt((4.0 - d) / d) / 2.0",
"+ k = sqrt(1.0 / (xd**2 + yd**2) - 0.25)",
"+ pvx = p[0][0]",
"- while bx - p[prev][0] >= 2.0:",
"+ bxm2 = bx - 2.0",
"+ bxp2 = bx + 2.0",
"+ bym2 = by - 2.0",
"+ byp2 = by + 2.0",
"+ w... | false | 0.050003 | 0.048669 | 1.027414 | [
"s856799877",
"s419449567"
] |
u573754721 | p02911 | python | s811124539 | s019592334 | 542 | 263 | 56,408 | 11,792 | Accepted | Accepted | 51.48 | n,k,q = list(map(int,input().split()))
L = [int(eval(input())) for i in range(q)]
P = [k - q for i in range(n)]
for i in range(q):
P[L[i] - 1] += 1
for i in range(n):
if P[i] > 0:
print("Yes")
else:
print("No") | n,k,q = list(map(int,input().split()))
A=[int(eval(input())) for i in range(q)]
P=[k-q for i in range(n)]
for i in range(q):
P[A[i]-1] +=1
for i in range(n):
if P[i]>0:
print("Yes")
else:
print("No") | 13 | 12 | 266 | 242 | n, k, q = list(map(int, input().split()))
L = [int(eval(input())) for i in range(q)]
P = [k - q for i in range(n)]
for i in range(q):
P[L[i] - 1] += 1
for i in range(n):
if P[i] > 0:
print("Yes")
else:
print("No")
| n, k, q = list(map(int, input().split()))
A = [int(eval(input())) for i in range(q)]
P = [k - q for i in range(n)]
for i in range(q):
P[A[i] - 1] += 1
for i in range(n):
if P[i] > 0:
print("Yes")
else:
print("No")
| false | 7.692308 | [
"-L = [int(eval(input())) for i in range(q)]",
"+A = [int(eval(input())) for i in range(q)]",
"- P[L[i] - 1] += 1",
"+ P[A[i] - 1] += 1"
] | false | 0.045671 | 0.075095 | 0.608178 | [
"s811124539",
"s019592334"
] |
u014333473 | p03711 | python | s773800465 | s106452303 | 31 | 24 | 9,116 | 9,108 | Accepted | Accepted | 22.58 | a,b,c=[1,3,5,7,8,10,12],[4,6,9,11],[2]
print(('YNeos'[len(set([0 if i in a else [1,2][i in b] for i in list(map(int,input().split()))]))!=1::2])) | print(('YNeos'[len(set([0 if i==2 else [1,2][i in [4,6,9,11]] for i in list(map(int,input().split()))]))!=1::2])) | 2 | 1 | 144 | 111 | a, b, c = [1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]
print(
(
"YNeos"[
len(
set(
[
0 if i in a else [1, 2][i in b]
for i in list(map(int, input().split()))
]
)
)
... | print(
(
"YNeos"[
len(
set(
[
0 if i == 2 else [1, 2][i in [4, 6, 9, 11]]
for i in list(map(int, input().split()))
]
)
)
!= 1 :: 2
]
)
)
| false | 50 | [
"-a, b, c = [1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]",
"- 0 if i in a else [1, 2][i in b]",
"+ 0 if i == 2 else [1, 2][i in [4, 6, 9, 11]]"
] | false | 0.037152 | 0.04329 | 0.858219 | [
"s773800465",
"s106452303"
] |
u504800764 | p02554 | python | s112565404 | s346861897 | 581 | 27 | 11,116 | 9,168 | Accepted | Accepted | 95.35 | n = int(eval(input()))
mod = 1000000007
ans = 10**n - 9**n - 9**n +8**n
print((ans%mod)) | n = int(eval(input()))
mod = 1000000007
ans = pow(10,n,mod)
ans -= pow(9,n,mod) * 2
ans += pow(8,n,mod)
print((ans%mod)) | 4 | 6 | 83 | 117 | n = int(eval(input()))
mod = 1000000007
ans = 10**n - 9**n - 9**n + 8**n
print((ans % mod))
| n = int(eval(input()))
mod = 1000000007
ans = pow(10, n, mod)
ans -= pow(9, n, mod) * 2
ans += pow(8, n, mod)
print((ans % mod))
| false | 33.333333 | [
"-ans = 10**n - 9**n - 9**n + 8**n",
"+ans = pow(10, n, mod)",
"+ans -= pow(9, n, mod) * 2",
"+ans += pow(8, n, mod)"
] | false | 0.188054 | 0.035233 | 5.337427 | [
"s112565404",
"s346861897"
] |
u227082700 | p02863 | python | s036765388 | s561678396 | 773 | 709 | 183,640 | 183,384 | Accepted | Accepted | 8.28 | n,t=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(n)]
ab.sort()
dp=[6007*[0]for _ in range(n)]
ans=0
for i in range(n):
a,b=ab[i]
for j in range(6007):
if i==0:
if j>=a and j<t:dp[i][j]=b
elif j>=a and j-a<t:dp[i][j]=max(dp[i-1][j-a]+b,dp[i-1][j])
else:... | n,t=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(n)]
ab.sort()
dp=[6007*[0]for _ in range(n)]
for i in range(n):
a,b=ab[i]
for j in range(6007):
if i==0:
if j>=a and j<t:dp[i][j]=b
elif j>=a and j-a<t:dp[i][j]=max(dp[i-1][j-a]+b,dp[i-1][j])
else:dp[i][j... | 14 | 12 | 372 | 346 | n, t = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
dp = [6007 * [0] for _ in range(n)]
ans = 0
for i in range(n):
a, b = ab[i]
for j in range(6007):
if i == 0:
if j >= a and j < t:
dp[i][j] = b
elif j >= a and j -... | n, t = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
dp = [6007 * [0] for _ in range(n)]
for i in range(n):
a, b = ab[i]
for j in range(6007):
if i == 0:
if j >= a and j < t:
dp[i][j] = b
elif j >= a and j - a < t:
... | false | 14.285714 | [
"-ans = 0",
"- ans = max(ans, dp[i][j])",
"-print(ans)",
"+print((max(dp[-1])))"
] | false | 0.068932 | 0.05154 | 1.337437 | [
"s036765388",
"s561678396"
] |
u254871849 | p03447 | python | s550812657 | s589471834 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | import sys
x, a, b = list(map(int, sys.stdin.read().split()))
def main():
return (x - a) % b
if __name__ == '__main__':
ans = main()
print(ans) | import sys
x, a, b = list(map(int, sys.stdin.read().split()))
x -= a
def main():
q, r = divmod(x, b)
print(r)
if __name__ == '__main__':
main() | 10 | 11 | 161 | 163 | import sys
x, a, b = list(map(int, sys.stdin.read().split()))
def main():
return (x - a) % b
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
x, a, b = list(map(int, sys.stdin.read().split()))
x -= a
def main():
q, r = divmod(x, b)
print(r)
if __name__ == "__main__":
main()
| false | 9.090909 | [
"+x -= a",
"- return (x - a) % b",
"+ q, r = divmod(x, b)",
"+ print(r)",
"- ans = main()",
"- print(ans)",
"+ main()"
] | false | 0.065332 | 0.066549 | 0.981708 | [
"s550812657",
"s589471834"
] |
u027634846 | p02407 | python | s335667917 | s312818100 | 30 | 20 | 7,464 | 7,464 | Accepted | Accepted | 33.33 | n = eval(input())
numbers = input().split()
print((' '.join(numbers[::-1]))) | n = eval(input())
numbers = list(input().split())
print((" ".join(numbers[::-1]))) | 3 | 3 | 70 | 76 | n = eval(input())
numbers = input().split()
print((" ".join(numbers[::-1])))
| n = eval(input())
numbers = list(input().split())
print((" ".join(numbers[::-1])))
| false | 0 | [
"-numbers = input().split()",
"+numbers = list(input().split())"
] | false | 0.098457 | 0.035167 | 2.799682 | [
"s335667917",
"s312818100"
] |
u554781254 | p02915 | python | s889204279 | s321112941 | 181 | 24 | 38,384 | 3,568 | Accepted | Accepted | 86.74 | import sys
input = sys.stdin.readline
from itertools import *
from collections import *
INF = float('inf')
""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
D = [int(input()) for _ in range(N)]
"""
def main():
N = int(eval(input()))
print((... | import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float('inf')
NIL = - 1
N = int(eval(... | 21 | 13 | 365 | 339 | import sys
input = sys.stdin.readline
from itertools import *
from collections import *
INF = float("inf")
""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
D = [int(input()) for _ in range(N)]
"""
def main():
N = int(eval(input()))
print((N**3))
if __n... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float("inf")
NIL = -1
N = int(eval(input()))
print... | false | 38.095238 | [
"+sys.setrecursionlimit(10**9)",
"-from itertools import *",
"-from collections import *",
"+from itertools import permutations, combinations, accumulate",
"+from functools import *",
"+from collections import deque, defaultdict, Counter",
"+from heapq import heapify, heappop, heappush, heappushpop",
... | false | 0.101638 | 0.039199 | 2.592888 | [
"s889204279",
"s321112941"
] |
u298297089 | p03274 | python | s055832559 | s730410924 | 111 | 87 | 14,480 | 14,224 | Accepted | Accepted | 21.62 | N,K = list(map(int, input().split()))
X = []
idx = 0
for i,x in enumerate(input().split()):
x = int(x)
X.append(x)
if x < 0:
idx = i + 1
if idx == N:
idx = N-1
ans = 10**9
for i in range(max(0,idx-K), min(N-K+1,idx+K)):
ans = min(ans, X[i+K-1] - X[i] + min(abs(X[i]), abs(X[i+K-1]... | N,K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**9
for i in range(N-K+1):
ans = min(ans, X[i+K-1] - X[i] + min(abs(X[i]), abs(X[i+K-1])))
print(ans) | 14 | 6 | 329 | 186 | N, K = list(map(int, input().split()))
X = []
idx = 0
for i, x in enumerate(input().split()):
x = int(x)
X.append(x)
if x < 0:
idx = i + 1
if idx == N:
idx = N - 1
ans = 10**9
for i in range(max(0, idx - K), min(N - K + 1, idx + K)):
ans = min(ans, X[i + K - 1] - X[i] + min(abs(X[i]), abs(X[... | N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**9
for i in range(N - K + 1):
ans = min(ans, X[i + K - 1] - X[i] + min(abs(X[i]), abs(X[i + K - 1])))
print(ans)
| false | 57.142857 | [
"-X = []",
"-idx = 0",
"-for i, x in enumerate(input().split()):",
"- x = int(x)",
"- X.append(x)",
"- if x < 0:",
"- idx = i + 1",
"-if idx == N:",
"- idx = N - 1",
"+X = list(map(int, input().split()))",
"-for i in range(max(0, idx - K), min(N - K + 1, idx + K)):",
"+for i... | false | 0.035946 | 0.0423 | 0.849793 | [
"s055832559",
"s730410924"
] |
u532966492 | p02728 | python | s115355654 | s148497917 | 1,088 | 854 | 122,932 | 109,048 | Accepted | Accepted | 21.51 | def main():
from sys import stdin
input = stdin.readline
n = int(eval(input()))
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [[] for _ in [0]*n]
for a, b in ab:
g[a-1].append(b-1)
g[b-1].append(a-1)
mod = 10**9+7
fact = [1, 1]
inv = [po... | def main():
from sys import stdin
input = stdin.readline
n = int(eval(input()))
g = [[] for _ in [0]*n]
for _ in range(n-1):
a, b = list(map(int, input().split()))
g[a-1].append(b-1)
g[b-1].append(a-1)
mod = 10**9+7
fact = [1, 1]
inv = [1]*(n+1)
... | 81 | 88 | 2,014 | 2,674 | def main():
from sys import stdin
input = stdin.readline
n = int(eval(input()))
ab = [list(map(int, input().split())) for _ in [0] * (n - 1)]
g = [[] for _ in [0] * n]
for a, b in ab:
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
mod = 10**9 + 7
fact = [1, 1]
inv = [... | def main():
from sys import stdin
input = stdin.readline
n = int(eval(input()))
g = [[] for _ in [0] * n]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
mod = 10**9 + 7
fact = [1, 1]
inv = [1] * (n + 1)... | false | 7.954545 | [
"- ab = [list(map(int, input().split())) for _ in [0] * (n - 1)]",
"- for a, b in ab:",
"+ for _ in range(n - 1):",
"+ a, b = list(map(int, input().split()))",
"- inv = [pow(i, mod - 2, mod) for i in range(n + 1)]",
"+ inv = [1] * (n + 1)",
"- # merge:頂点aにbをマージするときのモノイド",
"- ... | false | 0.033937 | 0.056859 | 0.596856 | [
"s115355654",
"s148497917"
] |
u606045429 | p02773 | python | s093346969 | s086899283 | 413 | 302 | 38,392 | 38,392 | Accepted | Accepted | 26.88 | from collections import Counter
N, *S = open(0).read().split()
C = Counter(S)
ma = max(C.values())
ans = sorted(k for k, v in list(C.items()) if v == ma)
for a in ans:
print(a) | from collections import Counter
N, *S = open(0).read().split()
C = Counter(S)
ma = max(C.values())
ans = sorted(k for k, v in list(C.items()) if v == ma)
print(("\n".join(ans))) | 11 | 10 | 188 | 182 | from collections import Counter
N, *S = open(0).read().split()
C = Counter(S)
ma = max(C.values())
ans = sorted(k for k, v in list(C.items()) if v == ma)
for a in ans:
print(a)
| from collections import Counter
N, *S = open(0).read().split()
C = Counter(S)
ma = max(C.values())
ans = sorted(k for k, v in list(C.items()) if v == ma)
print(("\n".join(ans)))
| false | 9.090909 | [
"-for a in ans:",
"- print(a)",
"+print((\"\\n\".join(ans)))"
] | false | 0.035841 | 0.141822 | 0.252714 | [
"s093346969",
"s086899283"
] |
u678167152 | p03241 | python | s026650219 | s605474501 | 37 | 33 | 3,060 | 9,192 | Accepted | Accepted | 10.81 | N, M = list(map(int, input().split()))
i = 1
lis = []
while M//i>=N and i<=M**0.5:
if M % i == 0:
lis.append(i)
i += 1
for l in lis[::-1]:
ans = M//l
if M//ans>=N:
lis.append(ans)
print((lis[-1])) | def divisor(n):
cd = []
i = 1
while i*i <= n:
if n%i==0:
cd.append(i)
if i != n//i:
cd.append(n//i)
i += 1
return cd
N, M = list(map(int, input().split()))
cd = divisor(M)
cd.sort(reverse=True)
for c in cd:
if M//c>=N:
print(c)
break | 12 | 18 | 215 | 291 | N, M = list(map(int, input().split()))
i = 1
lis = []
while M // i >= N and i <= M**0.5:
if M % i == 0:
lis.append(i)
i += 1
for l in lis[::-1]:
ans = M // l
if M // ans >= N:
lis.append(ans)
print((lis[-1]))
| def divisor(n):
cd = []
i = 1
while i * i <= n:
if n % i == 0:
cd.append(i)
if i != n // i:
cd.append(n // i)
i += 1
return cd
N, M = list(map(int, input().split()))
cd = divisor(M)
cd.sort(reverse=True)
for c in cd:
if M // c >= N:
p... | false | 33.333333 | [
"+def divisor(n):",
"+ cd = []",
"+ i = 1",
"+ while i * i <= n:",
"+ if n % i == 0:",
"+ cd.append(i)",
"+ if i != n // i:",
"+ cd.append(n // i)",
"+ i += 1",
"+ return cd",
"+",
"+",
"-i = 1",
"-lis = []",
"-while M // i >... | false | 0.040357 | 0.039549 | 1.020416 | [
"s026650219",
"s605474501"
] |
u216392490 | p02577 | python | s943471388 | s930447234 | 71 | 28 | 9,264 | 9,044 | Accepted | Accepted | 60.56 | n = eval(input())
m = 0
for i in n:
m += int(i)
if m % 9:
print('No')
else:
print('Yes')
| n = eval(input())
total = 0
for i in range(10):
total += n.count(f'{i}') * i
print(('Yes' if total%9==0 else 'No'))
| 10 | 5 | 106 | 116 | n = eval(input())
m = 0
for i in n:
m += int(i)
if m % 9:
print("No")
else:
print("Yes")
| n = eval(input())
total = 0
for i in range(10):
total += n.count(f"{i}") * i
print(("Yes" if total % 9 == 0 else "No"))
| false | 50 | [
"-m = 0",
"-for i in n:",
"- m += int(i)",
"-if m % 9:",
"- print(\"No\")",
"-else:",
"- print(\"Yes\")",
"+total = 0",
"+for i in range(10):",
"+ total += n.count(f\"{i}\") * i",
"+print((\"Yes\" if total % 9 == 0 else \"No\"))"
] | false | 0.038377 | 0.037475 | 1.024073 | [
"s943471388",
"s930447234"
] |
u312025627 | p02912 | python | s028635073 | s453716265 | 702 | 404 | 96,920 | 72,088 | Accepted | Accepted | 42.45 | from heapq import heappush,heappop,heapify
from math import ceil
def main():
N, M = (int(i) for i in input().split())
A = [-int(i) for i in input().split()]
heapify(A)
for divcnt in range(M):
tmp = ceil(heappop(A)/2)
heappush(A,tmp)
print((-sum(A)))
if __name__ == "__main__... | def main():
from heapq import heappush,heappop,heapify
N, M = (int(i) for i in input().split())
A = [-int(i) for i in input().split()]
heapify(A)
for divcnt in range(M):
tmp = -heappop(A)
tmp //= 2
heappush(A,-tmp)
print((-sum(A)))
if __name__ == "__main__":
... | 12 | 12 | 333 | 327 | from heapq import heappush, heappop, heapify
from math import ceil
def main():
N, M = (int(i) for i in input().split())
A = [-int(i) for i in input().split()]
heapify(A)
for divcnt in range(M):
tmp = ceil(heappop(A) / 2)
heappush(A, tmp)
print((-sum(A)))
if __name__ == "__main__"... | def main():
from heapq import heappush, heappop, heapify
N, M = (int(i) for i in input().split())
A = [-int(i) for i in input().split()]
heapify(A)
for divcnt in range(M):
tmp = -heappop(A)
tmp //= 2
heappush(A, -tmp)
print((-sum(A)))
if __name__ == "__main__":
mai... | false | 0 | [
"-from heapq import heappush, heappop, heapify",
"-from math import ceil",
"+def main():",
"+ from heapq import heappush, heappop, heapify",
"-",
"-def main():",
"- tmp = ceil(heappop(A) / 2)",
"- heappush(A, tmp)",
"+ tmp = -heappop(A)",
"+ tmp //= 2",
"+ h... | false | 0.068564 | 0.078301 | 0.87565 | [
"s028635073",
"s453716265"
] |
u634159866 | p03062 | python | s712954723 | s393261109 | 72 | 63 | 14,468 | 14,332 | Accepted | Accepted | 12.5 | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
zero = 0
for i in range(N):
if A[i]<0:
cnt+=1
if A[i]==0:
zero+=1
B = list(map(abs, A))
if (N-zero)%2==0:
if cnt%2==0:
print((sum(B)))
else:
print((sum(B)-2*min(B)))
else... | N = int(eval(input()))
List = list(map(int, input().split()))
if (List.count(0)!=0)|((sum(x<0 for x in List)%2==0)):
print((sum([abs(List[i]) for i in range(N)])))
else:
nList = [abs(List[i]) for i in range(N)]
print((sum(nList)-2*min(nList))) | 22 | 9 | 395 | 255 | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
zero = 0
for i in range(N):
if A[i] < 0:
cnt += 1
if A[i] == 0:
zero += 1
B = list(map(abs, A))
if (N - zero) % 2 == 0:
if cnt % 2 == 0:
print((sum(B)))
else:
print((sum(B) - 2 * min(B)))
else:
if cnt ... | N = int(eval(input()))
List = list(map(int, input().split()))
if (List.count(0) != 0) | ((sum(x < 0 for x in List) % 2 == 0)):
print((sum([abs(List[i]) for i in range(N)])))
else:
nList = [abs(List[i]) for i in range(N)]
print((sum(nList) - 2 * min(nList)))
| false | 59.090909 | [
"-A = list(map(int, input().split()))",
"-cnt = 0",
"-zero = 0",
"-for i in range(N):",
"- if A[i] < 0:",
"- cnt += 1",
"- if A[i] == 0:",
"- zero += 1",
"-B = list(map(abs, A))",
"-if (N - zero) % 2 == 0:",
"- if cnt % 2 == 0:",
"- print((sum(B)))",
"- else:... | false | 0.036574 | 0.035618 | 1.026838 | [
"s712954723",
"s393261109"
] |
u203843959 | p02598 | python | s120472254 | s004721405 | 291 | 207 | 94,024 | 104,172 | Accepted | Accepted | 28.87 | N,K=list(map(int,input().split()))
alist=list(map(int,input().split()))
#print(alist)
def num_cut(x):
if x==0:
return float("inf")
ret=0
for a in alist:
ret+=-(-(a-x)//x)
return ret
#for i in range(1,max(alist)):
# print(i,num_cut(i))
l=1
r=max(alist)+1
while l<=r:
mid=(l+r)/... | N,K=list(map(int,input().split()))
alist=list(map(int,input().split()))
#print(alist)
memo={0:False}
def isOK(x):
if x in memo:
return memo[x]
num_cut=0
for a in alist:
num_cut+=-(-(a-x)//x)
if num_cut>K:
memo[x]=False
return False
memo[x]=True
return True
... | 29 | 31 | 466 | 484 | N, K = list(map(int, input().split()))
alist = list(map(int, input().split()))
# print(alist)
def num_cut(x):
if x == 0:
return float("inf")
ret = 0
for a in alist:
ret += -(-(a - x) // x)
return ret
# for i in range(1,max(alist)):
# print(i,num_cut(i))
l = 1
r = max(alist) + 1
while ... | N, K = list(map(int, input().split()))
alist = list(map(int, input().split()))
# print(alist)
memo = {0: False}
def isOK(x):
if x in memo:
return memo[x]
num_cut = 0
for a in alist:
num_cut += -(-(a - x) // x)
if num_cut > K:
memo[x] = False
return False
... | false | 6.451613 | [
"-def num_cut(x):",
"- if x == 0:",
"- return float(\"inf\")",
"- ret = 0",
"- for a in alist:",
"- ret += -(-(a - x) // x)",
"- return ret",
"+memo = {0: False}",
"-# for i in range(1,max(alist)):",
"-# print(i,num_cut(i))",
"+def isOK(x):",
"+ if x in memo:",
... | false | 0.056447 | 0.03767 | 1.498487 | [
"s120472254",
"s004721405"
] |
u537976628 | p03478 | python | s002404676 | s579923142 | 38 | 35 | 9,088 | 9,172 | Accepted | Accepted | 7.89 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
if a <= sum(list(map(int,str(i)))) <= b:
ans += i
print(ans) | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
tmp = 0
q = i
while q > 0:
tmp += q % 10
q //= 10
if a <= tmp <= b:
ans += i
print(ans) | 6 | 11 | 147 | 207 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
if a <= sum(list(map(int, str(i)))) <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
tmp = 0
q = i
while q > 0:
tmp += q % 10
q //= 10
if a <= tmp <= b:
ans += i
print(ans)
| false | 45.454545 | [
"- if a <= sum(list(map(int, str(i)))) <= b:",
"+ tmp = 0",
"+ q = i",
"+ while q > 0:",
"+ tmp += q % 10",
"+ q //= 10",
"+ if a <= tmp <= b:"
] | false | 0.047371 | 0.129519 | 0.365742 | [
"s002404676",
"s579923142"
] |
u692453235 | p02614 | python | s656273260 | s284350617 | 61 | 56 | 9,196 | 9,200 | Accepted | Accepted | 8.2 | H, W, K = list(map(int, input().split()))
C = [eval(input()) for _ in range(H)]
ans = 0
for row in range(1 << H):
for col in range(1 << W):
cnt = 0
for i in range(H):
for j in range(W):
if (row & (1 << i)) or (col & (1 << j)):
continue
if C[i][j] == '#':
... | import itertools
H, W, K = list(map(int, input().split()))
C = []
for i in range(H):
c = list(eval(input()))
C.append(c)
ans = 0
for h in itertools.product([0, 1], repeat = H):
for w in itertools.product([0, 1], repeat = W):
cnt = 0
for i in range(H):
for j in range(W):
... | 19 | 22 | 448 | 423 | H, W, K = list(map(int, input().split()))
C = [eval(input()) for _ in range(H)]
ans = 0
for row in range(1 << H):
for col in range(1 << W):
cnt = 0
for i in range(H):
for j in range(W):
if (row & (1 << i)) or (col & (1 << j)):
continue
... | import itertools
H, W, K = list(map(int, input().split()))
C = []
for i in range(H):
c = list(eval(input()))
C.append(c)
ans = 0
for h in itertools.product([0, 1], repeat=H):
for w in itertools.product([0, 1], repeat=W):
cnt = 0
for i in range(H):
for j in range(W):
... | false | 13.636364 | [
"+import itertools",
"+",
"-C = [eval(input()) for _ in range(H)]",
"+C = []",
"+for i in range(H):",
"+ c = list(eval(input()))",
"+ C.append(c)",
"-for row in range(1 << H):",
"- for col in range(1 << W):",
"+for h in itertools.product([0, 1], repeat=H):",
"+ for w in itertools.pro... | false | 0.03991 | 0.039588 | 1.00814 | [
"s656273260",
"s284350617"
] |
u368249389 | p02657 | python | s527847109 | s605067489 | 22 | 20 | 9,144 | 9,076 | Accepted | Accepted | 9.09 | # Problem A - Multiplication 1
# input
a, b = list(map(int, input().split()))
# output
print((a * b))
| # Problem a - Multiplication 1
# input
A, B = list(map(int, input().split()))
# initialization
ans = A * B
# output
print(ans)
| 7 | 10 | 102 | 133 | # Problem A - Multiplication 1
# input
a, b = list(map(int, input().split()))
# output
print((a * b))
| # Problem a - Multiplication 1
# input
A, B = list(map(int, input().split()))
# initialization
ans = A * B
# output
print(ans)
| false | 30 | [
"-# Problem A - Multiplication 1",
"+# Problem a - Multiplication 1",
"-a, b = list(map(int, input().split()))",
"+A, B = list(map(int, input().split()))",
"+# initialization",
"+ans = A * B",
"-print((a * b))",
"+print(ans)"
] | false | 0.03882 | 0.09193 | 0.422282 | [
"s527847109",
"s605067489"
] |
u057415180 | p02843 | python | s546887538 | s607090948 | 43 | 18 | 3,064 | 3,064 | Accepted | Accepted | 58.14 | x = int(eval(input()))
if x >= 2000:
print((1))
else:
c = x//100 + 1
am = x%100
for i in range(c):
for j in range(c-i):
for k in range(c-i-j):
for l in range(c-i-j-k):
for m in range(c-i-j-l):
if am == i*5 + j*4 +... | y = int(eval(input()))
dp = [0]*99
dp.insert(0,1)
if y >= 2000:
print((1))
else:
for x in range(100,y+1):
if dp[x-100] == 1 or dp[x-101] == 1 or dp[x-102] == 1 or dp[x-103] == 1 or dp[x-104] == 1 or dp[x-105] == 1:
dp.append(1)
else:
dp.append(0)
print((d... | 15 | 13 | 418 | 316 | x = int(eval(input()))
if x >= 2000:
print((1))
else:
c = x // 100 + 1
am = x % 100
for i in range(c):
for j in range(c - i):
for k in range(c - i - j):
for l in range(c - i - j - k):
for m in range(c - i - j - l):
if am == ... | y = int(eval(input()))
dp = [0] * 99
dp.insert(0, 1)
if y >= 2000:
print((1))
else:
for x in range(100, y + 1):
if (
dp[x - 100] == 1
or dp[x - 101] == 1
or dp[x - 102] == 1
or dp[x - 103] == 1
or dp[x - 104] == 1
or dp[x - 105] == ... | false | 13.333333 | [
"-x = int(eval(input()))",
"-if x >= 2000:",
"+y = int(eval(input()))",
"+dp = [0] * 99",
"+dp.insert(0, 1)",
"+if y >= 2000:",
"- c = x // 100 + 1",
"- am = x % 100",
"- for i in range(c):",
"- for j in range(c - i):",
"- for k in range(c - i - j):",
"- ... | false | 0.055004 | 0.033963 | 1.619503 | [
"s546887538",
"s607090948"
] |
u316603606 | p03493 | python | s686530466 | s161327290 | 27 | 24 | 9,092 | 9,064 | Accepted | Accepted | 11.11 | s = eval(input ())
c = 0
for i in range (3):
if s[i] == '1':
c += 1
print (c) | a = eval(input ())
print((a.count ('1')))
| 6 | 2 | 88 | 36 | s = eval(input())
c = 0
for i in range(3):
if s[i] == "1":
c += 1
print(c)
| a = eval(input())
print((a.count("1")))
| false | 66.666667 | [
"-s = eval(input())",
"-c = 0",
"-for i in range(3):",
"- if s[i] == \"1\":",
"- c += 1",
"-print(c)",
"+a = eval(input())",
"+print((a.count(\"1\")))"
] | false | 0.11343 | 0.046988 | 2.413996 | [
"s686530466",
"s161327290"
] |
u102461423 | p03785 | python | s009690087 | s797488647 | 114 | 105 | 7,384 | 12,508 | Accepted | Accepted | 7.89 | import sys
input = sys.stdin.readline
N,C,K = list(map(int,input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
answer = 0
first = -K
rest = C
for t in T:
if first + K >= t and rest > 0:
# 乗れる
rest -= 1
continue
# 乗れない
answer += 1
first = t
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# greedy
N,C,K,*T = list(map(int,read().split()))
T.sort()
bus_t = -K - 100
bus_c = C
answer = 0
for t in T:
bl = (bus_t + K >= t) and (bus_c + 1 <= C)
if bl:
bus_c +=... | 21 | 24 | 337 | 398 | import sys
input = sys.stdin.readline
N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
answer = 0
first = -K
rest = C
for t in T:
if first + K >= t and rest > 0:
# 乗れる
rest -= 1
continue
# 乗れない
answer += 1
first = t
rest = C - 1
p... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# greedy
N, C, K, *T = list(map(int, read().split()))
T.sort()
bus_t = -K - 100
bus_c = C
answer = 0
for t in T:
bl = (bus_t + K >= t) and (bus_c + 1 <= C)
if bl:
bus_c += 1
conti... | false | 12.5 | [
"-input = sys.stdin.readline",
"-N, C, K = list(map(int, input().split()))",
"-T = [int(eval(input())) for _ in range(N)]",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+# greedy",
"+N, C, K, *T = list(map(int, read().split()))",... | false | 0.041381 | 0.03915 | 1.05697 | [
"s009690087",
"s797488647"
] |
u170077602 | p03169 | python | s638080988 | s230360990 | 1,731 | 1,342 | 260,104 | 258,312 | Accepted | Accepted | 22.47 | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
IJK = [0,0,0]
for i in range(N):
IJK[a[i]-1]+=1
dp = [[[0.0]*(N+3) for _ in range(N+3)] for _ in range(N+3)]
for k in range(N+1):
for j in range(N+1):
for i in range(N+1):
if i+j... | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
IJK = [0,0,0]
for i in range(N):
IJK[a[i]-1]+=1
dp = [[[float(0)]*(N+3) for _ in range(N+3)] for _ in range(N+3)]
for k in range(N+1):
for j in range(N+1):
for i in range(N+1):
i... | 24 | 24 | 607 | 624 | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
IJK = [0, 0, 0]
for i in range(N):
IJK[a[i] - 1] += 1
dp = [[[0.0] * (N + 3) for _ in range(N + 3)] for _ in range(N + 3)]
for k in range(N + 1):
for j in range(N + 1):
for i in range(N + 1):
if... | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
IJK = [0, 0, 0]
for i in range(N):
IJK[a[i] - 1] += 1
dp = [[[float(0)] * (N + 3) for _ in range(N + 3)] for _ in range(N + 3)]
for k in range(N + 1):
for j in range(N + 1):
for i in range(N + 1):
... | false | 0 | [
"-dp = [[[0.0] * (N + 3) for _ in range(N + 3)] for _ in range(N + 3)]",
"+dp = [[[float(0)] * (N + 3) for _ in range(N + 3)] for _ in range(N + 3)]",
"- tmp += i * dp[i - 1][j][k]",
"+ tmp += i * dp[i - 1][j][k] * 1.0",
"- tmp += j * dp[i + 1][j - 1][k]",
"+ ... | false | 0.04554 | 0.048948 | 0.930375 | [
"s638080988",
"s230360990"
] |
u761320129 | p03262 | python | s414244880 | s362570689 | 138 | 99 | 16,296 | 16,296 | Accepted | Accepted | 28.26 | from fractions import gcd
N,X = list(map(int,input().split()))
src = list(map(int,input().split()))
src.sort()
g = abs(X - src[0])
for a,b in zip(src,src[1:]):
d = b-a
g = gcd(g, d)
print(g) | from fractions import gcd
N,X = list(map(int,input().split()))
src = list(map(int,input().split()))
g = abs(X-src[0])
for x in src[1:]:
g = gcd(g,abs(X-x))
print(g) | 10 | 9 | 202 | 172 | from fractions import gcd
N, X = list(map(int, input().split()))
src = list(map(int, input().split()))
src.sort()
g = abs(X - src[0])
for a, b in zip(src, src[1:]):
d = b - a
g = gcd(g, d)
print(g)
| from fractions import gcd
N, X = list(map(int, input().split()))
src = list(map(int, input().split()))
g = abs(X - src[0])
for x in src[1:]:
g = gcd(g, abs(X - x))
print(g)
| false | 10 | [
"-src.sort()",
"-for a, b in zip(src, src[1:]):",
"- d = b - a",
"- g = gcd(g, d)",
"+for x in src[1:]:",
"+ g = gcd(g, abs(X - x))"
] | false | 0.042702 | 0.043402 | 0.983858 | [
"s414244880",
"s362570689"
] |
u375695365 | p02759 | python | s828876840 | s054919926 | 181 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.61 | n=int(eval(input()))
if n%2==1:
print((n//2+1))
else:
print((n//2)) | n=int(eval(input()))
print(((n+1)//2)) | 5 | 3 | 69 | 33 | n = int(eval(input()))
if n % 2 == 1:
print((n // 2 + 1))
else:
print((n // 2))
| n = int(eval(input()))
print(((n + 1) // 2))
| false | 40 | [
"-if n % 2 == 1:",
"- print((n // 2 + 1))",
"-else:",
"- print((n // 2))",
"+print(((n + 1) // 2))"
] | false | 0.118214 | 0.086609 | 1.36492 | [
"s828876840",
"s054919926"
] |
u677523557 | p03722 | python | s075200304 | s585658883 | 928 | 227 | 3,440 | 42,736 | Accepted | Accepted | 75.54 | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
graph = []
for _ in range(M):
a, b, d = list(map(int, input().split()))
graph.append([a-1, b-1, -d])
INF = int(1E18)
D = [INF for _ in range(N)]
D[0] = 0
for c in ran... | import sys
input = sys.stdin.readline
INF = 10**17
N, M = list(map(int, input().split()))
Edges = [list(map(int, input().split())) for _ in range(M)]
def bfs(graph, start):
checked = [False]*N
checked[start] = True
q = [start]
while q:
qq = []
for p in q:
... | 42 | 53 | 964 | 1,125 | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
graph = []
for _ in range(M):
a, b, d = list(map(int, input().split()))
graph.append([a - 1, b - 1, -d])
INF = int(1e18)
D = [INF for _ in range(N)]
D[0] = 0
for c in range(N - 1):
... | import sys
input = sys.stdin.readline
INF = 10**17
N, M = list(map(int, input().split()))
Edges = [list(map(int, input().split())) for _ in range(M)]
def bfs(graph, start):
checked = [False] * N
checked[start] = True
q = [start]
while q:
qq = []
for p in q:
for np in graph... | false | 20.754717 | [
"+INF = 10**17",
"+N, M = list(map(int, input().split()))",
"+Edges = [list(map(int, input().split())) for _ in range(M)]",
"-def main():",
"- N, M = list(map(int, input().split()))",
"- graph = []",
"- for _ in range(M):",
"- a, b, d = list(map(int, input().split()))",
"- gra... | false | 0.038508 | 0.044474 | 0.865849 | [
"s075200304",
"s585658883"
] |
u506858457 | p02762 | python | s152812953 | s834155149 | 1,533 | 958 | 41,492 | 60,724 | Accepted | Accepted | 37.51 | #Satoooh blog
class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(n)] # 親
self.rank = [1] * n # 木の高さ
self.size = [1] * n # size[i] は i を根とするグループのサイズ
def find(self, x): # x の根を返す
if self.parent[x] == x:
return x
... | #ika tako
import sys
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
if self.table[x] < 0:
return x
else:
self.table[x] = self._root(self.table[x])
return self.table[x]
def count(self, x):
... | 62 | 54 | 1,780 | 1,389 | # Satoooh blog
class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(n)] # 親
self.rank = [1] * n # 木の高さ
self.size = [1] * n # size[i] は i を根とするグループのサイズ
def find(self, x): # x の根を返す
if self.parent[x] == x:
return x
else... | # ika tako
import sys
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
if self.table[x] < 0:
return x
else:
self.table[x] = self._root(self.table[x])
return self.table[x]
def count(self, x):
return -self... | false | 12.903226 | [
"-# Satoooh blog",
"+# ika tako",
"+import sys",
"+",
"+",
"- self.n = n",
"- self.parent = [i for i in range(n)] # 親",
"- self.rank = [1] * n # 木の高さ",
"- self.size = [1] * n # size[i] は i を根とするグループのサイズ",
"+ self.table = [-1] * n",
"- def find(self, x): ... | false | 0.039081 | 0.044795 | 0.872439 | [
"s152812953",
"s834155149"
] |
u695429668 | p03779 | python | s615752888 | s934251633 | 30 | 25 | 4,888 | 2,940 | Accepted | Accepted | 16.67 |
N = int(eval(input()))
count = 0
i = 0
buff = 0
a = []
ans = 0
while True:
a.append(buff)
if buff >= N:
break
i += 1
buff += i
print(i) | N = int(eval(input()))
ans = 0
for i in range(N+1):
ans += i
if N <= ans:
print(i)
exit() | 15 | 9 | 169 | 117 | N = int(eval(input()))
count = 0
i = 0
buff = 0
a = []
ans = 0
while True:
a.append(buff)
if buff >= N:
break
i += 1
buff += i
print(i)
| N = int(eval(input()))
ans = 0
for i in range(N + 1):
ans += i
if N <= ans:
print(i)
exit()
| false | 40 | [
"-count = 0",
"-i = 0",
"-buff = 0",
"-a = []",
"-while True:",
"- a.append(buff)",
"- if buff >= N:",
"- break",
"- i += 1",
"- buff += i",
"-print(i)",
"+for i in range(N + 1):",
"+ ans += i",
"+ if N <= ans:",
"+ print(i)",
"+ exit()"
] | false | 0.046498 | 0.048145 | 0.965796 | [
"s615752888",
"s934251633"
] |
u867848444 | p03545 | python | s792759531 | s501004402 | 187 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.91 | s=eval(input())
n=len(s)-1
for i in range(2**n):
op=['-']*n
for j in range(n):
if ((i>>j)&1):
op[n-1-j]='+'
formula=''
for x,y in zip(s,op+['']):#sとopの長さをそろえている(多分
formula+=(x+y)
if eval(formula)==7:
print((formula+'=7'))
break | #79-C:DFS
def dfs(i,f,f_sum):
if i==3:
if f_sum==7:
print((f+'=7'))
exit()
else:
dfs(i+1,f+'+'+s[i+1],f_sum+int(s[i+1]))
dfs(i+1,f+'-'+s[i+1],f_sum-int(s[i+1]))
s=eval(input())
dfs(0,s[0],int(s[0])) | 15 | 13 | 299 | 260 | s = eval(input())
n = len(s) - 1
for i in range(2**n):
op = ["-"] * n
for j in range(n):
if (i >> j) & 1:
op[n - 1 - j] = "+"
formula = ""
for x, y in zip(s, op + [""]): # sとopの長さをそろえている(多分
formula += x + y
if eval(formula) == 7:
print((formula + "=7"))
b... | # 79-C:DFS
def dfs(i, f, f_sum):
if i == 3:
if f_sum == 7:
print((f + "=7"))
exit()
else:
dfs(i + 1, f + "+" + s[i + 1], f_sum + int(s[i + 1]))
dfs(i + 1, f + "-" + s[i + 1], f_sum - int(s[i + 1]))
s = eval(input())
dfs(0, s[0], int(s[0]))
| false | 13.333333 | [
"+# 79-C:DFS",
"+def dfs(i, f, f_sum):",
"+ if i == 3:",
"+ if f_sum == 7:",
"+ print((f + \"=7\"))",
"+ exit()",
"+ else:",
"+ dfs(i + 1, f + \"+\" + s[i + 1], f_sum + int(s[i + 1]))",
"+ dfs(i + 1, f + \"-\" + s[i + 1], f_sum - int(s[i + 1]))",
"+... | false | 0.046576 | 0.037149 | 1.253749 | [
"s792759531",
"s501004402"
] |
u203843959 | p02658 | python | s171646014 | s848314621 | 74 | 51 | 21,604 | 21,792 | Accepted | Accepted | 31.08 | import sys
N=int(eval(input()))
alist=list(map(int,input().split()))
alist.sort()
if alist[0]==0:
print((0))
sys.exit(0)
answer=1
e18=10**18
for a in alist:
answer*=a
if answer>e18:
print((-1))
break
else:
print(answer) | import sys
N=int(eval(input()))
alist=list(map(int,input().split()))
if 0 in alist:
print((0))
sys.exit(0)
answer=1
e18=10**18
for a in alist:
answer*=a
if answer>e18:
print((-1))
break
else:
print(answer) | 18 | 17 | 246 | 231 | import sys
N = int(eval(input()))
alist = list(map(int, input().split()))
alist.sort()
if alist[0] == 0:
print((0))
sys.exit(0)
answer = 1
e18 = 10**18
for a in alist:
answer *= a
if answer > e18:
print((-1))
break
else:
print(answer)
| import sys
N = int(eval(input()))
alist = list(map(int, input().split()))
if 0 in alist:
print((0))
sys.exit(0)
answer = 1
e18 = 10**18
for a in alist:
answer *= a
if answer > e18:
print((-1))
break
else:
print(answer)
| false | 5.555556 | [
"-alist.sort()",
"-if alist[0] == 0:",
"+if 0 in alist:"
] | false | 0.037716 | 0.037855 | 0.99632 | [
"s171646014",
"s848314621"
] |
u419877586 | p02990 | python | s602327762 | s152391858 | 294 | 239 | 51,052 | 43,760 | Accepted | Accepted | 18.71 | mod=10**9+7
def framod(n, a=1):
for i in range(1,n+1):
a=a * i % mod
return a
def power(n, r):
if r == 0: return 1
if r%2 == 0:
return power(n*n % mod, r//2) % mod
if r%2 == 1:
return n * power(n, r-1) % mod
def comb(n, k):
a=framod(n)
b=framod(k)
c=framod(n-k)
re... | def comb(n, r):
if r<0 or r>n:
return 0
r=min(r, n-r)
return g1[n]*g2[r]*g2[n-r]%MOD
MOD=10**9+7
MAXN=4000+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]
for i in range(2, MAXN+1):
g1.append((g1[-1]*i)%MOD)
inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
g2.append((g2[-1]*inverse[-1... | 26 | 34 | 531 | 654 | mod = 10**9 + 7
def framod(n, a=1):
for i in range(1, n + 1):
a = a * i % mod
return a
def power(n, r):
if r == 0:
return 1
if r % 2 == 0:
return power(n * n % mod, r // 2) % mod
if r % 2 == 1:
return n * power(n, r - 1) % mod
def comb(n, k):
a = framod(n)
... | def comb(n, r):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % MOD
MOD = 10**9 + 7
MAXN = 4000 + 10
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, MAXN + 1):
g1.append((g1[-1] * i) % MOD)
inverse.append(-inverse[MOD % i] * (MOD // i) % MOD)
... | false | 23.529412 | [
"-mod = 10**9 + 7",
"+def comb(n, r):",
"+ if r < 0 or r > n:",
"+ return 0",
"+ r = min(r, n - r)",
"+ return g1[n] * g2[r] * g2[n - r] % MOD",
"-def framod(n, a=1):",
"- for i in range(1, n + 1):",
"- a = a * i % mod",
"- return a",
"+MOD = 10**9 + 7",
"+MAXN = 4... | false | 0.037147 | 0.03925 | 0.946429 | [
"s602327762",
"s152391858"
] |
u743420240 | p02702 | python | s745415620 | s894556390 | 366 | 332 | 18,168 | 10,704 | Accepted | Accepted | 9.29 | # -*- coding: utf-8 -*-
def main():
# 入力
st = eval(input())
# 右からi文字目から最後の数字までを数値化したものについてmodを計算していく
mod_res_dic = {0: [0]}
tmp_mod_val = 0
r_st = ''.join(list(reversed(st)))
cnt = 0
for i in range(len(r_st)):
target_st = r_st[i:i+1]
tmp_mod_val += int(ta... | # -*- coding: utf-8 -*-
def main():
# 入力
st = eval(input())
# 右からi文字目から最後の数字までを数値化したものについてmodを計算していく
mod_res_dic = {0: 1}
tmp_mod_val = 0
r_st = ''.join(list(reversed(st)))
cnt = 0
for i in range(len(r_st)):
target_st = r_st[i:i+1]
tmp_mod_val += int(targ... | 25 | 25 | 537 | 534 | # -*- coding: utf-8 -*-
def main():
# 入力
st = eval(input())
# 右からi文字目から最後の数字までを数値化したものについてmodを計算していく
mod_res_dic = {0: [0]}
tmp_mod_val = 0
r_st = "".join(list(reversed(st)))
cnt = 0
for i in range(len(r_st)):
target_st = r_st[i : i + 1]
tmp_mod_val += int(target_st) * po... | # -*- coding: utf-8 -*-
def main():
# 入力
st = eval(input())
# 右からi文字目から最後の数字までを数値化したものについてmodを計算していく
mod_res_dic = {0: 1}
tmp_mod_val = 0
r_st = "".join(list(reversed(st)))
cnt = 0
for i in range(len(r_st)):
target_st = r_st[i : i + 1]
tmp_mod_val += int(target_st) * pow(... | false | 0 | [
"- mod_res_dic = {0: [0]}",
"+ mod_res_dic = {0: 1}",
"- ls = mod_res_dic.setdefault(tmp_mod_val, [])",
"- ls.append(i - 1)",
"- if len(ls) > 1:",
"- cnt += len(ls) - 1",
"- print((int(cnt)))",
"+ ls = mod_res_dic.setdefault(tmp_mod_val, 0)",
"+ ... | false | 0.09291 | 0.109626 | 0.847516 | [
"s745415620",
"s894556390"
] |
u232652798 | p02639 | python | s890149818 | s757319050 | 27 | 24 | 9,028 | 9,004 | Accepted | Accepted | 11.11 | array = list(map(int,input().split()))
for i in range(len(array)):
if array[i] == 0:
print((i+1))
break | lista = [int(x) for x in input().split()]
for i in range(len(lista)):
if lista[i] == 0:
print((i+1))
exit() | 6 | 6 | 127 | 131 | array = list(map(int, input().split()))
for i in range(len(array)):
if array[i] == 0:
print((i + 1))
break
| lista = [int(x) for x in input().split()]
for i in range(len(lista)):
if lista[i] == 0:
print((i + 1))
exit()
| false | 0 | [
"-array = list(map(int, input().split()))",
"-for i in range(len(array)):",
"- if array[i] == 0:",
"+lista = [int(x) for x in input().split()]",
"+for i in range(len(lista)):",
"+ if lista[i] == 0:",
"- break",
"+ exit()"
] | false | 0.094273 | 0.045349 | 2.078814 | [
"s890149818",
"s757319050"
] |
u730769327 | p03044 | python | s924732952 | s990582912 | 528 | 330 | 93,176 | 99,332 | Accepted | Accepted | 37.5 | import queue
n=int(eval(input()))
e=[[] for _ in range(n)]
INF=10**18
d=[INF]*n
for _ in range(n-1):
v,u,w=list(map(int,input().split()))
e[v-1]+=[(u-1,w)]
e[u-1]+=[(v-1,w)]
q=queue.Queue()
q.put(0)
d[0]=0
while not q.empty():
now=q.get()
for to,dis in e[now]:
if d[to]==INF:
d[to]=d[... | from collections import deque
n=int(input())
e=[[]for _ in range(n+1)]
c=[-1]*(n+1)
for _ in range(n-1):
a,b,w=map(int,input().split())
e[a]+=[(b,w)]
e[b]+=[(a,w)]
q=deque([1])
c[1]=0
while q:
now=q.popleft()
for to,w in e[now]:
if c[to]==-1:
c[to]=(c[now]+w)%2
q.append(to)
pri... | 20 | 17 | 360 | 339 | import queue
n = int(eval(input()))
e = [[] for _ in range(n)]
INF = 10**18
d = [INF] * n
for _ in range(n - 1):
v, u, w = list(map(int, input().split()))
e[v - 1] += [(u - 1, w)]
e[u - 1] += [(v - 1, w)]
q = queue.Queue()
q.put(0)
d[0] = 0
while not q.empty():
now = q.get()
for to, dis in e[now]:
... | from collections import deque
n = int(input())
e = [[] for _ in range(n + 1)]
c = [-1] * (n + 1)
for _ in range(n - 1):
a, b, w = map(int, input().split())
e[a] += [(b, w)]
e[b] += [(a, w)]
q = deque([1])
c[1] = 0
while q:
now = q.popleft()
for to, w in e[now]:
if c[to] == -1:
c... | false | 15 | [
"-import queue",
"+from collections import deque",
"-n = int(eval(input()))",
"-e = [[] for _ in range(n)]",
"-INF = 10**18",
"-d = [INF] * n",
"+n = int(input())",
"+e = [[] for _ in range(n + 1)]",
"+c = [-1] * (n + 1)",
"- v, u, w = list(map(int, input().split()))",
"- e[v - 1] += [(u -... | false | 0.037911 | 0.041825 | 0.906437 | [
"s924732952",
"s990582912"
] |
u163783894 | p03086 | python | s654718932 | s639618270 | 175 | 19 | 38,384 | 3,064 | Accepted | Accepted | 89.14 | import math
import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import sys
# import bisect
# import numpy as np
# from scipy.special import comb
def main():
S = eval(input())
acgt = set(['A', 'C', 'G', 'T'])
ans = 0
for i in range(... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
def main():
S = eval(input())
ans = 0
count = 0
for i in range(len(S)):
if S[i] in ('A', 'C', 'G', 'T'):
count += 1... | 29 | 26 | 575 | 450 | import math
import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import sys
# import bisect
# import numpy as np
# from scipy.special import comb
def main():
S = eval(input())
acgt = set(["A", "C", "G", "T"])
ans = 0
for i in range(1, len(S) + 1):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
def main():
S = eval(input())
ans = 0
count = 0
for i in range(len(S)):
if S[i] in ("A", "C", "G", "T"):
count += 1
ans =... | false | 10.344828 | [
"-import math",
"-import itertools",
"+import sys",
"-# from collections import deque",
"-# from collections import defaultdict",
"-# import heapq",
"-# import sys",
"-# import bisect",
"-# import numpy as np",
"-# from scipy.special import comb",
"+read = sys.stdin.buffer.read",
"+readline = ... | false | 0.081341 | 0.044365 | 1.833449 | [
"s654718932",
"s639618270"
] |
u811733736 | p00462 | python | s197584101 | s137237627 | 240 | 200 | 17,036 | 12,824 | Accepted | Accepted | 16.67 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline
def main(args):
while True:
d = int(eval(input())) # ??°??¶????????????
if d == 0:
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539
AC
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline
def main(args):
while True:
d = int(eval(input())) # ??°??¶????????????
if d == 0:
... | 49 | 47 | 1,146 | 1,550 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline
def main(args):
while True:
d = int(eval(input())) # ??°??¶????????????
if d == 0:
break
n = ... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539
AC
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline
def main(args):
while True:
d = int(eval(input())) # ??°??¶????????????
if d == 0:
break
n... | false | 4.081633 | [
"+AC",
"- cw_pos.append(0)",
"- cw_pos.append(d)",
"+ cw_pos.append(0) # ??¬????????????",
"+ cw_pos.append(d) # ??°??¶??????1??¨??????????????¬????????????(??????)",
"- ccw_pos = [d - x for x in cw_pos]",
"- ccw_pos.sort()",
"+ # ccw_pos = [... | false | 0.041895 | 0.041425 | 1.011333 | [
"s197584101",
"s137237627"
] |
u535803878 | p02703 | python | s512772690 | s335028797 | 1,913 | 1,721 | 123,604 | 124,904 | Accepted | Accepted | 10.04 | import sys
input = lambda : sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: set() for u in range(n)}
uv2e = {}
for i in range(m):
u,v,a[i],b[i] = list(ma... | import sys
input = lambda : sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: [] for u in range(n)}
uv2e = {}
for i in range(m):
u,v,a[i],b[i] = list(map(i... | 50 | 50 | 1,234 | 1,237 | import sys
input = lambda: sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: set() for u in range(n)}
uv2e = {}
for i in range(m):
u, v, a[i], b[i] = list(map(int, input(... | import sys
input = lambda: sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: [] for u in range(n)}
uv2e = {}
for i in range(m):
u, v, a[i], b[i] = list(map(int, input().s... | false | 0 | [
"-ns = {u: set() for u in range(n)}",
"+ns = {u: [] for u in range(n)}",
"- ns[u - 1].add(v - 1)",
"- ns[v - 1].add(u - 1)",
"+ ns[u - 1].append(v - 1)",
"+ ns[v - 1].append(u - 1)"
] | false | 0.049561 | 0.037926 | 1.306772 | [
"s512772690",
"s335028797"
] |
u113971909 | p03078 | python | s221632603 | s603972071 | 51 | 36 | 4,852 | 4,852 | Accepted | Accepted | 29.41 | X,Y,Z,K = list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
from heapq import heapify, heappop, heappush, heappushpop
hp=[]
hist=set([])
heapify(hp)
hp0=[-(A[0]+B[0... | ##############################
# priority que
##############################
X,Y,Z,K = list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
def Nmb(tp):
return A[t... | 29 | 42 | 837 | 970 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
from heapq import heapify, heappop, heappush, heappushpop
hp = []
hist = set([])
heapify(hp)
hp0 = [-(A... | ##############################
# priority que
##############################
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
def Nmb(tp):
return A... | false | 30.952381 | [
"+##############################",
"+# priority que",
"+##############################",
"+",
"+",
"+def Nmb(tp):",
"+ return A[tp[0] - 1] + B[tp[1] - 1] + C[tp[2] - 1]",
"+",
"+",
"-hist = set([])",
"-hp0 = [-(A[0] + B[0] + C[0]), 1, 1, 1]",
"-heappush(hp, hp0)",
"-hist.add(tuple(hp0[1:]... | false | 0.037049 | 0.061685 | 0.600609 | [
"s221632603",
"s603972071"
] |
u794910686 | p02819 | python | s566149173 | s682582097 | 26 | 17 | 2,940 | 2,940 | Accepted | Accepted | 34.62 | x=int(eval(input()))
def primeddx(x):
for i in range(2,x):
if x%i==0:
return False
return True
while not primeddx(x):
x+=1
print(x) | x=int(eval(input()))
def primeddx(x):
for i in range(2,int(x**0.5)):
if x%i==0:
return False
return True
while not primeddx(x):
x+=1
print(x) | 10 | 10 | 167 | 177 | x = int(eval(input()))
def primeddx(x):
for i in range(2, x):
if x % i == 0:
return False
return True
while not primeddx(x):
x += 1
print(x)
| x = int(eval(input()))
def primeddx(x):
for i in range(2, int(x**0.5)):
if x % i == 0:
return False
return True
while not primeddx(x):
x += 1
print(x)
| false | 0 | [
"- for i in range(2, x):",
"+ for i in range(2, int(x**0.5)):"
] | false | 0.053845 | 0.05016 | 1.073452 | [
"s566149173",
"s682582097"
] |
u744920373 | p02814 | python | s791835246 | s066145494 | 1,709 | 855 | 16,308 | 16,348 | Accepted | Accepted | 49.97 | import fractions
from functools import reduce
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def factorization(n):
arr = []
temp = n
for i in range(2,... | import fractions
from functools import reduce
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def factorization(n):
arr = []
temp = n
for i in range... | 68 | 66 | 1,383 | 1,314 | import fractions
from functools import reduce
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5... | import fractions
from functools import reduce
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5... | false | 2.941176 | [
"-A = sorted(list(map(int, input().split())))",
"+A = list(map(int, input().split()))",
"-sisu_2 = min([factorization(A[i])[0][1] for i in range(min(1000, N))])",
"-\"\"\"",
"+flag = 0",
"- while A[i]%2==0:",
"+ while A[i] % 2 == 0:",
"- if sisu_a0==0:",
"+ if sisu_a0 == 0:",
"- ... | false | 0.04915 | 0.108202 | 0.454241 | [
"s791835246",
"s066145494"
] |
u996434204 | p02713 | python | s464328976 | s500567386 | 1,621 | 948 | 9,852 | 69,776 | Accepted | Accepted | 41.52 | import math
from functools import reduce
n = int(eval(input()))
ans = 0
li = []
buf = n
for i in range(1,n+1):
for j in range(1,n+1):
tmp = math.gcd(i,j)
li.append(tmp)
for i in range(len(li)):
for j in range(1,n+1):
ans += math.gcd(li[i],j)
print(ans)
| import math
from functools import reduce
n = int(eval(input()))
ans = 0
li = []
buf = n
def gcd(*numbers):
return reduce(math.gcd,numbers)
for i in range(1,n+1):
for j in range(1,n+1):
for k in range(1,n+1):
ans += gcd(i,j,k)
print(ans)
| 16 | 16 | 296 | 277 | import math
from functools import reduce
n = int(eval(input()))
ans = 0
li = []
buf = n
for i in range(1, n + 1):
for j in range(1, n + 1):
tmp = math.gcd(i, j)
li.append(tmp)
for i in range(len(li)):
for j in range(1, n + 1):
ans += math.gcd(li[i], j)
print(ans)
| import math
from functools import reduce
n = int(eval(input()))
ans = 0
li = []
buf = n
def gcd(*numbers):
return reduce(math.gcd, numbers)
for i in range(1, n + 1):
for j in range(1, n + 1):
for k in range(1, n + 1):
ans += gcd(i, j, k)
print(ans)
| false | 0 | [
"+",
"+",
"+def gcd(*numbers):",
"+ return reduce(math.gcd, numbers)",
"+",
"+",
"- tmp = math.gcd(i, j)",
"- li.append(tmp)",
"-for i in range(len(li)):",
"- for j in range(1, n + 1):",
"- ans += math.gcd(li[i], j)",
"+ for k in range(1, n + 1):",
"+ ... | false | 0.163092 | 0.036543 | 4.463069 | [
"s464328976",
"s500567386"
] |
u896741788 | p02574 | python | s764445934 | s257347437 | 706 | 342 | 191,912 | 189,072 | Accepted | Accepted | 51.56 | n,a=int(eval(input())),list(map(int,input().split()))
g=0
from math import gcd
for i in a:g=gcd(i,g)
if g!=1:print("not coprime")
else:
from collections import defaultdict
memo=defaultdict(int)
for i in a:
for p in range(2,int(i**.5)+1):
if i%p==0:
while i%p==0... | n,a=int(eval(input())),list(map(int,input().split()))
g=0
from math import gcd
for i in a:g=gcd(i,g)
if g!=1:print("not coprime")
else:
primes=list(range(10**6+1))
primes[0]=primes[1]=0
for i in range(2,10**6+1):
if primes[i]==i:
for j in range(2*i,10**6,i):primes[j]=i
p... | 19 | 20 | 559 | 527 | n, a = int(eval(input())), list(map(int, input().split()))
g = 0
from math import gcd
for i in a:
g = gcd(i, g)
if g != 1:
print("not coprime")
else:
from collections import defaultdict
memo = defaultdict(int)
for i in a:
for p in range(2, int(i**0.5) + 1):
if i % p == 0:
... | n, a = int(eval(input())), list(map(int, input().split()))
g = 0
from math import gcd
for i in a:
g = gcd(i, g)
if g != 1:
print("not coprime")
else:
primes = list(range(10**6 + 1))
primes[0] = primes[1] = 0
for i in range(2, 10**6 + 1):
if primes[i] == i:
for j in range(2 * i, ... | false | 5 | [
"- from collections import defaultdict",
"-",
"- memo = defaultdict(int)",
"- for i in a:",
"- for p in range(2, int(i**0.5) + 1):",
"- if i % p == 0:",
"- while i % p == 0:",
"- i //= p",
"- if memo[p]:",
"- ... | false | 0.041852 | 0.762341 | 0.054899 | [
"s764445934",
"s257347437"
] |
u171366497 | p03972 | python | s127708844 | s966559865 | 528 | 296 | 11,500 | 11,792 | Accepted | Accepted | 43.94 | W,H=list(map(int,input().split()))
P=[int(eval(input())) for i in range(W)]
Q=[int(eval(input())) for j in range(H)]
P.append(float('inf'))
Q.append(float('inf'))
P.sort(reverse=True)
Q.sort(reverse=True)
now_W=W+1
now_H=H+1
cost=0
while now_W>1 or now_H>1:
if P[-1]<Q[-1]:
cost+=P.pop()*now_H
... | import sys
input=sys.stdin.readline
W,H=list(map(int,input().split()))
P=[int(eval(input())) for _ in range(W)]+[float('inf')]
Q=[int(eval(input())) for _ in range(H)]+[float('inf')]
P.sort(reverse=True)
Q.sort(reverse=True)
ans=0
W+=1
H+=1
while True:
if W==H==1:
break
elif Q[-1]<P[-1] or ... | 25 | 22 | 587 | 493 | W, H = list(map(int, input().split()))
P = [int(eval(input())) for i in range(W)]
Q = [int(eval(input())) for j in range(H)]
P.append(float("inf"))
Q.append(float("inf"))
P.sort(reverse=True)
Q.sort(reverse=True)
now_W = W + 1
now_H = H + 1
cost = 0
while now_W > 1 or now_H > 1:
if P[-1] < Q[-1]:
cost += P.... | import sys
input = sys.stdin.readline
W, H = list(map(int, input().split()))
P = [int(eval(input())) for _ in range(W)] + [float("inf")]
Q = [int(eval(input())) for _ in range(H)] + [float("inf")]
P.sort(reverse=True)
Q.sort(reverse=True)
ans = 0
W += 1
H += 1
while True:
if W == H == 1:
break
elif Q[-... | false | 12 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-P = [int(eval(input())) for i in range(W)]",
"-Q = [int(eval(input())) for j in range(H)]",
"-P.append(float(\"inf\"))",
"-Q.append(float(\"inf\"))",
"+P = [int(eval(input())) for _ in range(W)] + [float(\"inf\")]",
"+Q = [int(eval(input())) for _... | false | 0.047386 | 0.036936 | 1.282925 | [
"s127708844",
"s966559865"
] |
u021019433 | p02959 | python | s799753221 | s773379863 | 142 | 115 | 15,552 | 16,576 | Accepted | Accepted | 19.01 | R = lambda: list(map(int, input().split()))
eval(input())
a = list(R())
r = y = 0
for u, v, w in zip(R(), a, a[1:]):
x = min(v - y, u)
y = min(w, u - x)
r += x + y
print(r) | R = lambda: list(map(int, input().split()))
eval(input())
a = list(R())
def f():
y = 0
for u, v, w in zip(R(), a, a[1:]):
x = min(v - y, u)
y = min(w, u - x)
yield x + y
print((sum(f())))
| 9 | 10 | 180 | 215 | R = lambda: list(map(int, input().split()))
eval(input())
a = list(R())
r = y = 0
for u, v, w in zip(R(), a, a[1:]):
x = min(v - y, u)
y = min(w, u - x)
r += x + y
print(r)
| R = lambda: list(map(int, input().split()))
eval(input())
a = list(R())
def f():
y = 0
for u, v, w in zip(R(), a, a[1:]):
x = min(v - y, u)
y = min(w, u - x)
yield x + y
print((sum(f())))
| false | 10 | [
"-r = y = 0",
"-for u, v, w in zip(R(), a, a[1:]):",
"- x = min(v - y, u)",
"- y = min(w, u - x)",
"- r += x + y",
"-print(r)",
"+",
"+",
"+def f():",
"+ y = 0",
"+ for u, v, w in zip(R(), a, a[1:]):",
"+ x = min(v - y, u)",
"+ y = min(w, u - x)",
"+ yie... | false | 0.060676 | 0.047526 | 1.276684 | [
"s799753221",
"s773379863"
] |
u600402037 | p03252 | python | s729005283 | s231211733 | 680 | 72 | 18,424 | 3,632 | Accepted | Accepted | 89.41 | S = list(eval(input()))
T = list(eval(input()))
answer = 'Yes'
for s in sorted(map(chr,list(range(97,123)))):
if S.count(s) >= 2:
l1 = [i for i, x in enumerate(S) if x == s]
for x in l1:
if T[x] != T[l1[0]]:
answer = 'No'
if T.count(s) >= 2:
l2 = [... | S, T = eval(input()), eval(input())
convert = dict()
answer = 'Yes'
for s, t in zip(S, T):
if s in convert and convert[s] != t:
answer = 'No'
break
else:
convert[s] = t
after = list(convert.values())
if len(after) != len(set(after)):
answer = 'No'
print(answer) | 16 | 17 | 441 | 299 | S = list(eval(input()))
T = list(eval(input()))
answer = "Yes"
for s in sorted(map(chr, list(range(97, 123)))):
if S.count(s) >= 2:
l1 = [i for i, x in enumerate(S) if x == s]
for x in l1:
if T[x] != T[l1[0]]:
answer = "No"
if T.count(s) >= 2:
l2 = [i for i, x... | S, T = eval(input()), eval(input())
convert = dict()
answer = "Yes"
for s, t in zip(S, T):
if s in convert and convert[s] != t:
answer = "No"
break
else:
convert[s] = t
after = list(convert.values())
if len(after) != len(set(after)):
answer = "No"
print(answer)
| false | 5.882353 | [
"-S = list(eval(input()))",
"-T = list(eval(input()))",
"+S, T = eval(input()), eval(input())",
"+convert = dict()",
"-for s in sorted(map(chr, list(range(97, 123)))):",
"- if S.count(s) >= 2:",
"- l1 = [i for i, x in enumerate(S) if x == s]",
"- for x in l1:",
"- if T[x]... | false | 0.047972 | 0.047188 | 1.016614 | [
"s729005283",
"s231211733"
] |
u618369407 | p03738 | python | s792494897 | s226629178 | 30 | 25 | 9,112 | 8,980 | Accepted | Accepted | 16.67 | # -*- coding: utf-8 -*-
A = int(eval(input()))
B = int(eval(input()))
if A > B:
print('GREATER')
elif A < B:
print('LESS')
else:
print('EQUAL') | # -*- coding: utf-8 -*-
A = list(str(eval(input())))
B = list(str(eval(input())))
if len(A) > len(B):
print('GREATER')
elif len(A) < len(B):
print('LESS')
elif A == B:
print('EQUAL')
else:
for i in range(len(A)):
if A[i] > B[i]:
print('GREATER')
break
... | 11 | 19 | 155 | 377 | # -*- coding: utf-8 -*-
A = int(eval(input()))
B = int(eval(input()))
if A > B:
print("GREATER")
elif A < B:
print("LESS")
else:
print("EQUAL")
| # -*- coding: utf-8 -*-
A = list(str(eval(input())))
B = list(str(eval(input())))
if len(A) > len(B):
print("GREATER")
elif len(A) < len(B):
print("LESS")
elif A == B:
print("EQUAL")
else:
for i in range(len(A)):
if A[i] > B[i]:
print("GREATER")
break
elif A[i] < ... | false | 42.105263 | [
"-A = int(eval(input()))",
"-B = int(eval(input()))",
"-if A > B:",
"+A = list(str(eval(input())))",
"+B = list(str(eval(input())))",
"+if len(A) > len(B):",
"-elif A < B:",
"+elif len(A) < len(B):",
"+elif A == B:",
"+ print(\"EQUAL\")",
"- print(\"EQUAL\")",
"+ for i in range(len(A)... | false | 0.04601 | 0.045203 | 1.017848 | [
"s792494897",
"s226629178"
] |
u405256066 | p03354 | python | s189143131 | s624753922 | 458 | 396 | 13,812 | 13,812 | Accepted | Accepted | 13.54 | from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
par = [i for i in range(N+1)]
rank = [0] * (N+1)
def find(x):
if par[x] == x:
return par[x]
else:
par[x] = find(par[x])
return par[x]
def... | from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
par = [i for i in range(N+1)]
rank = [0] * (N+1)
def find(x):
if par[x] == x:
return par[x]
else:
par[x] = find(par[x])
return par[x]
d... | 34 | 34 | 754 | 758 | from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
par = [i for i in range(N + 1)]
rank = [0] * (N + 1)
def find(x):
if par[x] == x:
return par[x]
else:
par[x] = find(par[x])
return par[x]
def unio... | from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
par = [i for i in range(N + 1)]
rank = [0] * (N + 1)
def find(x):
if par[x] == x:
return par[x]
else:
par[x] = find(par[x])
return par[x]
def unio... | false | 0 | [
"- par[x] = y",
"+ par[y] = x"
] | false | 0.043557 | 0.039393 | 1.105696 | [
"s189143131",
"s624753922"
] |
u719044784 | p02554 | python | s801534040 | s306645790 | 392 | 36 | 10,956 | 9,104 | Accepted | Accepted | 90.82 | import math
n = int(eval(input()))
inf = 10 ** 9 + 7
df = (10 ** n) - (2 * 9 ** n - 8 ** n)
print((df % inf)) | n=int(eval(input()))
mod=10**9+7
e=pow(8,n,mod)
f=pow(9,n,mod)
g=pow(10,n,mod)
print(((g-2*f+e)%mod))
| 8 | 7 | 111 | 101 | import math
n = int(eval(input()))
inf = 10**9 + 7
df = (10**n) - (2 * 9**n - 8**n)
print((df % inf))
| n = int(eval(input()))
mod = 10**9 + 7
e = pow(8, n, mod)
f = pow(9, n, mod)
g = pow(10, n, mod)
print(((g - 2 * f + e) % mod))
| false | 12.5 | [
"-import math",
"-",
"-inf = 10**9 + 7",
"-df = (10**n) - (2 * 9**n - 8**n)",
"-print((df % inf))",
"+mod = 10**9 + 7",
"+e = pow(8, n, mod)",
"+f = pow(9, n, mod)",
"+g = pow(10, n, mod)",
"+print(((g - 2 * f + e) % mod))"
] | false | 0.119335 | 0.035248 | 3.385579 | [
"s801534040",
"s306645790"
] |
u700805562 | p02597 | python | s384934686 | s088306369 | 33 | 28 | 9,308 | 9,200 | Accepted | Accepted | 15.15 | n = int(eval(input()))
c = eval(input())
cnt_r = c.count("R")
print((c[:cnt_r].count("W"))) | n=eval(input())
c=eval(input())
print((c[:c.count("R")].count("W"))) | 4 | 3 | 80 | 56 | n = int(eval(input()))
c = eval(input())
cnt_r = c.count("R")
print((c[:cnt_r].count("W")))
| n = eval(input())
c = eval(input())
print((c[: c.count("R")].count("W")))
| false | 25 | [
"-n = int(eval(input()))",
"+n = eval(input())",
"-cnt_r = c.count(\"R\")",
"-print((c[:cnt_r].count(\"W\")))",
"+print((c[: c.count(\"R\")].count(\"W\")))"
] | false | 0.074569 | 0.041606 | 1.792253 | [
"s384934686",
"s088306369"
] |
u379959788 | p02990 | python | s012315463 | s626677970 | 547 | 371 | 3,444 | 14,620 | Accepted | Accepted | 32.18 | def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2,r+1):
pivot = denominator[p - 1]
if pivot > 1:
offset = (n - r) % p
... | from scipy.misc import comb
mod = 1000000007
N, K = list(map(int, input().split()))
for i in range(1, K+1):
blue = K - i
red = N - K - (i - 1)
if blue < 0 or red < 0:
print((0))
else:
print((((comb(red+i, i, exact=True) % mod) * (comb(blue+i-1, i-1, exact=True) % mod)) % mod... | 33 | 12 | 795 | 312 | def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2, r + 1):
pivot = denominator[p - 1]
if pivot > 1:
offset = (n ... | from scipy.misc import comb
mod = 1000000007
N, K = list(map(int, input().split()))
for i in range(1, K + 1):
blue = K - i
red = N - K - (i - 1)
if blue < 0 or red < 0:
print((0))
else:
print(
(
(
(comb(red + i, i, exact=True) % mod)
... | false | 63.636364 | [
"-def cmb(n, r):",
"- if n - r < r:",
"- r = n - r",
"- if r == 0:",
"- return 1",
"- if r == 1:",
"- return n",
"- numerator = [n - r + k + 1 for k in range(r)]",
"- denominator = [k + 1 for k in range(r)]",
"- for p in range(2, r + 1):",
"- pivot =... | false | 0.034925 | 0.178387 | 0.195783 | [
"s012315463",
"s626677970"
] |
u153665391 | p02259 | python | s382648658 | s184035076 | 30 | 20 | 7,708 | 7,720 | Accepted | Accepted | 33.33 | n = int(eval(input())) - 1
a = list(map(int, input().split()))
count = 0
flag = 1
while flag:
flag = 0
for i in range( n, 0, -1 ):
if a[i] < a[i-1]:
t = a[i]
a[i] = a[i-1]
a[i-1] = t
count += 1
flag = 1
print((*a))
print(co... | n = int(eval(input())) - 1
a = list(map(int, input().split()))
count = 0
flag = 1
while flag:
flag = 0
j = 0
for i in range( n, j, -1 ):
if a[i] < a[i-1]:
t = a[i]
a[i] = a[i-1]
a[i-1] = t
count += 1
flag = 1
j... | 18 | 20 | 316 | 346 | n = int(eval(input())) - 1
a = list(map(int, input().split()))
count = 0
flag = 1
while flag:
flag = 0
for i in range(n, 0, -1):
if a[i] < a[i - 1]:
t = a[i]
a[i] = a[i - 1]
a[i - 1] = t
count += 1
flag = 1
print((*a))
print(count)
| n = int(eval(input())) - 1
a = list(map(int, input().split()))
count = 0
flag = 1
while flag:
flag = 0
j = 0
for i in range(n, j, -1):
if a[i] < a[i - 1]:
t = a[i]
a[i] = a[i - 1]
a[i - 1] = t
count += 1
flag = 1
j += 1
print((*a))
... | false | 10 | [
"- for i in range(n, 0, -1):",
"+ j = 0",
"+ for i in range(n, j, -1):",
"+ j += 1"
] | false | 0.035358 | 0.034513 | 1.024467 | [
"s382648658",
"s184035076"
] |
u329407311 | p02727 | python | s979767872 | s452512647 | 446 | 243 | 105,708 | 22,720 | Accepted | Accepted | 45.52 | import bisect
X,Y,A,B,C=list(map(int,input().split()))
AList=list(map(int,input().split()))
BList=list(map(int,input().split()))
CList=list(map(int,input().split()))
AList.sort(reverse=True)
BList.sort(reverse=True)
CList.sort(reverse=True)
alist = AList[0:X] + BList[0:Y]
clist = CList
alist.sort()
ans... | import bisect
X,Y,A,B,C=list(map(int,input().split()))
AList=list(map(int,input().split()))
BList=list(map(int,input().split()))
CList=list(map(int,input().split()))
AList.sort(reverse=True)
BList.sort(reverse=True)
CList.sort(reverse=True)
alist = AList[0:X] + BList[0:Y] + CList
alist.sort(reverse=True)... | 29 | 15 | 502 | 346 | import bisect
X, Y, A, B, C = list(map(int, input().split()))
AList = list(map(int, input().split()))
BList = list(map(int, input().split()))
CList = list(map(int, input().split()))
AList.sort(reverse=True)
BList.sort(reverse=True)
CList.sort(reverse=True)
alist = AList[0:X] + BList[0:Y]
clist = CList
alist.sort()
ans... | import bisect
X, Y, A, B, C = list(map(int, input().split()))
AList = list(map(int, input().split()))
BList = list(map(int, input().split()))
CList = list(map(int, input().split()))
AList.sort(reverse=True)
BList.sort(reverse=True)
CList.sort(reverse=True)
alist = AList[0:X] + BList[0:Y] + CList
alist.sort(reverse=Tru... | false | 48.275862 | [
"-alist = AList[0:X] + BList[0:Y]",
"-clist = CList",
"-alist.sort()",
"-ans = sum(alist)",
"-cnt = 0",
"-for i in range(C):",
"- a = clist[i]",
"- b = bisect.bisect_left(alist, a)",
"- if i < b:",
"- ans += a",
"- cnt += 1",
"-aa = sum(alist[:cnt])",
"-print((int(ans ... | false | 0.037454 | 0.036038 | 1.039293 | [
"s979767872",
"s452512647"
] |
u681444474 | p02842 | python | s634994238 | s000775100 | 186 | 52 | 38,384 | 2,940 | Accepted | Accepted | 72.04 | N=int(eval(input()))
l=N*100//108
stp=0
for i in range(2):
if (l+i)*108//100==N:
print((l+i))
stp=1
break
if stp==0:
print(':(') | # coding: utf-8
N = int(eval(input()))
x_ = N//1.08
ans = ':('
for i in range(1,100000):
x = x_+i
if int(1.08*x) == N:
ans = int(x)
break
print(ans) | 10 | 13 | 145 | 181 | N = int(eval(input()))
l = N * 100 // 108
stp = 0
for i in range(2):
if (l + i) * 108 // 100 == N:
print((l + i))
stp = 1
break
if stp == 0:
print(":(")
| # coding: utf-8
N = int(eval(input()))
x_ = N // 1.08
ans = ":("
for i in range(1, 100000):
x = x_ + i
if int(1.08 * x) == N:
ans = int(x)
break
print(ans)
| false | 23.076923 | [
"+# coding: utf-8",
"-l = N * 100 // 108",
"-stp = 0",
"-for i in range(2):",
"- if (l + i) * 108 // 100 == N:",
"- print((l + i))",
"- stp = 1",
"+x_ = N // 1.08",
"+ans = \":(\"",
"+for i in range(1, 100000):",
"+ x = x_ + i",
"+ if int(1.08 * x) == N:",
"+ an... | false | 0.054118 | 0.086685 | 0.62431 | [
"s634994238",
"s000775100"
] |
u179169725 | p03720 | python | s647281626 | s646868029 | 118 | 28 | 28,340 | 10,188 | Accepted | Accepted | 76.27 | mycode = r'''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
ctypedef long l... | mycode = r'''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
ctypedef long l... | 58 | 42 | 1,437 | 982 | mycode = r"""
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
ctypedef long long LL
... | mycode = r"""
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
ctypedef long long LL
... | false | 27.586207 | [
"-cdef extern int __builtin_popcount(unsigned int) nogil",
"-import numpy as np",
"-import sys",
"-readline = sys.stdin.buffer.readline",
"-read = sys.stdin.readline #文字列読み込む時はこっち",
"-cdef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)",
"-cdef read_matrix(LL H,LL W):",
"- #retur... | false | 0.037165 | 0.054289 | 0.684576 | [
"s647281626",
"s646868029"
] |
u078349616 | p02695 | python | s613282805 | s378727412 | 1,134 | 1,019 | 28,640 | 9,124 | Accepted | Accepted | 10.14 | N, M, Q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(Q)]
l = []
def dfs(lis, y):
if len(lis) == N:
l.append(lis)
return
else:
for i in range(y, M+1):
z = list(lis)
z.append(i)
dfs(z, i)
return
dfs([], 1)
ans =... | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
for A in combinations_with_replacement(list(range(1, M+1)), N):
tmp = 0
for a, b, c, d in query:
if A[b-1] - A[a-1] == c:
tmp += d
... | 27 | 14 | 451 | 343 | N, M, Q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(Q)]
l = []
def dfs(lis, y):
if len(lis) == N:
l.append(lis)
return
else:
for i in range(y, M + 1):
z = list(lis)
z.append(i)
dfs(z, i)
return
... | from itertools import combinations_with_replacement
N, M, Q = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
for A in combinations_with_replacement(list(range(1, M + 1)), N):
tmp = 0
for a, b, c, d in query:
if A[b - 1] - A[a - 1] == c:
t... | false | 48.148148 | [
"+from itertools import combinations_with_replacement",
"+",
"-l = []",
"-",
"-",
"-def dfs(lis, y):",
"- if len(lis) == N:",
"- l.append(lis)",
"- return",
"- else:",
"- for i in range(y, M + 1):",
"- z = list(lis)",
"- z.append(i)",
"- ... | false | 0.064011 | 0.045269 | 1.414004 | [
"s613282805",
"s378727412"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.