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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u761320129 | p03221 | python | s974341092 | s891098688 | 738 | 682 | 47,844 | 47,772 | Accepted | Accepted | 7.59 | N,M = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(M)]
cs = [[] for i in range(N+1)]
for i,(p,y) in enumerate(src):
cs[p].append((y,i))
ans = [None]*M
for pi,cities in enumerate(cs):
for order,(y,i) in enumerate(sorted(cities)):
ans[i] = str(pi).zfill(6) + s... | N,M = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(M)]
cs = [[] for i in range(N+1)]
for i,(p,y) in enumerate(src):
cs[p].append((y,i))
for cc in cs:
cc.sort()
ans = [None] * M
for p in range(len(cs)):
for i,(_,j) in enumerate(cs[p]):
s = str(p).zfill(... | 12 | 15 | 363 | 385 | N, M = map(int, input().split())
src = [tuple(map(int, input().split())) for i in range(M)]
cs = [[] for i in range(N + 1)]
for i, (p, y) in enumerate(src):
cs[p].append((y, i))
ans = [None] * M
for pi, cities in enumerate(cs):
for order, (y, i) in enumerate(sorted(cities)):
ans[i] = str(pi).zfill(6) + ... | N, M = map(int, input().split())
src = [tuple(map(int, input().split())) for i in range(M)]
cs = [[] for i in range(N + 1)]
for i, (p, y) in enumerate(src):
cs[p].append((y, i))
for cc in cs:
cc.sort()
ans = [None] * M
for p in range(len(cs)):
for i, (_, j) in enumerate(cs[p]):
s = str(p).zfill(6) +... | false | 20 | [
"+for cc in cs:",
"+ cc.sort()",
"-for pi, cities in enumerate(cs):",
"- for order, (y, i) in enumerate(sorted(cities)):",
"- ans[i] = str(pi).zfill(6) + str(order + 1).zfill(6)",
"+for p in range(len(cs)):",
"+ for i, (_, j) in enumerate(cs[p]):",
"+ s = str(p).zfill(6) + str(i... | false | 0.038329 | 0.074087 | 0.517358 | [
"s974341092",
"s891098688"
] |
u994988729 | p03363 | python | s381624446 | s828708095 | 209 | 166 | 41,664 | 41,620 | Accepted | Accepted | 20.57 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
cum = [0] * (n + 1)
for i in range(n):
cum[i + 1] = cum[i] + a[i]
c = Counter(cum)
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans) | from itertools import accumulate
from collections import Counter
N = int(eval(input()))
A = [0]+list(map(int, input().split()))
Acum = list(accumulate(A))
C = Counter(Acum)
ans = 0
for _, v in list(C.items()):
ans += (v - 1) * v // 2
print(ans)
| 13 | 12 | 253 | 250 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
cum = [0] * (n + 1)
for i in range(n):
cum[i + 1] = cum[i] + a[i]
c = Counter(cum)
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
| from itertools import accumulate
from collections import Counter
N = int(eval(input()))
A = [0] + list(map(int, input().split()))
Acum = list(accumulate(A))
C = Counter(Acum)
ans = 0
for _, v in list(C.items()):
ans += (v - 1) * v // 2
print(ans)
| false | 7.692308 | [
"+from itertools import accumulate",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-cum = [0] * (n + 1)",
"-for i in range(n):",
"- cum[i + 1] = cum[i] + a[i]",
"-c = Counter(cum)",
"+N = int(eval(input()))",
"+A = [0] + list(map(int, input().split()))",
"+Acum = list(accu... | false | 0.042538 | 0.099438 | 0.427785 | [
"s381624446",
"s828708095"
] |
u102278909 | p03032 | python | s577498183 | s393595776 | 624 | 219 | 49,372 | 43,356 | Accepted | Accepted | 64.9 | # coding: utf-8
import sys
input = sys.stdin.readline
# N = int(input())
N, K = list(map(int, input().split()))
D = [int(x) for x in input().split()]
# S = input()
ans = 0
for l in range(N + 1):
if l > K:
break
for r in range(N - l + 1):
if l + r > K:
break
... | # coding: utf-8
import sys
input = sys.stdin.readline
# N = int(input())
N, K = list(map(int, input().split()))
D = [int(x) for x in input().split()]
# S = input()
ans = 0
for l in range(N + 1):
if l > K:
break
for r in range(N - l + 1):
if l + r > K:
break
... | 30 | 26 | 665 | 507 | # coding: utf-8
import sys
input = sys.stdin.readline
# N = int(input())
N, K = list(map(int, input().split()))
D = [int(x) for x in input().split()]
# S = input()
ans = 0
for l in range(N + 1):
if l > K:
break
for r in range(N - l + 1):
if l + r > K:
break
l_list = sorted(D... | # coding: utf-8
import sys
input = sys.stdin.readline
# N = int(input())
N, K = list(map(int, input().split()))
D = [int(x) for x in input().split()]
# S = input()
ans = 0
for l in range(N + 1):
if l > K:
break
for r in range(N - l + 1):
if l + r > K:
break
value_list = D[0:... | false | 13.333333 | [
"- l_list = sorted(D[0:l])",
"- r_list = sorted(D[N - r : N])",
"- for discard_l in range(K - (l + r) + 1):",
"- for discard_r in range(K - (l + r + discard_l) + 1):",
"- value = sum(l_list[discard_l:])",
"- value += sum(r_list[discard_r:])",
... | false | 0.04482 | 0.091157 | 0.491682 | [
"s577498183",
"s393595776"
] |
u968166680 | p02845 | python | s503012770 | s351837088 | 226 | 66 | 60,068 | 14,068 | Accepted | Accepted | 70.8 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
MOD = 1000000007
N, *A = list(map(int, read().split()))
seq = [-1] * 3
ans = 1
try:
for a in A:
ans = ans * s... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
MOD = 1000000007
N, *A = list(map(int, read().split()))
C = [0] * (N + 1)
C[0] = 3
ans = 1
for a in A:
ans = ans * C[... | 27 | 30 | 492 | 505 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
MOD = 1000000007
N, *A = list(map(int, read().split()))
seq = [-1] * 3
ans = 1
try:
for a in A:
ans = ans * seq.count(a - 1) % ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
MOD = 1000000007
N, *A = list(map(int, read().split()))
C = [0] * (N + 1)
C[0] = 3
ans = 1
for a in A:
ans = ans * C[a] % MOD
i... | false | 10 | [
"- seq = [-1] * 3",
"+ C = [0] * (N + 1)",
"+ C[0] = 3",
"- try:",
"- for a in A:",
"- ans = ans * seq.count(a - 1) % MOD",
"- seq[seq.index(a - 1)] = a",
"- print(ans)",
"- except:",
"- print((0))",
"+ for a in A:",
"+ ans = ... | false | 0.045441 | 0.082533 | 0.550583 | [
"s503012770",
"s351837088"
] |
u250583425 | p03476 | python | s394062063 | s196135418 | 397 | 266 | 6,896 | 6,360 | Accepted | Accepted | 33 | import sys
import math
def input(): return sys.stdin.readline().rstrip()
def isPrime(n):
m = (n + 1) // 2
n_sqrt = int(math.sqrt(n))
for i in range(2, n_sqrt + 1):
if n % i == 0 or m % i == 0:
return 0
else:
return 1
def main():
Q = int(eval(input()))
... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
MAX = 10 ** 5
Q = int(eval(input()))
ans = [0] * (MAX + 1)
sum = 0
prime = set()
memo = [False] * 2 + [True] * (MAX - 1)
for i in range(2, MAX + 1):
if memo[i]:
prime.add(i)
... | 26 | 26 | 572 | 620 | import sys
import math
def input():
return sys.stdin.readline().rstrip()
def isPrime(n):
m = (n + 1) // 2
n_sqrt = int(math.sqrt(n))
for i in range(2, n_sqrt + 1):
if n % i == 0 or m % i == 0:
return 0
else:
return 1
def main():
Q = int(eval(input()))
MAX = ... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
MAX = 10**5
Q = int(eval(input()))
ans = [0] * (MAX + 1)
sum = 0
prime = set()
memo = [False] * 2 + [True] * (MAX - 1)
for i in range(2, MAX + 1):
if memo[i]:
prime.add(i)
for j i... | false | 0 | [
"-import math",
"-def isPrime(n):",
"- m = (n + 1) // 2",
"- n_sqrt = int(math.sqrt(n))",
"- for i in range(2, n_sqrt + 1):",
"- if n % i == 0 or m % i == 0:",
"- return 0",
"- else:",
"- return 1",
"-",
"-",
"+ MAX = 10**5",
"- MAX = 10**5",
"- ... | false | 0.270606 | 0.178342 | 1.517343 | [
"s394062063",
"s196135418"
] |
u764215612 | p02702 | python | s213408394 | s581382216 | 296 | 84 | 9,368 | 9,300 | Accepted | Accepted | 71.62 | def main():
n, mods = 0, [1]+[0]*2019
for i, j in enumerate(reversed(eval(input()))):
n = (n+int(j)*pow(10, i, 2019))%2019
mods[n] += 1
print((sum([i*(i-1)//2 for i in mods])))
main() | def main():
n, mods = 0, [1]+[0]*2019
d = 1
for i, j in enumerate(reversed(eval(input()))):
# n = (n+int(j)*pow(10, i, 2019))%2019
n = (n+int(j)*d)%2019
d=d*10%2019
mods[n] += 1
print((sum([i*(i-1)//2 for i in mods])))
main() | 7 | 10 | 195 | 250 | def main():
n, mods = 0, [1] + [0] * 2019
for i, j in enumerate(reversed(eval(input()))):
n = (n + int(j) * pow(10, i, 2019)) % 2019
mods[n] += 1
print((sum([i * (i - 1) // 2 for i in mods])))
main()
| def main():
n, mods = 0, [1] + [0] * 2019
d = 1
for i, j in enumerate(reversed(eval(input()))):
# n = (n+int(j)*pow(10, i, 2019))%2019
n = (n + int(j) * d) % 2019
d = d * 10 % 2019
mods[n] += 1
print((sum([i * (i - 1) // 2 for i in mods])))
main()
| false | 30 | [
"+ d = 1",
"- n = (n + int(j) * pow(10, i, 2019)) % 2019",
"+ # n = (n+int(j)*pow(10, i, 2019))%2019",
"+ n = (n + int(j) * d) % 2019",
"+ d = d * 10 % 2019"
] | false | 0.046116 | 0.036211 | 1.273548 | [
"s213408394",
"s581382216"
] |
u945181840 | p03488 | python | s719530752 | s596894865 | 952 | 798 | 3,820 | 3,888 | Accepted | Accepted | 16.18 | s = input().split('T')
x, y = list(map(int, input().split()))
# x軸方向の移動について
# 1回目の移動はxの正方向のみ
here_x = [len(s[0])]
for i in s[2::2]:
move = len(i)
here_x = [i + move for i in here_x] + [i - move for i in here_x]
here_x = list(set(here_x))
# x軸方向の移動について
# 1回目の移動はxの正方向のみ
here_y = [0]
for i ... | def main():
s = input().split('T')
x, y = list(map(int, input().split()))
# x軸方向の移動について
# 1回目の移動はxの正方向のみ
here_x = [len(s[0])]
for i in s[2::2]:
move = len(i)
here_x = [i + move for i in here_x] + [i - move for i in here_x]
here_x = set(here_x)
# y軸方向の移... | 25 | 29 | 523 | 626 | s = input().split("T")
x, y = list(map(int, input().split()))
# x軸方向の移動について
# 1回目の移動はxの正方向のみ
here_x = [len(s[0])]
for i in s[2::2]:
move = len(i)
here_x = [i + move for i in here_x] + [i - move for i in here_x]
here_x = list(set(here_x))
# x軸方向の移動について
# 1回目の移動はxの正方向のみ
here_y = [0]
for i in s[1::2]:
move... | def main():
s = input().split("T")
x, y = list(map(int, input().split()))
# x軸方向の移動について
# 1回目の移動はxの正方向のみ
here_x = [len(s[0])]
for i in s[2::2]:
move = len(i)
here_x = [i + move for i in here_x] + [i - move for i in here_x]
here_x = set(here_x)
# y軸方向の移動について
here_y... | false | 13.793103 | [
"-s = input().split(\"T\")",
"-x, y = list(map(int, input().split()))",
"-# x軸方向の移動について",
"-# 1回目の移動はxの正方向のみ",
"-here_x = [len(s[0])]",
"-for i in s[2::2]:",
"- move = len(i)",
"- here_x = [i + move for i in here_x] + [i - move for i in here_x]",
"- here_x = list(set(here_x))",
"-# x軸方向の移... | false | 0.038201 | 0.041334 | 0.924199 | [
"s719530752",
"s596894865"
] |
u948524308 | p03162 | python | s148992399 | s457436351 | 977 | 475 | 3,064 | 3,064 | Accepted | Accepted | 51.38 | N=int(eval(input()))
p=list(map(int,input().split()))
for i in range(1,N):
add=list(map(int,input().split()))
temp=[[] for j in range(3)]
for j in range(3):
pnt=p[j]
for k in range(3):
if j==k:continue
else:
temp[k].append(pnt+add[k])
... | N=int(eval(input()))
p=list(map(int,input().split()))
for i in range(1,N):
add=list(map(int,input().split()))
p0=p[0]
p1=p[1]
p2=p[2]
p[0]=max(add[0]+p1,add[0]+p2)
p[1]=max(add[1]+p2,add[1]+p0)
p[2]=max(add[2]+p0,add[2]+p1)
print((max(p)))
| 16 | 15 | 376 | 278 | N = int(eval(input()))
p = list(map(int, input().split()))
for i in range(1, N):
add = list(map(int, input().split()))
temp = [[] for j in range(3)]
for j in range(3):
pnt = p[j]
for k in range(3):
if j == k:
continue
else:
temp[k].appe... | N = int(eval(input()))
p = list(map(int, input().split()))
for i in range(1, N):
add = list(map(int, input().split()))
p0 = p[0]
p1 = p[1]
p2 = p[2]
p[0] = max(add[0] + p1, add[0] + p2)
p[1] = max(add[1] + p2, add[1] + p0)
p[2] = max(add[2] + p0, add[2] + p1)
print((max(p)))
| false | 6.25 | [
"- temp = [[] for j in range(3)]",
"- for j in range(3):",
"- pnt = p[j]",
"- for k in range(3):",
"- if j == k:",
"- continue",
"- else:",
"- temp[k].append(pnt + add[k])",
"- for j in range(3):",
"- p[j] = max(temp... | false | 0.113353 | 0.044503 | 2.547093 | [
"s148992399",
"s457436351"
] |
u102461423 | p02901 | python | s184700371 | s865127569 | 1,485 | 788 | 3,444 | 12,512 | Accepted | Accepted | 46.94 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
import itertools
N,M = list(map(int,readline().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(x) for x in readline().split()))
C.append(sum(1<<(int(x)-1) for x in readline().spli... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
N,M = list(map(int,readline().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(x) for x in readline().split()))
C.append(sum(1<<(int(x)-1) for x in readline().... | 27 | 37 | 574 | 869 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
import itertools
N, M = list(map(int, readline().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(x) for x in readline().split()))
C.append(sum(1 << (int(x) - 1) for x in readline().split()))
I... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
import numpy as np
N, M = list(map(int, readline().split()))
AB = []
C = []
for _ in range(M):
AB.append(tuple(int(x) for x in readline().split()))
C.append(sum(1 << (int(x) - 1) for x in readline().split()))... | false | 27.027027 | [
"-import itertools",
"+import numpy as np",
"+A, B = np.array(AB, np.int64).T",
"+C = np.array(C, np.int64)",
"-dp = [INF] * (1 << N)",
"+dp = np.full(1 << N, INF, np.int64)",
"-for n, ((a, b), c) in itertools.product(list(range(1 << N)), list(zip(AB, C))):",
"- m = n | c",
"- x = dp[n] + a",
... | false | 0.204381 | 0.23848 | 0.857016 | [
"s184700371",
"s865127569"
] |
u894258749 | p02998 | python | s823439687 | s691940431 | 637 | 561 | 25,072 | 16,104 | Accepted | Accepted | 11.93 | import sys
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))
from collections import defaultdict
class UnionFind:
def __init__(self, N=None):
if N is None or N < 1:
self.parent = defaultdict(lambda: -1)
else:
self.parent = [-1]*int(N)
... | import sys
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))
from collections import defaultdict
class UnionFind:
def __init__(self, N=None):
if N is None or N < 1:
self.parent = defaultdict(lambda: -1)
else:
self.parent = [-1]*int(N)
... | 81 | 67 | 1,971 | 1,716 | import sys
input = sys.stdin.readline
inpl = lambda: list(map(int, input().split()))
from collections import defaultdict
class UnionFind:
def __init__(self, N=None):
if N is None or N < 1:
self.parent = defaultdict(lambda: -1)
else:
self.parent = [-1] * int(N)
def roo... | import sys
input = sys.stdin.readline
inpl = lambda: list(map(int, input().split()))
from collections import defaultdict
class UnionFind:
def __init__(self, N=None):
if N is None or N < 1:
self.parent = defaultdict(lambda: -1)
else:
self.parent = [-1] * int(N)
def roo... | false | 17.283951 | [
"-Xi = defaultdict(CountUp())",
"-Yi = defaultdict(CountUp())",
"-xy = []",
"+uf = UnionFind()",
"- xi = Xi[x]",
"- yi = Yi[y]",
"- xy.append((xi, yi))",
"-Nx = len(Xi)",
"-Ny = len(Yi)",
"-Nxy = Nx + Ny",
"-uf = UnionFind(Nx + Ny)",
"-for xi, yi in xy:",
"- uf.merge(xi, yi + Nx)... | false | 0.041753 | 0.041406 | 1.008382 | [
"s823439687",
"s691940431"
] |
u721316601 | p03062 | python | s629264841 | s684181363 | 194 | 171 | 25,644 | 14,252 | Accepted | Accepted | 11.86 | N = int(eval(input()))
A = list(map(int, input().split()))
dp = [[0,0] for i in range(N+1)]
dp[0][1] = -10**20
for i in range(N):
dp[i+1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])
dp[i+1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])
print((dp[-1][0]))
| N = int(eval(input()))
A = list(map(int, input().split()))
dp = [0, -10**20]
tmp = [0, 0]
for i in range(N):
tmp[0] = max(dp[0] + A[i], dp[1] - A[i])
tmp[1] = max(dp[0] - A[i], dp[1] + A[i])
dp[0], dp[1] = tmp[0], tmp[1]
print((dp[0])) | 10 | 10 | 262 | 249 | N = int(eval(input()))
A = list(map(int, input().split()))
dp = [[0, 0] for i in range(N + 1)]
dp[0][1] = -(10**20)
for i in range(N):
dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])
dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])
print((dp[-1][0]))
| N = int(eval(input()))
A = list(map(int, input().split()))
dp = [0, -(10**20)]
tmp = [0, 0]
for i in range(N):
tmp[0] = max(dp[0] + A[i], dp[1] - A[i])
tmp[1] = max(dp[0] - A[i], dp[1] + A[i])
dp[0], dp[1] = tmp[0], tmp[1]
print((dp[0]))
| false | 0 | [
"-dp = [[0, 0] for i in range(N + 1)]",
"-dp[0][1] = -(10**20)",
"+dp = [0, -(10**20)]",
"+tmp = [0, 0]",
"- dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])",
"- dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])",
"-print((dp[-1][0]))",
"+ tmp[0] = max(dp[0] + A[i], dp[1] - A[i])",
... | false | 0.117052 | 0.035542 | 3.293344 | [
"s629264841",
"s684181363"
] |
u519003353 | p03493 | python | s960252788 | s005119091 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | print((input().count("1"))) | number = eval(input())
a = number.count("1")
print(a)
| 1 | 3 | 25 | 50 | print((input().count("1")))
| number = eval(input())
a = number.count("1")
print(a)
| false | 66.666667 | [
"-print((input().count(\"1\")))",
"+number = eval(input())",
"+a = number.count(\"1\")",
"+print(a)"
] | false | 0.070173 | 0.040613 | 1.727849 | [
"s960252788",
"s005119091"
] |
u525065967 | p02888 | python | s318659144 | s842537341 | 1,715 | 1,400 | 3,188 | 3,188 | Accepted | Accepted | 18.37 | N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
cmax = L[-1] + L[-2]
csum = list(0 for _ in range(cmax+1))
for i in range(N): csum[L[i]] += 1
for i in range(1,cmax+1): csum[i] += csum[i-1]
ans = 0
for ib in range(N):
b = L[ib]
for ia in range(ib):
a = L[ia]
minL, m... | import bisect
N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
ans = 0
for b in range(N):
for a in range(b):
ans += bisect.bisect_left(L, L[a] + L[b])-(b+1)
print(ans) | 17 | 9 | 466 | 199 | N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
cmax = L[-1] + L[-2]
csum = list(0 for _ in range(cmax + 1))
for i in range(N):
csum[L[i]] += 1
for i in range(1, cmax + 1):
csum[i] += csum[i - 1]
ans = 0
for ib in range(N):
b = L[ib]
for ia in range(ib):
a = L[ia]
min... | import bisect
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for b in range(N):
for a in range(b):
ans += bisect.bisect_left(L, L[a] + L[b]) - (b + 1)
print(ans)
| false | 47.058824 | [
"+import bisect",
"+",
"-cmax = L[-1] + L[-2]",
"-csum = list(0 for _ in range(cmax + 1))",
"-for i in range(N):",
"- csum[L[i]] += 1",
"-for i in range(1, cmax + 1):",
"- csum[i] += csum[i - 1]",
"-for ib in range(N):",
"- b = L[ib]",
"- for ia in range(ib):",
"- a = L[ia]"... | false | 0.039275 | 0.036197 | 1.08504 | [
"s318659144",
"s842537341"
] |
u620084012 | p03112 | python | s698158029 | s269726892 | 1,103 | 684 | 16,752 | 12,780 | Accepted | Accepted | 37.99 | import bisect
A, B, Q = list(map(int,input().split()))
S = [-float("inf")] + sorted([int(eval(input())) for k in range(A)]) + [float("inf")]
T = [-float("inf")] + sorted([int(eval(input())) for k in range(B)]) + [float("inf")]
X = [int(eval(input())) for k in range(Q)]
for x in X:
p = bisect.bisect_left(S,x... | import sys, math, bisect
sys.setrecursionlimit(200010)
def input():
return sys.stdin.readline()[:-1]
def main():
A, B, Q = list(map(int,input().split()))
s = [-10**12] + sorted([int(eval(input())) for k in range(A)]) + [10**12]
t = [-10**12] + sorted([int(eval(input())) for k in range(B)]) + ... | 16 | 26 | 615 | 780 | import bisect
A, B, Q = list(map(int, input().split()))
S = [-float("inf")] + sorted([int(eval(input())) for k in range(A)]) + [float("inf")]
T = [-float("inf")] + sorted([int(eval(input())) for k in range(B)]) + [float("inf")]
X = [int(eval(input())) for k in range(Q)]
for x in X:
p = bisect.bisect_left(S, x)
... | import sys, math, bisect
sys.setrecursionlimit(200010)
def input():
return sys.stdin.readline()[:-1]
def main():
A, B, Q = list(map(int, input().split()))
s = [-(10**12)] + sorted([int(eval(input())) for k in range(A)]) + [10**12]
t = [-(10**12)] + sorted([int(eval(input())) for k in range(B)]) + [... | false | 38.461538 | [
"-import bisect",
"+import sys, math, bisect",
"-A, B, Q = list(map(int, input().split()))",
"-S = [-float(\"inf\")] + sorted([int(eval(input())) for k in range(A)]) + [float(\"inf\")]",
"-T = [-float(\"inf\")] + sorted([int(eval(input())) for k in range(B)]) + [float(\"inf\")]",
"-X = [int(eval(input()))... | false | 0.03736 | 0.061037 | 0.612083 | [
"s698158029",
"s269726892"
] |
u260980560 | p00713 | python | s539628324 | s856799877 | 28,240 | 24,730 | 6,640 | 6,580 | Accepted | Accepted | 12.43 | from math import sqrt
from bisect import bisect_left
def circle_center(x1, y1, x2, y2):
xd = x2 - x1; yd = y2 - y1
d = xd**2 + yd**2
k = sqrt((4.0 - d) / d) / 2.0
xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
xd *= k; yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
n ... | from math import sqrt
def circle_center(x1, y1, x2, y2):
xd = x2 - x1; yd = y2 - y1
d = xd**2 + yd**2
k = sqrt((4.0 - d) / d) / 2.0
xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
xd *= k; yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
n = int(input())
if n==0: bre... | 33 | 32 | 1,220 | 1,212 | from math import sqrt
from bisect import bisect_left
def circle_center(x1, y1, x2, y2):
xd = x2 - x1
yd = y2 - y1
d = xd**2 + yd**2
k = sqrt((4.0 - d) / d) / 2.0
xc = (x1 + x2) / 2.0
yc = (y1 + y2) / 2.0
xd *= k
yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
... | from math import sqrt
def circle_center(x1, y1, x2, y2):
xd = x2 - x1
yd = y2 - y1
d = xd**2 + yd**2
k = sqrt((4.0 - d) / d) / 2.0
xc = (x1 + x2) / 2.0
yc = (y1 + y2) / 2.0
xd *= k
yd *= k
return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
n = int(input())
if n == 0... | false | 3.030303 | [
"-from bisect import bisect_left",
"- px = [e[0] for e in p]",
"- py = [e[1] for e in p]",
"- bx = px[i]",
"- by = py[i]",
"- while bx - px[prev] >= 2.0:",
"+ bx, by = p[i]",
"+ while bx - p[prev][0] >= 2.0:",
"- cx = px[j]",
"- cy = p... | false | 0.056661 | 0.050003 | 1.133158 | [
"s539628324",
"s856799877"
] |
u137038354 | p02614 | python | s326650803 | s809268858 | 66 | 53 | 9,112 | 9,176 | Accepted | Accepted | 19.7 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
H,W,K = list(map(int,readline().split()))
C = [readline().strip() for _ in range(H)]
ans = 0
for i in range(2**H):
for j in range(2**W):
cnt = 0
for s in range(H):
for t in ran... | import sys
def main():
H,W,K = list(map(int,input().split()))
a = []
for i in range(H):
a.append(sys.stdin.readline())
ans = 0
for i in range(2**H):
for j in range(2**W):
cnt = 0
for s in range(H):
for t in range(W):
if(i >> s) & 1 and (j >> t) & 1 an... | 20 | 22 | 476 | 448 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W, K = list(map(int, readline().split()))
C = [readline().strip() for _ in range(H)]
ans = 0
for i in range(2**H):
for j in range(2**W):
cnt = 0
for s in range(H):
for t in range(W):
... | import sys
def main():
H, W, K = list(map(int, input().split()))
a = []
for i in range(H):
a.append(sys.stdin.readline())
ans = 0
for i in range(2**H):
for j in range(2**W):
cnt = 0
for s in range(H):
for t in range(W):
if... | false | 9.090909 | [
"-read = sys.stdin.read",
"-readline = sys.stdin.readline",
"-readlines = sys.stdin.readlines",
"-H, W, K = list(map(int, readline().split()))",
"-C = [readline().strip() for _ in range(H)]",
"-ans = 0",
"-for i in range(2**H):",
"- for j in range(2**W):",
"- cnt = 0",
"- for s in... | false | 0.047459 | 0.040589 | 1.169242 | [
"s326650803",
"s809268858"
] |
u278492238 | p03317 | python | s170063363 | s925958397 | 41 | 19 | 13,812 | 4,724 | Accepted | Accepted | 53.66 | from math import ceil
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
r = ceil((N-1) / (K-1))
print(r) | from math import ceil
N, K = list(map(int, input().split()))
#A = list(map(int, input().split()))
A = eval(input()) # dummy read
r = ceil((N-1) / (K-1))
print(r) | 6 | 7 | 135 | 163 | from math import ceil
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
r = ceil((N - 1) / (K - 1))
print(r)
| from math import ceil
N, K = list(map(int, input().split()))
# A = list(map(int, input().split()))
A = eval(input()) # dummy read
r = ceil((N - 1) / (K - 1))
print(r)
| false | 14.285714 | [
"-A = list(map(int, input().split()))",
"+# A = list(map(int, input().split()))",
"+A = eval(input()) # dummy read"
] | false | 0.007675 | 0.032409 | 0.236802 | [
"s170063363",
"s925958397"
] |
u564902833 | p03112 | python | s773827073 | s513029987 | 1,693 | 1,103 | 13,988 | 16,156 | Accepted | Accepted | 34.85 | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10 ** 18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(eval(input()))
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
res = INF
for ... | from bisect import bisect_right
A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF]
t = [-INF]
for _ in range(A):
s.append(int(eval(input())))
s.append(INF)
for _ in range(B):
t.append(int(eval(input())))
t.append(INF)
x = list(map(int, (eval(input()) for _ in range(Q))))
for y in x:... | 14 | 28 | 451 | 870 | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(eval(input()))
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
res = INF
fo... | from bisect import bisect_right
A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF]
t = [-INF]
for _ in range(A):
s.append(int(eval(input())))
s.append(INF)
for _ in range(B):
t.append(int(eval(input())))
t.append(INF)
x = list(map(int, (eval(input()) for _ in range(Q))))
for y in x:
i = bise... | false | 50 | [
"-import bisect",
"+from bisect import bisect_right",
"-s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]",
"-t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]",
"-for q in range(Q):",
"- x = int(eval(input()))",
"- b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)",
... | false | 0.037519 | 0.037298 | 1.005925 | [
"s773827073",
"s513029987"
] |
u144913062 | p02555 | python | s866859792 | s049954126 | 107 | 62 | 68,992 | 63,396 | Accepted | Accepted | 42.06 | from itertools import accumulate
S = int(eval(input()))
mod = 10**9 + 7
if S == 1 or S == 2:
print((0))
exit()
dp = [0] * (S + 1)
dp[0] = 1
ans = 0
for i in range(S):
cum = list(accumulate(dp))
for j in range(S, 2, -1):
dp[j] = cum[j-3] % mod
dp[0] = dp[1] = dp[2] = 0
ans... | S = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (S + 1)
dp[0] = 1
for i in range(3, S + 1):
dp[i] = (dp[i-1] + dp[i-3]) % mod
print((dp[S])) | 17 | 7 | 346 | 144 | from itertools import accumulate
S = int(eval(input()))
mod = 10**9 + 7
if S == 1 or S == 2:
print((0))
exit()
dp = [0] * (S + 1)
dp[0] = 1
ans = 0
for i in range(S):
cum = list(accumulate(dp))
for j in range(S, 2, -1):
dp[j] = cum[j - 3] % mod
dp[0] = dp[1] = dp[2] = 0
ans = (ans + dp[... | S = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (S + 1)
dp[0] = 1
for i in range(3, S + 1):
dp[i] = (dp[i - 1] + dp[i - 3]) % mod
print((dp[S]))
| false | 58.823529 | [
"-from itertools import accumulate",
"-",
"-if S == 1 or S == 2:",
"- print((0))",
"- exit()",
"-ans = 0",
"-for i in range(S):",
"- cum = list(accumulate(dp))",
"- for j in range(S, 2, -1):",
"- dp[j] = cum[j - 3] % mod",
"- dp[0] = dp[1] = dp[2] = 0",
"- ans = (ans +... | false | 0.1145 | 0.036749 | 3.115731 | [
"s866859792",
"s049954126"
] |
u285891772 | p03393 | python | s368497932 | s340566351 | 56 | 39 | 5,840 | 5,200 | Accepted | Accepted | 30.36 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 42 | 40 | 1,258 | 1,238 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
log,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
log,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 4.761905 | [
"- S = S[::-1]",
"- for i in range(len(S) - 1):",
"- if S[i + 1] < S[i]:",
"- for char in sorted(S[: i + 1]):",
"- if char > S[i + 1]:",
"- print((S[::-1][: -i - 2] + char))",
"+ for i in range(len(S) - 2, -1, -1):"... | false | 0.104376 | 0.051726 | 2.017863 | [
"s368497932",
"s340566351"
] |
u340781749 | p03504 | python | s483752909 | s553585511 | 565 | 476 | 25,632 | 19,280 | Accepted | Accepted | 15.75 | from collections import defaultdict
from heapq import heapreplace, heappush
n, v = list(map(int, input().split()))
programs = defaultdict(list)
for _ in range(n):
s, t, c = list(map(int, input().split()))
programs[c].append((s, t))
combined = []
for c, p in list(programs.items()):
p.sort()
... | from collections import defaultdict
from itertools import accumulate
n, v = list(map(int, input().split()))
programs = defaultdict(list)
for _ in range(n):
s, t, c = list(map(int, input().split()))
programs[c].append((s, t))
imos = [0] * (2 * 10 ** 5 + 2)
for c, p in list(programs.items()):
p.s... | 30 | 24 | 748 | 590 | from collections import defaultdict
from heapq import heapreplace, heappush
n, v = list(map(int, input().split()))
programs = defaultdict(list)
for _ in range(n):
s, t, c = list(map(int, input().split()))
programs[c].append((s, t))
combined = []
for c, p in list(programs.items()):
p.sort()
ps, pt = p[0... | from collections import defaultdict
from itertools import accumulate
n, v = list(map(int, input().split()))
programs = defaultdict(list)
for _ in range(n):
s, t, c = list(map(int, input().split()))
programs[c].append((s, t))
imos = [0] * (2 * 10**5 + 2)
for c, p in list(programs.items()):
p.sort()
ps, ... | false | 20 | [
"-from heapq import heapreplace, heappush",
"+from itertools import accumulate",
"-combined = []",
"+imos = [0] * (2 * 10**5 + 2)",
"- combined.append((ps, pt, c))",
"+ imos[2 * ps - 1] += 1",
"+ imos[2 * pt + 1] -= 1",
"- combined.append((ps, pt, c))",
"-combined... | false | 0.043664 | 0.061666 | 0.708065 | [
"s483752909",
"s553585511"
] |
u968166680 | p02838 | python | s637199311 | s332411416 | 1,899 | 664 | 455,220 | 136,452 | Accepted | Accepted | 65.03 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
M = 61
for i, a in enumerate(A):
A[i] = list(map(int, str(format(a, 'b')).z... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
M = 61
C = [0] * M
for a in A:
a = str(format(a, 'b'))
for i,... | 42 | 32 | 911 | 584 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
M = 61
for i, a in enumerate(A):
A[i] = list(map(int, str(format(a, "b")).zfill(M)[::-1]))
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
M = 61
C = [0] * M
for a in A:
a = str(format(a, "b"))
for i, d in enumerate(re... | false | 23.809524 | [
"- for i, a in enumerate(A):",
"- A[i] = list(map(int, str(format(a, \"b\")).zfill(M)[::-1]))",
"- csum = [[0] * M for _ in range(N)]",
"- csum[0] = A[0]",
"- for i in range(1, N):",
"- for j in range(M):",
"- csum[i][j] = csum[i - 1][j] + A[i][j]",
"- p2 = [0] ... | false | 0.037762 | 0.044173 | 0.854872 | [
"s637199311",
"s332411416"
] |
u952708174 | p02755 | python | s873667031 | s460090906 | 254 | 17 | 2,940 | 3,060 | Accepted | Accepted | 93.31 | def c_tax_increase():
A, B = [int(i) for i in input().split()]
for k in range(1, 10**6):
t1 = 8 * k // 100
t2 = k // 10
if t1 > 0 and t2 > 0 and t1 == A and t2 == B:
return k
return -1
print((c_tax_increase())) | def c_tax_increase():
from math import floor, ceil
A, B = [int(i) for i in input().split()]
lower = ceil(max(25 * A / 2, 10 * B))
upper = floor(min(25 * (A + 1) / 2, 10 * (B + 1)))
return lower if lower < upper else -1
print((c_tax_increase())) | 10 | 8 | 266 | 270 | def c_tax_increase():
A, B = [int(i) for i in input().split()]
for k in range(1, 10**6):
t1 = 8 * k // 100
t2 = k // 10
if t1 > 0 and t2 > 0 and t1 == A and t2 == B:
return k
return -1
print((c_tax_increase()))
| def c_tax_increase():
from math import floor, ceil
A, B = [int(i) for i in input().split()]
lower = ceil(max(25 * A / 2, 10 * B))
upper = floor(min(25 * (A + 1) / 2, 10 * (B + 1)))
return lower if lower < upper else -1
print((c_tax_increase()))
| false | 20 | [
"+ from math import floor, ceil",
"+",
"- for k in range(1, 10**6):",
"- t1 = 8 * k // 100",
"- t2 = k // 10",
"- if t1 > 0 and t2 > 0 and t1 == A and t2 == B:",
"- return k",
"- return -1",
"+ lower = ceil(max(25 * A / 2, 10 * B))",
"+ upper = floor(... | false | 0.189248 | 0.037707 | 5.018924 | [
"s873667031",
"s460090906"
] |
u427344224 | p03714 | python | s023157116 | s016381671 | 481 | 441 | 37,212 | 40,340 | Accepted | Accepted | 8.32 | import heapq
N = int(eval(input()))
a_list = list(map(int, input().split()))
max_score = - float("inf")
red_list = a_list[:N]
blue_list = [-a for a in a_list[2 * N:]]
heapq.heapify(red_list)
heapq.heapify(blue_list)
red_sum = [sum(red_list)]
blue_sum = [sum(blue_list)]
for i in range(N, 2 * N):
h... | import heapq
N = int(eval(input()))
a_list = list(map(int, input().split()))
max_score = - float("inf")
red_list = a_list[:N]
blue_list = [-a for a in a_list[2 * N:]]
heapq.heapify(red_list)
heapq.heapify(blue_list)
red_sum = [sum(red_list)]
blue_sum = [sum(blue_list)]
for i in range(N, 2 * N):
h... | 29 | 29 | 790 | 753 | import heapq
N = int(eval(input()))
a_list = list(map(int, input().split()))
max_score = -float("inf")
red_list = a_list[:N]
blue_list = [-a for a in a_list[2 * N :]]
heapq.heapify(red_list)
heapq.heapify(blue_list)
red_sum = [sum(red_list)]
blue_sum = [sum(blue_list)]
for i in range(N, 2 * N):
heapq.heappush(red_... | import heapq
N = int(eval(input()))
a_list = list(map(int, input().split()))
max_score = -float("inf")
red_list = a_list[:N]
blue_list = [-a for a in a_list[2 * N :]]
heapq.heapify(red_list)
heapq.heapify(blue_list)
red_sum = [sum(red_list)]
blue_sum = [sum(blue_list)]
for i in range(N, 2 * N):
heapq.heappush(red_... | false | 0 | [
"- red_sum.append(max(red_sum[-1], red_sum[-1] + a_list[i] - item))",
"+ red_sum.append(red_sum[-1] + a_list[i] - item)",
"- blue_sum.append(max(blue_sum[-1], blue_sum[-1] - a_list[i] - item))",
"+ blue_sum.append(blue_sum[-1] - a_list[i] - item)"
] | false | 0.048275 | 0.047123 | 1.024454 | [
"s023157116",
"s016381671"
] |
u227082700 | p02973 | python | s420303772 | s874127275 | 246 | 188 | 7,068 | 16,848 | Accepted | Accepted | 23.58 | import bisect;n,a,l=int(eval(input())),[-int(eval(input()))],1
for i in range(n-1):
b=-int(eval(input()))
if a[-1]>b:a[bisect.bisect_right(a,b)]=b
else:a.append(b);l+=1
print(l) | n=int(eval(input()))
a=[int(eval(input()))for _ in range(n)]
dp=[2]*(n+1)
from bisect import bisect_left,bisect_right
for i in a:
dp[bisect_left(dp,-i+1)]=-i
print((dp.index(2))) | 6 | 7 | 170 | 172 | import bisect
n, a, l = int(eval(input())), [-int(eval(input()))], 1
for i in range(n - 1):
b = -int(eval(input()))
if a[-1] > b:
a[bisect.bisect_right(a, b)] = b
else:
a.append(b)
l += 1
print(l)
| n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
dp = [2] * (n + 1)
from bisect import bisect_left, bisect_right
for i in a:
dp[bisect_left(dp, -i + 1)] = -i
print((dp.index(2)))
| false | 14.285714 | [
"-import bisect",
"+n = int(eval(input()))",
"+a = [int(eval(input())) for _ in range(n)]",
"+dp = [2] * (n + 1)",
"+from bisect import bisect_left, bisect_right",
"-n, a, l = int(eval(input())), [-int(eval(input()))], 1",
"-for i in range(n - 1):",
"- b = -int(eval(input()))",
"- if a[-1] > b... | false | 0.039009 | 0.040545 | 0.962112 | [
"s420303772",
"s874127275"
] |
u426534722 | p02278 | python | s608344872 | s370895847 | 30 | 20 | 7,884 | 5,764 | Accepted | Accepted | 33.33 | MAX = 1000
VMAX = 10000
n = int(eval(input()))
A = [int(i) for i in input().split()]
V = [False] * MAX
def solve():
B = A[:]
T = [0] * (VMAX + 1)
B.sort()
ans = 0
s = min(VMAX, min(A))
for i in range(n):
T[B[i]] = i
for i in range(n):
if V[i] : continue
... | VMAX = 10000
n = int(eval(input()))
A = list(map(int, input().split()))
s = min(A)
def solve():
ans = 0
V = [False] * n
B = sorted(A)
T = [0] * (VMAX + 1)
for i in range(n):
T[B[i]] = i
for i in range(n):
if V[i]:
continue
cur = i
S = 0
... | 30 | 30 | 651 | 651 | MAX = 1000
VMAX = 10000
n = int(eval(input()))
A = [int(i) for i in input().split()]
V = [False] * MAX
def solve():
B = A[:]
T = [0] * (VMAX + 1)
B.sort()
ans = 0
s = min(VMAX, min(A))
for i in range(n):
T[B[i]] = i
for i in range(n):
if V[i]:
continue
c... | VMAX = 10000
n = int(eval(input()))
A = list(map(int, input().split()))
s = min(A)
def solve():
ans = 0
V = [False] * n
B = sorted(A)
T = [0] * (VMAX + 1)
for i in range(n):
T[B[i]] = i
for i in range(n):
if V[i]:
continue
cur = i
S = 0
m = V... | false | 0 | [
"-MAX = 1000",
"-A = [int(i) for i in input().split()]",
"-V = [False] * MAX",
"+A = list(map(int, input().split()))",
"+s = min(A)",
"- B = A[:]",
"+ ans = 0",
"+ V = [False] * n",
"+ B = sorted(A)",
"- B.sort()",
"- ans = 0",
"- s = min(VMAX, min(A))",
"- print(ans)... | false | 0.041111 | 0.057368 | 0.716624 | [
"s608344872",
"s370895847"
] |
u046592970 | p02996 | python | s030520646 | s620480323 | 1,029 | 938 | 55,264 | 55,268 | Accepted | Accepted | 8.84 | n = int(eval(input()))
lis = sorted([list(map(int,input().split())) for _ in range(n)], key = lambda z:z[1])
t = 0
ans = "Yes"
for i in lis:
t += i[0]
if t > i[1]:
ans = "No"
print(ans) | from operator import itemgetter
n = int(eval(input()))
lis =sorted([list(map(int,input().split())) for _ in range(n)], key = itemgetter(1))
t = 0
ans = "Yes"
for i in lis:
t += i[0]
if t > i[1]:
ans = "No"
print(ans) | 9 | 10 | 203 | 235 | n = int(eval(input()))
lis = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda z: z[1])
t = 0
ans = "Yes"
for i in lis:
t += i[0]
if t > i[1]:
ans = "No"
print(ans)
| from operator import itemgetter
n = int(eval(input()))
lis = sorted([list(map(int, input().split())) for _ in range(n)], key=itemgetter(1))
t = 0
ans = "Yes"
for i in lis:
t += i[0]
if t > i[1]:
ans = "No"
print(ans)
| false | 10 | [
"+from operator import itemgetter",
"+",
"-lis = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda z: z[1])",
"+lis = sorted([list(map(int, input().split())) for _ in range(n)], key=itemgetter(1))"
] | false | 0.037646 | 0.062204 | 0.605213 | [
"s030520646",
"s620480323"
] |
u879309973 | p02852 | python | s687983353 | s016506926 | 121 | 93 | 11,244 | 11,228 | Accepted | Accepted | 23.14 | def solve(n, m, s):
cnt = 0
for i in range(1, n+1):
if (s[i-1] == "0") and (s[i] == "1"):
cnt = 1
elif (s[i-1] == "1") and (s[i] == "1"):
cnt += 1
if cnt >= m:
return -1
s = s[::-1]
i = 0
path = []
while i < n:
for ... | def solve(n, m, s):
if s.find("1"*m) >= 0:
return -1
s = s[::-1]
i = 0
path = []
while i < n:
for j in range(min(m, n-i), 0, -1):
ni = i+j
if s[ni] == "0":
i = ni
path.append(j)
break
return " ".... | 24 | 18 | 597 | 419 | def solve(n, m, s):
cnt = 0
for i in range(1, n + 1):
if (s[i - 1] == "0") and (s[i] == "1"):
cnt = 1
elif (s[i - 1] == "1") and (s[i] == "1"):
cnt += 1
if cnt >= m:
return -1
s = s[::-1]
i = 0
path = []
while i < n:
for j in ra... | def solve(n, m, s):
if s.find("1" * m) >= 0:
return -1
s = s[::-1]
i = 0
path = []
while i < n:
for j in range(min(m, n - i), 0, -1):
ni = i + j
if s[ni] == "0":
i = ni
path.append(j)
break
return " ".join(ma... | false | 25 | [
"- cnt = 0",
"- for i in range(1, n + 1):",
"- if (s[i - 1] == \"0\") and (s[i] == \"1\"):",
"- cnt = 1",
"- elif (s[i - 1] == \"1\") and (s[i] == \"1\"):",
"- cnt += 1",
"- if cnt >= m:",
"- return -1",
"+ if s.find(\"1\" * m) >= 0:",
... | false | 0.046138 | 0.116475 | 0.396122 | [
"s687983353",
"s016506926"
] |
u289876798 | p03457 | python | s328507229 | s759587795 | 374 | 327 | 11,816 | 3,188 | Accepted | Accepted | 12.57 | #! env python
# -*- coding: utf-8 -*-
import os
import sys
# at_coder.ABC086C_Traveling
# Date: 2019/06/02
# Filename: ABC086C_Traveling
__author__ = 'acto_mini'
__date__ = "2019/06/02"
def main():
# 作業ディレクトリを自身のファイルのディレクトリに変更
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
... | #! env python
# -*- coding: utf-8 -*-
import os
import sys
# ac_py.main.py
# Date: 2020/06/08
# Filename: main.py
__author__ = 'acto_mini'
__date__ = "2020/06/08"
def main():
n = int(eval(input()))
t_prev = 0
x_prev = 0
y_prev = 0
for i in range(n):
t, x, y = list(m... | 48 | 34 | 889 | 623 | #! env python
# -*- coding: utf-8 -*-
import os
import sys
# at_coder.ABC086C_Traveling
# Date: 2019/06/02
# Filename: ABC086C_Traveling
__author__ = "acto_mini"
__date__ = "2019/06/02"
def main():
# 作業ディレクトリを自身のファイルのディレクトリに変更
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
t, x, y = [0], [0], [0... | #! env python
# -*- coding: utf-8 -*-
import os
import sys
# ac_py.main.py
# Date: 2020/06/08
# Filename: main.py
__author__ = "acto_mini"
__date__ = "2020/06/08"
def main():
n = int(eval(input()))
t_prev = 0
x_prev = 0
y_prev = 0
for i in range(n):
t, x, y = list(map(int, input().split()... | false | 29.166667 | [
"-# at_coder.ABC086C_Traveling",
"-# Date: 2019/06/02",
"-# Filename: ABC086C_Traveling",
"+# ac_py.main.py",
"+# Date: 2020/06/08",
"+# Filename: main.py",
"-__date__ = \"2019/06/02\"",
"+__date__ = \"2020/06/08\"",
"- # 作業ディレクトリを自身のファイルのディレクトリに変更",
"- os.chdir(os.path.dirname(os.path.abspa... | false | 0.045517 | 0.045067 | 1.009981 | [
"s328507229",
"s759587795"
] |
u077025302 | p03363 | python | s204070134 | s765589368 | 234 | 207 | 26,136 | 41,196 | Accepted | Accepted | 11.54 | n = int(eval(input()))
a = list(map(int,input().split()))
list_S = [0]
ans = 0
for i in range(n):
list_S.append(list_S[i] + a[i])
list_S.sort() # 昇順に並び替え 計算量はO(NlogN)
pre = list_S[0] # 前の数字
acc = 1 # 今まで何個同じ数字が連続したか
for i in range(1,n+1): # i番目の数字を見る.ちなみに0番目の数字は上2行でもう見た
if list_S[i] == pre: # 今見ている数... | n = int(eval(input()))
a = list(map(int,input().split()))
list_S = [0]
ans = 0
for i in range(n):
list_S.append(list_S[i] + a[i])
dict_S = {}
for i in list_S:
if i in dict_S:
dict_S[i] += 1
else:
dict_S[i] = 1
for v in list(dict_S.values()):
ans += v * (v-1) // 2
prin... | 22 | 18 | 564 | 314 | n = int(eval(input()))
a = list(map(int, input().split()))
list_S = [0]
ans = 0
for i in range(n):
list_S.append(list_S[i] + a[i])
list_S.sort() # 昇順に並び替え 計算量はO(NlogN)
pre = list_S[0] # 前の数字
acc = 1 # 今まで何個同じ数字が連続したか
for i in range(1, n + 1): # i番目の数字を見る.ちなみに0番目の数字は上2行でもう見た
if list_S[i] == pre: # 今見ている数字が前... | n = int(eval(input()))
a = list(map(int, input().split()))
list_S = [0]
ans = 0
for i in range(n):
list_S.append(list_S[i] + a[i])
dict_S = {}
for i in list_S:
if i in dict_S:
dict_S[i] += 1
else:
dict_S[i] = 1
for v in list(dict_S.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 18.181818 | [
"-list_S.sort() # 昇順に並び替え 計算量はO(NlogN)",
"-pre = list_S[0] # 前の数字",
"-acc = 1 # 今まで何個同じ数字が連続したか",
"-for i in range(1, n + 1): # i番目の数字を見る.ちなみに0番目の数字は上2行でもう見た",
"- if list_S[i] == pre: # 今見ている数字が前の数字と同じなら,accに1加算",
"- acc += 1",
"- else: # 違うなら,ansに(acc個の中から2個選ぶ場合の数)を加算",
"- a... | false | 0.105142 | 0.046125 | 2.279503 | [
"s204070134",
"s765589368"
] |
u597374218 | p02959 | python | s126351596 | s858030929 | 180 | 163 | 18,476 | 19,116 | Accepted | Accepted | 9.44 | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
count+=min(A[i],B[i])
if A[i]<B[i]:
if A[i+1]<B[i]-A[i]:
count+=A[i+1]
A[i+1]=0
else:
count+=B[i]-A[i]
A[i+1]-=B[i]-A[i]
... | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i,b in enumerate(B):
attack=min(b,A[i]+A[i+1])
count+=attack
A[i+1]-=max(0,attack-A[i])
print(count) | 14 | 9 | 326 | 213 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
for i in range(N):
count += min(A[i], B[i])
if A[i] < B[i]:
if A[i + 1] < B[i] - A[i]:
count += A[i + 1]
A[i + 1] = 0
else:
count += B[i] - A[i]
... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
for i, b in enumerate(B):
attack = min(b, A[i] + A[i + 1])
count += attack
A[i + 1] -= max(0, attack - A[i])
print(count)
| false | 35.714286 | [
"-for i in range(N):",
"- count += min(A[i], B[i])",
"- if A[i] < B[i]:",
"- if A[i + 1] < B[i] - A[i]:",
"- count += A[i + 1]",
"- A[i + 1] = 0",
"- else:",
"- count += B[i] - A[i]",
"- A[i + 1] -= B[i] - A[i]",
"+for i, b in enumera... | false | 0.043755 | 0.076591 | 0.571283 | [
"s126351596",
"s858030929"
] |
u002459665 | p02756 | python | s680105934 | s526928341 | 645 | 481 | 26,288 | 44,644 | Accepted | Accepted | 25.43 | S = eval(input())
Q = int(eval(input()))
QUERY = []
for i in range(Q):
# q = list(map(int, input().split()))
q = input().split()
if q[0] == '1':
QUERY.append([int(q[0])])
else:
QUERY.append([int(q[0]), int(q[1]), q[2]])
st = []
en = []
rev = False
rev_c = 0
for q in QUERY... | S = eval(input())
Q = int(eval(input()))
QUERY = []
for i in range(Q):
q = input().split()
QUERY.append(q)
from collections import deque
l = deque(list(S))
# print(l)
rev = 0
for qi in QUERY:
if qi[0] == '1':
rev += 1
else:
if rev % 2 == 0:
if qi[1] == '1... | 48 | 35 | 884 | 632 | S = eval(input())
Q = int(eval(input()))
QUERY = []
for i in range(Q):
# q = list(map(int, input().split()))
q = input().split()
if q[0] == "1":
QUERY.append([int(q[0])])
else:
QUERY.append([int(q[0]), int(q[1]), q[2]])
st = []
en = []
rev = False
rev_c = 0
for q in QUERY:
if q[0] ==... | S = eval(input())
Q = int(eval(input()))
QUERY = []
for i in range(Q):
q = input().split()
QUERY.append(q)
from collections import deque
l = deque(list(S))
# print(l)
rev = 0
for qi in QUERY:
if qi[0] == "1":
rev += 1
else:
if rev % 2 == 0:
if qi[1] == "1":
l... | false | 27.083333 | [
"- # q = list(map(int, input().split()))",
"- if q[0] == \"1\":",
"- QUERY.append([int(q[0])])",
"+ QUERY.append(q)",
"+from collections import deque",
"+",
"+l = deque(list(S))",
"+# print(l)",
"+rev = 0",
"+for qi in QUERY:",
"+ if qi[0] == \"1\":",
"+ rev += 1",
... | false | 0.044285 | 0.036759 | 1.204738 | [
"s680105934",
"s526928341"
] |
u914361753 | p03494 | python | s310452069 | s080981837 | 251 | 11 | 17,012 | 2,568 | Accepted | Accepted | 95.62 | import numpy as np
def IntLog2(N):
k = 0
while N%2 == 0:
k += 1
N /= 2
return k
N = input()
inputArray = list(map(int, input().split()))
Log2_inputArray = [IntLog2(n) for n in inputArray]
print(min(Log2_inputArray)) | def SolveABC081B(array):
print(max(j for j in range(32) if all(i % 2**j == 0 for i in array)))
eval(input())
inputArray = list(map(int, input().split()))
SolveABC081B(inputArray) | 12 | 6 | 256 | 183 | import numpy as np
def IntLog2(N):
k = 0
while N % 2 == 0:
k += 1
N /= 2
return k
N = input()
inputArray = list(map(int, input().split()))
Log2_inputArray = [IntLog2(n) for n in inputArray]
print(min(Log2_inputArray))
| def SolveABC081B(array):
print(max(j for j in range(32) if all(i % 2**j == 0 for i in array)))
eval(input())
inputArray = list(map(int, input().split()))
SolveABC081B(inputArray)
| false | 50 | [
"-import numpy as np",
"+def SolveABC081B(array):",
"+ print(max(j for j in range(32) if all(i % 2**j == 0 for i in array)))",
"-def IntLog2(N):",
"- k = 0",
"- while N % 2 == 0:",
"- k += 1",
"- N /= 2",
"- return k",
"-",
"-",
"-N = input()",
"+eval(input())",
"... | false | 0.084427 | 0.036585 | 2.307694 | [
"s310452069",
"s080981837"
] |
u443512298 | p03944 | python | s865489152 | s649255609 | 24 | 22 | 3,064 | 3,064 | Accepted | Accepted | 8.33 | # coding: utf-8
"""Snuke's Coloring 2 (ABC Edit)
@author: hijiri.n
@modified: 11-19-2016
"""
def data(): return list(map(int, input().split()))
def solve(init, point):
w, h, N = init
rect = [0, w, 0, h]
for p in point:
x, y, a = p
if [1, -1][a % 2] * ([x, y][a > 2] -... | # coding: utf-8
"""Snuke's Coloring 2 (ABC Edit)
@author: hijiri.n
@modified: 11-19-2016
"""
def data(): return list(map(int, input().split()))
def solve(init, point):
w, h, N = init
rect = [0, w, 0, h]
for p in point:
x, y, a = p
rect[a - 1] = [min, max][a % ... | 30 | 29 | 650 | 607 | # coding: utf-8
"""Snuke's Coloring 2 (ABC Edit)
@author: hijiri.n
@modified: 11-19-2016
"""
def data():
return list(map(int, input().split()))
def solve(init, point):
w, h, N = init
rect = [0, w, 0, h]
for p in point:
x, y, a = p
if [1, -1][a % 2] * ([x, y][a > 2] - rect[a - 1]) < 0... | # coding: utf-8
"""Snuke's Coloring 2 (ABC Edit)
@author: hijiri.n
@modified: 11-19-2016
"""
def data():
return list(map(int, input().split()))
def solve(init, point):
w, h, N = init
rect = [0, w, 0, h]
for p in point:
x, y, a = p
rect[a - 1] = [min, max][a % 2](rect[a - 1], [x, y][a... | false | 3.333333 | [
"- if [1, -1][a % 2] * ([x, y][a > 2] - rect[a - 1]) < 0:",
"- rect[a - 1] = [x, y][a > 2]",
"- if (rect[1] <= rect[0]) if a <= 2 else (rect[3] <= rect[2]):",
"+ rect[a - 1] = [min, max][a % 2](rect[a - 1], [x, y][a > 2])",
"+ if rect[1] <= rect[0] or rect[3] <= rect[2... | false | 0.04889 | 0.113 | 0.432658 | [
"s865489152",
"s649255609"
] |
u729133443 | p03266 | python | s674238835 | s077694581 | 169 | 17 | 40,048 | 2,940 | Accepted | Accepted | 89.94 | n,k=list(map(int,input().split()))
m=[0]*k
for i in range(1,n+1):m[i%k]+=1
print((m[0]**3+[m[k//2]**3,0][k%2])) | n,k=list(map(int,input().split()));print(((n//k)**3+[((n-k//2)//k+1)**3,0][k%2])) | 4 | 1 | 106 | 73 | n, k = list(map(int, input().split()))
m = [0] * k
for i in range(1, n + 1):
m[i % k] += 1
print((m[0] ** 3 + [m[k // 2] ** 3, 0][k % 2]))
| n, k = list(map(int, input().split()))
print(((n // k) ** 3 + [((n - k // 2) // k + 1) ** 3, 0][k % 2]))
| false | 75 | [
"-m = [0] * k",
"-for i in range(1, n + 1):",
"- m[i % k] += 1",
"-print((m[0] ** 3 + [m[k // 2] ** 3, 0][k % 2]))",
"+print(((n // k) ** 3 + [((n - k // 2) // k + 1) ** 3, 0][k % 2]))"
] | false | 0.082571 | 0.045407 | 1.818489 | [
"s674238835",
"s077694581"
] |
u347203174 | p03829 | python | s846763478 | s880158870 | 95 | 84 | 85,040 | 85,464 | Accepted | Accepted | 11.58 | N, A, B = list(map(int, input().split()))
town = list(map(int, input().split()))
diff = [0]*(N+1)
for i in range(1, N):
diff[i] = town[i] - town[i-1]
sumz = 0
for i in range(1, N+1):
if diff[i]*A > B:
sumz += B
else:
sumz += diff[i]*A
print(sumz)
| N, A, B = list(map(int, input().split()))
num = list(map(int, input().split()))
ans = 0
for i in range(1, N):
d = num[i] - num[i-1]
if d*A < B:
ans += d*A
else:
ans += B
print(ans)
| 15 | 12 | 286 | 215 | N, A, B = list(map(int, input().split()))
town = list(map(int, input().split()))
diff = [0] * (N + 1)
for i in range(1, N):
diff[i] = town[i] - town[i - 1]
sumz = 0
for i in range(1, N + 1):
if diff[i] * A > B:
sumz += B
else:
sumz += diff[i] * A
print(sumz)
| N, A, B = list(map(int, input().split()))
num = list(map(int, input().split()))
ans = 0
for i in range(1, N):
d = num[i] - num[i - 1]
if d * A < B:
ans += d * A
else:
ans += B
print(ans)
| false | 20 | [
"-town = list(map(int, input().split()))",
"-diff = [0] * (N + 1)",
"+num = list(map(int, input().split()))",
"+ans = 0",
"- diff[i] = town[i] - town[i - 1]",
"-sumz = 0",
"-for i in range(1, N + 1):",
"- if diff[i] * A > B:",
"- sumz += B",
"+ d = num[i] - num[i - 1]",
"+ if ... | false | 0.06808 | 0.113178 | 0.601531 | [
"s846763478",
"s880158870"
] |
u203843959 | p02983 | python | s319876975 | s878638227 | 842 | 684 | 3,064 | 3,064 | Accepted | Accepted | 18.76 | import sys
L,R=list(map(int,input().split()))
if R-L>2017:
print((0))
sys.exit()
L%=2019
while(R-L>2019):
R-=2019
#print(L,R)
answer=10**10
for i in range(L,R):
for j in range(i+1,R+1):
answer=min(answer,(i*j)%2019)
print(answer) | L,R=list(map(int,input().split()))
if L//2019 != R//2019:
print((0))
else:
L%=2019
R%=2019
answer=10**10
for i in range(L,R):
for j in range(i+1,R+1):
answer=min(answer,(i*j)%2019)
print(answer) | 18 | 14 | 260 | 232 | import sys
L, R = list(map(int, input().split()))
if R - L > 2017:
print((0))
sys.exit()
L %= 2019
while R - L > 2019:
R -= 2019
# print(L,R)
answer = 10**10
for i in range(L, R):
for j in range(i + 1, R + 1):
answer = min(answer, (i * j) % 2019)
print(answer)
| L, R = list(map(int, input().split()))
if L // 2019 != R // 2019:
print((0))
else:
L %= 2019
R %= 2019
answer = 10**10
for i in range(L, R):
for j in range(i + 1, R + 1):
answer = min(answer, (i * j) % 2019)
print(answer)
| false | 22.222222 | [
"-import sys",
"-",
"-if R - L > 2017:",
"+if L // 2019 != R // 2019:",
"- sys.exit()",
"-L %= 2019",
"-while R - L > 2019:",
"- R -= 2019",
"-# print(L,R)",
"-answer = 10**10",
"-for i in range(L, R):",
"- for j in range(i + 1, R + 1):",
"- answer = min(answer, (i * j) % 201... | false | 0.048074 | 0.043642 | 1.101555 | [
"s319876975",
"s878638227"
] |
u014333473 | p04043 | python | s644653229 | s636538587 | 27 | 24 | 9,068 | 8,908 | Accepted | Accepted | 11.11 | a,b,c=list(map(int,input().split()));print((['NO','YES'][max(a,b,c)==7 and (a+b+c)-max(a,b,c)==10])) | a=input().replace('5','');print(('NYOE S'[a.count('7')==1::2])) | 1 | 1 | 92 | 61 | a, b, c = list(map(int, input().split()))
print((["NO", "YES"][max(a, b, c) == 7 and (a + b + c) - max(a, b, c) == 10]))
| a = input().replace("5", "")
print(("NYOE S"[a.count("7") == 1 :: 2]))
| false | 0 | [
"-a, b, c = list(map(int, input().split()))",
"-print(([\"NO\", \"YES\"][max(a, b, c) == 7 and (a + b + c) - max(a, b, c) == 10]))",
"+a = input().replace(\"5\", \"\")",
"+print((\"NYOE S\"[a.count(\"7\") == 1 :: 2]))"
] | false | 0.041731 | 0.040699 | 1.025359 | [
"s644653229",
"s636538587"
] |
u476383383 | p02995 | python | s190848365 | s639235193 | 35 | 17 | 5,048 | 3,060 | Accepted | Accepted | 51.43 | from fractions import gcd
a, b, c, d = list(map(int, input().split()))
lcm = c*d // gcd(c,d)
def calc(x):
return x-(x//c)-(x//d)+(x//lcm)
print((calc(b)-calc(a-1))) | import sys
input = sys.stdin.readline
a, b, c, d = list(map(int, input().split()))
def gcd(a,b):
while b:
a, b = b, a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
def calc(x):
return x-(x//c)-(x//d)+(x//lcm(c,d))
print((calc(b)-calc(a-1))) | 9 | 16 | 171 | 275 | from fractions import gcd
a, b, c, d = list(map(int, input().split()))
lcm = c * d // gcd(c, d)
def calc(x):
return x - (x // c) - (x // d) + (x // lcm)
print((calc(b) - calc(a - 1)))
| import sys
input = sys.stdin.readline
a, b, c, d = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def calc(x):
return x - (x // c) - (x // d) + (x // lcm(c, d))
print((calc(b) - calc(a - 1)))
| false | 43.75 | [
"-from fractions import gcd",
"+import sys",
"+input = sys.stdin.readline",
"-lcm = c * d // gcd(c, d)",
"+",
"+",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+def lcm(a, b):",
"+ return a * b // gcd(a, b)",
"- return x - (x // c) - (... | false | 0.047655 | 0.044034 | 1.082237 | [
"s190848365",
"s639235193"
] |
u155236040 | p03804 | python | s996162472 | s988373982 | 21 | 19 | 3,064 | 3,064 | Accepted | Accepted | 9.52 | n,m = list(map(int,input().split()))
a_list = [eval(input()) for _ in range(n)]
b_list = [eval(input()) for _ in range(m)]
count = 0
res = []
for i in range(n-m+1):
for j in range(n-m+1):
f = True
for k in range(m):
for l in range(m):
if a_list[i+k][j+l] != b_li... | n,m = list(map(int,input().split()))
a_list = [eval(input()) for _ in range(n)]
b_list = [eval(input()) for _ in range(m)]
for i in range(n-m+1):
for j in range(n-m+1):
f = True
for k in range(m):
for l in range(m):
if a_list[i+k][j+l] != b_list[k][l]:
... | 19 | 17 | 489 | 468 | n, m = list(map(int, input().split()))
a_list = [eval(input()) for _ in range(n)]
b_list = [eval(input()) for _ in range(m)]
count = 0
res = []
for i in range(n - m + 1):
for j in range(n - m + 1):
f = True
for k in range(m):
for l in range(m):
if a_list[i + k][j + l] != ... | n, m = list(map(int, input().split()))
a_list = [eval(input()) for _ in range(n)]
b_list = [eval(input()) for _ in range(m)]
for i in range(n - m + 1):
for j in range(n - m + 1):
f = True
for k in range(m):
for l in range(m):
if a_list[i + k][j + l] != b_list[k][l]:
... | false | 10.526316 | [
"-count = 0",
"-res = []"
] | false | 0.032768 | 0.036122 | 0.907165 | [
"s996162472",
"s988373982"
] |
u263830634 | p03610 | python | s234819152 | s672502465 | 71 | 34 | 5,292 | 6,048 | Accepted | Accepted | 52.11 | s = list(input())
for i in range(0, len(s), 2):
print (s[i], end='')
print ()
| import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
S = list(input())
print (*S[::2], sep = '')
| 5 | 8 | 87 | 141 | s = list(input())
for i in range(0, len(s), 2):
print(s[i], end="")
print()
| import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
S = list(input())
print(*S[::2], sep="")
| false | 37.5 | [
"-s = list(input())",
"-for i in range(0, len(s), 2):",
"- print(s[i], end=\"\")",
"-print()",
"+import sys",
"+",
"+# input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"+S = list(input())",
"+print(*S[::2], sep=\"\")"
] | false | 0.07821 | 0.042685 | 1.832267 | [
"s234819152",
"s672502465"
] |
u055875839 | p03434 | python | s116734728 | s561536293 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | num = int(eval(input()))
cards = sorted(list(map(int, input().split())), reverse = True)
alice = 0
bob = 0
for i in range(num):
if i//2*2 == i:
alice += cards[i]
else:
bob += cards[i]
print((alice - bob)) | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A, reverse = True)
dif = sum(A[0::2]) - sum(A[1::2])
print(dif) | 12 | 5 | 221 | 131 | num = int(eval(input()))
cards = sorted(list(map(int, input().split())), reverse=True)
alice = 0
bob = 0
for i in range(num):
if i // 2 * 2 == i:
alice += cards[i]
else:
bob += cards[i]
print((alice - bob))
| N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
dif = sum(A[0::2]) - sum(A[1::2])
print(dif)
| false | 58.333333 | [
"-num = int(eval(input()))",
"-cards = sorted(list(map(int, input().split())), reverse=True)",
"-alice = 0",
"-bob = 0",
"-for i in range(num):",
"- if i // 2 * 2 == i:",
"- alice += cards[i]",
"- else:",
"- bob += cards[i]",
"-print((alice - bob))",
"+N = int(eval(input()))"... | false | 0.067379 | 0.066108 | 1.019224 | [
"s116734728",
"s561536293"
] |
u249372595 | p03087 | python | s454372280 | s169705671 | 450 | 242 | 18,068 | 88,532 | Accepted | Accepted | 46.22 | N,Q = list(map(int,input().split()))
S = eval(input())
left=[]
right=[]
for _ in range(Q):
l,r = list(map(int,input().split()))
left.append(l)
right.append(r)
a = [0]*N
for i in range(1,N):
if S[i] == "C" and S[i-1] == "A":
a[i] = a[i-1] + 1
else:
a[i] = a[i-1]
#print(a)
ans = []
f... | N,Q = list(map(int,input().split()))
S = eval(input())
L = []
R = []
for i in range(Q):
l,r=list(map(int,input().split()))
L.append(l)
R.append(r)
dp = [0]*N
for j in range(N-1):
if S[j]=='A' and S[j+1]=='C':
dp[j+1] = dp[j]+1
else:
dp[j+1] = dp[j]
for k in range(Q):
print((dp[R[k... | 23 | 18 | 392 | 329 | N, Q = list(map(int, input().split()))
S = eval(input())
left = []
right = []
for _ in range(Q):
l, r = list(map(int, input().split()))
left.append(l)
right.append(r)
a = [0] * N
for i in range(1, N):
if S[i] == "C" and S[i - 1] == "A":
a[i] = a[i - 1] + 1
else:
a[i] = a[i - 1]
# pri... | N, Q = list(map(int, input().split()))
S = eval(input())
L = []
R = []
for i in range(Q):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
dp = [0] * N
for j in range(N - 1):
if S[j] == "A" and S[j + 1] == "C":
dp[j + 1] = dp[j] + 1
else:
dp[j + 1] = dp[j]
for k in rang... | false | 21.73913 | [
"-left = []",
"-right = []",
"-for _ in range(Q):",
"+L = []",
"+R = []",
"+for i in range(Q):",
"- left.append(l)",
"- right.append(r)",
"-a = [0] * N",
"-for i in range(1, N):",
"- if S[i] == \"C\" and S[i - 1] == \"A\":",
"- a[i] = a[i - 1] + 1",
"+ L.append(l)",
"+ ... | false | 0.043682 | 0.038734 | 1.127735 | [
"s454372280",
"s169705671"
] |
u332385682 | p03703 | python | s806346722 | s333516064 | 1,322 | 1,201 | 52,216 | 24,548 | Accepted | Accepted | 9.15 | import sys
from itertools import accumulate
def solve():
n, k = list(map(int, sys.stdin.readline().split()))
a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]
s = [0] + list(accumulate(a))
# 座標圧縮
s = [(si, i) for (i, si) in enumerate(s)]
s.sort()
z = [None] * (n +... | import sys
from itertools import accumulate
inf = 1<<60
ans = 0
def solve():
n, k = list(map(int, sys.stdin.readline().split()))
a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]
s = [0] + list(accumulate(a))
MergeSort(s)
print(ans)
def MergeSort(a):
if len(a) =... | 58 | 52 | 1,070 | 883 | import sys
from itertools import accumulate
def solve():
n, k = list(map(int, sys.stdin.readline().split()))
a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]
s = [0] + list(accumulate(a))
# 座標圧縮
s = [(si, i) for (i, si) in enumerate(s)]
s.sort()
z = [None] * (n + 1)
num =... | import sys
from itertools import accumulate
inf = 1 << 60
ans = 0
def solve():
n, k = list(map(int, sys.stdin.readline().split()))
a = [int(sys.stdin.readline().rstrip()) - k for i in range(n)]
s = [0] + list(accumulate(a))
MergeSort(s)
print(ans)
def MergeSort(a):
if len(a) == 1:
r... | false | 10.344828 | [
"+",
"+inf = 1 << 60",
"+ans = 0",
"- # 座標圧縮",
"- s = [(si, i) for (i, si) in enumerate(s)]",
"- s.sort()",
"- z = [None] * (n + 1)",
"- num = -1",
"- p = -float(\"inf\")",
"- for i in range(n + 1):",
"- if s[i][0] > p:",
"- num += 1",
"- z[s[i][... | false | 0.04182 | 0.040962 | 1.020953 | [
"s806346722",
"s333516064"
] |
u517724953 | p02761 | python | s534414801 | s776633474 | 190 | 162 | 38,256 | 38,384 | Accepted | Accepted | 14.74 | n, m = map(int, input().split())
ans = [-1]*n
for i in range(m):
s, c = map(int, input().split())
if s == 1 and c == 0 and n != 1:
print(-1)
exit()
if ans[s-1] == -1 or ans[s-1] == c:
ans[s-1] = c
else:
print(-1)
exit()
if ans[0] == -1 and n != 1:
... | n, m = map(int, input().split())
ans = [-1]*n
if n == 1 and m == 0:
print(0)
exit()
for i in range(m):
s, c = map(int, input().split())
if s == 1 and c == 0 and n != 1:
print(-1)
exit()
if ans[s-1] == -1 or ans[s-1] == c:
ans[s-1] = c
else:
pr... | 22 | 28 | 423 | 467 | n, m = map(int, input().split())
ans = [-1] * n
for i in range(m):
s, c = map(int, input().split())
if s == 1 and c == 0 and n != 1:
print(-1)
exit()
if ans[s - 1] == -1 or ans[s - 1] == c:
ans[s - 1] = c
else:
print(-1)
exit()
if ans[0] == -1 and n != 1:
ans[... | n, m = map(int, input().split())
ans = [-1] * n
if n == 1 and m == 0:
print(0)
exit()
for i in range(m):
s, c = map(int, input().split())
if s == 1 and c == 0 and n != 1:
print(-1)
exit()
if ans[s - 1] == -1 or ans[s - 1] == c:
ans[s - 1] = c
else:
print(-1)
... | false | 21.428571 | [
"+if n == 1 and m == 0:",
"+ print(0)",
"+ exit()",
"-if ans[0] == -1 and n != 1:",
"+if ans[0] == -1:"
] | false | 0.043843 | 0.109124 | 0.401774 | [
"s534414801",
"s776633474"
] |
u941407962 | p02844 | python | s901783168 | s868569810 | 506 | 61 | 41,052 | 3,572 | Accepted | Accepted | 87.94 | n = int(eval(input()))
S = str(eval(input()))
r = 0
for i in range(1000):
t = "{0:03d}".format(i)
j = 0
for c in S:
if t[j] == c:
j += 1
if j == 3:
r += 1
break
print(r)
| n,S,r=int(eval(input())),eval(input()),0
dp1=[0]*n
dp2=[0]*n
d=set()
for i, c in enumerate(S):
dp1[i] = len(d)
d.add(c)
cs = [0 for i in range(10)]
d=set()
for i, c in enumerate(S[::-1]):
dp2[i] = len(d)
r += dp1[n-i-1]*(dp2[i]-dp2[cs[int(c)]])
d.add(c)
cs[int(c)] = i
print(r)
| 13 | 16 | 234 | 306 | n = int(eval(input()))
S = str(eval(input()))
r = 0
for i in range(1000):
t = "{0:03d}".format(i)
j = 0
for c in S:
if t[j] == c:
j += 1
if j == 3:
r += 1
break
print(r)
| n, S, r = int(eval(input())), eval(input()), 0
dp1 = [0] * n
dp2 = [0] * n
d = set()
for i, c in enumerate(S):
dp1[i] = len(d)
d.add(c)
cs = [0 for i in range(10)]
d = set()
for i, c in enumerate(S[::-1]):
dp2[i] = len(d)
r += dp1[n - i - 1] * (dp2[i] - dp2[cs[int(c)]])
d.add(c)
cs[int(c)] = i
p... | false | 18.75 | [
"-n = int(eval(input()))",
"-S = str(eval(input()))",
"-r = 0",
"-for i in range(1000):",
"- t = \"{0:03d}\".format(i)",
"- j = 0",
"- for c in S:",
"- if t[j] == c:",
"- j += 1",
"- if j == 3:",
"- r += 1",
"- break",
"+n, S, r = int(e... | false | 0.039289 | 0.079511 | 0.494136 | [
"s901783168",
"s868569810"
] |
u499259667 | p03844 | python | s391893464 | s838870777 | 17 | 12 | 2,940 | 2,572 | Accepted | Accepted | 29.41 | A,op,B=input().split()
A,B=list(map(int,[A,B]))
print((A+B if op=="+" else A-B)) | print((eval(input()))) | 3 | 1 | 74 | 14 | A, op, B = input().split()
A, B = list(map(int, [A, B]))
print((A + B if op == "+" else A - B))
| print((eval(input())))
| false | 66.666667 | [
"-A, op, B = input().split()",
"-A, B = list(map(int, [A, B]))",
"-print((A + B if op == \"+\" else A - B))",
"+print((eval(input())))"
] | false | 0.037664 | 0.062402 | 0.603566 | [
"s391893464",
"s838870777"
] |
u485319545 | p02572 | python | s314354163 | s067437801 | 1,645 | 152 | 42,456 | 31,476 | Accepted | Accepted | 90.76 | n=int(eval(input()))
a=list(map(int,input().split()))
mod=10**9+7
import numpy as np
cum=[]
prev=0
for i in range(n):
tmp = prev%mod +a[i]%mod
cum.append(tmp)
prev = cum[-1]
ans=0
for i in range(n-1):
p=a[i]
t = cum[-1] - cum[i]
ans+=(p*t)%mod
print((ans%mod)) | n=int(eval(input()))
a=list(map(int,input().split()))
mod=10**9+7
total = sum(a)
cum=[]
ans=0
for i in range(n):
total-=a[i]
ans += a[i]*(total)%mod
print((ans%mod)) | 23 | 14 | 305 | 186 | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
import numpy as np
cum = []
prev = 0
for i in range(n):
tmp = prev % mod + a[i] % mod
cum.append(tmp)
prev = cum[-1]
ans = 0
for i in range(n - 1):
p = a[i]
t = cum[-1] - cum[i]
ans += (p * t) % mod
print((ans % mod))
| n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
total = sum(a)
cum = []
ans = 0
for i in range(n):
total -= a[i]
ans += a[i] * (total) % mod
print((ans % mod))
| false | 39.130435 | [
"-import numpy as np",
"-",
"+total = sum(a)",
"-prev = 0",
"+ans = 0",
"- tmp = prev % mod + a[i] % mod",
"- cum.append(tmp)",
"- prev = cum[-1]",
"-ans = 0",
"-for i in range(n - 1):",
"- p = a[i]",
"- t = cum[-1] - cum[i]",
"- ans += (p * t) % mod",
"+ total -= a[i]... | false | 0.03638 | 0.035572 | 1.02272 | [
"s314354163",
"s067437801"
] |
u535803878 | p02762 | python | s617953945 | s723019839 | 1,453 | 472 | 108,548 | 115,400 | Accepted | Accepted | 67.52 |
from collections import defaultdict
n, m, k = list(map(int, input().split()))
ns = defaultdict(set)
bs = defaultdict(set)
for i in range(m):
a,b = list(map(int, input().split()))
ns[a-1].add(b-1)
ns[b-1].add(a-1)
for i in range(k):
c,d = list(map(int, input().split()))
bs[c-1].add(d-1)... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n,m,k = list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.n = n
self.parent = list(range(n))
self.size = [1... | 42 | 60 | 998 | 1,452 | from collections import defaultdict
n, m, k = list(map(int, input().split()))
ns = defaultdict(set)
bs = defaultdict(set)
for i in range(m):
a, b = list(map(int, input().split()))
ns[a - 1].add(b - 1)
ns[b - 1].add(a - 1)
for i in range(k):
c, d = list(map(int, input().split()))
bs[c - 1].add(d - 1... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, m, k = list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.n = n
self.parent = list(range(n))
self.size = [1] * n
... | false | 30 | [
"-from collections import defaultdict",
"+import sys",
"+input = lambda: sys.stdin.readline().rstrip()",
"+sys.setrecursionlimit(max(1000, 10**9))",
"+write = lambda x: sys.stdout.write(x + \"\\n\")",
"-ns = defaultdict(set)",
"-bs = defaultdict(set)",
"+",
"+",
"+class UnionFindTree:",
"+ de... | false | 0.063511 | 0.043249 | 1.468499 | [
"s617953945",
"s723019839"
] |
u673361376 | p03626 | python | s545227214 | s504504650 | 168 | 17 | 38,256 | 3,064 | Accepted | Accepted | 89.88 | N = int(eval(input()))
grids = [[s for s in eval(input())],[s for s in eval(input())]]
MOD = 1000000007
if grids[0][0] == grids[1][0]:
prv_row_type = 1
ans = 3
posx = 1
else:
prv_row_type = -1
ans = 6
posx = 2
while posx < N:
if grids[0][posx] == grids[1][posx]:
if prv_row_type == 1:... | MOD = 10 ** 9 + 7
N = int(eval(input()))
S1 = eval(input())
S2 = eval(input())
ans = 1
prv_ptn = 0 # 1 or 2
i = 0
while i < N:
if S1[i] == S2[i]:
if prv_ptn == 0:
ans *= 3
elif prv_ptn == 1:
ans *= 2
else:
ans *= 1
ans %= MOD
... | 26 | 30 | 490 | 555 | N = int(eval(input()))
grids = [[s for s in eval(input())], [s for s in eval(input())]]
MOD = 1000000007
if grids[0][0] == grids[1][0]:
prv_row_type = 1
ans = 3
posx = 1
else:
prv_row_type = -1
ans = 6
posx = 2
while posx < N:
if grids[0][posx] == grids[1][posx]:
if prv_row_type == 1... | MOD = 10**9 + 7
N = int(eval(input()))
S1 = eval(input())
S2 = eval(input())
ans = 1
prv_ptn = 0 # 1 or 2
i = 0
while i < N:
if S1[i] == S2[i]:
if prv_ptn == 0:
ans *= 3
elif prv_ptn == 1:
ans *= 2
else:
ans *= 1
ans %= MOD
prv_ptn = 1
... | false | 13.333333 | [
"+MOD = 10**9 + 7",
"-grids = [[s for s in eval(input())], [s for s in eval(input())]]",
"-MOD = 1000000007",
"-if grids[0][0] == grids[1][0]:",
"- prv_row_type = 1",
"- ans = 3",
"- posx = 1",
"-else:",
"- prv_row_type = -1",
"- ans = 6",
"- posx = 2",
"-while posx < N:",
... | false | 0.040604 | 0.037987 | 1.068882 | [
"s545227214",
"s504504650"
] |
u358254559 | p02889 | python | s787580383 | s480216423 | 1,686 | 1,272 | 125,660 | 36,576 | Accepted | Accepted | 24.56 | n,m,l = list(map(int, input().split()))
wf=[[float("inf") for i in range(n)] for j in range(n)]
for i in range(m):
a,b,c = list(map(int,input().split()))
wf[a-1][b-1] = c
wf[b-1][a-1] = c
q = int(eval(input()))
st=[list(map(int,input().split())) for i in range(q)]
for i in range(n):
wf[i][i]=... | n,m,l = list(map(int, input().split()))
wf=[[float("inf") for i in range(n)] for j in range(n)]
for i in range(m):
a,b,c = list(map(int,input().split()))
wf[a-1][b-1] = c
wf[b-1][a-1] = c
q = int(eval(input()))
st=[list(map(int,input().split())) for i in range(q)]
from scipy.sparse.csgraph import ... | 36 | 29 | 922 | 692 | n, m, l = list(map(int, input().split()))
wf = [[float("inf") for i in range(n)] for j in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
wf[a - 1][b - 1] = c
wf[b - 1][a - 1] = c
q = int(eval(input()))
st = [list(map(int, input().split())) for i in range(q)]
for i in range(n):
wf... | n, m, l = list(map(int, input().split()))
wf = [[float("inf") for i in range(n)] for j in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
wf[a - 1][b - 1] = c
wf[b - 1][a - 1] = c
q = int(eval(input()))
st = [list(map(int, input().split())) for i in range(q)]
from scipy.sparse.csgraph... | false | 19.444444 | [
"+from scipy.sparse.csgraph import floyd_warshall",
"+",
"-for k in range(n):",
"- for i in range(n):",
"- for j in range(i + 1, n):",
"- wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j])",
"- wf[j][i] = wf[i][j]",
"+wf = floyd_warshall(wf)",
"-for k in range(n):",
"- ... | false | 0.042568 | 0.415619 | 0.10242 | [
"s787580383",
"s480216423"
] |
u840570107 | p02779 | python | s349822700 | s293382123 | 212 | 113 | 20,796 | 40,724 | Accepted | Accepted | 46.7 | n = int(eval(input()))
lis = [x for x in input().split()]
lis.sort()
for i in range(1, n):
if lis[i-1] == lis[i]:
print("NO")
exit()
print("YES") | n = int(eval(input()))
lis = input().split()
dic = {}
for i in range(n):
if lis[i] not in dic:
dic[lis[i]] = 1
else:
dic[lis[i]] += 1
for x in list(dic.values()):
if x != 1:
print("NO")
exit()
print("YES") | 10 | 16 | 162 | 237 | n = int(eval(input()))
lis = [x for x in input().split()]
lis.sort()
for i in range(1, n):
if lis[i - 1] == lis[i]:
print("NO")
exit()
print("YES")
| n = int(eval(input()))
lis = input().split()
dic = {}
for i in range(n):
if lis[i] not in dic:
dic[lis[i]] = 1
else:
dic[lis[i]] += 1
for x in list(dic.values()):
if x != 1:
print("NO")
exit()
print("YES")
| false | 37.5 | [
"-lis = [x for x in input().split()]",
"-lis.sort()",
"-for i in range(1, n):",
"- if lis[i - 1] == lis[i]:",
"+lis = input().split()",
"+dic = {}",
"+for i in range(n):",
"+ if lis[i] not in dic:",
"+ dic[lis[i]] = 1",
"+ else:",
"+ dic[lis[i]] += 1",
"+for x in list(di... | false | 0.041576 | 0.041013 | 1.013742 | [
"s349822700",
"s293382123"
] |
u136869985 | p03854 | python | s530503401 | s662096938 | 61 | 43 | 3,188 | 3,188 | Accepted | Accepted | 29.51 | A = ["dream", "dreamer", "erase", "eraser"]
for i in range(4):
A[i] = A[i][::-1]
S = input()[::-1]
idx = 0
while idx < len(S):
flag = False
for i in range(4):
if len(S) - idx < len(A[i]):
continue
else:
if S[idx:idx+len(A[i])] == A[i]:
fl... | A = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(A)):
A[i] = A[i][::-1]
s = input()[::-1]
i = 0
while True:
f = True
for a in A:
if len(a) > len(s) - i:
continue
if s[i:i+len(a)] == a:
i += len(a)
f = False
break
... | 22 | 26 | 524 | 487 | A = ["dream", "dreamer", "erase", "eraser"]
for i in range(4):
A[i] = A[i][::-1]
S = input()[::-1]
idx = 0
while idx < len(S):
flag = False
for i in range(4):
if len(S) - idx < len(A[i]):
continue
else:
if S[idx : idx + len(A[i])] == A[i]:
flag = True
... | A = ["dream", "dreamer", "erase", "eraser"]
for i in range(len(A)):
A[i] = A[i][::-1]
s = input()[::-1]
i = 0
while True:
f = True
for a in A:
if len(a) > len(s) - i:
continue
if s[i : i + len(a)] == a:
i += len(a)
f = False
break
else:
... | false | 15.384615 | [
"-for i in range(4):",
"+for i in range(len(A)):",
"-S = input()[::-1]",
"-idx = 0",
"-while idx < len(S):",
"- flag = False",
"- for i in range(4):",
"- if len(S) - idx < len(A[i]):",
"+s = input()[::-1]",
"+i = 0",
"+while True:",
"+ f = True",
"+ for a in A:",
"+ ... | false | 0.041823 | 0.094286 | 0.443575 | [
"s530503401",
"s662096938"
] |
u811733736 | p02407 | python | s090426421 | s481151522 | 30 | 20 | 7,692 | 7,760 | Accepted | Accepted | 33.33 | if __name__ == '__main__':
data_num = int(eval(input()))
data = [x for x in input().split(' ')]
assert data_num == len(data), "invalid input"
data.reverse()
output = ' '.join(data)
print(output) | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_A&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
n = int(eval(input()))
numbers = [int(x) for x in input().split()]
numbers.reverse()
print((*numbers))
i... | 9 | 20 | 222 | 367 | if __name__ == "__main__":
data_num = int(eval(input()))
data = [x for x in input().split(" ")]
assert data_num == len(data), "invalid input"
data.reverse()
output = " ".join(data)
print(output)
| # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_A&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
n = int(eval(input()))
numbers = [int(x) for x in input().split()]
numbers.reverse()
print((*numbers))
if __name__ == "__... | false | 55 | [
"+# -*- coding: utf-8 -*-",
"+\"\"\"",
"+http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_A&lang=jp",
"+\"\"\"",
"+import sys",
"+from sys import stdin",
"+",
"+input = stdin.readline",
"+",
"+",
"+def main(args):",
"+ n = int(eval(input()))",
"+ numbers = [int(x) for x ... | false | 0.217173 | 0.038374 | 5.659387 | [
"s090426421",
"s481151522"
] |
u191874006 | p03061 | python | s434742794 | s745204644 | 251 | 109 | 59,632 | 89,740 | Accepted | Accepted | 56.57 | #!/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... | #!/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... | 46 | 38 | 1,021 | 953 | #!/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... | #!/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 | 17.391304 | [
"-def gcd(n, m):",
"- if m == 0:",
"- return n",
"- else:",
"- return gcd(m, n % m)",
"-",
"-",
"-l = [0] * n",
"-r = [0] * n",
"-l[0] = a[0]",
"-for i in range(1, n):",
"- l[i] = gcd(l[i - 1], a[i])",
"-r[-1] = a[-1]",
"-for i in range(n - 1)[::-1]:",
"- r[i] =... | false | 0.046387 | 0.039664 | 1.169499 | [
"s434742794",
"s745204644"
] |
u150984829 | p02414 | python | s412984810 | s236430198 | 130 | 110 | 6,984 | 6,588 | Accepted | Accepted | 15.38 | import sys
e=[list(map(int,x.split()))for x in sys.stdin];n=e[0][0]+1
[print(*x)for x in[[sum(s*t for s,t in zip(c,l))for l in zip(*e[n:])]for c in e[1:n]]]
| import sys
e=[list(map(int,x.split()))for x in sys.stdin];n=e[0][0]+1
for c in e[1:n]:print((*[sum([s*t for s,t in zip(c,l)])for l in zip(*e[n:])]))
| 3 | 3 | 159 | 149 | import sys
e = [list(map(int, x.split())) for x in sys.stdin]
n = e[0][0] + 1
[
print(*x)
for x in [[sum(s * t for s, t in zip(c, l)) for l in zip(*e[n:])] for c in e[1:n]]
]
| import sys
e = [list(map(int, x.split())) for x in sys.stdin]
n = e[0][0] + 1
for c in e[1:n]:
print((*[sum([s * t for s, t in zip(c, l)]) for l in zip(*e[n:])]))
| false | 0 | [
"-[",
"- print(*x)",
"- for x in [[sum(s * t for s, t in zip(c, l)) for l in zip(*e[n:])] for c in e[1:n]]",
"-]",
"+for c in e[1:n]:",
"+ print((*[sum([s * t for s, t in zip(c, l)]) for l in zip(*e[n:])]))"
] | false | 0.037684 | 0.037018 | 1.017994 | [
"s412984810",
"s236430198"
] |
u626337957 | p03701 | python | s698090247 | s712469139 | 192 | 177 | 3,188 | 3,064 | Accepted | Accepted | 7.81 | N = int(eval(input()))
nums=[int(eval(input())) for _ in range(N)]
MAX = 10**4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
for i in range(MAX+1)[::-1]:
if dp[i] == 1 and (i + num) <= MAX*MAX:
dp[i+num] = 1
ans = 0
for i in range(MAX+1):
if dp[i] == 1 and i%10 != 0:
ans = i
print(ans)
| N = int(eval(input()))
nums=[int(eval(input())) for _ in range(N)]
MAX = 10**4
dp = [0] * (MAX+1)
dp[0] = 1
for num in nums:
for i in range(MAX+1)[::-1]:
if dp[i] == 1 and (i + num) <= MAX+1:
dp[i+num] = 1
ans = 0
for i in range(MAX+1):
if dp[i] == 1 and i%10 != 0:
ans = i
print(ans)
| 14 | 14 | 306 | 304 | N = int(eval(input()))
nums = [int(eval(input())) for _ in range(N)]
MAX = 10**4
dp = [0] * (MAX + 1)
dp[0] = 1
for num in nums:
for i in range(MAX + 1)[::-1]:
if dp[i] == 1 and (i + num) <= MAX * MAX:
dp[i + num] = 1
ans = 0
for i in range(MAX + 1):
if dp[i] == 1 and i % 10 != 0:
an... | N = int(eval(input()))
nums = [int(eval(input())) for _ in range(N)]
MAX = 10**4
dp = [0] * (MAX + 1)
dp[0] = 1
for num in nums:
for i in range(MAX + 1)[::-1]:
if dp[i] == 1 and (i + num) <= MAX + 1:
dp[i + num] = 1
ans = 0
for i in range(MAX + 1):
if dp[i] == 1 and i % 10 != 0:
ans ... | false | 0 | [
"- if dp[i] == 1 and (i + num) <= MAX * MAX:",
"+ if dp[i] == 1 and (i + num) <= MAX + 1:"
] | false | 0.046089 | 0.047863 | 0.962938 | [
"s698090247",
"s712469139"
] |
u766684188 | p02899 | python | s553270586 | s529286608 | 575 | 109 | 65,196 | 13,940 | Accepted | Accepted | 81.04 | n=int(eval(input()))
A=list(map(int,input().split()))
B=[]
for i,a in enumerate(A):
B.append((a,i+1))
B.sort()
Ans=[]
for _,a in B:
Ans.append(a)
print((*Ans)) | n=int(eval(input()))
A=tuple(map(int,input().split()))
Ans=[0]*n
for i,a in enumerate(A):
Ans[a-1]=i+1
print((*Ans)) | 10 | 6 | 168 | 117 | n = int(eval(input()))
A = list(map(int, input().split()))
B = []
for i, a in enumerate(A):
B.append((a, i + 1))
B.sort()
Ans = []
for _, a in B:
Ans.append(a)
print((*Ans))
| n = int(eval(input()))
A = tuple(map(int, input().split()))
Ans = [0] * n
for i, a in enumerate(A):
Ans[a - 1] = i + 1
print((*Ans))
| false | 40 | [
"-A = list(map(int, input().split()))",
"-B = []",
"+A = tuple(map(int, input().split()))",
"+Ans = [0] * n",
"- B.append((a, i + 1))",
"-B.sort()",
"-Ans = []",
"-for _, a in B:",
"- Ans.append(a)",
"+ Ans[a - 1] = i + 1"
] | false | 0.007048 | 0.035328 | 0.19951 | [
"s553270586",
"s529286608"
] |
u860002137 | p02631 | python | s208344590 | s882649494 | 190 | 173 | 31,676 | 31,428 | Accepted | Accepted | 8.95 | n = int(eval(input()))
arr = list(map(int, input().split()))
a = arr[0]
for i in range(1, n):
a ^= arr[i]
ans = []
for i in range(n):
ans.append(a ^ arr[i])
print((*ans)) | n = int(eval(input()))
arr = list(map(int, input().split()))
a = 0
for i in range(n):
a ^= arr[i]
ans = []
for i in range(n):
ans.append(a ^ arr[i])
print((*ans)) | 13 | 13 | 190 | 178 | n = int(eval(input()))
arr = list(map(int, input().split()))
a = arr[0]
for i in range(1, n):
a ^= arr[i]
ans = []
for i in range(n):
ans.append(a ^ arr[i])
print((*ans))
| n = int(eval(input()))
arr = list(map(int, input().split()))
a = 0
for i in range(n):
a ^= arr[i]
ans = []
for i in range(n):
ans.append(a ^ arr[i])
print((*ans))
| false | 0 | [
"-a = arr[0]",
"-for i in range(1, n):",
"+a = 0",
"+for i in range(n):"
] | false | 0.046421 | 0.046462 | 0.999124 | [
"s208344590",
"s882649494"
] |
u010379708 | p02646 | python | s688664959 | s362980101 | 191 | 66 | 71,328 | 61,692 | Accepted | Accepted | 65.45 | from decimal import *
l=list(map(int, input().split(' ')))
a=l[0]
v=l[1]
l=list(map(int, input().split(' ')))
b=l[0]
w=l[1]
s=int(eval(input()))
ans=True
if a>b:
ans=Decimal(a)-Decimal(v*s)<=Decimal(b)-Decimal(w*s)
else:
ans=Decimal(a)+Decimal(v*s)>=Decimal(b)+Decimal(w*s)
if ans:
print("YES... |
l=list(map(int, input().split(' ')))
a=l[0]
v=l[1]
l=list(map(int, input().split(' ')))
b=l[0]
w=l[1]
s=int(eval(input()))
ans=True
if a>b:
ans=a-v*s<=b-w*s
else:
ans=a+v*s>=b+w*s
if ans:
print("YES")
else:
print("NO")
| 20 | 19 | 349 | 254 | from decimal import *
l = list(map(int, input().split(" ")))
a = l[0]
v = l[1]
l = list(map(int, input().split(" ")))
b = l[0]
w = l[1]
s = int(eval(input()))
ans = True
if a > b:
ans = Decimal(a) - Decimal(v * s) <= Decimal(b) - Decimal(w * s)
else:
ans = Decimal(a) + Decimal(v * s) >= Decimal(b) + Decimal(w ... | l = list(map(int, input().split(" ")))
a = l[0]
v = l[1]
l = list(map(int, input().split(" ")))
b = l[0]
w = l[1]
s = int(eval(input()))
ans = True
if a > b:
ans = a - v * s <= b - w * s
else:
ans = a + v * s >= b + w * s
if ans:
print("YES")
else:
print("NO")
| false | 5 | [
"-from decimal import *",
"-",
"- ans = Decimal(a) - Decimal(v * s) <= Decimal(b) - Decimal(w * s)",
"+ ans = a - v * s <= b - w * s",
"- ans = Decimal(a) + Decimal(v * s) >= Decimal(b) + Decimal(w * s)",
"+ ans = a + v * s >= b + w * s"
] | false | 0.041324 | 0.045514 | 0.907937 | [
"s688664959",
"s362980101"
] |
u629350026 | p02659 | python | s229075543 | s458011433 | 25 | 23 | 9,156 | 8,936 | Accepted | Accepted | 8 | A,B = list(map(str,input().split()))
A = int(A)
B = int(float(B)*1000)
print((int(A*B)//1000)) | a,b=list(map(str,input().split()))
tempb=int(float(b)*1000)
tempa=int(a)
print((int(tempa*tempb)//1000)) | 4 | 4 | 89 | 99 | A, B = list(map(str, input().split()))
A = int(A)
B = int(float(B) * 1000)
print((int(A * B) // 1000))
| a, b = list(map(str, input().split()))
tempb = int(float(b) * 1000)
tempa = int(a)
print((int(tempa * tempb) // 1000))
| false | 0 | [
"-A, B = list(map(str, input().split()))",
"-A = int(A)",
"-B = int(float(B) * 1000)",
"-print((int(A * B) // 1000))",
"+a, b = list(map(str, input().split()))",
"+tempb = int(float(b) * 1000)",
"+tempa = int(a)",
"+print((int(tempa * tempb) // 1000))"
] | false | 0.043143 | 0.120476 | 0.3581 | [
"s229075543",
"s458011433"
] |
u264349861 | p03166 | python | s734562256 | s293833527 | 484 | 423 | 163,508 | 152,644 | Accepted | Accepted | 12.6 | #dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(eval(input())),lambda :[int(w) for w in input().split()]
import sys
sys.setrecursionlimit(10**6)
def dfs(u):
global grpah,vis,dp
vis.add(u)
for i in graph[u]:
if i not in vis:
... | #dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(eval(input())),lambda :[int(w) for w in input().split()]
import sys
sys.setrecursionlimit(10**6)
def dfs(u):
global grpah,vis,dp
vis[u] = 1
for i in graph[u]:
if not vis[i]:
... | 28 | 28 | 595 | 595 | # dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
inp, ip = lambda: int(eval(input())), lambda: [int(w) for w in input().split()]
import sys
sys.setrecursionlimit(10**6)
def dfs(u):
global grpah, vis, dp
vis.add(u)
for i in graph[u]:
if i not in vis:
d... | # dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
inp, ip = lambda: int(eval(input())), lambda: [int(w) for w in input().split()]
import sys
sys.setrecursionlimit(10**6)
def dfs(u):
global grpah, vis, dp
vis[u] = 1
for i in graph[u]:
if not vis[i]:
dfs... | false | 0 | [
"- vis.add(u)",
"+ vis[u] = 1",
"- if i not in vis:",
"+ if not vis[i]:",
"-vis = set()",
"+vis = [0] * (n + 1)",
"- if i not in vis:",
"+ if not vis[i]:"
] | false | 0.045901 | 0.038335 | 1.197341 | [
"s734562256",
"s293833527"
] |
u133936772 | p03013 | python | s500602349 | s886042289 | 182 | 71 | 3,060 | 3,064 | Accepted | Accepted | 60.99 | M=10**9+7
f=input
n,m=list(map(int,f().split()))
s,t=0,1
u=0 if m<1 else int(f())
for i in range(n):
if i==u-1:
s,t=t,0
try: u=int(f())
except: pass
else: s,t=t,(s+t)%M
print(t) | M=10**9+7
import sys
f=sys.stdin.readline
n,m=list(map(int,f().split()))
s,t=0,1
u=0 if m<1 else int(f())
for i in range(n):
if i==u-1:
s,t=t,0
try: u=int(f())
except: pass
else: s,t=t,(s+t)%M
print(t) | 12 | 13 | 198 | 223 | M = 10**9 + 7
f = input
n, m = list(map(int, f().split()))
s, t = 0, 1
u = 0 if m < 1 else int(f())
for i in range(n):
if i == u - 1:
s, t = t, 0
try:
u = int(f())
except:
pass
else:
s, t = t, (s + t) % M
print(t)
| M = 10**9 + 7
import sys
f = sys.stdin.readline
n, m = list(map(int, f().split()))
s, t = 0, 1
u = 0 if m < 1 else int(f())
for i in range(n):
if i == u - 1:
s, t = t, 0
try:
u = int(f())
except:
pass
else:
s, t = t, (s + t) % M
print(t)
| false | 7.692308 | [
"-f = input",
"+import sys",
"+",
"+f = sys.stdin.readline"
] | false | 0.041539 | 0.04293 | 0.967604 | [
"s500602349",
"s886042289"
] |
u579699847 | p02683 | python | s881998760 | s479958739 | 167 | 154 | 27,372 | 27,340 | Accepted | Accepted | 7.78 | import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M,X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float('INF')
for i in range(2**N):
bit = np.array([[i>>j&1 for j in range(N)]]).T
t = np.sum(CA*bit,axis=0)
if np.all(t[1:]>=X):
ans = min(... | import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M,X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float('INF')
for i in range(2**N):
bit = np.array([[i>>j&1 for j in range(N)]]).T
temp = (CA*bit).sum(axis=0)
if (temp[1:]>=X).all():
ans =... | 11 | 11 | 371 | 379 | import numpy as np, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, M, X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float("INF")
for i in range(2**N):
bit = np.array([[i >> j & 1 for j in range(N)]]).T
t = np.sum(CA * bit, axis=0)
if np.all(t[1:] >= X):
... | import numpy as np, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, M, X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float("INF")
for i in range(2**N):
bit = np.array([[i >> j & 1 for j in range(N)]]).T
temp = (CA * bit).sum(axis=0)
if (temp[1:] >= X).all():
... | false | 0 | [
"- t = np.sum(CA * bit, axis=0)",
"- if np.all(t[1:] >= X):",
"- ans = min(ans, t[0])",
"+ temp = (CA * bit).sum(axis=0)",
"+ if (temp[1:] >= X).all():",
"+ ans = min(ans, temp[0])"
] | false | 0.273366 | 0.330626 | 0.826814 | [
"s881998760",
"s479958739"
] |
u969850098 | p03713 | python | s218787061 | s704448190 | 52 | 34 | 5,576 | 5,064 | Accepted | Accepted | 34.62 | import sys
readline = sys.stdin.readline
from math import floor, ceil
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def round(f, r=0):
return Decimal(str(f)).quantize(Decimal(str(r)), rounding=ROUND_HALF_UP)
def main():
H, W = list(map(int, readline().rstrip().split()))
ans = H * W
... | import sys
readline = sys.stdin.readline
from math import floor, ceil
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def round(f, r=0):
return Decimal(str(f)).quantize(Decimal(str(r)), rounding=ROUND_HALF_UP)
def main():
H, W = list(map(int, readline().rstrip().split()))
ans = H * W... | 47 | 46 | 1,338 | 1,244 | import sys
readline = sys.stdin.readline
from math import floor, ceil
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def round(f, r=0):
return Decimal(str(f)).quantize(Decimal(str(r)), rounding=ROUND_HALF_UP)
def main():
H, W = list(map(int, readline().rstrip().split()))
ans = H * W
if... | import sys
readline = sys.stdin.readline
from math import floor, ceil
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def round(f, r=0):
return Decimal(str(f)).quantize(Decimal(str(r)), rounding=ROUND_HALF_UP)
def main():
H, W = list(map(int, readline().rstrip().split()))
ans = H * W
if... | false | 2.12766 | [
"- x1_cand = [floor(W / 3), ceil(W / 3)]",
"- # x1_cand = [i for i in range(1, W)]",
"+ x1_cand = [int(round(W / 3))]",
"- y1_cand = [floor(H / 3), ceil(H / 3)]",
"- # y1_cand = [i for i in range(1, H)]",
"+ y1_cand = [int(round(H / 3))]"
] | false | 0.007435 | 0.040947 | 0.18158 | [
"s218787061",
"s704448190"
] |
u944325914 | p02614 | python | s068941655 | s165122974 | 130 | 54 | 9,340 | 9,148 | Accepted | Accepted | 58.46 | import copy
h,w,k=list(map(int,input().split()))
v=[]
for _ in range(h):
array=list(eval(input()))
v.append(array)
ans=0
for a in range(2**h):
c=copy.deepcopy(v)
for b in range(h):
if a>>b & 1:
for d in range(w):
c[b][d]=0
for e in range(2**w):
... | from itertools import product
h,w,k=list(map(int,input().split()))
c=[list(eval(input())) for _ in range(h)]
ans=0
for i in product([0,1],repeat=h):
for j in product([0,1],repeat=w):
temp=0
for m in range(h):
for n in range(w):
if i[m]==0 and j[n]==0 and c[m][n]=="#":
temp+=1... | 25 | 16 | 546 | 371 | import copy
h, w, k = list(map(int, input().split()))
v = []
for _ in range(h):
array = list(eval(input()))
v.append(array)
ans = 0
for a in range(2**h):
c = copy.deepcopy(v)
for b in range(h):
if a >> b & 1:
for d in range(w):
c[b][d] = 0
for e in range(2**w):
... | from itertools import product
h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for i in product([0, 1], repeat=h):
for j in product([0, 1], repeat=w):
temp = 0
for m in range(h):
for n in range(w):
if i[m] == 0 and j[n] == 0 a... | false | 36 | [
"-import copy",
"+from itertools import product",
"-v = []",
"-for _ in range(h):",
"- array = list(eval(input()))",
"- v.append(array)",
"+c = [list(eval(input())) for _ in range(h)]",
"-for a in range(2**h):",
"- c = copy.deepcopy(v)",
"- for b in range(h):",
"- if a >> b & ... | false | 0.035077 | 0.029189 | 1.201703 | [
"s068941655",
"s165122974"
] |
u588341295 | p02883 | python | s129189946 | s935122693 | 1,952 | 1,079 | 115,200 | 113,408 | Accepted | Accepted | 44.72 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 52 | 52 | 1,270 | 1,273 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 0 | [
"-print((bisearch_min(-1, INF, check)))",
"+print((bisearch_min(-1, 10**12, check)))"
] | false | 0.065472 | 0.097824 | 0.669281 | [
"s129189946",
"s935122693"
] |
u455696302 | p03408 | python | s582553876 | s537162647 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
Sw = list(set(S))
Tw = list(set(T))
mm = 0
for i in Sw:
tmp = S.count(i) - T.count(i)
if mm < tmp:
mm = tmp
for i in Tw:
tmp = S.count(i) - T.count(i)
if... | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
red = {}
for i in T:
if i not in red:
red[i] = 1
else:
red[i] += 1
blue = {}
for i in S:
if i not in blue:
blue[i] = 1
else:
blue[i... | 20 | 30 | 337 | 474 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
Sw = list(set(S))
Tw = list(set(T))
mm = 0
for i in Sw:
tmp = S.count(i) - T.count(i)
if mm < tmp:
mm = tmp
for i in Tw:
tmp = S.count(i) - T.count(i)
if mm < tmp:
mm... | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
red = {}
for i in T:
if i not in red:
red[i] = 1
else:
red[i] += 1
blue = {}
for i in S:
if i not in blue:
blue[i] = 1
else:
blue[i] += 1
res = 0
for ... | false | 33.333333 | [
"-Sw = list(set(S))",
"-Tw = list(set(T))",
"-mm = 0",
"-for i in Sw:",
"- tmp = S.count(i) - T.count(i)",
"- if mm < tmp:",
"- mm = tmp",
"-for i in Tw:",
"- tmp = S.count(i) - T.count(i)",
"- if mm < tmp:",
"- mm = tmp",
"-print(mm)",
"+red = {}",
"+for i in T:"... | false | 0.066994 | 0.054262 | 1.234633 | [
"s582553876",
"s537162647"
] |
u072717685 | p03416 | python | s366433774 | s295519632 | 71 | 50 | 2,940 | 9,164 | Accepted | Accepted | 29.58 | def main():
a, b = list(map(int,input().split()))
r = 0
for i in range(a, b + 1):
r += str(i) == str(i)[::-1]
print(r)
if __name__ == '__main__':
main() | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
a, b = list(map(int, input().split()))
r = 0
for i1 in range(a, b + 1):
stri1 = str(i1)
r += stri1 == stri1[::-1]
print(r)
if __name__ == '__main__':
main()
| 10 | 14 | 185 | 279 | def main():
a, b = list(map(int, input().split()))
r = 0
for i in range(a, b + 1):
r += str(i) == str(i)[::-1]
print(r)
if __name__ == "__main__":
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
a, b = list(map(int, input().split()))
r = 0
for i1 in range(a, b + 1):
stri1 = str(i1)
r += stri1 == stri1[::-1]
print(r)
if __name__ == "__main__":
main()
| false | 28.571429 | [
"+import sys",
"+",
"+read = sys.stdin.read",
"+readlines = sys.stdin.readlines",
"+",
"+",
"- for i in range(a, b + 1):",
"- r += str(i) == str(i)[::-1]",
"+ for i1 in range(a, b + 1):",
"+ stri1 = str(i1)",
"+ r += stri1 == stri1[::-1]"
] | false | 0.04736 | 0.040972 | 1.155892 | [
"s366433774",
"s295519632"
] |
u753803401 | p03547 | python | s612574008 | s815454772 | 28 | 17 | 2,940 | 2,940 | Accepted | Accepted | 39.29 | x, y = list(map(str, input().split()))
if x < y:
print("<")
elif x > y:
print(">")
else:
print("=")
| x, y = input().split()
if x < y:
print("<")
elif x > y:
print(">")
else:
print("=")
| 7 | 7 | 112 | 102 | x, y = list(map(str, input().split()))
if x < y:
print("<")
elif x > y:
print(">")
else:
print("=")
| x, y = input().split()
if x < y:
print("<")
elif x > y:
print(">")
else:
print("=")
| false | 0 | [
"-x, y = list(map(str, input().split()))",
"+x, y = input().split()"
] | false | 0.037147 | 0.039348 | 0.944068 | [
"s612574008",
"s815454772"
] |
u018679195 | p02785 | python | s440370586 | s404940276 | 162 | 145 | 26,180 | 105,392 | Accepted | Accepted | 10.49 | nk = list(map(int,input().split()))
n,k = nk
h = list(map(int,input().split()))
if k >= len(h):
print((0))
else:
h.sort()
for i in range (k):
h.pop()
print((sum(h))) | nMonsters, nSpecial = [int(x) for x in input().split()]
monst = [int(x) for x in input().split()]
monst.sort()
nMonsters -= nSpecial
if nMonsters < 0:
print((0))
else:
print((sum(monst[0:nMonsters])))
| 10 | 12 | 194 | 220 | nk = list(map(int, input().split()))
n, k = nk
h = list(map(int, input().split()))
if k >= len(h):
print((0))
else:
h.sort()
for i in range(k):
h.pop()
print((sum(h)))
| nMonsters, nSpecial = [int(x) for x in input().split()]
monst = [int(x) for x in input().split()]
monst.sort()
nMonsters -= nSpecial
if nMonsters < 0:
print((0))
else:
print((sum(monst[0:nMonsters])))
| false | 16.666667 | [
"-nk = list(map(int, input().split()))",
"-n, k = nk",
"-h = list(map(int, input().split()))",
"-if k >= len(h):",
"+nMonsters, nSpecial = [int(x) for x in input().split()]",
"+monst = [int(x) for x in input().split()]",
"+monst.sort()",
"+nMonsters -= nSpecial",
"+if nMonsters < 0:",
"- h.sort... | false | 0.071164 | 0.070132 | 1.014705 | [
"s440370586",
"s404940276"
] |
u186838327 | p03103 | python | s995949399 | s791657649 | 859 | 383 | 53,208 | 78,900 | Accepted | Accepted | 55.41 | n, m = list(map(int, input().split()))
AB = []
for i in range(n):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
ans = 0
for i in range(n):
a, b = AB[i]
if b >= m:
ans += a*m
break
else:
ans += a*b
m -= b
print(ans)
| n, m = list(map(int, input().split()))
AB = []
for i in range(n):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
ans = 0
for a, b in AB:
if b <= m:
ans += a*b
m -= b
else:
ans += a*m
m = 0
if m == 0:
break
print(ans)
| 17 | 18 | 289 | 303 | n, m = list(map(int, input().split()))
AB = []
for i in range(n):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
ans = 0
for i in range(n):
a, b = AB[i]
if b >= m:
ans += a * m
break
else:
ans += a * b
m -= b
print(ans)
| n, m = list(map(int, input().split()))
AB = []
for i in range(n):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
ans = 0
for a, b in AB:
if b <= m:
ans += a * b
m -= b
else:
ans += a * m
m = 0
if m == 0:
break
print(ans)
| false | 5.555556 | [
"-for i in range(n):",
"- a, b = AB[i]",
"- if b >= m:",
"+for a, b in AB:",
"+ if b <= m:",
"+ ans += a * b",
"+ m -= b",
"+ else:",
"+ m = 0",
"+ if m == 0:",
"- else:",
"- ans += a * b",
"- m -= b"
] | false | 0.037077 | 0.037186 | 0.997073 | [
"s995949399",
"s791657649"
] |
u536113865 | p03627 | python | s148875753 | s469036728 | 104 | 81 | 14,224 | 18,216 | Accepted | Accepted | 22.12 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
f,s,i = 0,0,0
while i+1<n:
if a[i]==a[i+1]:
s = f
f = a[i]
i += 1
i += 1
print((f*s))
| ai = lambda: list(map(int, input().split()))
n = int(eval(input()))
a = ai()
from collections import Counter
c = Counter(a)
a = [i for i in c if c[i]>1]
a.sort()
if len(a)>0 and c[a[-1]]>=4:
print((a[-1]**2))
elif len(a)<2:
print((0))
else:
print((a[-1]*a[-2])) | 11 | 14 | 188 | 275 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
f, s, i = 0, 0, 0
while i + 1 < n:
if a[i] == a[i + 1]:
s = f
f = a[i]
i += 1
i += 1
print((f * s))
| ai = lambda: list(map(int, input().split()))
n = int(eval(input()))
a = ai()
from collections import Counter
c = Counter(a)
a = [i for i in c if c[i] > 1]
a.sort()
if len(a) > 0 and c[a[-1]] >= 4:
print((a[-1] ** 2))
elif len(a) < 2:
print((0))
else:
print((a[-1] * a[-2]))
| false | 21.428571 | [
"+ai = lambda: list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"+a = ai()",
"+from collections import Counter",
"+",
"+c = Counter(a)",
"+a = [i for i in c if c[i] > 1]",
"-f, s, i = 0, 0, 0",
"-while i + 1 < n:",
"- if a[i] == a[i + 1]:",
"- s = f",
"- ... | false | 0.099792 | 0.05194 | 1.921284 | [
"s148875753",
"s469036728"
] |
u225388820 | p03660 | python | s057531669 | s961619886 | 377 | 285 | 117,900 | 32,224 | Accepted | Accepted | 24.4 | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n = int(eval(input()))
es=[[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
es[a - 1].append(b - 1)
es[b - 1].append(a - 1)
def dfs0(v, d, p):
if v == n - 1:
return d
for e in ... | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
from collections import deque
n = int(eval(input()))
es=[[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
es[a - 1].append(b - 1)
es[b - 1].append(a - 1)
INF = 1 << 32
d = [INF] * n
d[0] = 0
... | 35 | 31 | 769 | 730 | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n = int(eval(input()))
es = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
es[a - 1].append(b - 1)
es[b - 1].append(a - 1)
def dfs0(v, d, p):
if v == n - 1:
return d
for e in es[v... | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
from collections import deque
n = int(eval(input()))
es = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
es[a - 1].append(b - 1)
es[b - 1].append(a - 1)
INF = 1 << 32
d = [INF] * n
d[0] = 0
q = de... | false | 11.428571 | [
"+from collections import deque",
"+",
"-",
"-",
"-def dfs0(v, d, p):",
"- if v == n - 1:",
"- return d",
"+INF = 1 << 32",
"+d = [INF] * n",
"+d[0] = 0",
"+q = deque([0])",
"+while q:",
"+ v = q.popleft()",
"- if e != p:",
"- k = dfs0(e, d + 1, v)",
"- ... | false | 0.127086 | 0.048133 | 2.64031 | [
"s057531669",
"s961619886"
] |
u838644735 | p02928 | python | s223382026 | s255369883 | 226 | 189 | 41,692 | 41,708 | Accepted | Accepted | 16.37 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
ret = 0
while i > 0:
ret += self.tree[i]
i -= i & -i
return ret
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
ret = 0
while i > 0:
ret += self.tree[i]
i -= i & -i
return ret
... | 43 | 51 | 835 | 1,007 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
ret = 0
while i > 0:
ret += self.tree[i]
i -= i & -i
return ret
def add(s... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
ret = 0
while i > 0:
ret += self.tree[i]
i -= i & -i
return ret
def add(s... | false | 15.686275 | [
"-inter = 0",
"-for i in range(N):",
"- ai = A[i]",
"- for j in range(i + 1):",
"- aj = A[j]",
"- if ai > aj:",
"- inter += 1",
"+# inter = 0",
"+# for i in range(N):",
"+# ai = A[i]",
"+# for j in range(i + 1):",
"+# aj = A[j]",
"+# if ... | false | 0.042676 | 0.054 | 0.790298 | [
"s223382026",
"s255369883"
] |
u320511454 | p03295 | python | s415201325 | s062876372 | 447 | 412 | 29,080 | 30,216 | Accepted | Accepted | 7.83 | n,m=list(map(int,input().split()))
M=[list(map(int,input().split())) for _ in range(m)]
M.sort(key=lambda X: X[1])
end,ans=0,0
for i in range(m):
if M[i][0] >= end:
ans += 1
end=M[i][1]
print(ans) | n,m=list(map(int,input().split()))
M=[list(map(int,input().split())) for _ in range(m)]
M.sort(key=lambda X: X[1])
end,ans=0,0
for a,b in M:
if a >= end:
ans += 1
end=b
print(ans) | 10 | 10 | 216 | 199 | n, m = list(map(int, input().split()))
M = [list(map(int, input().split())) for _ in range(m)]
M.sort(key=lambda X: X[1])
end, ans = 0, 0
for i in range(m):
if M[i][0] >= end:
ans += 1
end = M[i][1]
print(ans)
| n, m = list(map(int, input().split()))
M = [list(map(int, input().split())) for _ in range(m)]
M.sort(key=lambda X: X[1])
end, ans = 0, 0
for a, b in M:
if a >= end:
ans += 1
end = b
print(ans)
| false | 0 | [
"-for i in range(m):",
"- if M[i][0] >= end:",
"+for a, b in M:",
"+ if a >= end:",
"- end = M[i][1]",
"+ end = b"
] | false | 0.03705 | 0.073243 | 0.505859 | [
"s415201325",
"s062876372"
] |
u179169725 | p03037 | python | s106252952 | s674711363 | 357 | 282 | 3,060 | 8,892 | Accepted | Accepted | 21.01 | # https://atcoder.jp/contests/abc127/tasks/abc127_c
N, M = list(map(int, input().split()))
L = 0
R = N
for _ in range(M):
l, r = list(map(int, input().split()))
L = max(L, l)
R = min(R, r)
print((max(R - L + 1, 0)))
| # https://atcoder.jp/contests/abc127/tasks/abc127_c
# 脳死でimosで殴っても良い
class Imos1d:
def __init__(self, N: int):
'''
[0]*N の配列に対して、区間の加算を管理する。
'''
self.ls = [0] * (N + 1) # 配列外参照を防ぐため多くとっておく
self.N = N
def add(self, l, r, x):
'''
[l,r)の区間にx... | 10 | 41 | 236 | 916 | # https://atcoder.jp/contests/abc127/tasks/abc127_c
N, M = list(map(int, input().split()))
L = 0
R = N
for _ in range(M):
l, r = list(map(int, input().split()))
L = max(L, l)
R = min(R, r)
print((max(R - L + 1, 0)))
| # https://atcoder.jp/contests/abc127/tasks/abc127_c
# 脳死でimosで殴っても良い
class Imos1d:
def __init__(self, N: int):
"""
[0]*N の配列に対して、区間の加算を管理する。
"""
self.ls = [0] * (N + 1) # 配列外参照を防ぐため多くとっておく
self.N = N
def add(self, l, r, x):
"""
[l,r)の区間にxを足し込む O(1)
... | false | 75.609756 | [
"-N, M = list(map(int, input().split()))",
"-L = 0",
"-R = N",
"+# 脳死でimosで殴っても良い",
"+class Imos1d:",
"+ def __init__(self, N: int):",
"+ \"\"\"",
"+ [0]*N の配列に対して、区間の加算を管理する。",
"+ \"\"\"",
"+ self.ls = [0] * (N + 1) # 配列外参照を防ぐため多くとっておく",
"+ self.N = N",
... | false | 0.036772 | 0.035459 | 1.037028 | [
"s106252952",
"s674711363"
] |
u074220993 | p03762 | python | s658136218 | s281041910 | 117 | 104 | 25,396 | 24,456 | Accepted | Accepted | 11.11 | n, m = list(map(int, input().split()))
x = [x for x in map(int, input().split())]
y = [y for y in map(int, input().split())]
sum_x = 0
sum_y = 0
ans = 0
for i in range(n):
sum_x += (2*i - n + 1) * x[i]
for j in range(m):
sum_y += (2*j - m + 1) * y[j]
ans = sum_x * sum_y
print((ans%1000000007)) | n, m = list(map(int, input().split()))
X = sorted([int(x) for x in input().split()])
Y = sorted([int(x) for x in input().split()])
mod = 1000000007
def diffSum(X): #Σ(X[j]-X[i]) 1<=i<j<=N
l = len(X)
Res = [(2*i-l+1)*X[i] for i in range(l)]
return sum(Res)%mod
print((diffSum(X)*diffSum(Y)%mod)) | 12 | 11 | 306 | 310 | n, m = list(map(int, input().split()))
x = [x for x in map(int, input().split())]
y = [y for y in map(int, input().split())]
sum_x = 0
sum_y = 0
ans = 0
for i in range(n):
sum_x += (2 * i - n + 1) * x[i]
for j in range(m):
sum_y += (2 * j - m + 1) * y[j]
ans = sum_x * sum_y
print((ans % 1000000007))
| n, m = list(map(int, input().split()))
X = sorted([int(x) for x in input().split()])
Y = sorted([int(x) for x in input().split()])
mod = 1000000007
def diffSum(X): # Σ(X[j]-X[i]) 1<=i<j<=N
l = len(X)
Res = [(2 * i - l + 1) * X[i] for i in range(l)]
return sum(Res) % mod
print((diffSum(X) * diffSum(Y) %... | false | 8.333333 | [
"-x = [x for x in map(int, input().split())]",
"-y = [y for y in map(int, input().split())]",
"-sum_x = 0",
"-sum_y = 0",
"-ans = 0",
"-for i in range(n):",
"- sum_x += (2 * i - n + 1) * x[i]",
"-for j in range(m):",
"- sum_y += (2 * j - m + 1) * y[j]",
"-ans = sum_x * sum_y",
"-print((ans... | false | 0.044894 | 0.045074 | 0.995998 | [
"s658136218",
"s281041910"
] |
u114920558 | p03283 | python | s644034941 | s194354361 | 2,831 | 1,713 | 53,208 | 57,304 | Accepted | Accepted | 39.49 | N, M, Q = list(map(int, input().split()))
train = [[0]*(N+1) for _ in range(N+1)]
for i in range(M):
a, b = list(map(int, input().split()))
train[a][b] += 1
for i in range(1, N+1):
for j in range(1, N+1):
train[i][j] += train[i][j-1]
for i in range(Q):
ans = 0
l, r = list(map(int, inpu... | N, M, Q = list(map(int, input().split()))
train = [[0]*(N+1) for _ in range(N+1)]
for i in range(M):
a, b = list(map(int, input().split()))
train[a][b] += 1
for i in range(1, N+1):
for j in range(1, N+1):
train[i][j] += train[i][j-1]
for i in range(1, N+1):
for j in range(1, N+1):
... | 18 | 19 | 395 | 462 | N, M, Q = list(map(int, input().split()))
train = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(M):
a, b = list(map(int, input().split()))
train[a][b] += 1
for i in range(1, N + 1):
for j in range(1, N + 1):
train[i][j] += train[i][j - 1]
for i in range(Q):
ans = 0
l, r = list(map(int... | N, M, Q = list(map(int, input().split()))
train = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(M):
a, b = list(map(int, input().split()))
train[a][b] += 1
for i in range(1, N + 1):
for j in range(1, N + 1):
train[i][j] += train[i][j - 1]
for i in range(1, N + 1):
for j in range(1, N + 1)... | false | 5.263158 | [
"+for i in range(1, N + 1):",
"+ for j in range(1, N + 1):",
"+ train[j][i] += train[j - 1][i]",
"- ans = 0",
"- for j in range(l, r + 1):",
"- ans += train[j][r] - train[j][l - 1]",
"- print(ans)",
"+ print((train[r][r] - train[l - 1][r] - train[r][l - 1] + train[l - 1][l... | false | 0.03546 | 0.038145 | 0.929603 | [
"s644034941",
"s194354361"
] |
u576432509 | p02936 | python | s255357914 | s074550858 | 1,812 | 1,157 | 93,452 | 93,448 | Accepted | Accepted | 36.15 |
from collections import deque
icase=0
if icase==0:
n,q=list(map(int,input().split()))
g = [set() for _ in range(n)]
for i in range(n-1):
ai,bi=list(map(int,input().split()))
g[ai-1].add(bi-1)
g[bi-1].add(ai-1)
g=tuple(g)
xx=[0]*n
for i in range(q):
... | import sys
input = sys.stdin.readline
from collections import deque
icase=0
if icase==0:
n,q=list(map(int,input().split()))
g = [set() for _ in range(n)]
for i in range(n-1):
ai,bi=list(map(int,input().split()))
g[ai-1].add(bi-1)
g[bi-1].add(ai-1)
g=tuple(g)
xx=... | 73 | 74 | 1,627 | 1,665 | from collections import deque
icase = 0
if icase == 0:
n, q = list(map(int, input().split()))
g = [set() for _ in range(n)]
for i in range(n - 1):
ai, bi = list(map(int, input().split()))
g[ai - 1].add(bi - 1)
g[bi - 1].add(ai - 1)
g = tuple(g)
xx = [0] * n
for i in rang... | import sys
input = sys.stdin.readline
from collections import deque
icase = 0
if icase == 0:
n, q = list(map(int, input().split()))
g = [set() for _ in range(n)]
for i in range(n - 1):
ai, bi = list(map(int, input().split()))
g[ai - 1].add(bi - 1)
g[bi - 1].add(ai - 1)
g = tupl... | false | 1.351351 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.056406 | 0.037895 | 1.488462 | [
"s255357914",
"s074550858"
] |
u644907318 | p03577 | python | s140345431 | s707366279 | 377 | 67 | 79,440 | 61,848 | Accepted | Accepted | 82.23 | print((input().strip()[:-8])) | S = input().strip()
print((S[:-8])) | 1 | 2 | 27 | 34 | print((input().strip()[:-8]))
| S = input().strip()
print((S[:-8]))
| false | 50 | [
"-print((input().strip()[:-8]))",
"+S = input().strip()",
"+print((S[:-8]))"
] | false | 0.073611 | 0.067786 | 1.085933 | [
"s140345431",
"s707366279"
] |
u340781749 | p02913 | python | s141859384 | s793627831 | 85 | 68 | 3,904 | 3,404 | Accepted | Accepted | 20 | def solve(n, s, d, MOD):
ttt = [ord(c) - 97 for c in s]
ttx = []
c = 1
for t in ttt[::-1]:
ttx.append(t * c % MOD)
c = c * d % MOD
ttx.reverse()
ttc = [0]
for t in ttx:
ttc.append((ttc[-1] + t) % MOD)
l, r = 0, n // 2 + 1
while l < r:
... | def solve(n, s):
l, r = 0, n // 2 + 1
while l < r:
m = (l + r + 1) // 2
if search(m, s):
l = m
else:
r = m - 1
return l
def search(w, s):
appeared = []
comparing = set()
w2 = w * 2
for i in range(w, n + 1):
t = hash(... | 46 | 30 | 935 | 562 | def solve(n, s, d, MOD):
ttt = [ord(c) - 97 for c in s]
ttx = []
c = 1
for t in ttt[::-1]:
ttx.append(t * c % MOD)
c = c * d % MOD
ttx.reverse()
ttc = [0]
for t in ttx:
ttc.append((ttc[-1] + t) % MOD)
l, r = 0, n // 2 + 1
while l < r:
m = (l + r + 1) /... | def solve(n, s):
l, r = 0, n // 2 + 1
while l < r:
m = (l + r + 1) // 2
if search(m, s):
l = m
else:
r = m - 1
return l
def search(w, s):
appeared = []
comparing = set()
w2 = w * 2
for i in range(w, n + 1):
t = hash(s[i - w : i])
... | false | 34.782609 | [
"-def solve(n, s, d, MOD):",
"- ttt = [ord(c) - 97 for c in s]",
"- ttx = []",
"- c = 1",
"- for t in ttt[::-1]:",
"- ttx.append(t * c % MOD)",
"- c = c * d % MOD",
"- ttx.reverse()",
"- ttc = [0]",
"- for t in ttx:",
"- ttc.append((ttc[-1] + t) % MOD)",... | false | 0.043312 | 0.040964 | 1.057339 | [
"s141859384",
"s793627831"
] |
u037430802 | p02937 | python | s722554995 | s769133893 | 158 | 125 | 7,668 | 8,052 | Accepted | Accepted | 20.89 | from bisect import bisect
S = eval(input())
T = eval(input())
N = len(S)
# Sにおいてある文字が出てくる位置を調べる
idxs_S = [[] for _ in range(26)] # a~zの分
for i, c in enumerate(S):
idx = ord(c) - ord("a")
idxs_S[idx].append(i)
# Tに出てくる文字がSになければ無理
for c in set(T):
if len(idxs_S[ord(c) - ord("a")]) == 0:
... | from collections import defaultdict
import bisect
s = eval(input())
t = eval(input())
N = len(s)
set_s = set(s)
set_t = set(t)
for c in set_t:
if c not in set_s:
print((-1))
exit()
# それぞれの文字のインデックスを記録
idxs = defaultdict(list)
for i in range(N):
idxs[s[i]].append(i)
cur... | 29 | 35 | 670 | 691 | from bisect import bisect
S = eval(input())
T = eval(input())
N = len(S)
# Sにおいてある文字が出てくる位置を調べる
idxs_S = [[] for _ in range(26)] # a~zの分
for i, c in enumerate(S):
idx = ord(c) - ord("a")
idxs_S[idx].append(i)
# Tに出てくる文字がSになければ無理
for c in set(T):
if len(idxs_S[ord(c) - ord("a")]) == 0:
print((-1))
... | from collections import defaultdict
import bisect
s = eval(input())
t = eval(input())
N = len(s)
set_s = set(s)
set_t = set(t)
for c in set_t:
if c not in set_s:
print((-1))
exit()
# それぞれの文字のインデックスを記録
idxs = defaultdict(list)
for i in range(N):
idxs[s[i]].append(i)
current_idx = -1 # ここ0にしていると... | false | 17.142857 | [
"-from bisect import bisect",
"+from collections import defaultdict",
"+import bisect",
"-S = eval(input())",
"-T = eval(input())",
"-N = len(S)",
"-# Sにおいてある文字が出てくる位置を調べる",
"-idxs_S = [[] for _ in range(26)] # a~zの分",
"-for i, c in enumerate(S):",
"- idx = ord(c) - ord(\"a\")",
"- idxs_S... | false | 0.101215 | 0.042008 | 2.409433 | [
"s722554995",
"s769133893"
] |
u233729690 | p02731 | python | s551846239 | s225690439 | 120 | 17 | 5,588 | 2,940 | Accepted | Accepted | 85.83 | from decimal import *
L = int(eval(input()))
print(((Decimal(L) / Decimal(3)) ** Decimal(3)))
| L = int(eval(input()))
print(((L / 3) ** 3)) | 5 | 3 | 92 | 40 | from decimal import *
L = int(eval(input()))
print(((Decimal(L) / Decimal(3)) ** Decimal(3)))
| L = int(eval(input()))
print(((L / 3) ** 3))
| false | 40 | [
"-from decimal import *",
"-",
"-print(((Decimal(L) / Decimal(3)) ** Decimal(3)))",
"+print(((L / 3) ** 3))"
] | false | 0.074993 | 0.039818 | 1.883399 | [
"s551846239",
"s225690439"
] |
u512212329 | p02629 | python | s053279489 | s669723617 | 34 | 31 | 9,468 | 9,464 | Accepted | Accepted | 8.82 | from collections import deque
import math
def main():
n = int(input())
if n == 1:
print('a')
return
digits = deque()
alpha = ord('a') - 1
maxex = int(math.log(n-1, 26))
ex = 1
for ex in range(1, maxex + 2):
bb = pow(26, ex - 1)
aa = bb * 26
... | from collections import deque
def main():
n = int(eval(input()))
base = 26
orig = ord('a')
ans = deque()
for exp in range(1, 12):
if (tmp := pow(base, exp)) >= n:
n -= 1 # zero_indexed for ASCII mod
for digit in range(exp):
ans.appendlef... | 31 | 22 | 626 | 491 | from collections import deque
import math
def main():
n = int(input())
if n == 1:
print("a")
return
digits = deque()
alpha = ord("a") - 1
maxex = int(math.log(n - 1, 26))
ex = 1
for ex in range(1, maxex + 2):
bb = pow(26, ex - 1)
aa = bb * 26
rem = n... | from collections import deque
def main():
n = int(eval(input()))
base = 26
orig = ord("a")
ans = deque()
for exp in range(1, 12):
if (tmp := pow(base, exp)) >= n:
n -= 1 # zero_indexed for ASCII mod
for digit in range(exp):
ans.appendleft(chr(orig +... | false | 29.032258 | [
"-import math",
"- n = int(input())",
"- if n == 1:",
"- print(\"a\")",
"- return",
"- digits = deque()",
"- alpha = ord(\"a\") - 1",
"- maxex = int(math.log(n - 1, 26))",
"- ex = 1",
"- for ex in range(1, maxex + 2):",
"- bb = pow(26, ex - 1)",
"- ... | false | 0.007681 | 0.042029 | 0.182752 | [
"s053279489",
"s669723617"
] |
u312025627 | p03449 | python | s670191048 | s022476368 | 169 | 24 | 38,512 | 3,064 | Accepted | Accepted | 85.8 | def main():
N = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(2)]
ans = 0
for i in range(N):
cur = sum(A[0][:i+1]) + sum(A[1][i:])
ans = max(ans, cur)
print(ans)
if __name__ == '__main__':
main()
| def main():
from itertools import accumulate
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
accA = list(accumulate(A))
accB = list(accumulate([0] + B))
ans = 0
for i in range(N):
cur = accA[i] + (accB[N] - accB[i])
... | 12 | 16 | 270 | 399 | def main():
N = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(2)]
ans = 0
for i in range(N):
cur = sum(A[0][: i + 1]) + sum(A[1][i:])
ans = max(ans, cur)
print(ans)
if __name__ == "__main__":
main()
| def main():
from itertools import accumulate
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
accA = list(accumulate(A))
accB = list(accumulate([0] + B))
ans = 0
for i in range(N):
cur = accA[i] + (accB[N] - accB[i])
ans ... | false | 25 | [
"+ from itertools import accumulate",
"+",
"- A = [[int(i) for i in input().split()] for j in range(2)]",
"+ A = [int(i) for i in input().split()]",
"+ B = [int(i) for i in input().split()]",
"+ accA = list(accumulate(A))",
"+ accB = list(accumulate([0] + B))",
"- cur = sum(A[... | false | 0.037427 | 0.086665 | 0.431854 | [
"s670191048",
"s022476368"
] |
u525065967 | p02641 | python | s767694457 | s860113104 | 24 | 21 | 9,200 | 9,200 | Accepted | Accepted | 12.5 | x,n = list(map(int,input().split()))
if n == 0:
print(x)
exit()
P = [*list(map(int,input().split()))]
ans = 100+100 # inf = x + d + 1
for d in range(100): # [0,100)
now_diff = abs(ans - x)
min_x, max_x = x - d, x + d
if min_x not in P:
if now_diff > abs(min_x - x): ans = x-d
e... | x,n = list(map(int,input().split()))
if n == 0:
print(x)
exit()
P = [*list(map(int,input().split()))]
ans = 100 + 100 # inf = x + d + 1
for d in range(100): # [0,100)
now_diff = abs(ans - x)
min_x, max_x = x - d, x + d
if min_x not in P:
if now_diff > abs(min_x - x): ans = min_x
... | 14 | 14 | 389 | 395 | x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
P = [*list(map(int, input().split()))]
ans = 100 + 100 # inf = x + d + 1
for d in range(100): # [0,100)
now_diff = abs(ans - x)
min_x, max_x = x - d, x + d
if min_x not in P:
if now_diff > abs(min_x - x):
ans = x... | x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
P = [*list(map(int, input().split()))]
ans = 100 + 100 # inf = x + d + 1
for d in range(100): # [0,100)
now_diff = abs(ans - x)
min_x, max_x = x - d, x + d
if min_x not in P:
if now_diff > abs(min_x - x):
ans = m... | false | 0 | [
"- ans = x - d",
"+ ans = min_x",
"- ans = x + d",
"+ ans = max_x"
] | false | 0.046177 | 0.046922 | 0.98411 | [
"s767694457",
"s860113104"
] |
u623814058 | p03612 | python | s353199632 | s280484939 | 96 | 64 | 19,968 | 20,456 | Accepted | Accepted | 33.33 | N=int(eval(input()))
S=[]
for x,y in zip(list(map(int,input().split())), list(range(1,N+1))):
if x==y: S.append(y)
S.append('$')
L=len(S)
l=[S[0]]
i=1
a=0
while i<L:
if S[i]=='$':a+=1
elif l[0]+1!=S[i]:
a+=1
l=[S[i]]
else:l.append(S[i])
i+=1
print(a) | N=int(eval(input()))
*P,=list(map(int,input().split()))
i=c=0
while i<N:
if P[i]==i+1:
c+=1
i+=1
i+=1
print(c) | 19 | 10 | 271 | 120 | N = int(eval(input()))
S = []
for x, y in zip(list(map(int, input().split())), list(range(1, N + 1))):
if x == y:
S.append(y)
S.append("$")
L = len(S)
l = [S[0]]
i = 1
a = 0
while i < L:
if S[i] == "$":
a += 1
elif l[0] + 1 != S[i]:
a += 1
l = [S[i]]
else:
l.appen... | N = int(eval(input()))
(*P,) = list(map(int, input().split()))
i = c = 0
while i < N:
if P[i] == i + 1:
c += 1
i += 1
i += 1
print(c)
| false | 47.368421 | [
"-S = []",
"-for x, y in zip(list(map(int, input().split())), list(range(1, N + 1))):",
"- if x == y:",
"- S.append(y)",
"-S.append(\"$\")",
"-L = len(S)",
"-l = [S[0]]",
"-i = 1",
"-a = 0",
"-while i < L:",
"- if S[i] == \"$\":",
"- a += 1",
"- elif l[0] + 1 != S[i]:"... | false | 0.048037 | 0.045513 | 1.05545 | [
"s353199632",
"s280484939"
] |
u562935282 | p03476 | python | s050740599 | s270067798 | 240 | 207 | 6,372 | 14,368 | Accepted | Accepted | 13.75 | class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]: continue
primes.append(i)
f[i] = i # 素数には自身を代入
for j in range(i * ... | class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]: continue
primes.append(i)
f[i] = i # 素数には自身を代入
for j in range(i * ... | 63 | 78 | 1,687 | 1,808 | class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]:
continue
primes.append(i)
f[i] = i # 素数には自身を代入
for j in range... | class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]:
continue
primes.append(i)
f[i] = i # 素数には自身を代入
for j in range... | false | 19.230769 | [
"- # def is_prime(self, x) -> bool: # 素数判定",
"- # return self.f[x] == x",
"- #",
"- # def factor_list(self, x) -> list: # 素因数分解の昇順リスト, [2,2,3,5,...]",
"- # res = []",
"- # while x != 1:",
"- # res.append(self.f[x])",
"- # x //= self.f[x]",
"- ... | false | 0.146948 | 0.078916 | 1.862096 | [
"s050740599",
"s270067798"
] |
u811733736 | p02396 | python | s290871931 | s570789183 | 130 | 60 | 7,552 | 7,760 | Accepted | Accepted | 53.85 | if __name__ == '__main__':
current_no = 1
while True:
input_num = int(eval(input()))
if input_num != 0:
print(('Case {0}: {1}'.format(current_no, input_num)))
current_no += 1
else:
break | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
count = 1
while True:
x = int(eval(input()))
if x == 0:
break
print(('Case {}: ... | 10 | 23 | 256 | 416 | if __name__ == "__main__":
current_no = 1
while True:
input_num = int(eval(input()))
if input_num != 0:
print(("Case {0}: {1}".format(current_no, input_num)))
current_no += 1
else:
break
| # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
count = 1
while True:
x = int(eval(input()))
if x == 0:
break
print(("Case {}: {}".format(count... | false | 56.521739 | [
"+# -*- coding: utf-8 -*-",
"+\"\"\"",
"+http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_B&lang=jp",
"+\"\"\"",
"+import sys",
"+from sys import stdin",
"+",
"+input = stdin.readline",
"+",
"+",
"+def main(args):",
"+ count = 1",
"+ while True:",
"+ x = int(eva... | false | 0.102126 | 0.100629 | 1.014874 | [
"s290871931",
"s570789183"
] |
u067677727 | p02240 | python | s120374797 | s732135870 | 830 | 370 | 32,736 | 35,620 | Accepted | Accepted | 55.42 | # -*- coding: utf-8 -*-
def assignColor(G):
n = len(G)
C = [-1 for i in range(n)]
for i in range(n):
if C[i] == -1:
C = BFS(G, i, C)
return C
#@profile
def BFS(G, start, C):
n = len(G)
Q = []
Q.append(start)
C[start] = start
while len(Q) != 0... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def assign_color():
_color = 1
for m in range(vertices_num):
if vertices_status_list[m] == -1:
graph_dfs(m, _color)
_color += 1
return None
def graph_dfs(vertex, color):
vertices_stack = li... | 51 | 60 | 1,057 | 1,603 | # -*- coding: utf-8 -*-
def assignColor(G):
n = len(G)
C = [-1 for i in range(n)]
for i in range(n):
if C[i] == -1:
C = BFS(G, i, C)
return C
# @profile
def BFS(G, start, C):
n = len(G)
Q = []
Q.append(start)
C[start] = start
while len(Q) != 0:
u = Q.pop... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def assign_color():
_color = 1
for m in range(vertices_num):
if vertices_status_list[m] == -1:
graph_dfs(m, _color)
_color += 1
return None
def graph_dfs(vertex, color):
vertices_stack = list()
vertices_stac... | false | 15 | [
"+#!/usr/bin/env python",
"-def assignColor(G):",
"- n = len(G)",
"- C = [-1 for i in range(n)]",
"- for i in range(n):",
"- if C[i] == -1:",
"- C = BFS(G, i, C)",
"- return C",
"+import sys",
"-# @profile",
"-def BFS(G, start, C):",
"- n = len(G)",
"- Q =... | false | 0.045748 | 0.104083 | 0.439536 | [
"s120374797",
"s732135870"
] |
u596276291 | p03475 | python | s980193826 | s278132313 | 100 | 74 | 4,584 | 4,080 | Accepted | Accepted | 26 | import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cac... | 43 | 45 | 1,103 | 1,036 | import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, ... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import... | false | 4.444444 | [
"-import sys",
"+#!/usr/bin/python3",
"-from math import pi, sqrt, ceil, floor",
"+from math import pi, sqrt",
"-from functools import lru_cache, reduce",
"-from operator import xor",
"-from heapq import heappush, heappop",
"+from functools import lru_cache",
"+import sys",
"+sys.setrecursionlimit... | false | 0.037273 | 0.034727 | 1.073308 | [
"s980193826",
"s278132313"
] |
u606045429 | p03354 | python | s523702064 | s259863050 | 666 | 315 | 13,812 | 44,028 | Accepted | Accepted | 52.7 | # http://www.geocities.jp/m_hiroi/light/pyalgo61.html
class UnionFind3:
def __init__(self, size):
# 負の値はルート (集合の代表) で集合の個数
# 正の値は次の要素を表す
self.table = [-1 for _ in range(size)]
# 集合の代表を求める
def find(self, x):
if self.table[x] < 0:
return x
else... | class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data[x]
def union(self, x, y):
x, y = self.find(x), self.... | 52 | 33 | 1,321 | 837 | # http://www.geocities.jp/m_hiroi/light/pyalgo61.html
class UnionFind3:
def __init__(self, size):
# 負の値はルート (集合の代表) で集合の個数
# 正の値は次の要素を表す
self.table = [-1 for _ in range(size)]
# 集合の代表を求める
def find(self, x):
if self.table[x] < 0:
return x
else:
... | class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data[x]
def union(self, x, y):
x, y = self.find(x), self.find(y)
... | false | 36.538462 | [
"-# http://www.geocities.jp/m_hiroi/light/pyalgo61.html",
"-class UnionFind3:",
"+class UnionFind:",
"- # 負の値はルート (集合の代表) で集合の個数",
"- # 正の値は次の要素を表す",
"- self.table = [-1 for _ in range(size)]",
"+ self.data = [-1] * size",
"- # 集合の代表を求める",
"- if self.table[x] < ... | false | 0.04847 | 0.037199 | 1.302979 | [
"s523702064",
"s259863050"
] |
u644907318 | p03795 | python | s800877885 | s166860203 | 166 | 65 | 38,256 | 61,684 | Accepted | Accepted | 60.84 | N = int(eval(input()))
x = N*800
y = (N//15)*200
print((x-y)) | N = int(eval(input()))
x = 800*N
y = (N//15)*200
print((x-y)) | 4 | 4 | 56 | 56 | N = int(eval(input()))
x = N * 800
y = (N // 15) * 200
print((x - y))
| N = int(eval(input()))
x = 800 * N
y = (N // 15) * 200
print((x - y))
| false | 0 | [
"-x = N * 800",
"+x = 800 * N"
] | false | 0.039647 | 0.03987 | 0.994414 | [
"s800877885",
"s166860203"
] |
u340781749 | p02727 | python | s542416178 | s241299364 | 261 | 237 | 22,720 | 22,560 | Accepted | Accepted | 9.2 | x, y, a, b, c = list(map(int, input().split()))
ppp = list(map(int, input().split()))
qqq = list(map(int, input().split()))
rrr = list(map(int, input().split()))
ppp.sort(reverse=True)
qqq.sort(reverse=True)
rrr.sort(reverse=True)
ppqq = ppp[:x] + qqq[:y]
ppqq.sort(reverse=True)
ppqq.insert(0, 0)
rrr.insert(0... | x, y, a, b, c = list(map(int, input().split()))
ppp = list(map(int, input().split()))
qqq = list(map(int, input().split()))
rrr = list(map(int, input().split()))
ppp.sort(reverse=True)
qqq.sort(reverse=True)
ppqq = ppp[:x] + qqq[:y]
ppqq.extend(rrr)
ppqq.sort(reverse=True)
print((sum(ppqq[:x + y])))
| 18 | 10 | 456 | 308 | x, y, a, b, c = list(map(int, input().split()))
ppp = list(map(int, input().split()))
qqq = list(map(int, input().split()))
rrr = list(map(int, input().split()))
ppp.sort(reverse=True)
qqq.sort(reverse=True)
rrr.sort(reverse=True)
ppqq = ppp[:x] + qqq[:y]
ppqq.sort(reverse=True)
ppqq.insert(0, 0)
rrr.insert(0, 0)
i = x... | x, y, a, b, c = list(map(int, input().split()))
ppp = list(map(int, input().split()))
qqq = list(map(int, input().split()))
rrr = list(map(int, input().split()))
ppp.sort(reverse=True)
qqq.sort(reverse=True)
ppqq = ppp[:x] + qqq[:y]
ppqq.extend(rrr)
ppqq.sort(reverse=True)
print((sum(ppqq[: x + y])))
| false | 44.444444 | [
"-rrr.sort(reverse=True)",
"+ppqq.extend(rrr)",
"-ppqq.insert(0, 0)",
"-rrr.insert(0, 0)",
"-i = x + y",
"-j = 1",
"-while i > 0 and j <= c and ppqq[i] < rrr[j]:",
"- i -= 1",
"- j += 1",
"-print((sum(ppqq[: i + 1]) + sum(rrr[:j])))",
"+print((sum(ppqq[: x + y])))"
] | false | 0.091532 | 0.087241 | 1.049186 | [
"s542416178",
"s241299364"
] |
u562935282 | p02735 | python | s274337012 | s032479222 | 238 | 30 | 43,376 | 3,064 | Accepted | Accepted | 87.39 | def main():
from collections import deque
WHITE = 0
BLACK = 1
CHAR = '.', '#'
H, W = list(map(int, input().split()))
s = [eval(input()) for _ in range(H)]
h = deque()
x = CHAR.index(s[0][0])
h.append((x, 0, 0, x))
cost = [[H * W] * W for _ in range(H)]
co... | def main():
H, W = list(map(int, input().split()))
s = [eval(input()) for _ in range(H)]
dp = [[H * W] * W for _ in range(H)]
dp[0][0] = int(s[0][0] == '#')
for r in range(H):
for c in range(W):
if r > 0:
dp[r][c] = min(dp[r][c], dp[r - 1][c] + int(s... | 70 | 22 | 1,949 | 573 | def main():
from collections import deque
WHITE = 0
BLACK = 1
CHAR = ".", "#"
H, W = list(map(int, input().split()))
s = [eval(input()) for _ in range(H)]
h = deque()
x = CHAR.index(s[0][0])
h.append((x, 0, 0, x))
cost = [[H * W] * W for _ in range(H)]
cost[0][0] = x
whi... | def main():
H, W = list(map(int, input().split()))
s = [eval(input()) for _ in range(H)]
dp = [[H * W] * W for _ in range(H)]
dp[0][0] = int(s[0][0] == "#")
for r in range(H):
for c in range(W):
if r > 0:
dp[r][c] = min(
dp[r][c], dp[r - 1][c] ... | false | 68.571429 | [
"- from collections import deque",
"-",
"- WHITE = 0",
"- BLACK = 1",
"- CHAR = \".\", \"#\"",
"- h = deque()",
"- x = CHAR.index(s[0][0])",
"- h.append((x, 0, 0, x))",
"- cost = [[H * W] * W for _ in range(H)]",
"- cost[0][0] = x",
"- while h:",
"- cnt, r,... | false | 0.038529 | 0.038705 | 0.995449 | [
"s274337012",
"s032479222"
] |
u970267139 | p03752 | python | s666626824 | s824559418 | 327 | 170 | 3,064 | 3,064 | Accepted | Accepted | 48.01 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = pow(10, 18)
for i in range(2 ** N):
cost = 0
cnt = 0
highest = 0
for j in range(N):
if (i >> j) & 1:
cnt += 1
if highest >= a[j]:
cost += highest - a[j] + 1
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cost = 10 ** 18
for i in range(2 ** (n - 1)):
num = 0
c = 0
prev = a[0]
for j in range(n - 1):
if i >> j & 1:
num += 1
if a[j + 1] <= prev:
c += prev - a[j + 1] + 1
... | 21 | 18 | 442 | 437 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = pow(10, 18)
for i in range(2**N):
cost = 0
cnt = 0
highest = 0
for j in range(N):
if (i >> j) & 1:
cnt += 1
if highest >= a[j]:
cost += highest - a[j] + 1
high... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cost = 10**18
for i in range(2 ** (n - 1)):
num = 0
c = 0
prev = a[0]
for j in range(n - 1):
if i >> j & 1:
num += 1
if a[j + 1] <= prev:
c += prev - a[j + 1] + 1
pr... | false | 14.285714 | [
"-N, K = list(map(int, input().split()))",
"+n, k = list(map(int, input().split()))",
"-ans = pow(10, 18)",
"-for i in range(2**N):",
"- cost = 0",
"- cnt = 0",
"- highest = 0",
"- for j in range(N):",
"- if (i >> j) & 1:",
"- cnt += 1",
"- if highest >= ... | false | 0.068628 | 0.088793 | 0.772903 | [
"s666626824",
"s824559418"
] |
u605853117 | p03170 | python | s894278687 | s961418817 | 1,077 | 333 | 60,508 | 52,828 | Accepted | Accepted | 69.08 | """
AtCoder Educational DP Contest
https://atcoder.jp/contests/dp/tasks/dp_k
K - Stones
"""
import collections
def solve(xs):
dp = collections.defaultdict(bool)
dp[0] = False
for j in range(1, K + 1):
iterable = ((j >= x) and (not dp[j - x]) for x in xs)
dp[j] = any(iterable... | """
AtCoder Educational DP Contest
https://atcoder.jp/contests/dp/tasks/dp_k
K - Stones
"""
import collections
def solve(xs):
dp = collections.defaultdict(bool)
dp[0] = False
for j in range(1, K + 1):
dp[j] = any((j >= x) and (not dp[j - x]) for x in xs)
return dp[K]
N, K = lis... | 22 | 20 | 529 | 473 | """
AtCoder Educational DP Contest
https://atcoder.jp/contests/dp/tasks/dp_k
K - Stones
"""
import collections
def solve(xs):
dp = collections.defaultdict(bool)
dp[0] = False
for j in range(1, K + 1):
iterable = ((j >= x) and (not dp[j - x]) for x in xs)
dp[j] = any(iterable)
return dp... | """
AtCoder Educational DP Contest
https://atcoder.jp/contests/dp/tasks/dp_k
K - Stones
"""
import collections
def solve(xs):
dp = collections.defaultdict(bool)
dp[0] = False
for j in range(1, K + 1):
dp[j] = any((j >= x) and (not dp[j - x]) for x in xs)
return dp[K]
N, K = list(map(int, inp... | false | 9.090909 | [
"- iterable = ((j >= x) and (not dp[j - x]) for x in xs)",
"- dp[j] = any(iterable)",
"+ dp[j] = any((j >= x) and (not dp[j - x]) for x in xs)",
"-choices = collections.Counter([float(s) for s in input().split()])",
"+choices = [int(s) for s in input().split()]"
] | false | 0.101389 | 0.041766 | 2.427541 | [
"s894278687",
"s961418817"
] |
u406379114 | p02659 | python | s075683580 | s817427835 | 28 | 23 | 10,068 | 9,184 | Accepted | Accepted | 17.86 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
c = a*b
print((int(a*b))) | a, b = input().split()
a = int(a)
c = 0
c += a*int(b[0])*100
c += a*int(b[2])*10
c += a*int(b[3])
c = str(c)
if(len(c) < 3):
print((0))
else:
print((c[:-2]))
| 7 | 13 | 111 | 172 | from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
c = a * b
print((int(a * b)))
| a, b = input().split()
a = int(a)
c = 0
c += a * int(b[0]) * 100
c += a * int(b[2]) * 10
c += a * int(b[3])
c = str(c)
if len(c) < 3:
print((0))
else:
print((c[:-2]))
| false | 46.153846 | [
"-from decimal import Decimal",
"-",
"-a = Decimal(a)",
"-b = Decimal(b)",
"-c = a * b",
"-print((int(a * b)))",
"+a = int(a)",
"+c = 0",
"+c += a * int(b[0]) * 100",
"+c += a * int(b[2]) * 10",
"+c += a * int(b[3])",
"+c = str(c)",
"+if len(c) < 3:",
"+ print((0))",
"+else:",
"+ ... | false | 0.054179 | 0.050602 | 1.070678 | [
"s075683580",
"s817427835"
] |
u692746605 | p02714 | python | s287398682 | s290393202 | 1,405 | 958 | 9,252 | 9,192 | Accepted | Accepted | 31.81 | N=int(eval(input()))
S=[1 if x=='R' else (2 if x=='G' else 3) for x in [*eval(input())]]
t=S.count(1)*S.count(2)*S.count(3)
for i in range(N-2):
j=1
while i+2*j<N:
if S[i]*S[i+j]*S[i+2*j]==6:
t-=1
j+=1
print(t)
| def main():
N=int(eval(input()))
S=[1 if x=='R' else (2 if x=='G' else 3) for x in [*eval(input())]]
t=S.count(1)*S.count(2)*S.count(3)
for i in range(N-2):
j=1
while i+2*j<N:
if S[i]*S[i+j]*S[i+2*j]==6:
t-=1
j+=1
print(t)
main()
| 12 | 15 | 230 | 273 | N = int(eval(input()))
S = [1 if x == "R" else (2 if x == "G" else 3) for x in [*eval(input())]]
t = S.count(1) * S.count(2) * S.count(3)
for i in range(N - 2):
j = 1
while i + 2 * j < N:
if S[i] * S[i + j] * S[i + 2 * j] == 6:
t -= 1
j += 1
print(t)
| def main():
N = int(eval(input()))
S = [1 if x == "R" else (2 if x == "G" else 3) for x in [*eval(input())]]
t = S.count(1) * S.count(2) * S.count(3)
for i in range(N - 2):
j = 1
while i + 2 * j < N:
if S[i] * S[i + j] * S[i + 2 * j] == 6:
t -= 1
j... | false | 20 | [
"-N = int(eval(input()))",
"-S = [1 if x == \"R\" else (2 if x == \"G\" else 3) for x in [*eval(input())]]",
"-t = S.count(1) * S.count(2) * S.count(3)",
"-for i in range(N - 2):",
"- j = 1",
"- while i + 2 * j < N:",
"- if S[i] * S[i + j] * S[i + 2 * j] == 6:",
"- t -= 1",
"... | false | 0.036118 | 0.038421 | 0.940076 | [
"s287398682",
"s290393202"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.