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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u109617871 | p03854 | python | s881155366 | s963760497 | 1,862 | 92 | 3,484 | 3,316 | Accepted | Accepted | 95.06 | given = ["dreamer", "dream", "eraser", "erase"]
S = eval(input())
while len(S) > 0:
tmp = S
for i in given:
if S.endswith(i):
S = S[::-1].replace(i[::-1], "", 1)[::-1]
if len(S) == 0:
print("YES")
break
if tmp == S:
print("NO... | given = ["dreamer", "dream", "eraser", "erase"]
S = eval(input())
while len(S) > 0:
judge = [S.endswith(i) for i in given]
if any(judge):
target = given[judge.index(True)]
S = S[:-len(target)]
if len(S) == 0:
print("YES")
break
else:
print("... | 13 | 13 | 331 | 333 | given = ["dreamer", "dream", "eraser", "erase"]
S = eval(input())
while len(S) > 0:
tmp = S
for i in given:
if S.endswith(i):
S = S[::-1].replace(i[::-1], "", 1)[::-1]
if len(S) == 0:
print("YES")
break
if tmp == S:
print("NO")
... | given = ["dreamer", "dream", "eraser", "erase"]
S = eval(input())
while len(S) > 0:
judge = [S.endswith(i) for i in given]
if any(judge):
target = given[judge.index(True)]
S = S[: -len(target)]
if len(S) == 0:
print("YES")
break
else:
print("NO")
... | false | 0 | [
"- tmp = S",
"- for i in given:",
"- if S.endswith(i):",
"- S = S[::-1].replace(i[::-1], \"\", 1)[::-1]",
"- if len(S) == 0:",
"- print(\"YES\")",
"- break",
"- if tmp == S:",
"+ judge = [S.endswith(i) for i in given]",
"+ i... | false | 0.038197 | 0.039411 | 0.969176 | [
"s881155366",
"s963760497"
] |
u992910889 | p03208 | python | s785201896 | s386279830 | 541 | 254 | 51,160 | 45,148 | Accepted | Accepted | 53.05 | def resolve():
N,K=list(map(int,input().split()))
H=sorted([int(eval(input())) for i in range(N)])
ans=10**20
for i in range(N-K+1):
ans=min(H[i+K-1]-H[i], ans)
print(ans)
resolve()
| import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
n,k=list(map(int,input().split()))
h=sorted([int(eval(input())) for i in range(n)])
ans=10**20
for i in range(n-k+1):
ans=min(ans,h[i+k-1]-h[i])
print(ans)
resolve() | 9 | 14 | 207 | 308 | def resolve():
N, K = list(map(int, input().split()))
H = sorted([int(eval(input())) for i in range(N)])
ans = 10**20
for i in range(N - K + 1):
ans = min(H[i + K - 1] - H[i], ans)
print(ans)
resolve()
| import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
n, k = list(map(int, input().split()))
h = sorted([int(eval(input())) for i in range(n)])
ans = 10**20
for i in range(n - k + 1):
ans = min(ans, h[i + k - 1] - h[i])
print(an... | false | 35.714286 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**5 + 10)",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"- N, K = list(map(int, input().split()))",
"- H = sorted([int(eval(input())) for i in range(N)])",
"+ n, k = list(map(int, input().split()))",
... | false | 0.035731 | 0.036493 | 0.979114 | [
"s785201896",
"s386279830"
] |
u182898140 | p02723 | python | s861029636 | s097068999 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | S=str(eval(input()))
if S[2]==S[3] and S[4]==S[5]:
print('Yes')
else:
print('No') | s=str(eval(input()))
if s[2]==s[3] and s[4]==s[5]:
print('Yes')
else:
print('No') | 6 | 5 | 85 | 83 | S = str(eval(input()))
if S[2] == S[3] and S[4] == S[5]:
print("Yes")
else:
print("No")
| s = str(eval(input()))
if s[2] == s[3] and s[4] == s[5]:
print("Yes")
else:
print("No")
| false | 16.666667 | [
"-S = str(eval(input()))",
"-if S[2] == S[3] and S[4] == S[5]:",
"+s = str(eval(input()))",
"+if s[2] == s[3] and s[4] == s[5]:"
] | false | 0.042589 | 0.043148 | 0.987053 | [
"s861029636",
"s097068999"
] |
u571281863 | p02629 | python | s098309760 | s112251826 | 34 | 29 | 9,104 | 9,108 | Accepted | Accepted | 14.71 | alphabet='abcdefghijklmnopqrstuvwxyz'
N=int(eval(input()))
r=[]
while N>26:
x=N%26
N=N//26
if x==0:
N-=1
x=26
r.append(x)
r.append(N)
name=[alphabet[i-1] for i in r]
name.reverse()
name=''.join(name)
print(name) | alphabet='abcdefghijklmnopqrstuvwxyz'
N=int(eval(input()))
name=''
while N>0:
N-=1
name+=alphabet[N%26]
N//=26
print((name[::-1])) | 15 | 8 | 239 | 135 | alphabet = "abcdefghijklmnopqrstuvwxyz"
N = int(eval(input()))
r = []
while N > 26:
x = N % 26
N = N // 26
if x == 0:
N -= 1
x = 26
r.append(x)
r.append(N)
name = [alphabet[i - 1] for i in r]
name.reverse()
name = "".join(name)
print(name)
| alphabet = "abcdefghijklmnopqrstuvwxyz"
N = int(eval(input()))
name = ""
while N > 0:
N -= 1
name += alphabet[N % 26]
N //= 26
print((name[::-1]))
| false | 46.666667 | [
"-r = []",
"-while N > 26:",
"- x = N % 26",
"- N = N // 26",
"- if x == 0:",
"- N -= 1",
"- x = 26",
"- r.append(x)",
"-r.append(N)",
"-name = [alphabet[i - 1] for i in r]",
"-name.reverse()",
"-name = \"\".join(name)",
"-print(name)",
"+name = \"\"",
"+while N... | false | 0.044973 | 0.08406 | 0.535008 | [
"s098309760",
"s112251826"
] |
u159723084 | p02550 | python | s953724712 | s320327037 | 81 | 55 | 15,972 | 12,152 | Accepted | Accepted | 32.1 | # -*- coding: utf-8 -*-
N,X,M=list(map(int,input().split()))
A=[0]*10**5
A[0]=X
D=dict()
#A=[X]
s=N
for i in range(1,N):
a=A[i-1]**2%M
if a in D:
s=A.index(a)
break
else:
#A.append(a)
A[i]=a
D[a]=0
if s==N:
ans=sum(A)
else:
A=A[:i]
... | # -*- coding: utf-8 -*-
N,X,M=list(map(int,input().split()))
A=[0]*(M+1)
A[0]=X
D=[0]*(M+1)
s=N
for i in range(1,N):
a=A[i-1]**2%M
if D[a] == 1:
s=A.index(a)
break
else:
A[i]=a
D[a]=1
if s==N:
ans=sum(A)
else:
A=A[:i]
ans=0
l=l... | 41 | 34 | 613 | 448 | # -*- coding: utf-8 -*-
N, X, M = list(map(int, input().split()))
A = [0] * 10**5
A[0] = X
D = dict()
# A=[X]
s = N
for i in range(1, N):
a = A[i - 1] ** 2 % M
if a in D:
s = A.index(a)
break
else:
# A.append(a)
A[i] = a
D[a] = 0
if s == N:
ans = sum(A)
else:
... | # -*- coding: utf-8 -*-
N, X, M = list(map(int, input().split()))
A = [0] * (M + 1)
A[0] = X
D = [0] * (M + 1)
s = N
for i in range(1, N):
a = A[i - 1] ** 2 % M
if D[a] == 1:
s = A.index(a)
break
else:
A[i] = a
D[a] = 1
if s == N:
ans = sum(A)
else:
A = A[:i]
ans ... | false | 17.073171 | [
"-A = [0] * 10**5",
"+A = [0] * (M + 1)",
"-D = dict()",
"-# A=[X]",
"+D = [0] * (M + 1)",
"- if a in D:",
"+ if D[a] == 1:",
"- # A.append(a)",
"- D[a] = 0",
"+ D[a] = 1",
"- Z = [0] * (len(A) + 1)",
"- for i in range(1, len(A) + 1):",
"- Z[i] = Z[i -... | false | 0.03505 | 0.199246 | 0.175915 | [
"s953724712",
"s320327037"
] |
u077291787 | p02707 | python | s243863101 | s385386858 | 150 | 109 | 43,788 | 34,868 | Accepted | Accepted | 27.33 | # C - management
from collections import Counter
def main():
N, *A = list(map(int, open(0).read().split()))
cnt_subordinates = Counter(A)
ans = [cnt_subordinates[i] for i in range(1, N + 1)]
print(("\n".join(map(str, ans))))
if __name__ == "__main__":
main()
| # C - management
def main():
N, *A = list(map(int, open(0).read().split()))
cnt_subordinates = [0] * (N + 1)
for a in A:
cnt_subordinates[a] += 1
print(("\n".join(map(str, cnt_subordinates[1:]))))
if __name__ == "__main__":
main()
| 13 | 11 | 287 | 263 | # C - management
from collections import Counter
def main():
N, *A = list(map(int, open(0).read().split()))
cnt_subordinates = Counter(A)
ans = [cnt_subordinates[i] for i in range(1, N + 1)]
print(("\n".join(map(str, ans))))
if __name__ == "__main__":
main()
| # C - management
def main():
N, *A = list(map(int, open(0).read().split()))
cnt_subordinates = [0] * (N + 1)
for a in A:
cnt_subordinates[a] += 1
print(("\n".join(map(str, cnt_subordinates[1:]))))
if __name__ == "__main__":
main()
| false | 15.384615 | [
"-from collections import Counter",
"-",
"-",
"- cnt_subordinates = Counter(A)",
"- ans = [cnt_subordinates[i] for i in range(1, N + 1)]",
"- print((\"\\n\".join(map(str, ans))))",
"+ cnt_subordinates = [0] * (N + 1)",
"+ for a in A:",
"+ cnt_subordinates[a] += 1",
"+ prin... | false | 0.035315 | 0.102487 | 0.344579 | [
"s243863101",
"s385386858"
] |
u083960235 | p02897 | python | s429817178 | s036793182 | 105 | 26 | 6,084 | 3,896 | Accepted | Accepted | 75.24 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 27 | 28 | 829 | 854 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 3.571429 | [
"-from fractions import gcd",
"+from heapq import heapify, heappop, heappush",
"-n = INT()",
"-if n % 2 == 0:",
"- print((0.5))",
"-if n % 2 != 0:",
"- a = n // 2",
"- b = n // 2 + 1",
"- print((b / n))",
"+N = INT()",
"+if N % 2 == 0:",
"+ print((1 / 2))",
"+else:",
"+ e... | false | 0.075722 | 0.036268 | 2.087875 | [
"s429817178",
"s036793182"
] |
u595375942 | p02614 | python | s493785937 | s853919749 | 138 | 68 | 9,368 | 9,160 | Accepted | Accepted | 50.72 | from itertools import combinations
import copy
H, W, K = list(map(int, input().split()))
C = [list(eval(input())) for _ in range(H)]
ans = 0
w = list(range(W))
h = list(range(H))
for i in range(W+1):
for comi in combinations(w, i):
for j in range(H+1):
for comj in combinations(h, j... | H, W, K = list(map(int, input().split()))
C = [list(eval(input())) for _ in range(H)]
ans = 0
for maskR in range(1 << H):
for maskC in range(1 << W):
black = 0
for i in range(H):
for j in range(W):
if ((maskR >> i) & 1) == 0 and ((maskC >> j) & 1) == 0 and C[i][j]... | 27 | 13 | 761 | 406 | from itertools import combinations
import copy
H, W, K = list(map(int, input().split()))
C = [list(eval(input())) for _ in range(H)]
ans = 0
w = list(range(W))
h = list(range(H))
for i in range(W + 1):
for comi in combinations(w, i):
for j in range(H + 1):
for comj in combinations(h, j):
... | H, W, K = list(map(int, input().split()))
C = [list(eval(input())) for _ in range(H)]
ans = 0
for maskR in range(1 << H):
for maskC in range(1 << W):
black = 0
for i in range(H):
for j in range(W):
if (
((maskR >> i) & 1) == 0
and (... | false | 51.851852 | [
"-from itertools import combinations",
"-import copy",
"-",
"-w = list(range(W))",
"-h = list(range(H))",
"-for i in range(W + 1):",
"- for comi in combinations(w, i):",
"- for j in range(H + 1):",
"- for comj in combinations(h, j):",
"- tmpC = copy.deepcopy(C)"... | false | 0.044808 | 0.076657 | 0.584528 | [
"s493785937",
"s853919749"
] |
u504836877 | p02948 | python | s470392906 | s618083249 | 697 | 596 | 35,296 | 25,452 | Accepted | Accepted | 14.49 | N,M = list(map(int, input().split()))
L = [[int(a) for a in input().split()] for _ in range(N)]
import heapq
L.sort()
h = []
ans = [0]*(M)
i = 0
j = 0
d = 0
while i < M and d < M:
i += 1
while j < N and L[j][0] <= i:
heapq.heappush(h, [-L[j][1], L[j][0]])
j += 1
if h:
... | N,M = list(map(int, input().split()))
L = [[int(l) for l in input().split()] for _ in range(N)]
import heapq
h = []
ans = 0
L.sort()
m = 1
i = 0
while i < N and L[i][0] <= M:
if L[i][0] == m:
heapq.heappush(h, -L[i][1])
i += 1
else:
m += 1
if h:
ans -... | 28 | 21 | 513 | 406 | N, M = list(map(int, input().split()))
L = [[int(a) for a in input().split()] for _ in range(N)]
import heapq
L.sort()
h = []
ans = [0] * (M)
i = 0
j = 0
d = 0
while i < M and d < M:
i += 1
while j < N and L[j][0] <= i:
heapq.heappush(h, [-L[j][1], L[j][0]])
j += 1
if h:
temp = heap... | N, M = list(map(int, input().split()))
L = [[int(l) for l in input().split()] for _ in range(N)]
import heapq
h = []
ans = 0
L.sort()
m = 1
i = 0
while i < N and L[i][0] <= M:
if L[i][0] == m:
heapq.heappush(h, -L[i][1])
i += 1
else:
m += 1
if h:
ans -= heapq.heappop... | false | 25 | [
"-L = [[int(a) for a in input().split()] for _ in range(N)]",
"+L = [[int(l) for l in input().split()] for _ in range(N)]",
"+h = []",
"+ans = 0",
"-h = []",
"-ans = [0] * (M)",
"+m = 1",
"-j = 0",
"-d = 0",
"-while i < M and d < M:",
"- i += 1",
"- while j < N and L[j][0] <= i:",
"- ... | false | 0.039546 | 0.036794 | 1.074798 | [
"s470392906",
"s618083249"
] |
u165429863 | p02651 | python | s381425429 | s038217250 | 140 | 81 | 9,192 | 9,064 | Accepted | Accepted | 42.14 | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = list(map(int,input().split()))
S = eval(input())
if S[-1] == '1':
print((1))
continue
list0 = [0] * 64
for a, s in zip(A[::-1], S[::-1]):
blen = a.bit_length()
for i in range(b... | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = list(map(int,input().split()))
S = eval(input())
list0 = [0] * 64
for a, s in zip(A[::-1], S[::-1]):
if s == '1':
while a:
b = a.bit_length() - 1
if list0[b]:
... | 32 | 35 | 662 | 728 | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = list(map(int, input().split()))
S = eval(input())
if S[-1] == "1":
print((1))
continue
list0 = [0] * 64
for a, s in zip(A[::-1], S[::-1]):
blen = a.bit_length()
for i in range(blen, 0, -1):
... | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = list(map(int, input().split()))
S = eval(input())
list0 = [0] * 64
for a, s in zip(A[::-1], S[::-1]):
if s == "1":
while a:
b = a.bit_length() - 1
if list0[b]:
... | false | 8.571429 | [
"- if S[-1] == \"1\":",
"- print((1))",
"- continue",
"- blen = a.bit_length()",
"- for i in range(blen, 0, -1):",
"- if a.bit_length() < i:",
"- continue",
"- if list0[i - 1]:",
"- a ^= list0[i - 1]",
"- ... | false | 0.038413 | 0.038484 | 0.998153 | [
"s381425429",
"s038217250"
] |
u312025627 | p03387 | python | s041967589 | s087239549 | 165 | 17 | 38,256 | 3,060 | Accepted | Accepted | 89.7 | def main():
A = [int(i) for i in input().split()]
A.sort()
B = [A[2]-A[1], A[2]-A[0]]
ans = 0
if B[0] % 2 == B[1] % 2:
ans = (B[0]+B[1])//2
else:
ans = 0--(B[0]+B[1])//2 + 1
print(ans)
if __name__ == '__main__':
main()
| def main():
A = [int(i) for i in input().split()]
A.sort()
B = [A[2] - A[0], A[2] - A[1]]
ans = 0
if B[0] % 2 == B[1] % 2:
ans = (B[0]+B[1])//2
else:
ans = 0--(B[0]+B[1])//2 + 1
print(ans)
if __name__ == '__main__':
main()
| 14 | 14 | 282 | 286 | def main():
A = [int(i) for i in input().split()]
A.sort()
B = [A[2] - A[1], A[2] - A[0]]
ans = 0
if B[0] % 2 == B[1] % 2:
ans = (B[0] + B[1]) // 2
else:
ans = 0 - -(B[0] + B[1]) // 2 + 1
print(ans)
if __name__ == "__main__":
main()
| def main():
A = [int(i) for i in input().split()]
A.sort()
B = [A[2] - A[0], A[2] - A[1]]
ans = 0
if B[0] % 2 == B[1] % 2:
ans = (B[0] + B[1]) // 2
else:
ans = 0 - -(B[0] + B[1]) // 2 + 1
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- B = [A[2] - A[1], A[2] - A[0]]",
"+ B = [A[2] - A[0], A[2] - A[1]]"
] | false | 0.038367 | 0.039017 | 0.983335 | [
"s041967589",
"s087239549"
] |
u060938295 | p02922 | python | s106403303 | s592841414 | 21 | 19 | 3,060 | 3,316 | Accepted | Accepted | 9.52 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 1 20:21:49 2019
@author: Yamazaki Kenichi
"""
A, B = list(map(int,input().split()))
ans = (B-A-1)//(A-1) + 1 + 1
print(ans)
| A, B = list(map(int,input().split()))
ans = (B-1-1)//(A-1)+1
print(ans) | 14 | 4 | 193 | 69 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 1 20:21:49 2019
@author: Yamazaki Kenichi
"""
A, B = list(map(int, input().split()))
ans = (B - A - 1) // (A - 1) + 1 + 1
print(ans)
| A, B = list(map(int, input().split()))
ans = (B - 1 - 1) // (A - 1) + 1
print(ans)
| false | 71.428571 | [
"-# -*- coding: utf-8 -*-",
"-\"\"\"",
"-Created on Sun Sep 1 20:21:49 2019",
"-@author: Yamazaki Kenichi",
"-\"\"\"",
"-ans = (B - A - 1) // (A - 1) + 1 + 1",
"+ans = (B - 1 - 1) // (A - 1) + 1"
] | false | 0.081935 | 0.121278 | 0.675593 | [
"s106403303",
"s592841414"
] |
u281303342 | p04000 | python | s823039296 | s408544315 | 2,446 | 1,926 | 245,744 | 166,500 | Accepted | Accepted | 21.26 | from collections import Counter
H,W,N = list(map(int,input().split()))
Bs = []
for i in range(N):
x,y = list(map(int,input().split()))
for xx in range(3):
for yy in range(3):
tx,ty = x-xx,y-yy
if 1<=tx and tx<=H-2 and 1<=ty and ty<=W-2:
Bs.append((tx,ty))... | H,W,N = list(map(int,input().split()))
dic = {}
for i in range(N):
a,b = list(map(int,input().split()))
for dh in range(3):
for dw in range(3):
if 0<a-dh<=H-2 and 0<b-dw<=W-2:
if (a-dh,b-dw) not in list(dic.keys()):
dic[(a-dh,b-dw)] = 1
... | 17 | 23 | 449 | 510 | from collections import Counter
H, W, N = list(map(int, input().split()))
Bs = []
for i in range(N):
x, y = list(map(int, input().split()))
for xx in range(3):
for yy in range(3):
tx, ty = x - xx, y - yy
if 1 <= tx and tx <= H - 2 and 1 <= ty and ty <= W - 2:
Bs.... | H, W, N = list(map(int, input().split()))
dic = {}
for i in range(N):
a, b = list(map(int, input().split()))
for dh in range(3):
for dw in range(3):
if 0 < a - dh <= H - 2 and 0 < b - dw <= W - 2:
if (a - dh, b - dw) not in list(dic.keys()):
dic[(a - dh, b... | false | 26.086957 | [
"-from collections import Counter",
"-",
"-Bs = []",
"+dic = {}",
"- x, y = list(map(int, input().split()))",
"- for xx in range(3):",
"- for yy in range(3):",
"- tx, ty = x - xx, y - yy",
"- if 1 <= tx and tx <= H - 2 and 1 <= ty and ty <= W - 2:",
"- ... | false | 0.049722 | 0.048517 | 1.024826 | [
"s823039296",
"s408544315"
] |
u440566786 | p02913 | python | s301456212 | s397245158 | 960 | 566 | 54,468 | 48,092 | Accepted | Accepted | 41.04 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class SuffixArray(object):
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
lcp: O(1)
"""
def __i... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def Z(s):
"""
s: str
return list of int with length len(s)
"""
# initialization
n=len(s)
z=[0]*n
z[0]=n
# construct
L,R=0,0
for i in range(1,n... | 94 | 39 | 2,547 | 862 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class SuffixArray(object):
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
lcp: O(1)
"""
def __ini... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def Z(s):
"""
s: str
return list of int with length len(s)
"""
# initialization
n = len(s)
z = [0] * n
z[0] = n
# construct
L, R = 0, 0
for i in ra... | false | 58.510638 | [
"-class SuffixArray(object):",
"+def Z(s):",
"- construct:",
"- suffix array: O(N(logN)^2)",
"- lcp array: O(N)",
"- sparse table: O(NlogN)",
"- query:",
"- lcp: O(1)",
"+ s: str",
"+ return list of int with length len(s)",
"-",
"- def __init__(self, ... | false | 0.043271 | 0.041647 | 1.039007 | [
"s301456212",
"s397245158"
] |
u907414670 | p02773 | python | s433461968 | s891198967 | 973 | 880 | 46,840 | 46,872 | Accepted | Accepted | 9.56 | from collections import Counter
n = int(eval(input()))
s_list = []
for i in range(n):
s_list.append(eval(input()))
s_list.sort()
c = Counter(s_list)
l = c.most_common()
count = l[0][1]
l.sort()
for i in l:
if count == i[1]:
print((i[0])) | from collections import Counter
n = int(eval(input()))
s_list = []
for i in range(n):
s_list.append(eval(input()))
#s_list.sort()
c = Counter(s_list)
l = c.most_common()
count = l[0][1]
l.sort()
for i in l:
if count == i[1]:
print((i[0])) | 16 | 16 | 261 | 262 | from collections import Counter
n = int(eval(input()))
s_list = []
for i in range(n):
s_list.append(eval(input()))
s_list.sort()
c = Counter(s_list)
l = c.most_common()
count = l[0][1]
l.sort()
for i in l:
if count == i[1]:
print((i[0]))
| from collections import Counter
n = int(eval(input()))
s_list = []
for i in range(n):
s_list.append(eval(input()))
# s_list.sort()
c = Counter(s_list)
l = c.most_common()
count = l[0][1]
l.sort()
for i in l:
if count == i[1]:
print((i[0]))
| false | 0 | [
"-s_list.sort()",
"+# s_list.sort()"
] | false | 0.035408 | 0.037025 | 0.956325 | [
"s433461968",
"s891198967"
] |
u633068244 | p00729 | python | s773856311 | s511116701 | 4,910 | 1,810 | 20,908 | 161,296 | Accepted | Accepted | 63.14 | while 1:
N,M = list(map(int,input().split()))
if N == 0: break
T = [[0]*1261 for i in range(N)]
r = eval(input())
tnms = sorted([list(map(int,input().split())) for i in range(r)], key = lambda x:x[1])
for i in range(0,r,2):
t1,n,m,s = tnms[i]
t2,n,m,s = tnms[i+1]
T[n-1][t1:t2] = [m for j in range(t... | while 1:
N,M = list(map(int,input().split()))
if N == 0: break
T = [[0]*1261 for i in range(M)]
r = eval(input())
tnms = sorted([list(map(int,input().split())) for i in range(r)], key = lambda x:x[1])
for i in range(0,r,2):
t1,n,m,s = tnms[i]
t2,n,m,s = tnms[i+1]
T[m-1][t1:t2] = [1 for j in range(t... | 14 | 13 | 472 | 413 | while 1:
N, M = list(map(int, input().split()))
if N == 0:
break
T = [[0] * 1261 for i in range(N)]
r = eval(input())
tnms = sorted(
[list(map(int, input().split())) for i in range(r)], key=lambda x: x[1]
)
for i in range(0, r, 2):
t1, n, m, s = tnms[i]
t2, n,... | while 1:
N, M = list(map(int, input().split()))
if N == 0:
break
T = [[0] * 1261 for i in range(M)]
r = eval(input())
tnms = sorted(
[list(map(int, input().split())) for i in range(r)], key=lambda x: x[1]
)
for i in range(0, r, 2):
t1, n, m, s = tnms[i]
t2, n,... | false | 7.142857 | [
"- T = [[0] * 1261 for i in range(N)]",
"+ T = [[0] * 1261 for i in range(M)]",
"- T[n - 1][t1:t2] = [m for j in range(t1, t2)]",
"+ T[m - 1][t1:t2] = [1 for j in range(t1, t2)]",
"- print(",
"- sum(1 if any(T[n][t] == m for n in range(N)) else 0 for t in range(ts, te... | false | 0.039934 | 0.036932 | 1.081265 | [
"s773856311",
"s511116701"
] |
u497046426 | p02756 | python | s033457994 | s919356570 | 1,617 | 500 | 4,516 | 4,468 | Accepted | Accepted | 69.08 | S = eval(input())
Q = int(eval(input()))
pre, suf = '', ''
rev = False
for _ in range(Q):
query = input().split()
if query[0] == '1':
rev ^= 1
else:
f, c = query[1:]
if (f == '1' and not rev) or (f == '2' and rev): pre = c + pre
else: suf = suf + c
print((pre + S ... | S = eval(input())
Q = int(eval(input()))
pre_rev, suf = '', ''
rev = False
for _ in range(Q):
query = input().split()
if query[0] == '1':
rev ^= 1
else:
f, c = query[1:]
if (f == '1' and not rev) or (f == '2' and rev): pre_rev = pre_rev + c
else: suf = suf + c
pri... | 13 | 13 | 351 | 377 | S = eval(input())
Q = int(eval(input()))
pre, suf = "", ""
rev = False
for _ in range(Q):
query = input().split()
if query[0] == "1":
rev ^= 1
else:
f, c = query[1:]
if (f == "1" and not rev) or (f == "2" and rev):
pre = c + pre
else:
suf = suf + c
pri... | S = eval(input())
Q = int(eval(input()))
pre_rev, suf = "", ""
rev = False
for _ in range(Q):
query = input().split()
if query[0] == "1":
rev ^= 1
else:
f, c = query[1:]
if (f == "1" and not rev) or (f == "2" and rev):
pre_rev = pre_rev + c
else:
suf =... | false | 0 | [
"-pre, suf = \"\", \"\"",
"+pre_rev, suf = \"\", \"\"",
"- pre = c + pre",
"+ pre_rev = pre_rev + c",
"-print((pre + S + suf if not rev else (pre + S + suf)[::-1]))",
"+print((pre_rev[::-1] + S + suf if not rev else (S + suf)[::-1] + pre_rev))"
] | false | 0.036651 | 0.033328 | 1.0997 | [
"s033457994",
"s919356570"
] |
u241159583 | p03273 | python | s703103197 | s894958066 | 36 | 21 | 3,188 | 3,188 | Accepted | Accepted | 41.67 | H, W = list(map(int, input().split()))
a = list(eval(input()) for _ in range(H))
h = []
w = []
w_list = []
for i in range(H):
if a[i] == "." * W:
h.append(i)
for j in range(W):
if a[i][j] == ".":
w.append(j)
w_set = list(set(w))
for x in range(len(w_set)):
if w.count(w_set[x]) == H:... | H, W = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(H)]
b = [list(x) for x in zip(*a)]
n = []
for i in range(W):
if b[i] == ["."] * H:
n.append(i)
for A in a:
if A == ["."] * W: continue
if len(n) == 0:
print(("".join(A)))
continue
ans = ""
for i in ... | 25 | 20 | 479 | 380 | H, W = list(map(int, input().split()))
a = list(eval(input()) for _ in range(H))
h = []
w = []
w_list = []
for i in range(H):
if a[i] == "." * W:
h.append(i)
for j in range(W):
if a[i][j] == ".":
w.append(j)
w_set = list(set(w))
for x in range(len(w_set)):
if w.count(w_set[x]) ==... | H, W = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(H)]
b = [list(x) for x in zip(*a)]
n = []
for i in range(W):
if b[i] == ["."] * H:
n.append(i)
for A in a:
if A == ["."] * W:
continue
if len(n) == 0:
print(("".join(A)))
continue
ans = ""
... | false | 20 | [
"-a = list(eval(input()) for _ in range(H))",
"-h = []",
"-w = []",
"-w_list = []",
"-for i in range(H):",
"- if a[i] == \".\" * W:",
"- h.append(i)",
"- for j in range(W):",
"- if a[i][j] == \".\":",
"- w.append(j)",
"-w_set = list(set(w))",
"-for x in range(len... | false | 0.042353 | 0.132742 | 0.31906 | [
"s703103197",
"s894958066"
] |
u503227287 | p02553 | python | s764088690 | s061823031 | 87 | 74 | 61,740 | 61,588 | Accepted | Accepted | 14.94 | from sys import stdin
def main():
_in = [_.rstrip() for _ in stdin.readlines()]
a, b, c, d = list(map(int, _in[0].split(' '))) # type:list(int)
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cnt = -float('inf')
cnt = max(cnt, a * c)
cnt = max(cnt, a * d)
cnt = max(cnt, b ... | from sys import stdin
def main():
_in = [_.rstrip() for _ in stdin.readlines()]
a, b, c, d = list(map(int, _in[0].split(' '))) # type:list(int)
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
ans = -float('inf')
for _ in [a * c, a * d, b * c, b * d]:
ans = max(ans, _)
... | 19 | 16 | 486 | 434 | from sys import stdin
def main():
_in = [_.rstrip() for _ in stdin.readlines()]
a, b, c, d = list(map(int, _in[0].split(" "))) # type:list(int)
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cnt = -float("inf")
cnt = max(cnt, a * c)
cnt = max(cnt, a * d)
cnt = max(cnt, b * c)
c... | from sys import stdin
def main():
_in = [_.rstrip() for _ in stdin.readlines()]
a, b, c, d = list(map(int, _in[0].split(" "))) # type:list(int)
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
ans = -float("inf")
for _ in [a * c, a * d, b * c, b * d]:
ans = max(ans, _)
# ^^^^^^^^... | false | 15.789474 | [
"- cnt = -float(\"inf\")",
"- cnt = max(cnt, a * c)",
"- cnt = max(cnt, a * d)",
"- cnt = max(cnt, b * c)",
"- cnt = max(cnt, b * d)",
"- ans = cnt",
"+ ans = -float(\"inf\")",
"+ for _ in [a * c, a * d, b * c, b * d]:",
"+ ans = max(ans, _)"
] | false | 0.037992 | 0.036145 | 1.051101 | [
"s764088690",
"s061823031"
] |
u596276291 | p03779 | python | s984315830 | s534673565 | 33 | 26 | 3,444 | 3,316 | Accepted | Accepted | 21.21 | from collections import defaultdict
# 初項a,交差dの数列n個の和
def arithmetic_series(a, d, n):
return n * (2 * a + (n - 1) * d) // 2
def main():
X = int(eval(input()))
for i in range(10 ** 9):
if X <= arithmetic_series(1, 1, i):
print(i)
return
if __name__ == '__m... | from collections import defaultdict
def main():
X = int(eval(input()))
for i in range(0, X + 1):
if (1 + i) * i // 2 >= X:
print(i)
return
print(X)
if __name__ == '__main__':
main()
| 18 | 14 | 334 | 241 | from collections import defaultdict
# 初項a,交差dの数列n個の和
def arithmetic_series(a, d, n):
return n * (2 * a + (n - 1) * d) // 2
def main():
X = int(eval(input()))
for i in range(10**9):
if X <= arithmetic_series(1, 1, i):
print(i)
return
if __name__ == "__main__":
main()
| from collections import defaultdict
def main():
X = int(eval(input()))
for i in range(0, X + 1):
if (1 + i) * i // 2 >= X:
print(i)
return
print(X)
if __name__ == "__main__":
main()
| false | 22.222222 | [
"-",
"-# 初項a,交差dの数列n個の和",
"-def arithmetic_series(a, d, n):",
"- return n * (2 * a + (n - 1) * d) // 2",
"- for i in range(10**9):",
"- if X <= arithmetic_series(1, 1, i):",
"+ for i in range(0, X + 1):",
"+ if (1 + i) * i // 2 >= X:",
"+ print(X)"
] | false | 0.119657 | 0.041927 | 2.853956 | [
"s984315830",
"s534673565"
] |
u577579003 | p03061 | python | s033801460 | s816146698 | 235 | 204 | 14,584 | 16,148 | Accepted | Accepted | 13.19 | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a,b):
if b==0:return a
return gcd(b, a%b)
L = A.copy()
R = A.copy()
for i in range(1, N):
L[i] = gcd(L[i-1], L[i])
for i in reversed(list(range(0, N-1))):
R[i] = gcd(R[i+1], R[i])
result = max(R[1],L[-2])
for i in r... | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
#def gcd(a,b):
# if b==0:return a
# return gcd(b, a%b)
L = A.copy()
R = A.copy()
for i in range(1, N):
L[i] = gcd(L[i-1], L[i])
for i in reversed(list(range(0, N-1))):
R[i] = gcd(R[i+1], R[i])
# 端っこをぬか... | 20 | 26 | 383 | 490 | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
L = A.copy()
R = A.copy()
for i in range(1, N):
L[i] = gcd(L[i - 1], L[i])
for i in reversed(list(range(0, N - 1))):
R[i] = gcd(R[i + 1], R[i])
result = max(R[1], L[-2])
for i i... | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
# def gcd(a,b):
# if b==0:return a
# return gcd(b, a%b)
L = A.copy()
R = A.copy()
for i in range(1, N):
L[i] = gcd(L[i - 1], L[i])
for i in reversed(list(range(0, N - 1))):
R[i] = gcd(R[i + 1], R[i])
# 端っこをぬかした条件
# A[0 ... | false | 23.076923 | [
"+from fractions import gcd",
"+",
"-",
"-",
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- return gcd(b, a % b)",
"-",
"-",
"+# def gcd(a,b):",
"+# if b==0:return a",
"+# return gcd(b, a%b)",
"+# 端っこをぬかした条件",
"+# A[0 ]ぬかした場合, R[ 1]",
"+# A[N-1]ぬかした場合, L[-2]",
... | false | 0.035603 | 0.048565 | 0.7331 | [
"s033801460",
"s816146698"
] |
u652057333 | p02793 | python | s849872367 | s039693439 | 450 | 403 | 115,952 | 114,928 | Accepted | Accepted | 10.44 | from collections import defaultdict
class LCM_mod:
"""
最小公倍数の計算を行う
オーバーフローが発生しないように素因数分解し,
因数の積を逐次余りに置き換えて最小公倍数を導出する.
"""
def __init__(self, max_num, p=10**9+7):
self.max_num = max_num + 1
self.p = p
self.prime = [0 for _ in range(self.max_num)]
self.... | from collections import defaultdict
class LCM_mod:
"""
最小公倍数の計算を行う
オーバーフローが発生しないように素因数分解し,
因数の積を逐次余りに置き換えて最小公倍数を導出する.
"""
def __init__(self, max_num, p=10**9+7):
self.max_num = max_num + 1
self.p = p
self.prime = [0 for _ in range(self.max_num)]
self.... | 89 | 86 | 2,216 | 2,188 | from collections import defaultdict
class LCM_mod:
"""
最小公倍数の計算を行う
オーバーフローが発生しないように素因数分解し,
因数の積を逐次余りに置き換えて最小公倍数を導出する.
"""
def __init__(self, max_num, p=10**9 + 7):
self.max_num = max_num + 1
self.p = p
self.prime = [0 for _ in range(self.max_num)]
self.max_map ... | from collections import defaultdict
class LCM_mod:
"""
最小公倍数の計算を行う
オーバーフローが発生しないように素因数分解し,
因数の積を逐次余りに置き換えて最小公倍数を導出する.
"""
def __init__(self, max_num, p=10**9 + 7):
self.max_num = max_num + 1
self.p = p
self.prime = [0 for _ in range(self.max_num)]
self.max_map ... | false | 3.370787 | [
"- if self.prime[i]:",
"- continue",
"- for j in range(i * 2, self.max_num, i):",
"- if self.prime[j]:",
"- continue",
"- self.prime[j] = i",
"- self.prime[i] = i",
"+ if self.prime[i] == 0:",
... | false | 0.467335 | 0.380742 | 1.227434 | [
"s849872367",
"s039693439"
] |
u103539599 | p03472 | python | s082596815 | s598152637 | 395 | 358 | 11,348 | 11,312 | Accepted | Accepted | 9.37 | T=0
N,H=list(map(int, input().split()))
A=[]
B=[]
for i in range(N):
a,b=list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
for i in range(N):
if A[0]<=B[i]:
H-=B[i]
T+=1
if H<=0:
break
if H>0:
... | import math
N,H=list(map(int, input().split()))
A=[]
B=[]
for i in range(N):
a,b=list(map(int, input().split()))
A.append(a)
B.append(b)
ans=0
B.sort(reverse=True)
Am=max(A)
for i in range(N):
if B[i]>=Am:
H-=B[i]
ans+=1
if H<=0:
break
if H>0:
... | 27 | 26 | 371 | 343 | T = 0
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
for i in range(N):
if A[0] <= B[i]:
H -= B[i]
T += 1
if H <= 0:
break
if H > 0:
T... | import math
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
ans = 0
B.sort(reverse=True)
Am = max(A)
for i in range(N):
if B[i] >= Am:
H -= B[i]
ans += 1
if H <= 0:
break
if H > 0:
ans... | false | 3.703704 | [
"-T = 0",
"+import math",
"+",
"-A.sort(reverse=True)",
"+ans = 0",
"+Am = max(A)",
"- if A[0] <= B[i]:",
"+ if B[i] >= Am:",
"- T += 1",
"- if H <= 0:",
"- break",
"+ ans += 1",
"+ if H <= 0:",
"+ break",
"- T += int(H / A[0])",
"- ... | false | 0.050167 | 0.048195 | 1.040917 | [
"s082596815",
"s598152637"
] |
u924406834 | p03013 | python | s505451554 | s155642258 | 710 | 480 | 469,580 | 45,808 | Accepted | Accepted | 32.39 | n,m = list(map(int,input().split()))
judge = [True for i in range(n+1)]
for i in range(m):
judge[int(eval(input()))] = False
dp = [0]*(n+1)
dp[0] = 1
for i in range(n):
if judge[i + 1]:dp[i+1] += dp[i]
if i + 2 > n:continue
if judge[i + 2]:dp[i+2] += dp[i]
print((dp[-1]%1000000007)) | n,m = list(map(int,input().split()))
judge = [True for i in range(n+1)]
for i in range(m):
judge[int(eval(input()))] = False
dp = [0]*(n+1)
dp[0] = 1
for i in range(n):
if i + 1 > n:continue
if judge[i + 1]:dp[i+1] = (dp[i] +dp[i+1]) %1000000007
if i + 2 > n:continue
if judge[i + 2]:dp[i+2... | 11 | 12 | 295 | 367 | n, m = list(map(int, input().split()))
judge = [True for i in range(n + 1)]
for i in range(m):
judge[int(eval(input()))] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
if judge[i + 1]:
dp[i + 1] += dp[i]
if i + 2 > n:
continue
if judge[i + 2]:
dp[i + 2] += dp[i]
print((d... | n, m = list(map(int, input().split()))
judge = [True for i in range(n + 1)]
for i in range(m):
judge[int(eval(input()))] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
if i + 1 > n:
continue
if judge[i + 1]:
dp[i + 1] = (dp[i] + dp[i + 1]) % 1000000007
if i + 2 > n:
cont... | false | 8.333333 | [
"+ if i + 1 > n:",
"+ continue",
"- dp[i + 1] += dp[i]",
"+ dp[i + 1] = (dp[i] + dp[i + 1]) % 1000000007",
"- dp[i + 2] += dp[i]",
"+ dp[i + 2] = (dp[i] + dp[i + 2]) % 1000000007"
] | false | 0.036151 | 0.039533 | 0.914447 | [
"s505451554",
"s155642258"
] |
u498487134 | p03003 | python | s036828716 | s262951747 | 353 | 193 | 72,412 | 94,276 | Accepted | Accepted | 45.33 |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
#シンプルに!!
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
#i文字目までとj文字目まで見た.
for i in rang... |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
# dp[i][j]はSをi文字,Tをj文字見た時の通り数
for i in range(N+1):
... | 35 | 37 | 726 | 706 | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
# シンプルに!!
mod = 10**9 + 7
N, M = MI()
S = LI()
T = LI()
dp = [[0] * (M + 1) for _ in range(N + 1)]
# i文字目までとj文字目まで見た.
for i i... | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, M = MI()
S = LI()
T = LI()
dp = [[0] * (M + 1) for _ in range(N + 1)]
# dp[i][j]はSをi文字,Tをj文字見た時の通り数
for i in r... | false | 5.405405 | [
"- # シンプルに!!",
"- # i文字目までとj文字目まで見た.",
"+ # dp[i][j]はSをi文字,Tをj文字見た時の通り数",
"- # まとめたせいで繊維が少し不自然かも",
"- # 基本はdp[i][j]を2回数えているのでひく,でもi文字目とj文字目が一致していればたす",
"- dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]",
"+ dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + ... | false | 0.044267 | 0.047559 | 0.930771 | [
"s036828716",
"s262951747"
] |
u332906195 | p03503 | python | s463363141 | s676829362 | 269 | 225 | 3,064 | 3,188 | Accepted | Accepted | 16.36 | import itertools
N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -10 ** 10
for f in itertools.product([0, 1], repeat=10):
if f == (0,) * 10:
continue
p = 0
for i in range(N):
p += P[i][... | import itertools
N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -10 ** 10
for f in list(itertools.product([0, 1], repeat=10))[1:]:
p = sum([P[i][sum([F[i][j] * f[j] for j in range(10)])] for i in range(N)])
... | 16 | 12 | 393 | 346 | import itertools
N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -(10**10)
for f in itertools.product([0, 1], repeat=10):
if f == (0,) * 10:
continue
p = 0
for i in range(N):
p += P[i][sum([F[i][j] ... | import itertools
N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -(10**10)
for f in list(itertools.product([0, 1], repeat=10))[1:]:
p = sum([P[i][sum([F[i][j] * f[j] for j in range(10)])] for i in range(N)])
ans = max(... | false | 25 | [
"-for f in itertools.product([0, 1], repeat=10):",
"- if f == (0,) * 10:",
"- continue",
"- p = 0",
"- for i in range(N):",
"- p += P[i][sum([F[i][j] * f[j] for j in range(10)])]",
"+for f in list(itertools.product([0, 1], repeat=10))[1:]:",
"+ p = sum([P[i][sum([F[i][j] * f[... | false | 0.04653 | 0.180181 | 0.258241 | [
"s463363141",
"s676829362"
] |
u896063224 | p03062 | python | s937827888 | s631740903 | 94 | 54 | 14,412 | 14,208 | Accepted | Accepted | 42.55 | N = int(eval(input()))
A = list(map(int,input().split(' ')))
sum = 0
min = 1000000000
minus = 0
for n in range(N):
n_abs = abs(A[n])
sum += n_abs
if min > n_abs:
min = n_abs
if A[n] < 0:
minus += 1
if minus%2 != 0:
sum -= 2*min
print(sum) | N = int(eval(input()))
A = list(map(int,input().split(' ')))
ABS_LIST = list(map(abs,A))
ABS_SUM = sum(ABS_LIST)
if len([x for x in A if x < 0])%2 != 0:
print((ABS_SUM-min(ABS_LIST)*2))
else:
print(ABS_SUM) | 15 | 8 | 282 | 213 | N = int(eval(input()))
A = list(map(int, input().split(" ")))
sum = 0
min = 1000000000
minus = 0
for n in range(N):
n_abs = abs(A[n])
sum += n_abs
if min > n_abs:
min = n_abs
if A[n] < 0:
minus += 1
if minus % 2 != 0:
sum -= 2 * min
print(sum)
| N = int(eval(input()))
A = list(map(int, input().split(" ")))
ABS_LIST = list(map(abs, A))
ABS_SUM = sum(ABS_LIST)
if len([x for x in A if x < 0]) % 2 != 0:
print((ABS_SUM - min(ABS_LIST) * 2))
else:
print(ABS_SUM)
| false | 46.666667 | [
"-sum = 0",
"-min = 1000000000",
"-minus = 0",
"-for n in range(N):",
"- n_abs = abs(A[n])",
"- sum += n_abs",
"- if min > n_abs:",
"- min = n_abs",
"- if A[n] < 0:",
"- minus += 1",
"-if minus % 2 != 0:",
"- sum -= 2 * min",
"-print(sum)",
"+ABS_LIST = list(ma... | false | 0.073273 | 0.059977 | 1.221686 | [
"s937827888",
"s631740903"
] |
u644907318 | p03617 | python | s650733013 | s875255372 | 181 | 69 | 38,448 | 61,536 | Accepted | Accepted | 61.88 | Q,H,S,D = list(map(int,input().split()))
N = int(eval(input()))
a2 = min(Q*8,H*4,S*2,D)
ans = (N//2)*a2
a1 = min(Q*4,H*2,S)
ans += (N%2)*a1
print(ans) | Q,H,S,D = list(map(int,input().split()))
N = int(eval(input()))
x2 = min(D,2*S,4*H,8*Q)
cnt = (N//2)*x2
N = N%2
x1 = min(S,2*H,4*Q)
cnt += N*x1
print(cnt) | 7 | 8 | 144 | 149 | Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
a2 = min(Q * 8, H * 4, S * 2, D)
ans = (N // 2) * a2
a1 = min(Q * 4, H * 2, S)
ans += (N % 2) * a1
print(ans)
| Q, H, S, D = list(map(int, input().split()))
N = int(eval(input()))
x2 = min(D, 2 * S, 4 * H, 8 * Q)
cnt = (N // 2) * x2
N = N % 2
x1 = min(S, 2 * H, 4 * Q)
cnt += N * x1
print(cnt)
| false | 12.5 | [
"-a2 = min(Q * 8, H * 4, S * 2, D)",
"-ans = (N // 2) * a2",
"-a1 = min(Q * 4, H * 2, S)",
"-ans += (N % 2) * a1",
"-print(ans)",
"+x2 = min(D, 2 * S, 4 * H, 8 * Q)",
"+cnt = (N // 2) * x2",
"+N = N % 2",
"+x1 = min(S, 2 * H, 4 * Q)",
"+cnt += N * x1",
"+print(cnt)"
] | false | 0.036055 | 0.036599 | 0.985125 | [
"s650733013",
"s875255372"
] |
u047393579 | p03775 | python | s994711983 | s130981676 | 43 | 32 | 3,060 | 3,060 | Accepted | Accepted | 25.58 | def F(a, b):
count = 0
c = max(a, b)
while c >= 10:
c = c / 10
count += 1
return count+1
N = int(eval(input()))
minimum = 15
for num in range(1,int(N/(10**5))+10**5+1):
if N % num == 0:
minimum = min(minimum, F(num, N/num))
print(minimum) | def F(a, b):
count = 0
c = max(a, b)
while c >= 10:
c = c / 10
count += 1
return count+1
N = int(eval(input()))
minimum = 15
for num in range(1,10**5+1):
if N % num == 0:
minimum = min(minimum, F(num, N/num))
print(minimum) | 14 | 14 | 290 | 276 | def F(a, b):
count = 0
c = max(a, b)
while c >= 10:
c = c / 10
count += 1
return count + 1
N = int(eval(input()))
minimum = 15
for num in range(1, int(N / (10**5)) + 10**5 + 1):
if N % num == 0:
minimum = min(minimum, F(num, N / num))
print(minimum)
| def F(a, b):
count = 0
c = max(a, b)
while c >= 10:
c = c / 10
count += 1
return count + 1
N = int(eval(input()))
minimum = 15
for num in range(1, 10**5 + 1):
if N % num == 0:
minimum = min(minimum, F(num, N / num))
print(minimum)
| false | 0 | [
"-for num in range(1, int(N / (10**5)) + 10**5 + 1):",
"+for num in range(1, 10**5 + 1):"
] | false | 0.05844 | 0.06843 | 0.854003 | [
"s994711983",
"s130981676"
] |
u577170763 | p02815 | python | s068264251 | s877217188 | 560 | 342 | 88,616 | 78,316 | Accepted | Accepted | 38.93 | import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():... | import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():... | 34 | 31 | 665 | 638 | import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
N = gete(i... | import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
N = gete(i... | false | 8.823529 | [
"- c.sort(key=lambda x: -x)",
"+ c.sort(reverse=True)",
"- dp[n] = 4 * dp[n - 1] + (n + 1) * base * c[n - 1]",
"- base *= 4",
"- dp[n] %= mod",
"- base %= mod",
"+ dp[n] = (4 * dp[n - 1] + (n + 1) * base * c[n - 1]) % mod",
"+ base = (4 * base) % mod"
] | false | 0.047427 | 0.038973 | 1.216923 | [
"s068264251",
"s877217188"
] |
u882564128 | p03805 | python | s369522539 | s754365929 | 212 | 178 | 13,872 | 13,968 | Accepted | Accepted | 16.04 | from itertools import permutations
from math import factorial
n, m = list(map(int, input().split(' ')))
edge = []
for i in range(m):
ai, bi = list(map(int, input().split(' ')))
edge.append([ai,bi])
x = [i for i in range(1,n+1)]
ls = list(permutations(x))
ans = 0
for l in range(factorial(n-1)):... | from itertools import permutations
from math import factorial
n, m = list(map(int, input().split(' ')))
edge = []
for i in range(m):
ai, bi = list(map(int, input().split(' ')))
edge.append([ai, bi])
l = [i for i in range(1, n+1)]
ls = list(permutations(l))
ans = 0
for i in range(factorial(n-1)):
... | 25 | 22 | 523 | 496 | from itertools import permutations
from math import factorial
n, m = list(map(int, input().split(" ")))
edge = []
for i in range(m):
ai, bi = list(map(int, input().split(" ")))
edge.append([ai, bi])
x = [i for i in range(1, n + 1)]
ls = list(permutations(x))
ans = 0
for l in range(factorial(n - 1)):
cnt = ... | from itertools import permutations
from math import factorial
n, m = list(map(int, input().split(" ")))
edge = []
for i in range(m):
ai, bi = list(map(int, input().split(" ")))
edge.append([ai, bi])
l = [i for i in range(1, n + 1)]
ls = list(permutations(l))
ans = 0
for i in range(factorial(n - 1)):
y = 0
... | false | 12 | [
"-x = [i for i in range(1, n + 1)]",
"-ls = list(permutations(x))",
"+l = [i for i in range(1, n + 1)]",
"+ls = list(permutations(l))",
"-for l in range(factorial(n - 1)):",
"- cnt = 0",
"- for i in range(n - 1):",
"- for j in range(m):",
"- if (ls[l][i] in edge[j]) and (ls[l... | false | 0.249812 | 0.069229 | 3.608498 | [
"s369522539",
"s754365929"
] |
u696444274 | p02989 | python | s258041644 | s502678746 | 78 | 64 | 14,396 | 20,752 | Accepted | Accepted | 17.95 | n = int(eval(input()))
d = list(map(int, input().split()))
#b = list(map(int, input().split()))
d.sort()
print((d[n//2]-d[n//2-1])) | n = int(eval(input()))
#h, w, k = list(map(int, input().split()))
# A = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# q = int(input())
p = list(map(int, input().split()))
# b = list(map(int, input().split()))
# ab_sorted = so... | 6 | 18 | 129 | 550 | n = int(eval(input()))
d = list(map(int, input().split()))
# b = list(map(int, input().split()))
d.sort()
print((d[n // 2] - d[n // 2 - 1]))
| n = int(eval(input()))
# h, w, k = list(map(int, input().split()))
# A = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# q = int(input())
p = list(map(int, input().split()))
# b = list(map(int, input().split()))
# ab_sorted = sorted(ab... | false | 66.666667 | [
"-d = list(map(int, input().split()))",
"+# h, w, k = list(map(int, input().split()))",
"+# A = list(map(int, input().split()))",
"+# a = list(map(int, input().split()))",
"+# data = [list(map(int, input().split())) for i in range(n)]",
"+# q = int(input())",
"+p = list(map(int, input().split()))",
"-... | false | 0.120017 | 0.115766 | 1.036719 | [
"s258041644",
"s502678746"
] |
u288430479 | p02726 | python | s607989838 | s685518555 | 1,166 | 1,063 | 9,360 | 9,276 | Accepted | Accepted | 8.83 | n,x,y = list(map(int,input().split()))
ko = [0 for i in range(10**4)]
for i in range(1,n):
for j in range(i+1,n+1):
c1 = j-i
if i<=x and y<=j:
c2 = (x-i)+1+(j-y)
elif i<=x and j<y:
c2 = (x-i)+1+(y-j)
elif x<i and y<=j:
c2 = (i-x)+1+(j-y)
else:
c2 = (i-x)+1+(y-j)... | n,x,y = list(map(int,input().split()))
ko = [0 for i in range(10**4)]
for i in range(1,n):
for j in range(i+1,n+1):
c1 = j-i
c2 = abs(x-i)+1+abs(y-j)
ko[min(c1,c2)] += 1
# print(i,j,j-i,c1,c2,ko[:10])
for i in range(1,n):
print((ko[i])) | 17 | 10 | 412 | 256 | n, x, y = list(map(int, input().split()))
ko = [0 for i in range(10**4)]
for i in range(1, n):
for j in range(i + 1, n + 1):
c1 = j - i
if i <= x and y <= j:
c2 = (x - i) + 1 + (j - y)
elif i <= x and j < y:
c2 = (x - i) + 1 + (y - j)
elif x < i and y <= j:
... | n, x, y = list(map(int, input().split()))
ko = [0 for i in range(10**4)]
for i in range(1, n):
for j in range(i + 1, n + 1):
c1 = j - i
c2 = abs(x - i) + 1 + abs(y - j)
ko[min(c1, c2)] += 1
# print(i,j,j-i,c1,c2,ko[:10])
for i in range(1, n):
print((ko[i]))
| false | 41.176471 | [
"- if i <= x and y <= j:",
"- c2 = (x - i) + 1 + (j - y)",
"- elif i <= x and j < y:",
"- c2 = (x - i) + 1 + (y - j)",
"- elif x < i and y <= j:",
"- c2 = (i - x) + 1 + (j - y)",
"- else:",
"- c2 = (i - x) + 1 + (y - j)",
"+ ... | false | 0.040144 | 0.086853 | 0.462208 | [
"s607989838",
"s685518555"
] |
u830054172 | p02630 | python | s444137734 | s618819284 | 550 | 483 | 21,284 | 21,292 | Accepted | Accepted | 12.18 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
sumA = sum(A)
dic = Counter(A)
Q = int(eval(input()))
for _ in range(Q):
b, c = list(map(int, input().split()))
if b in list(dic.keys()):
sumA += ((c-b)*dic[b])
#変更後の数字は既にいる?
i... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0 for _ in range(100005)]
for i in range(N):
cnt[A[i]] += 1
sumA = sum(A)
# print(sumA)
Q = int(eval(input()))
for _ in range(Q):
b, c = list(map(int, input().split()))
if cnt[b]:
... | 32 | 22 | 615 | 392 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
sumA = sum(A)
dic = Counter(A)
Q = int(eval(input()))
for _ in range(Q):
b, c = list(map(int, input().split()))
if b in list(dic.keys()):
sumA += (c - b) * dic[b]
# 変更後の数字は既にいる?
if c in list(dic.k... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0 for _ in range(100005)]
for i in range(N):
cnt[A[i]] += 1
sumA = sum(A)
# print(sumA)
Q = int(eval(input()))
for _ in range(Q):
b, c = list(map(int, input().split()))
if cnt[b]:
sumA += (c - b) * cnt... | false | 31.25 | [
"+cnt = [0 for _ in range(100005)]",
"+for i in range(N):",
"+ cnt[A[i]] += 1",
"-dic = Counter(A)",
"+# print(sumA)",
"- if b in list(dic.keys()):",
"- sumA += (c - b) * dic[b]",
"- # 変更後の数字は既にいる?",
"- if c in list(dic.keys()):",
"- # 個数を保持",
"- ... | false | 0.04246 | 0.047729 | 0.889617 | [
"s444137734",
"s618819284"
] |
u296518383 | p02912 | python | s548822488 | s531612686 | 309 | 155 | 64,664 | 14,180 | Accepted | Accepted | 49.84 | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h = []
for a in A:
heappush(h, -a)
for _ in range(M):
heappush(h, -(-heappop(h) // 2))
print((-sum(h))) | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h = []
for a in A:
heappush(h, -a)
for _ in range(M):
a = -heappop(h) // 2
heappush(h, -a)
print((-sum(h))) | 12 | 13 | 228 | 237 | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h = []
for a in A:
heappush(h, -a)
for _ in range(M):
heappush(h, -(-heappop(h) // 2))
print((-sum(h)))
| from heapq import heappush, heappop
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h = []
for a in A:
heappush(h, -a)
for _ in range(M):
a = -heappop(h) // 2
heappush(h, -a)
print((-sum(h)))
| false | 7.692308 | [
"- heappush(h, -(-heappop(h) // 2))",
"+ a = -heappop(h) // 2",
"+ heappush(h, -a)"
] | false | 0.052596 | 0.053793 | 0.97776 | [
"s548822488",
"s531612686"
] |
u046187684 | p02899 | python | s387290034 | s185356686 | 174 | 74 | 24,532 | 14,948 | Accepted | Accepted | 57.47 | def solve(string):
n, *a = list(map(int, string.split()))
a = sorted([(_a, i) for i, _a in enumerate(a, start=1)])
return " ".join([str(i) for _, i in a])
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| def solve(string):
n, *a = list(map(int, string.split()))
ans = [0] * n
for i, _a in enumerate(a, 1):
ans[_a - 1] = str(i)
return " ".join(ans)
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| 8 | 10 | 245 | 248 | def solve(string):
n, *a = list(map(int, string.split()))
a = sorted([(_a, i) for i, _a in enumerate(a, start=1)])
return " ".join([str(i) for _, i in a])
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| def solve(string):
n, *a = list(map(int, string.split()))
ans = [0] * n
for i, _a in enumerate(a, 1):
ans[_a - 1] = str(i)
return " ".join(ans)
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| false | 20 | [
"- a = sorted([(_a, i) for i, _a in enumerate(a, start=1)])",
"- return \" \".join([str(i) for _, i in a])",
"+ ans = [0] * n",
"+ for i, _a in enumerate(a, 1):",
"+ ans[_a - 1] = str(i)",
"+ return \" \".join(ans)"
] | false | 0.036205 | 0.03627 | 0.998193 | [
"s387290034",
"s185356686"
] |
u687044304 | p03031 | python | s985571702 | s085946687 | 33 | 26 | 3,444 | 3,064 | Accepted | Accepted | 21.21 | # -*- coding:utf-8 -*-
from itertools import combinations
import copy
def solve2():
"""
itertools.productを使えばもっとすっきり?
"""
import itertools as it
N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
_in = list(map(int, input().split()))
K.... | # -*- coding:utf-8 -*-
from itertools import product
def solve():
N, M = list(map(int, input().split()))
K, S = [], []
for _ in range(M):
_in = list(map(int, input().split()))
K.append(_in[0])
S.append(_in[1:])
P = list(map(int, input().split()))
all_stats = pro... | 84 | 30 | 2,082 | 790 | # -*- coding:utf-8 -*-
from itertools import combinations
import copy
def solve2():
"""
itertools.productを使えばもっとすっきり?
"""
import itertools as it
N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
_in = list(map(int, input().split()))
K.append(_in[0... | # -*- coding:utf-8 -*-
from itertools import product
def solve():
N, M = list(map(int, input().split()))
K, S = [], []
for _ in range(M):
_in = list(map(int, input().split()))
K.append(_in[0])
S.append(_in[1:])
P = list(map(int, input().split()))
all_stats = product((0, 1),... | false | 64.285714 | [
"-from itertools import combinations",
"-import copy",
"+from itertools import product",
"-def solve2():",
"- \"\"\"",
"- itertools.productを使えばもっとすっきり?",
"- \"\"\"",
"- import itertools as it",
"-",
"+def solve():",
"- K = []",
"- S = []",
"- for i in range(M):",
"+ ... | false | 0.086258 | 0.06423 | 1.342962 | [
"s985571702",
"s085946687"
] |
u450956662 | p02787 | python | s433526519 | s165073510 | 437 | 144 | 42,972 | 75,008 | Accepted | Accepted | 67.05 | H, N = list(map(int, input().split()))
M = [tuple(map(int, input().split())) for _ in range(N)]
dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H):
if dp[h] == float('inf'):
continue
for a, b in M:
idx = min(H, h + a)
dp[idx] = min(dp[idx], dp[h] + b)
print((dp[H]))
| H, N = list(map(int, input().split()))
dp = [10 ** 9] * (H + 1)
dp[0] = 0
for _ in range(N):
a, b = list(map(int, input().split()))
for i in range(H):
idx = min(H, i + a)
dp[idx] = min(dp[idx], dp[i] + b)
print((dp[H]))
| 11 | 10 | 308 | 240 | H, N = list(map(int, input().split()))
M = [tuple(map(int, input().split())) for _ in range(N)]
dp = [float("inf")] * (H + 1)
dp[0] = 0
for h in range(H):
if dp[h] == float("inf"):
continue
for a, b in M:
idx = min(H, h + a)
dp[idx] = min(dp[idx], dp[h] + b)
print((dp[H]))
| H, N = list(map(int, input().split()))
dp = [10**9] * (H + 1)
dp[0] = 0
for _ in range(N):
a, b = list(map(int, input().split()))
for i in range(H):
idx = min(H, i + a)
dp[idx] = min(dp[idx], dp[i] + b)
print((dp[H]))
| false | 9.090909 | [
"-M = [tuple(map(int, input().split())) for _ in range(N)]",
"-dp = [float(\"inf\")] * (H + 1)",
"+dp = [10**9] * (H + 1)",
"-for h in range(H):",
"- if dp[h] == float(\"inf\"):",
"- continue",
"- for a, b in M:",
"- idx = min(H, h + a)",
"- dp[idx] = min(dp[idx], dp[h] + ... | false | 0.332731 | 0.129037 | 2.578574 | [
"s433526519",
"s165073510"
] |
u863955163 | p02714 | python | s973131737 | s979094279 | 1,968 | 1,464 | 9,204 | 9,220 | Accepted | Accepted | 25.61 | N = int(eval(input()))
S = list(eval(input()))
ans = S.count('R') * S.count('G') * S.count('B')
for i in range(N-2):
for j in range(i+1, N + (-(N-i-1)//2)):
k = j+(j-i)
if len(set([S[i], S[j], S[k]])) == 3:
ans-=1
print(ans) | def solve():
N = int(eval(input()))
S = list(eval(input()))
ans = S.count('R') * S.count('G') * S.count('B')
for i in range(N-2):
for j in range(i+1, N + (-(N-i-1)//2)):
k = j+(j-i)
if len(set([S[i], S[j], S[k]])) == 3:
ans-=1
return ans
prin... | 9 | 11 | 252 | 318 | N = int(eval(input()))
S = list(eval(input()))
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N - 2):
for j in range(i + 1, N + (-(N - i - 1) // 2)):
k = j + (j - i)
if len(set([S[i], S[j], S[k]])) == 3:
ans -= 1
print(ans)
| def solve():
N = int(eval(input()))
S = list(eval(input()))
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N - 2):
for j in range(i + 1, N + (-(N - i - 1) // 2)):
k = j + (j - i)
if len(set([S[i], S[j], S[k]])) == 3:
ans -= 1
return an... | false | 18.181818 | [
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-ans = S.count(\"R\") * S.count(\"G\") * S.count(\"B\")",
"-for i in range(N - 2):",
"- for j in range(i + 1, N + (-(N - i - 1) // 2)):",
"- k = j + (j - i)",
"- if len(set([S[i], S[j], S[k]])) == 3:",
"- ans -= 1",
... | false | 0.044286 | 0.043513 | 1.017769 | [
"s973131737",
"s979094279"
] |
u216015528 | p02731 | python | s697852232 | s555777999 | 82 | 68 | 73,572 | 61,692 | Accepted | Accepted | 17.07 | #!/usr/bin/env python3
def main():
L = int(eval(input()))
ans = 0
for i in range(min(L, 1000)):
for j in range(1000):
a = i + (j / 1000)
b = (L - a) / 2
ans = max(ans, a * b * b)
print(ans)
if __name__ == '__main__':
main()
| #!/usr/bin/env python3
def main():
L = int(eval(input()))
print((L ** 3 / 27))
if __name__ == '__main__':
main()
| 15 | 9 | 299 | 128 | #!/usr/bin/env python3
def main():
L = int(eval(input()))
ans = 0
for i in range(min(L, 1000)):
for j in range(1000):
a = i + (j / 1000)
b = (L - a) / 2
ans = max(ans, a * b * b)
print(ans)
if __name__ == "__main__":
main()
| #!/usr/bin/env python3
def main():
L = int(eval(input()))
print((L**3 / 27))
if __name__ == "__main__":
main()
| false | 40 | [
"- ans = 0",
"- for i in range(min(L, 1000)):",
"- for j in range(1000):",
"- a = i + (j / 1000)",
"- b = (L - a) / 2",
"- ans = max(ans, a * b * b)",
"- print(ans)",
"+ print((L**3 / 27))"
] | false | 0.103892 | 0.034828 | 2.983041 | [
"s697852232",
"s555777999"
] |
u011062360 | p02713 | python | s587559005 | s782410346 | 1,548 | 454 | 9,488 | 68,792 | Accepted | Accepted | 70.67 | import math
k = int(eval(input()))
ans = 0
list_gcd = [[0]*202 for _ in range(202)]
for i in range(1, 201):
for j in range(i, 201):
num = math.gcd(i, j)
list_gcd[i][j] = num
list_gcd[j][i] = num
ans = 0
for i in range(1, k+1):
for j in range(1, k+1):
for l in rang... | import math
k = int(eval(input()))
ans = 0
for i in range(1, k+1):
for j in range(1, k + 1):
for l in range(1, k + 1):
num = math.gcd(i, j)
ans += math.gcd(num,l)
print(ans) | 19 | 10 | 409 | 213 | import math
k = int(eval(input()))
ans = 0
list_gcd = [[0] * 202 for _ in range(202)]
for i in range(1, 201):
for j in range(i, 201):
num = math.gcd(i, j)
list_gcd[i][j] = num
list_gcd[j][i] = num
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + ... | import math
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
num = math.gcd(i, j)
ans += math.gcd(num, l)
print(ans)
| false | 47.368421 | [
"-list_gcd = [[0] * 202 for _ in range(202)]",
"-for i in range(1, 201):",
"- for j in range(i, 201):",
"- num = math.gcd(i, j)",
"- list_gcd[i][j] = num",
"- list_gcd[j][i] = num",
"-ans = 0",
"- num = list_gcd[i][j]",
"- ans += list_gcd[num][l]",
"+ ... | false | 0.16169 | 0.16589 | 0.97468 | [
"s587559005",
"s782410346"
] |
u703196441 | p00586 | python | s299650173 | s859193470 | 20 | 10 | 4,180 | 4,180 | Accepted | Accepted | 50 | while 1:
try:
a, b = input().split()
print(int(a) + int(b))
except:
break | while 1:
try:
a, b = list(map(int, input().split()))
print(a + b)
except:
break | 6 | 6 | 113 | 113 | while 1:
try:
a, b = input().split()
print(int(a) + int(b))
except:
break
| while 1:
try:
a, b = list(map(int, input().split()))
print(a + b)
except:
break
| false | 0 | [
"- a, b = input().split()",
"- print(int(a) + int(b))",
"+ a, b = list(map(int, input().split()))",
"+ print(a + b)"
] | false | 0.037317 | 0.037278 | 1.001028 | [
"s299650173",
"s859193470"
] |
u203843959 | p03732 | python | s474365607 | s491903427 | 378 | 234 | 69,724 | 43,244 | Accepted | Accepted | 38.1 | N,W=list(map(int,input().split()))
wvlist=[]
for i in range(N):
w,v=list(map(int,input().split()))
wvlist.append((w,v))
#normalize
w1=wvlist[0][0]
w2vlist=[]
for i in range(N):
w,v=wvlist[i]
w2vlist.append((w,w-w1,v))
#print(w2vlist)
dp=[[[0 for _ in range(3*N+1)] for _ in range(N+1)] for ... | from collections import defaultdict
N,W=list(map(int,input().split()))
wvdic=defaultdict(list)
for i in range(N):
w,v=list(map(int,input().split()))
wvdic[w].append(v)
#print(wvdic)
wv_sorted=sorted(wvdic.items())
#print(wv_sorted)
wvslist=[]
for i in range(len(wv_sorted)):
slist=[0]
vlist=s... | 35 | 44 | 743 | 1,152 | N, W = list(map(int, input().split()))
wvlist = []
for i in range(N):
w, v = list(map(int, input().split()))
wvlist.append((w, v))
# normalize
w1 = wvlist[0][0]
w2vlist = []
for i in range(N):
w, v = wvlist[i]
w2vlist.append((w, w - w1, v))
# print(w2vlist)
dp = [[[0 for _ in range(3 * N + 1)] for _ in ... | from collections import defaultdict
N, W = list(map(int, input().split()))
wvdic = defaultdict(list)
for i in range(N):
w, v = list(map(int, input().split()))
wvdic[w].append(v)
# print(wvdic)
wv_sorted = sorted(wvdic.items())
# print(wv_sorted)
wvslist = []
for i in range(len(wv_sorted)):
slist = [0]
... | false | 20.454545 | [
"+from collections import defaultdict",
"+",
"-wvlist = []",
"+wvdic = defaultdict(list)",
"- wvlist.append((w, v))",
"-# normalize",
"-w1 = wvlist[0][0]",
"-w2vlist = []",
"-for i in range(N):",
"- w, v = wvlist[i]",
"- w2vlist.append((w, w - w1, v))",
"-# print(w2vlist)",
"-dp = [... | false | 0.117889 | 0.086602 | 1.361269 | [
"s474365607",
"s491903427"
] |
u504836877 | p03161 | python | s989938352 | s053974032 | 433 | 352 | 52,448 | 52,448 | Accepted | Accepted | 18.71 | N,K = list(map(int, input().split()))
H = [int(h) for h in input().split()]
dp = [0]*N
for i in range(1, N):
j = i-1
cost = 10**18
while j >= max(0, i-K):
cost = min(cost, dp[j]+abs(H[i]-H[j]))
j -= 1
dp[i] = cost
print((dp[N-1])) | N,K = list(map(int, input().split()))
H = [int(h) for h in input().split()]
dp = [10**12]*N
dp[0] = 0
for i in range(1, N):
t = 1
while t <= K and i-t >= 0:
dp[i] = min(dp[i], dp[i-t]+abs(H[i]-H[i-t]))
t += 1
print((dp[-1])) | 14 | 12 | 274 | 261 | N, K = list(map(int, input().split()))
H = [int(h) for h in input().split()]
dp = [0] * N
for i in range(1, N):
j = i - 1
cost = 10**18
while j >= max(0, i - K):
cost = min(cost, dp[j] + abs(H[i] - H[j]))
j -= 1
dp[i] = cost
print((dp[N - 1]))
| N, K = list(map(int, input().split()))
H = [int(h) for h in input().split()]
dp = [10**12] * N
dp[0] = 0
for i in range(1, N):
t = 1
while t <= K and i - t >= 0:
dp[i] = min(dp[i], dp[i - t] + abs(H[i] - H[i - t]))
t += 1
print((dp[-1]))
| false | 14.285714 | [
"-dp = [0] * N",
"+dp = [10**12] * N",
"+dp[0] = 0",
"- j = i - 1",
"- cost = 10**18",
"- while j >= max(0, i - K):",
"- cost = min(cost, dp[j] + abs(H[i] - H[j]))",
"- j -= 1",
"- dp[i] = cost",
"-print((dp[N - 1]))",
"+ t = 1",
"+ while t <= K and i - t >= 0:"... | false | 0.058744 | 0.093355 | 0.629249 | [
"s989938352",
"s053974032"
] |
u969850098 | p03339 | python | s517021464 | s487845787 | 157 | 106 | 3,672 | 3,700 | Accepted | Accepted | 32.48 | N = int(eval(input()))
S = eval(input())
e_count = S.count('E')
w_count = 0
ans = e_count
for s in S:
if s == 'E':
e_count -= 1
else:
w_count += 1
ans = min(ans, e_count + w_count)
print(ans) | N = int(eval(input()))
S = eval(input())
e_count = S.count('E')
w_count = 0
ans = e_count
for s in S:
if s == 'E':
e_count -= 1
else:
w_count += 1
if e_count + w_count < ans:
ans = e_count + w_count
print(ans) | 12 | 13 | 218 | 245 | N = int(eval(input()))
S = eval(input())
e_count = S.count("E")
w_count = 0
ans = e_count
for s in S:
if s == "E":
e_count -= 1
else:
w_count += 1
ans = min(ans, e_count + w_count)
print(ans)
| N = int(eval(input()))
S = eval(input())
e_count = S.count("E")
w_count = 0
ans = e_count
for s in S:
if s == "E":
e_count -= 1
else:
w_count += 1
if e_count + w_count < ans:
ans = e_count + w_count
print(ans)
| false | 7.692308 | [
"- ans = min(ans, e_count + w_count)",
"+ if e_count + w_count < ans:",
"+ ans = e_count + w_count"
] | false | 0.042659 | 0.084037 | 0.507617 | [
"s517021464",
"s487845787"
] |
u392319141 | p03215 | python | s641908112 | s697259285 | 2,128 | 1,955 | 22,964 | 32,744 | Accepted | Accepted | 8.13 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
cumA = [0] * (N + 1)
for i in range(1, N + 1):
cumA[i] = cumA[i - 1] + A[i - 1]
beauty = []
for left in range(N):
for right in range(left + 1, N + 1):
b = cumA[right] - cumA[left]
beauty.append(b)
ans = 0
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
S = []
for i in range(N):
s = 0
for a in A[i:]:
s += a
S.append(s)
def isOk(n):
return sum([n & a == n for a in S]) >= K
ans = 0
for d in range(40)[:: -1]:
if isOk(ans | (1 << d)):
ans |... | 26 | 18 | 542 | 337 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
cumA = [0] * (N + 1)
for i in range(1, N + 1):
cumA[i] = cumA[i - 1] + A[i - 1]
beauty = []
for left in range(N):
for right in range(left + 1, N + 1):
b = cumA[right] - cumA[left]
beauty.append(b)
ans = 0
M = max(beauty).... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
S = []
for i in range(N):
s = 0
for a in A[i:]:
s += a
S.append(s)
def isOk(n):
return sum([n & a == n for a in S]) >= K
ans = 0
for d in range(40)[::-1]:
if isOk(ans | (1 << d)):
ans |= 1 << d
print(a... | false | 30.769231 | [
"-cumA = [0] * (N + 1)",
"-for i in range(1, N + 1):",
"- cumA[i] = cumA[i - 1] + A[i - 1]",
"-beauty = []",
"-for left in range(N):",
"- for right in range(left + 1, N + 1):",
"- b = cumA[right] - cumA[left]",
"- beauty.append(b)",
"+S = []",
"+for i in range(N):",
"+ s =... | false | 0.044535 | 0.044302 | 1.005268 | [
"s641908112",
"s697259285"
] |
u203843959 | p02580 | python | s642267535 | s154208451 | 811 | 557 | 168,120 | 176,764 | Accepted | Accepted | 31.32 | import sys
import random
H,W,M=list(map(int,input().split()))
hlist=[0]*H
wlist=[0]*W
hwset=set()
for _ in range(M):
h,w=list(map(int,input().split()))
hlist[h-1]+=1
wlist[w-1]+=1
hwset.add((h-1,w-1))
hmax=max(hlist)
wmax=max(wlist)
hlist2=[]
for i in range(H):
if hlist[i]==hmax:
h... | import sys
H,W,M=list(map(int,input().split()))
hlist=[0]*H
wlist=[0]*W
hwset=set()
for _ in range(M):
h,w=list(map(int,input().split()))
hlist[h-1]+=1
wlist[w-1]+=1
hwset.add((h-1,w-1))
hmax=max(hlist)
hlist2=[]
for i in range(H):
if hlist[i]==hmax:
hlist2.append(i)
wmax=max(wlist)... | 48 | 40 | 838 | 680 | import sys
import random
H, W, M = list(map(int, input().split()))
hlist = [0] * H
wlist = [0] * W
hwset = set()
for _ in range(M):
h, w = list(map(int, input().split()))
hlist[h - 1] += 1
wlist[w - 1] += 1
hwset.add((h - 1, w - 1))
hmax = max(hlist)
wmax = max(wlist)
hlist2 = []
for i in range(H):
... | import sys
H, W, M = list(map(int, input().split()))
hlist = [0] * H
wlist = [0] * W
hwset = set()
for _ in range(M):
h, w = list(map(int, input().split()))
hlist[h - 1] += 1
wlist[w - 1] += 1
hwset.add((h - 1, w - 1))
hmax = max(hlist)
hlist2 = []
for i in range(H):
if hlist[i] == hmax:
hl... | false | 16.666667 | [
"-import random",
"-wmax = max(wlist)",
"-hlist2.sort(reverse=True)",
"-random.shuffle(hlist2)",
"+wmax = max(wlist)",
"-wlist2.sort(reverse=True)",
"-random.shuffle(wlist2)",
"-if H2 * W2 >= 10**7:",
"- norm = (H2 * W2) // (10**7)",
"- H2 = int(H2 / (norm**0.5))",
"- W2 = int(W2 / (nor... | false | 0.038203 | 0.041834 | 0.913215 | [
"s642267535",
"s154208451"
] |
u759412327 | p02628 | python | s166526051 | s118783100 | 31 | 28 | 9,260 | 9,196 | Accepted | Accepted | 9.68 | N,K = list(map(int,input().split()))
P = sorted(list(map(int,input().split())))
print((sum(P[:K]))) | N,K = list(map(int,input().split()))
print((sum(sorted(list(map(int,input().split())))[:K]))) | 3 | 2 | 93 | 86 | N, K = list(map(int, input().split()))
P = sorted(list(map(int, input().split())))
print((sum(P[:K])))
| N, K = list(map(int, input().split()))
print((sum(sorted(list(map(int, input().split())))[:K])))
| false | 33.333333 | [
"-P = sorted(list(map(int, input().split())))",
"-print((sum(P[:K])))",
"+print((sum(sorted(list(map(int, input().split())))[:K])))"
] | false | 0.046563 | 0.046642 | 0.998308 | [
"s166526051",
"s118783100"
] |
u970197315 | p02726 | python | s786166087 | s678834366 | 1,870 | 303 | 9,516 | 76,540 | Accepted | Accepted | 83.8 | from collections import Counter
n, x, y = list(map(int, input().split()))
c = Counter()
for i in range(1, n):
for j in range(i+1, n+1):
dist = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
c[dist] += 1
for k in range(1, n):
print((c[k]))
| from collections import deque, Counter
n, x, y = list(map(int, input().split()))
G = [[] for _ in range(n)]
for i in range(n-1):
G[i].append(i+1)
G[i+1].append(i)
G[x-1].append(y-1)
G[y-1].append(x-1)
c = Counter()
for i in range(n):
q = deque([i])
dist = [-1]*n
dist[i] = 0
while q:... | 10 | 26 | 274 | 627 | from collections import Counter
n, x, y = list(map(int, input().split()))
c = Counter()
for i in range(1, n):
for j in range(i + 1, n + 1):
dist = min(abs(j - i), abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x))
c[dist] += 1
for k in range(1, n):
print((c[k]))
| from collections import deque, Counter
n, x, y = list(map(int, input().split()))
G = [[] for _ in range(n)]
for i in range(n - 1):
G[i].append(i + 1)
G[i + 1].append(i)
G[x - 1].append(y - 1)
G[y - 1].append(x - 1)
c = Counter()
for i in range(n):
q = deque([i])
dist = [-1] * n
dist[i] = 0
whil... | false | 61.538462 | [
"-from collections import Counter",
"+from collections import deque, Counter",
"+G = [[] for _ in range(n)]",
"+for i in range(n - 1):",
"+ G[i].append(i + 1)",
"+ G[i + 1].append(i)",
"+G[x - 1].append(y - 1)",
"+G[y - 1].append(x - 1)",
"+for i in range(n):",
"+ q = deque([i])",
"+ ... | false | 0.101361 | 0.03634 | 2.789275 | [
"s786166087",
"s678834366"
] |
u655834330 | p03013 | python | s549004561 | s290364594 | 507 | 200 | 54,744 | 15,444 | Accepted | Accepted | 60.55 | from collections import defaultdict
def read_input():
n, m = list(map(int, input().split()))
d = defaultdict(lambda : True)
for i in range(m):
d[int(eval(input()))] = False
return n, m, d
def submit():
n, m, d = read_input()
prev = 1
prev_prev = 0
for... | from collections import defaultdict
def read_input():
n, m = list(map(int, input().split()))
d = defaultdict(lambda : True)
for i in range(m):
d[int(eval(input()))] = False
return n, m, d
def submit():
n, m, d = read_input()
prev = 1
prev_prev = 0
curr = ... | 37 | 36 | 594 | 604 | from collections import defaultdict
def read_input():
n, m = list(map(int, input().split()))
d = defaultdict(lambda: True)
for i in range(m):
d[int(eval(input()))] = False
return n, m, d
def submit():
n, m, d = read_input()
prev = 1
prev_prev = 0
for i in range(1, n + 1):
... | from collections import defaultdict
def read_input():
n, m = list(map(int, input().split()))
d = defaultdict(lambda: True)
for i in range(m):
d[int(eval(input()))] = False
return n, m, d
def submit():
n, m, d = read_input()
prev = 1
prev_prev = 0
curr = 1
for i in range(1... | false | 2.702703 | [
"+ curr = 1"
] | false | 0.05268 | 0.053912 | 0.977139 | [
"s549004561",
"s290364594"
] |
u623687794 | p02744 | python | s749001512 | s406153959 | 289 | 157 | 56,540 | 14,524 | Accepted | Accepted | 45.67 | n=int(eval(input()))
l=[["a"],["aa","ab"],[],[],[],[],[],[],[],[]]
for i in range(2,10):
for j in l[i-1]:
syurui=len(set(list(j)))
for h in range(syurui+1):
l[i].append(j+chr(97+h))
for i in l[n-1]:print(i) | n=int(eval(input()))
l=[["a"]]+[[] for i in range(9)]
for i in range(9):
for j in l[i]:
k=len(set(list(j)))
for h in range(k+1):
l[i+1].append(j+chr(97+h))
for i in l[n-1]:print(i)
| 8 | 8 | 223 | 198 | n = int(eval(input()))
l = [["a"], ["aa", "ab"], [], [], [], [], [], [], [], []]
for i in range(2, 10):
for j in l[i - 1]:
syurui = len(set(list(j)))
for h in range(syurui + 1):
l[i].append(j + chr(97 + h))
for i in l[n - 1]:
print(i)
| n = int(eval(input()))
l = [["a"]] + [[] for i in range(9)]
for i in range(9):
for j in l[i]:
k = len(set(list(j)))
for h in range(k + 1):
l[i + 1].append(j + chr(97 + h))
for i in l[n - 1]:
print(i)
| false | 0 | [
"-l = [[\"a\"], [\"aa\", \"ab\"], [], [], [], [], [], [], [], []]",
"-for i in range(2, 10):",
"- for j in l[i - 1]:",
"- syurui = len(set(list(j)))",
"- for h in range(syurui + 1):",
"- l[i].append(j + chr(97 + h))",
"+l = [[\"a\"]] + [[] for i in range(9)]",
"+for i in ra... | false | 0.151588 | 0.101942 | 1.486992 | [
"s749001512",
"s406153959"
] |
u200316926 | p02717 | python | s699776751 | s047770843 | 152 | 17 | 12,508 | 2,940 | Accepted | Accepted | 88.82 | import numpy as np
box = np.array(input().split())
box[0],box[1] = box[1], box[0]
box[0],box[2] = box[2], box[0]
print(("{} {} {}".format(box[0], box[1], box[2]))) | X, Y, Z = [int(x) for x in input().split()]
print((Z, X, Y)) | 7 | 2 | 169 | 59 | import numpy as np
box = np.array(input().split())
box[0], box[1] = box[1], box[0]
box[0], box[2] = box[2], box[0]
print(("{} {} {}".format(box[0], box[1], box[2])))
| X, Y, Z = [int(x) for x in input().split()]
print((Z, X, Y))
| false | 71.428571 | [
"-import numpy as np",
"-",
"-box = np.array(input().split())",
"-box[0], box[1] = box[1], box[0]",
"-box[0], box[2] = box[2], box[0]",
"-print((\"{} {} {}\".format(box[0], box[1], box[2])))",
"+X, Y, Z = [int(x) for x in input().split()]",
"+print((Z, X, Y))"
] | false | 0.259789 | 0.037345 | 6.956538 | [
"s699776751",
"s047770843"
] |
u529787332 | p03448 | python | s349758339 | s867099042 | 121 | 61 | 21,992 | 8,404 | Accepted | Accepted | 49.59 | cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
all_set = set([])
for a in range(cnt500+1):
tmp500 = a*500
if tmp500 > X:
break
all_set.add((tmp500, 0, 0))
for b in range(cnt100+1):
tmp100 = b*100
if tmp100... | cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
all = []
for a in range(cnt500+1):
for b in range(cnt100+1):
for c in range(cnt50+1):
all.append(a*500 + b*100 + c*50)
print((all.count(X))) | 27 | 11 | 598 | 255 | cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
all_set = set([])
for a in range(cnt500 + 1):
tmp500 = a * 500
if tmp500 > X:
break
all_set.add((tmp500, 0, 0))
for b in range(cnt100 + 1):
tmp100 = b * 100
if tmp100 > X:
... | cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
all = []
for a in range(cnt500 + 1):
for b in range(cnt100 + 1):
for c in range(cnt50 + 1):
all.append(a * 500 + b * 100 + c * 50)
print((all.count(X)))
| false | 59.259259 | [
"-all_set = set([])",
"+all = []",
"- tmp500 = a * 500",
"- if tmp500 > X:",
"- break",
"- all_set.add((tmp500, 0, 0))",
"- tmp100 = b * 100",
"- if tmp100 > X:",
"- break",
"- all_set.add((tmp500, tmp100, 0))",
"- tmp50 = c * 50",
"- ... | false | 0.137082 | 0.19868 | 0.689963 | [
"s349758339",
"s867099042"
] |
u156815136 | p03449 | python | s441340846 | s877940773 | 168 | 36 | 38,800 | 5,276 | Accepted | Accepted | 78.57 | #import collections
#aa = collections.Counter(a) # list to list
#mod = 10**9 + 7
def readInts():
return list(map(int,input().split()))
def main():
n = int(eval(input()))
A = [readInts() for _ in range(2)]
#print(*A)
# 下に行くidxを決めておく
idx = 0
# ゆーてnまでしかいけないけど
ma_ = -1
while... | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | 52 | 35 | 1,164 | 776 | # import collections
# aa = collections.Counter(a) # list to list
# mod = 10**9 + 7
def readInts():
return list(map(int, input().split()))
def main():
n = int(eval(input()))
A = [readInts() for _ in range(2)]
# print(*A)
# 下に行くidxを決めておく
idx = 0
# ゆーてnまでしかいけないけど
ma_ = -1
while idx <... | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | false | 32.692308 | [
"+from statistics import median",
"+",
"-# aa = collections.Counter(a) # list to list",
"-# mod = 10**9 + 7",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+from fractions import gcd",
"+from itertools import combinations # (string,3) 3回",
"+from collections... | false | 0.086175 | 0.066705 | 1.291887 | [
"s441340846",
"s877940773"
] |
u917013605 | p02843 | python | s336914284 | s876453325 | 169 | 94 | 38,512 | 3,828 | Accepted | Accepted | 44.38 | import sys
x = int(eval(input()))
for i in range(x):
if i * 100 <= x <= i * 105:
print((1))
sys.exit()
print((0))
| x = int(input())
dp = [False] * (x + 106)
money_li = [100, 101, 102, 103, 104, 105]
dp[0] = True
for i in range(x + 1):
if dp[i]:
for money in money_li:
dp[i + money] = True
print(1) if dp[x] else print(0)
| 9 | 10 | 134 | 240 | import sys
x = int(eval(input()))
for i in range(x):
if i * 100 <= x <= i * 105:
print((1))
sys.exit()
print((0))
| x = int(input())
dp = [False] * (x + 106)
money_li = [100, 101, 102, 103, 104, 105]
dp[0] = True
for i in range(x + 1):
if dp[i]:
for money in money_li:
dp[i + money] = True
print(1) if dp[x] else print(0)
| false | 10 | [
"-import sys",
"-",
"-x = int(eval(input()))",
"-for i in range(x):",
"- if i * 100 <= x <= i * 105:",
"- print((1))",
"- sys.exit()",
"-print((0))",
"+x = int(input())",
"+dp = [False] * (x + 106)",
"+money_li = [100, 101, 102, 103, 104, 105]",
"+dp[0] = True",
"+for i in r... | false | 0.041698 | 0.035847 | 1.163229 | [
"s336914284",
"s876453325"
] |
u477320129 | p03837 | python | s625745842 | s006373485 | 212 | 187 | 38,236 | 38,188 | Accepted | Accepted | 11.79 | #!/usr/bin/env python3
import sys
def solve(N: int, M: int, a: "List[int]", b: "List[int]", c: "List[int]"):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
omat = csr_matrix((c+c, (a+b, b+a)), shape=(N+1, N+1), dtype=np.int32)
... | #!/usr/bin/env python3
import sys
def solve(N: int, M: int, a: "List[int]", b: "List[int]", c: "List[int]"):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
omat = csr_matrix((c, (a, b)), shape=(N+1, N+1), dtype=np.int32)
smat =... | 37 | 37 | 1,118 | 1,123 | #!/usr/bin/env python3
import sys
def solve(N: int, M: int, a: "List[int]", b: "List[int]", c: "List[int]"):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
omat = csr_matrix((c + c, (a + b, b + a)), shape=(N + 1, N + 1), dtype=np.int32)
smat... | #!/usr/bin/env python3
import sys
def solve(N: int, M: int, a: "List[int]", b: "List[int]", c: "List[int]"):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
omat = csr_matrix((c, (a, b)), shape=(N + 1, N + 1), dtype=np.int32)
smat = floyd_war... | false | 0 | [
"- omat = csr_matrix((c + c, (a + b, b + a)), shape=(N + 1, N + 1), dtype=np.int32)",
"- smat = floyd_warshall(omat)",
"- return ((omat - smat) > 0).sum() // 2",
"+ omat = csr_matrix((c, (a, b)), shape=(N + 1, N + 1), dtype=np.int32)",
"+ smat = floyd_warshall(omat, directed=False)",
"+ ... | false | 0.45307 | 0.550572 | 0.822908 | [
"s625745842",
"s006373485"
] |
u482157295 | p02743 | python | s934064120 | s894935827 | 33 | 17 | 5,076 | 2,940 | Accepted | Accepted | 48.48 | from decimal import Decimal
a, b, c = list(map(int,input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| import math
a, b, c = list(map(int, input().split()))
ab = a * b
out = c - a - b
num = ((out))**2
if out < 0:
num = -num
if 4*ab < num:
print("Yes")
else:
print("No")
| 6 | 16 | 175 | 188 | from decimal import Decimal
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| import math
a, b, c = list(map(int, input().split()))
ab = a * b
out = c - a - b
num = ((out)) ** 2
if out < 0:
num = -num
if 4 * ab < num:
print("Yes")
else:
print("No")
| false | 62.5 | [
"-from decimal import Decimal",
"+import math",
"-if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():",
"+ab = a * b",
"+out = c - a - b",
"+num = ((out)) ** 2",
"+if out < 0:",
"+ num = -num",
"+if 4 * ab < num:"
] | false | 0.036777 | 0.034964 | 1.051856 | [
"s934064120",
"s894935827"
] |
u921773161 | p02834 | python | s415465052 | s186593902 | 1,168 | 675 | 49,240 | 29,776 | Accepted | Accepted | 42.21 | #%%
n, u, v = list(map(int, input().split()))
u, v = u-1, v-1
reach = [[] for _ in range(n)]
for i in range(n-1):
a, b = [int(x)-1 for x in input().split()]
reach[a].append(b)
reach[b].append(a)
def x_route(x, reach):
x_route = [[-1, -1] for _ in range(n)]
check = [0] * n
stack = [x... | n, u, v = list(map(int, input().split()))
u, v = u-1, v-1
reach = [[] for _ in range(n)]
for i in range(n-1):
a, b = [int(x)-1 for x in input().split()]
reach[a].append(b)
reach[b].append(a)
def x_route(x, reach):
x_route = [-1] * n
check = [0] * n
stack = [x]
check[x] = 1
... | 35 | 32 | 884 | 792 | #%%
n, u, v = list(map(int, input().split()))
u, v = u - 1, v - 1
reach = [[] for _ in range(n)]
for i in range(n - 1):
a, b = [int(x) - 1 for x in input().split()]
reach[a].append(b)
reach[b].append(a)
def x_route(x, reach):
x_route = [[-1, -1] for _ in range(n)]
check = [0] * n
stack = [x]
... | n, u, v = list(map(int, input().split()))
u, v = u - 1, v - 1
reach = [[] for _ in range(n)]
for i in range(n - 1):
a, b = [int(x) - 1 for x in input().split()]
reach[a].append(b)
reach[b].append(a)
def x_route(x, reach):
x_route = [-1] * n
check = [0] * n
stack = [x]
check[x] = 1
x_ro... | false | 8.571429 | [
"-#%%",
"- x_route = [[-1, -1] for _ in range(n)]",
"+ x_route = [-1] * n",
"- x_route[x] = [-1, 0]",
"+ x_route[x] = 0",
"- if check[i] == 1:",
"- pass",
"- else:",
"+ if check[i] != 1:",
"- x_route[i] = [tmp, x_route[tmp]... | false | 0.064035 | 0.045913 | 1.394688 | [
"s415465052",
"s186593902"
] |
u346812984 | p03162 | python | s267155639 | s198843863 | 715 | 331 | 41,748 | 32,392 | Accepted | Accepted | 53.71 | N = int(eval(input()))
abc = []
abc.append((0, 0, 0))
for _ in range(N):
a, b, c = list(map(int, input().split()))
abc.append((a, b, c))
dp = [[float("inf") for _ in range(3)] for _ in range(N + 1)]
dp[0] = [0, 0, 0]
for i in range(1, N + 1):
dp[i][0] = max(dp[i - 1][1] + abc[i][0], dp[i - 1][2... | import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
ABC = [(0, 0, 0)]
for _ in range(N):
a, b, c = list(map(int, input().split()))
ABC.append((a, b, c))
... | 16 | 32 | 514 | 705 | N = int(eval(input()))
abc = []
abc.append((0, 0, 0))
for _ in range(N):
a, b, c = list(map(int, input().split()))
abc.append((a, b, c))
dp = [[float("inf") for _ in range(3)] for _ in range(N + 1)]
dp[0] = [0, 0, 0]
for i in range(1, N + 1):
dp[i][0] = max(dp[i - 1][1] + abc[i][0], dp[i - 1][2] + abc[i][0]... | import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
ABC = [(0, 0, 0)]
for _ in range(N):
a, b, c = list(map(int, input().split()))
ABC.append((a, b, c))
dp_a = [0] * (N + 1... | false | 50 | [
"-N = int(eval(input()))",
"-abc = []",
"-abc.append((0, 0, 0))",
"-for _ in range(N):",
"- a, b, c = list(map(int, input().split()))",
"- abc.append((a, b, c))",
"-dp = [[float(\"inf\") for _ in range(3)] for _ in range(N + 1)]",
"-dp[0] = [0, 0, 0]",
"-for i in range(1, N + 1):",
"- dp[... | false | 0.070579 | 0.036334 | 1.942514 | [
"s267155639",
"s198843863"
] |
u985929170 | p02576 | python | s456962647 | s125286751 | 69 | 29 | 61,928 | 9,160 | Accepted | Accepted | 57.97 | n,x,t = list(map(int,input().split()))
import math
print((t * math.ceil(n/x))) | n,x,t = list(map(int,input().split()))
if n%x == 0:
print((int(n/x)*t))
else:
print(((1+n//x)*t)) | 3 | 6 | 72 | 101 | n, x, t = list(map(int, input().split()))
import math
print((t * math.ceil(n / x)))
| n, x, t = list(map(int, input().split()))
if n % x == 0:
print((int(n / x) * t))
else:
print(((1 + n // x) * t))
| false | 50 | [
"-import math",
"-",
"-print((t * math.ceil(n / x)))",
"+if n % x == 0:",
"+ print((int(n / x) * t))",
"+else:",
"+ print(((1 + n // x) * t))"
] | false | 0.143797 | 0.133858 | 1.074251 | [
"s456962647",
"s125286751"
] |
u223663729 | p02813 | python | s875428174 | s603566073 | 216 | 27 | 3,064 | 8,052 | Accepted | Accepted | 87.5 | def dfs(res, chk):
if len(res) == n:
global idx
global pi
global qi
idx += 1
pb = all(res[i]+1 == p for i, p in enumerate(P))
qb = all(res[i]+1 == q for i, q in enumerate(Q))
if pb:
pi = idx
if qb:
qi = idx
r... | # AtCoder Beginner Contest 150
# C - Count Order
# https://atcoder.jp/contests/abc150/tasks/abc150_c
from itertools import permutations
N = int(eval(input()))
P = tuple(i-1 for i in map(int, input().split()))
Q = tuple(i-1 for i in map(int, input().split()))
F = list(permutations(list(range(N))))
print(... | 28 | 13 | 620 | 338 | def dfs(res, chk):
if len(res) == n:
global idx
global pi
global qi
idx += 1
pb = all(res[i] + 1 == p for i, p in enumerate(P))
qb = all(res[i] + 1 == q for i, q in enumerate(Q))
if pb:
pi = idx
if qb:
qi = idx
return
... | # AtCoder Beginner Contest 150
# C - Count Order
# https://atcoder.jp/contests/abc150/tasks/abc150_c
from itertools import permutations
N = int(eval(input()))
P = tuple(i - 1 for i in map(int, input().split()))
Q = tuple(i - 1 for i in map(int, input().split()))
F = list(permutations(list(range(N))))
print((abs(F.inde... | false | 53.571429 | [
"-def dfs(res, chk):",
"- if len(res) == n:",
"- global idx",
"- global pi",
"- global qi",
"- idx += 1",
"- pb = all(res[i] + 1 == p for i, p in enumerate(P))",
"- qb = all(res[i] + 1 == q for i, q in enumerate(Q))",
"- if pb:",
"- pi... | false | 0.042943 | 0.057042 | 0.752832 | [
"s875428174",
"s603566073"
] |
u525065967 | p02571 | python | s335312846 | s197186588 | 87 | 62 | 9,136 | 9,028 | Accepted | Accepted | 28.74 | s = eval(input())
t = eval(input())
INF = 10**9
min_ans = INF
for i in range(len(s)-len(t)+1):
c = 0
for j in range(len(t)):
si = s[i+j]
ti = t[j]
# print(i,j,si,ti)
if si == ti:
c += 1
min_ans = min(min_ans, len(t)-c)
print(min_ans)
| s = eval(input())
t = eval(input())
ans = 10**9
for i in range(len(s)-len(t)+1):
c = 0
for j in range(len(t)):
if s[i+j] != t[j]: c += 1
ans = min(ans, c)
print(ans)
| 15 | 9 | 293 | 182 | s = eval(input())
t = eval(input())
INF = 10**9
min_ans = INF
for i in range(len(s) - len(t) + 1):
c = 0
for j in range(len(t)):
si = s[i + j]
ti = t[j]
# print(i,j,si,ti)
if si == ti:
c += 1
min_ans = min(min_ans, len(t) - c)
print(min_ans)
| s = eval(input())
t = eval(input())
ans = 10**9
for i in range(len(s) - len(t) + 1):
c = 0
for j in range(len(t)):
if s[i + j] != t[j]:
c += 1
ans = min(ans, c)
print(ans)
| false | 40 | [
"-INF = 10**9",
"-min_ans = INF",
"+ans = 10**9",
"- si = s[i + j]",
"- ti = t[j]",
"- # print(i,j,si,ti)",
"- if si == ti:",
"+ if s[i + j] != t[j]:",
"- min_ans = min(min_ans, len(t) - c)",
"-print(min_ans)",
"+ ans = min(ans, c)",
"+print(ans)"
] | false | 0.036257 | 0.035359 | 1.025373 | [
"s335312846",
"s197186588"
] |
u813098295 | p03045 | python | s557814000 | s840378591 | 1,000 | 533 | 78,168 | 5,472 | Accepted | Accepted | 46.7 | class uf_tree:
def __init__(self, n):
self._size = n
self.sizes = [1] * n
self.par = list(range(n))
def find(self, x):
if x == self.par[x]:
return x
self.par[x] = self.find(self.par[x])
return self.par[x]
def unite(self, x, y):
... | class UnionFind:
def __init__(self, n):
self.parent = [ -1 for _ in range(n) ]
self._size = n
def unite(self, x, y):
x, y = self.root(x), self.root(y)
if x != y:
if self.parent[y] < self.parent[x]:
x, y = y, x
self.parent[x] += sel... | 39 | 32 | 904 | 899 | class uf_tree:
def __init__(self, n):
self._size = n
self.sizes = [1] * n
self.par = list(range(n))
def find(self, x):
if x == self.par[x]:
return x
self.par[x] = self.find(self.par[x])
return self.par[x]
def unite(self, x, y):
self._size... | class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
self._size = n
def unite(self, x, y):
x, y = self.root(x), self.root(y)
if x != y:
if self.parent[y] < self.parent[x]:
x, y = y, x
self.parent[x] += self.parent[y... | false | 17.948718 | [
"-class uf_tree:",
"+class UnionFind:",
"+ self.parent = [-1 for _ in range(n)]",
"- self.sizes = [1] * n",
"- self.par = list(range(n))",
"-",
"- def find(self, x):",
"- if x == self.par[x]:",
"- return x",
"- self.par[x] = self.find(self.par[x])",... | false | 0.043181 | 0.101111 | 0.427069 | [
"s557814000",
"s840378591"
] |
u747602774 | p02768 | python | s802228039 | s963259859 | 799 | 109 | 3,064 | 3,064 | Accepted | Accepted | 86.36 | def modinv(a,m):
return pow(a,m-2,m)
n,a,b = list(map(int,input().split()))
P = 10**9+7
nCa = 1
for i in range(1,a+1):
nCa = nCa*(n+1-i)*modinv(i,P)%P
nCb = nCa
for j in range(a+1,b+1):
nCb = nCb*(n+1-j)*modinv(j,P)%P
ans = (pow(2,n,P) -1 - nCa - nCb + 2*P)%P
print(ans)
| def comb(n, r, mod):
r = min(r, n-r)
mol = 1
for i in range(n-r+1, n+1):
mol = (mol * i) % mod
deno = 1
for i in range(1, r+1):
deno = (deno * i) % mod
ret = mol * pow(deno, mod-2, mod) % mod
return ret
n,a,b = list(map(int,input().split()))
P = 10**9+7
nCa ... | 17 | 20 | 298 | 408 | def modinv(a, m):
return pow(a, m - 2, m)
n, a, b = list(map(int, input().split()))
P = 10**9 + 7
nCa = 1
for i in range(1, a + 1):
nCa = nCa * (n + 1 - i) * modinv(i, P) % P
nCb = nCa
for j in range(a + 1, b + 1):
nCb = nCb * (n + 1 - j) * modinv(j, P) % P
ans = (pow(2, n, P) - 1 - nCa - nCb + 2 * P) % P... | def comb(n, r, mod):
r = min(r, n - r)
mol = 1
for i in range(n - r + 1, n + 1):
mol = (mol * i) % mod
deno = 1
for i in range(1, r + 1):
deno = (deno * i) % mod
ret = mol * pow(deno, mod - 2, mod) % mod
return ret
n, a, b = list(map(int, input().split()))
P = 10**9 + 7
nCa... | false | 15 | [
"-def modinv(a, m):",
"- return pow(a, m - 2, m)",
"+def comb(n, r, mod):",
"+ r = min(r, n - r)",
"+ mol = 1",
"+ for i in range(n - r + 1, n + 1):",
"+ mol = (mol * i) % mod",
"+ deno = 1",
"+ for i in range(1, r + 1):",
"+ deno = (deno * i) % mod",
"+ ret = ... | false | 0.836181 | 0.080256 | 10.418955 | [
"s802228039",
"s963259859"
] |
u934868410 | p02888 | python | s214308202 | s020925873 | 783 | 241 | 45,696 | 42,860 | Accepted | Accepted | 69.22 | from bisect import bisect_left
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
for j in range(i+1, n):
left = l[j]-l[i]
right = l[i]+l[j]
ans += max(0, bisect_left(l, right) - (j+1))
print(ans) | n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
lt = [n] * (l[n-1] + l[n-2] + 1)
ans = 0
for i in range(l[0]+1):
lt[i] = 0
length = l[0]
for i in range(1, n):
if length < l[i]:
for j in range(length+1, l[i]+1):
lt[j] = i
length = l[i]
for i in range(n):
for j in r... | 11 | 18 | 258 | 401 | from bisect import bisect_left
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
for j in range(i + 1, n):
left = l[j] - l[i]
right = l[i] + l[j]
ans += max(0, bisect_left(l, right) - (j + 1))
print(ans)
| n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
lt = [n] * (l[n - 1] + l[n - 2] + 1)
ans = 0
for i in range(l[0] + 1):
lt[i] = 0
length = l[0]
for i in range(1, n):
if length < l[i]:
for j in range(length + 1, l[i] + 1):
lt[j] = i
length = l[i]
for i in range(n):
... | false | 38.888889 | [
"-from bisect import bisect_left",
"-",
"+lt = [n] * (l[n - 1] + l[n - 2] + 1)",
"+for i in range(l[0] + 1):",
"+ lt[i] = 0",
"+length = l[0]",
"+for i in range(1, n):",
"+ if length < l[i]:",
"+ for j in range(length + 1, l[i] + 1):",
"+ lt[j] = i",
"+ length = l[... | false | 0.038117 | 0.038117 | 0.999996 | [
"s214308202",
"s020925873"
] |
u365364616 | p03963 | python | s278910774 | s873504951 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n, k = list(map(int, input().split()))
print((k * (k - 1) ** max(0, n - 1)))
| n, k = list(map(int, input().split()))
print((k * (k - 1) ** (n - 1)))
| 2 | 2 | 70 | 64 | n, k = list(map(int, input().split()))
print((k * (k - 1) ** max(0, n - 1)))
| n, k = list(map(int, input().split()))
print((k * (k - 1) ** (n - 1)))
| false | 0 | [
"-print((k * (k - 1) ** max(0, n - 1)))",
"+print((k * (k - 1) ** (n - 1)))"
] | false | 0.044804 | 0.047166 | 0.949922 | [
"s278910774",
"s873504951"
] |
u169200126 | p02659 | python | s952666674 | s775474296 | 24 | 21 | 9,100 | 8,964 | Accepted | Accepted | 12.5 | a, b = list(map(float, input().split()))
c = int(a)*int(float(b) * 1000)//1000
print (c) | a, b = list(map(float, input().split()))
b = float(b)
c = int(a)*int(b * 1000)//1000
print (c) | 5 | 6 | 88 | 95 | a, b = list(map(float, input().split()))
c = int(a) * int(float(b) * 1000) // 1000
print(c)
| a, b = list(map(float, input().split()))
b = float(b)
c = int(a) * int(b * 1000) // 1000
print(c)
| false | 16.666667 | [
"-c = int(a) * int(float(b) * 1000) // 1000",
"+b = float(b)",
"+c = int(a) * int(b * 1000) // 1000"
] | false | 0.07554 | 0.038433 | 1.965496 | [
"s952666674",
"s775474296"
] |
u912237403 | p00064 | python | s381615291 | s471226117 | 20 | 10 | 4,188 | 4,180 | Accepted | Accepted | 50 | import sys,re
p=re.compile('\d+')
x=[]
for s in sys.stdin:
x+=p.findall(s)
print(sum(map(int,x))) | import sys,re
s="".join([s for s in sys.stdin])
p=re.compile('\d+')
x=p.findall(s)
print(sum(map(int,x))) | 6 | 5 | 105 | 108 | import sys, re
p = re.compile("\d+")
x = []
for s in sys.stdin:
x += p.findall(s)
print(sum(map(int, x)))
| import sys, re
s = "".join([s for s in sys.stdin])
p = re.compile("\d+")
x = p.findall(s)
print(sum(map(int, x)))
| false | 16.666667 | [
"+s = \"\".join([s for s in sys.stdin])",
"-x = []",
"-for s in sys.stdin:",
"- x += p.findall(s)",
"+x = p.findall(s)"
] | false | 0.054366 | 0.055212 | 0.984684 | [
"s381615291",
"s471226117"
] |
u762420987 | p02762 | python | s446045149 | s568855178 | 1,222 | 734 | 9,844 | 14,136 | Accepted | Accepted | 39.93 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 64 | 63 | 1,701 | 1,566 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 1.5625 | [
"- def __str__(self):",
"- return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())",
"+import sys",
"-N, M, K = map(int, input().split())",
"+input = sys.stdin.readline",
"+N, M, K = list(map(int, input().split()))",
"-not_friend_candidates = [1] * N",
"+ans = [0] * ... | false | 0.044802 | 0.040955 | 1.09392 | [
"s446045149",
"s568855178"
] |
u843175622 | p03951 | python | s552619455 | s839388945 | 29 | 26 | 9,096 | 9,012 | Accepted | Accepted | 10.34 | n = int(eval(input()))
s = eval(input())
t = eval(input())
ans = n * 2
for i in range(n):
if s[n - i - 1:] == t[:i + 1]:
ans = min(ans, n * 2 - (i + 1))
print(ans)
| n = int(eval(input()))
s = eval(input())
t = eval(input())
a = 0
for i in range(n):
if s[n - i - 1:] == t[:i + 1]:
a = i + 1
print((n * 2 - a))
| 9 | 9 | 167 | 145 | n = int(eval(input()))
s = eval(input())
t = eval(input())
ans = n * 2
for i in range(n):
if s[n - i - 1 :] == t[: i + 1]:
ans = min(ans, n * 2 - (i + 1))
print(ans)
| n = int(eval(input()))
s = eval(input())
t = eval(input())
a = 0
for i in range(n):
if s[n - i - 1 :] == t[: i + 1]:
a = i + 1
print((n * 2 - a))
| false | 0 | [
"-ans = n * 2",
"+a = 0",
"- ans = min(ans, n * 2 - (i + 1))",
"-print(ans)",
"+ a = i + 1",
"+print((n * 2 - a))"
] | false | 0.122732 | 0.049117 | 2.498773 | [
"s552619455",
"s839388945"
] |
u870164956 | p02900 | python | s973888879 | s115280911 | 406 | 271 | 118,248 | 113,904 | Accepted | Accepted | 33.25 | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素因数の種類の数+1が答え
from fractions import gcd
def main():
a, b = list(map(int, input().split()))
print((num_facto(gcd(a,b)) + 1))
def num_facto(n):
ans = 0
max_n = int((n ** 0.5) // 1) + 1
is_prime = [True for x in range(max_n + 1)]
... | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素因数の種類の数+1が答え
def main():
a, b = sorted(list(map(int, input().split())), reverse = True)
while b != 0:
a, b = b, a % b
print((num_facto(a) + 1))
def num_facto(n):
ans = 0
max_n = int((n ** 0.5) // 1) + 1
is_prime = [True fo... | 35 | 35 | 786 | 818 | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素因数の種類の数+1が答え
from fractions import gcd
def main():
a, b = list(map(int, input().split()))
print((num_facto(gcd(a, b)) + 1))
def num_facto(n):
ans = 0
max_n = int((n**0.5) // 1) + 1
is_prime = [True for x in range(max_n + 1)]
is_p... | # 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素因数の種類の数+1が答え
def main():
a, b = sorted(list(map(int, input().split())), reverse=True)
while b != 0:
a, b = b, a % b
print((num_facto(a) + 1))
def num_facto(n):
ans = 0
max_n = int((n**0.5) // 1) + 1
is_prime = [True for x i... | false | 0 | [
"-from fractions import gcd",
"-",
"-",
"- a, b = list(map(int, input().split()))",
"- print((num_facto(gcd(a, b)) + 1))",
"+ a, b = sorted(list(map(int, input().split())), reverse=True)",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ print((num_facto(a) + 1))"
] | false | 0.052229 | 0.048539 | 1.07603 | [
"s973888879",
"s115280911"
] |
u168578024 | p03061 | python | s101063526 | s456882600 | 1,062 | 818 | 104,992 | 82,340 | Accepted | Accepted | 22.98 | import copy
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = copy.deepcopy(I)
self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)]
def assign(self, k, x):
self.seg[k + self.sz] = copy.deepcopy(x)
def build(se... | import copy
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I for i in range(self.sz * 2)]
def assign(self, k, x):
self.seg[k + self.sz] = x
def build(self):
for i in range(self.sz - 1, 0, ... | 55 | 55 | 1,527 | 1,437 | import copy
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = copy.deepcopy(I)
self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)]
def assign(self, k, x):
self.seg[k + self.sz] = copy.deepcopy(x)
def build(self):
... | import copy
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I for i in range(self.sz * 2)]
def assign(self, k, x):
self.seg[k + self.sz] = x
def build(self):
for i in range(self.sz - 1, 0, -1):
... | false | 0 | [
"- self.I = copy.deepcopy(I)",
"- self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)]",
"+ self.I = I",
"+ self.seg = [I for i in range(self.sz * 2)]",
"- self.seg[k + self.sz] = copy.deepcopy(x)",
"+ self.seg[k + self.sz] = x",
"- self.seg[k] = cop... | false | 0.093821 | 0.213578 | 0.439285 | [
"s101063526",
"s456882600"
] |
u879870653 | p02948 | python | s333025102 | s185909971 | 934 | 615 | 82,020 | 39,664 | Accepted | Accepted | 34.15 | import heapq
class Heapq :
def __init__(self, arr, desc=False) :
if desc :
arr = [-a for a in arr]
self.sign = -1 if desc else 1
self.hq = arr
heapq.heapify(self.hq)
def pop(self) :
return heapq.heappop(self.hq) * self.sign
def push(self, a):
... | import heapq
class Heapq :
def __init__(self, arr, desc=False) :
if desc :
arr = [-a for a in arr]
self.sign = -1 if desc else 1
self.hq = arr
heapq.heapify(self.hq)
def pop(self) :
return heapq.heappop(self.hq) * self.sign
def push(self, a):
... | 33 | 32 | 804 | 815 | import heapq
class Heapq:
def __init__(self, arr, desc=False):
if desc:
arr = [-a for a in arr]
self.sign = -1 if desc else 1
self.hq = arr
heapq.heapify(self.hq)
def pop(self):
return heapq.heappop(self.hq) * self.sign
def push(self, a):
heapq... | import heapq
class Heapq:
def __init__(self, arr, desc=False):
if desc:
arr = [-a for a in arr]
self.sign = -1 if desc else 1
self.hq = arr
heapq.heapify(self.hq)
def pop(self):
return heapq.heappop(self.hq) * self.sign
def push(self, a):
heapq... | false | 3.030303 | [
"-D = {i: [] for i in range(1, M + 1)}",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"- if a > M:",
"- continue",
"- D[a].append(b)",
"-q = Heapq([], True)",
"+AB = [list(map(int, input().split())) for i in range(N)]",
"+L = [[] for i in range(10**5 + 1)]",
"... | false | 0.09507 | 0.233751 | 0.406715 | [
"s333025102",
"s185909971"
] |
u547167033 | p03031 | python | s662627652 | s936593263 | 49 | 32 | 3,064 | 3,064 | Accepted | Accepted | 34.69 | n,m=list(map(int,input().split()))
l=[list(map(int,input().split()))[1:] for i in range(m)]
p=list(map(int,input().split()))
form = "0" + str(n) + "b"
ans=0
for i in range(2**n):
ptr = format(i,form)
flg = True
for j in range(m):
s= sum(int(ptr[k-1]) for k in l[j])
if s%2 != p[j]:
flg = False
if ... | n,m=list(map(int,input().split()))
k=[0]*m
s=[set() for i in range(m)]
for i in range(m):
k[i],*t=list(map(int,input().split()))
for j in range(k[i]):
s[i].add(t[j]-1)
ans=0
p=list(map(int,input().split()))
for i in range(2**n):
switch=[0]*n
flag=True
for j in range(n):
if i>>j&1:
... | 15 | 26 | 348 | 527 | n, m = list(map(int, input().split()))
l = [list(map(int, input().split()))[1:] for i in range(m)]
p = list(map(int, input().split()))
form = "0" + str(n) + "b"
ans = 0
for i in range(2**n):
ptr = format(i, form)
flg = True
for j in range(m):
s = sum(int(ptr[k - 1]) for k in l[j])
if s % 2 !... | n, m = list(map(int, input().split()))
k = [0] * m
s = [set() for i in range(m)]
for i in range(m):
k[i], *t = list(map(int, input().split()))
for j in range(k[i]):
s[i].add(t[j] - 1)
ans = 0
p = list(map(int, input().split()))
for i in range(2**n):
switch = [0] * n
flag = True
for j in rang... | false | 42.307692 | [
"-l = [list(map(int, input().split()))[1:] for i in range(m)]",
"+k = [0] * m",
"+s = [set() for i in range(m)]",
"+for i in range(m):",
"+ k[i], *t = list(map(int, input().split()))",
"+ for j in range(k[i]):",
"+ s[i].add(t[j] - 1)",
"+ans = 0",
"-form = \"0\" + str(n) + \"b\"",
"-a... | false | 0.046032 | 0.038067 | 1.209231 | [
"s662627652",
"s936593263"
] |
u258647915 | p03946 | python | s483437333 | s320652258 | 166 | 147 | 14,252 | 14,252 | Accepted | Accepted | 11.45 | def readints(): return list(map(int,input().split()))
N, T = readints()
a = list(readints())
mdiff = 0
mi = 1145141919
for i in range(N):
mi = min(mi, a[i])
mdiff = max(mdiff, a[i] - mi)
mi = 1145141919
ans = 0
for i in range(N):
mi = min(mi, a[i])
ans += (a[i] - mi == mdiff)
print(... | def readints(): return list(map(int,input().split()))
N, T = readints()
a = list(readints())
mdiff = 0
mi = 1145141919
for x in a:
mi = min(mi, x)
mdiff = max(mdiff, x - mi)
mi = 1145141919
ans = 0
for x in a:
mi = min(mi, x)
ans += (x - mi == mdiff)
print(ans) | 18 | 18 | 318 | 292 | def readints():
return list(map(int, input().split()))
N, T = readints()
a = list(readints())
mdiff = 0
mi = 1145141919
for i in range(N):
mi = min(mi, a[i])
mdiff = max(mdiff, a[i] - mi)
mi = 1145141919
ans = 0
for i in range(N):
mi = min(mi, a[i])
ans += a[i] - mi == mdiff
print(ans)
| def readints():
return list(map(int, input().split()))
N, T = readints()
a = list(readints())
mdiff = 0
mi = 1145141919
for x in a:
mi = min(mi, x)
mdiff = max(mdiff, x - mi)
mi = 1145141919
ans = 0
for x in a:
mi = min(mi, x)
ans += x - mi == mdiff
print(ans)
| false | 0 | [
"-for i in range(N):",
"- mi = min(mi, a[i])",
"- mdiff = max(mdiff, a[i] - mi)",
"+for x in a:",
"+ mi = min(mi, x)",
"+ mdiff = max(mdiff, x - mi)",
"-for i in range(N):",
"- mi = min(mi, a[i])",
"- ans += a[i] - mi == mdiff",
"+for x in a:",
"+ mi = min(mi, x)",
"+ a... | false | 0.076966 | 0.076626 | 1.004436 | [
"s483437333",
"s320652258"
] |
u066855390 | p02754 | python | s109290873 | s496283371 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | n, a, b = list(map(int, input().split()))
amari = n % (a+b)
sho = n // (a+b)
if n <= a:
print(n)
elif amari == 0:
print((a*sho))
elif amari < a:
print((a*sho + amari))
else:
print((a*sho + a))
| n, a, b = list(map(int, input().split()))
amari = n % (a + b)
sho = n // (a + b)
if n <= a:
print(n)
else:
print((a * sho + min(a, amari)))
| 11 | 8 | 207 | 148 | n, a, b = list(map(int, input().split()))
amari = n % (a + b)
sho = n // (a + b)
if n <= a:
print(n)
elif amari == 0:
print((a * sho))
elif amari < a:
print((a * sho + amari))
else:
print((a * sho + a))
| n, a, b = list(map(int, input().split()))
amari = n % (a + b)
sho = n // (a + b)
if n <= a:
print(n)
else:
print((a * sho + min(a, amari)))
| false | 27.272727 | [
"-elif amari == 0:",
"- print((a * sho))",
"-elif amari < a:",
"- print((a * sho + amari))",
"- print((a * sho + a))",
"+ print((a * sho + min(a, amari)))"
] | false | 0.047716 | 0.048888 | 0.976029 | [
"s109290873",
"s496283371"
] |
u332906195 | p03147 | python | s002356923 | s541464037 | 21 | 19 | 3,060 | 2,940 | Accepted | Accepted | 9.52 | # -*- coding: utf-8 -*-
n = int(eval(input()))
h_list = list(map(int, input().split()))
if not len(h_list) == n :
raise RuntimeError("Mismatch Length.")
count = 0
while True:
h_max = max(h_list)
if h_max == 0:
break
isMax_list = [h == h_max for h in h_list]
for i, isMa... | N = int(eval(input()))
H = [0] + list(map(int, input().split()))
ans = 0
for i in range(N):
ans += max(H[i + 1] - H[i], 0)
print(ans)
| 24 | 6 | 480 | 137 | # -*- coding: utf-8 -*-
n = int(eval(input()))
h_list = list(map(int, input().split()))
if not len(h_list) == n:
raise RuntimeError("Mismatch Length.")
count = 0
while True:
h_max = max(h_list)
if h_max == 0:
break
isMax_list = [h == h_max for h in h_list]
for i, isMax in enumerate(isMax_lis... | N = int(eval(input()))
H = [0] + list(map(int, input().split()))
ans = 0
for i in range(N):
ans += max(H[i + 1] - H[i], 0)
print(ans)
| false | 75 | [
"-# -*- coding: utf-8 -*-",
"-n = int(eval(input()))",
"-h_list = list(map(int, input().split()))",
"-if not len(h_list) == n:",
"- raise RuntimeError(\"Mismatch Length.\")",
"-count = 0",
"-while True:",
"- h_max = max(h_list)",
"- if h_max == 0:",
"- break",
"- isMax_list = ... | false | 0.035785 | 0.035467 | 1.00897 | [
"s002356923",
"s541464037"
] |
u714533789 | p03494 | python | s240448118 | s969370924 | 21 | 19 | 3,056 | 2,940 | Accepted | Accepted | 9.52 | from time import sleep
n = eval(input())
A = list(map(int, input().split()))
i = 0
while True:
if len([a for a in A if a % 2]) > 0:
break
A = list([x/2 for x in A])
i+=1
print(i)
| n = eval(input())
A = list(map(int, input().split()))
i = 0
while True:
if len([a for a in A if a % 2]) > 0:
break
A = list([x/2 for x in A])
i+=1
print(i)
| 10 | 9 | 207 | 183 | from time import sleep
n = eval(input())
A = list(map(int, input().split()))
i = 0
while True:
if len([a for a in A if a % 2]) > 0:
break
A = list([x / 2 for x in A])
i += 1
print(i)
| n = eval(input())
A = list(map(int, input().split()))
i = 0
while True:
if len([a for a in A if a % 2]) > 0:
break
A = list([x / 2 for x in A])
i += 1
print(i)
| false | 10 | [
"-from time import sleep",
"-"
] | false | 0.03599 | 0.03564 | 1.009836 | [
"s240448118",
"s969370924"
] |
u536600145 | p03161 | python | s648885861 | s202051257 | 456 | 376 | 55,136 | 52,448 | Accepted | Accepted | 17.54 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float('Inf')] * n
dp[0] = 0
for i in range(n):
for j in range(i+1, i+k+1):
if j < n:
dp[j] = min(dp[j], dp[i]+abs(h[i]-h[j]))
print((dp[-1])) | import sys
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [sys.maxsize] * n
dp[0] = 0
for i in range(n):
for j in range(i+1, i+k+1):
if j < n:
dp[j] = min(dp[j], dp[i]+abs(h[i]-h[j]))
print((dp[-1])) | 12 | 13 | 264 | 275 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("Inf")] * n
dp[0] = 0
for i in range(n):
for j in range(i + 1, i + k + 1):
if j < n:
dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))
print((dp[-1]))
| import sys
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [sys.maxsize] * n
dp[0] = 0
for i in range(n):
for j in range(i + 1, i + k + 1):
if j < n:
dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))
print((dp[-1]))
| false | 7.692308 | [
"+import sys",
"+",
"-dp = [float(\"Inf\")] * n",
"+dp = [sys.maxsize] * n"
] | false | 0.048869 | 0.110053 | 0.444047 | [
"s648885861",
"s202051257"
] |
u131411061 | p02755 | python | s779179968 | s091871840 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | import math
def main():
A,B = list(map(int,input().split()))
flag = True
for i in range(1,1010):
if(math.floor(i*0.08) == A and math.floor(i*0.1) == B):
print(i)
flag = False
break
if(flag):
print((-1))
if __name__ == "__main__":
... | import math
def main():
A,B = list(map(int,input().split()))
ans = -1
flag = True
for i in range(1,1010):
if(math.floor(i*0.08) == A and math.floor(i*0.1) == B):
ans = i
flag = False
break
print(ans)
if __name__ == "__main__":
main(... | 18 | 17 | 328 | 321 | import math
def main():
A, B = list(map(int, input().split()))
flag = True
for i in range(1, 1010):
if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
print(i)
flag = False
break
if flag:
print((-1))
if __name__ == "__main__":
main()
| import math
def main():
A, B = list(map(int, input().split()))
ans = -1
flag = True
for i in range(1, 1010):
if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
ans = i
flag = False
break
print(ans)
if __name__ == "__main__":
main()
| false | 5.555556 | [
"+ ans = -1",
"- print(i)",
"+ ans = i",
"- if flag:",
"- print((-1))",
"+ print(ans)"
] | false | 0.093832 | 0.045564 | 2.059323 | [
"s779179968",
"s091871840"
] |
u363320559 | p02701 | python | s575279747 | s945191329 | 291 | 112 | 35,720 | 35,640 | Accepted | Accepted | 61.51 | N=int(eval(input()))
K=[]
z=0
for x in range(N):
k=eval(input())
K.append(k)
T=set(K)
y=len(T)
print(y)
| import sys
input=sys.stdin.readline
N=int(eval(input()))
K=[]
z=0
for x in range(N):
k=eval(input())
K.append(k)
T=set(K)
y=len(T)
print(y)
| 9 | 12 | 108 | 148 | N = int(eval(input()))
K = []
z = 0
for x in range(N):
k = eval(input())
K.append(k)
T = set(K)
y = len(T)
print(y)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
K = []
z = 0
for x in range(N):
k = eval(input())
K.append(k)
T = set(K)
y = len(T)
print(y)
| false | 25 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.116222 | 0.040794 | 2.849003 | [
"s575279747",
"s945191329"
] |
u289547799 | p03212 | python | s122705625 | s515048869 | 138 | 39 | 3,064 | 3,060 | Accepted | Accepted | 71.74 | N = int(eval(input()))
M = len(str(N))
count = 0
def dfs(A):
global count
if len(A) <= M and (3 in A and 5 in A and 7 in A):
num = 0
for i in range(len(A)):
num += A[i]*(10**i)
if num <= N:
count += 1
elif len(A) > M:
return
for i in [3, 5, 7]:
A.append(i)
... | def func(cur, use):
global counter
if (cur > N): return
if (use == 0b111): counter += 1
func(cur * 10 + 7, use | 0b001)
func(cur * 10 + 5, use | 0b010)
func(cur * 10 + 3, use | 0b100)
N = int(eval(input()))
counter = 0
func(0, 0)
print(counter) | 24 | 14 | 370 | 270 | N = int(eval(input()))
M = len(str(N))
count = 0
def dfs(A):
global count
if len(A) <= M and (3 in A and 5 in A and 7 in A):
num = 0
for i in range(len(A)):
num += A[i] * (10**i)
if num <= N:
count += 1
elif len(A) > M:
return
for i in [3, 5, 7]:... | def func(cur, use):
global counter
if cur > N:
return
if use == 0b111:
counter += 1
func(cur * 10 + 7, use | 0b001)
func(cur * 10 + 5, use | 0b010)
func(cur * 10 + 3, use | 0b100)
N = int(eval(input()))
counter = 0
func(0, 0)
print(counter)
| false | 41.666667 | [
"-N = int(eval(input()))",
"-M = len(str(N))",
"-count = 0",
"+def func(cur, use):",
"+ global counter",
"+ if cur > N:",
"+ return",
"+ if use == 0b111:",
"+ counter += 1",
"+ func(cur * 10 + 7, use | 0b001)",
"+ func(cur * 10 + 5, use | 0b010)",
"+ func(cur * ... | false | 0.101903 | 0.081965 | 1.243247 | [
"s122705625",
"s515048869"
] |
u777923818 | p03482 | python | s255710289 | s876242890 | 39 | 36 | 3,188 | 3,188 | Accepted | Accepted | 7.69 | # -*- coding: utf-8 -*-
S = eval(input())
for k in range((len(S)+1)//2-1, len(S)-1):
if S[k] != S[k+1] or S[-k-1] != S[-k-2]:
print((k+1))
break
else:
print((len(S))) | S = eval(input())
N = len(S)
for k in range((N+1)//2, N):
if S[k-1] != S[k] or S[-k] != S[-k-1]:
print(k)
break
else:
print(N) | 8 | 8 | 187 | 151 | # -*- coding: utf-8 -*-
S = eval(input())
for k in range((len(S) + 1) // 2 - 1, len(S) - 1):
if S[k] != S[k + 1] or S[-k - 1] != S[-k - 2]:
print((k + 1))
break
else:
print((len(S)))
| S = eval(input())
N = len(S)
for k in range((N + 1) // 2, N):
if S[k - 1] != S[k] or S[-k] != S[-k - 1]:
print(k)
break
else:
print(N)
| false | 0 | [
"-# -*- coding: utf-8 -*-",
"-for k in range((len(S) + 1) // 2 - 1, len(S) - 1):",
"- if S[k] != S[k + 1] or S[-k - 1] != S[-k - 2]:",
"- print((k + 1))",
"+N = len(S)",
"+for k in range((N + 1) // 2, N):",
"+ if S[k - 1] != S[k] or S[-k] != S[-k - 1]:",
"+ print(k)",
"- print... | false | 0.040582 | 0.040592 | 0.999758 | [
"s255710289",
"s876242890"
] |
u994988729 | p03160 | python | s109872330 | s087169267 | 145 | 130 | 14,236 | 14,052 | Accepted | Accepted | 10.34 | n = int(eval(input()))
h = tuple(map(int, input().split()))
cost = [0] * (n + 1)
for i in range(n):
if i == 0:
continue
elif i == 1:
cost[i] = cost[i - 1] + abs(h[i] - h[i - 1])
continue
cost[i] = min(cost[i - 1] + abs(h[i] - h[i - 1]),
cost[i - 2] + a... | n = int(eval(input()))
h = tuple(map(int, input().split()))
cost = [0] * (n + 1)
inf = 10**18
dp = [inf]*(n+5)
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
ans = dp[n-1]
print(ans)
| 15 | 14 | 355 | 269 | n = int(eval(input()))
h = tuple(map(int, input().split()))
cost = [0] * (n + 1)
for i in range(n):
if i == 0:
continue
elif i == 1:
cost[i] = cost[i - 1] + abs(h[i] - h[i - 1])
continue
cost[i] = min(
cost[i - 1] + abs(h[i] - h[i - 1]), cost[i - 2] + abs(h[i] - h[i - 2])
... | n = int(eval(input()))
h = tuple(map(int, input().split()))
cost = [0] * (n + 1)
inf = 10**18
dp = [inf] * (n + 5)
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
ans = dp[n - 1]
print(ans)
| false | 6.666667 | [
"-for i in range(n):",
"- if i == 0:",
"- continue",
"- elif i == 1:",
"- cost[i] = cost[i - 1] + abs(h[i] - h[i - 1])",
"- continue",
"- cost[i] = min(",
"- cost[i - 1] + abs(h[i] - h[i - 1]), cost[i - 2] + abs(h[i] - h[i - 2])",
"- )",
"-print((cost[n - 1]... | false | 0.039014 | 0.03907 | 0.998557 | [
"s109872330",
"s087169267"
] |
u592547545 | p02862 | python | s967559489 | s224121323 | 1,069 | 124 | 123,020 | 3,064 | Accepted | Accepted | 88.4 | # 法Pの下での組み合わせ数 nCk を求める
# MAX: nの最大値
P = (10**9)+7
fac=[]
inv=[]
finv=[]
# 拡張ユークリッドアルゴリズム
# (d, x, y): d=ax+by を満たすd, x, yを求める
# aとbが互いに素な整数であればgcd(a,b)=d=1, ax=1 (mod b)
# xは法bの元でaの乗法逆元a^-1になる
def exEuclid(a, b):
if (b==0):
return (a, 1, 0)
else:
(dd, xx, yy) = exEuclid(b, a... | # 拡張ユークリッドアルゴリズム
# (d, x, y): d=ax+by を満たすd, x, yを求める
# aとbが互いに素な整数であればgcd(a,b)=d=1, ax=1 (mod b)
# xは法bの元でaの乗法逆元a^-1になる
def exEuclid(a, b):
if (b==0):
return (a, 1, 0)
else:
(dd, xx, yy) = exEuclid(b, a % b)
return (dd, yy, xx - (a//b)*yy)
def mycomb(n, k, p):
k = min(n... | 65 | 35 | 1,313 | 753 | # 法Pの下での組み合わせ数 nCk を求める
# MAX: nの最大値
P = (10**9) + 7
fac = []
inv = []
finv = []
# 拡張ユークリッドアルゴリズム
# (d, x, y): d=ax+by を満たすd, x, yを求める
# aとbが互いに素な整数であればgcd(a,b)=d=1, ax=1 (mod b)
# xは法bの元でaの乗法逆元a^-1になる
def exEuclid(a, b):
if b == 0:
return (a, 1, 0)
else:
(dd, xx, yy) = exEuclid(b, a % b)
... | # 拡張ユークリッドアルゴリズム
# (d, x, y): d=ax+by を満たすd, x, yを求める
# aとbが互いに素な整数であればgcd(a,b)=d=1, ax=1 (mod b)
# xは法bの元でaの乗法逆元a^-1になる
def exEuclid(a, b):
if b == 0:
return (a, 1, 0)
else:
(dd, xx, yy) = exEuclid(b, a % b)
return (dd, yy, xx - (a // b) * yy)
def mycomb(n, k, p):
k = min(n - k, k... | false | 46.153846 | [
"-# 法Pの下での組み合わせ数 nCk を求める",
"-# MAX: nの最大値",
"-P = (10**9) + 7",
"-fac = []",
"-inv = []",
"-finv = []",
"-def COMinit(MAX):",
"- global fac, inv, finv",
"- fac = [1 for _ in range(MAX)]",
"- inv = [1 for _ in range(MAX)]",
"- finv = [1 for _ in range(MAX)]",
"- # print('len(fac... | false | 0.921424 | 0.007802 | 118.099219 | [
"s967559489",
"s224121323"
] |
u061231294 | p02960 | python | s047754686 | s597530982 | 1,501 | 743 | 63,524 | 61,916 | Accepted | Accepted | 50.5 | S = eval(input())
S = S[::-1]
mod = 10 ** 9 + 7
N = len(S)
table = [[0] * 13 for _ in range(N + 1)]
table[0][0] = 1
dd = 1
for i in range(N):
c = S[i] != '?'
for j in range(13):
for k in range(10):
if c and int(S[i]) != k:
continue
table[i+1][(j +... | S = eval(input())
S = S[::-1]
mod = 10 ** 9 + 7
N = len(S)
table = [[0] * 13 for _ in range(N + 1)]
table[0][0] = 1
dd = 1
for i in range(N):
if S[i] == '?':
for j in range(13):
for k in range(10):
table[i+1][(j + dd * k) % 13] += table[i][j]
tabl... | 20 | 24 | 443 | 576 | S = eval(input())
S = S[::-1]
mod = 10**9 + 7
N = len(S)
table = [[0] * 13 for _ in range(N + 1)]
table[0][0] = 1
dd = 1
for i in range(N):
c = S[i] != "?"
for j in range(13):
for k in range(10):
if c and int(S[i]) != k:
continue
table[i + 1][(j + dd * k) % 13] +=... | S = eval(input())
S = S[::-1]
mod = 10**9 + 7
N = len(S)
table = [[0] * 13 for _ in range(N + 1)]
table[0][0] = 1
dd = 1
for i in range(N):
if S[i] == "?":
for j in range(13):
for k in range(10):
table[i + 1][(j + dd * k) % 13] += table[i][j]
table[i + 1][(j + dd ... | false | 16.666667 | [
"- c = S[i] != \"?\"",
"- for j in range(13):",
"- for k in range(10):",
"- if c and int(S[i]) != k:",
"- continue",
"- table[i + 1][(j + dd * k) % 13] += table[i][j]",
"- table[i + 1][(j + dd * k) % 13] %= mod",
"+ if S[i] == \"?\":",
... | false | 0.039323 | 0.120331 | 0.326788 | [
"s047754686",
"s597530982"
] |
u879309973 | p02844 | python | s915825211 | s411809617 | 966 | 22 | 3,188 | 3,064 | Accepted | Accepted | 97.72 | def solve(n, s):
l = {s[i]: i for i in range(n-1, -1, -1)}
r = {s[i]: i for i in range(n)}
S = set()
for j in range(n):
y = s[j]
for x, i in list(l.items()):
for z, k in list(r.items()):
if i < j < k:
S.add(x+y+z)
return len(S... | def solve(n, s):
ans = 0
for v in range(1000):
p = 0
for x in str(v).zfill(3):
p = s.find(x, p)
if p < 0:
break
p += 1
ans += int(p > 0)
return ans
assert solve(4, "0224") == 3
assert solve(6, "123123") == 17
assert s... | 15 | 19 | 362 | 411 | def solve(n, s):
l = {s[i]: i for i in range(n - 1, -1, -1)}
r = {s[i]: i for i in range(n)}
S = set()
for j in range(n):
y = s[j]
for x, i in list(l.items()):
for z, k in list(r.items()):
if i < j < k:
S.add(x + y + z)
return len(S)
... | def solve(n, s):
ans = 0
for v in range(1000):
p = 0
for x in str(v).zfill(3):
p = s.find(x, p)
if p < 0:
break
p += 1
ans += int(p > 0)
return ans
assert solve(4, "0224") == 3
assert solve(6, "123123") == 17
assert solve(19, "314... | false | 21.052632 | [
"- l = {s[i]: i for i in range(n - 1, -1, -1)}",
"- r = {s[i]: i for i in range(n)}",
"- S = set()",
"- for j in range(n):",
"- y = s[j]",
"- for x, i in list(l.items()):",
"- for z, k in list(r.items()):",
"- if i < j < k:",
"- ... | false | 0.096084 | 0.043727 | 2.197384 | [
"s915825211",
"s411809617"
] |
u142415823 | p03244 | python | s383172622 | s086343991 | 87 | 77 | 18,656 | 15,588 | Accepted | Accepted | 11.49 | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
O = collections.Counter(v[0::2])
E = collections.Counter(v[1::2])
def get_candidate(F):
c = [[0, 0], [0, 0]]
for i, j in list(F.items()):
if j >= c[0][1]:
c[1] = c[0]
c[0] = [i, j]
... | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
o = collections.Counter(v[0::2]).most_common(2)
e = collections.Counter(v[1::2]).most_common(2)
if len(o) == 1:
o.append([0, 0])
if len(e) == 1:
e.append([0, 0])
if o[0][0] != e[0][0]:
ans = n - o[0][1] - e[0][... | 27 | 20 | 558 | 398 | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
O = collections.Counter(v[0::2])
E = collections.Counter(v[1::2])
def get_candidate(F):
c = [[0, 0], [0, 0]]
for i, j in list(F.items()):
if j >= c[0][1]:
c[1] = c[0]
c[0] = [i, j]
elif j >= ... | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
o = collections.Counter(v[0::2]).most_common(2)
e = collections.Counter(v[1::2]).most_common(2)
if len(o) == 1:
o.append([0, 0])
if len(e) == 1:
e.append([0, 0])
if o[0][0] != e[0][0]:
ans = n - o[0][1] - e[0][1]
else:
ans = ... | false | 25.925926 | [
"-O = collections.Counter(v[0::2])",
"-E = collections.Counter(v[1::2])",
"-",
"-",
"-def get_candidate(F):",
"- c = [[0, 0], [0, 0]]",
"- for i, j in list(F.items()):",
"- if j >= c[0][1]:",
"- c[1] = c[0]",
"- c[0] = [i, j]",
"- elif j >= c[1][1]:",
... | false | 0.047389 | 0.044261 | 1.070685 | [
"s383172622",
"s086343991"
] |
u427344224 | p04005 | python | s658071784 | s421494196 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | A, B, C = list(map(int, input().split()))
margin = 0
if (A*B*C) % 2 == 0:
print((0))
else:
abc = [A, B, C]
abc.sort()
print((abc[0] * abc[1])) | A, B, C = list(map(int, input().split()))
if (A*B*C) % 2 == 0:
print((0))
else:
abc = [A, B, C]
abc.sort()
print((abc[0] * abc[1])) | 10 | 8 | 159 | 145 | A, B, C = list(map(int, input().split()))
margin = 0
if (A * B * C) % 2 == 0:
print((0))
else:
abc = [A, B, C]
abc.sort()
print((abc[0] * abc[1]))
| A, B, C = list(map(int, input().split()))
if (A * B * C) % 2 == 0:
print((0))
else:
abc = [A, B, C]
abc.sort()
print((abc[0] * abc[1]))
| false | 20 | [
"-margin = 0"
] | false | 0.03903 | 0.038553 | 1.01238 | [
"s658071784",
"s421494196"
] |
u864197622 | p03313 | python | s992219505 | s983563203 | 870 | 593 | 177,964 | 135,948 | Accepted | Accepted | 31.84 | N = int(eval(input()))
A = [[(0, 0)] * (1<<N) for _ in range(N+1)]
A[0] = [(int(a), 0) for a in input().split()]
combine = lambda a, b: a if a[1] >= b[0] else b if b[1] >= a[0] else (a[0], b[0]) if a[0] > b[0] else (b[0], a[0])
for i in range(1, N+1):
ii = 1 << i - 1
for j in range(1<<N):
if j ... | N = int(eval(input()))
A = [(int(a), 0) for a in input().split()]
combine = lambda a, b: a if a[1] >= b[0] else b if b[1] >= a[0] else (a[0], b[0]) if a[0] > b[0] else (b[0], a[0])
for i in range(N):
ii = 1 << i
for j in range(1<<N)[::-1]:
if j & ii:
A[j] = combine(A[j], A[j^ii])
... | 18 | 15 | 553 | 437 | N = int(eval(input()))
A = [[(0, 0)] * (1 << N) for _ in range(N + 1)]
A[0] = [(int(a), 0) for a in input().split()]
combine = (
lambda a, b: a
if a[1] >= b[0]
else b
if b[1] >= a[0]
else (a[0], b[0])
if a[0] > b[0]
else (b[0], a[0])
)
for i in range(1, N + 1):
ii = 1 << i - 1
for j ... | N = int(eval(input()))
A = [(int(a), 0) for a in input().split()]
combine = (
lambda a, b: a
if a[1] >= b[0]
else b
if b[1] >= a[0]
else (a[0], b[0])
if a[0] > b[0]
else (b[0], a[0])
)
for i in range(N):
ii = 1 << i
for j in range(1 << N)[::-1]:
if j & ii:
A[j] = ... | false | 16.666667 | [
"-A = [[(0, 0)] * (1 << N) for _ in range(N + 1)]",
"-A[0] = [(int(a), 0) for a in input().split()]",
"+A = [(int(a), 0) for a in input().split()]",
"-for i in range(1, N + 1):",
"- ii = 1 << i - 1",
"- for j in range(1 << N):",
"+for i in range(N):",
"+ ii = 1 << i",
"+ for j in range(1... | false | 0.038393 | 0.038248 | 1.0038 | [
"s992219505",
"s983563203"
] |
u631277801 | p03425 | python | s610702980 | s855932324 | 177 | 102 | 9,776 | 10,676 | Accepted | Accepted | 42.37 | N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
isMARCH = [0]*5
for name in S:
if name[0] == "M":
isMARCH[0] += 1
elif name[0] == "A":
isMARCH[1] += 1
elif name[0] == "R":
isMARCH[2] += 1
elif name[0] == "C":
isMARCH[3] += 1
... | from itertools import combinations
import sys
sdin = sys.stdin.readline
n = int(sdin())
s = [sdin() for _ in range(n)]
# marchで始まっている人をカウント
m = len([si for si in s if si.startswith("M")])
a = len([si for si in s if si.startswith("A")])
r = len([si for si in s if si.startswith("R")])
c = len([si for si in... | 25 | 27 | 533 | 586 | N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
isMARCH = [0] * 5
for name in S:
if name[0] == "M":
isMARCH[0] += 1
elif name[0] == "A":
isMARCH[1] += 1
elif name[0] == "R":
isMARCH[2] += 1
elif name[0] == "C":
isMARCH[3] += 1
elif name[0]... | from itertools import combinations
import sys
sdin = sys.stdin.readline
n = int(sdin())
s = [sdin() for _ in range(n)]
# marchで始まっている人をカウント
m = len([si for si in s if si.startswith("M")])
a = len([si for si in s if si.startswith("A")])
r = len([si for si in s if si.startswith("R")])
c = len([si for si in s if si.start... | false | 7.407407 | [
"-N = int(eval(input()))",
"-S = []",
"-for i in range(N):",
"- S.append(eval(input()))",
"-isMARCH = [0] * 5",
"-for name in S:",
"- if name[0] == \"M\":",
"- isMARCH[0] += 1",
"- elif name[0] == \"A\":",
"- isMARCH[1] += 1",
"- elif name[0] == \"R\":",
"- isM... | false | 0.070771 | 0.07077 | 1.000018 | [
"s610702980",
"s855932324"
] |
u934442292 | p03161 | python | s415843087 | s366044959 | 1,067 | 797 | 127,836 | 37,952 | Accepted | Accepted | 25.3 | import sys
import numba as nb
import numpy as np
input = sys.stdin.readline
INF = float("inf")
@nb.njit("i8(i8,i8,i8[:])")
def solve(N, K, h):
dp = np.zeros(N, dtype=np.int64)
for i in range(1, N):
k = min(K, i)
dp[i] = np.min(dp[i - k:i] + np.abs(h[i] - h[i - k:i]))
retur... | import sys
# import numba as nb
import numpy as np
input = sys.stdin.readline
INF = float("inf")
# @nb.njit("i8(i8,i8,i8[:])")
def solve(N, K, h):
dp = np.zeros(N, dtype=np.int64)
for i in range(1, N):
k = min(K, i)
dp[i] = np.min(dp[i - k:i] + np.abs(h[i] - h[i - k:i]))
r... | 28 | 28 | 523 | 527 | import sys
import numba as nb
import numpy as np
input = sys.stdin.readline
INF = float("inf")
@nb.njit("i8(i8,i8,i8[:])")
def solve(N, K, h):
dp = np.zeros(N, dtype=np.int64)
for i in range(1, N):
k = min(K, i)
dp[i] = np.min(dp[i - k : i] + np.abs(h[i] - h[i - k : i]))
return dp[-1]
d... | import sys
# import numba as nb
import numpy as np
input = sys.stdin.readline
INF = float("inf")
# @nb.njit("i8(i8,i8,i8[:])")
def solve(N, K, h):
dp = np.zeros(N, dtype=np.int64)
for i in range(1, N):
k = min(K, i)
dp[i] = np.min(dp[i - k : i] + np.abs(h[i] - h[i - k : i]))
return dp[-1]
... | false | 0 | [
"-import numba as nb",
"+",
"+# import numba as nb",
"-",
"-",
"-@nb.njit(\"i8(i8,i8,i8[:])\")",
"+# @nb.njit(\"i8(i8,i8,i8[:])\")"
] | false | 0.039658 | 0.238445 | 0.16632 | [
"s415843087",
"s366044959"
] |
u273010357 | p03416 | python | s812069571 | s690319670 | 70 | 63 | 2,940 | 2,940 | Accepted | Accepted | 10 | a,b = list(map(int, input().split()))
cnt = 0
for i in range(a, b+1):
if str(i)==str(i)[::-1]:
cnt += 1
print(cnt) | A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B+1):
if str(i)==str(i)[::-1]:
cnt += 1
print(cnt) | 7 | 6 | 127 | 126 | a, b = list(map(int, input().split()))
cnt = 0
for i in range(a, b + 1):
if str(i) == str(i)[::-1]:
cnt += 1
print(cnt)
| A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B + 1):
if str(i) == str(i)[::-1]:
cnt += 1
print(cnt)
| false | 14.285714 | [
"-a, b = list(map(int, input().split()))",
"+A, B = list(map(int, input().split()))",
"-for i in range(a, b + 1):",
"+for i in range(A, B + 1):"
] | false | 0.06101 | 0.067521 | 0.903561 | [
"s812069571",
"s690319670"
] |
u581187895 | p02919 | python | s819383033 | s765277394 | 547 | 91 | 134,672 | 89,220 | Accepted | Accepted | 83.36 |
from bisect import bisect_left, bisect_right
class OrderedSet:
def __init__(self, a):
self.c = {}
self.a_sort = sorted(list(set(a)))
for i, a in enumerate(self.a_sort):
self.c[a] = i + 1
self.r = {v: k for k, v in list(self.c.items())}
self.size = len(se... |
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
P = [0] * (N + 1)
for i, a in enumerate(A):
P[a] = i
l_idx = list(range(-1, N - 1)) + [-1, -1]
r_idx = list(range(1, N + 1)) + [N, N] # 番兵
ans = 0
for p in range(1, N + 1):
x = P[... | 114 | 32 | 2,969 | 612 | from bisect import bisect_left, bisect_right
class OrderedSet:
def __init__(self, a):
self.c = {}
self.a_sort = sorted(list(set(a)))
for i, a in enumerate(self.a_sort):
self.c[a] = i + 1
self.r = {v: k for k, v in list(self.c.items())}
self.size = len(self.c)
... | def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
P = [0] * (N + 1)
for i, a in enumerate(A):
P[a] = i
l_idx = list(range(-1, N - 1)) + [-1, -1]
r_idx = list(range(1, N + 1)) + [N, N] # 番兵
ans = 0
for p in range(1, N + 1):
x = P[p]
l1 = l_... | false | 71.929825 | [
"-from bisect import bisect_left, bisect_right",
"-",
"-",
"-class OrderedSet:",
"- def __init__(self, a):",
"- self.c = {}",
"- self.a_sort = sorted(list(set(a)))",
"- for i, a in enumerate(self.a_sort):",
"- self.c[a] = i + 1",
"- self.r = {v: k for k, v... | false | 0.088874 | 0.039688 | 2.239318 | [
"s819383033",
"s765277394"
] |
u249218227 | p03493 | python | s420109700 | s971510780 | 167 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.22 | li = list(eval(input()))
counter = 0
for i in li:
counter += int(i)
print(counter) | li = list(eval(input()))
counter = int(li[0]) + int(li[1]) + int(li[2])
print(counter) | 5 | 3 | 83 | 82 | li = list(eval(input()))
counter = 0
for i in li:
counter += int(i)
print(counter)
| li = list(eval(input()))
counter = int(li[0]) + int(li[1]) + int(li[2])
print(counter)
| false | 40 | [
"-counter = 0",
"-for i in li:",
"- counter += int(i)",
"+counter = int(li[0]) + int(li[1]) + int(li[2])"
] | false | 0.041413 | 0.041753 | 0.991866 | [
"s420109700",
"s971510780"
] |
u392319141 | p03062 | python | s349948618 | s542980507 | 65 | 58 | 14,412 | 14,412 | Accepted | Accepted | 10.77 | N = int(eval(input()))
A = list(map(int, input().split()))
negA = []
posA = []
for a in A:
if a >= 0:
posA.append(a)
else:
negA.append(a)
ans = sum(posA) - sum(negA)
if len(negA) % 2 == 1:
ans -= min([abs(a) for a in A]) * 2
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = [abs(a) for a in A]
minus = sum([a < 0 for a in A])
ans = sum(B)
if minus % 2 == 1:
ans -= min(B) * 2
print(ans)
| 17 | 11 | 278 | 187 | N = int(eval(input()))
A = list(map(int, input().split()))
negA = []
posA = []
for a in A:
if a >= 0:
posA.append(a)
else:
negA.append(a)
ans = sum(posA) - sum(negA)
if len(negA) % 2 == 1:
ans -= min([abs(a) for a in A]) * 2
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = [abs(a) for a in A]
minus = sum([a < 0 for a in A])
ans = sum(B)
if minus % 2 == 1:
ans -= min(B) * 2
print(ans)
| false | 35.294118 | [
"-negA = []",
"-posA = []",
"-for a in A:",
"- if a >= 0:",
"- posA.append(a)",
"- else:",
"- negA.append(a)",
"-ans = sum(posA) - sum(negA)",
"-if len(negA) % 2 == 1:",
"- ans -= min([abs(a) for a in A]) * 2",
"+B = [abs(a) for a in A]",
"+minus = sum([a < 0 for a in A]... | false | 0.045558 | 0.104044 | 0.437873 | [
"s349948618",
"s542980507"
] |
u072717685 | p02772 | python | s957523294 | s708471893 | 183 | 120 | 38,256 | 27,288 | Accepted | Accepted | 34.43 | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
r = 'APPROVED'
for num in a:
if num % 2 == 0:
if num % 3 == 0 or num % 5 == 0:
pass
else:
r = 'DENIED'
break
print(r)
main() | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
a = np.fromstring(read(), np.int64, sep=' ')[1:]
a = a[a % 2 == 0]
if np.all((a % 3 == 0) | (a % 5 == 0)):
print('APPROVED')
else:
print('DENIED')
if __name__ == '__main__':
... | 16 | 14 | 259 | 327 | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
r = "APPROVED"
for num in a:
if num % 2 == 0:
if num % 3 == 0 or num % 5 == 0:
pass
else:
r = "DENIED"
break
print(r)
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
a = np.fromstring(read(), np.int64, sep=" ")[1:]
a = a[a % 2 == 0]
if np.all((a % 3 == 0) | (a % 5 == 0)):
print("APPROVED")
else:
print("DENIED")
if __name__ == "__main__":
main()
| false | 12.5 | [
"-def main():",
"- n = int(eval(input()))",
"- a = list(map(int, input().split()))",
"- r = \"APPROVED\"",
"- for num in a:",
"- if num % 2 == 0:",
"- if num % 3 == 0 or num % 5 == 0:",
"- pass",
"- else:",
"- r = \"DENIED\"",
... | false | 0.03491 | 0.535478 | 0.065195 | [
"s957523294",
"s708471893"
] |
u537067968 | p02244 | python | s554248402 | s777145813 | 390 | 360 | 6,296 | 6,300 | Accepted | Accepted | 7.69 | from functools import lru_cache
cc = [["." for i in range(8)] for j in range(8)]
def check(cc,a,b):
ss = list(zip(*cc))
if 'Q' in cc[a]: return False
if 'Q' in ss[b]: return False
d = []
for i in range(8):
for j in range(8):
try:
if j + (a - i) == b:
... | from functools import lru_cache
cc = [["." for i in range(8)] for j in range(8)]
def check(cc,a,b):
ss = list(zip(*cc))
if 'Q' in cc[a]: return False
if 'Q' in ss[b]: return False
d = []
for i in range(8):
for j in range(8):
try:
if j + abs(a - i) == ... | 43 | 40 | 1,198 | 1,071 | from functools import lru_cache
cc = [["." for i in range(8)] for j in range(8)]
def check(cc, a, b):
ss = list(zip(*cc))
if "Q" in cc[a]:
return False
if "Q" in ss[b]:
return False
d = []
for i in range(8):
for j in range(8):
try:
if j + (a - i... | from functools import lru_cache
cc = [["." for i in range(8)] for j in range(8)]
def check(cc, a, b):
ss = list(zip(*cc))
if "Q" in cc[a]:
return False
if "Q" in ss[b]:
return False
d = []
for i in range(8):
for j in range(8):
try:
if j + abs(a ... | false | 6.976744 | [
"- if j + (a - i) == b:",
"+ if j + abs(a - i) == b:",
"- if j - (a - i) == b:",
"- d.append(cc[i][j])",
"- if j + (i - a) == b:",
"- d.append(cc[i][j])",
"- if j - (i - a) == b:",
"+ ... | false | 0.968064 | 0.375404 | 2.578723 | [
"s554248402",
"s777145813"
] |
u063052907 | p02934 | python | s985770117 | s809820567 | 24 | 17 | 3,700 | 2,940 | Accepted | Accepted | 29.17 | from operator import mul
from functools import reduce
N = int(eval(input()))
if N == 1:
ans = int(eval(input()))
print(ans)
exit()
lst_A = list(map(int, input().split()))
upper = reduce(mul, lst_A)
lower = 0
for i in range(N):
lst_tmp = lst_A[:i] + lst_A[i+1::]
lower += reduce(mu... | N = int(eval(input()))
lst_A = list(map(int, input().split()))
ans = 1 / sum(1 / x for x in lst_A)
print(ans) | 19 | 4 | 352 | 106 | from operator import mul
from functools import reduce
N = int(eval(input()))
if N == 1:
ans = int(eval(input()))
print(ans)
exit()
lst_A = list(map(int, input().split()))
upper = reduce(mul, lst_A)
lower = 0
for i in range(N):
lst_tmp = lst_A[:i] + lst_A[i + 1 : :]
lower += reduce(mul, lst_tmp)
ans... | N = int(eval(input()))
lst_A = list(map(int, input().split()))
ans = 1 / sum(1 / x for x in lst_A)
print(ans)
| false | 78.947368 | [
"-from operator import mul",
"-from functools import reduce",
"-",
"-if N == 1:",
"- ans = int(eval(input()))",
"- print(ans)",
"- exit()",
"-upper = reduce(mul, lst_A)",
"-lower = 0",
"-for i in range(N):",
"- lst_tmp = lst_A[:i] + lst_A[i + 1 : :]",
"- lower += reduce(mul, lst... | false | 0.078549 | 0.060809 | 1.291745 | [
"s985770117",
"s809820567"
] |
u185802209 | p03268 | python | s629786319 | s635722216 | 150 | 17 | 2,940 | 3,060 | Accepted | Accepted | 88.67 | n,k=list(map(int,input().split()))
c=0
s = k if k%2==1 else k//2
for i in range(s,n+1,s):
s2 = k if i%k==0 else s
n2 = (n-s2)//k+1
c+=n2**2
print(c) | n,k = list(map(int,input().split()))
s = k if k%2==1 else k//2
l = (n-s)//s+1
n1=(n-s)//k+1
n2=(n-k)//k+1
if l%2==0:
print((l*(n1**2+n2**2)//2))
else:
print(((l//2)*(n1**2+n2**2)+n1**2)) | 8 | 9 | 161 | 192 | n, k = list(map(int, input().split()))
c = 0
s = k if k % 2 == 1 else k // 2
for i in range(s, n + 1, s):
s2 = k if i % k == 0 else s
n2 = (n - s2) // k + 1
c += n2**2
print(c)
| n, k = list(map(int, input().split()))
s = k if k % 2 == 1 else k // 2
l = (n - s) // s + 1
n1 = (n - s) // k + 1
n2 = (n - k) // k + 1
if l % 2 == 0:
print((l * (n1**2 + n2**2) // 2))
else:
print(((l // 2) * (n1**2 + n2**2) + n1**2))
| false | 11.111111 | [
"-c = 0",
"-for i in range(s, n + 1, s):",
"- s2 = k if i % k == 0 else s",
"- n2 = (n - s2) // k + 1",
"- c += n2**2",
"-print(c)",
"+l = (n - s) // s + 1",
"+n1 = (n - s) // k + 1",
"+n2 = (n - k) // k + 1",
"+if l % 2 == 0:",
"+ print((l * (n1**2 + n2**2) // 2))",
"+else:",
"+... | false | 0.07003 | 0.037525 | 1.866216 | [
"s629786319",
"s635722216"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.