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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u729133443 | p03085 | python | s511171130 | s847991586 | 167 | 22 | 38,256 | 8,860 | Accepted | Accepted | 86.83 | print(('TCG鬱A'[ord(eval(input()))%5])) | print(('TCG A'[ord(eval(input()))%5])) | 1 | 1 | 30 | 30 | print(("TCG鬱A"[ord(eval(input())) % 5]))
| print(("TCG A"[ord(eval(input())) % 5]))
| false | 0 | [
"-print((\"TCG鬱A\"[ord(eval(input())) % 5]))",
"+print((\"TCG A\"[ord(eval(input())) % 5]))"
] | false | 0.052437 | 0.037405 | 1.401874 | [
"s511171130",
"s847991586"
] |
u979823197 | p03295 | python | s682387351 | s510042765 | 472 | 303 | 21,268 | 92,804 | Accepted | Accepted | 35.81 | N,M=list(map(int,input().split()))
ab=[]
for m in range(M):
[a,b]=[int(i) for i in input().split()]
ab.append([a,b])
ab.sort(key=lambda x:x[1])
count=[]
count.append(ab[0][1]-1)
for i in range(1,M):
if ab[i][0]<=count[-1]<ab[i][1]:
pass
elif ab[i][0]<=count[-1] and ab[i][1]-1==count[-1]:
cou... | n,m=list(map(int,input().split()))
B=[]
for _ in range(m):
a,b=list(map(int,input().split()))
B.append([a-1,b-1])
B=sorted(B,key=lambda x:x[1])
ans=m
for i in range(1,m):
if B[i][0]<B[i-1][1]:
ans-=1
B[i][1]=B[i-1][1]
print(ans) | 17 | 14 | 422 | 251 | N, M = list(map(int, input().split()))
ab = []
for m in range(M):
[a, b] = [int(i) for i in input().split()]
ab.append([a, b])
ab.sort(key=lambda x: x[1])
count = []
count.append(ab[0][1] - 1)
for i in range(1, M):
if ab[i][0] <= count[-1] < ab[i][1]:
pass
elif ab[i][0] <= count[-1] and ab[i][1]... | n, m = list(map(int, input().split()))
B = []
for _ in range(m):
a, b = list(map(int, input().split()))
B.append([a - 1, b - 1])
B = sorted(B, key=lambda x: x[1])
ans = m
for i in range(1, m):
if B[i][0] < B[i - 1][1]:
ans -= 1
B[i][1] = B[i - 1][1]
print(ans)
| false | 17.647059 | [
"-N, M = list(map(int, input().split()))",
"-ab = []",
"-for m in range(M):",
"- [a, b] = [int(i) for i in input().split()]",
"- ab.append([a, b])",
"-ab.sort(key=lambda x: x[1])",
"-count = []",
"-count.append(ab[0][1] - 1)",
"-for i in range(1, M):",
"- if ab[i][0] <= count[-1] < ab[i][... | false | 0.04299 | 0.042635 | 1.008332 | [
"s682387351",
"s510042765"
] |
u402342597 | p02657 | python | s581015592 | s564636404 | 23 | 21 | 9,152 | 9,108 | Accepted | Accepted | 8.7 | a, b= (int(x) for x in input().split())
print((a*b)) | import math
a,b = [float(x) for x in input().split()]
a = int(a)
b = int(b*100)
print((int(math.floor(a*b)//100))) | 3 | 5 | 53 | 116 | a, b = (int(x) for x in input().split())
print((a * b))
| import math
a, b = [float(x) for x in input().split()]
a = int(a)
b = int(b * 100)
print((int(math.floor(a * b) // 100)))
| false | 40 | [
"-a, b = (int(x) for x in input().split())",
"-print((a * b))",
"+import math",
"+",
"+a, b = [float(x) for x in input().split()]",
"+a = int(a)",
"+b = int(b * 100)",
"+print((int(math.floor(a * b) // 100)))"
] | false | 0.036905 | 0.039902 | 0.924893 | [
"s581015592",
"s564636404"
] |
u436173409 | p02693 | python | s483199884 | s778865511 | 296 | 24 | 27,452 | 9,092 | Accepted | Accepted | 91.89 | k = int(eval(input()))
a, b = [int(e) for e in input().split()]
import numpy as np
ab = np.zeros((b-a)+1)
ab[:] = a
for i in range(b-a):
ab[i+1:] +=1
if (ab % k == 0).sum() > 0:
print('OK')
else:
print('NG') | k = int(eval(input()))
a, b = [int(e) for e in input().split()]
ans='NG'
for i in range(a,b+1):
if i%k == 0:
ans='OK'
break
else:
pass
print(ans) | 16 | 10 | 233 | 180 | k = int(eval(input()))
a, b = [int(e) for e in input().split()]
import numpy as np
ab = np.zeros((b - a) + 1)
ab[:] = a
for i in range(b - a):
ab[i + 1 :] += 1
if (ab % k == 0).sum() > 0:
print("OK")
else:
print("NG")
| k = int(eval(input()))
a, b = [int(e) for e in input().split()]
ans = "NG"
for i in range(a, b + 1):
if i % k == 0:
ans = "OK"
break
else:
pass
print(ans)
| false | 37.5 | [
"-import numpy as np",
"-",
"-ab = np.zeros((b - a) + 1)",
"-ab[:] = a",
"-for i in range(b - a):",
"- ab[i + 1 :] += 1",
"-if (ab % k == 0).sum() > 0:",
"- print(\"OK\")",
"-else:",
"- print(\"NG\")",
"+ans = \"NG\"",
"+for i in range(a, b + 1):",
"+ if i % k == 0:",
"+ ... | false | 0.224713 | 0.036871 | 6.094508 | [
"s483199884",
"s778865511"
] |
u754022296 | p02756 | python | s569291238 | s148871592 | 964 | 475 | 90,904 | 14,560 | Accepted | Accepted | 50.73 | from collections import deque
s = deque(list(input()))
q = int(input())
f = 0
for _ in range(q):
l = input()
if l == "1":
f ^= 1
else:
a, b, c = l.split()
if f ^ (b=="1"):
s.appendleft(c)
else:
s.append(c)
if f:
ans = list(s)[::-1]
else:
ans = list(s)
print(*ans, ... | from collections import deque
def main():
s = deque(list(input()))
q = int(input())
f = 0
for _ in range(q):
l = input()
if l == "1":
f ^= 1
else:
a, b, c = l.split()
if f ^ (b=="1"):
s.appendleft(c)
else:
s.append(c)
if f:
ans = list(s)[... | 19 | 22 | 327 | 414 | from collections import deque
s = deque(list(input()))
q = int(input())
f = 0
for _ in range(q):
l = input()
if l == "1":
f ^= 1
else:
a, b, c = l.split()
if f ^ (b == "1"):
s.appendleft(c)
else:
s.append(c)
if f:
ans = list(s)[::-1]
else:
ans... | from collections import deque
def main():
s = deque(list(input()))
q = int(input())
f = 0
for _ in range(q):
l = input()
if l == "1":
f ^= 1
else:
a, b, c = l.split()
if f ^ (b == "1"):
s.appendleft(c)
else:
... | false | 13.636364 | [
"-s = deque(list(input()))",
"-q = int(input())",
"-f = 0",
"-for _ in range(q):",
"- l = input()",
"- if l == \"1\":",
"- f ^= 1",
"+",
"+def main():",
"+ s = deque(list(input()))",
"+ q = int(input())",
"+ f = 0",
"+ for _ in range(q):",
"+ l = input()",
... | false | 0.059298 | 0.007477 | 7.930495 | [
"s569291238",
"s148871592"
] |
u724428568 | p02832 | python | s957321602 | s350878539 | 121 | 92 | 26,140 | 26,140 | Accepted | Accepted | 23.97 | N = int(eval(input()))
l = list(map(int, input().split()))
if l == [i+1 for i in range(N)]: # 1, 2, 3, ...
print((0))
elif 1 not in l:
print((-1))
else:
detected = 0
target = 1
for i in l:
if i == target:
detected += 1
target += 1
print((N - detected)) | N = int(eval(input()))
l = list(map(int, input().split()))
if 1 not in l:
print((-1))
else:
detected = 0
for i in l:
if i == detected+1:
detected += 1
print((N - detected)) | 15 | 11 | 285 | 193 | N = int(eval(input()))
l = list(map(int, input().split()))
if l == [i + 1 for i in range(N)]: # 1, 2, 3, ...
print((0))
elif 1 not in l:
print((-1))
else:
detected = 0
target = 1
for i in l:
if i == target:
detected += 1
target += 1
print((N - detected))
| N = int(eval(input()))
l = list(map(int, input().split()))
if 1 not in l:
print((-1))
else:
detected = 0
for i in l:
if i == detected + 1:
detected += 1
print((N - detected))
| false | 26.666667 | [
"-if l == [i + 1 for i in range(N)]: # 1, 2, 3, ...",
"- print((0))",
"-elif 1 not in l:",
"+if 1 not in l:",
"- target = 1",
"- if i == target:",
"+ if i == detected + 1:",
"- target += 1"
] | false | 0.041984 | 0.040337 | 1.040833 | [
"s957321602",
"s350878539"
] |
u193264896 | p02813 | python | s218948531 | s675053035 | 44 | 32 | 5,244 | 9,024 | Accepted | Accepted | 27.27 | from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path,... | import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
from itertools import permutations
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(readline())
P = tuple(map(int, readline().split()))
Q = tuple(map(int, readline().split()))
... | 35 | 28 | 1,100 | 520 | from collections import deque
from collections import Counter
from itertools import product, permutations, combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
# pypyではscipy, numpyは使えない
# from scipy.sparse.csgraph import shortest_path, fl... | import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
from itertools import permutations
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
N = int(readline())
P = tuple(map(int, readline().split()))
Q = tuple(map(int, readline().split()))
for i, A in enumera... | false | 20 | [
"-from collections import deque",
"-from collections import Counter",
"-from itertools import product, permutations, combinations",
"-from operator import itemgetter",
"-from heapq import heappop, heappush",
"-from bisect import bisect_left, bisect_right, bisect",
"-",
"-# pypyではscipy, numpyは使えない",
... | false | 0.061304 | 0.041603 | 1.473528 | [
"s218948531",
"s675053035"
] |
u600402037 | p03274 | python | s183987944 | s258588037 | 164 | 93 | 14,564 | 14,480 | Accepted | Accepted | 43.29 | # coding: utf-8
import sys
from bisect import bisect_left, bisect_right
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
X = lr()
if 0 in X:
K -= 1
i = bisect_left(X, 0)
ne = X[:i]
i = bisect_right(X, 0)
po = X[i:]
INF = 10 *... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
X = lr()
answer = []
for i in range(N-K+1):
l = X[i]; r = X[i+K-1]
a = abs(l) + abs(r-l)
b = abs(r) + abs(l-r)
answer.append(min(a, b))
pr... | 42 | 18 | 799 | 342 | # coding: utf-8
import sys
from bisect import bisect_left, bisect_right
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
X = lr()
if 0 in X:
K -= 1
i = bisect_left(X, 0)
ne = X[:i]
i = bisect_right(X, 0)
po = X[i:]
INF = 10**10
neg = [INF] * (K... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
X = lr()
answer = []
for i in range(N - K + 1):
l = X[i]
r = X[i + K - 1]
a = abs(l) + abs(r - l)
b = abs(r) + abs(l - r)
answer.append(min(a, b))
print... | false | 57.142857 | [
"-from bisect import bisect_left, bisect_right",
"-if 0 in X:",
"- K -= 1",
"-i = bisect_left(X, 0)",
"-ne = X[:i]",
"-i = bisect_right(X, 0)",
"-po = X[i:]",
"-INF = 10**10",
"-neg = [INF] * (K + 1) # 左からK本選ぶ場合、K-1本選ぶ場合・・・0本選ぶ場合",
"-neg[-1] = 0",
"-pos = [INF] * (K + 1)",
"-pos[0] = 0",
... | false | 0.092125 | 0.041614 | 2.21377 | [
"s183987944",
"s258588037"
] |
u419686324 | p03241 | python | s004994068 | s328325116 | 361 | 31 | 3,572 | 4,188 | Accepted | Accepted | 91.41 | N, M = list(map(int, input().split()))
import math
class PrimeUtils:
@staticmethod
def primes_sieve(n):
sieve = [True] * (n + 1)
for i in range(2, n + 1):
if sieve[i]:
for j in range(i + i, n + 1, i):
sieve[j] = False
return [i ... | import math, collections, itertools, functools, operator
class PrimeUtils:
@staticmethod
def primes_sieve(n):
sieve = [True] * (n + 1)
for i in range(2, n + 1):
if sieve[i]:
for j in range(i + i, n + 1, i):
sieve[j] = False
return ... | 23 | 44 | 637 | 1,366 | N, M = list(map(int, input().split()))
import math
class PrimeUtils:
@staticmethod
def primes_sieve(n):
sieve = [True] * (n + 1)
for i in range(2, n + 1):
if sieve[i]:
for j in range(i + i, n + 1, i):
sieve[j] = False
return [i for i, x i... | import math, collections, itertools, functools, operator
class PrimeUtils:
@staticmethod
def primes_sieve(n):
sieve = [True] * (n + 1)
for i in range(2, n + 1):
if sieve[i]:
for j in range(i + i, n + 1, i):
sieve[j] = False
return [i for ... | false | 47.727273 | [
"-N, M = list(map(int, input().split()))",
"-import math",
"+import math, collections, itertools, functools, operator",
"+ @staticmethod",
"+ # Prime Factor Decomposition",
"+ def pfd(n):",
"+ rn = math.ceil(math.sqrt(n))",
"+ primes = PrimeUtils.primes_sieve(rn)",
"+ f... | false | 0.147275 | 0.042412 | 3.472522 | [
"s004994068",
"s328325116"
] |
u788703383 | p02684 | python | s960540746 | s362716661 | 180 | 137 | 32,400 | 31,064 | Accepted | Accepted | 23.89 | n,k =list(map(int,input().split()))
a=list(map(int,input().split()))
a = [1] + a
def next(i):
return a[i]
z = [0] * (n+1)
place = 1
T = 0
interval = 0
if k < n:
for i in range(k):
place = next(place)
print(place);exit()
place = 0
k += 1
for i in range(n):
place = next(place)
... | import sys
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
input = sys.stdin.readline
def inp():
return int(eval(input()))
def inpl():
return list(map(int,input().split()))
def inpm():
return list(map(int,input().split()))
n,k =list(map(int,input().split()))
a=[1] + inpl()
... | 30 | 33 | 523 | 598 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [1] + a
def next(i):
return a[i]
z = [0] * (n + 1)
place = 1
T = 0
interval = 0
if k < n:
for i in range(k):
place = next(place)
print(place)
exit()
place = 0
k += 1
for i in range(n):
place = next(place)
... | import sys
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
input = sys.stdin.readline
def inp():
return int(eval(input()))
def inpl():
return list(map(int, input().split()))
def inpm():
return list(map(int, input().split()))
n, k = list(map(int, input().split()))
a = [1] + inpl()
b ... | false | 9.090909 | [
"-n, k = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-a = [1] + a",
"+import sys",
"+",
"+sys.setrecursionlimit(10**8)",
"+INF = float(\"inf\")",
"+mod = 10**9 + 7",
"+input = sys.stdin.readline",
"-def next(i):",
"- return a[i]",
"+def inp():",
"+ return... | false | 0.05755 | 0.036371 | 1.582309 | [
"s960540746",
"s362716661"
] |
u969190727 | p03682 | python | s962069143 | s211683590 | 1,863 | 879 | 122,800 | 147,396 | Accepted | Accepted | 52.82 | import sys
input = sys.stdin.readline
n=int(eval(input()))
Edge=[[] for i in range(n)]
XY=[]
append=XY.append
for i in range(n):
x,y=list(map(int,input().split()))
append([i,x,y])
XY.sort(key=lambda x:x[1])
for i in range(1,n):
n1,x1,y1=XY[i-1][0],XY[i-1][1],XY[i-1][2]
n2,x2,y2=XY[i][0],XY[i][1],XY[... | import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
def MST(n, E):
def par(m):
if UF[m] == m:
return m
ret = par(UF[m])
UF[m] = ret
return ret
UF = [i for i in range(n)]
E = sorted(E, key=lambda x: x[2])
ans = 0
for i,... | 41 | 39 | 1,082 | 841 | import sys
input = sys.stdin.readline
n = int(eval(input()))
Edge = [[] for i in range(n)]
XY = []
append = XY.append
for i in range(n):
x, y = list(map(int, input().split()))
append([i, x, y])
XY.sort(key=lambda x: x[1])
for i in range(1, n):
n1, x1, y1 = XY[i - 1][0], XY[i - 1][1], XY[i - 1][2]
n2, x... | import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
def MST(n, E):
def par(m):
if UF[m] == m:
return m
ret = par(UF[m])
UF[m] = ret
return ret
UF = [i for i in range(n)]
E = sorted(E, key=lambda x: x[2])
ans = 0
for i, j, d in E:
... | false | 4.878049 | [
"+sys.setrecursionlimit(1000000)",
"-n = int(eval(input()))",
"-Edge = [[] for i in range(n)]",
"-XY = []",
"-append = XY.append",
"-for i in range(n):",
"- x, y = list(map(int, input().split()))",
"- append([i, x, y])",
"-XY.sort(key=lambda x: x[1])",
"-for i in range(1, n):",
"- n1, x... | false | 0.042101 | 0.039973 | 1.053229 | [
"s962069143",
"s211683590"
] |
u204842730 | p02814 | python | s069002689 | s860706869 | 705 | 62 | 16,280 | 16,280 | Accepted | Accepted | 91.21 | import fractions
import math
n,m = list(map(int,input().split()))
a = list(map(int, input().split()))
s = set(a)
c = set()
l = 1
k = (a[0] // 2) % 2
for i in a:
l = l * i // fractions.gcd(l,i)
if l // 2 > m:
ans = 0
break
count = 0
while True:
if (i>>count) % 2 == ... | import fractions
import math
n,m = list(map(int,input().split()))
a = list(map(int, input().split()))
a = set(a)
c = set()
l = 1
for i in a:
l = l * i // fractions.gcd(l,i)
if l // 2 > m:
ans = 0
break
count = 0
while True:
if (i>>count) % 2 == 0:
count... | 27 | 26 | 502 | 481 | import fractions
import math
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
s = set(a)
c = set()
l = 1
k = (a[0] // 2) % 2
for i in a:
l = l * i // fractions.gcd(l, i)
if l // 2 > m:
ans = 0
break
count = 0
while True:
if (i >> count) % 2 == 0:
... | import fractions
import math
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = set(a)
c = set()
l = 1
for i in a:
l = l * i // fractions.gcd(l, i)
if l // 2 > m:
ans = 0
break
count = 0
while True:
if (i >> count) % 2 == 0:
count += 1
... | false | 3.703704 | [
"-s = set(a)",
"+a = set(a)",
"-k = (a[0] // 2) % 2"
] | false | 0.099542 | 0.043621 | 2.281962 | [
"s069002689",
"s860706869"
] |
u633068244 | p00239 | python | s646540569 | s124359545 | 140 | 110 | 4,516 | 4,488 | Accepted | Accepted | 21.43 | while 1:
n=eval(input())
if n==0:break
s=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
s[i].append(4*s[i][1]+9*s[i][2]+4*s[i][3])
r=list(map(int,input().split()))
flag=0
for i in s:
if i[1]<=r[0] and i[2]<=r[1] and i[3]<=r[2] and i[4]<=r[3]:
print(i[0])
flag=1
if fl... | while 1:
n=eval(input())
if n==0:break
s=[list(map(int,input().split())) for i in range(n)]
r=list(map(int,input().split()))
flag=0
for i in s:
if i[1]<=r[0] and i[2]<=r[1] and i[3]<=r[2] and 4*(i[1]+i[3])+9*i[2]<=r[3]:
print(i[0])
flag=1
if flag==0:print("NA") | 13 | 11 | 325 | 274 | while 1:
n = eval(input())
if n == 0:
break
s = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
s[i].append(4 * s[i][1] + 9 * s[i][2] + 4 * s[i][3])
r = list(map(int, input().split()))
flag = 0
for i in s:
if i[1] <= r[0] and i[2] <= r[1] and i[... | while 1:
n = eval(input())
if n == 0:
break
s = [list(map(int, input().split())) for i in range(n)]
r = list(map(int, input().split()))
flag = 0
for i in s:
if (
i[1] <= r[0]
and i[2] <= r[1]
and i[3] <= r[2]
and 4 * (i[1] + i[3]) +... | false | 15.384615 | [
"- for i in range(n):",
"- s[i].append(4 * s[i][1] + 9 * s[i][2] + 4 * s[i][3])",
"- if i[1] <= r[0] and i[2] <= r[1] and i[3] <= r[2] and i[4] <= r[3]:",
"+ if (",
"+ i[1] <= r[0]",
"+ and i[2] <= r[1]",
"+ and i[3] <= r[2]",
"+ and ... | false | 0.04206 | 0.041405 | 1.015805 | [
"s646540569",
"s124359545"
] |
u612721349 | p03493 | python | s044527154 | s360009735 | 164 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.63 | print((input().count("1"))) | s = eval(input())
print((s.count('1'))) | 1 | 2 | 25 | 32 | print((input().count("1")))
| s = eval(input())
print((s.count("1")))
| false | 50 | [
"-print((input().count(\"1\")))",
"+s = eval(input())",
"+print((s.count(\"1\")))"
] | false | 0.19963 | 0.040231 | 4.962112 | [
"s044527154",
"s360009735"
] |
u609061751 | p03319 | python | s868854092 | s357959500 | 211 | 47 | 52,508 | 14,324 | Accepted | Accepted | 77.73 | import sys
input = sys.stdin.readline
n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
idx = a.index(1)
left = idx
right = n - (idx + 1)
ans = 10 ** 10
for i in range(k):
cnt = 1
left_ = left - i
right_ = right - (k - 1 - i)
cnt += left_//(k - 1) + rig... | import sys
input = lambda: sys.stdin.readline().rstrip()
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
if a[i] == 1:
break
left = len(a[:i])
right = len(a[i + 1:])
ans = left // (k - 1) + right//(k - 1) + (left%(k-1) + right%(k-1))//(k-1) + int((... | 21 | 14 | 437 | 368 | import sys
input = sys.stdin.readline
n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
idx = a.index(1)
left = idx
right = n - (idx + 1)
ans = 10**10
for i in range(k):
cnt = 1
left_ = left - i
right_ = right - (k - 1 - i)
cnt += (
left_ // (k - 1)
+ right_... | import sys
input = lambda: sys.stdin.readline().rstrip()
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
if a[i] == 1:
break
left = len(a[:i])
right = len(a[i + 1 :])
ans = (
left // (k - 1)
+ right // (k - 1)
+ (left % (k - 1) + right % (k - 1)) //... | false | 33.333333 | [
"-input = sys.stdin.readline",
"-n, k = [int(x) for x in input().split()]",
"-a = [int(x) for x in input().split()]",
"-idx = a.index(1)",
"-left = idx",
"-right = n - (idx + 1)",
"-ans = 10**10",
"-for i in range(k):",
"- cnt = 1",
"- left_ = left - i",
"- right_ = right - (k - 1 - i)"... | false | 0.061462 | 0.081213 | 0.756798 | [
"s868854092",
"s357959500"
] |
u076917070 | p03294 | python | s896482042 | s685835164 | 176 | 18 | 5,344 | 3,316 | Accepted | Accepted | 89.77 | import sys
input=sys.stdin.readline
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
n = int(eval(input()))
a = list(map(int, input().split()))
m = a[0]
for i in a:
m = lcm(m, i)
x = 0
for i in a:
x += (m-1)%i
print(x) | import sys
input=sys.stdin.readline
int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in a:
x += i-1
print(x)
| 19 | 10 | 268 | 136 | import sys
input = sys.stdin.readline
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
n = int(eval(input()))
a = list(map(int, input().split()))
m = a[0]
for i in a:
m = lcm(m, i)
x = 0
for i in a:
x += (m - 1) % i
print(x)
| import sys
input = sys.stdin.readline
int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in a:
x += i - 1
print(x)
| false | 47.368421 | [
"-import fractions",
"-",
"-",
"-def lcm(x, y):",
"- return (x * y) // fractions.gcd(x, y)",
"-",
"-",
"-n = int(eval(input()))",
"+int(eval(input()))",
"-m = a[0]",
"-for i in a:",
"- m = lcm(m, i)",
"- x += (m - 1) % i",
"+ x += i - 1"
] | false | 0.050992 | 0.038831 | 1.313161 | [
"s896482042",
"s685835164"
] |
u533039576 | p02763 | python | s863281432 | s908102245 | 1,048 | 657 | 250,076 | 80,224 | Accepted | Accepted | 37.31 | class BIT1():
"""
Binary Indexed Tree (1-indexed)
"""
def __init__(self, n):
self.n = n
self.bit = [0] * (self.n + 1)
self.data = [0] * (self.n + 1)
def add(self, idx, x):
# add x to idx-th element
# idx: 1-indexed
self.data[idx] += x
... | class SegmentTree1():
"""
1-indexed Segment Tree
"""
def __init__(self, n_, ele_id, op_func):
self.n = 1 << (n_ - 1).bit_length() # size
self.data = [ele_id] * (2 * self.n) # binary tree (1-indexed)
self.ele_id = ele_id # identity element
self.op_func = op_func... | 53 | 71 | 1,271 | 2,073 | class BIT1:
"""
Binary Indexed Tree (1-indexed)
"""
def __init__(self, n):
self.n = n
self.bit = [0] * (self.n + 1)
self.data = [0] * (self.n + 1)
def add(self, idx, x):
# add x to idx-th element
# idx: 1-indexed
self.data[idx] += x
while idx... | class SegmentTree1:
"""
1-indexed Segment Tree
"""
def __init__(self, n_, ele_id, op_func):
self.n = 1 << (n_ - 1).bit_length() # size
self.data = [ele_id] * (2 * self.n) # binary tree (1-indexed)
self.ele_id = ele_id # identity element
self.op_func = op_func # binar... | false | 25.352113 | [
"-class BIT1:",
"+class SegmentTree1:",
"- Binary Indexed Tree (1-indexed)",
"+ 1-indexed Segment Tree",
"- def __init__(self, n):",
"- self.n = n",
"- self.bit = [0] * (self.n + 1)",
"- self.data = [0] * (self.n + 1)",
"+ def __init__(self, n_, ele_id, op_func):",
... | false | 0.038048 | 0.047539 | 0.800344 | [
"s863281432",
"s908102245"
] |
u799428010 | p02628 | python | s038536451 | s685985230 | 28 | 25 | 9,076 | 9,156 | Accepted | Accepted | 10.71 | a,b= list(map(int, input().split()))
p=list(map(int, input().split()))
X=sorted(p)[:b]
print((sum(X))) | N,K = list(map(int, input().split()))
P=sorted(list(map(int, input().split())),reverse=False)
print((sum(P[:K]))) | 4 | 3 | 91 | 107 | a, b = list(map(int, input().split()))
p = list(map(int, input().split()))
X = sorted(p)[:b]
print((sum(X)))
| N, K = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse=False)
print((sum(P[:K])))
| false | 25 | [
"-a, b = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-X = sorted(p)[:b]",
"-print((sum(X)))",
"+N, K = list(map(int, input().split()))",
"+P = sorted(list(map(int, input().split())), reverse=False)",
"+print((sum(P[:K])))"
] | false | 0.042557 | 0.042544 | 1.000304 | [
"s038536451",
"s685985230"
] |
u350997408 | p02396 | python | s744415490 | s325991464 | 80 | 70 | 7,776 | 7,664 | Accepted | Accepted | 12.5 | # coding: utf-8
import sys
line = sys.stdin
count = 1
for x in line :
if int(x) == 0 :
break
print('Case {0}: {1}'.format(count, x), end='')
count += 1
| # coding: utf-8
import sys
line = sys.stdin
count = 1
for x in line :
if int(x) == 0 :
break
print(('Case {0}: {1}'.format(count, x.strip())))
count += 1 | 11 | 11 | 168 | 168 | # coding: utf-8
import sys
line = sys.stdin
count = 1
for x in line:
if int(x) == 0:
break
print("Case {0}: {1}".format(count, x), end="")
count += 1
| # coding: utf-8
import sys
line = sys.stdin
count = 1
for x in line:
if int(x) == 0:
break
print(("Case {0}: {1}".format(count, x.strip())))
count += 1
| false | 0 | [
"- print(\"Case {0}: {1}\".format(count, x), end=\"\")",
"+ print((\"Case {0}: {1}\".format(count, x.strip())))"
] | false | 0.038129 | 0.085217 | 0.44744 | [
"s744415490",
"s325991464"
] |
u567534852 | p02972 | python | s901944894 | s354293825 | 292 | 270 | 13,116 | 13,112 | Accepted | Accepted | 7.53 | n = int(eval(input()))
a = list(map(int, input().split()))
ball = [0]*n
for i in reversed(list(range(1, n+1))):
a[i-1] ^= sum(ball[i-1:n:i]) % 2
if a[i-1] == 1:
ball[i-1] =1
if sum(ball) > 0:
print((sum(ball)))
print((*[i+1 for i in range(n) if ball[i] > 0]))
else:
... | n = int(eval(input()))
a = list(map(int, input().split()))
ball = [0]*n
for i in reversed(list(range(1, n+1))):
ball_in_or_not = a[i-1] ^ sum(ball[i-1:n:i]) % 2
if ball_in_or_not == 1:
ball[i-1] =1
if sum(ball) > 0:
print((sum(ball)))
print((*[i+1 for i in range(n) if ball... | 19 | 18 | 316 | 338 | n = int(eval(input()))
a = list(map(int, input().split()))
ball = [0] * n
for i in reversed(list(range(1, n + 1))):
a[i - 1] ^= sum(ball[i - 1 : n : i]) % 2
if a[i - 1] == 1:
ball[i - 1] = 1
if sum(ball) > 0:
print((sum(ball)))
print((*[i + 1 for i in range(n) if ball[i] > 0]))
else:
print((... | n = int(eval(input()))
a = list(map(int, input().split()))
ball = [0] * n
for i in reversed(list(range(1, n + 1))):
ball_in_or_not = a[i - 1] ^ sum(ball[i - 1 : n : i]) % 2
if ball_in_or_not == 1:
ball[i - 1] = 1
if sum(ball) > 0:
print((sum(ball)))
print((*[i + 1 for i in range(n) if ball[i] > ... | false | 5.263158 | [
"- a[i - 1] ^= sum(ball[i - 1 : n : i]) % 2",
"- if a[i - 1] == 1:",
"+ ball_in_or_not = a[i - 1] ^ sum(ball[i - 1 : n : i]) % 2",
"+ if ball_in_or_not == 1:"
] | false | 0.041416 | 0.040241 | 1.029186 | [
"s901944894",
"s354293825"
] |
u571281863 | p02678 | python | s927856066 | s847829581 | 651 | 409 | 44,552 | 56,668 | Accepted | Accepted | 37.17 | from collections import deque
N,M=list(map(int,input().split()))
to=[[] for _ in range(N)]
for _ in range(M):
a,b=list(map(int,input().split()))
to[a-1].append(b-1)
to[b-1].append(a-1)
q=deque([0])
r=[None]*N
while q:
x=q.popleft()
for i in to[x]:
if r[i] is None:
q.append(i)
r[i... | from collections import deque
N,M,*AB=map(int,open(0).read().split())
to=[[] for _ in range(N)]
for a,b in zip(*[iter(AB)]*2):
to[a-1].append(b-1)
to[b-1].append(a-1)
q=deque([0])
r=[None]*N
while q:
x=q.popleft()
for i in to[x]:
if r[i] is None:
q.append(i)
r[i]=x+1
print("Yes",*r... | 17 | 15 | 361 | 334 | from collections import deque
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
to[a - 1].append(b - 1)
to[b - 1].append(a - 1)
q = deque([0])
r = [None] * N
while q:
x = q.popleft()
for i in to[x]:
if r[i] is None:
... | from collections import deque
N, M, *AB = map(int, open(0).read().split())
to = [[] for _ in range(N)]
for a, b in zip(*[iter(AB)] * 2):
to[a - 1].append(b - 1)
to[b - 1].append(a - 1)
q = deque([0])
r = [None] * N
while q:
x = q.popleft()
for i in to[x]:
if r[i] is None:
q.append(i... | false | 11.764706 | [
"-N, M = list(map(int, input().split()))",
"+N, M, *AB = map(int, open(0).read().split())",
"-for _ in range(M):",
"- a, b = list(map(int, input().split()))",
"+for a, b in zip(*[iter(AB)] * 2):",
"-print(\"Yes\")",
"-print((\"\\n\".join(map(str, r[1:]))))",
"+print(\"Yes\", *r[1:], sep=\"\\n\")"
] | false | 0.036675 | 0.036308 | 1.010109 | [
"s927856066",
"s847829581"
] |
u467736898 | p02868 | python | s926866848 | s276417145 | 1,010 | 719 | 72,024 | 103,724 | Accepted | Accepted | 28.81 | # RMQ のパフォーマンステスト
class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
# 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990681
def __init__(self, a, sqrt_n=150, inf=(1<<31)-1):
self.sqrt_n = sqrt_n
if hasattr(a, "__iter__"):
from itertools import zip_longest
... | # いろいろ高速化
class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
# 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990681
def __init__(self, a, sqrt_n=150, inf=(1<<31)-1):
self.sqrt_n = sqrt_n
if hasattr(a, "__iter__"):
from itertools import zip_longest
self.... | 76 | 76 | 2,237 | 2,216 | # RMQ のパフォーマンステスト
class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
# 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990681
def __init__(self, a, sqrt_n=150, inf=(1 << 31) - 1):
self.sqrt_n = sqrt_n
if hasattr(a, "__iter__"):
from itertools import zip_longest
s... | # いろいろ高速化
class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
# 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990681
def __init__(self, a, sqrt_n=150, inf=(1 << 31) - 1):
self.sqrt_n = sqrt_n
if hasattr(a, "__iter__"):
from itertools import zip_longest
self.n = ... | false | 0 | [
"-# RMQ のパフォーマンステスト",
"+# いろいろ高速化",
"-N, M = list(map(int, input().split()))",
"-LRC = [list(map(int, input().split())) for _ in range(M)]",
"+N, M, *LRC = list(map(int, open(0).read().split()))",
"+LRC = list(zip(*[iter(LRC)] * 3))"
] | false | 0.070302 | 0.03954 | 1.77799 | [
"s926866848",
"s276417145"
] |
u943624079 | p02888 | python | s542026789 | s955251451 | 1,968 | 761 | 3,188 | 44,124 | Accepted | Accepted | 61.33 | N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
from bisect import bisect_left
cnt = 0
for i in range(0, N - 2):
for j in range(i + 1, N - 1):
t = L[i] + L[j]
idx = bisect_left(L, t, j + 1, len(L))
cnt += max(0, idx - j - 1)
print(cnt)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
from bisect import bisect_left
cnt = 0
for i in range(0,N-2):
for j in range(i+1,N-1):
t = L[i]+L[j]
idx = bisect_left(L,t,lo=j+1)
cnt += max(0,idx-j-1)
print(cnt) | 13 | 12 | 292 | 253 | N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
from bisect import bisect_left
cnt = 0
for i in range(0, N - 2):
for j in range(i + 1, N - 1):
t = L[i] + L[j]
idx = bisect_left(L, t, j + 1, len(L))
cnt += max(0, idx - j - 1)
print(cnt)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
from bisect import bisect_left
cnt = 0
for i in range(0, N - 2):
for j in range(i + 1, N - 1):
t = L[i] + L[j]
idx = bisect_left(L, t, lo=j + 1)
cnt += max(0, idx - j - 1)
print(cnt)
| false | 7.692308 | [
"- idx = bisect_left(L, t, j + 1, len(L))",
"+ idx = bisect_left(L, t, lo=j + 1)"
] | false | 0.046501 | 0.045087 | 1.031358 | [
"s542026789",
"s955251451"
] |
u571969099 | p02558 | python | s036554886 | s035160527 | 656 | 252 | 76,220 | 74,256 | Accepted | Accepted | 61.59 | class DSU:
def __init__(self, n):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a, b):
x, y = self.leader(a), self.leader(b)
if x == y:
return x
if -self.parent_or_size[x] < -self.parent_or_size[y]:
x, y = y, x
self... | import sys
input = sys.stdin.readline
class DSU:
def __init__(self, n):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a, b):
x, y = self.leader(a), self.leader(b)
if x == y:
return x
if -self.parent_or_size[x] < -self.parent_or_size[... | 47 | 50 | 1,294 | 1,336 | class DSU:
def __init__(self, n):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a, b):
x, y = self.leader(a), self.leader(b)
if x == y:
return x
if -self.parent_or_size[x] < -self.parent_or_size[y]:
x, y = y, x
self.parent_or_... | import sys
input = sys.stdin.readline
class DSU:
def __init__(self, n):
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a, b):
x, y = self.leader(a), self.leader(b)
if x == y:
return x
if -self.parent_or_size[x] < -self.parent_or_size[y]:
... | false | 6 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.063309 | 0.038253 | 1.65499 | [
"s036554886",
"s035160527"
] |
u633255271 | p02762 | python | s740345219 | s205439657 | 1,382 | 1,144 | 39,216 | 13,420 | Accepted | Accepted | 17.22 | import sys
sys.setrecursionlimit(1000000000)
class union_find:
def __init__(self, N):
self.par = [i for i in range(N)]
self.size = [1 for i in range(N)]
self.excluded = [0 for i in range(N)]
def root(self, a):
if self.par[a] == a:
return a
e... | class union_find:
def __init__(self, N):
# par < 0 の時はsizeを格納
self.par = [-1 for i in range(N)]
self.excluded = [0 for i in range(N)]
def root(self, a):
if self.par[a] < 0:
return a
else:
# 経路圧縮
self.par[a] = self.root(s... | 50 | 49 | 1,415 | 1,342 | import sys
sys.setrecursionlimit(1000000000)
class union_find:
def __init__(self, N):
self.par = [i for i in range(N)]
self.size = [1 for i in range(N)]
self.excluded = [0 for i in range(N)]
def root(self, a):
if self.par[a] == a:
return a
else:
... | class union_find:
def __init__(self, N):
# par < 0 の時はsizeを格納
self.par = [-1 for i in range(N)]
self.excluded = [0 for i in range(N)]
def root(self, a):
if self.par[a] < 0:
return a
else:
# 経路圧縮
self.par[a] = self.root(self.par[a])
... | false | 2 | [
"-import sys",
"-",
"-sys.setrecursionlimit(1000000000)",
"-",
"-",
"- self.par = [i for i in range(N)]",
"- self.size = [1 for i in range(N)]",
"+ # par < 0 の時はsizeを格納",
"+ self.par = [-1 for i in range(N)]",
"- if self.par[a] == a:",
"+ if self.par[a] ... | false | 0.037586 | 0.037749 | 0.9957 | [
"s740345219",
"s205439657"
] |
u780698286 | p03371 | python | s592644592 | s277846076 | 212 | 190 | 9,084 | 9,108 | Accepted | Accepted | 10.38 | a, b, c, x, y = list(map(int, input().split()))
ans = 10 ** 15
for i in range(max(x, y) * 2 + 1):
n = c * i * 2 + max(0, x - i) * a + max(0, y - i) * b
ans = min(ans, n)
print(ans) | a, b, c, x, y = list(map(int, input().split()))
ans = 10 ** 15
for i in range(max(x, y) * 2 + 1):
if x - i//2 < 0 and y - i//2 < 0:
n = c * i
elif x - i//2 < 0:
n = c * i + (y - i//2) * b
elif y - i//2 < 0:
n = c * i + (x - i//2) * a
else:
n = c * i + (x - i//2) * a + (y - i//2) * b
... | 6 | 13 | 185 | 348 | a, b, c, x, y = list(map(int, input().split()))
ans = 10**15
for i in range(max(x, y) * 2 + 1):
n = c * i * 2 + max(0, x - i) * a + max(0, y - i) * b
ans = min(ans, n)
print(ans)
| a, b, c, x, y = list(map(int, input().split()))
ans = 10**15
for i in range(max(x, y) * 2 + 1):
if x - i // 2 < 0 and y - i // 2 < 0:
n = c * i
elif x - i // 2 < 0:
n = c * i + (y - i // 2) * b
elif y - i // 2 < 0:
n = c * i + (x - i // 2) * a
else:
n = c * i + (x - i // ... | false | 53.846154 | [
"- n = c * i * 2 + max(0, x - i) * a + max(0, y - i) * b",
"+ if x - i // 2 < 0 and y - i // 2 < 0:",
"+ n = c * i",
"+ elif x - i // 2 < 0:",
"+ n = c * i + (y - i // 2) * b",
"+ elif y - i // 2 < 0:",
"+ n = c * i + (x - i // 2) * a",
"+ else:",
"+ n = c ... | false | 0.106274 | 0.104191 | 1.019989 | [
"s592644592",
"s277846076"
] |
u906501980 | p02678 | python | s763878467 | s586660681 | 597 | 471 | 41,544 | 98,656 | Accepted | Accepted | 21.11 | from collections import deque
def main():
n, m = list(map(int, input().split()))
route = [[] for _ in range(n+1)]
ans = [None]*(n+1)
for _ in range(m):
a, b = list(map(int, input().split()))
route[a].append(b)
route[b].append(a)
q = deque([1])
while q:
... | from collections import deque
def main():
n, m = list(map(int, input().split()))
route = [[] for _ in range(n+1)]
for _ in range(m):
a, b = list(map(int, input().split()))
route[a].append(b)
route[b].append(a)
ans = [None]*(n+1)
q = deque([1])
while q:
... | 23 | 23 | 609 | 609 | from collections import deque
def main():
n, m = list(map(int, input().split()))
route = [[] for _ in range(n + 1)]
ans = [None] * (n + 1)
for _ in range(m):
a, b = list(map(int, input().split()))
route[a].append(b)
route[b].append(a)
q = deque([1])
while q:
par... | from collections import deque
def main():
n, m = list(map(int, input().split()))
route = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, input().split()))
route[a].append(b)
route[b].append(a)
ans = [None] * (n + 1)
q = deque([1])
while q:
par... | false | 0 | [
"- ans = [None] * (n + 1)",
"+ ans = [None] * (n + 1)"
] | false | 0.044416 | 0.049382 | 0.899445 | [
"s763878467",
"s586660681"
] |
u325282913 | p03361 | python | s384123224 | s832171377 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | H, W = list(map(int, input().split()))
tmp = '.' * (W + 2)
matrix = [tmp] * (H + 2)
for i in range(1,H+1):
matrix[i] = '.' + eval(input()) + '.'
for i in range(1,H+1):
for k in range(1,W+1):
if matrix[i][k] == '.':
continue
elif matrix[i][k-1] == '.' and matrix[i][k+1] == '.... | H, W = list(map(int,input().split()))
grid = ['.'*(W+2)]
for _ in range(H):
tmp = eval(input())
tmp = '.' + tmp + '.'
grid.append(tmp)
grid.append('.'*(W+2))
for i in range(1,H+1):
for k in range(1,W+1):
if grid[i][k] == '.':
continue
if grid[i][k+1] != '#' and gri... | 13 | 16 | 421 | 453 | H, W = list(map(int, input().split()))
tmp = "." * (W + 2)
matrix = [tmp] * (H + 2)
for i in range(1, H + 1):
matrix[i] = "." + eval(input()) + "."
for i in range(1, H + 1):
for k in range(1, W + 1):
if matrix[i][k] == ".":
continue
elif (
matrix[i][k - 1] == "."
... | H, W = list(map(int, input().split()))
grid = ["." * (W + 2)]
for _ in range(H):
tmp = eval(input())
tmp = "." + tmp + "."
grid.append(tmp)
grid.append("." * (W + 2))
for i in range(1, H + 1):
for k in range(1, W + 1):
if grid[i][k] == ".":
continue
if grid[i][k + 1] != "#" a... | false | 18.75 | [
"-tmp = \".\" * (W + 2)",
"-matrix = [tmp] * (H + 2)",
"-for i in range(1, H + 1):",
"- matrix[i] = \".\" + eval(input()) + \".\"",
"+grid = [\".\" * (W + 2)]",
"+for _ in range(H):",
"+ tmp = eval(input())",
"+ tmp = \".\" + tmp + \".\"",
"+ grid.append(tmp)",
"+grid.append(\".\" * (W... | false | 0.067632 | 0.068412 | 0.988597 | [
"s384123224",
"s832171377"
] |
u440566786 | p02834 | python | s832909949 | s134634374 | 526 | 438 | 71,224 | 66,616 | Accepted | Accepted | 16.73 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n,x,y=list(map(int,input().split()))
x-=1; y-=1
E=[[] for _ in range(n)]
for _ in range(n-1):
u,v=list(map(int,input().split()))
u-=1; v-=1
... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n,x,y=list(map(int,input().split()))
x-=1; y-=1
E=[[] for _ in range(n)]
for _ in range(n-1):
u,v=list(map(int,input().split()))
u-=1; v-=1
... | 69 | 44 | 1,448 | 944 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
E = [[] for _ in range(n)]
for _ in range(n - 1):
u, v = list(map(int, input().split()))
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
E = [[] for _ in range(n)]
for _ in range(n - 1):
u, v = list(map(int, input().split()))
... | false | 36.231884 | [
"- # x から y への path を作る(depthも)",
"+ # x,y それぞれの depth を計算する",
"+ dx = [None] * n",
"+ dx[x] = 0",
"- prev = [None] * n",
"- prev[x] = -1",
"- depth = [None] * n",
"- depth[x] = 0",
"- prev[nv] = v",
"- depth[nv] = depth[v] + 1",
"+ dx[nv]... | false | 0.046698 | 0.046155 | 1.01177 | [
"s832909949",
"s134634374"
] |
u941047297 | p03625 | python | s369891769 | s666121459 | 243 | 76 | 68,760 | 22,316 | Accepted | Accepted | 68.72 | from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
l1, l2 = 0, 0
for k, v in list(c.items()):
if k > l1:
if v >= 4:
l1, l2 = k, k
elif 2 <= v <= 3:
l1, l2 = k... | from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
B = sorted([(k, v) for k, v in list(c.items()) if v >= 2], reverse = True, key = lambda x: x[0])
if len(B) < 2:
print((0))
elif B[0][1] >= 4:
print((B[0]... | 20 | 15 | 476 | 402 | from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
l1, l2 = 0, 0
for k, v in list(c.items()):
if k > l1:
if v >= 4:
l1, l2 = k, k
elif 2 <= v <= 3:
l1, l2 = k, l1
... | from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
B = sorted(
[(k, v) for k, v in list(c.items()) if v >= 2], reverse=True, key=lambda x: x[0]
)
if len(B) < 2:
print((0))
elif B[0][1] >= 4:
print((B... | false | 25 | [
"- l1, l2 = 0, 0",
"- for k, v in list(c.items()):",
"- if k > l1:",
"- if v >= 4:",
"- l1, l2 = k, k",
"- elif 2 <= v <= 3:",
"- l1, l2 = k, l1",
"- else:",
"- pass",
"- elif l2 < k <= l1 and v >= 2:... | false | 0.094093 | 0.067704 | 1.389762 | [
"s369891769",
"s666121459"
] |
u863370423 | p04043 | python | s194922777 | s029873760 | 22 | 17 | 3,316 | 2,940 | Accepted | Accepted | 22.73 | arr = list(map(int,input().split()))
b = [0]*10
for i in arr:
b[i-1] += 1
if (b[4]==2 and b[6]==1):
print("YES")
else:
print("NO")
| a, b, c = list(map(int, input().split()))
if a==5 and b==5 and c==7 or a==5 and b==7 and c==5 or a==7 and b==5 and c==5:
print('YES')
else:
print('NO') | 12 | 5 | 158 | 157 | arr = list(map(int, input().split()))
b = [0] * 10
for i in arr:
b[i - 1] += 1
if b[4] == 2 and b[6] == 1:
print("YES")
else:
print("NO")
| a, b, c = list(map(int, input().split()))
if (
a == 5
and b == 5
and c == 7
or a == 5
and b == 7
and c == 5
or a == 7
and b == 5
and c == 5
):
print("YES")
else:
print("NO")
| false | 58.333333 | [
"-arr = list(map(int, input().split()))",
"-b = [0] * 10",
"-for i in arr:",
"- b[i - 1] += 1",
"-if b[4] == 2 and b[6] == 1:",
"+a, b, c = list(map(int, input().split()))",
"+if (",
"+ a == 5",
"+ and b == 5",
"+ and c == 7",
"+ or a == 5",
"+ and b == 7",
"+ and c == 5... | false | 0.032503 | 0.032078 | 1.013241 | [
"s194922777",
"s029873760"
] |
u761320129 | p02792 | python | s631376678 | s397776675 | 197 | 139 | 3,064 | 9,200 | Accepted | Accepted | 29.44 | N = int(eval(input()))
c = [[0]*10 for _ in range(10)]
for n in range(1,N+1):
s = str(n)
c[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += c[i][j] * c[j][i]
print(ans) | N = int(eval(input()))
dp = [[0]*10 for _ in range(10)]
for n in range(1,N+1):
s = str(n)
dp[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += dp[i][j] * dp[j][i]
print(ans) | 12 | 13 | 229 | 235 | N = int(eval(input()))
c = [[0] * 10 for _ in range(10)]
for n in range(1, N + 1):
s = str(n)
c[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += c[i][j] * c[j][i]
print(ans)
| N = int(eval(input()))
dp = [[0] * 10 for _ in range(10)]
for n in range(1, N + 1):
s = str(n)
dp[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += dp[i][j] * dp[j][i]
print(ans)
| false | 7.692308 | [
"-c = [[0] * 10 for _ in range(10)]",
"+dp = [[0] * 10 for _ in range(10)]",
"- c[int(s[0])][int(s[-1])] += 1",
"+ dp[int(s[0])][int(s[-1])] += 1",
"- ans += c[i][j] * c[j][i]",
"+ ans += dp[i][j] * dp[j][i]"
] | false | 0.187579 | 0.067695 | 2.770931 | [
"s631376678",
"s397776675"
] |
u315078622 | p02916 | python | s846375234 | s188739412 | 174 | 26 | 38,384 | 9,020 | Accepted | Accepted | 85.06 | N = int(eval(input()))
A = [int(x)-1 for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
ans = 0
for i, a in enumerate(A):
ans += B[a]
if i < N-1 and a + 1 == A[i+1]:
ans += C[a]
print(ans)
| def main() -> None:
N = int(eval(input()))
A = [int(x)-1 for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
ans = sum(B[a] for a in A)
for a1, a2 in zip(A, A[1:]):
if a1 + 1 == a2:
ans += C[a1]
print(ans)
if... | 10 | 14 | 259 | 351 | N = int(eval(input()))
A = [int(x) - 1 for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
ans = 0
for i, a in enumerate(A):
ans += B[a]
if i < N - 1 and a + 1 == A[i + 1]:
ans += C[a]
print(ans)
| def main() -> None:
N = int(eval(input()))
A = [int(x) - 1 for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
ans = sum(B[a] for a in A)
for a1, a2 in zip(A, A[1:]):
if a1 + 1 == a2:
ans += C[a1]
print(ans)
if __name__ ... | false | 28.571429 | [
"-N = int(eval(input()))",
"-A = [int(x) - 1 for x in input().split()]",
"-B = [int(x) for x in input().split()]",
"-C = [int(x) for x in input().split()]",
"-ans = 0",
"-for i, a in enumerate(A):",
"- ans += B[a]",
"- if i < N - 1 and a + 1 == A[i + 1]:",
"- ans += C[a]",
"-print(ans... | false | 0.039826 | 0.040444 | 0.98471 | [
"s846375234",
"s188739412"
] |
u445624660 | p03472 | python | s110344493 | s058029356 | 361 | 317 | 8,652 | 30,044 | Accepted | Accepted | 12.19 | # ai<=biなので基本的にbiが強い。最強のaiより弱いbiは使う必要がない
# 順番は関係ないので選びぬかれたbiを強いほうか使っていって、倒せなかったら最強のaiをHがなくなるまで使う
# これだとPypyでギリギリ間に合わん...
n, h = list(map(int, input().split()))
a, b = 0, []
for _ in range(n):
ai, bi = list(map(int, input().split()))
a = max(a, ai)
b.append(bi)
b = list(sorted(b))
l, r = 0, n
... | # Bを一回使えると考えると
# - Ai>BiであるBiを使う意味はない(Aiで殴ればいいので)
# - Ai>AjであるAjを使う意味はない(Aiで殴ればいいので)
# つまりA中最強のAiより上(i=j自身を含む)のBjを1度使い、あとはAiで殴る
n, h = list(map(int, input().split()))
power = [list(map(int, input().split())) for _ in range(n)]
maxa = sorted(power, key=lambda x : x[0], reverse=True)[0][0]
muscleb = sorted(list([x... | 31 | 19 | 599 | 591 | # ai<=biなので基本的にbiが強い。最強のaiより弱いbiは使う必要がない
# 順番は関係ないので選びぬかれたbiを強いほうか使っていって、倒せなかったら最強のaiをHがなくなるまで使う
# これだとPypyでギリギリ間に合わん...
n, h = list(map(int, input().split()))
a, b = 0, []
for _ in range(n):
ai, bi = list(map(int, input().split()))
a = max(a, ai)
b.append(bi)
b = list(sorted(b))
l, r = 0, n
while r - l > 0... | # Bを一回使えると考えると
# - Ai>BiであるBiを使う意味はない(Aiで殴ればいいので)
# - Ai>AjであるAjを使う意味はない(Aiで殴ればいいので)
# つまりA中最強のAiより上(i=j自身を含む)のBjを1度使い、あとはAiで殴る
n, h = list(map(int, input().split()))
power = [list(map(int, input().split())) for _ in range(n)]
maxa = sorted(power, key=lambda x: x[0], reverse=True)[0][0]
muscleb = sorted(
list([x fo... | false | 38.709677 | [
"-# ai<=biなので基本的にbiが強い。最強のaiより弱いbiは使う必要がない",
"-# 順番は関係ないので選びぬかれたbiを強いほうか使っていって、倒せなかったら最強のaiをHがなくなるまで使う",
"-# これだとPypyでギリギリ間に合わん...",
"+# Bを一回使えると考えると",
"+# - Ai>BiであるBiを使う意味はない(Aiで殴ればいいので)",
"+# - Ai>AjであるAjを使う意味はない(Aiで殴ればいいので)",
"+# つまりA中最強のAiより上(i=j自身を含む)のBjを1度使い、あとはAiで殴る",
"-a, b = 0, []",
"-for ... | false | 0.041943 | 0.043183 | 0.971292 | [
"s110344493",
"s058029356"
] |
u811967730 | p02996 | python | s007142067 | s121471383 | 938 | 834 | 53,600 | 55,264 | Accepted | Accepted | 11.09 | N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
task.sort(key=lambda x: x[1])
t = 0
ans = "Yes"
for i in range(N):
a = task[i][0]
b = task[i][1]
t += a
if t > b:
ans = "No"
break
print(ans)
| N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
t = 0
ans = "Yes"
for a, b in sorted(task, key=lambda x: x[1]):
t += a
if t > b:
ans = "No"
break
print(ans)
| 17 | 13 | 270 | 224 | N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
task.sort(key=lambda x: x[1])
t = 0
ans = "Yes"
for i in range(N):
a = task[i][0]
b = task[i][1]
t += a
if t > b:
ans = "No"
break
print(ans)
| N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
t = 0
ans = "Yes"
for a, b in sorted(task, key=lambda x: x[1]):
t += a
if t > b:
ans = "No"
break
print(ans)
| false | 23.529412 | [
"-task.sort(key=lambda x: x[1])",
"-for i in range(N):",
"- a = task[i][0]",
"- b = task[i][1]",
"+for a, b in sorted(task, key=lambda x: x[1]):"
] | false | 0.032001 | 0.0407 | 0.786265 | [
"s007142067",
"s121471383"
] |
u254871849 | p03126 | python | s023898945 | s007640132 | 20 | 18 | 3,188 | 3,060 | Accepted | Accepted | 10 | # 2019-11-12 15:53:47(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
... | import sys
n, m = list(map(int, sys.stdin.readline().split()))
g = [[int(x) for x in sys.stdin.readline().split()[1:]] for _ in range(n)]
def main():
res = set(range(1, m+1))
for a in g:
res &= set(a)
return len(res)
if __name__ == '__main__':
ans = main()
print(ans) | 25 | 15 | 676 | 311 | # 2019-11-12 15:53:47(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import ... | import sys
n, m = list(map(int, sys.stdin.readline().split()))
g = [[int(x) for x in sys.stdin.readline().split()[1:]] for _ in range(n)]
def main():
res = set(range(1, m + 1))
for a in g:
res &= set(a)
return len(res)
if __name__ == "__main__":
ans = main()
print(ans)
| false | 40 | [
"-# 2019-11-12 15:53:47(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-# fro... | false | 0.043529 | 0.045169 | 0.963707 | [
"s023898945",
"s007640132"
] |
u172035535 | p03073 | python | s227083972 | s679341321 | 46 | 18 | 3,188 | 3,188 | Accepted | Accepted | 60.87 | S = eval(input())
ans0 = 0
ans1 = 0
for i in range(len(S)):
if i%2 == 0:
if S[i] == '0':
ans1 += 1
else:
ans0 += 1
else:
if S[i] == '1':
ans1 += 1
else:
ans0 += 1
print((min(ans0,ans1))) | S = eval(input())
a = S[::2]
b = S[1::2]
A = a.count('0')+b.count('1')
print((min(A,len(S)-A))) | 15 | 5 | 280 | 91 | S = eval(input())
ans0 = 0
ans1 = 0
for i in range(len(S)):
if i % 2 == 0:
if S[i] == "0":
ans1 += 1
else:
ans0 += 1
else:
if S[i] == "1":
ans1 += 1
else:
ans0 += 1
print((min(ans0, ans1)))
| S = eval(input())
a = S[::2]
b = S[1::2]
A = a.count("0") + b.count("1")
print((min(A, len(S) - A)))
| false | 66.666667 | [
"-ans0 = 0",
"-ans1 = 0",
"-for i in range(len(S)):",
"- if i % 2 == 0:",
"- if S[i] == \"0\":",
"- ans1 += 1",
"- else:",
"- ans0 += 1",
"- else:",
"- if S[i] == \"1\":",
"- ans1 += 1",
"- else:",
"- ans0 += 1",
... | false | 0.056276 | 0.032804 | 1.715518 | [
"s227083972",
"s679341321"
] |
u681444474 | p02853 | python | s006761805 | s637297214 | 202 | 19 | 38,256 | 3,064 | Accepted | Accepted | 90.59 | X = list(map(int,input().split()))
c=100000
b=200000
a=300000
X.sort()
ans=0
cnt=0
for i in X:
if i==1:
ans+=a
cnt+=1
elif i==2:
ans+=b
elif i==3:
ans+=c
if cnt==2:
ans += 400000
print(ans) | # coding: utf-8
x, y = list(map(int,input().split()))
l1 = [1,2,3]
l2 = [300000,200000,100000]
ans = 0
if x in l1:
ans += l2[l1.index(x)]
if y in l1:
ans += l2[l1.index(y)]
if x == 1 and y == 1:
ans += 400000
print(ans) | 18 | 18 | 254 | 252 | X = list(map(int, input().split()))
c = 100000
b = 200000
a = 300000
X.sort()
ans = 0
cnt = 0
for i in X:
if i == 1:
ans += a
cnt += 1
elif i == 2:
ans += b
elif i == 3:
ans += c
if cnt == 2:
ans += 400000
print(ans)
| # coding: utf-8
x, y = list(map(int, input().split()))
l1 = [1, 2, 3]
l2 = [300000, 200000, 100000]
ans = 0
if x in l1:
ans += l2[l1.index(x)]
if y in l1:
ans += l2[l1.index(y)]
if x == 1 and y == 1:
ans += 400000
print(ans)
| false | 0 | [
"-X = list(map(int, input().split()))",
"-c = 100000",
"-b = 200000",
"-a = 300000",
"-X.sort()",
"+# coding: utf-8",
"+x, y = list(map(int, input().split()))",
"+l1 = [1, 2, 3]",
"+l2 = [300000, 200000, 100000]",
"-cnt = 0",
"-for i in X:",
"- if i == 1:",
"- ans += a",
"- ... | false | 0.038902 | 0.04314 | 0.901775 | [
"s006761805",
"s637297214"
] |
u141610915 | p03112 | python | s403345211 | s517876048 | 1,696 | 583 | 14,848 | 95,784 | Accepted | Accepted | 65.62 | from bisect import bisect_left as bl
A, B, Q = list(map(int, input().split()))
inf = 10 ** 11
Sh = [-1 * inf] + [int(eval(input())) for _ in range(A)] + [inf]
Te = [-1 * inf] + [int(eval(input())) for _ in range(B)] + [inf]
for _ in range(Q):
x = int(eval(input()))
b, d = bl(Sh, x), bl(Te, x)
res = inf
... | import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
A, B, Q = list(map(int, input().split()))
a = [-10 ** 18] + [int(eval(input())) for _ in range(A)] + [10 ** 18]
b = [-10 ** 18] + [int(eval(input())) for _ in range(B)] + [10 ** 18]
for _ in range(Q):
x = int(eval(input()))
ra = bl(a... | 14 | 18 | 468 | 683 | from bisect import bisect_left as bl
A, B, Q = list(map(int, input().split()))
inf = 10**11
Sh = [-1 * inf] + [int(eval(input())) for _ in range(A)] + [inf]
Te = [-1 * inf] + [int(eval(input())) for _ in range(B)] + [inf]
for _ in range(Q):
x = int(eval(input()))
b, d = bl(Sh, x), bl(Te, x)
res = inf
f... | import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
A, B, Q = list(map(int, input().split()))
a = [-(10**18)] + [int(eval(input())) for _ in range(A)] + [10**18]
b = [-(10**18)] + [int(eval(input())) for _ in range(B)] + [10**18]
for _ in range(Q):
x = int(eval(input()))
ra = bl(a, x)
... | false | 22.222222 | [
"+import sys",
"+input = sys.stdin.readline",
"-inf = 10**11",
"-Sh = [-1 * inf] + [int(eval(input())) for _ in range(A)] + [inf]",
"-Te = [-1 * inf] + [int(eval(input())) for _ in range(B)] + [inf]",
"+a = [-(10**18)] + [int(eval(input())) for _ in range(A)] + [10**18]",
"+b = [-(10**18)] + [int(eval(i... | false | 0.039516 | 0.047715 | 0.828184 | [
"s403345211",
"s517876048"
] |
u423585790 | p02696 | python | s327712665 | s447495422 | 669 | 60 | 76,768 | 62,004 | Accepted | Accepted | 91.03 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(... | a,b,n=list(map(int,input().split()))
def f(x):
return a*x//b-a*(x//b)
if n<b:
ans =f(n)
else:
t = n
u = b - 1
ans=max(f(t),f(u))
print(ans)
| 35 | 10 | 1,052 | 163 | #!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI():
return list(map(int, input().split()))
def LF... | a, b, n = list(map(int, input().split()))
def f(x):
return a * x // b - a * (x // b)
if n < b:
ans = f(n)
else:
t = n
u = b - 1
ans = max(f(t), f(u))
print(ans)
| false | 71.428571 | [
"-#!/usr/bin/env python3",
"-from collections import defaultdict, deque",
"-from heapq import heappush, heappop",
"-from bisect import bisect_left, bisect_right",
"-import sys, random, itertools, math",
"-",
"-sys.setrecursionlimit(10**5)",
"-input = sys.stdin.readline",
"-sqrt = math.sqrt",
"+a, ... | false | 0.038572 | 0.035717 | 1.079915 | [
"s327712665",
"s447495422"
] |
u775681539 | p02708 | python | s005209827 | s448153178 | 119 | 69 | 27,184 | 83,520 | Accepted | Accepted | 42.02 | MOD = int(1e9)+7
def main():
n, k = list(map(int, input().split()))
n += 1
a = [int(i) for i in range(n)]
s = [0]
for i in range(n):
s.append(s[i]+a[i])
ans = 0
for i in range(k, n+1):
ans += s[n]-s[n-i]-s[i]+1
ans %= MOD
print((ans%MOD))
main() | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, K = list(map(int, readline().split()))
p = [int(i) for i in range(N+1)]
s = [0]
for i in range(N+1):
s.append(s[i]+p[i])
ans = 0
P = int(1e9)+7... | 15 | 19 | 309 | 463 | MOD = int(1e9) + 7
def main():
n, k = list(map(int, input().split()))
n += 1
a = [int(i) for i in range(n)]
s = [0]
for i in range(n):
s.append(s[i] + a[i])
ans = 0
for i in range(k, n + 1):
ans += s[n] - s[n - i] - s[i] + 1
ans %= MOD
print((ans % MOD))
main(... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, K = list(map(int, readline().split()))
p = [int(i) for i in range(N + 1)]
s = [0]
for i in range(N + 1):
s.append(s[i] + p[i])
ans = 0
P = int(1e9) + 7
... | false | 21.052632 | [
"-MOD = int(1e9) + 7",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"- n, k = list(map(int, input().split()))",
"- n += 1",
"- a = [int(i) for i in range(n)]",
"+ N, K = list(map(int, readline()... | false | 0.157915 | 0.107203 | 1.473047 | [
"s005209827",
"s448153178"
] |
u263830634 | p03557 | python | s171111113 | s560060179 | 616 | 559 | 23,360 | 23,360 | Accepted | Accepted | 9.25 |
from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
#Bの中の数iに対して、Aの中でiより小さい数の個数と、Cの中でiより大きい数の個数の積を探索
for i in B:
ans += bisect_right(A, i-0.1) * (N-b... | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
# print (A, B ,C)
ans = 0
for i in B:
# print (i)
# print (bisect.bisect_left(A, i-0.1))
ans += bisect.bisect_left(A,... | 16 | 18 | 349 | 370 | from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
# Bの中の数iに対して、Aの中でiより小さい数の個数と、Cの中でiより大きい数の個数の積を探索
for i in B:
ans += bisect_right(A, i - 0.1) * (N - bisect_left(C... | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
# print (A, B ,C)
ans = 0
for i in B:
# print (i)
# print (bisect.bisect_left(A, i-0.1))
ans += bisect.bisect_left(A, i - 0.1) * (N - b... | false | 11.111111 | [
"-from bisect import bisect_left, bisect_right",
"+import bisect",
"+B.sort()",
"+# print (A, B ,C)",
"-# Bの中の数iに対して、Aの中でiより小さい数の個数と、Cの中でiより大きい数の個数の積を探索",
"- ans += bisect_right(A, i - 0.1) * (N - bisect_left(C, i + 0.1))",
"+ # print (i)",
"+ # print (bisect.bisect_left(A, i-0.1))",
"+ ... | false | 0.04971 | 0.049499 | 1.004258 | [
"s171111113",
"s560060179"
] |
u549161102 | p02689 | python | s264021006 | s951067687 | 307 | 254 | 31,964 | 20,068 | Accepted | Accepted | 17.26 | N,M = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
counts = [1]*N
for i in AB:
if H[i[0]-1] <= H[i[1]-1]:
counts[i[0]-1] -= 1
if H[i[0]-1] >= H[i[1]-1]:
counts[i[1]-1] -= 1
print((counts.count(1))) | N,M = list(map(int, input().split()))
H = list(map(int, input().split()))
L = []
for i in range(M):
a, b = list(map(int, input().split()))
if H[a-1] > H[b-1]:
L.append(b-1)
elif H[a-1] < H[b-1]:
L.append(a-1)
else:
L.append(a-1)
L.append(b-1)
print((N - len(set(L))))
| 11 | 13 | 292 | 290 | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
counts = [1] * N
for i in AB:
if H[i[0] - 1] <= H[i[1] - 1]:
counts[i[0] - 1] -= 1
if H[i[0] - 1] >= H[i[1] - 1]:
counts[i[1] - 1] -= 1
print((counts.count(1)))
| N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
L = []
for i in range(M):
a, b = list(map(int, input().split()))
if H[a - 1] > H[b - 1]:
L.append(b - 1)
elif H[a - 1] < H[b - 1]:
L.append(a - 1)
else:
L.append(a - 1)
L.append(b - 1)
print((N - l... | false | 15.384615 | [
"-AB = [list(map(int, input().split())) for i in range(M)]",
"-counts = [1] * N",
"-for i in AB:",
"- if H[i[0] - 1] <= H[i[1] - 1]:",
"- counts[i[0] - 1] -= 1",
"- if H[i[0] - 1] >= H[i[1] - 1]:",
"- counts[i[1] - 1] -= 1",
"-print((counts.count(1)))",
"+L = []",
"+for i in ra... | false | 0.036947 | 0.072808 | 0.507456 | [
"s264021006",
"s951067687"
] |
u935558307 | p03565 | python | s504379369 | s431550527 | 20 | 17 | 3,188 | 3,064 | Accepted | Accepted | 15 | import sys
s = eval(input())
t = eval(input())
for i in range(len(s)-len(t)+1):
if i == 0:
sub = s[-i-len(t):]
else:
sub = s[-i-len(t):-i]
for j in range(len(t)):
if sub[j]!=t[j] and sub[j]!="?":
break
else:
if i == 0:
s = s[:-i-len(t)]+t
else:
s = s[:-i-... | import sys
s = eval(input())
t = eval(input())
lenS = len(s)
lenT = len(t)
for i in range(lenS-lenT,-1,-1):
sub = s[i:i+lenT]
for j in range(lenT):
if sub[j]!="?" and sub[j]!=t[j]:
break
else:
s=s.replace("?","a")
print((s[:i]+t+s[i+lenT:]))
sys.exit()
continue
print('... | 24 | 18 | 423 | 320 | import sys
s = eval(input())
t = eval(input())
for i in range(len(s) - len(t) + 1):
if i == 0:
sub = s[-i - len(t) :]
else:
sub = s[-i - len(t) : -i]
for j in range(len(t)):
if sub[j] != t[j] and sub[j] != "?":
break
else:
if i == 0:
s = s[: -i - ... | import sys
s = eval(input())
t = eval(input())
lenS = len(s)
lenT = len(t)
for i in range(lenS - lenT, -1, -1):
sub = s[i : i + lenT]
for j in range(lenT):
if sub[j] != "?" and sub[j] != t[j]:
break
else:
s = s.replace("?", "a")
print((s[:i] + t + s[i + lenT :]))
... | false | 25 | [
"-for i in range(len(s) - len(t) + 1):",
"- if i == 0:",
"- sub = s[-i - len(t) :]",
"- else:",
"- sub = s[-i - len(t) : -i]",
"- for j in range(len(t)):",
"- if sub[j] != t[j] and sub[j] != \"?\":",
"+lenS = len(s)",
"+lenT = len(t)",
"+for i in range(lenS - lenT, -1... | false | 0.048618 | 0.040604 | 1.197369 | [
"s504379369",
"s431550527"
] |
u794173881 | p02787 | python | s424131069 | s958544159 | 1,812 | 378 | 44,404 | 42,972 | Accepted | Accepted | 79.14 | h, n = list(map(int, input().split()))
info = [list(map(int, input().split())) for i in range(n)]
dp = [10**18] * (h + 1 + 10 ** 5)
dp[h + 10 ** 5] = 0
for i in range(n):
a, b = info[i]
for j in range(h + 1 + 10 ** 5)[::-1]:
if j - a >= 0:
dp[j - a] = min(dp[j] + b, dp[j - a])
pri... | h, n = list(map(int, input().split()))
info = [list(map(int, input().split())) for i in range(n)]
INF = 10**18
dp = [INF] * (h + 1)
dp[h] = 0
for i in range(n):
a, b = info[i]
for j in range(h + 1)[::-1]:
dp[max(j - a, 0)] = min(dp[j] + b, dp[max(j - a, 0)])
print((dp[0]))
| 11 | 11 | 339 | 297 | h, n = list(map(int, input().split()))
info = [list(map(int, input().split())) for i in range(n)]
dp = [10**18] * (h + 1 + 10**5)
dp[h + 10**5] = 0
for i in range(n):
a, b = info[i]
for j in range(h + 1 + 10**5)[::-1]:
if j - a >= 0:
dp[j - a] = min(dp[j] + b, dp[j - a])
print((min(dp[0 : 10... | h, n = list(map(int, input().split()))
info = [list(map(int, input().split())) for i in range(n)]
INF = 10**18
dp = [INF] * (h + 1)
dp[h] = 0
for i in range(n):
a, b = info[i]
for j in range(h + 1)[::-1]:
dp[max(j - a, 0)] = min(dp[j] + b, dp[max(j - a, 0)])
print((dp[0]))
| false | 0 | [
"-dp = [10**18] * (h + 1 + 10**5)",
"-dp[h + 10**5] = 0",
"+INF = 10**18",
"+dp = [INF] * (h + 1)",
"+dp[h] = 0",
"- for j in range(h + 1 + 10**5)[::-1]:",
"- if j - a >= 0:",
"- dp[j - a] = min(dp[j] + b, dp[j - a])",
"-print((min(dp[0 : 10**5 + 1])))",
"+ for j in range(h... | false | 2.018824 | 0.155939 | 12.946249 | [
"s424131069",
"s958544159"
] |
u836939578 | p02726 | python | s758111889 | s234928632 | 1,185 | 484 | 118,492 | 83,036 | Accepted | Accepted | 59.16 | import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
N,X,Y = list(map(int, input().split()))
edges = [[] for _ in range(N)]
for i in range(N-1):
edges[i].append(i+1)
edges[i+1].append(i)
edges[X-1].append(Y-1)
edges[Y-1].append(X-1)
ans = [0] * (N-1)
qu... | import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
N,X,Y = list(map(int, input().split()))
queue = deque()
edges = [[] for _ in range(N)]
for i in range(N-1):
edges[i].append(i+1)
edges[i+1].append(i)
edges[X-1].append(Y-1)
edges[Y-1].append(X-1)
ans = ... | 41 | 35 | 850 | 687 | import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
N, X, Y = list(map(int, input().split()))
edges = [[] for _ in range(N)]
for i in range(N - 1):
edges[i].append(i + 1)
edges[i + 1].append(i)
edges[X - 1].append(Y - 1)
edges[Y - 1].append(X - 1)
ans = [0] * (N - 1)
queue =... | import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
N, X, Y = list(map(int, input().split()))
queue = deque()
edges = [[] for _ in range(N)]
for i in range(N - 1):
edges[i].append(i + 1)
edges[i + 1].append(i)
edges[X - 1].append(Y - 1)
edges[Y - 1].append(X - 1)
ans = [0] *... | false | 14.634146 | [
"+queue = deque()",
"-ans = [0] * (N - 1)",
"-queue = deque([])",
"-",
"-",
"-def bfs(start):",
"- queue.extend(edges[start])",
"- visited = [False] * N",
"- visited[start] = True",
"- i = 0",
"+ans = [0] * N",
"+for i in range(N):",
"+ visited = [0] * N",
"+ visited[i] =... | false | 0.090418 | 0.090185 | 1.002591 | [
"s758111889",
"s234928632"
] |
u608088992 | p03634 | python | s851587897 | s012991350 | 1,149 | 491 | 52,476 | 53,976 | Accepted | Accepted | 57.27 | import heapq
N = int(eval(input()))
P = [[] for i in range(N)]
for i in range(N-1):
a, b, c = list(map(int, input().split()))
P[a-1].append((c, b-1))
P[b-1].append((c, a-1))
Q, K = list(map(int, input().split()))
C = [float("inf") for _ in range(N)]
V = [False for _ in range(N)]
C[K-1] = 0
H = ... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
Edge = [[] for _ in range(N)]
for _ in range(N-1):
a, b, c = list(map(int, input().split()))
Edge[a-1].append((b-1, c))
Edge[b-1].append((a-1, c))
Q, K = list(m... | 28 | 31 | 721 | 824 | import heapq
N = int(eval(input()))
P = [[] for i in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
P[a - 1].append((c, b - 1))
P[b - 1].append((c, a - 1))
Q, K = list(map(int, input().split()))
C = [float("inf") for _ in range(N)]
V = [False for _ in range(N)]
C[K - 1] = 0
H = ... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
Edge = [[] for _ in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
Edge[a - 1].append((b - 1, c))
Edge[b - 1].append((a - 1, c))
Q, K = list(m... | false | 9.677419 | [
"-import heapq",
"+import sys",
"+from collections import deque",
"-N = int(eval(input()))",
"-P = [[] for i in range(N)]",
"-for i in range(N - 1):",
"- a, b, c = list(map(int, input().split()))",
"- P[a - 1].append((c, b - 1))",
"- P[b - 1].append((c, a - 1))",
"-Q, K = list(map(int, in... | false | 0.044519 | 0.138098 | 0.322368 | [
"s851587897",
"s012991350"
] |
u374099594 | p03280 | python | s872172022 | s264668325 | 18 | 11 | 3,428 | 2,568 | Accepted | Accepted | 38.89 | import subprocess
A,B = list(map(int, subprocess.check_output("dd").split()))
print((A-1)*(B-1))
| import sys
A,B = list(map(int, sys.stdin.read().split()))
print((A-1)*(B-1)) | 3 | 3 | 92 | 71 | import subprocess
A, B = list(map(int, subprocess.check_output("dd").split()))
print((A - 1) * (B - 1))
| import sys
A, B = list(map(int, sys.stdin.read().split()))
print((A - 1) * (B - 1))
| false | 0 | [
"-import subprocess",
"+import sys",
"-A, B = list(map(int, subprocess.check_output(\"dd\").split()))",
"+A, B = list(map(int, sys.stdin.read().split()))"
] | false | 0.045333 | 0.051501 | 0.880229 | [
"s872172022",
"s264668325"
] |
u257162238 | p03363 | python | s945432742 | s082539541 | 194 | 163 | 41,980 | 54,148 | Accepted | Accepted | 15.98 | import sys
input = sys.stdin.readline
from itertools import accumulate
from collections import Counter
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
S = accumulate(A)
C = Counter(S)
ans = 0
k = 0
for a i... | import sys
input = sys.stdin.readline
from itertools import accumulate
from collections import Counter
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
S = [0] + list(accumulate(A)) + [10**9+1]
C = Counter(S)
ans = 0... | 29 | 27 | 545 | 574 | import sys
input = sys.stdin.readline
from itertools import accumulate
from collections import Counter
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
S = accumulate(A)
C = Counter(S)
ans = 0
k = 0
for a in A:
ans... | import sys
input = sys.stdin.readline
from itertools import accumulate
from collections import Counter
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
S = [0] + list(accumulate(A)) + [10**9 + 1]
C = Counter(S)
ans = 0
for k, ... | false | 6.896552 | [
"- S = accumulate(A)",
"+ S = [0] + list(accumulate(A)) + [10**9 + 1]",
"- k = 0",
"- for a in A:",
"- ans += C[k]",
"- k += a",
"- C[k] -= 1",
"+ for k, v in C.most_common():",
"+ if v >= 2:",
"+ ans += v * (v - 1) // 2"
] | false | 0.114385 | 0.121489 | 0.941528 | [
"s945432742",
"s082539541"
] |
u623814058 | p03341 | python | s600829652 | s785651975 | 150 | 120 | 9,780 | 9,616 | Accepted | Accepted | 20 | N=int(eval(input()))
S=eval(input())
import collections
tw=S.count('W')
te=S.count('E')
ans=float('inf')
cw=[0,0]
ce=[tw,te]
#print(cw,ce)
for i in S:
if i=='W':
ce[0]-=1
ans=min(ans,cw[0]+ce[1])
#print(cw,ce,cw[0]+ce[1])
cw[0]+=1
else:
ce[1]-=1
... | eval(input())
S=eval(input())
ans=float('inf')
cw=0
ce=S.count('E')
for i in S:
if i=='W':
ans=min(ans,cw+ce)
cw+=1
else:
ce-=1
ans=min(ans,cw+ce)
print(ans) | 24 | 15 | 406 | 175 | N = int(eval(input()))
S = eval(input())
import collections
tw = S.count("W")
te = S.count("E")
ans = float("inf")
cw = [0, 0]
ce = [tw, te]
# print(cw,ce)
for i in S:
if i == "W":
ce[0] -= 1
ans = min(ans, cw[0] + ce[1])
# print(cw,ce,cw[0]+ce[1])
cw[0] += 1
else:
ce[1]... | eval(input())
S = eval(input())
ans = float("inf")
cw = 0
ce = S.count("E")
for i in S:
if i == "W":
ans = min(ans, cw + ce)
cw += 1
else:
ce -= 1
ans = min(ans, cw + ce)
print(ans)
| false | 37.5 | [
"-N = int(eval(input()))",
"+eval(input())",
"-import collections",
"-",
"-tw = S.count(\"W\")",
"-te = S.count(\"E\")",
"-cw = [0, 0]",
"-ce = [tw, te]",
"-# print(cw,ce)",
"+cw = 0",
"+ce = S.count(\"E\")",
"- ce[0] -= 1",
"- ans = min(ans, cw[0] + ce[1])",
"- # prin... | false | 0.038281 | 0.063143 | 0.606264 | [
"s600829652",
"s785651975"
] |
u350997995 | p02861 | python | s065414762 | s907934392 | 407 | 314 | 3,064 | 3,316 | Accepted | Accepted | 22.85 | import math
import itertools
N = int(eval(input()))
X = [list(map(int,input().split())) for i in range(N)]
l = [i for i in range(N)]
ans = 0
for v in itertools.permutations(l,N):
for i in range(N):
if i==0:x,y = X[v[i]]
else:
x2,y2 = X[v[i]]
ans+=math.sqrt((x-x2)... | from math import factorial as fac
from math import sqrt
from collections import deque
N = int(eval(input()))
X = []
for i in range(N):
x,y = list(map(int,input().split()))
X.append((x,y))
ans = 0
Q = deque()
for i in range(N):
Q.append((0,[i],X[i][0],X[i][1]))
while Q:
S,L,x,y = Q.pop()
... | 15 | 22 | 383 | 516 | import math
import itertools
N = int(eval(input()))
X = [list(map(int, input().split())) for i in range(N)]
l = [i for i in range(N)]
ans = 0
for v in itertools.permutations(l, N):
for i in range(N):
if i == 0:
x, y = X[v[i]]
else:
x2, y2 = X[v[i]]
ans += math.sq... | from math import factorial as fac
from math import sqrt
from collections import deque
N = int(eval(input()))
X = []
for i in range(N):
x, y = list(map(int, input().split()))
X.append((x, y))
ans = 0
Q = deque()
for i in range(N):
Q.append((0, [i], X[i][0], X[i][1]))
while Q:
S, L, x, y = Q.pop()
if... | false | 31.818182 | [
"-import math",
"-import itertools",
"+from math import factorial as fac",
"+from math import sqrt",
"+from collections import deque",
"-X = [list(map(int, input().split())) for i in range(N)]",
"-l = [i for i in range(N)]",
"+X = []",
"+for i in range(N):",
"+ x, y = list(map(int, input().spli... | false | 0.086175 | 0.089857 | 0.959023 | [
"s065414762",
"s907934392"
] |
u098968285 | p03312 | python | s106633099 | s144173758 | 1,347 | 1,071 | 101,636 | 93,432 | Accepted | Accepted | 20.49 | def makelist(n, m):
return [[0 for _ in range(m)] for _ in range(n)]
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
def check(mid, base): # b is max-value
if mid < base:
l = imos[mid-1]
r = imos[base-1] - imos[mid-1]
return abs(r-l)
else:
l... | def makelist(n, m):
return [[0 for _ in range(m)] for _ in range(n)]
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
def check(mid, base): # b is max-value
if mid < base:
l = imos[mid-1]
r = imos[base-1] - imos[mid-1]
return abs(r-l)
else:
l... | 72 | 55 | 1,727 | 1,294 | def makelist(n, m):
return [[0 for _ in range(m)] for _ in range(n)]
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
def check(mid, base): # b is max-value
if mid < base:
l = imos[mid - 1]
r = imos[base - 1] - imos[mid - 1]
return abs(r - l)
else:
l = im... | def makelist(n, m):
return [[0 for _ in range(m)] for _ in range(n)]
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
def check(mid, base): # b is max-value
if mid < base:
l = imos[mid - 1]
r = imos[base - 1] - imos[mid - 1]
return abs(r - l)
else:
l = im... | false | 23.611111 | [
"- # 初期条件",
"- if small == big:",
"- return small",
"- elif big - small == 1:",
"- if check(small, i) <= check(big, i):",
"- return small",
"+ if big - small <= 2: # 終了条件",
"+ mid = (big + small) // 2",
"+ if check(big, i) <= check(mid, i):",
"+ ... | false | 0.007599 | 0.089462 | 0.084941 | [
"s106633099",
"s144173758"
] |
u027622859 | p03637 | python | s093735708 | s388267103 | 71 | 65 | 15,020 | 15,020 | Accepted | Accepted | 8.45 | N = int(eval(input()))
l = list(map(int, input().split()))
a, b, c = 0, 0, 0
for i in l:
if i % 4 == 0:
c += 1
elif i % 2 == 0:
b += 1
elif not i % 2 == 0:
a += 1
if b >= 1:
if c >= a:
print("Yes")
else:
print("No")
else:
if c+1 >= a:
... | N = int(eval(input()))
l = list(map(int, input().split()))
a, b, c = 0, 0, 0
for i in l:
if i % 4 == 0:
c += 1
elif i % 2 == 0:
b += 1
else:
a += 1
if b >= 1:
if c >= a:
print("Yes")
else:
print("No")
else:
if c+1 >= a:
print("... | 22 | 22 | 366 | 351 | N = int(eval(input()))
l = list(map(int, input().split()))
a, b, c = 0, 0, 0
for i in l:
if i % 4 == 0:
c += 1
elif i % 2 == 0:
b += 1
elif not i % 2 == 0:
a += 1
if b >= 1:
if c >= a:
print("Yes")
else:
print("No")
else:
if c + 1 >= a:
print("Yes"... | N = int(eval(input()))
l = list(map(int, input().split()))
a, b, c = 0, 0, 0
for i in l:
if i % 4 == 0:
c += 1
elif i % 2 == 0:
b += 1
else:
a += 1
if b >= 1:
if c >= a:
print("Yes")
else:
print("No")
else:
if c + 1 >= a:
print("Yes")
else:
... | false | 0 | [
"- elif not i % 2 == 0:",
"+ else:"
] | false | 0.057935 | 0.087157 | 0.664723 | [
"s093735708",
"s388267103"
] |
u226155577 | p03389 | python | s295089624 | s184495842 | 184 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.76 | a, b, c= list(map(int, input().split()))
ans = 0
def calc(a, b):
if a < b:
r = b-a
if r % 2:
return r//2 + 2
return r//2
else:
return a-b
def solve(a, b, c):
return calc(a, c) + calc(b, c)
print((min(solve(a, b, c), solve(b, c, a), solve(c, a, b))))
| a, b, c = sorted(map(int, input().split()))
a = c-a; b = c-b
p = a%2; q = b%2
if p and q:
print((a//2+b//2+1))
elif p or q:
print((a//2+b//2+2))
else:
print((a//2+b//2))
| 13 | 9 | 310 | 184 | a, b, c = list(map(int, input().split()))
ans = 0
def calc(a, b):
if a < b:
r = b - a
if r % 2:
return r // 2 + 2
return r // 2
else:
return a - b
def solve(a, b, c):
return calc(a, c) + calc(b, c)
print((min(solve(a, b, c), solve(b, c, a), solve(c, a, b))))... | a, b, c = sorted(map(int, input().split()))
a = c - a
b = c - b
p = a % 2
q = b % 2
if p and q:
print((a // 2 + b // 2 + 1))
elif p or q:
print((a // 2 + b // 2 + 2))
else:
print((a // 2 + b // 2))
| false | 30.769231 | [
"-a, b, c = list(map(int, input().split()))",
"-ans = 0",
"-",
"-",
"-def calc(a, b):",
"- if a < b:",
"- r = b - a",
"- if r % 2:",
"- return r // 2 + 2",
"- return r // 2",
"- else:",
"- return a - b",
"-",
"-",
"-def solve(a, b, c):",
"- ... | false | 0.080666 | 0.040584 | 1.987647 | [
"s295089624",
"s184495842"
] |
u747602774 | p03162 | python | s223741624 | s223617517 | 504 | 347 | 22,772 | 22,772 | Accepted | Accepted | 31.15 | N = int(eval(input()))
dp = [[0]*3 for i in range(N)]
dp[0] = list(map(int,input().split()))
for i in range(1,N):
a,b,c = list(map(int,input().split()))
dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a
dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b
dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + c
print((max(dp[N-1... | import sys
readline = sys.stdin.readline
N = int(readline())
dp = [[0]*3 for i in range(N)]
dp[0] = list(map(int,readline().split()))
for i in range(1,N):
a,b,c = list(map(int,readline().split()))
dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a
dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b
dp[i][2] = max... | 9 | 11 | 310 | 363 | N = int(eval(input()))
dp = [[0] * 3 for i in range(N)]
dp[0] = list(map(int, input().split()))
for i in range(1, N):
a, b, c = list(map(int, input().split()))
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a
dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b
dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c
pri... | import sys
readline = sys.stdin.readline
N = int(readline())
dp = [[0] * 3 for i in range(N)]
dp[0] = list(map(int, readline().split()))
for i in range(1, N):
a, b, c = list(map(int, readline().split()))
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a
dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b
dp[i]... | false | 18.181818 | [
"-N = int(eval(input()))",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"-dp[0] = list(map(int, input().split()))",
"+dp[0] = list(map(int, readline().split()))",
"- a, b, c = list(map(int, input().split()))",
"+ a, b, c = list(map(int, readline().split()))"
] | false | 0.135628 | 0.041597 | 3.260508 | [
"s223741624",
"s223617517"
] |
u150984829 | p02396 | python | s446910744 | s849976124 | 120 | 50 | 5,580 | 5,680 | Accepted | Accepted | 58.33 | for i,a in enumerate(iter(input,'0'),1):print(f'Case {i}: {a}')
| import sys
for i,a in enumerate(sys.stdin,1):
if a=='0\n':break
print(f'Case {i}: {a}',end='')
| 1 | 4 | 64 | 100 | for i, a in enumerate(iter(input, "0"), 1):
print(f"Case {i}: {a}")
| import sys
for i, a in enumerate(sys.stdin, 1):
if a == "0\n":
break
print(f"Case {i}: {a}", end="")
| false | 75 | [
"-for i, a in enumerate(iter(input, \"0\"), 1):",
"- print(f\"Case {i}: {a}\")",
"+import sys",
"+",
"+for i, a in enumerate(sys.stdin, 1):",
"+ if a == \"0\\n\":",
"+ break",
"+ print(f\"Case {i}: {a}\", end=\"\")"
] | false | 0.006412 | 0.035354 | 0.181354 | [
"s446910744",
"s849976124"
] |
u255673886 | p03997 | python | s714811153 | s021177236 | 188 | 85 | 38,384 | 68,376 | Accepted | Accepted | 54.79 | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,c... | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,c... | 71 | 102 | 1,762 | 2,264 | from collections import deque
from heapq import heapify, heappop, heappush, heappushpop
from copy import copy, deepcopy
from itertools import product, permutations, combinations, combinations_with_replacement
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
# from math import g... | from collections import deque
from heapq import heapify, heappop, heappush, heappushpop
from copy import copy, deepcopy
from itertools import product, permutations, combinations, combinations_with_replacement
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
# from math import g... | false | 30.392157 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-h = int(eval(input()))",
"-ans = (a + b) * h / 2",
"-print((int(ans)))",
"+def I():",
"+ return int(eval(input()))",
"+",
"+",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def RI():",
"+ return list... | false | 0.039948 | 0.04113 | 0.971253 | [
"s714811153",
"s021177236"
] |
u794910686 | p02837 | python | s452925234 | s550772819 | 1,301 | 319 | 3,064 | 3,064 | Accepted | Accepted | 75.48 | def honestcount(i):
return bin(i).count("1")
def is_honest(i,j):
return (i>>j)%2 == 1
N = int(eval(input()))
A = [0] * N
shogens=[]
for i in range(N):
a = int(eval(input()))
shogen=[]
for j in range(a):
x,y = list(map(int, input().split()))
shogen.append((x-1,y))
... | def honestcount(i):
return bin(i).count("1")
def is_honest(i,j):
return (i>>j)%2 == 1
N = int(eval(input()))
A = [0] * N
shogens=[]
for i in range(N):
a = int(eval(input()))
shogen=[]
for j in range(a):
x,y = list(map(int, input().split()))
shogen.append((x-1,y))
... | 31 | 33 | 626 | 666 | def honestcount(i):
return bin(i).count("1")
def is_honest(i, j):
return (i >> j) % 2 == 1
N = int(eval(input()))
A = [0] * N
shogens = []
for i in range(N):
a = int(eval(input()))
shogen = []
for j in range(a):
x, y = list(map(int, input().split()))
shogen.append((x - 1, y))
... | def honestcount(i):
return bin(i).count("1")
def is_honest(i, j):
return (i >> j) % 2 == 1
N = int(eval(input()))
A = [0] * N
shogens = []
for i in range(N):
a = int(eval(input()))
shogen = []
for j in range(a):
x, y = list(map(int, input().split()))
shogen.append((x - 1, y))
... | false | 6.060606 | [
"+ break"
] | false | 0.04215 | 0.036669 | 1.14948 | [
"s452925234",
"s550772819"
] |
u514687406 | p03834 | python | s476648204 | s342834700 | 26 | 22 | 9,080 | 8,928 | Accepted | Accepted | 15.38 | # import sys; input = lambda: sys.stdin.readline()
s = eval(input())
s = s.replace(",", " ")
print(s) | print((" ".join(map(str, input().split(","))))) | 4 | 1 | 98 | 45 | # import sys; input = lambda: sys.stdin.readline()
s = eval(input())
s = s.replace(",", " ")
print(s)
| print((" ".join(map(str, input().split(",")))))
| false | 75 | [
"-# import sys; input = lambda: sys.stdin.readline()",
"-s = eval(input())",
"-s = s.replace(\",\", \" \")",
"-print(s)",
"+print((\" \".join(map(str, input().split(\",\")))))"
] | false | 0.043256 | 0.04721 | 0.916258 | [
"s476648204",
"s342834700"
] |
u774539708 | p02793 | python | s015237563 | s946772161 | 1,254 | 690 | 5,612 | 14,476 | Accepted | Accepted | 44.98 | n=int(eval(input()))
A=list(map(int,input().split()))
mod=10**9+7
import fractions
def lcm(a,b):
return a*b//fractions.gcd(a,b)
def power(a):
T=[a]
while 2**(len(T))<mod:
T.append(T[-1]**2%mod)
b=bin(mod-2)
ans=1
for i in range(len(b)-2):
if int(b[-i-1])==1:
... | n=int(eval(input()))
A=list(map(int,input().split()))
mod=10**9+7
def inverse(a): #aに対し、a**(mod-2)、つまり逆元を返す
T=[a]
while 2**(len(T))<mod: #a**1,a**2.a**4,a**8,...を計算しておく
T.append(T[-1]**2%mod)
b=bin(mod-2) #mod-2を2進数表記にする
ans=1
for i in range(len(b)-2):
if int(b[-i-1])==1:... | 28 | 54 | 492 | 1,143 | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
import fractions
def lcm(a, b):
return a * b // fractions.gcd(a, b)
def power(a):
T = [a]
while 2 ** (len(T)) < mod:
T.append(T[-1] ** 2 % mod)
b = bin(mod - 2)
ans = 1
for i in range(len(b) - 2):
if i... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
def inverse(a): # aに対し、a**(mod-2)、つまり逆元を返す
T = [a]
while 2 ** (len(T)) < mod: # a**1,a**2.a**4,a**8,...を計算しておく
T.append(T[-1] ** 2 % mod)
b = bin(mod - 2) # mod-2を2進数表記にする
ans = 1
for i in range(len(b) - 2):
... | false | 48.148148 | [
"-import fractions",
"-def lcm(a, b):",
"- return a * b // fractions.gcd(a, b)",
"-",
"-",
"-def power(a):",
"+def inverse(a): # aに対し、a**(mod-2)、つまり逆元を返す",
"- while 2 ** (len(T)) < mod:",
"+ while 2 ** (len(T)) < mod: # a**1,a**2.a**4,a**8,...を計算しておく",
"- b = bin(mod - 2)",
"+ b... | false | 0.055521 | 0.757082 | 0.073335 | [
"s015237563",
"s946772161"
] |
u654470292 | p03488 | python | s885039777 | s073082033 | 556 | 490 | 175,960 | 167,260 | Accepted | Accepted | 11.87 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
mod=pow(10,9)+7
s=eval(input())
x,y=list(map(int,input().split()))
lst=[[],[]]
cnt=0
... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[c... | 64 | 86 | 1,362 | 1,833 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations, accumulate, combinations, product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
mod = pow(10, 9) + 7
s = eval(input())
x, y = list(map(int, input().split()))
lst = [[], []]
c... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
mod = pow(10, 9) + 7
al = [... | false | 25.581395 | [
"+import bisect",
"+import copy",
"+import heapq",
"+import math",
"-import heapq",
"-import math",
"-import bisect",
"-from itertools import permutations, accumulate, combinations, product",
"-from fractions import gcd",
"+from itertools import accumulate, combinations, permutations, product",
... | false | 0.049974 | 0.048566 | 1.028991 | [
"s885039777",
"s073082033"
] |
u558867581 | p02701 | python | s606007217 | s330111768 | 269 | 71 | 35,704 | 38,828 | Accepted | Accepted | 73.61 | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
S_uniqu = list(set(S))
print((len(S_uniqu))) | n, *s = open(0).read().split()
print((len(set(s)))) | 5 | 2 | 97 | 50 | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
S_uniqu = list(set(S))
print((len(S_uniqu)))
| n, *s = open(0).read().split()
print((len(set(s))))
| false | 60 | [
"-N = int(eval(input()))",
"-S = [eval(input()) for i in range(N)]",
"-S_uniqu = list(set(S))",
"-print((len(S_uniqu)))",
"+n, *s = open(0).read().split()",
"+print((len(set(s))))"
] | false | 0.037069 | 0.035573 | 1.042053 | [
"s606007217",
"s330111768"
] |
u519939795 | p02783 | python | s284115711 | s623128987 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | h,a=list(map(int,input().split()))
l=0
while h>0:
h = h-a
l += 1
print(l) | H, A = list(map(int, input().split()))
print((H//A if H % A == 0 else H//A+1)) | 6 | 2 | 80 | 71 | h, a = list(map(int, input().split()))
l = 0
while h > 0:
h = h - a
l += 1
print(l)
| H, A = list(map(int, input().split()))
print((H // A if H % A == 0 else H // A + 1))
| false | 66.666667 | [
"-h, a = list(map(int, input().split()))",
"-l = 0",
"-while h > 0:",
"- h = h - a",
"- l += 1",
"-print(l)",
"+H, A = list(map(int, input().split()))",
"+print((H // A if H % A == 0 else H // A + 1))"
] | false | 0.040587 | 0.039403 | 1.030053 | [
"s284115711",
"s623128987"
] |
u926678805 | p03108 | python | s799305764 | s389293756 | 769 | 654 | 26,260 | 25,932 | Accepted | Accepted | 14.95 | class UnionFind:
def __init__(self, n):
self.data=[-1 for i in range(n)]
def root(self,x):
if self.data[x]<0:
return x
else:
self.data[x]=self.root(self.data[x])
return self.data[x]
def uni(self,x,y):
x=self.root(x)
y=s... | import sys
sys.setrecursionlimit(100000)
input=lambda : sys.stdin.readline().rstrip('\n')
class UnionFind:
def __init__(self, n):
self.data=[-1 for i in range(n)]
def root(self,x):
if self.data[x]<0:
return x
else:
self.data[x]=self.root(self.data[x... | 47 | 51 | 1,072 | 1,171 | class UnionFind:
def __init__(self, n):
self.data = [-1 for i in range(n)]
def root(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.root(self.data[x])
return self.data[x]
def uni(self, x, y):
x = self.root(x)
y =... | import sys
sys.setrecursionlimit(100000)
input = lambda: sys.stdin.readline().rstrip("\n")
class UnionFind:
def __init__(self, n):
self.data = [-1 for i in range(n)]
def root(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.root(self.data[x])
... | false | 7.843137 | [
"+import sys",
"+",
"+sys.setrecursionlimit(100000)",
"+input = lambda: sys.stdin.readline().rstrip(\"\\n\")",
"+",
"+"
] | false | 0.060421 | 0.071765 | 0.841923 | [
"s799305764",
"s389293756"
] |
u347640436 | p02793 | python | s255645944 | s523250169 | 316 | 287 | 49,856 | 49,688 | Accepted | Accepted | 9.18 | # エラトステネスの篩, フェルマーの小定理
def make_prime_table(N):
sieve = list(range(N + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(2, int(N ** 0.5) + 1):
if sieve[i] != i:
continue
for j in range(i * i, N + 1, i):
if sieve[j] == j:
sieve[j] = i
r... | # エラトステネスの篩, フェルマーの小定理
def make_prime_table(n):
sieve = list(range(n + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(2, int(n ** 0.5) + 1):
if sieve[i] != i:
continue
for j in range(i * i, n + 1, i):
if sieve[j] == j:
sieve[j] = i
r... | 46 | 49 | 1,030 | 1,029 | # エラトステネスの篩, フェルマーの小定理
def make_prime_table(N):
sieve = list(range(N + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(2, int(N**0.5) + 1):
if sieve[i] != i:
continue
for j in range(i * i, N + 1, i):
if sieve[j] == j:
sieve[j] = i
return sieve
... | # エラトステネスの篩, フェルマーの小定理
def make_prime_table(n):
sieve = list(range(n + 1))
sieve[0] = -1
sieve[1] = -1
for i in range(2, int(n**0.5) + 1):
if sieve[i] != i:
continue
for j in range(i * i, n + 1, i):
if sieve[j] == j:
sieve[j] = i
return sieve
... | false | 6.122449 | [
"-def make_prime_table(N):",
"- sieve = list(range(N + 1))",
"+def make_prime_table(n):",
"+ sieve = list(range(n + 1))",
"- for i in range(2, int(N**0.5) + 1):",
"+ for i in range(2, int(n**0.5) + 1):",
"- for j in range(i * i, N + 1, i):",
"+ for j in range(i * i, n + 1, i)... | false | 0.694248 | 0.650227 | 1.067702 | [
"s255645944",
"s523250169"
] |
u852517668 | p03436 | python | s895802565 | s012859514 | 50 | 29 | 3,952 | 3,436 | Accepted | Accepted | 42 | import queue
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = list(map(int, input().split()))
field = [eval(input()) for _ in range(H)]
dist = [[-1] * W for _ in range(H)]
que = queue.Queue()
que.put((0, 0))
dist[0][0] = 0
while not que.empty():
y, x = que.get()
for i in range(4):
ny, nx = y + dy[... | from collections import deque
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = list(map(int, input().split()))
field = [eval(input()) for _ in range(H)]
dist = [[-1] * W for _ in range(H)]
que = deque()
que.append((0, 0))
dist[0][0] = 0
while len(que) > 0:
y, x = que.popleft()
for i in range(4):
n... | 31 | 31 | 691 | 708 | import queue
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = list(map(int, input().split()))
field = [eval(input()) for _ in range(H)]
dist = [[-1] * W for _ in range(H)]
que = queue.Queue()
que.put((0, 0))
dist[0][0] = 0
while not que.empty():
y, x = que.get()
for i in range(4):
ny, nx = y + dy[i], x + d... | from collections import deque
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = list(map(int, input().split()))
field = [eval(input()) for _ in range(H)]
dist = [[-1] * W for _ in range(H)]
que = deque()
que.append((0, 0))
dist[0][0] = 0
while len(que) > 0:
y, x = que.popleft()
for i in range(4):
ny, nx = y... | false | 0 | [
"-import queue",
"+from collections import deque",
"-que = queue.Queue()",
"-que.put((0, 0))",
"+que = deque()",
"+que.append((0, 0))",
"-while not que.empty():",
"- y, x = que.get()",
"+while len(que) > 0:",
"+ y, x = que.popleft()",
"- que.put((ny, nx))",
"+ que.append((n... | false | 0.083485 | 0.060299 | 1.384512 | [
"s895802565",
"s012859514"
] |
u790710233 | p02582 | python | s626312904 | s671688220 | 31 | 25 | 8,952 | 9,016 | Accepted | Accepted | 19.35 | s = input().split('S')
print((max(list(map(len, s)))))
| print((max(list(map(len, input().split('S'))))))
| 2 | 1 | 48 | 41 | s = input().split("S")
print((max(list(map(len, s)))))
| print((max(list(map(len, input().split("S"))))))
| false | 50 | [
"-s = input().split(\"S\")",
"-print((max(list(map(len, s)))))",
"+print((max(list(map(len, input().split(\"S\"))))))"
] | false | 0.038288 | 0.037229 | 1.028437 | [
"s626312904",
"s671688220"
] |
u073852194 | p03806 | python | s950521916 | s661925484 | 865 | 539 | 159,388 | 99,292 | Accepted | Accepted | 37.69 | INF = 10**18
def solve(N, Ma, Mb, sol):
if N % 2 == 1:
sol.append((0, 0, 0))
N += 1
M = N // 2
sol1 = sol[:M]
sol2 = sol[M:]
S1 = []
D = dict()
res = INF
for i in range(2**M):
A1, B1, C1 = 0, 0, 0
A2, B2, C2 = 0, 0, 0
for j ... | INF = 10**18
N, Ma, Mb = list(map(int, input().split()))
dp = [[[INF for k in range(401)] for j in range(401)] for i in range(N + 1)]
dp[0][0][0] = 0
for i in range(N):
a, b, c = list(map(int, input().split()))
for j in range(400):
for k in range(400):
dp[i + 1][j][k] = min(dp[... | 52 | 23 | 1,190 | 646 | INF = 10**18
def solve(N, Ma, Mb, sol):
if N % 2 == 1:
sol.append((0, 0, 0))
N += 1
M = N // 2
sol1 = sol[:M]
sol2 = sol[M:]
S1 = []
D = dict()
res = INF
for i in range(2**M):
A1, B1, C1 = 0, 0, 0
A2, B2, C2 = 0, 0, 0
for j in range(M):
... | INF = 10**18
N, Ma, Mb = list(map(int, input().split()))
dp = [[[INF for k in range(401)] for j in range(401)] for i in range(N + 1)]
dp[0][0][0] = 0
for i in range(N):
a, b, c = list(map(int, input().split()))
for j in range(400):
for k in range(400):
dp[i + 1][j][k] = min(dp[i + 1][j][k], ... | false | 55.769231 | [
"-",
"-",
"-def solve(N, Ma, Mb, sol):",
"- if N % 2 == 1:",
"- sol.append((0, 0, 0))",
"- N += 1",
"- M = N // 2",
"- sol1 = sol[:M]",
"- sol2 = sol[M:]",
"- S1 = []",
"- D = dict()",
"- res = INF",
"- for i in range(2**M):",
"- A1, B1, C1 = 0,... | false | 0.042788 | 0.689203 | 0.062083 | [
"s950521916",
"s661925484"
] |
u808569469 | p03610 | python | s214710436 | s532647090 | 45 | 28 | 9,380 | 9,016 | Accepted | Accepted | 37.78 | s = eval(input())
s_odd = []
for i in range(0, len(s)):
if i % 2 == 0:
s_odd.append(s[i])
print(("".join(s_odd)))
| S = str(eval(input()))
print((S[::2])) | 8 | 2 | 127 | 31 | s = eval(input())
s_odd = []
for i in range(0, len(s)):
if i % 2 == 0:
s_odd.append(s[i])
print(("".join(s_odd)))
| S = str(eval(input()))
print((S[::2]))
| false | 75 | [
"-s = eval(input())",
"-s_odd = []",
"-for i in range(0, len(s)):",
"- if i % 2 == 0:",
"- s_odd.append(s[i])",
"-print((\"\".join(s_odd)))",
"+S = str(eval(input()))",
"+print((S[::2]))"
] | false | 0.045777 | 0.04008 | 1.142136 | [
"s214710436",
"s532647090"
] |
u244742296 | p02386 | python | s469081526 | s189736107 | 260 | 190 | 6,824 | 6,812 | Accepted | Accepted | 26.92 | class Dice(object):
def __init__(self, s1, s2, s3, s4, s5, s6):
self.s1 = s1
self.s2 = s2
self.s3 = s3
self.s4 = s4
self.s5 = s5
self.s6 = s6
def east(self):
prev_s6 = self.s6
self.s6 = self.s3
self.s3 = self.s1
self.s1 ... | class Dice(object):
def __init__(self, s1, s2, s3, s4, s5, s6):
self.s1 = s1
self.s2 = s2
self.s3 = s3
self.s4 = s4
self.s5 = s5
self.s6 = s6
def east(self):
prev_s6 = self.s6
self.s6 = self.s3
self.s3 = self.s1
self.s1 ... | 89 | 82 | 2,196 | 2,103 | class Dice(object):
def __init__(self, s1, s2, s3, s4, s5, s6):
self.s1 = s1
self.s2 = s2
self.s3 = s3
self.s4 = s4
self.s5 = s5
self.s6 = s6
def east(self):
prev_s6 = self.s6
self.s6 = self.s3
self.s3 = self.s1
self.s1 = self.s4
... | class Dice(object):
def __init__(self, s1, s2, s3, s4, s5, s6):
self.s1 = s1
self.s2 = s2
self.s3 = s3
self.s4 = s4
self.s5 = s5
self.s6 = s6
def east(self):
prev_s6 = self.s6
self.s6 = self.s3
self.s3 = self.s1
self.s1 = self.s4
... | false | 7.865169 | [
"- if (",
"- self.s1 == anotherDice.s1",
"- and self.s2 == anotherDice.s2",
"- and self.s3 == anotherDice.s3",
"- and self.s4 == anotherDice.s4",
"- and self.s5 == anotherDice.s5",
"- and self.s6 == anotherDice.s6",
"- ):"... | false | 0.042091 | 0.074448 | 0.565382 | [
"s469081526",
"s189736107"
] |
u353895424 | p02939 | python | s050641475 | s479023710 | 103 | 88 | 9,636 | 9,404 | Accepted | Accepted | 14.56 | """
aabbaa
aa b ba a
a ab b aa
"""
s = list(eval(input()))
n = len(s)
hst = []
sk = ""
for i in range(n):
sk += s[i]
if i == 0:
hst.append(sk)
sk = ""
elif hst[-1] != sk:
hst.append(sk)
sk = ""
print((len(hst))) | s = list(eval(input()))
n = len(s)
hst = ["#"]
sk = ""
for i in range(n):
sk += s[i]
if hst[-1] != sk:
hst.append(sk)
sk = ""
print((len(hst)-1)) | 22 | 13 | 272 | 176 | """
aabbaa
aa b ba a
a ab b aa
"""
s = list(eval(input()))
n = len(s)
hst = []
sk = ""
for i in range(n):
sk += s[i]
if i == 0:
hst.append(sk)
sk = ""
elif hst[-1] != sk:
hst.append(sk)
sk = ""
print((len(hst)))
| s = list(eval(input()))
n = len(s)
hst = ["#"]
sk = ""
for i in range(n):
sk += s[i]
if hst[-1] != sk:
hst.append(sk)
sk = ""
print((len(hst) - 1))
| false | 40.909091 | [
"-\"\"\"",
"-aabbaa",
"-aa b ba a",
"-a ab b aa",
"-\"\"\"",
"-hst = []",
"+hst = [\"#\"]",
"- if i == 0:",
"+ if hst[-1] != sk:",
"- elif hst[-1] != sk:",
"- hst.append(sk)",
"- sk = \"\"",
"-print((len(hst)))",
"+print((len(hst) - 1))"
] | false | 0.048502 | 0.10963 | 0.442417 | [
"s050641475",
"s479023710"
] |
u010090035 | p02831 | python | s221915486 | s023411233 | 35 | 17 | 5,048 | 3,064 | Accepted | Accepted | 51.43 | from fractions import gcd
a,b=list(map(int,input().split()))
print((a*b//gcd(a,b))) | a,b=list(map(int,input().split()))
#a,bの最大公約数
def gcd(a,b):
if(b==0):
return a
else:
return gcd(b, a%b)
#a,bの最小公倍数
def lcm(a,b):
return a*b//gcd(a,b)
print((lcm(a,b))) | 3 | 14 | 77 | 203 | from fractions import gcd
a, b = list(map(int, input().split()))
print((a * b // gcd(a, b)))
| a, b = list(map(int, input().split()))
# a,bの最大公約数
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
# a,bの最小公倍数
def lcm(a, b):
return a * b // gcd(a, b)
print((lcm(a, b)))
| false | 78.571429 | [
"-from fractions import gcd",
"+a, b = list(map(int, input().split()))",
"+# a,bの最大公約数",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ else:",
"+ return gcd(b, a % b)",
"-a, b = list(map(int, input().split()))",
"-print((a * b // gcd(a, b)))",
"+",
"+# a,bの最小公倍数",
"... | false | 0.046542 | 0.076896 | 0.605257 | [
"s221915486",
"s023411233"
] |
u968404618 | p03624 | python | s997792366 | s880051142 | 20 | 17 | 3,316 | 3,188 | Accepted | Accepted | 15 | S = eval(input())
X= ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
ans = ''
for x in X:
if x not in S:
ans = x
break
if ans == '':
ans = 'None'
print(ans) | S = eval(input())
X = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
ans = ''
for x in X:
if x not in S:
ans = x
break
if ans:
print((ans[0]))
else:
print('None') | 15 | 15 | 282 | 292 | S = eval(input())
X = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
ans = ""
for x in X:
if x not in S:
ans = x
... | S = eval(input())
X = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
ans = ""
for x in X:
if x not in S:
ans = x
... | false | 0 | [
"-if ans == \"\":",
"- ans = \"None\"",
"-print(ans)",
"+if ans:",
"+ print((ans[0]))",
"+else:",
"+ print(\"None\")"
] | false | 0.043826 | 0.065305 | 0.6711 | [
"s997792366",
"s880051142"
] |
u223133214 | p02923 | python | s329843958 | s111525517 | 224 | 128 | 63,856 | 85,124 | Accepted | Accepted | 42.86 | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(0, N-1):
if H[i] >= H[i + 1]:
cnt += 1
ans = max(cnt, ans)
else:
cnt = 0
print(ans)
| n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
H_r = H[::-1]
cnt = 0
for i in range(n - 1):
now = H_r[i]
nex = H_r[i + 1]
if now <= nex:
cnt += 1
ans = max(ans, cnt)
else:
cnt = 0
nex = now
print(ans)
| 12 | 17 | 212 | 277 | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(0, N - 1):
if H[i] >= H[i + 1]:
cnt += 1
ans = max(cnt, ans)
else:
cnt = 0
print(ans)
| n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
H_r = H[::-1]
cnt = 0
for i in range(n - 1):
now = H_r[i]
nex = H_r[i + 1]
if now <= nex:
cnt += 1
ans = max(ans, cnt)
else:
cnt = 0
nex = now
print(ans)
| false | 29.411765 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"+H_r = H[::-1]",
"-for i in range(0, N - 1):",
"- if H[i] >= H[i + 1]:",
"+for i in range(n - 1):",
"+ now = H_r[i]",
"+ nex = H_r[i + 1]",
"+ if now <= nex:",
"- ans = max(cnt, ans)",
"+ ans = max(ans, cnt)",
"+ ... | false | 0.042483 | 0.084798 | 0.500991 | [
"s329843958",
"s111525517"
] |
u086503932 | p02681 | python | s453659687 | s920366460 | 23 | 21 | 9,084 | 8,980 | Accepted | Accepted | 8.7 | #!/usr/bin/env python3
def main():
S = eval(input())
T = eval(input())
if S == T[:len(S)]:
print('Yes')
else:
print('No')
main()
| #!/usr/bin/env python3
def main():
S = eval(input())
T = eval(input())
if S == T[:len(S)]:
print('Yes')
else:
print('No')
if __name__ == "__main__":
main()
| 12 | 13 | 163 | 195 | #!/usr/bin/env python3
def main():
S = eval(input())
T = eval(input())
if S == T[: len(S)]:
print("Yes")
else:
print("No")
main()
| #!/usr/bin/env python3
def main():
S = eval(input())
T = eval(input())
if S == T[: len(S)]:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 7.692308 | [
"-main()",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.037581 | 0.073324 | 0.512532 | [
"s453659687",
"s920366460"
] |
u764600134 | p03108 | python | s700760308 | s736216805 | 778 | 705 | 27,172 | 27,188 | Accepted | Accepted | 9.38 | # -*- coding: utf-8 -*-
"""
D - Decayed Bridges
https://atcoder.jp/contests/abc120/tasks/abc120_d#
"""
import sys
class DisjointSet(object):
def __init__(self, n):
self.rank = []
self.p = []
self.size = []
for i in range(n+1):
self.makeSet(i)
def ma... | # -*- coding: utf-8 -*-
"""
D - Decayed Bridges
https://atcoder.jp/contests/abc120/tasks/abc120_d#
AC
"""
import sys
class DisjointSet(object):
def __init__(self, n):
self.rank = [0] * n
self.p = list(range(n))
self.size = [1] * n
def same(self, x, y):
return sel... | 71 | 64 | 1,746 | 1,591 | # -*- coding: utf-8 -*-
"""
D - Decayed Bridges
https://atcoder.jp/contests/abc120/tasks/abc120_d#
"""
import sys
class DisjointSet(object):
def __init__(self, n):
self.rank = []
self.p = []
self.size = []
for i in range(n + 1):
self.makeSet(i)
def makeSet(self, x)... | # -*- coding: utf-8 -*-
"""
D - Decayed Bridges
https://atcoder.jp/contests/abc120/tasks/abc120_d#
AC
"""
import sys
class DisjointSet(object):
def __init__(self, n):
self.rank = [0] * n
self.p = list(range(n))
self.size = [1] * n
def same(self, x, y):
return self.findSet(x) =... | false | 9.859155 | [
"+AC",
"- self.rank = []",
"- self.p = []",
"- self.size = []",
"- for i in range(n + 1):",
"- self.makeSet(i)",
"-",
"- def makeSet(self, x):",
"- self.p.insert(x, x)",
"- self.rank.insert(x, 0)",
"- self.size.insert(x, 1)",
"+ ... | false | 0.083414 | 0.111205 | 0.750091 | [
"s700760308",
"s736216805"
] |
u865741247 | p03478 | python | s725954863 | s354171412 | 42 | 35 | 3,060 | 3,188 | Accepted | Accepted | 16.67 | def ketanowa(p):
ans=0
p=str(p)
for i in p:
ans+=int(i)
return ans
def main():
temp=input().split(" ")
n=int(temp[0])
a=int(temp[1])
b=int(temp[2])
su=0
for i in range(n+1):
if a<=ketanowa(i) and ketanowa(i)<=b:
su+=i
print (s... | a,b,c=input().split(" ")
nums=[]
ans=0
b=int(b)
c=int(c)
a=int(a)
for i in range(a+1):
nums.append(sum(list(map(int,str(i)))))
for j,n in enumerate(nums):
if b<=n and n<=c:
ans+=j
print(ans) | 22 | 12 | 365 | 209 | def ketanowa(p):
ans = 0
p = str(p)
for i in p:
ans += int(i)
return ans
def main():
temp = input().split(" ")
n = int(temp[0])
a = int(temp[1])
b = int(temp[2])
su = 0
for i in range(n + 1):
if a <= ketanowa(i) and ketanowa(i) <= b:
su += i
prin... | a, b, c = input().split(" ")
nums = []
ans = 0
b = int(b)
c = int(c)
a = int(a)
for i in range(a + 1):
nums.append(sum(list(map(int, str(i)))))
for j, n in enumerate(nums):
if b <= n and n <= c:
ans += j
print(ans)
| false | 45.454545 | [
"-def ketanowa(p):",
"- ans = 0",
"- p = str(p)",
"- for i in p:",
"- ans += int(i)",
"- return ans",
"-",
"-",
"-def main():",
"- temp = input().split(\" \")",
"- n = int(temp[0])",
"- a = int(temp[1])",
"- b = int(temp[2])",
"- su = 0",
"- for i in ... | false | 0.043144 | 0.185459 | 0.232635 | [
"s725954863",
"s354171412"
] |
u677523557 | p03734 | python | s352956042 | s509317406 | 293 | 36 | 3,064 | 3,064 | Accepted | Accepted | 87.71 | N, W = list(map(int, input().split()))
V = [[] for _ in range(4)]
for i in range(N):
w, v = list(map(int, input().split()))
if i == 0:
w0 = w
V[0].append(v)
else:
V[w-w0].append(v)
J = []
for i in range(4):
F = sorted(V[i], reverse=True)
G = [0]
for f in F:... | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split()))
A = [[] for _ in range(4)]
for i in range(N):
w, v = list(map(int, input().split()))
if i == 0: w0 = w
A[w-w0].append(v)
B = [[0] for _ in range(4)]
for i in range(4):
A[i].sort(reverse=True)
b = 0
for a... | 27 | 27 | 681 | 661 | N, W = list(map(int, input().split()))
V = [[] for _ in range(4)]
for i in range(N):
w, v = list(map(int, input().split()))
if i == 0:
w0 = w
V[0].append(v)
else:
V[w - w0].append(v)
J = []
for i in range(4):
F = sorted(V[i], reverse=True)
G = [0]
for f in F:
G.ap... | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split()))
A = [[] for _ in range(4)]
for i in range(N):
w, v = list(map(int, input().split()))
if i == 0:
w0 = w
A[w - w0].append(v)
B = [[0] for _ in range(4)]
for i in range(4):
A[i].sort(reverse=True)
b = 0
for a in A... | false | 0 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-V = [[] for _ in range(4)]",
"+A = [[] for _ in range(4)]",
"- V[0].append(v)",
"- else:",
"- V[w - w0].append(v)",
"-J = []",
"+ A[w - w0].append(v)",
"+B = [[0] for _ in range(4)]",
"- F = sorted(V[i], reverse=True)"... | false | 0.036972 | 0.036418 | 1.015212 | [
"s352956042",
"s509317406"
] |
u803617136 | p02755 | python | s493863139 | s201900883 | 176 | 18 | 38,384 | 3,060 | Accepted | Accepted | 89.77 | A, B = list(map(int, input().split()))
for n in range(1, 1001):
a = int(n * 0.08)
b = int(n * 0.1)
if A == a and B == b:
print(n)
exit()
print((-1)) | a, b = list(map(int, input().split()))
ans = -1
for x in range(13, 1250):
if int(x * 0.08) == a and int(x * 0.1) == b:
ans = x
break
print(ans) | 8 | 7 | 175 | 163 | A, B = list(map(int, input().split()))
for n in range(1, 1001):
a = int(n * 0.08)
b = int(n * 0.1)
if A == a and B == b:
print(n)
exit()
print((-1))
| a, b = list(map(int, input().split()))
ans = -1
for x in range(13, 1250):
if int(x * 0.08) == a and int(x * 0.1) == b:
ans = x
break
print(ans)
| false | 12.5 | [
"-A, B = list(map(int, input().split()))",
"-for n in range(1, 1001):",
"- a = int(n * 0.08)",
"- b = int(n * 0.1)",
"- if A == a and B == b:",
"- print(n)",
"- exit()",
"-print((-1))",
"+a, b = list(map(int, input().split()))",
"+ans = -1",
"+for x in range(13, 1250):",
... | false | 0.041197 | 0.039303 | 1.048186 | [
"s493863139",
"s201900883"
] |
u131411061 | p02689 | python | s366535686 | s035298615 | 427 | 369 | 47,920 | 38,024 | Accepted | Accepted | 13.58 | N,M = list(map(int,input().split()))
H = list(map(int,input().split()))
d = []
for i in range(M):
A,B = list(map(int,input().split()))
d.append((A-1,B-1))
cnt = 0
res = {}
for i in range(N):
res[i] = False
flag = {}
for i in range(N):
flag[i] = True
for i in d:
A = i[0]
B = ... | N,M = list(map(int,input().split()))
H = list(map(int,input().split()))
d = []
for i in range(M):
A,B = list(map(int,input().split()))
d.append((A-1,B-1))
cnt = 0
flag = {}
for i in range(N):
flag[i] = True
for i in d:
A = i[0]
B = i[1]
if not(H[A] > H[B] and flag[A] == True):... | 32 | 21 | 674 | 444 | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
d = []
for i in range(M):
A, B = list(map(int, input().split()))
d.append((A - 1, B - 1))
cnt = 0
res = {}
for i in range(N):
res[i] = False
flag = {}
for i in range(N):
flag[i] = True
for i in d:
A = i[0]
B = i[1]
# ... | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
d = []
for i in range(M):
A, B = list(map(int, input().split()))
d.append((A - 1, B - 1))
cnt = 0
flag = {}
for i in range(N):
flag[i] = True
for i in d:
A = i[0]
B = i[1]
if not (H[A] > H[B] and flag[A] == True):
... | false | 34.375 | [
"-res = {}",
"-for i in range(N):",
"- res[i] = False",
"- # print(\"H[A] > H[B]\",H[A],H[B])",
"- if H[A] > H[B] and flag[A] == True:",
"- res[A] = True",
"- else:",
"+ if not (H[A] > H[B] and flag[A] == True):",
"- res[A] = False",
"- # print(\"H[A] < H[B]\",H[A],... | false | 0.036628 | 0.038321 | 0.955832 | [
"s366535686",
"s035298615"
] |
u780342333 | p02393 | python | s716156924 | s319333671 | 30 | 20 | 7,676 | 5,572 | Accepted | Accepted | 33.33 | nums = [int(x) for x in input().split(" ")]
nums.sort()
res = " ".join([str(n) for n in nums])
print(res) | l = list(map(int, input().split()))
l.sort()
print((*l))
| 4 | 3 | 108 | 57 | nums = [int(x) for x in input().split(" ")]
nums.sort()
res = " ".join([str(n) for n in nums])
print(res)
| l = list(map(int, input().split()))
l.sort()
print((*l))
| false | 25 | [
"-nums = [int(x) for x in input().split(\" \")]",
"-nums.sort()",
"-res = \" \".join([str(n) for n in nums])",
"-print(res)",
"+l = list(map(int, input().split()))",
"+l.sort()",
"+print((*l))"
] | false | 0.040274 | 0.041054 | 0.980986 | [
"s716156924",
"s319333671"
] |
u634046173 | p02767 | python | s437841363 | s677533490 | 30 | 25 | 9,112 | 9,168 | Accepted | Accepted | 16.67 | import math
N = int(eval(input()))
X = list(map(int,input().split()))
medf = math.floor(sum(X)/N)
medc = math.ceil(sum(X)/N)
cf = 0
cc = 0
for i in range(N):
cf += (X[i] - medf)**2
cc += (X[i] - medc)**2
print((min(cf,cc))) | import math
N = int(eval(input()))
X = list(map(int,input().split()))
med = int(sum(X)/N + 0.5)
c = 0
for i in range(N):
c += (X[i] - med)**2
print(c)
| 11 | 8 | 229 | 154 | import math
N = int(eval(input()))
X = list(map(int, input().split()))
medf = math.floor(sum(X) / N)
medc = math.ceil(sum(X) / N)
cf = 0
cc = 0
for i in range(N):
cf += (X[i] - medf) ** 2
cc += (X[i] - medc) ** 2
print((min(cf, cc)))
| import math
N = int(eval(input()))
X = list(map(int, input().split()))
med = int(sum(X) / N + 0.5)
c = 0
for i in range(N):
c += (X[i] - med) ** 2
print(c)
| false | 27.272727 | [
"-medf = math.floor(sum(X) / N)",
"-medc = math.ceil(sum(X) / N)",
"-cf = 0",
"-cc = 0",
"+med = int(sum(X) / N + 0.5)",
"+c = 0",
"- cf += (X[i] - medf) ** 2",
"- cc += (X[i] - medc) ** 2",
"-print((min(cf, cc)))",
"+ c += (X[i] - med) ** 2",
"+print(c)"
] | false | 0.097965 | 0.041716 | 2.348375 | [
"s437841363",
"s677533490"
] |
u803848678 | p03695 | python | s215345876 | s369712862 | 21 | 18 | 3,316 | 3,060 | Accepted | Accepted | 14.29 | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
over = 0
for i in a:
lv = i//400
if lv < 3200//400 and not d[lv]:
d[lv] = True
if lv >= 3200//400:
over += 1
syurui = sum(d.values())
print((max(1, syurui), syuru... | n = int(eval(input()))
a = list(map(int, input().split()))
d = [0]*8
over = 0
for i in a:
lv = i//400
if lv < 8:
d[lv] = 1
else:
over += 1
print((max(sum(d), 1), sum(d)+over)) | 14 | 12 | 320 | 207 | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
over = 0
for i in a:
lv = i // 400
if lv < 3200 // 400 and not d[lv]:
d[lv] = True
if lv >= 3200 // 400:
over += 1
syurui = sum(d.values())
print((max(1, syurui), syurui + ove... | n = int(eval(input()))
a = list(map(int, input().split()))
d = [0] * 8
over = 0
for i in a:
lv = i // 400
if lv < 8:
d[lv] = 1
else:
over += 1
print((max(sum(d), 1), sum(d) + over))
| false | 14.285714 | [
"-from collections import defaultdict",
"-",
"-d = defaultdict(int)",
"+d = [0] * 8",
"- if lv < 3200 // 400 and not d[lv]:",
"- d[lv] = True",
"- if lv >= 3200 // 400:",
"+ if lv < 8:",
"+ d[lv] = 1",
"+ else:",
"-syurui = sum(d.values())",
"-print((max(1, syurui), s... | false | 0.110794 | 0.04623 | 2.396608 | [
"s215345876",
"s369712862"
] |
u914797917 | p03624 | python | s608126176 | s265956230 | 20 | 18 | 3,188 | 3,188 | Accepted | Accepted | 10 | s=eval(input())
for i in range(26):
if s.count(chr(ord('a')+i))==0:
print((chr(ord('a')+i)))
break
else:
print('None') | s=eval(input())
for i in range(26):
if not chr(ord('a')+i) in s:
print((chr(ord('a')+i)))
break
else:
print('None')
| 7 | 7 | 128 | 126 | s = eval(input())
for i in range(26):
if s.count(chr(ord("a") + i)) == 0:
print((chr(ord("a") + i)))
break
else:
print("None")
| s = eval(input())
for i in range(26):
if not chr(ord("a") + i) in s:
print((chr(ord("a") + i)))
break
else:
print("None")
| false | 0 | [
"- if s.count(chr(ord(\"a\") + i)) == 0:",
"+ if not chr(ord(\"a\") + i) in s:"
] | false | 0.040674 | 0.040344 | 1.008178 | [
"s608126176",
"s265956230"
] |
u987164499 | p03378 | python | s245047651 | s710327739 | 152 | 17 | 12,436 | 3,060 | Accepted | Accepted | 88.82 | from sys import stdin
import numpy as np
n,m,x= [int(x) for x in stdin.readline().rstrip().split()]
li = list(map(int,stdin.readline().rstrip().split()))
lin= [0]*(n+1)
for i in li:
lin[i] = 1
print((min(sum(lin[:x]),sum(lin[x+1:])))) | n,m,x = list(map(int,input().split()))
a = list(map(int,input().split()))
li = [0]*(n+1)
for i in a:
li[i] += 1
print((min(sum(li[:x+1]),sum(li[x:])))) | 10 | 9 | 247 | 158 | from sys import stdin
import numpy as np
n, m, x = [int(x) for x in stdin.readline().rstrip().split()]
li = list(map(int, stdin.readline().rstrip().split()))
lin = [0] * (n + 1)
for i in li:
lin[i] = 1
print((min(sum(lin[:x]), sum(lin[x + 1 :]))))
| n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
li = [0] * (n + 1)
for i in a:
li[i] += 1
print((min(sum(li[: x + 1]), sum(li[x:]))))
| false | 10 | [
"-from sys import stdin",
"-import numpy as np",
"-",
"-n, m, x = [int(x) for x in stdin.readline().rstrip().split()]",
"-li = list(map(int, stdin.readline().rstrip().split()))",
"-lin = [0] * (n + 1)",
"-for i in li:",
"- lin[i] = 1",
"-print((min(sum(lin[:x]), sum(lin[x + 1 :]))))",
"+n, m, x... | false | 0.038471 | 0.038291 | 1.004695 | [
"s245047651",
"s710327739"
] |
u191874006 | p02945 | python | s712348348 | s877897113 | 164 | 135 | 38,256 | 65,540 | Accepted | Accepted | 17.68 | #!/usr/bin/env python3
#ABC137 A
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fro... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 20 | 21 | 513 | 598 | #!/usr/bin/env python3
# ABC137 A
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools ... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 4.761905 | [
"-# ABC137 A",
"-import bisect",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-sys.setrecursionlimit(1000000000)",
"-from heapq import heappush, heappop",
"+sys.setrecursionlimit(2147483647)",
"+from heapq import heappush, heappop, heappushpop",
"+inf = float(\... | false | 0.048072 | 0.085992 | 0.559026 | [
"s712348348",
"s877897113"
] |
u581187895 | p02780 | python | s295974275 | s723376959 | 587 | 187 | 24,312 | 23,344 | Accepted | Accepted | 68.14 | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = list(map(int, readline().split()))
A = np.array(readline().split(), dtype=np.int64)
A = np.array([(1+a)/2 for a in A])
Acum = np.zeros(N+1, np.float64)
Acum[1:] = A.... | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = list(map(int, readline().split()))
A = np.array(readline().split(), dtype=np.int64) + 1
Acum = np.zeros(N+1, np.float64)
Acum[1:] = A.cumsum()
x = Acum[K:] - Acu... | 15 | 15 | 367 | 339 | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = list(map(int, readline().split()))
A = np.array(readline().split(), dtype=np.int64)
A = np.array([(1 + a) / 2 for a in A])
Acum = np.zeros(N + 1, np.float64)
Acum[1:] = A.cumsum... | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = list(map(int, readline().split()))
A = np.array(readline().split(), dtype=np.int64) + 1
Acum = np.zeros(N + 1, np.float64)
Acum[1:] = A.cumsum()
x = Acum[K:] - Acum[:-K]
print((... | false | 0 | [
"-A = np.array(readline().split(), dtype=np.int64)",
"-A = np.array([(1 + a) / 2 for a in A])",
"+A = np.array(readline().split(), dtype=np.int64) + 1",
"-print((x.max()))",
"+print((x.max() / 2))"
] | false | 0.200229 | 0.441117 | 0.453913 | [
"s295974275",
"s723376959"
] |
u367701763 | p03252 | python | s268748223 | s121870617 | 111 | 92 | 97,012 | 107,064 | Accepted | Accepted | 17.12 | def ch(x):
return ord(x)-ord("a")
def dch(x):
return chr(x+ord("a"))
S = input().rstrip()
T = input().rstrip()
s0 = S[0]
cnt = 1
A1 = []
P = [-1]*26
k=0
for s in S[1:]:
if s==s0:
cnt += 1
else:
if P[ch(s0)] == -1:
P[ch(s0)] = k
k += 1
... | def make_map(X):
X = list([ord(x) - ord("a") for x in X])
s = [-1]*26
res = [0]+[-1]*(len(X)-1)
cnt = 0
for i, x in enumerate(X):
if s[x] == -1:
s[x] = res[i] = cnt
cnt += 1
else:
res[i] = s[x]
return res
print(("Yes" if make_map(ev... | 64 | 13 | 1,136 | 360 | def ch(x):
return ord(x) - ord("a")
def dch(x):
return chr(x + ord("a"))
S = input().rstrip()
T = input().rstrip()
s0 = S[0]
cnt = 1
A1 = []
P = [-1] * 26
k = 0
for s in S[1:]:
if s == s0:
cnt += 1
else:
if P[ch(s0)] == -1:
P[ch(s0)] = k
k += 1
A1.... | def make_map(X):
X = list([ord(x) - ord("a") for x in X])
s = [-1] * 26
res = [0] + [-1] * (len(X) - 1)
cnt = 0
for i, x in enumerate(X):
if s[x] == -1:
s[x] = res[i] = cnt
cnt += 1
else:
res[i] = s[x]
return res
print(("Yes" if make_map(eval... | false | 79.6875 | [
"-def ch(x):",
"- return ord(x) - ord(\"a\")",
"+def make_map(X):",
"+ X = list([ord(x) - ord(\"a\") for x in X])",
"+ s = [-1] * 26",
"+ res = [0] + [-1] * (len(X) - 1)",
"+ cnt = 0",
"+ for i, x in enumerate(X):",
"+ if s[x] == -1:",
"+ s[x] = res[i] = cnt",
... | false | 0.047084 | 0.035312 | 1.333376 | [
"s268748223",
"s121870617"
] |
u852386636 | p03244 | python | s197416652 | s933567780 | 91 | 81 | 34,748 | 31,960 | Accepted | Accepted | 10.99 | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
even_odd_length = n / 2
replace_total = 0
list_odd = v[0::2]
list_even = v[1::2]
dict_c_odd = dict(collections.Counter(list_odd))
dict_c_even = dict(collections.Counter(list_even))
dict_c_even_bk = dict_c_even.copy()
dict_c_od... | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
even_odd_length = n / 2
replace_total = 0
list_odd = v[0::2]
list_even = v[1::2]
dict_c_odd = dict(collections.Counter(list_odd))
dict_c_even = dict(collections.Counter(list_even))
dict_c_even_bk = dict_c_even.copy()
replace... | 44 | 46 | 1,416 | 1,387 | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
even_odd_length = n / 2
replace_total = 0
list_odd = v[0::2]
list_even = v[1::2]
dict_c_odd = dict(collections.Counter(list_odd))
dict_c_even = dict(collections.Counter(list_even))
dict_c_even_bk = dict_c_even.copy()
dict_c_odd_bk = dict_c_o... | import collections
n = int(eval(input()))
v = list(map(int, input().split()))
even_odd_length = n / 2
replace_total = 0
list_odd = v[0::2]
list_even = v[1::2]
dict_c_odd = dict(collections.Counter(list_odd))
dict_c_even = dict(collections.Counter(list_even))
dict_c_even_bk = dict_c_even.copy()
replace_total_tmp = 0
re... | false | 4.347826 | [
"-dict_c_odd_bk = dict_c_odd.copy()"
] | false | 0.04412 | 0.044094 | 1.000605 | [
"s197416652",
"s933567780"
] |
u641446860 | p03208 | python | s911137509 | s744639322 | 541 | 248 | 51,160 | 8,280 | Accepted | Accepted | 54.16 | N, K = list(map(int, input().split()))
h = sorted([int(eval(input())) for _ in range(N)])
ans = float('inf')
for i in range(N-K+1):
ans = min(h[i+K-1] - h[i],ans)
print(ans) | N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h = sorted(h)
ans = float('inf')
for i in range(N-K+1):
ans = min(h[i+K-1] - h[i], ans)
print(ans) | 6 | 7 | 171 | 178 | N, K = list(map(int, input().split()))
h = sorted([int(eval(input())) for _ in range(N)])
ans = float("inf")
for i in range(N - K + 1):
ans = min(h[i + K - 1] - h[i], ans)
print(ans)
| N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h = sorted(h)
ans = float("inf")
for i in range(N - K + 1):
ans = min(h[i + K - 1] - h[i], ans)
print(ans)
| false | 14.285714 | [
"-h = sorted([int(eval(input())) for _ in range(N)])",
"+h = [int(eval(input())) for _ in range(N)]",
"+h = sorted(h)"
] | false | 0.078627 | 0.041637 | 1.888399 | [
"s911137509",
"s744639322"
] |
u263830634 | p02815 | python | s469695365 | s288495693 | 268 | 220 | 26,012 | 27,108 | Accepted | Accepted | 17.91 | MOD = 10 ** 9 + 7
N = int(eval(input()))
C = list(map(int, input().split()))
C.sort()
if N == 1:
print((2 * C[0] % MOD))
exit()
lst = [0] * (N + 3)
lst[0] = 1
for i in range(1, N + 3):
lst[i] = (lst[i - 1] * 2) % MOD
ANS = 0
for i, c in enumerate(C):
ANS += c * (N + 1 - i)
ANS ... | MOD = 10 ** 9 + 7
N = int(eval(input()))
C = list(map(int, input().split()))
C.sort()
if N == 1:
print((2 * C[0] % MOD))
exit()
ANS = 0
for i, c in enumerate(C):
ANS += c * (N + 1 - i)
ANS *= pow(2, N - 2, MOD)
ANS %= MOD
ANS *= pow(2, N, MOD)
print((ANS % MOD)) | 24 | 17 | 388 | 285 | MOD = 10**9 + 7
N = int(eval(input()))
C = list(map(int, input().split()))
C.sort()
if N == 1:
print((2 * C[0] % MOD))
exit()
lst = [0] * (N + 3)
lst[0] = 1
for i in range(1, N + 3):
lst[i] = (lst[i - 1] * 2) % MOD
ANS = 0
for i, c in enumerate(C):
ANS += c * (N + 1 - i)
ANS *= pow(2, N - 2, MOD)
ANS %=... | MOD = 10**9 + 7
N = int(eval(input()))
C = list(map(int, input().split()))
C.sort()
if N == 1:
print((2 * C[0] % MOD))
exit()
ANS = 0
for i, c in enumerate(C):
ANS += c * (N + 1 - i)
ANS *= pow(2, N - 2, MOD)
ANS %= MOD
ANS *= pow(2, N, MOD)
print((ANS % MOD))
| false | 29.166667 | [
"-lst = [0] * (N + 3)",
"-lst[0] = 1",
"-for i in range(1, N + 3):",
"- lst[i] = (lst[i - 1] * 2) % MOD"
] | false | 0.007587 | 0.038086 | 0.199208 | [
"s469695365",
"s288495693"
] |
u597374218 | p02759 | python | s964013495 | s846998052 | 25 | 23 | 9,084 | 9,148 | Accepted | Accepted | 8 | import math
N=int(eval(input()))
print((math.ceil(N/2))) | N=int(eval(input()))
print((N//2+N%2)) | 3 | 2 | 50 | 31 | import math
N = int(eval(input()))
print((math.ceil(N / 2)))
| N = int(eval(input()))
print((N // 2 + N % 2))
| false | 33.333333 | [
"-import math",
"-",
"-print((math.ceil(N / 2)))",
"+print((N // 2 + N % 2))"
] | false | 0.088472 | 0.036779 | 2.405499 | [
"s964013495",
"s846998052"
] |
u630941334 | p04015 | python | s221195891 | s637895782 | 1,743 | 1,557 | 58,484 | 54,088 | Accepted | Accepted | 10.67 | def main():
N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
x.insert(0, 0)
dp = [[[0 for _ in range(N * A + 1)] for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(N + 1):
dp[i][0][0] = 1
for i in range(1, N + 1):
for j in range(1... | def main():
N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
x.insert(0, 0)
dp = [[[0] * (N * A + 1) for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(N + 1):
dp[i][0][0] = 1
for i in range(1, N + 1):
for j in range(1, i + 1):
... | 26 | 26 | 648 | 636 | def main():
N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
x.insert(0, 0)
dp = [[[0 for _ in range(N * A + 1)] for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(N + 1):
dp[i][0][0] = 1
for i in range(1, N + 1):
for j in range(1, i + 1):
... | def main():
N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
x.insert(0, 0)
dp = [[[0] * (N * A + 1) for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(N + 1):
dp[i][0][0] = 1
for i in range(1, N + 1):
for j in range(1, i + 1):
for ... | false | 0 | [
"- dp = [[[0 for _ in range(N * A + 1)] for _ in range(N + 1)] for _ in range(N + 1)]",
"+ dp = [[[0] * (N * A + 1) for _ in range(N + 1)] for _ in range(N + 1)]"
] | false | 0.054961 | 0.129507 | 0.424384 | [
"s221195891",
"s637895782"
] |
u843175622 | p04045 | python | s488036922 | s520829394 | 505 | 398 | 107,288 | 92,760 | Accepted | Accepted | 21.19 | import sys
import numpy as np
from numba import njit, i4
read = sys.stdin.readline
@njit((i4, i4, i4[:]), cache=True)
def main(n, k, a):
for i in np.arange(n, 100000):
ok = 1
j = i
while j:
m = j % 10
for l in a:
if m == l:
... | import sys
import numpy as np
from numba import njit, i4
read = sys.stdin.readline
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
cc = CC('unko')
@cc.export('main', '(i4, i4, i4[:])')
def main(n, k, a):
for i in np.arange(n, 100000):
ok = 1
... | 26 | 33 | 581 | 787 | import sys
import numpy as np
from numba import njit, i4
read = sys.stdin.readline
@njit((i4, i4, i4[:]), cache=True)
def main(n, k, a):
for i in np.arange(n, 100000):
ok = 1
j = i
while j:
m = j % 10
for l in a:
if m == l:
ok = ... | import sys
import numpy as np
from numba import njit, i4
read = sys.stdin.readline
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("unko")
@cc.export("main", "(i4, i4, i4[:])")
def main(n, k, a):
for i in np.arange(n, 100000):
ok = 1
j = i
... | false | 21.212121 | [
"+if sys.argv[-1] == \"ONLINE_JUDGE\":",
"+ from numba.pycc import CC",
"+ cc = CC(\"unko\")",
"-@njit((i4, i4, i4[:]), cache=True)",
"-def main(n, k, a):",
"- for i in np.arange(n, 100000):",
"- ok = 1",
"- j = i",
"- while j:",
"- m = j % 10",
"- ... | false | 0.431361 | 0.215417 | 2.002452 | [
"s488036922",
"s520829394"
] |
u753803401 | p03013 | python | s156725159 | s390737361 | 252 | 228 | 63,324 | 50,008 | Accepted | Accepted | 9.52 | def slove():
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip('\n').split()))
a = dict([[int(input().rstrip('\n')), 0] for _ in range(m)])
x = [0] * (n + 1)
x[0] = 1 if 0 not in a else 0
x[1] = 1 if 1 not in a else 0
for i in range(2, n+1):
if i ... | def slove():
import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, m = list(map(int, input().rstrip('\n').split()))
a = {int(input().rstrip('\n')): 0 for _ in range(m)}
dp = [0] * (n + 1)
dp[0] = 1 if 0 not in a else 0
dp[1] = 1 if 1 not in a else 0
for i in range(2, n ... | 18 | 19 | 481 | 499 | def slove():
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip("\n").split()))
a = dict([[int(input().rstrip("\n")), 0] for _ in range(m)])
x = [0] * (n + 1)
x[0] = 1 if 0 not in a else 0
x[1] = 1 if 1 not in a else 0
for i in range(2, n + 1):
if i not in... | def slove():
import sys
input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().rstrip("\n").split()))
a = {int(input().rstrip("\n")): 0 for _ in range(m)}
dp = [0] * (n + 1)
dp[0] = 1 if 0 not in a else 0
dp[1] = 1 if 1 not in a else 0
for i in range(2, n + 1):
... | false | 5.263158 | [
"+ mod = 10**9 + 7",
"- a = dict([[int(input().rstrip(\"\\n\")), 0] for _ in range(m)])",
"- x = [0] * (n + 1)",
"- x[0] = 1 if 0 not in a else 0",
"- x[1] = 1 if 1 not in a else 0",
"+ a = {int(input().rstrip(\"\\n\")): 0 for _ in range(m)}",
"+ dp = [0] * (n + 1)",
"+ dp[0] =... | false | 0.067487 | 0.046779 | 1.442687 | [
"s156725159",
"s390737361"
] |
u645250356 | p03598 | python | s809275550 | s229135425 | 183 | 41 | 38,544 | 10,396 | Accepted | Accepted | 77.6 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.st... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 16 | 16 | 454 | 435 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpln(n):
r... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 0 | [
"-import sys, bisect, math, itertools",
"+import sys, bisect, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-x = inpl()",
"+a = inpl()",
"-for i in x:",
"- res += min(i, abs(i - k)) *... | false | 0.035553 | 0.036028 | 0.986838 | [
"s809275550",
"s229135425"
] |
u537782349 | p03680 | python | s035490999 | s516448329 | 232 | 201 | 19,064 | 7,340 | Accepted | Accepted | 13.36 | a = int(eval(input()))
b = [int(eval(input())) for _ in range(a)]
c = 1
d = 0
e = {}
while True:
d += 1
if b[c-1] == 2:
print(d)
exit()
else:
if (c-1) not in e:
e.setdefault((c-1), "")
else:
print((-1))
exit()
c = b[... | a = int(eval(input()))
b = [int(eval(input()))for _ in range(a)]
c = 0
d = 1
while True:
if b[d-1] == 2:
c += 1
break
elif c > a:
print((-1))
exit()
else:
d = b[d-1]
c += 1
print(c)
| 17 | 15 | 313 | 242 | a = int(eval(input()))
b = [int(eval(input())) for _ in range(a)]
c = 1
d = 0
e = {}
while True:
d += 1
if b[c - 1] == 2:
print(d)
exit()
else:
if (c - 1) not in e:
e.setdefault((c - 1), "")
else:
print((-1))
exit()
c = b[c - 1]
| a = int(eval(input()))
b = [int(eval(input())) for _ in range(a)]
c = 0
d = 1
while True:
if b[d - 1] == 2:
c += 1
break
elif c > a:
print((-1))
exit()
else:
d = b[d - 1]
c += 1
print(c)
| false | 11.764706 | [
"-c = 1",
"-d = 0",
"-e = {}",
"+c = 0",
"+d = 1",
"- d += 1",
"- if b[c - 1] == 2:",
"- print(d)",
"+ if b[d - 1] == 2:",
"+ c += 1",
"+ break",
"+ elif c > a:",
"+ print((-1))",
"- if (c - 1) not in e:",
"- e.setdefault((c - 1),... | false | 0.105688 | 0.085067 | 1.242399 | [
"s035490999",
"s516448329"
] |
u188827677 | p02813 | python | s094892407 | s083938744 | 36 | 33 | 9,188 | 13,784 | Accepted | Accepted | 8.33 | from itertools import permutations
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
t = 0
x = 0
y = 0
for i in permutations(list(range(1,n+1)),n):
t += 1
if i == p: x = t
if i == q: y = t
print((abs(x-y))) | from itertools import permutations
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
nums = list(permutations(list(range(1,n+1)), n))
print((abs(nums.index(q) - nums.index(p)))) | 14 | 7 | 260 | 217 | from itertools import permutations
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
t = 0
x = 0
y = 0
for i in permutations(list(range(1, n + 1)), n):
t += 1
if i == p:
x = t
if i == q:
y = t
print((abs(x - y)))
| from itertools import permutations
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
nums = list(permutations(list(range(1, n + 1)), n))
print((abs(nums.index(q) - nums.index(p))))
| false | 50 | [
"-t = 0",
"-x = 0",
"-y = 0",
"-for i in permutations(list(range(1, n + 1)), n):",
"- t += 1",
"- if i == p:",
"- x = t",
"- if i == q:",
"- y = t",
"-print((abs(x - y)))",
"+nums = list(permutations(list(range(1, n + 1)), n))",
"+print((abs(nums.index(q) - nums.index(p)... | false | 0.047643 | 0.121193 | 0.393114 | [
"s094892407",
"s083938744"
] |
u057964173 | p03281 | python | s348956165 | s327918423 | 182 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.66 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
# 約数の片割れをリストに
divisors.append(i)
... | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(eval(input()))
if 1<=n<105:
print((0))
elif n<135:
print((1))
elif n<165:
print((2))
elif n<189:
print((3))
elif n<195:
print((4))
else:
print((5)... | 23 | 18 | 653 | 314 | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
# 約数の片割れをリストに
divisors.append(i)
# 平方数じゃなけ... | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
n = int(eval(input()))
if 1 <= n < 105:
print((0))
elif n < 135:
print((1))
elif n < 165:
print((2))
elif n < 189:
print((3))
elif n < 195:
print((4))
else:
prin... | false | 21.73913 | [
"-",
"- def make_divisors(n):",
"- divisors = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- # 約数の片割れをリストに",
"- divisors.append(i)",
"- # 平方数じゃなければ片割れの相方をリストに",
"- if i != n // i:",
"- ... | false | 0.038746 | 0.038964 | 0.994419 | [
"s348956165",
"s327918423"
] |
u156815136 | p03672 | python | s648470902 | s429050625 | 48 | 39 | 5,660 | 10,300 | Accepted | Accepted | 18.75 | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | 42 | 37 | 926 | 849 | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | false | 11.904762 | [
"-from statistics import median",
"-",
"+# from statistics import median",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"-from collections import defaultdict",
"-import bisect",
"+from itertools import combinations, permutations, accumulate # (string,3) 3回... | false | 0.036703 | 0.036016 | 1.019057 | [
"s648470902",
"s429050625"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.