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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u396210538 | p02696 | python | s711102825 | s773268847 | 22 | 20 | 9,156 | 9,160 | Accepted | Accepted | 9.09 | from sys import stdin
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = (A*N)//B-A*(N//B)
if B-1<=N:
ans2 = (A*(B-1))//B
else:
ans2=0
print((max(ans1,ans2))) | from sys import stdin
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = ((A*N)//B)-A*int(N/B)
if B-1<=N:
ans2 = (A*(B-1))//B
else:
ans2=0
print((max(ans1,ans2))) | 12 | 12 | 197 | 201 | from sys import stdin
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = (A * N) // B - A * (N // B)
if B - 1 <= N:
ans2 = (A * (B - 1)) // B
else:
ans2 = 0
print((max(ans1, ans2)))
| from sys import stdin
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = ((A * N) // B) - A * int(N / B)
if B - 1 <= N:
ans2 = (A * (B - 1)) // B
else:
ans2 = 0
print((max(ans1, ans2)))
| false | 0 | [
"-ans1 = (A * N) // B - A * (N // B)",
"+ans1 = ((A * N) // B) - A * int(N / B)"
] | false | 0.042776 | 0.139137 | 0.307435 | [
"s711102825",
"s773268847"
] |
u150984829 | p02410 | python | s592297519 | s114281839 | 30 | 20 | 6,012 | 6,016 | Accepted | Accepted | 33.33 | n,m=list(map(int,input().split()))
A=[[] for _ in range(n)]
for i in range(n):
A[i] = [_ for _ in map(int,input().split())]
b=[]
for i in range(m):
b.append(int(eval(input())))
for i in range(n):
c=0
for j in range(m):
c+=A[i][j]*b[j]
print(c) | n,m=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(n)]
b=[int(eval(input())) for _ in range(m)]
for i in range(n):
print((sum([A[i][j]*b[j] for j in range(m)]))) | 12 | 5 | 249 | 185 | n, m = list(map(int, input().split()))
A = [[] for _ in range(n)]
for i in range(n):
A[i] = [_ for _ in map(int, input().split())]
b = []
for i in range(m):
b.append(int(eval(input())))
for i in range(n):
c = 0
for j in range(m):
c += A[i][j] * b[j]
print(c)
| n, m = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(n)]
b = [int(eval(input())) for _ in range(m)]
for i in range(n):
print((sum([A[i][j] * b[j] for j in range(m)])))
| false | 58.333333 | [
"-A = [[] for _ in range(n)]",
"+A = [list(map(int, input().split())) for _ in range(n)]",
"+b = [int(eval(input())) for _ in range(m)]",
"- A[i] = [_ for _ in map(int, input().split())]",
"-b = []",
"-for i in range(m):",
"- b.append(int(eval(input())))",
"-for i in range(n):",
"- c = 0",
... | false | 0.049107 | 0.04894 | 1.003411 | [
"s592297519",
"s114281839"
] |
u146816547 | p00710 | python | s615648698 | s768787303 | 30 | 20 | 4,648 | 4,648 | Accepted | Accepted | 33.33 | while True:
n, r = list(map(int, input().split()))
if n == 0 and r == 0:
break
Cards = [i for i in range(n, 0, -1)]
for i in range(r):
p, c = list(map(int, input().split()))
Cards = Cards[p-1:p-1+c] + Cards[:p-1] + Cards[p-1+c:]
print(Cards[0])
| while True:
n, r = list(map(int, input().split()))
if n == 0 and r == 0:
break
Cards = list(range(n, 0, -1))
for i in range(r):
p, c = list(map(int, input().split()))
Cards = Cards[p-1:p-1+c] + Cards[:p-1] + Cards[p-1+c:]
print(Cards[0])
| 13 | 14 | 300 | 289 | while True:
n, r = list(map(int, input().split()))
if n == 0 and r == 0:
break
Cards = [i for i in range(n, 0, -1)]
for i in range(r):
p, c = list(map(int, input().split()))
Cards = Cards[p - 1 : p - 1 + c] + Cards[: p - 1] + Cards[p - 1 + c :]
print(Cards[0])
| while True:
n, r = list(map(int, input().split()))
if n == 0 and r == 0:
break
Cards = list(range(n, 0, -1))
for i in range(r):
p, c = list(map(int, input().split()))
Cards = Cards[p - 1 : p - 1 + c] + Cards[: p - 1] + Cards[p - 1 + c :]
print(Cards[0])
| false | 7.142857 | [
"- Cards = [i for i in range(n, 0, -1)]",
"+ Cards = list(range(n, 0, -1))"
] | false | 0.043933 | 0.068003 | 0.646044 | [
"s615648698",
"s768787303"
] |
u332793228 | p03264 | python | s053210896 | s943067256 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | k=int(eval(input()))
print((k**2//4)) | print((int(eval(input()))**2>>2)) | 2 | 1 | 30 | 25 | k = int(eval(input()))
print((k**2 // 4))
| print((int(eval(input())) ** 2 >> 2))
| false | 50 | [
"-k = int(eval(input()))",
"-print((k**2 // 4))",
"+print((int(eval(input())) ** 2 >> 2))"
] | false | 0.047302 | 0.047059 | 1.005157 | [
"s053210896",
"s943067256"
] |
u368796742 | p03158 | python | s549201732 | s667072352 | 1,456 | 1,154 | 103,604 | 24,240 | Accepted | Accepted | 20.74 | import bisect
n,q = list(map(int,input().split()))
A = list(map(int,input().split()))
dic = {}
w = [A[0]]
for i in range(1,n):
w.append(w[-1]+A[i])
w1 = [A[0],0]
w2 = [0,A[1]]
for i in range(2,n):
if i%2 == 0:
w1.append(w1[-2]+A[i])
w2.append(0)
else:
w2.append(w2... | n,q = list(map(int,input().split()))
A = list(map(int,input().split()))
w = [A[0]]
for i in range(1,n):
w.append(w[-1]+A[i])
w1 = [0]*n
for i in range(n):
if (n-1-i)%2 == 0:
w1[i] = A[i]
if i > 0:
w1[i] += w1[i-1]
def solve(x):
l = 0
r = n+1
while r-l > 1:
... | 95 | 37 | 2,312 | 724 | import bisect
n, q = list(map(int, input().split()))
A = list(map(int, input().split()))
dic = {}
w = [A[0]]
for i in range(1, n):
w.append(w[-1] + A[i])
w1 = [A[0], 0]
w2 = [0, A[1]]
for i in range(2, n):
if i % 2 == 0:
w1.append(w1[-2] + A[i])
w2.append(0)
else:
w2.append(w2[-2] +... | n, q = list(map(int, input().split()))
A = list(map(int, input().split()))
w = [A[0]]
for i in range(1, n):
w.append(w[-1] + A[i])
w1 = [0] * n
for i in range(n):
if (n - 1 - i) % 2 == 0:
w1[i] = A[i]
if i > 0:
w1[i] += w1[i - 1]
def solve(x):
l = 0
r = n + 1
while r - l > 1:
... | false | 61.052632 | [
"-import bisect",
"-",
"-dic = {}",
"-w1 = [A[0], 0]",
"-w2 = [0, A[1]]",
"-for i in range(2, n):",
"- if i % 2 == 0:",
"- w1.append(w1[-2] + A[i])",
"- w2.append(0)",
"- else:",
"- w2.append(w2[-2] + A[i])",
"- w1.append(0)",
"+w1 = [0] * n",
"+for i in r... | false | 0.04345 | 0.081681 | 0.531946 | [
"s549201732",
"s667072352"
] |
u864197622 | p02998 | python | s842920137 | s045061454 | 886 | 779 | 122,544 | 117,296 | Accepted | Accepted | 12.08 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(eval(input()))
K = 10**5+1
P = [i for i in range(K)]
def par(a):
if P[a] == a:
return a
t = par(P[a])
P[a] = t
return t
def cb(a, b):
pa = par(a)
pb = par(b)
if pa != pb:
P[pa] = pb... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(eval(input()))
K = 10**5+1
P = [i for i in range(K)]
def par(a):
if P[a] == a:
return a
t = par(P[a])
P[a] = t
return t
def cb(a, b):
P[par(b)] = par(a)
X = [[] for _ in range(K)]
Y = [[] for _ in... | 41 | 38 | 813 | 766 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(eval(input()))
K = 10**5 + 1
P = [i for i in range(K)]
def par(a):
if P[a] == a:
return a
t = par(P[a])
P[a] = t
return t
def cb(a, b):
pa = par(a)
pb = par(b)
if pa != pb:
P[pa] = pb
X = [[] ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(eval(input()))
K = 10**5 + 1
P = [i for i in range(K)]
def par(a):
if P[a] == a:
return a
t = par(P[a])
P[a] = t
return t
def cb(a, b):
P[par(b)] = par(a)
X = [[] for _ in range(K)]
Y = [[] for _ in range(K)]... | false | 7.317073 | [
"- pa = par(a)",
"- pb = par(b)",
"- if pa != pb:",
"- P[pa] = pb",
"+ P[par(b)] = par(a)"
] | false | 0.589823 | 0.969475 | 0.608394 | [
"s842920137",
"s045061454"
] |
u606878291 | p02881 | python | s450287939 | s271628871 | 201 | 115 | 3,064 | 3,316 | Accepted | Accepted | 42.79 | import math
def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q & 1 == 0: return False
return pow(2, q - 1, q) == 1
def main(n):
if is_prime(n):
return n - 1
else:
sqrt = int(math.sqrt(n))
for i in range(sqrt, 1, -1):
div, mod ... | def get_half_dividers(n):
return {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}
N = int(eval(input()))
dividers = get_half_dividers(N)
print((min([max(0, d - 1) + max(0, (N // d) - 1) for d in dividers])))
| 24 | 8 | 471 | 220 | import math
def is_prime(q):
q = abs(q)
if q == 2:
return True
if q < 2 or q & 1 == 0:
return False
return pow(2, q - 1, q) == 1
def main(n):
if is_prime(n):
return n - 1
else:
sqrt = int(math.sqrt(n))
for i in range(sqrt, 1, -1):
div, mod ... | def get_half_dividers(n):
return {i for i in range(1, int(n**0.5) + 1) if n % i == 0}
N = int(eval(input()))
dividers = get_half_dividers(N)
print((min([max(0, d - 1) + max(0, (N // d) - 1) for d in dividers])))
| false | 66.666667 | [
"-import math",
"+def get_half_dividers(n):",
"+ return {i for i in range(1, int(n**0.5) + 1) if n % i == 0}",
"-def is_prime(q):",
"- q = abs(q)",
"- if q == 2:",
"- return True",
"- if q < 2 or q & 1 == 0:",
"- return False",
"- return pow(2, q - 1, q) == 1",
"-",
... | false | 0.036794 | 0.088025 | 0.417988 | [
"s450287939",
"s271628871"
] |
u879870653 | p03575 | python | s694078514 | s535514977 | 130 | 21 | 3,572 | 3,064 | Accepted | Accepted | 83.85 | from collections import deque
from copy import deepcopy
N,M = list(map(int,input().split()))
Matrix = [[False for x in range(N)] for y in range(N)]
Path = []
for i in range(M) :
a,b = list(map(int,input().split()))
a -= 1
b -= 1
Path.append((a,b))
Matrix[a][b] = True
Matrix[b][a] ... | class UnionFind:
def __init__(self, num):
self.rank = [0] * num
self.par = [i for i in range(num)]
self.n = num
def find_root(self, node):
if self.par[node] == node:
return node
else:
self.par[node] = self.find_root(self.par[node])
... | 34 | 54 | 880 | 1,321 | from collections import deque
from copy import deepcopy
N, M = list(map(int, input().split()))
Matrix = [[False for x in range(N)] for y in range(N)]
Path = []
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
Path.append((a, b))
Matrix[a][b] = True
Matrix[b][a] = True
ans... | class UnionFind:
def __init__(self, num):
self.rank = [0] * num
self.par = [i for i in range(num)]
self.n = num
def find_root(self, node):
if self.par[node] == node:
return node
else:
self.par[node] = self.find_root(self.par[node])
ret... | false | 37.037037 | [
"-from collections import deque",
"-from copy import deepcopy",
"+class UnionFind:",
"+ def __init__(self, num):",
"+ self.rank = [0] * num",
"+ self.par = [i for i in range(num)]",
"+ self.n = num",
"-N, M = list(map(int, input().split()))",
"-Matrix = [[False for x in range... | false | 0.079469 | 0.082999 | 0.957473 | [
"s694078514",
"s535514977"
] |
u981332890 | p02812 | python | s059774432 | s589702268 | 271 | 17 | 18,756 | 2,940 | Accepted | Accepted | 93.73 | import numpy as np
def main():
N = int(eval(input()))
S = eval(input())
print((S.count("ABC")))
return 0
if __name__ == '__main__':
main() | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N-2):
if S[i:i+3] == "ABC":
ans += 1
print(ans)
| 12 | 9 | 159 | 122 | import numpy as np
def main():
N = int(eval(input()))
S = eval(input())
print((S.count("ABC")))
return 0
if __name__ == "__main__":
main()
| N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N - 2):
if S[i : i + 3] == "ABC":
ans += 1
print(ans)
| false | 25 | [
"-import numpy as np",
"-",
"-",
"-def main():",
"- N = int(eval(input()))",
"- S = eval(input())",
"- print((S.count(\"ABC\")))",
"- return 0",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",
"+N = int(eval(input()))",
"+S = eval(input())",
"+ans = 0",
"+for i in... | false | 0.07151 | 0.039717 | 1.800496 | [
"s059774432",
"s589702268"
] |
u102461423 | p03580 | python | s941731230 | s199670444 | 294 | 204 | 8,360 | 8,360 | Accepted | Accepted | 30.61 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = readline().rstrip().decode('utf-8')
def solve_partial(S):
INF = 10**18
"""
・Sは1から始まり、1で終わる
・Sは00を含まない
・したがって、Sは1,01に分解可能
・残る最小個数を調べるdp。これは、1... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = readline().rstrip().decode('utf-8')
def solve_partial(S):
INF = 10**18
"""
・Sは1から始まり、1で終わる
・Sは00を含まない
・したがって、Sは1,01に分解可能
・残る最小個数を調べるdp。これは、1... | 41 | 42 | 942 | 954 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = readline().rstrip().decode("utf-8")
def solve_partial(S):
INF = 10**18
"""
・Sは1から始まり、1で終わる
・Sは00を含まない
・したがって、Sは1,01に分解可能
・残る最小個数を調べるdp。これは、1, 101111,1111... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = readline().rstrip().decode("utf-8")
def solve_partial(S):
INF = 10**18
"""
・Sは1から始まり、1で終わる
・Sは00を含まない
・したがって、Sは1,01に分解可能
・残る最小個数を調べるdp。これは、1, 101111,1111... | false | 2.380952 | [
"+ ace = min(a, c, e)",
"- a2 = min(a, c, e) + 1",
"+ a2 = ace + 1",
"- d2 = min(a, c, d, e)",
"+ d2 = ace if ace < d else d",
"- a2 = min(a, c, e) + 1",
"+ a2 = ace + 1",
"- d2 = min(a, c, e)",
"+ d2 = ac... | false | 0.036919 | 0.037882 | 0.974572 | [
"s941731230",
"s199670444"
] |
u562935282 | p03546 | python | s474995457 | s618646645 | 38 | 30 | 3,316 | 3,316 | Accepted | Accepted | 21.05 | def warshall_floyd(cost):
# cost[i][j] : iからjへの最短距離
for k in range(10):
for i in range(10):
for j in range(10):
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])
return cost
h, w = list(map(int, input().split()))
cost = [list(map(int, input().split())) for... | def main():
h, w = list(map(int, input().split()))
c = [[int(x) for x in input().split()] for _ in range(10)]
a = [[int(x) for x in input().split()] for _ in range(h)]
for k in range(10):
for i in range(10):
for j in range(10):
c[i][j] = min(c[i][j], c[i][k] ... | 23 | 22 | 589 | 509 | def warshall_floyd(cost):
# cost[i][j] : iからjへの最短距離
for k in range(10):
for i in range(10):
for j in range(10):
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])
return cost
h, w = list(map(int, input().split()))
cost = [list(map(int, input().split())) for _ in rang... | def main():
h, w = list(map(int, input().split()))
c = [[int(x) for x in input().split()] for _ in range(10)]
a = [[int(x) for x in input().split()] for _ in range(h)]
for k in range(10):
for i in range(10):
for j in range(10):
c[i][j] = min(c[i][j], c[i][k] + c[k][j]... | false | 4.347826 | [
"-def warshall_floyd(cost):",
"- # cost[i][j] : iからjへの最短距離",
"+def main():",
"+ h, w = list(map(int, input().split()))",
"+ c = [[int(x) for x in input().split()] for _ in range(10)]",
"+ a = [[int(x) for x in input().split()] for _ in range(h)]",
"- cost[i][j] = min(cost[i][j... | false | 0.07509 | 0.034335 | 2.186966 | [
"s474995457",
"s618646645"
] |
u562935282 | p02802 | python | s590117745 | s487274478 | 289 | 135 | 3,828 | 4,596 | Accepted | Accepted | 53.29 | def solved(p):
return cwa[p] == -1
n, m = list(map(int, input().split()))
wa = 0
cwa = [0] * n
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if solved(p):
continue
if s == 'AC':
wa += cwa[p]
cwa[p] = -1
else:
cwa[p] += 1
ac = cwa.... | def main():
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ac = [False] * N
wa = [0] * N
for _ in range(M):
it = iter(input().split())
p = int(next(it)) - 1
s = next(it)
if s == 'AC':
ac[p] = True
e... | 21 | 22 | 339 | 488 | def solved(p):
return cwa[p] == -1
n, m = list(map(int, input().split()))
wa = 0
cwa = [0] * n
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if solved(p):
continue
if s == "AC":
wa += cwa[p]
cwa[p] = -1
else:
cwa[p] += 1
ac = cwa.count(-1)
print((ac, ... | def main():
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ac = [False] * N
wa = [0] * N
for _ in range(M):
it = iter(input().split())
p = int(next(it)) - 1
s = next(it)
if s == "AC":
ac[p] = True
else:
... | false | 4.545455 | [
"-def solved(p):",
"- return cwa[p] == -1",
"+def main():",
"+ import sys",
"+",
"+ input = sys.stdin.readline",
"+ N, M = list(map(int, input().split()))",
"+ ac = [False] * N",
"+ wa = [0] * N",
"+ for _ in range(M):",
"+ it = iter(input().split())",
"+ p =... | false | 0.048312 | 0.051947 | 0.930027 | [
"s590117745",
"s487274478"
] |
u655975843 | p03112 | python | s507760358 | s077719739 | 1,080 | 665 | 16,380 | 16,364 | Accepted | Accepted | 38.43 | 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]
ans = []
for i in range(q):
x = int(eval(input()))
idxs = bisect.bisect(s, x)
idxt = bisect.bisect(t, x)
... | import bisect
import sys
input = sys.stdin.readline
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]
ans = []
for i in range(q):
x = int(eval(input()))
idxs = bisect.bisect(s... | 24 | 25 | 701 | 739 | 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]
ans = []
for i in range(q):
x = int(eval(input()))
idxs = bisect.bisect(s, x)
idxt = bisect.bisect(t, x)
lis = []
... | import bisect
import sys
input = sys.stdin.readline
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]
ans = []
for i in range(q):
x = int(eval(input()))
idxs = bisect.bisect(s, x)
id... | false | 4 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.037661 | 0.047708 | 0.789399 | [
"s507760358",
"s077719739"
] |
u594862874 | p02813 | python | s499979024 | s412324987 | 44 | 27 | 15,140 | 8,052 | Accepted | Accepted | 38.64 | import itertools
import math
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))
a = L.index(P)
b = L.index(Q)
print((abs(a-b))) | from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
perm = list(permutations(list(range(1, N+1)), N))
print((abs(perm.index(P) - perm.index(Q)))) | 9 | 8 | 253 | 221 | import itertools
import math
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list, list(itertools.permutations(list(i for i in range(1, N + 1)), N))))
a = L.index(P)
b = L.index(Q)
print((abs(a - b)))
| from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
perm = list(permutations(list(range(1, N + 1)), N))
print((abs(perm.index(P) - perm.index(Q))))
| false | 11.111111 | [
"-import itertools",
"-import math",
"+from itertools import permutations",
"-P = list(map(int, input().split()))",
"-Q = list(map(int, input().split()))",
"-L = list(map(list, list(itertools.permutations(list(i for i in range(1, N + 1)), N))))",
"-a = L.index(P)",
"-b = L.index(Q)",
"-print((abs(a ... | false | 0.038884 | 0.035143 | 1.106452 | [
"s499979024",
"s412324987"
] |
u968166680 | p02839 | python | s908023337 | s340523971 | 1,342 | 179 | 227,308 | 93,700 | Accepted | Accepted | 86.66 | 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():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, rea... | 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():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, rea... | 45 | 45 | 1,083 | 1,163 | 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():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, readline().split()... | 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():
H, W = list(map(int, readline().split()))
A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, readline().split()... | false | 0 | [
"+ M = 0",
"- dp = [set() for j in range(W)]",
"- dp[0].add(G[0][0])",
"+ if M < G[i][j]:",
"+ M = G[i][j]",
"+ M = 20000",
"+ dp = [[0] * W for _ in range(H)]",
"+ dp[0][0] = 1 << (M + G[0][0]) | 1 << (M - G[0][0])",
"- if i == 0 and j == 0:",
... | false | 0.036759 | 0.059422 | 0.618598 | [
"s908023337",
"s340523971"
] |
u729133443 | p02616 | python | s626241605 | s594520542 | 174 | 160 | 31,680 | 112,196 | Accepted | Accepted | 8.05 | n,k,*a=list(map(int,open(i:=0).read().split()))
a.sort()
p=a.pop
s=b=~k%2or p()
while k>1:
if(x:=a[i]*a[i+1])*b>a[-1]*a[-2]*b:s*=x;i+=2
else:s*=p()*p()
s%=10**9+7;k-=2
print(s) | n,k,*a=list(map(int,open(0).read().split()))
a.sort()
p=a.pop
s=b=~k%2or p()
i=0
while k>1:
x=a[i]*a[i+1]
if x*b>a[-1]*a[-2]*b:s*=x;i+=2
else:s*=p()*p()
s%=10**9+7;k-=2
print(s) | 9 | 11 | 181 | 185 | n, k, *a = list(map(int, open(i := 0).read().split()))
a.sort()
p = a.pop
s = b = ~k % 2 or p()
while k > 1:
if (x := a[i] * a[i + 1]) * b > a[-1] * a[-2] * b:
s *= x
i += 2
else:
s *= p() * p()
s %= 10**9 + 7
k -= 2
print(s)
| n, k, *a = list(map(int, open(0).read().split()))
a.sort()
p = a.pop
s = b = ~k % 2 or p()
i = 0
while k > 1:
x = a[i] * a[i + 1]
if x * b > a[-1] * a[-2] * b:
s *= x
i += 2
else:
s *= p() * p()
s %= 10**9 + 7
k -= 2
print(s)
| false | 18.181818 | [
"-n, k, *a = list(map(int, open(i := 0).read().split()))",
"+n, k, *a = list(map(int, open(0).read().split()))",
"+i = 0",
"- if (x := a[i] * a[i + 1]) * b > a[-1] * a[-2] * b:",
"+ x = a[i] * a[i + 1]",
"+ if x * b > a[-1] * a[-2] * b:"
] | false | 0.033194 | 0.059487 | 0.557999 | [
"s626241605",
"s594520542"
] |
u466331465 | p02814 | python | s150184395 | s591072497 | 471 | 415 | 89,580 | 89,580 | Accepted | Accepted | 11.89 | import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
a = 1
MOD = 10**9+7
cnt = 0
l = 0
for i in A:
i = i//2
a = lcm(a,i)
for i in A:
cnt1=0
i=i//2
b=a//i
if b%2==0:
while b%2==0:
b=... | import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
a = 1
MOD = 10**9+7
cnt = 10**9
l = 0
for i in A:
i = i//2
a = lcm(a,i)
for i in A:
cnt1=0
b=i//2
if b%2==0:
while b%2==0:
b=b/2
... | 31 | 25 | 499 | 432 | import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
a = 1
MOD = 10**9 + 7
cnt = 0
l = 0
for i in A:
i = i // 2
a = lcm(a, i)
for i in A:
cnt1 = 0
i = i // 2
b = a // i
if b % 2 == 0:
... | import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
a = 1
MOD = 10**9 + 7
cnt = 10**9
l = 0
for i in A:
i = i // 2
a = lcm(a, i)
for i in A:
cnt1 = 0
b = i // 2
if b % 2 == 0:
while b % 2... | false | 19.354839 | [
"-cnt = 0",
"+cnt = 10**9",
"- i = i // 2",
"- b = a // i",
"+ b = i // 2",
"- if cnt == 0:",
"+ if cnt == 10**9:",
"- l += 1",
"- else:",
"- if cnt != cnt1:",
"- print((0))",
"- exit()",
"-if l == N and cnt != 0:",
"- print((0))",
... | false | 0.082552 | 0.088251 | 0.935425 | [
"s150184395",
"s591072497"
] |
u864197622 | p02710 | python | s346924926 | s277726801 | 449 | 330 | 137,848 | 116,672 | Accepted | Accepted | 26.5 | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
C = [int(a) - 1 for a in input().split()]
X = [[] for i in range(N)]
for i in range(N-1):
x, y = map(int, input().split())
X[x-1].append(y-1)
X[y-1].append(x-1)
def EulerTour(n, X, i0):
f = lambda k: k * (k + 1) // 2
... | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
C = [int(a) - 1 for a in input().split()]
X = [[] for i in range(N)]
head = [-1] * (N + 1)
to = [0] * (N - 1 << 1)
nxt = [0] * (N - 1 << 1)
for i in range(N-1):
x, y = map(int, input().split())
x, y = x-1, y-1
nxt[i] = head... | 51 | 59 | 1,197 | 1,327 | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
C = [int(a) - 1 for a in input().split()]
X = [[] for i in range(N)]
for i in range(N - 1):
x, y = map(int, input().split())
X[x - 1].append(y - 1)
X[y - 1].append(x - 1)
def EulerTour(n, X, i0):
f = lambda k: k * (k + 1) // 2
... | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
C = [int(a) - 1 for a in input().split()]
X = [[] for i in range(N)]
head = [-1] * (N + 1)
to = [0] * (N - 1 << 1)
nxt = [0] * (N - 1 << 1)
for i in range(N - 1):
x, y = map(int, input().split())
x, y = x - 1, y - 1
nxt[i] = head[x]
... | false | 13.559322 | [
"+head = [-1] * (N + 1)",
"+to = [0] * (N - 1 << 1)",
"+nxt = [0] * (N - 1 << 1)",
"- X[x - 1].append(y - 1)",
"- X[y - 1].append(x - 1)",
"+ x, y = x - 1, y - 1",
"+ nxt[i] = head[x]",
"+ to[i] = y",
"+ head[x] = i",
"+ j = i + N - 1",
"+ nxt[j] = head[y]",
"+ to[j]... | false | 0.060713 | 0.044029 | 1.378917 | [
"s346924926",
"s277726801"
] |
u238504302 | p02756 | python | s040586999 | s013691154 | 884 | 376 | 43,136 | 45,844 | Accepted | Accepted | 57.47 | S = eval(input())
Q = int(eval(input()))
Query = list(input().split() for _ in range(Q))
count = 0
L, R = "", ""
for i in range(Q):
if Query[i][0] == "1": count += 1
else:
if Query[i][1] == "1":
if count % 2 == 0: L = Query[i][2] + L
else: R += Query[i][2]
else:
if count % ... | from queue import deque
S = eval(input())
Q = int(eval(input()))
Query = list(input().split() for _ in range(Q))
count = 0
L, R = deque(), deque()
for i in range(Q):
if Query[i][0] == "1": count += 1
else:
if Query[i][1] == "1":
if count % 2 == 0: L.appendleft(Query[i][2])
else: R.app... | 19 | 20 | 446 | 532 | S = eval(input())
Q = int(eval(input()))
Query = list(input().split() for _ in range(Q))
count = 0
L, R = "", ""
for i in range(Q):
if Query[i][0] == "1":
count += 1
else:
if Query[i][1] == "1":
if count % 2 == 0:
L = Query[i][2] + L
else:
... | from queue import deque
S = eval(input())
Q = int(eval(input()))
Query = list(input().split() for _ in range(Q))
count = 0
L, R = deque(), deque()
for i in range(Q):
if Query[i][0] == "1":
count += 1
else:
if Query[i][1] == "1":
if count % 2 == 0:
L.appendleft(Query[... | false | 5 | [
"+from queue import deque",
"+",
"-L, R = \"\", \"\"",
"+L, R = deque(), deque()",
"- L = Query[i][2] + L",
"+ L.appendleft(Query[i][2])",
"- R += Query[i][2]",
"+ R.append(Query[i][2])",
"- R += Query[i][2]",
"+ ... | false | 0.084261 | 0.04245 | 1.984958 | [
"s040586999",
"s013691154"
] |
u788137651 | p03006 | python | s698591743 | s739309083 | 200 | 184 | 39,792 | 39,024 | Accepted | Accepted | 8 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from iter... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from iter... | 58 | 55 | 1,594 | 1,533 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict
from itertools import ... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict
from itertools import ... | false | 5.172414 | [
"+ XY.sort()",
"- XY.sort()",
"- maxim = -inf",
"- for v in list(count.values()):",
"- maxim = max(maxim, v)",
"- print((N - maxim))",
"+ print((N - max(count.values())))"
] | false | 0.088614 | 0.048342 | 1.833052 | [
"s698591743",
"s739309083"
] |
u123756661 | p03136 | python | s918391180 | s360986160 | 191 | 165 | 38,384 | 38,324 | Accepted | Accepted | 13.61 | eval(input())
l=[int(i) for i in input().split()]
print((["No","Yes"][max(l)<sum(l)-max(l)])) | eval(input())
l=[int(i) for i in input().split()]
print((["Yes","No"][max(l)-(sum(l)-max(l))>=0])) | 3 | 3 | 87 | 92 | eval(input())
l = [int(i) for i in input().split()]
print((["No", "Yes"][max(l) < sum(l) - max(l)]))
| eval(input())
l = [int(i) for i in input().split()]
print((["Yes", "No"][max(l) - (sum(l) - max(l)) >= 0]))
| false | 0 | [
"-print(([\"No\", \"Yes\"][max(l) < sum(l) - max(l)]))",
"+print(([\"Yes\", \"No\"][max(l) - (sum(l) - max(l)) >= 0]))"
] | false | 0.043415 | 0.039048 | 1.111852 | [
"s918391180",
"s360986160"
] |
u579699847 | p03163 | python | s387100872 | s689206264 | 1,739 | 799 | 654,572 | 121,200 | Accepted | Accepted | 54.05 | import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [collections.defaultdict(int) for _ in range(N+1)] #1_indexed
dp[0][0] = 0
for i in range(1,N+1):
w,v = wv[i-1]
for dw,dv in list(dp[i-1].items()):
dp[i][dw... | import collections,itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)] #1_indexed
for i,j in itertools.product(list(range(1,N+1)),list(range(W+1))):
w,v = wv[i-1]
if j-w>=0:
dp[i][j] = m... | 13 | 11 | 435 | 396 | import collections, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, W = LI()
wv = [LI() for _ in range(N)]
dp = [collections.defaultdict(int) for _ in range(N + 1)] # 1_indexed
dp[0][0] = 0
for i in range(1, N + 1):
w, v = wv[i - 1]
for dw, dv in list(dp[i - 1].items()):
... | import collections, itertools, sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, W = LI()
wv = [LI() for _ in range(N)]
dp = [[0] * (W + 1) for _ in range(N + 1)] # 1_indexed
for i, j in itertools.product(list(range(1, N + 1)), list(range(W + 1))):
w, v = wv[i - 1]
if j - w ... | false | 15.384615 | [
"-import collections, sys",
"+import collections, itertools, sys",
"-dp = [collections.defaultdict(int) for _ in range(N + 1)] # 1_indexed",
"-dp[0][0] = 0",
"-for i in range(1, N + 1):",
"+dp = [[0] * (W + 1) for _ in range(N + 1)] # 1_indexed",
"+for i, j in itertools.product(list(range(1, N + 1)), ... | false | 0.040023 | 0.055759 | 0.717786 | [
"s387100872",
"s689206264"
] |
u329706129 | p03745 | python | s447818801 | s301128499 | 91 | 81 | 14,480 | 14,436 | Accepted | Accepted | 10.99 | N = int(eval(input()))
A = list(map(int, input().split()))
if(N == 1):
print((1))
exit(0)
cur = A[0]
# 昇順(1)か降順(0)かのフラグ
ans = 1
flag = -1
for i in range(1, N):
if(cur == A[i]): continue
if(flag == -1):
if(A[i] > cur): flag = 1
elif(A[i] < cur): flag = 0
cur = A[i]
... | N = int(eval(input()))
A = list(map(int, input().split()))
if(N == 1):
print((1))
exit(0)
cur = A[0]
# 昇順(1)か降順(0)かのフラグ
ans = 1
flag = -1
for i in range(1, N):
if(cur == A[i]): continue
if(flag == -1):
if(A[i] > cur): flag = 1
elif(A[i] < cur): flag = 0
elif(flag == 1 a... | 31 | 22 | 689 | 467 | N = int(eval(input()))
A = list(map(int, input().split()))
if N == 1:
print((1))
exit(0)
cur = A[0]
# 昇順(1)か降順(0)かのフラグ
ans = 1
flag = -1
for i in range(1, N):
if cur == A[i]:
continue
if flag == -1:
if A[i] > cur:
flag = 1
elif A[i] < cur:
flag = 0
... | N = int(eval(input()))
A = list(map(int, input().split()))
if N == 1:
print((1))
exit(0)
cur = A[0]
# 昇順(1)か降順(0)かのフラグ
ans = 1
flag = -1
for i in range(1, N):
if cur == A[i]:
continue
if flag == -1:
if A[i] > cur:
flag = 1
elif A[i] < cur:
flag = 0
eli... | false | 29.032258 | [
"- cur = A[i]",
"- continue",
"- if flag == 1 and A[i] < cur:",
"- cur, flag = A[i], -1",
"+ elif flag == 1 and A[i] < cur:",
"+ flag = -1",
"- continue",
"- if flag == 1 and A[i] > cur:",
"- cur = A[i]",
"- continue",
"- if flag == 0 ... | false | 0.043428 | 0.04381 | 0.991279 | [
"s447818801",
"s301128499"
] |
u855199458 | p02343 | python | s359455231 | s594468938 | 940 | 840 | 8,824 | 6,716 | Accepted | Accepted | 10.64 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000)
N, Q = tuple(map(int, input().split()))
tree = [[-1, 1] for _ in range(N)] # [next, rank]
def find(i):
if tree[i][0] == -1:
group = i
else:
group = find(tree[i][0])
return group
def unite(x, y):
px =... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000)
N, Q = tuple(map(int, input().split()))
tree = [[-1, 1] for _ in range(N)] # [next, rank]
def find(i):
if tree[i][0] == -1:
group = i
else:
group = find(tree[i][0])
tree[i][0] = group
return group
... | 34 | 35 | 777 | 809 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000)
N, Q = tuple(map(int, input().split()))
tree = [[-1, 1] for _ in range(N)] # [next, rank]
def find(i):
if tree[i][0] == -1:
group = i
else:
group = find(tree[i][0])
return group
def unite(x, y):
px = find(x)
py = f... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000)
N, Q = tuple(map(int, input().split()))
tree = [[-1, 1] for _ in range(N)] # [next, rank]
def find(i):
if tree[i][0] == -1:
group = i
else:
group = find(tree[i][0])
tree[i][0] = group
return group
def unite(x, y):
... | false | 2.857143 | [
"+ tree[i][0] = group"
] | false | 0.044418 | 0.0405 | 1.096752 | [
"s359455231",
"s594468938"
] |
u352394527 | p00472 | python | s970593016 | s674766640 | 600 | 450 | 9,636 | 9,636 | Accepted | Accepted | 25 | n,m = list(map(int,input().split()))
lst = [0]
for i in range(n - 1):
lst.append(lst[-1] + int(eval(input())))
ans = 0
num = 0
for i in range(m):
a = int(eval(input()))
ans += abs(lst[num] - lst[num + a])
ans %= 100000
num += a
print(ans)
| def solve():
n,m = list(map(int,input().split()))
lst = [0]
for i in range(n - 1):
lst.append(lst[-1] + int(eval(input())))
ans = 0
num = 0
for i in range(m):
a = int(eval(input()))
ans += abs(lst[num] - lst[num + a])
num += a
print((ans % 100000))
solve()
| 13 | 13 | 244 | 279 | n, m = list(map(int, input().split()))
lst = [0]
for i in range(n - 1):
lst.append(lst[-1] + int(eval(input())))
ans = 0
num = 0
for i in range(m):
a = int(eval(input()))
ans += abs(lst[num] - lst[num + a])
ans %= 100000
num += a
print(ans)
| def solve():
n, m = list(map(int, input().split()))
lst = [0]
for i in range(n - 1):
lst.append(lst[-1] + int(eval(input())))
ans = 0
num = 0
for i in range(m):
a = int(eval(input()))
ans += abs(lst[num] - lst[num + a])
num += a
print((ans % 100000))
solve()... | false | 0 | [
"-n, m = list(map(int, input().split()))",
"-lst = [0]",
"-for i in range(n - 1):",
"- lst.append(lst[-1] + int(eval(input())))",
"-ans = 0",
"-num = 0",
"-for i in range(m):",
"- a = int(eval(input()))",
"- ans += abs(lst[num] - lst[num + a])",
"- ans %= 100000",
"- num += a",
... | false | 0.045067 | 0.045248 | 0.995995 | [
"s970593016",
"s674766640"
] |
u497952650 | p03457 | python | s036123778 | s419415334 | 373 | 277 | 3,064 | 22,424 | Accepted | Accepted | 25.74 | N = int(eval(input()))
ans = "Yes"
x = 0
y = 0
t = 0
for i in range(N):
t_i,x_i,y_i = list(map(int,input().split()))
x_i = abs(x_i-x)
y_i = abs(y_i-x)
t_i = abs(t_i-t)
if x_i+y_i <= t_i and (x_i+y_i-t_i)%2 == 0:
continue
else:
ans = "No"
x = x_i
y = y... | N = int(eval(input()))
txy = list(tuple(map(int,input().split())) for _ in range(N))
t_0 = 0
x_0 = 0
y_0 = 0
for t,x,y in txy:
dt = t - t_0
dx = x - x_0
dy = y - y_0
if (abs(dx) + abs(dy))%2 == dt%2 and (abs(dx)+abs(dy)) <= dt:
t_0 = t
x_0 = x
y_0 = y
else:... | 20 | 21 | 337 | 367 | N = int(eval(input()))
ans = "Yes"
x = 0
y = 0
t = 0
for i in range(N):
t_i, x_i, y_i = list(map(int, input().split()))
x_i = abs(x_i - x)
y_i = abs(y_i - x)
t_i = abs(t_i - t)
if x_i + y_i <= t_i and (x_i + y_i - t_i) % 2 == 0:
continue
else:
ans = "No"
x = x_i
y = y_i
... | N = int(eval(input()))
txy = list(tuple(map(int, input().split())) for _ in range(N))
t_0 = 0
x_0 = 0
y_0 = 0
for t, x, y in txy:
dt = t - t_0
dx = x - x_0
dy = y - y_0
if (abs(dx) + abs(dy)) % 2 == dt % 2 and (abs(dx) + abs(dy)) <= dt:
t_0 = t
x_0 = x
y_0 = y
else:
p... | false | 4.761905 | [
"-ans = \"Yes\"",
"-x = 0",
"-y = 0",
"-t = 0",
"-for i in range(N):",
"- t_i, x_i, y_i = list(map(int, input().split()))",
"- x_i = abs(x_i - x)",
"- y_i = abs(y_i - x)",
"- t_i = abs(t_i - t)",
"- if x_i + y_i <= t_i and (x_i + y_i - t_i) % 2 == 0:",
"- continue",
"+txy... | false | 0.047582 | 0.045891 | 1.036834 | [
"s036123778",
"s419415334"
] |
u260216890 | p02564 | python | s902989825 | s040208363 | 2,011 | 1,779 | 250,252 | 249,912 | Accepted | Accepted | 11.54 | import sys
input = sys.stdin.readline
n,m = list(map(int, input().split()))
es = [[] for _ in range(n)]
for i in range(m):
a,b=list(map(int, input().split()))
es[a].append(b)
# strongly connected component
def scc(es): # DFSを2回行う
n_node = len(es)
esinv = [[] for _ in range(n_node)]
for ... | import sys
input = sys.stdin.readline
n,m = list(map(int, input().split()))
es = [[] for _ in range(n)]
for i in range(m):
a,b=list(map(int, input().split()))
es[a].append(b)
# strongly connected component
def scc(n_node,es): # DFSを2回行う
esinv = [[] for _ in range(n_node)]
for i in range(n_no... | 63 | 62 | 1,943 | 1,930 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
es = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
es[a].append(b)
# strongly connected component
def scc(es): # DFSを2回行う
n_node = len(es)
esinv = [[] for _ in range(n_node)]
for i in ra... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
es = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
es[a].append(b)
# strongly connected component
def scc(n_node, es): # DFSを2回行う
esinv = [[] for _ in range(n_node)]
for i in range(n_node):
... | false | 1.587302 | [
"-def scc(es): # DFSを2回行う",
"- n_node = len(es)",
"+def scc(n_node, es): # DFSを2回行う",
"-res, compo = scc(es)",
"+res, compo = scc(n, es)"
] | false | 0.139353 | 0.192999 | 0.722038 | [
"s902989825",
"s040208363"
] |
u836939578 | p02572 | python | s513139495 | s694892068 | 129 | 113 | 104,816 | 105,140 | Accepted | Accepted | 12.4 | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
x = 0
ans = 0
for i in range(len(A)):
ans += A[i] * x % MOD
x += A[i] % MOD
print((ans%MOD)) | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
max_edge = sum(A)
tmp = 0
for num in A:
tmp += num ** 2
print(((max_edge ** 2 - tmp) // 2 % MOD)) | 12 | 14 | 187 | 189 | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
x = 0
ans = 0
for i in range(len(A)):
ans += A[i] * x % MOD
x += A[i] % MOD
print((ans % MOD))
| N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
max_edge = sum(A)
tmp = 0
for num in A:
tmp += num**2
print(((max_edge**2 - tmp) // 2 % MOD))
| false | 14.285714 | [
"-x = 0",
"-ans = 0",
"-for i in range(len(A)):",
"- ans += A[i] * x % MOD",
"- x += A[i] % MOD",
"-print((ans % MOD))",
"+max_edge = sum(A)",
"+tmp = 0",
"+for num in A:",
"+ tmp += num**2",
"+print(((max_edge**2 - tmp) // 2 % MOD))"
] | false | 0.036368 | 0.077216 | 0.470996 | [
"s513139495",
"s694892068"
] |
u970197315 | p03575 | python | s722181888 | s919268330 | 27 | 24 | 3,064 | 3,064 | Accepted | Accepted | 11.11 | # ABC075 C - Bridge
def dfs(v):
visited[v]=True
for nv in range(n):
if G[v][nv]==False:
continue
if visited[nv]:
continue
dfs(nv)
n,m = list(map(int,input().split()))
G = [[False]*n for _ in range(n)]
ans = 0
visited = [False for _ in range(n)]
A,B ... | class UnionFind:
def __init__(self, n):
self.p = [-1]*n
# union by rank
self.r = [1]*n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def union(self, x, y):
... | 30 | 51 | 658 | 1,115 | # ABC075 C - Bridge
def dfs(v):
visited[v] = True
for nv in range(n):
if G[v][nv] == False:
continue
if visited[nv]:
continue
dfs(nv)
n, m = list(map(int, input().split()))
G = [[False] * n for _ in range(n)]
ans = 0
visited = [False for _ in range(n)]
A, B = []... | class UnionFind:
def __init__(self, n):
self.p = [-1] * n
# union by rank
self.r = [1] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def union(self, x, y):
rx, ry... | false | 41.176471 | [
"-# ABC075 C - Bridge",
"-def dfs(v):",
"- visited[v] = True",
"- for nv in range(n):",
"- if G[v][nv] == False:",
"- continue",
"- if visited[nv]:",
"- continue",
"- dfs(nv)",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.p... | false | 0.040954 | 0.042134 | 0.971981 | [
"s722181888",
"s919268330"
] |
u867848444 | p03162 | python | s550108900 | s873754117 | 950 | 650 | 47,320 | 74,968 | Accepted | Accepted | 31.58 | n=int(eval(input()))
l=[list(map(int,input().split())) for i in range(n)]
dp=[[0,0,0] for i in range(n+1)]
for i in range(n):
#j==kの場合を除く
for j in range(3):
for k in range(3):
if j!=k:
dp[i+1][j]=max(dp[i+1][j],dp[i][k]+l[i][j])
prin... | #DP-C
n=int(eval(input()))
l=[list(map(int,input().split())) for i in range(n)]
dp=[[0]*3 for i in range(n)]
dp[0]=l[0]
#print(dp)
for i in range(1,n):
for j in range(3):
for k in range(3):
#同じ活動の場合を除く
if j!=k:
dp[i][j]=max(dp[i-1][k]+l[i][j],dp[i][j]... | 13 | 16 | 328 | 335 | n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n)]
dp = [[0, 0, 0] for i in range(n + 1)]
for i in range(n):
# j==kの場合を除く
for j in range(3):
for k in range(3):
if j != k:
dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + l[i][j])
print((max(dp[-1])))
| # DP-C
n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n)]
dp = [[0] * 3 for i in range(n)]
dp[0] = l[0]
# print(dp)
for i in range(1, n):
for j in range(3):
for k in range(3):
# 同じ活動の場合を除く
if j != k:
dp[i][j] = max(dp[i - 1][k] + l[i][j], d... | false | 18.75 | [
"+# DP-C",
"-dp = [[0, 0, 0] for i in range(n + 1)]",
"-for i in range(n):",
"- # j==kの場合を除く",
"+dp = [[0] * 3 for i in range(n)]",
"+dp[0] = l[0]",
"+# print(dp)",
"+for i in range(1, n):",
"+ # 同じ活動の場合を除く",
"- dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + l[i][j])",
... | false | 0.036678 | 0.036715 | 0.999011 | [
"s550108900",
"s873754117"
] |
u691018832 | p02631 | python | s597753009 | s782979509 | 1,164 | 143 | 28,232 | 29,060 | Accepted | Accepted | 87.71 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
a = list(map(int, readline().split()))
ans = [0] * n
v = 2 ** 30
for i in range(30):
... | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
a = list(map(int, readline().split()))
memo = 0
for aa in a:
memo ^= aa
for i in... | 33 | 19 | 830 | 412 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
a = list(map(int, readline().split()))
ans = [0] * n
v = 2**30
for i in range(30):
v //= 2
... | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
a = list(map(int, readline().split()))
memo = 0
for aa in a:
memo ^= aa
for i in range(n):
... | false | 42.424242 | [
"- ans = [0] * n",
"- v = 2**30",
"- for i in range(30):",
"- v //= 2",
"- check = [False] * n",
"- cnt = 0",
"- for j, aa in enumerate(a):",
"- if aa >= v:",
"- a[j] -= v",
"- check[j] = True",
"- cnt +... | false | 0.034852 | 0.03735 | 0.933121 | [
"s597753009",
"s782979509"
] |
u072053884 | p02299 | python | s162740219 | s250512024 | 90 | 80 | 7,844 | 7,936 | Accepted | Accepted | 11.11 | def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def string_to_complex(s):
x, y = list(map(int, s.split()))
return x + y * 1j
def contains(polygon, point):
flag = False
for v1, v2 in zip(polygon[0:], poly... | def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def string_to_complex(s):
x, y = list(map(int, s.split()))
return x + y * 1j
def contains(polygon, point):
flag = False
for v1, v2 in zip(polygon[0:], poly... | 41 | 41 | 975 | 975 | def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def string_to_complex(s):
x, y = list(map(int, s.split()))
return x + y * 1j
def contains(polygon, point):
flag = False
for v1, v2 in zip(polygon[0:], polygon[1:]):... | def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def string_to_complex(s):
x, y = list(map(int, s.split()))
return x + y * 1j
def contains(polygon, point):
flag = False
for v1, v2 in zip(polygon[0:], polygon[1:]):... | false | 0 | [
"+ if cross_ab == 0 and dot(a, b) <= 0:",
"+ return 1",
"- if cross_ab == 0 and dot(a, b) <= 0:",
"- return 1"
] | false | 0.063487 | 0.045734 | 1.388187 | [
"s162740219",
"s250512024"
] |
u867826040 | p02580 | python | s999325639 | s246546231 | 2,357 | 2,153 | 144,488 | 156,420 | Accepted | Accepted | 8.66 | #from random import randint
import numpy as np
#@njit
def f(h,w,m,ins):
yp = np.zeros(h,dtype=np.int)
xp = np.zeros(w,dtype=np.int)
#yp[:,1] = np.arange(h)
#xp[:,1] = np.arange(w)
ans = 0
s = set()
for hi,wi in ins:
s.add((hi-1,wi-1))
yp[hi-1] += 1
xp... | #from random import randint
import numpy as np
def f(h,w,m,ins):
yp = np.zeros(h,dtype=np.int32)
xp = np.zeros(w,dtype=np.int32)
s = set()
for hi,wi in ins:
s.add((hi-1,wi-1))
yp[hi-1] += 1
xp[wi-1] += 1
ypm = yp.max()
xpm = xp.max()
yps = np.where(yp ... | 43 | 35 | 1,096 | 991 | # from random import randint
import numpy as np
# @njit
def f(h, w, m, ins):
yp = np.zeros(h, dtype=np.int)
xp = np.zeros(w, dtype=np.int)
# yp[:,1] = np.arange(h)
# xp[:,1] = np.arange(w)
ans = 0
s = set()
for hi, wi in ins:
s.add((hi - 1, wi - 1))
yp[hi - 1] += 1
x... | # from random import randint
import numpy as np
def f(h, w, m, ins):
yp = np.zeros(h, dtype=np.int32)
xp = np.zeros(w, dtype=np.int32)
s = set()
for hi, wi in ins:
s.add((hi - 1, wi - 1))
yp[hi - 1] += 1
xp[wi - 1] += 1
ypm = yp.max()
xpm = xp.max()
yps = np.where(y... | false | 18.604651 | [
"-# @njit",
"+",
"- yp = np.zeros(h, dtype=np.int)",
"- xp = np.zeros(w, dtype=np.int)",
"- # yp[:,1] = np.arange(h)",
"- # xp[:,1] = np.arange(w)",
"- ans = 0",
"+ yp = np.zeros(h, dtype=np.int32)",
"+ xp = np.zeros(w, dtype=np.int32)",
"- ypm = yp[yp.argmax()]",
"- x... | false | 0.539299 | 0.276936 | 1.947381 | [
"s999325639",
"s246546231"
] |
u203383537 | p02659 | python | s456150732 | s111175605 | 27 | 21 | 10,076 | 9,152 | Accepted | Accepted | 22.22 | from decimal import *
a,b = input().split()
ans = Decimal(a) * Decimal(b)
print((int(ans))) | a,b = input().split()
b = b.replace(".","")
ans = (int(a) * int(b))//100
print(ans) | 5 | 7 | 94 | 92 | from decimal import *
a, b = input().split()
ans = Decimal(a) * Decimal(b)
print((int(ans)))
| a, b = input().split()
b = b.replace(".", "")
ans = (int(a) * int(b)) // 100
print(ans)
| false | 28.571429 | [
"-from decimal import *",
"-",
"-ans = Decimal(a) * Decimal(b)",
"-print((int(ans)))",
"+b = b.replace(\".\", \"\")",
"+ans = (int(a) * int(b)) // 100",
"+print(ans)"
] | false | 0.044444 | 0.03969 | 1.119756 | [
"s456150732",
"s111175605"
] |
u609061751 | p03290 | python | s318478903 | s497578647 | 258 | 152 | 44,912 | 3,064 | Accepted | Accepted | 41.09 | import sys
input = sys.stdin.readline
d, g = [int(x) for x in input().split()]
pc = [[int(x) for x in input().split()] for _ in range(d)]
ans = float("inf")
for i in range(2 ** d):
i_bin = bin(i)[2:].zfill(d)
s = set() # コンプリートボーナスをもらう
for j in range(len(i_bin)):
if i_bin[j] == "1":
... | import sys
input = sys.stdin.readline
d, g = [int(x) for x in input().split()]
pc = [[int(x) for x in input().split()] for _ in range(d)]
ans = float("inf")
for i in range(2 ** d):
s = set() # コンプリートボーナスをもらう
for j in range(d):
if (i >> j) & 1:
s.add(j)
cnt = 0
total ... | 39 | 38 | 910 | 865 | import sys
input = sys.stdin.readline
d, g = [int(x) for x in input().split()]
pc = [[int(x) for x in input().split()] for _ in range(d)]
ans = float("inf")
for i in range(2**d):
i_bin = bin(i)[2:].zfill(d)
s = set() # コンプリートボーナスをもらう
for j in range(len(i_bin)):
if i_bin[j] == "1":
s.ad... | import sys
input = sys.stdin.readline
d, g = [int(x) for x in input().split()]
pc = [[int(x) for x in input().split()] for _ in range(d)]
ans = float("inf")
for i in range(2**d):
s = set() # コンプリートボーナスをもらう
for j in range(d):
if (i >> j) & 1:
s.add(j)
cnt = 0
total = 0
for k in ... | false | 2.564103 | [
"- i_bin = bin(i)[2:].zfill(d)",
"- for j in range(len(i_bin)):",
"- if i_bin[j] == \"1\":",
"+ for j in range(d):",
"+ if (i >> j) & 1:"
] | false | 0.03895 | 0.045981 | 0.847101 | [
"s318478903",
"s497578647"
] |
u162773977 | p03241 | python | s833136835 | s509842957 | 22 | 20 | 3,188 | 3,064 | Accepted | Accepted | 9.09 |
def factorize(n):
nn = n
lst = []
for i in range(2, int(1 + n ** 0.5)):
k = 0
while nn % i == 0:
k += 1
nn = nn // i
if k > 0:
lst.append([i, k])
if nn != 1:
lst.append([nn, 1])
return lst
def gen_divisor(m):
#... | def gen_divisor(n):
ps = []
for i in range(1, int(1 + n ** 0.5)):
if n % i == 0:
yield i
ps.append(n // i)
if n // ps[-1] == ps[-1]:
del ps[-1]
for p in reversed(ps):
yield p
N, M = list(map(int, input().split()))
def solve():
for di in... | 46 | 20 | 1,112 | 420 | def factorize(n):
nn = n
lst = []
for i in range(2, int(1 + n**0.5)):
k = 0
while nn % i == 0:
k += 1
nn = nn // i
if k > 0:
lst.append([i, k])
if nn != 1:
lst.append([nn, 1])
return lst
def gen_divisor(m):
# not sorted!
y... | def gen_divisor(n):
ps = []
for i in range(1, int(1 + n**0.5)):
if n % i == 0:
yield i
ps.append(n // i)
if n // ps[-1] == ps[-1]:
del ps[-1]
for p in reversed(ps):
yield p
N, M = list(map(int, input().split()))
def solve():
for di in gen_divisor(M... | false | 56.521739 | [
"-def factorize(n):",
"- nn = n",
"- lst = []",
"- for i in range(2, int(1 + n**0.5)):",
"- k = 0",
"- while nn % i == 0:",
"- k += 1",
"- nn = nn // i",
"- if k > 0:",
"- lst.append([i, k])",
"- if nn != 1:",
"- lst.appe... | false | 0.040439 | 0.074754 | 0.540967 | [
"s833136835",
"s509842957"
] |
u853619096 | p02393 | python | s874668232 | s411193957 | 30 | 20 | 7,700 | 7,648 | Accepted | Accepted | 33.33 | z =[int(i) for i in input().split()]
z.sort()
print(("{0} {1} {2}".format(z[0],z[1],z[2]))) | a=list(map(int,input().split()))
a.sort()
print((a[0],a[1],a[2])) | 4 | 3 | 95 | 65 | z = [int(i) for i in input().split()]
z.sort()
print(("{0} {1} {2}".format(z[0], z[1], z[2])))
| a = list(map(int, input().split()))
a.sort()
print((a[0], a[1], a[2]))
| false | 25 | [
"-z = [int(i) for i in input().split()]",
"-z.sort()",
"-print((\"{0} {1} {2}\".format(z[0], z[1], z[2])))",
"+a = list(map(int, input().split()))",
"+a.sort()",
"+print((a[0], a[1], a[2]))"
] | false | 0.054025 | 0.173461 | 0.311452 | [
"s874668232",
"s411193957"
] |
u588341295 | p02588 | python | s451665982 | s298739434 | 1,842 | 331 | 214,772 | 85,224 | Accepted | Accepted | 82.03 | import sys
from collections import Counter
from decimal import Decimal
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 ran... | import sys
from collections import Counter
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... | 45 | 44 | 1,227 | 1,198 | import sys
from collections import Counter
from decimal import Decimal
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] ... | import sys
from collections import Counter
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... | false | 2.222222 | [
"-from decimal import Decimal",
"- a = Decimal(eval(input()))",
"- A[i] = int(a * K)",
"+ a = float(eval(input()))",
"+ A[i] = round(a * K)"
] | false | 0.045305 | 0.036935 | 1.226612 | [
"s451665982",
"s298739434"
] |
u853187694 | p02848 | python | s348297121 | s120630099 | 35 | 32 | 4,468 | 4,340 | Accepted | Accepted | 8.57 | n = int(input())
st = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
s = input()
for i in range(len(s)):
a = (st.index(s[i]) + n) % 26
print(st[a],end="")
| N = int(input())
S = input()
for s in S:
ans = chr((ord(s) - ord("A") + N) % 26 + ord("A"))
print(ans,end="")
| 6 | 5 | 226 | 121 | n = int(input())
st = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
]
s = input()
for i in range(len(s)):
a = (st.index(s[i]) ... | N = int(input())
S = input()
for s in S:
ans = chr((ord(s) - ord("A") + N) % 26 + ord("A"))
print(ans, end="")
| false | 16.666667 | [
"-n = int(input())",
"-st = [",
"- \"A\",",
"- \"B\",",
"- \"C\",",
"- \"D\",",
"- \"E\",",
"- \"F\",",
"- \"G\",",
"- \"H\",",
"- \"I\",",
"- \"J\",",
"- \"K\",",
"- \"L\",",
"- \"M\",",
"- \"N\",",
"- \"O\",",
"- \"P\",",
"- \"... | false | 0.067656 | 0.078924 | 0.857229 | [
"s348297121",
"s120630099"
] |
u214304095 | p03329 | python | s901615462 | s760633975 | 720 | 615 | 3,828 | 3,828 | Accepted | Accepted | 14.58 | n = int(eval(input()))
dp = [1000000] * 100010
dp[0] = 0
for i in range(n):
a = 1
while i + a <= 100000:
dp[i + a] = min(dp[i + a], dp[i] + 1)
a *= 6
b = 1
while i + b <= 100000:
dp[i + b] = min(dp[i + b], dp[i] + 1)
b *= 9
print((dp[n]))
| n = int(eval(input()))
dp = [1000000] * 100010
dp[0] = 0
for i in range(1, n + 1):
a = 1
while a <= i:
dp[i] = min(dp[i], dp[i - a] + 1)
a *= 6
b = 1
while b <= i:
dp[i] = min(dp[i], dp[i - b] + 1)
b *= 9
print((dp[n]))
| 13 | 13 | 291 | 272 | n = int(eval(input()))
dp = [1000000] * 100010
dp[0] = 0
for i in range(n):
a = 1
while i + a <= 100000:
dp[i + a] = min(dp[i + a], dp[i] + 1)
a *= 6
b = 1
while i + b <= 100000:
dp[i + b] = min(dp[i + b], dp[i] + 1)
b *= 9
print((dp[n]))
| n = int(eval(input()))
dp = [1000000] * 100010
dp[0] = 0
for i in range(1, n + 1):
a = 1
while a <= i:
dp[i] = min(dp[i], dp[i - a] + 1)
a *= 6
b = 1
while b <= i:
dp[i] = min(dp[i], dp[i - b] + 1)
b *= 9
print((dp[n]))
| false | 0 | [
"-for i in range(n):",
"+for i in range(1, n + 1):",
"- while i + a <= 100000:",
"- dp[i + a] = min(dp[i + a], dp[i] + 1)",
"+ while a <= i:",
"+ dp[i] = min(dp[i], dp[i - a] + 1)",
"- while i + b <= 100000:",
"- dp[i + b] = min(dp[i + b], dp[i] + 1)",
"+ while b <= ... | false | 0.373769 | 0.118932 | 3.14271 | [
"s901615462",
"s760633975"
] |
u893063840 | p02787 | python | s647753868 | s077160240 | 1,485 | 1,347 | 369,980 | 381,976 | Accepted | Accepted | 9.29 | h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
dp = [[float("inf")] * (h + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for i in range(1, n + 1):
for j in range(1, h + 1):
a, b = ab[i-1]
dp[i][j] = min(dp[i-1][j], dp[i... | h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
dp = [[float("inf")] * (h + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for i, (a, b) in enumerate(ab, 1):
for j in range(h + 1):
dp[i][j] = min(dp[i-1][j], dp[i][max(j-a, 0)] + b... | 14 | 13 | 364 | 340 | h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
dp = [[float("inf")] * (h + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for i in range(1, n + 1):
for j in range(1, h + 1):
a, b = ab[i - 1]
dp[i][j] = min(dp[i - 1][j], dp[i][max(j ... | h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
dp = [[float("inf")] * (h + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for i, (a, b) in enumerate(ab, 1):
for j in range(h + 1):
dp[i][j] = min(dp[i - 1][j], dp[i][max(j - a, 0)] + b)
ans =... | false | 7.142857 | [
"-for i in range(1, n + 1):",
"- for j in range(1, h + 1):",
"- a, b = ab[i - 1]",
"+for i, (a, b) in enumerate(ab, 1):",
"+ for j in range(h + 1):"
] | false | 0.22676 | 0.209284 | 1.083503 | [
"s647753868",
"s077160240"
] |
u105210954 | p02789 | python | s706203086 | s711345761 | 175 | 20 | 38,484 | 3,060 | Accepted | Accepted | 88.57 | n, m = list(map(int, input().split()))
if n == m:
print('Yes')
else:
print('No') | def resolve():
a, b = list(map(int, input().split()))
if a == b:
print('Yes')
else:
print('No')
resolve() | 5 | 9 | 82 | 137 | n, m = list(map(int, input().split()))
if n == m:
print("Yes")
else:
print("No")
| def resolve():
a, b = list(map(int, input().split()))
if a == b:
print("Yes")
else:
print("No")
resolve()
| false | 44.444444 | [
"-n, m = list(map(int, input().split()))",
"-if n == m:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+def resolve():",
"+ a, b = list(map(int, input().split()))",
"+ if a == b:",
"+ print(\"Yes\")",
"+ else:",
"+ print(\"No\")",
"+",
"+",
"+resolve()"
] | false | 0.044217 | 0.035933 | 1.230532 | [
"s706203086",
"s711345761"
] |
u875361824 | p03330 | python | s836729674 | s218863510 | 927 | 535 | 5,620 | 48,988 | Accepted | Accepted | 42.29 | def main():
"""
1 <= N <= 500
3 <= C <= 30
(i!=j): 1 <= D(i,j) <= 1000
(i==j): 0 = D(i,j)
1 <= c(i,j) <= C
"""
N, C = list(map(int, input().split()))
D = [
list(map(int, input().split()))
for _ in range(C)
]
c = [
list(map(int, input().s... | from itertools import product
def main():
"""
1 <= N <= 500
3 <= C <= 30
(i!=j): 1 <= D(i,j) <= 1000
(i==j): 0 = D(i,j)
1 <= c(i,j) <= C
"""
N, C = list(map(int, input().split()))
D = [
list(map(int, input().split()))
for _ in range(C)
]
c =... | 67 | 123 | 1,556 | 2,890 | def main():
"""
1 <= N <= 500
3 <= C <= 30
(i!=j): 1 <= D(i,j) <= 1000
(i==j): 0 = D(i,j)
1 <= c(i,j) <= C
"""
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]
ans = f(N, C,... | from itertools import product
def main():
"""
1 <= N <= 500
3 <= C <= 30
(i!=j): 1 <= D(i,j) <= 1000
(i==j): 0 = D(i,j)
1 <= c(i,j) <= C
"""
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for ... | false | 45.528455 | [
"+from itertools import product",
"+",
"+",
"+ ans1 = fast_f(N, C, c, D)",
"+ assert ans == ans1",
"+ if N <= 30:",
"+ ans2 = TLE(N, C, c, D)",
"+ assert ans == ans2",
"-def TLE(N, C, c, D):",
"+def WA(N, C, c, D):",
"+def TLE(N, C, c, D):",
"+ \"\"\"",
"+ 3色に割り当... | false | 0.043594 | 0.058536 | 0.744737 | [
"s836729674",
"s218863510"
] |
u597455618 | p03855 | python | s379290698 | s640140243 | 714 | 515 | 47,836 | 49,424 | Accepted | Accepted | 27.87 | from collections import Counter
from typing import AnyStr
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
stack = []
tbl = self.table
while tbl[x] >= 0:
stack.append(x)
x = tbl[x]
for y in stack:
... | from collections import Counter
import sys
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
stack = []
tbl = self.table
while tbl[x] >= 0:
stack.append(x)
x = tbl[x]
for y in stack:
tbl... | 57 | 60 | 1,290 | 1,321 | from collections import Counter
from typing import AnyStr
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
stack = []
tbl = self.table
while tbl[x] >= 0:
stack.append(x)
x = tbl[x]
for y in stack:
tbl... | from collections import Counter
import sys
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
stack = []
tbl = self.table
while tbl[x] >= 0:
stack.append(x)
x = tbl[x]
for y in stack:
tbl[y] = x
... | false | 5 | [
"-from typing import AnyStr",
"+import sys",
"- n, k, l = list(map(int, input().split()))",
"+ n, k, l = list(map(int, sys.stdin.buffer.readline().split()))",
"- for _ in range(k):",
"- p, q = list(map(int, input().split()))",
"- a.union(p - 1, q - 1)",
"- for _ in range(l):"... | false | 0.075635 | 0.038963 | 1.941219 | [
"s379290698",
"s640140243"
] |
u773265208 | p02923 | python | s513525107 | s368711981 | 217 | 78 | 63,984 | 14,252 | Accepted | Accepted | 64.06 | n = int(eval(input()))
h = list(map(int,input().split()))
ans = 0
height = h[0]
count = 0
i = 1
while i < n:
if h[i] <= height:
count += 1
height = h[i]
i += 1
else:
ans = max(ans,count)
count = 0
height = h[i]
i += 1
print((max(ans,count)))
| n = int(eval(input()))
h = list(map(int,input().split()))
ans = 0
tmp = 0
for i in range(n-1):
if h[i] >= h[i+1]:
tmp += 1
else:
ans = max(ans,tmp)
tmp = 0
ans = max(ans,tmp)
print(ans)
| 18 | 13 | 268 | 201 | n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
height = h[0]
count = 0
i = 1
while i < n:
if h[i] <= height:
count += 1
height = h[i]
i += 1
else:
ans = max(ans, count)
count = 0
height = h[i]
i += 1
print((max(ans, count)))
| n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n - 1):
if h[i] >= h[i + 1]:
tmp += 1
else:
ans = max(ans, tmp)
tmp = 0
ans = max(ans, tmp)
print(ans)
| false | 27.777778 | [
"-height = h[0]",
"-count = 0",
"-i = 1",
"-while i < n:",
"- if h[i] <= height:",
"- count += 1",
"- height = h[i]",
"- i += 1",
"+tmp = 0",
"+for i in range(n - 1):",
"+ if h[i] >= h[i + 1]:",
"+ tmp += 1",
"- ans = max(ans, count)",
"- cou... | false | 0.037946 | 0.035626 | 1.065124 | [
"s513525107",
"s368711981"
] |
u883621917 | p03127 | python | s520315826 | s696035249 | 154 | 103 | 85,776 | 85,060 | Accepted | Accepted | 33.12 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
a = list(map(int, input().split()))
import heapq
ans = 0
heapq.heapify(a)
while a:
t = heapq.heappop(a)
if ans == 0:
ans = t
continue
else:
big = max(ans, t)
small... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
import functools
print((functools.reduce(gcd, a)))
| 24 | 15 | 442 | 274 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
a = list(map(int, input().split()))
import heapq
ans = 0
heapq.heapify(a)
while a:
t = heapq.heappop(a)
if ans == 0:
ans = t
continue
else:
big = max(ans, t)
small = min(ans, t)
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
import functools
print((functools.reduce(gcd, a)))
| false | 37.5 | [
"-import heapq",
"-ans = 0",
"-heapq.heapify(a)",
"-while a:",
"- t = heapq.heappop(a)",
"- if ans == 0:",
"- ans = t",
"- continue",
"+",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"- big = max(ans, t)",
"- small = min(ans, t)",
"- ... | false | 0.042479 | 0.041072 | 1.034255 | [
"s520315826",
"s696035249"
] |
u867826040 | p02558 | python | s210845851 | s386728512 | 777 | 371 | 11,612 | 11,848 | Accepted | Accepted | 52.25 | class UnionFind:
def __init__(self, n: int) -> None:
self.forest = [-1] * n
def union(self, x: int, y: int) -> None:
x = self.findRoot(x)
y = self.findRoot(y)
if x == y:
return
if self.forest[x] > self.forest[y]:
x, y = y, x
sel... | import sys
class UnionFind:
def __init__(self, n: int) -> None:
self.forest = [-1] * n
def union(self, x: int, y: int) -> None:
x = self.findRoot(x)
y = self.findRoot(y)
if x == y:
return
if self.forest[x] > self.forest[y]:
x, y = y... | 37 | 46 | 989 | 1,126 | class UnionFind:
def __init__(self, n: int) -> None:
self.forest = [-1] * n
def union(self, x: int, y: int) -> None:
x = self.findRoot(x)
y = self.findRoot(y)
if x == y:
return
if self.forest[x] > self.forest[y]:
x, y = y, x
self.forest[x]... | import sys
class UnionFind:
def __init__(self, n: int) -> None:
self.forest = [-1] * n
def union(self, x: int, y: int) -> None:
x = self.findRoot(x)
y = self.findRoot(y)
if x == y:
return
if self.forest[x] > self.forest[y]:
x, y = y, x
s... | false | 19.565217 | [
"+import sys",
"+",
"+",
"-n, q = list(map(int, input().split()))",
"-uf = UnionFind(n)",
"-for i in range(q):",
"- ti, ui, vi = list(map(int, input().split()))",
"- if ti:",
"- print((int(uf.issame(ui, vi))))",
"- else:",
"- uf.union(vi, ui)",
"+def main():",
"+ in... | false | 0.101143 | 0.043161 | 2.343356 | [
"s210845851",
"s386728512"
] |
u254871849 | p03475 | python | s614456173 | s037945632 | 73 | 63 | 3,188 | 3,188 | Accepted | Accepted | 13.7 | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
n = int(sys.stdin.readline().rstrip())
c, s, f = [], [], []
for i in range(n-1):
ci, si, fi = (int(x) for x in sys.stdin.readline().split())
... | import sys
n = int(sys.stdin.readline().rstrip())
csf = list(zip(*[map(int, sys.stdin.read().split())] * 3))
def main():
take_time = [None] * n
for i in range(n):
cur = i
t = 0
while cur < n - 1:
c, s, f = csf[cur]
if t < s:
t = s... | 38 | 25 | 903 | 564 | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
n = int(sys.stdin.readline().rstrip())
c, s, f = [], [], []
for i in range(n - 1):
ci, si, fi = (int(x) for x in sys.stdin.readline().split())
c.appen... | import sys
n = int(sys.stdin.readline().rstrip())
csf = list(zip(*[map(int, sys.stdin.read().split())] * 3))
def main():
take_time = [None] * n
for i in range(n):
cur = i
t = 0
while cur < n - 1:
c, s, f = csf[cur]
if t < s:
t = s
el... | false | 34.210526 | [
"-# import collections",
"-# import math",
"-# import string",
"-# import bisect",
"-# import re",
"-# import itertools",
"-# import statistics",
"+n = int(sys.stdin.readline().rstrip())",
"+csf = list(zip(*[map(int, sys.stdin.read().split())] * 3))",
"+",
"+",
"- n = int(sys.stdin.readline... | false | 0.044715 | 0.041527 | 1.076775 | [
"s614456173",
"s037945632"
] |
u594803920 | p02819 | python | s883229581 | s457335364 | 212 | 26 | 3,060 | 3,060 | Accepted | Accepted | 87.74 | a = int(eval(input()))
def hantei(x):
k = 0
for i in range(2, x//2):
if x % i == 0:
k += 1
if k ==0:
return x
c = True
while c:
hantei(a)
b = hantei(a)
if b is not None:
print(b)
c = False
elif b is None:
a += 1 | a = int(eval(input()))
b = True
def hantei(n, x): #素数だとFalseを返す
for i in range(2, n):
if n % i == 0:
x = True
return x
while b:
b = hantei(a, b)
if b is None:
print(a)
break
a += 1
| 18 | 13 | 303 | 251 | a = int(eval(input()))
def hantei(x):
k = 0
for i in range(2, x // 2):
if x % i == 0:
k += 1
if k == 0:
return x
c = True
while c:
hantei(a)
b = hantei(a)
if b is not None:
print(b)
c = False
elif b is None:
a += 1
| a = int(eval(input()))
b = True
def hantei(n, x): # 素数だとFalseを返す
for i in range(2, n):
if n % i == 0:
x = True
return x
while b:
b = hantei(a, b)
if b is None:
print(a)
break
a += 1
| false | 27.777778 | [
"+b = True",
"-def hantei(x):",
"- k = 0",
"- for i in range(2, x // 2):",
"- if x % i == 0:",
"- k += 1",
"- if k == 0:",
"- return x",
"+def hantei(n, x): # 素数だとFalseを返す",
"+ for i in range(2, n):",
"+ if n % i == 0:",
"+ x = True",
"... | false | 0.065036 | 0.088032 | 0.738782 | [
"s883229581",
"s457335364"
] |
u591016708 | p02820 | python | s183371612 | s850796770 | 76 | 49 | 4,084 | 4,084 | Accepted | Accepted | 35.53 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
check = [0]*N
ans = 0
for i in range(N):
if i < K or T[i] != T[i-K] or not check[i-K]:
ans += P if T[i] == 'r' else R if T[i] == 's' else S
check[i] = 1
print(ans) |
def solve(N,K,R,S,P,T):
check = [0]*N
ans = 0
for i in range(N):
if i < K or T[i] != T[i-K] or not check[i-K]:
ans += P if T[i] == 'r' else R if T[i] == 's' else S
check[i] = 1
print(ans)
def main():
N, K = list(map(int, input().split()))
R, S, P = l... | 10 | 18 | 273 | 421 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
check = [0] * N
ans = 0
for i in range(N):
if i < K or T[i] != T[i - K] or not check[i - K]:
ans += P if T[i] == "r" else R if T[i] == "s" else S
check[i] = 1
print(ans)
| def solve(N, K, R, S, P, T):
check = [0] * N
ans = 0
for i in range(N):
if i < K or T[i] != T[i - K] or not check[i - K]:
ans += P if T[i] == "r" else R if T[i] == "s" else S
check[i] = 1
print(ans)
def main():
N, K = list(map(int, input().split()))
R, S, P = li... | false | 44.444444 | [
"-N, K = list(map(int, input().split()))",
"-R, S, P = list(map(int, input().split()))",
"-T = eval(input())",
"-check = [0] * N",
"-ans = 0",
"-for i in range(N):",
"- if i < K or T[i] != T[i - K] or not check[i - K]:",
"- ans += P if T[i] == \"r\" else R if T[i] == \"s\" else S",
"- ... | false | 0.042561 | 0.040973 | 1.03876 | [
"s183371612",
"s850796770"
] |
u047796752 | p02838 | python | s821763225 | s261008031 | 1,686 | 711 | 200,720 | 123,132 | Accepted | Accepted | 57.83 | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9+7
A = [format(Ai, 'b') for Ai in A]
L = max(len(Ai) for Ai in A)
A = ['0'*(L-len(Ai))+Ai for Ai in A]
ans = 0
for i in range(L):
one, zero = 0, 0
for j in range(N):
if A[j][... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
MOD = 10**9+7
for i in range(65):
one = 0
zero = 0
for j in range(N):
if (A[j]>>i)&1:
one += 1
else:
zero += 1
ans += one*zero*po... | 25 | 22 | 477 | 356 | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
A = [format(Ai, "b") for Ai in A]
L = max(len(Ai) for Ai in A)
A = ["0" * (L - len(Ai)) + Ai for Ai in A]
ans = 0
for i in range(L):
one, zero = 0, 0
for j in range(N):
if A[j][i] == "1":
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
MOD = 10**9 + 7
for i in range(65):
one = 0
zero = 0
for j in range(N):
if (A[j] >> i) & 1:
one += 1
else:
zero += 1
ans += one * zero * pow(2, i, MOD)
an... | false | 12 | [
"+ans = 0",
"-A = [format(Ai, \"b\") for Ai in A]",
"-L = max(len(Ai) for Ai in A)",
"-A = [\"0\" * (L - len(Ai)) + Ai for Ai in A]",
"-ans = 0",
"-for i in range(L):",
"- one, zero = 0, 0",
"+for i in range(65):",
"+ one = 0",
"+ zero = 0",
"- if A[j][i] == \"1\":",
"+ ... | false | 0.036961 | 0.035903 | 1.029472 | [
"s821763225",
"s261008031"
] |
u075012704 | p03946 | python | s847661415 | s720599976 | 75 | 68 | 15,060 | 15,060 | Accepted | Accepted | 9.33 | from itertools import accumulate
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
MIN_Acc = list(accumulate(A, func=min))
Profits = [A[i] - MIN_Acc[i] for i in range(N)]
MAX_Profit = max(Profits)
ans = Profits.count(MAX_Profit)
print(ans)
| from itertools import accumulate
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
A_MIN = list(accumulate(A, func=min))
diff = [a - a_min for a, a_min in zip(A, A_MIN)]
MAX_diff = max(diff)
print((diff.count(MAX_diff)))
| 10 | 9 | 270 | 248 | from itertools import accumulate
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
MIN_Acc = list(accumulate(A, func=min))
Profits = [A[i] - MIN_Acc[i] for i in range(N)]
MAX_Profit = max(Profits)
ans = Profits.count(MAX_Profit)
print(ans)
| from itertools import accumulate
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
A_MIN = list(accumulate(A, func=min))
diff = [a - a_min for a, a_min in zip(A, A_MIN)]
MAX_diff = max(diff)
print((diff.count(MAX_diff)))
| false | 10 | [
"-MIN_Acc = list(accumulate(A, func=min))",
"-Profits = [A[i] - MIN_Acc[i] for i in range(N)]",
"-MAX_Profit = max(Profits)",
"-ans = Profits.count(MAX_Profit)",
"-print(ans)",
"+A_MIN = list(accumulate(A, func=min))",
"+diff = [a - a_min for a, a_min in zip(A, A_MIN)]",
"+MAX_diff = max(diff)",
"+p... | false | 0.039696 | 0.049285 | 0.805439 | [
"s847661415",
"s720599976"
] |
u729133443 | p02782 | python | s513947381 | s984254000 | 342 | 201 | 82,220 | 54,128 | Accepted | Accepted | 41.23 | def main():
M=10**9+7
r1,c1,r2,c2=list(map(int,input().split()))
n=r2+c2+2
fac=[1]
val=1
append=fac.append
for i in range(1,n+1):
val=val*i%M
append(val)
f=lambda r,c:fac[r+c+2]*pow(fac[c+1],M-2,M)*pow(fac[r+1],M-2,M)-c-r-2
print(((f(r2,c2)-f(r2,c1-1)-f(r1-1,c2)+f(r1-1,c1-1))%M))
m... | def main():
M=10**9+7
r1,c1,r2,c2=list(map(int,input().split()))
n=r2+c2+2
fac=[0]*(n+1)
fac[0]=val=1
for i in range(1,n+1):fac[i]=val=val*i%M
f=lambda r,c:fac[r+c+2]*pow(fac[c+1],M-2,M)*pow(fac[r+1],M-2,M)-c-r-2
print(((f(r2,c2)-f(r2,c1-1)-f(r1-1,c2)+f(r1-1,c1-1))%M))
main() | 13 | 10 | 317 | 293 | def main():
M = 10**9 + 7
r1, c1, r2, c2 = list(map(int, input().split()))
n = r2 + c2 + 2
fac = [1]
val = 1
append = fac.append
for i in range(1, n + 1):
val = val * i % M
append(val)
f = (
lambda r, c: fac[r + c + 2]
* pow(fac[c + 1], M - 2, M)
*... | def main():
M = 10**9 + 7
r1, c1, r2, c2 = list(map(int, input().split()))
n = r2 + c2 + 2
fac = [0] * (n + 1)
fac[0] = val = 1
for i in range(1, n + 1):
fac[i] = val = val * i % M
f = (
lambda r, c: fac[r + c + 2]
* pow(fac[c + 1], M - 2, M)
* pow(fac[r + 1],... | false | 23.076923 | [
"- fac = [1]",
"- val = 1",
"- append = fac.append",
"+ fac = [0] * (n + 1)",
"+ fac[0] = val = 1",
"- val = val * i % M",
"- append(val)",
"+ fac[i] = val = val * i % M"
] | false | 0.037294 | 0.073442 | 0.507805 | [
"s513947381",
"s984254000"
] |
u642874916 | p02735 | python | s251699990 | s799179071 | 341 | 300 | 64,620 | 62,316 | Accepted | Accepted | 12.02 | from decimal import *
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I(): return int(input())
def S(): ret... | from decimal import *
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I(): return int(input())
def S(): ret... | 105 | 96 | 2,266 | 2,000 | from decimal import *
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I():
return int(input())
def S():
return inp... | from decimal import *
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
def I():
return int(input())
def S():
return inp... | false | 8.571429 | [
"-def bfs(graph, initial, goal, H, W):",
"- options = [(1, 0), (0, 1)]",
"- q = deque([initial])",
"- dist = [[10**9 for i in range(W)] for i in range(H)]",
"- dist[initial[0]][initial[1]] = 0 if graph[initial[0]][initial[1]] == ROAD else 1",
"- while len(q) != 0:",
"- p = q.poplef... | false | 0.056117 | 0.052388 | 1.071194 | [
"s251699990",
"s799179071"
] |
u762420987 | p03031 | python | s798285622 | s251808302 | 35 | 25 | 3,064 | 3,064 | Accepted | Accepted | 28.57 | N, M = list(map(int, input().split()))
slist = [list(map(int, input().split()))[1:] for _ in range(M)]
plist = list(map(int, input().split()))
def count_on_switch(switch_array: list, on: set):
return sum([int(sw in on) for sw in switch_array])
ans = 0
# print("---")
for i in range(2**N):
on = set()
... | N, M = list(map(int, input().split()))
s_setlist = []
for i in range(M):
k, *s = list(map(int, input().split()))
s_setlist.append(set(s))
plist = list(map(int, input().split()))
ans = 0
for i in range(2**N):
on = set()
for j in range(N):
if ((i >> j) & 1):
on.add(j+1)
... | 23 | 17 | 602 | 438 | N, M = list(map(int, input().split()))
slist = [list(map(int, input().split()))[1:] for _ in range(M)]
plist = list(map(int, input().split()))
def count_on_switch(switch_array: list, on: set):
return sum([int(sw in on) for sw in switch_array])
ans = 0
# print("---")
for i in range(2**N):
on = set()
for ... | N, M = list(map(int, input().split()))
s_setlist = []
for i in range(M):
k, *s = list(map(int, input().split()))
s_setlist.append(set(s))
plist = list(map(int, input().split()))
ans = 0
for i in range(2**N):
on = set()
for j in range(N):
if (i >> j) & 1:
on.add(j + 1)
light_list ... | false | 26.086957 | [
"-slist = [list(map(int, input().split()))[1:] for _ in range(M)]",
"+s_setlist = []",
"+for i in range(M):",
"+ k, *s = list(map(int, input().split()))",
"+ s_setlist.append(set(s))",
"-",
"-",
"-def count_on_switch(switch_array: list, on: set):",
"- return sum([int(sw in on) for sw in swi... | false | 0.081281 | 0.080726 | 1.006866 | [
"s798285622",
"s251808302"
] |
u334712262 | p03725 | python | s319998257 | s465272866 | 268 | 243 | 94,944 | 95,184 | Accepted | Accepted | 9.33 | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | 93 | 92 | 1,855 | 1,843 | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | false | 1.075269 | [
"- t = min(abs(x), abs(x - H + 1), abs(y), abs(y - W + 1))",
"- ans = min(ans, t)",
"+ ans = min(ans, min(abs(x), abs(x - H + 1), abs(y), abs(y - W + 1)))",
"+ c = d[x][y]",
"+ if c + 1 > K:",
"+ continue",
"- c = d[x][y]",
"- if c + ... | false | 0.113384 | 0.049885 | 2.272919 | [
"s319998257",
"s465272866"
] |
u746419473 | p02899 | python | s117353898 | s216788234 | 201 | 150 | 22,564 | 25,556 | Accepted | Accepted | 25.37 | n=int(eval(input()))
a=list(map(int, input().split()))
s=[]
i=1
for _a in a:
s.append([i, _a])
i+=1
s.sort(key=lambda x: x[1])
ans=""
for i, _ in s:
ans+=str(i)+" "
print(ans)
| n = int(eval(input()))
*a, = list(map(int, input().split()))
t = []
for i, j in zip(list(range(1, n+1)), a):
t.append((i, j))
ans = []
for i in sorted(t, key=lambda x: x[1]):
ans.append(i[0])
print((" ".join(map(str, ans))))
| 15 | 11 | 199 | 225 | n = int(eval(input()))
a = list(map(int, input().split()))
s = []
i = 1
for _a in a:
s.append([i, _a])
i += 1
s.sort(key=lambda x: x[1])
ans = ""
for i, _ in s:
ans += str(i) + " "
print(ans)
| n = int(eval(input()))
(*a,) = list(map(int, input().split()))
t = []
for i, j in zip(list(range(1, n + 1)), a):
t.append((i, j))
ans = []
for i in sorted(t, key=lambda x: x[1]):
ans.append(i[0])
print((" ".join(map(str, ans))))
| false | 26.666667 | [
"-a = list(map(int, input().split()))",
"-s = []",
"-i = 1",
"-for _a in a:",
"- s.append([i, _a])",
"- i += 1",
"-s.sort(key=lambda x: x[1])",
"-ans = \"\"",
"-for i, _ in s:",
"- ans += str(i) + \" \"",
"-print(ans)",
"+(*a,) = list(map(int, input().split()))",
"+t = []",
"+for ... | false | 0.039709 | 0.042354 | 0.937553 | [
"s117353898",
"s216788234"
] |
u912237403 | p02242 | python | s317192194 | s254931527 | 30 | 20 | 4,816 | 4,684 | Accepted | Accepted | 33.33 | import sys
global nodes
nodes = {}
def shortest_path(GRAPH):
global nodes
p1 = 0
nodes[p1][1] = 0;
edge={}
total = 0
mini = 0
while True:
nodes[p1][0]=True
for p2 in range(len(nodes)):
if nodes[p2][0]==False and (p1, p2) in GRAPH:
... | import sys
def shortest_path(GRAPH, distance):
nodes = set()
p1 = 0
distance[p1] = 0
while True:
dp1 = distance[p1]
gp1 = GRAPH[p1]
status[p1]=1
for p2 in list(gp1.keys()):
tmp = gp1[p2] + dp1
if status[p2]==0 and tmp < dis... | 51 | 51 | 1,133 | 1,166 | import sys
global nodes
nodes = {}
def shortest_path(GRAPH):
global nodes
p1 = 0
nodes[p1][1] = 0
edge = {}
total = 0
mini = 0
while True:
nodes[p1][0] = True
for p2 in range(len(nodes)):
if nodes[p2][0] == False and (p1, p2) in GRAPH:
tmp = nod... | import sys
def shortest_path(GRAPH, distance):
nodes = set()
p1 = 0
distance[p1] = 0
while True:
dp1 = distance[p1]
gp1 = GRAPH[p1]
status[p1] = 1
for p2 in list(gp1.keys()):
tmp = gp1[p2] + dp1
if status[p2] == 0 and tmp < distance[p2]:
... | false | 0 | [
"-global nodes",
"-nodes = {}",
"-",
"-def shortest_path(GRAPH):",
"- global nodes",
"+def shortest_path(GRAPH, distance):",
"+ nodes = set()",
"- nodes[p1][1] = 0",
"- edge = {}",
"- total = 0",
"- mini = 0",
"+ distance[p1] = 0",
"- nodes[p1][0] = True",
"- ... | false | 0.11292 | 0.106128 | 1.064001 | [
"s317192194",
"s254931527"
] |
u296518383 | p02578 | python | s604760835 | s190569098 | 128 | 112 | 94,332 | 92,644 | Accepted | Accepted | 12.5 | from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
... | from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
N = int(eval(input()))
A = list(map(int, input().split()))
answer = 0
max_a = A[0]
for a in A:
max_a = max(max_a, a)
answer += max_a - a
print(answer) | 34 | 14 | 841 | 240 | from sys import stdin, setrecursionlimit
# input = stdin.buffer.readline
setrecursionlimit(10**7)
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from ite... | from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
N = int(eval(input()))
A = list(map(int, input().split()))
answer = 0
max_a = A[0]
for a in A:
max_a = max(max_a, a)
answer += max_a - a
print(answer)
| false | 58.823529 | [
"-# input = stdin.buffer.readline",
"-setrecursionlimit(10**7)",
"-from heapq import heappush, heappop",
"-from bisect import bisect_left, bisect_right",
"-from collections import deque, defaultdict, Counter",
"-from itertools import combinations, permutations, combinations_with_replacement",
"-from ite... | false | 0.062247 | 0.044766 | 1.390506 | [
"s604760835",
"s190569098"
] |
u014333473 | p03598 | python | s373802449 | s200019737 | 33 | 28 | 9,032 | 9,116 | Accepted | Accepted | 15.15 | _,k=eval(input()),int(eval(input()));print((sum([min(i,(k-i))*2 for i in list(map(int,input().split()))]))) | _,k=eval(input()),int(eval(input()));print((sum(min(i,(k-i))*2 for i in list(map(int,input().split()))))) | 1 | 1 | 93 | 91 | _, k = eval(input()), int(eval(input()))
print((sum([min(i, (k - i)) * 2 for i in list(map(int, input().split()))])))
| _, k = eval(input()), int(eval(input()))
print((sum(min(i, (k - i)) * 2 for i in list(map(int, input().split())))))
| false | 0 | [
"-print((sum([min(i, (k - i)) * 2 for i in list(map(int, input().split()))])))",
"+print((sum(min(i, (k - i)) * 2 for i in list(map(int, input().split())))))"
] | false | 0.04406 | 0.107261 | 0.410774 | [
"s373802449",
"s200019737"
] |
u281610856 | p02695 | python | s838994169 | s632869053 | 601 | 391 | 9,148 | 9,228 | Accepted | Accepted | 34.94 | from itertools import permutations, accumulate, combinations, combinations_with_replacement
import sys
input = sys.stdin.readline
def main():
n, m, q = list(map(int, input().split()))
# <方針>:Aを全列挙する
ans = 0
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
n, m, q = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def dfs(u, A):
global n, m, q, l, ans
if len(A) == n: # lの長さがnになったらscoreの計算をする
score = 0
for i in range(q... | 28 | 30 | 683 | 665 | from itertools import (
permutations,
accumulate,
combinations,
combinations_with_replacement,
)
import sys
input = sys.stdin.readline
def main():
n, m, q = list(map(int, input().split()))
# <方針>:Aを全列挙する
ans = 0
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in ... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n, m, q = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def dfs(u, A):
global n, m, q, l, ans
if len(A) == n: # lの長さがnになったらscoreの計算をする
score = 0
for i in range(q):
... | false | 6.666667 | [
"-from itertools import (",
"- permutations,",
"- accumulate,",
"- combinations,",
"- combinations_with_replacement,",
"-)",
"+sys.setrecursionlimit(10**6)",
"+n, m, q = list(map(int, input().split()))",
"+l = [tuple(map(int, input().split())) for _ in range(q)]",
"+ans = 0",
"+",
... | false | 0.045353 | 0.104949 | 0.432149 | [
"s838994169",
"s632869053"
] |
u607563136 | p02900 | python | s869591646 | s404794218 | 191 | 108 | 9,320 | 9,436 | Accepted | Accepted | 43.46 | def division(n):
if n < 2:
return [1]
prime_factors = [1]
for i in range(2,int(n**0.5)+1):
while n % i == 0:
prime_factors.append(i)
n //= i
if n > 1:
prime_factors.append(n)
return prime_factors
a,b = list(map(int,input().split()))
... | from math import gcd
def division(n):
if n < 2:
return [1]
prime_factors = [1]
for i in range(2,int(n**0.5)+1):
while n % i == 0:
prime_factors.append(i)
n //= i
if n > 1:
prime_factors.append(n)
return prime_factors
a,b = list(map(int,in... | 23 | 16 | 429 | 373 | def division(n):
if n < 2:
return [1]
prime_factors = [1]
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
prime_factors.append(i)
n //= i
if n > 1:
prime_factors.append(n)
return prime_factors
a, b = list(map(int, input().split()))
da = set(div... | from math import gcd
def division(n):
if n < 2:
return [1]
prime_factors = [1]
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
prime_factors.append(i)
n //= i
if n > 1:
prime_factors.append(n)
return prime_factors
a, b = list(map(int, input()... | false | 30.434783 | [
"+from math import gcd",
"+",
"+",
"-da = set(division(a))",
"-db = set(division(b))",
"-cnt = 0",
"-for i in da:",
"- if i in db:",
"- cnt += 1",
"-print(cnt)",
"+d = set(division(gcd(a, b)))",
"+print((len(d)))"
] | false | 0.047606 | 0.036564 | 1.301995 | [
"s869591646",
"s404794218"
] |
u876742094 | p03944 | python | s783715312 | s370997855 | 121 | 33 | 9,328 | 9,236 | Accepted | Accepted | 72.73 | import itertools
W,H,N=list(map(int,input().split()))
xya=[list(map(int,input().split())) for i in range(N)]
res=[[True for j in range(H)] for i in range(W)]
for j in range(H):
for i in range(W):
for k in range(N):
if (i<xya[k][0] and xya[k][2]==1) or (i>=xya[k][0] and xya[k][2]==2) or ... | W,H,N=list(map(int,input().split()))
xya=[list(map(int,input().split())) for i in range(N)]
first=[0,0]
last=[W,H]
for i in range(N):
if first[0]<xya[i][0] and xya[i][2]==1:
first[0]=xya[i][0]
if last[0]>xya[i][0] and xya[i][2]==2:
last[0]=xya[i][0]
if first[1]<xya[i][1] and xya... | 14 | 23 | 511 | 558 | import itertools
W, H, N = list(map(int, input().split()))
xya = [list(map(int, input().split())) for i in range(N)]
res = [[True for j in range(H)] for i in range(W)]
for j in range(H):
for i in range(W):
for k in range(N):
if (
(i < xya[k][0] and xya[k][2] == 1)
... | W, H, N = list(map(int, input().split()))
xya = [list(map(int, input().split())) for i in range(N)]
first = [0, 0]
last = [W, H]
for i in range(N):
if first[0] < xya[i][0] and xya[i][2] == 1:
first[0] = xya[i][0]
if last[0] > xya[i][0] and xya[i][2] == 2:
last[0] = xya[i][0]
if first[1] < xy... | false | 39.130435 | [
"-import itertools",
"-",
"-res = [[True for j in range(H)] for i in range(W)]",
"-for j in range(H):",
"- for i in range(W):",
"- for k in range(N):",
"- if (",
"- (i < xya[k][0] and xya[k][2] == 1)",
"- or (i >= xya[k][0] and xya[k][2] == 2)",
"... | false | 0.075838 | 0.037379 | 2.028909 | [
"s783715312",
"s370997855"
] |
u729133443 | p03547 | python | s271213746 | s991593853 | 168 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.88 | a,b=input().split();print(('=><'[a>b or-(a<b)])) | x,_,y=eval(input());print(('=><'[(x>y)-(x<y)])) | 1 | 1 | 46 | 39 | a, b = input().split()
print(("=><"[a > b or -(a < b)]))
| x, _, y = eval(input())
print(("=><"[(x > y) - (x < y)]))
| false | 0 | [
"-a, b = input().split()",
"-print((\"=><\"[a > b or -(a < b)]))",
"+x, _, y = eval(input())",
"+print((\"=><\"[(x > y) - (x < y)]))"
] | false | 0.03602 | 0.036569 | 0.984971 | [
"s271213746",
"s991593853"
] |
u098012509 | p02733 | python | s652303069 | s292928915 | 1,310 | 1,087 | 52,060 | 45,916 | Accepted | Accepted | 17.02 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
H, W, K = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = float("inf")
for n in range(2 ** (H - 1)):
tmp = 0
wn = [0] * 10
wi = [set() for ... | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
H, W, K = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = float("inf")
for n in range(2 ** (H - 1)):
tmp = 0
wn = [0] * 10
for i in range... | 57 | 53 | 1,476 | 1,246 | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
H, W, K = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = float("inf")
for n in range(2 ** (H - 1)):
tmp = 0
wn = [0] * 10
wi = [set() for _ in range(10)]
... | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
H, W, K = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = float("inf")
for n in range(2 ** (H - 1)):
tmp = 0
wn = [0] * 10
for i in range(H):
if n >... | false | 7.017544 | [
"- wi = [set() for _ in range(10)]",
"- ni = 0",
"- wi[ni].add(i)",
"- ni += 1",
"+ ni = 0",
"- for wii in range(ni + 1):",
"- if j in wi[wii]:",
"- if wn[wii] + int(S[j][i]) > K:",
"- ... | false | 0.041636 | 0.038593 | 1.078844 | [
"s652303069",
"s292928915"
] |
u202751685 | p02681 | python | s421801821 | s762018349 | 24 | 19 | 9,100 | 9,036 | Accepted | Accepted | 20.83 | a = eval(input())
b = eval(input())
ans = True
for i in range(len(a)):
if a[i] != b[i]:
ans = False
break
if ans:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
t = t[:-1]
if s == t:
print("Yes")
else:
print("No") | 14 | 8 | 167 | 90 | a = eval(input())
b = eval(input())
ans = True
for i in range(len(a)):
if a[i] != b[i]:
ans = False
break
if ans:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
t = t[:-1]
if s == t:
print("Yes")
else:
print("No")
| false | 42.857143 | [
"-a = eval(input())",
"-b = eval(input())",
"-ans = True",
"-for i in range(len(a)):",
"- if a[i] != b[i]:",
"- ans = False",
"- break",
"-if ans:",
"+s = eval(input())",
"+t = eval(input())",
"+t = t[:-1]",
"+if s == t:"
] | false | 0.114005 | 0.041882 | 2.722056 | [
"s421801821",
"s762018349"
] |
u020604402 | p04000 | python | s781797228 | s711281843 | 2,088 | 1,922 | 143,380 | 143,420 | Accepted | Accepted | 7.95 | H, W , N = list(map(int,input().split()))
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = list(map(int,input().split()))
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r i... | H, W , N = list(map(int,input().split()))
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = list(map(int,input().split()))
x -= 1
y -= 1
matrix.append([x,y])
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:... | 30 | 29 | 819 | 804 | H, W, N = list(map(int, input().split()))
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
matrix.append([x, y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1... | H, W, N = list(map(int, input().split()))
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
matrix.append([x, y])
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1, 0]:
... | false | 3.333333 | [
"-matrix.sort()"
] | false | 0.046087 | 0.086268 | 0.534231 | [
"s781797228",
"s711281843"
] |
u956937655 | p02912 | python | s376281742 | s789091066 | 260 | 226 | 14,380 | 14,380 | Accepted | Accepted | 13.08 | import math
import heapq
N, M = list(map(int, input().split()))
A = list([-int(a) for a in input().split()])
A.sort()
heapq.heapify(A)
for i in range(M):
a = heapq.heappop(A)
a = -(-a / 2.0)
heapq.heappush(A, a)
amount = 0
for a in A:
amount += math.floor(-a)
print(amount) | import math
import heapq
N, M = list(map(int, input().split()))
A = list([-int(a) for a in input().split()])
A.sort()
heapq.heapify(A)
for i in range(M):
a = heapq.heappop(A)
a /= 2.0
heapq.heappush(A, a)
amount = 0
for a in A:
amount += math.floor(-a)
print(amount) | 17 | 17 | 305 | 298 | import math
import heapq
N, M = list(map(int, input().split()))
A = list([-int(a) for a in input().split()])
A.sort()
heapq.heapify(A)
for i in range(M):
a = heapq.heappop(A)
a = -(-a / 2.0)
heapq.heappush(A, a)
amount = 0
for a in A:
amount += math.floor(-a)
print(amount)
| import math
import heapq
N, M = list(map(int, input().split()))
A = list([-int(a) for a in input().split()])
A.sort()
heapq.heapify(A)
for i in range(M):
a = heapq.heappop(A)
a /= 2.0
heapq.heappush(A, a)
amount = 0
for a in A:
amount += math.floor(-a)
print(amount)
| false | 0 | [
"- a = -(-a / 2.0)",
"+ a /= 2.0"
] | false | 0.055262 | 0.054948 | 1.005725 | [
"s376281742",
"s789091066"
] |
u237362582 | p03559 | python | s796184780 | s941120698 | 408 | 360 | 23,328 | 23,360 | Accepted | Accepted | 11.76 | N = int(eval(input()))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
sorted_a = sorted(a)
sorted_b = sorted(b)
sorted_c = sorted(c)
ans = 0
before_a = 0
before_c = 0
count_a = 0
count_c_rest = 0
for each_b in sorted_b:
for ai in r... | import bisect
N = int(eval(input()))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
sorted_a = sorted(a)
sorted_c = sorted(c)
ans = 0
for each_b in b:
ai = bisect.bisect_left(sorted_a, each_b)
ci = bisect.bisect_right(sorted_c, ... | 32 | 15 | 763 | 363 | N = int(eval(input()))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
c = list(map(int, input().split(" ")))
sorted_a = sorted(a)
sorted_b = sorted(b)
sorted_c = sorted(c)
ans = 0
before_a = 0
before_c = 0
count_a = 0
count_c_rest = 0
for each_b in sorted_b:
for ai in range(before_a, ... | import bisect
N = int(eval(input()))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
c = list(map(int, input().split(" ")))
sorted_a = sorted(a)
sorted_c = sorted(c)
ans = 0
for each_b in b:
ai = bisect.bisect_left(sorted_a, each_b)
ci = bisect.bisect_right(sorted_c, each_b)
a... | false | 53.125 | [
"+import bisect",
"+",
"-sorted_b = sorted(b)",
"-before_a = 0",
"-before_c = 0",
"-count_a = 0",
"-count_c_rest = 0",
"-for each_b in sorted_b:",
"- for ai in range(before_a, len(sorted_a)):",
"- if each_b > sorted_a[ai]:",
"- count_a += 1",
"- before_a += 1",
... | false | 0.046712 | 0.094991 | 0.491757 | [
"s796184780",
"s941120698"
] |
u503111914 | p02971 | python | s424740073 | s625687049 | 661 | 562 | 23,328 | 14,128 | Accepted | Accepted | 14.98 | import numpy as np
N = int(eval(input()))
num_list = [int(eval(input())) for i in range(N)]
a = max(num_list)
if num_list.count(a) > 1:
for j in range(N):
print(a)
else:
b = np.sort(num_list)
c = b[-2]
for k in range(int(num_list.index(a))):
print(a)
print(c)
for l in range(N-int(num_li... | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
B = sorted(A,reverse=True)
max1 = B[0]
max2 = B[1]
for i in range(N):
if A[i] == max1:
print(max2)
else:
print(max1) | 15 | 10 | 338 | 203 | import numpy as np
N = int(eval(input()))
num_list = [int(eval(input())) for i in range(N)]
a = max(num_list)
if num_list.count(a) > 1:
for j in range(N):
print(a)
else:
b = np.sort(num_list)
c = b[-2]
for k in range(int(num_list.index(a))):
print(a)
print(c)
for l in range(N - ... | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
B = sorted(A, reverse=True)
max1 = B[0]
max2 = B[1]
for i in range(N):
if A[i] == max1:
print(max2)
else:
print(max1)
| false | 33.333333 | [
"-import numpy as np",
"-",
"-num_list = [int(eval(input())) for i in range(N)]",
"-a = max(num_list)",
"-if num_list.count(a) > 1:",
"- for j in range(N):",
"- print(a)",
"-else:",
"- b = np.sort(num_list)",
"- c = b[-2]",
"- for k in range(int(num_list.index(a))):",
"- ... | false | 0.387541 | 0.074599 | 5.194976 | [
"s424740073",
"s625687049"
] |
u346812984 | p02873 | python | s323463950 | s721953356 | 377 | 319 | 24,092 | 23,336 | Accepted | Accepted | 15.38 | S = eval(input())
ans = [0 for i in range(len(S) + 1)]
for i in range(len(S)):
if "<" == S[i]:
ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
if ">" == S[i]:
ans[i] = max(ans[i], ans[i + 1] + 1)
print((sum(ans)))
| S = eval(input())
N = len(S) + 1
ans = [0] * N
for i in range(N - 1):
if S[i] == "<":
if ans[i] < ans[i + 1]:
continue
else:
ans[i + 1] = ans[i] + 1
for i in range(N - 1, 0, -1):
if S[i - 1] == ">":
if ans[i - 1] > ans[i]:
continue
... | 12 | 18 | 256 | 379 | S = eval(input())
ans = [0 for i in range(len(S) + 1)]
for i in range(len(S)):
if "<" == S[i]:
ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
if ">" == S[i]:
ans[i] = max(ans[i], ans[i + 1] + 1)
print((sum(ans)))
| S = eval(input())
N = len(S) + 1
ans = [0] * N
for i in range(N - 1):
if S[i] == "<":
if ans[i] < ans[i + 1]:
continue
else:
ans[i + 1] = ans[i] + 1
for i in range(N - 1, 0, -1):
if S[i - 1] == ">":
if ans[i - 1] > ans[i]:
continue
else:
... | false | 33.333333 | [
"-ans = [0 for i in range(len(S) + 1)]",
"-for i in range(len(S)):",
"- if \"<\" == S[i]:",
"- ans[i + 1] = ans[i] + 1",
"-for i in range(len(S) - 1, -1, -1):",
"- if \">\" == S[i]:",
"- ans[i] = max(ans[i], ans[i + 1] + 1)",
"+N = len(S) + 1",
"+ans = [0] * N",
"+for i in rang... | false | 0.045388 | 0.044937 | 1.010028 | [
"s323463950",
"s721953356"
] |
u380524497 | p02703 | python | s223492002 | s703572133 | 619 | 494 | 24,232 | 23,840 | Accepted | Accepted | 20.19 | def main():
import heapq
n, m, s = list(map(int, input().split()))
if s >= 2500:
s = 2499
edges = [[] for _ in range(n)]
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_-1].append((to-1, cost, time))
edges[to-1].appen... | def main():
import heapq
n, m, s = list(map(int, input().split()))
edges = [[] for _ in range(n)]
max_cost = 0
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_-1].append((to-1, cost, time))
edges[to-1].append((from_-1, cost, t... | 58 | 59 | 1,554 | 1,606 | def main():
import heapq
n, m, s = list(map(int, input().split()))
if s >= 2500:
s = 2499
edges = [[] for _ in range(n)]
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_ - 1].append((to - 1, cost, time))
edges[to - 1].append((fro... | def main():
import heapq
n, m, s = list(map(int, input().split()))
edges = [[] for _ in range(n)]
max_cost = 0
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_ - 1].append((to - 1, cost, time))
edges[to - 1].append((from_ - 1, cost, time... | false | 1.694915 | [
"- if s >= 2500:",
"- s = 2499",
"+ max_cost = 0",
"+ if cost > max_cost:",
"+ max_cost = cost",
"+ max_coin = max_cost * (n - 1)",
"+ if s > max_coin:",
"+ s = max_coin",
"- DP = [[INF] * 2500 for _ in range(n)]",
"+ DP = [[INF] * (max_coin + 1) f... | false | 0.059817 | 0.049533 | 1.207627 | [
"s223492002",
"s703572133"
] |
u191829404 | p03041 | python | s741455095 | s529010155 | 32 | 23 | 3,796 | 3,540 | Accepted | Accepted | 28.12 | # https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde s=input() s='abcde'
# abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ) a=int(input()) a=5
# 1 2 | x,y = s_inpl() | x=1,y=2
# 1 2 3 4 5 ... n li = input().split() li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n li = inpl() li=[1,2,3,4,5,.... | # abcde s=input() s='abcde'
# abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ) a=int(input()) a=5
# 1 2 | x,y = s_inpl() | x=1,y=2
# 1 2 3 4 5 ... n li = input().split() li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n li = inpl() li=[1,2,3,4,5,...,n]
# FFFTFTTFF li = input().split('T') li=['FFF', 'F... | 57 | 58 | 1,452 | 1,427 | # https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde s=input() s='abcde'
# abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ) a=int(input()) a=5
# 1 2 | x,y = s_inpl() | x=1,y=2
# 1 2 3 4 5 ... n li = input().split() li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n li = inpl() li=[1,2,3,4,5,...,n]
... | # abcde s=input() s='abcde'
# abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ) a=int(input()) a=5
# 1 2 | x,y = s_inpl() | x=1,y=2
# 1 2 3 4 5 ... n li = input().split() li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n li = inpl() li=[1,2,3,4,5,...,n]
# FFFTFTTFF li = input().split('T') li=['FFF', 'F', '',... | false | 1.724138 | [
"-# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0",
"-N, K = s_inpl()",
"+############",
"+############",
"+N, K = l_inpl()",
"-for i, s in enumerate(S):",
"- if i + 1 == K:",
"+for i in range(N):",
"+ s = S[i]",
"+ if i == K - 1:"
] | false | 0.007904 | 0.066134 | 0.119522 | [
"s741455095",
"s529010155"
] |
u303059352 | p02971 | python | s800372603 | s995793357 | 635 | 518 | 15,636 | 14,108 | Accepted | Accepted | 18.43 | n=int(eval(input()))
a=[int(eval(input()))for _ in range(n)]
left=[0]
for i in a:
left.append(max(left[-1],i))
right=[0]
for i in reversed(a):
right.append(max(right[-1],i))
right.reverse()
for i in range(n):
print((max(left[i],right[i+1])))
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
b = sorted(a)
max1, max2 = b[-1], b[-2]
for i in a:
if i == max1:
print(max2)
else:
print(max1) | 11 | 9 | 244 | 181 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
left = [0]
for i in a:
left.append(max(left[-1], i))
right = [0]
for i in reversed(a):
right.append(max(right[-1], i))
right.reverse()
for i in range(n):
print((max(left[i], right[i + 1])))
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
b = sorted(a)
max1, max2 = b[-1], b[-2]
for i in a:
if i == max1:
print(max2)
else:
print(max1)
| false | 18.181818 | [
"-a = [int(eval(input())) for _ in range(n)]",
"-left = [0]",
"+a = [int(eval(input())) for i in range(n)]",
"+b = sorted(a)",
"+max1, max2 = b[-1], b[-2]",
"- left.append(max(left[-1], i))",
"-right = [0]",
"-for i in reversed(a):",
"- right.append(max(right[-1], i))",
"-right.reverse()",
... | false | 0.153555 | 0.169805 | 0.904302 | [
"s800372603",
"s995793357"
] |
u129978636 | p03548 | python | s452207670 | s068274087 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | X, Y, Z = list(map( int, input().split()))
m = X - Z
n = Y + Z
print((m//n)) | X, Y, Z = list(map( int, input().split()))
m = X - Z
print((m//(Y+Z)))
| 4 | 3 | 71 | 65 | X, Y, Z = list(map(int, input().split()))
m = X - Z
n = Y + Z
print((m // n))
| X, Y, Z = list(map(int, input().split()))
m = X - Z
print((m // (Y + Z)))
| false | 25 | [
"-n = Y + Z",
"-print((m // n))",
"+print((m // (Y + Z)))"
] | false | 0.042182 | 0.042327 | 0.996563 | [
"s452207670",
"s068274087"
] |
u560867850 | p03401 | python | s109951688 | s636039741 | 206 | 181 | 14,044 | 14,044 | Accepted | Accepted | 12.14 | import sys
input = sys.stdin.readline
def costs(a):
prev = 0
for x in a:
yield abs(x - prev)
prev = x
def main():
eval(input())
A = [0] + [int(c) for c in input().split()] + [0]
total = sum(costs(A))
for i, x in enumerate(A):
if i == 0 or i == len(A)-1: co... | import sys
input = sys.stdin.readline
def costs(a):
prev = 0
for x in a:
yield abs(x - prev)
prev = x
def main():
eval(input())
A = [0] + [int(c) for c in input().split()] + [0]
total = sum(costs(A))
for i, x in enumerate(A[1:-1],1):
prev_cost = abs(x - A[... | 21 | 20 | 503 | 465 | import sys
input = sys.stdin.readline
def costs(a):
prev = 0
for x in a:
yield abs(x - prev)
prev = x
def main():
eval(input())
A = [0] + [int(c) for c in input().split()] + [0]
total = sum(costs(A))
for i, x in enumerate(A):
if i == 0 or i == len(A) - 1:
... | import sys
input = sys.stdin.readline
def costs(a):
prev = 0
for x in a:
yield abs(x - prev)
prev = x
def main():
eval(input())
A = [0] + [int(c) for c in input().split()] + [0]
total = sum(costs(A))
for i, x in enumerate(A[1:-1], 1):
prev_cost = abs(x - A[i - 1])
... | false | 4.761905 | [
"- for i, x in enumerate(A):",
"- if i == 0 or i == len(A) - 1:",
"- continue",
"+ for i, x in enumerate(A[1:-1], 1):"
] | false | 0.039168 | 0.080097 | 0.489008 | [
"s109951688",
"s636039741"
] |
u089230684 | p03165 | python | s813894193 | s553824288 | 406 | 371 | 56,800 | 153,080 | Accepted | Accepted | 8.62 | def main():
import numpy as np
s = np.array(list(eval(input())), np.str)
sl = len(s)
t = np.array(list(eval(input())), np.str)
tl = len(t)
equal = (s[:, None] == t[None, :])
dp = [np.zeros(tl + 1, np.int32)]
for i in range(sl):
tmp = dp[-1].copy()
np.maximum(tmp[1:], tmp[:-1] + equ... | s = eval(input())
t = eval(input())
n = len(s)
m = len(t)
dp = [[0 for j in range(1 + m)] for i in range(1 + n)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j -... | 33 | 23 | 691 | 546 | def main():
import numpy as np
s = np.array(list(eval(input())), np.str)
sl = len(s)
t = np.array(list(eval(input())), np.str)
tl = len(t)
equal = s[:, None] == t[None, :]
dp = [np.zeros(tl + 1, np.int32)]
for i in range(sl):
tmp = dp[-1].copy()
np.maximum(tmp[1:], tmp[:... | s = eval(input())
t = eval(input())
n = len(s)
m = len(t)
dp = [[0 for j in range(1 + m)] for i in range(1 + n)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
res =... | false | 30.30303 | [
"-def main():",
"- import numpy as np",
"-",
"- s = np.array(list(eval(input())), np.str)",
"- sl = len(s)",
"- t = np.array(list(eval(input())), np.str)",
"- tl = len(t)",
"- equal = s[:, None] == t[None, :]",
"- dp = [np.zeros(tl + 1, np.int32)]",
"- for i in range(sl):",... | false | 0.257561 | 0.043155 | 5.968244 | [
"s813894193",
"s553824288"
] |
u109133010 | p03331 | python | s717572469 | s155229718 | 188 | 104 | 2,940 | 3,060 | Accepted | Accepted | 44.68 | N=int(eval(input()))
def f(x):
s=0
while x!=0:
s+=x%10
x//=10
return(s)
minn=50
for i in range(1,N):
minn=min(f(i)+f(N-i),minn)
print(minn) | N=int(eval(input()))
def f(x):
s=0
while x!=0:
s+=x%10
x//=10
return(s)
minn=50
for i in range(1,N//2+1):
minn=min(f(i)+f(N-i),minn)
print(minn) | 11 | 11 | 159 | 164 | N = int(eval(input()))
def f(x):
s = 0
while x != 0:
s += x % 10
x //= 10
return s
minn = 50
for i in range(1, N):
minn = min(f(i) + f(N - i), minn)
print(minn)
| N = int(eval(input()))
def f(x):
s = 0
while x != 0:
s += x % 10
x //= 10
return s
minn = 50
for i in range(1, N // 2 + 1):
minn = min(f(i) + f(N - i), minn)
print(minn)
| false | 0 | [
"-for i in range(1, N):",
"+for i in range(1, N // 2 + 1):"
] | false | 0.102656 | 0.048205 | 2.129587 | [
"s717572469",
"s155229718"
] |
u540877546 | p02659 | python | s661130152 | s450694382 | 26 | 23 | 10,064 | 10,016 | Accepted | Accepted | 11.54 | from decimal import *
getcontext().prec = 32
a, b = list(map(Decimal, input().split()))
print((int(a*b)))
| from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a*b)))
| 4 | 3 | 107 | 89 | from decimal import *
getcontext().prec = 32
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| false | 25 | [
"-from decimal import *",
"+from decimal import Decimal",
"-getcontext().prec = 32"
] | false | 0.079863 | 0.03839 | 2.080334 | [
"s661130152",
"s450694382"
] |
u608241985 | p02725 | python | s174694620 | s791803978 | 124 | 92 | 32,296 | 31,788 | Accepted | Accepted | 25.81 | k, n = list(map(int, input().split()))
A = list(map(int, input().split()))
farthest = (k-A[-1])+A[0]
for i in range(len(A)-1):
farthest = max(farthest, A[i+1]-A[i])
print((k-farthest))
| k, n, *A = list(map(int, open(0).read().split()))
far = k + A[0] - A[-1]
for x, y in zip(A[1:], A):
if far < x - y:
far = x - y
print((k-far)) | 7 | 6 | 188 | 151 | k, n = list(map(int, input().split()))
A = list(map(int, input().split()))
farthest = (k - A[-1]) + A[0]
for i in range(len(A) - 1):
farthest = max(farthest, A[i + 1] - A[i])
print((k - farthest))
| k, n, *A = list(map(int, open(0).read().split()))
far = k + A[0] - A[-1]
for x, y in zip(A[1:], A):
if far < x - y:
far = x - y
print((k - far))
| false | 14.285714 | [
"-k, n = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-farthest = (k - A[-1]) + A[0]",
"-for i in range(len(A) - 1):",
"- farthest = max(farthest, A[i + 1] - A[i])",
"-print((k - farthest))",
"+k, n, *A = list(map(int, open(0).read().split()))",
"+far = k + A[0] - A[-1... | false | 0.039504 | 0.038853 | 1.016757 | [
"s174694620",
"s791803978"
] |
u777923818 | p03602 | python | s829468530 | s936804290 | 643 | 454 | 46,812 | 43,996 | Accepted | Accepted | 29.39 | # -*- coding: utf-8 -*-
from itertools import combinations
def inpl(): return tuple(map(int, input().split()))
N = int(eval(input()))
res = 0
exist = True
A = []
for _ in range(N):
A.append(inpl())
for i, j in combinations(list(range(N)), 2):
vervose = False
for k in range(N):
... | # -*- coding: utf-8 -*-
from itertools import combinations
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
res = 0
exist = True
A = []
for _ in range(N):
A.append(inpl())
for i, j in combinations(list(range(N)), 2):
vervose = False
if not exist:
b... | 37 | 39 | 698 | 740 | # -*- coding: utf-8 -*-
from itertools import combinations
def inpl():
return tuple(map(int, input().split()))
N = int(eval(input()))
res = 0
exist = True
A = []
for _ in range(N):
A.append(inpl())
for i, j in combinations(list(range(N)), 2):
vervose = False
for k in range(N):
if A[i][j] > A... | # -*- coding: utf-8 -*-
from itertools import combinations
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
res = 0
exist = True
A = []
for _ in range(N):
A.append(inpl())
for i, j in combinations(list(range(N)), 2):
vervose = False
if not exist:
break
for k in r... | false | 5.128205 | [
"- return tuple(map(int, input().split()))",
"+ return list(map(int, input().split()))",
"- for k in range(N):",
"- if A[i][j] > A[i][k] + A[k][j]:",
"- exist = False",
"- break",
"- elif A[i][j] == A[i][k] + A[k][j]:",
"- vervose = True",
"- ... | false | 0.039544 | 0.04304 | 0.918789 | [
"s829468530",
"s936804290"
] |
u987164499 | p03095 | python | s131333190 | s456982865 | 48 | 25 | 5,328 | 3,444 | Accepted | Accepted | 47.92 | from sys import stdin
import string
from itertools import groupby
n = int(stdin.readline().rstrip())
s = list(stdin.readline().rstrip())
s.sort()
lin = []
for key, value in groupby(s):
lin.append(len(list(value)))
point = 1
for i in lin:
point *= i+1
point %= 10**9+7
print((point-1)) | from collections import Counter
n = int(eval(input()))
s = eval(input())
mod = 10**9+7
c = Counter(s)
point = 1
for i,j in list(c.items()):
point *= j+1
point %= mod
point -= 1
print(point) | 15 | 16 | 309 | 199 | from sys import stdin
import string
from itertools import groupby
n = int(stdin.readline().rstrip())
s = list(stdin.readline().rstrip())
s.sort()
lin = []
for key, value in groupby(s):
lin.append(len(list(value)))
point = 1
for i in lin:
point *= i + 1
point %= 10**9 + 7
print((point - 1))
| from collections import Counter
n = int(eval(input()))
s = eval(input())
mod = 10**9 + 7
c = Counter(s)
point = 1
for i, j in list(c.items()):
point *= j + 1
point %= mod
point -= 1
print(point)
| false | 6.25 | [
"-from sys import stdin",
"-import string",
"-from itertools import groupby",
"+from collections import Counter",
"-n = int(stdin.readline().rstrip())",
"-s = list(stdin.readline().rstrip())",
"-s.sort()",
"-lin = []",
"-for key, value in groupby(s):",
"- lin.append(len(list(value)))",
"+n = ... | false | 0.046405 | 0.21153 | 0.219377 | [
"s131333190",
"s456982865"
] |
u844646164 | p03673 | python | s590071191 | s727820384 | 251 | 159 | 26,180 | 116,152 | Accepted | Accepted | 36.65 | n = int(eval(input()))
a = list(map(int, input().split()))
b = [0 for _ in range(n)]
count = 0
i = 0
j = -1
k = -1
for _ in range(n):
if count % 2 == 0:
b[i] = a[k]
i += 1
k -= 1
else:
b[j] = a[k]
j -= 1
k -= 1
count += 1
print((*b)) | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
b = []
c = []
for i in range(n):
if i == 0:
b.append(a[i])
elif i % 2 == 0:
b.append(a[i])
elif i % 2 == 1:
c.append(a[i])
if n % 2:
ans = b[::-1] + c
else:
ans = c[::-1] + b
print((*ans))
| 20 | 19 | 276 | 290 | n = int(eval(input()))
a = list(map(int, input().split()))
b = [0 for _ in range(n)]
count = 0
i = 0
j = -1
k = -1
for _ in range(n):
if count % 2 == 0:
b[i] = a[k]
i += 1
k -= 1
else:
b[j] = a[k]
j -= 1
k -= 1
count += 1
print((*b))
| n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
b = []
c = []
for i in range(n):
if i == 0:
b.append(a[i])
elif i % 2 == 0:
b.append(a[i])
elif i % 2 == 1:
c.append(a[i])
if n % 2:
ans = b[::-1] + c
else:
ans = c[::-1] + b
print((*ans))
| false | 5 | [
"-b = [0 for _ in range(n)]",
"-count = 0",
"-i = 0",
"-j = -1",
"-k = -1",
"-for _ in range(n):",
"- if count % 2 == 0:",
"- b[i] = a[k]",
"- i += 1",
"- k -= 1",
"- else:",
"- b[j] = a[k]",
"- j -= 1",
"- k -= 1",
"- count += 1",
"-p... | false | 0.038216 | 0.04128 | 0.925787 | [
"s590071191",
"s727820384"
] |
u859897687 | p02957 | python | s759675821 | s198033356 | 176 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.34 | a,b=list(map(int,input().split()))
if (a-b)%2==1:
print("IMPOSSIBLE")
else:
print((min(a,b)+abs(a-b)//2)) | a,b=list(map(int,input().split()))
if (a+b)%2==1:
print("IMPOSSIBLE")
else:
print(((a+b)//2)) | 5 | 5 | 105 | 93 | a, b = list(map(int, input().split()))
if (a - b) % 2 == 1:
print("IMPOSSIBLE")
else:
print((min(a, b) + abs(a - b) // 2))
| a, b = list(map(int, input().split()))
if (a + b) % 2 == 1:
print("IMPOSSIBLE")
else:
print(((a + b) // 2))
| false | 0 | [
"-if (a - b) % 2 == 1:",
"+if (a + b) % 2 == 1:",
"- print((min(a, b) + abs(a - b) // 2))",
"+ print(((a + b) // 2))"
] | false | 0.091919 | 0.046185 | 1.990206 | [
"s759675821",
"s198033356"
] |
u189023301 | p02883 | python | s574419095 | s936982018 | 324 | 282 | 51,740 | 52,088 | Accepted | Accepted | 12.96 | import sys
import numpy as np
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
cc = CC('my_module')
@cc.export('is_ok', '(i8[:],u8[:],u8,u8)')
def is_ok(A, F, x, k):
y = A - x // F
tmp = y[y > 0].sum()
return tmp <= k
cc.compile()
ex... | import sys
import numpy as np
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
cc = CC('my_module')
@cc.export('is_ok', '(u8[:],u8[:],u8,u8)')
def is_ok(A, F, x, k):
tmp = 0
for a, f in zip(A, F):
y = a * f
if y > x:
tmp ... | 35 | 37 | 679 | 747 | import sys
import numpy as np
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("my_module")
@cc.export("is_ok", "(i8[:],u8[:],u8,u8)")
def is_ok(A, F, x, k):
y = A - x // F
tmp = y[y > 0].sum()
return tmp <= k
cc.compile()
exit()
from my_module imp... | import sys
import numpy as np
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("my_module")
@cc.export("is_ok", "(u8[:],u8[:],u8,u8)")
def is_ok(A, F, x, k):
tmp = 0
for a, f in zip(A, F):
y = a * f
if y > x:
tmp += a - x // ... | false | 5.405405 | [
"- @cc.export(\"is_ok\", \"(i8[:],u8[:],u8,u8)\")",
"+ @cc.export(\"is_ok\", \"(u8[:],u8[:],u8,u8)\")",
"- y = A - x // F",
"- tmp = y[y > 0].sum()",
"+ tmp = 0",
"+ for a, f in zip(A, F):",
"+ y = a * f",
"+ if y > x:",
"+ tmp +... | false | 0.297099 | 0.282969 | 1.049932 | [
"s574419095",
"s936982018"
] |
u102461423 | p03163 | python | s282576379 | s855593187 | 211 | 138 | 15,488 | 28,944 | Accepted | Accepted | 34.6 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N,W = list(map(int,readline().split()))
m = list(map(int,read().split()))
WV = list(zip(m,m))
# 重さ -> 最大価値
dp = np.zeros(W+1,np.int64)
for w,v in WV:
np.maximum... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, lim = list(map(int, readline().split()))
WV = np.array(read().split(), np.int64)
W = WV[::2]
V = WV[1::2]
# weight -> value
dp = np.zeros(lim + 1, np.int64)
for w,... | 20 | 18 | 380 | 396 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N, W = list(map(int, readline().split()))
m = list(map(int, read().split()))
WV = list(zip(m, m))
# 重さ -> 最大価値
dp = np.zeros(W + 1, np.int64)
for w, v in WV:
np.maximum(dp[w:], dp... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, lim = list(map(int, readline().split()))
WV = np.array(read().split(), np.int64)
W = WV[::2]
V = WV[1::2]
# weight -> value
dp = np.zeros(lim + 1, np.int64)
for w, v in zip(W, V):
... | false | 10 | [
"+import numpy as np",
"-import numpy as np",
"-",
"-N, W = list(map(int, readline().split()))",
"-m = list(map(int, read().split()))",
"-WV = list(zip(m, m))",
"-# 重さ -> 最大価値",
"-dp = np.zeros(W + 1, np.int64)",
"-for w, v in WV:",
"- np.maximum(dp[w:], dp[:-w].copy() + v, out=dp[w:])",
"-an... | false | 0.250539 | 0.182536 | 1.372544 | [
"s282576379",
"s855593187"
] |
u218834617 | p02761 | python | s635925421 | s152265511 | 75 | 63 | 61,900 | 61,892 | Accepted | Accepted | 16 | import sys
N,M=list(map(int,input().split()))
x=[-1]*N
valid=True
for _ in range(M):
s,c=list(map(int,input().split()))
if x[s-1]!=-1 and x[s-1]!=c:
print((-1))
sys.exit()
x[s-1]=c
if N>1 and x[0]==0:
print((-1))
else:
ans=0
for i in range(N):
if x[i]... | N,M=list(map(int,input().split()))
x=[-1]*N
for _ in range(M):
s,c=list(map(int,input().split()))
s-=1
if ((s==c==0 and N>1) or
x[s]!=-1 and x[s]!=c):
print((-1))
exit()
x[s]=c
if x[0]==-1:
x[0]=0+(N>1)
for i in range(N):
if x[i]==-1: x[i]=0
print((''.j... | 25 | 18 | 447 | 322 | import sys
N, M = list(map(int, input().split()))
x = [-1] * N
valid = True
for _ in range(M):
s, c = list(map(int, input().split()))
if x[s - 1] != -1 and x[s - 1] != c:
print((-1))
sys.exit()
x[s - 1] = c
if N > 1 and x[0] == 0:
print((-1))
else:
ans = 0
for i in range(N):
... | N, M = list(map(int, input().split()))
x = [-1] * N
for _ in range(M):
s, c = list(map(int, input().split()))
s -= 1
if (s == c == 0 and N > 1) or x[s] != -1 and x[s] != c:
print((-1))
exit()
x[s] = c
if x[0] == -1:
x[0] = 0 + (N > 1)
for i in range(N):
if x[i] == -1:
x[i... | false | 28 | [
"-import sys",
"-",
"-valid = True",
"- if x[s - 1] != -1 and x[s - 1] != c:",
"+ s -= 1",
"+ if (s == c == 0 and N > 1) or x[s] != -1 and x[s] != c:",
"- sys.exit()",
"- x[s - 1] = c",
"-if N > 1 and x[0] == 0:",
"- print((-1))",
"-else:",
"- ans = 0",
"- for i i... | false | 0.033709 | 0.035857 | 0.940109 | [
"s635925421",
"s152265511"
] |
u955248595 | p02640 | python | s637082840 | s626955088 | 63 | 28 | 63,816 | 9,196 | Accepted | Accepted | 55.56 | X,Y = (int(x) for x in input().split())
Flag = False
for A in range(0,X+1):
for B in range(0,X+1):
if A+B==X and 2*A+4*B==Y:
Flag = True
if Flag:
break
if Flag:
print('Yes')
else:
print('No') | X,Y = (int(x) for x in input().split())
Flag = False
for A in range(0,X+1):
B = X-A
if 2*A+4*B==Y:
Flag = True
break
print((['No','Yes'][Flag])) | 12 | 8 | 246 | 173 | X, Y = (int(x) for x in input().split())
Flag = False
for A in range(0, X + 1):
for B in range(0, X + 1):
if A + B == X and 2 * A + 4 * B == Y:
Flag = True
if Flag:
break
if Flag:
print("Yes")
else:
print("No")
| X, Y = (int(x) for x in input().split())
Flag = False
for A in range(0, X + 1):
B = X - A
if 2 * A + 4 * B == Y:
Flag = True
break
print((["No", "Yes"][Flag]))
| false | 33.333333 | [
"- for B in range(0, X + 1):",
"- if A + B == X and 2 * A + 4 * B == Y:",
"- Flag = True",
"- if Flag:",
"+ B = X - A",
"+ if 2 * A + 4 * B == Y:",
"+ Flag = True",
"-if Flag:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print(([\"No\", \"Yes\... | false | 0.046963 | 0.046921 | 1.000886 | [
"s637082840",
"s626955088"
] |
u798803522 | p02364 | python | s955060228 | s081181670 | 1,190 | 1,040 | 43,800 | 47,584 | Accepted | Accepted | 12.61 | from collections import defaultdict
import heapq
vertices,edges = list(map(int,input().split(" ")))
link = defaultdict(dict)
weight = defaultdict(dict)
way = [float("inf")] * vertices
for e in range(edges):
source,target,w = list(map(int,input().split(" ")))
link[source] = link.get(source,set()) | {ta... | from collections import defaultdict
import heapq
vertices, edges = (int(n) for n in input().split(" "))
conn = defaultdict(set)
weight = defaultdict(dict)
for i in range(edges):
v1, v2, w = (int(n) for n in input().split(" "))
conn[v1] |= {v2}
conn[v2] |= {v1}
weight[v1][v2] = w
weight[v2]... | 34 | 29 | 979 | 784 | from collections import defaultdict
import heapq
vertices, edges = list(map(int, input().split(" ")))
link = defaultdict(dict)
weight = defaultdict(dict)
way = [float("inf")] * vertices
for e in range(edges):
source, target, w = list(map(int, input().split(" ")))
link[source] = link.get(source, set()) | {targe... | from collections import defaultdict
import heapq
vertices, edges = (int(n) for n in input().split(" "))
conn = defaultdict(set)
weight = defaultdict(dict)
for i in range(edges):
v1, v2, w = (int(n) for n in input().split(" "))
conn[v1] |= {v2}
conn[v2] |= {v1}
weight[v1][v2] = w
weight[v2][v1] = w
... | false | 14.705882 | [
"-vertices, edges = list(map(int, input().split(\" \")))",
"-link = defaultdict(dict)",
"+vertices, edges = (int(n) for n in input().split(\" \"))",
"+conn = defaultdict(set)",
"-way = [float(\"inf\")] * vertices",
"-for e in range(edges):",
"- source, target, w = list(map(int, input().split(\" \")))... | false | 0.054907 | 0.036525 | 1.503291 | [
"s955060228",
"s081181670"
] |
u612975321 | p03721 | python | s525216013 | s228979302 | 425 | 319 | 27,080 | 29,420 | Accepted | Accepted | 24.94 | import heapq
n, k = list(map(int,input().split()))
q = []
for i in range(n):
q.append(list(map(int, input().split())))
heapq.heapify(q)
cnt = 0
while cnt < k:
a, b = heapq.heappop(q)
cnt += b
print(a) | n, k = list(map(int,input().split()))
q = []
for i in range(n):
q.append(list(map(int, input().split())))
q = sorted(q, key=lambda x:x[0])
cnt = 0
i = 0
while cnt < k:
a, b = q[i]
cnt += b
i += 1
print(a) | 16 | 14 | 230 | 229 | import heapq
n, k = list(map(int, input().split()))
q = []
for i in range(n):
q.append(list(map(int, input().split())))
heapq.heapify(q)
cnt = 0
while cnt < k:
a, b = heapq.heappop(q)
cnt += b
print(a)
| n, k = list(map(int, input().split()))
q = []
for i in range(n):
q.append(list(map(int, input().split())))
q = sorted(q, key=lambda x: x[0])
cnt = 0
i = 0
while cnt < k:
a, b = q[i]
cnt += b
i += 1
print(a)
| false | 12.5 | [
"-import heapq",
"-",
"-heapq.heapify(q)",
"+q = sorted(q, key=lambda x: x[0])",
"+i = 0",
"- a, b = heapq.heappop(q)",
"+ a, b = q[i]",
"+ i += 1"
] | false | 0.039767 | 0.197333 | 0.201521 | [
"s525216013",
"s228979302"
] |
u761320129 | p03673 | python | s602746284 | s279393589 | 169 | 145 | 26,180 | 32,376 | Accepted | Accepted | 14.2 | N = int(eval(input()))
src = list(map(int,input().split()))
ans = list(reversed(src[1::2])) + src[::2]
if N%2:
ans.reverse()
print((*ans)) | from collections import deque
N = int(eval(input()))
A = list(map(int,input().split()))
b = deque()
for i,a in enumerate(A):
if i%2:
b.appendleft(a)
else:
b.append(a)
if N%2:
print((*reversed(b)))
else:
print((*b)) | 7 | 15 | 141 | 252 | N = int(eval(input()))
src = list(map(int, input().split()))
ans = list(reversed(src[1::2])) + src[::2]
if N % 2:
ans.reverse()
print((*ans))
| from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
b = deque()
for i, a in enumerate(A):
if i % 2:
b.appendleft(a)
else:
b.append(a)
if N % 2:
print((*reversed(b)))
else:
print((*b))
| false | 53.333333 | [
"+from collections import deque",
"+",
"-src = list(map(int, input().split()))",
"-ans = list(reversed(src[1::2])) + src[::2]",
"+A = list(map(int, input().split()))",
"+b = deque()",
"+for i, a in enumerate(A):",
"+ if i % 2:",
"+ b.appendleft(a)",
"+ else:",
"+ b.append(a)"... | false | 0.048265 | 0.048216 | 1.001013 | [
"s602746284",
"s279393589"
] |
u945181840 | p03372 | python | s522250017 | s484229246 | 516 | 218 | 38,964 | 38,964 | Accepted | Accepted | 57.75 | import sys
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
N, C = list(map(int, readline().split()))
xv = np.array(read().split(), np.int64).reshape(N, 2)
v = xv[:, 1]
x = xv[:, 0]
ax = C - x[::-1]
cx = x.copy()
cx[1:] = cx[1:] - cx[:-1]
acx = C - x
acx[:-1] = acx[:-1] - acx[1:]
... | import sys
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
N, C = list(map(int, readline().split()))
xv = np.array(read().split(), np.int64).reshape(N, 2)
v = xv[:, 1]
x = xv[:, 0]
ax = C - x[::-1]
cx = x.copy()
cx[1:] = cx[1:] - cx[:-1]
acx = C - x
acx[:-1] = acx[:-1] - acx[1:]
... | 31 | 36 | 758 | 868 | import sys
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
N, C = list(map(int, readline().split()))
xv = np.array(read().split(), np.int64).reshape(N, 2)
v = xv[:, 1]
x = xv[:, 0]
ax = C - x[::-1]
cx = x.copy()
cx[1:] = cx[1:] - cx[:-1]
acx = C - x
acx[:-1] = acx[:-1] - acx[1:]
clockwise = v - ... | import sys
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
N, C = list(map(int, readline().split()))
xv = np.array(read().split(), np.int64).reshape(N, 2)
v = xv[:, 1]
x = xv[:, 0]
ax = C - x[::-1]
cx = x.copy()
cx[1:] = cx[1:] - cx[:-1]
acx = C - x
acx[:-1] = acx[:-1] - acx[1:]
clockwise = np.c... | false | 13.888889 | [
"-clockwise = v - cx",
"-np.cumsum(clockwise, out=clockwise)",
"+clockwise = np.cumsum(v - cx)",
"-for i in range(N - 1):",
"- answer.append(clockwise[i] - x[i] + anti_max[N - i - 2])",
"- answer.append(anticlockwise[i] - ax[i] + con_max[N - i - 2])",
"+clockwise = clockwise - x",
"+anti_max = a... | false | 0.256415 | 0.253434 | 1.011763 | [
"s522250017",
"s484229246"
] |
u445624660 | p02954 | python | s051048149 | s987932005 | 171 | 93 | 12,596 | 17,756 | Accepted | Accepted | 45.61 | s = eval(input())
n = len(s)
arr = [0 for _ in range(n)]
r_arr = [0 for _ in range(n)]
l_arr = [0 for _ in range(n)]
for i in range(n - 1):
if s[i] == "R" and s[i + 1] == "L":
arr[i] += 1
arr[i + 1] += 1
r_pos = []
for i in range(n - 1):
if s[i] == "R":
if s[i + 1] == "... | a = list(eval(input()))
ans = [0] * len(a)
even_r, odd_r = 0, 0
# 正直変数ガチャ
for i in range(len(a)):
if a[i] == "R":
if i % 2 == 0:
odd_r += 1
else:
even_r += 1
else:
if i % 2 == 0:
ans[i - 1] += even_r
ans[i] += odd_r
el... | 43 | 36 | 1,000 | 840 | s = eval(input())
n = len(s)
arr = [0 for _ in range(n)]
r_arr = [0 for _ in range(n)]
l_arr = [0 for _ in range(n)]
for i in range(n - 1):
if s[i] == "R" and s[i + 1] == "L":
arr[i] += 1
arr[i + 1] += 1
r_pos = []
for i in range(n - 1):
if s[i] == "R":
if s[i + 1] == "L":
fo... | a = list(eval(input()))
ans = [0] * len(a)
even_r, odd_r = 0, 0
# 正直変数ガチャ
for i in range(len(a)):
if a[i] == "R":
if i % 2 == 0:
odd_r += 1
else:
even_r += 1
else:
if i % 2 == 0:
ans[i - 1] += even_r
ans[i] += odd_r
else:
... | false | 16.27907 | [
"-s = eval(input())",
"-n = len(s)",
"-arr = [0 for _ in range(n)]",
"-r_arr = [0 for _ in range(n)]",
"-l_arr = [0 for _ in range(n)]",
"-for i in range(n - 1):",
"- if s[i] == \"R\" and s[i + 1] == \"L\":",
"- arr[i] += 1",
"- arr[i + 1] += 1",
"-r_pos = []",
"-for i in range(... | false | 0.033373 | 0.048745 | 0.684635 | [
"s051048149",
"s987932005"
] |
u370661635 | p03325 | python | s387607338 | s663894819 | 118 | 28 | 4,148 | 4,148 | Accepted | Accepted | 76.27 | n = int(eval(input()))
a = list(map(int,input().split()))
cnt = 0
for ii in a:
temp = ii
while temp % 2 == 0:
temp = temp /2
cnt += 1
print(cnt) | n = int(eval(input()))
a = list(map(int,input().split()))
c = 0
for ii in range(n):
c += format(a[ii],"b")[::-1].find("1")
print(c) | 11 | 7 | 162 | 134 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for ii in a:
temp = ii
while temp % 2 == 0:
temp = temp / 2
cnt += 1
print(cnt)
| n = int(eval(input()))
a = list(map(int, input().split()))
c = 0
for ii in range(n):
c += format(a[ii], "b")[::-1].find("1")
print(c)
| false | 36.363636 | [
"-cnt = 0",
"-for ii in a:",
"- temp = ii",
"- while temp % 2 == 0:",
"- temp = temp / 2",
"- cnt += 1",
"-print(cnt)",
"+c = 0",
"+for ii in range(n):",
"+ c += format(a[ii], \"b\")[::-1].find(\"1\")",
"+print(c)"
] | false | 0.035234 | 0.054911 | 0.641665 | [
"s387607338",
"s663894819"
] |
u054556734 | p03295 | python | s676369779 | s955094604 | 560 | 517 | 37,908 | 37,920 | Accepted | Accepted | 7.68 | import numpy as np
n,m = list(map(int,input().split()))
arr = np.array([list(map(int,input().split())) for i in range(m)])
arr = arr[ arr[:,1].argsort(), :] #各行の1列目だけみて、行インデックスをソート
ans = 0
start,end = 0,0
for ab in arr:
a,b = ab[0],ab[1]
if a < end: continue
start,end = a,b
ans += 1
p... | import numpy as np
n,m = list(map(int,input().split()))
arr = np.array([list(map(int,input().split())) for i in range(m)])
arr = arr[ arr[:,1].argsort(), :] #各行の1列目だけみて、行インデックスをソート
A = arr.T[0]
B = arr.T[1]
ans = 0
start,end = 0,0
for a,b in zip(A,B):
if a < end: continue
start,end = a,b
ans ... | 18 | 18 | 328 | 337 | import numpy as np
n, m = list(map(int, input().split()))
arr = np.array([list(map(int, input().split())) for i in range(m)])
arr = arr[arr[:, 1].argsort(), :] # 各行の1列目だけみて、行インデックスをソート
ans = 0
start, end = 0, 0
for ab in arr:
a, b = ab[0], ab[1]
if a < end:
continue
start, end = a, b
ans += 1
... | import numpy as np
n, m = list(map(int, input().split()))
arr = np.array([list(map(int, input().split())) for i in range(m)])
arr = arr[arr[:, 1].argsort(), :] # 各行の1列目だけみて、行インデックスをソート
A = arr.T[0]
B = arr.T[1]
ans = 0
start, end = 0, 0
for a, b in zip(A, B):
if a < end:
continue
start, end = a, b
... | false | 0 | [
"+A = arr.T[0]",
"+B = arr.T[1]",
"-for ab in arr:",
"- a, b = ab[0], ab[1]",
"+for a, b in zip(A, B):"
] | false | 0.388062 | 0.439783 | 0.882395 | [
"s676369779",
"s955094604"
] |
u909643606 | p03329 | python | s542480282 | s907748182 | 473 | 232 | 3,064 | 3,064 | Accepted | Accepted | 50.95 | n=int(eval(input()))
s_6=[6**(6-i) for i in range(6)]
s_9=[9**(5-i) for i in range(5)]
amari=[0,1,2,3,4,5,1,2,3,1,2,3,2,3]
best=float("inf")
for i in range(n+1):
count_6=0
n_6=i
for j in range(len(s_6)):
count_6+=n_6//s_6[j]
n_6=n_6%s_6[j]
n_9=n-i
count_9=0
fo... | n = int(eval(input()))
ans = float("inf")
for n_nine in range(0, n//9 + 1):
s = n - 9 * n_nine
n_six = s // 6
n_one = s - 6 * n_six
n_nine2 = 0
n_six2 = 0
pow_nine = 5
pow_six = 6
while n_nine >= 9:
if n_nine >= 9 ** (pow_nine - 1):
n_nine -= 9 ** (p... | 22 | 28 | 461 | 672 | n = int(eval(input()))
s_6 = [6 ** (6 - i) for i in range(6)]
s_9 = [9 ** (5 - i) for i in range(5)]
amari = [0, 1, 2, 3, 4, 5, 1, 2, 3, 1, 2, 3, 2, 3]
best = float("inf")
for i in range(n + 1):
count_6 = 0
n_6 = i
for j in range(len(s_6)):
count_6 += n_6 // s_6[j]
n_6 = n_6 % s_6[j]
n_9... | n = int(eval(input()))
ans = float("inf")
for n_nine in range(0, n // 9 + 1):
s = n - 9 * n_nine
n_six = s // 6
n_one = s - 6 * n_six
n_nine2 = 0
n_six2 = 0
pow_nine = 5
pow_six = 6
while n_nine >= 9:
if n_nine >= 9 ** (pow_nine - 1):
n_nine -= 9 ** (pow_nine - 1)
... | false | 21.428571 | [
"-s_6 = [6 ** (6 - i) for i in range(6)]",
"-s_9 = [9 ** (5 - i) for i in range(5)]",
"-amari = [0, 1, 2, 3, 4, 5, 1, 2, 3, 1, 2, 3, 2, 3]",
"-best = float(\"inf\")",
"-for i in range(n + 1):",
"- count_6 = 0",
"- n_6 = i",
"- for j in range(len(s_6)):",
"- count_6 += n_6 // s_6[j]",... | false | 0.119928 | 0.058043 | 2.066209 | [
"s542480282",
"s907748182"
] |
u652583512 | p02862 | python | s723422137 | s051675328 | 444 | 122 | 38,768 | 3,064 | Accepted | Accepted | 72.52 | def comb(n, k, mod):
if k > (n // 2):
k = n - k
a = 1
for i in range(k):
a *= (n - i)
a %= mod
for i in range(k - 1):
a = (a * pow(k - i, mod - 2, mod)) % mod
return a
X, Y = list(map(int, input().split()))
ans = 0
mod = 10 ** 9 + 7
if X > Y:
X, ... | def comb(n, k, mod):
if k > (n // 2):
k = n - k
a = 1
for i in range(k):
a = (a * (n - i)) % mod
b = 1
for i in range(k - 1):
b = (b *(k - i)) % mod
a = (a * pow(b, mod - 2, mod)) % mod
return a
X, Y = list(map(int, input().split()))
ans = 0
mod = 10 ... | 26 | 27 | 493 | 521 | def comb(n, k, mod):
if k > (n // 2):
k = n - k
a = 1
for i in range(k):
a *= n - i
a %= mod
for i in range(k - 1):
a = (a * pow(k - i, mod - 2, mod)) % mod
return a
X, Y = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
if X > Y:
X, Y = Y, X
##Yのほうが大きいと... | def comb(n, k, mod):
if k > (n // 2):
k = n - k
a = 1
for i in range(k):
a = (a * (n - i)) % mod
b = 1
for i in range(k - 1):
b = (b * (k - i)) % mod
a = (a * pow(b, mod - 2, mod)) % mod
return a
X, Y = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
if X > ... | false | 3.703704 | [
"- a *= n - i",
"- a %= mod",
"+ a = (a * (n - i)) % mod",
"+ b = 1",
"- a = (a * pow(k - i, mod - 2, mod)) % mod",
"+ b = (b * (k - i)) % mod",
"+ a = (a * pow(b, mod - 2, mod)) % mod"
] | false | 0.479565 | 0.145114 | 3.304742 | [
"s723422137",
"s051675328"
] |
u032662562 | p00079 | python | s860490203 | s890952804 | 30 | 20 | 7,516 | 7,552 | Accepted | Accepted | 33.33 | import math
f = []
while True:
try:
st = input().strip().split(',')
x,y = list(map(float,st ))
f.append(x + y*1j)
except EOFError:
break
px = [p.real for p in f]
ox = (max(px) + min(px)) / 2.0
py = [p.imag for p in f]
oy = (max(py) + min(py)) / 2.0
fo = ox + oy... | def cross(x, y):
return (x.conjugate() * y).imag
def area_polygon(points):
area = 0
n = len(points)
for i in range(n):
area += cross(points[i], points[(i+1)%n])
return area / 2
import sys
p = []
for line in sys.stdin:
x, y = list(map(float, line.split(','))... | 31 | 19 | 598 | 371 | import math
f = []
while True:
try:
st = input().strip().split(",")
x, y = list(map(float, st))
f.append(x + y * 1j)
except EOFError:
break
px = [p.real for p in f]
ox = (max(px) + min(px)) / 2.0
py = [p.imag for p in f]
oy = (max(py) + min(py)) / 2.0
fo = ox + oy * 1j
ss = 0.0
... | def cross(x, y):
return (x.conjugate() * y).imag
def area_polygon(points):
area = 0
n = len(points)
for i in range(n):
area += cross(points[i], points[(i + 1) % n])
return area / 2
import sys
p = []
for line in sys.stdin:
x, y = list(map(float, line.split(",")))
p.append(complex... | false | 38.709677 | [
"-import math",
"+def cross(x, y):",
"+ return (x.conjugate() * y).imag",
"-f = []",
"-while True:",
"- try:",
"- st = input().strip().split(\",\")",
"- x, y = list(map(float, st))",
"- f.append(x + y * 1j)",
"- except EOFError:",
"- break",
"-px = [p.real ... | false | 0.046723 | 0.045544 | 1.025881 | [
"s860490203",
"s890952804"
] |
u288087195 | p03127 | python | s645165862 | s891439598 | 95 | 79 | 16,240 | 14,224 | Accepted | Accepted | 16.84 | # -*- coding: utf-8 -*-
import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
def calc(monsters):
if len(monsters) == 1:
return monsters[0]
min_monster = min(monsters)
min_index = monsters.index(min_monster)
new_monsters = []
for i in range(len(monster... | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = list(map(int, input().split()))
def calc(monsters):
if len(monsters) == 1:
return monsters[0]
min_monster = min(monsters)
min_index = monsters.index(min_monster)
new_monsters = []
for i in range(len(monsters)):
if i... | 27 | 26 | 568 | 550 | # -*- coding: utf-8 -*-
import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
def calc(monsters):
if len(monsters) == 1:
return monsters[0]
min_monster = min(monsters)
min_index = monsters.index(min_monster)
new_monsters = []
for i in range(len(monsters)):
if... | # -*- coding: utf-8 -*-
N = int(eval(input()))
A = list(map(int, input().split()))
def calc(monsters):
if len(monsters) == 1:
return monsters[0]
min_monster = min(monsters)
min_index = monsters.index(min_monster)
new_monsters = []
for i in range(len(monsters)):
if i == min_index:
... | false | 3.703704 | [
"-import fractions",
"-"
] | false | 0.055714 | 0.036268 | 1.536162 | [
"s645165862",
"s891439598"
] |
u671060652 | p03242 | python | s044157015 | s919170929 | 292 | 64 | 64,748 | 61,812 | Accepted | Accepted | 78.08 | import itertools
import math
import fractions
import functools
import copy
n = input()
for i in range(len(n)):
if n[i] == '1':
print('9',end="")
else:
print('1',end="")
print("")
| def main():
# n = int(input())
# h, w, k = map(int, input().split())
# a = list(map(int, input().split()))
s = eval(input())
ans = ""
for i in s:
if i == "1":
ans += "9"
else:
ans += "1"
print(ans)
if __name__ == '__main__':
main()... | 13 | 16 | 215 | 315 | import itertools
import math
import fractions
import functools
import copy
n = input()
for i in range(len(n)):
if n[i] == "1":
print("9", end="")
else:
print("1", end="")
print("")
| def main():
# n = int(input())
# h, w, k = map(int, input().split())
# a = list(map(int, input().split()))
s = eval(input())
ans = ""
for i in s:
if i == "1":
ans += "9"
else:
ans += "1"
print(ans)
if __name__ == "__main__":
main()
| false | 18.75 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-import copy",
"+def main():",
"+ # n = int(input())",
"+ # h, w, k = map(int, input().split())",
"+ # a = list(map(int, input().split()))",
"+ s = eval(input())",
"+ ans = \"\"",
"+ for i in s:",... | false | 0.279666 | 0.037272 | 7.503383 | [
"s044157015",
"s919170929"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.