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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u648212584 | p02804 | python | s387232808 | s346899860 | 358 | 260 | 19,824 | 56,560 | Accepted | Accepted | 27.37 | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
MOD = 10**9+7
A.sort()
fac = [0 for _ in range(N+1)]
fac[0],fac[1] = 1,1
inv = copy.deepcopy(fac)
invfac = copy.deepcopy(fac)
... | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N,M = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort()
MOD = 10**9+7
fac = [0 for _ in range(N+1)]
fac[0],fac[1] = 1,1
invfac = copy.deepcopy(fac)
for i in range(2,N+1):
... | 33 | 34 | 782 | 776 | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
A.sort()
fac = [0 for _ in range(N + 1)]
fac[0], fac[1] = 1, 1
inv = copy.deepcopy(fac)
invfac = copy.deepcopy(fac)
for i... | import sys
input = sys.stdin.buffer.readline
import copy
def main():
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
MOD = 10**9 + 7
fac = [0 for _ in range(N + 1)]
fac[0], fac[1] = 1, 1
invfac = copy.deepcopy(fac)
for i in range(2, N + 1):
... | false | 2.941176 | [
"- N, K = list(map(int, input().split()))",
"- A = list(map(int, input().split()))",
"+ N, M = list(map(int, input().split()))",
"+ a = list(map(int, input().split()))",
"+ a.sort()",
"- A.sort()",
"- inv = copy.deepcopy(fac)",
"- inv[i] = MOD - (MOD // i) * inv[MOD % i] % ... | false | 0.038344 | 0.038708 | 0.990595 | [
"s387232808",
"s346899860"
] |
u623283955 | p02788 | python | s375025559 | s353943291 | 1,707 | 1,382 | 100,824 | 102,616 | Accepted | Accepted | 19.04 | import math
N,D,A=list(map(int,input().split()))
l=[]
for i in range(N):
k=list(map(int,input().split()))
l.append(k)
l.sort()
S=[0]*N
ma=[0]*N
tmp=N-1
for i in reversed(list(range(N))):
x=l[i][0]
for j in reversed(list(range(0,tmp))):
if abs(l[j][0]-(x-D))>D:
ma[i]=j+1
tmp=j+1
... | import math
from operator import itemgetter
N,D,A=list(map(int,input().split()))
l=[]
for i in range(N):
k=tuple(map(int,input().split()))
l.append(k)
l.sort(key=itemgetter(0))
S=[0]*N
ma=[0]*N
tmp=N-1
for i in reversed(list(range(N))):
x=l[i][0]
for j in reversed(list(range(0,tmp))):
if abs(l... | 33 | 34 | 601 | 652 | import math
N, D, A = list(map(int, input().split()))
l = []
for i in range(N):
k = list(map(int, input().split()))
l.append(k)
l.sort()
S = [0] * N
ma = [0] * N
tmp = N - 1
for i in reversed(list(range(N))):
x = l[i][0]
for j in reversed(list(range(0, tmp))):
if abs(l[j][0] - (x - D)) > D:
... | import math
from operator import itemgetter
N, D, A = list(map(int, input().split()))
l = []
for i in range(N):
k = tuple(map(int, input().split()))
l.append(k)
l.sort(key=itemgetter(0))
S = [0] * N
ma = [0] * N
tmp = N - 1
for i in reversed(list(range(N))):
x = l[i][0]
for j in reversed(list(range(0, ... | false | 2.941176 | [
"+from operator import itemgetter",
"- k = list(map(int, input().split()))",
"+ k = tuple(map(int, input().split()))",
"-l.sort()",
"+l.sort(key=itemgetter(0))"
] | false | 0.043912 | 0.043594 | 1.007292 | [
"s375025559",
"s353943291"
] |
u597374218 | p02622 | python | s013732190 | s051757246 | 63 | 54 | 9,416 | 9,332 | Accepted | Accepted | 14.29 | S=eval(input())
T=eval(input())
count=0
for i in range(len(S)):
count+=S[i]!=T[i]
print(count) | S=eval(input())
T=eval(input())
print((sum(S[i]!=T[i] for i in range(len(S))))) | 6 | 3 | 91 | 67 | S = eval(input())
T = eval(input())
count = 0
for i in range(len(S)):
count += S[i] != T[i]
print(count)
| S = eval(input())
T = eval(input())
print((sum(S[i] != T[i] for i in range(len(S)))))
| false | 50 | [
"-count = 0",
"-for i in range(len(S)):",
"- count += S[i] != T[i]",
"-print(count)",
"+print((sum(S[i] != T[i] for i in range(len(S)))))"
] | false | 0.03635 | 0.035414 | 1.026404 | [
"s013732190",
"s051757246"
] |
u844646164 | p03608 | python | s049819918 | s729065619 | 474 | 269 | 59,480 | 78,832 | Accepted | Accepted | 43.25 | import heapq
import itertools
n, m, r = list(map(int, input().split()))
r = list([int(x)-1 for x in input().split()])
d = [[float('inf')]*n for _ in range(n)]
for _ in range(m):
a, b, t = list(map(int, input().split()))
a -= 1
b -= 1
d[a][b] = t
d[b][a] = t
for i in range(n):
d[i][i] = 0
def ... | import itertools
N, M, R = list(map(int, input().split()))
r = list([int(x)-1 for x in input().split()])
graph = [[] for _ in range(N)]
d = [[float('inf')]*N for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
graph[a] += [[b, c]]
graph[b] += [[c, a]]
d[a... | 31 | 33 | 678 | 741 | import heapq
import itertools
n, m, r = list(map(int, input().split()))
r = list([int(x) - 1 for x in input().split()])
d = [[float("inf")] * n for _ in range(n)]
for _ in range(m):
a, b, t = list(map(int, input().split()))
a -= 1
b -= 1
d[a][b] = t
d[b][a] = t
for i in range(n):
d[i][i] = 0
... | import itertools
N, M, R = list(map(int, input().split()))
r = list([int(x) - 1 for x in input().split()])
graph = [[] for _ in range(N)]
d = [[float("inf")] * N for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
graph[a] += [[b, c]]
graph[b] += [[c, a]]
... | false | 6.060606 | [
"-import heapq",
"-n, m, r = list(map(int, input().split()))",
"+N, M, R = list(map(int, input().split()))",
"-d = [[float(\"inf\")] * n for _ in range(n)]",
"-for _ in range(m):",
"- a, b, t = list(map(int, input().split()))",
"+graph = [[] for _ in range(N)]",
"+d = [[float(\"inf\")] * N for _ in... | false | 0.036163 | 0.036163 | 1.000007 | [
"s049819918",
"s729065619"
] |
u606878291 | p03476 | python | s208308051 | s059124361 | 1,388 | 891 | 10,416 | 4,980 | Accepted | Accepted | 35.81 | from functools import lru_cache
@lru_cache(maxsize=None)
def is_prime(n):
"""
nが素数かどうか判定する
"""
if n < 2:
return False
elif n == 2:
return True
elif n % 2 == 0:
return False
else:
i = 3
while i ** 2 <= n:
if n % i == 0:
... | size = 10 ** 5 + 1
is_primes = [True] * size
is_primes[0] = False
is_primes[1] = False
for n in range(2, size):
if not is_primes[n]:
continue
m = n * 2
while m < size:
is_primes[m] = False
m += n
dp = [0] * size
for i in range(1, size):
dp[i] = dp[i - 1]
if ... | 34 | 23 | 699 | 522 | from functools import lru_cache
@lru_cache(maxsize=None)
def is_prime(n):
"""
nが素数かどうか判定する
"""
if n < 2:
return False
elif n == 2:
return True
elif n % 2 == 0:
return False
else:
i = 3
while i**2 <= n:
if n % i == 0:
retur... | size = 10**5 + 1
is_primes = [True] * size
is_primes[0] = False
is_primes[1] = False
for n in range(2, size):
if not is_primes[n]:
continue
m = n * 2
while m < size:
is_primes[m] = False
m += n
dp = [0] * size
for i in range(1, size):
dp[i] = dp[i - 1]
if i % 2 == 1 and is_pr... | false | 32.352941 | [
"-from functools import lru_cache",
"-",
"-",
"-@lru_cache(maxsize=None)",
"-def is_prime(n):",
"- \"\"\"",
"- nが素数かどうか判定する",
"- \"\"\"",
"- if n < 2:",
"- return False",
"- elif n == 2:",
"- return True",
"- elif n % 2 == 0:",
"- return False",
"- ... | false | 1.837971 | 0.16169 | 11.367269 | [
"s208308051",
"s059124361"
] |
u574053975 | p03160 | python | s202725544 | s019591797 | 145 | 125 | 13,980 | 13,908 | Accepted | Accepted | 13.79 | a=int(eval(input()))
b=list(map(int,input().split()))
c=[0,abs(b[0]-b[1])]
for i in range(2,a):
if abs(b[i-1]-b[i])+c[i-1] < abs(b[i-2]-b[i])+c[i-2]:
c.append(abs(b[i-1]-b[i])+c[i-1])
else:
c.append(abs(b[i-2]-b[i])+c[i-2])
print((c[a-1])) | a=int(eval(input()))
b=list(map(int,input().split()))
c=[0,abs(b[0]-b[1])]
for i in range(2,a):
d=min(c[i-2]+abs(b[i-2]-b[i]),c[i-1]+abs(b[i-1]-b[i]))
c.append(d)
print((c[a-1])) | 10 | 8 | 257 | 182 | a = int(eval(input()))
b = list(map(int, input().split()))
c = [0, abs(b[0] - b[1])]
for i in range(2, a):
if abs(b[i - 1] - b[i]) + c[i - 1] < abs(b[i - 2] - b[i]) + c[i - 2]:
c.append(abs(b[i - 1] - b[i]) + c[i - 1])
else:
c.append(abs(b[i - 2] - b[i]) + c[i - 2])
print((c[a - 1]))
| a = int(eval(input()))
b = list(map(int, input().split()))
c = [0, abs(b[0] - b[1])]
for i in range(2, a):
d = min(c[i - 2] + abs(b[i - 2] - b[i]), c[i - 1] + abs(b[i - 1] - b[i]))
c.append(d)
print((c[a - 1]))
| false | 20 | [
"- if abs(b[i - 1] - b[i]) + c[i - 1] < abs(b[i - 2] - b[i]) + c[i - 2]:",
"- c.append(abs(b[i - 1] - b[i]) + c[i - 1])",
"- else:",
"- c.append(abs(b[i - 2] - b[i]) + c[i - 2])",
"+ d = min(c[i - 2] + abs(b[i - 2] - b[i]), c[i - 1] + abs(b[i - 1] - b[i]))",
"+ c.append(d)"
] | false | 0.047372 | 0.040001 | 1.184269 | [
"s202725544",
"s019591797"
] |
u553987207 | p02924 | python | s773251440 | s123516693 | 1,463 | 30 | 62,472 | 9,116 | Accepted | Accepted | 97.95 | N = int(eval(input()))
ans = sum(range(1, N))
print(ans) | N = int(eval(input()))
ans = N * (N - 1) // 2
print(ans) | 3 | 3 | 52 | 52 | N = int(eval(input()))
ans = sum(range(1, N))
print(ans)
| N = int(eval(input()))
ans = N * (N - 1) // 2
print(ans)
| false | 0 | [
"-ans = sum(range(1, N))",
"+ans = N * (N - 1) // 2"
] | false | 0.071666 | 0.037907 | 1.890579 | [
"s773251440",
"s123516693"
] |
u426649993 | p02642 | python | s269617461 | s679621901 | 1,172 | 1,053 | 43,860 | 43,476 | Accepted | Accepted | 10.15 | from math import sqrt
from collections import Counter
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
p = [0] * (10**6 + 1)
c = Counter(A)
for a in list(c.keys()):
tmp = a * 2
while tmp <= 10**6:
p[tmp] = 1
... | from math import sqrt
from collections import Counter
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 0
p = [0] * (10**6 + 1)
c = Counter(A)
for a in list(c.keys()):
tmp = a * 2
while tmp <= 10**6:
p[tmp] =... | 27 | 28 | 459 | 473 | from math import sqrt
from collections import Counter
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
p = [0] * (10**6 + 1)
c = Counter(A)
for a in list(c.keys()):
tmp = a * 2
while tmp <= 10**6:
p[tmp] = 1
tmp += a
for... | from math import sqrt
from collections import Counter
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 0
p = [0] * (10**6 + 1)
c = Counter(A)
for a in list(c.keys()):
tmp = a * 2
while tmp <= 10**6:
p[tmp] = 1
tmp... | false | 3.571429 | [
"+ A.sort()"
] | false | 0.234156 | 0.177963 | 1.315755 | [
"s269617461",
"s679621901"
] |
u879870653 | p03379 | python | s246765329 | s721768281 | 304 | 253 | 26,772 | 25,224 | Accepted | Accepted | 16.78 | N = int(eval(input()))
X = list(map(int,input().split()))
L = sorted(X)
p = L[N//2]
q = L[N//2-1]
for i in range(N) :
if X[i] <= q :
print(p)
else :
print(q)
| N = int(input())
X = list(map(int,input().split()))
Y = sorted(X)
a = Y[N//2-1]
b = Y[N//2]
ans = []
for x in X :
if x <= a :
ans.append(b)
else :
ans.append(a)
print(*ans,sep="\n")
| 11 | 17 | 194 | 226 | N = int(eval(input()))
X = list(map(int, input().split()))
L = sorted(X)
p = L[N // 2]
q = L[N // 2 - 1]
for i in range(N):
if X[i] <= q:
print(p)
else:
print(q)
| N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
a = Y[N // 2 - 1]
b = Y[N // 2]
ans = []
for x in X:
if x <= a:
ans.append(b)
else:
ans.append(a)
print(*ans, sep="\n")
| false | 35.294118 | [
"-N = int(eval(input()))",
"+N = int(input())",
"-L = sorted(X)",
"-p = L[N // 2]",
"-q = L[N // 2 - 1]",
"-for i in range(N):",
"- if X[i] <= q:",
"- print(p)",
"+Y = sorted(X)",
"+a = Y[N // 2 - 1]",
"+b = Y[N // 2]",
"+ans = []",
"+for x in X:",
"+ if x <= a:",
"+ ... | false | 0.032968 | 0.039522 | 0.834152 | [
"s246765329",
"s721768281"
] |
u549497563 | p03262 | python | s166030187 | s208135654 | 105 | 78 | 16,280 | 14,224 | Accepted | Accepted | 25.71 | from fractions import gcd
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
l = [abs(i-x) for i in l]
res = l[0]
for i in range(1,n):
res = gcd(res,l[i])
print(res) | n,x = list(map(int,input().split()))
xl = list(map(int,input().split()))
a = [abs(i-x) for i in xl]
def gcd(x,y):
if x<y:
x,y = y,x
if y==0:
return x
if x%y==0:
return y
else:
return gcd(y,x%y)
ans = a[0]
for i in a:
ans = gcd(ans,i)
print(ans) | 8 | 16 | 191 | 305 | from fractions import gcd
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
l = [abs(i - x) for i in l]
res = l[0]
for i in range(1, n):
res = gcd(res, l[i])
print(res)
| n, x = list(map(int, input().split()))
xl = list(map(int, input().split()))
a = [abs(i - x) for i in xl]
def gcd(x, y):
if x < y:
x, y = y, x
if y == 0:
return x
if x % y == 0:
return y
else:
return gcd(y, x % y)
ans = a[0]
for i in a:
ans = gcd(ans, i)
print(ans)... | false | 50 | [
"-from fractions import gcd",
"+n, x = list(map(int, input().split()))",
"+xl = list(map(int, input().split()))",
"+a = [abs(i - x) for i in xl]",
"-n, x = list(map(int, input().split()))",
"-l = list(map(int, input().split()))",
"-l = [abs(i - x) for i in l]",
"-res = l[0]",
"-for i in range(1, n):... | false | 0.043673 | 0.036302 | 1.203055 | [
"s166030187",
"s208135654"
] |
u747602774 | p02803 | python | s601004992 | s953199371 | 509 | 356 | 3,064 | 3,064 | Accepted | Accepted | 30.06 | H,W = list(map(int,input().split()))
grid = [eval(input()) for i in range(H)]
INF = 10 ** 18
ans = 0
for h in range(H):
for w in range(W):
if grid[h][w] == '#':
continue
dist = [[INF] * W for _ in range(H)]
dist[h][w] = 0
q = [(h,w)]
d = 1
... | def gridbfs(grid,sy,sx):
INF = 10**18
gridy = len(grid)
gridx = len(grid[0])
dist = [[INF]*gridx for _ in range(gridy)]
dist[sy][sx] = 0
q = [(sy,sx)]
d = 1
while q:
qq = []
for y,x in q:
for dy,dx in [(-1,0),(1,0),(0,-1),(0,1)]:
... | 35 | 42 | 992 | 1,058 | H, W = list(map(int, input().split()))
grid = [eval(input()) for i in range(H)]
INF = 10**18
ans = 0
for h in range(H):
for w in range(W):
if grid[h][w] == "#":
continue
dist = [[INF] * W for _ in range(H)]
dist[h][w] = 0
q = [(h, w)]
d = 1
while q:
... | def gridbfs(grid, sy, sx):
INF = 10**18
gridy = len(grid)
gridx = len(grid[0])
dist = [[INF] * gridx for _ in range(gridy)]
dist[sy][sx] = 0
q = [(sy, sx)]
d = 1
while q:
qq = []
for y, x in q:
for dy, dx in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
... | false | 16.666667 | [
"-H, W = list(map(int, input().split()))",
"-grid = [eval(input()) for i in range(H)]",
"-INF = 10**18",
"-ans = 0",
"-for h in range(H):",
"- for w in range(W):",
"- if grid[h][w] == \"#\":",
"+def gridbfs(grid, sy, sx):",
"+ INF = 10**18",
"+ gridy = len(grid)",
"+ gridx = l... | false | 0.042664 | 0.042184 | 1.011392 | [
"s601004992",
"s953199371"
] |
u922449550 | p02991 | python | s336048405 | s418272763 | 724 | 659 | 60,164 | 20,688 | Accepted | Accepted | 8.98 | from collections import deque
N, M = list(map(int, input().split()))
graph = [[] for i in range(3*N)]
for i in range(M):
u, v = list(map(int, input().split()))
u, v = 3*(u - 1), 3*(v - 1)
graph[u].append(v+1)
graph[u+1].append(v+2)
graph[u+2].append(v)
s, t = list(map(int, input().split()))
s,... | from collections import deque
N, M = list(map(int, input().split()))
graph = [[] for i in range(N)]
for i in range(M):
u, v = list(map(int, input().split()))
graph[u-1].append(v-1)
s, t = list(map(int, input().split()))
s -= 1
t -= 1
is_visited = [[False]*N for i in range(3)]
is_visited[0][s] = ... | 31 | 53 | 627 | 988 | from collections import deque
N, M = list(map(int, input().split()))
graph = [[] for i in range(3 * N)]
for i in range(M):
u, v = list(map(int, input().split()))
u, v = 3 * (u - 1), 3 * (v - 1)
graph[u].append(v + 1)
graph[u + 1].append(v + 2)
graph[u + 2].append(v)
s, t = list(map(int, input().spl... | from collections import deque
N, M = list(map(int, input().split()))
graph = [[] for i in range(N)]
for i in range(M):
u, v = list(map(int, input().split()))
graph[u - 1].append(v - 1)
s, t = list(map(int, input().split()))
s -= 1
t -= 1
is_visited = [[False] * N for i in range(3)]
is_visited[0][s] = True
d = ... | false | 41.509434 | [
"-graph = [[] for i in range(3 * N)]",
"+graph = [[] for i in range(N)]",
"- u, v = 3 * (u - 1), 3 * (v - 1)",
"- graph[u].append(v + 1)",
"- graph[u + 1].append(v + 2)",
"- graph[u + 2].append(v)",
"+ graph[u - 1].append(v - 1)",
"-s, t = 3 * (s - 1), 3 * (t - 1)",
"-dist = [10**9] *... | false | 0.134112 | 0.12898 | 1.039789 | [
"s336048405",
"s418272763"
] |
u757030836 | p02982 | python | s866749382 | s065421820 | 26 | 18 | 3,064 | 3,188 | Accepted | Accepted | 30.77 | n,d = list(map(int, input().split()))
x = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
for i in range(n):
for j in range(i+1, n):
dd = 0
for m in range(d):
dd += (x[i][m] - x[j][m]) ** 2
dd = dd**0.5
if dd.is_integer():
ans += 1
... | n,d = list(map(int, input().split()))
x = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
for i in range(n):
for j in range(i+1, n):
dd = 0
for m in range(d):
dd += (x[i][m] - x[j][m]) ** 2
dd = dd**0.5
if dd % 1 ==0:
ans += 1
prin... | 14 | 14 | 326 | 321 | n, d = list(map(int, input().split()))
x = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
for i in range(n):
for j in range(i + 1, n):
dd = 0
for m in range(d):
dd += (x[i][m] - x[j][m]) ** 2
dd = dd**0.5
if dd.is_integer():
ans += 1
print(ans)
| n, d = list(map(int, input().split()))
x = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
for i in range(n):
for j in range(i + 1, n):
dd = 0
for m in range(d):
dd += (x[i][m] - x[j][m]) ** 2
dd = dd**0.5
if dd % 1 == 0:
ans += 1
print(ans)
| false | 0 | [
"- if dd.is_integer():",
"+ if dd % 1 == 0:"
] | false | 0.037007 | 0.036682 | 1.008846 | [
"s866749382",
"s065421820"
] |
u678167152 | p02558 | python | s834188161 | s980931123 | 350 | 322 | 80,984 | 83,236 | Accepted | Accepted | 8 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
y = self.find(y... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
y = self.find(y... | 59 | 56 | 1,325 | 1,282 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.f... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.f... | false | 5.084746 | [
"- if t == 0:",
"+ if t:",
"+ ans.append(int(uf.same(u, v)))",
"+ else:",
"- else:",
"- if uf.same(u, v):",
"- ans.append(1)",
"- else:",
"- ans.append(0)"
] | false | 0.042007 | 0.044426 | 0.945551 | [
"s834188161",
"s980931123"
] |
u671211357 | p02952 | python | s497804013 | s233786304 | 79 | 56 | 7,064 | 2,940 | Accepted | Accepted | 29.11 | N = int(eval(input()))
hako = []
ans = 0
for i in range(N):
hako.append(N-i)
for k in range(N):
nakami = hako[k]
if len(str(nakami))%2 >= 1:
ans += 1
print(ans)
| count = 0
S=int(eval(input()))
for i in range(1,S+1):
if len(str(i))%2==1:
count +=1
print(count)
| 10 | 6 | 184 | 109 | N = int(eval(input()))
hako = []
ans = 0
for i in range(N):
hako.append(N - i)
for k in range(N):
nakami = hako[k]
if len(str(nakami)) % 2 >= 1:
ans += 1
print(ans)
| count = 0
S = int(eval(input()))
for i in range(1, S + 1):
if len(str(i)) % 2 == 1:
count += 1
print(count)
| false | 40 | [
"-N = int(eval(input()))",
"-hako = []",
"-ans = 0",
"-for i in range(N):",
"- hako.append(N - i)",
"-for k in range(N):",
"- nakami = hako[k]",
"- if len(str(nakami)) % 2 >= 1:",
"- ans += 1",
"-print(ans)",
"+count = 0",
"+S = int(eval(input()))",
"+for i in range(1, S + 1)... | false | 0.049601 | 0.090867 | 0.545869 | [
"s497804013",
"s233786304"
] |
u654470292 | p02923 | python | s759282963 | s972511911 | 233 | 99 | 63,984 | 90,688 | Accepted | Accepted | 57.51 | import sys
def input():
return sys.stdin.readline()[:-1]
n=int(eval(input()))
h=list(map(int,input().split()))
ans=[0]*n
tmp=1
for i in range(n-1):
if h[i]>=h[i+1]:
ans[i]=tmp
tmp+=1
else:
tmp=1
print((max(ans))) | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecurs... | 14 | 27 | 253 | 631 | import sys
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
h = list(map(int, input().split()))
ans = [0] * n
tmp = 1
for i in range(n - 1):
if h[i] >= h[i + 1]:
ans[i] = tmp
tmp += 1
else:
tmp = 1
print((max(ans)))
| import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
sys.setrecursionl... | false | 48.148148 | [
"+import bisect",
"+import copy",
"+import heapq",
"+import math",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+def ruiseki(lst):",
"+ return [0] + list(accumulate(lst))",
"+",
"+",
"+sys.setrec... | false | 0.043526 | 0.033831 | 1.286564 | [
"s759282963",
"s972511911"
] |
u699089116 | p03545 | python | s794272475 | s030128509 | 184 | 26 | 38,384 | 9,112 | Accepted | Accepted | 85.87 | import itertools
n = eval(input())
a, b, c, d = n
for i, j, k in itertools.product(["+", "-"], repeat=3):
if eval(a + i + b + j + c + k + d) == 7:
print((a+i+b+j+c+k+d + "=7"))
exit()
| from itertools import product
s = eval(input())
A, B, C, D = int(s[0]), int(s[1]), int(s[2]), int(s[3])
P = product([1, -1], repeat=3)
def convert(integer):
if integer == 1:
return "+"
elif integer == -1:
return "-"
for o1, o2, o3 in P:
if A + B * o1 + C * o2 + D * o3 == 7:
... | 8 | 16 | 204 | 427 | import itertools
n = eval(input())
a, b, c, d = n
for i, j, k in itertools.product(["+", "-"], repeat=3):
if eval(a + i + b + j + c + k + d) == 7:
print((a + i + b + j + c + k + d + "=7"))
exit()
| from itertools import product
s = eval(input())
A, B, C, D = int(s[0]), int(s[1]), int(s[2]), int(s[3])
P = product([1, -1], repeat=3)
def convert(integer):
if integer == 1:
return "+"
elif integer == -1:
return "-"
for o1, o2, o3 in P:
if A + B * o1 + C * o2 + D * o3 == 7:
prin... | false | 50 | [
"-import itertools",
"+from itertools import product",
"-n = eval(input())",
"-a, b, c, d = n",
"-for i, j, k in itertools.product([\"+\", \"-\"], repeat=3):",
"- if eval(a + i + b + j + c + k + d) == 7:",
"- print((a + i + b + j + c + k + d + \"=7\"))",
"+s = eval(input())",
"+A, B, C, D ... | false | 0.037835 | 0.05272 | 0.717658 | [
"s794272475",
"s030128509"
] |
u325282913 | p02899 | python | s453850837 | s724542543 | 504 | 85 | 73,384 | 20,392 | Accepted | Accepted | 83.13 | N = int(input())
a = list(map(int, input().split()))
dic = {}
for i in range(N):
dic[i+1] = a[i]
dic_sorted = sorted(dic.items(), key=lambda x:x[1])
for i in range(N):
print(dic_sorted[i][0],'',end="")
| N = int(eval(input()))
arr = list(map(int, input().split()))
arr2 = [0]*N
for i in range(N):
arr2[arr[i]-1] = i+1
print((*arr2)) | 8 | 6 | 216 | 129 | N = int(input())
a = list(map(int, input().split()))
dic = {}
for i in range(N):
dic[i + 1] = a[i]
dic_sorted = sorted(dic.items(), key=lambda x: x[1])
for i in range(N):
print(dic_sorted[i][0], "", end="")
| N = int(eval(input()))
arr = list(map(int, input().split()))
arr2 = [0] * N
for i in range(N):
arr2[arr[i] - 1] = i + 1
print((*arr2))
| false | 25 | [
"-N = int(input())",
"-a = list(map(int, input().split()))",
"-dic = {}",
"+N = int(eval(input()))",
"+arr = list(map(int, input().split()))",
"+arr2 = [0] * N",
"- dic[i + 1] = a[i]",
"-dic_sorted = sorted(dic.items(), key=lambda x: x[1])",
"-for i in range(N):",
"- print(dic_sorted[i][0], ... | false | 0.118848 | 0.037365 | 3.180738 | [
"s453850837",
"s724542543"
] |
u987164499 | p02727 | python | s838694177 | s991443644 | 557 | 321 | 103,072 | 23,456 | Accepted | Accepted | 42.37 | from sys import stdin,setrecursionlimit
import heapq
x,y,a,b,c = list(map(int,stdin.readline().rstrip().split()))
p = list(map(int,stdin.readline().rstrip().split()))
q = list(map(int,stdin.readline().rstrip().split()))
r = list(map(int,stdin.readline().rstrip().split()))
p.sort()
q.sort()
r.sort(reverse ... | import heapq
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
#価値が小さいように並べる
p.sort()
q.sort()
#価値が大きいように並べる
r.sort(reverse = True)
#結局赤色上位x個,緑色上位y個だけ残せばよい
p = p[a-x:]
q = q[b-y:]
# heapqの形にする
hea... | 30 | 35 | 629 | 602 | from sys import stdin, setrecursionlimit
import heapq
x, y, a, b, c = list(map(int, stdin.readline().rstrip().split()))
p = list(map(int, stdin.readline().rstrip().split()))
q = list(map(int, stdin.readline().rstrip().split()))
r = list(map(int, stdin.readline().rstrip().split()))
p.sort()
q.sort()
r.sort(reverse=True... | import heapq
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
# 価値が小さいように並べる
p.sort()
q.sort()
# 価値が大きいように並べる
r.sort(reverse=True)
# 結局赤色上位x個,緑色上位y個だけ残せばよい
p = p[a - x :]
q = q[b - y :]
# heapqの形にする
heapq.heapify... | false | 14.285714 | [
"-from sys import stdin, setrecursionlimit",
"-x, y, a, b, c = list(map(int, stdin.readline().rstrip().split()))",
"-p = list(map(int, stdin.readline().rstrip().split()))",
"-q = list(map(int, stdin.readline().rstrip().split()))",
"-r = list(map(int, stdin.readline().rstrip().split()))",
"+x, y, a, b, c =... | false | 0.070852 | 0.074282 | 0.953834 | [
"s838694177",
"s991443644"
] |
u379142263 | p02819 | python | s690117617 | s081993042 | 274 | 17 | 3,064 | 2,940 | Accepted | Accepted | 93.8 | import sys
n = int(eval(input()))
for i in range(n,2*n):
chk = True
for j in range(2,n):
if i%j==0:
chk=False
if chk==True:
print(i)
sys.exit()
| x = int(eval(input()))
def is_prime(n):
for i in range(2,int(n**0.5)+1):
if n%i != 0:
continue
else:
return False
return True
while True:
if is_prime(x) == True:
break
else:
x +=1
print(x)
| 10 | 14 | 195 | 269 | import sys
n = int(eval(input()))
for i in range(n, 2 * n):
chk = True
for j in range(2, n):
if i % j == 0:
chk = False
if chk == True:
print(i)
sys.exit()
| x = int(eval(input()))
def is_prime(n):
for i in range(2, int(n**0.5) + 1):
if n % i != 0:
continue
else:
return False
return True
while True:
if is_prime(x) == True:
break
else:
x += 1
print(x)
| false | 28.571429 | [
"-import sys",
"+x = int(eval(input()))",
"-n = int(eval(input()))",
"-for i in range(n, 2 * n):",
"- chk = True",
"- for j in range(2, n):",
"- if i % j == 0:",
"- chk = False",
"- if chk == True:",
"- print(i)",
"- sys.exit()",
"+",
"+def is_prime(n... | false | 0.224066 | 0.037739 | 5.937212 | [
"s690117617",
"s081993042"
] |
u094158322 | p02608 | python | s671306358 | s489442637 | 152 | 123 | 75,032 | 71,000 | Accepted | Accepted | 19.08 | from collections import defaultdict
n=int(eval(input()))
MAX=10001
RMAX=102
d = defaultdict(int)
for i in range(1,RMAX):
wkx = i * i
if wkx > MAX:
break
for j in range(1,RMAX):
wky = wkx + j * j + i * j
if wky > MAX :
break
for k in range(1,RMAX):
... | from collections import defaultdict
n=int(eval(input()))
MAX=10000
d = defaultdict(int)
def col(x,y,z):
if x == y and x == z :
return 1
if x == y or y == z or z == x :
return 3
return 6
# x <= y <= z
for i in range(1,MAX):
wkx = i**2
if wkx > MAX:
break
... | 22 | 31 | 502 | 657 | from collections import defaultdict
n = int(eval(input()))
MAX = 10001
RMAX = 102
d = defaultdict(int)
for i in range(1, RMAX):
wkx = i * i
if wkx > MAX:
break
for j in range(1, RMAX):
wky = wkx + j * j + i * j
if wky > MAX:
break
for k in range(1, RMAX):
... | from collections import defaultdict
n = int(eval(input()))
MAX = 10000
d = defaultdict(int)
def col(x, y, z):
if x == y and x == z:
return 1
if x == y or y == z or z == x:
return 3
return 6
# x <= y <= z
for i in range(1, MAX):
wkx = i**2
if wkx > MAX:
break
for j in... | false | 29.032258 | [
"-MAX = 10001",
"-RMAX = 102",
"+MAX = 10000",
"-for i in range(1, RMAX):",
"- wkx = i * i",
"+",
"+",
"+def col(x, y, z):",
"+ if x == y and x == z:",
"+ return 1",
"+ if x == y or y == z or z == x:",
"+ return 3",
"+ return 6",
"+",
"+",
"+# x <= y <= z",
... | false | 0.245489 | 0.096026 | 2.556483 | [
"s671306358",
"s489442637"
] |
u037430802 | p02792 | python | s356220297 | s970732900 | 230 | 140 | 3,060 | 68,472 | Accepted | Accepted | 39.13 |
N = int(eval(input()))
C = [[0 for _ in range(10)] for _ in range(10)]
for n in range(1, N+1):
head = int(str(n)[0])
tail = int(str(n)[-1])
C[head][tail] += 1
ans = 0
for i in range(1,10):
for j in range(1,10):
ans += C[i][j] * C[j][i]
print(ans)
|
from collections import defaultdict
N = int(eval(input()))
"""
愚直解だと、Aを1~Nまで動かした時、各Aについて何個Bを取れるかを足し合わせると答えが出る。が、これはN<=2*10**5なのでO(N^2)は間に合わない。
事前に先頭がxで末尾がyの個数を、1~Nまで数え上げておくと、各Aについて先頭と末尾を抜き出して、それに対応するBの個数を足し合わせるとO(N)で求められる
"""
d = defaultdict(int)
for i in range(1,N+1):
d[(int(str(i)[0]... | 21 | 29 | 295 | 460 | N = int(eval(input()))
C = [[0 for _ in range(10)] for _ in range(10)]
for n in range(1, N + 1):
head = int(str(n)[0])
tail = int(str(n)[-1])
C[head][tail] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += C[i][j] * C[j][i]
print(ans)
| from collections import defaultdict
N = int(eval(input()))
"""
愚直解だと、Aを1~Nまで動かした時、各Aについて何個Bを取れるかを足し合わせると答えが出る。が、これはN<=2*10**5なのでO(N^2)は間に合わない。
事前に先頭がxで末尾がyの個数を、1~Nまで数え上げておくと、各Aについて先頭と末尾を抜き出して、それに対応するBの個数を足し合わせるとO(N)で求められる
"""
d = defaultdict(int)
for i in range(1, N + 1):
d[(int(str(i)[0]), int(str(i)[-1]))] += 1
... | false | 27.586207 | [
"+from collections import defaultdict",
"+",
"-C = [[0 for _ in range(10)] for _ in range(10)]",
"-for n in range(1, N + 1):",
"- head = int(str(n)[0])",
"- tail = int(str(n)[-1])",
"- C[head][tail] += 1",
"+\"\"\"",
"+愚直解だと、Aを1~Nまで動かした時、各Aについて何個Bを取れるかを足し合わせると答えが出る。が、これはN<=2*10**5なのでO(N^2)は... | false | 0.173797 | 0.159387 | 1.090413 | [
"s356220297",
"s970732900"
] |
u762420987 | p02889 | python | s176058573 | s776561946 | 1,957 | 1,580 | 20,444 | 19,284 | Accepted | Accepted | 19.26 | import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
inf = float("inf")
N, M, L = list(map(int, input().split()))
graph = np.zeros((N, N))
for _ in range(M):
A, B, C = list(map(int, input().split()))
graph[A-1][B-1] = C
graph[B-1][A-1] = C
shortest_... | import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
inf = float("inf")
N, M, L = list(map(int, input().split()))
graph = np.zeros((N, N))
for _ in range(M):
A, B, C = list(map(int, input().split()))
graph[A-1][B-1] = C
graph[B-1][A-1] = C
shortest_... | 25 | 25 | 779 | 781 | import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
inf = float("inf")
N, M, L = list(map(int, input().split()))
graph = np.zeros((N, N))
for _ in range(M):
A, B, C = list(map(int, input().split()))
graph[A - 1][B - 1] = C
graph[B - 1][A - 1] = C
shortest_p... | import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
inf = float("inf")
N, M, L = list(map(int, input().split()))
graph = np.zeros((N, N))
for _ in range(M):
A, B, C = list(map(int, input().split()))
graph[A - 1][B - 1] = C
graph[B - 1][A - 1] = C
shortest_p... | false | 0 | [
"-shortest_paths = shortest_path(csr_matrix(graph), directed=False, method=\"D\")",
"+shortest_paths = shortest_path(csr_matrix(graph), directed=False, method=\"FW\")",
"-costs = shortest_path(csr_matrix(graph), directed=False, method=\"D\")",
"+costs = shortest_path(csr_matrix(graph), directed=False, method=... | false | 0.357668 | 0.353209 | 1.012625 | [
"s176058573",
"s776561946"
] |
u248416507 | p00741 | python | s921336415 | s428667039 | 80 | 70 | 8,460 | 6,376 | Accepted | Accepted | 12.5 | import sys
def visit(x, y, area):
area[y][x] = 0
move = [(-1, 0), (0, 1), (1, 0), (0, -1), (1, -1), (1, 1), (-1, 1), (-1, -1)]
#print '(' + str(x) + ',' + str(y) + ')'
for i in move:
if 0 <= (x + i[0]) < w and 0 <= (y + i[1]) < h and area[y + i[1]][x + i[0]] == 1:
visit(x... | def solve_sub(x, y, area):
stack = []
stack.append((x, y))
move = [(x, y) for x in range(-1, 2) for y in range(-1, 2) if not (x == 0 and y == 0)]
while len(stack) != 0:
now = stack.pop()
x = now[0]
y = now[1]
area[y][x] = 0
for dire in move:
... | 37 | 39 | 897 | 999 | import sys
def visit(x, y, area):
area[y][x] = 0
move = [(-1, 0), (0, 1), (1, 0), (0, -1), (1, -1), (1, 1), (-1, 1), (-1, -1)]
# print '(' + str(x) + ',' + str(y) + ')'
for i in move:
if (
0 <= (x + i[0]) < w
and 0 <= (y + i[1]) < h
and area[y + i[1]][x + i[... | def solve_sub(x, y, area):
stack = []
stack.append((x, y))
move = [
(x, y) for x in range(-1, 2) for y in range(-1, 2) if not (x == 0 and y == 0)
]
while len(stack) != 0:
now = stack.pop()
x = now[0]
y = now[1]
area[y][x] = 0
for dire in move:
... | false | 5.128205 | [
"-import sys",
"+def solve_sub(x, y, area):",
"+ stack = []",
"+ stack.append((x, y))",
"+ move = [",
"+ (x, y) for x in range(-1, 2) for y in range(-1, 2) if not (x == 0 and y == 0)",
"+ ]",
"+ while len(stack) != 0:",
"+ now = stack.pop()",
"+ x = now[0]",
"... | false | 0.099705 | 0.043633 | 2.285078 | [
"s921336415",
"s428667039"
] |
u761320129 | p03309 | python | s981618513 | s484593580 | 673 | 194 | 56,032 | 29,216 | Accepted | Accepted | 71.17 | from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
B = [a-i-1 for i,a in enumerate(A)]
ctr = Counter(B)
st = sorted(list(ctr.items()))
left = l_sum = 0
ans = r_sum = sum([(k - st[0][0])*v for k,v in st[1:]])
for (k1,v1),(k2,v2) in zip(st,st[1:]):
left += v1
l... | N = int(eval(input()))
A = list(map(int,input().split()))
B = [a-i-1 for i,a in enumerate(A)]
med = list(sorted(B))[N//2]
print((sum([abs(a-med) for a in B]))) | 17 | 5 | 433 | 155 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
B = [a - i - 1 for i, a in enumerate(A)]
ctr = Counter(B)
st = sorted(list(ctr.items()))
left = l_sum = 0
ans = r_sum = sum([(k - st[0][0]) * v for k, v in st[1:]])
for (k1, v1), (k2, v2) in zip(st, st[1:]):
left += v1
l... | N = int(eval(input()))
A = list(map(int, input().split()))
B = [a - i - 1 for i, a in enumerate(A)]
med = list(sorted(B))[N // 2]
print((sum([abs(a - med) for a in B])))
| false | 70.588235 | [
"-from collections import Counter",
"-",
"-ctr = Counter(B)",
"-st = sorted(list(ctr.items()))",
"-left = l_sum = 0",
"-ans = r_sum = sum([(k - st[0][0]) * v for k, v in st[1:]])",
"-for (k1, v1), (k2, v2) in zip(st, st[1:]):",
"- left += v1",
"- l_sum += left * (k2 - k1)",
"- right = N -... | false | 0.036554 | 0.035999 | 1.015411 | [
"s981618513",
"s484593580"
] |
u187516587 | p03965 | python | s667931309 | s188808950 | 36 | 18 | 3,316 | 3,188 | Accepted | Accepted | 50 | s=eval(input())
c=False
a=0
for i in s:
if i=="g" and c:
a+=1
elif i=="p" and not c:
a-=1
c=not c
print(a) | s=eval(input())
g=s.count("g")
l=len(s)
print((l//2+g-l)) | 10 | 4 | 137 | 52 | s = eval(input())
c = False
a = 0
for i in s:
if i == "g" and c:
a += 1
elif i == "p" and not c:
a -= 1
c = not c
print(a)
| s = eval(input())
g = s.count("g")
l = len(s)
print((l // 2 + g - l))
| false | 60 | [
"-c = False",
"-a = 0",
"-for i in s:",
"- if i == \"g\" and c:",
"- a += 1",
"- elif i == \"p\" and not c:",
"- a -= 1",
"- c = not c",
"-print(a)",
"+g = s.count(\"g\")",
"+l = len(s)",
"+print((l // 2 + g - l))"
] | false | 0.039051 | 0.034101 | 1.145153 | [
"s667931309",
"s188808950"
] |
u887207211 | p03290 | python | s944726999 | s704742321 | 25 | 22 | 3,064 | 3,064 | Accepted | Accepted | 12 | D, G = list(map(int,input().split()))
pc = [list(map(int,input().split())) for _ in range(D)]
ans = 1e9
for i in range(1 << D):
cnt = 0
point = 0
for j in range(D):
if(((i >> j) & 1) == 1):
point += pc[j][0]*100*(j+1) + pc[j][1]
cnt += pc[j][0]
else:
tmp = j
if(point < G)... | D, G = list(map(int,input().split()))
PC = [list(map(int,input().split())) for _ in range(D)]
ans = 1e9
for i in range(1 << D):
point = 0
cnt = 0
for j in range(D):
if(((i >> j) & 1) == 1):
point += PC[j][0]*(j+1)*100 + PC[j][1]
cnt += PC[j][0]
else:
tmp = j
if(point < G)... | 20 | 20 | 459 | 459 | D, G = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(D)]
ans = 1e9
for i in range(1 << D):
cnt = 0
point = 0
for j in range(D):
if ((i >> j) & 1) == 1:
point += pc[j][0] * 100 * (j + 1) + pc[j][1]
cnt += pc[j][0]
else:
... | D, G = list(map(int, input().split()))
PC = [list(map(int, input().split())) for _ in range(D)]
ans = 1e9
for i in range(1 << D):
point = 0
cnt = 0
for j in range(D):
if ((i >> j) & 1) == 1:
point += PC[j][0] * (j + 1) * 100 + PC[j][1]
cnt += PC[j][0]
else:
... | false | 0 | [
"-pc = [list(map(int, input().split())) for _ in range(D)]",
"+PC = [list(map(int, input().split())) for _ in range(D)]",
"+ point = 0",
"- point = 0",
"- point += pc[j][0] * 100 * (j + 1) + pc[j][1]",
"- cnt += pc[j][0]",
"+ point += PC[j][0] * (j + 1) * 100 + PC[... | false | 0.049764 | 0.034813 | 1.429465 | [
"s944726999",
"s704742321"
] |
u422272120 | p04045 | python | s659928838 | s392511263 | 147 | 76 | 3,060 | 5,472 | Accepted | Accepted | 48.3 | n,k = list(map(int,input().split()))
D = list(map(int,input().split()))
ans = n
while True:
for i in list(map(int, str(ans))):
if i in D:
break
else:
print (ans)
exit ()
ans += 1
| import sys
sys.setrecursionlimit(500000)
n,k = list(map(int,input().split()))
D = list(map(int,input().split()))
ans = []
def dfs(p:str):
if int(p)>=n:
ans.append(int(p))
return
if len(p)>len(str(n))+1:
return
for i in range(10):
if not i in D:
... | 13 | 24 | 235 | 414 | n, k = list(map(int, input().split()))
D = list(map(int, input().split()))
ans = n
while True:
for i in list(map(int, str(ans))):
if i in D:
break
else:
print(ans)
exit()
ans += 1
| import sys
sys.setrecursionlimit(500000)
n, k = list(map(int, input().split()))
D = list(map(int, input().split()))
ans = []
def dfs(p: str):
if int(p) >= n:
ans.append(int(p))
return
if len(p) > len(str(n)) + 1:
return
for i in range(10):
if not i in D:
dfs(p ... | false | 45.833333 | [
"+import sys",
"+",
"+sys.setrecursionlimit(500000)",
"-ans = n",
"-while True:",
"- for i in list(map(int, str(ans))):",
"- if i in D:",
"- break",
"- else:",
"- print(ans)",
"- exit()",
"- ans += 1",
"+ans = []",
"+",
"+",
"+def dfs(p: str):",... | false | 0.088591 | 0.084456 | 1.04896 | [
"s659928838",
"s392511263"
] |
u848647227 | p03763 | python | s524162625 | s274607925 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | a = int(eval(input()))
ar = []
for i in range(a):
l = eval(input())
ar.append(l)
br = set(list(ar[0]))
dr = []
for r in br:
cr =[]
count = 0
for rr in ar:
if rr.count(r) > 0:
cr.append(rr.count(r))
count += 1
if count == a:
for i in ... | a = int(eval(input()))
ar = []
l = 51
t = ''
for i in range(a):
j = eval(input())
ar.append(j)
if len(j) < l:
l = len(j)
t = j
T = list(t)
br = []
for r in set(T):
count = 0
cr = []
for l in ar:
if r not in l:
break
else:
... | 19 | 26 | 399 | 471 | a = int(eval(input()))
ar = []
for i in range(a):
l = eval(input())
ar.append(l)
br = set(list(ar[0]))
dr = []
for r in br:
cr = []
count = 0
for rr in ar:
if rr.count(r) > 0:
cr.append(rr.count(r))
count += 1
if count == a:
for i in range(min(cr))... | a = int(eval(input()))
ar = []
l = 51
t = ""
for i in range(a):
j = eval(input())
ar.append(j)
if len(j) < l:
l = len(j)
t = j
T = list(t)
br = []
for r in set(T):
count = 0
cr = []
for l in ar:
if r not in l:
break
else:
cr.append(l.count(... | false | 26.923077 | [
"+l = 51",
"+t = \"\"",
"- l = eval(input())",
"- ar.append(l)",
"-br = set(list(ar[0]))",
"-dr = []",
"-for r in br:",
"+ j = eval(input())",
"+ ar.append(j)",
"+ if len(j) < l:",
"+ l = len(j)",
"+ t = j",
"+T = list(t)",
"+br = []",
"+for r in set(T):",
... | false | 0.044594 | 0.044497 | 1.002164 | [
"s524162625",
"s274607925"
] |
u054556734 | p02683 | python | s320078343 | s889960027 | 304 | 164 | 27,256 | 27,260 | Accepted | Accepted | 46.05 | import numpy as np
n,m,x = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
ans = np.inf
flag = 0
for i in range(2**n):
r = np.array([0]*(m+1))
for j in range(n):
if (i>>j)&1:
for k in range(m+1): r[k] += a[j][k]
if np.all(r[1:]>=x):
... | import numpy as np
import sys
n,m,x = list(map(int,input().split()))
arr = np.array([list(map(int,input().split())) for i in range(n)])
c = arr.T[0] # c[n-1]まで
a = arr.T[1:].T # a[n-1][m-1]まで
ans = np.inf
for i in range(2**n):
ability = np.zeros(m, np.int64)
cost = 0
for j in range(n):
... | 18 | 21 | 424 | 495 | import numpy as np
n, m, x = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]
ans = np.inf
flag = 0
for i in range(2**n):
r = np.array([0] * (m + 1))
for j in range(n):
if (i >> j) & 1:
for k in range(m + 1):
r[k] += a[j][k]
if np.a... | import numpy as np
import sys
n, m, x = list(map(int, input().split()))
arr = np.array([list(map(int, input().split())) for i in range(n)])
c = arr.T[0] # c[n-1]まで
a = arr.T[1:].T # a[n-1][m-1]まで
ans = np.inf
for i in range(2**n):
ability = np.zeros(m, np.int64)
cost = 0
for j in range(n):
if (i ... | false | 14.285714 | [
"+import sys",
"-a = [list(map(int, input().split())) for i in range(n)]",
"+arr = np.array([list(map(int, input().split())) for i in range(n)])",
"+c = arr.T[0] # c[n-1]まで",
"+a = arr.T[1:].T # a[n-1][m-1]まで",
"-flag = 0",
"- r = np.array([0] * (m + 1))",
"+ ability = np.zeros(m, np.int64)",
... | false | 0.380345 | 0.344756 | 1.103231 | [
"s320078343",
"s889960027"
] |
u102461423 | p03160 | python | s981955152 | s413583148 | 396 | 138 | 96,732 | 32,888 | Accepted | Accepted | 65.15 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(H):
dp = np.zeros_like(H)
dp[1] = abs(H[1] - H[0])
for n in range(2, len(H)):
x = dp[n - 1] + abs(H[n - 1] - H[n])
... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(H):
dp = np.zeros_like(H)
dp[1] = abs(H[1] - H[0])
for n in range(2, len(H)):
x = dp[n - 1] + abs(H[n - 1] - H[n])
y = dp[n - 2] + abs... | 29 | 28 | 678 | 654 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(H):
dp = np.zeros_like(H)
dp[1] = abs(H[1] - H[0])
for n in range(2, len(H)):
x = dp[n - 1] + abs(H[n - 1] - H[n])
y = dp[... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(H):
dp = np.zeros_like(H)
dp[1] = abs(H[1] - H[0])
for n in range(2, len(H)):
x = dp[n - 1] + abs(H[n - 1] - H[n])
y = dp[n - 2] + abs(H[n - 2] -... | false | 3.448276 | [
"-from numba import njit"
] | false | 0.626966 | 0.621144 | 1.009373 | [
"s981955152",
"s413583148"
] |
u849334482 | p02681 | python | s455951289 | s435625932 | 22 | 20 | 8,924 | 9,096 | Accepted | Accepted | 9.09 | prev = eval(input())
new = eval(input())
flag = 0
if len(prev)+1 == len(new):
for i in range(len(prev)):
if prev[i] == new[i]:
flag += 1
if flag == len(prev):
print('Yes')
else:
print('No') | s = eval(input())
t = input()[:-1]
if s == t:
print("Yes")
else:
print("No") | 11 | 7 | 203 | 85 | prev = eval(input())
new = eval(input())
flag = 0
if len(prev) + 1 == len(new):
for i in range(len(prev)):
if prev[i] == new[i]:
flag += 1
if flag == len(prev):
print("Yes")
else:
print("No")
| s = eval(input())
t = input()[:-1]
if s == t:
print("Yes")
else:
print("No")
| false | 36.363636 | [
"-prev = eval(input())",
"-new = eval(input())",
"-flag = 0",
"-if len(prev) + 1 == len(new):",
"- for i in range(len(prev)):",
"- if prev[i] == new[i]:",
"- flag += 1",
"-if flag == len(prev):",
"+s = eval(input())",
"+t = input()[:-1]",
"+if s == t:"
] | false | 0.047975 | 0.044389 | 1.080794 | [
"s455951289",
"s435625932"
] |
u761529120 | p03356 | python | s537343254 | s333062144 | 1,021 | 353 | 90,860 | 85,676 | Accepted | Accepted | 65.43 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 58 | 74 | 1,278 | 1,698 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 21.621622 | [
"+ def roots(self):",
"+ return [i for i, x in enumerate(self.parents) if x < 0]",
"-def func(x):",
"- return x - 1",
"+ def group_count(self):",
"+ return len(self.roots())",
"+",
"+ def all_group_members(self):",
"+ return {r: self.members(r) for r in self.roots()}... | false | 0.039997 | 0.104944 | 0.381124 | [
"s537343254",
"s333062144"
] |
u867848444 | p02861 | python | s739039320 | s192825601 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | n=int(eval(input()))
xy=[list(map(int,input().split())) for i in range(n)]
d=0
for i in range(n):
for j in range(n):
d+=((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**0.5
print((d/n))
| n=int(eval(input()))
xy=[list(map(int,input().split())) for i in range(n)]
def dis(a,b):
d=(a[0]-b[0])**2+(a[1]-b[1])**2
return d**0.5
ans=0
from itertools import combinations
# listから2つ選ぶ組み合わせ
for a,b in combinations(xy, 2):
ans+=dis(a,b)
print((2*ans/n)) | 9 | 13 | 200 | 274 | n = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(n)]
d = 0
for i in range(n):
for j in range(n):
d += ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** 0.5
print((d / n))
| n = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(n)]
def dis(a, b):
d = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
return d**0.5
ans = 0
from itertools import combinations
# listから2つ選ぶ組み合わせ
for a, b in combinations(xy, 2):
ans += dis(a, b)
print((2 * ans / n))
| false | 30.769231 | [
"-d = 0",
"-for i in range(n):",
"- for j in range(n):",
"- d += ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** 0.5",
"-print((d / n))",
"+",
"+",
"+def dis(a, b):",
"+ d = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2",
"+ return d**0.5",
"+",
"+",
"+ans = 0",
"+fr... | false | 0.176707 | 0.113514 | 1.556708 | [
"s739039320",
"s192825601"
] |
u506858457 | p02803 | python | s827243953 | s314198046 | 358 | 234 | 3,316 | 9,144 | Accepted | Accepted | 34.64 | '''ika tako
スタートが決められたとき、そこから最も遠いマスは、
幅優先探索で最後に訪れたマスとなる。
よって、道である各マスをスタート地点として全て試し、
最長移動距離の最大値が答え。
H,W の上限が小さいので、スタート地点候補が最大400、
1回の探索で探索するマスが最大400、あわせて160000回に
比例する計算量で間に合う。
'''
from collections import deque
def bfs(field, s):
MOVE = [(0, 1), (1, 0), (0, -1), (-1, 0)]
q = deque([(0, s)])
d... | from collections import deque
def MI(): return list(map(int, input().split()))
def bfs(field,s):
q=deque([(0,s)])
MOVE=[(-1,0),(0,-1),(0,1),(1,0)]
d,i,j=-1,-1,-1
dist=[[-1]*W for i in range(H)]
while q:
d,(i,j)=q.popleft()
if dist[i][j]!=-1:
continue
dist[i][j]=d
for di,dj ... | 42 | 32 | 1,080 | 739 | """ika tako
スタートが決められたとき、そこから最も遠いマスは、
幅優先探索で最後に訪れたマスとなる。
よって、道である各マスをスタート地点として全て試し、
最長移動距離の最大値が答え。
H,W の上限が小さいので、スタート地点候補が最大400、
1回の探索で探索するマスが最大400、あわせて160000回に
比例する計算量で間に合う。
"""
from collections import deque
def bfs(field, s):
MOVE = [(0, 1), (1, 0), (0, -1), (-1, 0)]
q = deque([(0, s)])
dist = [[-1] * ... | from collections import deque
def MI():
return list(map(int, input().split()))
def bfs(field, s):
q = deque([(0, s)])
MOVE = [(-1, 0), (0, -1), (0, 1), (1, 0)]
d, i, j = -1, -1, -1
dist = [[-1] * W for i in range(H)]
while q:
d, (i, j) = q.popleft()
if dist[i][j] != -1:
... | false | 23.809524 | [
"-\"\"\"ika tako",
"-スタートが決められたとき、そこから最も遠いマスは、",
"-幅優先探索で最後に訪れたマスとなる。",
"-よって、道である各マスをスタート地点として全て試し、",
"-最長移動距離の最大値が答え。",
"-H,W の上限が小さいので、スタート地点候補が最大400、",
"-1回の探索で探索するマスが最大400、あわせて160000回に",
"-比例する計算量で間に合う。",
"-\"\"\"",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",... | false | 0.067305 | 0.103399 | 0.650923 | [
"s827243953",
"s314198046"
] |
u852690916 | p03078 | python | s984589412 | s930597496 | 859 | 115 | 253,384 | 80,456 | Accepted | Accepted | 86.61 | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from itertools import product
import sys
def main(X, Y, Z, K, A, B, C):
AB = sorted([a + b for a, b in product(A, B)], reverse=True)
ABC = sorted([ab + c for ab, c in product(AB[:K], C)], reverse=True)
for k in range(K):
print((ABC[k]))
if __n... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from itertools import product
import sys
def main(X, Y, Z, K, A, B, C):
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ans = []
for x in range(1, X + 1):
if x > K: break
for y in range(1, Y + 1):
if... | 16 | 26 | 557 | 801 | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from itertools import product
import sys
def main(X, Y, Z, K, A, B, C):
AB = sorted([a + b for a, b in product(A, B)], reverse=True)
ABC = sorted([ab + c for ab, c in product(AB[:K], C)], reverse=True)
for k in range(K):
print((ABC[k]))
if __name__ ... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from itertools import product
import sys
def main(X, Y, Z, K, A, B, C):
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ans = []
for x in range(1, X + 1):
if x > K:
break
for y in range(1, Y + 1):
... | false | 38.461538 | [
"- AB = sorted([a + b for a, b in product(A, B)], reverse=True)",
"- ABC = sorted([ab + c for ab, c in product(AB[:K], C)], reverse=True)",
"- for k in range(K):",
"- print((ABC[k]))",
"+ A.sort(reverse=True)",
"+ B.sort(reverse=True)",
"+ C.sort(reverse=True)",
"+ ans = []... | false | 0.108642 | 0.008 | 13.580131 | [
"s984589412",
"s930597496"
] |
u606045429 | p02955 | python | s007545853 | s180515185 | 522 | 157 | 3,444 | 3,064 | Accepted | Accepted | 69.92 | from itertools import accumulate
def divisors(N):
U = int(N ** 0.5) + 1
L = [i for i in range(1, U) if N % i == 0]
return L + [N // i for i in reversed(L) if N != i * i]
N, K, *A = list(map(int, open(0).read().split()))
for d in reversed(divisors(sum(A))):
R = [0] + list(accumulate(sorted(a... | def divisors(N):
U = int(N ** 0.5) + 1
L = [i for i in range(1, U) if N % i == 0]
return L + [N // i for i in reversed(L) if N != i * i]
N, K, *A = list(map(int, open(0).read().split()))
for d in reversed(divisors(sum(A))):
R = sorted(a % d for a in A)
if sum(R[:-sum(R) // d]) <= K:
... | 17 | 12 | 486 | 343 | from itertools import accumulate
def divisors(N):
U = int(N**0.5) + 1
L = [i for i in range(1, U) if N % i == 0]
return L + [N // i for i in reversed(L) if N != i * i]
N, K, *A = list(map(int, open(0).read().split()))
for d in reversed(divisors(sum(A))):
R = [0] + list(accumulate(sorted(a % d for a ... | def divisors(N):
U = int(N**0.5) + 1
L = [i for i in range(1, U) if N % i == 0]
return L + [N // i for i in reversed(L) if N != i * i]
N, K, *A = list(map(int, open(0).read().split()))
for d in reversed(divisors(sum(A))):
R = sorted(a % d for a in A)
if sum(R[: -sum(R) // d]) <= K:
print(d... | false | 29.411765 | [
"-from itertools import accumulate",
"-",
"-",
"- R = [0] + list(accumulate(sorted(a % d for a in A)))",
"- for i in range(N):",
"- l = R[i]",
"- r = (N - i) * d - (R[N] - R[i])",
"- if max(l, r) <= K:",
"- print(d)",
"- quit()",
"+ R = sorted(... | false | 0.068482 | 0.03878 | 1.765905 | [
"s007545853",
"s180515185"
] |
u883621917 | p02793 | python | s541625175 | s225315414 | 1,581 | 1,216 | 75,152 | 75,092 | Accepted | Accepted | 23.09 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
lcm = 1
#import collections
#lcm_pf = collections.defaultdict(int)
#for i, v in enumerate(a):
# j = 2
# pf = {}
# while j ** 2 <= v:
# ext = ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
lcm = 1
import collections
lcm_pf = collections.defaultdict(int)
for i, v in enumerate(a):
j = 2
pf = {}
while j ** 2 <= v:
ext = 0
... | 37 | 37 | 801 | 785 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10**9 + 7
lcm = 1
# import collections
# lcm_pf = collections.defaultdict(int)
# for i, v in enumerate(a):
# j = 2
# pf = {}
# while j ** 2 <= v:
# ext = 0
# while ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10**9 + 7
lcm = 1
import collections
lcm_pf = collections.defaultdict(int)
for i, v in enumerate(a):
j = 2
pf = {}
while j**2 <= v:
ext = 0
while v % j == 0:
... | false | 0 | [
"-# import collections",
"-# lcm_pf = collections.defaultdict(int)",
"-# for i, v in enumerate(a):",
"-# j = 2",
"-# pf = {}",
"-# while j ** 2 <= v:",
"-# ext = 0",
"-# while v % j == 0:",
"-# ext += 1",
"-# v //= j",
"-# if ext:",
"-# ... | false | 0.044408 | 0.039139 | 1.134613 | [
"s541625175",
"s225315414"
] |
u844646164 | p03044 | python | s273506480 | s198166412 | 921 | 768 | 85,212 | 85,204 | Accepted | Accepted | 16.61 | import sys
sys.setrecursionlimit(100000000)
N = int(eval(input()))
graph = [[] for _ in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
graph[u] += [[v, w]]
graph[v] += [[u, w]]
color = [-1]*N
def dfs(v, c):
color[v] = c
for next_v, w in graph[v]:
... | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
N = int(eval(input()))
color = [-1]*N
graph = [[] for _ in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
graph[u] += [[v, w]]
graph[v] += [[u, w]]
def dfs(u, c):
color[u] = c
... | 26 | 28 | 610 | 505 | import sys
sys.setrecursionlimit(100000000)
N = int(eval(input()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
graph[u] += [[v, w]]
graph[v] += [[u, w]]
color = [-1] * N
def dfs(v, c):
color[v] = c
for next_v, w in graph[v]... | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
N = int(eval(input()))
color = [-1] * N
graph = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
graph[u] += [[v, w]]
graph[v] += [[u, w]]
def dfs(u, c):
color[u] = c
... | false | 7.142857 | [
"-sys.setrecursionlimit(100000000)",
"+sys.setrecursionlimit(1000000000)",
"+input = sys.stdin.readline",
"+color = [-1] * N",
"-color = [-1] * N",
"-def dfs(v, c):",
"- color[v] = c",
"- for next_v, w in graph[v]:",
"- if color[next_v] == c and w % 2 != 0:",
"- return",
... | false | 0.050764 | 0.068867 | 0.737136 | [
"s273506480",
"s198166412"
] |
u385167811 | p03127 | python | s629879711 | s167652063 | 1,036 | 813 | 14,276 | 14,308 | Accepted | Accepted | 21.53 | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N-1] % A[N-2] != 0:
A[N-1] = A[N-1] % A[N-2]
elif N >= 3 and A[N-1] % A[N-3] != 0:
A[N-1] = A[N-1] % A[N-3]
elif N >= 4 and A[N-1] % A[N-4] !=... | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N-1] % A[N-2] != 0:
A[N-1] = A[N-1] % A[N-2]
elif N >= 3 and A[N-1] % A[N-3] != 0:
A[N-1] = A[N-1] % A[N-3]
elif N >= 4 and A[N-1] % A[N-4] !=... | 55 | 37 | 1,750 | 1,029 | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N - 1] % A[N - 2] != 0:
A[N - 1] = A[N - 1] % A[N - 2]
elif N >= 3 and A[N - 1] % A[N - 3] != 0:
A[N - 1] = A[N - 1] % A[N - 3]
elif N >= 4 and A[N - 1] %... | N = int(eval(input()))
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
iii += 1
if A[N - 1] % A[N - 2] != 0:
A[N - 1] = A[N - 1] % A[N - 2]
elif N >= 3 and A[N - 1] % A[N - 3] != 0:
A[N - 1] = A[N - 1] % A[N - 3]
elif N >= 4 and A[N - 1] %... | false | 32.727273 | [
"- elif N >= 11 and A[N - 1] % A[N - 11] != 0:",
"- A[N - 1] = A[N - 1] % A[N - 11]",
"- elif N >= 12 and A[N - 1] % A[N - 12] != 0:",
"- A[N - 1] = A[N - 1] % A[N - 12]",
"- elif N >= 13 and A[N - 1] % A[N - 13] != 0:",
"- A[N - 1] = A[N - 1] % A[N - 13]",
"- elif N >= ... | false | 0.048264 | 0.044127 | 1.093742 | [
"s629879711",
"s167652063"
] |
u588341295 | p03503 | python | s513477982 | s680696437 | 284 | 232 | 3,188 | 43,628 | Accepted | Accepted | 18.31 | # -*- coding: utf-8 -*-
import itertools
N = int(eval(input()))
F = []
for i in range(N):
F.append(list(map(int, input().split())))
P = []
for i in range(N):
P.append(list(map(int, input().split())))
# 重複順列で自分の店の全パターンを出す
me_list = list(itertools.product([0, 1], repeat=10))
# 初期値は利益の最小値
me_p ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 43 | 40 | 826 | 1,098 | # -*- coding: utf-8 -*-
import itertools
N = int(eval(input()))
F = []
for i in range(N):
F.append(list(map(int, input().split())))
P = []
for i in range(N):
P.append(list(map(int, input().split())))
# 重複順列で自分の店の全パターンを出す
me_list = list(itertools.product([0, 1], repeat=10))
# 初期値は利益の最小値
me_p = -float("inf")
# 自... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 6.976744 | [
"-import itertools",
"+import sys",
"-N = int(eval(input()))",
"-F = []",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def list2d(a, b, c):",
"+ return [[c] * b for i in range(a)]",
"+",
"+",
"+def list3d(a, b, c, d):",
"+ return [[[d] * c for j in ... | false | 0.05131 | 0.052055 | 0.985673 | [
"s513477982",
"s680696437"
] |
u490642448 | p03346 | python | s359492552 | s392037828 | 589 | 134 | 106,132 | 100,016 | Accepted | Accepted | 77.25 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
p = [[int(j),i] for i,j in enumerate(read().split()) ]
p.sort()
longest = 1
now = 1
for i in range(1,n):
if(p[i][1] > p[i-1][1]):
now += 1
else:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
p = list(map(int,read().split()))
q = [0] * n
for i,p_i in enumerate(p):
q[p_i-1] = i
longest = 1
now = 1
for i in range(1,n):
if(q[i] > q[i-1]):
now +... | 19 | 21 | 381 | 403 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
p = [[int(j), i] for i, j in enumerate(read().split())]
p.sort()
longest = 1
now = 1
for i in range(1, n):
if p[i][1] > p[i - 1][1]:
now += 1
else:
now = 1
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
p = list(map(int, read().split()))
q = [0] * n
for i, p_i in enumerate(p):
q[p_i - 1] = i
longest = 1
now = 1
for i in range(1, n):
if q[i] > q[i - 1]:
now += 1
el... | false | 9.52381 | [
"-p = [[int(j), i] for i, j in enumerate(read().split())]",
"-p.sort()",
"+p = list(map(int, read().split()))",
"+q = [0] * n",
"+for i, p_i in enumerate(p):",
"+ q[p_i - 1] = i",
"- if p[i][1] > p[i - 1][1]:",
"+ if q[i] > q[i - 1]:"
] | false | 0.045098 | 0.039494 | 1.141896 | [
"s359492552",
"s392037828"
] |
u476604182 | p02955 | python | s008830369 | s668017813 | 401 | 297 | 3,188 | 45,276 | Accepted | Accepted | 25.94 | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
A = [int(i) for i in input().split()]
x = sum(A)
ls = []
for i in range(1, int(x**0.5)+1):
if x%i==0:
ls += [i]
if i != x//i:
ls += [x//i]
ls.sort(reverse=True)
for i in ls:
B =[]
for j in A:
heappush(B, -1*... | N, K = list(map(int, input().split()))
A = [int(c) for c in input().split()]
S = sum(A)
pls = []
for i in range(1,S):
if i*i>S:
break
if S%i==0:
pls += [i]
pls += [S//i]
pls.sort(reverse=True)
for p in pls:
B = []
for i in range(N):
B += [A[i]%p]
B.sort()
for j in r... | 30 | 42 | 522 | 786 | from heapq import heappush, heappop
N, K = list(map(int, input().split()))
A = [int(i) for i in input().split()]
x = sum(A)
ls = []
for i in range(1, int(x**0.5) + 1):
if x % i == 0:
ls += [i]
if i != x // i:
ls += [x // i]
ls.sort(reverse=True)
for i in ls:
B = []
for j in A:
... | N, K = list(map(int, input().split()))
A = [int(c) for c in input().split()]
S = sum(A)
pls = []
for i in range(1, S):
if i * i > S:
break
if S % i == 0:
pls += [i]
pls += [S // i]
pls.sort(reverse=True)
for p in pls:
B = []
for i in range(N):
B += [A[i] % p]
B.sort()... | false | 28.571429 | [
"-from heapq import heappush, heappop",
"-",
"-A = [int(i) for i in input().split()]",
"-x = sum(A)",
"-ls = []",
"-for i in range(1, int(x**0.5) + 1):",
"- if x % i == 0:",
"- ls += [i]",
"- if i != x // i:",
"- ls += [x // i]",
"-ls.sort(reverse=True)",
"-for i in... | false | 0.035976 | 0.037056 | 0.970859 | [
"s008830369",
"s668017813"
] |
u353797797 | p02998 | python | s560586019 | s117912330 | 885 | 734 | 92,576 | 37,120 | Accepted | Accepted | 17.06 | import sys
sys.setrecursionlimit(10**6)
def dfs(x, al):
global cntx, cnty
if (al, x) in used:
return
used.add((al, x))
if al == 0:
cntx += 1
else:
cnty += 1
for xy in to[al][x]:
dfs(xy, 1 - al)
return
n = int(eval(input()))
to = [{}, {}]
fo... | def get_group(x):
g = group[x]
if g == x:
return x
group[g] = re = get_group(g)
return re
def unite(x, y):
gx = get_group(x)
gy = get_group(y)
if gx != gy:
dx = depth[gx]
dy = depth[gy]
if dy > dx:
gx, gy = gy, gx
group[gy] ... | 33 | 47 | 632 | 903 | import sys
sys.setrecursionlimit(10**6)
def dfs(x, al):
global cntx, cnty
if (al, x) in used:
return
used.add((al, x))
if al == 0:
cntx += 1
else:
cnty += 1
for xy in to[al][x]:
dfs(xy, 1 - al)
return
n = int(eval(input()))
to = [{}, {}]
for _ in range(n)... | def get_group(x):
g = group[x]
if g == x:
return x
group[g] = re = get_group(g)
return re
def unite(x, y):
gx = get_group(x)
gy = get_group(y)
if gx != gy:
dx = depth[gx]
dy = depth[gy]
if dy > dx:
gx, gy = gy, gx
group[gy] = gx
i... | false | 29.787234 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"+def get_group(x):",
"+ g = group[x]",
"+ if g == x:",
"+ return x",
"+ group[g] = re = get_group(g)",
"+ return re",
"-def dfs(x, al):",
"- global cntx, cnty",
"- if (al, x) in used:",
"- return",
"- ... | false | 0.03391 | 0.03488 | 0.972204 | [
"s560586019",
"s117912330"
] |
u888092736 | p03805 | python | s544128050 | s294798234 | 39 | 36 | 9,324 | 9,200 | Accepted | Accepted | 7.69 | from itertools import permutations, islice
def window(seq, n):
it = iter(seq)
result = tuple(islice(it, n))
if len(result) == n:
yield result
for elem in it:
result = result[1:] + (elem,)
yield result
N, M, *ab = list(map(int, open(0).read().split()))
g = [[0] *... | from itertools import permutations
N, M, *ab = list(map(int, open(0).read().split()))
g = [[0] * N for _ in range(N)]
for a, b in zip(*[iter(ab)] * 2):
g[a - 1][b - 1] = 1
g[b - 1][a - 1] = 1
ans = 0
for path in permutations(list(range(1, N))):
path = [0] + list(path)
if all(g[v][nv] for ... | 25 | 15 | 583 | 369 | from itertools import permutations, islice
def window(seq, n):
it = iter(seq)
result = tuple(islice(it, n))
if len(result) == n:
yield result
for elem in it:
result = result[1:] + (elem,)
yield result
N, M, *ab = list(map(int, open(0).read().split()))
g = [[0] * N for _ in ra... | from itertools import permutations
N, M, *ab = list(map(int, open(0).read().split()))
g = [[0] * N for _ in range(N)]
for a, b in zip(*[iter(ab)] * 2):
g[a - 1][b - 1] = 1
g[b - 1][a - 1] = 1
ans = 0
for path in permutations(list(range(1, N))):
path = [0] + list(path)
if all(g[v][nv] for v, nv in zip(p... | false | 40 | [
"-from itertools import permutations, islice",
"-",
"-",
"-def window(seq, n):",
"- it = iter(seq)",
"- result = tuple(islice(it, n))",
"- if len(result) == n:",
"- yield result",
"- for elem in it:",
"- result = result[1:] + (elem,)",
"- yield result",
"-",
... | false | 0.049663 | 0.050664 | 0.980235 | [
"s544128050",
"s294798234"
] |
u160414758 | p03634 | python | s129400503 | s557725167 | 1,370 | 983 | 171,284 | 153,060 | Accepted | Accepted | 28.25 | import sys;sys.setrecursionlimit(int(1e7))
N = int(eval(input()))
ABC = [list(map(int,input().split())) for _ in range(N-1)]
Q,K = list(map(int,input().split()))
XY = [list(map(int,input().split())) for _ in range(Q)]
tree = [[] for _ in range(N+1)]
depth = [None]*(N+1)
for abc in ABC:
tree[abc[0]].appe... | import sys;sys.setrecursionlimit(int(1e7))
N = int(eval(input()))
ABC = [tuple(map(int,input().split())) for _ in range(N-1)]
Q,K = list(map(int,input().split()))
XY = [tuple(map(int,input().split())) for _ in range(Q)]
tree = [[] for _ in range(N+1)]
depth = [None]*(N+1)
for abc in ABC:
tree[abc[0]].ap... | 23 | 23 | 570 | 572 | import sys
sys.setrecursionlimit(int(1e7))
N = int(eval(input()))
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(Q)]
tree = [[] for _ in range(N + 1)]
depth = [None] * (N + 1)
for abc in ABC:
tree[abc[0]].app... | import sys
sys.setrecursionlimit(int(1e7))
N = int(eval(input()))
ABC = [tuple(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
XY = [tuple(map(int, input().split())) for _ in range(Q)]
tree = [[] for _ in range(N + 1)]
depth = [None] * (N + 1)
for abc in ABC:
tree[abc[0]].a... | false | 0 | [
"-ABC = [list(map(int, input().split())) for _ in range(N - 1)]",
"+ABC = [tuple(map(int, input().split())) for _ in range(N - 1)]",
"-XY = [list(map(int, input().split())) for _ in range(Q)]",
"+XY = [tuple(map(int, input().split())) for _ in range(Q)]",
"- tree[abc[0]].append([abc[1], abc[2]])",
"- ... | false | 0.072145 | 0.034317 | 2.102315 | [
"s129400503",
"s557725167"
] |
u163783894 | p02788 | python | s150202216 | s191758837 | 854 | 769 | 110,420 | 110,604 | Accepted | Accepted | 9.95 | import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().spli... | import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().spli... | 101 | 95 | 2,565 | 2,325 | import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode("utf-8")
in_nl = lambda: list(map(int, readline().split()))
in_nl... | import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode("utf-8")
in_nl = lambda: list(map(int, readline().split()))
in_nl... | false | 5.940594 | [
"-class SegTree:",
"- def __init__(self, init_val, segfunc, ide_ele):",
"- n = len(init_val)",
"- self.ide_ele = ide_ele",
"- self.segfunc = segfunc",
"- self.num = 2 ** (n - 1).bit_length()",
"- self.seg = [self.ide_ele] * 2 * self.num",
"- for i in range(... | false | 0.047418 | 0.046732 | 1.01468 | [
"s150202216",
"s191758837"
] |
u334712262 | p02698 | python | s569629573 | s231029205 | 1,428 | 1,207 | 383,380 | 307,244 | Accepted | Accepted | 15.48 | # -*- coding: utf-8 -*-
import bisect
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62-1
def read_int():
return int(input())
def read_int_n():
return list(map(int, input().split()))
def read_float():
return float(input())
def read_float_n()... | # -*- coding: utf-8 -*-
import bisect
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.buffer.readline
INF = 2**62-1
def read_int():
return int(input())
def read_int_n():
return list(map(int, input().split()))
def read_float():
return float(input())
def read_float_n(... | 93 | 93 | 1,582 | 1,583 | # -*- coding: utf-8 -*-
import bisect
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62 - 1
def read_int():
return int(input())
def read_int_n():
return list(map(int, input().split()))
def read_float():
return float(input())
def read_float_n():
return list(m... | # -*- coding: utf-8 -*-
import bisect
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.buffer.readline
INF = 2**62 - 1
def read_int():
return int(input())
def read_int_n():
return list(map(int, input().split()))
def read_float():
return float(input())
def read_float_n():
return list(... | false | 0 | [
"-sys.setrecursionlimit(100000)",
"+sys.setrecursionlimit(1000000)"
] | false | 0.111989 | 0.056019 | 1.999137 | [
"s569629573",
"s231029205"
] |
u874259320 | p02710 | python | s927380083 | s431012038 | 1,430 | 1,255 | 400,976 | 400,768 | Accepted | Accepted | 12.24 | from typing import List
import sys
n = int(eval(input()))
c = list(map(int, input().split()))
c = [x-1 for x in c]
# print(c)
adj = [[] for i in range(n)]
for i in range(n-1):
a, b = tuple(map(int, input().split()))
a -= 1
b -= 1
adj[a].append(b)
adj[b].append(a)
size: List[int] =... | from typing import List
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(eval(input()))
c = list(map(int, input().split()))
c = [x-1 for x in c]
# print(c)
adj = [[] for i in range(n)]
for i in range(n-1):
a, b = tuple(map(int, input().split()))
a -= 1
b -= 1
adj[a].append(... | 66 | 67 | 1,539 | 1,586 | from typing import List
import sys
n = int(eval(input()))
c = list(map(int, input().split()))
c = [x - 1 for x in c]
# print(c)
adj = [[] for i in range(n)]
for i in range(n - 1):
a, b = tuple(map(int, input().split()))
a -= 1
b -= 1
adj[a].append(b)
adj[b].append(a)
size: List[int] = [1 for i in r... | from typing import List
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(eval(input()))
c = list(map(int, input().split()))
c = [x - 1 for x in c]
# print(c)
adj = [[] for i in range(n)]
for i in range(n - 1):
a, b = tuple(map(int, input().split()))
a -= 1
b -= 1
adj[a].append(b)
ad... | false | 1.492537 | [
"+input = lambda: sys.stdin.readline().rstrip()"
] | false | 0.053658 | 0.048048 | 1.116739 | [
"s927380083",
"s431012038"
] |
u929569377 | p02814 | python | s923307909 | s288605711 | 867 | 312 | 14,244 | 63,984 | Accepted | Accepted | 64.01 | from sys import setrecursionlimit, exit
n, m = list(map(int, input().split()))
a = [int(x) // 2 for x in input().split()]
t = 0
while a[0] % 2 == 0:
a[0] //= 2
t += 1
for i in range(1, n):
t2 = 0
while a[i] % 2 == 0:
a[i] //= 2
t2 += 1
if t2 != t:
print((0)... | from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)
from heapq import heapify, heappush, heappop, heappushpop, heapreplace
from bisect import bisect_left, bisect_right
from math import atan, degrees
n, m = list(map(int, input().split()))
a = [int(x) // 2 for x in input().split()]
t = 0
... | 32 | 38 | 555 | 740 | from sys import setrecursionlimit, exit
n, m = list(map(int, input().split()))
a = [int(x) // 2 for x in input().split()]
t = 0
while a[0] % 2 == 0:
a[0] //= 2
t += 1
for i in range(1, n):
t2 = 0
while a[i] % 2 == 0:
a[i] //= 2
t2 += 1
if t2 != t:
print((0))
exit()
... | from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)
from heapq import heapify, heappush, heappop, heappushpop, heapreplace
from bisect import bisect_left, bisect_right
from math import atan, degrees
n, m = list(map(int, input().split()))
a = [int(x) // 2 for x in input().split()]
t = 0
while a[0] % ... | false | 15.789474 | [
"+",
"+setrecursionlimit(1000000000)",
"+from heapq import heapify, heappush, heappop, heappushpop, heapreplace",
"+from bisect import bisect_left, bisect_right",
"+from math import atan, degrees"
] | false | 0.047393 | 0.046878 | 1.011004 | [
"s923307909",
"s288605711"
] |
u227082700 | p02599 | python | s626118202 | s530309504 | 1,495 | 1,299 | 207,552 | 207,464 | Accepted | Accepted | 13.11 | """
O_______________________________________________________________________________________________________________O
* *
* xxxxx ... | n,q=list(map(int,input().split()))
a=list(map(int,input().split()))
for i in range(n):a[i]-=1
queries=[[]for _ in range(n)]
for i in range(q):
l,r=list(map(int,input().split()))
l-=1
r-=1
queries[r].append((l,i))
lastAppeared=[0]*n
bit=[0]*(n+1)
ans=[0]*q
for i in range(n):
x=lastAppeared[a[i]]+1... | 72 | 32 | 4,125 | 611 | """
O_______________________________________________________________________________________________________________O
* *
* xxxxx ... | n, q = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
a[i] -= 1
queries = [[] for _ in range(n)]
for i in range(q):
l, r = list(map(int, input().split()))
l -= 1
r -= 1
queries[r].append((l, i))
lastAppeared = [0] * n
bit = [0] * (n + 1)
ans = [0] * q
for i in... | false | 55.555556 | [
"-\"\"\"",
"-O_______________________________________________________________________________________________________________O",
"-* *",
"-* xxxxx ... | false | 0.100626 | 0.088504 | 1.136965 | [
"s626118202",
"s530309504"
] |
u781262926 | p02975 | python | s492747174 | s193023499 | 493 | 65 | 15,980 | 16,388 | Accepted | Accepted | 86.82 | import sys
inputs = sys.stdin.readlines()
N = int(inputs[0])
a_list = list(map(int, inputs[1].split()))
from collections import Counter
def all_zeros(a_list):
return sum(a_list) == 0
def check(N, a_list):
if all_zeros(a_list):
print('Yes')
return
elif N % 3 == 0:
... | import sys
inputs = sys.stdin.readlines()
from collections import Counter
N = int(inputs[0])
a_list = list(map(int, inputs[1].split()))
def check(N, a_list):
mc = Counter(a_list).most_common()
n = len(mc)
if n == 1:
if mc[0][0] == 0:
print('Yes')
return
... | 32 | 26 | 787 | 617 | import sys
inputs = sys.stdin.readlines()
N = int(inputs[0])
a_list = list(map(int, inputs[1].split()))
from collections import Counter
def all_zeros(a_list):
return sum(a_list) == 0
def check(N, a_list):
if all_zeros(a_list):
print("Yes")
return
elif N % 3 == 0:
x = N // 3
... | import sys
inputs = sys.stdin.readlines()
from collections import Counter
N = int(inputs[0])
a_list = list(map(int, inputs[1].split()))
def check(N, a_list):
mc = Counter(a_list).most_common()
n = len(mc)
if n == 1:
if mc[0][0] == 0:
print("Yes")
return
elif n == 2:
... | false | 18.75 | [
"+from collections import Counter",
"+",
"-from collections import Counter",
"-",
"-",
"-def all_zeros(a_list):",
"- return sum(a_list) == 0",
"- if all_zeros(a_list):",
"- print(\"Yes\")",
"- return",
"- elif N % 3 == 0:",
"- x = N // 3",
"- if not all([... | false | 0.037655 | 0.036958 | 1.018867 | [
"s492747174",
"s193023499"
] |
u929569377 | p03573 | python | s728364235 | s161645486 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | A, B, C = [int(x) for x in input().split()]
if A == B:
print(C)
else:
if A == C:
print(B)
else:
print(A) | A, B, C = input().split()
if A == B:
print(C)
else:
if A == C:
print(B)
else:
print(A) | 9 | 9 | 120 | 102 | A, B, C = [int(x) for x in input().split()]
if A == B:
print(C)
else:
if A == C:
print(B)
else:
print(A)
| A, B, C = input().split()
if A == B:
print(C)
else:
if A == C:
print(B)
else:
print(A)
| false | 0 | [
"-A, B, C = [int(x) for x in input().split()]",
"+A, B, C = input().split()"
] | false | 0.04065 | 0.040189 | 1.011481 | [
"s728364235",
"s161645486"
] |
u556589653 | p03574 | python | s304207552 | s572545255 | 44 | 39 | 9,212 | 9,184 | Accepted | Accepted | 11.36 | h,w = list(map(int,input().split()))
ls = []
yside = {-1,-1,-1,0,0,1,1,1}
xside = {-1,0,1,-1,1,-1,0,1}
side = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(h):
ls.append(list(eval(input())))
for i in range(h):
ans2 = ""
for j in range(w):
ans = 0
if ls[i][j] == "#":
... | h,w = list(map(int,input().split()))
ls = []
side = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(h):
ls.append(list(eval(input())))
for i in range(h):
ans2 = ""
for j in range(w):
ans = 0
if ls[i][j] == "#":
ans2 += "#"
else:
for k in range(8):
... | 21 | 19 | 595 | 536 | h, w = list(map(int, input().split()))
ls = []
yside = {-1, -1, -1, 0, 0, 1, 1, 1}
xside = {-1, 0, 1, -1, 1, -1, 0, 1}
side = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]
for i in range(h):
ls.append(list(eval(input())))
for i in range(h):
ans2 = ""
for j in range(w):
ans =... | h, w = list(map(int, input().split()))
ls = []
side = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]
for i in range(h):
ls.append(list(eval(input())))
for i in range(h):
ans2 = ""
for j in range(w):
ans = 0
if ls[i][j] == "#":
ans2 += "#"
else:
... | false | 9.52381 | [
"-yside = {-1, -1, -1, 0, 0, 1, 1, 1}",
"-xside = {-1, 0, 1, -1, 1, -1, 0, 1}"
] | false | 0.036942 | 0.032872 | 1.123818 | [
"s304207552",
"s572545255"
] |
u104005543 | p02947 | python | s982685834 | s150095746 | 706 | 548 | 10,612 | 24,652 | Accepted | Accepted | 22.38 | n = int(eval(input()))
arr = []
for i in range(n):
s = list(str(eval(input())))
s.sort()
k = ''
for i in range(10):
k += s[i]
arr.append(k)
arr.sort()
ans = 0
count = 1
for i in range(n - 1):
if arr[i] == arr[i + 1]:
count += 1
if i == n - 2:
a... | n = int(eval(input()))
arr = []
for i in range(n):
s = list(str(eval(input())))
s.sort()
arr.append(s)
arr.sort()
ans = 0
count = 1
for i in range(1, n):
if arr[i] == arr[i - 1]:
count += 1
else:
ans += count * (count - 1) // 2
count = 1
if i == n - 1:
... | 21 | 18 | 421 | 356 | n = int(eval(input()))
arr = []
for i in range(n):
s = list(str(eval(input())))
s.sort()
k = ""
for i in range(10):
k += s[i]
arr.append(k)
arr.sort()
ans = 0
count = 1
for i in range(n - 1):
if arr[i] == arr[i + 1]:
count += 1
if i == n - 2:
ans += count * (c... | n = int(eval(input()))
arr = []
for i in range(n):
s = list(str(eval(input())))
s.sort()
arr.append(s)
arr.sort()
ans = 0
count = 1
for i in range(1, n):
if arr[i] == arr[i - 1]:
count += 1
else:
ans += count * (count - 1) // 2
count = 1
if i == n - 1:
ans += coun... | false | 14.285714 | [
"- k = \"\"",
"- for i in range(10):",
"- k += s[i]",
"- arr.append(k)",
"+ arr.append(s)",
"-for i in range(n - 1):",
"- if arr[i] == arr[i + 1]:",
"+for i in range(1, n):",
"+ if arr[i] == arr[i - 1]:",
"- if i == n - 2:",
"- ans += count * (count - 1... | false | 0.038714 | 0.039803 | 0.97264 | [
"s982685834",
"s150095746"
] |
u874723578 | p03338 | python | s046182726 | s846157429 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N = int(eval(input()))
S = eval(input())
K = []
for i in range(1,N):
X = list(set(S[:i]))
Y = list(set(S[i:]))
cnt = 0
for i in range(len(X)):
if X[i] in Y:
cnt += 1
K.append(cnt)
print((max(K))) | N = int(eval(input()))
S = eval(input())
K = []
for i in range(1,N):
X = set(S[:i])
Y = set(S[i:])
K.append(len(X & Y))
print((max(K))) | 15 | 10 | 238 | 144 | N = int(eval(input()))
S = eval(input())
K = []
for i in range(1, N):
X = list(set(S[:i]))
Y = list(set(S[i:]))
cnt = 0
for i in range(len(X)):
if X[i] in Y:
cnt += 1
K.append(cnt)
print((max(K)))
| N = int(eval(input()))
S = eval(input())
K = []
for i in range(1, N):
X = set(S[:i])
Y = set(S[i:])
K.append(len(X & Y))
print((max(K)))
| false | 33.333333 | [
"- X = list(set(S[:i]))",
"- Y = list(set(S[i:]))",
"- cnt = 0",
"- for i in range(len(X)):",
"- if X[i] in Y:",
"- cnt += 1",
"- K.append(cnt)",
"+ X = set(S[:i])",
"+ Y = set(S[i:])",
"+ K.append(len(X & Y))"
] | false | 0.049725 | 0.049563 | 1.003275 | [
"s046182726",
"s846157429"
] |
u873482706 | p00162 | python | s874258683 | s488433657 | 3,330 | 3,060 | 35,948 | 35,952 | Accepted | Accepted | 8.11 | def two(n):
if n == 1:
return True
elif n%2 != 0:
return three(n)
else:
q = n/2
return two(q)
def three(n):
if n == 1:
return True
elif n%3 != 0:
return five(n)
else:
q = n/3
return three(q)
def five(n):
if ... | def two(n):
if n == 1:
return True
elif n%2 != 0:
return three(n)
else:
q = n/2
return two(q)
def three(n):
if n == 1:
return True
elif n%3 != 0:
return five(n)
else:
q = n/3
return three(q)
def five(n):
if ... | 37 | 37 | 668 | 669 | def two(n):
if n == 1:
return True
elif n % 2 != 0:
return three(n)
else:
q = n / 2
return two(q)
def three(n):
if n == 1:
return True
elif n % 3 != 0:
return five(n)
else:
q = n / 3
return three(q)
def five(n):
if n == 1:
... | def two(n):
if n == 1:
return True
elif n % 2 != 0:
return three(n)
else:
q = n / 2
return two(q)
def three(n):
if n == 1:
return True
elif n % 3 != 0:
return five(n)
else:
q = n / 3
return three(q)
def five(n):
if n == 1:
... | false | 0 | [
"- return two(q)",
"+ return five(q)"
] | false | 0.042281 | 0.043714 | 0.967227 | [
"s874258683",
"s488433657"
] |
u592248346 | p03777 | python | s769765652 | s180939919 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b = list(map(str,input().split()))
if a=="H":
print(b)
elif b == "H":
print("D")
else:
print("H") | a,b = input().split()
if a==b: print("H")
else: print("D") | 7 | 3 | 111 | 60 | a, b = list(map(str, input().split()))
if a == "H":
print(b)
elif b == "H":
print("D")
else:
print("H")
| a, b = input().split()
if a == b:
print("H")
else:
print("D")
| false | 57.142857 | [
"-a, b = list(map(str, input().split()))",
"-if a == \"H\":",
"- print(b)",
"-elif b == \"H\":",
"+a, b = input().split()",
"+if a == b:",
"+ print(\"H\")",
"+else:",
"-else:",
"- print(\"H\")"
] | false | 0.04826 | 0.048114 | 1.003047 | [
"s769765652",
"s180939919"
] |
u633068244 | p02264 | python | s806155165 | s905761592 | 600 | 510 | 14,000 | 14,020 | Accepted | Accepted | 15 | n,q = list(map(int, input().split()))
que = [list(map(str, input().split())) for i in range(n)]
mxt = sum([int(y) for x,y in que])
t = 0
i = 0
while t < mxt:
i %= n
if int(que[i][1]) <= q:
t += int(que[i][1])
print(que[i][0],t)
que.pop(i)
n -= 1
else:
t += q
que[i][1] = int(que[i][1]) - q
... | n,q = list(map(int, input().split()))
que = [list(map(str, input().split())) for i in range(n)]
for i in range(n):que[i][1] = int(que[i][1])
mxt = sum([y for x,y in que])
t = 0
i = 0
while t < mxt:
if i >= n: i %= n
if que[i][1] <= q:
t += que[i][1]
print(que[i][0],t)
que.pop(... | 16 | 17 | 323 | 400 | n, q = list(map(int, input().split()))
que = [list(map(str, input().split())) for i in range(n)]
mxt = sum([int(y) for x, y in que])
t = 0
i = 0
while t < mxt:
i %= n
if int(que[i][1]) <= q:
t += int(que[i][1])
print(que[i][0], t)
que.pop(i)
n -= 1
else:
t += q
... | n, q = list(map(int, input().split()))
que = [list(map(str, input().split())) for i in range(n)]
for i in range(n):
que[i][1] = int(que[i][1])
mxt = sum([y for x, y in que])
t = 0
i = 0
while t < mxt:
if i >= n:
i %= n
if que[i][1] <= q:
t += que[i][1]
print(que[i][0], t)
que... | false | 5.882353 | [
"-mxt = sum([int(y) for x, y in que])",
"+for i in range(n):",
"+ que[i][1] = int(que[i][1])",
"+mxt = sum([y for x, y in que])",
"- i %= n",
"- if int(que[i][1]) <= q:",
"- t += int(que[i][1])",
"+ if i >= n:",
"+ i %= n",
"+ if que[i][1] <= q:",
"+ t += que[... | false | 0.037816 | 0.096909 | 0.390223 | [
"s806155165",
"s905761592"
] |
u318427318 | p03738 | python | s547996752 | s717382842 | 31 | 27 | 9,060 | 9,048 | Accepted | Accepted | 12.9 | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
a = int(eval(input()))
b = int(eval(input()))
if a == b:
print("EQUAL")
elif a > b:
print("GREATER")
else:
print("LESS")
if __name__=="__main__":
main() | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
a = int(eval(input()))
b = int(eval(input()))
if a > b :
print("GREATER")
elif a < b :
print("LESS")
elif a == b :
print("EQUAL")
if __name__=="__main__":
main() | 17 | 17 | 275 | 286 | # -*-coding:utf-8-*-
import sys
input = sys.stdin.readline
def main():
a = int(eval(input()))
b = int(eval(input()))
if a == b:
print("EQUAL")
elif a > b:
print("GREATER")
else:
print("LESS")
if __name__ == "__main__":
main()
| # -*-coding:utf-8-*-
import sys
input = sys.stdin.readline
def main():
a = int(eval(input()))
b = int(eval(input()))
if a > b:
print("GREATER")
elif a < b:
print("LESS")
elif a == b:
print("EQUAL")
if __name__ == "__main__":
main()
| false | 0 | [
"- if a == b:",
"+ if a > b:",
"+ print(\"GREATER\")",
"+ elif a < b:",
"+ print(\"LESS\")",
"+ elif a == b:",
"- elif a > b:",
"- print(\"GREATER\")",
"- else:",
"- print(\"LESS\")"
] | false | 0.044179 | 0.177772 | 0.248515 | [
"s547996752",
"s717382842"
] |
u305366205 | p02744 | python | s234008612 | s856020342 | 170 | 133 | 14,556 | 12,664 | Accepted | Accepted | 21.76 | n = int(eval(input()))
candidate = ['a']
def dfs(s, c):
if len(s) == n:
return
for i in range(ord('a'), ord(c) + 2):
now = s + chr(i)
candidate.append(now)
if i > ord(c):
dfs(now, chr(i))
else:
dfs(now, c)
dfs('a', 'a')
for c... | n = int(eval(input()))
if n == 1:
print('a')
exit()
ans = []
def dfs(s, c):
for i in range(ord('a'), ord(c) + 2):
now = s + chr(i)
if len(now) == n:
ans.append(now)
elif i > ord(c):
dfs(now, chr(i))
else:
dfs(now, c)
... | 21 | 24 | 368 | 362 | n = int(eval(input()))
candidate = ["a"]
def dfs(s, c):
if len(s) == n:
return
for i in range(ord("a"), ord(c) + 2):
now = s + chr(i)
candidate.append(now)
if i > ord(c):
dfs(now, chr(i))
else:
dfs(now, c)
dfs("a", "a")
for c in candidate:
... | n = int(eval(input()))
if n == 1:
print("a")
exit()
ans = []
def dfs(s, c):
for i in range(ord("a"), ord(c) + 2):
now = s + chr(i)
if len(now) == n:
ans.append(now)
elif i > ord(c):
dfs(now, chr(i))
else:
dfs(now, c)
dfs("a", "a")
for c... | false | 12.5 | [
"-candidate = [\"a\"]",
"+if n == 1:",
"+ print(\"a\")",
"+ exit()",
"+ans = []",
"- if len(s) == n:",
"- return",
"- candidate.append(now)",
"- if i > ord(c):",
"+ if len(now) == n:",
"+ ans.append(now)",
"+ elif i > ord(c):",
"-for c i... | false | 0.060142 | 0.073117 | 0.822544 | [
"s234008612",
"s856020342"
] |
u869790980 | p02913 | python | s852069671 | s261110019 | 237 | 201 | 94,492 | 71,196 | Accepted | Accepted | 15.19 | import collections
n = int(input())
s = input()
def f(k, s):
if k == 0:
return True
cc = collections.Counter()
q = collections.deque()
for j in range(k - 1, len(s)):
q.append(s[j - k + 1:j+1])
if len(q) == k + 1:
u = q.popleft()
cc[u] += 1
if s[j- k+1:j+1] in cc:
return True
re... | import collections
n,s = int(input()), input()
def f(k, s):
cc,q = collections.Counter(), collections.deque()
for j in range(k - 1, len(s)):
q.append(s[j - k + 1:j+1])
if len(q) == k + 1: cc[q.popleft()] += 1
if q[-1] in cc: return True
return False
lo,hi = 0, n/2
while(lo < hi):
med = (lo +... | 26 | 17 | 465 | 396 | import collections
n = int(input())
s = input()
def f(k, s):
if k == 0:
return True
cc = collections.Counter()
q = collections.deque()
for j in range(k - 1, len(s)):
q.append(s[j - k + 1 : j + 1])
if len(q) == k + 1:
u = q.popleft()
cc[u] += 1
i... | import collections
n, s = int(input()), input()
def f(k, s):
cc, q = collections.Counter(), collections.deque()
for j in range(k - 1, len(s)):
q.append(s[j - k + 1 : j + 1])
if len(q) == k + 1:
cc[q.popleft()] += 1
if q[-1] in cc:
return True
return False
... | false | 34.615385 | [
"-n = int(input())",
"-s = input()",
"+n, s = int(input()), input()",
"- if k == 0:",
"- return True",
"- cc = collections.Counter()",
"- q = collections.deque()",
"+ cc, q = collections.Counter(), collections.deque()",
"- u = q.popleft()",
"- cc[u] += 1",
... | false | 0.043087 | 0.039024 | 1.104105 | [
"s852069671",
"s261110019"
] |
u281610856 | p03031 | python | s470814049 | s450041494 | 35 | 31 | 3,316 | 3,064 | Accepted | Accepted | 11.43 | from collections import deque
n, m = list(map(int, input().split()))
s = [0] * m
k = [0] * m
for i in range(m):
s[i] = deque(list(map(int, input().split())))
k[i] = deque.popleft(s[i])
s[i] = list(s[i])
p = list(map(int, input().split()))
cnt = 0
for i in range(2 ** n):
l = [0] * n
f... | n, m = list(map(int, input().split()))
s = [0] * m
for i in range(m):
s[i] = list(map(int, input().split()))[1:]
p = list(map(int, input().split()))
ans = 0
for bit in range(2 << (n-1)):
l = [0] * n
for i in range(n):
if bit >> i & 1:
l[i] += 1
for i in range(m):
... | 30 | 23 | 664 | 540 | from collections import deque
n, m = list(map(int, input().split()))
s = [0] * m
k = [0] * m
for i in range(m):
s[i] = deque(list(map(int, input().split())))
k[i] = deque.popleft(s[i])
s[i] = list(s[i])
p = list(map(int, input().split()))
cnt = 0
for i in range(2**n):
l = [0] * n
for j in range(n):... | n, m = list(map(int, input().split()))
s = [0] * m
for i in range(m):
s[i] = list(map(int, input().split()))[1:]
p = list(map(int, input().split()))
ans = 0
for bit in range(2 << (n - 1)):
l = [0] * n
for i in range(n):
if bit >> i & 1:
l[i] += 1
for i in range(m):
cnt = 0
... | false | 23.333333 | [
"-from collections import deque",
"-",
"-k = [0] * m",
"- s[i] = deque(list(map(int, input().split())))",
"- k[i] = deque.popleft(s[i])",
"- s[i] = list(s[i])",
"+ s[i] = list(map(int, input().split()))[1:]",
"-cnt = 0",
"-for i in range(2**n):",
"+ans = 0",
"+for bit in range(2 << (... | false | 0.053059 | 0.033991 | 1.560951 | [
"s470814049",
"s450041494"
] |
u631238602 | p03074 | python | s600729514 | s813067059 | 106 | 88 | 18,172 | 12,016 | Accepted | Accepted | 16.98 | from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit
import heapq
import itertools
import operato... | from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit
import heapq
import itertools
import operato... | 97 | 97 | 1,912 | 1,819 | from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit
import heapq
import itertools
import operator
# global... | from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit
import heapq
import itertools
import operator
# global... | false | 0 | [
"- cont.append((count, cur == \"1\"))",
"+ cont.append(count)",
"- cont.append((count, cur == \"1\"))",
"+ cont.append(count)",
"- cont = cont + ([(0, None)] * M)",
"- if cont[0][1] == False:",
"- cont = [(0, None)] + cont",
"+ cont = cont + ([0] * M)",
"+... | false | 0.042389 | 0.042889 | 0.988343 | [
"s600729514",
"s813067059"
] |
u057916330 | p03221 | python | s344828107 | s727316816 | 839 | 743 | 30,568 | 40,012 | Accepted | Accepted | 11.44 | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return '{:0>6}'.format(n)
N, M = list(map(int, input().split()))
P, Y = [0 for _ in range(M)], [0 for _ in range(M)]
for i in range(M):
P[i], Y[i] = list(map(int, input().split()))
data = [[P[i], Y[i], 1, i] for i in range(M)]
data.sor... | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return '{:0>6}'.format(n)
N, M = list(map(int, input().split()))
P, Y = [0 for _ in range(M)], [0 for _ in range(M)]
for i in range(M):
P[i], Y[i] = list(map(int, input().split()))
data = [[P[i], Y[i], 1, i] for i in range(M)]
data.sor... | 21 | 23 | 609 | 647 | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return "{:0>6}".format(n)
N, M = list(map(int, input().split()))
P, Y = [0 for _ in range(M)], [0 for _ in range(M)]
for i in range(M):
P[i], Y[i] = list(map(int, input().split()))
data = [[P[i], Y[i], 1, i] for i in range(M)]
data.sort(key=lambda... | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return "{:0>6}".format(n)
N, M = list(map(int, input().split()))
P, Y = [0 for _ in range(M)], [0 for _ in range(M)]
for i in range(M):
P[i], Y[i] = list(map(int, input().split()))
data = [[P[i], Y[i], 1, i] for i in range(M)]
data.sort(key=lambda... | false | 8.695652 | [
"+ans = []",
"- print((pad(di[0]) + pad(di[2])))",
"+ ans.append(pad(di[0]) + pad(di[2]))",
"+print((\"\\n\".join(ans)))"
] | false | 0.037752 | 0.041159 | 0.917237 | [
"s344828107",
"s727316816"
] |
u283869437 | p03025 | python | s655268910 | s052959275 | 932 | 586 | 11,052 | 13,076 | Accepted | Accepted | 37.12 | M=10**9+7
N,A,B,C=list(map(int,input().split()))
f=[1]
for i in range(1,2*N):
f.append(f[-1]*i%M)
t=pow(A+B,M-2,M)
A*=t
B*=t
a=pow(A,N,M)
b=pow(B,N,M)
z=0
for i in range(N):
z+=(N+i)*100*pow(100-C,M-2,M)*f[N+i-1]*pow(f[N-1]*f[i],M-2,M)*(a+b)
z%=M
a=a*B%M
b=b*A%M
print(z)
| M=10**9+7
N,A,B,C=list(map(int,input().split()))
f=[1]
for i in range(1,2*N):
f.append(f[-1]*i%M)
t=pow(A+B,M-2,M)
A*=t
B*=t
a=pow(A,N,M)
b=pow(B,N,M)
z=0
for i in range(N):
z+=(N+i)*100*t*f[N+i-1]*pow(f[N-1]*f[i],M-2,M)*(a+b)
z%=M
a=a*B%M
b=b*A%M
print(z)
| 17 | 17 | 287 | 272 | M = 10**9 + 7
N, A, B, C = list(map(int, input().split()))
f = [1]
for i in range(1, 2 * N):
f.append(f[-1] * i % M)
t = pow(A + B, M - 2, M)
A *= t
B *= t
a = pow(A, N, M)
b = pow(B, N, M)
z = 0
for i in range(N):
z += (
(N + i)
* 100
* pow(100 - C, M - 2, M)
* f[N + i - 1]
... | M = 10**9 + 7
N, A, B, C = list(map(int, input().split()))
f = [1]
for i in range(1, 2 * N):
f.append(f[-1] * i % M)
t = pow(A + B, M - 2, M)
A *= t
B *= t
a = pow(A, N, M)
b = pow(B, N, M)
z = 0
for i in range(N):
z += (N + i) * 100 * t * f[N + i - 1] * pow(f[N - 1] * f[i], M - 2, M) * (a + b)
z %= M
a... | false | 0 | [
"- z += (",
"- (N + i)",
"- * 100",
"- * pow(100 - C, M - 2, M)",
"- * f[N + i - 1]",
"- * pow(f[N - 1] * f[i], M - 2, M)",
"- * (a + b)",
"- )",
"+ z += (N + i) * 100 * t * f[N + i - 1] * pow(f[N - 1] * f[i], M - 2, M) * (a + b)"
] | false | 0.222966 | 0.09111 | 2.447217 | [
"s655268910",
"s052959275"
] |
u079603018 | p02686 | python | s557986463 | s174649245 | 1,317 | 1,201 | 115,276 | 107,532 | Accepted | Accepted | 8.81 | import sys
readline = sys.stdin.buffer.readline
N = int(readline())
S = [readline().rstrip().decode() for _ in range(N)]
def count_cb_ob(s):
st = []
for i, si in enumerate(s):
if si == '(' or len(st) == 0 or st[-1] != '(':
st.append(si)
else:
st.pop()
r... | import sys
readline = sys.stdin.readline
N = int(readline())
S = [readline().rstrip() for _ in range(N)]
def count_cb_ob(s):
st = []
for i, si in enumerate(s):
if si == '(' or len(st) == 0 or st[-1] != '(':
st.append(si)
else:
st.pop()
return st.count('... | 35 | 35 | 834 | 733 | import sys
readline = sys.stdin.buffer.readline
N = int(readline())
S = [readline().rstrip().decode() for _ in range(N)]
def count_cb_ob(s):
st = []
for i, si in enumerate(s):
if si == "(" or len(st) == 0 or st[-1] != "(":
st.append(si)
else:
st.pop()
return st.cou... | import sys
readline = sys.stdin.readline
N = int(readline())
S = [readline().rstrip() for _ in range(N)]
def count_cb_ob(s):
st = []
for i, si in enumerate(s):
if si == "(" or len(st) == 0 or st[-1] != "(":
st.append(si)
else:
st.pop()
return st.count(")"), st.coun... | false | 0 | [
"-readline = sys.stdin.buffer.readline",
"+readline = sys.stdin.readline",
"-S = [readline().rstrip().decode() for _ in range(N)]",
"+S = [readline().rstrip() for _ in range(N)]",
"-f = list([cb_ob for cb_ob in cb_obs if cb_ob[0] < cb_ob[1]])",
"-b = list([cb_ob for cb_ob in cb_obs if cb_ob[0] > cb_ob[1]]... | false | 0.060838 | 0.038531 | 1.578947 | [
"s557986463",
"s174649245"
] |
u057964173 | p02657 | python | s646737882 | s861421545 | 24 | 22 | 9,156 | 9,040 | Accepted | Accepted | 8.33 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
a,b=list(map(int, input().split()))
print((a*b))
resolve() | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
a,b=list(map(float, input().split()))
b100=b*100
print((int(a*b100/100)))
resolve() | 7 | 8 | 140 | 170 | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
a, b = list(map(int, input().split()))
print((a * b))
resolve()
| import sys
def input():
return sys.stdin.readline().strip()
def resolve():
a, b = list(map(float, input().split()))
b100 = b * 100
print((int(a * b100 / 100)))
resolve()
| false | 12.5 | [
"- a, b = list(map(int, input().split()))",
"- print((a * b))",
"+ a, b = list(map(float, input().split()))",
"+ b100 = b * 100",
"+ print((int(a * b100 / 100)))"
] | false | 0.036682 | 0.035844 | 1.023386 | [
"s646737882",
"s861421545"
] |
u513081876 | p03606 | python | s884789174 | s079118964 | 22 | 20 | 3,316 | 3,060 | Accepted | Accepted | 9.09 | N = int(eval(input()))
ans = 0
for i in range(N):
lr = list(map(int, input().split()))
ans += lr[1] - lr[0] +1
print(ans) | N = int(eval(input()))
ans = 0
for i in range(N):
l, r = list(map(int, input().split()))
ans += r-l+1
print(ans) | 6 | 6 | 128 | 113 | N = int(eval(input()))
ans = 0
for i in range(N):
lr = list(map(int, input().split()))
ans += lr[1] - lr[0] + 1
print(ans)
| N = int(eval(input()))
ans = 0
for i in range(N):
l, r = list(map(int, input().split()))
ans += r - l + 1
print(ans)
| false | 0 | [
"- lr = list(map(int, input().split()))",
"- ans += lr[1] - lr[0] + 1",
"+ l, r = list(map(int, input().split()))",
"+ ans += r - l + 1"
] | false | 0.040306 | 0.039722 | 1.014717 | [
"s884789174",
"s079118964"
] |
u614181788 | p02580 | python | s885495690 | s947600258 | 2,577 | 885 | 197,076 | 221,764 | Accepted | Accepted | 65.66 | import time
t0 = time.time()
h,w,m = list(map(int,input().split()))
H = [0]*(h+1)
W = [0]*(w+1)
s = set([])
for i in range(m):
a,b = list(map(int,input().split()))
s.add((a,b))
H[a] += 1
W[b] += 1
x = [0]*(h+1)
y = [0]*(w+1)
for i in range(h+1):
x[i] = [i,H[i]]
for i in ... | h,w,m = list(map(int,input().split()))
s = set([])
H = [0]*(h+1)
W = [0]*(w+1)
for i in range(m):
x,y = list(map(int,input().split()))
H[x] += 1
W[y] += 1
s.add((x,y))
p = [0]*(h+1)
q = [0]*(w+1)
for i in range(h+1):
p[i] = [i, H[i]]
for i in range(w+1):
q[i] = [i, W[i]]
... | 50 | 37 | 842 | 682 | import time
t0 = time.time()
h, w, m = list(map(int, input().split()))
H = [0] * (h + 1)
W = [0] * (w + 1)
s = set([])
for i in range(m):
a, b = list(map(int, input().split()))
s.add((a, b))
H[a] += 1
W[b] += 1
x = [0] * (h + 1)
y = [0] * (w + 1)
for i in range(h + 1):
x[i] = [i, H[i]]
for i in ran... | h, w, m = list(map(int, input().split()))
s = set([])
H = [0] * (h + 1)
W = [0] * (w + 1)
for i in range(m):
x, y = list(map(int, input().split()))
H[x] += 1
W[y] += 1
s.add((x, y))
p = [0] * (h + 1)
q = [0] * (w + 1)
for i in range(h + 1):
p[i] = [i, H[i]]
for i in range(w + 1):
q[i] = [i, W[i]... | false | 26 | [
"-import time",
"-",
"-t0 = time.time()",
"+s = set([])",
"-s = set([])",
"- a, b = list(map(int, input().split()))",
"- s.add((a, b))",
"- H[a] += 1",
"- W[b] += 1",
"-x = [0] * (h + 1)",
"-y = [0] * (w + 1)",
"+ x, y = list(map(int, input().split()))",
"+ H[x] += 1",
"+... | false | 0.041591 | 0.036258 | 1.147095 | [
"s885495690",
"s947600258"
] |
u992465933 | p02911 | python | s341356223 | s229186354 | 364 | 244 | 11,904 | 10,472 | Accepted | Accepted | 32.97 | import collections
def main():
n,k,q = [int(x) for x in input().split()]
a = []
for i in range(q):
a.append(int(eval(input())))
c = collections.Counter(a)
for i in range(n):
index = int('{}'.format(i+1))
point = k + c[index] - q
if point > 0:
... | import math
def main():
n,k,q = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(q)]
score = [k-q]*n
for i in range(q):
score[A[i]-1] += 1
for i in score:
if i>0:
print('Yes')
else:
print('No')
if __name__ ==... | 21 | 19 | 415 | 333 | import collections
def main():
n, k, q = [int(x) for x in input().split()]
a = []
for i in range(q):
a.append(int(eval(input())))
c = collections.Counter(a)
for i in range(n):
index = int("{}".format(i + 1))
point = k + c[index] - q
if point > 0:
print("... | import math
def main():
n, k, q = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(q)]
score = [k - q] * n
for i in range(q):
score[A[i] - 1] += 1
for i in score:
if i > 0:
print("Yes")
else:
print("No")
if __name__ == "__main... | false | 9.52381 | [
"-import collections",
"+import math",
"- n, k, q = [int(x) for x in input().split()]",
"- a = []",
"+ n, k, q = list(map(int, input().split()))",
"+ A = [int(eval(input())) for _ in range(q)]",
"+ score = [k - q] * n",
"- a.append(int(eval(input())))",
"- c = collections.Co... | false | 0.04406 | 0.036739 | 1.199291 | [
"s341356223",
"s229186354"
] |
u240096083 | p02787 | python | s199183884 | s642181935 | 1,993 | 662 | 295,688 | 126,684 | Accepted | Accepted | 66.78 | #from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#import sys
#sys.setrecursionlimit(N) #N回まで再起を許可する。
# = map(int,input().split())
# = list(map(int,input().split()))
# = [list(map... | #from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#import sys
#sys.setrecursionlimit(N) #N回まで再起を許可する。
# = map(int,input().split())
# = list(map(int,input().split()))
# = [list(map... | 44 | 44 | 1,126 | 1,123 | # from pprint import pprint
# from collections import deque
# from collections import defaultdict
# from collections import Counter
# from copy import deepcopy
# from itertools
# import sys
# sys.setrecursionlimit(N) #N回まで再起を許可する。
# = map(int,input().split())
# = list(map(int,input().split()))
# = [list(map(int,input()... | # from pprint import pprint
# from collections import deque
# from collections import defaultdict
# from collections import Counter
# from copy import deepcopy
# from itertools
# import sys
# sys.setrecursionlimit(N) #N回まで再起を許可する。
# = map(int,input().split())
# = list(map(int,input().split()))
# = [list(map(int,input()... | false | 0 | [
"- dp = [[float(\"inf\") for _ in range(h + 1)] for _ in range(n + 1)]",
"+ dp = [[100000001 for _ in range(h + 1)] for _ in range(n + 1)]"
] | false | 0.111109 | 0.346022 | 0.321104 | [
"s199183884",
"s642181935"
] |
u285891772 | p04046 | python | s080701961 | s317456342 | 312 | 218 | 20,952 | 42,992 | Accepted | Accepted | 30.13 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
... | 46 | 46 | 1,324 | 1,294 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
)
from itertools import (
accumulate,
permutations,
combinations,
combinations_wi... | false | 0 | [
"- log2,",
"-from fractions import gcd"
] | false | 0.194497 | 0.195549 | 0.994623 | [
"s080701961",
"s317456342"
] |
u606033239 | p03273 | python | s973086625 | s415643541 | 164 | 22 | 13,784 | 4,468 | Accepted | Accepted | 86.59 | import numpy as np
h,w=map(int,input().split())
s=[]
for _ in range(h):
a = input()
if "#" in a:
s.append(a)
d = []
for i in zip(*s):
if "#" in i:
d.append(i)
for j in zip(*d):
print(*j,sep="")
| h,w=map(int,input().split())
s=[]
for _ in range(h):
a = input()
if "#" in a:
s.append(a)
d = []
for i in zip(*s):
if "#" in i:
d.append(i)
for j in zip(*d):
print(*j,sep="")
| 13 | 12 | 238 | 218 | import numpy as np
h, w = map(int, input().split())
s = []
for _ in range(h):
a = input()
if "#" in a:
s.append(a)
d = []
for i in zip(*s):
if "#" in i:
d.append(i)
for j in zip(*d):
print(*j, sep="")
| h, w = map(int, input().split())
s = []
for _ in range(h):
a = input()
if "#" in a:
s.append(a)
d = []
for i in zip(*s):
if "#" in i:
d.append(i)
for j in zip(*d):
print(*j, sep="")
| false | 7.692308 | [
"-import numpy as np",
"-"
] | false | 0.042066 | 0.049746 | 0.845616 | [
"s973086625",
"s415643541"
] |
u989345508 | p03239 | python | s786827852 | s289917992 | 20 | 17 | 2,940 | 3,060 | Accepted | Accepted | 15 | n,t=input().split()
n,t=int(n),int(t)
c=1001
for i in range(n):
ck,tk=input().split()
if int(tk)<=t and int(ck)<c:
c=int(ck)
if c==1001:
print("TLE")
else:
print(c)
| n,t=list(map(int,input().split()))
ct=[list(map(int,input().split())) for i in range(n)]
c=10000000000000000
for i in range(n):
if ct[i][1]<=t:
c=min(c,ct[i][0])
print((c if c!=10000000000000000 else "TLE")) | 13 | 7 | 211 | 217 | n, t = input().split()
n, t = int(n), int(t)
c = 1001
for i in range(n):
ck, tk = input().split()
if int(tk) <= t and int(ck) < c:
c = int(ck)
if c == 1001:
print("TLE")
else:
print(c)
| n, t = list(map(int, input().split()))
ct = [list(map(int, input().split())) for i in range(n)]
c = 10000000000000000
for i in range(n):
if ct[i][1] <= t:
c = min(c, ct[i][0])
print((c if c != 10000000000000000 else "TLE"))
| false | 46.153846 | [
"-n, t = input().split()",
"-n, t = int(n), int(t)",
"-c = 1001",
"+n, t = list(map(int, input().split()))",
"+ct = [list(map(int, input().split())) for i in range(n)]",
"+c = 10000000000000000",
"- ck, tk = input().split()",
"- if int(tk) <= t and int(ck) < c:",
"- c = int(ck)",
"-if... | false | 0.047048 | 0.040381 | 1.165088 | [
"s786827852",
"s289917992"
] |
u852210959 | p02725 | python | s386354728 | s999038303 | 115 | 102 | 26,436 | 26,444 | Accepted | Accepted | 11.3 | # -*- coding: utf-8 -*-
def calc(k, kiten, a):
koho1 = abs(kiten -a)
koho2 = kiten + k - a
koho3 = a + k - kiten
return min(koho1, koho2, koho3)
def main():
k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
max_kkn = a_list[0] + k - a_list[-... | # -*- coding: utf-8 -*-
def calc(k, kiten, a):
koho1 = abs(kiten -a)
koho2 = kiten + k - a
koho3 = a + k - kiten
return min(koho1, koho2, koho3)
def main():
k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
max_kkn = a_list[0] + k - a_list[-... | 24 | 24 | 474 | 468 | # -*- coding: utf-8 -*-
def calc(k, kiten, a):
koho1 = abs(kiten - a)
koho2 = kiten + k - a
koho3 = a + k - kiten
return min(koho1, koho2, koho3)
def main():
k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
max_kkn = a_list[0] + k - a_list[-1]
for i in ra... | # -*- coding: utf-8 -*-
def calc(k, kiten, a):
koho1 = abs(kiten - a)
koho2 = kiten + k - a
koho3 = a + k - kiten
return min(koho1, koho2, koho3)
def main():
k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))
max_kkn = a_list[0] + k - a_list[-1]
for a, b in... | false | 0 | [
"- for i in range(n - 1):",
"- max_kkn = max(max_kkn, a_list[i + 1] - a_list[i])",
"+ for a, b in zip(a_list, a_list[1:]):",
"+ max_kkn = max(max_kkn, b - a)"
] | false | 0.046296 | 0.117422 | 0.394269 | [
"s386354728",
"s999038303"
] |
u440566786 | p02888 | python | s050919686 | s336094988 | 786 | 239 | 44,892 | 42,604 | Accepted | Accepted | 69.59 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
from bisect import bisect_left
n=int(eval(input()))
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(1,n):
for j in range(i+1,n):... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
L=list(map(int,input().split()))
L.sort()
ans=0
for b in range(1,n-1):
c=b+1
for a in range(b):
while(c<n... | 17 | 17 | 412 | 391 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
from bisect import bisect_left
n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(1, n):
for j in range... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for b in range(1, n - 1):
c = b + 1
for a in range(b):
... | false | 0 | [
"- from bisect import bisect_left",
"-",
"- for i in range(1, n):",
"- for j in range(i + 1, n):",
"- k = bisect_left(L, L[j] - L[i] + 1)",
"- ans += max(0, i - k)",
"+ for b in range(1, n - 1):",
"+ c = b + 1",
"+ for a in range(b):",
"+ ... | false | 0.038201 | 0.035647 | 1.071655 | [
"s050919686",
"s336094988"
] |
u562935282 | p03699 | python | s761680808 | s424904244 | 125 | 17 | 3,064 | 3,060 | Accepted | Accepted | 86.4 | def main():
N = int(eval(input()))
s = [int(eval(input())) for _ in range(N)]
dp = [False] * (10000 + 1)
dp[0] = True
for x in s:
for score in range(10000 - x, -1, -1):
dp[score + x] |= dp[score]
for score in range(10000, -1, -1):
if dp[score] and score... | def main():
N = int(eval(input()))
s = [int(eval(input())) for _ in range(N)]
tot = sum(s)
if tot % 10 == 0:
s.sort()
for x in s:
if x % 10 == 0: continue
tot -= x
break
else:
tot = 0
print(tot)
if __name__ ... | 29 | 28 | 567 | 478 | def main():
N = int(eval(input()))
s = [int(eval(input())) for _ in range(N)]
dp = [False] * (10000 + 1)
dp[0] = True
for x in s:
for score in range(10000 - x, -1, -1):
dp[score + x] |= dp[score]
for score in range(10000, -1, -1):
if dp[score] and score % 10 != 0:
... | def main():
N = int(eval(input()))
s = [int(eval(input())) for _ in range(N)]
tot = sum(s)
if tot % 10 == 0:
s.sort()
for x in s:
if x % 10 == 0:
continue
tot -= x
break
else:
tot = 0
print(tot)
if __name__ == ... | false | 3.448276 | [
"- dp = [False] * (10000 + 1)",
"- dp[0] = True",
"- for x in s:",
"- for score in range(10000 - x, -1, -1):",
"- dp[score + x] |= dp[score]",
"- for score in range(10000, -1, -1):",
"- if dp[score] and score % 10 != 0:",
"- print(score)",
"- ... | false | 0.055084 | 0.062303 | 0.884125 | [
"s761680808",
"s424904244"
] |
u107077660 | p04012 | python | s764910207 | s009957918 | 29 | 20 | 3,444 | 3,316 | Accepted | Accepted | 31.03 | from collections import Counter
s = eval(input())
c = list(Counter(s).values())
for n in c:
if n & 1 == 1:
print("No")
break
else:
print("Yes")
| from collections import Counter
w = eval(input())
C = Counter(w)
for l in C:
if C[l] % 2:
print("No")
break
else:
print("Yes")
| 10 | 9 | 148 | 135 | from collections import Counter
s = eval(input())
c = list(Counter(s).values())
for n in c:
if n & 1 == 1:
print("No")
break
else:
print("Yes")
| from collections import Counter
w = eval(input())
C = Counter(w)
for l in C:
if C[l] % 2:
print("No")
break
else:
print("Yes")
| false | 10 | [
"-s = eval(input())",
"-c = list(Counter(s).values())",
"-for n in c:",
"- if n & 1 == 1:",
"+w = eval(input())",
"+C = Counter(w)",
"+for l in C:",
"+ if C[l] % 2:"
] | false | 0.047336 | 0.03213 | 1.473248 | [
"s764910207",
"s009957918"
] |
u626684023 | p02880 | python | s710839792 | s762035941 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | ans = "No"
N = int(eval(input()))
for i in range(1, 10):
temp = N / i
if 1 <= temp <= 9 and temp % 1 == 0:
ans = "Yes"
break
print(ans) | N = int(eval(input()))
ans = "No"
for i in range(1, 10):
if N // i < 10 and (N // i) * i == N:
ans = "Yes"
print(ans) | 8 | 6 | 160 | 128 | ans = "No"
N = int(eval(input()))
for i in range(1, 10):
temp = N / i
if 1 <= temp <= 9 and temp % 1 == 0:
ans = "Yes"
break
print(ans)
| N = int(eval(input()))
ans = "No"
for i in range(1, 10):
if N // i < 10 and (N // i) * i == N:
ans = "Yes"
print(ans)
| false | 25 | [
"+N = int(eval(input()))",
"-N = int(eval(input()))",
"- temp = N / i",
"- if 1 <= temp <= 9 and temp % 1 == 0:",
"+ if N // i < 10 and (N // i) * i == N:",
"- break"
] | false | 0.074396 | 0.046913 | 1.585847 | [
"s710839792",
"s762035941"
] |
u297574184 | p03592 | python | s052726544 | s444054174 | 311 | 17 | 2,940 | 2,940 | Accepted | Accepted | 94.53 | N, M, K = list(map(int, input().split()))
for r in range(N + 1):
for c in range(M + 1):
if (N - r) * c + r * (M - c) == K:
print('Yes')
exit()
print('No')
| N, M, K = list(map(int, input().split()))
for r in range(N + 1):
a = K - r * M
b = N - 2 * r
if b != 0 and a % b == 0 and 0 <= a // b <= M:
print('Yes')
exit()
print('No')
| 9 | 10 | 195 | 205 | N, M, K = list(map(int, input().split()))
for r in range(N + 1):
for c in range(M + 1):
if (N - r) * c + r * (M - c) == K:
print("Yes")
exit()
print("No")
| N, M, K = list(map(int, input().split()))
for r in range(N + 1):
a = K - r * M
b = N - 2 * r
if b != 0 and a % b == 0 and 0 <= a // b <= M:
print("Yes")
exit()
print("No")
| false | 10 | [
"- for c in range(M + 1):",
"- if (N - r) * c + r * (M - c) == K:",
"- print(\"Yes\")",
"- exit()",
"+ a = K - r * M",
"+ b = N - 2 * r",
"+ if b != 0 and a % b == 0 and 0 <= a // b <= M:",
"+ print(\"Yes\")",
"+ exit()"
] | false | 0.036581 | 0.034669 | 1.055138 | [
"s052726544",
"s444054174"
] |
u277312083 | p02732 | python | s660651301 | s411514371 | 575 | 482 | 26,780 | 26,780 | Accepted | Accepted | 16.17 | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
s = 0
for i in set(a):
s += c[i] * (c[i] - 1)
for i in a:
print((int((s - (c[i] * (c[i] - 1)) + ((c[i] - 1) * (c[i] - 2))) / 2))) | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
s = 0
for i in set(a):
s += c[i] * (c[i] - 1)
dp = [-1] * (n + 1)
for i in a:
if dp[i] == -1:
dp[i] = (s - c[i] * (c[i] - 1) + (c[i] - 1) * (c[i] - 2)) // 2
print((dp[i]))
el... | 9 | 14 | 242 | 338 | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
s = 0
for i in set(a):
s += c[i] * (c[i] - 1)
for i in a:
print((int((s - (c[i] * (c[i] - 1)) + ((c[i] - 1) * (c[i] - 2))) / 2)))
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
s = 0
for i in set(a):
s += c[i] * (c[i] - 1)
dp = [-1] * (n + 1)
for i in a:
if dp[i] == -1:
dp[i] = (s - c[i] * (c[i] - 1) + (c[i] - 1) * (c[i] - 2)) // 2
print((dp[i]))
else:
... | false | 35.714286 | [
"-import collections",
"+from collections import Counter",
"-c = collections.Counter(a)",
"+c = Counter(a)",
"+dp = [-1] * (n + 1)",
"- print((int((s - (c[i] * (c[i] - 1)) + ((c[i] - 1) * (c[i] - 2))) / 2)))",
"+ if dp[i] == -1:",
"+ dp[i] = (s - c[i] * (c[i] - 1) + (c[i] - 1) * (c[i] - 2... | false | 0.042824 | 0.099878 | 0.428759 | [
"s660651301",
"s411514371"
] |
u518958552 | p02687 | python | s733928850 | s017242246 | 22 | 20 | 9,088 | 9,024 | Accepted | Accepted | 9.09 | s = eval(input())
if s == "ABC":
print("ARC")
elif s == "ARC":
print("ABC") | s = eval(input())
if s == "ABC":
print("ARC")
else:
print("ABC") | 6 | 5 | 87 | 70 | s = eval(input())
if s == "ABC":
print("ARC")
elif s == "ARC":
print("ABC")
| s = eval(input())
if s == "ABC":
print("ARC")
else:
print("ABC")
| false | 16.666667 | [
"-elif s == \"ARC\":",
"+else:"
] | false | 0.038299 | 0.042096 | 0.909801 | [
"s733928850",
"s017242246"
] |
u721316601 | p02900 | python | s700398038 | s517842423 | 428 | 295 | 3,064 | 3,188 | Accepted | Accepted | 31.07 | import sys
input = sys.stdin.readline
def is_prime(N):
prime = set()
if not N % 2: prime.add(2)
while not N % 2: N //= 2
x = 3
while x ** 2 <= N:
if not N % x: prime.add(x)
while not N % x: N //= x
x += 2
if N > 1: prime.add(N)
... | def gcd(a, b):
while b:
r = a % b
a, b = b, r
return a
A, B = list(map(int, input().split()))
n = gcd(A, B)
ans = 1
if not n % 2: ans += 1
while not n % 2:
n //= 2
i = 3
while i <= n**0.5:
if not n % i: ans += 1
while not n % i:
n //= i
i += 2
... | 32 | 25 | 520 | 351 | import sys
input = sys.stdin.readline
def is_prime(N):
prime = set()
if not N % 2:
prime.add(2)
while not N % 2:
N //= 2
x = 3
while x**2 <= N:
if not N % x:
prime.add(x)
while not N % x:
N //= x
x += 2
if N > 1:
prime.ad... | def gcd(a, b):
while b:
r = a % b
a, b = b, r
return a
A, B = list(map(int, input().split()))
n = gcd(A, B)
ans = 1
if not n % 2:
ans += 1
while not n % 2:
n //= 2
i = 3
while i <= n**0.5:
if not n % i:
ans += 1
while not n % i:
n //= i
i += 2
if 1 < n:
... | false | 21.875 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"+def gcd(a, b):",
"+ while b:",
"+ r = a % b",
"+ a, b = b, r",
"+ return a",
"-def is_prime(N):",
"- prime = set()",
"- if not N % 2:",
"- prime.add(2)",
"- while not N % 2:",
"- N //= 2",
"- ... | false | 0.007682 | 0.041504 | 0.185096 | [
"s700398038",
"s517842423"
] |
u046187684 | p03326 | python | s298589156 | s689881072 | 43 | 33 | 4,172 | 3,916 | Accepted | Accepted | 23.26 | from functools import partial
from itertools import islice, product
def take(n, iterable):
return list(islice(iterable, n))
def chunked(iterable, n):
return iter(partial(take, n, iter(iterable)), [])
def solve(s):
n, m, *xyz = list(map(int, s.split()))
ans = 0
for sign_x, sign_y... | from functools import partial
from itertools import islice, product
def take(n, iterable):
return list(islice(iterable, n))
def chunked(iterable, n):
return iter(partial(take, n, iter(iterable)), [])
def solve(s):
n, m, *xyz = list(map(int, s.split()))
return max([
sum(
... | 25 | 24 | 702 | 658 | from functools import partial
from itertools import islice, product
def take(n, iterable):
return list(islice(iterable, n))
def chunked(iterable, n):
return iter(partial(take, n, iter(iterable)), [])
def solve(s):
n, m, *xyz = list(map(int, s.split()))
ans = 0
for sign_x, sign_y, sign_z in pro... | from functools import partial
from itertools import islice, product
def take(n, iterable):
return list(islice(iterable, n))
def chunked(iterable, n):
return iter(partial(take, n, iter(iterable)), [])
def solve(s):
n, m, *xyz = list(map(int, s.split()))
return max(
[
sum(
... | false | 4 | [
"- ans = 0",
"- for sign_x, sign_y, sign_z in product([1, -1], repeat=3):",
"- ordered = sorted(",
"- [x * sign_x + y * sign_y + z * sign_z for x, y, z in chunked(xyz, 3)],",
"- reverse=True,",
"- )",
"- ans = max(ans, sum(ordered[:m]))",
"- return a... | false | 0.040349 | 0.037769 | 1.068311 | [
"s298589156",
"s689881072"
] |
u729133443 | p03128 | python | s050977465 | s730399322 | 251 | 179 | 51,036 | 14,388 | Accepted | Accepted | 28.69 | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*-~n
for i in range(1,n+1):
for j,k in zip((1,2,3,4,5,6,7,8,9),(2,5,5,4,5,6,3,7,6)):
if j in a and i-k>=0and(i-k<1or d[i-k]):d[i]=max(d[i],d[i-k]*10+j)
print((d[n])) | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*-~n
for i in range(1,n+1):
for j,k in zip((1,2,3,4,5,6,7,8,9),(2,5,5,4,5,6,3,7,6)):
if i-k>=0and(i-k<1or d[i-k])and j in a:d[i]=max(d[i],d[i-k]*10+j)
print((d[n])) | 6 | 6 | 215 | 214 | n, m, *a = list(map(int, open(0).read().split()))
d = [0] * -~n
for i in range(1, n + 1):
for j, k in zip((1, 2, 3, 4, 5, 6, 7, 8, 9), (2, 5, 5, 4, 5, 6, 3, 7, 6)):
if j in a and i - k >= 0 and (i - k < 1 or d[i - k]):
d[i] = max(d[i], d[i - k] * 10 + j)
print((d[n]))
| n, m, *a = list(map(int, open(0).read().split()))
d = [0] * -~n
for i in range(1, n + 1):
for j, k in zip((1, 2, 3, 4, 5, 6, 7, 8, 9), (2, 5, 5, 4, 5, 6, 3, 7, 6)):
if i - k >= 0 and (i - k < 1 or d[i - k]) and j in a:
d[i] = max(d[i], d[i - k] * 10 + j)
print((d[n]))
| false | 0 | [
"- if j in a and i - k >= 0 and (i - k < 1 or d[i - k]):",
"+ if i - k >= 0 and (i - k < 1 or d[i - k]) and j in a:"
] | false | 0.04718 | 0.046358 | 1.017742 | [
"s050977465",
"s730399322"
] |
u729133443 | p02879 | python | s468558530 | s831185241 | 165 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.7 | a,_,b,*c=eval(input());print((-(len(c)>0)or int(a)*int(b))) | a,_,b,*c=eval(input());print((-(c>[])or int(a)*int(b))) | 1 | 1 | 51 | 47 | a, _, b, *c = eval(input())
print((-(len(c) > 0) or int(a) * int(b)))
| a, _, b, *c = eval(input())
print((-(c > []) or int(a) * int(b)))
| false | 0 | [
"-print((-(len(c) > 0) or int(a) * int(b)))",
"+print((-(c > []) or int(a) * int(b)))"
] | false | 0.047974 | 0.04718 | 1.016822 | [
"s468558530",
"s831185241"
] |
u450983668 | p02848 | python | s560703706 | s376907684 | 24 | 17 | 3,064 | 3,060 | Accepted | Accepted | 29.17 | N = int(eval(input()))
S = eval(input())
alphabet = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
newS = ""
for x in S:
newS += alphabet[(alphabet.index(x)+N)%26]
print(newS) | N = int(eval(input()))
S = eval(input())
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
newS = S.translate(str.maketrans(alphabet, alphabet[N:]+alphabet[:N]))
print(newS) | 9 | 7 | 259 | 159 | N = int(eval(input()))
S = eval(input())
alphabet = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
]
newS = ""
for x in S:
newS... | N = int(eval(input()))
S = eval(input())
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
newS = S.translate(str.maketrans(alphabet, alphabet[N:] + alphabet[:N]))
print(newS)
| false | 22.222222 | [
"-alphabet = [",
"- \"A\",",
"- \"B\",",
"- \"C\",",
"- \"D\",",
"- \"E\",",
"- \"F\",",
"- \"G\",",
"- \"H\",",
"- \"I\",",
"- \"J\",",
"- \"K\",",
"- \"L\",",
"- \"M\",",
"- \"N\",",
"- \"O\",",
"- \"P\",",
"- \"Q\",",
"- \"... | false | 0.062139 | 0.0372 | 1.670418 | [
"s560703706",
"s376907684"
] |
u312025627 | p02900 | python | s098358732 | s570895769 | 80 | 72 | 67,556 | 63,244 | Accepted | Accepted | 10 | def main():
N, M = (int(i) for i in input().split())
def enum_divisors(n):
# 約数列挙
divs = set()
for i in range(1, n+1):
if i*i > n:
break
if n % i == 0:
divs.add(i)
if n//i != i:
# i が... | def main():
N, M = (int(i) for i in input().split())
def prime_factorize(n):
res = []
for i in range(2, n+1):
if i*i > n:
break
if n % i != 0:
continue
ex = 0
while n % i == 0:
ex += 1
... | 31 | 30 | 684 | 611 | def main():
N, M = (int(i) for i in input().split())
def enum_divisors(n):
# 約数列挙
divs = set()
for i in range(1, n + 1):
if i * i > n:
break
if n % i == 0:
divs.add(i)
if n // i != i:
# i が平方数でない... | def main():
N, M = (int(i) for i in input().split())
def prime_factorize(n):
res = []
for i in range(2, n + 1):
if i * i > n:
break
if n % i != 0:
continue
ex = 0
while n % i == 0:
ex += 1
... | false | 3.225806 | [
"- def enum_divisors(n):",
"- # 約数列挙",
"- divs = set()",
"- for i in range(1, n + 1):",
"+ def prime_factorize(n):",
"+ res = []",
"+ for i in range(2, n + 1):",
"- if n % i == 0:",
"- divs.add(i)",
"- if n // i != i... | false | 0.038395 | 0.043637 | 0.87987 | [
"s098358732",
"s570895769"
] |
u827765795 | p03370 | python | s747497929 | s041856797 | 160 | 36 | 8,968 | 9,120 | Accepted | Accepted | 77.5 | N, X = list(map(int, input().split()))
M = [int(eval(input())) for i in range(N)]
cnt = 0
for i in M:
X -= i
cnt += 1
while True:
X -= min(M)
if X < 0:
break
cnt += 1
print(cnt) | N, X = list(map(int, input().split()))
M = [int(eval(input())) for i in range(N)]
cnt = N
X -= sum(M)
cnt += X // min(M)
print(cnt)
| 12 | 6 | 204 | 125 | N, X = list(map(int, input().split()))
M = [int(eval(input())) for i in range(N)]
cnt = 0
for i in M:
X -= i
cnt += 1
while True:
X -= min(M)
if X < 0:
break
cnt += 1
print(cnt)
| N, X = list(map(int, input().split()))
M = [int(eval(input())) for i in range(N)]
cnt = N
X -= sum(M)
cnt += X // min(M)
print(cnt)
| false | 50 | [
"-cnt = 0",
"-for i in M:",
"- X -= i",
"- cnt += 1",
"-while True:",
"- X -= min(M)",
"- if X < 0:",
"- break",
"- cnt += 1",
"+cnt = N",
"+X -= sum(M)",
"+cnt += X // min(M)"
] | false | 0.034742 | 0.074562 | 0.465942 | [
"s747497929",
"s041856797"
] |
u263830634 | p03816 | python | s056508363 | s211086971 | 78 | 46 | 18,648 | 14,564 | Accepted | Accepted | 41.03 | from collections import Counter
N = int(eval(input()))
lst = list(map(int, input().split()))
C = Counter(lst)
odd = 0
even = 0
for c in C:
if C[c] % 2 == 0:
even += 1
else:
odd += 1
if even % 2 == 0:
print((len(C)))
else:
print((len(C) - 1))
| N = int(eval(input()))
lst = list(map(int, input().split()))
s = len(set(lst))
print(((s - 1)//2 * 2 + 1)) | 18 | 5 | 286 | 104 | from collections import Counter
N = int(eval(input()))
lst = list(map(int, input().split()))
C = Counter(lst)
odd = 0
even = 0
for c in C:
if C[c] % 2 == 0:
even += 1
else:
odd += 1
if even % 2 == 0:
print((len(C)))
else:
print((len(C) - 1))
| N = int(eval(input()))
lst = list(map(int, input().split()))
s = len(set(lst))
print(((s - 1) // 2 * 2 + 1))
| false | 72.222222 | [
"-from collections import Counter",
"-",
"-C = Counter(lst)",
"-odd = 0",
"-even = 0",
"-for c in C:",
"- if C[c] % 2 == 0:",
"- even += 1",
"- else:",
"- odd += 1",
"-if even % 2 == 0:",
"- print((len(C)))",
"-else:",
"- print((len(C) - 1))",
"+s = len(set(lst)... | false | 0.043383 | 0.079676 | 0.544487 | [
"s056508363",
"s211086971"
] |
u285022453 | p03329 | python | s774155328 | s634223405 | 450 | 279 | 49,100 | 47,692 | Accepted | Accepted | 38 | n = int(eval(input()))
dp = [float('inf')] * (n + 1)
dp[0] = 0
for i in range(n):
dp[i + 1] = min(dp[i + 1], dp[i] + 1)
for j in range(n):
if i + 6 ** (j + 1) <= n:
dp[i + 6 ** (j + 1)] = min(dp[i + 6 ** (j + 1)], dp[i] + 1)
else:
break
for k in ra... | n = int(eval(input()))
dp = [float('inf')] * (n + 1)
dp[0] = 0
for i in range(n):
dp[i + 1] = min(dp[i + 1], dp[i] + 1)
for j in range(n):
if i + 6 ** (j + 1) <= n:
dp[i + 6 ** (j + 1)] = min(dp[i + 6 ** (j + 1)], dp[i] + 1)
else:
break
for k in range(... | 20 | 20 | 495 | 475 | n = int(eval(input()))
dp = [float("inf")] * (n + 1)
dp[0] = 0
for i in range(n):
dp[i + 1] = min(dp[i + 1], dp[i] + 1)
for j in range(n):
if i + 6 ** (j + 1) <= n:
dp[i + 6 ** (j + 1)] = min(dp[i + 6 ** (j + 1)], dp[i] + 1)
else:
break
for k in range(n):
... | n = int(eval(input()))
dp = [float("inf")] * (n + 1)
dp[0] = 0
for i in range(n):
dp[i + 1] = min(dp[i + 1], dp[i] + 1)
for j in range(n):
if i + 6 ** (j + 1) <= n:
dp[i + 6 ** (j + 1)] = min(dp[i + 6 ** (j + 1)], dp[i] + 1)
else:
break
for k in range(n):
if i... | false | 0 | [
"- for k in range(n):",
"- if i + 9 ** (k + 1) <= n:",
"- dp[i + 9 ** (k + 1)] = min(dp[i + 9 ** (k + 1)], dp[i] + 1)",
"- else:",
"- break",
"+ for k in range(n):",
"+ if i + 9 ** (k + 1) <= n:",
"+ dp[i + 9 ** (k + 1)] =... | false | 0.483306 | 0.464941 | 1.0395 | [
"s774155328",
"s634223405"
] |
u581187895 | p03352 | python | s313547750 | s985114560 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | x = int(eval(input()))
ans = [b**p for b in range(1001) for p in range(2,10)
if b**p <= x]
print((max(ans))) | X = int(eval(input()))
ans = 1
for i in range(2, X):
n = i*i
while n <= X:
ans = max(ans, n)
n *= i
print(ans)
| 4 | 10 | 113 | 133 | x = int(eval(input()))
ans = [b**p for b in range(1001) for p in range(2, 10) if b ** p <= x]
print((max(ans)))
| X = int(eval(input()))
ans = 1
for i in range(2, X):
n = i * i
while n <= X:
ans = max(ans, n)
n *= i
print(ans)
| false | 60 | [
"-x = int(eval(input()))",
"-ans = [b**p for b in range(1001) for p in range(2, 10) if b ** p <= x]",
"-print((max(ans)))",
"+X = int(eval(input()))",
"+ans = 1",
"+for i in range(2, X):",
"+ n = i * i",
"+ while n <= X:",
"+ ans = max(ans, n)",
"+ n *= i",
"+print(ans)"
] | false | 0.046043 | 0.043464 | 1.05935 | [
"s313547750",
"s985114560"
] |
u048945791 | p03295 | python | s684565752 | s969493294 | 428 | 385 | 29,084 | 18,248 | Accepted | Accepted | 10.05 | N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(M)]
ab.sort(key = lambda x : x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans) | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
ab.sort(key = lambda x : x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans) | 14 | 14 | 258 | 259 | N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(M)]
ab.sort(key=lambda x: x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans)
| N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
ab.sort(key=lambda x: x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans)
| false | 0 | [
"-ab = [list(map(int, input().split())) for _ in range(M)]",
"+ab = [tuple(map(int, input().split())) for _ in range(M)]"
] | false | 0.081108 | 0.036737 | 2.207805 | [
"s684565752",
"s969493294"
] |
u063052907 | p02947 | python | s280535130 | s730765468 | 425 | 343 | 19,960 | 20,028 | Accepted | Accepted | 19.29 | from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1,r + 1)))
return over // under
N = int(eval(input()))
lst_s = ["".joi... | from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1,r + 1)))
return over // under
N = int(eval(input()))
lst_s = ["".joi... | 26 | 25 | 500 | 486 | from collections import Counter
from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
return over // under
N = int(eval(input()))
lst_s = ["".join... | from collections import Counter
from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
return over // under
N = int(eval(input()))
lst_s = ["".join... | false | 3.846154 | [
"-lst_s.sort()"
] | false | 0.047592 | 0.110786 | 0.429584 | [
"s280535130",
"s730765468"
] |
u033606236 | p03600 | python | s231861345 | s941319640 | 861 | 601 | 43,740 | 43,740 | Accepted | Accepted | 30.2 | n = int(eval(input()))
ary = [list(map(int,input().split())) for _ in range(n)]
ans = sum([sum(i) for i in ary])
for i in range(n):
for j in range(n):
flag = 0
for k in range(n):
if j == k or i == k:continue
if ary[i][j] > ary[i][k] + ary[k][j]:print((-1));exit()
... | n = int(eval(input()))
ary = [list(map(int,input().split())) for _ in range(n)]
ans = sum([sum(i) for i in ary])
for i in range(n):
for j in range(n):
for k in range(n):
if j == k or i == k:continue
if ary[i][j] > ary[i][k] + ary[k][j]:print((-1));exit()
if ary[i]... | 13 | 12 | 434 | 413 | n = int(eval(input()))
ary = [list(map(int, input().split())) for _ in range(n)]
ans = sum([sum(i) for i in ary])
for i in range(n):
for j in range(n):
flag = 0
for k in range(n):
if j == k or i == k:
continue
if ary[i][j] > ary[i][k] + ary[k][j]:
... | n = int(eval(input()))
ary = [list(map(int, input().split())) for _ in range(n)]
ans = sum([sum(i) for i in ary])
for i in range(n):
for j in range(n):
for k in range(n):
if j == k or i == k:
continue
if ary[i][j] > ary[i][k] + ary[k][j]:
print((-1))
... | false | 7.692308 | [
"- flag = 0",
"- flag = 1",
"- if flag:",
"- ans -= ary[i][j]",
"+ ans -= ary[i][j]",
"+ break"
] | false | 0.06035 | 0.057815 | 1.04384 | [
"s231861345",
"s941319640"
] |
u312025627 | p02888 | python | s387670627 | s488977010 | 950 | 713 | 136,108 | 42,204 | Accepted | Accepted | 24.95 | def main():
N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
L_pair = []
for i in range(N):
for j in range(i+1, N):
L_pair.append((i, j))
def is_ok(mid, i, j):
if L[mid] < L[i] + L[j]:
return True
else:
... | def main():
from bisect import bisect_left
N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
ans = 0
for i in range(N):
for j in range(i+1, N):
ab = L[i] + L[j]
ri = bisect_left(L, ab)
le = j + 1
ans += ri - l... | 35 | 18 | 786 | 378 | def main():
N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
L_pair = []
for i in range(N):
for j in range(i + 1, N):
L_pair.append((i, j))
def is_ok(mid, i, j):
if L[mid] < L[i] + L[j]:
return True
else:
return Fa... | def main():
from bisect import bisect_left
N = int(eval(input()))
L = [int(i) for i in input().split()]
L.sort()
ans = 0
for i in range(N):
for j in range(i + 1, N):
ab = L[i] + L[j]
ri = bisect_left(L, ab)
le = j + 1
ans += ri - le
pr... | false | 48.571429 | [
"+ from bisect import bisect_left",
"+",
"- L_pair = []",
"+ ans = 0",
"- L_pair.append((i, j))",
"-",
"- def is_ok(mid, i, j):",
"- if L[mid] < L[i] + L[j]:",
"- return True",
"- else:",
"- return False",
"-",
"- def binary_searc... | false | 0.043977 | 0.041057 | 1.071115 | [
"s387670627",
"s488977010"
] |
u254871849 | p03814 | python | s797900715 | s286640137 | 24 | 18 | 4,968 | 3,512 | Accepted | Accepted | 25 | s = eval(input())
a = s.index("A")
rs = ''.join(reversed(s))
z = rs.index("Z")
print((len(s) - a - z)) | s = eval(input())
a = s.index("A")
rs = s[::-1]
z = rs.index("Z")
print((len(s) - a - z)) | 7 | 7 | 102 | 89 | s = eval(input())
a = s.index("A")
rs = "".join(reversed(s))
z = rs.index("Z")
print((len(s) - a - z))
| s = eval(input())
a = s.index("A")
rs = s[::-1]
z = rs.index("Z")
print((len(s) - a - z))
| false | 0 | [
"-rs = \"\".join(reversed(s))",
"+rs = s[::-1]"
] | false | 0.046369 | 0.058904 | 0.787204 | [
"s797900715",
"s286640137"
] |
u394482932 | p03997 | python | s205625658 | s535732507 | 165 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.7 | a,b,h=list(map(int,[eval(input()) for i in range(3)]))
print((h*(a+b)//2)) | a,b,h=list(map(int,[eval(input())for i in[0]*3]));print((h*(a+b)//2)) | 2 | 1 | 61 | 55 | a, b, h = list(map(int, [eval(input()) for i in range(3)]))
print((h * (a + b) // 2))
| a, b, h = list(map(int, [eval(input()) for i in [0] * 3]))
print((h * (a + b) // 2))
| false | 50 | [
"-a, b, h = list(map(int, [eval(input()) for i in range(3)]))",
"+a, b, h = list(map(int, [eval(input()) for i in [0] * 3]))"
] | false | 0.035298 | 0.032743 | 1.078028 | [
"s205625658",
"s535732507"
] |
u922449550 | p02733 | python | s711331271 | s524979590 | 803 | 725 | 53,596 | 52,444 | Accepted | Accepted | 9.71 | H, W, K = list(map(int, input().split()))
S = [eval(input()) for h in range(H)]
# 横の割り方を全通り試す(2**(H-1))
ans = float('inf')
for i in range(2**(H-1)):
_ans = bin(i).count('1')
chocos = [list(map(int, S[0]))]
for j in range(H-1):
if i >> j & 1:
chocos.append(list(map(int, S[j+1])... | H, W, K = list(map(int, input().split()))
S = [eval(input()) for h in range(H)]
# 横の割り方を全通り試す(2**(H-1))
ans = float('inf')
for i in range(2**(H-1)):
_ans = bin(i).count('1')
chocos = [list(map(int, S[0]))]
for j in range(H-1):
if i >> j & 1:
chocos.append(list(map(int, S[j+1])... | 36 | 41 | 927 | 1,054 | H, W, K = list(map(int, input().split()))
S = [eval(input()) for h in range(H)]
# 横の割り方を全通り試す(2**(H-1))
ans = float("inf")
for i in range(2 ** (H - 1)):
_ans = bin(i).count("1")
chocos = [list(map(int, S[0]))]
for j in range(H - 1):
if i >> j & 1:
chocos.append(list(map(int, S[j + 1])))
... | H, W, K = list(map(int, input().split()))
S = [eval(input()) for h in range(H)]
# 横の割り方を全通り試す(2**(H-1))
ans = float("inf")
for i in range(2 ** (H - 1)):
_ans = bin(i).count("1")
chocos = [list(map(int, S[0]))]
for j in range(H - 1):
if i >> j & 1:
chocos.append(list(map(int, S[j + 1])))
... | false | 12.195122 | [
"+ flag = False",
"+ flag = True",
"+ break",
"+ if flag:",
"+ flag = False",
"+ break"
] | false | 0.066624 | 0.078013 | 0.854004 | [
"s711331271",
"s524979590"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.