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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u608088992 | p03420 | python | s401444470 | s597388906 | 79 | 61 | 3,060 | 3,316 | Accepted | Accepted | 22.78 | N, K = list(map(int, input().split()))
Ans = 0
if K == 0:
print((N**2))
else:
def Mods(i, N, K): #iで割った余りがK以上のN以下の数
lim = N//i
pattern = i - K
total = lim * pattern
if N - i * lim < K:
return total
else:
extra = N - i * lim - K + 1
... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
Ans = 0
if K == 0: print((N ** 2))
else:
for b in range(K + 1, N + 1):
Ans += (b - K) * (N // b)
mod = N % b
if mod >= K an... | 19 | 20 | 422 | 430 | N, K = list(map(int, input().split()))
Ans = 0
if K == 0:
print((N**2))
else:
def Mods(i, N, K): # iで割った余りがK以上のN以下の数
lim = N // i
pattern = i - K
total = lim * pattern
if N - i * lim < K:
return total
else:
extra = N - i * lim - K + 1
... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
Ans = 0
if K == 0:
print((N**2))
else:
for b in range(K + 1, N + 1):
Ans += (b - K) * (N // b)
mod = N % b
if mod >= K and mod... | false | 5 | [
"-N, K = list(map(int, input().split()))",
"-Ans = 0",
"-if K == 0:",
"- print((N**2))",
"-else:",
"+import sys",
"+from collections import deque",
"- def Mods(i, N, K): # iで割った余りがK以上のN以下の数",
"- lim = N // i",
"- pattern = i - K",
"- total = lim * pattern",
"- ... | false | 0.04504 | 0.038931 | 1.156909 | [
"s401444470",
"s597388906"
] |
u886747123 | p03048 | python | s489457479 | s015970542 | 1,748 | 1,436 | 3,060 | 2,940 | Accepted | Accepted | 17.85 | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N//R + 1):
for g in range((N - r*R)//G + 1):
tmp = N-r*R-g*G
if tmp%B == 0:
ans += 1
print(ans) | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N//R + 1):
for g in range((N - r*R)//G + 1):
if (N-r*R-g*G)%B == 0:
ans += 1
print(ans) | 9 | 8 | 198 | 181 | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range((N - r * R) // G + 1):
tmp = N - r * R - g * G
if tmp % B == 0:
ans += 1
print(ans)
| R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range((N - r * R) // G + 1):
if (N - r * R - g * G) % B == 0:
ans += 1
print(ans)
| false | 11.111111 | [
"- tmp = N - r * R - g * G",
"- if tmp % B == 0:",
"+ if (N - r * R - g * G) % B == 0:"
] | false | 0.087793 | 0.082664 | 1.062052 | [
"s489457479",
"s015970542"
] |
u408260374 | p02240 | python | s904117829 | s926461711 | 680 | 590 | 12,572 | 26,600 | Accepted | Accepted | 13.24 | import sys
sys.setrecursionlimit(10**6)
class UnionFindTree:
"""Disjoint-Set Data Structure
Union-Find Tree
complexity:
init: O(n)
find, unite, same: O(alpha(n))
used in SRM505 div.2 900, ATC001 A, DSL1A(AOJ)
"""
def __init__(self, n):
self.par... | V, E = list(map(int, input().split()))
edge = [[] for _ in range(V)]
for _ in range(E):
s, t = list(map(int, input().split()))
edge[s].append(t)
edge[t].append(s)
group = [-1] * V
cnt = 0
for i in range(V):
if group[i] == -1:
group[i] = cnt
stack = [i]
while stack:
... | 43 | 23 | 1,169 | 615 | import sys
sys.setrecursionlimit(10**6)
class UnionFindTree:
"""Disjoint-Set Data Structure
Union-Find Tree
complexity:
init: O(n)
find, unite, same: O(alpha(n))
used in SRM505 div.2 900, ATC001 A, DSL1A(AOJ)
"""
def __init__(self, n):
self.par = list(range(n)) # paren... | V, E = list(map(int, input().split()))
edge = [[] for _ in range(V)]
for _ in range(E):
s, t = list(map(int, input().split()))
edge[s].append(t)
edge[t].append(s)
group = [-1] * V
cnt = 0
for i in range(V):
if group[i] == -1:
group[i] = cnt
stack = [i]
while stack:
v ... | false | 46.511628 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-class UnionFindTree:",
"- \"\"\"Disjoint-Set Data Structure",
"- Union-Find Tree",
"- complexity:",
"- init: O(n)",
"- find, unite, same: O(alpha(n))",
"- used in SRM505 div.2 900, ATC001 A, DSL1A(AOJ)",
... | false | 0.07057 | 0.037975 | 1.858337 | [
"s904117829",
"s926461711"
] |
u600402037 | p02850 | python | s376749896 | s455197997 | 841 | 583 | 51,400 | 39,792 | Accepted | Accepted | 30.68 | import sys
from collections import defaultdict
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
AB = [lr() for _ in range(N-1)]
graph = [[] for _ in range(N+1)] # 1-indexed
for i in range(N-1):
a, b = AB[i]
AB[i] = tuple(sorted([a... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
graph = [[] for _ in range(N+1)]
AB = [lr() for _ in range(N-1)]
for a, b in AB:
graph[a].append(b)
graph[b].append(a)
root = 1
parent = [0] * (N+1)
order = []
stack... | 45 | 43 | 1,081 | 850 | import sys
from collections import defaultdict
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
AB = [lr() for _ in range(N - 1)]
graph = [[] for _ in range(N + 1)] # 1-indexed
for i in range(N - 1):
a, b = AB[i]
AB[i] = tuple(sorted([a, b]))... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
graph = [[] for _ in range(N + 1)]
AB = [lr() for _ in range(N - 1)]
for a, b in AB:
graph[a].append(b)
graph[b].append(a)
root = 1
parent = [0] * (N + 1)
order = []
stack = [(root, 0... | false | 4.444444 | [
"-from collections import defaultdict",
"+graph = [[] for _ in range(N + 1)]",
"-graph = [[] for _ in range(N + 1)] # 1-indexed",
"-for i in range(N - 1):",
"- a, b = AB[i]",
"- AB[i] = tuple(sorted([a, b]))",
"+for a, b in AB:",
"-AB_to_C = defaultdict(int)",
"-stack = [root]",
"+order = [... | false | 0.035159 | 0.034415 | 1.021612 | [
"s376749896",
"s455197997"
] |
u968166680 | p03565 | python | s599028444 | s834655782 | 66 | 26 | 62,120 | 9,104 | Accepted | Accepted | 60.61 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
ans = []
for i in range(N - M + 1):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
ans = []
for i in range(N - M + 1):
... | 40 | 39 | 764 | 746 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
ans = []
for i in range(N - M + 1):
ok = True
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
ans = []
for i in range(N - M + 1):
ok = True
... | false | 2.5 | [
"- ans.sort()",
"- print((ans[0]))",
"+ print((min(ans)))"
] | false | 0.007166 | 0.040017 | 0.179069 | [
"s599028444",
"s834655782"
] |
u745087332 | p03363 | python | s456672383 | s561947177 | 232 | 213 | 25,716 | 41,696 | Accepted | Accepted | 8.19 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
S = [0]
for i in range(N):
S.append(S[-1] + A[i])
S.sort()
cnt = 1
prev = None
ans = 0
for s in S:
if prev == s:
... | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
S = [0]
for i in range(N):
S.append(S[-1] + A[i])
cnt_num = Counter(S)
ans = 0
for num in list(c... | 36 | 29 | 487 | 430 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
S = [0]
for i in range(N):
S.append(S[-1] + A[i])
S.sort()
cnt = 1
prev = None
ans = 0
for s in S:
if prev == s:
prev = s
cnt += 1... | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
S = [0]
for i in range(N):
S.append(S[-1] + A[i])
cnt_num = Counter(S)
ans = 0
for num in list(cnt_num.keys()):
cn... | false | 19.444444 | [
"+from collections import Counter",
"-S.sort()",
"-cnt = 1",
"-prev = None",
"+cnt_num = Counter(S)",
"-for s in S:",
"- if prev == s:",
"- prev = s",
"- cnt += 1",
"- else:",
"- prev = s",
"- ans += cnt * (cnt - 1) // 2",
"- cnt = 1",
"-if cnt != 1... | false | 0.035018 | 0.0363 | 0.964686 | [
"s456672383",
"s561947177"
] |
u197615397 | p02362 | python | s893929554 | s380372852 | 660 | 330 | 7,976 | 8,080 | Accepted | Accepted | 50 | import sys
readline = sys.stdin.readline
V, E, r = list(map(int, readline().split()))
inf = 10**10
edges = [[] for _ in [None]*V]
for _ in [None]*E:
s, t, d = list(map(int, readline().split()))
edges[s].append((t, d))
vertices = [inf] * V
vertices[r] = 0
for i in range(V):
flag = 0
f... | import sys
readline = sys.stdin.readline
V, E, r = list(map(int, readline().split()))
inf = 10**10
edges = [[] for _ in [None]*V]
for _ in [None]*E:
s, t, d = list(map(int, readline().split()))
edges[s].append((t, d))
def bellman_ford(n, edges, start):
vertices = [inf] * n
vertices[sta... | 31 | 37 | 727 | 930 | import sys
readline = sys.stdin.readline
V, E, r = list(map(int, readline().split()))
inf = 10**10
edges = [[] for _ in [None] * V]
for _ in [None] * E:
s, t, d = list(map(int, readline().split()))
edges[s].append((t, d))
vertices = [inf] * V
vertices[r] = 0
for i in range(V):
flag = 0
for v in range(V... | import sys
readline = sys.stdin.readline
V, E, r = list(map(int, readline().split()))
inf = 10**10
edges = [[] for _ in [None] * V]
for _ in [None] * E:
s, t, d = list(map(int, readline().split()))
edges[s].append((t, d))
def bellman_ford(n, edges, start):
vertices = [inf] * n
vertices[start] = 0
... | false | 16.216216 | [
"-vertices = [inf] * V",
"-vertices[r] = 0",
"-for i in range(V):",
"- flag = 0",
"- for v in range(V):",
"- cost = vertices[v]",
"- if cost == inf:",
"- continue",
"- for dist, _cost in edges[v]:",
"- newcost = cost + _cost",
"- if ver... | false | 0.152398 | 0.046893 | 3.249897 | [
"s893929554",
"s380372852"
] |
u668503853 | p03363 | python | s405771190 | s503239544 | 312 | 255 | 39,296 | 41,920 | Accepted | Accepted | 18.27 | import collections
N=int(eval(input()))
A=list(map(int,input().split()))
b=ans=0
c=collections.Counter([0])
for a in A:
b+=a
ans+=c[b]
c[b]+=1
print(ans) | from collections import Counter
N=int(eval(input()))
A=list(map(int,input().split()))
S=[0]*N
for i in range(N):
S[i]=S[i-1]+A[i]
S=[0]+S
S=Counter(S)
a=[S[s]*(S[s]-1)//2 for s in S]
print((sum(a))) | 10 | 10 | 162 | 201 | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
b = ans = 0
c = collections.Counter([0])
for a in A:
b += a
ans += c[b]
c[b] += 1
print(ans)
| from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
S = [0] * N
for i in range(N):
S[i] = S[i - 1] + A[i]
S = [0] + S
S = Counter(S)
a = [S[s] * (S[s] - 1) // 2 for s in S]
print((sum(a)))
| false | 0 | [
"-import collections",
"+from collections import Counter",
"-b = ans = 0",
"-c = collections.Counter([0])",
"-for a in A:",
"- b += a",
"- ans += c[b]",
"- c[b] += 1",
"-print(ans)",
"+S = [0] * N",
"+for i in range(N):",
"+ S[i] = S[i - 1] + A[i]",
"+S = [0] + S",
"+S = Counte... | false | 0.154093 | 0.037556 | 4.103019 | [
"s405771190",
"s503239544"
] |
u948524308 | p02713 | python | s729902923 | s397496497 | 1,153 | 349 | 9,180 | 76,624 | Accepted | Accepted | 69.73 | K=int(eval(input()))
from math import gcd
ans=0
for a in range(1,K+1):
for b in range(1,K+1):
g = gcd(a, b)
for c in range(1,K+1):
ans+=gcd(g,c)
print(ans)
| K=int(eval(input()))
def gcd(x,y):
if x<y:
temp=x
x=y
y=temp
if x%y==0:
return y
else:
nx=y
ny=x%y
return gcd(nx,ny)
ans=0
for a in range(1,K+1):
for b in range(1,K+1):
g=gcd(a,b)
for c in range(1,K+1):
... | 13 | 21 | 209 | 343 | K = int(eval(input()))
from math import gcd
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
g = gcd(a, b)
for c in range(1, K + 1):
ans += gcd(g, c)
print(ans)
| K = int(eval(input()))
def gcd(x, y):
if x < y:
temp = x
x = y
y = temp
if x % y == 0:
return y
else:
nx = y
ny = x % y
return gcd(nx, ny)
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
g = gcd(a, b)
for c in range(... | false | 38.095238 | [
"-from math import gcd",
"+",
"+",
"+def gcd(x, y):",
"+ if x < y:",
"+ temp = x",
"+ x = y",
"+ y = temp",
"+ if x % y == 0:",
"+ return y",
"+ else:",
"+ nx = y",
"+ ny = x % y",
"+ return gcd(nx, ny)",
"+"
] | false | 0.052403 | 0.209862 | 0.249702 | [
"s729902923",
"s397496497"
] |
u803617136 | p03031 | python | s098412958 | s196923605 | 189 | 43 | 40,176 | 3,188 | Accepted | Accepted | 77.25 | N, M = list(map(int, input().split()))
k = [input().split() for _ in range(M)]
p = list(map(int, input().split()))
ans = 0
for n in range(2 ** N):
is_mismatch = False
for i in range(M):
cnt = 0
for si in k[i][1:]:
if (n >> (int(si) - 1)) & 1:
cnt = (cnt + 1)... | n, m = list(map(int, input().split()))
swtiches = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2 ** n):
is_on = True
for j in range(m):
k = swtiches[j][0]
s = swtiches[j][1:]
cnt = 0
for si in s:
... | 19 | 20 | 461 | 471 | N, M = list(map(int, input().split()))
k = [input().split() for _ in range(M)]
p = list(map(int, input().split()))
ans = 0
for n in range(2**N):
is_mismatch = False
for i in range(M):
cnt = 0
for si in k[i][1:]:
if (n >> (int(si) - 1)) & 1:
cnt = (cnt + 1) % 2
... | n, m = list(map(int, input().split()))
swtiches = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
is_on = True
for j in range(m):
k = swtiches[j][0]
s = swtiches[j][1:]
cnt = 0
for si in s:
if i >> ... | false | 5 | [
"-N, M = list(map(int, input().split()))",
"-k = [input().split() for _ in range(M)]",
"+n, m = list(map(int, input().split()))",
"+swtiches = [list(map(int, input().split())) for _ in range(m)]",
"-for n in range(2**N):",
"- is_mismatch = False",
"- for i in range(M):",
"+for i in range(2**n):"... | false | 0.046539 | 0.044036 | 1.056827 | [
"s098412958",
"s196923605"
] |
u994988729 | p03435 | python | s351467204 | s299306530 | 151 | 17 | 12,508 | 3,064 | Accepted | Accepted | 88.74 | import numpy as np
c=np.array([[int(i) for i in input().split()] for _ in range(3)])
b123=c[0]
a123=np.array([
0,
c[1][1]-b123[1],
c[2][2]-b123[2],
])
isOk=True
for i in range(3):
for j in range(3):
if c[i][j]!=a123[i]+b123[j]:
isOk=False
ans="Yes" if isOk else "No... | C = [list(map(int, input().split())) for _ in range(3)]
x = C[0][0]
a = [c[0] - x for c in C]
b = [C[0][i]-a[0] for i in range(3)]
ans = "Yes"
for i in range(3):
for j in range(3):
if C[i][j] != a[i] + b[j]:
ans = "No"
print(ans)
| 18 | 13 | 334 | 269 | import numpy as np
c = np.array([[int(i) for i in input().split()] for _ in range(3)])
b123 = c[0]
a123 = np.array(
[
0,
c[1][1] - b123[1],
c[2][2] - b123[2],
]
)
isOk = True
for i in range(3):
for j in range(3):
if c[i][j] != a123[i] + b123[j]:
isOk = False
ans ... | C = [list(map(int, input().split())) for _ in range(3)]
x = C[0][0]
a = [c[0] - x for c in C]
b = [C[0][i] - a[0] for i in range(3)]
ans = "Yes"
for i in range(3):
for j in range(3):
if C[i][j] != a[i] + b[j]:
ans = "No"
print(ans)
| false | 27.777778 | [
"-import numpy as np",
"-",
"-c = np.array([[int(i) for i in input().split()] for _ in range(3)])",
"-b123 = c[0]",
"-a123 = np.array(",
"- [",
"- 0,",
"- c[1][1] - b123[1],",
"- c[2][2] - b123[2],",
"- ]",
"-)",
"-isOk = True",
"+C = [list(map(int, input().split()... | false | 0.33876 | 0.036022 | 9.404248 | [
"s351467204",
"s299306530"
] |
u537782349 | p03078 | python | s263752327 | s459623156 | 1,741 | 1,536 | 5,228 | 5,108 | Accepted | Accepted | 11.77 | a, b, c, d = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
ans = [[al[0] + bl[0] + cl[... | import heapq
a, b, c, d = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = []
heapq.heappush(q, [-(al[0] + bl[0] + cl[0]), ... | 37 | 46 | 1,305 | 1,840 | a, b, c, d = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
ans = [[al[0] + bl[0] + cl[0], 0, 0... | import heapq
a, b, c, d = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = []
heapq.heappush(q, [-(al[0] + bl[0] + cl[0]), 0, 0, 0]... | false | 19.565217 | [
"+import heapq",
"+",
"-q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]",
"-ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]]",
"+q = []",
"+heapq.heappush(q, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])",
"+ans = []",
"+heapq.heappush(ans, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])",
"- s, aq, bq, cq = list(map(int, q.pop()))"... | false | 0.068095 | 0.036496 | 1.865823 | [
"s263752327",
"s459623156"
] |
u347640436 | p02804 | python | s366161235 | s421029709 | 912 | 733 | 14,416 | 20,032 | Accepted | Accepted | 19.63 | p = 1000000007
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
fac = [0] * (N + 1)
fac[0] = 1
for i in range(N):
fac[i + 1] = fac[i] * (i + 1) % p
def mcomb(n, k):
if n == 0 and k == 0:
return 1
if n < k or k < 0:
return 0
return fac[n] * po... | # フェルマーの小定理
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
m = 1000000007
fac = [0] * (N + 1)
fac[0] = 1
for i in range(N):
fac[i + 1] = fac[i] * (i + 1) % m
def mcomb(n, k):
if n == 0 and k == 0:
return 1
if n < k or k < 0:
return 0
retur... | 33 | 35 | 652 | 655 | p = 1000000007
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
fac = [0] * (N + 1)
fac[0] = 1
for i in range(N):
fac[i + 1] = fac[i] * (i + 1) % p
def mcomb(n, k):
if n == 0 and k == 0:
return 1
if n < k or k < 0:
return 0
return fac[n] * pow(fac[n - k], p - ... | # フェルマーの小定理
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
m = 1000000007
fac = [0] * (N + 1)
fac[0] = 1
for i in range(N):
fac[i + 1] = fac[i] * (i + 1) % m
def mcomb(n, k):
if n == 0 and k == 0:
return 1
if n < k or k < 0:
return 0
return fac[n] * pow(fac[... | false | 5.714286 | [
"-p = 1000000007",
"+# フェルマーの小定理",
"+m = 1000000007",
"- fac[i + 1] = fac[i] * (i + 1) % p",
"+ fac[i + 1] = fac[i] * (i + 1) % m",
"- return fac[n] * pow(fac[n - k], p - 2, p) * pow(fac[k], p - 2, p) % p",
"+ return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m",
"- re... | false | 0.104092 | 0.142139 | 0.732322 | [
"s366161235",
"s421029709"
] |
u285358283 | p02628 | python | s036621083 | s882158954 | 30 | 27 | 9,028 | 9,168 | Accepted | Accepted | 10 | N, K = list(map(int,input().split()))
P = list(map(int,input().split()))
P.sort()
print((sum(P[:K])))
| N, K = list(map(int,input().split()))
print((sum(sorted(list(map(int,input().split())))[:K]))) | 7 | 2 | 103 | 87 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort()
print((sum(P[:K])))
| N, K = list(map(int, input().split()))
print((sum(sorted(list(map(int, input().split())))[:K])))
| false | 71.428571 | [
"-P = list(map(int, input().split()))",
"-P.sort()",
"-print((sum(P[:K])))",
"+print((sum(sorted(list(map(int, input().split())))[:K])))"
] | false | 0.035301 | 0.035815 | 0.985658 | [
"s036621083",
"s882158954"
] |
u930705402 | p02713 | python | s967439583 | s170741641 | 1,191 | 491 | 9,620 | 68,876 | Accepted | Accepted | 58.77 | from math import gcd
import itertools
K=int(eval(input()))
res=0
li=[]
for x in itertools.product(list(range(1,K+1)),repeat=2):
li.append(gcd(x[0],x[1]))
for x,y in itertools.product(list(range(1,K+1)),li):
res+=gcd(x,y)
print(res) | from math import *
K=int(eval(input()))
ans=0
for a in range(1,K+1):
for b in range(1,K+1):
for c in range(1,K+1):
ans+=gcd(gcd(a,b),c)
print(ans) | 10 | 8 | 230 | 159 | from math import gcd
import itertools
K = int(eval(input()))
res = 0
li = []
for x in itertools.product(list(range(1, K + 1)), repeat=2):
li.append(gcd(x[0], x[1]))
for x, y in itertools.product(list(range(1, K + 1)), li):
res += gcd(x, y)
print(res)
| from math import *
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
| false | 20 | [
"-from math import gcd",
"-import itertools",
"+from math import *",
"-res = 0",
"-li = []",
"-for x in itertools.product(list(range(1, K + 1)), repeat=2):",
"- li.append(gcd(x[0], x[1]))",
"-for x, y in itertools.product(list(range(1, K + 1)), li):",
"- res += gcd(x, y)",
"-print(res)",
"... | false | 0.110819 | 0.173642 | 0.638203 | [
"s967439583",
"s170741641"
] |
u768993705 | p02909 | python | s003560555 | s149740588 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | w = eval(input())
weather = ['Sunny', 'Cloudy', 'Rainy' ]
idx = weather.index(w) + 1
if idx > 2:
idx = 0
print((weather[idx])) | w = eval(input())
weather = ['Sunny', 'Cloudy', 'Rainy' ]
idx = weather.index(w) - 2
print((weather[idx])) | 8 | 6 | 129 | 105 | w = eval(input())
weather = ["Sunny", "Cloudy", "Rainy"]
idx = weather.index(w) + 1
if idx > 2:
idx = 0
print((weather[idx]))
| w = eval(input())
weather = ["Sunny", "Cloudy", "Rainy"]
idx = weather.index(w) - 2
print((weather[idx]))
| false | 25 | [
"-idx = weather.index(w) + 1",
"-if idx > 2:",
"- idx = 0",
"+idx = weather.index(w) - 2"
] | false | 0.069691 | 0.079286 | 0.878982 | [
"s003560555",
"s149740588"
] |
u219197917 | p02947 | python | s129618430 | s035594566 | 358 | 299 | 25,328 | 25,328 | Accepted | Accepted | 16.48 | from collections import defaultdict
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
cnt = defaultdict(int)
for si in s:
cnt["".join(sorted(si))] += 1
ans = 0
for v in list(cnt.values()):
ans += sum(range(1, v))
print(ans) | from collections import defaultdict
import sys
def input() -> str:
return sys.stdin.readline()
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
cnt = defaultdict(int)
for si in s:
cnt["".join(sorted(si))] += 1
ans = 0
for v in list(cnt.values()):
ans += sum(range(1, v))
print(ans)
| 11 | 13 | 235 | 300 | from collections import defaultdict
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
cnt = defaultdict(int)
for si in s:
cnt["".join(sorted(si))] += 1
ans = 0
for v in list(cnt.values()):
ans += sum(range(1, v))
print(ans)
| from collections import defaultdict
import sys
def input() -> str:
return sys.stdin.readline()
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
cnt = defaultdict(int)
for si in s:
cnt["".join(sorted(si))] += 1
ans = 0
for v in list(cnt.values()):
ans += sum(range(1, v))
print(ans)
| false | 15.384615 | [
"+import sys",
"+",
"+",
"+def input() -> str:",
"+ return sys.stdin.readline()",
"+"
] | false | 0.181276 | 0.040925 | 4.429463 | [
"s129618430",
"s035594566"
] |
u454093752 | p03436 | python | s997416864 | s634922343 | 213 | 82 | 41,712 | 74,300 | Accepted | Accepted | 61.5 | from _collections import deque
H,W = list(map(int,input().split()))
T = []
for i in range(H):
a = list(eval(input()))
T.append(a)
K = [[0,0,0]]
P = deque(K)
dp = [[10**6]*W for _ in range(H)]
used = [[0]*W for _ in range(H)]
move = [(-1,0),(0,-1),(1,0),(0,1)]
while(len(P)>0):
b = P.popleft()... | from collections import deque
H, W = list(map(int, input().split()))
K = []
for i in range(H):
A = list(eval(input()))
K.append(A)
P = deque([[0, 0, 1]])
used = [[0]*W for _ in range(H)]
used[0][0] = 1
while(True):
if len(P) == 0:
break
h, w, c = P.popleft()
if h == H-1 and w ==... | 37 | 32 | 929 | 797 | from _collections import deque
H, W = list(map(int, input().split()))
T = []
for i in range(H):
a = list(eval(input()))
T.append(a)
K = [[0, 0, 0]]
P = deque(K)
dp = [[10**6] * W for _ in range(H)]
used = [[0] * W for _ in range(H)]
move = [(-1, 0), (0, -1), (1, 0), (0, 1)]
while len(P) > 0:
b = P.popleft(... | from collections import deque
H, W = list(map(int, input().split()))
K = []
for i in range(H):
A = list(eval(input()))
K.append(A)
P = deque([[0, 0, 1]])
used = [[0] * W for _ in range(H)]
used[0][0] = 1
while True:
if len(P) == 0:
break
h, w, c = P.popleft()
if h == H - 1 and w == W - 1:
... | false | 13.513514 | [
"-from _collections import deque",
"+from collections import deque",
"-T = []",
"+K = []",
"- a = list(eval(input()))",
"- T.append(a)",
"-K = [[0, 0, 0]]",
"-P = deque(K)",
"-dp = [[10**6] * W for _ in range(H)]",
"+ A = list(eval(input()))",
"+ K.append(A)",
"+P = deque([[0, 0, 1... | false | 0.106207 | 0.047151 | 2.252471 | [
"s997416864",
"s634922343"
] |
u766684188 | p03731 | python | s610048943 | s760021803 | 170 | 147 | 25,744 | 26,708 | Accepted | Accepted | 13.53 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
n,t=list(map(int,input().split()))
T=list(map(int,input().split()))
ans=t
for i in range(1,n):
ans+=min(T[i]-T[i-1],t)
print(ans) | n,t=list(map(int,input().split()))
T=list(map(int,input().split()))
ans=t
for i in range(1,n):
ans+=min(T[i]-T[i-1],t)
print(ans) | 9 | 6 | 200 | 132 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
n, t = list(map(int, input().split()))
T = list(map(int, input().split()))
ans = t
for i in range(1, n):
ans += min(T[i] - T[i - 1], t)
print(ans)
| n, t = list(map(int, input().split()))
T = list(map(int, input().split()))
ans = t
for i in range(1, n):
ans += min(T[i] - T[i - 1], t)
print(ans)
| false | 33.333333 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**9)"
] | false | 0.044736 | 0.044624 | 1.002498 | [
"s610048943",
"s760021803"
] |
u006880673 | p02754 | python | s164791547 | s460039550 | 164 | 73 | 38,384 | 61,884 | Accepted | Accepted | 55.49 | n, a, b = list(map(int, input().split()))
cycles = n//(a+b)
count = 0
count += a*cycles
rest = n - (a+b)*cycles
if rest > a:
count += a
else:
count += rest
print(count) | N,A,B = list(map(int,input().split()))
ans = N//(A+B) * A
ans += min(A, N%(A+B))
print(ans) | 11 | 4 | 181 | 88 | n, a, b = list(map(int, input().split()))
cycles = n // (a + b)
count = 0
count += a * cycles
rest = n - (a + b) * cycles
if rest > a:
count += a
else:
count += rest
print(count)
| N, A, B = list(map(int, input().split()))
ans = N // (A + B) * A
ans += min(A, N % (A + B))
print(ans)
| false | 63.636364 | [
"-n, a, b = list(map(int, input().split()))",
"-cycles = n // (a + b)",
"-count = 0",
"-count += a * cycles",
"-rest = n - (a + b) * cycles",
"-if rest > a:",
"- count += a",
"-else:",
"- count += rest",
"-print(count)",
"+N, A, B = list(map(int, input().split()))",
"+ans = N // (A + B) ... | false | 0.03554 | 0.070087 | 0.507083 | [
"s164791547",
"s460039550"
] |
u785066634 | p03060 | python | s605838235 | s794353970 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | n=int(eval(input()))
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(n):
if v[i]-c[i] >0:
ans += v[i]-c[i]
print(ans)
| n=int(eval(input()))
v=list(map(int,input().split()))
c=list(map(int,input().split()))
a=0
for i in range(n):
if v[i]-c[i]>0:
a+=v[i]-c[i]
print(a)
| 8 | 10 | 219 | 189 | n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
if v[i] - c[i] > 0:
ans += v[i] - c[i]
print(ans)
| n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
a = 0
for i in range(n):
if v[i] - c[i] > 0:
a += v[i] - c[i]
print(a)
| false | 20 | [
"-ans = 0",
"+a = 0",
"- ans += v[i] - c[i]",
"-print(ans)",
"+ a += v[i] - c[i]",
"+print(a)"
] | false | 0.051833 | 0.076944 | 0.673638 | [
"s605838235",
"s794353970"
] |
u714642969 | p02599 | python | s095077271 | s745452023 | 1,623 | 772 | 235,784 | 168,800 | Accepted | Accepted | 52.43 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
N,Q=map(int,input().split())
a=tuple... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
N,Q=map(int,input().split())
a=tuple... | 63 | 73 | 1,483 | 1,610 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
N, Q = map(int, input().split(... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
N, Q = map(int, input().split(... | false | 13.69863 | [
"-lr = [() for i in range(Q)]",
"+lr = [0] * Q",
"+c0 = 10**12",
"+c1 = 10**6",
"- lr[i] = (l, r, i)",
"-lr.sort(key=lambda t: t[1], reverse=1)",
"+ lr[i] = r * c0 + l * c1 + i",
"+lr.sort(reverse=1)",
"-l, r, j = lr.pop()",
"+lrj = lr.pop()",
"+r = lrj // c0",
"+lrj %= c0",
"+l = lrj ... | false | 0.046665 | 0.037197 | 1.254548 | [
"s095077271",
"s745452023"
] |
u222668979 | p02689 | python | s287873344 | s686504287 | 353 | 261 | 44,428 | 31,896 | Accepted | Accepted | 26.06 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
near = [[0] for _ in range(n)]
for a, b in ab:
near[a-1].append(h[b-1])
near[b-1].append(h[a-1])
cnt = 0
for i in range(n):
... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
h_max = [0 for _ in range(n)]
for a, b in ab:
h_max[a-1] = max(h_max[a-1], h[b-1])
h_max[b-1] = max(h_max[b-1], h[a-1])
cnt = 0... | 17 | 17 | 371 | 390 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
near = [[0] for _ in range(n)]
for a, b in ab:
near[a - 1].append(h[b - 1])
near[b - 1].append(h[a - 1])
cnt = 0
for i in range(n):
if h[... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
h_max = [0 for _ in range(n)]
for a, b in ab:
h_max[a - 1] = max(h_max[a - 1], h[b - 1])
h_max[b - 1] = max(h_max[b - 1], h[a - 1])
cnt = 0
f... | false | 0 | [
"-near = [[0] for _ in range(n)]",
"+h_max = [0 for _ in range(n)]",
"- near[a - 1].append(h[b - 1])",
"- near[b - 1].append(h[a - 1])",
"+ h_max[a - 1] = max(h_max[a - 1], h[b - 1])",
"+ h_max[b - 1] = max(h_max[b - 1], h[a - 1])",
"- if h[i] > max(near[i]):",
"+ if h[i] > h_max[i]:... | false | 0.04308 | 0.045348 | 0.949974 | [
"s287873344",
"s686504287"
] |
u788137651 | p03739 | python | s789082083 | s901171185 | 315 | 241 | 61,916 | 59,804 | Accepted | Accepted | 23.49 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import ... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import ... | 107 | 62 | 3,067 | 1,824 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defau... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defau... | false | 42.056075 | [
"-# Binary Indexed Tree (1-index!!!!!!!!)",
"-class BinaryIndexedTree:",
"- def __init__(self, size):",
"- self.__node = [0] * (size + 1)",
"- self.size = size",
"-",
"- # node[index]にvalueを足して、BITを更新",
"- def add(self, index, value):",
"- while index <= self.size:",
... | false | 0.037895 | 0.03813 | 0.993836 | [
"s789082083",
"s901171185"
] |
u867848444 | p02885 | python | s793385267 | s352312344 | 176 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.34 | a,b=list(map(int,input().split()))
print((a-2*b if a-2*b>0 else 0)) | a,b=list(map(int,input().split()))
print((max(0,a-2*b))) | 2 | 3 | 60 | 51 | a, b = list(map(int, input().split()))
print((a - 2 * b if a - 2 * b > 0 else 0))
| a, b = list(map(int, input().split()))
print((max(0, a - 2 * b)))
| false | 33.333333 | [
"-print((a - 2 * b if a - 2 * b > 0 else 0))",
"+print((max(0, a - 2 * b)))"
] | false | 0.04417 | 0.034396 | 1.284158 | [
"s793385267",
"s352312344"
] |
u075012704 | p03714 | python | s488629090 | s080195467 | 413 | 353 | 38,420 | 40,336 | Accepted | Accepted | 14.53 | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
# 準備
left, right = A[:N], A[-N:]
right = list([-x for x in right])
left_sum, right_sum = [sum(left)], [-sum(right)]
heapq.heapify(left)
heapq.heapify(right)
# left処理
for i in range(N, 2*N):
heapq.heappush(left, A[i])
low... | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
Left, Right = A[:N], list([-a for a in A[-N:]])
heapq.heapify(Left)
heapq.heapify(Right)
Left_SUM, Right_SUM = [sum(Left)], [-sum(Right)]
M = A[N:2*N]
# 左側
for k in range(N):
lo = heapq.heappushpop(Left, M[k])
Left_SUM.append... | 30 | 23 | 682 | 563 | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
# 準備
left, right = A[:N], A[-N:]
right = list([-x for x in right])
left_sum, right_sum = [sum(left)], [-sum(right)]
heapq.heapify(left)
heapq.heapify(right)
# left処理
for i in range(N, 2 * N):
heapq.heappush(left, A[i])
low = heapq.heappop(... | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
Left, Right = A[:N], list([-a for a in A[-N:]])
heapq.heapify(Left)
heapq.heapify(Right)
Left_SUM, Right_SUM = [sum(Left)], [-sum(Right)]
M = A[N : 2 * N]
# 左側
for k in range(N):
lo = heapq.heappushpop(Left, M[k])
Left_SUM.append(Left_SUM[... | false | 23.333333 | [
"-# 準備",
"-left, right = A[:N], A[-N:]",
"-right = list([-x for x in right])",
"-left_sum, right_sum = [sum(left)], [-sum(right)]",
"-heapq.heapify(left)",
"-heapq.heapify(right)",
"-# left処理",
"-for i in range(N, 2 * N):",
"- heapq.heappush(left, A[i])",
"- low = heapq.heappop(left)",
"- ... | false | 0.115734 | 0.046453 | 2.491397 | [
"s488629090",
"s080195467"
] |
u368249389 | p03103 | python | s248043725 | s076609663 | 709 | 288 | 63,400 | 25,952 | Accepted | Accepted | 59.38 | # Problem C - Energy Drink Collector
# input
N, M = list(map(int, input().split()))
ab_list = []
for i in range(N):
a, b = list(map(int, input().split()))
ab_list.append([a, b])
# initialization
ab_list = sorted(ab_list, key=lambda x: x[0])
min_cost = 0
# count
i = 0
nokori = M
while nokori>0... | # Problem C - Energy Drink Collector
# input
N, M = list(map(int, input().split()))
ab_list = []
for i in range(N):
a, b = list(map(int, input().split()))
ab_list.append([a, b])
# initialization
nokori = M
ab_list = sorted(ab_list, key= lambda x: x[0])
ans = 0
# count
i = 0
while nokori>0:
... | 30 | 29 | 493 | 506 | # Problem C - Energy Drink Collector
# input
N, M = list(map(int, input().split()))
ab_list = []
for i in range(N):
a, b = list(map(int, input().split()))
ab_list.append([a, b])
# initialization
ab_list = sorted(ab_list, key=lambda x: x[0])
min_cost = 0
# count
i = 0
nokori = M
while nokori > 0:
a, b = ab_l... | # Problem C - Energy Drink Collector
# input
N, M = list(map(int, input().split()))
ab_list = []
for i in range(N):
a, b = list(map(int, input().split()))
ab_list.append([a, b])
# initialization
nokori = M
ab_list = sorted(ab_list, key=lambda x: x[0])
ans = 0
# count
i = 0
while nokori > 0:
ab = ab_list[i]
... | false | 3.333333 | [
"+nokori = M",
"-min_cost = 0",
"+ans = 0",
"-nokori = M",
"- a, b = ab_list[i]",
"- if nokori - b < 0:",
"- b = nokori",
"- nokori = 0",
"+ ab = ab_list[i]",
"+ a = ab[0]",
"+ b = ab[1]",
"+ if b <= nokori:",
"+ ans += a * b",
"+ nokori -= b",... | false | 0.048976 | 0.118701 | 0.412601 | [
"s248043725",
"s076609663"
] |
u552746936 | p02690 | python | s570934590 | s772541394 | 41 | 36 | 9,100 | 9,164 | Accepted | Accepted | 12.2 | import bisect
import math
D = 120
X = int(eval(input()))
for a in range(-D, D):
for b in range(-D-1, D-1):
if a**5 - b**5 == X:
break
else:
continue
break
print((a, b))
| D = 120
X = int(eval(input()))
for a in range(-D, D):
for b in range(-D-1, D-1):
if a**5 - b**5 == X:
break
else:
continue
break
print((a, b))
| 16 | 13 | 220 | 190 | import bisect
import math
D = 120
X = int(eval(input()))
for a in range(-D, D):
for b in range(-D - 1, D - 1):
if a**5 - b**5 == X:
break
else:
continue
break
print((a, b))
| D = 120
X = int(eval(input()))
for a in range(-D, D):
for b in range(-D - 1, D - 1):
if a**5 - b**5 == X:
break
else:
continue
break
print((a, b))
| false | 18.75 | [
"-import bisect",
"-import math",
"-"
] | false | 0.065015 | 0.067441 | 0.964025 | [
"s570934590",
"s772541394"
] |
u649202997 | p03062 | python | s468067385 | s574726034 | 66 | 57 | 14,412 | 14,332 | Accepted | Accepted | 13.64 | n = int(eval(input()))
a_list = [int(i) for i in input().split()]
minus_count_even_flug = True
zero_exist_flug = False
for a in a_list:
if a < 0:
minus_count_even_flug = not minus_count_even_flug
if a == 0:
zero_exist_flug = True
a_abs_list = [abs(a) for a in a_list]
sum_a_a... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(abs, A))
C = [a for a in A if a < 0]
if len(C) % 2 == 0:
print((sum(B)))
else:
print((sum(B) - min(B)*2)) | 17 | 8 | 468 | 186 | n = int(eval(input()))
a_list = [int(i) for i in input().split()]
minus_count_even_flug = True
zero_exist_flug = False
for a in a_list:
if a < 0:
minus_count_even_flug = not minus_count_even_flug
if a == 0:
zero_exist_flug = True
a_abs_list = [abs(a) for a in a_list]
sum_a_abs_list = sum(a_abs_l... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(abs, A))
C = [a for a in A if a < 0]
if len(C) % 2 == 0:
print((sum(B)))
else:
print((sum(B) - min(B) * 2))
| false | 52.941176 | [
"-n = int(eval(input()))",
"-a_list = [int(i) for i in input().split()]",
"-minus_count_even_flug = True",
"-zero_exist_flug = False",
"-for a in a_list:",
"- if a < 0:",
"- minus_count_even_flug = not minus_count_even_flug",
"- if a == 0:",
"- zero_exist_flug = True",
"-a_abs_... | false | 0.101761 | 0.040902 | 2.487943 | [
"s468067385",
"s574726034"
] |
u699296734 | p03339 | python | s643359144 | s430619476 | 196 | 160 | 9,764 | 9,716 | Accepted | Accepted | 18.37 | n = int(eval(input()))
s = eval(input())
res = n
w = 0
e = 0
for i in range(n):
if s[i] == "W":
w += 1
else:
e += 1
l_w = 0
l_e = 0
for i in range(n):
if i == n - 1 and s[i] == "E":
l_e += 1
tmp = l_w + (e - l_e)
res = min(tmp, res)
if s[i] == "W":
... | n = int(eval(input()))
s = eval(input())
res = n
e = s.count("E")
l_w = 0
l_e = 0
for i in range(n):
if i == n - 1 and s[i] == "E":
l_e += 1
tmp = l_w + (e - l_e)
res = min(tmp, res)
if s[i] == "W":
l_w += 1
else:
l_e += 1
print(res)
| 23 | 17 | 363 | 283 | n = int(eval(input()))
s = eval(input())
res = n
w = 0
e = 0
for i in range(n):
if s[i] == "W":
w += 1
else:
e += 1
l_w = 0
l_e = 0
for i in range(n):
if i == n - 1 and s[i] == "E":
l_e += 1
tmp = l_w + (e - l_e)
res = min(tmp, res)
if s[i] == "W":
l_w += 1
el... | n = int(eval(input()))
s = eval(input())
res = n
e = s.count("E")
l_w = 0
l_e = 0
for i in range(n):
if i == n - 1 and s[i] == "E":
l_e += 1
tmp = l_w + (e - l_e)
res = min(tmp, res)
if s[i] == "W":
l_w += 1
else:
l_e += 1
print(res)
| false | 26.086957 | [
"-w = 0",
"-e = 0",
"-for i in range(n):",
"- if s[i] == \"W\":",
"- w += 1",
"- else:",
"- e += 1",
"+e = s.count(\"E\")"
] | false | 0.083752 | 0.044548 | 1.880047 | [
"s643359144",
"s430619476"
] |
u722535636 | p03112 | python | s609922999 | s241932206 | 1,747 | 1,442 | 16,140 | 16,144 | Accepted | Accepted | 17.46 | A=list(map(int,input().split()))
S,T,X=[[int(eval(input())) for i in range(A[j])] for j in range(3)]
def binary(a,l,):
low=0
high=len(l)-1
while high-low>1:
mid=(low+high)//2
if l[mid]<a:
low=mid
else:
high=mid
return [l[high],l[low]]
for x in X:
s=set(binary(x,S))
t=set(binary(x,T)... | import sys
input=sys.stdin.readline
A=list(map(int,input().split()))
S,T,X=[[int(eval(input())) for i in range(A[j])] for j in range(3)]
def binary(a,l,):
low=0
high=len(l)-1
while high-low>1:
mid=(low+high)//2
if l[mid]<a:
low=mid
else:
high=mid
return [l[high],l[low]]
for x in X:
... | 22 | 24 | 427 | 465 | A = list(map(int, input().split()))
S, T, X = [[int(eval(input())) for i in range(A[j])] for j in range(3)]
def binary(
a,
l,
):
low = 0
high = len(l) - 1
while high - low > 1:
mid = (low + high) // 2
if l[mid] < a:
low = mid
else:
high = mid
ret... | import sys
input = sys.stdin.readline
A = list(map(int, input().split()))
S, T, X = [[int(eval(input())) for i in range(A[j])] for j in range(3)]
def binary(
a,
l,
):
low = 0
high = len(l) - 1
while high - low > 1:
mid = (low + high) // 2
if l[mid] < a:
low = mid
... | false | 8.333333 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038371 | 0.042164 | 0.910042 | [
"s609922999",
"s241932206"
] |
u471797506 | p03973 | python | s605468660 | s993969739 | 252 | 233 | 7,076 | 5,764 | Accepted | Accepted | 7.54 | # -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll
N = int(input())
A = [int(input()) for i in range(N)]
ans = A[0] - 1
d = 2
for i in range(1, N):
k = (A[i] - 1)/d
if A[i] == d:
d += 1
ans += k
print(ans)
| N = int(input())
A = [int(input()) for i in range(N)]
ans = A[0] - 1
d = 2
for i in range(1, N):
ans += (A[i] - 1)/d
if A[i] == d: d += 1
print(ans)
| 13 | 8 | 304 | 173 | # -*- coding: utf-8 -*-
import sys, copy, math, heapq, itertools as it, fractions, re, bisect, collections as coll
N = int(input())
A = [int(input()) for i in range(N)]
ans = A[0] - 1
d = 2
for i in range(1, N):
k = (A[i] - 1) / d
if A[i] == d:
d += 1
ans += k
print(ans)
| N = int(input())
A = [int(input()) for i in range(N)]
ans = A[0] - 1
d = 2
for i in range(1, N):
ans += (A[i] - 1) / d
if A[i] == d:
d += 1
print(ans)
| false | 38.461538 | [
"-# -*- coding: utf-8 -*-",
"-import sys, copy, math, heapq, itertools as it, fractions, re, bisect, collections as coll",
"-",
"- k = (A[i] - 1) / d",
"+ ans += (A[i] - 1) / d",
"- ans += k"
] | false | 0.062164 | 0.070892 | 0.876894 | [
"s605468660",
"s993969739"
] |
u779805689 | p02537 | python | s413535989 | s421220054 | 767 | 642 | 130,844 | 110,528 | Accepted | Accepted | 16.3 | # a_k の値を x に更新
def update(k, x):
k += T0-1
data[k] = x
while k >= 0:
k = (k - 1) // 2
data[k] = max(data[2*k+1], data[2*k+2])
# 区間[l, r)の最小値
def query(l, r):
L = l + T0; R = r + T0
s = 0
while L < R:
if R & 1:
R -= 1
s = max(s, data[... | class Segment_Tree():
"""
このプログラム内は1-index
"""
def __init__(self,L,calc,unit):
"""calcを演算とするリストLのSegment Treeを作成
calc:演算(2変数関数,モノイド)
unit:モノイドcalcの単位元 (xe=ex=xを満たすe)
"""
self.calc=calc
self.unit=unit
N=len(L)
d=max(1,(N-1)... | 38 | 85 | 766 | 1,893 | # a_k の値を x に更新
def update(k, x):
k += T0 - 1
data[k] = x
while k >= 0:
k = (k - 1) // 2
data[k] = max(data[2 * k + 1], data[2 * k + 2])
# 区間[l, r)の最小値
def query(l, r):
L = l + T0
R = r + T0
s = 0
while L < R:
if R & 1:
R -= 1
s = max(s, data... | class Segment_Tree:
"""
このプログラム内は1-index
"""
def __init__(self, L, calc, unit):
"""calcを演算とするリストLのSegment Treeを作成
calc:演算(2変数関数,モノイド)
unit:モノイドcalcの単位元 (xe=ex=xを満たすe)
"""
self.calc = calc
self.unit = unit
N = len(L)
d = max(1, (N - 1).bit_... | false | 55.294118 | [
"-# a_k の値を x に更新",
"-def update(k, x):",
"- k += T0 - 1",
"- data[k] = x",
"- while k >= 0:",
"- k = (k - 1) // 2",
"- data[k] = max(data[2 * k + 1], data[2 * k + 2])",
"+class Segment_Tree:",
"+ \"\"\"",
"+ このプログラム内は1-index",
"+ \"\"\"",
"+ def __init__(sel... | false | 0.039931 | 0.113669 | 0.351289 | [
"s413535989",
"s421220054"
] |
u107077660 | p03997 | python | s747164979 | s746681913 | 40 | 23 | 3,188 | 3,064 | Accepted | Accepted | 42.5 | a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
print((int((a+b)*h/2))) | a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
ans = (a + b) * h // 2
print(ans) | 4 | 5 | 75 | 88 | a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
print((int((a + b) * h / 2)))
| a = int(eval(input()))
b = int(eval(input()))
h = int(eval(input()))
ans = (a + b) * h // 2
print(ans)
| false | 20 | [
"-print((int((a + b) * h / 2)))",
"+ans = (a + b) * h // 2",
"+print(ans)"
] | false | 0.07535 | 0.036579 | 2.059948 | [
"s747164979",
"s746681913"
] |
u395894569 | p02683 | python | s003987935 | s225712491 | 116 | 84 | 9,144 | 9,216 | Accepted | Accepted | 27.59 | n,m,y = list(map(int, input().split()))
l = [input().split() for x in range(n)]
c = [0]*n
a=[[0 for x in range(m)] for y in range(n)]
for i in range(n):
c[i] = l[i][0]
for j in range(m):
a[i][j] = l[i][j+1]
ans=float('inf')
for i in range(2 ** n):
cost = 0
d=[0]*m
for j in rang... | n, m, x = list(map(int, input().split()))
c = [0] * n
a = [[0 for _ in range(m)] for i in range(n)]
for i in range(n):
l = [int(_) for _ in input().split()]
c[i]=l[0]
for j in range(m):
a[i][j] = l[j+1]
inf=float('inf')
ans=inf
for i in range(2 ** n):
cost = 0
d=[0]*m
fo... | 24 | 31 | 602 | 629 | n, m, y = list(map(int, input().split()))
l = [input().split() for x in range(n)]
c = [0] * n
a = [[0 for x in range(m)] for y in range(n)]
for i in range(n):
c[i] = l[i][0]
for j in range(m):
a[i][j] = l[i][j + 1]
ans = float("inf")
for i in range(2**n):
cost = 0
d = [0] * m
for j in range(... | n, m, x = list(map(int, input().split()))
c = [0] * n
a = [[0 for _ in range(m)] for i in range(n)]
for i in range(n):
l = [int(_) for _ in input().split()]
c[i] = l[0]
for j in range(m):
a[i][j] = l[j + 1]
inf = float("inf")
ans = inf
for i in range(2**n):
cost = 0
d = [0] * m
for j in ... | false | 22.580645 | [
"-n, m, y = list(map(int, input().split()))",
"-l = [input().split() for x in range(n)]",
"+n, m, x = list(map(int, input().split()))",
"-a = [[0 for x in range(m)] for y in range(n)]",
"+a = [[0 for _ in range(m)] for i in range(n)]",
"- c[i] = l[i][0]",
"+ l = [int(_) for _ in input().split()]",... | false | 0.040963 | 0.089527 | 0.457549 | [
"s003987935",
"s225712491"
] |
u098012509 | p03045 | python | s373541240 | s706134825 | 1,248 | 319 | 26,016 | 25,936 | Accepted | Accepted | 74.44 | import sys
input = sys.stdin.readline
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 ... | import sys
input = sys.stdin.readline
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 ... | 103 | 67 | 2,435 | 1,521 | import sys
input = sys.stdin.readline
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
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
... | false | 34.951456 | [
"- u = UnionFind(N + 2)",
"- f = True",
"+ u = UnionFind(N)",
"- x += 1",
"- y += 1",
"- if z % 2 == 0:",
"- u.union(x, y)",
"- else:",
"- if f:",
"- f = False",
"- u.union(x, 0)",
"- u.unio... | false | 0.048805 | 0.077857 | 0.626849 | [
"s373541240",
"s706134825"
] |
u863442865 | p03634 | python | s040304390 | s145203387 | 1,253 | 784 | 193,456 | 84,272 | Accepted | Accepted | 37.43 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | 46 | 61 | 1,196 | 1,737 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | false | 24.590164 | [
"+ inf = 10**17",
"- def dfs(v):",
"- visited[v] = 1",
"- for cost, nv in edge[v]:",
"- if visited[nv] == 1:",
"+ def dijkstra_heap(start, edge):",
"+ # 始点から各頂点への最短距離(頂点番号:0~N-1)",
"+ d = [inf] * N",
"+ used = [False] * N",
"+ d[start] ... | false | 0.105546 | 0.039375 | 2.680498 | [
"s040304390",
"s145203387"
] |
u346812984 | p02972 | python | s485072369 | s397940648 | 836 | 216 | 69,608 | 12,724 | Accepted | Accepted | 74.16 | import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def make_divisors(n):
# exclude itself
divisors = [1]
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
divisors.append(i)
... | import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(input())
A = list(map(int, input().split()))
B = [0] * N
for i in range(N)[::-1]:
s = sum(B[i :: i + 1]) % 2
if A[... | 45 | 29 | 870 | 525 | import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def make_divisors(n):
# exclude itself
divisors = [1]
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
... | import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(input())
A = list(map(int, input().split()))
B = [0] * N
for i in range(N)[::-1]:
s = sum(B[i :: i + 1]) % 2
if A[i] == s:
... | false | 35.555556 | [
"-def make_divisors(n):",
"- # exclude itself",
"- divisors = [1]",
"- for i in range(2, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- if i != n // i:",
"- divisors.append(n // i)",
"- return divisors",
"-",
"-",
"- ... | false | 0.035681 | 0.03776 | 0.944938 | [
"s485072369",
"s397940648"
] |
u608088992 | p03026 | python | s875637379 | s202460075 | 61 | 50 | 6,752 | 6,380 | Accepted | Accepted | 18.03 | import sys, math, collections, heapq, itertools
def gcd(a, b):
a, b = max(a, b), min(a, b)
while a % b > 0: a, b = b, a % b
return b
def solve():
file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
INF = 10 ** 25
mod = 7 + 10 ** 9
N = int(file())
... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
Edge = [[] for _ in range(N)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
Edge[a-1].append(b-1)
Edge[b-1].append(a-1)
C = [int(c) for c in input... | 62 | 32 | 1,700 | 772 | import sys, math, collections, heapq, itertools
def gcd(a, b):
a, b = max(a, b), min(a, b)
while a % b > 0:
a, b = b, a % b
return b
def solve():
file = sys.stdin.readline # single: int(file()), line: map(int, file().split())
INF = 10**25
mod = 7 + 10**9
N = int(file())
edge... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
Edge = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
Edge[a - 1].append(b - 1)
Edge[b - 1].append(a - 1)
C = [int(c) for c in input... | false | 48.387097 | [
"-import sys, math, collections, heapq, itertools",
"-",
"-",
"-def gcd(a, b):",
"- a, b = max(a, b), min(a, b)",
"- while a % b > 0:",
"- a, b = b, a % b",
"- return b",
"+import sys",
"+from collections import deque",
"- file = sys.stdin.readline # single: int(file()), line... | false | 0.111858 | 0.129684 | 0.862547 | [
"s875637379",
"s202460075"
] |
u811841526 | p02418 | python | s250937876 | s415252462 | 70 | 20 | 7,472 | 5,548 | Accepted | Accepted | 71.43 | s = eval(input())
p = eval(input())
s *= 2
if p in s:
print('Yes')
else:
print('No') | s = eval(input()) * 2
p = eval(input())
if p in s:
print('Yes')
else:
print('No')
| 7 | 7 | 86 | 85 | s = eval(input())
p = eval(input())
s *= 2
if p in s:
print("Yes")
else:
print("No")
| s = eval(input()) * 2
p = eval(input())
if p in s:
print("Yes")
else:
print("No")
| false | 0 | [
"-s = eval(input())",
"+s = eval(input()) * 2",
"-s *= 2"
] | false | 0.106286 | 0.046173 | 2.301874 | [
"s250937876",
"s415252462"
] |
u401686269 | p02548 | python | s049338653 | s352515013 | 163 | 102 | 9,156 | 16,920 | Accepted | Accepted | 37.42 | N=int(eval(input()))
ans=0
for a in range(1,N):
ans += (N-1)//a
print(ans) | def main():
N=int(eval(input()))
print((sum([(N-1)//a for a in range(1,N)])))
if __name__=="__main__":
main() | 7 | 6 | 80 | 115 | N = int(eval(input()))
ans = 0
for a in range(1, N):
ans += (N - 1) // a
print(ans)
| def main():
N = int(eval(input()))
print((sum([(N - 1) // a for a in range(1, N)])))
if __name__ == "__main__":
main()
| false | 14.285714 | [
"-N = int(eval(input()))",
"-ans = 0",
"-for a in range(1, N):",
"- ans += (N - 1) // a",
"-print(ans)",
"+def main():",
"+ N = int(eval(input()))",
"+ print((sum([(N - 1) // a for a in range(1, N)])))",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.091517 | 0.06442 | 1.420621 | [
"s049338653",
"s352515013"
] |
u562935282 | p03266 | python | s367521149 | s435736056 | 86 | 18 | 15,084 | 2,940 | Accepted | Accepted | 79.07 | def iin(): return int(eval(input()))
def nl(): return list(map(int, input().split()))
def ary(r, c, v): return [[v for _ in range(c)] for _ in range(r)]
n, k = nl()
d = dict()
for i in range(1, n + 1):
t = i % k
d[t] = d.get(t, 0) + 1
ans = 0
if k % 2 == 0:
ans += d.get(k // 2, 0) ** 3
ans ... | n, k = list(map(int, input().split()))
ans = 0
if k % 2 == 0:
ans += ((n - k // 2) // k + 1) ** 3
ans += (n // k) ** 3
print(ans) | 16 | 7 | 345 | 134 | def iin():
return int(eval(input()))
def nl():
return list(map(int, input().split()))
def ary(r, c, v):
return [[v for _ in range(c)] for _ in range(r)]
n, k = nl()
d = dict()
for i in range(1, n + 1):
t = i % k
d[t] = d.get(t, 0) + 1
ans = 0
if k % 2 == 0:
ans += d.get(k // 2, 0) ** 3
ans... | n, k = list(map(int, input().split()))
ans = 0
if k % 2 == 0:
ans += ((n - k // 2) // k + 1) ** 3
ans += (n // k) ** 3
print(ans)
| false | 56.25 | [
"-def iin():",
"- return int(eval(input()))",
"-",
"-",
"-def nl():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def ary(r, c, v):",
"- return [[v for _ in range(c)] for _ in range(r)]",
"-",
"-",
"-n, k = nl()",
"-d = dict()",
"-for i in range(1, n + 1):",
"- ... | false | 0.03851 | 0.038342 | 1.004398 | [
"s367521149",
"s435736056"
] |
u729133443 | p02658 | python | s560973998 | s206911079 | 100 | 66 | 19,268 | 19,380 | Accepted | Accepted | 34 | t=1
for a in sorted([*open(0)][1].split()):t=(-1,t:=t*int(a))[0<=t<=1e18]
print(t) | t=1
for a in[*open(0)][1].split():t=(-1,t:=t*int(a))[0<=t<=1e18]
print(t) | 3 | 3 | 84 | 75 | t = 1
for a in sorted([*open(0)][1].split()):
t = (-1, t := t * int(a))[0 <= t <= 1e18]
print(t)
| t = 1
for a in [*open(0)][1].split():
t = (-1, t := t * int(a))[0 <= t <= 1e18]
print(t)
| false | 0 | [
"-for a in sorted([*open(0)][1].split()):",
"+for a in [*open(0)][1].split():"
] | false | 0.038866 | 0.038647 | 1.005661 | [
"s560973998",
"s206911079"
] |
u355371431 | p03658 | python | s758324860 | s654633145 | 169 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.94 | N,K = list(map(int,input().split()))
L = list(map(int,input().split()))
L = sorted(L)
ans = sum(L[len(L)- K :])
print(ans) | N,K = list(map(int,input().split()))
L = list(map(int,input().split()))
L.sort()
print((sum(L[N-K:]))) | 5 | 5 | 120 | 99 | N, K = list(map(int, input().split()))
L = list(map(int, input().split()))
L = sorted(L)
ans = sum(L[len(L) - K :])
print(ans)
| N, K = list(map(int, input().split()))
L = list(map(int, input().split()))
L.sort()
print((sum(L[N - K :])))
| false | 0 | [
"-L = sorted(L)",
"-ans = sum(L[len(L) - K :])",
"-print(ans)",
"+L.sort()",
"+print((sum(L[N - K :])))"
] | false | 0.036004 | 0.041497 | 0.867619 | [
"s758324860",
"s654633145"
] |
u346443137 | p03456 | python | s491809032 | s215774724 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | import math
import sys
s = sys.stdin.read()
line = s.splitlines()[0]
a, b = s.split(" ")
x = int(a + b)
sqrt = math.sqrt(x)
sqrt = int(sqrt)
squared = sqrt * sqrt
s = "Yes" if x == squared else "No"
print(s)
| import math
a, b = input().split()
x = int(a + b)
sqrt = int(math.sqrt(x))
squared = sqrt * sqrt
print(("Yes" if x == squared else "No"))
| 12 | 7 | 220 | 143 | import math
import sys
s = sys.stdin.read()
line = s.splitlines()[0]
a, b = s.split(" ")
x = int(a + b)
sqrt = math.sqrt(x)
sqrt = int(sqrt)
squared = sqrt * sqrt
s = "Yes" if x == squared else "No"
print(s)
| import math
a, b = input().split()
x = int(a + b)
sqrt = int(math.sqrt(x))
squared = sqrt * sqrt
print(("Yes" if x == squared else "No"))
| false | 41.666667 | [
"-import sys",
"-s = sys.stdin.read()",
"-line = s.splitlines()[0]",
"-a, b = s.split(\" \")",
"+a, b = input().split()",
"-sqrt = math.sqrt(x)",
"-sqrt = int(sqrt)",
"+sqrt = int(math.sqrt(x))",
"-s = \"Yes\" if x == squared else \"No\"",
"-print(s)",
"+print((\"Yes\" if x == squared else \"No\... | false | 0.06012 | 0.04888 | 1.229948 | [
"s491809032",
"s215774724"
] |
u353895424 | p03408 | python | s327474290 | s004296313 | 170 | 18 | 38,640 | 3,064 | Accepted | Accepted | 89.41 | from collections import Counter
n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
m = int(eval(input()))
t = []
for _ in range(m):
t.append(eval(input()))
ans = []
cs = Counter(s)
ct = Counter(t)
for i in range(len(cs)):
ans.append(cs.most_common()[i][... | # x1, y1, x2, y2 = map(int, input().split())
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
m = int(eval(input()))
t = []
for i in range(m):
t.append(eval(input()))
price = []
tmp = 0
for i in range(n):
price.append(s.count(s[i]) - t.count(s[i]))
print((max(0,... | 19 | 18 | 358 | 308 | from collections import Counter
n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
m = int(eval(input()))
t = []
for _ in range(m):
t.append(eval(input()))
ans = []
cs = Counter(s)
ct = Counter(t)
for i in range(len(cs)):
ans.append(cs.most_common()[i][1] - t.count(cs.most_common()[i]... | # x1, y1, x2, y2 = map(int, input().split())
n = int(eval(input()))
s = []
for i in range(n):
s.append(eval(input()))
m = int(eval(input()))
t = []
for i in range(m):
t.append(eval(input()))
price = []
tmp = 0
for i in range(n):
price.append(s.count(s[i]) - t.count(s[i]))
print((max(0, max(price))))
| false | 5.263158 | [
"-from collections import Counter",
"-",
"+# x1, y1, x2, y2 = map(int, input().split())",
"-for _ in range(n):",
"+for i in range(n):",
"-for _ in range(m):",
"+for i in range(m):",
"-ans = []",
"-cs = Counter(s)",
"-ct = Counter(t)",
"-for i in range(len(cs)):",
"- ans.append(cs.most_commo... | false | 0.036835 | 0.035665 | 1.03281 | [
"s327474290",
"s004296313"
] |
u740909619 | p02945 | python | s729356872 | s286864571 | 31 | 26 | 8,972 | 9,072 | Accepted | Accepted | 16.13 | # A - +-x
def main():
a, b = list(map(int, input().split()))
print((max([a+b, a-b, a*b])))
if __name__ == '__main__':
main() | # A - +-x
def main():
a, b = list(map(int, input().split()))
print((max(a+b, a-b, a*b)))
if __name__ == '__main__':
main() | 7 | 7 | 135 | 133 | # A - +-x
def main():
a, b = list(map(int, input().split()))
print((max([a + b, a - b, a * b])))
if __name__ == "__main__":
main()
| # A - +-x
def main():
a, b = list(map(int, input().split()))
print((max(a + b, a - b, a * b)))
if __name__ == "__main__":
main()
| false | 0 | [
"- print((max([a + b, a - b, a * b])))",
"+ print((max(a + b, a - b, a * b)))"
] | false | 0.040171 | 0.040031 | 1.003503 | [
"s729356872",
"s286864571"
] |
u818349438 | p03658 | python | s142130939 | s890446329 | 166 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.16 | n,k = list(map(int,input().split()))
l = list(map(int,input().split()))
l.sort(reverse = True)
sum = 0
for i in range(k):
sum+=l[i]
print(sum) | n,k = list(map(int,input().split()))
l = list(map(int,input().split()))
l.sort(reverse = True)
ans = sum(l[:k])
print(ans) | 8 | 5 | 148 | 120 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
sum = 0
for i in range(k):
sum += l[i]
print(sum)
| n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = sum(l[:k])
print(ans)
| false | 37.5 | [
"-sum = 0",
"-for i in range(k):",
"- sum += l[i]",
"-print(sum)",
"+ans = sum(l[:k])",
"+print(ans)"
] | false | 0.03507 | 0.034192 | 1.025659 | [
"s142130939",
"s890446329"
] |
u606045429 | p03157 | python | s325901353 | s392098210 | 803 | 374 | 151,924 | 4,844 | Accepted | Accepted | 53.42 | import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
H, W = [int(_) for _ in input().split()]
S = [eval(input()) for _ in range(H)]
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
visited = [[False] * W for _ in range(H)]
b, w = 0, 0
def dfs(i, j):
if visited[i][j]:
return (0, 0)
... | from collections import deque
H, W = [int(_) for _ in input().split()]
S = [eval(input()) for _ in range(H)]
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
visited = [[False] * W for _ in range(H)]
def bfs(i, j):
b, w = 0, 0
visited[i][j] = True
que = deque([(i, j)])
while que:
ci, ... | 41 | 38 | 810 | 875 | import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
H, W = [int(_) for _ in input().split()]
S = [eval(input()) for _ in range(H)]
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
visited = [[False] * W for _ in range(H)]
b, w = 0, 0
def dfs(i, j):
if visited[i][j]:
return (0, 0)
visited[i][... | from collections import deque
H, W = [int(_) for _ in input().split()]
S = [eval(input()) for _ in range(H)]
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
visited = [[False] * W for _ in range(H)]
def bfs(i, j):
b, w = 0, 0
visited[i][j] = True
que = deque([(i, j)])
while que:
ci, cj = que.poplef... | false | 7.317073 | [
"-import sys",
"+from collections import deque",
"-sys.setrecursionlimit(200000)",
"-input = sys.stdin.readline",
"-b, w = 0, 0",
"-def dfs(i, j):",
"- if visited[i][j]:",
"- return (0, 0)",
"+def bfs(i, j):",
"+ b, w = 0, 0",
"- if S[i][j] == \"#\":",
"- b, w = 1, 0",
... | false | 0.045066 | 0.047736 | 0.944055 | [
"s325901353",
"s392098210"
] |
u753803401 | p03162 | python | s572554341 | s402694430 | 301 | 274 | 53,996 | 45,420 | Accepted | Accepted | 8.97 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
dp = [[0] * 3 for _ in range(n)]
for i in range(n):
a, b, c = list(map(int, readline().split()))
if i == 0:
dp[i][0] = a
dp[i][1] = b
... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = [0] * n
b = [0] * n
c = [0] * n
for i in range(n):
av, bv, cv = list(map(int, readline().split()))
if i == 0:
a[i] = av
b[i] = bv
... | 23 | 25 | 597 | 587 | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
dp = [[0] * 3 for _ in range(n)]
for i in range(n):
a, b, c = list(map(int, readline().split()))
if i == 0:
dp[i][0] = a
dp[i][1] = b
dp[i][2] = c
... | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = [0] * n
b = [0] * n
c = [0] * n
for i in range(n):
av, bv, cv = list(map(int, readline().split()))
if i == 0:
a[i] = av
b[i] = bv
c[i] = ... | false | 8 | [
"- dp = [[0] * 3 for _ in range(n)]",
"+ a = [0] * n",
"+ b = [0] * n",
"+ c = [0] * n",
"- a, b, c = list(map(int, readline().split()))",
"+ av, bv, cv = list(map(int, readline().split()))",
"- dp[i][0] = a",
"- dp[i][1] = b",
"- dp[i][2] =... | false | 0.044524 | 0.0422 | 1.055077 | [
"s572554341",
"s402694430"
] |
u813450984 | p04045 | python | s122609494 | s424594026 | 155 | 101 | 3,060 | 2,940 | Accepted | Accepted | 34.84 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
nums = [i for i in range(10) if not i in l]
while True:
total = 0
for num in nums:
total += list(str(n)).count(str(num))
if total == len(list(str(n))):
print(n)
break
n += 1 | n, k = list(map(int, input().split()))
like = list(map(str, set(range(10)) - set(map(int, input().split()))))
while True:
count = 0
for c in str(n):
if c in like:
count += 1
if count == len(str(n)):
print(n)
break
n += 1 | 14 | 14 | 282 | 264 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
nums = [i for i in range(10) if not i in l]
while True:
total = 0
for num in nums:
total += list(str(n)).count(str(num))
if total == len(list(str(n))):
print(n)
break
n += 1
| n, k = list(map(int, input().split()))
like = list(map(str, set(range(10)) - set(map(int, input().split()))))
while True:
count = 0
for c in str(n):
if c in like:
count += 1
if count == len(str(n)):
print(n)
break
n += 1
| false | 0 | [
"-l = list(map(int, input().split()))",
"-nums = [i for i in range(10) if not i in l]",
"+like = list(map(str, set(range(10)) - set(map(int, input().split()))))",
"- total = 0",
"- for num in nums:",
"- total += list(str(n)).count(str(num))",
"- if total == len(list(str(n))):",
"+ c... | false | 0.060589 | 0.040272 | 1.504501 | [
"s122609494",
"s424594026"
] |
u018679195 | p03331 | python | s014727353 | s185895147 | 263 | 201 | 2,568 | 8,600 | Accepted | Accepted | 23.57 | #!/usr/bin/python
# -*- coding: utf-8 -*-
n=int(input())
maxv=n
for a in range(1,n):
b=n-a
if a>b: break
sa=sum([int(x) for x in str(a)])
sb=sum([int(x) for x in str(b)])
maxv=min(maxv, sa+sb)
print(maxv) | num = int(eval(input()))
def digitSum(n):
s = 0
while n!=0:
s += n%10
n //=10
return s
arr = []
rev_arr = []
for n in range(1,num):
arr.append(n)
rev_arr = arr[::-1]
final_arr = []
for n in range(num-1):
val = digitSum(arr[n]) + digitSum(rev_arr[n])
final_a... | 12 | 22 | 231 | 353 | #!/usr/bin/python
# -*- coding: utf-8 -*-
n = int(input())
maxv = n
for a in range(1, n):
b = n - a
if a > b:
break
sa = sum([int(x) for x in str(a)])
sb = sum([int(x) for x in str(b)])
maxv = min(maxv, sa + sb)
print(maxv)
| num = int(eval(input()))
def digitSum(n):
s = 0
while n != 0:
s += n % 10
n //= 10
return s
arr = []
rev_arr = []
for n in range(1, num):
arr.append(n)
rev_arr = arr[::-1]
final_arr = []
for n in range(num - 1):
val = digitSum(arr[n]) + digitSum(rev_arr[n])
final_arr.append(v... | false | 45.454545 | [
"-#!/usr/bin/python",
"-# -*- coding: utf-8 -*-",
"-n = int(input())",
"-maxv = n",
"-for a in range(1, n):",
"- b = n - a",
"- if a > b:",
"- break",
"- sa = sum([int(x) for x in str(a)])",
"- sb = sum([int(x) for x in str(b)])",
"- maxv = min(maxv, sa + sb)",
"-print(ma... | false | 0.143204 | 0.2838 | 0.504593 | [
"s014727353",
"s185895147"
] |
u392319141 | p02702 | python | s967397899 | s832850305 | 1,446 | 953 | 112,812 | 26,924 | Accepted | Accepted | 34.09 | import numpy as np
from numba import njit
S = eval(input())
MOD = 2019
dp = np.zeros(MOD, dtype=np.int64)
dp[0] = 1
@njit
def hoge(dp, s):
T = dp.copy()
dp[s:] = T[:-s]
dp[:s] = T[-s:]
ans = 0
for i, s in enumerate(S[::-1]):
hoge(dp, (int(s) * pow(10, i, MOD)) % MOD)
ans += dp[0]... | import numpy as np
S = eval(input())
MOD = 2019
dp = np.zeros(MOD, dtype=np.int64)
dp[0] = 1
def hoge(dp, s):
T = dp.copy()
dp[s:] = T[:-s]
dp[:s] = T[-s:]
ans = 0
for i, s in enumerate(S[::-1]):
hoge(dp, (int(s) * pow(10, i, MOD)) % MOD)
ans += dp[0]
dp[0] += 1
print(ans)
| 20 | 18 | 343 | 312 | import numpy as np
from numba import njit
S = eval(input())
MOD = 2019
dp = np.zeros(MOD, dtype=np.int64)
dp[0] = 1
@njit
def hoge(dp, s):
T = dp.copy()
dp[s:] = T[:-s]
dp[:s] = T[-s:]
ans = 0
for i, s in enumerate(S[::-1]):
hoge(dp, (int(s) * pow(10, i, MOD)) % MOD)
ans += dp[0]
dp[0] += 1... | import numpy as np
S = eval(input())
MOD = 2019
dp = np.zeros(MOD, dtype=np.int64)
dp[0] = 1
def hoge(dp, s):
T = dp.copy()
dp[s:] = T[:-s]
dp[:s] = T[-s:]
ans = 0
for i, s in enumerate(S[::-1]):
hoge(dp, (int(s) * pow(10, i, MOD)) % MOD)
ans += dp[0]
dp[0] += 1
print(ans)
| false | 10 | [
"-from numba import njit",
"-@njit"
] | false | 0.227087 | 0.26105 | 0.869898 | [
"s967397899",
"s832850305"
] |
u682730715 | p03146 | python | s655277095 | s052566900 | 75 | 21 | 7,880 | 3,316 | Accepted | Accepted | 72 | # coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
d = defaultdict(int)
s = int(eval(input()))
d[s] = 1
index = 1
while(1):
... | from collections import defaultdict, deque
s = int(eval(input()))
d = defaultdict(int)
d[s] = 1
index = 1
while(1):
if s % 2 == 0:
s = s // 2
else:
s = 3 * s + 1
index += 1
if d[s] == 1:
break
d[s] = 1
print(index)
| 29 | 15 | 465 | 245 | # coding: UTF-8
import sys
# sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
d = defaultdict(int)
s = int(eval(input()))
d[s] = 1
index = 1
while 1:
if s % 2 == 0:
... | from collections import defaultdict, deque
s = int(eval(input()))
d = defaultdict(int)
d[s] = 1
index = 1
while 1:
if s % 2 == 0:
s = s // 2
else:
s = 3 * s + 1
index += 1
if d[s] == 1:
break
d[s] = 1
print(index)
| false | 48.275862 | [
"-# coding: UTF-8",
"-import sys",
"+from collections import defaultdict, deque",
"-# sys.setrecursionlimit(n)",
"-import heapq",
"-import re",
"-import bisect",
"-import random",
"-import math",
"-import itertools",
"-from collections import defaultdict, deque",
"-from copy import deepcopy",
... | false | 0.081164 | 0.037088 | 2.188418 | [
"s655277095",
"s052566900"
] |
u968166680 | p02839 | python | s756016254 | s002826276 | 210 | 131 | 93,840 | 85,692 | Accepted | Accepted | 37.62 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, rea... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, rea... | 45 | 45 | 1,165 | 1,170 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, readline().split()... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, readline().split()... | false | 0 | [
"- M = 20000",
"+ M *= max(H, W)"
] | false | 0.101716 | 0.039821 | 2.554351 | [
"s756016254",
"s002826276"
] |
u221061152 | p02720 | python | s145096156 | s667150946 | 119 | 64 | 6,120 | 6,108 | Accepted | Accepted | 46.22 | from collections import deque
K = int(eval(input()))
if K<10:
print(K)
exit()
q = deque([1,2,3,4,5,6,7,8,9])
cnt = 9
while q:
n = q.popleft()
r = n % 10
n *= 10;
for i in range(10):
if abs(r - i) <= 1:
q.append(n + i)
cnt += 1
if cnt == K:
print((n... | from collections import deque
k = int(eval(input()))
if k <= 9:
print(k)
exit()
que = deque([1,2,3,4,5,6,7,8,9])
cnt = len(que)
while cnt < k:
x = que.popleft()
m = x%10
if m != 0:
que.append(10*x+m-1)
cnt+=1
if cnt == k: print((que.pop())); exit();
que.append(10*x+m)
cnt+=1... | 20 | 23 | 334 | 450 | from collections import deque
K = int(eval(input()))
if K < 10:
print(K)
exit()
q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
cnt = 9
while q:
n = q.popleft()
r = n % 10
n *= 10
for i in range(10):
if abs(r - i) <= 1:
q.append(n + i)
cnt += 1
if cnt == K:
... | from collections import deque
k = int(eval(input()))
if k <= 9:
print(k)
exit()
que = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
cnt = len(que)
while cnt < k:
x = que.popleft()
m = x % 10
if m != 0:
que.append(10 * x + m - 1)
cnt += 1
if cnt == k:
print((que.pop()))
... | false | 13.043478 | [
"-K = int(eval(input()))",
"-if K < 10:",
"- print(K)",
"+k = int(eval(input()))",
"+if k <= 9:",
"+ print(k)",
"-q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])",
"-cnt = 9",
"-while q:",
"- n = q.popleft()",
"- r = n % 10",
"- n *= 10",
"- for i in range(10):",
"- if abs(... | false | 0.090142 | 0.007418 | 12.151068 | [
"s145096156",
"s667150946"
] |
u644907318 | p02732 | python | s780898960 | s454438210 | 438 | 245 | 88,140 | 121,160 | Accepted | Accepted | 44.06 | N = int(eval(input()))
A = list(map(int,input().split()))
C = {}
for i in range(N):
if A[i] not in C:
C[A[i]] = 0
C[A[i]] += 1
K = 0
for j in C:
K += (C[j]*(C[j]-1))//2
for k in range(N):
j = A[k]
print((K-C[j]+1)) | N = int(eval(input()))
A = list(map(int,input().split()))
A.insert(0,0)
C = {i:0 for i in range(1,N+1)}
for i in range(1,N+1):
C[A[i]] += 1
tot = 0
for i in range(1,N+1):
tot += (C[i]*(C[i]-1))//2
for i in range(1,N+1):
c = C[A[i]]-1
ans = tot-(C[A[i]]*(C[A[i]]-1))//2+(c*(c-1))//2
print(... | 13 | 13 | 246 | 318 | N = int(eval(input()))
A = list(map(int, input().split()))
C = {}
for i in range(N):
if A[i] not in C:
C[A[i]] = 0
C[A[i]] += 1
K = 0
for j in C:
K += (C[j] * (C[j] - 1)) // 2
for k in range(N):
j = A[k]
print((K - C[j] + 1))
| N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
C = {i: 0 for i in range(1, N + 1)}
for i in range(1, N + 1):
C[A[i]] += 1
tot = 0
for i in range(1, N + 1):
tot += (C[i] * (C[i] - 1)) // 2
for i in range(1, N + 1):
c = C[A[i]] - 1
ans = tot - (C[A[i]] * (C[A[i]] - 1)) // 2 + (c... | false | 0 | [
"-C = {}",
"-for i in range(N):",
"- if A[i] not in C:",
"- C[A[i]] = 0",
"+A.insert(0, 0)",
"+C = {i: 0 for i in range(1, N + 1)}",
"+for i in range(1, N + 1):",
"-K = 0",
"-for j in C:",
"- K += (C[j] * (C[j] - 1)) // 2",
"-for k in range(N):",
"- j = A[k]",
"- print((K ... | false | 0.047374 | 0.088816 | 0.533395 | [
"s780898960",
"s454438210"
] |
u325282913 | p02844 | python | s028991174 | s193320244 | 894 | 178 | 66,620 | 3,344 | Accepted | Accepted | 80.09 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
tmp = str(i)
while len(tmp) < 3:
tmp = '0' + tmp
count = 0
target = S
for i in tmp:
target = target.replace(i,'')
for k in S:
if 3 <= count:
break
if k == tmp[count]:
... | N = int(eval(input()))
S = eval(input())
first_check = [0] * 10
ans = 0
for i in range(N):
if first_check[int(S[i])] == 1:
continue
second_check = [0] * 10
for k in range(i+1,N):
if second_check[int(S[k])] == 1:
continue
ans += len(set(list(S[k+1:])))
... | 19 | 15 | 381 | 379 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
tmp = str(i)
while len(tmp) < 3:
tmp = "0" + tmp
count = 0
target = S
for i in tmp:
target = target.replace(i, "")
for k in S:
if 3 <= count:
break
if k == tmp[count]:
c... | N = int(eval(input()))
S = eval(input())
first_check = [0] * 10
ans = 0
for i in range(N):
if first_check[int(S[i])] == 1:
continue
second_check = [0] * 10
for k in range(i + 1, N):
if second_check[int(S[k])] == 1:
continue
ans += len(set(list(S[k + 1 :])))
second... | false | 21.052632 | [
"+first_check = [0] * 10",
"-for i in range(1000):",
"- tmp = str(i)",
"- while len(tmp) < 3:",
"- tmp = \"0\" + tmp",
"- count = 0",
"- target = S",
"- for i in tmp:",
"- target = target.replace(i, \"\")",
"- for k in S:",
"- if 3 <= count:",
"- ... | false | 0.032102 | 0.035872 | 0.89492 | [
"s028991174",
"s193320244"
] |
u371763408 | p03425 | python | s614528505 | s691004784 | 181 | 156 | 10,872 | 9,780 | Accepted | Accepted | 13.81 | from collections import Counter
import itertools
ans=0
n=int(eval(input()))
ls=["M","A","R","C","H"]
S=Counter([i for i in list([x[0] for x in [eval(input()) for i in range(n)]]) if i in ls])
for i in itertools.combinations(list(S.values()),3):
ans+=i[0]*i[1]*i[2]
print(ans)
| # from collections import Counter
import itertools
ans=0
n=int(eval(input()))
ls=["M","A","R","C","H"]
# S=Counter([i for i in list(map(lambda x:x[0] ,[input() for i in range(n)])) if i in ls])
S = [eval(input()) for _ in range(n)]
# for i in itertools.combinations(S.values(),3):
# ans+=i[0]*i[1]*i[2]
# prin... | 10 | 20 | 274 | 502 | from collections import Counter
import itertools
ans = 0
n = int(eval(input()))
ls = ["M", "A", "R", "C", "H"]
S = Counter(
[i for i in list([x[0] for x in [eval(input()) for i in range(n)]]) if i in ls]
)
for i in itertools.combinations(list(S.values()), 3):
ans += i[0] * i[1] * i[2]
print(ans)
| # from collections import Counter
import itertools
ans = 0
n = int(eval(input()))
ls = ["M", "A", "R", "C", "H"]
# S=Counter([i for i in list(map(lambda x:x[0] ,[input() for i in range(n)])) if i in ls])
S = [eval(input()) for _ in range(n)]
# for i in itertools.combinations(S.values(),3):
# ans+=i[0]*i[1]*i[2]
# pr... | false | 50 | [
"-from collections import Counter",
"+# from collections import Counter",
"-S = Counter(",
"- [i for i in list([x[0] for x in [eval(input()) for i in range(n)]]) if i in ls]",
"-)",
"-for i in itertools.combinations(list(S.values()), 3):",
"- ans += i[0] * i[1] * i[2]",
"+# S=Counter([i for i in... | false | 0.04834 | 0.079925 | 0.604815 | [
"s614528505",
"s691004784"
] |
u196746947 | p02695 | python | s831320949 | s789989358 | 1,384 | 889 | 9,164 | 9,212 | Accepted | Accepted | 35.77 | import itertools
n,m,q=list(map(int,input().split()))
Se=[]
for i in range(q):
Se.append(tuple(map(int,input().split())))
#print(Se)
integerset={i for i in range(1,m+1)}
#print(integerset)
everyset=itertools.combinations_with_replacement(integerset,n)
max=0
for v in everyset:
# print(v)
# print(le... | import itertools
def main():
n,m,q=list(map(int,input().split()))
Se=[]
for i in range(q):
Se.append(tuple(map(int,input().split())))
#print(Se)
integerset={i for i in range(1,m+1)}
#print(integerset)
everyset=itertools.combinations_with_replacement(integerset,n)
max=0
... | 21 | 24 | 502 | 626 | import itertools
n, m, q = list(map(int, input().split()))
Se = []
for i in range(q):
Se.append(tuple(map(int, input().split())))
# print(Se)
integerset = {i for i in range(1, m + 1)}
# print(integerset)
everyset = itertools.combinations_with_replacement(integerset, n)
max = 0
for v in everyset:
# print(v)
... | import itertools
def main():
n, m, q = list(map(int, input().split()))
Se = []
for i in range(q):
Se.append(tuple(map(int, input().split())))
# print(Se)
integerset = {i for i in range(1, m + 1)}
# print(integerset)
everyset = itertools.combinations_with_replacement(integerset, n)
... | false | 12.5 | [
"-n, m, q = list(map(int, input().split()))",
"-Se = []",
"-for i in range(q):",
"- Se.append(tuple(map(int, input().split())))",
"-# print(Se)",
"-integerset = {i for i in range(1, m + 1)}",
"-# print(integerset)",
"-everyset = itertools.combinations_with_replacement(integerset, n)",
"-max = 0",... | false | 0.064136 | 0.057943 | 1.106867 | [
"s831320949",
"s789989358"
] |
u222668979 | p02584 | python | s881824235 | s964175482 | 79 | 64 | 61,776 | 61,912 | Accepted | Accepted | 18.99 | x, k, d = list(map(int, input().split()))
x, cnt = abs(x), abs(x) // d
if k % 2 == cnt % 2:
ans = abs(x - d * min(k,cnt))
elif k % 2 != cnt % 2:
ans = abs(x - d * min(k,(cnt + 1)))
print(ans)
| x, k, d = list(map(int, input().split()))
x, cnt = abs(x), abs(x) // d
ans = abs(x - d * min(k, cnt + (k % 2 != cnt % 2)))
print(ans)
| 8 | 5 | 202 | 133 | x, k, d = list(map(int, input().split()))
x, cnt = abs(x), abs(x) // d
if k % 2 == cnt % 2:
ans = abs(x - d * min(k, cnt))
elif k % 2 != cnt % 2:
ans = abs(x - d * min(k, (cnt + 1)))
print(ans)
| x, k, d = list(map(int, input().split()))
x, cnt = abs(x), abs(x) // d
ans = abs(x - d * min(k, cnt + (k % 2 != cnt % 2)))
print(ans)
| false | 37.5 | [
"-if k % 2 == cnt % 2:",
"- ans = abs(x - d * min(k, cnt))",
"-elif k % 2 != cnt % 2:",
"- ans = abs(x - d * min(k, (cnt + 1)))",
"+ans = abs(x - d * min(k, cnt + (k % 2 != cnt % 2)))"
] | false | 0.048511 | 0.040694 | 1.192092 | [
"s881824235",
"s964175482"
] |
u223663729 | p02588 | python | s130407929 | s814338666 | 335 | 198 | 114,572 | 74,072 | Accepted | Accepted | 40.9 | N, *A = open(0).read().split()
class BIT():
def __init__(self, n, x=1):
self.n = n
self.T = [[0]*20 for _ in [0]*20]
def add(self, i, y, x):
i += 1
y += 1
while i <= self.n:
j = y
while j <= self.n:
self.T[i][j] += ... | import sys
input = sys.stdin.readline
N = int(eval(input()))
T = [[0]*19 for _ in [0]*19]
def count25(x):
c2 = c5 = 0
while x % 2 == 0:
x //= 2
c2 += 1
while x % 5 == 0:
x //= 5
c5 += 1
return c2, c5
for _ in range(N):
a, *b = input().split('.')
... | 78 | 40 | 1,521 | 819 | N, *A = open(0).read().split()
class BIT:
def __init__(self, n, x=1):
self.n = n
self.T = [[0] * 20 for _ in [0] * 20]
def add(self, i, y, x):
i += 1
y += 1
while i <= self.n:
j = y
while j <= self.n:
self.T[i][j] += x
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
T = [[0] * 19 for _ in [0] * 19]
def count25(x):
c2 = c5 = 0
while x % 2 == 0:
x //= 2
c2 += 1
while x % 5 == 0:
x //= 5
c5 += 1
return c2, c5
for _ in range(N):
a, *b = input().split(".")
x = int(a... | false | 48.717949 | [
"-N, *A = open(0).read().split()",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+N = int(eval(input()))",
"+T = [[0] * 19 for _ in [0] * 19]",
"-class BIT:",
"- def __init__(self, n, x=1):",
"- self.n = n",
"- self.T = [[0] * 20 for _ in [0] * 20]",
"-",
"- def add(s... | false | 0.037745 | 0.037398 | 1.009298 | [
"s130407929",
"s814338666"
] |
u721316601 | p03634 | python | s302879318 | s620321291 | 1,472 | 677 | 47,024 | 47,032 | Accepted | Accepted | 54.01 | import heapq
N = int(eval(input()))
graph = [[] for i in range(N+1)]
visited = [False] * (N+1)
cost = [10**20 for i in range(N+1)]
for i in range(N-1):
a, b, c = list(map(int, input().split()))
graph[a].append((c, b))
graph[b].append((c, a))
Q, K = list(map(int, input().split()))
q = []
... | import sys
from heapq import heappush, heappop, heapify
input = sys.stdin.readline
def main():
N = int(eval(input()))
g = [[] for i in range(N)]
for i in range(N-1):
a, b, c = list(map(int, input().split()))
a -= 1; b -= 1
g[a].append((c, b))
g[b].append((c,... | 34 | 41 | 736 | 927 | import heapq
N = int(eval(input()))
graph = [[] for i in range(N + 1)]
visited = [False] * (N + 1)
cost = [10**20 for i in range(N + 1)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
graph[a].append((c, b))
graph[b].append((c, a))
Q, K = list(map(int, input().split()))
q = []
for cr in g... | import sys
from heapq import heappush, heappop, heapify
input = sys.stdin.readline
def main():
N = int(eval(input()))
g = [[] for i in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
g[a].append((c, b))
g[b].append((c, a))
... | false | 17.073171 | [
"-import heapq",
"+import sys",
"+from heapq import heappush, heappop, heapify",
"-N = int(eval(input()))",
"-graph = [[] for i in range(N + 1)]",
"-visited = [False] * (N + 1)",
"-cost = [10**20 for i in range(N + 1)]",
"-for i in range(N - 1):",
"- a, b, c = list(map(int, input().split()))",
... | false | 0.038594 | 0.038594 | 0.999995 | [
"s302879318",
"s620321291"
] |
u844945939 | p00117 | python | s735233690 | s719742465 | 40 | 30 | 6,752 | 6,776 | Accepted | Accepted | 25 | INF = 1000000
def bellman_ford(graph, source):
lg = len(graph)
unused = list(range(lg))
d = [INF] * (lg)
d[source] = 0
while unused:
v = min(unused, key=lambda u: d[u])
unused.remove(v)
for u in range(n + 1):
d[u] = min(d[u], d[v] + graph[v][u])
... | INF = 1e12
def dijkstra(graph, source):
lg = len(graph)
unused = list(range(lg))
d = [INF] * (lg)
d[source] = 0
while unused:
v = min(unused, key=lambda u: d[u])
unused.remove(v)
for u in range(n + 1):
d[u] = min(d[u], d[v] + graph[v][u])
re... | 32 | 32 | 695 | 680 | INF = 1000000
def bellman_ford(graph, source):
lg = len(graph)
unused = list(range(lg))
d = [INF] * (lg)
d[source] = 0
while unused:
v = min(unused, key=lambda u: d[u])
unused.remove(v)
for u in range(n + 1):
d[u] = min(d[u], d[v] + graph[v][u])
return d
n... | INF = 1e12
def dijkstra(graph, source):
lg = len(graph)
unused = list(range(lg))
d = [INF] * (lg)
d[source] = 0
while unused:
v = min(unused, key=lambda u: d[u])
unused.remove(v)
for u in range(n + 1):
d[u] = min(d[u], d[v] + graph[v][u])
return d
n = int(... | false | 0 | [
"-INF = 1000000",
"+INF = 1e12",
"-def bellman_ford(graph, source):",
"+def dijkstra(graph, source):",
"-d_go = bellman_ford(cost, x1)[x2]",
"-d_back = bellman_ford(cost, x2)[x1]",
"+d_go = dijkstra(cost, x1)[x2]",
"+d_back = dijkstra(cost, x2)[x1]"
] | false | 0.037399 | 0.038688 | 0.966697 | [
"s735233690",
"s719742465"
] |
u525065967 | p02574 | python | s546911090 | s920266020 | 480 | 393 | 126,956 | 127,520 | Accepted | Accepted | 18.12 | from functools import reduce
def gen_d_prim(n):
D = [0] * (n+1)
for i in range(2, n+1):
if D[i] > 0: continue
for j in range(i, n+1, i): D[j] = i
return D
def is_pairwise(A):
D = gen_d_prim(10**6)
past = set()
for a in A:
now = set()
while a != 1:
... | from functools import reduce
def is_pairwise():
MAX_A = 10**6 + 1
C = [0] * MAX_A
for a in A: C[a] += 1
if sum(C[2::2]) > 1: return False
for i in range(3, MAX_A, 2):
if sum(C[i::i]) > 1: return False
return True
def solve():
from functools import reduce
from math imp... | 30 | 19 | 756 | 494 | from functools import reduce
def gen_d_prim(n):
D = [0] * (n + 1)
for i in range(2, n + 1):
if D[i] > 0:
continue
for j in range(i, n + 1, i):
D[j] = i
return D
def is_pairwise(A):
D = gen_d_prim(10**6)
past = set()
for a in A:
now = set()
... | from functools import reduce
def is_pairwise():
MAX_A = 10**6 + 1
C = [0] * MAX_A
for a in A:
C[a] += 1
if sum(C[2::2]) > 1:
return False
for i in range(3, MAX_A, 2):
if sum(C[i::i]) > 1:
return False
return True
def solve():
from functools import redu... | false | 36.666667 | [
"-def gen_d_prim(n):",
"- D = [0] * (n + 1)",
"- for i in range(2, n + 1):",
"- if D[i] > 0:",
"- continue",
"- for j in range(i, n + 1, i):",
"- D[j] = i",
"- return D",
"-",
"-",
"-def is_pairwise(A):",
"- D = gen_d_prim(10**6)",
"- past =... | false | 0.601831 | 0.221407 | 2.718212 | [
"s546911090",
"s920266020"
] |
u150984829 | p02386 | python | s935662517 | s798215108 | 200 | 80 | 5,616 | 5,616 | Accepted | Accepted | 60 | n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
b=a[k];b[3],b[4]=b[4],b[3]
t=0
for i in range(n-1):
d=a[i]
for j in range(i+1,n):
e=a[j]
if d==e:t=1;break
for p in('152043','215304','302541','410352','514320'):
f=[d[int(k)]for k in p]
if f[0]==e[0]a... | n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
b=a[k];b[3],b[4]=b[4],b[3]
t=0
for i in range(n-1):
if t==1:break
d=a[i]
for j in range(i+1,n):
if t==1:break
e=a[j]
for p in('012345','152043','215304','302541','410352','514320'):
if t==1:break
f=[... | 17 | 19 | 423 | 468 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for k in range(n):
b = a[k]
b[3], b[4] = b[4], b[3]
t = 0
for i in range(n - 1):
d = a[i]
for j in range(i + 1, n):
e = a[j]
if d == e:
t = 1
break
for p in ("152043", "215304",... | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for k in range(n):
b = a[k]
b[3], b[4] = b[4], b[3]
t = 0
for i in range(n - 1):
if t == 1:
break
d = a[i]
for j in range(i + 1, n):
if t == 1:
break
e = a[j]
for p in ("012345"... | false | 10.526316 | [
"+ if t == 1:",
"+ break",
"+ if t == 1:",
"+ break",
"- if d == e:",
"- t = 1",
"- break",
"- for p in (\"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):",
"+ for p in (\"012345\", \"152043\", \"215304\", \"302541\", ... | false | 0.096789 | 0.067674 | 1.43022 | [
"s935662517",
"s798215108"
] |
u513434790 | p02596 | python | s467650810 | s978660832 | 379 | 199 | 63,608 | 9,120 | Accepted | Accepted | 47.49 | import sys
K = int(eval(input()))
seven = 0
for i in range(K+2):
seven += (7 * pow(10, i, K)) % K
seven %= K
if seven == 0:
print((i+1))
sys.exit()
print((-1)) | import sys
K = int(eval(input()))
seven = 7
seven %= K
for i in range(K+2):
if seven == 0:
print((i+1))
sys.exit()
seven = seven * 10 + 7
seven %= K
print((-1)) | 13 | 14 | 196 | 194 | import sys
K = int(eval(input()))
seven = 0
for i in range(K + 2):
seven += (7 * pow(10, i, K)) % K
seven %= K
if seven == 0:
print((i + 1))
sys.exit()
print((-1))
| import sys
K = int(eval(input()))
seven = 7
seven %= K
for i in range(K + 2):
if seven == 0:
print((i + 1))
sys.exit()
seven = seven * 10 + 7
seven %= K
print((-1))
| false | 7.142857 | [
"-seven = 0",
"+seven = 7",
"+seven %= K",
"- seven += (7 * pow(10, i, K)) % K",
"- seven %= K",
"+ seven = seven * 10 + 7",
"+ seven %= K"
] | false | 0.672228 | 0.105898 | 6.347884 | [
"s467650810",
"s978660832"
] |
u156815136 | p02823 | python | s352202671 | s471249815 | 49 | 18 | 5,660 | 3,060 | Accepted | Accepted | 63.27 | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
#from collections import defaultdict
#import bisect
#
# d = m - ... | 34 | 31 | 756 | 736 | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
# from collections import defaultdict
# import bisect
#
# d = m - k... | false | 8.823529 | [
"-from statistics import median",
"-",
"+# from statistics import median",
"-from fractions import gcd",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"-from collections import defaultdict",
"-import bisect",
"-",
"+# from fractions import gcd",
"+# fr... | false | 0.076198 | 0.052738 | 1.444848 | [
"s352202671",
"s471249815"
] |
u241159583 | p03937 | python | s899908817 | s709527422 | 24 | 20 | 3,060 | 3,060 | Accepted | Accepted | 16.67 | H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
ans = 0
for i in range(H):
ans += A[i].count("#")
print(("Possible" if ans == H + W - 1 else "Impossible")) | H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
cnt = 0
for i in range(H):
cnt += A[i].count("#")
print(("Possible" if cnt == H + W - 1 else "Impossible")) | 7 | 7 | 186 | 185 | H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
ans = 0
for i in range(H):
ans += A[i].count("#")
print(("Possible" if ans == H + W - 1 else "Impossible"))
| H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
cnt = 0
for i in range(H):
cnt += A[i].count("#")
print(("Possible" if cnt == H + W - 1 else "Impossible"))
| false | 0 | [
"-ans = 0",
"+cnt = 0",
"- ans += A[i].count(\"#\")",
"-print((\"Possible\" if ans == H + W - 1 else \"Impossible\"))",
"+ cnt += A[i].count(\"#\")",
"+print((\"Possible\" if cnt == H + W - 1 else \"Impossible\"))"
] | false | 0.043233 | 0.034503 | 1.253016 | [
"s899908817",
"s709527422"
] |
u188827677 | p02791 | python | s256473664 | s115720020 | 114 | 95 | 24,744 | 24,744 | Accepted | Accepted | 16.67 | n = int(eval(input()))
p = list(map(int, input().split()))
count = 0
a = p[0]
for i in range(n):
if a >= p[i]:
a = p[i]
count+=1
print(count)
| n = int(eval(input()))
p = list(map(int, input().split()))
t = p[0]
ans = 0
for i in p:
if i <= t:
ans += 1
t = i
print(ans) | 10 | 11 | 156 | 140 | n = int(eval(input()))
p = list(map(int, input().split()))
count = 0
a = p[0]
for i in range(n):
if a >= p[i]:
a = p[i]
count += 1
print(count)
| n = int(eval(input()))
p = list(map(int, input().split()))
t = p[0]
ans = 0
for i in p:
if i <= t:
ans += 1
t = i
print(ans)
| false | 9.090909 | [
"-count = 0",
"-a = p[0]",
"-for i in range(n):",
"- if a >= p[i]:",
"- a = p[i]",
"- count += 1",
"-print(count)",
"+t = p[0]",
"+ans = 0",
"+for i in p:",
"+ if i <= t:",
"+ ans += 1",
"+ t = i",
"+print(ans)"
] | false | 0.040659 | 0.068519 | 0.593387 | [
"s256473664",
"s115720020"
] |
u889914341 | p03229 | python | s739824203 | s950107526 | 227 | 98 | 7,504 | 7,400 | Accepted | Accepted | 56.83 | def solve():
n = int(eval(input()))
a = sorted(int(eval(input())) for _ in range(n))
c0 = n // 2 - 1
c1 = n // 2
c2 = n // 2 + 1
ans = 0
if n & 1:
for i in range(c0):
ans -= a[i] * 2
for i in range(c2 + 1, n):
ans += a[i] * 2
ans +=... | import sys
readline = sys.stdin.readline
def solve():
n = int(eval(input()))
a = sorted(int(readline()) for _ in range(n))
c0 = n // 2 - 1
c1 = n // 2
c2 = n // 2 + 1
ans = 0
if n & 1:
ans = sum(a[c2 + 1:]) * 2 - sum(a[:c0]) * 2 - a[c0] + a[c2] + max(-a[c0] + a[c1], - a[c1]... | 21 | 15 | 560 | 436 | def solve():
n = int(eval(input()))
a = sorted(int(eval(input())) for _ in range(n))
c0 = n // 2 - 1
c1 = n // 2
c2 = n // 2 + 1
ans = 0
if n & 1:
for i in range(c0):
ans -= a[i] * 2
for i in range(c2 + 1, n):
ans += a[i] * 2
ans += -a[c0] + a[... | import sys
readline = sys.stdin.readline
def solve():
n = int(eval(input()))
a = sorted(int(readline()) for _ in range(n))
c0 = n // 2 - 1
c1 = n // 2
c2 = n // 2 + 1
ans = 0
if n & 1:
ans = (
sum(a[c2 + 1 :]) * 2
- sum(a[:c0]) * 2
- a[c0]
... | false | 28.571429 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+",
"+",
"- a = sorted(int(eval(input())) for _ in range(n))",
"+ a = sorted(int(readline()) for _ in range(n))",
"- for i in range(c0):",
"- ans -= a[i] * 2",
"- for i in range(c2 + 1, n):",
"- ans ... | false | 0.064279 | 0.070344 | 0.913785 | [
"s739824203",
"s950107526"
] |
u058781705 | p03293 | python | s495375923 | s011995681 | 172 | 71 | 38,384 | 61,876 | Accepted | Accepted | 58.72 |
def rolling(str, n):
return str[n:len(str)] + str[:n]
def solve():
S = eval(input())
T = eval(input())
for i in range(len(S)):
if rolling(S, i) == T:
print("Yes")
exit()
print("No")
# Solve
if __name__ == "__main__":
solve()
| def rolling(str, n):
return str[n:len(str)] + str[:n]
S = eval(input())
T = eval(input())
for i in range(len(S)):
if rolling(S, i) == T:
print("Yes")
exit()
print("No")
| 23 | 12 | 301 | 195 | def rolling(str, n):
return str[n : len(str)] + str[:n]
def solve():
S = eval(input())
T = eval(input())
for i in range(len(S)):
if rolling(S, i) == T:
print("Yes")
exit()
print("No")
# Solve
if __name__ == "__main__":
solve()
| def rolling(str, n):
return str[n : len(str)] + str[:n]
S = eval(input())
T = eval(input())
for i in range(len(S)):
if rolling(S, i) == T:
print("Yes")
exit()
print("No")
| false | 47.826087 | [
"-def solve():",
"- S = eval(input())",
"- T = eval(input())",
"- for i in range(len(S)):",
"- if rolling(S, i) == T:",
"- print(\"Yes\")",
"- exit()",
"- print(\"No\")",
"-",
"-",
"-# Solve",
"-if __name__ == \"__main__\":",
"- solve()",
"+S = e... | false | 0.055124 | 0.054035 | 1.020144 | [
"s495375923",
"s011995681"
] |
u777283665 | p03723 | python | s647549963 | s624649566 | 164 | 17 | 38,384 | 3,064 | Accepted | Accepted | 89.63 | a, b, c = list(map(int, input().split()))
ab = abs(a-b)
bc = abs(b-c)
if a == b == c:
if a % 2 == 0:
print((-1))
exit()
else:
print((0))
exit()
count = 0
while True:
if ab % 2 != 0 or bc % 2 != 0:
break
else:
ab = ab // 2
bc = bc // 2
count += 1
print(co... | c = list(map(int, input().split()))
if len(set(c)) == 1 and c[0] % 2 == 0:
print((-1))
exit()
cnt = 0
while c[0] % 2 != 1 and c[1] % 2 != 1 and c[2] % 2 != 1:
c = [c[1]/2 + c[2]/2, c[0]/2 + c[2]/2, c[0]/2 + c[1]/2]
cnt += 1
print(cnt) | 23 | 11 | 314 | 260 | a, b, c = list(map(int, input().split()))
ab = abs(a - b)
bc = abs(b - c)
if a == b == c:
if a % 2 == 0:
print((-1))
exit()
else:
print((0))
exit()
count = 0
while True:
if ab % 2 != 0 or bc % 2 != 0:
break
else:
ab = ab // 2
bc = bc // 2
c... | c = list(map(int, input().split()))
if len(set(c)) == 1 and c[0] % 2 == 0:
print((-1))
exit()
cnt = 0
while c[0] % 2 != 1 and c[1] % 2 != 1 and c[2] % 2 != 1:
c = [c[1] / 2 + c[2] / 2, c[0] / 2 + c[2] / 2, c[0] / 2 + c[1] / 2]
cnt += 1
print(cnt)
| false | 52.173913 | [
"-a, b, c = list(map(int, input().split()))",
"-ab = abs(a - b)",
"-bc = abs(b - c)",
"-if a == b == c:",
"- if a % 2 == 0:",
"- print((-1))",
"- exit()",
"- else:",
"- print((0))",
"- exit()",
"-count = 0",
"-while True:",
"- if ab % 2 != 0 or bc % 2 != ... | false | 0.041933 | 0.036379 | 1.152697 | [
"s647549963",
"s624649566"
] |
u368796742 | p03464 | python | s612967820 | s704003462 | 105 | 97 | 20,236 | 20,604 | Accepted | Accepted | 7.62 | k = int(eval(input()))
a = list(map(int,input().split()))
if a[-1] != 2:
print((-1))
exit()
l = 2
r = 3
for i in a[::-1][1:]:
if i > r:
print((-1))
exit()
l = (l+i-1)//i*i
r = r//i*i+i-1
if r < l:
print((-1))
exit()
print((l,r)) | k = int(eval(input()))
a = list(map(int,input().split()))
l = 2
r = 2
for i in a[::-1]:
if i > r:
print((-1))
exit()
l = (l+i-1)//i*i
r = r//i*i+i-1
if r < l:
print((-1))
exit()
print((l,r)) | 18 | 15 | 288 | 241 | k = int(eval(input()))
a = list(map(int, input().split()))
if a[-1] != 2:
print((-1))
exit()
l = 2
r = 3
for i in a[::-1][1:]:
if i > r:
print((-1))
exit()
l = (l + i - 1) // i * i
r = r // i * i + i - 1
if r < l:
print((-1))
exit()
print((l, r))
| k = int(eval(input()))
a = list(map(int, input().split()))
l = 2
r = 2
for i in a[::-1]:
if i > r:
print((-1))
exit()
l = (l + i - 1) // i * i
r = r // i * i + i - 1
if r < l:
print((-1))
exit()
print((l, r))
| false | 16.666667 | [
"-if a[-1] != 2:",
"- print((-1))",
"- exit()",
"-r = 3",
"-for i in a[::-1][1:]:",
"+r = 2",
"+for i in a[::-1]:"
] | false | 0.043902 | 0.046847 | 0.937131 | [
"s612967820",
"s704003462"
] |
u733814820 | p02994 | python | s488425208 | s572419223 | 149 | 17 | 12,504 | 3,060 | Accepted | Accepted | 88.59 | import numpy as np
def resolve():
n, l = list(map(int, input().split()))
arr = []
for i in range(n):
arr.append(i + l)
yotei = sum(arr)
ans = abs(yotei - arr[0])
sa = abs(yotei - (yotei - arr[0]))
for i in range(n):
if (sa > abs(yotei - (yotei - arr[i]))):
sa = abs(yotei - (... | INF = 1001001001
def resolve():
n, l = list(map(int, input().split()))
base = 0
for i in range(1, n+1):
base += l + i - 1
ans = 0
sa = INF
for i in range(1, n+1):
tmp = base - (l + i - 1)
if abs(base - tmp) <= sa:
ans = tmp
sa = abs(base - tmp)
print(ans)
retu... | 23 | 21 | 430 | 360 | import numpy as np
def resolve():
n, l = list(map(int, input().split()))
arr = []
for i in range(n):
arr.append(i + l)
yotei = sum(arr)
ans = abs(yotei - arr[0])
sa = abs(yotei - (yotei - arr[0]))
for i in range(n):
if sa > abs(yotei - (yotei - arr[i])):
sa = ab... | INF = 1001001001
def resolve():
n, l = list(map(int, input().split()))
base = 0
for i in range(1, n + 1):
base += l + i - 1
ans = 0
sa = INF
for i in range(1, n + 1):
tmp = base - (l + i - 1)
if abs(base - tmp) <= sa:
ans = tmp
sa = abs(base - tm... | false | 8.695652 | [
"-import numpy as np",
"+INF = 1001001001",
"- arr = []",
"- for i in range(n):",
"- arr.append(i + l)",
"- yotei = sum(arr)",
"- ans = abs(yotei - arr[0])",
"- sa = abs(yotei - (yotei - arr[0]))",
"- for i in range(n):",
"- if sa > abs(yotei - (yotei - arr[i])):",
... | false | 0.03677 | 0.05397 | 0.681295 | [
"s488425208",
"s572419223"
] |
u607074939 | p02708 | python | s442804206 | s820622250 | 70 | 21 | 9,160 | 9,176 | Accepted | Accepted | 70 | N,K = list(map(int,input().split()))
s = 0
for i in range(K,N+2):
s += i*N +1 - i*(i -1)
print((s%(10**9 +7))) | N,K = list(map(int,input().split()))
s = int( (N*(N+1)*(N+2))/6 - (K*(K-1)*(3*N-2*K+4))/6 + N-K+2 )
print((s%(10**9 + 7))) | 8 | 5 | 116 | 122 | N, K = list(map(int, input().split()))
s = 0
for i in range(K, N + 2):
s += i * N + 1 - i * (i - 1)
print((s % (10**9 + 7)))
| N, K = list(map(int, input().split()))
s = int(
(N * (N + 1) * (N + 2)) / 6 - (K * (K - 1) * (3 * N - 2 * K + 4)) / 6 + N - K + 2
)
print((s % (10**9 + 7)))
| false | 37.5 | [
"-s = 0",
"-for i in range(K, N + 2):",
"- s += i * N + 1 - i * (i - 1)",
"+s = int(",
"+ (N * (N + 1) * (N + 2)) / 6 - (K * (K - 1) * (3 * N - 2 * K + 4)) / 6 + N - K + 2",
"+)"
] | false | 0.066778 | 0.076532 | 0.872555 | [
"s442804206",
"s820622250"
] |
u887207211 | p03125 | python | s878809760 | s894092625 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | def ans():
a, b = list(map(int,input().split()))
if(b%a == 0):
print((a+b))
else:
print((b-a))
ans() | A, B = list(map(int,input().split()))
if(B%A == 0):
print((A+B))
else:
print((B-A)) | 7 | 5 | 110 | 81 | def ans():
a, b = list(map(int, input().split()))
if b % a == 0:
print((a + b))
else:
print((b - a))
ans()
| A, B = list(map(int, input().split()))
if B % A == 0:
print((A + B))
else:
print((B - A))
| false | 28.571429 | [
"-def ans():",
"- a, b = list(map(int, input().split()))",
"- if b % a == 0:",
"- print((a + b))",
"- else:",
"- print((b - a))",
"-",
"-",
"-ans()",
"+A, B = list(map(int, input().split()))",
"+if B % A == 0:",
"+ print((A + B))",
"+else:",
"+ print((B - A))"
... | false | 0.054163 | 0.046832 | 1.156548 | [
"s878809760",
"s894092625"
] |
u133936772 | p02660 | python | s401959897 | s926876836 | 218 | 124 | 20,208 | 9,436 | Accepted | Accepted | 43.12 | n=int(eval(input()))
int_sqrt=lambda x:int(x**0.5)+1
def sieve(x):
p=[]
b=[1]*x
for i in range(2,x):
if b[i]:
p+=[i]
for j in range(2*i,x,i): b[j]=0
return p
def prime_factor(x):
d={}
for i in p:
while x%i<1:
x//=i
d[i]=d.get(i,0)+1
if x<2: break
if x... | n=int(eval(input()))
int_sqrt=lambda x:int(x**0.5)+1
def prime_factor(x):
d={}
for i in p:
while x%i<1:
x//=i
d[i]=d.get(i,0)+1
if x<2: break
if x>1: d[x]=1
return d
p=list(range(2,int_sqrt(n)))
d=prime_factor(n)
a=0
for i in list(d.values()):
t=c=0
while t+c<i: c+=1;... | 29 | 21 | 460 | 325 | n = int(eval(input()))
int_sqrt = lambda x: int(x**0.5) + 1
def sieve(x):
p = []
b = [1] * x
for i in range(2, x):
if b[i]:
p += [i]
for j in range(2 * i, x, i):
b[j] = 0
return p
def prime_factor(x):
d = {}
for i in p:
while x % i < 1:... | n = int(eval(input()))
int_sqrt = lambda x: int(x**0.5) + 1
def prime_factor(x):
d = {}
for i in p:
while x % i < 1:
x //= i
d[i] = d.get(i, 0) + 1
if x < 2:
break
if x > 1:
d[x] = 1
return d
p = list(range(2, int_sqrt(n)))
d = prime_factor... | false | 27.586207 | [
"-",
"-",
"-def sieve(x):",
"- p = []",
"- b = [1] * x",
"- for i in range(2, x):",
"- if b[i]:",
"- p += [i]",
"- for j in range(2 * i, x, i):",
"- b[j] = 0",
"- return p",
"-p = sieve(int_sqrt(n))",
"+p = list(range(2, int_sqrt(n)))"
... | false | 0.240344 | 0.064226 | 3.742151 | [
"s401959897",
"s926876836"
] |
u562935282 | p02971 | python | s363000685 | s834770548 | 733 | 340 | 15,656 | 35,020 | Accepted | Accepted | 53.62 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
left = [0] * n
for i in range(n):
if i == 0:
left[i] = a[i]
else:
left[i] = max(left[i - 1], a[i])
right = [0] * n
for i in range(n - 1, -1, -1):
if i == n - 1:
right[i] = a[i]
else:
right[... | def main():
from operator import itemgetter
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
it = iter(sorted(enumerate(A, start=1), key=itemgetter(1), reverse=True))
i, ma1 = next(it)
_, ma2 = next(it)
for j in ra... | 24 | 21 | 508 | 450 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
left = [0] * n
for i in range(n):
if i == 0:
left[i] = a[i]
else:
left[i] = max(left[i - 1], a[i])
right = [0] * n
for i in range(n - 1, -1, -1):
if i == n - 1:
right[i] = a[i]
else:
right[i] = max(right[i ... | def main():
from operator import itemgetter
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
it = iter(sorted(enumerate(A, start=1), key=itemgetter(1), reverse=True))
i, ma1 = next(it)
_, ma2 = next(it)
for j in range(1, N + 1):... | false | 12.5 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"-left = [0] * n",
"-for i in range(n):",
"- if i == 0:",
"- left[i] = a[i]",
"- else:",
"- left[i] = max(left[i - 1], a[i])",
"-right = [0] * n",
"-for i in range(n - 1, -1, -1):",
"- if i == n - 1:... | false | 0.034919 | 0.071848 | 0.486011 | [
"s363000685",
"s834770548"
] |
u623819879 | p02786 | python | s197028279 | s927190797 | 177 | 10 | 38,384 | 2,568 | Accepted | Accepted | 94.35 | print((2**len(bin(int(eval(input()))))//4-1)) | print(2**len(bin(eval(input())))/4-1) | 1 | 1 | 37 | 30 | print((2 ** len(bin(int(eval(input())))) // 4 - 1))
| print(2 ** len(bin(eval(input()))) / 4 - 1)
| false | 0 | [
"-print((2 ** len(bin(int(eval(input())))) // 4 - 1))",
"+print(2 ** len(bin(eval(input()))) / 4 - 1)"
] | false | 0.05873 | 0.006963 | 8.434602 | [
"s197028279",
"s927190797"
] |
u989345508 | p03478 | python | s132002213 | s786963531 | 35 | 29 | 3,060 | 2,940 | Accepted | Accepted | 17.14 | n,a,b=input().split()
n,a,b=int(n),int(a),int(b)
m=len(str(n))
'''
c=0
if n==10**4 and A==1:
c=1
k=len(str(n))
for i in range(k):
'''
c=0
for i in range(n):
#map関数はクソ便利
if a <= sum(list(map(int, str(i+1)))) <= b:
c+=i+1
print(c)
| n,a,b=list(map(int,input().split()))
ans=0
for i in range(1,n+1):
s=0
j=i
while j!=0:
s+=(j%10)
j//=10
if a<=s<=b:ans+=i
print(ans) | 17 | 10 | 268 | 166 | n, a, b = input().split()
n, a, b = int(n), int(a), int(b)
m = len(str(n))
"""
c=0
if n==10**4 and A==1:
c=1
k=len(str(n))
for i in range(k):
"""
c = 0
for i in range(n):
# map関数はクソ便利
if a <= sum(list(map(int, str(i + 1)))) <= b:
c += i + 1
print(c)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
s = 0
j = i
while j != 0:
s += j % 10
j //= 10
if a <= s <= b:
ans += i
print(ans)
| false | 41.176471 | [
"-n, a, b = input().split()",
"-n, a, b = int(n), int(a), int(b)",
"-m = len(str(n))",
"-\"\"\"",
"-c=0",
"-if n==10**4 and A==1:",
"- c=1",
"-k=len(str(n))",
"-for i in range(k):",
"-\"\"\"",
"-c = 0",
"-for i in range(n):",
"- # map関数はクソ便利",
"- if a <= sum(list(map(int, str(i + ... | false | 0.040923 | 0.039765 | 1.029135 | [
"s132002213",
"s786963531"
] |
u773265208 | p02899 | python | s386412853 | s655256586 | 715 | 186 | 69,612 | 28,768 | Accepted | Accepted | 73.99 | n = int(input())
a = list(map(int,input().split()))
b = [i for i in range(1,n+1)]
z = zip(a,b)
sorted_z = sorted(z)
new_a = []
new_b = []
for a_dash,b_dash in sorted_z:
new_a.append(a_dash)
new_b.append(b_dash)
print(new_b[0],end="")
for i in range(1,n):
print(" ",end="")
print(new_b[i],end="... | n = list(map(int,input().split()))
a = list(map(int,input().split()))
tmp = [[num,i+1] for i,num in enumerate(a)]
tmp.sort(key=lambda x: x[0])
ans = [str(i) for j,i in tmp]
print((" ".join(ans)))
| 19 | 9 | 323 | 199 | n = int(input())
a = list(map(int, input().split()))
b = [i for i in range(1, n + 1)]
z = zip(a, b)
sorted_z = sorted(z)
new_a = []
new_b = []
for a_dash, b_dash in sorted_z:
new_a.append(a_dash)
new_b.append(b_dash)
print(new_b[0], end="")
for i in range(1, n):
print(" ", end="")
print(new_b[i], end=""... | n = list(map(int, input().split()))
a = list(map(int, input().split()))
tmp = [[num, i + 1] for i, num in enumerate(a)]
tmp.sort(key=lambda x: x[0])
ans = [str(i) for j, i in tmp]
print((" ".join(ans)))
| false | 52.631579 | [
"-n = int(input())",
"+n = list(map(int, input().split()))",
"-b = [i for i in range(1, n + 1)]",
"-z = zip(a, b)",
"-sorted_z = sorted(z)",
"-new_a = []",
"-new_b = []",
"-for a_dash, b_dash in sorted_z:",
"- new_a.append(a_dash)",
"- new_b.append(b_dash)",
"-print(new_b[0], end=\"\")",
... | false | 0.036544 | 0.036948 | 0.989073 | [
"s386412853",
"s655256586"
] |
u537550206 | p02899 | python | s058530873 | s215007297 | 119 | 83 | 20,892 | 20,904 | Accepted | Accepted | 30.25 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [""]*n
for i in range(n):
x = a[i]
b = ans[a[i] - 1]
c = str(i+1)
ans[a[i]-1] = str(i+1)
print((" ".join(ans))) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [""]*n
for i in range(n):
ans[a[i]-1] = str(i+1) #aのi番インデックスの値から1引いたものがans配列のインデックスになる。値は出席番号(i+1)
print((" ".join(ans))) | 12 | 9 | 198 | 193 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = [""] * n
for i in range(n):
x = a[i]
b = ans[a[i] - 1]
c = str(i + 1)
ans[a[i] - 1] = str(i + 1)
print((" ".join(ans)))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = [""] * n
for i in range(n):
ans[a[i] - 1] = str(i + 1) # aのi番インデックスの値から1引いたものがans配列のインデックスになる。値は出席番号(i+1)
print((" ".join(ans)))
| false | 25 | [
"- x = a[i]",
"- b = ans[a[i] - 1]",
"- c = str(i + 1)",
"- ans[a[i] - 1] = str(i + 1)",
"+ ans[a[i] - 1] = str(i + 1) # aのi番インデックスの値から1引いたものがans配列のインデックスになる。値は出席番号(i+1)"
] | false | 0.040715 | 0.039254 | 1.037212 | [
"s058530873",
"s215007297"
] |
u384793271 | p03386 | python | s530396431 | s624310346 | 1,180 | 26 | 63,708 | 9,116 | Accepted | Accepted | 97.8 | a, b, k = list(map(int, input().split()))
for i in range(a, b+1):
if a <= i <= a + k - 1 or b - k + 1 <= i <= b:
print(i) | a, b, k = list(map(int, input().split()))
ans_A = []
ans_B = []
for i in range(a, min(b, a + k)):
ans_A.append(i)
for i in range(max(a, b - k + 1), b+1):
ans_B.append(i)
ans = sorted(list(set(ans_A) | set(ans_B)))
for i in ans:
print(i) | 5 | 12 | 132 | 255 | a, b, k = list(map(int, input().split()))
for i in range(a, b + 1):
if a <= i <= a + k - 1 or b - k + 1 <= i <= b:
print(i)
| a, b, k = list(map(int, input().split()))
ans_A = []
ans_B = []
for i in range(a, min(b, a + k)):
ans_A.append(i)
for i in range(max(a, b - k + 1), b + 1):
ans_B.append(i)
ans = sorted(list(set(ans_A) | set(ans_B)))
for i in ans:
print(i)
| false | 58.333333 | [
"-for i in range(a, b + 1):",
"- if a <= i <= a + k - 1 or b - k + 1 <= i <= b:",
"- print(i)",
"+ans_A = []",
"+ans_B = []",
"+for i in range(a, min(b, a + k)):",
"+ ans_A.append(i)",
"+for i in range(max(a, b - k + 1), b + 1):",
"+ ans_B.append(i)",
"+ans = sorted(list(set(ans_A)... | false | 0.04298 | 0.044326 | 0.969616 | [
"s530396431",
"s624310346"
] |
u790710233 | p02983 | python | s361992643 | s398392677 | 689 | 53 | 3,064 | 3,064 | Accepted | Accepted | 92.31 | L, R = list(map(int, input().split()))
MOD = 2019
INF = 10**5
ans = INF
if 2019 <= R-L:
print((0))
else:
x = L % MOD
y = R % MOD
if x < y:
for i in range(x, y):
for j in range(i+1, y+1):
ans = min(ans, (i*j) % MOD)
else:
print(ans... | L, R = list(map(int, input().split()))
MOD = 2019
INF = 10**5
ans = INF
if 2019 <= R-L:
print((0))
else:
x = L % MOD
y = R % MOD
if x < y:
for i in range(x, y):
for j in range(i+1, y+1):
ans = min(ans, (i*j) % MOD)
if ans == 0:
... | 19 | 20 | 342 | 372 | L, R = list(map(int, input().split()))
MOD = 2019
INF = 10**5
ans = INF
if 2019 <= R - L:
print((0))
else:
x = L % MOD
y = R % MOD
if x < y:
for i in range(x, y):
for j in range(i + 1, y + 1):
ans = min(ans, (i * j) % MOD)
else:
print(ans)
else... | L, R = list(map(int, input().split()))
MOD = 2019
INF = 10**5
ans = INF
if 2019 <= R - L:
print((0))
else:
x = L % MOD
y = R % MOD
if x < y:
for i in range(x, y):
for j in range(i + 1, y + 1):
ans = min(ans, (i * j) % MOD)
if ans == 0:
brea... | false | 5 | [
"- else:",
"- print(ans)",
"+ if ans == 0:",
"+ break",
"+ print(ans)"
] | false | 0.044303 | 0.049294 | 0.898735 | [
"s361992643",
"s398392677"
] |
u418149936 | p02779 | python | s111322760 | s994447003 | 115 | 86 | 40,796 | 36,996 | Accepted | Accepted | 25.22 | N = int(eval(input()))
A_ls = list(map(int, input().split(' ')))
rst = set()
for i in A_ls:
rst.add(i)
if len(rst) == N:
print('YES')
else:
print('NO') | N = int(eval(input()))
A_ls = list(input().split(' '))
A_set = { i for i in A_ls }
if len(A_set) == N:
print('YES')
else:
print('NO') | 9 | 7 | 159 | 141 | N = int(eval(input()))
A_ls = list(map(int, input().split(" ")))
rst = set()
for i in A_ls:
rst.add(i)
if len(rst) == N:
print("YES")
else:
print("NO")
| N = int(eval(input()))
A_ls = list(input().split(" "))
A_set = {i for i in A_ls}
if len(A_set) == N:
print("YES")
else:
print("NO")
| false | 22.222222 | [
"-A_ls = list(map(int, input().split(\" \")))",
"-rst = set()",
"-for i in A_ls:",
"- rst.add(i)",
"-if len(rst) == N:",
"+A_ls = list(input().split(\" \"))",
"+A_set = {i for i in A_ls}",
"+if len(A_set) == N:"
] | false | 0.046838 | 0.143293 | 0.326868 | [
"s111322760",
"s994447003"
] |
u474561976 | p02695 | python | s472888265 | s985327933 | 675 | 623 | 9,208 | 9,144 | Accepted | Accepted | 7.7 | def main():
import itertools
n,m,q = list(map(int,input().split(" ")))
ops = []
for i in range(q):
ops.append(list(map(int,input().split(" "))))
ans = 0
for A in itertools.combinations_with_replacement(list(range(1,m+1)),n):
temp = 0
for op in ops:
... | def score(A,g):
score = 0
for p in g:
if A[p[1]]-A[p[0]]==p[2]:
score+=p[3]
return score
def solve(m,n,g,A,dep):
if dep==n:
return score(A,g)
else:
temp_scores = []
for i in range(A[dep],m+1):
A[dep+1] = i
temp_scores... | 17 | 27 | 437 | 612 | def main():
import itertools
n, m, q = list(map(int, input().split(" ")))
ops = []
for i in range(q):
ops.append(list(map(int, input().split(" "))))
ans = 0
for A in itertools.combinations_with_replacement(list(range(1, m + 1)), n):
temp = 0
for op in ops:
if... | def score(A, g):
score = 0
for p in g:
if A[p[1]] - A[p[0]] == p[2]:
score += p[3]
return score
def solve(m, n, g, A, dep):
if dep == n:
return score(A, g)
else:
temp_scores = []
for i in range(A[dep], m + 1):
A[dep + 1] = i
temp_... | false | 37.037037 | [
"+def score(A, g):",
"+ score = 0",
"+ for p in g:",
"+ if A[p[1]] - A[p[0]] == p[2]:",
"+ score += p[3]",
"+ return score",
"+",
"+",
"+def solve(m, n, g, A, dep):",
"+ if dep == n:",
"+ return score(A, g)",
"+ else:",
"+ temp_scores = []",
"... | false | 0.05197 | 0.075193 | 0.69116 | [
"s472888265",
"s985327933"
] |
u075012704 | p02984 | python | s479182423 | s025007520 | 299 | 139 | 72,932 | 14,092 | Accepted | Accepted | 53.51 | N = int(input())
A = list(map(int, input().split()))
A = A + A
s1 = [0]
for i in range(N):
s1.append((A[i] - s1[-1] // 2) * 2)
X = (s1[-1]) // 2
ans = [X]
for i in range(N):
ans.append((A[i] - ans[-1] // 2) * 2)
print(*ans[:-1], sep=' ')
| N = int(input())
A = list(map(int, input().split()))
dam_prob = 0
for i in range(N - 1):
dam_prob = (A[i] - (dam_prob // 2)) * 2
start_dam = (A[-1] - (dam_prob // 2))
ans = [start_dam]
for i in range(N - 1):
ans.append((A[i] - (ans[-1] // 2)) * 2)
print(*ans, sep=' ')
| 15 | 14 | 264 | 294 | N = int(input())
A = list(map(int, input().split()))
A = A + A
s1 = [0]
for i in range(N):
s1.append((A[i] - s1[-1] // 2) * 2)
X = (s1[-1]) // 2
ans = [X]
for i in range(N):
ans.append((A[i] - ans[-1] // 2) * 2)
print(*ans[:-1], sep=" ")
| N = int(input())
A = list(map(int, input().split()))
dam_prob = 0
for i in range(N - 1):
dam_prob = (A[i] - (dam_prob // 2)) * 2
start_dam = A[-1] - (dam_prob // 2)
ans = [start_dam]
for i in range(N - 1):
ans.append((A[i] - (ans[-1] // 2)) * 2)
print(*ans, sep=" ")
| false | 6.666667 | [
"-A = A + A",
"-s1 = [0]",
"-for i in range(N):",
"- s1.append((A[i] - s1[-1] // 2) * 2)",
"-X = (s1[-1]) // 2",
"-ans = [X]",
"-for i in range(N):",
"- ans.append((A[i] - ans[-1] // 2) * 2)",
"-print(*ans[:-1], sep=\" \")",
"+dam_prob = 0",
"+for i in range(N - 1):",
"+ dam_prob = (A... | false | 0.075467 | 0.078617 | 0.959931 | [
"s479182423",
"s025007520"
] |
u063073794 | p02861 | python | s743330912 | s580258919 | 420 | 17 | 3,064 | 3,064 | Accepted | Accepted | 95.95 | from itertools import permutations
n = int(eval(input()))
n_ = 1
for i in range(n):
n_ *= i+1
c = [tuple(map(int,input().split())) for _ in range(n)]
tot = 0
def dis(c,x,y):
x1,y1 = c[x]
x2,y2 = c[y]
return ((x1-x2)**2 + (y1-y2)**2)**.5
for l in permutations(list(range(n))):
d = 0
... | #yandy
N = int(eval(input()))
paths = []
for _ in range(N):
x, y = list(map(int, input().split()))
paths.append((x, y))
all_path_len = 0
for i in range(N):
for j in range(N):
if i == j:
continue
xa, ya = paths[i]
xb, yb = paths[j]
all_path... | 22 | 22 | 410 | 398 | from itertools import permutations
n = int(eval(input()))
n_ = 1
for i in range(n):
n_ *= i + 1
c = [tuple(map(int, input().split())) for _ in range(n)]
tot = 0
def dis(c, x, y):
x1, y1 = c[x]
x2, y2 = c[y]
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
for l in permutations(list(range(n))):
d... | # yandy
N = int(eval(input()))
paths = []
for _ in range(N):
x, y = list(map(int, input().split()))
paths.append((x, y))
all_path_len = 0
for i in range(N):
for j in range(N):
if i == j:
continue
xa, ya = paths[i]
xb, yb = paths[j]
all_path_len += ((xa - xb) ** 2 ... | false | 0 | [
"-from itertools import permutations",
"-",
"-n = int(eval(input()))",
"-n_ = 1",
"-for i in range(n):",
"- n_ *= i + 1",
"-c = [tuple(map(int, input().split())) for _ in range(n)]",
"-tot = 0",
"-",
"-",
"-def dis(c, x, y):",
"- x1, y1 = c[x]",
"- x2, y2 = c[y]",
"- return ((x... | false | 0.076431 | 0.036971 | 2.06729 | [
"s743330912",
"s580258919"
] |
u707124227 | p02691 | python | s840142416 | s485800423 | 361 | 333 | 92,264 | 66,308 | Accepted | Accepted | 7.76 | def main(n,a_):
from collections import defaultdict
lr=[[i+ai,i-ai] for i,ai in enumerate(a_)]
rs=defaultdict(lambda:0)
ls=defaultdict(lambda:0)
ans=0
for l,r in lr:
rs[r]+=1
ls[l]+=1
for k in list(rs.keys()):
ans+=rs[k]*ls[k]
print(ans)
if __name__=='__main__':
n=int(eval(inp... | n=int(eval(input()))
a=list(map(int,input().split()))
b=[]
c=[]
for i in range(n):
b.append(a[i]-(i+1))
c.append(-(a[i]+i+1))
from collections import defaultdict
#cnt_b=Counter(b)
cnt_c=defaultdict(int)
ans=0
for i in range(n):
v=cnt_c[b[i]]
ans+=v
cnt_c[c[i]]+=1
print(ans) | 18 | 16 | 408 | 293 | def main(n, a_):
from collections import defaultdict
lr = [[i + ai, i - ai] for i, ai in enumerate(a_)]
rs = defaultdict(lambda: 0)
ls = defaultdict(lambda: 0)
ans = 0
for l, r in lr:
rs[r] += 1
ls[l] += 1
for k in list(rs.keys()):
ans += rs[k] * ls[k]
print(ans)... | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
c = []
for i in range(n):
b.append(a[i] - (i + 1))
c.append(-(a[i] + i + 1))
from collections import defaultdict
# cnt_b=Counter(b)
cnt_c = defaultdict(int)
ans = 0
for i in range(n):
v = cnt_c[b[i]]
ans += v
cnt_c[c[i]] += 1
print(a... | false | 11.111111 | [
"-def main(n, a_):",
"- from collections import defaultdict",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+b = []",
"+c = []",
"+for i in range(n):",
"+ b.append(a[i] - (i + 1))",
"+ c.append(-(a[i] + i + 1))",
"+from collections import defaultdict",
"- lr = [... | false | 0.036556 | 0.035771 | 1.02195 | [
"s840142416",
"s485800423"
] |
u525065967 | p02598 | python | s589419373 | s185894527 | 1,814 | 1,356 | 30,760 | 30,916 | Accepted | Accepted | 25.25 | n, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
A.sort(reverse=True)
ng, ok = 0, 1<<30
while ok - ng > 1:
m = (ng + ok) // 2
c = 0
for a in A:
d = (a - 1) // m
if d > 0: c += d
else: break
if c <= k: ok = m
else: ng = m
print(ok)
| n, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
A.sort(reverse=True)
ng, ok = 0, 1<<30
while ok - ng > 1:
m = (ng + ok) // 2
c = 0
for a in A:
d = (a - 1) // m
if d == 0: break
c += d
if c <= k: ok = m
else: ng = m
print(ok)
| 14 | 14 | 305 | 300 | n, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
A.sort(reverse=True)
ng, ok = 0, 1 << 30
while ok - ng > 1:
m = (ng + ok) // 2
c = 0
for a in A:
d = (a - 1) // m
if d > 0:
c += d
else:
break
if c <= k:
ok = m
else:... | n, k = list(map(int, input().split()))
A = [*list(map(int, input().split()))]
A.sort(reverse=True)
ng, ok = 0, 1 << 30
while ok - ng > 1:
m = (ng + ok) // 2
c = 0
for a in A:
d = (a - 1) // m
if d == 0:
break
c += d
if c <= k:
ok = m
else:
ng = m
p... | false | 0 | [
"- if d > 0:",
"- c += d",
"- else:",
"+ if d == 0:",
"+ c += d"
] | false | 0.085643 | 0.043053 | 1.989263 | [
"s589419373",
"s185894527"
] |
u936985471 | p03700 | python | s843105548 | s797939879 | 942 | 850 | 6,988 | 7,076 | Accepted | Accepted | 9.77 | N,A,B=list(map(int,input().split()))
Aadd=A-B
H=[0]*N
for i in range(N):
H[i]=int(eval(input()))
MAXV=max(H)//B+(max(H)%B>0)
ng=-1
ok=MAXV+1
def isOK(n):
Anum=0
Bdamage=n*B
for i in range(len(H)):
rest=H[i]-Bdamage
if rest>0:
Anum+=rest//Aadd+(rest%Aadd>0)
if Anum<=n:
retur... | import sys
readline = sys.stdin.readline
N,A,B = list(map(int,readline().split()))
H = [int(readline()) for i in range(N)]
# AをA - Bと読み替え、一回の攻撃で全体にBダメージと1体にAダメージと考える
# X回で達成できるかの二分探索
A -= B
ng = 0
ok = 10 ** 9
def isOk(x):
# 各H_iを倒すのに必要な攻撃Aの回数をカウントする
cnt = 0
for i in range(len(H)):
h = H[... | 28 | 30 | 449 | 510 | N, A, B = list(map(int, input().split()))
Aadd = A - B
H = [0] * N
for i in range(N):
H[i] = int(eval(input()))
MAXV = max(H) // B + (max(H) % B > 0)
ng = -1
ok = MAXV + 1
def isOK(n):
Anum = 0
Bdamage = n * B
for i in range(len(H)):
rest = H[i] - Bdamage
if rest > 0:
Anum ... | import sys
readline = sys.stdin.readline
N, A, B = list(map(int, readline().split()))
H = [int(readline()) for i in range(N)]
# AをA - Bと読み替え、一回の攻撃で全体にBダメージと1体にAダメージと考える
# X回で達成できるかの二分探索
A -= B
ng = 0
ok = 10**9
def isOk(x):
# 各H_iを倒すのに必要な攻撃Aの回数をカウントする
cnt = 0
for i in range(len(H)):
h = H[i] - x ... | false | 6.666667 | [
"-N, A, B = list(map(int, input().split()))",
"-Aadd = A - B",
"-H = [0] * N",
"-for i in range(N):",
"- H[i] = int(eval(input()))",
"-MAXV = max(H) // B + (max(H) % B > 0)",
"-ng = -1",
"-ok = MAXV + 1",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N, A, B = list(map(int, readli... | false | 0.044641 | 0.008108 | 5.506005 | [
"s843105548",
"s797939879"
] |
u539969758 | p02936 | python | s083363727 | s898915813 | 1,547 | 1,329 | 273,880 | 230,572 | Accepted | Accepted | 14.09 | import sys
sys.setrecursionlimit(400000)
N, Q = list(map(int, input().split()))
paths = [list() for _ in range(N+1)] # paths[i] : 頂点iと繋がってる点を全て表す
for _ in range(N-1):
a, b = list(map(int, input().split()))
paths[a].append(b)
paths[b].append(a)
# ab = [list(map(int, input().split())) for _ in range(N... | import sys
sys.setrecursionlimit(400000)
n,q=list(map(int,input().split()))
ans=[0]*(n+1) #答え
score=[0]*(n+1) #xの総和
g=[[] for _ in range(n+1)] #グラフ
for i in range(n-1):
a,b=list(map(int,input().split()))
g[a].append(b)
g[b].append(a)
for j in range(q):
p,x=list(map(int,input().split()))
... | 31 | 25 | 901 | 578 | import sys
sys.setrecursionlimit(400000)
N, Q = list(map(int, input().split()))
paths = [list() for _ in range(N + 1)] # paths[i] : 頂点iと繋がってる点を全て表す
for _ in range(N - 1):
a, b = list(map(int, input().split()))
paths[a].append(b)
paths[b].append(a)
# ab = [list(map(int, input().split())) for _ in range(N-1... | import sys
sys.setrecursionlimit(400000)
n, q = list(map(int, input().split()))
ans = [0] * (n + 1) # 答え
score = [0] * (n + 1) # xの総和
g = [[] for _ in range(n + 1)] # グラフ
for i in range(n - 1):
a, b = list(map(int, input().split()))
g[a].append(b)
g[b].append(a)
for j in range(q):
p, x = list(map(in... | false | 19.354839 | [
"-N, Q = list(map(int, input().split()))",
"-paths = [list() for _ in range(N + 1)] # paths[i] : 頂点iと繋がってる点を全て表す",
"-for _ in range(N - 1):",
"+n, q = list(map(int, input().split()))",
"+ans = [0] * (n + 1) # 答え",
"+score = [0] * (n + 1) # xの総和",
"+g = [[] for _ in range(n + 1)] # グラフ",
"+for i in... | false | 0.049431 | 0.049929 | 0.99003 | [
"s083363727",
"s898915813"
] |
u757030836 | p03433 | python | s031261985 | s408505971 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N = eval(input())
A = eval(input())
n = int(N)
a = int(A)
x = n % 500
if x <= a:
print("Yes")
else:
print("No")
| N = int(eval(input()))
A = int(eval(input()))
num = N % 500
if num <= A:
print("Yes")
else:
print("No")
| 12 | 10 | 116 | 108 | N = eval(input())
A = eval(input())
n = int(N)
a = int(A)
x = n % 500
if x <= a:
print("Yes")
else:
print("No")
| N = int(eval(input()))
A = int(eval(input()))
num = N % 500
if num <= A:
print("Yes")
else:
print("No")
| false | 16.666667 | [
"-N = eval(input())",
"-A = eval(input())",
"-n = int(N)",
"-a = int(A)",
"-x = n % 500",
"-if x <= a:",
"+N = int(eval(input()))",
"+A = int(eval(input()))",
"+num = N % 500",
"+if num <= A:"
] | false | 0.050135 | 0.050461 | 0.993555 | [
"s031261985",
"s408505971"
] |
u638456847 | p03283 | python | s127502329 | s029077094 | 777 | 443 | 123,888 | 56,648 | Accepted | Accepted | 42.99 | # 累積和(1次元)を用いた解法
from itertools import accumulate
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,M,Q,*lr = list(map(int, read().split()))
LR = [[0]*(N+1) for _ in range(N+1)]
query = []
for i, (l, r) in enumerate(zip(*[iter(lr)]... | # 累積和(2次元)を用いた解法
from itertools import accumulate
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,M,Q,*lr = list(map(int, read().split()))
LR = [[0]*(N+1) for _ in range(N+1)]
query = []
for i, (l, r) in enumerate(zip(*[iter(lr)]... | 31 | 33 | 693 | 803 | # 累積和(1次元)を用いた解法
from itertools import accumulate
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, M, Q, *lr = list(map(int, read().split()))
LR = [[0] * (N + 1) for _ in range(N + 1)]
query = []
for i, (l, r) in enumerate(zip(*[iter(lr)] *... | # 累積和(2次元)を用いた解法
from itertools import accumulate
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, M, Q, *lr = list(map(int, read().split()))
LR = [[0] * (N + 1) for _ in range(N + 1)]
query = []
for i, (l, r) in enumerate(zip(*[iter(lr)] *... | false | 6.060606 | [
"-# 累積和(1次元)を用いた解法",
"+# 累積和(2次元)を用いた解法",
"- LR_acc = []",
"- for L in LR:",
"- LR_acc.append(list(accumulate(L)))",
"+ for i in range(1, N + 1):",
"+ LR[1][i] += LR[1][i - 1]",
"+ LR[i][1] += LR[i - 1][1]",
"+ for i in range(2, N + 1):",
"+ for j in range(2... | false | 0.088058 | 0.045669 | 1.928174 | [
"s127502329",
"s029077094"
] |
u427344224 | p03137 | python | s427695364 | s028032490 | 310 | 116 | 26,400 | 13,968 | Accepted | Accepted | 62.58 | N, M = list(map(int, input().split()))
x_list = list(map(int, input().split()))
x_list.sort()
ans = 0
margin = [0] * (M - 1)
f = x_list[0]
for i in range(1, M):
margin[i - 1] = x_list[i] - f
f = x_list[i]
margin = sorted(enumerate(margin), key=lambda x: (-x[1], x[0]))
cnt = [0]
for i, v in margin... | N, M = list(map(int, input().split()))
x_list = list(map(int, input().split()))
x_list.sort()
margin = []
prev = x_list[0]
for i in range(1, M):
margin.append(x_list[i] - prev)
prev = x_list[i]
margin.sort(reverse=True)
print((x_list[-1] - x_list[0] - sum(margin[:N-1])))
| 40 | 12 | 849 | 285 | N, M = list(map(int, input().split()))
x_list = list(map(int, input().split()))
x_list.sort()
ans = 0
margin = [0] * (M - 1)
f = x_list[0]
for i in range(1, M):
margin[i - 1] = x_list[i] - f
f = x_list[i]
margin = sorted(enumerate(margin), key=lambda x: (-x[1], x[0]))
cnt = [0]
for i, v in margin:
if len(cn... | N, M = list(map(int, input().split()))
x_list = list(map(int, input().split()))
x_list.sort()
margin = []
prev = x_list[0]
for i in range(1, M):
margin.append(x_list[i] - prev)
prev = x_list[i]
margin.sort(reverse=True)
print((x_list[-1] - x_list[0] - sum(margin[: N - 1])))
| false | 70 | [
"-ans = 0",
"-margin = [0] * (M - 1)",
"-f = x_list[0]",
"+margin = []",
"+prev = x_list[0]",
"- margin[i - 1] = x_list[i] - f",
"- f = x_list[i]",
"-margin = sorted(enumerate(margin), key=lambda x: (-x[1], x[0]))",
"-cnt = [0]",
"-for i, v in margin:",
"- if len(cnt) == N:",
"- ... | false | 0.089151 | 0.043464 | 2.051171 | [
"s427695364",
"s028032490"
] |
u922487073 | p03252 | python | s424043391 | s998962000 | 225 | 190 | 6,704 | 5,168 | Accepted | Accepted | 15.56 | S=eval(input())
T=eval(input())
Rs = {}
Rt = {}
for s,t in zip(S,T):
if s in list(Rs.keys()) and Rs[s] != t:
print("No")
exit()
if t in list(Rt.keys()) and Rt[t] != s:
print("No")
exit()
if not s in list(Rs.keys()):
Rs[s] = t
if not t in l... | S=eval(input())
T=eval(input())
Rs = {}
Rt = {}
for s,t in zip(S,T):
if s in list(Rs.keys()) and Rs[s] != t:
print("No")
exit()
if t in list(Rt.keys()) and Rt[t] != s:
print("No")
exit()
if not s in list(Rs.keys()):
Rs[s] = t
if not t in l... | 28 | 25 | 525 | 435 | S = eval(input())
T = eval(input())
Rs = {}
Rt = {}
for s, t in zip(S, T):
if s in list(Rs.keys()) and Rs[s] != t:
print("No")
exit()
if t in list(Rt.keys()) and Rt[t] != s:
print("No")
exit()
if not s in list(Rs.keys()):
Rs[s] = t
if not t in list(Rt.keys()):
... | S = eval(input())
T = eval(input())
Rs = {}
Rt = {}
for s, t in zip(S, T):
if s in list(Rs.keys()) and Rs[s] != t:
print("No")
exit()
if t in list(Rt.keys()) and Rt[t] != s:
print("No")
exit()
if not s in list(Rs.keys()):
Rs[s] = t
if not t in list(Rt.keys()):
... | false | 10.714286 | [
"-rest = [\"\"] * len(S)",
"-for i, t in enumerate(T):",
"- rest[i] = Rt[t]",
"-print((\"Yes\" if \"\".join(ress) == T and \"\".join(rest) == S else \"No\"))",
"+print((\"Yes\" if \"\".join(ress) == T else \"No\"))"
] | false | 0.036243 | 0.035286 | 1.027111 | [
"s424043391",
"s998962000"
] |
u077291787 | p03068 | python | s935066814 | s703525798 | 173 | 18 | 38,384 | 2,940 | Accepted | Accepted | 89.6 | # TPBC201B - *e**** ********e* *e****e* ****e**
n = int(eval(input()))
s = list(eval(input()))
k = int(eval(input()))
for i in range(n):
if s[i] != s[k - 1]:
s[i] = "*"
print(("".join(s))) | # tenka1-2019-beginnerB - *e**** ********e* *e****e* ****e**
def main():
N, S, K = open(0).read().split()
tgt = S[int(K) - 1]
ans = [i if i == tgt else "*" for i in S]
print(("".join(ans)))
if __name__ == "__main__":
main() | 9 | 10 | 189 | 252 | # TPBC201B - *e**** ********e* *e****e* ****e**
n = int(eval(input()))
s = list(eval(input()))
k = int(eval(input()))
for i in range(n):
if s[i] != s[k - 1]:
s[i] = "*"
print(("".join(s)))
| # tenka1-2019-beginnerB - *e**** ********e* *e****e* ****e**
def main():
N, S, K = open(0).read().split()
tgt = S[int(K) - 1]
ans = [i if i == tgt else "*" for i in S]
print(("".join(ans)))
if __name__ == "__main__":
main()
| false | 10 | [
"-# TPBC201B - *e**** ********e* *e****e* ****e**",
"-n = int(eval(input()))",
"-s = list(eval(input()))",
"-k = int(eval(input()))",
"-for i in range(n):",
"- if s[i] != s[k - 1]:",
"- s[i] = \"*\"",
"-print((\"\".join(s)))",
"+# tenka1-2019-beginnerB - *e**** ********e* *e****e* ****e**"... | false | 0.121923 | 0.033691 | 3.618905 | [
"s935066814",
"s703525798"
] |
u413960612 | p02911 | python | s389365718 | s407996914 | 305 | 195 | 22,556 | 15,360 | Accepted | Accepted | 36.07 | import bisect as bi
N,K,Q = list(map(int,input().split()))
A = [int(eval(input())) for i in range(Q)]
B = [K]*N
p = 0
for i in range(N+1):
A.append(i+1)
C = sorted(A)
for i in range(N):
B[i] += bi.bisect_left(C,i+2) - p - 1
p = bi.bisect_left(C,i+2)
for i in range(N):
if(B[i] > Q):
... | N,K,Q = list(map(int,input().split()))
A = [int(eval(input())) for i in range(Q)]
B = [K]*N
p = 0
for i in range(Q):
B[A[i]-1] += 1
for i in range(N):
if(B[i] > Q):
print("Yes")
else:
print("No") | 17 | 11 | 354 | 221 | import bisect as bi
N, K, Q = list(map(int, input().split()))
A = [int(eval(input())) for i in range(Q)]
B = [K] * N
p = 0
for i in range(N + 1):
A.append(i + 1)
C = sorted(A)
for i in range(N):
B[i] += bi.bisect_left(C, i + 2) - p - 1
p = bi.bisect_left(C, i + 2)
for i in range(N):
if B[i] > Q:
... | N, K, Q = list(map(int, input().split()))
A = [int(eval(input())) for i in range(Q)]
B = [K] * N
p = 0
for i in range(Q):
B[A[i] - 1] += 1
for i in range(N):
if B[i] > Q:
print("Yes")
else:
print("No")
| false | 35.294118 | [
"-import bisect as bi",
"-",
"-for i in range(N + 1):",
"- A.append(i + 1)",
"-C = sorted(A)",
"-for i in range(N):",
"- B[i] += bi.bisect_left(C, i + 2) - p - 1",
"- p = bi.bisect_left(C, i + 2)",
"+for i in range(Q):",
"+ B[A[i] - 1] += 1"
] | false | 0.082717 | 0.106645 | 0.775625 | [
"s389365718",
"s407996914"
] |
u796942881 | p03073 | python | s940555440 | s587842624 | 37 | 18 | 4,376 | 3,188 | Accepted | Accepted | 51.35 | def main():
S = [int(i) for i in eval(input())]
x = - (-len(S) // 2) - sum(S[::2]) + sum(S[1::2])
print((min(x, len(S) - x)))
return
main()
| def repaint(S):
return S[::2].count("0") + S[1::2].count("1")
def main():
S = eval(input())
print((min(repaint(S), len(S) - repaint(S))))
return
main()
| 9 | 12 | 159 | 176 | def main():
S = [int(i) for i in eval(input())]
x = -(-len(S) // 2) - sum(S[::2]) + sum(S[1::2])
print((min(x, len(S) - x)))
return
main()
| def repaint(S):
return S[::2].count("0") + S[1::2].count("1")
def main():
S = eval(input())
print((min(repaint(S), len(S) - repaint(S))))
return
main()
| false | 25 | [
"+def repaint(S):",
"+ return S[::2].count(\"0\") + S[1::2].count(\"1\")",
"+",
"+",
"- S = [int(i) for i in eval(input())]",
"- x = -(-len(S) // 2) - sum(S[::2]) + sum(S[1::2])",
"- print((min(x, len(S) - x)))",
"+ S = eval(input())",
"+ print((min(repaint(S), len(S) - repaint(S))... | false | 0.044481 | 0.036451 | 1.220282 | [
"s940555440",
"s587842624"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.