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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u873915460 | p02614 | python | s456385750 | s134943039 | 88 | 66 | 68,476 | 68,380 | Accepted | Accepted | 25 | H,W,K=list(map(int,input().split()))
S=[eval(input()) for i in range(H)]
P=0
Q=0
for i in range(1<<H):
for j in range(1<<W):
Q=0
for k in range(H):
for l in range(W):
if S[k][l]=='#' and i&(1<<k)!=0 and j&(1<<l)!=0:
Q+=1
if Q==K:
P+=1
print(P)
| H,W,K=list(map(int,input().split()))
C=[eval(input()) for i in range(H)]
DP=[0]*(K+1)
X=[]
P=0
for i in range(1,1<<H):
X=[0]*W
for j in range(H):
if i&(1<<j):
for k in range(W):
if C[j][k]=='#':
X[k]+=1
for j in range(K+1):
DP[j]=0
DP[0]=1
for j in range(W):
... | 14 | 21 | 289 | 403 | H, W, K = list(map(int, input().split()))
S = [eval(input()) for i in range(H)]
P = 0
Q = 0
for i in range(1 << H):
for j in range(1 << W):
Q = 0
for k in range(H):
for l in range(W):
if S[k][l] == "#" and i & (1 << k) != 0 and j & (1 << l) != 0:
Q += ... | H, W, K = list(map(int, input().split()))
C = [eval(input()) for i in range(H)]
DP = [0] * (K + 1)
X = []
P = 0
for i in range(1, 1 << H):
X = [0] * W
for j in range(H):
if i & (1 << j):
for k in range(W):
if C[j][k] == "#":
X[k] += 1
for j in range(K ... | false | 33.333333 | [
"-S = [eval(input()) for i in range(H)]",
"+C = [eval(input()) for i in range(H)]",
"+DP = [0] * (K + 1)",
"+X = []",
"-Q = 0",
"-for i in range(1 << H):",
"- for j in range(1 << W):",
"- Q = 0",
"- for k in range(H):",
"- for l in range(W):",
"- if S[k... | false | 0.113847 | 0.046608 | 2.442638 | [
"s456385750",
"s134943039"
] |
u014333473 | p03673 | python | s796153653 | s577203037 | 736 | 123 | 31,300 | 31,028 | Accepted | Accepted | 83.29 | from collections import deque
n,a,b=int(input()),deque(map(int,input().split())),deque()
for i in range(n):
if n%2==0:
if i%2==0:
b.append(a[i])
else:
b.appendleft(a[i])
else:
if i%2==0:
b.appendleft(a[i])
else:
b.append(a[i])
print(*b,sep=' ')
| n,a=int(input()),list(map(int,input().split()))
b=[a[1::2][::-1]+a[::2],a[0::2][::-1]+a[1::2]][n%2]
print(*b,sep=' ')
| 14 | 3 | 301 | 119 | from collections import deque
n, a, b = int(input()), deque(map(int, input().split())), deque()
for i in range(n):
if n % 2 == 0:
if i % 2 == 0:
b.append(a[i])
else:
b.appendleft(a[i])
else:
if i % 2 == 0:
b.appendleft(a[i])
else:
... | n, a = int(input()), list(map(int, input().split()))
b = [a[1::2][::-1] + a[::2], a[0::2][::-1] + a[1::2]][n % 2]
print(*b, sep=" ")
| false | 78.571429 | [
"-from collections import deque",
"-",
"-n, a, b = int(input()), deque(map(int, input().split())), deque()",
"-for i in range(n):",
"- if n % 2 == 0:",
"- if i % 2 == 0:",
"- b.append(a[i])",
"- else:",
"- b.appendleft(a[i])",
"- else:",
"- if i %... | false | 0.053892 | 0.039467 | 1.365477 | [
"s796153653",
"s577203037"
] |
u144913062 | p02610 | python | s203530273 | s723090528 | 488 | 412 | 105,744 | 101,180 | Accepted | Accepted | 15.57 | from collections import deque
from heapq import heappush, heappushpop
import sys
input = sys.stdin.readline
def calc(camels):
camels = deque(sorted(camels, key=lambda x: x[0]))
N = len(camels)
heap = []
while camels and camels[0][0] == 0:
camels.popleft()
for i in range(1, N+1):
... | from heapq import heappush, heappop
import sys
input = sys.stdin.readline
def calc(camels, N):
camels.sort(key=lambda x: x[0])
heap = []
for i, x in camels:
heappush(heap, x)
if len(heap) > i:
heappop(heap)
return sum(heap)
T = int(eval(input()))
for _ in rang... | 42 | 30 | 1,105 | 688 | from collections import deque
from heapq import heappush, heappushpop
import sys
input = sys.stdin.readline
def calc(camels):
camels = deque(sorted(camels, key=lambda x: x[0]))
N = len(camels)
heap = []
while camels and camels[0][0] == 0:
camels.popleft()
for i in range(1, N + 1):
... | from heapq import heappush, heappop
import sys
input = sys.stdin.readline
def calc(camels, N):
camels.sort(key=lambda x: x[0])
heap = []
for i, x in camels:
heappush(heap, x)
if len(heap) > i:
heappop(heap)
return sum(heap)
T = int(eval(input()))
for _ in range(T):
N... | false | 28.571429 | [
"-from collections import deque",
"-from heapq import heappush, heappushpop",
"+from heapq import heappush, heappop",
"-def calc(camels):",
"- camels = deque(sorted(camels, key=lambda x: x[0]))",
"- N = len(camels)",
"+def calc(camels, N):",
"+ camels.sort(key=lambda x: x[0])",
"- while ... | false | 0.03853 | 0.161101 | 0.239166 | [
"s203530273",
"s723090528"
] |
u080364835 | p02957 | python | s180305317 | s710321683 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a, b = list(map(int, input().split()))
k = ( a + b )
if k%2 == 0:
print((k//2))
else:
print('IMPOSSIBLE') | a, b = list(map(int, input().split()))
if (a**2 - b**2) % (2 * (a - b)) == 0:
print(((a**2 - b**2) // (2 * (a - b))))
else:
print('IMPOSSIBLE')
| 8 | 6 | 110 | 150 | a, b = list(map(int, input().split()))
k = a + b
if k % 2 == 0:
print((k // 2))
else:
print("IMPOSSIBLE")
| a, b = list(map(int, input().split()))
if (a**2 - b**2) % (2 * (a - b)) == 0:
print(((a**2 - b**2) // (2 * (a - b))))
else:
print("IMPOSSIBLE")
| false | 25 | [
"-k = a + b",
"-if k % 2 == 0:",
"- print((k // 2))",
"+if (a**2 - b**2) % (2 * (a - b)) == 0:",
"+ print(((a**2 - b**2) // (2 * (a - b))))"
] | false | 0.041289 | 0.046347 | 0.89086 | [
"s180305317",
"s710321683"
] |
u281303342 | p03472 | python | s055382737 | s728776695 | 365 | 218 | 7,384 | 7,392 | Accepted | Accepted | 40.27 | import sys
N,H = list(map(int,input().split()))
A = 0
B = []
for _ in range(N):
a,b = list(map(int,input().split()))
A = max(A,a)
B.append(b)
B.sort(reverse=True)
ans = 0
for b in B:
if b > A:
H -= b
ans += 1
else:
break
if H <= 0:
print(ans)
... | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
N,H = list(map(int,input().split()))
A,B = 0,[]
for i in range(N):
a,b = list(map(int,input().split()))
A = max(A,a)
B.append(b)
ans = 0
B.sort(reverse=True)
for b in B:
if b > A:
ans += 1
H -= b
... | 22 | 24 | 353 | 408 | import sys
N, H = list(map(int, input().split()))
A = 0
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A = max(A, a)
B.append(b)
B.sort(reverse=True)
ans = 0
for b in B:
if b > A:
H -= b
ans += 1
else:
break
if H <= 0:
print(ans)
sys.exi... | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
N, H = list(map(int, input().split()))
A, B = 0, []
for i in range(N):
a, b = list(map(int, input().split()))
A = max(A, a)
B.append(b)
ans = 0
B.sort(reverse=True)
for b in B:
if b > A:
ans += 1
H -= b
if H <= 0:
... | false | 8.333333 | [
"+# python3 (3.4.3)",
"+input = sys.stdin.readline",
"+# main",
"-A = 0",
"-B = []",
"-for _ in range(N):",
"+A, B = 0, []",
"+for i in range(N):",
"+ans = 0",
"-ans = 0",
"+ ans += 1",
"- ans += 1",
"- else:",
"- break",
"- if H <= 0:",
"- print(ans)"... | false | 0.036237 | 0.040609 | 0.892338 | [
"s055382737",
"s728776695"
] |
u077291787 | p03141 | python | s646247895 | s022081258 | 391 | 165 | 22,104 | 25,180 | Accepted | Accepted | 57.8 | # nikkei2019-qualC - Different Strokes
def main():
N = int(eval(input()))
A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=sum, reverse=1)
ans = sum(i for i, j in A[::2]) - sum(j for i, j in A[1::2])
print(ans)
if __name__ == "__main__":
main() | # nikkei2019-qualC - Different Strokes
def main():
# player gets ai <-> point spread increases by ai + bi -> sort A by ai + bi
# player gets Ai whose index is even / rival gets Ai whose index is odd
N, *AB = list(map(int, open(0).read().split()))
A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]
A... | 10 | 13 | 289 | 465 | # nikkei2019-qualC - Different Strokes
def main():
N = int(eval(input()))
A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=sum, reverse=1)
ans = sum(i for i, j in A[::2]) - sum(j for i, j in A[1::2])
print(ans)
if __name__ == "__main__":
main()
| # nikkei2019-qualC - Different Strokes
def main():
# player gets ai <-> point spread increases by ai + bi -> sort A by ai + bi
# player gets Ai whose index is even / rival gets Ai whose index is odd
N, *AB = list(map(int, open(0).read().split()))
A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]
A.sort(... | false | 23.076923 | [
"- N = int(eval(input()))",
"- A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=sum, reverse=1)",
"+ # player gets ai <-> point spread increases by ai + bi -> sort A by ai + bi",
"+ # player gets Ai whose index is even / rival gets Ai whose index is odd",
"+ N, *AB = list(... | false | 0.067003 | 0.065723 | 1.019476 | [
"s646247895",
"s022081258"
] |
u255067135 | p03078 | python | s372282450 | s887483934 | 1,748 | 60 | 161,220 | 4,700 | Accepted | Accepted | 96.57 |
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
# まずA, Bで総当たり、上位K個をスタック
tmp = [a+b for a in A for b in B]
tmp.sort(reverse=True)
tmp = tmp... |
def conKey(i, j, k):
return str(i)+'-'+str(j)+'-'+str(k)
def getKey(s):
return list(map(int, s.split('-')))
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True... | 20 | 42 | 444 | 986 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
# まずA, Bで総当たり、上位K個をスタック
tmp = [a + b for a in A for b in B]
tmp.sort(reverse=True)
tmp = tmp[:K]
# 残りのc個... | def conKey(i, j, k):
return str(i) + "-" + str(j) + "-" + str(k)
def getKey(s):
return list(map(int, s.split("-")))
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.so... | false | 52.380952 | [
"+def conKey(i, j, k):",
"+ return str(i) + \"-\" + str(j) + \"-\" + str(k)",
"+",
"+",
"+def getKey(s):",
"+ return list(map(int, s.split(\"-\")))",
"+",
"+",
"+import heapq",
"+",
"-# まずA, Bで総当たり、上位K個をスタック",
"-tmp = [a + b for a in A for b in B]",
"-tmp.sort(reverse=True)",
"-tmp =... | false | 0.075869 | 0.034433 | 2.203388 | [
"s372282450",
"s887483934"
] |
u254871849 | p03575 | python | s228526280 | s322703896 | 21 | 18 | 3,316 | 3,192 | Accepted | Accepted | 14.29 | import sys
from collections import deque
n, m = list(map(int, sys.stdin.readline().split()))
ab = list(map(int, sys.stdin.read().split()))
ab = list(zip(*[ab] * 2))
graph = [set() for _ in range(n+1)]
for a, b in ab:
graph[a].add(b)
graph[b].add(a)
def main():
que = set()
for i in range(1... | import sys
n, m, *ab = list(map(int, sys.stdin.read().split()))
graph = [set() for _ in range(n)]
for a, b in zip(*[iter(ab)] * 2):
a -= 1; b -= 1
graph[a].add(b); graph[b].add(a)
def main():
stack = [i for i in range(n) if len(graph[i]) == 1]
bridges = 0
while stack:
x = stac... | 34 | 23 | 730 | 558 | import sys
from collections import deque
n, m = list(map(int, sys.stdin.readline().split()))
ab = list(map(int, sys.stdin.read().split()))
ab = list(zip(*[ab] * 2))
graph = [set() for _ in range(n + 1)]
for a, b in ab:
graph[a].add(b)
graph[b].add(a)
def main():
que = set()
for i in range(1, n + 1):
... | import sys
n, m, *ab = list(map(int, sys.stdin.read().split()))
graph = [set() for _ in range(n)]
for a, b in zip(*[iter(ab)] * 2):
a -= 1
b -= 1
graph[a].add(b)
graph[b].add(a)
def main():
stack = [i for i in range(n) if len(graph[i]) == 1]
bridges = 0
while stack:
x = stack.pop(... | false | 32.352941 | [
"-from collections import deque",
"-n, m = list(map(int, sys.stdin.readline().split()))",
"-ab = list(map(int, sys.stdin.read().split()))",
"-ab = list(zip(*[ab] * 2))",
"-graph = [set() for _ in range(n + 1)]",
"-for a, b in ab:",
"+n, m, *ab = list(map(int, sys.stdin.read().split()))",
"+graph = [se... | false | 0.045071 | 0.047819 | 0.942535 | [
"s228526280",
"s322703896"
] |
u597374218 | p03360 | python | s483929524 | s862748420 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | l=[int(_) for _ in input().split()]
k=int(eval(input()))
print((max(l)*2**k+sum(l)-max(l))) | l=[int(_) for _ in input().split()]
print((max(l)*2**int(eval(input()))+sum(l)-max(l))) | 3 | 2 | 85 | 80 | l = [int(_) for _ in input().split()]
k = int(eval(input()))
print((max(l) * 2**k + sum(l) - max(l)))
| l = [int(_) for _ in input().split()]
print((max(l) * 2 ** int(eval(input())) + sum(l) - max(l)))
| false | 33.333333 | [
"-k = int(eval(input()))",
"-print((max(l) * 2**k + sum(l) - max(l)))",
"+print((max(l) * 2 ** int(eval(input())) + sum(l) - max(l)))"
] | false | 0.039169 | 0.038462 | 1.018379 | [
"s483929524",
"s862748420"
] |
u941047297 | p03449 | python | s918357232 | s564422739 | 182 | 17 | 38,512 | 3,060 | Accepted | Accepted | 90.66 | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
ans = 0
for n in range(N):
score = sum(A[0][:n + 1]) + sum(A[1][n:])
ans = max(ans, score)
print(ans) | n = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
ans = 0
for i in range(n):
score = sum(A[0][:i + 1] + A[1][i:])
ans = max(ans, score)
print(ans) | 7 | 7 | 188 | 183 | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
ans = 0
for n in range(N):
score = sum(A[0][: n + 1]) + sum(A[1][n:])
ans = max(ans, score)
print(ans)
| n = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
ans = 0
for i in range(n):
score = sum(A[0][: i + 1] + A[1][i:])
ans = max(ans, score)
print(ans)
| false | 0 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-for n in range(N):",
"- score = sum(A[0][: n + 1]) + sum(A[1][n:])",
"+for i in range(n):",
"+ score = sum(A[0][: i + 1] + A[1][i:])"
] | false | 0.087788 | 0.047691 | 1.840772 | [
"s918357232",
"s564422739"
] |
u678167152 | p03171 | python | s696598685 | s118966010 | 858 | 787 | 111,964 | 111,836 | Accepted | Accepted | 8.28 | N = int(eval(input()))
A = list(map(int, input().split()))
def solve(N,A):
s,e = 0, N-1
dp = [[0]*N for i in range(N)]
for k in range(N):
for i in range(N):
j = i+k
if j>=N:
continue
sign = (-1)**(N-1-k)
if k==0:
... | N = int(eval(input()))
A = list(map(int, input().split()))
def solve(N,A):
s,e = 0, N-1
dp = [[0]*N for i in range(N)]
for k in range(N):
for i in range(N-k):
j = i+k
sign = (-1)**(N-1-k)
if k==0:
dp[i][j] = sign*A[i]
... | 20 | 18 | 502 | 456 | N = int(eval(input()))
A = list(map(int, input().split()))
def solve(N, A):
s, e = 0, N - 1
dp = [[0] * N for i in range(N)]
for k in range(N):
for i in range(N):
j = i + k
if j >= N:
continue
sign = (-1) ** (N - 1 - k)
if k == 0:
... | N = int(eval(input()))
A = list(map(int, input().split()))
def solve(N, A):
s, e = 0, N - 1
dp = [[0] * N for i in range(N)]
for k in range(N):
for i in range(N - k):
j = i + k
sign = (-1) ** (N - 1 - k)
if k == 0:
dp[i][j] = sign * A[i]
... | false | 10 | [
"- for i in range(N):",
"+ for i in range(N - k):",
"- if j >= N:",
"- continue"
] | false | 0.062855 | 0.037741 | 1.665411 | [
"s696598685",
"s118966010"
] |
u901447859 | p02927 | python | s327223622 | s986371562 | 26 | 20 | 3,060 | 3,060 | Accepted | Accepted | 23.08 | M,D=list(map(int, input().split()))
seki=0
for m in range(1,M+1):
for d in range(1,D+1):
str_d = str(d)
if len(str_d)==2:
d10 = int(str_d[0])
d1 = int(str_d[1])
if d10 >= 2 and d1 >= 2 and d10*d1 == m:
seki+=1
print(seki) | M, D = list(map(int, input().split()))
seki = 0
for m in range(1, M + 1):
for d in range(1, D + 1):
d10, d1 = divmod(d, 10)
if d10 >= 2 and d1 >= 2 and d10 * d1 == m:
seki += 1
print(seki) | 12 | 8 | 300 | 221 | M, D = list(map(int, input().split()))
seki = 0
for m in range(1, M + 1):
for d in range(1, D + 1):
str_d = str(d)
if len(str_d) == 2:
d10 = int(str_d[0])
d1 = int(str_d[1])
if d10 >= 2 and d1 >= 2 and d10 * d1 == m:
seki += 1
print(seki)
| M, D = list(map(int, input().split()))
seki = 0
for m in range(1, M + 1):
for d in range(1, D + 1):
d10, d1 = divmod(d, 10)
if d10 >= 2 and d1 >= 2 and d10 * d1 == m:
seki += 1
print(seki)
| false | 33.333333 | [
"- str_d = str(d)",
"- if len(str_d) == 2:",
"- d10 = int(str_d[0])",
"- d1 = int(str_d[1])",
"- if d10 >= 2 and d1 >= 2 and d10 * d1 == m:",
"- seki += 1",
"+ d10, d1 = divmod(d, 10)",
"+ if d10 >= 2 and d1 >= 2 and d10 * d1 ... | false | 0.036416 | 0.062549 | 0.582198 | [
"s327223622",
"s986371562"
] |
u969850098 | p03634 | python | s303679838 | s385064624 | 583 | 485 | 43,800 | 51,240 | Accepted | Accepted | 16.81 | import sys
readline = sys.stdin.readline
from collections import deque
def main():
N = int(readline())
path = [[] for _ in range(N)]
for _ in range(N-1):
a, b, c = list(map(int, readline().rstrip().split()))
path[a-1].append((b-1, c))
path[b-1].append((a-1, c))
Q, K =... | import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop
def dijkstra(path, N, start):
"""
Args:
path (list): [[(cost, node), (cost, node), ...], [], [], ...]
"""
visited = [False] * N
que = [(0, start)]
heapify(que) # 始点aから各頂点への(距離, 頂点ID)
... | 31 | 48 | 784 | 1,263 | import sys
readline = sys.stdin.readline
from collections import deque
def main():
N = int(readline())
path = [[] for _ in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, readline().rstrip().split()))
path[a - 1].append((b - 1, c))
path[b - 1].append((a - 1, c))
Q, K ... | import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop
def dijkstra(path, N, start):
"""
Args:
path (list): [[(cost, node), (cost, node), ...], [], [], ...]
"""
visited = [False] * N
que = [(0, start)]
heapify(que) # 始点aから各頂点への(距離, 頂点ID)
dist = [-1]... | false | 35.416667 | [
"-from collections import deque",
"+from heapq import heapify, heappush, heappop",
"+",
"+",
"+def dijkstra(path, N, start):",
"+ \"\"\"",
"+ Args:",
"+ path (list): [[(cost, node), (cost, node), ...], [], [], ...]",
"+ \"\"\"",
"+ visited = [False] * N",
"+ que = [(0, star... | false | 0.036581 | 0.045492 | 0.804119 | [
"s303679838",
"s385064624"
] |
u392319141 | p03286 | python | s043053090 | s763669777 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
ans = ''
isOdd = False
while N != 0 :
if N % 2 == 1 :
ans += '1'
else :
ans += '0'
if isOdd :
N += 1
N //= 2
isOdd = not isOdd
if ans == '' :
print('0')
else :
print((ans[::-1])) | N = int(eval(input()))
if N == 0:
print((0))
exit()
ans = []
while N != 0:
d = len(ans)
if N % 2 == 1:
ans.append('1')
N -= pow(-1, d)
N //= 2
else:
ans.append('0')
N //= 2
print((''.join(ans[::-1])))
| 18 | 18 | 264 | 271 | N = int(eval(input()))
ans = ""
isOdd = False
while N != 0:
if N % 2 == 1:
ans += "1"
else:
ans += "0"
if isOdd:
N += 1
N //= 2
isOdd = not isOdd
if ans == "":
print("0")
else:
print((ans[::-1]))
| N = int(eval(input()))
if N == 0:
print((0))
exit()
ans = []
while N != 0:
d = len(ans)
if N % 2 == 1:
ans.append("1")
N -= pow(-1, d)
N //= 2
else:
ans.append("0")
N //= 2
print(("".join(ans[::-1])))
| false | 0 | [
"-ans = \"\"",
"-isOdd = False",
"+if N == 0:",
"+ print((0))",
"+ exit()",
"+ans = []",
"+ d = len(ans)",
"- ans += \"1\"",
"+ ans.append(\"1\")",
"+ N -= pow(-1, d)",
"+ N //= 2",
"- ans += \"0\"",
"- if isOdd:",
"- N += 1",
"- N... | false | 0.043708 | 0.044857 | 0.974392 | [
"s043053090",
"s763669777"
] |
u086503932 | p03112 | python | s312994657 | s388541430 | 946 | 761 | 18,656 | 91,284 | Accepted | Accepted | 19.56 | #!/usr/bin/env python3
from bisect import bisect_right
def main():
A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for _ in range(A)]
t = [int(eval(input())) for _ in range(B)]
# print(s,t)
s = [-10**12] + s + [10**12]
t = [-10**12] + t + [10**12]
for _ in rang... | from bisect import bisect_left
A, B, Q = list(map(int, input().split()))
INF = 10**12
s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
for _ in range(Q):
x = int(eval(input()))
si = bisect_left(s,x)
ti = bisect_left(t,x)
... | 27 | 18 | 797 | 516 | #!/usr/bin/env python3
from bisect import bisect_right
def main():
A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for _ in range(A)]
t = [int(eval(input())) for _ in range(B)]
# print(s,t)
s = [-(10**12)] + s + [10**12]
t = [-(10**12)] + t + [10**12]
for _ in range(Q):
... | from bisect import bisect_left
A, B, Q = list(map(int, input().split()))
INF = 10**12
s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
for _ in range(Q):
x = int(eval(input()))
si = bisect_left(s, x)
ti = bisect_left(t, x)
sl = [s[s... | false | 33.333333 | [
"-#!/usr/bin/env python3",
"-from bisect import bisect_right",
"+from bisect import bisect_left",
"-",
"-def main():",
"- A, B, Q = list(map(int, input().split()))",
"- s = [int(eval(input())) for _ in range(A)]",
"- t = [int(eval(input())) for _ in range(B)]",
"- # print(s,t)",
"- ... | false | 0.142895 | 0.037966 | 3.763786 | [
"s312994657",
"s388541430"
] |
u353919145 | p02628 | python | s328927955 | s583366216 | 62 | 26 | 62,248 | 9,240 | Accepted | Accepted | 58.06 | NK = input().split()
n = int(NK[0])
k = int(NK[1])
arr = list(map(int, input().split()))
arr.sort()
print((sum(arr[0:k])))
| n, k = input().split()
p = list(map(int, input().split()))
p = sorted(p)
ans = 0
for i in range(int(k)):
ans += p[i]
print(ans)
| 6 | 7 | 126 | 138 | NK = input().split()
n = int(NK[0])
k = int(NK[1])
arr = list(map(int, input().split()))
arr.sort()
print((sum(arr[0:k])))
| n, k = input().split()
p = list(map(int, input().split()))
p = sorted(p)
ans = 0
for i in range(int(k)):
ans += p[i]
print(ans)
| false | 14.285714 | [
"-NK = input().split()",
"-n = int(NK[0])",
"-k = int(NK[1])",
"-arr = list(map(int, input().split()))",
"-arr.sort()",
"-print((sum(arr[0:k])))",
"+n, k = input().split()",
"+p = list(map(int, input().split()))",
"+p = sorted(p)",
"+ans = 0",
"+for i in range(int(k)):",
"+ ans += p[i]",
... | false | 0.035701 | 0.034199 | 1.043904 | [
"s328927955",
"s583366216"
] |
u169138653 | p03112 | python | s711931276 | s195642051 | 1,290 | 728 | 16,864 | 64,860 | Accepted | Accepted | 43.57 | from bisect import bisect_left
def main():
a,b,q=list(map(int,input().split()))
s=[int(eval(input())) for i in range(a)]
t=[int(eval(input())) for i in range(b)]
x=[int(eval(input())) for i in range(q)]
inf=10**11
minf=-10**11
s=[minf]+s+[inf]
t=[minf]+t+[inf]
for i in range(q):
ns=bise... | from bisect import bisect_left
import sys
def main():
input=sys.stdin.readline
a,b,q=list(map(int,input().split()))
s=[int(eval(input())) for i in range(a)]
t=[int(eval(input())) for i in range(b)]
x=[int(eval(input())) for i in range(q)]
inf=10**11
minf=-10**11
s=[minf]+s+[inf]
t=[minf]+t+... | 20 | 22 | 551 | 591 | from bisect import bisect_left
def main():
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
x = [int(eval(input())) for i in range(q)]
inf = 10**11
minf = -(10**11)
s = [minf] + s + [inf]
t = [minf] + t + [i... | from bisect import bisect_left
import sys
def main():
input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
x = [int(eval(input())) for i in range(q)]
inf = 10**11
minf = -(10**11)
s = ... | false | 9.090909 | [
"+import sys",
"+ input = sys.stdin.readline"
] | false | 0.038148 | 0.037943 | 1.005388 | [
"s711931276",
"s195642051"
] |
u807028974 | p02584 | python | s077943233 | s623780035 | 33 | 28 | 9,208 | 9,216 | Accepted | Accepted | 15.15 | # import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
# combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operato... | X,K,D = list(map(int,input().split()))
# 原点に近い位置までの移動回数を求める
count = abs(X) // D
ans = 0
if count>K:
ans = abs(X) - D * K
else:
if (K-count)%2==0:
ans = abs(X) % D
else:
ans = abs(abs(X) % D - D)
print(ans) | 42 | 12 | 878 | 238 | # import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
# combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemge... | X, K, D = list(map(int, input().split()))
# 原点に近い位置までの移動回数を求める
count = abs(X) // D
ans = 0
if count > K:
ans = abs(X) - D * K
else:
if (K - count) % 2 == 0:
ans = abs(X) % D
else:
ans = abs(abs(X) % D - D)
print(ans)
| false | 71.428571 | [
"-# import sys",
"-# import math #sqrt,gcd,pi",
"-# import decimal",
"-# import queue # queue",
"-# import bisect",
"-# import heapq # priolity-queue",
"-# import time",
"-# from itertools import product,permutations,\\",
"-# combinations,combinations_with_replacement",
"-# 重複あり順列、順列、組み合わせ、重複あり組み合... | false | 0.031877 | 0.032144 | 0.991677 | [
"s077943233",
"s623780035"
] |
u562935282 | p03160 | python | s473721506 | s987531089 | 177 | 133 | 13,928 | 13,884 | Accepted | Accepted | 24.86 | inf = float('inf')
n = int(eval(input()))
h = list(map(int, input().split())) + [inf]
dp = [inf] * (n + 1)
dp[0] = 0
# 配る
for i in range(n - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print((dp[n - 1]))
| def main():
import sys
readline = sys.stdin.readline
inf = 10 ** 9
n = int(readline())
*h, = list(map(int, readline().split()))
h = [inf] + h + [inf] # 1-indexed化
dp = [inf] * (n + 2)
dp[0] = 0
dp[1] = 0
for i in range(1, n): # ジャンプ元,1-indexed
dp[i + ... | 13 | 28 | 293 | 550 | inf = float("inf")
n = int(eval(input()))
h = list(map(int, input().split())) + [inf]
dp = [inf] * (n + 1)
dp[0] = 0
# 配る
for i in range(n - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print((dp[n - 1]))
| def main():
import sys
readline = sys.stdin.readline
inf = 10**9
n = int(readline())
(*h,) = list(map(int, readline().split()))
h = [inf] + h + [inf] # 1-indexed化
dp = [inf] * (n + 2)
dp[0] = 0
dp[1] = 0
for i in range(1, n): # ジャンプ元,1-indexed
dp[i + 2] = min(dp[i + 2]... | false | 53.571429 | [
"-inf = float(\"inf\")",
"-n = int(eval(input()))",
"-h = list(map(int, input().split())) + [inf]",
"-dp = [inf] * (n + 1)",
"-dp[0] = 0",
"-# 配る",
"-for i in range(n - 1):",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]... | false | 0.007649 | 0.037021 | 0.206607 | [
"s473721506",
"s987531089"
] |
u606045429 | p03062 | python | s509104353 | s583077271 | 184 | 116 | 22,220 | 14,332 | Accepted | Accepted | 36.96 | N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [(0, -1e10)] * (N + 1)
for i in range(N):
a = max(dp[i][0] + A[i], dp[i][1] - A[i])
b = max(dp[i][0] - A[i], dp[i][1] + A[i])
dp[i + 1] = (a, b)
print((dp[N][0])) | N = int(eval(input()))
A = [int(i) for i in input().split()]
a, b = 0, -1e10
for ai in A:
a, b = max(a + ai, b - ai), max(a - ai, b + ai)
print(a) | 10 | 8 | 243 | 153 | N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [(0, -1e10)] * (N + 1)
for i in range(N):
a = max(dp[i][0] + A[i], dp[i][1] - A[i])
b = max(dp[i][0] - A[i], dp[i][1] + A[i])
dp[i + 1] = (a, b)
print((dp[N][0]))
| N = int(eval(input()))
A = [int(i) for i in input().split()]
a, b = 0, -1e10
for ai in A:
a, b = max(a + ai, b - ai), max(a - ai, b + ai)
print(a)
| false | 20 | [
"-dp = [(0, -1e10)] * (N + 1)",
"-for i in range(N):",
"- a = max(dp[i][0] + A[i], dp[i][1] - A[i])",
"- b = max(dp[i][0] - A[i], dp[i][1] + A[i])",
"- dp[i + 1] = (a, b)",
"-print((dp[N][0]))",
"+a, b = 0, -1e10",
"+for ai in A:",
"+ a, b = max(a + ai, b - ai), max(a - ai, b + ai)",
"... | false | 0.068319 | 0.060871 | 1.12235 | [
"s509104353",
"s583077271"
] |
u392319141 | p03800 | python | s544623119 | s064579092 | 230 | 170 | 6,788 | 8,356 | Accepted | Accepted | 26.09 | N = int(input())
S = list(input())
# Sの値を+-1にする
for i in range(N) :
if S[i] == 'o' :
S[i] = 1
else :
S[i] = -1
S.append(S[0])
def check() :
for first in [1, -1] :
for second in [1, -1] :
animal = [1] * (N + 2)
animal[0] = first
... | N = int(input())
S = [1 if s == 'o' else -1 for s in input()]
for first in [1, -1]:
for second in [1, -1]:
ans = [first, second]
prev = first
now = second
for s in S[1:] + [S[0]]:
if s == 1:
if now == 1:
prev, now = now, pre... | 38 | 25 | 888 | 733 | N = int(input())
S = list(input())
# Sの値を+-1にする
for i in range(N):
if S[i] == "o":
S[i] = 1
else:
S[i] = -1
S.append(S[0])
def check():
for first in [1, -1]:
for second in [1, -1]:
animal = [1] * (N + 2)
animal[0] = first
animal[1] = second
... | N = int(input())
S = [1 if s == "o" else -1 for s in input()]
for first in [1, -1]:
for second in [1, -1]:
ans = [first, second]
prev = first
now = second
for s in S[1:] + [S[0]]:
if s == 1:
if now == 1:
prev, now = now, prev
... | false | 34.210526 | [
"-S = list(input())",
"-# Sの値を+-1にする",
"-for i in range(N):",
"- if S[i] == \"o\":",
"- S[i] = 1",
"- else:",
"- S[i] = -1",
"-S.append(S[0])",
"-",
"-",
"-def check():",
"- for first in [1, -1]:",
"- for second in [1, -1]:",
"- animal = [1] * (N + ... | false | 0.114539 | 0.061342 | 1.867218 | [
"s544623119",
"s064579092"
] |
u117193815 | p03281 | python | s259316287 | s551257203 | 21 | 18 | 3,060 | 3,060 | Accepted | Accepted | 14.29 | n = int(eval(input()))
l=[]
count=0
for h in range(n):
for i in range(h+1):
if (h+1)%(i+1)==0 and (h+1)%2!=0:
l.append(h+1)
if len(l)==8:
count+=1
if len(l)!=8:
l.clear()
print(count) | n = int(eval(input()))
cnt=0
ans=0
for i in range(1,n+1,2):
for j in range(1,i+1):
if i%j==0:
cnt+=1
if cnt==8:
ans+=1
cnt=0
else:
cnt=0
print(ans) | 12 | 13 | 254 | 209 | n = int(eval(input()))
l = []
count = 0
for h in range(n):
for i in range(h + 1):
if (h + 1) % (i + 1) == 0 and (h + 1) % 2 != 0:
l.append(h + 1)
if len(l) == 8:
count += 1
if len(l) != 8:
l.clear()
print(count)
| n = int(eval(input()))
cnt = 0
ans = 0
for i in range(1, n + 1, 2):
for j in range(1, i + 1):
if i % j == 0:
cnt += 1
if cnt == 8:
ans += 1
cnt = 0
else:
cnt = 0
print(ans)
| false | 7.692308 | [
"-l = []",
"-count = 0",
"-for h in range(n):",
"- for i in range(h + 1):",
"- if (h + 1) % (i + 1) == 0 and (h + 1) % 2 != 0:",
"- l.append(h + 1)",
"- if len(l) == 8:",
"- count += 1",
"- if len(l) != 8:",
"- l.clear()",
"-print(count)",... | false | 0.194264 | 0.007833 | 24.80042 | [
"s259316287",
"s551257203"
] |
u571867512 | p03557 | python | s588361989 | s159508106 | 1,100 | 319 | 23,328 | 23,360 | Accepted | Accepted | 71 | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
def b_search_l(B,key):
#key < B[s]を満たすsの個数
if key < B[0]:
return N
elif key >= B[N-1]:
return 0
else:
left,... | from bisect import bisect_left,bisect_right
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
#bisect_left:keyを挿入できる最小のindex
#bisect_right:keyを挿入できる最大のindex
ans = 0
for i in range(N):
b_l,b_r =... | 50 | 18 | 1,159 | 394 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
def b_search_l(B, key):
# key < B[s]を満たすsの個数
if key < B[0]:
return N
elif key >= B[N - 1]:
return 0
else:
left, right = ... | from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
# bisect_left:keyを挿入できる最小のindex
# bisect_right:keyを挿入できる最大のindex
ans = 0
for i in range(N):
b_l, b_r = bisect_le... | false | 64 | [
"+from bisect import bisect_left, bisect_right",
"+",
"-",
"-",
"-def b_search_l(B, key):",
"- # key < B[s]を満たすsの個数",
"- if key < B[0]:",
"- return N",
"- elif key >= B[N - 1]:",
"- return 0",
"- else:",
"- left, right = 0, N",
"- while left < right:",... | false | 0.057354 | 0.040169 | 1.427805 | [
"s588361989",
"s159508106"
] |
u126747509 | p03478 | python | s984794069 | s027613892 | 30 | 27 | 3,060 | 3,060 | Accepted | Accepted | 10 | def main():
n, a, b = list(map(int, input().split()))
sumv = 0
for x in range(a, n+1):
num = sum([int(i) for i in str(x)])
if num >= a and num <= b: sumv += x
print(sumv)
if __name__ == '__main__':
main() | def sum_digit(x):
sumv = 0
while x > 0:
t = x % 10
sumv += t
x = x // 10
return sumv
if __name__ == '__main__':
n, a, b = list(map(int, input().split()))
ans = 0
for num in range(a, n+1):
sumv = sum_digit(num)
if a <= sumv and sumv <= b:
... | 12 | 17 | 248 | 351 | def main():
n, a, b = list(map(int, input().split()))
sumv = 0
for x in range(a, n + 1):
num = sum([int(i) for i in str(x)])
if num >= a and num <= b:
sumv += x
print(sumv)
if __name__ == "__main__":
main()
| def sum_digit(x):
sumv = 0
while x > 0:
t = x % 10
sumv += t
x = x // 10
return sumv
if __name__ == "__main__":
n, a, b = list(map(int, input().split()))
ans = 0
for num in range(a, n + 1):
sumv = sum_digit(num)
if a <= sumv and sumv <= b:
an... | false | 29.411765 | [
"-def main():",
"- n, a, b = list(map(int, input().split()))",
"+def sum_digit(x):",
"- for x in range(a, n + 1):",
"- num = sum([int(i) for i in str(x)])",
"- if num >= a and num <= b:",
"- sumv += x",
"- print(sumv)",
"+ while x > 0:",
"+ t = x % 10",
... | false | 0.03953 | 0.038709 | 1.021222 | [
"s984794069",
"s027613892"
] |
u732412551 | p03862 | python | s117895557 | s600194286 | 134 | 104 | 14,156 | 14,052 | Accepted | Accepted | 22.39 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
acc = 0
ans = 0
for a in A:
eat = max(acc + a - x, 0)
ans += eat
acc = a - eat
acc = 0
ans2 = 0
for a in A:
eat = max(acc + a - x, 0)
ans2 += eat
acc = a - eat
print((min(ans, ans2))) | N,x=list(map(int, input().split()))
A=list(map(int, input().split()))
ans=0
if A[0]>x:
ans+=A[0]-x
A[0]=x
for i in range(1,N):
if A[i]+A[i-1]>x:
y=A[i]+A[i-1]-x
A[i]-=y
ans+=y
print(ans) | 15 | 12 | 288 | 227 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
acc = 0
ans = 0
for a in A:
eat = max(acc + a - x, 0)
ans += eat
acc = a - eat
acc = 0
ans2 = 0
for a in A:
eat = max(acc + a - x, 0)
ans2 += eat
acc = a - eat
print((min(ans, ans2)))
| N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
if A[0] > x:
ans += A[0] - x
A[0] = x
for i in range(1, N):
if A[i] + A[i - 1] > x:
y = A[i] + A[i - 1] - x
A[i] -= y
ans += y
print(ans)
| false | 20 | [
"-acc = 0",
"-for a in A:",
"- eat = max(acc + a - x, 0)",
"- ans += eat",
"- acc = a - eat",
"-acc = 0",
"-ans2 = 0",
"-for a in A:",
"- eat = max(acc + a - x, 0)",
"- ans2 += eat",
"- acc = a - eat",
"-print((min(ans, ans2)))",
"+if A[0] > x:",
"+ ans += A[0] - x",
... | false | 0.04101 | 0.040633 | 1.00929 | [
"s117895557",
"s600194286"
] |
u975966195 | p03457 | python | s473780971 | s398849814 | 431 | 323 | 27,300 | 3,060 | Accepted | Accepted | 25.06 | n = int(eval(input()))
info = [list(map(int, input().split())) for i in range(n)]
info.insert(0, [0, 0, 0])
x_diff, y_diff = 0, 0
for i in range(n):
dt = info[i+1][0] - info[i][0]
x_diff = abs(info[i+1][1] - info[i][1])
y_diff = abs(info[i+1][2] - info[i][2])
if dt < x_diff + y_diff:
... | n = int(eval(input()))
for i in range(n):
t,x,y=list(map(int,input().split()))
if (x + y) > t or (x + y + t) % 2:
print("No")
exit()
print("Yes")
| 18 | 7 | 434 | 164 | n = int(eval(input()))
info = [list(map(int, input().split())) for i in range(n)]
info.insert(0, [0, 0, 0])
x_diff, y_diff = 0, 0
for i in range(n):
dt = info[i + 1][0] - info[i][0]
x_diff = abs(info[i + 1][1] - info[i][1])
y_diff = abs(info[i + 1][2] - info[i][2])
if dt < x_diff + y_diff:
print... | n = int(eval(input()))
for i in range(n):
t, x, y = list(map(int, input().split()))
if (x + y) > t or (x + y + t) % 2:
print("No")
exit()
print("Yes")
| false | 61.111111 | [
"-info = [list(map(int, input().split())) for i in range(n)]",
"-info.insert(0, [0, 0, 0])",
"-x_diff, y_diff = 0, 0",
"- dt = info[i + 1][0] - info[i][0]",
"- x_diff = abs(info[i + 1][1] - info[i][1])",
"- y_diff = abs(info[i + 1][2] - info[i][2])",
"- if dt < x_diff + y_diff:",
"- ... | false | 0.093664 | 0.044913 | 2.085472 | [
"s473780971",
"s398849814"
] |
u729133443 | p02889 | python | s614895551 | s862528097 | 1,778 | 441 | 31,020 | 31,000 | Accepted | Accepted | 75.2 | from scipy.sparse import*
f=csgraph.johnson
t=list(map(int,open('/dev/fd/0').read().split()))
n,m,l=t[:3]
m=m*3+3
for i in f(f(csr_matrix((t[5:m:3],(t[3:m:3],t[4:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n)%n-1:print(i) | from scipy.sparse import*
f=csgraph.floyd_warshall
t=list(map(int,open('/dev/fd/0').read().split()))
n,m,l=t[:3]
m=m*3+3
for i in f(f(csr_matrix((t[5:m:3],(t[3:m:3],t[4:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n)%n-1:print(i) | 6 | 6 | 226 | 233 | from scipy.sparse import *
f = csgraph.johnson
t = list(map(int, open("/dev/fd/0").read().split()))
n, m, l = t[:3]
m = m * 3 + 3
for i in (
f(f(csr_matrix((t[5:m:3], (t[3:m:3], t[4:m:3])), [n + 1] * 2), 0) <= l)[
t[m + 1 :: 2], t[m + 2 :: 2]
].clip(0, n)
% n
- 1
):
print(i)
| from scipy.sparse import *
f = csgraph.floyd_warshall
t = list(map(int, open("/dev/fd/0").read().split()))
n, m, l = t[:3]
m = m * 3 + 3
for i in (
f(f(csr_matrix((t[5:m:3], (t[3:m:3], t[4:m:3])), [n + 1] * 2), 0) <= l)[
t[m + 1 :: 2], t[m + 2 :: 2]
].clip(0, n)
% n
- 1
):
print(i)
| false | 0 | [
"-f = csgraph.johnson",
"+f = csgraph.floyd_warshall"
] | false | 0.566778 | 0.66047 | 0.858144 | [
"s614895551",
"s862528097"
] |
u966695411 | p03238 | python | s819633205 | s939401669 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | *a,=list(map(int,open(0).read().split()))
print((a[1]+a[2]if a[0]>1else'Hello World')) | i=input;print((eval(i()+'+'+i())if'1'<i()else'Hello World')) | 2 | 1 | 79 | 58 | (*a,) = list(map(int, open(0).read().split()))
print((a[1] + a[2] if a[0] > 1 else "Hello World"))
| i = input
print((eval(i() + "+" + i()) if "1" < i() else "Hello World"))
| false | 50 | [
"-(*a,) = list(map(int, open(0).read().split()))",
"-print((a[1] + a[2] if a[0] > 1 else \"Hello World\"))",
"+i = input",
"+print((eval(i() + \"+\" + i()) if \"1\" < i() else \"Hello World\"))"
] | false | 0.072439 | 0.041684 | 1.737814 | [
"s819633205",
"s939401669"
] |
u191874006 | p03125 | python | s774772700 | s276155853 | 181 | 165 | 38,384 | 38,384 | Accepted | Accepted | 8.84 | #!/usr/bin/env python3
#ABC118 A
a,b = list(map(int,input().split()))
if b % a == 0:
print((a+b))
else:
print((b-a))
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 9 | 24 | 125 | 625 | #!/usr/bin/env python3
# ABC118 A
a, b = list(map(int, input().split()))
if b % a == 0:
print((a + b))
else:
print((b - a))
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 62.5 | [
"-# ABC118 A",
"-a, b = list(map(int, input().split()))",
"+import sys",
"+import math",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"+",
"+sys.setrecursionlimit(2147483647)",
"+from heapq import heappush, heappop, heappushpop",
"+from collections import defa... | false | 0.038772 | 0.043372 | 0.893931 | [
"s774772700",
"s276155853"
] |
u192522487 | p02987 | python | s088168620 | s413619564 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s = sorted(list(eval(input())))
print(("Yes" if s[0] == s[1] and s[2] == s[3] and s[1] != s[2] else "No")) | s = sorted(eval(input()))
print(("Yes" if s[0] == s[1] and s[2] == s[3] and s[1] != s[2] else "No")) | 2 | 2 | 99 | 93 | s = sorted(list(eval(input())))
print(("Yes" if s[0] == s[1] and s[2] == s[3] and s[1] != s[2] else "No"))
| s = sorted(eval(input()))
print(("Yes" if s[0] == s[1] and s[2] == s[3] and s[1] != s[2] else "No"))
| false | 0 | [
"-s = sorted(list(eval(input())))",
"+s = sorted(eval(input()))"
] | false | 0.045231 | 0.043105 | 1.049338 | [
"s088168620",
"s413619564"
] |
u243572357 | p03494 | python | s549273781 | s389789508 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | eval(input())
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
A=[a/2 for a in A]
ans+=1
print(ans) | eval(input())
A=list(map(int,input().split()))
ans=0
while all([a%2==0 for a in A]):
A=[a//2 for a in A]
ans+=1
print(ans) | 7 | 7 | 127 | 130 | eval(input())
A = list(map(int, input().split()))
ans = 0
while all(a % 2 == 0 for a in A):
A = [a / 2 for a in A]
ans += 1
print(ans)
| eval(input())
A = list(map(int, input().split()))
ans = 0
while all([a % 2 == 0 for a in A]):
A = [a // 2 for a in A]
ans += 1
print(ans)
| false | 0 | [
"-while all(a % 2 == 0 for a in A):",
"- A = [a / 2 for a in A]",
"+while all([a % 2 == 0 for a in A]):",
"+ A = [a // 2 for a in A]"
] | false | 0.034851 | 0.035855 | 0.971988 | [
"s549273781",
"s389789508"
] |
u626299761 | p02707 | python | s627872685 | s093210483 | 163 | 145 | 25,016 | 25,148 | Accepted | Accepted | 11.04 | num_sub = int(eval(input()))
sub_boss = input().split()
num_boss = [0]*(num_sub)
for i in sub_boss:
i = int(i)
num_boss[i-1] = num_boss[i-1] + 1
for i in num_boss:
print(i) | num_sub = int(eval(input()))
sub_boss = input().split()
num_boss = [0]*(num_sub)
for i in sub_boss:
num_boss[int(i)-1] += 1
for i in num_boss:
print(i) | 11 | 10 | 184 | 160 | num_sub = int(eval(input()))
sub_boss = input().split()
num_boss = [0] * (num_sub)
for i in sub_boss:
i = int(i)
num_boss[i - 1] = num_boss[i - 1] + 1
for i in num_boss:
print(i)
| num_sub = int(eval(input()))
sub_boss = input().split()
num_boss = [0] * (num_sub)
for i in sub_boss:
num_boss[int(i) - 1] += 1
for i in num_boss:
print(i)
| false | 9.090909 | [
"- i = int(i)",
"- num_boss[i - 1] = num_boss[i - 1] + 1",
"+ num_boss[int(i) - 1] += 1"
] | false | 0.040474 | 0.035621 | 1.136238 | [
"s627872685",
"s093210483"
] |
u562935282 | p03171 | python | s702395255 | s819308324 | 598 | 540 | 164,616 | 178,268 | Accepted | Accepted | 9.7 | n = int(eval(input()))
a = tuple(map(int, input().split()))
memo = tuple([None] * n for _ in range(n))
for i, aa in enumerate(a):
memo[i][i] = aa
for l in range(n - 1, -1, -1):
for r in range(l, n):
if memo[l][r] is None:
memo[l][r] = max(a[r] - memo[l][r - 1], a[l] - memo[l + 1]... | def solve():
n = int(eval(input()))
a = tuple(int(x) for x in input().split())
memo = tuple([None] * n for _ in range(n))
for i, aa in enumerate(a):
memo[i][i] = aa
for l in range(n - 1, -1, -1):
for r in range(l, n):
if memo[l][r] is None:
me... | 13 | 18 | 344 | 449 | n = int(eval(input()))
a = tuple(map(int, input().split()))
memo = tuple([None] * n for _ in range(n))
for i, aa in enumerate(a):
memo[i][i] = aa
for l in range(n - 1, -1, -1):
for r in range(l, n):
if memo[l][r] is None:
memo[l][r] = max(a[r] - memo[l][r - 1], a[l] - memo[l + 1][r])
print((... | def solve():
n = int(eval(input()))
a = tuple(int(x) for x in input().split())
memo = tuple([None] * n for _ in range(n))
for i, aa in enumerate(a):
memo[i][i] = aa
for l in range(n - 1, -1, -1):
for r in range(l, n):
if memo[l][r] is None:
memo[l][r] = ma... | false | 27.777778 | [
"-n = int(eval(input()))",
"-a = tuple(map(int, input().split()))",
"-memo = tuple([None] * n for _ in range(n))",
"-for i, aa in enumerate(a):",
"- memo[i][i] = aa",
"-for l in range(n - 1, -1, -1):",
"- for r in range(l, n):",
"- if memo[l][r] is None:",
"- memo[l][r] = max... | false | 0.044293 | 0.043754 | 1.012312 | [
"s702395255",
"s819308324"
] |
u597374218 | p03578 | python | s071797612 | s573291822 | 351 | 265 | 35,428 | 67,680 | Accepted | Accepted | 24.5 | N=int(eval(input()))
D=sorted(map(int,input().split()))[::-1]
M=int(eval(input()))
T=sorted(map(int,input().split()))
for t in T:
d=0
while D and d!=t:
d=D.pop()
if d!=t:
print("NO")
exit()
print("YES") | from collections import Counter
N=int(eval(input()))
D=Counter(list(map(int,input().split())))
M=int(eval(input()))
T=Counter(list(map(int,input().split())))
print(("YES" if all(D[key]>=value for key,value in list(T.items())) else "NO")) | 12 | 6 | 237 | 210 | N = int(eval(input()))
D = sorted(map(int, input().split()))[::-1]
M = int(eval(input()))
T = sorted(map(int, input().split()))
for t in T:
d = 0
while D and d != t:
d = D.pop()
if d != t:
print("NO")
exit()
print("YES")
| from collections import Counter
N = int(eval(input()))
D = Counter(list(map(int, input().split())))
M = int(eval(input()))
T = Counter(list(map(int, input().split())))
print(("YES" if all(D[key] >= value for key, value in list(T.items())) else "NO"))
| false | 50 | [
"+from collections import Counter",
"+",
"-D = sorted(map(int, input().split()))[::-1]",
"+D = Counter(list(map(int, input().split())))",
"-T = sorted(map(int, input().split()))",
"-for t in T:",
"- d = 0",
"- while D and d != t:",
"- d = D.pop()",
"- if d != t:",
"- print... | false | 0.089692 | 0.046821 | 1.915654 | [
"s071797612",
"s573291822"
] |
u102461423 | p03310 | python | s236898658 | s715831174 | 865 | 247 | 27,340 | 40,592 | Accepted | Accepted | 71.45 | N = int(eval(input()))
A = [0]*N
S = 0
for i,a in enumerate(input().split()):
S += int(a)
A[i] = S
answer = S
# index は最後に回収する番号で管理
B = 0
D = 2
for C in range(1,N-2):
D = max(D,C+1)
SB = A[B]
SC = A[C] - A[B]
SD = A[D] - A[C]
SE = S - A[D]
left_score = abs(SB - SC)
# BCの境界の調整
... | import numpy as np
N = int(eval(input()))
A = np.zeros(N+2, dtype=np.int64)
A[1:-1] = input().split()
np.cumsum(A, out = A)
total = A[-1]
A[-1] = 10 ** 18
left = np.searchsorted(A, A/2)
P1 = A[left-1]
P2 = A[left]
Q1,Q2 = A-P1, A-P2
np.maximum(P1,Q2,out = P1)
np.minimum(P2,Q1,out = P2)
P,Q = P1,P2
... | 46 | 31 | 831 | 627 | N = int(eval(input()))
A = [0] * N
S = 0
for i, a in enumerate(input().split()):
S += int(a)
A[i] = S
answer = S
# index は最後に回収する番号で管理
B = 0
D = 2
for C in range(1, N - 2):
D = max(D, C + 1)
SB = A[B]
SC = A[C] - A[B]
SD = A[D] - A[C]
SE = S - A[D]
left_score = abs(SB - SC)
# BCの境界の調... | import numpy as np
N = int(eval(input()))
A = np.zeros(N + 2, dtype=np.int64)
A[1:-1] = input().split()
np.cumsum(A, out=A)
total = A[-1]
A[-1] = 10**18
left = np.searchsorted(A, A / 2)
P1 = A[left - 1]
P2 = A[left]
Q1, Q2 = A - P1, A - P2
np.maximum(P1, Q2, out=P1)
np.minimum(P2, Q1, out=P2)
P, Q = P1, P2
right = np.... | false | 32.608696 | [
"+import numpy as np",
"+",
"-A = [0] * N",
"-S = 0",
"-for i, a in enumerate(input().split()):",
"- S += int(a)",
"- A[i] = S",
"-answer = S",
"-# index は最後に回収する番号で管理",
"-B = 0",
"-D = 2",
"-for C in range(1, N - 2):",
"- D = max(D, C + 1)",
"- SB = A[B]",
"- SC = A[C] - ... | false | 0.032907 | 0.644699 | 0.051043 | [
"s236898658",
"s715831174"
] |
u970197315 | p03524 | python | s461577742 | s219639729 | 38 | 25 | 3,572 | 3,444 | Accepted | Accepted | 34.21 | # B - Palindrome-phobia
from collections import defaultdict
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
s=si()
d=defaultdict(int)
for ss in s:
d[ss]+=1
n=len(s)
t=set(s)
m=len(t)
if n==1:
pri... | s=eval(input())
from collections import Counter
c=Counter(s)
a_cnt=c["a"]
b_cnt=c["b"]
c_cnt=c["c"]
if abs(a_cnt-b_cnt)<=1 and abs(b_cnt-c_cnt)<=1 and abs(c_cnt-a_cnt)<=1:
print("YES")
else:
print("NO") | 49 | 10 | 1,041 | 209 | # B - Palindrome-phobia
from collections import defaultdict
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
s = si()
d = defaultdict(int)
for ss in s:
d[ss] += 1
n = len(s)
t = set(s)
m = len(t)
if n == 1:
prin... | s = eval(input())
from collections import Counter
c = Counter(s)
a_cnt = c["a"]
b_cnt = c["b"]
c_cnt = c["c"]
if abs(a_cnt - b_cnt) <= 1 and abs(b_cnt - c_cnt) <= 1 and abs(c_cnt - a_cnt) <= 1:
print("YES")
else:
print("NO")
| false | 79.591837 | [
"-# B - Palindrome-phobia",
"-from collections import defaultdict",
"+s = eval(input())",
"+from collections import Counter",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(int, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-s = si(... | false | 0.040074 | 0.033996 | 1.178781 | [
"s461577742",
"s219639729"
] |
u576432509 | p03240 | python | s109323183 | s386652728 | 40 | 36 | 3,064 | 3,064 | Accepted | Accepted | 10 | def abs(x1,x2):
if x1>x2:
return x1-x2
else:
return x2-x1
n=int(eval(input()))
x=[]
y=[]
h=[]
for i in range(n):
xi,yi,hi=list(map(int,input().split()))
x.append(xi)
y.append(yi)
h.append(hi)
hmax=h[0]
xhmax=x[0]
yhmax=y[0]
ihmax=0
for i in range(n):... | def abs(x1,x2):
if x1>x2:
return x1-x2
else:
return x2-x1
n=int(eval(input()))
x=[]
y=[]
h=[]
for i in range(n):
xi,yi,hi=list(map(int,input().split()))
x.append(xi)
y.append(yi)
h.append(hi)
hmax=h[0]
xhmax=x[0]
yhmax=y[0]
ihmax=0
for i in range(n):... | 39 | 42 | 718 | 774 | def abs(x1, x2):
if x1 > x2:
return x1 - x2
else:
return x2 - x1
n = int(eval(input()))
x = []
y = []
h = []
for i in range(n):
xi, yi, hi = list(map(int, input().split()))
x.append(xi)
y.append(yi)
h.append(hi)
hmax = h[0]
xhmax = x[0]
yhmax = y[0]
ihmax = 0
for i in range(n):... | def abs(x1, x2):
if x1 > x2:
return x1 - x2
else:
return x2 - x1
n = int(eval(input()))
x = []
y = []
h = []
for i in range(n):
xi, yi, hi = list(map(int, input().split()))
x.append(xi)
y.append(yi)
h.append(hi)
hmax = h[0]
xhmax = x[0]
yhmax = y[0]
ihmax = 0
for i in range(n):... | false | 7.142857 | [
"+ break",
"+ if yesno == \"yes\":",
"+ break"
] | false | 0.114457 | 0.087494 | 1.308167 | [
"s109323183",
"s386652728"
] |
u983327168 | p02712 | python | s211935465 | s219676992 | 197 | 108 | 9,160 | 34,520 | Accepted | Accepted | 45.18 | n=int(eval(input()))
ans=0
for i in range(1,n+1):
if i % 15 == 0:
pass
elif i % 3 == 0:
pass
elif i % 5 == 0:
pass
else:
ans=ans+i
print(ans)
| import numpy as np
n=int(eval(input()))
a=np.arange(n+1,dtype=np.int64)
a[::3]=0
a[::5]=0
print((a.sum()))
| 13 | 6 | 197 | 104 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 15 == 0:
pass
elif i % 3 == 0:
pass
elif i % 5 == 0:
pass
else:
ans = ans + i
print(ans)
| import numpy as np
n = int(eval(input()))
a = np.arange(n + 1, dtype=np.int64)
a[::3] = 0
a[::5] = 0
print((a.sum()))
| false | 53.846154 | [
"+import numpy as np",
"+",
"-ans = 0",
"-for i in range(1, n + 1):",
"- if i % 15 == 0:",
"- pass",
"- elif i % 3 == 0:",
"- pass",
"- elif i % 5 == 0:",
"- pass",
"- else:",
"- ans = ans + i",
"-print(ans)",
"+a = np.arange(n + 1, dtype=np.int64)",... | false | 0.007067 | 0.483828 | 0.014607 | [
"s211935465",
"s219676992"
] |
u189487046 | p03073 | python | s012764538 | s463339310 | 70 | 18 | 3,956 | 3,188 | Accepted | Accepted | 74.29 | S = list(eval(input()))
ans1 = 0
ans2 = 0
tmp = S[0]
for i in range(1, len(S)):
if tmp == S[i]:
ans1 += 1
tmp = "0" if tmp == "1" else "1"
else:
tmp = S[i]
tmp = S[-1]
for i in reversed(list(range(0, len(S)-1))):
if tmp == S[i]:
ans2 += 1
tmp = "0"... | s = eval(input())
odd = s[0::2]
even = s[1::2]
odd0 = odd.count("0")
odd1 = odd.count("1")
even0 = even.count("0")
even1 = even.count("1")
print((min((odd0 + even1), (odd1 + even0))))
| 22 | 10 | 389 | 187 | S = list(eval(input()))
ans1 = 0
ans2 = 0
tmp = S[0]
for i in range(1, len(S)):
if tmp == S[i]:
ans1 += 1
tmp = "0" if tmp == "1" else "1"
else:
tmp = S[i]
tmp = S[-1]
for i in reversed(list(range(0, len(S) - 1))):
if tmp == S[i]:
ans2 += 1
tmp = "0" if tmp == "1" els... | s = eval(input())
odd = s[0::2]
even = s[1::2]
odd0 = odd.count("0")
odd1 = odd.count("1")
even0 = even.count("0")
even1 = even.count("1")
print((min((odd0 + even1), (odd1 + even0))))
| false | 54.545455 | [
"-S = list(eval(input()))",
"-ans1 = 0",
"-ans2 = 0",
"-tmp = S[0]",
"-for i in range(1, len(S)):",
"- if tmp == S[i]:",
"- ans1 += 1",
"- tmp = \"0\" if tmp == \"1\" else \"1\"",
"- else:",
"- tmp = S[i]",
"-tmp = S[-1]",
"-for i in reversed(list(range(0, len(S) - 1... | false | 0.032509 | 0.031539 | 1.030731 | [
"s012764538",
"s463339310"
] |
u490553751 | p02773 | python | s021746632 | s079234304 | 978 | 738 | 90,704 | 35,560 | Accepted | Accepted | 24.54 | N = int(eval(input()))
S = ['0'] * N
for i in range(N):
S[i] = eval(input())
import collections
c = collections.Counter(S)
li = list(c.values())
ca = list(c.keys())
li.sort()
max = li[-1]
from collections import deque
lia = deque()
for i in ca:
if c[i] == max:
lia.append(i)
liaa = list(li... | #template
def inputlist(): return [int(k) for k in input().split()]
#template
N = int(eval(input()))
s = [0]*N
for i in range(N):
s[i] = eval(input())
from collections import Counter
c = Counter(s)
li = []
m = max(list(c.values()))
for i in list(c.keys()):
if c[i] == m:
li.append(i)
li.sor... | 20 | 17 | 371 | 355 | N = int(eval(input()))
S = ["0"] * N
for i in range(N):
S[i] = eval(input())
import collections
c = collections.Counter(S)
li = list(c.values())
ca = list(c.keys())
li.sort()
max = li[-1]
from collections import deque
lia = deque()
for i in ca:
if c[i] == max:
lia.append(i)
liaa = list(lia)
liaa.sort(... | # template
def inputlist():
return [int(k) for k in input().split()]
# template
N = int(eval(input()))
s = [0] * N
for i in range(N):
s[i] = eval(input())
from collections import Counter
c = Counter(s)
li = []
m = max(list(c.values()))
for i in list(c.keys()):
if c[i] == m:
li.append(i)
li.sort()... | false | 15 | [
"+# template",
"+def inputlist():",
"+ return [int(k) for k in input().split()]",
"+",
"+",
"+# template",
"-S = [\"0\"] * N",
"+s = [0] * N",
"- S[i] = eval(input())",
"-import collections",
"+ s[i] = eval(input())",
"+from collections import Counter",
"-c = collections.Counter(S)"... | false | 0.044448 | 0.0441 | 1.007894 | [
"s021746632",
"s079234304"
] |
u518042385 | p03212 | python | s834393021 | s361486326 | 74 | 67 | 7,012 | 3,060 | Accepted | Accepted | 9.46 | from collections import deque
n=int(eval(input()))
l=["3","5","7"]
q=deque(["3","5","7"])
l1=["3","5","7"]
count=0
while q:
a=q.popleft()
for i in l:
if int(i+a)<=n:
q.append(i+a)
l1.append(i+a)
for i in l1:
if ("3" in i) and ("5" in i) and ("7" in i):
count+=1
print(count) | num=int(eval(input()))
def dfs(n):
if n>num:
return 0
else:
w=str(n)
if w=="0":
w=""
if "3" in w and "7" in w and "5" in w:
ret=1
else:
ret=0
for i in "357":
ret+=dfs(int(i+w))
return ret
print((dfs(0))) | 16 | 16 | 309 | 269 | from collections import deque
n = int(eval(input()))
l = ["3", "5", "7"]
q = deque(["3", "5", "7"])
l1 = ["3", "5", "7"]
count = 0
while q:
a = q.popleft()
for i in l:
if int(i + a) <= n:
q.append(i + a)
l1.append(i + a)
for i in l1:
if ("3" in i) and ("5" in i) and ("7" in ... | num = int(eval(input()))
def dfs(n):
if n > num:
return 0
else:
w = str(n)
if w == "0":
w = ""
if "3" in w and "7" in w and "5" in w:
ret = 1
else:
ret = 0
for i in "357":
ret += dfs(int(i + w))
return ret
... | false | 0 | [
"-from collections import deque",
"+num = int(eval(input()))",
"-n = int(eval(input()))",
"-l = [\"3\", \"5\", \"7\"]",
"-q = deque([\"3\", \"5\", \"7\"])",
"-l1 = [\"3\", \"5\", \"7\"]",
"-count = 0",
"-while q:",
"- a = q.popleft()",
"- for i in l:",
"- if int(i + a) <= n:",
"- ... | false | 0.052899 | 0.050513 | 1.04723 | [
"s834393021",
"s361486326"
] |
u219197917 | p02662 | python | s822590101 | s757756078 | 330 | 162 | 132,120 | 132,184 | Accepted | Accepted | 50.91 | def main():
n, s = list(map(int, input().split()))
a = sorted([int(i) for i in input().split()])
mod = 998244353
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
ai = a[i]
for j in range(s + 1):
if j < ai:
dp[i + 1][... | def main():
n, s = list(map(int, input().split()))
a = [int(i) for i in input().split()]
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
ai = a[i]
for j in range(s + 1):
if j < ai:
dp[i + 1][j] = dp[i][j] * 2 % 998244353... | 17 | 16 | 494 | 471 | def main():
n, s = list(map(int, input().split()))
a = sorted([int(i) for i in input().split()])
mod = 998244353
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
ai = a[i]
for j in range(s + 1):
if j < ai:
dp[i + 1][j] = dp[i]... | def main():
n, s = list(map(int, input().split()))
a = [int(i) for i in input().split()]
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
ai = a[i]
for j in range(s + 1):
if j < ai:
dp[i + 1][j] = dp[i][j] * 2 % 998244353
... | false | 5.882353 | [
"- a = sorted([int(i) for i in input().split()])",
"- mod = 998244353",
"+ a = [int(i) for i in input().split()]",
"- dp[i + 1][j] = dp[i][j] * 2 % mod",
"+ dp[i + 1][j] = dp[i][j] * 2 % 998244353",
"- dp[i + 1][j] = (dp[i][j] * 2 % mod + dp[i][j - ai]... | false | 0.056371 | 0.077439 | 0.727939 | [
"s822590101",
"s757756078"
] |
u620084012 | p02792 | python | s420551779 | s351088394 | 200 | 166 | 40,300 | 9,156 | Accepted | Accepted | 17 | N = int(eval(input()))
d = len(str(N))
s = [0 for k in range(100)]
for k in range(1,N+1):
l = len(str(k))
s[10*(k//(10**(l-1)))+k%10] += 1
ans = 0
for k in range(1,10):
ans += s[k]**2
for x in range(1,10):
for y in range(1,10):
ans += s[x*10+y]*s[y*10+x]
print(ans)
| N = int(eval(input()))
t = [0]*(100)
ans = 0
for k in range(1,N+1):
if k%10 != 0:
t[10*int(str(k)[0])+int(str(k)[-1])] += 1
for k in range(11,100):
if k%10 != 0:
ans += t[k]*t[10*(k%10)+k//10]
print(ans)
| 17 | 11 | 304 | 233 | N = int(eval(input()))
d = len(str(N))
s = [0 for k in range(100)]
for k in range(1, N + 1):
l = len(str(k))
s[10 * (k // (10 ** (l - 1))) + k % 10] += 1
ans = 0
for k in range(1, 10):
ans += s[k] ** 2
for x in range(1, 10):
for y in range(1, 10):
ans += s[x * 10 + y] * s[y * 10 + x]
print(ans)
| N = int(eval(input()))
t = [0] * (100)
ans = 0
for k in range(1, N + 1):
if k % 10 != 0:
t[10 * int(str(k)[0]) + int(str(k)[-1])] += 1
for k in range(11, 100):
if k % 10 != 0:
ans += t[k] * t[10 * (k % 10) + k // 10]
print(ans)
| false | 35.294118 | [
"-d = len(str(N))",
"-s = [0 for k in range(100)]",
"+t = [0] * (100)",
"+ans = 0",
"- l = len(str(k))",
"- s[10 * (k // (10 ** (l - 1))) + k % 10] += 1",
"-ans = 0",
"-for k in range(1, 10):",
"- ans += s[k] ** 2",
"-for x in range(1, 10):",
"- for y in range(1, 10):",
"- a... | false | 0.071708 | 0.053036 | 1.352067 | [
"s420551779",
"s351088394"
] |
u094191970 | p02584 | python | s053935861 | s125985563 | 36 | 30 | 9,152 | 9,104 | Accepted | Accepted | 16.67 | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
x,k,d=nii()
dist=abs(x)
num=dist//d
if num>k:
print((abs(dist-d*k)))
exit()
else:
k-=num
dist1=dist-d*num
if k>=1:
dist2=abs(dist1-d)
if dist2<=dist1:
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
x,k,d=nii()
dist=abs(x)
num=dist//d
if num>k:
print((abs(dist-d*k)))
exit()
else:
k-=num
dist-=d*num
if k%2==0:
print(dist)
else:
print((min(abs(dist+d),abs(dis... | 27 | 20 | 418 | 317 | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
x, k, d = nii()
dist = abs(x)
num = dist // d
if num > k:
print((abs(dist - d * k)))
exit()
else:
k -= num
dist1 = dist - d * num
if k >= 1:
dist2 = abs(dist1... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
x, k, d = nii()
dist = abs(x)
num = dist // d
if num > k:
print((abs(dist - d * k)))
exit()
else:
k -= num
dist -= d * num
if k % 2 == 0:
print(dist)
else:
print(... | false | 25.925926 | [
"- dist1 = dist - d * num",
"- if k >= 1:",
"- dist2 = abs(dist1 - d)",
"- if dist2 <= dist1:",
"- k -= 1",
"- dist1 = dist2",
"+ dist -= d * num",
"- print(dist1)",
"+ print(dist)",
"- print((min(abs(dist1 + d), abs(dist1 - d))))",
"+ pri... | false | 0.037011 | 0.035873 | 1.031725 | [
"s053935861",
"s125985563"
] |
u285443936 | p04015 | python | s583725760 | s577825847 | 395 | 308 | 93,276 | 92,892 | Accepted | Accepted | 22.03 | N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
table = [[[0]*(N*A+1) for i in range(N+1)] for j in range(N+1)]
table[0][0][0] = 1
for j in range(1,N+1):
for k in range(N+1):
for s in range(N*A+1):
c = x[j-1]
if s-c<0:
table[j][k][s] = table[j-1][k][s]... | N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
table = [[[0]*(N*A+1) for i in range(N+1)] for j in range(N+1)]
table[0][0][0] = 1
for j in range(1,N+1):
for k in range(j+1):
for s in range(N*A+1):
c = x[j-1]
if s-c<0:
table[j][k][s] = table[j-1][k][s]... | 19 | 19 | 489 | 489 | N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
table = [[[0] * (N * A + 1) for i in range(N + 1)] for j in range(N + 1)]
table[0][0][0] = 1
for j in range(1, N + 1):
for k in range(N + 1):
for s in range(N * A + 1):
c = x[j - 1]
if s - c < 0:
... | N, A = list(map(int, input().split()))
x = [int(i) for i in input().split()]
table = [[[0] * (N * A + 1) for i in range(N + 1)] for j in range(N + 1)]
table[0][0][0] = 1
for j in range(1, N + 1):
for k in range(j + 1):
for s in range(N * A + 1):
c = x[j - 1]
if s - c < 0:
... | false | 0 | [
"- for k in range(N + 1):",
"+ for k in range(j + 1):"
] | false | 0.201158 | 0.126576 | 1.589225 | [
"s583725760",
"s577825847"
] |
u342869120 | p02684 | python | s394310700 | s707046832 | 496 | 422 | 218,136 | 217,944 | Accepted | Accepted | 14.92 | N, K = list(map(int, input().split()))
*A, = list(map(int, input().split()))
A = [a-1 for a in A]
# Douling(ダブリング)
i = 1
to = [[a for a in A]]
while pow(2, i) < K:
t = [to[i-1][to[i-1][j]] for j in range(N)]
to.append(t)
i += 1
i -= 1
ans = [i for i in range(N)]
while i >= 0:
if K & (1 ... | N, K = list(map(int, input().split()))
*A, = list(map(int, input().split()))
A = [a-1 for a in A]
# Douling(ダブリング)
i = 1
to = [[a for a in A]]
while pow(2, i) < K:
t = [to[i-1][to[i-1][j]] for j in range(N)]
to.append(t)
i += 1
i -= 1
ans = 0
while i >= 0:
if K & (1 << i) > 0:
... | 20 | 19 | 411 | 350 | N, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
A = [a - 1 for a in A]
# Douling(ダブリング)
i = 1
to = [[a for a in A]]
while pow(2, i) < K:
t = [to[i - 1][to[i - 1][j]] for j in range(N)]
to.append(t)
i += 1
i -= 1
ans = [i for i in range(N)]
while i >= 0:
if K & (1 << i) > 0... | N, K = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
A = [a - 1 for a in A]
# Douling(ダブリング)
i = 1
to = [[a for a in A]]
while pow(2, i) < K:
t = [to[i - 1][to[i - 1][j]] for j in range(N)]
to.append(t)
i += 1
i -= 1
ans = 0
while i >= 0:
if K & (1 << i) > 0:
ans = to[i... | false | 5 | [
"-ans = [i for i in range(N)]",
"+ans = 0",
"- for j in range(N):",
"- ans[j] = to[i][ans[j]]",
"+ ans = to[i][ans]",
"-print((ans[0] + 1))",
"+print((ans + 1))"
] | false | 0.043993 | 0.042249 | 1.04129 | [
"s394310700",
"s707046832"
] |
u270681687 | p03363 | python | s227808245 | s616256449 | 244 | 203 | 26,136 | 40,960 | Accepted | Accepted | 16.8 | n = int(eval(input()))
a = list(map(int, input().split()))
cum = [0] * (n+1)
for i in range(n):
cum[i+1] = cum[i] + a[i]
cum.sort()
num = cum[0]
count = 1
ans = 0
for i in range(n):
if cum[i+1] == num:
count += 1
else:
ans += count * (count - 1) // 2
num = cum[i+1]
... | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
cum = [0] * (n+1)
for i, ai in enumerate(a):
cum[i+1] += cum[i] + ai
cnt = Counter(cum)
ans = 0
for num in list(cnt.values()):
ans += num * (num-1) // 2
print(ans) | 25 | 14 | 405 | 266 | n = int(eval(input()))
a = list(map(int, input().split()))
cum = [0] * (n + 1)
for i in range(n):
cum[i + 1] = cum[i] + a[i]
cum.sort()
num = cum[0]
count = 1
ans = 0
for i in range(n):
if cum[i + 1] == num:
count += 1
else:
ans += count * (count - 1) // 2
num = cum[i + 1]
co... | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
cum = [0] * (n + 1)
for i, ai in enumerate(a):
cum[i + 1] += cum[i] + ai
cnt = Counter(cum)
ans = 0
for num in list(cnt.values()):
ans += num * (num - 1) // 2
print(ans)
| false | 44 | [
"+from collections import Counter",
"+",
"-for i in range(n):",
"- cum[i + 1] = cum[i] + a[i]",
"-cum.sort()",
"-num = cum[0]",
"-count = 1",
"+for i, ai in enumerate(a):",
"+ cum[i + 1] += cum[i] + ai",
"+cnt = Counter(cum)",
"-for i in range(n):",
"- if cum[i + 1] == num:",
"- ... | false | 0.109428 | 0.057903 | 1.889861 | [
"s227808245",
"s616256449"
] |
u887207211 | p03329 | python | s405697234 | s556579389 | 364 | 19 | 3,060 | 3,064 | Accepted | Accepted | 94.78 | N = int(eval(input()))
ans = 1e9
for i in range(N+1):
cnt = 0
tmp = i
while tmp > 0:
cnt += tmp%6
tmp //= 6
tmp = N-i
while tmp > 0:
cnt += tmp%9
tmp //= 9
ans = min(ans, cnt)
print(ans) | from itertools import count, takewhile
N = int(eval(input()))
def dfs(n, d={}):
if(n < 6):
return n
if(n in d):
return d[n]
mn = max(takewhile(lambda x: x<=n, (9**i for i in count())))
ms = max(takewhile(lambda x: x<=n, (6**i for i in count())))
d[n] = min(dfs(n-mn), dfs(n-ms))+1
return ... | 15 | 14 | 223 | 335 | N = int(eval(input()))
ans = 1e9
for i in range(N + 1):
cnt = 0
tmp = i
while tmp > 0:
cnt += tmp % 6
tmp //= 6
tmp = N - i
while tmp > 0:
cnt += tmp % 9
tmp //= 9
ans = min(ans, cnt)
print(ans)
| from itertools import count, takewhile
N = int(eval(input()))
def dfs(n, d={}):
if n < 6:
return n
if n in d:
return d[n]
mn = max(takewhile(lambda x: x <= n, (9**i for i in count())))
ms = max(takewhile(lambda x: x <= n, (6**i for i in count())))
d[n] = min(dfs(n - mn), dfs(n - m... | false | 6.666667 | [
"+from itertools import count, takewhile",
"+",
"-ans = 1e9",
"-for i in range(N + 1):",
"- cnt = 0",
"- tmp = i",
"- while tmp > 0:",
"- cnt += tmp % 6",
"- tmp //= 6",
"- tmp = N - i",
"- while tmp > 0:",
"- cnt += tmp % 9",
"- tmp //= 9",
"- ... | false | 0.276088 | 0.034685 | 7.959953 | [
"s405697234",
"s556579389"
] |
u134302690 | p03485 | python | s542833838 | s381022923 | 162 | 19 | 38,256 | 3,060 | Accepted | Accepted | 88.27 | a,b = list(map(int,input().split()))
ave = (a+b)/2
if ave%1 != 0:
print((int(ave+1)))
else:
print((int(ave))) | import math
a,b = list(map(int,input().split()))
print((math.ceil((a+b)/2))) | 6 | 3 | 112 | 70 | a, b = list(map(int, input().split()))
ave = (a + b) / 2
if ave % 1 != 0:
print((int(ave + 1)))
else:
print((int(ave)))
| import math
a, b = list(map(int, input().split()))
print((math.ceil((a + b) / 2)))
| false | 50 | [
"+import math",
"+",
"-ave = (a + b) / 2",
"-if ave % 1 != 0:",
"- print((int(ave + 1)))",
"-else:",
"- print((int(ave)))",
"+print((math.ceil((a + b) / 2)))"
] | false | 0.075838 | 0.052689 | 1.439365 | [
"s542833838",
"s381022923"
] |
u994988729 | p03273 | python | s773575419 | s293070605 | 340 | 158 | 21,980 | 14,460 | Accepted | Accepted | 53.53 | import numpy as np
h,w=list(map(int,input().split()))
grid=np.empty((h,w),dtype="<U")
for i in range(h):
s=list(eval(input()))
grid[i]=s
del_row=[]
del_col=[]
for i in range(h):
if all(grid[i]=="."):
del_row.append(i)
for j in range(w):
if all(grid[:,j]=="."):
del_col.appe... | import numpy as np
H, W = list(map(int, input().split()))
grid = np.array([list(eval(input())) for _ in range(H)], dtype="U1")
row = []
col = []
for i in range(H):
if (grid[i] != ".").any():
row.append(i)
trans_grid = np.transpose(grid)
for i in range(W):
if (trans_grid[i] != ".").any():
... | 21 | 19 | 432 | 392 | import numpy as np
h, w = list(map(int, input().split()))
grid = np.empty((h, w), dtype="<U")
for i in range(h):
s = list(eval(input()))
grid[i] = s
del_row = []
del_col = []
for i in range(h):
if all(grid[i] == "."):
del_row.append(i)
for j in range(w):
if all(grid[:, j] == "."):
del_c... | import numpy as np
H, W = list(map(int, input().split()))
grid = np.array([list(eval(input())) for _ in range(H)], dtype="U1")
row = []
col = []
for i in range(H):
if (grid[i] != ".").any():
row.append(i)
trans_grid = np.transpose(grid)
for i in range(W):
if (trans_grid[i] != ".").any():
col.ap... | false | 9.52381 | [
"-h, w = list(map(int, input().split()))",
"-grid = np.empty((h, w), dtype=\"<U\")",
"-for i in range(h):",
"- s = list(eval(input()))",
"- grid[i] = s",
"-del_row = []",
"-del_col = []",
"-for i in range(h):",
"- if all(grid[i] == \".\"):",
"- del_row.append(i)",
"-for j in rang... | false | 0.362705 | 0.245927 | 1.474849 | [
"s773575419",
"s293070605"
] |
u941407962 | p02991 | python | s510701176 | s307807814 | 916 | 733 | 102,100 | 101,476 | Accepted | Accepted | 19.98 | N, M = [int(x) for x in input().strip().split(" ")]
from collections import deque
vs = set()
def bfs(v,d,t,N):
queue=deque([v])
dist = [0] * (N+1)
while True:
if len(queue) == 0:
break
v = queue.popleft()
for u in d[v]:
if u in vs:
... | N,M=list(map(int,input().split()))
edge=[list(map(int,input().split())) for i in range(M)]
inf=10**20
c=[[] for i in range(N*3+1)]
for i,j in edge:
c[i].append(N+j)
c[N+i].append(N+N+j)
c[N+N+i].append(j)
S,T=list(map(int, input().split()))
from collections import deque
d=[inf]*(N*3+1)
d[S]=0
q=... | 29 | 24 | 750 | 525 | N, M = [int(x) for x in input().strip().split(" ")]
from collections import deque
vs = set()
def bfs(v, d, t, N):
queue = deque([v])
dist = [0] * (N + 1)
while True:
if len(queue) == 0:
break
v = queue.popleft()
for u in d[v]:
if u in vs:
co... | N, M = list(map(int, input().split()))
edge = [list(map(int, input().split())) for i in range(M)]
inf = 10**20
c = [[] for i in range(N * 3 + 1)]
for i, j in edge:
c[i].append(N + j)
c[N + i].append(N + N + j)
c[N + N + i].append(j)
S, T = list(map(int, input().split()))
from collections import deque
d = [... | false | 17.241379 | [
"-N, M = [int(x) for x in input().strip().split(\" \")]",
"+N, M = list(map(int, input().split()))",
"+edge = [list(map(int, input().split())) for i in range(M)]",
"+inf = 10**20",
"+c = [[] for i in range(N * 3 + 1)]",
"+for i, j in edge:",
"+ c[i].append(N + j)",
"+ c[N + i].append(N + N + j)"... | false | 0.044391 | 0.061835 | 0.717898 | [
"s510701176",
"s307807814"
] |
u147077748 | p03168 | python | s210600893 | s320794594 | 1,870 | 1,674 | 3,316 | 3,444 | Accepted | Accepted | 10.48 | # coding: utf-8
import sys
input = sys.stdin.readline
def f2(n, p):
dp = [ 0.0 ] * (n + 1)
dp[0] = 1.0
# pprint.pprint(dp, width = 50)
for i in range(n):
dp_ = list(dp)
pi_ = 1 - p[i]
for j in range(n + 1):
dp[j] = dp_[j - 1] * p[i] + dp_[j] * pi_
... | import sys
# input処理を高速化する
input = sys.stdin.readline
def main():
N = int(eval(input()))
p = list(map(float, input().split()))
# dp[j] := 表が j 枚となる確率
# dp[j] = dp[j-1]*p[i] + dp[j]*(1-p[i]) ただしdp[j]が重複していることに注意
dp = [0.0] * (N+1)
# 初期条件
dp[0]= 1.0
for i in range(N):
... | 19 | 25 | 505 | 496 | # coding: utf-8
import sys
input = sys.stdin.readline
def f2(n, p):
dp = [0.0] * (n + 1)
dp[0] = 1.0
# pprint.pprint(dp, width = 50)
for i in range(n):
dp_ = list(dp)
pi_ = 1 - p[i]
for j in range(n + 1):
dp[j] = dp_[j - 1] * p[i] + dp_[j] * pi_
# pprint.pp... | import sys
# input処理を高速化する
input = sys.stdin.readline
def main():
N = int(eval(input()))
p = list(map(float, input().split()))
# dp[j] := 表が j 枚となる確率
# dp[j] = dp[j-1]*p[i] + dp[j]*(1-p[i]) ただしdp[j]が重複していることに注意
dp = [0.0] * (N + 1)
# 初期条件
dp[0] = 1.0
for i in range(N):
p_head ... | false | 24 | [
"-# coding: utf-8",
"+# input処理を高速化する",
"-def f2(n, p):",
"- dp = [0.0] * (n + 1)",
"+def main():",
"+ N = int(eval(input()))",
"+ p = list(map(float, input().split()))",
"+ # dp[j] := 表が j 枚となる確率",
"+ # dp[j] = dp[j-1]*p[i] + dp[j]*(1-p[i]) ただしdp[j]が重複していることに注意",
"+ dp = [0.0] *... | false | 0.041498 | 0.040565 | 1.023009 | [
"s210600893",
"s320794594"
] |
u562935282 | p03045 | python | s217764855 | s186053600 | 905 | 596 | 69,152 | 5,488 | Accepted | Accepted | 34.14 | class UnionFind:
def __init__(self, n):
self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed)
def find(self, x): # xを含む木における根の頂点番号を返す
if self.v[x] < 0: # (負)は根
return x
else: # 根の頂点番号
self.v[x] = self.find(self.v[x]) # uniteで... | class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
... | 42 | 44 | 1,248 | 1,038 | class UnionFind:
def __init__(self, n):
self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed)
def find(self, x): # xを含む木における根の頂点番号を返す
if self.v[x] < 0: # (負)は根
return x
else: # 根の頂点番号
self.v[x] = self.find(self.v[x]) # uniteでは, 旧根に属す... | class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(... | false | 4.545455 | [
"- self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed)",
"+ self.parent = [-1 for _ in range(n)]",
"+ # 正==子: 根の頂点番号 / 負==根: 連結頂点数",
"- def find(self, x): # xを含む木における根の頂点番号を返す",
"- if self.v[x] < 0: # (負)は根",
"+ def find(self, x):",
"+ ... | false | 0.106073 | 0.08775 | 1.208807 | [
"s217764855",
"s186053600"
] |
u232652798 | p02779 | python | s518778112 | s346703564 | 213 | 181 | 25,268 | 26,680 | Accepted | Accepted | 15.02 | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = sorted(A)
NO = False
for i in range(0,len(B)-1):
if B[i+1] - B[i] == 0:
NO = True
if NO == True:
print('NO')
else:
print('YES') | N = int(eval(input()))
A = list(map(int,input().split()))
S = sorted(A)
Check = False
for i in range(len(S)-1):
if S[i] == S[i+1]:
Check = True
break
if Check == True:
print('NO')
else:
print('YES')
| 11 | 13 | 216 | 237 | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = sorted(A)
NO = False
for i in range(0, len(B) - 1):
if B[i + 1] - B[i] == 0:
NO = True
if NO == True:
print("NO")
else:
print("YES")
| N = int(eval(input()))
A = list(map(int, input().split()))
S = sorted(A)
Check = False
for i in range(len(S) - 1):
if S[i] == S[i + 1]:
Check = True
break
if Check == True:
print("NO")
else:
print("YES")
| false | 15.384615 | [
"-A = [int(x) for x in input().split()]",
"-B = sorted(A)",
"-NO = False",
"-for i in range(0, len(B) - 1):",
"- if B[i + 1] - B[i] == 0:",
"- NO = True",
"-if NO == True:",
"+A = list(map(int, input().split()))",
"+S = sorted(A)",
"+Check = False",
"+for i in range(len(S) - 1):",
"+... | false | 0.036445 | 0.03623 | 1.005939 | [
"s518778112",
"s346703564"
] |
u892251744 | p03013 | python | s633000240 | s115134515 | 539 | 490 | 49,752 | 46,668 | Accepted | Accepted | 9.09 | N, M = list(map(int, input().split()))
mod = 10 **9 + 7
broken = [0] * M
for i in range(M):
broken[i] = int(eval(input()))
dp = [0] * (N+3)
dp[0] = 1
for i in range(M):
dp[broken[i]] = -1 * float('inf')
for i in range(N):
if dp[i] >= 0:
dp[i+1] = (dp[i+1] + dp[i]) % mod
dp[i+... | N, M = list(map(int, input().split()))
mod = 10 ** 9 + 7
dp = [0] * (N+3)
dp[0] = 1
for i in range(M):
dp[int(eval(input()))] = 0.5
for i in range(N):
if dp[i] % 1 == 0:
dp[i+1] = (dp[i+1] + dp[i]) % mod
dp[i+2] = (dp[i+2] + dp[i]) % mod
print((dp[N] % mod))
| 17 | 13 | 359 | 283 | N, M = list(map(int, input().split()))
mod = 10**9 + 7
broken = [0] * M
for i in range(M):
broken[i] = int(eval(input()))
dp = [0] * (N + 3)
dp[0] = 1
for i in range(M):
dp[broken[i]] = -1 * float("inf")
for i in range(N):
if dp[i] >= 0:
dp[i + 1] = (dp[i + 1] + dp[i]) % mod
dp[i + 2] = (dp[... | N, M = list(map(int, input().split()))
mod = 10**9 + 7
dp = [0] * (N + 3)
dp[0] = 1
for i in range(M):
dp[int(eval(input()))] = 0.5
for i in range(N):
if dp[i] % 1 == 0:
dp[i + 1] = (dp[i + 1] + dp[i]) % mod
dp[i + 2] = (dp[i + 2] + dp[i]) % mod
print((dp[N] % mod))
| false | 23.529412 | [
"-broken = [0] * M",
"-for i in range(M):",
"- broken[i] = int(eval(input()))",
"- dp[broken[i]] = -1 * float(\"inf\")",
"+ dp[int(eval(input()))] = 0.5",
"- if dp[i] >= 0:",
"+ if dp[i] % 1 == 0:"
] | false | 0.05411 | 0.03496 | 1.547747 | [
"s633000240",
"s115134515"
] |
u729133443 | p02573 | python | s220547242 | s465336002 | 1,675 | 67 | 299,680 | 9,832 | Accepted | Accepted | 96 | from networkx import*
print((max(list(map(len,connected_components(Graph([*list(map(str.split,open(0))),'!!'][1:]))))))) | import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
import os, zlib, base64
open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$|e)+isjN5PkPoj1*-9SuS1WrHVp+Bt^(JW@FVDWSfWd>pKQYutPVz80K>3oEbBB&`RqjCzX8$MfG)}S5fivncVF?Qgb!6qG_eERrx;jqU3{i!aAy5S*U?iRVvBK@x#3j`l<L?TIobSQvMqOZK<bz{J<O|$`y-rX6ONPcwt?OCve%1... | 2 | 6 | 107 | 862 | from networkx import *
print(
(
max(
list(
map(
len,
connected_components(
Graph([*list(map(str.split, open(0))), "!!"][1:])
),
)
)
)
)
)
| import sys
if sys.argv[-1] == "ONLINE_JUDGE":
import os, zlib, base64
open("solve.pyx", "wb").write(
zlib.decompress(
base64.b85decode(
"c$|e)+isjN5PkPoj1*-9SuS1WrHVp+Bt^(JW@FVDWSfWd>pKQYutPVz80K>3oEbBB&`RqjCzX8$MfG)}S5fivncVF?Qgb!6qG_eERrx;jqU3{i!aAy5S*U?iRVvBK@x#3j`l<L?TI... | false | 66.666667 | [
"-from networkx import *",
"+import sys",
"-print(",
"- (",
"- max(",
"- list(",
"- map(",
"- len,",
"- connected_components(",
"- Graph([*list(map(str.split, open(0))), \"!!\"][1:])",
"- ... | false | 0.12868 | 0.039587 | 3.250558 | [
"s220547242",
"s465336002"
] |
u021548497 | p02617 | python | s501549772 | s366877313 | 588 | 289 | 35,624 | 35,740 | Accepted | Accepted | 50.85 | n = int(eval(input()))
tree = [[] for _ in range(n)]
for i in range(n-1):
v, w = list(map(int, input().split()))
if v > w:
v, w = w, v
tree[w-1].append(v-1)
ans = 0
count = 0
for i in range(n):
count += i+1
for v in tree[i]:
count -= v+1
ans += count
print(ans) | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
tree = [[] for _ in range(n)]
for i in range(n-1):
v, w = list(map(int, input().split()))
if v > w:
v, w = w, v
tree[w-1].append(v-1)
ans = 0
count = 0
for i in range(n):
count += i+1
for v... | 17 | 24 | 292 | 419 | n = int(eval(input()))
tree = [[] for _ in range(n)]
for i in range(n - 1):
v, w = list(map(int, input().split()))
if v > w:
v, w = w, v
tree[w - 1].append(v - 1)
ans = 0
count = 0
for i in range(n):
count += i + 1
for v in tree[i]:
count -= v + 1
ans += count
print(ans)
| import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
tree = [[] for _ in range(n)]
for i in range(n - 1):
v, w = list(map(int, input().split()))
if v > w:
v, w = w, v
tree[w - 1].append(v - 1)
ans = 0
count = 0
for i in range(n):
... | false | 29.166667 | [
"-n = int(eval(input()))",
"-tree = [[] for _ in range(n)]",
"-for i in range(n - 1):",
"- v, w = list(map(int, input().split()))",
"- if v > w:",
"- v, w = w, v",
"- tree[w - 1].append(v - 1)",
"-ans = 0",
"-count = 0",
"-for i in range(n):",
"- count += i + 1",
"- for v... | false | 0.040968 | 0.043341 | 0.945237 | [
"s501549772",
"s366877313"
] |
u619819312 | p02712 | python | s371011466 | s719103194 | 154 | 25 | 9,076 | 9,056 | Accepted | Accepted | 83.77 | a=0
for i in range(int(eval(input()))+1):
if i%3!=0 and i%5!=0:
a+=i
print(a) | n=int(eval(input()))
a=[0,1,3,3,7,7,7,14,22,22,22,33,33,46,60]
b=[0,1,1,0,1,0,0,1,1,0,0,1,0,1,1]
print((60*(n//15)+120*(n//15)*(n//15-1)//2+sum(b[:n%15+1])*(15*(n//15))+a[n%15])) | 5 | 4 | 87 | 173 | a = 0
for i in range(int(eval(input())) + 1):
if i % 3 != 0 and i % 5 != 0:
a += i
print(a)
| n = int(eval(input()))
a = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 33, 46, 60]
b = [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1]
print(
(
60 * (n // 15)
+ 120 * (n // 15) * (n // 15 - 1) // 2
+ sum(b[: n % 15 + 1]) * (15 * (n // 15))
+ a[n % 15]
)
)
| false | 20 | [
"-a = 0",
"-for i in range(int(eval(input())) + 1):",
"- if i % 3 != 0 and i % 5 != 0:",
"- a += i",
"-print(a)",
"+n = int(eval(input()))",
"+a = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 33, 46, 60]",
"+b = [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1]",
"+print(",
"+ (",
"+ ... | false | 0.187119 | 0.038432 | 4.86889 | [
"s371011466",
"s719103194"
] |
u416011173 | p02571 | python | s767230953 | s117636772 | 67 | 49 | 8,920 | 9,084 | Accepted | Accepted | 26.87 | # -*- coding: utf-8 -*-
# モジュールのインポート
import sys
# 標準入力を取得
S = eval(input())
T = eval(input())
# 求解処理
ans = len(T)
for i in range(len(S) - len(T) + 1):
diff = 0
for j in range(len(T)):
if T[j] != S[i + j]:
diff += 1
ans = min(ans, diff)
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
S = eval(input())
T = eval(input())
return S, T
def main(S: str, T: str) -> None:
"""
メイン処理.
Args:\n
S (str): 文字列(1 <= |S| <= 1000)
T (st... | 19 | 42 | 296 | 688 | # -*- coding: utf-8 -*-
# モジュールのインポート
import sys
# 標準入力を取得
S = eval(input())
T = eval(input())
# 求解処理
ans = len(T)
for i in range(len(S) - len(T) + 1):
diff = 0
for j in range(len(T)):
if T[j] != S[i + j]:
diff += 1
ans = min(ans, diff)
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
S = eval(input())
T = eval(input())
return S, T
def main(S: str, T: str) -> None:
"""
メイン処理.
Args:\n
S (str): 文字列(1 <= |S| <= 1000)
T (str): 文字列(1 <= |T| <= |S|)
... | false | 54.761905 | [
"-# モジュールのインポート",
"-import sys",
"+def get_input() -> tuple:",
"+ \"\"\"",
"+ 標準入力を取得する.",
"+ Returns:\\n",
"+ tuple: 標準入力",
"+ \"\"\"",
"+ S = eval(input())",
"+ T = eval(input())",
"+ return S, T",
"-# 標準入力を取得",
"-S = eval(input())",
"-T = eval(input())",
"-... | false | 0.035773 | 0.036658 | 0.97585 | [
"s767230953",
"s117636772"
] |
u028973125 | p02573 | python | s539780843 | s707125225 | 453 | 275 | 127,132 | 88,584 | Accepted | Accepted | 39.29 | import sys
from collections import deque
input = sys.stdin.readline
N, M = list(map(int, input().split()))
relations = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
relations[a].append(b)
relations[b].append(a)
ans = 0
visited = set(... | import sys
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... | 33 | 67 | 708 | 1,538 | import sys
from collections import deque
input = sys.stdin.readline
N, M = list(map(int, input().split()))
relations = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
relations[a].append(b)
relations[b].append(a)
ans = 0
visited = set()
for i in range(... | import sys
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):
... | false | 50.746269 | [
"-from collections import deque",
"+",
"+",
"+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... | false | 0.039494 | 0.069935 | 0.56473 | [
"s539780843",
"s707125225"
] |
u045091221 | p03086 | python | s734274498 | s839195123 | 37 | 34 | 9,760 | 9,720 | Accepted | Accepted | 8.11 | import re
m = re.findall(r'[ATCG]+', eval(input()))
if m:
print((max([len(x) for x in m])))
else:
print('0')
| import re
m = re.findall(r'[ATCG]+', eval(input()))
print((max([len(x) for x in m]) if m else '0'))
| 7 | 4 | 116 | 96 | import re
m = re.findall(r"[ATCG]+", eval(input()))
if m:
print((max([len(x) for x in m])))
else:
print("0")
| import re
m = re.findall(r"[ATCG]+", eval(input()))
print((max([len(x) for x in m]) if m else "0"))
| false | 42.857143 | [
"-if m:",
"- print((max([len(x) for x in m])))",
"-else:",
"- print(\"0\")",
"+print((max([len(x) for x in m]) if m else \"0\"))"
] | false | 0.052344 | 0.052497 | 0.997088 | [
"s734274498",
"s839195123"
] |
u530383736 | p02602 | python | s548205213 | s044819193 | 163 | 126 | 31,828 | 31,476 | Accepted | Accepted | 22.7 | # -*- coding: utf-8 -*-
def main():
import sys
import math
N,K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
for i in range(len(A_list)):
A_list[i] = math.log10( A_list[i] )
point_K = 0
for i in range(K):... | # -*- coding: utf-8 -*-
import sys
def main():
N,K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
for i in range(K, len(A_list)):
if A_list[i] > A_list[i-K]:
print("Yes")
else:
print("No")
... | 34 | 19 | 638 | 362 | # -*- coding: utf-8 -*-
def main():
import sys
import math
N, K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
for i in range(len(A_list)):
A_list[i] = math.log10(A_list[i])
point_K = 0
for i in range(K):
point_K += A_lis... | # -*- coding: utf-8 -*-
import sys
def main():
N, K = list(map(int, sys.stdin.readline().split()))
A_list = list(map(int, sys.stdin.readline().split()))
for i in range(K, len(A_list)):
if A_list[i] > A_list[i - K]:
print("Yes")
else:
print("No")
if __name__ == "__... | false | 44.117647 | [
"+import sys",
"+",
"+",
"- import sys",
"- import math",
"-",
"- for i in range(len(A_list)):",
"- A_list[i] = math.log10(A_list[i])",
"- point_K = 0",
"- for i in range(K):",
"- point_K += A_list[i]",
"- prev = point_K",
"- current = prev - A_list[i -... | false | 0.044358 | 0.045867 | 0.967103 | [
"s548205213",
"s044819193"
] |
u163320134 | p02947 | python | s812786861 | s796849452 | 1,015 | 511 | 120,580 | 22,116 | Accepted | Accepted | 49.66 | n=int(eval(input()))
arr=[eval(input()) for _ in range(n)]
dic={}
check='abcdefghijklmnopqrstuvwxyz'
for s in arr:
count=[0]*26
for i in range(10):
for j in range(26):
if s[i]==check[j]:
count[j]+=1
break
count=tuple(count)
if count not in dic:
dic[count]=1
else:
... | n=int(eval(input()))
dic={}
ans=0
for _ in range(n):
s=eval(input())
s=str(sorted(s))
if s not in dic:
dic[s]=1
else:
ans+=dic[s]
dic[s]+=1
print(ans) | 20 | 12 | 392 | 173 | n = int(eval(input()))
arr = [eval(input()) for _ in range(n)]
dic = {}
check = "abcdefghijklmnopqrstuvwxyz"
for s in arr:
count = [0] * 26
for i in range(10):
for j in range(26):
if s[i] == check[j]:
count[j] += 1
break
count = tuple(count)
if count n... | n = int(eval(input()))
dic = {}
ans = 0
for _ in range(n):
s = eval(input())
s = str(sorted(s))
if s not in dic:
dic[s] = 1
else:
ans += dic[s]
dic[s] += 1
print(ans)
| false | 40 | [
"-arr = [eval(input()) for _ in range(n)]",
"-check = \"abcdefghijklmnopqrstuvwxyz\"",
"-for s in arr:",
"- count = [0] * 26",
"- for i in range(10):",
"- for j in range(26):",
"- if s[i] == check[j]:",
"- count[j] += 1",
"- break",
"- count... | false | 0.04704 | 0.047205 | 0.996516 | [
"s812786861",
"s796849452"
] |
u355865104 | p03212 | python | s763953868 | s577043725 | 72 | 40 | 7,404 | 3,060 | Accepted | Accepted | 44.44 | import itertools
def solve():
N = int(eval(input()))
num = str(N)
com = []
com.append(('3', '5', '7'))
com.append(('3', '5', '7'))
res = 0
dig = len(num)
for x in range(3, dig+1):
com.append(('3', '5', '7'))
temp = list(itertools.product(*com))
... | import itertools
if __name__ == '__main__':
N = eval(input())
n = int(N)
count = 0
for i in range(0, len(N)):
temp = itertools.product(["3", "5", "7"], repeat=i+1)
for j in temp:
s = "".join(j)
if ("3" in s and "5" in s and "7" in s and int(s) <= n):
count += ... | 26 | 16 | 527 | 335 | import itertools
def solve():
N = int(eval(input()))
num = str(N)
com = []
com.append(("3", "5", "7"))
com.append(("3", "5", "7"))
res = 0
dig = len(num)
for x in range(3, dig + 1):
com.append(("3", "5", "7"))
temp = list(itertools.product(*com))
tempanswer = [i... | import itertools
if __name__ == "__main__":
N = eval(input())
n = int(N)
count = 0
for i in range(0, len(N)):
temp = itertools.product(["3", "5", "7"], repeat=i + 1)
for j in temp:
s = "".join(j)
if "3" in s and "5" in s and "7" in s and int(s) <= n:
... | false | 38.461538 | [
"-",
"-def solve():",
"- N = int(eval(input()))",
"- num = str(N)",
"- com = []",
"- com.append((\"3\", \"5\", \"7\"))",
"- com.append((\"3\", \"5\", \"7\"))",
"- res = 0",
"- dig = len(num)",
"- for x in range(3, dig + 1):",
"- com.append((\"3\", \"5\", \"7\"))",
... | false | 0.062156 | 0.064389 | 0.965323 | [
"s763953868",
"s577043725"
] |
u685684561 | p02713 | python | s313534970 | s866111797 | 1,983 | 1,490 | 9,244 | 9,244 | Accepted | Accepted | 24.86 | K=int(eval(input()))
import sys
def gcd(a,b):
if b!=0:
return (gcd(b,a%b))
else:
return (a)
def GCD(a,b,c):
k=gcd(a,b)
l=gcd(a,c)
return (gcd(k,l))
s=0
if K==198:
print((10493367))
sys.exit()
elif K==199:
print((10611772))
sys.exit()
elif K==200:... | K=int(eval(input()))
import sys
def gcd(a,b):
if b!=0:
return (gcd(b,a%b))
else:
return (a)
def GCD(a,b,c):
k=gcd(a,b)
return (gcd(k,c))
s=0
if K==198:
print((10493367))
sys.exit()
elif K==199:
print((10611772))
sys.exit()
else:
for i in range(... | 36 | 33 | 746 | 680 | K = int(eval(input()))
import sys
def gcd(a, b):
if b != 0:
return gcd(b, a % b)
else:
return a
def GCD(a, b, c):
k = gcd(a, b)
l = gcd(a, c)
return gcd(k, l)
s = 0
if K == 198:
print((10493367))
sys.exit()
elif K == 199:
print((10611772))
sys.exit()
elif K == 2... | K = int(eval(input()))
import sys
def gcd(a, b):
if b != 0:
return gcd(b, a % b)
else:
return a
def GCD(a, b, c):
k = gcd(a, b)
return gcd(k, c)
s = 0
if K == 198:
print((10493367))
sys.exit()
elif K == 199:
print((10611772))
sys.exit()
else:
for i in range(1, K... | false | 8.333333 | [
"- l = gcd(a, c)",
"- return gcd(k, l)",
"+ return gcd(k, c)",
"- sys.exit()",
"-elif K == 200:",
"- print((10813692))"
] | false | 0.046472 | 0.121013 | 0.384027 | [
"s313534970",
"s866111797"
] |
u694810977 | p03387 | python | s970671432 | s620314678 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | import collections
a,b,c = list(map(int,input().split()))
lists = [str(a%2),str(b%2),str(c%2)]
abc = [a,b,c]
an = []
if len(set(lists)) != 1:
d = collections.Counter(lists)
jud = int(d.most_common()[0][0])
for i in range(3):
if jud == int(lists[i]):
an.append(i)
for i in... | abc = list(map(int,input().split()))
guki = [abc[0] % 2,abc[1] % 2,abc[2] % 2]
cnt_gusu = 0
cnt = 0
for i in abc:
if i % 2 == 0:
cnt_gusu += 1
if cnt_gusu == 2:
cnt += 1
for i in range(3):
if abc[i] % 2 == 0:
abc[i] += 1
elif cnt_gusu == 1:
cnt += 1
for i in... | 38 | 36 | 810 | 802 | import collections
a, b, c = list(map(int, input().split()))
lists = [str(a % 2), str(b % 2), str(c % 2)]
abc = [a, b, c]
an = []
if len(set(lists)) != 1:
d = collections.Counter(lists)
jud = int(d.most_common()[0][0])
for i in range(3):
if jud == int(lists[i]):
an.append(i)
for i i... | abc = list(map(int, input().split()))
guki = [abc[0] % 2, abc[1] % 2, abc[2] % 2]
cnt_gusu = 0
cnt = 0
for i in abc:
if i % 2 == 0:
cnt_gusu += 1
if cnt_gusu == 2:
cnt += 1
for i in range(3):
if abc[i] % 2 == 0:
abc[i] += 1
elif cnt_gusu == 1:
cnt += 1
for i in range(3):
... | false | 5.263158 | [
"-import collections",
"-",
"-a, b, c = list(map(int, input().split()))",
"-lists = [str(a % 2), str(b % 2), str(c % 2)]",
"-abc = [a, b, c]",
"-an = []",
"-if len(set(lists)) != 1:",
"- d = collections.Counter(lists)",
"- jud = int(d.most_common()[0][0])",
"+abc = list(map(int, input().spli... | false | 0.131263 | 0.130868 | 1.003017 | [
"s970671432",
"s620314678"
] |
u596276291 | p03423 | python | s154774312 | s744632126 | 294 | 26 | 4,424 | 3,956 | Accepted | Accepted | 91.16 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cac... | 23 | 26 | 505 | 660 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
impor... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import... | false | 11.538462 | [
"+#!/usr/bin/python3",
"-",
"-INF = float(\"inf\")",
"+INF = float(\"inf\")",
"+YES, Yes, yes, NO, No, no = \"YES\", \"Yes\", \"yes\", \"NO\", \"No\", \"no\"",
"+dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]",
"-def solve(N):",
"- return N // 3",
"+def inside(y, x, H, W):",
"+ return 0 <= y < H an... | false | 0.040143 | 0.037814 | 1.061597 | [
"s154774312",
"s744632126"
] |
u271176141 | p03293 | python | s394447309 | s305469844 | 29 | 25 | 9,056 | 9,128 | Accepted | Accepted | 13.79 | s = eval(input())
t = eval(input())
s = list(s)
t = list(t)
count = 0
judgment = 0
while count <= len(s):
count +=1
item = s.pop()
s.insert(0,item)
if s == t:
judgment += 1
if judgment == 0:
print("No")
else:
print("Yes") | s = eval(input())
t = eval(input())
# s,tをリストにする
s = list(s)
t = list(t)
# 変数count,judgementに0を代入
count = 0
judgment = 0
# sの長さだけ順番入れ替えを繰り返し
while count <= len(s):
item = s.pop()
s.insert(0,item)
if s == t:
# s==tになったらjudgmentでカウントアップ
judgment += 1
# 回数をカウントアップ
co... | 20 | 25 | 264 | 399 | s = eval(input())
t = eval(input())
s = list(s)
t = list(t)
count = 0
judgment = 0
while count <= len(s):
count += 1
item = s.pop()
s.insert(0, item)
if s == t:
judgment += 1
if judgment == 0:
print("No")
else:
print("Yes")
| s = eval(input())
t = eval(input())
# s,tをリストにする
s = list(s)
t = list(t)
# 変数count,judgementに0を代入
count = 0
judgment = 0
# sの長さだけ順番入れ替えを繰り返し
while count <= len(s):
item = s.pop()
s.insert(0, item)
if s == t:
# s==tになったらjudgmentでカウントアップ
judgment += 1
# 回数をカウントアップ
count += 1
# 一回もs==tに... | false | 20 | [
"+# s,tをリストにする",
"+# 変数count,judgementに0を代入",
"+# sの長さだけ順番入れ替えを繰り返し",
"- count += 1",
"+ # s==tになったらjudgmentでカウントアップ",
"+ # 回数をカウントアップ",
"+ count += 1",
"+# 一回もs==tになってなければNo"
] | false | 0.091526 | 0.042972 | 2.129906 | [
"s394447309",
"s305469844"
] |
u203843959 | p02658 | python | s010640381 | s171646014 | 83 | 74 | 21,788 | 21,604 | Accepted | Accepted | 10.84 | N=int(eval(input()))
alist=list(map(int,input().split()))
alist.sort()
answer=1
for a in alist:
answer*=a
if answer==0:
print((0))
break
elif answer>10**18:
print((-1))
break
else:
print(answer) | import sys
N=int(eval(input()))
alist=list(map(int,input().split()))
alist.sort()
if alist[0]==0:
print((0))
sys.exit(0)
answer=1
e18=10**18
for a in alist:
answer*=a
if answer>e18:
print((-1))
break
else:
print(answer) | 15 | 18 | 223 | 246 | N = int(eval(input()))
alist = list(map(int, input().split()))
alist.sort()
answer = 1
for a in alist:
answer *= a
if answer == 0:
print((0))
break
elif answer > 10**18:
print((-1))
break
else:
print(answer)
| import sys
N = int(eval(input()))
alist = list(map(int, input().split()))
alist.sort()
if alist[0] == 0:
print((0))
sys.exit(0)
answer = 1
e18 = 10**18
for a in alist:
answer *= a
if answer > e18:
print((-1))
break
else:
print(answer)
| false | 16.666667 | [
"+import sys",
"+",
"+if alist[0] == 0:",
"+ print((0))",
"+ sys.exit(0)",
"+e18 = 10**18",
"- if answer == 0:",
"- print((0))",
"- break",
"- elif answer > 10**18:",
"+ if answer > e18:"
] | false | 0.041914 | 0.037716 | 1.111316 | [
"s010640381",
"s171646014"
] |
u208713671 | p02862 | python | s472017852 | s200518626 | 481 | 169 | 40,556 | 205,256 | Accepted | Accepted | 64.86 | [X,Y] = list(map(int,input().split()))
output = 0
Z = X+Y
def modinv(a, mod=10**9+7):
return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
r = min(r, n-r)
res = 1
for i in range(r):
res = res * (n - i) * modinv(i+1, mod) % mod
return res
if (Z%3==0)and(Z/3<=X)and(... | X,Y = list(map(int,input().split()))
MAXN = 2*(10**6)+10
p = 10**9+7
f = [1]
for i in range(MAXN):
f.append(f[-1] * (i+1) % p)
def nCr(n, r, mod=p):
return f[n] * pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % mod
Z = (X+Y)//3
if Z*3!=X+Y:
print((0))
else:
P,Q = X-Z, Y-Z
if P<0... | 21 | 20 | 439 | 381 | [X, Y] = list(map(int, input().split()))
output = 0
Z = X + Y
def modinv(a, mod=10**9 + 7):
return pow(a, mod - 2, mod)
def combination(n, r, mod=10**9 + 7):
r = min(r, n - r)
res = 1
for i in range(r):
res = res * (n - i) * modinv(i + 1, mod) % mod
return res
if (Z % 3 == 0) and (Z / ... | X, Y = list(map(int, input().split()))
MAXN = 2 * (10**6) + 10
p = 10**9 + 7
f = [1]
for i in range(MAXN):
f.append(f[-1] * (i + 1) % p)
def nCr(n, r, mod=p):
return f[n] * pow(f[r], mod - 2, mod) * pow(f[n - r], mod - 2, mod) % mod
Z = (X + Y) // 3
if Z * 3 != X + Y:
print((0))
else:
P, Q = X - Z, ... | false | 4.761905 | [
"-[X, Y] = list(map(int, input().split()))",
"-output = 0",
"-Z = X + Y",
"+X, Y = list(map(int, input().split()))",
"+MAXN = 2 * (10**6) + 10",
"+p = 10**9 + 7",
"+f = [1]",
"+for i in range(MAXN):",
"+ f.append(f[-1] * (i + 1) % p)",
"-def modinv(a, mod=10**9 + 7):",
"- return pow(a, mod... | false | 0.505191 | 2.132631 | 0.236886 | [
"s472017852",
"s200518626"
] |
u526603504 | p02913 | python | s566778367 | s871695819 | 370 | 75 | 135,900 | 6,388 | Accepted | Accepted | 79.73 | N = int(eval(input()))
S = eval(input())
F = [1] * (N//2 + 2)
for i in range(1, len(F)):
F[i] = F[i] * 26
def check(l):
D = set()
for i in range(N - 2 * l + 1):
D.add(S[i:i+l])
if S[i+l:i+2*l] in D:
return True
OK = 0
NG = N // 2 + 1
while abs(OK - NG) > 1:
... | N = int(eval(input()))
S = eval(input())
def check(l):
D = set()
for i in range(N - 2 * l + 1):
D.add(S[i:i+l])
if S[i+l:i+2*l] in D:
return True
OK = 0
NG = N // 2 + 1
while abs(OK - NG) > 1:
mid = (OK + NG) // 2
if check(mid):
OK = mid
else:
... | 25 | 21 | 412 | 338 | N = int(eval(input()))
S = eval(input())
F = [1] * (N // 2 + 2)
for i in range(1, len(F)):
F[i] = F[i] * 26
def check(l):
D = set()
for i in range(N - 2 * l + 1):
D.add(S[i : i + l])
if S[i + l : i + 2 * l] in D:
return True
OK = 0
NG = N // 2 + 1
while abs(OK - NG) > 1:
... | N = int(eval(input()))
S = eval(input())
def check(l):
D = set()
for i in range(N - 2 * l + 1):
D.add(S[i : i + l])
if S[i + l : i + 2 * l] in D:
return True
OK = 0
NG = N // 2 + 1
while abs(OK - NG) > 1:
mid = (OK + NG) // 2
if check(mid):
OK = mid
else:
... | false | 16 | [
"-F = [1] * (N // 2 + 2)",
"-for i in range(1, len(F)):",
"- F[i] = F[i] * 26"
] | false | 0.175997 | 0.158496 | 1.110419 | [
"s566778367",
"s871695819"
] |
u796942881 | p03645 | python | s535779338 | s544788881 | 348 | 203 | 53,524 | 48,836 | Accepted | Accepted | 41.67 | from sys import stdin
lines = stdin.readlines
l = [[int(i) - 1 for i in line.split()] for line in lines()]
N, M = l[0][0] + 1, l[0][1] + 1
def main():
f = [False] * N
t = [False] * N
for a, b in l[1:]:
if a == 0:
f[b] = True
elif b == N - 1:
t[a... | input = open(0).read
n, m, *l = list(map(int, input().split()))
# abm は ai と bi の tuple を持つ list
*abm, = list(zip(l[::2], l[1::2]))
def f(i):
# 1 は tuple 1番目の要素 なので 2番目の要素
# N は tuple 2番目の要素 なので 1番目の要素
return set(abi[i < 2] for abi in abm if i in abi)
def main():
print(("POSSIBLE" i... | 30 | 19 | 497 | 352 | from sys import stdin
lines = stdin.readlines
l = [[int(i) - 1 for i in line.split()] for line in lines()]
N, M = l[0][0] + 1, l[0][1] + 1
def main():
f = [False] * N
t = [False] * N
for a, b in l[1:]:
if a == 0:
f[b] = True
elif b == N - 1:
t[a] = True
for a, ... | input = open(0).read
n, m, *l = list(map(int, input().split()))
# abm は ai と bi の tuple を持つ list
(*abm,) = list(zip(l[::2], l[1::2]))
def f(i):
# 1 は tuple 1番目の要素 なので 2番目の要素
# N は tuple 2番目の要素 なので 1番目の要素
return set(abi[i < 2] for abi in abm if i in abi)
def main():
print(("POSSIBLE" if f(1) & f(n) e... | false | 36.666667 | [
"-from sys import stdin",
"+input = open(0).read",
"+n, m, *l = list(map(int, input().split()))",
"+# abm は ai と bi の tuple を持つ list",
"+(*abm,) = list(zip(l[::2], l[1::2]))",
"-lines = stdin.readlines",
"-l = [[int(i) - 1 for i in line.split()] for line in lines()]",
"-N, M = l[0][0] + 1, l[0][1] + 1... | false | 0.044282 | 0.058018 | 0.763243 | [
"s535779338",
"s544788881"
] |
u241159583 | p03944 | python | s049213645 | s596294644 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | W, H, N = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(N)]
w = [0, W]
h = [0, H]
for x, y, a in xya:
if a == 1 and w[0] < x:
w[0] = x
elif a == 2 and w[1] > x:
w[1] = x
elif a == 3 and h[0] < y:
h[0] = y
elif a == 4 and h[1] > y:
h[1] = y
... | w,h,n = list(map(int, input().split()))
xya = [list(map(int,input().split())) for _ in range(n)]
X = [0,w]
Y = [0,h]
for x,y,a in xya:
if a == 1 and X[0] < x: X[0] = x
elif a == 2 and X[1] > x: X[1] = x
elif a == 3 and Y[0] < y: Y[0] = y
elif a == 4 and Y[1] > y: Y[1] = y
h, w = Y[1]-Y[0], X[1]... | 18 | 11 | 408 | 352 | W, H, N = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(N)]
w = [0, W]
h = [0, H]
for x, y, a in xya:
if a == 1 and w[0] < x:
w[0] = x
elif a == 2 and w[1] > x:
w[1] = x
elif a == 3 and h[0] < y:
h[0] = y
elif a == 4 and h[1] > y:
h... | w, h, n = list(map(int, input().split()))
xya = [list(map(int, input().split())) for _ in range(n)]
X = [0, w]
Y = [0, h]
for x, y, a in xya:
if a == 1 and X[0] < x:
X[0] = x
elif a == 2 and X[1] > x:
X[1] = x
elif a == 3 and Y[0] < y:
Y[0] = y
elif a == 4 and Y[1] > y:
Y... | false | 38.888889 | [
"-W, H, N = list(map(int, input().split()))",
"-xya = [list(map(int, input().split())) for _ in range(N)]",
"-w = [0, W]",
"-h = [0, H]",
"+w, h, n = list(map(int, input().split()))",
"+xya = [list(map(int, input().split())) for _ in range(n)]",
"+X = [0, w]",
"+Y = [0, h]",
"- if a == 1 and w[0]... | false | 0.066372 | 0.050839 | 1.305533 | [
"s049213645",
"s596294644"
] |
u391731808 | p03786 | python | s845898494 | s092785377 | 629 | 290 | 14,276 | 14,320 | Accepted | Accepted | 53.9 | N=int(eval(input()))
A=[0]+sorted(map(int,input().split()))
l=0
r=N
while l+1<r:
i = (l+r)//2
a = sum(A[:i+1])
for j in range(i+1,N):
if a*2<A[j]: l = i;break
a += A[j]
else:
r = i
print((N-r+1)) | #二分探索
N = int(eval(input()))
A = [0] + sorted(map(int,input().split()))
def check(i):
a = sum(A[:i+1])
for b in A[i+1:]:
if a*2>=b:
a += b
else:return False
return True
l = 0
r = N
while l+1<r:
i = (l+r)//2
if check(i):
r = i
else:
... | 13 | 22 | 239 | 334 | N = int(eval(input()))
A = [0] + sorted(map(int, input().split()))
l = 0
r = N
while l + 1 < r:
i = (l + r) // 2
a = sum(A[: i + 1])
for j in range(i + 1, N):
if a * 2 < A[j]:
l = i
break
a += A[j]
else:
r = i
print((N - r + 1))
| # 二分探索
N = int(eval(input()))
A = [0] + sorted(map(int, input().split()))
def check(i):
a = sum(A[: i + 1])
for b in A[i + 1 :]:
if a * 2 >= b:
a += b
else:
return False
return True
l = 0
r = N
while l + 1 < r:
i = (l + r) // 2
if check(i):
r = i
... | false | 40.909091 | [
"+# 二分探索",
"+",
"+",
"+def check(i):",
"+ a = sum(A[: i + 1])",
"+ for b in A[i + 1 :]:",
"+ if a * 2 >= b:",
"+ a += b",
"+ else:",
"+ return False",
"+ return True",
"+",
"+",
"- a = sum(A[: i + 1])",
"- for j in range(i + 1, N):",
"... | false | 0.0365 | 0.036188 | 1.008625 | [
"s845898494",
"s092785377"
] |
u480138356 | p04047 | python | s397695330 | s359082201 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | N = int(eval(input()))
L = list(map(int, input().split(" ")))
L = sorted(L)
tmp= 0
for i in range(N):
tmp += L[i*2]
print(tmp) | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
l = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for i in range(0, N*2, 2):
ans += min(l[i], l[i+1])
print(ans)
if __name__ == "__main__":
main() | 10 | 15 | 130 | 279 | N = int(eval(input()))
L = list(map(int, input().split(" ")))
L = sorted(L)
tmp = 0
for i in range(N):
tmp += L[i * 2]
print(tmp)
| import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
l = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for i in range(0, N * 2, 2):
ans += min(l[i], l[i + 1])
print(ans)
if __name__ == "__main__":
main()
| false | 33.333333 | [
"-N = int(eval(input()))",
"-L = list(map(int, input().split(\" \")))",
"-L = sorted(L)",
"-tmp = 0",
"-for i in range(N):",
"- tmp += L[i * 2]",
"-print(tmp)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def main():",
"+ N = int(eval(input()))",
"+ l = sorted... | false | 0.048098 | 0.048192 | 0.998062 | [
"s397695330",
"s359082201"
] |
u474423089 | p03069 | python | s961629423 | s324263689 | 100 | 73 | 3,500 | 4,840 | Accepted | Accepted | 27 | n = int(eval(input()))
s = eval(input())
ans = s.count('.')
num = ans
for c in s:
if c == '.':
num -= 1
else:
num += 1
ans = min(ans,num)
print(ans)
|
def main():
N=int(eval(input()))
line = list(eval(input()))
ans= line.count(".")
num = ans
for i in line:
if i ==".":
num -=1
else:
num +=1
ans = min(ans,num)
return ans
print((main())) | 13 | 17 | 167 | 263 | n = int(eval(input()))
s = eval(input())
ans = s.count(".")
num = ans
for c in s:
if c == ".":
num -= 1
else:
num += 1
ans = min(ans, num)
print(ans)
| def main():
N = int(eval(input()))
line = list(eval(input()))
ans = line.count(".")
num = ans
for i in line:
if i == ".":
num -= 1
else:
num += 1
ans = min(ans, num)
return ans
print((main()))
| false | 23.529412 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-ans = s.count(\".\")",
"-num = ans",
"-for c in s:",
"- if c == \".\":",
"- num -= 1",
"- else:",
"- num += 1",
"- ans = min(ans, num)",
"-print(ans)",
"+def main():",
"+ N = int(eval(input()))",
"+ line = list... | false | 0.040992 | 0.035903 | 1.141722 | [
"s961629423",
"s324263689"
] |
u535803878 | p02703 | python | s657573424 | s925774710 | 1,969 | 1,685 | 126,416 | 124,564 | Accepted | Accepted | 14.42 | import sys
input = lambda : sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: [] for u in range(n)}
uv2e = {}
for i in range(m):
u,v,a[i],b[i] = list(map(i... | import sys
input = lambda : sys.stdin.readline().rstrip()
import heapq
from collections import defaultdict
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = defaultdict(list)
uv2e = {}
for i in range(m):
... | 63 | 51 | 1,655 | 1,266 | import sys
input = lambda: sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: [] for u in range(n)}
uv2e = {}
for i in range(m):
u, v, a[i], b[i] = list(map(int, input().s... | import sys
input = lambda: sys.stdin.readline().rstrip()
import heapq
from collections import defaultdict
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = defaultdict(list)
uv2e = {}
for i in range(m):
u, v, a[i], b[... | false | 19.047619 | [
"+from collections import defaultdict",
"-ns = {u: [] for u in range(n)}",
"+ns = defaultdict(list)",
"-ans[0][s] = 0",
"-done = [[None] * (maxs + 1) for _ in range(n)]",
"- # if ans[u][ss] is not None and ans[u][ss] <= dd:",
"- # continue",
"- # ans[u][ss] = dd",
"- if d... | false | 0.05377 | 0.04851 | 1.10843 | [
"s657573424",
"s925774710"
] |
u918009437 | p04001 | python | s306932977 | s885381903 | 29 | 26 | 3,064 | 3,060 | Accepted | Accepted | 10.34 | if __name__ == '__main__':
S = list(eval(input()))
answer = 0
for i in range(2**(len(S)-1)):
operators = (list(format(i, '0' + str(len(S)-1) + 'b').replace('1', '+').replace('0', ' ')))
state = S[0]
for j in range(len(S)-1):
state += operators[j] + S[j+1]
... | if __name__ == '__main__':
S = list(eval(input()))
ans = 0
for state in range(1 << (len(S)-1)):
ans += eval(S[0] + ''.join(('+' if (state >> i & 1) else '')+x for i, x in enumerate(S[1:])))
# print(str(state))
# print(S[0] + ''.join(('+' if (state >> i & 1) else '')+x for i, x ... | 16 | 9 | 404 | 390 | if __name__ == "__main__":
S = list(eval(input()))
answer = 0
for i in range(2 ** (len(S) - 1)):
operators = list(
format(i, "0" + str(len(S) - 1) + "b").replace("1", "+").replace("0", " ")
)
state = S[0]
for j in range(len(S) - 1):
state += operators[... | if __name__ == "__main__":
S = list(eval(input()))
ans = 0
for state in range(1 << (len(S) - 1)):
ans += eval(
S[0]
+ "".join(
("+" if (state >> i & 1) else "") + x for i, x in enumerate(S[1:])
)
)
# print(str(state))
# prin... | false | 43.75 | [
"- answer = 0",
"- for i in range(2 ** (len(S) - 1)):",
"- operators = list(",
"- format(i, \"0\" + str(len(S) - 1) + \"b\").replace(\"1\", \"+\").replace(\"0\", \" \")",
"+ ans = 0",
"+ for state in range(1 << (len(S) - 1)):",
"+ ans += eval(",
"+ S[0]"... | false | 0.047186 | 0.046721 | 1.009948 | [
"s306932977",
"s885381903"
] |
u074650488 | p02720 | python | s699119360 | s581833975 | 59 | 53 | 7,264 | 7,212 | Accepted | Accepted | 10.17 | maxn = 100005
def solve(n):
if n<=9:
return n
q = [0 for i in range(maxn)]
front = 1
rear = 0
for i in range(1,10):
rear += 1
q[rear] = i
cnt = 9
while 1:
u = q[front]
front += 1
if u%10 != 0:
t = u*10 + u%10 -1
rear += 1
q[rear] = t
cnt += 1
if cnt==n:
return... | def solve(n):
if n<=9:
return n
q = [0]
for i in range(1,10):
q.append(i)
now = 1
cnt = 9
while 1:
u = q[now]
now += 1
if u%10!=0:
t = u*10 + u%10 - 1
cnt += 1
if cnt==n:
return t
q.append(t)
t = u*10 + u%10
cnt += 1
if cnt==n:
return t
q.append(t)
if u... | 37 | 30 | 556 | 440 | maxn = 100005
def solve(n):
if n <= 9:
return n
q = [0 for i in range(maxn)]
front = 1
rear = 0
for i in range(1, 10):
rear += 1
q[rear] = i
cnt = 9
while 1:
u = q[front]
front += 1
if u % 10 != 0:
t = u * 10 + u % 10 - 1
... | def solve(n):
if n <= 9:
return n
q = [0]
for i in range(1, 10):
q.append(i)
now = 1
cnt = 9
while 1:
u = q[now]
now += 1
if u % 10 != 0:
t = u * 10 + u % 10 - 1
cnt += 1
if cnt == n:
return t
... | false | 18.918919 | [
"-maxn = 100005",
"-",
"-",
"- q = [0 for i in range(maxn)]",
"- front = 1",
"- rear = 0",
"+ q = [0]",
"- rear += 1",
"- q[rear] = i",
"+ q.append(i)",
"+ now = 1",
"- u = q[front]",
"- front += 1",
"+ u = q[now]",
"+ now +... | false | 0.053263 | 0.05372 | 0.991487 | [
"s699119360",
"s581833975"
] |
u151625340 | p02713 | python | s847079712 | s807540461 | 316 | 142 | 68,788 | 68,052 | Accepted | Accepted | 55.06 | K = int(eval(input()))
def gcd(a, b): # 最大公約数
a = abs(a)
b = abs(b)
while b:
a, b = b, a % b
return a # int
ans = 0
for i in range(1,K+1):
for j in range(i,K+1):
for k in range(j,K+1):
d = gcd(gcd(i,j),k)
if i==j==k:
ans += d
... |
import math
K = int(eval(input()))
ans = 0
for i in range(1,K+1):
for j in range(i,K+1):
for k in range(j,K+1):
d = math.gcd(math.gcd(i,j),k)
if i==j==k:
ans += d
elif i==j or j== k or k==i:
ans += 3*d
else:
... | 20 | 15 | 439 | 348 | K = int(eval(input()))
def gcd(a, b): # 最大公約数
a = abs(a)
b = abs(b)
while b:
a, b = b, a % b
return a # int
ans = 0
for i in range(1, K + 1):
for j in range(i, K + 1):
for k in range(j, K + 1):
d = gcd(gcd(i, j), k)
if i == j == k:
ans +=... | import math
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(i, K + 1):
for k in range(j, K + 1):
d = math.gcd(math.gcd(i, j), k)
if i == j == k:
ans += d
elif i == j or j == k or k == i:
ans += 3 * d
els... | false | 25 | [
"+import math",
"+",
"-",
"-",
"-def gcd(a, b): # 最大公約数",
"- a = abs(a)",
"- b = abs(b)",
"- while b:",
"- a, b = b, a % b",
"- return a # int",
"-",
"-",
"- d = gcd(gcd(i, j), k)",
"+ d = math.gcd(math.gcd(i, j), k)"
] | false | 0.146294 | 0.134004 | 1.091714 | [
"s847079712",
"s807540461"
] |
u906569502 | p03163 | python | s847721535 | s514968004 | 190 | 130 | 148,504 | 69,112 | Accepted | Accepted | 31.58 | n,W=list(map(int,input().split()))
dp=[0]*(W+1)
dd=dp.copy()
for i in range(n):
w,v=list(map(int,input().split()))
for j in range(W):
cw=j+w
cv=dp[j]+v
if cw <=W and dd[cw]<cv:
dd[cw]=cv
dp=dd.copy()
print((dp[W])) | n,W=list(map(int,input().split()))
dp=[0]*(W+1)
for i in range(n):
w,v=list(map(int,input().split()))
for j in range(W,-1,-1):
cw=j+w
cv=dp[j]+v
if cw <=W and dp[cw]<cv:
dp[cw]=cv
print((dp[W])) | 12 | 10 | 223 | 200 | n, W = list(map(int, input().split()))
dp = [0] * (W + 1)
dd = dp.copy()
for i in range(n):
w, v = list(map(int, input().split()))
for j in range(W):
cw = j + w
cv = dp[j] + v
if cw <= W and dd[cw] < cv:
dd[cw] = cv
dp = dd.copy()
print((dp[W]))
| n, W = list(map(int, input().split()))
dp = [0] * (W + 1)
for i in range(n):
w, v = list(map(int, input().split()))
for j in range(W, -1, -1):
cw = j + w
cv = dp[j] + v
if cw <= W and dp[cw] < cv:
dp[cw] = cv
print((dp[W]))
| false | 16.666667 | [
"-dd = dp.copy()",
"- for j in range(W):",
"+ for j in range(W, -1, -1):",
"- if cw <= W and dd[cw] < cv:",
"- dd[cw] = cv",
"- dp = dd.copy()",
"+ if cw <= W and dp[cw] < cv:",
"+ dp[cw] = cv"
] | false | 0.252786 | 0.047213 | 5.35413 | [
"s847721535",
"s514968004"
] |
u863370423 | p02712 | python | s625771454 | s351241776 | 215 | 76 | 8,792 | 64,712 | Accepted | Accepted | 64.65 | a=int(eval(input()))
x=int(1)
s=int(0)
while x<=a:
if x%3!=0 and x%5!=0:
s=s+x
x=x+1
print(s) | n = int(eval(input()))
s = 0
for i in range(1,n+1):
if i!=3 and i!=5 and i%3!=0 and i%5!=0:
s+=i
print(s) | 8 | 6 | 110 | 116 | a = int(eval(input()))
x = int(1)
s = int(0)
while x <= a:
if x % 3 != 0 and x % 5 != 0:
s = s + x
x = x + 1
print(s)
| n = int(eval(input()))
s = 0
for i in range(1, n + 1):
if i != 3 and i != 5 and i % 3 != 0 and i % 5 != 0:
s += i
print(s)
| false | 25 | [
"-a = int(eval(input()))",
"-x = int(1)",
"-s = int(0)",
"-while x <= a:",
"- if x % 3 != 0 and x % 5 != 0:",
"- s = s + x",
"- x = x + 1",
"+n = int(eval(input()))",
"+s = 0",
"+for i in range(1, n + 1):",
"+ if i != 3 and i != 5 and i % 3 != 0 and i % 5 != 0:",
"+ s +=... | false | 0.207516 | 0.154686 | 1.341532 | [
"s625771454",
"s351241776"
] |
u325282913 | p03862 | python | s403823497 | s031540819 | 109 | 93 | 14,132 | 85,492 | Accepted | Accepted | 14.68 | N, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
s = sum(arr)
for i in range(1,N):
if arr[i-1] + arr[i] >= x:
if arr[i-1] <= x:
arr[i] -= (arr[i] + arr[i-1]) - x
else:
arr[i] = 0
if x-arr[i-1] > 0:
arr[i-1] -= ... | N, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans = 0
for i in range(N-1):
if arr[i] + arr[i+1] >= x:
tmp = arr[i] + arr[i+1] - x
if arr[i+1] >= tmp:
arr[i+1] -= tmp
else:
arr[i+1] = 0
ans += tmp
print(ans) | 14 | 12 | 402 | 302 | N, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
s = sum(arr)
for i in range(1, N):
if arr[i - 1] + arr[i] >= x:
if arr[i - 1] <= x:
arr[i] -= (arr[i] + arr[i - 1]) - x
else:
arr[i] = 0
if x - arr[i - 1] > 0:
arr[i - 1] ... | N, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
if arr[i] + arr[i + 1] >= x:
tmp = arr[i] + arr[i + 1] - x
if arr[i + 1] >= tmp:
arr[i + 1] -= tmp
else:
arr[i + 1] = 0
ans += tmp
print(ans)
| false | 14.285714 | [
"-s = sum(arr)",
"-for i in range(1, N):",
"- if arr[i - 1] + arr[i] >= x:",
"- if arr[i - 1] <= x:",
"- arr[i] -= (arr[i] + arr[i - 1]) - x",
"+ans = 0",
"+for i in range(N - 1):",
"+ if arr[i] + arr[i + 1] >= x:",
"+ tmp = arr[i] + arr[i + 1] - x",
"+ if arr... | false | 0.055107 | 0.043802 | 1.258084 | [
"s403823497",
"s031540819"
] |
u219197917 | p03846 | python | s052129506 | s959467808 | 106 | 93 | 14,008 | 14,008 | Accepted | Accepted | 12.26 | n=int(eval(input()));print(([0,2**(n//2)%(10**9+7)][sorted(map(int,input().split()))==[(i+n%2)//2*2+1-n%2for i in range(n)]])) | n=int(eval(input()));print(([0,pow(2,(n//2),(10**9+7))][sorted(map(int,input().split()))==[i+(i+n+1)%2for i in range(n)]])) | 1 | 1 | 118 | 115 | n = int(eval(input()))
print(
(
[0, 2 ** (n // 2) % (10**9 + 7)][
sorted(map(int, input().split()))
== [(i + n % 2) // 2 * 2 + 1 - n % 2 for i in range(n)]
]
)
)
| n = int(eval(input()))
print(
(
[0, pow(2, (n // 2), (10**9 + 7))][
sorted(map(int, input().split())) == [i + (i + n + 1) % 2 for i in range(n)]
]
)
)
| false | 0 | [
"- [0, 2 ** (n // 2) % (10**9 + 7)][",
"- sorted(map(int, input().split()))",
"- == [(i + n % 2) // 2 * 2 + 1 - n % 2 for i in range(n)]",
"+ [0, pow(2, (n // 2), (10**9 + 7))][",
"+ sorted(map(int, input().split())) == [i + (i + n + 1) % 2 for i in range(n)]"
... | false | 0.040255 | 0.041494 | 0.970134 | [
"s052129506",
"s959467808"
] |
u795630164 | p03457 | python | s296044225 | s564440598 | 415 | 368 | 27,300 | 3,060 | Accepted | Accepted | 11.33 | N = int(eval(input()))
data = [list(map(int, input().split())) for _ in range(N)]
t = 0
x = 0
y = 0
for i in range(N):
distance = abs(x - data[i][1]) + abs(y - data[i][2])
time = data[i][0] - t
if distance > time :
print('No')
exit()
if (distance - time) % 2 == 1:
... | N = int(eval(input()))
t, x, y = 0, 0, 0
for i in range(N):
tn, xn, yn = list(map(int, input().split()))
l = abs(x-xn) + abs(y-yn)
if l > tn - t or (l - (tn - t)) % 2 == 1:
print('No')
exit()
t, x, y = tn, xn, yn
print('Yes')
| 22 | 12 | 420 | 259 | N = int(eval(input()))
data = [list(map(int, input().split())) for _ in range(N)]
t = 0
x = 0
y = 0
for i in range(N):
distance = abs(x - data[i][1]) + abs(y - data[i][2])
time = data[i][0] - t
if distance > time:
print("No")
exit()
if (distance - time) % 2 == 1:
print("No")
... | N = int(eval(input()))
t, x, y = 0, 0, 0
for i in range(N):
tn, xn, yn = list(map(int, input().split()))
l = abs(x - xn) + abs(y - yn)
if l > tn - t or (l - (tn - t)) % 2 == 1:
print("No")
exit()
t, x, y = tn, xn, yn
print("Yes")
| false | 45.454545 | [
"-data = [list(map(int, input().split())) for _ in range(N)]",
"-t = 0",
"-x = 0",
"-y = 0",
"+t, x, y = 0, 0, 0",
"- distance = abs(x - data[i][1]) + abs(y - data[i][2])",
"- time = data[i][0] - t",
"- if distance > time:",
"+ tn, xn, yn = list(map(int, input().split()))",
"+ l = a... | false | 0.096873 | 0.041179 | 2.352475 | [
"s296044225",
"s564440598"
] |
u886655280 | p03478 | python | s270355577 | s206259923 | 38 | 25 | 3,060 | 2,940 | Accepted | Accepted | 34.21 | N, A, B = list(map(int, input().split()))
target_total = 0 # 加算対象の数値の和
for n in range(1, N + 1):
total_each_digit = 0 # 各位の和
str_n = str(n)
n_length = len(str_n) # nの桁数
for i in range(n_length):
total_each_digit += int(str_n[i])
if A <= total_each_digit <= B:... | # 各位の値を足し算する処理2
def sum_each_digit(n):
total_each_digit = 0
while n >= 1:
total_each_digit += n % 10
n //= 10
return total_each_digit
N, A, B = list(map(int, input().split()))
target_total = 0 # 加算対象の数値の和
for n in range(1, N + 1):
if A <= sum_each_digit(n) <= B:
... | 16 | 18 | 364 | 360 | N, A, B = list(map(int, input().split()))
target_total = 0 # 加算対象の数値の和
for n in range(1, N + 1):
total_each_digit = 0 # 各位の和
str_n = str(n)
n_length = len(str_n) # nの桁数
for i in range(n_length):
total_each_digit += int(str_n[i])
if A <= total_each_digit <= B:
target_total += n
pri... | # 各位の値を足し算する処理2
def sum_each_digit(n):
total_each_digit = 0
while n >= 1:
total_each_digit += n % 10
n //= 10
return total_each_digit
N, A, B = list(map(int, input().split()))
target_total = 0 # 加算対象の数値の和
for n in range(1, N + 1):
if A <= sum_each_digit(n) <= B:
target_total +... | false | 11.111111 | [
"+# 各位の値を足し算する処理2",
"+def sum_each_digit(n):",
"+ total_each_digit = 0",
"+ while n >= 1:",
"+ total_each_digit += n % 10",
"+ n //= 10",
"+ return total_each_digit",
"+",
"+",
"- total_each_digit = 0 # 各位の和",
"- str_n = str(n)",
"- n_length = len(str_n) # nの桁... | false | 0.057594 | 0.035383 | 1.627714 | [
"s270355577",
"s206259923"
] |
u010110540 | p03721 | python | s531800104 | s821602168 | 317 | 186 | 24,360 | 5,744 | Accepted | Accepted | 41.32 | import sys
import bisect
N, K = list(map(int, sys.stdin.readline().split()))
d = []
for i in range(N):
a, b = list(map(int, sys.stdin.readline().split()))
d.append([a,b])
d.sort()
l = [0] * N
l[0] = d[0][1]
for i in range(1, N):
l[i] = d[i][1]+ l[i-1]
pos = bisect.bisect_left(l, K)... | import sys
d = [0] * 10**5
N, K = [int(x) for x in sys.stdin.readline().split()]
for i in range(N):
a, b = [int(x) for x in sys.stdin.readline().split()]
d[a-1] += b
cnt = 0
for i, j in enumerate(d):
cnt += j
if cnt >= K:
print((i+1))
break | 21 | 15 | 326 | 291 | import sys
import bisect
N, K = list(map(int, sys.stdin.readline().split()))
d = []
for i in range(N):
a, b = list(map(int, sys.stdin.readline().split()))
d.append([a, b])
d.sort()
l = [0] * N
l[0] = d[0][1]
for i in range(1, N):
l[i] = d[i][1] + l[i - 1]
pos = bisect.bisect_left(l, K)
print((d[pos][0]))
| import sys
d = [0] * 10**5
N, K = [int(x) for x in sys.stdin.readline().split()]
for i in range(N):
a, b = [int(x) for x in sys.stdin.readline().split()]
d[a - 1] += b
cnt = 0
for i, j in enumerate(d):
cnt += j
if cnt >= K:
print((i + 1))
break
| false | 28.571429 | [
"-import bisect",
"-N, K = list(map(int, sys.stdin.readline().split()))",
"-d = []",
"+d = [0] * 10**5",
"+N, K = [int(x) for x in sys.stdin.readline().split()]",
"- a, b = list(map(int, sys.stdin.readline().split()))",
"- d.append([a, b])",
"-d.sort()",
"-l = [0] * N",
"-l[0] = d[0][1]",
... | false | 0.045573 | 0.042663 | 1.068203 | [
"s531800104",
"s821602168"
] |
u562935282 | p03212 | python | s053970210 | s655036064 | 158 | 91 | 3,064 | 3,060 | Accepted | Accepted | 42.41 | def check(var):
in_range = var <= N
all_num_in = all(c in str(var) for c in '753')
return in_range and all_num_in
def dfs(x):
res = 0
if check(x):
res += 1
if x <= N:
for v in 3, 5, 7:
res += dfs(10 * x + v)
return res
N = int(eval(input()))
p... | def check(var):
return (0 <= var <= N) and all(c in str(var) for c in '753')
def dfs(x):
res = 0
if check(x): res += 1
if x <= N:
for v in 3, 5, 7:
res += dfs(10 * x + v)
return res
N = int(eval(input()))
print((dfs(0)))
| 18 | 15 | 327 | 271 | def check(var):
in_range = var <= N
all_num_in = all(c in str(var) for c in "753")
return in_range and all_num_in
def dfs(x):
res = 0
if check(x):
res += 1
if x <= N:
for v in 3, 5, 7:
res += dfs(10 * x + v)
return res
N = int(eval(input()))
print((dfs(0)))
| def check(var):
return (0 <= var <= N) and all(c in str(var) for c in "753")
def dfs(x):
res = 0
if check(x):
res += 1
if x <= N:
for v in 3, 5, 7:
res += dfs(10 * x + v)
return res
N = int(eval(input()))
print((dfs(0)))
| false | 16.666667 | [
"- in_range = var <= N",
"- all_num_in = all(c in str(var) for c in \"753\")",
"- return in_range and all_num_in",
"+ return (0 <= var <= N) and all(c in str(var) for c in \"753\")"
] | false | 0.061934 | 0.051267 | 1.208071 | [
"s053970210",
"s655036064"
] |
u263737105 | p02577 | python | s716244190 | s591743390 | 73 | 34 | 10,560 | 9,256 | Accepted | Accepted | 53.42 | import sys
cin = sys.stdin.readline
n = list(cin())
ans = 0
n.pop(-1)
for i in n:
ans += int(i)
if ans % 9 == 0:
print('Yes')
else:
print("No") | import sys
cin = sys.stdin.readline
n = cin()
total = 0
for i in range(10):
total += n.count(str(i)) * i
print(("Yes" if total%9 == 0 else "No")) | 12 | 9 | 167 | 157 | import sys
cin = sys.stdin.readline
n = list(cin())
ans = 0
n.pop(-1)
for i in n:
ans += int(i)
if ans % 9 == 0:
print("Yes")
else:
print("No")
| import sys
cin = sys.stdin.readline
n = cin()
total = 0
for i in range(10):
total += n.count(str(i)) * i
print(("Yes" if total % 9 == 0 else "No"))
| false | 25 | [
"-n = list(cin())",
"-ans = 0",
"-n.pop(-1)",
"-for i in n:",
"- ans += int(i)",
"-if ans % 9 == 0:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+n = cin()",
"+total = 0",
"+for i in range(10):",
"+ total += n.count(str(i)) * i",
"+print((\"Yes\" if total % 9 == 0 else \... | false | 0.045325 | 0.007021 | 6.455285 | [
"s716244190",
"s591743390"
] |
u863371419 | p02621 | python | s120399990 | s621984781 | 29 | 25 | 9,080 | 8,740 | Accepted | Accepted | 13.79 | a = int(eval(input()))
b = a**2
c = a**3
print((a+b+c)) | a = int(eval(input()))
print((a+a**2+a**3)) | 5 | 2 | 52 | 36 | a = int(eval(input()))
b = a**2
c = a**3
print((a + b + c))
| a = int(eval(input()))
print((a + a**2 + a**3))
| false | 60 | [
"-b = a**2",
"-c = a**3",
"-print((a + b + c))",
"+print((a + a**2 + a**3))"
] | false | 0.094002 | 0.037055 | 2.536824 | [
"s120399990",
"s621984781"
] |
u655048024 | p02627 | python | s680486672 | s960690155 | 28 | 25 | 9,016 | 8,872 | Accepted | Accepted | 10.71 | a = str(eval(input()))
b = a.upper()
if(a==b):
print("A")
else:
print("a")
| a = str(eval(input()))
x = "QWERTYUIOPASDFGHJKLZXCVBNM"
if(a in x):
print("A")
else:
print("a") | 8 | 6 | 86 | 98 | a = str(eval(input()))
b = a.upper()
if a == b:
print("A")
else:
print("a")
| a = str(eval(input()))
x = "QWERTYUIOPASDFGHJKLZXCVBNM"
if a in x:
print("A")
else:
print("a")
| false | 25 | [
"-b = a.upper()",
"-if a == b:",
"+x = \"QWERTYUIOPASDFGHJKLZXCVBNM\"",
"+if a in x:"
] | false | 0.085219 | 0.04754 | 1.792578 | [
"s680486672",
"s960690155"
] |
u654470292 | p02574 | python | s775582540 | s545822779 | 1,009 | 360 | 241,172 | 201,008 | Accepted | Accepted | 64.32 | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 53 | 59 | 1,046 | 1,446 | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 10.169492 | [
"-pc = \"pairwise coprime\"",
"-sc = \"setwise coprime\"",
"-nc = \"not coprime\"",
"-a.sort()",
"+",
"+",
"+def primes(n):",
"+ is_prime = [-1] * (n + 1)",
"+ is_prime[1] = 1",
"+ for i in range(2, int(n**0.5) + 1):",
"+ if is_prime[i] != -1:",
"+ continue",
"+ ... | false | 0.038665 | 0.935549 | 0.041329 | [
"s775582540",
"s545822779"
] |
u344030307 | p02953 | python | s660375376 | s246383133 | 78 | 70 | 20,472 | 20,800 | Accepted | Accepted | 10.26 | import sys
n = int(eval(input()))
h = list(map(int, input().split()))
def main():
for i in reversed(list(range(n-1))):
if h[i] - h[i+1] > 1:
return False
exit()
elif h[i] - h[i+1] == 1:
h[i] -= 1
else:
continue
return True
if main() == True:
print('Yes')
... |
n = int(eval(input()))
h = list(map(int, input().split()))
def main():
for i in reversed(list(range(n-1))):
if h[i] - h[i+1] > 1:
return False
exit()
elif h[i] - h[i+1] == 1:
h[i] -= 1
else:
continue
return True
if main() == True:
print('Yes')
else:
p... | 27 | 21 | 395 | 318 | import sys
n = int(eval(input()))
h = list(map(int, input().split()))
def main():
for i in reversed(list(range(n - 1))):
if h[i] - h[i + 1] > 1:
return False
exit()
elif h[i] - h[i + 1] == 1:
h[i] -= 1
else:
continue
return True
if mai... | n = int(eval(input()))
h = list(map(int, input().split()))
def main():
for i in reversed(list(range(n - 1))):
if h[i] - h[i + 1] > 1:
return False
exit()
elif h[i] - h[i + 1] == 1:
h[i] -= 1
else:
continue
return True
if main() == True:... | false | 22.222222 | [
"-import sys",
"-",
"- sys.exit()",
"-h[n - 1] -= 1",
"-if main() == True:",
"- print(\"Yes\")"
] | false | 0.039836 | 0.037949 | 1.049747 | [
"s660375376",
"s246383133"
] |
u186838327 | p03486 | python | s444703154 | s810521056 | 168 | 71 | 38,384 | 61,592 | Accepted | Accepted | 57.74 | s = str(eval(input()))
t = str(eval(input()))
S = [0]*26
T = [0]*26
for i in range(len(s)):
c = ord(s[i])-ord('a')
S[c] += 1
for i in range(len(t)):
c = ord(t[i])-ord('a')
T[c] += 1
s_ = ''
for i in range(26):
s_ += chr(i+ord('a'))*S[i]
t_ = ''
for i in reversed(list(range(26))... | s = str(eval(input()))
t = str(eval(input()))
s_ = list(s)
s_.sort()
s_ = ''.join(s_)
t_ = list(t)
t_.sort(reverse= True)
t_ = ''.join(t_)
if s_ == t_:
print('No')
exit()
L = [(s_, 0), (t_, 1)]
L.sort()
#print(L)
if L[0][1] == 0:
print('Yes')
else:
print('No')
| 31 | 22 | 482 | 290 | s = str(eval(input()))
t = str(eval(input()))
S = [0] * 26
T = [0] * 26
for i in range(len(s)):
c = ord(s[i]) - ord("a")
S[c] += 1
for i in range(len(t)):
c = ord(t[i]) - ord("a")
T[c] += 1
s_ = ""
for i in range(26):
s_ += chr(i + ord("a")) * S[i]
t_ = ""
for i in reversed(list(range(26))):
t_ ... | s = str(eval(input()))
t = str(eval(input()))
s_ = list(s)
s_.sort()
s_ = "".join(s_)
t_ = list(t)
t_.sort(reverse=True)
t_ = "".join(t_)
if s_ == t_:
print("No")
exit()
L = [(s_, 0), (t_, 1)]
L.sort()
# print(L)
if L[0][1] == 0:
print("Yes")
else:
print("No")
| false | 29.032258 | [
"-S = [0] * 26",
"-T = [0] * 26",
"-for i in range(len(s)):",
"- c = ord(s[i]) - ord(\"a\")",
"- S[c] += 1",
"-for i in range(len(t)):",
"- c = ord(t[i]) - ord(\"a\")",
"- T[c] += 1",
"-s_ = \"\"",
"-for i in range(26):",
"- s_ += chr(i + ord(\"a\")) * S[i]",
"-t_ = \"\"",
"-f... | false | 0.069505 | 0.04231 | 1.642748 | [
"s444703154",
"s810521056"
] |
u915355756 | p03072 | python | s610306743 | s245732566 | 283 | 18 | 21,512 | 2,940 | Accepted | Accepted | 93.64 | import numpy as np
#input
#N = 5
#H = [9,5,6,8,4]
N = int(eval(input()))
H = list(map(int,input().split()))
tmp = 0
for i in range(N):
if H[i] == max(H[0:i+1]):
tmp += 1
print(tmp)
|
#input
#N = 4
#H = [6, 5, 6, 8]
N = int(eval(input()))
H = list(map(int,input().split()))
tmp = H[0]
ans = 0
for i in range(N):
if H[i] >= tmp:
ans += 1
tmp = H[i]
print(ans)
| 12 | 14 | 199 | 204 | import numpy as np
# input
# N = 5
# H = [9,5,6,8,4]
N = int(eval(input()))
H = list(map(int, input().split()))
tmp = 0
for i in range(N):
if H[i] == max(H[0 : i + 1]):
tmp += 1
print(tmp)
| # input
# N = 4
# H = [6, 5, 6, 8]
N = int(eval(input()))
H = list(map(int, input().split()))
tmp = H[0]
ans = 0
for i in range(N):
if H[i] >= tmp:
ans += 1
tmp = H[i]
print(ans)
| false | 14.285714 | [
"-import numpy as np",
"-",
"-# N = 5",
"-# H = [9,5,6,8,4]",
"+# N = 4",
"+# H = [6, 5, 6, 8]",
"-tmp = 0",
"+tmp = H[0]",
"+ans = 0",
"- if H[i] == max(H[0 : i + 1]):",
"- tmp += 1",
"-print(tmp)",
"+ if H[i] >= tmp:",
"+ ans += 1",
"+ tmp = H[i]",
"+print(... | false | 0.053941 | 0.035975 | 1.499409 | [
"s610306743",
"s245732566"
] |
u500376440 | p03373 | python | s108570484 | s059812122 | 104 | 28 | 9,168 | 8,940 | Accepted | Accepted | 73.08 | A,B,C,X,Y=list(map(int,input().split()))
ans=10**12
for i in range(10**5+1):
temp=i*2*C+max(0,X-i)*A+max(0,Y-i)*B
ans=min(ans,temp)
print(ans)
| A,B,C,X,Y=list(map(int,input().split()))
ans=0
if 2*C<A+B:
Z=min(X,Y)
X-=Z
Y-=Z
ans+=2*C*Z
A=min(A,2*C)
B=min(B,2*C)
ans+=A*X
ans+=B*Y
print(ans)
| 6 | 12 | 146 | 159 | A, B, C, X, Y = list(map(int, input().split()))
ans = 10**12
for i in range(10**5 + 1):
temp = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B
ans = min(ans, temp)
print(ans)
| A, B, C, X, Y = list(map(int, input().split()))
ans = 0
if 2 * C < A + B:
Z = min(X, Y)
X -= Z
Y -= Z
ans += 2 * C * Z
A = min(A, 2 * C)
B = min(B, 2 * C)
ans += A * X
ans += B * Y
print(ans)
| false | 50 | [
"-ans = 10**12",
"-for i in range(10**5 + 1):",
"- temp = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B",
"- ans = min(ans, temp)",
"+ans = 0",
"+if 2 * C < A + B:",
"+ Z = min(X, Y)",
"+ X -= Z",
"+ Y -= Z",
"+ ans += 2 * C * Z",
"+A = min(A, 2 * C)",
"+B = min(B, 2 * C)... | false | 0.160458 | 0.04546 | 3.529672 | [
"s108570484",
"s059812122"
] |
u426683236 | p03290 | python | s095963363 | s403304357 | 224 | 188 | 41,712 | 40,560 | Accepted | Accepted | 16.07 | def solve():
inf = 1 << 60
D, G = list(map(int, input().split()))
p = [0]
c = [0]
for i in range(D):
pi, ci = list(map(int, input().split()))
p.append(pi)
c.append(ci)
sump = sum(p)
# dp[i][j] = 100i点の問題までで、j問解いて得られる最大の点数
dp = [[-inf for j in range(sump... | def solve():
inf = 1 << 60
D, G = list(map(int, input().split()))
p = []
c = []
for i in range(D):
pi, ci = list(map(int, input().split()))
p.append(pi)
c.append(ci)
bitD = 1 << D
min_cnt = inf
for b in range(bitD):
sc = 0
cnt = 0
... | 29 | 33 | 930 | 868 | def solve():
inf = 1 << 60
D, G = list(map(int, input().split()))
p = [0]
c = [0]
for i in range(D):
pi, ci = list(map(int, input().split()))
p.append(pi)
c.append(ci)
sump = sum(p)
# dp[i][j] = 100i点の問題までで、j問解いて得られる最大の点数
dp = [[-inf for j in range(sump + 1)] for ... | def solve():
inf = 1 << 60
D, G = list(map(int, input().split()))
p = []
c = []
for i in range(D):
pi, ci = list(map(int, input().split()))
p.append(pi)
c.append(ci)
bitD = 1 << D
min_cnt = inf
for b in range(bitD):
sc = 0
cnt = 0
for i in ... | false | 12.121212 | [
"- p = [0]",
"- c = [0]",
"+ p = []",
"+ c = []",
"- sump = sum(p)",
"- # dp[i][j] = 100i点の問題までで、j問解いて得られる最大の点数",
"- dp = [[-inf for j in range(sump + 1)] for i in range(D + 1)]",
"- dp[0][0] = 0",
"- for d in range(1, D + 1):",
"- for i in range(sump + 1):",
"-... | false | 0.044076 | 0.037792 | 1.166282 | [
"s095963363",
"s403304357"
] |
u161271485 | p03680 | python | s313166701 | s839593054 | 206 | 62 | 13,220 | 13,204 | Accepted | Accepted | 69.9 | def process(a):
tmp = a[0]
pushed = set()
cnt = 1
while not tmp in pushed:
if tmp == 2:
return cnt
pushed.add(tmp)
tmp = a[tmp - 1]
cnt += 1
return -1
if __name__ == '__main__':
a = [int(input().strip()) for _ in range(int(input().strip()... | import sys
def process(a):
tmp = a[1]
pushed = set()
cnt = 1
while not tmp in pushed:
if tmp == 2:
return cnt
pushed.add(tmp)
tmp = a[tmp]
cnt += 1
return -1
if __name__ == '__main__':
# a = [int(input().strip()) for _ in range(int(inp... | 15 | 18 | 346 | 393 | def process(a):
tmp = a[0]
pushed = set()
cnt = 1
while not tmp in pushed:
if tmp == 2:
return cnt
pushed.add(tmp)
tmp = a[tmp - 1]
cnt += 1
return -1
if __name__ == "__main__":
a = [int(input().strip()) for _ in range(int(input().strip()))]
prin... | import sys
def process(a):
tmp = a[1]
pushed = set()
cnt = 1
while not tmp in pushed:
if tmp == 2:
return cnt
pushed.add(tmp)
tmp = a[tmp]
cnt += 1
return -1
if __name__ == "__main__":
# a = [int(input().strip()) for _ in range(int(input().strip())... | false | 16.666667 | [
"+import sys",
"+",
"+",
"- tmp = a[0]",
"+ tmp = a[1]",
"- tmp = a[tmp - 1]",
"+ tmp = a[tmp]",
"- a = [int(input().strip()) for _ in range(int(input().strip()))]",
"+ # a = [int(input().strip()) for _ in range(int(input().strip()))]",
"+ a = list(map(int, sys.stdin))... | false | 0.047358 | 0.096231 | 0.492125 | [
"s313166701",
"s839593054"
] |
u519452411 | p03478 | python | s103609576 | s543709316 | 44 | 33 | 3,288 | 3,300 | Accepted | Accepted | 25 | n,a,b = [int(_) for _ in input().split()]
result = []
for i in range(1,n+1): # n=20のとき1~20を検査するよ
i = str(i)
wa = 0
for j in range(0,len(str(i))): # strとして認識するために、文字列は配列として0個目の文字列+1個目の文字列みたいに足し算をしていくよ
wa = wa + int(i[j])
if a <= wa <= b:
result.append(int(i))
print((sum(result))) | n,a,b = [int(_) for _ in input().split()]
result = []
for seisu in range(1,n+1):
wa = 0
first_seisu = seisu
while seisu != 0:
wa = wa + seisu % 10
seisu = int(seisu/10)
if a <= wa <= b:
result.append(first_seisu)
print((sum(result))) | 12 | 16 | 306 | 271 | n, a, b = [int(_) for _ in input().split()]
result = []
for i in range(1, n + 1): # n=20のとき1~20を検査するよ
i = str(i)
wa = 0
for j in range(
0, len(str(i))
): # strとして認識するために、文字列は配列として0個目の文字列+1個目の文字列みたいに足し算をしていくよ
wa = wa + int(i[j])
if a <= wa <= b:
result.append(int(i))
print((... | n, a, b = [int(_) for _ in input().split()]
result = []
for seisu in range(1, n + 1):
wa = 0
first_seisu = seisu
while seisu != 0:
wa = wa + seisu % 10
seisu = int(seisu / 10)
if a <= wa <= b:
result.append(first_seisu)
print((sum(result)))
| false | 25 | [
"-for i in range(1, n + 1): # n=20のとき1~20を検査するよ",
"- i = str(i)",
"+for seisu in range(1, n + 1):",
"- for j in range(",
"- 0, len(str(i))",
"- ): # strとして認識するために、文字列は配列として0個目の文字列+1個目の文字列みたいに足し算をしていくよ",
"- wa = wa + int(i[j])",
"+ first_seisu = seisu",
"+ while seisu !... | false | 0.039731 | 0.038754 | 1.025201 | [
"s103609576",
"s543709316"
] |
u471684875 | p03785 | python | s596849424 | s818004858 | 527 | 235 | 50,904 | 7,384 | Accepted | Accepted | 55.41 | n,c,k=list(map(int,input().split()))
t=[int(eval(input())) for i in range(n)]
t.sort()
ans=0
x=t[0]
y=0
for i in range(n-1):
y+=1
if t[i]-x>k:
ans+=1
x=t[i]
y=1
elif y==c:
ans+=1
x=t[i+1]
y=0
print((ans+2 if t[-1]-x>k else ans+1)) | n,c,k=list(map(int,input().split()))
t=[int(eval(input())) for i in range(n)]
t.sort()
ans=1
x=t[0]
y=0
for i in range(n-1):
y+=1
if t[i]-x>k:
ans+=1
x=t[i]
y=1
elif y==c:
ans+=1
x=t[i+1]
y=0
print((ans+1 if t[-1]-x>k else ans)) | 17 | 17 | 292 | 290 | n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for i in range(n)]
t.sort()
ans = 0
x = t[0]
y = 0
for i in range(n - 1):
y += 1
if t[i] - x > k:
ans += 1
x = t[i]
y = 1
elif y == c:
ans += 1
x = t[i + 1]
y = 0
print((ans + 2 if t[-1] - x > k... | n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for i in range(n)]
t.sort()
ans = 1
x = t[0]
y = 0
for i in range(n - 1):
y += 1
if t[i] - x > k:
ans += 1
x = t[i]
y = 1
elif y == c:
ans += 1
x = t[i + 1]
y = 0
print((ans + 1 if t[-1] - x > k... | false | 0 | [
"-ans = 0",
"+ans = 1",
"-print((ans + 2 if t[-1] - x > k else ans + 1))",
"+print((ans + 1 if t[-1] - x > k else ans))"
] | false | 0.0369 | 0.037297 | 0.989343 | [
"s596849424",
"s818004858"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.