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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u025501820 | p02714 | python | s547841300 | s196359248 | 1,903 | 1,432 | 9,208 | 9,132 | Accepted | Accepted | 24.75 | N = int(eval(input()))
S = eval(input())
r_num = S.count("R")
g_num = S.count("G")
b_num = S.count("B")
cnt = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
if 2 * j - i < N and S[i] != S[j] and (S[2 * j - i] != S[i] and S[2 * j - i] != S[j]):
cnt += 1
ans = r_num * g_n... | N = int(eval(input()))
S = eval(input())
r_num = S.count("R")
g_num = S.count("G")
b_num = S.count("B")
cnt = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
if not 2 * j - i < N:
break
if S[i] != S[j] and (S[2 * j - i] != S[i] and S[2 * j - i] != S[j]):
... | 16 | 19 | 336 | 378 | N = int(eval(input()))
S = eval(input())
r_num = S.count("R")
g_num = S.count("G")
b_num = S.count("B")
cnt = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
if (
2 * j - i < N
and S[i] != S[j]
and (S[2 * j - i] != S[i] and S[2 * j - i] != S[j])
):
... | N = int(eval(input()))
S = eval(input())
r_num = S.count("R")
g_num = S.count("G")
b_num = S.count("B")
cnt = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
if not 2 * j - i < N:
break
if S[i] != S[j] and (S[2 * j - i] != S[i] and S[2 * j - i] != S[j]):
cnt += 1
ans =... | false | 15.789474 | [
"- if (",
"- 2 * j - i < N",
"- and S[i] != S[j]",
"- and (S[2 * j - i] != S[i] and S[2 * j - i] != S[j])",
"- ):",
"+ if not 2 * j - i < N:",
"+ break",
"+ if S[i] != S[j] and (S[2 * j - i] != S[i] and S[2 * j - i] != S[j]):"
] | false | 0.04845 | 0.043071 | 1.124886 | [
"s547841300",
"s196359248"
] |
u069838609 | p03221 | python | s754091892 | s700948146 | 596 | 497 | 43,184 | 43,184 | Accepted | Accepted | 16.61 | import sys
fin = sys.stdin.readline
from collections import defaultdict
N, M = [int(elem) for elem in fin().split()]
pref_years = [[int(elem) for elem in fin().split()] for _ in range(M)]
formatter = lambda x: "{:06}".format(x)
# sort by year in ascending order
sorted_pref_years = sorted(pref_years, key=la... | import sys
fin = sys.stdin.readline
from collections import defaultdict
N, M = [int(elem) for elem in fin().split()]
cities = [[int(elem) for elem in fin().split()] for _ in range(M)]
sorted_cities = sorted(cities, key= lambda x: x[1])
num_cities_in_pref = defaultdict(int)
years_to_identification = dict()
... | 20 | 17 | 660 | 546 | import sys
fin = sys.stdin.readline
from collections import defaultdict
N, M = [int(elem) for elem in fin().split()]
pref_years = [[int(elem) for elem in fin().split()] for _ in range(M)]
formatter = lambda x: "{:06}".format(x)
# sort by year in ascending order
sorted_pref_years = sorted(pref_years, key=lambda x: x[1... | import sys
fin = sys.stdin.readline
from collections import defaultdict
N, M = [int(elem) for elem in fin().split()]
cities = [[int(elem) for elem in fin().split()] for _ in range(M)]
sorted_cities = sorted(cities, key=lambda x: x[1])
num_cities_in_pref = defaultdict(int)
years_to_identification = dict()
for pref, ye... | false | 15 | [
"-pref_years = [[int(elem) for elem in fin().split()] for _ in range(M)]",
"-formatter = lambda x: \"{:06}\".format(x)",
"-# sort by year in ascending order",
"-sorted_pref_years = sorted(pref_years, key=lambda x: x[1])",
"-number_cities_per_city = defaultdict(int)",
"-identity_numbers = {}",
"-for pref... | false | 0.049849 | 0.049004 | 1.017247 | [
"s754091892",
"s700948146"
] |
u923279197 | p02982 | python | s218732286 | s332234744 | 169 | 18 | 39,280 | 3,188 | Accepted | Accepted | 89.35 | n,d = list(map(int,input().split()))
x = [list(map(int,input().split())) for i in range(n)]
ans = 0
def k(a,b):
dist = 0
for i in range(d):
dist +=(a[i]-b[i])**2
dist = dist**(1/2)
while dist > 0:
dist -= 1
if dist == 0:
return True
return False
for i... | n,d = list(map(int,input().split()))
data = [list(map(int,input().split())) for i in range(n)]
def ok(x,y):
z = 0
for i in range(d):
z += (x[i]-y[i])**2
if z**(0.5) == int(z**(0.5)):
return True
else:
return False
ans = 0
for i in range(n):
for j in range(i+... | 19 | 20 | 417 | 388 | n, d = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
ans = 0
def k(a, b):
dist = 0
for i in range(d):
dist += (a[i] - b[i]) ** 2
dist = dist ** (1 / 2)
while dist > 0:
dist -= 1
if dist == 0:
return True
return False
f... | n, d = list(map(int, input().split()))
data = [list(map(int, input().split())) for i in range(n)]
def ok(x, y):
z = 0
for i in range(d):
z += (x[i] - y[i]) ** 2
if z ** (0.5) == int(z ** (0.5)):
return True
else:
return False
ans = 0
for i in range(n):
for j in range(i + ... | false | 5 | [
"-x = [list(map(int, input().split())) for i in range(n)]",
"-ans = 0",
"+data = [list(map(int, input().split())) for i in range(n)]",
"-def k(a, b):",
"- dist = 0",
"+def ok(x, y):",
"+ z = 0",
"- dist += (a[i] - b[i]) ** 2",
"- dist = dist ** (1 / 2)",
"- while dist > 0:",
"... | false | 0.032155 | 0.035329 | 0.910162 | [
"s218732286",
"s332234744"
] |
u761529120 | p03163 | python | s719654318 | s561712119 | 459 | 251 | 118,128 | 149,460 | Accepted | Accepted | 45.32 | def main():
N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[0] * (W + 5) for _ in range(N + 5)]
for i in range(N):
for j in range(W):
print()
if j + w[i... | def main():
N, Wei = list(map(int, input().split()))
W = [0] * N
V = [0] * N
for i in range(N):
W[i], V[i] = list(map(int, input().split()))
dp = [[0] * (Wei + 5) for _ in range(N + 5)]
dp[0][Wei] = 0
for i in range(N):
for w in range(Wei+1):
if w >= W[i... | 21 | 20 | 515 | 503 | def main():
N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[0] * (W + 5) for _ in range(N + 5)]
for i in range(N):
for j in range(W):
print()
if j + w[i] <= W:
... | def main():
N, Wei = list(map(int, input().split()))
W = [0] * N
V = [0] * N
for i in range(N):
W[i], V[i] = list(map(int, input().split()))
dp = [[0] * (Wei + 5) for _ in range(N + 5)]
dp[0][Wei] = 0
for i in range(N):
for w in range(Wei + 1):
if w >= W[i]:
... | false | 4.761905 | [
"- N, W = list(map(int, input().split()))",
"- w = [0] * N",
"- v = [0] * N",
"+ N, Wei = list(map(int, input().split()))",
"+ W = [0] * N",
"+ V = [0] * N",
"- w[i], v[i] = list(map(int, input().split()))",
"- dp = [[0] * (W + 5) for _ in range(N + 5)]",
"+ W[i], ... | false | 0.04844 | 0.041421 | 1.16946 | [
"s719654318",
"s561712119"
] |
u285891772 | p02848 | python | s473247906 | s870014394 | 328 | 155 | 22,452 | 14,012 | Accepted | Accepted | 52.74 | 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
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | 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
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | 29 | 25 | 996 | 1,000 | 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,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | 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,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 13.793103 | [
"-ans = []",
"-for s in S:",
"- ans.append(ascii_uppercase[(ascii_uppercase.index(s) + N) % 26])",
"+ans = [ascii_uppercase[(ascii_uppercase.index(S[i]) + N) % 26] for i in range(len(S))]",
"+# print(ans)"
] | false | 0.0482 | 0.146851 | 0.328223 | [
"s473247906",
"s870014394"
] |
u500376440 | p04043 | python | s255810306 | s992605938 | 165 | 28 | 38,256 | 9,084 | Accepted | Accepted | 83.03 | ABC=input().split()
if ABC.count("5")==2 and ABC.count("7")==1:
print("YES")
else:
print("NO")
| ABC=list(map(int,input().split()))
if ABC.count(5)==2 and ABC.count(7)==1:
print("YES")
else:
print("NO")
| 5 | 5 | 103 | 114 | ABC = input().split()
if ABC.count("5") == 2 and ABC.count("7") == 1:
print("YES")
else:
print("NO")
| ABC = list(map(int, input().split()))
if ABC.count(5) == 2 and ABC.count(7) == 1:
print("YES")
else:
print("NO")
| false | 0 | [
"-ABC = input().split()",
"-if ABC.count(\"5\") == 2 and ABC.count(\"7\") == 1:",
"+ABC = list(map(int, input().split()))",
"+if ABC.count(5) == 2 and ABC.count(7) == 1:"
] | false | 0.061072 | 0.03735 | 1.635129 | [
"s255810306",
"s992605938"
] |
u285681431 | p02793 | python | s250352605 | s198985240 | 1,198 | 161 | 83,196 | 82,884 | Accepted | Accepted | 86.56 | from collections import Counter
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
... | from collections import Counter
MOD = 10**9+7
N = int(eval(input()))
A = list(map(int,input().split()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
el... | 38 | 35 | 749 | 750 | from collections import Counter
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
... | from collections import Counter
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
... | false | 7.894737 | [
"-prime = [0] * (10**6 + 1)",
"+prime = [0] * (10**6 + 5)",
"-for i in range(10**6):",
"+for i in range(10**6 + 2):",
"- lcm *= pow(i, prime[i], MOD)",
"+ lcm *= pow(i, prime[i])",
"+ lcm %= MOD"
] | false | 0.475423 | 0.668676 | 0.710992 | [
"s250352605",
"s198985240"
] |
u945181840 | p03862 | python | s698645813 | s789420632 | 108 | 94 | 14,540 | 14,060 | Accepted | Accepted | 12.96 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
candy = min(a[0], x)
ans = a[0] - candy
a[0] = candy
for i in range(1, N):
candy += a[i]
if candy > x:
m = candy - x
ans += m
a[i] -= m
candy -= a[i - 1] + m
else:
candy -= a[i -... | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
candy = min(a[0], x)
ans = a[0] - candy
a[0] = candy
for i in range(1, N):
candy = a[i - 1] + a[i]
if candy > x:
m = candy - x
ans += m
a[i] -= m
print(ans) | 17 | 14 | 331 | 272 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
candy = min(a[0], x)
ans = a[0] - candy
a[0] = candy
for i in range(1, N):
candy += a[i]
if candy > x:
m = candy - x
ans += m
a[i] -= m
candy -= a[i - 1] + m
else:
candy -= a[i - 1]
print(ans)
| N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
candy = min(a[0], x)
ans = a[0] - candy
a[0] = candy
for i in range(1, N):
candy = a[i - 1] + a[i]
if candy > x:
m = candy - x
ans += m
a[i] -= m
print(ans)
| false | 17.647059 | [
"- candy += a[i]",
"+ candy = a[i - 1] + a[i]",
"- candy -= a[i - 1] + m",
"- else:",
"- candy -= a[i - 1]"
] | false | 0.09954 | 0.048013 | 2.073184 | [
"s698645813",
"s789420632"
] |
u616382321 | p02861 | python | s087846785 | s735112783 | 396 | 115 | 33,680 | 27,228 | Accepted | Accepted | 70.96 | import itertools
import numpy as np
def distance(x2,x1,y2,y1):
return ((x2-x1)**2 + (y2-y1)**2)**0.5
N = int(eval(input()))
X = []
Y = []
for _ in range(N):
x, y = list(map(int, input().split()))
X.append(x)
Y.append(y)
routes = list(itertools.permutations(list(range(N)), N))
ans = []
... | import numpy as np
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
XY = np.array(xy).flatten()
X = XY[::2] ; Y = XY[1::2]
dx = X[:,None] - X[None, :]
dy = Y[:, None] - Y[None,:]
dist_mat = (dx*dx + dy*dy) ** .5
answer = dist_mat.sum() / N
print(answer)
| 24 | 15 | 494 | 298 | import itertools
import numpy as np
def distance(x2, x1, y2, y1):
return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
N = int(eval(input()))
X = []
Y = []
for _ in range(N):
x, y = list(map(int, input().split()))
X.append(x)
Y.append(y)
routes = list(itertools.permutations(list(range(N)), N))
ans = []
f... | import numpy as np
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
XY = np.array(xy).flatten()
X = XY[::2]
Y = XY[1::2]
dx = X[:, None] - X[None, :]
dy = Y[:, None] - Y[None, :]
dist_mat = (dx * dx + dy * dy) ** 0.5
answer = dist_mat.sum() / N
print(answer)
| false | 37.5 | [
"-import itertools",
"-",
"-def distance(x2, x1, y2, y1):",
"- return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5",
"-",
"-",
"-X = []",
"-Y = []",
"-for _ in range(N):",
"- x, y = list(map(int, input().split()))",
"- X.append(x)",
"- Y.append(y)",
"-routes = list(itertools.permutat... | false | 0.155101 | 0.207611 | 0.747077 | [
"s087846785",
"s735112783"
] |
u047102107 | p03665 | python | s994985543 | s661268692 | 164 | 69 | 38,256 | 65,620 | Accepted | Accepted | 57.93 | from operator import mul
from functools import reduce
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
cE, cO = 0, 0
for a in A:
if a % 2 == 0:
cE += 1
else:
cO += 1
# 全て偶数
if cO == 0:
ans = 2 ** N if P == 0 else 0
print(ans)
else:
# 偶... | from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)
INF = int(1e10)
MOD = int(1e9 + 7)
def main():
from builtins import int, map
N, P = ... | 28 | 44 | 612 | 1,036 | from operator import mul
from functools import reduce
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
cE, cO = 0, 0
for a in A:
if a % 2 == 0:
cE += 1
else:
cO += 1
# 全て偶数
if cO == 0:
ans = 2**N if P == 0 else 0
print(ans)
else:
# 偶数が含まれている
# ある奇数$k$につ... | from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)
INF = int(1e10)
MOD = int(1e9 + 7)
def main():
from builtins import int, map
N, P = list(map(i... | false | 36.363636 | [
"-from operator import mul",
"-from functools import reduce",
"+from sys import stdin, setrecursionlimit",
"+from collections import Counter, deque, defaultdict",
"+from math import floor, ceil",
"+from bisect import bisect_left",
"+from itertools import combinations",
"-N, P = list(map(int, input().s... | false | 0.074314 | 0.064427 | 1.153461 | [
"s994985543",
"s661268692"
] |
u708255304 | p03011 | python | s617687658 | s081611324 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | # P, Q, R = map(int, input().split())
S = list(map(int, input().split()))
hoge = S.pop(S.index(min(S)))
fuga = S.pop(S.index(min(S)))
print((hoge + fuga))
| distances = list(map(int, input().split()))
distances.sort()
print((distances[0]+distances[1]))
| 7 | 5 | 161 | 100 | # P, Q, R = map(int, input().split())
S = list(map(int, input().split()))
hoge = S.pop(S.index(min(S)))
fuga = S.pop(S.index(min(S)))
print((hoge + fuga))
| distances = list(map(int, input().split()))
distances.sort()
print((distances[0] + distances[1]))
| false | 28.571429 | [
"-# P, Q, R = map(int, input().split())",
"-S = list(map(int, input().split()))",
"-hoge = S.pop(S.index(min(S)))",
"-fuga = S.pop(S.index(min(S)))",
"-print((hoge + fuga))",
"+distances = list(map(int, input().split()))",
"+distances.sort()",
"+print((distances[0] + distances[1]))"
] | false | 0.112674 | 0.047067 | 2.393893 | [
"s617687658",
"s081611324"
] |
u202570162 | p02885 | python | s405085000 | s710951328 | 22 | 19 | 3,316 | 2,940 | Accepted | Accepted | 13.64 | a,b= list(map(int,input().split()))
r = a-b*2
if r <= 0:
print((0))
else:
print(r) | A,B=list(map(int,input().split()))
ans=A-B*2
print((ans if ans>=0 else 0)) | 6 | 3 | 87 | 68 | a, b = list(map(int, input().split()))
r = a - b * 2
if r <= 0:
print((0))
else:
print(r)
| A, B = list(map(int, input().split()))
ans = A - B * 2
print((ans if ans >= 0 else 0))
| false | 50 | [
"-a, b = list(map(int, input().split()))",
"-r = a - b * 2",
"-if r <= 0:",
"- print((0))",
"-else:",
"- print(r)",
"+A, B = list(map(int, input().split()))",
"+ans = A - B * 2",
"+print((ans if ans >= 0 else 0))"
] | false | 0.007849 | 0.042406 | 0.185093 | [
"s405085000",
"s710951328"
] |
u645855527 | p02863 | python | s745579982 | s133149498 | 845 | 321 | 178,308 | 145,828 | Accepted | Accepted | 62.01 | n, t = list(map(int, input().split()))
a = [0]
b = [0]
for i in range(n):
a_, b_ = list(map(int, input().split()))
a.append(a_)
b.append(b_)
dp1 = [[0] * t for _ in range(n+2)]
dp2 = [[0] * t for _ in range(n+2)]
for i in range(n):
for j in range(t):
if a[i+1] > j:
dp... | N, T = list(map(int, input().split()))
AB = sorted([list(map(int, input().split())) for _ in range(N)])
dp = [[0] * N for _ in range(T)]
for i in range(1, T):
for j in range(N-1):
if AB[j][0] <= i:
dp[i][j] = max(dp[i][j-1], dp[i-AB[j][0]][j-1] + AB[j][1])
else:
d... | 31 | 17 | 769 | 426 | n, t = list(map(int, input().split()))
a = [0]
b = [0]
for i in range(n):
a_, b_ = list(map(int, input().split()))
a.append(a_)
b.append(b_)
dp1 = [[0] * t for _ in range(n + 2)]
dp2 = [[0] * t for _ in range(n + 2)]
for i in range(n):
for j in range(t):
if a[i + 1] > j:
dp1[i + 1][j... | N, T = list(map(int, input().split()))
AB = sorted([list(map(int, input().split())) for _ in range(N)])
dp = [[0] * N for _ in range(T)]
for i in range(1, T):
for j in range(N - 1):
if AB[j][0] <= i:
dp[i][j] = max(dp[i][j - 1], dp[i - AB[j][0]][j - 1] + AB[j][1])
else:
dp[i]... | false | 45.16129 | [
"-n, t = list(map(int, input().split()))",
"-a = [0]",
"-b = [0]",
"-for i in range(n):",
"- a_, b_ = list(map(int, input().split()))",
"- a.append(a_)",
"- b.append(b_)",
"-dp1 = [[0] * t for _ in range(n + 2)]",
"-dp2 = [[0] * t for _ in range(n + 2)]",
"-for i in range(n):",
"- fo... | false | 0.037192 | 0.04223 | 0.880681 | [
"s745579982",
"s133149498"
] |
u863370423 | p02792 | python | s648771506 | s753621287 | 260 | 146 | 11,636 | 9,156 | Accepted | Accepted | 43.85 | n = int(eval(input()))
letters_mapping = {num: {num2:[] for num2 in range(10)} for num in range(10)}
for num in range(1, n + 1):
first_letter = str(num)[0]
last_letter = str(num)[-1]
letters_mapping[int(first_letter)][int(last_letter)].append(num)
count = 0
for i, v in list(letters_mapping.items(... | n = int(eval(input()))
a = [[0 for i in range(10)] for j in range(10)]
for i in range(1, n+1):
s = str(i)
if s[-1] != '0':
a[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += a[i][j] * a[j][i]
print(ans) | 15 | 11 | 477 | 274 | n = int(eval(input()))
letters_mapping = {num: {num2: [] for num2 in range(10)} for num in range(10)}
for num in range(1, n + 1):
first_letter = str(num)[0]
last_letter = str(num)[-1]
letters_mapping[int(first_letter)][int(last_letter)].append(num)
count = 0
for i, v in list(letters_mapping.items()):
fo... | n = int(eval(input()))
a = [[0 for i in range(10)] for j in range(10)]
for i in range(1, n + 1):
s = str(i)
if s[-1] != "0":
a[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += a[i][j] * a[j][i]
print(ans)
| false | 26.666667 | [
"-letters_mapping = {num: {num2: [] for num2 in range(10)} for num in range(10)}",
"-for num in range(1, n + 1):",
"- first_letter = str(num)[0]",
"- last_letter = str(num)[-1]",
"- letters_mapping[int(first_letter)][int(last_letter)].append(num)",
"-count = 0",
"-for i, v in list(letters_mappi... | false | 0.082836 | 0.065148 | 1.271497 | [
"s648771506",
"s753621287"
] |
u282228874 | p03325 | python | s677013935 | s922116244 | 102 | 79 | 4,524 | 4,148 | Accepted | Accepted | 22.55 | n = int(eval(input()))
A = list(map(int,input().split()))
cnt = 0
for a in A:
while a%2 == 0:
cnt += 1
a /= 2
print(cnt)
| N = int(eval(input()))
A = list(map(int,input().split()))
res = 0
for a in A:
while a%2 == 0:
a //= 2
res += 1
print(res) | 8 | 8 | 142 | 142 | n = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
for a in A:
while a % 2 == 0:
cnt += 1
a /= 2
print(cnt)
| N = int(eval(input()))
A = list(map(int, input().split()))
res = 0
for a in A:
while a % 2 == 0:
a //= 2
res += 1
print(res)
| false | 0 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-cnt = 0",
"+res = 0",
"- cnt += 1",
"- a /= 2",
"-print(cnt)",
"+ a //= 2",
"+ res += 1",
"+print(res)"
] | false | 0.035051 | 0.040966 | 0.855613 | [
"s677013935",
"s922116244"
] |
u844005364 | p03329 | python | s069743152 | s540022218 | 194 | 168 | 42,200 | 38,384 | Accepted | Accepted | 13.4 | import bisect
six_list = [6 ** i for i in range(7)]
nine_list = [9 ** i for i in range(6)]
def six_nine(n):
if n < 6:
return n
else:
six = six_list[bisect.bisect_right(six_list, n) - 1]
nine = nine_list[bisect.bisect_right(nine_list, n) - 1]
return min(n // six + s... | import bisect
from functools import lru_cache
six_list = [6 ** i for i in range(7)]
nine_list = [9 ** i for i in range(6)]
@lru_cache(maxsize=1000)
def six_nine(n):
if n < 6:
return n
else:
six = six_list[bisect.bisect_right(six_list, n) - 1]
nine = nine_list[bisect.bisec... | 18 | 20 | 439 | 498 | import bisect
six_list = [6**i for i in range(7)]
nine_list = [9**i for i in range(6)]
def six_nine(n):
if n < 6:
return n
else:
six = six_list[bisect.bisect_right(six_list, n) - 1]
nine = nine_list[bisect.bisect_right(nine_list, n) - 1]
return min(n // six + six_nine(n % six)... | import bisect
from functools import lru_cache
six_list = [6**i for i in range(7)]
nine_list = [9**i for i in range(6)]
@lru_cache(maxsize=1000)
def six_nine(n):
if n < 6:
return n
else:
six = six_list[bisect.bisect_right(six_list, n) - 1]
nine = nine_list[bisect.bisect_right(nine_list... | false | 10 | [
"+from functools import lru_cache",
"+@lru_cache(maxsize=1000)"
] | false | 0.082287 | 0.04259 | 1.932096 | [
"s069743152",
"s540022218"
] |
u346812984 | p03311 | python | s356351967 | s022279709 | 205 | 189 | 25,196 | 25,872 | Accepted | Accepted | 7.8 | N = int(eval(input()))
A = list(map(int, input().split()))
A_i = [A[i] - i - 1 for i in range(N)]
A_i.sort()
b = A_i[N // 2]
ans = 0
for a in A_i:
ans += abs(a - b)
print(ans)
| import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A = [a - i - 1 for i, a in enumerate(A)]
A.sort()
i = N // 2
b = A[i]
... | 11 | 26 | 186 | 430 | N = int(eval(input()))
A = list(map(int, input().split()))
A_i = [A[i] - i - 1 for i in range(N)]
A_i.sort()
b = A_i[N // 2]
ans = 0
for a in A_i:
ans += abs(a - b)
print(ans)
| import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A = [a - i - 1 for i, a in enumerate(A)]
A.sort()
i = N // 2
b = A[i]
ans = 0
for a ... | false | 57.692308 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-A_i = [A[i] - i - 1 for i in range(N)]",
"-A_i.sort()",
"-b = A_i[N // 2]",
"-ans = 0",
"-for a in A_i:",
"- ans += abs(a - b)",
"-print(ans)",
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+INF = float(\"inf\")"... | false | 0.047981 | 0.043321 | 1.10757 | [
"s356351967",
"s022279709"
] |
u835924161 | p03327 | python | s519519350 | s182445230 | 26 | 24 | 9,024 | 9,092 | Accepted | Accepted | 7.69 | n=int(eval(input()))
if n<=999:
print("ABC")
else:
print("ABD") | if int(eval(input()))<=999:
print("ABC")
else:
print("ABD") | 6 | 4 | 71 | 64 | n = int(eval(input()))
if n <= 999:
print("ABC")
else:
print("ABD")
| if int(eval(input())) <= 999:
print("ABC")
else:
print("ABD")
| false | 33.333333 | [
"-n = int(eval(input()))",
"-if n <= 999:",
"+if int(eval(input())) <= 999:"
] | false | 0.047032 | 0.047736 | 0.985252 | [
"s519519350",
"s182445230"
] |
u814986259 | p02885 | python | s486935839 | s176170156 | 20 | 17 | 3,060 | 3,064 | Accepted | Accepted | 15 | A, B = list(map(int, input().split()))
print((max(0, A - 2*B)))
| a,b=list(map(int,input().split()))
print((max(0,a-b-b))) | 3 | 2 | 59 | 49 | A, B = list(map(int, input().split()))
print((max(0, A - 2 * B)))
| a, b = list(map(int, input().split()))
print((max(0, a - b - b)))
| false | 33.333333 | [
"-A, B = list(map(int, input().split()))",
"-print((max(0, A - 2 * B)))",
"+a, b = list(map(int, input().split()))",
"+print((max(0, a - b - b)))"
] | false | 0.064458 | 0.06462 | 0.997487 | [
"s486935839",
"s176170156"
] |
u263830634 | p03032 | python | s226208847 | s294465256 | 31 | 28 | 3,064 | 3,064 | Accepted | Accepted | 9.68 | N, K = list(map(int, input().split()))
lst = list(map(int, input().split()))
ans = 0
A = 0
while A <= min(K, N):
B = 0
lst2 = []
while B <= min(K, N) - A:
lst2 = lst[:A]+lst[N-B:]
lst2.sort()
count = 0
for i in range(len(lst2)):
if lst2[i] <= 0 and i... | N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N - left, K - left) + 1):
tmp = V[:left] + V[N - right:]
tmp.sort()
score = 0
count = K - left - right
for i in tmp:
... | 22 | 22 | 480 | 583 | N, K = list(map(int, input().split()))
lst = list(map(int, input().split()))
ans = 0
A = 0
while A <= min(K, N):
B = 0
lst2 = []
while B <= min(K, N) - A:
lst2 = lst[:A] + lst[N - B :]
lst2.sort()
count = 0
for i in range(len(lst2)):
if lst2[i] <= 0 and i + 1 <= K... | N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N - left, K - left) + 1):
tmp = V[:left] + V[N - right :]
tmp.sort()
score = 0
count = K - left - right
for i in tmp:
if cou... | false | 0 | [
"-lst = list(map(int, input().split()))",
"+V = list(map(int, input().split()))",
"-A = 0",
"-while A <= min(K, N):",
"- B = 0",
"- lst2 = []",
"- while B <= min(K, N) - A:",
"- lst2 = lst[:A] + lst[N - B :]",
"- lst2.sort()",
"- count = 0",
"- for i in range... | false | 0.050043 | 0.050123 | 0.998396 | [
"s226208847",
"s294465256"
] |
u891635666 | p03380 | python | s955212009 | s914347701 | 103 | 66 | 14,056 | 14,052 | Accepted | Accepted | 35.92 | n = int(eval(input()))
ls = sorted(map(int, input().split()))
ds = [abs(x - ls[-1] / 2) for x in ls[:-1]]
print((ls[-1], ls[ds.index(min(ds))])) | n = int(eval(input()))
ls = list(map(int, input().split()))
m = max(ls)
ls.remove(m)
ds = [abs(x - m / 2) for x in ls]
print((m, ls[ds.index(min(ds))])) | 4 | 6 | 139 | 149 | n = int(eval(input()))
ls = sorted(map(int, input().split()))
ds = [abs(x - ls[-1] / 2) for x in ls[:-1]]
print((ls[-1], ls[ds.index(min(ds))]))
| n = int(eval(input()))
ls = list(map(int, input().split()))
m = max(ls)
ls.remove(m)
ds = [abs(x - m / 2) for x in ls]
print((m, ls[ds.index(min(ds))]))
| false | 33.333333 | [
"-ls = sorted(map(int, input().split()))",
"-ds = [abs(x - ls[-1] / 2) for x in ls[:-1]]",
"-print((ls[-1], ls[ds.index(min(ds))]))",
"+ls = list(map(int, input().split()))",
"+m = max(ls)",
"+ls.remove(m)",
"+ds = [abs(x - m / 2) for x in ls]",
"+print((m, ls[ds.index(min(ds))]))"
] | false | 0.036231 | 0.059268 | 0.611311 | [
"s955212009",
"s914347701"
] |
u536034761 | p02888 | python | s097885733 | s556362577 | 1,394 | 1,106 | 9,316 | 9,492 | Accepted | Accepted | 20.66 | import bisect
from itertools import combinations
def main():
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for l in combinations(L, 2):
a = l[0]
b = l[1]
x = bisect.bisect_left(L, a + b)
y = bisect.bisect(L, b - a)
if b - ... | import bisect
from copy import deepcopy
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = 0
for i in range(N):
for j in range(i + 1, N - 1):
b = L[j] + L[i]
x = bisect.bisect_left(L, b) - j - 1
if x > 0:
ans += x
print(ans)
| 21 | 14 | 462 | 290 | import bisect
from itertools import combinations
def main():
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for l in combinations(L, 2):
a = l[0]
b = l[1]
x = bisect.bisect_left(L, a + b)
y = bisect.bisect(L, b - a)
if b - a < a:
... | import bisect
from copy import deepcopy
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = 0
for i in range(N):
for j in range(i + 1, N - 1):
b = L[j] + L[i]
x = bisect.bisect_left(L, b) - j - 1
if x > 0:
ans += x
print(ans)
| false | 33.333333 | [
"-from itertools import combinations",
"+from copy import deepcopy",
"-",
"-def main():",
"- N = int(eval(input()))",
"- L = sorted(list(map(int, input().split())))",
"- ans = 0",
"- for l in combinations(L, 2):",
"- a = l[0]",
"- b = l[1]",
"- x = bisect.bisect_... | false | 0.039282 | 0.081291 | 0.483226 | [
"s097885733",
"s556362577"
] |
u501952592 | p02866 | python | s307320972 | s146456779 | 108 | 95 | 24,248 | 24,512 | Accepted | Accepted | 12.04 | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
c = Counter(D)
m = max(c.keys())
if D[0] == 0 and c[0] == 1:
ans = 1
for i in range(1, m+1):
ans *= c[i-1]**c[i]
ans %= mod
print(ans)
else:
print((0)) | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
c = Counter(D)
m = max(c.keys())
if D[0] == 0 and c[0] == 1:
ans = 1
for i in D[1:]:
ans *= c[i-1]
ans %= mod
print(ans)
else:
print((0)) | 17 | 17 | 285 | 271 | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
c = Counter(D)
m = max(c.keys())
if D[0] == 0 and c[0] == 1:
ans = 1
for i in range(1, m + 1):
ans *= c[i - 1] ** c[i]
ans %= mod
print(ans)
else:
print((0))
| from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
c = Counter(D)
m = max(c.keys())
if D[0] == 0 and c[0] == 1:
ans = 1
for i in D[1:]:
ans *= c[i - 1]
ans %= mod
print(ans)
else:
print((0))
| false | 0 | [
"- for i in range(1, m + 1):",
"- ans *= c[i - 1] ** c[i]",
"+ for i in D[1:]:",
"+ ans *= c[i - 1]"
] | false | 0.05034 | 0.092443 | 0.544555 | [
"s307320972",
"s146456779"
] |
u693953100 | p02994 | python | s534385653 | s569015787 | 22 | 17 | 3,064 | 2,940 | Accepted | Accepted | 22.73 | n,l = list(map(int,input().split()))
id = 0
ans = 0
for i in range(n):
ans+=l+i
if abs(l+id)>abs(l+i):
id = i
print((ans-l-id)) | def solve():
n,l = list(map(int,input().split()))
mn = 10**10
s = 0
for i in range(n):
s+=l+i
if abs(mn)>abs(l+i):
mn = l+i
print((s-mn))
if __name__=='__main__':
solve() | 8 | 11 | 142 | 224 | n, l = list(map(int, input().split()))
id = 0
ans = 0
for i in range(n):
ans += l + i
if abs(l + id) > abs(l + i):
id = i
print((ans - l - id))
| def solve():
n, l = list(map(int, input().split()))
mn = 10**10
s = 0
for i in range(n):
s += l + i
if abs(mn) > abs(l + i):
mn = l + i
print((s - mn))
if __name__ == "__main__":
solve()
| false | 27.272727 | [
"-n, l = list(map(int, input().split()))",
"-id = 0",
"-ans = 0",
"-for i in range(n):",
"- ans += l + i",
"- if abs(l + id) > abs(l + i):",
"- id = i",
"-print((ans - l - id))",
"+def solve():",
"+ n, l = list(map(int, input().split()))",
"+ mn = 10**10",
"+ s = 0",
"+... | false | 0.048106 | 0.047059 | 1.022262 | [
"s534385653",
"s569015787"
] |
u631277801 | p04045 | python | s455986740 | s576371435 | 106 | 39 | 3,060 | 3,060 | Accepted | Accepted | 63.21 | N, K = list(map(int, input().split()))
D = list(map(int, input().split()))
while True:
flag = 1
N_str = list(str(N))
for s in N_str:
if int(s) in D:
flag = 0
break
if flag:
print(N)
break
N += 1 | N,K = list(map(int, input().split()))
D = set(list(map(int, input().split())))
ans = 0
for i in range(N, 10*N+1):
res = i
while res > 0:
digit = res % 10
if digit in D:
break
res //= 10
if res <= 0:
ans = i
... | 17 | 20 | 288 | 333 | N, K = list(map(int, input().split()))
D = list(map(int, input().split()))
while True:
flag = 1
N_str = list(str(N))
for s in N_str:
if int(s) in D:
flag = 0
break
if flag:
print(N)
break
N += 1
| N, K = list(map(int, input().split()))
D = set(list(map(int, input().split())))
ans = 0
for i in range(N, 10 * N + 1):
res = i
while res > 0:
digit = res % 10
if digit in D:
break
res //= 10
if res <= 0:
ans = i
break
print(ans)
| false | 15 | [
"-D = list(map(int, input().split()))",
"-while True:",
"- flag = 1",
"- N_str = list(str(N))",
"- for s in N_str:",
"- if int(s) in D:",
"- flag = 0",
"+D = set(list(map(int, input().split())))",
"+ans = 0",
"+for i in range(N, 10 * N + 1):",
"+ res = i",
"+ w... | false | 0.041783 | 0.042025 | 0.994248 | [
"s455986740",
"s576371435"
] |
u631277801 | p03215 | python | s353284840 | s474813538 | 348 | 272 | 92,084 | 66,016 | Accepted | Accepted | 21.84 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 38 | 39 | 890 | 895 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 2.564103 | [
"-sys.setrecursionlimit(10**5)",
"+sys.setrecursionlimit(10**7)",
"-from itertools import accumulate",
"-",
"-acum = list(accumulate([0] + a))",
"-cand = []",
"+cum = [0]",
"+for ai in a:",
"+ cum.append(cum[-1] + ai)",
"+pool = []",
"- cand.append(acum[j] - acum[i])",
"+ pool... | false | 0.036081 | 0.098196 | 0.367438 | [
"s353284840",
"s474813538"
] |
u690536347 | p03280 | python | s782401548 | s590829736 | 25 | 17 | 3,316 | 2,940 | Accepted | Accepted | 32 | a,b=list(map(int,input().split()))
c=(a*b)-(b+a-1)
print(c) | a,b=list(map(int,input().split()))
print((a*b-a-b+1)) | 3 | 2 | 55 | 46 | a, b = list(map(int, input().split()))
c = (a * b) - (b + a - 1)
print(c)
| a, b = list(map(int, input().split()))
print((a * b - a - b + 1))
| false | 33.333333 | [
"-c = (a * b) - (b + a - 1)",
"-print(c)",
"+print((a * b - a - b + 1))"
] | false | 0.037807 | 0.007451 | 5.074354 | [
"s782401548",
"s590829736"
] |
u761529120 | p03039 | python | s524070110 | s848047100 | 391 | 203 | 129,620 | 68,336 | Accepted | Accepted | 48.08 | def cmb(n, r, mod):
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 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.ap... | class Combination:
"""
O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる
n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
使用例:
comb = Combination(1000000)
print(comb(5, 3)) # 10
"""
def __init__(self, n_max, mod=10**9+7):
self.mod = mod
self.modinv = self.make_modi... | 38 | 57 | 778 | 1,566 | def cmb(n, r, mod):
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 # 出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-... | class Combination:
"""
O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる
n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
使用例:
comb = Combination(1000000)
print(comb(5, 3)) # 10
"""
def __init__(self, n_max, mod=10**9 + 7):
self.mod = mod
self.modinv = self.make_modinv_list... | false | 33.333333 | [
"-def cmb(n, r, mod):",
"- if r < 0 or r > n:",
"- return 0",
"- r = min(r, n - r)",
"- return g1[n] * g2[r] * g2[n - r] % mod",
"+class Combination:",
"+ \"\"\"",
"+ O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる",
"+ n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)",
"+ ... | false | 1.879933 | 0.043494 | 43.222354 | [
"s524070110",
"s848047100"
] |
u729133443 | p02624 | python | s063212083 | s324355382 | 1,731 | 308 | 9,168 | 73,164 | Accepted | Accepted | 82.21 | n=int(eval(input()))
print((n+sum(n//i*(i+n-n%i)//2for i in range(1,n)))) | n=int(eval(input()))
print((n+sum(n//i*(n-n%i+i)>>1for i in range(1,n)))) | 2 | 2 | 66 | 66 | n = int(eval(input()))
print((n + sum(n // i * (i + n - n % i) // 2 for i in range(1, n))))
| n = int(eval(input()))
print((n + sum(n // i * (n - n % i + i) >> 1 for i in range(1, n))))
| false | 0 | [
"-print((n + sum(n // i * (i + n - n % i) // 2 for i in range(1, n))))",
"+print((n + sum(n // i * (n - n % i + i) >> 1 for i in range(1, n))))"
] | false | 0.00789 | 1.022675 | 0.007715 | [
"s063212083",
"s324355382"
] |
u944325914 | p03031 | python | s502978559 | s178921733 | 46 | 36 | 9,156 | 9,008 | Accepted | Accepted | 21.74 | n,m=list(map(int,input().split()))
switch_list=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
result=[0]*m
for j in range(n):
if (i>>j)&1:
for k in range(m):
if j+1 in switch_list[k][1:]:
... | from itertools import product
n,m=list(map(int,input().split()))
ks=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
count=0
for i in product([0,1],repeat=n):
for j in range(m):
temp=0
for k in range(ks[j][0]):
if i[ks[j][k+1]-1]==1:
... | 17 | 17 | 444 | 428 | n, m = list(map(int, input().split()))
switch_list = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
result = [0] * m
for j in range(n):
if (i >> j) & 1:
for k in range(m):
if j + 1 in switch_list[k][1:]:
... | from itertools import product
n, m = list(map(int, input().split()))
ks = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
count = 0
for i in product([0, 1], repeat=n):
for j in range(m):
temp = 0
for k in range(ks[j][0]):
if i[ks[j][k + 1] - 1] ==... | false | 0 | [
"+from itertools import product",
"+",
"-switch_list = [list(map(int, input().split())) for _ in range(m)]",
"+ks = [list(map(int, input().split())) for _ in range(m)]",
"-ans = 0",
"-for i in range(2**n):",
"- result = [0] * m",
"- for j in range(n):",
"- if (i >> j) & 1:",
"- ... | false | 0.084528 | 0.080658 | 1.047969 | [
"s502978559",
"s178921733"
] |
u721316601 | p02983 | python | s926918822 | s793354835 | 755 | 213 | 3,060 | 12,792 | Accepted | Accepted | 71.79 | L, R = list(map(int, input().split()))
ans = 10**20
if R-L < 2019:
ans = 10**20
for i in range(L, R):
n = i % 2019
for j in range(i+1, R+1):
ans = min(ans, n * j % 2019)
else:
ans = 0
print(ans) | import numpy as np
L, R = list(map(int, input().split()))
if R-L < 2019:
ans = 10**20
for i in range(L, R):
ans = min(ans, np.min(np.arange(i+1, R+1) * i % 2019))
else:
ans = 0
print(ans) | 13 | 12 | 242 | 215 | L, R = list(map(int, input().split()))
ans = 10**20
if R - L < 2019:
ans = 10**20
for i in range(L, R):
n = i % 2019
for j in range(i + 1, R + 1):
ans = min(ans, n * j % 2019)
else:
ans = 0
print(ans)
| import numpy as np
L, R = list(map(int, input().split()))
if R - L < 2019:
ans = 10**20
for i in range(L, R):
ans = min(ans, np.min(np.arange(i + 1, R + 1) * i % 2019))
else:
ans = 0
print(ans)
| false | 7.692308 | [
"+import numpy as np",
"+",
"-ans = 10**20",
"- n = i % 2019",
"- for j in range(i + 1, R + 1):",
"- ans = min(ans, n * j % 2019)",
"+ ans = min(ans, np.min(np.arange(i + 1, R + 1) * i % 2019))"
] | false | 0.067678 | 0.179869 | 0.376263 | [
"s926918822",
"s793354835"
] |
u930705402 | p02733 | python | s023549877 | s749506851 | 447 | 413 | 46,300 | 46,428 | Accepted | Accepted | 7.61 | H,W,K=list(map(int,input().split()))
S=[list(map(int,list(eval(input())))) for i in range(H)]
ans=H+W-2
for bit in range(2**(H-1)):
divH=[0]
for j in range(H-1):
if(bit>>j&1):
divH.append(j+1)
divH.append(H)
glen=len(divH)-1
group=[0]*(glen)
res=glen-1
go=True... | H,W,K=list(map(int,input().split()))
S=[list(map(int,list(eval(input())))) for i in range(H)]
ans=H+W-2
for bit in range(2**(H-1)):
divH=[0]
for j in range(H-1):
if(bit>>j&1):
divH.append(j+1)
divH.append(H)
glen=len(divH)-1
group=[0]*(glen)
res=glen-1
go=True... | 40 | 37 | 929 | 906 | H, W, K = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for i in range(H)]
ans = H + W - 2
for bit in range(2 ** (H - 1)):
divH = [0]
for j in range(H - 1):
if bit >> j & 1:
divH.append(j + 1)
divH.append(H)
glen = len(divH) - 1
group = [0] * (glen)
... | H, W, K = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for i in range(H)]
ans = H + W - 2
for bit in range(2 ** (H - 1)):
divH = [0]
for j in range(H - 1):
if bit >> j & 1:
divH.append(j + 1)
divH.append(H)
glen = len(divH) - 1
group = [0] * (glen)
... | false | 7.5 | [
"- w = 0",
"- while w < W:",
"+ for w in range(W):",
"- break",
"- if c[g] + group[g] > K:",
"+ if cum + group[g] > K:",
"- group = [0] * glen",
"+ group = [c[i] for i in range(glen)]",
"- w += 1"
] | false | 0.118875 | 0.112472 | 1.056934 | [
"s023549877",
"s749506851"
] |
u652656291 | p03252 | python | s613859226 | s942700004 | 128 | 81 | 6,704 | 3,632 | Accepted | Accepted | 36.72 | s=list(eval(input()))
t=list(eval(input()))
S=sorted(map(s.count,set(s)))
T=sorted(map(t.count,set(t)))
print(("Yes" if S==T else "No"))
| S,T = eval(input()),eval(input())
convert = dict()
bl = True
for s,t in zip(S,T):
if s in convert and convert[s] != t:
bl = False
break
convert[s] = t
# 変換先の重複チェック
after = list(convert.values())
if len(after) != len(set(after)):
bl = False
print(('Yes' if bl else 'No'))
| 5 | 17 | 127 | 285 | s = list(eval(input()))
t = list(eval(input()))
S = sorted(map(s.count, set(s)))
T = sorted(map(t.count, set(t)))
print(("Yes" if S == T else "No"))
| S, T = eval(input()), eval(input())
convert = dict()
bl = True
for s, t in zip(S, T):
if s in convert and convert[s] != t:
bl = False
break
convert[s] = t
# 変換先の重複チェック
after = list(convert.values())
if len(after) != len(set(after)):
bl = False
print(("Yes" if bl else "No"))
| false | 70.588235 | [
"-s = list(eval(input()))",
"-t = list(eval(input()))",
"-S = sorted(map(s.count, set(s)))",
"-T = sorted(map(t.count, set(t)))",
"-print((\"Yes\" if S == T else \"No\"))",
"+S, T = eval(input()), eval(input())",
"+convert = dict()",
"+bl = True",
"+for s, t in zip(S, T):",
"+ if s in convert a... | false | 0.039262 | 0.035232 | 1.114386 | [
"s613859226",
"s942700004"
] |
u073549161 | p03643 | python | s345218913 | s919667992 | 170 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.41 | print(("ABC" + eval(input()))) | n= int(eval(input()))
print(("ABC" + str(n)))
| 1 | 2 | 22 | 39 | print(("ABC" + eval(input())))
| n = int(eval(input()))
print(("ABC" + str(n)))
| false | 50 | [
"-print((\"ABC\" + eval(input())))",
"+n = int(eval(input()))",
"+print((\"ABC\" + str(n)))"
] | false | 0.092843 | 0.046823 | 1.982862 | [
"s345218913",
"s919667992"
] |
u334712262 | p03074 | python | s702174395 | s358128040 | 182 | 168 | 7,092 | 11,624 | Accepted | Accepted | 7.69 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | 116 | 105 | 2,460 | 2,235 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | false | 9.482759 | [
"- # error_print(N, K)",
"- # error_print(S)",
"- # error_print(s1)",
"- # error_print(s0)",
"+ if S[0] == \"0\":",
"+ s1.insert(0, 0)",
"+ if S[-1] == \"0\":",
"+ s1.append(0)",
"+ s = []",
"+ i = 0",
"+ for i in range(len(s0)):",
"+ s.append(s1... | false | 0.037286 | 0.036403 | 1.024238 | [
"s702174395",
"s358128040"
] |
u966648240 | p02536 | python | s661425451 | s109602810 | 295 | 218 | 12,940 | 77,580 | Accepted | Accepted | 26.1 | N,M=list(map(int,input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.par... | import sys
def input():
return sys.stdin.readline()[:-1]
N,M=list(map(int,input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.pa... | 56 | 60 | 1,346 | 1,412 | N, M = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
... | import sys
def input():
return sys.stdin.readline()[:-1]
N, M = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] ... | false | 6.666667 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+"
] | false | 0.047196 | 0.038354 | 1.230549 | [
"s661425451",
"s109602810"
] |
u497046426 | p02617 | python | s719360174 | s573139761 | 723 | 535 | 35,664 | 36,048 | Accepted | Accepted | 26 | N = int(eval(input()))
E = [[] for _ in range(N)]
for _ in range(N - 1):
u, v = sorted(list(map(int, input().split())))
E[v-1].append(u-1)
ans = 0
for u, adj in enumerate(E):
ans += (u + 1) * (u + 2) // 2
if not adj: continue
adj = sorted(adj, reverse=True)
for v in adj:
ans -... | N = int(eval(input()))
E = []
for _ in range(N - 1):
u, v = sorted(list(map(int, input().split())))
E.append((u, v))
ans = 0
for v in range(1, N+1):
ans += (N - v + 1) * v
for u, v in E:
ans -= (N - v + 1) * u
print(ans) | 13 | 11 | 345 | 240 | N = int(eval(input()))
E = [[] for _ in range(N)]
for _ in range(N - 1):
u, v = sorted(list(map(int, input().split())))
E[v - 1].append(u - 1)
ans = 0
for u, adj in enumerate(E):
ans += (u + 1) * (u + 2) // 2
if not adj:
continue
adj = sorted(adj, reverse=True)
for v in adj:
ans ... | N = int(eval(input()))
E = []
for _ in range(N - 1):
u, v = sorted(list(map(int, input().split())))
E.append((u, v))
ans = 0
for v in range(1, N + 1):
ans += (N - v + 1) * v
for u, v in E:
ans -= (N - v + 1) * u
print(ans)
| false | 15.384615 | [
"-E = [[] for _ in range(N)]",
"+E = []",
"- E[v - 1].append(u - 1)",
"+ E.append((u, v))",
"-for u, adj in enumerate(E):",
"- ans += (u + 1) * (u + 2) // 2",
"- if not adj:",
"- continue",
"- adj = sorted(adj, reverse=True)",
"- for v in adj:",
"- ans -= (N - u) ... | false | 0.040725 | 0.039915 | 1.020277 | [
"s719360174",
"s573139761"
] |
u561231954 | p03157 | python | s684513308 | s543019734 | 639 | 570 | 12,136 | 74,144 | Accepted | Accepted | 10.8 | dy = (-1,0,1,0)
dx = (0,1,0,-1)
h,w = list(map(int,input().split()))
grid = [eval(input()) for _ in range(h)]
ans = 0
dist = [[-1] * w for _ in range(h)]
for i in range(h):
for j in range(w):
if dist[i][j] < 0:
odd = 0
even = 1
dist[i][j] = 0
s... | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
Dy = (-1,0,1,0)
Dx = (0,1,0,-1)
def main():
H,W = list(map(int,input().split()))
grid = [eval(input()) for _ in range(H)]
grid = [[1 if g == '#' else 0 for g in gr] for gr in grid]
G = [[] for _ in range(H*W)]
f... | 51 | 47 | 1,820 | 1,290 | dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
h, w = list(map(int, input().split()))
grid = [eval(input()) for _ in range(h)]
ans = 0
dist = [[-1] * w for _ in range(h)]
for i in range(h):
for j in range(w):
if dist[i][j] < 0:
odd = 0
even = 1
dist[i][j] = 0
stack = [... | import sys
sys.setrecursionlimit(10000000)
MOD = 10**9 + 7
INF = 10**15
Dy = (-1, 0, 1, 0)
Dx = (0, 1, 0, -1)
def main():
H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
grid = [[1 if g == "#" else 0 for g in gr] for gr in grid]
G = [[] for _ in range(H * W)]
for i... | false | 7.843137 | [
"-dy = (-1, 0, 1, 0)",
"-dx = (0, 1, 0, -1)",
"-h, w = list(map(int, input().split()))",
"-grid = [eval(input()) for _ in range(h)]",
"-ans = 0",
"-dist = [[-1] * w for _ in range(h)]",
"-for i in range(h):",
"- for j in range(w):",
"- if dist[i][j] < 0:",
"- odd = 0",
"- ... | false | 0.045506 | 0.037163 | 1.224519 | [
"s684513308",
"s543019734"
] |
u111365362 | p03073 | python | s392765258 | s288303741 | 74 | 67 | 3,188 | 3,188 | Accepted | Accepted | 9.46 | s = eval(input())
n = len(s)
z0 = 0
z1 = 0
for i in range(n):
if int(s[i]) ^ (i%2) == 0:
z0 += 1
else:
z1 += 1
print((min(z0,z1))) | #14:35
s = eval(input())
n = len(s)
scr = 0
for i in range(n):
a = int(s[i])
if i == 0:
b = 0
else:
b = 1 - b
if a != b:
scr += 1
#print(scr)
print((min(scr,n-scr))) | 10 | 14 | 143 | 190 | s = eval(input())
n = len(s)
z0 = 0
z1 = 0
for i in range(n):
if int(s[i]) ^ (i % 2) == 0:
z0 += 1
else:
z1 += 1
print((min(z0, z1)))
| # 14:35
s = eval(input())
n = len(s)
scr = 0
for i in range(n):
a = int(s[i])
if i == 0:
b = 0
else:
b = 1 - b
if a != b:
scr += 1
# print(scr)
print((min(scr, n - scr)))
| false | 28.571429 | [
"+# 14:35",
"-z0 = 0",
"-z1 = 0",
"+scr = 0",
"- if int(s[i]) ^ (i % 2) == 0:",
"- z0 += 1",
"+ a = int(s[i])",
"+ if i == 0:",
"+ b = 0",
"- z1 += 1",
"-print((min(z0, z1)))",
"+ b = 1 - b",
"+ if a != b:",
"+ scr += 1",
"+# print(scr)",
... | false | 0.044899 | 0.044021 | 1.019949 | [
"s392765258",
"s288303741"
] |
u033287260 | p02693 | python | s155100949 | s503820871 | 22 | 20 | 9,188 | 9,000 | Accepted | Accepted | 9.09 | K = int(eval(input()))
tmp = eval(input())
tmp = str.split(tmp,' ')
A = int(tmp[0])
B = int(tmp[1])
flag = 0
for i in list(range(A,B+1)):
if(i%K == 0):
flag = 1
break;
if(flag == 1):
print("OK")
else:
print("NG")
| K = int(eval(input()))
A,B = input().split()
A = int(A)
B = int(B)
largest = (B//K) * K
if A <= largest:
print("OK")
else:
print("NG") | 15 | 10 | 244 | 146 | K = int(eval(input()))
tmp = eval(input())
tmp = str.split(tmp, " ")
A = int(tmp[0])
B = int(tmp[1])
flag = 0
for i in list(range(A, B + 1)):
if i % K == 0:
flag = 1
break
if flag == 1:
print("OK")
else:
print("NG")
| K = int(eval(input()))
A, B = input().split()
A = int(A)
B = int(B)
largest = (B // K) * K
if A <= largest:
print("OK")
else:
print("NG")
| false | 33.333333 | [
"-tmp = eval(input())",
"-tmp = str.split(tmp, \" \")",
"-A = int(tmp[0])",
"-B = int(tmp[1])",
"-flag = 0",
"-for i in list(range(A, B + 1)):",
"- if i % K == 0:",
"- flag = 1",
"- break",
"-if flag == 1:",
"+A, B = input().split()",
"+A = int(A)",
"+B = int(B)",
"+larges... | false | 0.036796 | 0.0372 | 0.989136 | [
"s155100949",
"s503820871"
] |
u945181840 | p03837 | python | s865482654 | s187462530 | 535 | 321 | 26,568 | 22,880 | Accepted | Accepted | 40 | import sys
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
read = sys.stdin.read
N, M, *abc = list(map(int, read().split()))
a, b, c = list(zip(*list(zip(*[iter(abc)] * 3))))
graph = csr_matrix((c, (a, b)), shape=(N + 1, N + 1))
distance = dijkstra(graph, directed=False)
answ... | import sys
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
read = sys.stdin.read
N, M, *abc = list(map(int, read().split()))
a, b, c = list(zip(*list(zip(*[iter(abc)] * 3))))
graph = csr_matrix((c, (a, b)), shape=(N + 1, N + 1))
distance = dijkstra(graph, directed=False)
answ... | 32 | 19 | 683 | 425 | import sys
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
read = sys.stdin.read
N, M, *abc = list(map(int, read().split()))
a, b, c = list(zip(*list(zip(*[iter(abc)] * 3))))
graph = csr_matrix((c, (a, b)), shape=(N + 1, N + 1))
distance = dijkstra(graph, directed=False)
answer = 0
for i,... | import sys
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
read = sys.stdin.read
N, M, *abc = list(map(int, read().split()))
a, b, c = list(zip(*list(zip(*[iter(abc)] * 3))))
graph = csr_matrix((c, (a, b)), shape=(N + 1, N + 1))
distance = dijkstra(graph, directed=False)
answer = 0
for i,... | false | 40.625 | [
"- if k == distance[i][j]:",
"- continue",
"- for s in range(1, N + 1):",
"- if i == s or j == s:",
"- continue",
"- if k + distance[j][s] == distance[i][s]:",
"- break",
"- if k + distance[i][s] == distance[j][s]:",
"- break",
"- ... | false | 0.350224 | 0.543306 | 0.644616 | [
"s865482654",
"s187462530"
] |
u626337957 | p03078 | python | s650013798 | s083322876 | 970 | 36 | 151,644 | 4,780 | Accepted | Accepted | 96.29 | X, Y, Z, K = list(map(int, input().split()))
a_cakes = list(map(int, input().split()))
b_cakes = list(map(int, input().split()))
c_cakes = list(map(int, input().split()))
a_b_cakes = []
for a in a_cakes:
for b in b_cakes:
a_b_cakes.append(a+b)
a_b_cakes.sort(reverse=True)
a_b_c_cakes = []
for a_b in a_b... | from heapq import heappush, heappop
X,Y,Z,K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort(reverse=True)
b_list.sort(reverse=True)
c_list.sort(reverse=True)
hp = []
checked_dict = {}
max... | 16 | 27 | 453 | 951 | X, Y, Z, K = list(map(int, input().split()))
a_cakes = list(map(int, input().split()))
b_cakes = list(map(int, input().split()))
c_cakes = list(map(int, input().split()))
a_b_cakes = []
for a in a_cakes:
for b in b_cakes:
a_b_cakes.append(a + b)
a_b_cakes.sort(reverse=True)
a_b_c_cakes = []
for a_b in a_b_c... | from heapq import heappush, heappop
X, Y, Z, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort(reverse=True)
b_list.sort(reverse=True)
c_list.sort(reverse=True)
hp = []
checked_dict = {}
max_abc = a... | false | 40.740741 | [
"+from heapq import heappush, heappop",
"+",
"-a_cakes = list(map(int, input().split()))",
"-b_cakes = list(map(int, input().split()))",
"-c_cakes = list(map(int, input().split()))",
"-a_b_cakes = []",
"-for a in a_cakes:",
"- for b in b_cakes:",
"- a_b_cakes.append(a + b)",
"-a_b_cakes.... | false | 0.076086 | 0.03591 | 2.118823 | [
"s650013798",
"s083322876"
] |
u163320134 | p02813 | python | s999307586 | s206406512 | 34 | 17 | 8,052 | 3,064 | Accepted | Accepted | 50 | import itertools
n=int(eval(input()))
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
arrs=list(itertools.permutations(list(range(1,n+1))))
cnt1=0
cnt2=0
for i in range(len(arrs)):
if arrs[i]==p:
cnt1=i
if arrs[i]==q:
cnt2=i
print((abs(cnt2-cnt1))) | def fact(n):
ret=1
for i in range(2,n+1):
ret=ret*i
return ret
n=int(eval(input()))
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
cnt1=0
cnt2=0
checked1=[0]*(n+1)
checked2=[0]*(n+1)
for i in range(n):
checked1[arr1[i]]=1
checked2[arr2[i]]=1
cnt1+=(arr1[i]-1-sum... | 13 | 19 | 278 | 427 | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
arrs = list(itertools.permutations(list(range(1, n + 1))))
cnt1 = 0
cnt2 = 0
for i in range(len(arrs)):
if arrs[i] == p:
cnt1 = i
if arrs[i] == q:
cnt2 = i
print((abs(cnt2 - cnt1)))... | def fact(n):
ret = 1
for i in range(2, n + 1):
ret = ret * i
return ret
n = int(eval(input()))
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
checked1 = [0] * (n + 1)
checked2 = [0] * (n + 1)
for i in range(n):
checked1[arr1[i]] = 1
checked2... | false | 31.578947 | [
"-import itertools",
"+def fact(n):",
"+ ret = 1",
"+ for i in range(2, n + 1):",
"+ ret = ret * i",
"+ return ret",
"+",
"-p = tuple(map(int, input().split()))",
"-q = tuple(map(int, input().split()))",
"-arrs = list(itertools.permutations(list(range(1, n + 1))))",
"+arr1 = list... | false | 0.040413 | 0.042133 | 0.959172 | [
"s999307586",
"s206406512"
] |
u294922877 | p02392 | python | s986743022 | s162722925 | 50 | 20 | 7,680 | 5,592 | Accepted | Accepted | 60 | a,b,c = list(map(int, input().split()))
if (a<b<c):
print('Yes')
else:
print('No') | def judge(a, b, c):
return 'Yes' if a < b < c else 'No'
if __name__ == '__main__':
a, b, c = list(map(int, input().split(' ')))
print((judge(a, b, c)))
| 5 | 7 | 84 | 164 | a, b, c = list(map(int, input().split()))
if a < b < c:
print("Yes")
else:
print("No")
| def judge(a, b, c):
return "Yes" if a < b < c else "No"
if __name__ == "__main__":
a, b, c = list(map(int, input().split(" ")))
print((judge(a, b, c)))
| false | 28.571429 | [
"-a, b, c = list(map(int, input().split()))",
"-if a < b < c:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+def judge(a, b, c):",
"+ return \"Yes\" if a < b < c else \"No\"",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ a, b, c = list(map(int, input().split(\" \")))",
"+ ... | false | 0.046388 | 0.085414 | 0.54309 | [
"s986743022",
"s162722925"
] |
u542932305 | p03043 | python | s146571149 | s303084058 | 66 | 40 | 3,060 | 2,940 | Accepted | Accepted | 39.39 | N, K = list(map(int, input().split()))
result = 0
for i in range(1, N+1):
prob = 1
x = i
for j in range(i, K):
if K <= x:
break
prob *= 0.5
x *= 2
result += prob/N
print(('{0:.12f}'.format(result))) | N, K = list(map(int, input().split()))
result = 0
for x in range(1, N+1):
prob = 1
while x < K:
prob *= 0.5
x *= 2
result += prob/N
print(('{0:.9f}'.format(result))) | 14 | 11 | 257 | 197 | N, K = list(map(int, input().split()))
result = 0
for i in range(1, N + 1):
prob = 1
x = i
for j in range(i, K):
if K <= x:
break
prob *= 0.5
x *= 2
result += prob / N
print(("{0:.12f}".format(result)))
| N, K = list(map(int, input().split()))
result = 0
for x in range(1, N + 1):
prob = 1
while x < K:
prob *= 0.5
x *= 2
result += prob / N
print(("{0:.9f}".format(result)))
| false | 21.428571 | [
"-for i in range(1, N + 1):",
"+for x in range(1, N + 1):",
"- x = i",
"- for j in range(i, K):",
"- if K <= x:",
"- break",
"+ while x < K:",
"-print((\"{0:.12f}\".format(result)))",
"+print((\"{0:.9f}\".format(result)))"
] | false | 0.095835 | 0.096847 | 0.989545 | [
"s146571149",
"s303084058"
] |
u847467233 | p00616 | python | s580605032 | s640250379 | 280 | 170 | 10,272 | 10,276 | Accepted | Accepted | 39.29 | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
while True:
n, h = list(map(int, input().split()))
if n == 0: break
ans = []
for i in range(h):
c, a, b = input().split()
a, b = int(a)-1, int(b)-1
if c == "xy":
ans += [a+b*n+z*... | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
# n <= 500, 2^9 = 512
while True:
n, h = list(map(int, input().split()))
if n == 0: break
ans = []
for i in range(h):
c, a, b = input().split()
a, b = int(a)-1, int(b)-1
if c == "x... | 21 | 22 | 482 | 518 | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
while True:
n, h = list(map(int, input().split()))
if n == 0:
break
ans = []
for i in range(h):
c, a, b = input().split()
a, b = int(a) - 1, int(b) - 1
if c ==... | # AOJ 1030 Cubes Without Holes
# Python3 2018.7.6 bal4u
import sys
from sys import stdin
input = stdin.readline
# n <= 500, 2^9 = 512
while True:
n, h = list(map(int, input().split()))
if n == 0:
break
ans = []
for i in range(h):
c, a, b = input().split()
a, b = int(a) - 1, int... | false | 4.545455 | [
"+# n <= 500, 2^9 = 512",
"- ans += [a + b * n + z * n**2 for z in range(n)]",
"+ ans += [a + (b << 9) + (z << 18) for z in range(n)]",
"- ans += [a + y * n + b * n**2 for y in range(n)]",
"+ ans += [a + (y << 9) + (b << 18) for y in range(n)]",
"- a... | false | 0.158306 | 0.045048 | 3.514154 | [
"s580605032",
"s640250379"
] |
u171276253 | p03494 | python | s373747916 | s998112930 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | num = int(eval(input()))
s = input().rstrip().split(' ')
s = [ int(x) for x in s]
count = 0
key = True
while key:
for i in range(num):
if( s[i] % 2 == 0):
s[i] = s[i] // 2
else:
key = False
if key:
count += 1
print(count)
| import math
n = eval(input())
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print((round(ans))) | 17 | 7 | 291 | 170 | num = int(eval(input()))
s = input().rstrip().split(" ")
s = [int(x) for x in s]
count = 0
key = True
while key:
for i in range(num):
if s[i] % 2 == 0:
s[i] = s[i] // 2
else:
key = False
if key:
count += 1
print(count)
| import math
n = eval(input())
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print((round(ans)))
| false | 58.823529 | [
"-num = int(eval(input()))",
"-s = input().rstrip().split(\" \")",
"-s = [int(x) for x in s]",
"-count = 0",
"-key = True",
"-while key:",
"- for i in range(num):",
"- if s[i] % 2 == 0:",
"- s[i] = s[i] // 2",
"- else:",
"- key = False",
"- if key:",
... | false | 0.066336 | 0.050029 | 1.32596 | [
"s373747916",
"s998112930"
] |
u334712262 | p04046 | python | s030789723 | s966300455 | 1,534 | 448 | 126,576 | 29,260 | Accepted | Accepted | 70.8 |
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinat... |
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinat... | 114 | 104 | 2,088 | 2,078 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_re... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_re... | false | 8.77193 | [
"-nCr = {}",
"+class Combination:",
"+ def __init__(self, n, mod):",
"+ g1 = [1, 1]",
"+ g2 = [1, 1]",
"+ inverse = [0, 1]",
"+ for i in range(2, n + 1):",
"+ g1.append((g1[-1] * i) % mod)",
"+ inverse.append((-inverse[mod % i] * (mod // i)) % mod... | false | 2.586771 | 0.045782 | 56.501922 | [
"s030789723",
"s966300455"
] |
u619458041 | p03032 | python | s425653743 | s720915560 | 36 | 33 | 3,188 | 3,188 | Accepted | Accepted | 8.33 | import sys
from heapq import heappop, heappush
def main():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N, K) - left + 1):
heap = []
... | import sys
from heapq import heappop, heappush
def main():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N, K) - left + 1):
heap = []
... | 34 | 34 | 789 | 790 | import sys
from heapq import heappop, heappush
def main():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N, K) - left + 1):
heap = []
for v in V[... | import sys
from heapq import heappop, heappush
def main():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N, K) - left + 1):
heap = []
for v in V[... | false | 0 | [
"- if v > 0:",
"+ if v >= 0:"
] | false | 0.043527 | 0.049758 | 0.874759 | [
"s425653743",
"s720915560"
] |
u102461423 | p02702 | python | s270450801 | s740022149 | 1,186 | 858 | 117,692 | 108,872 | Accepted | Accepted | 27.66 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
@njit('(i4[:],)')
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x =... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
@njit('(i4[:],)', cache=True)
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
... | 27 | 27 | 629 | 641 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
@njit("(i4[:],)")
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x = x * pow10 %... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
@njit("(i4[:],)", cache=True)
def solve(S):
dp = np.zeros(2019, np.int64)
pow10 = 1
answer = 0
for x in S[::-1]:
dp[0] += 1
x =... | false | 0 | [
"-@njit(\"(i4[:],)\")",
"+@njit(\"(i4[:],)\", cache=True)"
] | false | 0.191589 | 0.216998 | 0.882908 | [
"s270450801",
"s740022149"
] |
u909643606 | p03716 | python | s090431689 | s940391037 | 501 | 463 | 38,288 | 38,292 | Accepted | Accepted | 7.58 | import heapq
def calc(front_sum, back_sum):
heapq.heapify(a_front)
heapq.heapify(a_back)
front_sums = [front_sum]
back_sums = [back_sum]
for i in range(n):
front_sum += a_center[i] - heapq.heappushpop(a_front, a_center[i])
front_sums += [front_sum]
back_sum += a_ce... | import heapq
def calc(front_sum, back_sum):
heapq.heapify(a_front)
heapq.heapify(a_back)
front_sums = [front_sum]
back_sums = [back_sum]
for i in a_center:
front_sum += i - heapq.heappushpop(a_front, i)
front_sums += [front_sum]
a_center.reverse()
for i in a_cente... | 39 | 41 | 963 | 961 | import heapq
def calc(front_sum, back_sum):
heapq.heapify(a_front)
heapq.heapify(a_back)
front_sums = [front_sum]
back_sums = [back_sum]
for i in range(n):
front_sum += a_center[i] - heapq.heappushpop(a_front, a_center[i])
front_sums += [front_sum]
back_sum += a_center[-i -... | import heapq
def calc(front_sum, back_sum):
heapq.heapify(a_front)
heapq.heapify(a_back)
front_sums = [front_sum]
back_sums = [back_sum]
for i in a_center:
front_sum += i - heapq.heappushpop(a_front, i)
front_sums += [front_sum]
a_center.reverse()
for i in a_center:
... | false | 4.878049 | [
"- for i in range(n):",
"- front_sum += a_center[i] - heapq.heappushpop(a_front, a_center[i])",
"+ for i in a_center:",
"+ front_sum += i - heapq.heappushpop(a_front, i)",
"- back_sum += a_center[-i - 1] + heapq.heappushpop(a_back, -a_center[-i - 1])",
"+ a_center.reverse()",... | false | 0.040747 | 0.049393 | 0.824951 | [
"s090431689",
"s940391037"
] |
u813098295 | p03658 | python | s973934199 | s314394123 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n, k = list(map(int, input().split()))
print(( sum(sorted([ int(x) for x in input().split()], reverse = True)[:k]) )) | _, K = list(map(int, input().split()))
L = list(map(int, input().split()))
print((sum(sorted(L, reverse=True)[:K]))) | 2 | 4 | 110 | 112 | n, k = list(map(int, input().split()))
print((sum(sorted([int(x) for x in input().split()], reverse=True)[:k])))
| _, K = list(map(int, input().split()))
L = list(map(int, input().split()))
print((sum(sorted(L, reverse=True)[:K])))
| false | 50 | [
"-n, k = list(map(int, input().split()))",
"-print((sum(sorted([int(x) for x in input().split()], reverse=True)[:k])))",
"+_, K = list(map(int, input().split()))",
"+L = list(map(int, input().split()))",
"+print((sum(sorted(L, reverse=True)[:K])))"
] | false | 0.04721 | 0.047091 | 1.002536 | [
"s973934199",
"s314394123"
] |
u007270338 | p02267 | python | s363355733 | s025589587 | 50 | 20 | 6,552 | 6,556 | Accepted | Accepted | 60 | #coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
def search_banpei(array, target, cnt):
tmp = array[len(array)-1]
array[len(array)-1] = target
n = 0
while array[n] != target:
n += 1
array[len(... | #coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
def search_banpei(array, target, cnt):
tmp = array[len(array)-1]
array[len(array)-1] = target
n = 0
while array[n] != target:
n += 1
array[len(... | 37 | 38 | 736 | 745 | # coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
def search_banpei(array, target, cnt):
tmp = array[len(array) - 1]
array[len(array) - 1] = target
n = 0
while array[n] != target:
n += 1
array[len(array) - 1... | # coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
def search_banpei(array, target, cnt):
tmp = array[len(array) - 1]
array[len(array) - 1] = target
n = 0
while array[n] != target:
n += 1
array[len(array) - 1... | false | 2.631579 | [
"+ return cnt",
"-cnt = linear_banpei_search()",
"+cnt = linear_search()"
] | false | 0.044986 | 0.084949 | 0.529565 | [
"s363355733",
"s025589587"
] |
u899975427 | p02936 | python | s889419121 | s203662415 | 1,234 | 1,022 | 56,056 | 67,176 | Accepted | Accepted | 17.18 | import sys
from collections import deque
input = sys.stdin.readline
n,q = list(map(int,input().split()))
score = [0]*(n+1)
tree = [[] for i in range(n+1)]
check = [0]*(n+1)
check[1] = 1
for i in range(n-1):
a,b = list(map(int,input().split()))
tree[b] += [a]
tree[a] += [b]
que = deque([1])
qapp... | import sys
from collections import deque
input = sys.stdin.readline
n,q = list(map(int,input().split()))
score = [0]*(n+1)
tree = [[] for i in range(n+1)]
check = [0]*(n+1)
check[1] = 1
for i in range(n-1):
a,b = list(map(int,input().split()))
tree[b] += [a]
tree[a] += [b]
que = deque([1])
qapp... | 32 | 32 | 569 | 588 | import sys
from collections import deque
input = sys.stdin.readline
n, q = list(map(int, input().split()))
score = [0] * (n + 1)
tree = [[] for i in range(n + 1)]
check = [0] * (n + 1)
check[1] = 1
for i in range(n - 1):
a, b = list(map(int, input().split()))
tree[b] += [a]
tree[a] += [b]
que = deque([1])
... | import sys
from collections import deque
input = sys.stdin.readline
n, q = list(map(int, input().split()))
score = [0] * (n + 1)
tree = [[] for i in range(n + 1)]
check = [0] * (n + 1)
check[1] = 1
for i in range(n - 1):
a, b = list(map(int, input().split()))
tree[b] += [a]
tree[a] += [b]
que = deque([1])
... | false | 0 | [
"-print((*score[1:]))",
"+print((\" \".join(map(str, score[1:]))))"
] | false | 0.07623 | 0.06427 | 1.186102 | [
"s889419121",
"s203662415"
] |
u811733736 | p00436 | python | s535832395 | s216720359 | 80 | 30 | 7,844 | 7,824 | Accepted | Accepted | 62.5 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
def cut(k):
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
def cut(k):
... | 54 | 57 | 981 | 1,154 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
def cut(k):
global cards
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline
def flatten(listOfLists):
"Flatten one level of nesting"
return chain.from_iterable(listOfLists)
def cut(k):
# ????????¨l
... | false | 5.263158 | [
"+AC",
"+ # ????????¨l",
"+ # ????????¨l",
"-N = 0",
"- global N",
"- shuffle()",
"+ # shuffle()",
"+ temp = [[y, b] for y, b in zip(cards[:n], cards[n:])]",
"+ cards = list(flatten(temp))",
"- cut(op)",
"+ # cut(k)",
"... | false | 0.075244 | 0.041542 | 1.811298 | [
"s535832395",
"s216720359"
] |
u579699847 | p02735 | python | s238657763 | s113706419 | 38 | 33 | 3,952 | 3,188 | Accepted | Accepted | 13.16 | import bisect,collections,copy,itertools,math,string
def I(): return int(eval(input()))
def S(): return eval(input())
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
H,W = LI()
S = [S() for _ in range(H)]
dp = [[-1]*W for ... | import itertools,sys
def S(): return sys.stdin.readline().rstrip()
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
H,W = LI()
S = [S() for _ in range(H)]
dp = [[float('INF')]*W for _ in range(H)]
for i,j in itertools.product(list(range(H)),list(range(W))):
if i==0:
if j==0:
... | 25 | 19 | 924 | 784 | import bisect, collections, copy, itertools, math, string
def I():
return int(eval(input()))
def S():
return eval(input())
def LI():
return list(map(int, input().split()))
def LS():
return list(input().split())
##################################################
H, W = LI()
S = [S() for _ in ra... | import itertools, sys
def S():
return sys.stdin.readline().rstrip()
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
H, W = LI()
S = [S() for _ in range(H)]
dp = [[float("INF")] * W for _ in range(H)]
for i, j in itertools.product(list(range(H)), list(range(W))):
if i == 0:
... | false | 24 | [
"-import bisect, collections, copy, itertools, math, string",
"-",
"-",
"-def I():",
"- return int(eval(input()))",
"+import itertools, sys",
"- return eval(input())",
"+ return sys.stdin.readline().rstrip()",
"- return list(map(int, input().split()))",
"+ return list(map(int, sys.s... | false | 0.038865 | 0.037828 | 1.027408 | [
"s238657763",
"s113706419"
] |
u519939795 | p03611 | python | s303489489 | s454535708 | 160 | 77 | 30,172 | 14,092 | Accepted | Accepted | 51.88 | import collections
n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(n):
a.append(a[i]+1)
a.append(a[i]-1)
c=collections.Counter(a)
print((c.most_common()[0][1])) | n=int(eval(input()))
a=list(map(int,input().split()))
ans=[0]*100002
for i in a:
ans[i]+=1
ans[i+1]+=1
ans[i+2]+=1
print((max(ans)))
| 9 | 8 | 190 | 144 | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
a.append(a[i] + 1)
a.append(a[i] - 1)
c = collections.Counter(a)
print((c.most_common()[0][1]))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0] * 100002
for i in a:
ans[i] += 1
ans[i + 1] += 1
ans[i + 2] += 1
print((max(ans)))
| false | 11.111111 | [
"-import collections",
"-",
"-for i in range(n):",
"- a.append(a[i] + 1)",
"- a.append(a[i] - 1)",
"-c = collections.Counter(a)",
"-print((c.most_common()[0][1]))",
"+ans = [0] * 100002",
"+for i in a:",
"+ ans[i] += 1",
"+ ans[i + 1] += 1",
"+ ans[i + 2] += 1",
"+print((max(a... | false | 0.110752 | 0.134354 | 0.824329 | [
"s303489489",
"s454535708"
] |
u507826663 | p02781 | python | s642646960 | s746437463 | 23 | 17 | 3,064 | 3,064 | Accepted | Accepted | 26.09 | N = int(eval(input()))
K = int(eval(input()))
A = 0
if N <= 100000:
for i in range(1,N+1):
c = str(i)
d = len(c) - c.count('0')
# print(i,c,d,len(c),c.count('0'))
if d == K:
A += 1
else:
keta = len(str(N))
if K ==1:
A = 9*(keta-1)
if K ==2:
... | N = int(eval(input()))
K = int(eval(input()))
A = 0
keta = len(str(N))
if K ==1:
A = 9*(keta-1)
if K ==2:
A = 9*9*(keta-1)*(keta-2)//2
if K ==3:
A = 9*9*9*(keta-1)*(keta-2)*(keta-3)//6
nc = 1
# print(N,K,keta,A)
while nc <= 3 and keta >=1:
# abcd... -> 1000000 - a0000000
T = N//... | 42 | 34 | 1,194 | 911 | N = int(eval(input()))
K = int(eval(input()))
A = 0
if N <= 100000:
for i in range(1, N + 1):
c = str(i)
d = len(c) - c.count("0")
# print(i,c,d,len(c),c.count('0'))
if d == K:
A += 1
else:
keta = len(str(N))
if K == 1:
A = 9 * (keta - 1)
if K == 2:... | N = int(eval(input()))
K = int(eval(input()))
A = 0
keta = len(str(N))
if K == 1:
A = 9 * (keta - 1)
if K == 2:
A = 9 * 9 * (keta - 1) * (keta - 2) // 2
if K == 3:
A = 9 * 9 * 9 * (keta - 1) * (keta - 2) * (keta - 3) // 6
nc = 1
# print(N,K,keta,A)
while nc <= 3 and keta >= 1:
# abcd... -> 1000000 - ... | false | 19.047619 | [
"-if N <= 100000:",
"- for i in range(1, N + 1):",
"- c = str(i)",
"- d = len(c) - c.count(\"0\")",
"- # print(i,c,d,len(c),c.count('0'))",
"- if d == K:",
"- A += 1",
"-else:",
"- keta = len(str(N))",
"- if K == 1:",
"- A = 9 * (keta - 1... | false | 0.040597 | 0.036074 | 1.125389 | [
"s642646960",
"s746437463"
] |
u562935282 | p03713 | python | s938979579 | s447273289 | 190 | 17 | 3,064 | 3,064 | Accepted | Accepted | 91.05 | def solve(h, w):
res = float('inf')
for hh in range(h + 1):
s1 = hh * w
ww = w // 2
s2 = (h - hh) * ww
s3 = (h - hh) * (w - ww)
res = min(res, max(s1, s2, s3) - min(s1, s2, s3))
return res
H, W = list(map(int, input().split()))
ans = H * W
if H % 3 ==... | def calc(h, w):
w_1_1 = w // 3
w_1_2 = w_1_1 + 1
ans = inf
for w_1 in w_1_1, w_1_2:
s_1 = w_1 * h
# 縦に割る
w_2 = (w - w_1) // 2
s_2 = w_2 * h
w_3 = w - w_1 - w_2
s_3 = w_3 * h
ss = [s_1, s_2, s_3]
# print(h, w, ss)
... | 22 | 40 | 445 | 715 | def solve(h, w):
res = float("inf")
for hh in range(h + 1):
s1 = hh * w
ww = w // 2
s2 = (h - hh) * ww
s3 = (h - hh) * (w - ww)
res = min(res, max(s1, s2, s3) - min(s1, s2, s3))
return res
H, W = list(map(int, input().split()))
ans = H * W
if H % 3 == 0 or W % 3 == ... | def calc(h, w):
w_1_1 = w // 3
w_1_2 = w_1_1 + 1
ans = inf
for w_1 in w_1_1, w_1_2:
s_1 = w_1 * h
# 縦に割る
w_2 = (w - w_1) // 2
s_2 = w_2 * h
w_3 = w - w_1 - w_2
s_3 = w_3 * h
ss = [s_1, s_2, s_3]
# print(h, w, ss)
ans = min(ans, max(... | false | 45 | [
"-def solve(h, w):",
"- res = float(\"inf\")",
"- for hh in range(h + 1):",
"- s1 = hh * w",
"- ww = w // 2",
"- s2 = (h - hh) * ww",
"- s3 = (h - hh) * (w - ww)",
"- res = min(res, max(s1, s2, s3) - min(s1, s2, s3))",
"- return res",
"+def calc(h, w):",... | false | 0.184615 | 0.062716 | 2.94366 | [
"s938979579",
"s447273289"
] |
u761320129 | p02834 | python | s641233433 | s052926755 | 1,161 | 617 | 128,760 | 133,064 | Accepted | Accepted | 46.86 | import sys
sys.setrecursionlimit(10**8)
N,U,V = list(map(int,input().split()))
U,V = U-1,V-1
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)
prev = [-1] * N
def dfs(v,p=-1):
for to in es[v]:... | import sys
sys.setrecursionlimit(10**8)
N,U,V = list(map(int,input().split()))
U,V = U-1,V-1
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)
dist1 = [N] * N
dist1[V] = 0
def dfs1(v,p=-1):
f... | 47 | 37 | 939 | 745 | import sys
sys.setrecursionlimit(10**8)
N, U, V = list(map(int, input().split()))
U, V = U - 1, V - 1
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)
prev = [-1] * N
def dfs(v, p=-1):
for to ... | import sys
sys.setrecursionlimit(10**8)
N, U, V = list(map(int, input().split()))
U, V = U - 1, V - 1
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)
dist1 = [N] * N
dist1[V] = 0
def dfs1(v, p=-1... | false | 21.276596 | [
"-prev = [-1] * N",
"+dist1 = [N] * N",
"+dist1[V] = 0",
"-def dfs(v, p=-1):",
"+def dfs1(v, p=-1):",
"- prev[to] = v",
"- dfs(to, v)",
"+ dist1[to] = dist1[v] + 1",
"+ dfs1(to, v)",
"-dfs(U)",
"-path = [V]",
"-while prev[path[-1]] >= 0:",
"- path.append(prev[p... | false | 0.03894 | 0.038132 | 1.02119 | [
"s641233433",
"s052926755"
] |
u316386814 | p03088 | python | s619808080 | s502482013 | 220 | 52 | 12,496 | 3,188 | Accepted | Accepted | 76.36 | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().spl... | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().spl... | 39 | 42 | 1,257 | 1,311 | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.... | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.... | false | 7.142857 | [
"- return input()",
"+ return eval(input())",
"-import numpy as np",
"- A, G, C, T = 0, 1, 2, 3",
"- dp = np.zeros((N + 1, 4, 4, 4), int)",
"- dp[0, T, T, T] = 1",
"- for n in range(N):",
"- for p1, p2, p3 in product(range(4), repeat=3):",
"+ A, G, C, T = list(range(4))",... | false | 0.037435 | 0.105877 | 0.353573 | [
"s619808080",
"s502482013"
] |
u046158516 | p04000 | python | s096508465 | s213304293 | 1,549 | 836 | 138,484 | 238,704 | Accepted | Accepted | 46.03 | a={}
h,w,n=list(map(int,input().split()))
for i in range(n):
y,x=list(map(int,input().split()))
for j in range(max(2,x-1),min(w-1,x+1)+1):
for k in range(max(2,y-1),min(h-1,y+1)+1):
if j*(10**10)+k in a:
a[j*(10**10)+k]+=1
else:
a[j*(10**10)+k]=1
ans=[0]*10
ans[0]=(h-2)*(w... | h,w,n=list(map(int,input().split()))
dic={}
INF=10**10
for i in range(n):
y,x=list(map(int,input().split()))
for j in range(max(2,x-1),min(w-1,x+1)+1):
for k in range(max(2,y-1),min(h-1,y+1)+1):
if j*INF+k in dic:
dic[j*INF+k]+=1
else:
dic[j*INF+k]=1
ans=[0]*10
ans[0]=(h-... | 17 | 18 | 384 | 390 | a = {}
h, w, n = list(map(int, input().split()))
for i in range(n):
y, x = list(map(int, input().split()))
for j in range(max(2, x - 1), min(w - 1, x + 1) + 1):
for k in range(max(2, y - 1), min(h - 1, y + 1) + 1):
if j * (10**10) + k in a:
a[j * (10**10) + k] += 1
... | h, w, n = list(map(int, input().split()))
dic = {}
INF = 10**10
for i in range(n):
y, x = list(map(int, input().split()))
for j in range(max(2, x - 1), min(w - 1, x + 1) + 1):
for k in range(max(2, y - 1), min(h - 1, y + 1) + 1):
if j * INF + k in dic:
dic[j * INF + k] += 1
... | false | 5.555556 | [
"-a = {}",
"+dic = {}",
"+INF = 10**10",
"- if j * (10**10) + k in a:",
"- a[j * (10**10) + k] += 1",
"+ if j * INF + k in dic:",
"+ dic[j * INF + k] += 1",
"- a[j * (10**10) + k] = 1",
"+ dic[j * INF + k] = 1",
"-fo... | false | 0.038122 | 0.117481 | 0.324493 | [
"s096508465",
"s213304293"
] |
u790710233 | p02662 | python | s985091575 | s520037961 | 736 | 112 | 96,936 | 68,540 | Accepted | Accepted | 84.78 | n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 998244353
dp = [0]*(s+1)
dp[0] = pow(2, n, MOD)
inv_2 = pow(2, MOD-2, MOD)
for a in A:
for j in reversed(list(range(s+1))):
if s < j+a:
continue
dp[j+a] += dp[j]*inv_2 % MOD
print((dp[-1] % MOD)... | n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 998244353
dp = [0]*(s+1)
dp[0] = pow(2, n, MOD)
inv_2 = pow(2, MOD-2, MOD)
for a in A:
for j in reversed(list(range(s+1))):
if s < j+a:
continue
dp[j+a] += dp[j]*inv_2
dp[j+a] %= MOD
pr... | 13 | 14 | 308 | 325 | n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 998244353
dp = [0] * (s + 1)
dp[0] = pow(2, n, MOD)
inv_2 = pow(2, MOD - 2, MOD)
for a in A:
for j in reversed(list(range(s + 1))):
if s < j + a:
continue
dp[j + a] += dp[j] * inv_2 % MOD
print((dp[-1] % MOD... | n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 998244353
dp = [0] * (s + 1)
dp[0] = pow(2, n, MOD)
inv_2 = pow(2, MOD - 2, MOD)
for a in A:
for j in reversed(list(range(s + 1))):
if s < j + a:
continue
dp[j + a] += dp[j] * inv_2
dp[j + a] %= MOD
... | false | 7.142857 | [
"- dp[j + a] += dp[j] * inv_2 % MOD",
"+ dp[j + a] += dp[j] * inv_2",
"+ dp[j + a] %= MOD"
] | false | 0.034141 | 0.037872 | 0.901492 | [
"s985091575",
"s520037961"
] |
u644907318 | p02661 | python | s312220592 | s248697589 | 447 | 400 | 136,808 | 136,624 | Accepted | Accepted | 10.51 | N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
A = sorted([X[i][0] for i in range(N)])
B = sorted([X[i][1] for i in range(N)])
if N%2==1:
k = (N+1)//2
a = A[k-1]
b = B[k-1]
print((b-a+1))
else:
a2 = A[N//2-1]+A[N//2]
b2 = B[N//2-1]+B[N//2]
print((b2... | N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
A = sorted([X[i][0] for i in range(N)])
B = sorted([X[i][1] for i in range(N)])
if N%2==1:
a = A[N//2]
b = B[N//2]
print((b-a+1))
else:
a = (A[(N-1)//2]+A[N//2])/2
b = (B[(N-1)//2]+B[N//2])/2
print((int((b-a... | 13 | 12 | 317 | 321 | N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
A = sorted([X[i][0] for i in range(N)])
B = sorted([X[i][1] for i in range(N)])
if N % 2 == 1:
k = (N + 1) // 2
a = A[k - 1]
b = B[k - 1]
print((b - a + 1))
else:
a2 = A[N // 2 - 1] + A[N // 2]
b2 = B[N // 2 - 1] + B[... | N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
A = sorted([X[i][0] for i in range(N)])
B = sorted([X[i][1] for i in range(N)])
if N % 2 == 1:
a = A[N // 2]
b = B[N // 2]
print((b - a + 1))
else:
a = (A[(N - 1) // 2] + A[N // 2]) / 2
b = (B[(N - 1) // 2] + B[N // 2]) /... | false | 7.692308 | [
"- k = (N + 1) // 2",
"- a = A[k - 1]",
"- b = B[k - 1]",
"+ a = A[N // 2]",
"+ b = B[N // 2]",
"- a2 = A[N // 2 - 1] + A[N // 2]",
"- b2 = B[N // 2 - 1] + B[N // 2]",
"- print((b2 - a2 + 1))",
"+ a = (A[(N - 1) // 2] + A[N // 2]) / 2",
"+ b = (B[(N - 1) // 2] + B[N /... | false | 0.049574 | 0.067314 | 0.736453 | [
"s312220592",
"s248697589"
] |
u864197622 | p02563 | python | s881399174 | s692457859 | 2,639 | 1,311 | 220,620 | 203,256 | Accepted | Accepted | 50.32 | p, g = 998244353, 3
invg = pow(g, p-2, p)
W = [pow(g, (p - 1) >> i, p) for i in range(24)]
iW = [pow(invg, (p - 1) >> i, p) for i in range(24)]
def fft(k, f):
for l in range(k)[::-1]:
d = 1 << l
u = 1
for i in range(d):
for j in range(i, 1 << k, 2*d):
... | p, g = 998244353, 3
invg = pow(g, p-2, p)
W = [pow(g, (p - 1) >> i, p) for i in range(24)]
iW = [pow(invg, (p - 1) >> i, p) for i in range(24)]
def fft(k, f):
for l in range(k)[::-1]:
d = 1 << l
u = 1
for i in range(d):
for j in range(i, 1 << k, 2*d):
... | 43 | 43 | 1,203 | 1,199 | p, g = 998244353, 3
invg = pow(g, p - 2, p)
W = [pow(g, (p - 1) >> i, p) for i in range(24)]
iW = [pow(invg, (p - 1) >> i, p) for i in range(24)]
def fft(k, f):
for l in range(k)[::-1]:
d = 1 << l
u = 1
for i in range(d):
for j in range(i, 1 << k, 2 * d):
f[j], ... | p, g = 998244353, 3
invg = pow(g, p - 2, p)
W = [pow(g, (p - 1) >> i, p) for i in range(24)]
iW = [pow(invg, (p - 1) >> i, p) for i in range(24)]
def fft(k, f):
for l in range(k)[::-1]:
d = 1 << l
u = 1
for i in range(d):
for j in range(i, 1 << k, 2 * d):
f[j], ... | false | 0 | [
"- k = (n0).bit_length() + 1",
"+ k = (n0).bit_length()"
] | false | 0.036655 | 0.03946 | 0.928931 | [
"s881399174",
"s692457859"
] |
u277177960 | p03911 | python | s461175744 | s738164937 | 546 | 420 | 120,408 | 142,068 | Accepted | Accepted | 23.08 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 95 | 131 | 1,866 | 2,803 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 27.480916 | [
"-import sys",
"+from fractions import Fraction",
"-from itertools import combinations, combinations_with_replacement, product, permutations",
"-from operator import add, mul, sub",
"+from itertools import (",
"+ combinations,",
"+ combinations_with_replacement,",
"+ product,",
"+ permut... | false | 0.076322 | 0.041671 | 1.831536 | [
"s461175744",
"s738164937"
] |
u799428760 | p02642 | python | s401596371 | s739665751 | 424 | 342 | 34,744 | 34,932 | Accepted | Accepted | 19.34 | if __name__ == "__main__":
n = int(eval(input()))
l_a = list(map(int, input().split()))
s_a = list(set(l_a))
s_a.sort()
dub_a = [0]*(max(s_a)+1)
for i in l_a:
dub_a[i] += 1
dp = [1]*(max(s_a)+1)
for i in s_a:
if 2*i > len(dp)-1:
pass
... | if __name__ == "__main__":
n = int(eval(input()))
l_a = list(map(int, input().split()))
s_a = list(set(l_a))
s_a.sort()
dub_a = [0]*(max(s_a)+1)
for i in l_a:
dub_a[i] += 1
dp = [1]*(max(s_a)+1)
for i in s_a:
if dp[i] == 0:
pass
e... | 31 | 27 | 599 | 509 | if __name__ == "__main__":
n = int(eval(input()))
l_a = list(map(int, input().split()))
s_a = list(set(l_a))
s_a.sort()
dub_a = [0] * (max(s_a) + 1)
for i in l_a:
dub_a[i] += 1
dp = [1] * (max(s_a) + 1)
for i in s_a:
if 2 * i > len(dp) - 1:
pass
""... | if __name__ == "__main__":
n = int(eval(input()))
l_a = list(map(int, input().split()))
s_a = list(set(l_a))
s_a.sort()
dub_a = [0] * (max(s_a) + 1)
for i in l_a:
dub_a[i] += 1
dp = [1] * (max(s_a) + 1)
for i in s_a:
if dp[i] == 0:
pass
else:
... | false | 12.903226 | [
"- if 2 * i > len(dp) - 1:",
"+ if dp[i] == 0:",
"- \"\"\"",
"- elif dp[2*i] == 0:",
"- pass",
"- \"\"\""
] | false | 0.037328 | 0.044218 | 0.844189 | [
"s401596371",
"s739665751"
] |
u600402037 | p03805 | python | s166346679 | s601803914 | 57 | 42 | 3,064 | 3,064 | Accepted | Accepted | 26.32 | import itertools
N, M = list(map(int, input().split()))
edges = [tuple(sorted(map(int, input().split()))) for _ in range(M)]
answer = 0
for i in itertools.permutations(list(range(2, N+1)), N-1):
l = [1] + list(i)
answer += sum(1 for x in zip(l, l[1:]) if tuple(sorted(x)) in edges) == N-1
print(answer... | from itertools import permutations
N, M = list(map(int, input().split()))
AB = set([tuple(sorted(map(int, input().split()))) for _ in range(M)])
answer = 0
for pattern in permutations(list(range(2, N+1)), N-1):
pattern = [1] + list(pattern)
for i in zip(pattern[:-1], pattern[1:]):
if tuple(so... | 10 | 14 | 313 | 393 | import itertools
N, M = list(map(int, input().split()))
edges = [tuple(sorted(map(int, input().split()))) for _ in range(M)]
answer = 0
for i in itertools.permutations(list(range(2, N + 1)), N - 1):
l = [1] + list(i)
answer += sum(1 for x in zip(l, l[1:]) if tuple(sorted(x)) in edges) == N - 1
print(answer)
| from itertools import permutations
N, M = list(map(int, input().split()))
AB = set([tuple(sorted(map(int, input().split()))) for _ in range(M)])
answer = 0
for pattern in permutations(list(range(2, N + 1)), N - 1):
pattern = [1] + list(pattern)
for i in zip(pattern[:-1], pattern[1:]):
if tuple(sorted(i... | false | 28.571429 | [
"-import itertools",
"+from itertools import permutations",
"-edges = [tuple(sorted(map(int, input().split()))) for _ in range(M)]",
"+AB = set([tuple(sorted(map(int, input().split()))) for _ in range(M)])",
"-for i in itertools.permutations(list(range(2, N + 1)), N - 1):",
"- l = [1] + list(i)",
"- ... | false | 0.067817 | 0.132555 | 0.511619 | [
"s166346679",
"s601803914"
] |
u545368057 | p02882 | python | s776991528 | s833086102 | 1,230 | 154 | 21,500 | 12,484 | Accepted | Accepted | 87.48 | import numpy as np
a,b,V = list(map(int, input().split()))
x = V/(a*a)
if b >= 2*x:
tan = b**2/(2*a*x)
else:
tan = 2*(b-x)/a
ans = np.arctan(tan)
print((ans*180/np.pi)) | import numpy as np
a,b,V = list(map(int, input().split()))
x = V/(a*a)
"""
算数の解
"""
# if b >= 2*x:
# tan = b**2/(2*a*x)
# else:
# tan = 2*(b-x)/a
# ans = np.arctan(tan)
# print(ans*180/np.pi)
"""
二部探索
"""
def f(theta):
if np.tan(theta) < (2*x)/a:
l = x + a*np.tan(theta)/2
e... | 9 | 36 | 176 | 621 | import numpy as np
a, b, V = list(map(int, input().split()))
x = V / (a * a)
if b >= 2 * x:
tan = b**2 / (2 * a * x)
else:
tan = 2 * (b - x) / a
ans = np.arctan(tan)
print((ans * 180 / np.pi))
| import numpy as np
a, b, V = list(map(int, input().split()))
x = V / (a * a)
"""
算数の解
"""
# if b >= 2*x:
# tan = b**2/(2*a*x)
# else:
# tan = 2*(b-x)/a
# ans = np.arctan(tan)
# print(ans*180/np.pi)
"""
二部探索
"""
def f(theta):
if np.tan(theta) < (2 * x) / a:
l = x + a * np.tan(theta) / 2
else:
... | false | 75 | [
"-if b >= 2 * x:",
"- tan = b**2 / (2 * a * x)",
"-else:",
"- tan = 2 * (b - x) / a",
"-ans = np.arctan(tan)",
"-print((ans * 180 / np.pi))",
"+\"\"\"",
"+算数の解",
"+\"\"\"",
"+# if b >= 2*x:",
"+# tan = b**2/(2*a*x)",
"+# else:",
"+# tan = 2*(b-x)/a",
"+# ans = np.arctan(tan)"... | false | 0.33957 | 0.176921 | 1.919329 | [
"s776991528",
"s833086102"
] |
u268516119 | p04031 | python | s016306937 | s279925200 | 166 | 18 | 13,060 | 3,060 | Accepted | Accepted | 89.16 | import numpy as np
M=int(eval(input()))
n=list(map(int,input().split()))
x=int(round(np.mean(n)))
ans=0
for i in n:
ans=ans+(i-x)**2
print(ans)
| M=int(eval(input()))
n=list(map(int,input().split()))
x=int(round(sum(n)/M))
ans=0
for i in n:
ans=ans+(i-x)**2
print(ans)
| 8 | 7 | 149 | 127 | import numpy as np
M = int(eval(input()))
n = list(map(int, input().split()))
x = int(round(np.mean(n)))
ans = 0
for i in n:
ans = ans + (i - x) ** 2
print(ans)
| M = int(eval(input()))
n = list(map(int, input().split()))
x = int(round(sum(n) / M))
ans = 0
for i in n:
ans = ans + (i - x) ** 2
print(ans)
| false | 12.5 | [
"-import numpy as np",
"-",
"-x = int(round(np.mean(n)))",
"+x = int(round(sum(n) / M))"
] | false | 0.244561 | 0.040363 | 6.059091 | [
"s016306937",
"s279925200"
] |
u797673668 | p00537 | python | s594442232 | s274367181 | 1,430 | 530 | 15,960 | 16,452 | Accepted | Accepted | 62.94 | class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] +=... | from itertools import accumulate
n, m = list(map(int, input().split()))
cnts = [0] * (n + 1)
cities = list(map(int, input().split()))
prev = next(cities)
for cur in cities:
if prev < cur:
cnts[prev] += 1
cnts[cur] -= 1
else:
cnts[cur] += 1
cnts[prev] -= 1
prev =... | 41 | 25 | 846 | 553 | class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
... | from itertools import accumulate
n, m = list(map(int, input().split()))
cnts = [0] * (n + 1)
cities = list(map(int, input().split()))
prev = next(cities)
for cur in cities:
if prev < cur:
cnts[prev] += 1
cnts[cur] -= 1
else:
cnts[cur] += 1
cnts[prev] -= 1
prev = cur
cnts = l... | false | 39.02439 | [
"-class Bit:",
"- def __init__(self, n):",
"- self.size = n",
"- self.tree = [0] * (n + 1)",
"-",
"- def sum(self, i):",
"- s = 0",
"- while i > 0:",
"- s += self.tree[i]",
"- i -= i & -i",
"- return s",
"-",
"- def add(self, ... | false | 0.066162 | 0.076253 | 0.867666 | [
"s594442232",
"s274367181"
] |
u845643816 | p00510 | python | s930618150 | s060441230 | 60 | 50 | 5,612 | 5,612 | Accepted | Accepted | 16.67 | n = int(eval(input()))
m = int(eval(input()))
S_max = m
for i in range(n):
a, b = list(map(int, input().split()))
m += a - b
if m < 0:
print((0))
break
S_max = max(S_max, m)
else:
print(S_max)
| n = int(eval(input()))
m = int(eval(input()))
S_max = m
for i in range(n):
a, b = list(map(int, input().split()))
m += a - b
if m < 0:
S_max = 0
break
S_max = max(S_max, m)
print(S_max)
| 12 | 11 | 220 | 210 | n = int(eval(input()))
m = int(eval(input()))
S_max = m
for i in range(n):
a, b = list(map(int, input().split()))
m += a - b
if m < 0:
print((0))
break
S_max = max(S_max, m)
else:
print(S_max)
| n = int(eval(input()))
m = int(eval(input()))
S_max = m
for i in range(n):
a, b = list(map(int, input().split()))
m += a - b
if m < 0:
S_max = 0
break
S_max = max(S_max, m)
print(S_max)
| false | 8.333333 | [
"- print((0))",
"+ S_max = 0",
"-else:",
"- print(S_max)",
"+print(S_max)"
] | false | 0.049253 | 0.042722 | 1.152858 | [
"s930618150",
"s060441230"
] |
u021548497 | p02560 | python | s546169217 | s857787301 | 657 | 298 | 106,300 | 78,812 | Accepted | Accepted | 54.64 | import sys
import numba
from numba import njit, i8
input = sys.stdin.readline
@njit(i8(i8, i8, i8, i8), cache=True)
def floor_sum(n, m, a, b):
ans = 0
if a >= m:
ans += (n-1) * n * (a // m) // 2
a %= m
if b >= m:
ans += b * (b // m)
b %= m
y_max = (a ... | import sys
input = sys.stdin.readline
def floor_sum(n, m, a, b):
ans = 0
if a >= m:
ans += (n-1) * n * (a // m) // 2
a %= m
if b >= m:
ans += b * (b // m)
b %= m
y_max = (a * n + b) // m
x_max = y_max * m - b
if y_max == 0:
return ans
... | 33 | 31 | 733 | 654 | import sys
import numba
from numba import njit, i8
input = sys.stdin.readline
@njit(i8(i8, i8, i8, i8), cache=True)
def floor_sum(n, m, a, b):
ans = 0
if a >= m:
ans += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
ans += b * (b // m)
b %= m
y_max = (a * n + b) // m
... | import sys
input = sys.stdin.readline
def floor_sum(n, m, a, b):
ans = 0
if a >= m:
ans += (n - 1) * n * (a // m) // 2
a %= m
if b >= m:
ans += b * (b // m)
b %= m
y_max = (a * n + b) // m
x_max = y_max * m - b
if y_max == 0:
return ans
ans += (n - ... | false | 6.060606 | [
"-import numba",
"-from numba import njit, i8",
"-@njit(i8(i8, i8, i8, i8), cache=True)"
] | false | 0.044152 | 0.138502 | 0.318783 | [
"s546169217",
"s857787301"
] |
u347640436 | p02632 | python | s650886337 | s057636651 | 1,867 | 1,302 | 91,708 | 75,460 | Accepted | Accepted | 30.26 | # フェルマーの小定理
K = int(eval(input()))
S = eval(input())
m = 1000000007
def make_factorial_table(n):
result = [0] * (n + 1)
result[0] = 1
for i in range(1, n + 1):
result[i] = result[i - 1] * i % m
return result
def mcomb(n, k):
if n == 0 and k == 0:
return 1
i... | # フェルマーの小定理
K = int(eval(input()))
S = eval(input())
m = 1000000007
result = 0
a = 1
b = 1
for i in range(K + 1):
# result += pow(26, K - i, m) * mcomb(len(S) - 1 + i, i) * pow(25, i, m)
result += pow(26, K - i, m) * (a * pow(b, m - 2, m)) * pow(25, i, m)
result %= m
a *= len(S) - 1 + (... | 30 | 19 | 621 | 370 | # フェルマーの小定理
K = int(eval(input()))
S = eval(input())
m = 1000000007
def make_factorial_table(n):
result = [0] * (n + 1)
result[0] = 1
for i in range(1, n + 1):
result[i] = result[i - 1] * i % m
return result
def mcomb(n, k):
if n == 0 and k == 0:
return 1
if n < k or k < 0:
... | # フェルマーの小定理
K = int(eval(input()))
S = eval(input())
m = 1000000007
result = 0
a = 1
b = 1
for i in range(K + 1):
# result += pow(26, K - i, m) * mcomb(len(S) - 1 + i, i) * pow(25, i, m)
result += pow(26, K - i, m) * (a * pow(b, m - 2, m)) * pow(25, i, m)
result %= m
a *= len(S) - 1 + (i + 1)
a %= m... | false | 36.666667 | [
"-",
"-",
"-def make_factorial_table(n):",
"- result = [0] * (n + 1)",
"- result[0] = 1",
"- for i in range(1, n + 1):",
"- result[i] = result[i - 1] * i % m",
"- return result",
"-",
"-",
"-def mcomb(n, k):",
"- if n == 0 and k == 0:",
"- return 1",
"- if n... | false | 0.042373 | 0.098193 | 0.431534 | [
"s650886337",
"s057636651"
] |
u768896740 | p02996 | python | s095163357 | s414092050 | 1,114 | 982 | 55,260 | 53,716 | Accepted | Accepted | 11.85 | n = int(eval(input()))
num_list = []
for _ in range(n):
nums = list(map(int, input().split()))
num_list.append(nums)
num_list = sorted(num_list, key=lambda x: x[1])
count = 0
for i in range(n):
count += num_list[i][0]
if count > num_list[i][1]:
print('No')
exit()
... | n = int(eval(input()))
jobs = []
for i in range(n):
array = list(map(int, input().split()))
jobs.append(array)
jobs.sort(key=lambda x:x[1])
time = 0
for i, j in jobs:
time += i
if time <= j:
continue
else:
print('No')
exit()
print('Yes') | 19 | 20 | 326 | 299 | n = int(eval(input()))
num_list = []
for _ in range(n):
nums = list(map(int, input().split()))
num_list.append(nums)
num_list = sorted(num_list, key=lambda x: x[1])
count = 0
for i in range(n):
count += num_list[i][0]
if count > num_list[i][1]:
print("No")
exit()
print("Yes")
| n = int(eval(input()))
jobs = []
for i in range(n):
array = list(map(int, input().split()))
jobs.append(array)
jobs.sort(key=lambda x: x[1])
time = 0
for i, j in jobs:
time += i
if time <= j:
continue
else:
print("No")
exit()
print("Yes")
| false | 5 | [
"-num_list = []",
"-for _ in range(n):",
"- nums = list(map(int, input().split()))",
"- num_list.append(nums)",
"-num_list = sorted(num_list, key=lambda x: x[1])",
"-count = 0",
"+jobs = []",
"- count += num_list[i][0]",
"- if count > num_list[i][1]:",
"+ array = list(map(int, input... | false | 0.038736 | 0.046521 | 0.832671 | [
"s095163357",
"s414092050"
] |
u241159583 | p03993 | python | s273224532 | s380716426 | 78 | 69 | 13,880 | 14,004 | Accepted | Accepted | 11.54 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if a[i] != "": n = a[i] - 1
if a[n] == i + 1:
ans += 1
a[n] = ""
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if a[a[i]-1] == i+1:
cnt += 1
a[i] = ""
print(cnt) | 10 | 9 | 177 | 149 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if a[i] != "":
n = a[i] - 1
if a[n] == i + 1:
ans += 1
a[n] = ""
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if a[a[i] - 1] == i + 1:
cnt += 1
a[i] = ""
print(cnt)
| false | 10 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-ans = 0",
"-for i in range(N):",
"- if a[i] != \"\":",
"- n = a[i] - 1",
"- if a[n] == i + 1:",
"- ans += 1",
"- a[n] = \"\"",
"-print(ans)",
"+cnt = 0",
"+for i in range(n):",
"+ if a[a[i] - 1] == i + 1:",... | false | 0.038501 | 0.036751 | 1.04763 | [
"s273224532",
"s380716426"
] |
u057916330 | p03764 | python | s115120613 | s938338730 | 152 | 116 | 18,576 | 18,624 | Accepted | Accepted | 23.68 | n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10 ** 9 + 7
xsum, ysum = 0, 0
for i in range(n):
xsum += i * x[i] - (n - 1 - i) * x[i]
for i in range(m):
ysum += i * y[i] - (m - 1 - i) * y[i]
ans = (xsum * ysum) % mod
print(ans)
| n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10 ** 9 + 7
xsum = sum((i * x[i] - (n - 1 - i) * x[i]) for i in range(n))
ysum = sum((i * y[i] - (m - 1 - i) * y[i]) for i in range(m))
ans = (xsum * ysum) % mod
print(ans)
| 11 | 8 | 310 | 291 | n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9 + 7
xsum, ysum = 0, 0
for i in range(n):
xsum += i * x[i] - (n - 1 - i) * x[i]
for i in range(m):
ysum += i * y[i] - (m - 1 - i) * y[i]
ans = (xsum * ysum) % mod
print(ans)
| n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9 + 7
xsum = sum((i * x[i] - (n - 1 - i) * x[i]) for i in range(n))
ysum = sum((i * y[i] - (m - 1 - i) * y[i]) for i in range(m))
ans = (xsum * ysum) % mod
print(ans)
| false | 27.272727 | [
"-xsum, ysum = 0, 0",
"-for i in range(n):",
"- xsum += i * x[i] - (n - 1 - i) * x[i]",
"-for i in range(m):",
"- ysum += i * y[i] - (m - 1 - i) * y[i]",
"+xsum = sum((i * x[i] - (n - 1 - i) * x[i]) for i in range(n))",
"+ysum = sum((i * y[i] - (m - 1 - i) * y[i]) for i in range(m))"
] | false | 0.039536 | 0.092277 | 0.428447 | [
"s115120613",
"s938338730"
] |
u702582248 | p03504 | python | s496565427 | s780301906 | 1,527 | 723 | 18,984 | 19,016 | Accepted | Accepted | 52.65 | def func():
tvs = []
for i in range(num):
tvs.append((-1, -1))
for i in range(len(bans)):
now = bans[i][0]
can = bans[i][2]
tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]
for j, tv in enumerate(tvs):
if tv[1] == -1 o... | def func():
tvs = []
for i in range(num):
tvs.append((-1, -1))
for i in range(len(bans)):
now = bans[i][0]
can = bans[i][2]
# tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]
for j, tv in enumerate(tvs):
if tv[1] == -1... | 29 | 29 | 765 | 767 | def func():
tvs = []
for i in range(num):
tvs.append((-1, -1))
for i in range(len(bans)):
now = bans[i][0]
can = bans[i][2]
tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]
for j, tv in enumerate(tvs):
if tv[1] == -1 or (tv[1] ... | def func():
tvs = []
for i in range(num):
tvs.append((-1, -1))
for i in range(len(bans)):
now = bans[i][0]
can = bans[i][2]
# tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]
for j, tv in enumerate(tvs):
if tv[1] == -1 or (tv[1... | false | 0 | [
"- tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]",
"+ # tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]"
] | false | 0.036225 | 0.036248 | 0.99939 | [
"s496565427",
"s780301906"
] |
u620084012 | p03503 | python | s832235750 | s440456469 | 570 | 236 | 3,064 | 42,972 | Accepted | Accepted | 58.6 | N = int(eval(input()))
F = [list(map(int, input().split())) for k in range(N)]
P = [list(map(int, input().split())) for k in range(N)]
B = [format(k,'b').zfill(10) for k in range(1,1024)]
ans = -10**9
for d in B:
t = 0
E = [0 for k in range(N)]
for l in range(N):
for k in range(10):
... | N = int(eval(input()))
F = [list(map(int,input().split())) for k in range(N)]
P = [list(map(int,input().split())) for k in range(N)]
ans = -float("inf")
for k in range(2**10):
temp = 0
S = [0 for l in range(N)]
for s in range(N):
for d in range(10):
if (k>>d)&1 == 1:
... | 17 | 18 | 432 | 491 | N = int(eval(input()))
F = [list(map(int, input().split())) for k in range(N)]
P = [list(map(int, input().split())) for k in range(N)]
B = [format(k, "b").zfill(10) for k in range(1, 1024)]
ans = -(10**9)
for d in B:
t = 0
E = [0 for k in range(N)]
for l in range(N):
for k in range(10):
... | N = int(eval(input()))
F = [list(map(int, input().split())) for k in range(N)]
P = [list(map(int, input().split())) for k in range(N)]
ans = -float("inf")
for k in range(2**10):
temp = 0
S = [0 for l in range(N)]
for s in range(N):
for d in range(10):
if (k >> d) & 1 == 1:
... | false | 5.555556 | [
"-B = [format(k, \"b\").zfill(10) for k in range(1, 1024)]",
"-ans = -(10**9)",
"-for d in B:",
"- t = 0",
"- E = [0 for k in range(N)]",
"- for l in range(N):",
"- for k in range(10):",
"- E[l] += int(d[k]) * F[l][k]",
"- for k in range(N):",
"- t += P[k][E[k]... | false | 0.089693 | 0.080645 | 1.112189 | [
"s832235750",
"s440456469"
] |
u579699847 | p02861 | python | s394135993 | s606297415 | 1,366 | 152 | 12,452 | 12,424 | Accepted | Accepted | 88.87 | import itertools,math,numpy as np
def I(): return int(eval(input()))
def LI(): return list(map(int,input().split()))
N = I()
xy = np.array(sorted([LI() for _ in range(N)]))
sum_norm = 0
dict_norm = {}
for a in itertools.permutations(list(range(N))):
for i in range(len(a)-1):
vector = tuple(xy[a[i+1... | import numpy as np
def I(): return int(eval(input()))
def LI(): return list(map(int,input().split()))
N = I()
xy = np.array([LI() for _ in range(N)])
sum_norm = 0
for i in range(N):
for j in range(i,N):
sum_norm += np.linalg.norm(xy[j]-xy[i])
print((2*sum_norm/N))
| 14 | 10 | 488 | 278 | import itertools, math, numpy as np
def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
N = I()
xy = np.array(sorted([LI() for _ in range(N)]))
sum_norm = 0
dict_norm = {}
for a in itertools.permutations(list(range(N))):
for i in range(len(a) - 1):
vector = tupl... | import numpy as np
def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
N = I()
xy = np.array([LI() for _ in range(N)])
sum_norm = 0
for i in range(N):
for j in range(i, N):
sum_norm += np.linalg.norm(xy[j] - xy[i])
print((2 * sum_norm / N))
| false | 28.571429 | [
"-import itertools, math, numpy as np",
"+import numpy as np",
"-xy = np.array(sorted([LI() for _ in range(N)]))",
"+xy = np.array([LI() for _ in range(N)])",
"-dict_norm = {}",
"-for a in itertools.permutations(list(range(N))):",
"- for i in range(len(a) - 1):",
"- vector = tuple(xy[a[i + 1... | false | 0.281638 | 0.162312 | 1.735163 | [
"s394135993",
"s606297415"
] |
u674574659 | p03290 | python | s758878977 | s314087357 | 241 | 26 | 45,292 | 3,064 | Accepted | Accepted | 89.21 | import re
d,g = list(map(int,input().split() ))
l = [list(map(int,input().split() ))+[100*(x+1)] for x in range(d) ]
mondai_num = []
for k in range(2**d):
#先に全完するカテゴリ(何百点問題を全完するか)を決め、回す
bin_str = format(k, "0{}b".format(d) )#二進数の文字列を取得
#これが全完する問題のリスト
zenkan_list = [ x.start() for x in re.findit... | import math
D,G = list(map(int,input().split()))
p = []
c = []
for i in range(D):
P,C = list(map(int,input().split()))
p.append(P)
c.append(C)
res = float("inf")
for i in range(2**D):
bs = format(i,"0{}b".format(D))
ans = 0
cnt = 0
#コンプするやつをたす
for j in range(D):
if bs[j] == ... | 42 | 33 | 953 | 669 | import re
d, g = list(map(int, input().split()))
l = [list(map(int, input().split())) + [100 * (x + 1)] for x in range(d)]
mondai_num = []
for k in range(2**d):
# 先に全完するカテゴリ(何百点問題を全完するか)を決め、回す
bin_str = format(k, "0{}b".format(d)) # 二進数の文字列を取得
# これが全完する問題のリスト
zenkan_list = [x.start() for x in re.findi... | import math
D, G = list(map(int, input().split()))
p = []
c = []
for i in range(D):
P, C = list(map(int, input().split()))
p.append(P)
c.append(C)
res = float("inf")
for i in range(2**D):
bs = format(i, "0{}b".format(D))
ans = 0
cnt = 0
# コンプするやつをたす
for j in range(D):
if bs[j] =... | false | 21.428571 | [
"-import re",
"+import math",
"-d, g = list(map(int, input().split()))",
"-l = [list(map(int, input().split())) + [100 * (x + 1)] for x in range(d)]",
"-mondai_num = []",
"-for k in range(2**d):",
"- # 先に全完するカテゴリ(何百点問題を全完するか)を決め、回す",
"- bin_str = format(k, \"0{}b\".format(d)) # 二進数の文字列を取得",
"... | false | 0.052608 | 0.060028 | 0.876382 | [
"s758878977",
"s314087357"
] |
u644907318 | p02948 | python | s655791834 | s856217861 | 1,371 | 460 | 25,536 | 103,076 | Accepted | Accepted | 66.45 | import bisect
N,M = list(map(int,input().split()))
C = []
for _ in range(N):
A,B = list(map(int,input().split()))
C.append([A,B])
C = sorted(C,key=lambda x:x[0],reverse=True)
C = sorted(C,key=lambda x:x[1],reverse=True)
rev = 0
hist = list(range(0,M+1))
for x in C:
A,B = x[0],x[1]
ind = bise... | import heapq
from collections import deque
N,M = list(map(int,input().split()))
A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])
A = [(-A[i][1],A[i][0]) for i in range(N)]
A = deque(A)
heap = []
cnt = 0
for i in range(M-1,-1,-1):
k = M-i
while len(A)>0 and A[0][1]<=k:
... | 17 | 17 | 403 | 456 | import bisect
N, M = list(map(int, input().split()))
C = []
for _ in range(N):
A, B = list(map(int, input().split()))
C.append([A, B])
C = sorted(C, key=lambda x: x[0], reverse=True)
C = sorted(C, key=lambda x: x[1], reverse=True)
rev = 0
hist = list(range(0, M + 1))
for x in C:
A, B = x[0], x[1]
ind =... | import heapq
from collections import deque
N, M = list(map(int, input().split()))
A = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
A = [(-A[i][1], A[i][0]) for i in range(N)]
A = deque(A)
heap = []
cnt = 0
for i in range(M - 1, -1, -1):
k = M - i
while len(A) > 0 and A[0][1] ... | false | 0 | [
"-import bisect",
"+import heapq",
"+from collections import deque",
"-C = []",
"-for _ in range(N):",
"- A, B = list(map(int, input().split()))",
"- C.append([A, B])",
"-C = sorted(C, key=lambda x: x[0], reverse=True)",
"-C = sorted(C, key=lambda x: x[1], reverse=True)",
"-rev = 0",
"-his... | false | 0.032653 | 0.033752 | 0.967428 | [
"s655791834",
"s856217861"
] |
u814265211 | p02802 | python | s214759676 | s496124541 | 332 | 268 | 31,564 | 25,396 | Accepted | Accepted | 19.28 | n, m = list(map(int, input().split()))
d = {}
for i in range(m):
p, s = input().split()
d.setdefault(p, [])
d[p].append(s)
cnt = 0; correct = 0
for v in list(d.values()):
if "AC" not in v:
continue
correct += 1
cnt += v.index("AC")
print((correct, cnt)) | N, M = list(map(int, input().split()))
l = [[] for _ in range(N)]
for i in range(M):
p, s = input().split()
l[int(p) - 1].append(s)
correct = 0
penalty = 0
for ll in l:
if 'AC' not in ll:
continue
correct += 1
penalty += ll.index('AC')
print((correct, penalty)) | 15 | 16 | 288 | 299 | n, m = list(map(int, input().split()))
d = {}
for i in range(m):
p, s = input().split()
d.setdefault(p, [])
d[p].append(s)
cnt = 0
correct = 0
for v in list(d.values()):
if "AC" not in v:
continue
correct += 1
cnt += v.index("AC")
print((correct, cnt))
| N, M = list(map(int, input().split()))
l = [[] for _ in range(N)]
for i in range(M):
p, s = input().split()
l[int(p) - 1].append(s)
correct = 0
penalty = 0
for ll in l:
if "AC" not in ll:
continue
correct += 1
penalty += ll.index("AC")
print((correct, penalty))
| false | 6.25 | [
"-n, m = list(map(int, input().split()))",
"-d = {}",
"-for i in range(m):",
"+N, M = list(map(int, input().split()))",
"+l = [[] for _ in range(N)]",
"+for i in range(M):",
"- d.setdefault(p, [])",
"- d[p].append(s)",
"-cnt = 0",
"+ l[int(p) - 1].append(s)",
"-for v in list(d.values())... | false | 0.036315 | 0.067894 | 0.534888 | [
"s214759676",
"s496124541"
] |
u901582103 | p02675 | python | s551387417 | s609105417 | 55 | 21 | 61,608 | 9,164 | Accepted | Accepted | 61.82 | n=int(input()[-1])
if n==2 or n==4 or n==5 or n==7 or n==9:
print('hon')
elif n==0 or n==1 or n==6 or n==8:
print('pon')
else:
print('bon') | n=int(input()[-1])
if n in [2,4,5,7,9]:
print('hon')
elif n in [0,1,6,8]:
print('pon')
else:
print('bon') | 7 | 7 | 157 | 114 | n = int(input()[-1])
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
print("hon")
elif n == 0 or n == 1 or n == 6 or n == 8:
print("pon")
else:
print("bon")
| n = int(input()[-1])
if n in [2, 4, 5, 7, 9]:
print("hon")
elif n in [0, 1, 6, 8]:
print("pon")
else:
print("bon")
| false | 0 | [
"-if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:",
"+if n in [2, 4, 5, 7, 9]:",
"-elif n == 0 or n == 1 or n == 6 or n == 8:",
"+elif n in [0, 1, 6, 8]:"
] | false | 0.035471 | 0.071067 | 0.499124 | [
"s551387417",
"s609105417"
] |
u780475861 | p03425 | python | s031975675 | s249496725 | 189 | 41 | 3,064 | 10,864 | Accepted | Accepted | 78.31 | n = int(eval(input()))
lst = [0] * 5
march = ['M', 'A', 'R', 'C', 'H']
for i in range(n):
nf = input()[0]
if nf in march:
lst[march.index(nf)] += 1
ret = 0
for a in range(0, 3):
for b in range(a + 1, 4):
for c in range(b + 1, 5):
ret += lst[a] * lst[b] * lst[c]
print(ret) | import sys
from itertools import combinations as comb
n, *S = open(0).read().split()
s = [i[0] for i in S]
c = [s.count(i) for i in 'MARCH']
ret = sum(x * y * z for x, y, z in comb(c, 3))
print(ret) | 13 | 7 | 298 | 204 | n = int(eval(input()))
lst = [0] * 5
march = ["M", "A", "R", "C", "H"]
for i in range(n):
nf = input()[0]
if nf in march:
lst[march.index(nf)] += 1
ret = 0
for a in range(0, 3):
for b in range(a + 1, 4):
for c in range(b + 1, 5):
ret += lst[a] * lst[b] * lst[c]
print(ret)
| import sys
from itertools import combinations as comb
n, *S = open(0).read().split()
s = [i[0] for i in S]
c = [s.count(i) for i in "MARCH"]
ret = sum(x * y * z for x, y, z in comb(c, 3))
print(ret)
| false | 46.153846 | [
"-n = int(eval(input()))",
"-lst = [0] * 5",
"-march = [\"M\", \"A\", \"R\", \"C\", \"H\"]",
"-for i in range(n):",
"- nf = input()[0]",
"- if nf in march:",
"- lst[march.index(nf)] += 1",
"-ret = 0",
"-for a in range(0, 3):",
"- for b in range(a + 1, 4):",
"- for c in ran... | false | 0.057959 | 0.036231 | 1.599734 | [
"s031975675",
"s249496725"
] |
u130900604 | p02684 | python | s682841128 | s605646596 | 205 | 157 | 32,408 | 31,812 | Accepted | Accepted | 23.41 | n,k=list(map(int,input().split()))
a=[0]+list(map(int,input().split()))
MAX_N=2*10**5
b=[1]
visited=[-1]*(n+10)
for i in range(1,2*MAX_N+1):
nxt=a[b[-1]]
b.append(nxt)
if k<=n:
print((b[k]))
exit()
# print(b)
for i,bi in enumerate(b):
if visited[bi]==-1:
visited[b... | n,k,*a=list(map(int,open(0).read().split()))
now=1
if k<=n:
for i in range(k):
now=a[now-1]
print(now)
exit()
# 絶対ループする
visited=[False]*n
visited[now-1]=-1
for i in range(4*10**5):
now=a[now-1]
if visited[now-1]==False:
visited[now-1]=i
else:
c,d=visited[now-1],i
break
k... | 27 | 26 | 440 | 407 | n, k = list(map(int, input().split()))
a = [0] + list(map(int, input().split()))
MAX_N = 2 * 10**5
b = [1]
visited = [-1] * (n + 10)
for i in range(1, 2 * MAX_N + 1):
nxt = a[b[-1]]
b.append(nxt)
if k <= n:
print((b[k]))
exit()
# print(b)
for i, bi in enumerate(b):
if visited[bi] == -1:
visi... | n, k, *a = list(map(int, open(0).read().split()))
now = 1
if k <= n:
for i in range(k):
now = a[now - 1]
print(now)
exit()
# 絶対ループする
visited = [False] * n
visited[now - 1] = -1
for i in range(4 * 10**5):
now = a[now - 1]
if visited[now - 1] == False:
visited[now - 1] = i
else:
... | false | 3.703704 | [
"-n, k = list(map(int, input().split()))",
"-a = [0] + list(map(int, input().split()))",
"-MAX_N = 2 * 10**5",
"-b = [1]",
"-visited = [-1] * (n + 10)",
"-for i in range(1, 2 * MAX_N + 1):",
"- nxt = a[b[-1]]",
"- b.append(nxt)",
"+n, k, *a = list(map(int, open(0).read().split()))",
"+now = ... | false | 0.25036 | 0.037814 | 6.62075 | [
"s682841128",
"s605646596"
] |
u796942881 | p03329 | python | s225724575 | s821645366 | 189 | 18 | 3,060 | 3,060 | Accepted | Accepted | 90.48 | N = int(eval(input()))
def main():
ans = N
for i in range(N + 1):
num = 0
cur = i
while 0 < cur:
num += cur % 6
cur //= 6
cur = N - i
while 0 < cur:
num += cur % 9
cur //= 9
if num < ans:
... | def f(num, base):
# calc max Pth Power
ret = 1
while ret <= num:
ret *= base
return ret // base
def main():
N = int(eval(input()))
st = {N}
ans = 0
while (all(st)):
st = {x - f(x, 6) for x in st} | {x - f(x, 9) for x in st}
ans += 1
print(ans)... | 28 | 20 | 378 | 339 | N = int(eval(input()))
def main():
ans = N
for i in range(N + 1):
num = 0
cur = i
while 0 < cur:
num += cur % 6
cur //= 6
cur = N - i
while 0 < cur:
num += cur % 9
cur //= 9
if num < ans:
ans = num
... | def f(num, base):
# calc max Pth Power
ret = 1
while ret <= num:
ret *= base
return ret // base
def main():
N = int(eval(input()))
st = {N}
ans = 0
while all(st):
st = {x - f(x, 6) for x in st} | {x - f(x, 9) for x in st}
ans += 1
print(ans)
return
mai... | false | 28.571429 | [
"-N = int(eval(input()))",
"+def f(num, base):",
"+ # calc max Pth Power",
"+ ret = 1",
"+ while ret <= num:",
"+ ret *= base",
"+ return ret // base",
"- ans = N",
"- for i in range(N + 1):",
"- num = 0",
"- cur = i",
"- while 0 < cur:",
"- ... | false | 0.04889 | 0.036984 | 1.321904 | [
"s225724575",
"s821645366"
] |
u075012704 | p03380 | python | s221008609 | s999173848 | 114 | 70 | 14,060 | 14,428 | Accepted | Accepted | 38.6 | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
ans_n = A.pop()
target = ans_n / 2
ans_r = - 1
high_score = 0
for r in A:
min_r = min(ans_n - r, r)
if min_r >= high_score:
high_score = r
ans_r = r
print((ans_n, ans_r))
| N = int(eval(input()))
A = list(map(int, input().split()))
n, r = max(A), None
A.pop(A.index(n))
target, best_score = n / 2, float('inf')
for a in A:
score = abs(a - target)
if score < best_score:
best_score = score
r = a
print((n, r))
| 15 | 13 | 271 | 266 | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
ans_n = A.pop()
target = ans_n / 2
ans_r = -1
high_score = 0
for r in A:
min_r = min(ans_n - r, r)
if min_r >= high_score:
high_score = r
ans_r = r
print((ans_n, ans_r))
| N = int(eval(input()))
A = list(map(int, input().split()))
n, r = max(A), None
A.pop(A.index(n))
target, best_score = n / 2, float("inf")
for a in A:
score = abs(a - target)
if score < best_score:
best_score = score
r = a
print((n, r))
| false | 13.333333 | [
"-A = sorted(list(map(int, input().split())))",
"-ans_n = A.pop()",
"-target = ans_n / 2",
"-ans_r = -1",
"-high_score = 0",
"-for r in A:",
"- min_r = min(ans_n - r, r)",
"- if min_r >= high_score:",
"- high_score = r",
"- ans_r = r",
"-print((ans_n, ans_r))",
"+A = list(m... | false | 0.037855 | 0.045125 | 0.8389 | [
"s221008609",
"s999173848"
] |
u028973125 | p02936 | python | s745699856 | s190898018 | 1,996 | 789 | 120,012 | 121,416 | Accepted | Accepted | 60.47 | from pprint import pprint
from collections import deque, defaultdict
n, q = list(map(int, input().strip().split(" ")))
# edges = defaultdict(set)
edges = [[] for _ in range(n)]
for _ in range(n-1):
a_i, b_i = list(map(int, input().strip().split(" ")))
edges[a_i-1].append(b_i-1)
edges[b_i-1].append... | from pprint import pprint
from collections import deque
import sys
n, q = list(map(int, sys.stdin.readline().strip().split(" ")))
edges = [[] for _ in range(n)]
for _ in range(n-1):
a_i, b_i = list(map(int, sys.stdin.readline().strip().split(" ")))
edges[a_i-1].append(b_i-1)
edges[b_i-1].append(... | 51 | 34 | 1,374 | 841 | from pprint import pprint
from collections import deque, defaultdict
n, q = list(map(int, input().strip().split(" ")))
# edges = defaultdict(set)
edges = [[] for _ in range(n)]
for _ in range(n - 1):
a_i, b_i = list(map(int, input().strip().split(" ")))
edges[a_i - 1].append(b_i - 1)
edges[b_i - 1].append(... | from pprint import pprint
from collections import deque
import sys
n, q = list(map(int, sys.stdin.readline().strip().split(" ")))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
a_i, b_i = list(map(int, sys.stdin.readline().strip().split(" ")))
edges[a_i - 1].append(b_i - 1)
edges[b_i - 1].append(a_i... | false | 33.333333 | [
"-from collections import deque, defaultdict",
"+from collections import deque",
"+import sys",
"-n, q = list(map(int, input().strip().split(\" \")))",
"-# edges = defaultdict(set)",
"+n, q = list(map(int, sys.stdin.readline().strip().split(\" \")))",
"- a_i, b_i = list(map(int, input().strip().split... | false | 0.054764 | 0.054137 | 1.011573 | [
"s745699856",
"s190898018"
] |
u410118019 | p02996 | python | s706556327 | s931590344 | 709 | 449 | 53,752 | 31,872 | Accepted | Accepted | 36.67 | import sys
from operator import itemgetter
input = sys.stdin.readline
n = int(eval(input()))
l = [list(map(int,input().split())) for _ in range(n)]
l.sort(key=itemgetter(1))
a = 0
flag = 0
for _ in range(n):
a += l[_][0]
if a > l[_][1]:
print('No')
flag = 1
break
if flag == 0:
print('Ye... | import sys
from operator import itemgetter
input = sys.stdin.readline
n = int(eval(input()))
l = [tuple(map(int,input().split())) for _ in range(n)]
l.sort(key=itemgetter(1))
a = 0
flag = 0
for _ in range(n):
a += l[_][0]
if a > l[_][1]:
print('No')
flag = 1
break
if flag == 0:
print('Y... | 16 | 16 | 317 | 318 | import sys
from operator import itemgetter
input = sys.stdin.readline
n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key=itemgetter(1))
a = 0
flag = 0
for _ in range(n):
a += l[_][0]
if a > l[_][1]:
print("No")
flag = 1
break
if flag == 0:
prin... | import sys
from operator import itemgetter
input = sys.stdin.readline
n = int(eval(input()))
l = [tuple(map(int, input().split())) for _ in range(n)]
l.sort(key=itemgetter(1))
a = 0
flag = 0
for _ in range(n):
a += l[_][0]
if a > l[_][1]:
print("No")
flag = 1
break
if flag == 0:
pri... | false | 0 | [
"-l = [list(map(int, input().split())) for _ in range(n)]",
"+l = [tuple(map(int, input().split())) for _ in range(n)]"
] | false | 0.045761 | 0.046148 | 0.991624 | [
"s706556327",
"s931590344"
] |
u724687935 | p02833 | python | s955968857 | s324458863 | 165 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.7 | N = int(eval(input()))
ans = 0
if N % 2 == 0:
mod = 10
while N >= mod:
ans += N // mod
mod *= 5
print(ans)
| # def f(n):
# if n < 2:
# return 1
# else:
# return n * f(n - 2)
# for i in range(2, 150, 2):
# print(i, f(i))
N = int(eval(input()))
if N % 2 == 1:
print((0))
exit()
k = 10
cnt = 0
while k <= N:
cnt += N // k
k *= 5
print(cnt)
| 11 | 22 | 138 | 290 | N = int(eval(input()))
ans = 0
if N % 2 == 0:
mod = 10
while N >= mod:
ans += N // mod
mod *= 5
print(ans)
| # def f(n):
# if n < 2:
# return 1
# else:
# return n * f(n - 2)
# for i in range(2, 150, 2):
# print(i, f(i))
N = int(eval(input()))
if N % 2 == 1:
print((0))
exit()
k = 10
cnt = 0
while k <= N:
cnt += N // k
k *= 5
print(cnt)
| false | 50 | [
"+# def f(n):",
"+# if n < 2:",
"+# return 1",
"+# else:",
"+# return n * f(n - 2)",
"+# for i in range(2, 150, 2):",
"+# print(i, f(i))",
"-ans = 0",
"-if N % 2 == 0:",
"- mod = 10",
"- while N >= mod:",
"- ans += N // mod",
"- mod *= 5",
"-... | false | 0.036196 | 0.035647 | 1.015394 | [
"s955968857",
"s324458863"
] |
u809819902 | p02945 | python | s576411045 | s944696940 | 29 | 26 | 9,156 | 9,152 | Accepted | Accepted | 10.34 | a,b = list(map(int, input().split()))
li = [a+b, a-b,a*b]
print((max(li)))
| a,b=list(map(int,input().split()))
print((max(a+b,a-b,a*b))) | 3 | 2 | 69 | 53 | a, b = list(map(int, input().split()))
li = [a + b, a - b, a * b]
print((max(li)))
| a, b = list(map(int, input().split()))
print((max(a + b, a - b, a * b)))
| false | 33.333333 | [
"-li = [a + b, a - b, a * b]",
"-print((max(li)))",
"+print((max(a + b, a - b, a * b)))"
] | false | 0.047642 | 0.049309 | 0.966199 | [
"s576411045",
"s944696940"
] |
u729133443 | p03128 | python | s909498068 | s432097091 | 207 | 138 | 15,524 | 14,388 | Accepted | Accepted | 33.33 | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*n*9
for i in range(n):
for j in a:c=i+(0,2,5,5,4,5,6,3,7,6)[j];d[c]=max(d[c],(d[i]*10+j)*(i<1or d[i]>0))
print((d[n])) | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*n+[-1]*9
for i in range(n):d[i+1]=max(j+d[i-int('0144345265'[j])]*10for j in a)
print((d[n])) | 5 | 4 | 166 | 139 | n, m, *a = list(map(int, open(0).read().split()))
d = [0] * n * 9
for i in range(n):
for j in a:
c = i + (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)[j]
d[c] = max(d[c], (d[i] * 10 + j) * (i < 1 or d[i] > 0))
print((d[n]))
| n, m, *a = list(map(int, open(0).read().split()))
d = [0] * n + [-1] * 9
for i in range(n):
d[i + 1] = max(j + d[i - int("0144345265"[j])] * 10 for j in a)
print((d[n]))
| false | 20 | [
"-d = [0] * n * 9",
"+d = [0] * n + [-1] * 9",
"- for j in a:",
"- c = i + (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)[j]",
"- d[c] = max(d[c], (d[i] * 10 + j) * (i < 1 or d[i] > 0))",
"+ d[i + 1] = max(j + d[i - int(\"0144345265\"[j])] * 10 for j in a)"
] | false | 0.037228 | 0.037458 | 0.993858 | [
"s909498068",
"s432097091"
] |
u998741086 | p03861 | python | s388850428 | s734589066 | 31 | 27 | 9,124 | 9,060 | Accepted | Accepted | 12.9 | #!/usr/bin/env python
a, b, x = list(map(int, input().split()))
if a == b:
if a%x == 0:
print((1))
else:
print((0))
exit()
if a%x == 0 and b%x == 0:
ans = b//x - a//x + 1
print(ans)
exit()
if a%x != 0 and b%x != 0:
ans = b//x - a//x
print(ans)
exit... | #!/usr/bin/env python
a, b, x = list(map(int, input().split()))
def f(n):
global x
if n == -1:
return 0
return n//x + 1
ans = f(b)-f(a-1)
print(ans)
| 24 | 12 | 428 | 179 | #!/usr/bin/env python
a, b, x = list(map(int, input().split()))
if a == b:
if a % x == 0:
print((1))
else:
print((0))
exit()
if a % x == 0 and b % x == 0:
ans = b // x - a // x + 1
print(ans)
exit()
if a % x != 0 and b % x != 0:
ans = b // x - a // x
print(ans)
exit()... | #!/usr/bin/env python
a, b, x = list(map(int, input().split()))
def f(n):
global x
if n == -1:
return 0
return n // x + 1
ans = f(b) - f(a - 1)
print(ans)
| false | 50 | [
"-if a == b:",
"- if a % x == 0:",
"- print((1))",
"- else:",
"- print((0))",
"- exit()",
"-if a % x == 0 and b % x == 0:",
"- ans = b // x - a // x + 1",
"- print(ans)",
"- exit()",
"-if a % x != 0 and b % x != 0:",
"- ans = b // x - a // x",
"- print(a... | false | 0.042802 | 0.007632 | 5.608521 | [
"s388850428",
"s734589066"
] |
u724687935 | p03855 | python | s958195296 | s723330847 | 1,583 | 933 | 47,328 | 57,480 | Accepted | Accepted | 41.06 | from collections import Counter
class WeightedUnionFind():
def __init__(self, n):
self.parents = [-1] * n
self.weight = [0] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.weight[x] += self.weight[self.parents[x]]
... | class UnionFind():
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.fi... | 63 | 64 | 1,674 | 1,474 | from collections import Counter
class WeightedUnionFind:
def __init__(self, n):
self.parents = [-1] * n
self.weight = [0] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.weight[x] += self.weight[self.parents[x]]
self.paren... | class UnionFind:
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
... | false | 1.5625 | [
"-from collections import Counter",
"-",
"-",
"-class WeightedUnionFind:",
"+class UnionFind:",
"- self.weight = [0] * n",
"- self.weight[x] += self.weight[self.parents[x]]",
"- def union(self, x, y, w):",
"- rx = self.find(x)",
"- ry = self.find(y)",
"- ... | false | 0.007683 | 0.0315 | 0.243912 | [
"s958195296",
"s723330847"
] |
u102461423 | p04000 | python | s626316867 | s544135143 | 1,781 | 1,533 | 166,856 | 166,892 | Accepted | Accepted | 13.92 | from collections import Counter
import sys
import itertools
input = sys.stdin.readline
c = Counter()
H,W,N = list(map(int,input().split()))
for _ in range(N):
a,b = list(map(int,input().split()))
# そのセルを含む正方形の中心を記録
for dx,dy in itertools.product([-1,0,1],repeat = 2):
aa = a + dx
bb = b + dy
... | from collections import defaultdict, Counter
import sys
import itertools
input = sys.stdin.readline
c = defaultdict(int)
H,W,N = list(map(int,input().split()))
for _ in range(N):
a,b = list(map(int,input().split()))
# そのセルを含む正方形の中心を記録
for dx,dy in itertools.product([-1,0,1],repeat = 2):
aa = a + d... | 21 | 21 | 494 | 515 | from collections import Counter
import sys
import itertools
input = sys.stdin.readline
c = Counter()
H, W, N = list(map(int, input().split()))
for _ in range(N):
a, b = list(map(int, input().split()))
# そのセルを含む正方形の中心を記録
for dx, dy in itertools.product([-1, 0, 1], repeat=2):
aa = a + dx
bb =... | from collections import defaultdict, Counter
import sys
import itertools
input = sys.stdin.readline
c = defaultdict(int)
H, W, N = list(map(int, input().split()))
for _ in range(N):
a, b = list(map(int, input().split()))
# そのセルを含む正方形の中心を記録
for dx, dy in itertools.product([-1, 0, 1], repeat=2):
aa =... | false | 0 | [
"-from collections import Counter",
"+from collections import defaultdict, Counter",
"-c = Counter()",
"+c = defaultdict(int)"
] | false | 0.042609 | 0.043114 | 0.988287 | [
"s626316867",
"s544135143"
] |
u342869120 | p02625 | python | s490249574 | s028248376 | 189 | 89 | 89,772 | 102,856 | Accepted | Accepted | 52.91 |
class Combination:
def __init__(self, n, mod):
fact = [0]*(n+1)
ifact = [0]*(n+1)
fact[0] = 1
for i in range(1, n+1):
fact[i] = (fact[i-1]*i) % mod
# 1/n!を逆元で求める
ifact[n] = pow(fact[n], mod-2, mod)
for i in range(n, 0, -1):
... | '''
完全順列(derangement)
モンモール数(Montmort number)
'''
MOD = 10**9+7
N, M = list(map(int, input().split()))
# 片方の順列の総数を求める
ans = 1
for i in range(N):
ans *= M-i
ans %= MOD
# M枚からN枚選ぶ完全順列を計算
d = [1, M-N]
for i in range(2, N+1):
# 1がk番目にある
# 1番目にkがある
t = (i-1)*d[-2] % MOD
# 1番目にk... | 38 | 25 | 965 | 393 | class Combination:
def __init__(self, n, mod):
fact = [0] * (n + 1)
ifact = [0] * (n + 1)
fact[0] = 1
for i in range(1, n + 1):
fact[i] = (fact[i - 1] * i) % mod
# 1/n!を逆元で求める
ifact[n] = pow(fact[n], mod - 2, mod)
for i in range(n, 0, -1):
... | """
完全順列(derangement)
モンモール数(Montmort number)
"""
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
# 片方の順列の総数を求める
ans = 1
for i in range(N):
ans *= M - i
ans %= MOD
# M枚からN枚選ぶ完全順列を計算
d = [1, M - N]
for i in range(2, N + 1):
# 1がk番目にある
# 1番目にkがある
t = (i - 1) * d[-2] % MOD
# 1番目にkがない
t +... | false | 34.210526 | [
"-class Combination:",
"- def __init__(self, n, mod):",
"- fact = [0] * (n + 1)",
"- ifact = [0] * (n + 1)",
"- fact[0] = 1",
"- for i in range(1, n + 1):",
"- fact[i] = (fact[i - 1] * i) % mod",
"- # 1/n!を逆元で求める",
"- ifact[n] = pow(fact[n], mo... | false | 0.152375 | 0.103423 | 1.473322 | [
"s490249574",
"s028248376"
] |
u583014768 | p03073 | python | s724389986 | s748860157 | 30 | 22 | 4,268 | 4,268 | Accepted | Accepted | 26.67 | S = list(eval(input()))
c = 0
if S[0] == '0':
for i in S[::2]:
if i == '1':
c += 1
for j in S[1::2]:
if j == '0':
c += 1
d = 0
if S[0] == '1':
for i in S[::2]:
if i == '0':
d += 1
for j in S[1::2]:
if j == '1'... | S = list(eval(input()))
s = S[::2].count('1') + S[1::2].count('0')
u = S[::2].count('0') + S[1::2].count('1')
print((min(s, u))) | 21 | 6 | 366 | 127 | S = list(eval(input()))
c = 0
if S[0] == "0":
for i in S[::2]:
if i == "1":
c += 1
for j in S[1::2]:
if j == "0":
c += 1
d = 0
if S[0] == "1":
for i in S[::2]:
if i == "0":
d += 1
for j in S[1::2]:
if j == "1":
d += 1
print(... | S = list(eval(input()))
s = S[::2].count("1") + S[1::2].count("0")
u = S[::2].count("0") + S[1::2].count("1")
print((min(s, u)))
| false | 71.428571 | [
"-c = 0",
"-if S[0] == \"0\":",
"- for i in S[::2]:",
"- if i == \"1\":",
"- c += 1",
"- for j in S[1::2]:",
"- if j == \"0\":",
"- c += 1",
"-d = 0",
"-if S[0] == \"1\":",
"- for i in S[::2]:",
"- if i == \"0\":",
"- d += 1",
... | false | 0.098621 | 0.036381 | 2.710797 | [
"s724389986",
"s748860157"
] |
u077291787 | p03781 | python | s046029329 | s703515127 | 32 | 17 | 2,940 | 2,940 | Accepted | Accepted | 46.88 | # ARC070C - Go Home (ABC056C)
x = int(eval(input()))
for i in range(1, x + 1):
if i * (i + 1) * 0.5 >= x:
print(i)
break | from math import ceil
x = int(eval(input()))
print((ceil((-1 + (8 * x + 1) ** 0.5) * 0.5))) | 6 | 3 | 139 | 85 | # ARC070C - Go Home (ABC056C)
x = int(eval(input()))
for i in range(1, x + 1):
if i * (i + 1) * 0.5 >= x:
print(i)
break
| from math import ceil
x = int(eval(input()))
print((ceil((-1 + (8 * x + 1) ** 0.5) * 0.5)))
| false | 50 | [
"-# ARC070C - Go Home (ABC056C)",
"+from math import ceil",
"+",
"-for i in range(1, x + 1):",
"- if i * (i + 1) * 0.5 >= x:",
"- print(i)",
"- break",
"+print((ceil((-1 + (8 * x + 1) ** 0.5) * 0.5)))"
] | false | 0.036461 | 0.081656 | 0.44652 | [
"s046029329",
"s703515127"
] |
u708211626 | p04012 | python | s246688975 | s477588195 | 26 | 21 | 9,000 | 9,080 | Accepted | Accepted | 19.23 | w = list(eval(input()))
s = set(w)
for i in s:
if w.count(i)%2 != 0:
print("No")
break
else:
print("Yes")
| a=eval(input());b=set(a)
for i in b:
if a.count(i) % 2 != 0:
print('No')
exit()
print('Yes')
| 9 | 9 | 122 | 113 | w = list(eval(input()))
s = set(w)
for i in s:
if w.count(i) % 2 != 0:
print("No")
break
else:
print("Yes")
| a = eval(input())
b = set(a)
for i in b:
if a.count(i) % 2 != 0:
print("No")
exit()
print("Yes")
| false | 0 | [
"-w = list(eval(input()))",
"-s = set(w)",
"-for i in s:",
"- if w.count(i) % 2 != 0:",
"+a = eval(input())",
"+b = set(a)",
"+for i in b:",
"+ if a.count(i) % 2 != 0:",
"- break",
"-else:",
"- print(\"Yes\")",
"+ exit()",
"+print(\"Yes\")"
] | false | 0.066489 | 0.037377 | 1.778881 | [
"s246688975",
"s477588195"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.