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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u411203878 | p03162 | python | s337933350 | s508058868 | 715 | 279 | 75,352 | 104,196 | Accepted | Accepted | 60.98 | n=int(eval(input()))
ab = []
for _ in range(n):
a, b, c = (int(x) for x in input().split())
ab.append([a, b, c])
dp = [[0 for i in range(3)] for j in range(n+1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j != k:
dp[i+1][k] = max([dp[i+... | n=int(eval(input()))
ab = []
for _ in range(n):
a, b, c = (int(x) for x in input().split())
ab.append([a, b, c])
dp = [[0]*3 for j in range(n+1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j != k:
dp[i+1][k] = max([dp[i+1][k], dp[i][j]+... | 16 | 16 | 362 | 347 | n = int(eval(input()))
ab = []
for _ in range(n):
a, b, c = (int(x) for x in input().split())
ab.append([a, b, c])
dp = [[0 for i in range(3)] for j in range(n + 1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j != k:
dp[i + 1][k] = max([dp[i + 1][k], dp[i... | n = int(eval(input()))
ab = []
for _ in range(n):
a, b, c = (int(x) for x in input().split())
ab.append([a, b, c])
dp = [[0] * 3 for j in range(n + 1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j != k:
dp[i + 1][k] = max([dp[i + 1][k], dp[i][j] + ab[i][k... | false | 0 | [
"-dp = [[0 for i in range(3)] for j in range(n + 1)]",
"+dp = [[0] * 3 for j in range(n + 1)]"
] | false | 0.036876 | 0.037034 | 0.995723 | [
"s337933350",
"s508058868"
] |
u600402037 | p03088 | python | s018148545 | s322824582 | 187 | 120 | 5,584 | 3,828 | Accepted | Accepted | 35.83 | # coding: utf-8
import sys
from functools import lru_cache
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10 ** 9 + 7
N = ir()
def ok(last4):
if last4.find('AGC') != -1:
return False
for i in range(3):
s = list(... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10 ** 9 + 7
N = ir()
memo = [{} for _ in range(N+1)]
def ok(last4):
if last4.find('AGC') != -1:
return False
for i in range(3):
s = list(... | 33 | 36 | 697 | 772 | # coding: utf-8
import sys
from functools import lru_cache
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10**9 + 7
N = ir()
def ok(last4):
if last4.find("AGC") != -1:
return False
for i in range(3):
s = list(last4)
s[... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10**9 + 7
N = ir()
memo = [{} for _ in range(N + 1)]
def ok(last4):
if last4.find("AGC") != -1:
return False
for i in range(3):
s = list(last4)
... | false | 8.333333 | [
"-from functools import lru_cache",
"+memo = [{} for _ in range(N + 1)]",
"-@lru_cache(None)",
"+ if last3 in memo[i]:",
"+ return memo[i][last3]",
"- return ret % MOD",
"+ ret %= MOD",
"+ memo[i][last3] = ret",
"+ return ret"
] | false | 0.063899 | 0.062742 | 1.018439 | [
"s018148545",
"s322824582"
] |
u968166680 | p03283 | python | s187149075 | s595214405 | 620 | 559 | 21,076 | 25,788 | Accepted | Accepted | 9.84 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N, M, Q = map(int, readline().split())
A = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = 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
def main():
N, M, Q = list(map(int, readline().split()))
A = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = list(map(int, readline().spli... | 34 | 34 | 801 | 811 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, M, Q = map(int, readline().split())
A = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = map(int, readline().split())
A[l - 1][r - ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N, M, Q = list(map(int, readline().split()))
A = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = list(map(int, readline().split()))
A... | false | 0 | [
"- N, M, Q = map(int, readline().split())",
"+ N, M, Q = list(map(int, readline().split()))",
"- l, r = map(int, readline().split())",
"+ l, r = list(map(int, readline().split()))",
"- p, q = map(int, readline().split())",
"+ p, q = list(map(int, readline().split()))",
... | false | 0.037336 | 0.035856 | 1.041271 | [
"s187149075",
"s595214405"
] |
u950825280 | p02725 | python | s464096318 | s672406313 | 291 | 165 | 26,444 | 26,444 | Accepted | Accepted | 43.3 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = k
b = a[0] + (k-a[-1])
prev = a[0]
for i, v in enumerate(a):
x = 0
if i == 0:
x = max(abs(a[i+1]-v), b)
elif i == len(a)-1:
x = max(b, abs(v-prev))
else:
x = max(abs(a[i+1]-v), abs(v-prev... | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = k
b = a[0] + (k-a[-1])
prev = a[0]
for i, v in enumerate(a):
if i == 0:
ans = min(ans, k-b)
ans = min(ans, k-abs(v-prev))
prev = v
print(ans) | 16 | 14 | 367 | 256 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = k
b = a[0] + (k - a[-1])
prev = a[0]
for i, v in enumerate(a):
x = 0
if i == 0:
x = max(abs(a[i + 1] - v), b)
elif i == len(a) - 1:
x = max(b, abs(v - prev))
else:
x = max(abs(a[i + 1] - v), abs(v - ... | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = k
b = a[0] + (k - a[-1])
prev = a[0]
for i, v in enumerate(a):
if i == 0:
ans = min(ans, k - b)
ans = min(ans, k - abs(v - prev))
prev = v
print(ans)
| false | 12.5 | [
"- x = 0",
"- x = max(abs(a[i + 1] - v), b)",
"- elif i == len(a) - 1:",
"- x = max(b, abs(v - prev))",
"- else:",
"- x = max(abs(a[i + 1] - v), abs(v - prev))",
"- ans = min(ans, k - x)",
"+ ans = min(ans, k - b)",
"+ ans = min(ans, k - abs(v - prev))"
] | false | 0.07488 | 0.04716 | 1.587784 | [
"s464096318",
"s672406313"
] |
u762420987 | p04034 | python | s759469133 | s229907069 | 611 | 371 | 53,080 | 12,652 | Accepted | Accepted | 39.28 | N, M = list(map(int, input().split()))
y_if = {1}
num = [1] * N
for i in range(M):
x, y = list(map(int, input().split()))
num[x - 1] -= 1
num[y - 1] += 1
if x in y_if:
if num[x - 1] == 0:
y_if.remove(x)
y_if.add(y)
print((len(y_if)))
| N, M = list(map(int, input().split()))
ball = [1] * N
red = {1}
ans = 0
for _ in range(M):
x, y = list(map(int, input().split()))
ball[x - 1] -= 1
ball[y - 1] += 1
if x in red:
red.add(y)
if ball[x - 1] == 0:
red.remove(x)
print((len(red)))
| 12 | 13 | 275 | 283 | N, M = list(map(int, input().split()))
y_if = {1}
num = [1] * N
for i in range(M):
x, y = list(map(int, input().split()))
num[x - 1] -= 1
num[y - 1] += 1
if x in y_if:
if num[x - 1] == 0:
y_if.remove(x)
y_if.add(y)
print((len(y_if)))
| N, M = list(map(int, input().split()))
ball = [1] * N
red = {1}
ans = 0
for _ in range(M):
x, y = list(map(int, input().split()))
ball[x - 1] -= 1
ball[y - 1] += 1
if x in red:
red.add(y)
if ball[x - 1] == 0:
red.remove(x)
print((len(red)))
| false | 7.692308 | [
"-y_if = {1}",
"-num = [1] * N",
"-for i in range(M):",
"+ball = [1] * N",
"+red = {1}",
"+ans = 0",
"+for _ in range(M):",
"- num[x - 1] -= 1",
"- num[y - 1] += 1",
"- if x in y_if:",
"- if num[x - 1] == 0:",
"- y_if.remove(x)",
"- y_if.add(y)",
"-print((... | false | 0.041552 | 0.036113 | 1.150612 | [
"s759469133",
"s229907069"
] |
u485716382 | p03260 | python | s525851436 | s475805327 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | def solve():
a, b = list(map(int, input().split()))
d = a * b
if d % 2 == 0:
print('No')
else:
print('Yes')
solve() | def main():
A, B = list(map(int, input().split(' ')))
for c in range(1, 4):
re = A * B * c
if re % 2 == 1:
print('Yes')
return
print('No')
return
main() | 9 | 11 | 134 | 213 | def solve():
a, b = list(map(int, input().split()))
d = a * b
if d % 2 == 0:
print("No")
else:
print("Yes")
solve()
| def main():
A, B = list(map(int, input().split(" ")))
for c in range(1, 4):
re = A * B * c
if re % 2 == 1:
print("Yes")
return
print("No")
return
main()
| false | 18.181818 | [
"-def solve():",
"- a, b = list(map(int, input().split()))",
"- d = a * b",
"- if d % 2 == 0:",
"- print(\"No\")",
"- else:",
"- print(\"Yes\")",
"+def main():",
"+ A, B = list(map(int, input().split(\" \")))",
"+ for c in range(1, 4):",
"+ re = A * B * c",... | false | 0.047421 | 0.046262 | 1.02506 | [
"s525851436",
"s475805327"
] |
u659753499 | p03371 | python | s732574880 | s305062018 | 117 | 17 | 3,060 | 3,060 | Accepted | Accepted | 85.47 | A,B,C,X,Y = list(map(int, input().split()))
ans = A*X+B*Y
for i in range(max(X,Y)+1):
ans = min(ans, A*max(X-i,0)+B*max(Y-i,0)+C*i*2)
print(ans)
| A,B,C,X,Y = list(map(int, input().split()))
if A+B < 2*C:
ans = A*X+B*Y
else:
XY = min(X,Y)
ans = min(A*(X-XY) + B*(Y-XY) + 2*C*XY, 2*C*max(X,Y))
print(ans)
| 5 | 7 | 145 | 163 | A, B, C, X, Y = list(map(int, input().split()))
ans = A * X + B * Y
for i in range(max(X, Y) + 1):
ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + C * i * 2)
print(ans)
| A, B, C, X, Y = list(map(int, input().split()))
if A + B < 2 * C:
ans = A * X + B * Y
else:
XY = min(X, Y)
ans = min(A * (X - XY) + B * (Y - XY) + 2 * C * XY, 2 * C * max(X, Y))
print(ans)
| false | 28.571429 | [
"-ans = A * X + B * Y",
"-for i in range(max(X, Y) + 1):",
"- ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + C * i * 2)",
"+if A + B < 2 * C:",
"+ ans = A * X + B * Y",
"+else:",
"+ XY = min(X, Y)",
"+ ans = min(A * (X - XY) + B * (Y - XY) + 2 * C * XY, 2 * C * max(X, Y))"
] | false | 0.050338 | 0.03611 | 1.393986 | [
"s732574880",
"s305062018"
] |
u761320129 | p03682 | python | s897550382 | s569925101 | 1,745 | 1,400 | 85,600 | 61,120 | Accepted | Accepted | 19.77 | from collections import defaultdict
import operator
N = eval(input())
xs = []
ys = []
for i in range(N):
x, y = list(map(int, input().split()))
xs.append((x,i))
ys.append((y,i))
xs.sort()
ys.sort()
es = defaultdict(lambda: float('inf'))
for i in range(N-1):
xd = xs[i+1][0] - xs[i][0]
... | N = int(eval(input()))
src = [tuple(map(int,input().split())) for i in range(N)]
xs = []
ys = []
for i,(x,y) in enumerate(src):
xs.append((x,i))
ys.append((y,i))
xs.sort()
ys.sort()
es = []
for (x1,i1),(x2,i2) in zip(xs,xs[1:]):
es.append((x2-x1, i1, i2))
for (y1,i1),(y2,i2) in zip(ys,ys[1:]... | 46 | 49 | 1,041 | 1,215 | from collections import defaultdict
import operator
N = eval(input())
xs = []
ys = []
for i in range(N):
x, y = list(map(int, input().split()))
xs.append((x, i))
ys.append((y, i))
xs.sort()
ys.sort()
es = defaultdict(lambda: float("inf"))
for i in range(N - 1):
xd = xs[i + 1][0] - xs[i][0]
i1 = min... | N = int(eval(input()))
src = [tuple(map(int, input().split())) for i in range(N)]
xs = []
ys = []
for i, (x, y) in enumerate(src):
xs.append((x, i))
ys.append((y, i))
xs.sort()
ys.sort()
es = []
for (x1, i1), (x2, i2) in zip(xs, xs[1:]):
es.append((x2 - x1, i1, i2))
for (y1, i1), (y2, i2) in zip(ys, ys[1:])... | false | 6.122449 | [
"-from collections import defaultdict",
"-import operator",
"-",
"-N = eval(input())",
"+N = int(eval(input()))",
"+src = [tuple(map(int, input().split())) for i in range(N)]",
"-for i in range(N):",
"- x, y = list(map(int, input().split()))",
"+for i, (x, y) in enumerate(src):",
"-es = default... | false | 0.107751 | 0.045931 | 2.345957 | [
"s897550382",
"s569925101"
] |
u779455925 | p02660 | python | s803792964 | s104339029 | 130 | 106 | 73,560 | 81,308 | Accepted | Accepted | 18.46 | from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
if(a%b==0):return(b)
return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
N=int(eval(input()))
... | from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
if(a%b==0):return(b)
return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
N=int(eval(input()))
... | 40 | 34 | 705 | 603 | from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a, b):
if a % b == 0:
return b
return gcd(b, a % b)
input = lambda: sys.stdin.readline().rstrip()
N = int(eval(i... | from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a, b):
if a % b == 0:
return b
return gcd(b, a % b)
input = lambda: sys.stdin.readline().rstrip()
N = int(eval(i... | false | 15 | [
"-lst2 = []",
"-lst3 = []",
"-for i in range(2, int(N**0.5) + 100):",
"- if N % i == 0:",
"- lst2.append(i)",
"- lst3.append(N // i)",
"-lst3.reverse()",
"-lst2 += lst3",
"-for i in lst2 + [N]:",
"+for i in list(range(2, int(N**0.5) + 100)):",
"+if N != 1:",
"+ lst[N] += 1"... | false | 0.148833 | 0.215689 | 0.690032 | [
"s803792964",
"s104339029"
] |
u706786134 | p02813 | python | s985360654 | s941956769 | 45 | 28 | 15,092 | 3,064 | Accepted | Accepted | 37.78 | from itertools import permutations
n = int(eval(input()))
p = list(map(str, input().split()))
q = list(map(str, input().split()))
s = "".join(map(str, list(range(1, (n+1)))))
x = list(permutations(s))
x = [list(i) for i in x]
print((abs(x.index(p)-x.index(q))))
| from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
for i, X in enumerate(permutations(list(range(1, N + 1)), N)):
if P == X:
a = i
if Q == X:
b = i
print((abs(a - b)))
| 8 | 12 | 255 | 272 | from itertools import permutations
n = int(eval(input()))
p = list(map(str, input().split()))
q = list(map(str, input().split()))
s = "".join(map(str, list(range(1, (n + 1)))))
x = list(permutations(s))
x = [list(i) for i in x]
print((abs(x.index(p) - x.index(q))))
| from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
for i, X in enumerate(permutations(list(range(1, N + 1)), N)):
if P == X:
a = i
if Q == X:
b = i
print((abs(a - b)))
| false | 33.333333 | [
"-n = int(eval(input()))",
"-p = list(map(str, input().split()))",
"-q = list(map(str, input().split()))",
"-s = \"\".join(map(str, list(range(1, (n + 1)))))",
"-x = list(permutations(s))",
"-x = [list(i) for i in x]",
"-print((abs(x.index(p) - x.index(q))))",
"+N = int(eval(input()))",
"+P = tuple(... | false | 0.041837 | 0.03954 | 1.058106 | [
"s985360654",
"s941956769"
] |
u766646838 | p02601 | python | s879668440 | s982754347 | 32 | 29 | 9,140 | 9,188 | Accepted | Accepted | 9.38 | A,B,C = list(map(int,input().split()))
K = int(eval(input()))
flag = True
for i in range(K+1):
num = K-i
for j in range(num+1):
num2 = num-j
if A*2**i<B*2**j:
if B*2**j<C*2**num2:
print("Yes")
flag = False
break
if flag ==False:
break
i... | N,M,K = list(map(int,input().split()))
num = int(eval(input()))
while num>0:
if K<=M or K<=N:
K = K*2
num -= 1
elif M<=N:
M = M*2
num -= 1
elif M>N:
K = K*2
num -= 1
if N<M and M<K:
print('Yes')
else:
print('No')
| 24 | 18 | 363 | 261 | A, B, C = list(map(int, input().split()))
K = int(eval(input()))
flag = True
for i in range(K + 1):
num = K - i
for j in range(num + 1):
num2 = num - j
if A * 2**i < B * 2**j:
if B * 2**j < C * 2**num2:
print("Yes")
flag = False
break
... | N, M, K = list(map(int, input().split()))
num = int(eval(input()))
while num > 0:
if K <= M or K <= N:
K = K * 2
num -= 1
elif M <= N:
M = M * 2
num -= 1
elif M > N:
K = K * 2
num -= 1
if N < M and M < K:
print("Yes")
else:
print("No")
| false | 25 | [
"-A, B, C = list(map(int, input().split()))",
"-K = int(eval(input()))",
"-flag = True",
"-for i in range(K + 1):",
"- num = K - i",
"- for j in range(num + 1):",
"- num2 = num - j",
"- if A * 2**i < B * 2**j:",
"- if B * 2**j < C * 2**num2:",
"- print... | false | 0.04811 | 0.048357 | 0.994877 | [
"s879668440",
"s982754347"
] |
u585963734 | p02640 | python | s213412194 | s381427811 | 27 | 23 | 9,168 | 9,172 | Accepted | Accepted | 14.81 | X,Y=list(map(int, input().split()))
for i in range(X+1):
for j in range(X-i+1):
if 2*i+4*(X-i)==Y:
print('Yes')
exit(0)
print('No') | X,Y=list(map(int, input().split()))
if 0<=(4*X-Y)//2<=X and (4*X-Y)%2==0:
print('Yes')
exit(0)
print('No') | 9 | 7 | 171 | 116 | X, Y = list(map(int, input().split()))
for i in range(X + 1):
for j in range(X - i + 1):
if 2 * i + 4 * (X - i) == Y:
print("Yes")
exit(0)
print("No")
| X, Y = list(map(int, input().split()))
if 0 <= (4 * X - Y) // 2 <= X and (4 * X - Y) % 2 == 0:
print("Yes")
exit(0)
print("No")
| false | 22.222222 | [
"-for i in range(X + 1):",
"- for j in range(X - i + 1):",
"- if 2 * i + 4 * (X - i) == Y:",
"- print(\"Yes\")",
"- exit(0)",
"+if 0 <= (4 * X - Y) // 2 <= X and (4 * X - Y) % 2 == 0:",
"+ print(\"Yes\")",
"+ exit(0)"
] | false | 0.041561 | 0.041523 | 1.000922 | [
"s213412194",
"s381427811"
] |
u537976628 | p02718 | python | s053106020 | s767909925 | 24 | 22 | 9,068 | 9,204 | Accepted | Accepted | 8.33 | n, m = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
if A[m - 1] < sum(A) / (4 * m):
print('No')
else:
print('Yes') | n, m = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse = True)
if A[m - 1] >= sum(A) / (4 * m):
print('Yes')
else:
print('No') | 6 | 6 | 166 | 169 | n, m = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
if A[m - 1] < sum(A) / (4 * m):
print("No")
else:
print("Yes")
| n, m = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
if A[m - 1] >= sum(A) / (4 * m):
print("Yes")
else:
print("No")
| false | 0 | [
"-if A[m - 1] < sum(A) / (4 * m):",
"+if A[m - 1] >= sum(A) / (4 * m):",
"+ print(\"Yes\")",
"+else:",
"-else:",
"- print(\"Yes\")"
] | false | 0.088573 | 0.045145 | 1.96195 | [
"s053106020",
"s767909925"
] |
u729133443 | p03792 | python | s454299380 | s195503016 | 70 | 55 | 5,676 | 3,316 | Accepted | Accepted | 21.43 | n=int(eval(input()));a=eval('list(input()),'*n);f=sum(n==t.count('#')for t in zip(*a));print((-all(t.count('#')<1for t in a)or min(n*2-f-a[i].count('#')+all(a[j][i]>'#'for j in range(n))for i in range(n)))) | s='#';n,*a=open(0).readlines();n=int(n);f=sum(n==t.count(s)for t in zip(*a));print((-all(t.count(s)<1for t in a)or min(n*2-f-a[i].count(s)+all(s<a[j][i]for j in range(n))for i in range(n)))) | 1 | 1 | 198 | 188 | n = int(eval(input()))
a = eval("list(input())," * n)
f = sum(n == t.count("#") for t in zip(*a))
print(
(
-all(t.count("#") < 1 for t in a)
or min(
n * 2 - f - a[i].count("#") + all(a[j][i] > "#" for j in range(n))
for i in range(n)
)
)
)
| s = "#"
n, *a = open(0).readlines()
n = int(n)
f = sum(n == t.count(s) for t in zip(*a))
print(
(
-all(t.count(s) < 1 for t in a)
or min(
n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in range(n))
for i in range(n)
)
)
)
| false | 0 | [
"-n = int(eval(input()))",
"-a = eval(\"list(input()),\" * n)",
"-f = sum(n == t.count(\"#\") for t in zip(*a))",
"+s = \"#\"",
"+n, *a = open(0).readlines()",
"+n = int(n)",
"+f = sum(n == t.count(s) for t in zip(*a))",
"- -all(t.count(\"#\") < 1 for t in a)",
"+ -all(t.count(s) < 1 f... | false | 0.037656 | 0.043243 | 0.870791 | [
"s454299380",
"s195503016"
] |
u841856382 | p02658 | python | s802117154 | s069331946 | 393 | 54 | 21,808 | 21,560 | Accepted | Accepted | 86.26 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in A:
print((0))
else:
for i in range(N):
a = A[i]
for j in range(19):
if a <= 10**j:
m = j
break
for k in range(19):
if ans <= 10**k:
... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in A:
print((0))
else:
for i in range(N):
ans = ans*A[i]
if(ans > 10**18):
print((-1))
break
elif(i == N-1):
print(ans) | 28 | 13 | 626 | 261 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in A:
print((0))
else:
for i in range(N):
a = A[i]
for j in range(19):
if a <= 10**j:
m = j
break
for k in range(19):
if ans <= 10**k:
n = k
... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in A:
print((0))
else:
for i in range(N):
ans = ans * A[i]
if ans > 10**18:
print((-1))
break
elif i == N - 1:
print(ans)
| false | 53.571429 | [
"- a = A[i]",
"- for j in range(19):",
"- if a <= 10**j:",
"- m = j",
"- break",
"- for k in range(19):",
"- if ans <= 10**k:",
"- n = k",
"- break",
"- if m + n > 19:",
"+ ans = ... | false | 0.197165 | 0.088975 | 2.215966 | [
"s802117154",
"s069331946"
] |
u729133443 | p03068 | python | s051788757 | s596804695 | 164 | 19 | 38,384 | 3,188 | Accepted | Accepted | 88.41 | _,s,k=open(0);print((''.join(t*(t==s[int(k)-1])or'*'for t in s[:-1]))) | import re;_,s,k=open(0);print((re.sub('[^%s]'%s[int(k)-1],'*',s[:-1]))) | 1 | 1 | 68 | 69 | _, s, k = open(0)
print(("".join(t * (t == s[int(k) - 1]) or "*" for t in s[:-1])))
| import re
_, s, k = open(0)
print((re.sub("[^%s]" % s[int(k) - 1], "*", s[:-1])))
| false | 0 | [
"+import re",
"+",
"-print((\"\".join(t * (t == s[int(k) - 1]) or \"*\" for t in s[:-1])))",
"+print((re.sub(\"[^%s]\" % s[int(k) - 1], \"*\", s[:-1])))"
] | false | 0.046616 | 0.078957 | 0.590405 | [
"s051788757",
"s596804695"
] |
u764773675 | p03478 | python | s593313057 | s304498964 | 44 | 36 | 3,552 | 3,060 | Accepted | Accepted | 18.18 | n,a,b = list(map(int,input().split(" ")))
res = []
for i in range(1,n + 1):
string = str(i)
string = list(string)
string = list(map(int,string))
t = 0
for j in string:
t += j
if a <= t <= b:
res.append(i)
total = 0
for i in res:
total += i
print(total)
... | # coding: utf-8
# Your code here!
n,a,b = list(map(int,input().split()))
ans = 0
for i in range(n + 1):
if a <= sum(list(map(int,list(str(i))))) <= b:
ans += i
print(ans) | 17 | 11 | 316 | 197 | n, a, b = list(map(int, input().split(" ")))
res = []
for i in range(1, n + 1):
string = str(i)
string = list(string)
string = list(map(int, string))
t = 0
for j in string:
t += j
if a <= t <= b:
res.append(i)
total = 0
for i in res:
total += i
print(total)
| # coding: utf-8
# Your code here!
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans)
| false | 35.294118 | [
"-n, a, b = list(map(int, input().split(\" \")))",
"-res = []",
"-for i in range(1, n + 1):",
"- string = str(i)",
"- string = list(string)",
"- string = list(map(int, string))",
"- t = 0",
"- for j in string:",
"- t += j",
"- if a <= t <= b:",
"- res.append(i)",
... | false | 0.037875 | 0.034448 | 1.099489 | [
"s593313057",
"s304498964"
] |
u795245552 | p02911 | python | s006350857 | s949730581 | 312 | 286 | 19,104 | 11,816 | Accepted | Accepted | 8.33 | n, k, q = [int(x) for x in input().split()]
a = []
for i in range(q):
a.append(int(eval(input())))
a_dict = dict((x, 0) for x in range(1, n + 1))
for i in range(q):
a_dict[a[i]] += 1
for i in range(n):
tmp = k - (q - a_dict[i + 1])
if tmp > 0:
ans = 'Yes'
else:
ans = ... | n, k, q = [int(x) for x in input().split()]
a = []
for i in range(q):
a.append(int(eval(input())))
n_list = [k - q for i in range(n)]
for i in range(q):
n_list[a[i] - 1] += 1
for i in range(n):
if n_list[i] > 0:
ans = 'Yes'
else:
ans = 'No'
print(ans) | 16 | 16 | 334 | 299 | n, k, q = [int(x) for x in input().split()]
a = []
for i in range(q):
a.append(int(eval(input())))
a_dict = dict((x, 0) for x in range(1, n + 1))
for i in range(q):
a_dict[a[i]] += 1
for i in range(n):
tmp = k - (q - a_dict[i + 1])
if tmp > 0:
ans = "Yes"
else:
ans = "No"
print(a... | n, k, q = [int(x) for x in input().split()]
a = []
for i in range(q):
a.append(int(eval(input())))
n_list = [k - q for i in range(n)]
for i in range(q):
n_list[a[i] - 1] += 1
for i in range(n):
if n_list[i] > 0:
ans = "Yes"
else:
ans = "No"
print(ans)
| false | 0 | [
"-a_dict = dict((x, 0) for x in range(1, n + 1))",
"+n_list = [k - q for i in range(n)]",
"- a_dict[a[i]] += 1",
"+ n_list[a[i] - 1] += 1",
"- tmp = k - (q - a_dict[i + 1])",
"- if tmp > 0:",
"+ if n_list[i] > 0:"
] | false | 0.131066 | 0.042855 | 3.058329 | [
"s006350857",
"s949730581"
] |
u891218252 | p03478 | python | s186745626 | s692040585 | 208 | 178 | 41,580 | 39,408 | Accepted | Accepted | 14.42 | N, A, B = list(map(int, input().split()))
ok_nums = []
ok_nums_append = ok_nums.append
for i in range(N+1):
i_s = str(i)
if A <= sum(list(map(int, list(i_s)))) <= B:
ok_nums_append(i)
print((sum(ok_nums)))
| N, A, B = list(map(int, input().split()))
# 各桁の和を計算する関数
def find_sum_of_digits(n):
sum_num = 0
while (n>0):
sum_num += n % 10
n = n // 10
return sum_num
total = 0
for i in range(N+1):
sum_num = find_sum_of_digits(i)
if A <= sum_num <= B:
total += i
print(tota... | 12 | 16 | 235 | 322 | N, A, B = list(map(int, input().split()))
ok_nums = []
ok_nums_append = ok_nums.append
for i in range(N + 1):
i_s = str(i)
if A <= sum(list(map(int, list(i_s)))) <= B:
ok_nums_append(i)
print((sum(ok_nums)))
| N, A, B = list(map(int, input().split()))
# 各桁の和を計算する関数
def find_sum_of_digits(n):
sum_num = 0
while n > 0:
sum_num += n % 10
n = n // 10
return sum_num
total = 0
for i in range(N + 1):
sum_num = find_sum_of_digits(i)
if A <= sum_num <= B:
total += i
print(total)
| false | 25 | [
"-ok_nums = []",
"-ok_nums_append = ok_nums.append",
"+# 各桁の和を計算する関数",
"+def find_sum_of_digits(n):",
"+ sum_num = 0",
"+ while n > 0:",
"+ sum_num += n % 10",
"+ n = n // 10",
"+ return sum_num",
"+",
"+",
"+total = 0",
"- i_s = str(i)",
"- if A <= sum(list(ma... | false | 0.048617 | 0.043816 | 1.109577 | [
"s186745626",
"s692040585"
] |
u761320129 | p03305 | python | s216072710 | s160545487 | 1,349 | 976 | 87,208 | 81,744 | Accepted | Accepted | 27.65 | N,M,S,T = map(int,input().split())
S,T = S-1,T-1
UVAB = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for u,v,a,b in UVAB:
u,v = u-1,v-1
es[u].append((v,a,b))
es[v].append((u,a,b))
import heapq
INF = float('inf')
cy = [INF] * N
cy[S] = 0
hq = [(0,S)]
heapq.he... | import sys
input = sys.stdin.readline
N,M,S,T = map(int,input().split())
S,T = S-1,T-1
UVAB = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for u,v,a,b in UVAB:
u,v = u-1,v-1
es[u].append((v,a,b))
es[v].append((u,a,b))
import heapq
INF = float('inf')
costy =... | 38 | 39 | 878 | 883 | N, M, S, T = map(int, input().split())
S, T = S - 1, T - 1
UVAB = [tuple(map(int, input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for u, v, a, b in UVAB:
u, v = u - 1, v - 1
es[u].append((v, a, b))
es[v].append((u, a, b))
import heapq
INF = float("inf")
cy = [INF] * N
cy[S] = 0
hq = [(0, S... | import sys
input = sys.stdin.readline
N, M, S, T = map(int, input().split())
S, T = S - 1, T - 1
UVAB = [tuple(map(int, input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for u, v, a, b in UVAB:
u, v = u - 1, v - 1
es[u].append((v, a, b))
es[v].append((u, a, b))
import heapq
INF = float("inf... | false | 2.564103 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-cy = [INF] * N",
"-cy[S] = 0",
"+costy = [INF] * N",
"+costy[S] = 0",
"-heapq.heapify(hq)",
"- if c + a >= cy[to]:",
"+ if costy[to] <= c + a:",
"- cy[to] = c + a",
"+ costy[to] = c + a",
"-cs = [INF] * N",
"-... | false | 0.077051 | 0.179905 | 0.42829 | [
"s216072710",
"s160545487"
] |
u970197315 | p03721 | python | s003890793 | s953369693 | 608 | 482 | 29,808 | 27,112 | Accepted | Accepted | 20.72 | # ABC061 C - Big Array
from operator import itemgetter
N,K = list(map(int,input().split()))
A = []
B = []
AB = [[] for _ in range(N)]
for i in range(N):
a,b = list(map(int,input().split()))
AB[i].append(a)
AB[i].append(b)
AB.sort(key=itemgetter(0, 1))
ans = 0
if len(AB) == 1:
ans = AB... | n,k=list(map(int,input().split()))
ab=[]
for i in range(n):
aa,bb=list(map(int,input().split()))
ab.append([aa,bb])
ab.sort(key=lambda x: x[0])
a,b=[],[]
for aa,bb in ab:
a.append(aa)
b.append(bb)
from itertools import accumulate
c=list(accumulate(b))
idx=-1
for i in range(n):
if i==0:
if 0... | 40 | 23 | 736 | 417 | # ABC061 C - Big Array
from operator import itemgetter
N, K = list(map(int, input().split()))
A = []
B = []
AB = [[] for _ in range(N)]
for i in range(N):
a, b = list(map(int, input().split()))
AB[i].append(a)
AB[i].append(b)
AB.sort(key=itemgetter(0, 1))
ans = 0
if len(AB) == 1:
ans = AB[0][0]
pri... | n, k = list(map(int, input().split()))
ab = []
for i in range(n):
aa, bb = list(map(int, input().split()))
ab.append([aa, bb])
ab.sort(key=lambda x: x[0])
a, b = [], []
for aa, bb in ab:
a.append(aa)
b.append(bb)
from itertools import accumulate
c = list(accumulate(b))
idx = -1
for i in range(n):
i... | false | 42.5 | [
"-# ABC061 C - Big Array",
"-from operator import itemgetter",
"+n, k = list(map(int, input().split()))",
"+ab = []",
"+for i in range(n):",
"+ aa, bb = list(map(int, input().split()))",
"+ ab.append([aa, bb])",
"+ab.sort(key=lambda x: x[0])",
"+a, b = [], []",
"+for aa, bb in ab:",
"+ ... | false | 0.042121 | 0.037182 | 1.132853 | [
"s003890793",
"s953369693"
] |
u406138190 | p02787 | python | s959372752 | s667235262 | 788 | 143 | 299,244 | 74,772 | Accepted | Accepted | 81.85 | h,n=list(map(int,input().split()))
a=[0]
b=[0]
width=2*10**4+7
dp=[[10**10 for i in range(width)] for j in range(n+1)]
dp[0][0]=0
dp[1][0]=0
for i in range(n):
x,y=list(map(int,input().split()))
a.append(x)
b.append(y)
for i in range(1,n+1):
for j in range(width):
dp[i][j]=min(dp[i]... | h,n=list(map(int,input().split()))
dp=[10**10 for i in range(h+1)]
dp[0]=0
for i in range(n):
x,y=list(map(int,input().split()))
for j in range(h+1):
nj=min(h,j+x)
dp[nj]=min(dp[nj],dp[j]+y)
print((dp[h])) | 17 | 9 | 433 | 223 | h, n = list(map(int, input().split()))
a = [0]
b = [0]
width = 2 * 10**4 + 7
dp = [[10**10 for i in range(width)] for j in range(n + 1)]
dp[0][0] = 0
dp[1][0] = 0
for i in range(n):
x, y = list(map(int, input().split()))
a.append(x)
b.append(y)
for i in range(1, n + 1):
for j in range(width):
dp... | h, n = list(map(int, input().split()))
dp = [10**10 for i in range(h + 1)]
dp[0] = 0
for i in range(n):
x, y = list(map(int, input().split()))
for j in range(h + 1):
nj = min(h, j + x)
dp[nj] = min(dp[nj], dp[j] + y)
print((dp[h]))
| false | 47.058824 | [
"-a = [0]",
"-b = [0]",
"-width = 2 * 10**4 + 7",
"-dp = [[10**10 for i in range(width)] for j in range(n + 1)]",
"-dp[0][0] = 0",
"-dp[1][0] = 0",
"+dp = [10**10 for i in range(h + 1)]",
"+dp[0] = 0",
"- a.append(x)",
"- b.append(y)",
"-for i in range(1, n + 1):",
"- for j in range(w... | false | 0.245432 | 0.072928 | 3.365397 | [
"s959372752",
"s667235262"
] |
u111365362 | p03111 | python | s747348196 | s221321828 | 418 | 240 | 18,020 | 45,916 | Accepted | Accepted | 42.58 | #18:51
n,A,B,C = list(map(int,input().split()))
D = [A,B,C]
l = []
for _ in range(n):
l.append(int(eval(input())))
l.sort(reverse=True)
def nex(time):
for i in range(n-1,-1,-1):
if time[i] < 3:
time[i] += 1
break
else:
time[i] = 0
else:
time = 'over'
return time
#p... | n,A,B,C = list(map(int,input().split()))
D = [A,B,C]
def nex(time):
for i in range(n):
if time[i] < 3:
time[i] += 1
break
else:
time[i] = 0
else:
time = 'over'
return time
boo = []
for _ in range(n):
boo.append(int(eval(input())))
can = []
time = [0 for _ in range(n... | 35 | 31 | 737 | 607 | # 18:51
n, A, B, C = list(map(int, input().split()))
D = [A, B, C]
l = []
for _ in range(n):
l.append(int(eval(input())))
l.sort(reverse=True)
def nex(time):
for i in range(n - 1, -1, -1):
if time[i] < 3:
time[i] += 1
break
else:
time[i] = 0
else:
... | n, A, B, C = list(map(int, input().split()))
D = [A, B, C]
def nex(time):
for i in range(n):
if time[i] < 3:
time[i] += 1
break
else:
time[i] = 0
else:
time = "over"
return time
boo = []
for _ in range(n):
boo.append(int(eval(input())))
can... | false | 11.428571 | [
"-# 18:51",
"-l = []",
"-for _ in range(n):",
"- l.append(int(eval(input())))",
"-l.sort(reverse=True)",
"- for i in range(n - 1, -1, -1):",
"+ for i in range(n):",
"-# print(nex([0,0,0,0]),nex([0,3,3,3]),nex([3,3,3,3]))",
"+boo = []",
"+for _ in range(n):",
"+ boo.append(int(eval(in... | false | 0.406028 | 0.319548 | 1.270631 | [
"s747348196",
"s221321828"
] |
u796942881 | p03208 | python | s315149626 | s756637245 | 112 | 85 | 14,092 | 14,092 | Accepted | Accepted | 24.11 | INF = 1000000007
input = open(0).read
N, K, *h = list(map(int, input().split()))
def main():
h.sort()
ans = INF
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
return
main()
| def main():
N, K, *h = list(map(int, open(0).read().split()))
h.sort()
print((min(j - i for i, j in zip(h, h[K - 1:]))))
return
main()
| 21 | 8 | 252 | 152 | INF = 1000000007
input = open(0).read
N, K, *h = list(map(int, input().split()))
def main():
h.sort()
ans = INF
for i in range(N - K + 1):
ans = min(ans, h[i + K - 1] - h[i])
print(ans)
return
main()
| def main():
N, K, *h = list(map(int, open(0).read().split()))
h.sort()
print((min(j - i for i, j in zip(h, h[K - 1 :]))))
return
main()
| false | 61.904762 | [
"-INF = 1000000007",
"-input = open(0).read",
"-N, K, *h = list(map(int, input().split()))",
"-",
"-",
"+ N, K, *h = list(map(int, open(0).read().split()))",
"- ans = INF",
"- for i in range(N - K + 1):",
"- ans = min(ans, h[i + K - 1] - h[i])",
"- print(ans)",
"+ print((mi... | false | 0.043928 | 0.04407 | 0.996761 | [
"s315149626",
"s756637245"
] |
u149551680 | p02658 | python | s309906215 | s758511830 | 102 | 89 | 21,772 | 21,528 | Accepted | Accepted | 12.75 | N = int(eval(input()))
A = list(map(int, input().split()))
limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
result *= a
if result > limit:
print((-1))
exit()
print(result) | N = int(eval(input()))
A = list(map(int, input().strip().split()))
limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
result *= a
if result > limit:
print((-1))
exit()
print(result) | 12 | 12 | 206 | 214 | N = int(eval(input()))
A = list(map(int, input().split()))
limit = 10**18
A.sort()
result = A[0]
for a in A[1:]:
result *= a
if result > limit:
print((-1))
exit()
print(result)
| N = int(eval(input()))
A = list(map(int, input().strip().split()))
limit = 10**18
A.sort()
result = A[0]
for a in A[1:]:
result *= a
if result > limit:
print((-1))
exit()
print(result)
| false | 0 | [
"-A = list(map(int, input().split()))",
"+A = list(map(int, input().strip().split()))"
] | false | 0.037724 | 0.058681 | 0.64286 | [
"s309906215",
"s758511830"
] |
u268793453 | p03142 | python | s977330494 | s722659341 | 994 | 883 | 135,448 | 85,480 | Accepted | Accepted | 11.17 | from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
n, m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n + m - 1)]
T = [[] for i in range(n+1)]
RT = [[] for i in range(n+1)]
IN = [0] * (n+1)
for a, b in A:
T[a].append(b)
RT[b].append(a)
IN... | from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
from collections import deque
n, m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n + m - 1)]
T = [[] for i in range(n+1)]
RT = [[] for i in range(n+1)]
IN = [0] * (n+1)
for a, b in A:
T[a].append(... | 37 | 38 | 694 | 734 | from sys import setrecursionlimit
setrecursionlimit(10**9)
n, m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n + m - 1)]
T = [[] for i in range(n + 1)]
RT = [[] for i in range(n + 1)]
IN = [0] * (n + 1)
for a, b in A:
T[a].append(b)
RT[b].append(a)
IN[b] += 1
P ... | from sys import setrecursionlimit
setrecursionlimit(10**9)
from collections import deque
n, m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n + m - 1)]
T = [[] for i in range(n + 1)]
RT = [[] for i in range(n + 1)]
IN = [0] * (n + 1)
for a, b in A:
T[a].append(b)
RT... | false | 2.631579 | [
"+from collections import deque",
"+",
"-used = [0] * (n + 1)",
"-def dfs(p, i):",
"- if used[i]:",
"- return None",
"- P[i] = p",
"- used[i] = True",
"- for t in T[i]:",
"- IN[t] -= 1",
"- for t in T[i]:",
"- if IN[t] == 0:",
"- dfs(i, t)",
"... | false | 0.044065 | 0.043831 | 1.005349 | [
"s977330494",
"s722659341"
] |
u923279197 | p02882 | python | s166691608 | s527922962 | 174 | 19 | 38,256 | 3,060 | Accepted | Accepted | 89.08 | from math import tan,pi,radians
a,b,x = list(map(int,input().split()))
ok = 0
ng = 90
if 2*x >= a**2*b:
while ng-ok > 10**(-7):
mid = (ok+ng)/2
if a*a*b-a**3*tan(radians(mid))/2 >=x:
ok = mid
else:
ng = mid
else:
while ng-ok > 10**(-7):
mid = ... | from math import atan,pi
a, b, x = list(map(int, input().split()))
if a**2*b < 2 * x:
print((180 * atan(2 * (a ** 2 * b - x) / (a ** 3)) / pi))
else:
print((180 * atan(a * b ** 2 / (2 * x)) / pi))
| 20 | 7 | 439 | 202 | from math import tan, pi, radians
a, b, x = list(map(int, input().split()))
ok = 0
ng = 90
if 2 * x >= a**2 * b:
while ng - ok > 10 ** (-7):
mid = (ok + ng) / 2
if a * a * b - a**3 * tan(radians(mid)) / 2 >= x:
ok = mid
else:
ng = mid
else:
while ng - ok > 10 ** ... | from math import atan, pi
a, b, x = list(map(int, input().split()))
if a**2 * b < 2 * x:
print((180 * atan(2 * (a**2 * b - x) / (a**3)) / pi))
else:
print((180 * atan(a * b**2 / (2 * x)) / pi))
| false | 65 | [
"-from math import tan, pi, radians",
"+from math import atan, pi",
"-ok = 0",
"-ng = 90",
"-if 2 * x >= a**2 * b:",
"- while ng - ok > 10 ** (-7):",
"- mid = (ok + ng) / 2",
"- if a * a * b - a**3 * tan(radians(mid)) / 2 >= x:",
"- ok = mid",
"- else:",
"- ... | false | 0.042848 | 0.042698 | 1.003518 | [
"s166691608",
"s527922962"
] |
u440180827 | p02408 | python | s923490574 | s364392215 | 30 | 10 | 7,744 | 7,648 | Accepted | Accepted | 66.67 | cards = [[0 for i in range(13)] for j in range(4)]
s2n = {'S': 0, 'H': 1, 'C': 2, 'D': 3}
n2s = 'SHCD'
n = int(eval(input()))
for i in range(n):
card = list(input().split())
card[1] = int(card[1])
if card[0] == 'S':
suit = 0
elif card[0] == 'H':
suit = 1
elif card[0] == ... | cards = [[0 for i in range(13)] for j in range(4)]
s2n = {'S': 0, 'H': 1, 'C': 2, 'D': 3}
n2s = 'SHCD'
n = int(eval(input()))
for i in range(n):
card = list(input().split())
card[1] = int(card[1])
cards[s2n[card[0]]][card[1]-1] = 1
for i in range(4):
for j in range(13):
if not(cards[i... | 20 | 12 | 522 | 352 | cards = [[0 for i in range(13)] for j in range(4)]
s2n = {"S": 0, "H": 1, "C": 2, "D": 3}
n2s = "SHCD"
n = int(eval(input()))
for i in range(n):
card = list(input().split())
card[1] = int(card[1])
if card[0] == "S":
suit = 0
elif card[0] == "H":
suit = 1
elif card[0] == "C":
... | cards = [[0 for i in range(13)] for j in range(4)]
s2n = {"S": 0, "H": 1, "C": 2, "D": 3}
n2s = "SHCD"
n = int(eval(input()))
for i in range(n):
card = list(input().split())
card[1] = int(card[1])
cards[s2n[card[0]]][card[1] - 1] = 1
for i in range(4):
for j in range(13):
if not (cards[i][j]):
... | false | 40 | [
"- if card[0] == \"S\":",
"- suit = 0",
"- elif card[0] == \"H\":",
"- suit = 1",
"- elif card[0] == \"C\":",
"- suit = 2",
"- elif card[0] == \"D\":",
"- suit = 3",
"- cards[suit][card[1] - 1] = 1",
"+ cards[s2n[card[0]]][card[1] - 1] = 1"
] | false | 0.045319 | 0.03758 | 1.205926 | [
"s923490574",
"s364392215"
] |
u115110170 | p03078 | python | s587445266 | s897526615 | 670 | 37 | 8,780 | 5,000 | Accepted | Accepted | 94.48 | x,y,z,k = list(map(int,input().split()))
a = sorted(list(map(int,input().split())),reverse=True)
b = sorted(list(map(int,input().split())),reverse=True)
c = sorted(list(map(int,input().split())),reverse=True)
r = []
for i in range(x):
for j in range(y):
for h in range(z):
if (i+1)*(j+1)*(h+1) > k:... | X, Y, Z, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
A = sorted(A)
B = sorted(B)
C = sorted(C)
maxn = A[0] * B[0] * C[0]
from heapq import *
h = []
heappush(h, (-A[-1] - B[-1] - C[-1], len(A... | 15 | 31 | 431 | 710 | x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)
r = []
for i in range(x):
for j in range(y):
for h in range(z):
if (i + 1) * ... | X, Y, Z, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
A = sorted(A)
B = sorted(B)
C = sorted(C)
maxn = A[0] * B[0] * C[0]
from heapq import *
h = []
heappush(h, (-A[-1] - B[-1] - C[-1], len(A) - 1, len(B) - 1, le... | false | 51.612903 | [
"-x, y, z, k = list(map(int, input().split()))",
"-a = sorted(list(map(int, input().split())), reverse=True)",
"-b = sorted(list(map(int, input().split())), reverse=True)",
"-c = sorted(list(map(int, input().split())), reverse=True)",
"-r = []",
"-for i in range(x):",
"- for j in range(y):",
"- ... | false | 0.037439 | 0.035965 | 1.040981 | [
"s587445266",
"s897526615"
] |
u138486156 | p03779 | python | s442299634 | s446838784 | 35 | 19 | 5,780 | 2,940 | Accepted | Accepted | 45.71 | import bisect
from math import sqrt
x = int(eval(input()))
a = [1]
s = 1
for i in range(2, 2*int(sqrt(x))):
s += i
a.append(s)
if x in a:
print((a.index(x) + 1))
exit()
print((bisect.bisect_right(a, x)+1))
| from math import sqrt
x = int(eval(input()))
t = (-1+sqrt(8*x+1))/2
a = int(t)
if a == t:
print(a)
else:
print((a+1))
| 15 | 11 | 229 | 131 | import bisect
from math import sqrt
x = int(eval(input()))
a = [1]
s = 1
for i in range(2, 2 * int(sqrt(x))):
s += i
a.append(s)
if x in a:
print((a.index(x) + 1))
exit()
print((bisect.bisect_right(a, x) + 1))
| from math import sqrt
x = int(eval(input()))
t = (-1 + sqrt(8 * x + 1)) / 2
a = int(t)
if a == t:
print(a)
else:
print((a + 1))
| false | 26.666667 | [
"-import bisect",
"-a = [1]",
"-s = 1",
"-for i in range(2, 2 * int(sqrt(x))):",
"- s += i",
"- a.append(s)",
"-if x in a:",
"- print((a.index(x) + 1))",
"- exit()",
"-print((bisect.bisect_right(a, x) + 1))",
"+t = (-1 + sqrt(8 * x + 1)) / 2",
"+a = int(t)",
"+if a == t:",
"+ ... | false | 0.076303 | 0.074693 | 1.021548 | [
"s442299634",
"s446838784"
] |
u858742833 | p02763 | python | s810467357 | s595059569 | 861 | 743 | 77,256 | 48,348 | Accepted | Accepted | 13.7 | def segfunc(x,y):
return x | y
def init(init_val):
#set_val
for i in range(n):
seg[i+num-1]=init_val[i]
#built
for i in range(num-2,-1,-1) :
seg[i]=segfunc(seg[2*i+1],seg[2*i+2])
def update(k,x):
k += num-1
seg[k] = x
while k:
k = (k-1)//... | class SegTree:
def __init__(self, a, func):
self.n = 2**(len(a) - 1).bit_length()
self.f = func
self.d = [0] * (2 * self.n - 1)
self.d[self.n - 1:self.n - 1 + len(a)] = a
for i in reversed(list(range(self.n - 1))):
self.d[i] = self.f(self.d[2 * i + 1], self... | 58 | 46 | 1,262 | 1,288 | def segfunc(x, y):
return x | y
def init(init_val):
# set_val
for i in range(n):
seg[i + num - 1] = init_val[i]
# built
for i in range(num - 2, -1, -1):
seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])
def update(k, x):
k += num - 1
seg[k] = x
while k:
k = (k ... | class SegTree:
def __init__(self, a, func):
self.n = 2 ** (len(a) - 1).bit_length()
self.f = func
self.d = [0] * (2 * self.n - 1)
self.d[self.n - 1 : self.n - 1 + len(a)] = a
for i in reversed(list(range(self.n - 1))):
self.d[i] = self.f(self.d[2 * i + 1], self.d[... | false | 20.689655 | [
"-def segfunc(x, y):",
"- return x | y",
"+class SegTree:",
"+ def __init__(self, a, func):",
"+ self.n = 2 ** (len(a) - 1).bit_length()",
"+ self.f = func",
"+ self.d = [0] * (2 * self.n - 1)",
"+ self.d[self.n - 1 : self.n - 1 + len(a)] = a",
"+ for i in re... | false | 0.082449 | 0.045597 | 1.808195 | [
"s810467357",
"s595059569"
] |
u693953100 | p02988 | python | s275542541 | s158940592 | 20 | 18 | 3,316 | 3,060 | Accepted | Accepted | 10 | n = int(eval(input()))
l = list(map(int,input().split()))
cnt =0
for i in range(1,n-1):
if l[i-1]<l[i]<l[i+1] or l[i-1]>l[i]>l[i+1]:
cnt+=1
print(cnt) | def solve():
n = int(eval(input()))
p = list(map(int,input().split()))
cnt = 0
for i in range(1,n-1):
if p[i-1]<p[i]<p[i+1] or p[i-1]>p[i]>p[i+1]:
cnt+=1
print(cnt)
if __name__=='__main__':
solve() | 7 | 10 | 162 | 244 | n = int(eval(input()))
l = list(map(int, input().split()))
cnt = 0
for i in range(1, n - 1):
if l[i - 1] < l[i] < l[i + 1] or l[i - 1] > l[i] > l[i + 1]:
cnt += 1
print(cnt)
| def solve():
n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n - 1):
if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]:
cnt += 1
print(cnt)
if __name__ == "__main__":
solve()
| false | 30 | [
"-n = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-cnt = 0",
"-for i in range(1, n - 1):",
"- if l[i - 1] < l[i] < l[i + 1] or l[i - 1] > l[i] > l[i + 1]:",
"- cnt += 1",
"-print(cnt)",
"+def solve():",
"+ n = int(eval(input()))",
"+ p = list(map(int, input().spli... | false | 0.048634 | 0.04826 | 1.007758 | [
"s275542541",
"s158940592"
] |
u995102075 | p03086 | python | s309847208 | s274829455 | 22 | 19 | 3,188 | 3,188 | Accepted | Accepted | 13.64 | import re
S = eval(input())
pattern = "[ATGC]*"
matched_list = sorted(re.findall(pattern, S),
key=lambda s: len(s),
reverse=True)
print((len(matched_list[0])))
| import re
S = eval(input())
pattern = "[ATGC]*"
matched_list = sorted(re.findall(pattern, S), key=len, reverse=True)
print((len(matched_list[0])))
| 9 | 7 | 206 | 147 | import re
S = eval(input())
pattern = "[ATGC]*"
matched_list = sorted(re.findall(pattern, S), key=lambda s: len(s), reverse=True)
print((len(matched_list[0])))
| import re
S = eval(input())
pattern = "[ATGC]*"
matched_list = sorted(re.findall(pattern, S), key=len, reverse=True)
print((len(matched_list[0])))
| false | 22.222222 | [
"-matched_list = sorted(re.findall(pattern, S), key=lambda s: len(s), reverse=True)",
"+matched_list = sorted(re.findall(pattern, S), key=len, reverse=True)"
] | false | 0.050701 | 0.050449 | 1.004988 | [
"s309847208",
"s274829455"
] |
u645855527 | p03665 | python | s665883091 | s144999907 | 169 | 72 | 38,256 | 66,564 | Accepted | Accepted | 57.4 | from collections import Counter
def modinv(a, mod=10**9+7):
return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
"""
nCr mod m
"""
if n < r:
return 0
r = min(r, n-r)
res = 1
for i in range(r):
res = res * (n - i) * modinv(i+1, mod) % mod
... | import math
def combination(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = 0
even = 0
for a in A:
if a % 2 == 0:
even += 1
else:
odd += 1
ans = 0
for i in... | 40 | 24 | 757 | 453 | from collections import Counter
def modinv(a, mod=10**9 + 7):
return pow(a, mod - 2, mod)
def combination(n, r, mod=10**9 + 7):
"""
nCr mod m
"""
if n < r:
return 0
r = min(r, n - r)
res = 1
for i in range(r):
res = res * (n - i) * modinv(i + 1, mod) % mod
return ... | import math
def combination(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = 0
even = 0
for a in A:
if a % 2 == 0:
even += 1
else:
odd += 1
ans = 0
for i in range(P, odd + 1, 2)... | false | 40 | [
"-from collections import Counter",
"+import math",
"-def modinv(a, mod=10**9 + 7):",
"- return pow(a, mod - 2, mod)",
"+def combination(n, r):",
"+ return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-def combination(n, r, mod=10**9 + 7):",
"- \"\"\"",
"- nCr mod ... | false | 0.043403 | 0.037129 | 1.168966 | [
"s665883091",
"s144999907"
] |
u525065967 | p02683 | python | s632222347 | s351997873 | 88 | 63 | 9,232 | 9,200 | Accepted | Accepted | 28.41 | n,m,x = list(map(int, input().split()))
books = [[*list(map(int, input().split()))] for _ in range(n)]
ans = inf = 10**18
for bit in range(1<<n): # [0,(2^N)-1] full search
cost = 0
skill = [0]*m
for book in range(n): # [0,N-1] book no.
if(bit>>book & 1): # buy
cost += books[book... | n,m,x = list(map(int, input().split()))
books = [[*list(map(int, input().split()))] for _ in range(n)]
ans = inf = 10**18
for bit in range(1<<n): # [0,(2^N)-1] combination full search
cost = 0
skill = [0]*m
for book in range(n): # [0,N-1] book no.
if(bit>>book & 1): # buy
cost +... | 13 | 13 | 469 | 523 | n, m, x = list(map(int, input().split()))
books = [[*list(map(int, input().split()))] for _ in range(n)]
ans = inf = 10**18
for bit in range(1 << n): # [0,(2^N)-1] full search
cost = 0
skill = [0] * m
for book in range(n): # [0,N-1] book no.
if bit >> book & 1: # buy
cost += books[bo... | n, m, x = list(map(int, input().split()))
books = [[*list(map(int, input().split()))] for _ in range(n)]
ans = inf = 10**18
for bit in range(1 << n): # [0,(2^N)-1] combination full search
cost = 0
skill = [0] * m
for book in range(n): # [0,N-1] book no.
if bit >> book & 1: # buy
cost... | false | 0 | [
"-for bit in range(1 << n): # [0,(2^N)-1] full search",
"+for bit in range(1 << n): # [0,(2^N)-1] combination full search",
"- cost += books[book][0]",
"- for j in range(m):",
"- skill[j] += books[book][j + 1] # skill get",
"+ cost += books[book][0] # ... | false | 0.043426 | 0.046093 | 0.94214 | [
"s632222347",
"s351997873"
] |
u873139556 | p03240 | python | s082269736 | s950031005 | 634 | 45 | 3,316 | 3,064 | Accepted | Accepted | 92.9 | from collections import Counter
n = int(eval(input()))
xyh = []
for i in range(n):
xyh.append(list(map(int, input().split())))
for i in range(n): # 高さが0でない情報を探す
if xyh[i][2] != 0:
xyh_1 = xyh[i]
break
for cx in range(101): #Cx 0~100
for cy in range(101): #Cy 0~100
... | n = int(eval(input()))
xyh = []
for i in range(n):
xyh.append(list(map(int, input().split())))
#高さが0でない情報を探す
for i in range(n):
if xyh[i][2] != 0:
x_ex, y_ex, h_ex = xyh[i]
break
for cx in range(101): #Cx 0~100
for cy in range(101): #Cy 0~100
h = abs(x_ex - cx) + abs... | 25 | 27 | 622 | 649 | from collections import Counter
n = int(eval(input()))
xyh = []
for i in range(n):
xyh.append(list(map(int, input().split())))
for i in range(n): # 高さが0でない情報を探す
if xyh[i][2] != 0:
xyh_1 = xyh[i]
break
for cx in range(101): # Cx 0~100
for cy in range(101): # Cy 0~100
h = abs(xyh_1... | n = int(eval(input()))
xyh = []
for i in range(n):
xyh.append(list(map(int, input().split())))
# 高さが0でない情報を探す
for i in range(n):
if xyh[i][2] != 0:
x_ex, y_ex, h_ex = xyh[i]
break
for cx in range(101): # Cx 0~100
for cy in range(101): # Cy 0~100
h = abs(x_ex - cx) + abs(y_ex - cy) ... | false | 7.407407 | [
"-from collections import Counter",
"-",
"-for i in range(n): # 高さが0でない情報を探す",
"+# 高さが0でない情報を探す",
"+for i in range(n):",
"- xyh_1 = xyh[i]",
"+ x_ex, y_ex, h_ex = xyh[i]",
"- h = abs(xyh_1[0] - cx) + abs(xyh_1[1] - cy) + xyh_1[2] # 高さHを求める",
"+ h = abs(x_ex - cx) + abs(... | false | 0.171763 | 0.073588 | 2.334102 | [
"s082269736",
"s950031005"
] |
u606045429 | p02662 | python | s760550639 | s301055992 | 174 | 144 | 132,424 | 72,036 | Accepted | Accepted | 17.24 | mod = 998244353
N, S, *A = list(map(int, open(0).read().split()))
dp = [[0] * (S + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i, a in enumerate(A, 1):
for j in range(S + 1):
dp[i][j] = (2 * dp[i - 1][j] + (dp[i - 1][j - a] if j >= a else 0)) % mod
print((dp[N][S])) | mod = 998244353
N, S, *A = list(map(int, open(0).read().split()))
dp = [1] + [0] * S
for i, a in enumerate(A, 1):
dp = [(2 * dp[j] + (dp[j - a] if j >= a else 0)) % mod for j in range(S + 1)]
print((dp[S])) | 12 | 9 | 284 | 213 | mod = 998244353
N, S, *A = list(map(int, open(0).read().split()))
dp = [[0] * (S + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i, a in enumerate(A, 1):
for j in range(S + 1):
dp[i][j] = (2 * dp[i - 1][j] + (dp[i - 1][j - a] if j >= a else 0)) % mod
print((dp[N][S]))
| mod = 998244353
N, S, *A = list(map(int, open(0).read().split()))
dp = [1] + [0] * S
for i, a in enumerate(A, 1):
dp = [(2 * dp[j] + (dp[j - a] if j >= a else 0)) % mod for j in range(S + 1)]
print((dp[S]))
| false | 25 | [
"-dp = [[0] * (S + 1) for _ in range(N + 1)]",
"-dp[0][0] = 1",
"+dp = [1] + [0] * S",
"- for j in range(S + 1):",
"- dp[i][j] = (2 * dp[i - 1][j] + (dp[i - 1][j - a] if j >= a else 0)) % mod",
"-print((dp[N][S]))",
"+ dp = [(2 * dp[j] + (dp[j - a] if j >= a else 0)) % mod for j in range(S ... | false | 0.036852 | 0.119437 | 0.308549 | [
"s760550639",
"s301055992"
] |
u633068244 | p00894 | python | s439892260 | s761074082 | 60 | 50 | 4,296 | 4,296 | Accepted | Accepted | 16.67 | while 1:
n = int(input())
if n == 0: break
exist = set([])
time = [0]*1000
bless = [0]*1000
for loop in range(n):
md,hm,io,p = input().split()
h,m = list(map(int,hm.split(":")))
t = 60*h+m
p = int(p)
if io == "I":
time[p] = t
... | while 1:
n = int(input())
if n == 0: break
exist = set([])
enter = [0]*1000
bless = [0]*1000
for loop in range(n):
md,hm,io,p = input().split()
h,m = list(map(int,hm.split(":")))
t = 60*h+m
p = int(p)
if io == "I":
enter[p] = t
... | 22 | 22 | 588 | 594 | while 1:
n = int(input())
if n == 0:
break
exist = set([])
time = [0] * 1000
bless = [0] * 1000
for loop in range(n):
md, hm, io, p = input().split()
h, m = list(map(int, hm.split(":")))
t = 60 * h + m
p = int(p)
if io == "I":
time[p] =... | while 1:
n = int(input())
if n == 0:
break
exist = set([])
enter = [0] * 1000
bless = [0] * 1000
for loop in range(n):
md, hm, io, p = input().split()
h, m = list(map(int, hm.split(":")))
t = 60 * h + m
p = int(p)
if io == "I":
enter[p]... | false | 0 | [
"- time = [0] * 1000",
"+ enter = [0] * 1000",
"- time[p] = t",
"+ enter[p] = t",
"- bless[i] += t - max(time[p], time[i])",
"+ bless[i] += t - max(enter[p], enter[i])",
"- bless[p] += t - max(time[0], time[p])",
"+ ... | false | 0.050152 | 0.050743 | 0.98835 | [
"s439892260",
"s761074082"
] |
u046187684 | p03476 | python | s125303514 | s315817096 | 898 | 744 | 17,996 | 36,920 | Accepted | Accepted | 17.15 | #!/usr/bin/env python3
# coding=utf-8
import sys
import numpy as np
num_max = 100000
primes = np.asarray([True for _ in range(num_max + 1)])
for i in range(num_max + 1):
if i == 0 or i == 1:
primes[i] = False
elif primes[i]:
primes[i * 2::i] = False
primes = set(np.arange(num_ma... | import numpy as np
def solve(string):
num_max = 100000
primes = np.asarray([True for _ in range(num_max + 1)])
for i in range(num_max + 1):
if i == 0 or i == 1:
primes[i] = False
elif primes[i]:
primes[i * 2::i] = False
primes = set(np.arange(num_max ... | 24 | 22 | 642 | 728 | #!/usr/bin/env python3
# coding=utf-8
import sys
import numpy as np
num_max = 100000
primes = np.asarray([True for _ in range(num_max + 1)])
for i in range(num_max + 1):
if i == 0 or i == 1:
primes[i] = False
elif primes[i]:
primes[i * 2 :: i] = False
primes = set(np.arange(num_max + 1)[primes]... | import numpy as np
def solve(string):
num_max = 100000
primes = np.asarray([True for _ in range(num_max + 1)])
for i in range(num_max + 1):
if i == 0 or i == 1:
primes[i] = False
elif primes[i]:
primes[i * 2 :: i] = False
primes = set(np.arange(num_max + 1)[prim... | false | 8.333333 | [
"-#!/usr/bin/env python3",
"-# coding=utf-8",
"-import sys",
"-num_max = 100000",
"-primes = np.asarray([True for _ in range(num_max + 1)])",
"-for i in range(num_max + 1):",
"- if i == 0 or i == 1:",
"- primes[i] = False",
"- elif primes[i]:",
"- primes[i * 2 :: i] = False",
... | false | 0.397384 | 0.472277 | 0.84142 | [
"s125303514",
"s315817096"
] |
u126232616 | p02936 | python | s744672736 | s699323368 | 1,990 | 845 | 116,496 | 125,404 | Accepted | Accepted | 57.54 | #import sys
#input = sys.stdin.readline
n,q = list(map(int,input().split()))
AB = [[int(x) for x in input().split()] for _ in range(n-1)]
PX = [[int(x) for x in input().split()] for _ in range(q)]
Graph = [[] for _ in range(n+1)]
for a,b in AB:
Graph[a].append(b)
Graph[b].append(a)
#print(Graph)
... | import sys
input = sys.stdin.readline
n,q = list(map(int,input().split()))
AB = [[int(x) for x in input().split()] for _ in range(n-1)]
PX = [[int(x) for x in input().split()] for _ in range(q)]
Graph = [[] for _ in range(n+1)]
for a,b in AB:
Graph[a].append(b)
Graph[b].append(a)
#print(Graph)
V... | 27 | 27 | 589 | 587 | # import sys
# input = sys.stdin.readline
n, q = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(n - 1)]
PX = [[int(x) for x in input().split()] for _ in range(q)]
Graph = [[] for _ in range(n + 1)]
for a, b in AB:
Graph[a].append(b)
Graph[b].append(a)
# print(Graph)
Value... | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(n - 1)]
PX = [[int(x) for x in input().split()] for _ in range(q)]
Graph = [[] for _ in range(n + 1)]
for a, b in AB:
Graph[a].append(b)
Graph[b].append(a)
# print(Graph)
Value = ... | false | 0 | [
"-# import sys",
"-# input = sys.stdin.readline",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.036194 | 0.047325 | 0.764803 | [
"s744672736",
"s699323368"
] |
u396266329 | p02725 | python | s708750932 | s054608629 | 214 | 153 | 26,444 | 26,420 | Accepted | Accepted | 28.5 | K,N = list(map(int,input().split()))
A = list(map(int,input().split()))
for n in range(N):
A.append(-(K-A[n]))
A.sort()
res = K
for n in range(N):
res = min(A[n+N-1] - A[n], res)
print(res) | K,N = list(map(int,input().split()))
A = list(map(int,input().split()))
maxNum = 0
A.append(A[0] + K)
for i in range(N):
maxNum = max(maxNum, A[i+1] - A[i])
print((K - maxNum)) | 9 | 7 | 195 | 176 | K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
for n in range(N):
A.append(-(K - A[n]))
A.sort()
res = K
for n in range(N):
res = min(A[n + N - 1] - A[n], res)
print(res)
| K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
maxNum = 0
A.append(A[0] + K)
for i in range(N):
maxNum = max(maxNum, A[i + 1] - A[i])
print((K - maxNum))
| false | 22.222222 | [
"-for n in range(N):",
"- A.append(-(K - A[n]))",
"-A.sort()",
"-res = K",
"-for n in range(N):",
"- res = min(A[n + N - 1] - A[n], res)",
"-print(res)",
"+maxNum = 0",
"+A.append(A[0] + K)",
"+for i in range(N):",
"+ maxNum = max(maxNum, A[i + 1] - A[i])",
"+print((K - maxNum))"
] | false | 0.036219 | 0.069247 | 0.523032 | [
"s708750932",
"s054608629"
] |
u944209426 | p03241 | python | s666834532 | s555755271 | 1,032 | 176 | 41,728 | 39,152 | Accepted | Accepted | 82.95 | n,m=list(map(int,input().split()))
x=1
if m%n==0:
print((m//n))
else:
for i in range(1,m//n+1):
if m%i==0 and i*n<=m:
x=max(x,i)
if m%i==0 and (m//i)*n<=m:
x=max(x,m//i)
print(x) | n,m=list(map(int,input().split()))
x=1
if m%n==0:
print((m//n))
else:
for i in range(1,int(m**0.5)+1):
if m%i==0 and i*n<=m:
x=max(x,i)
if m%(m//i)==0 and (m//i)*n<=m:
x=max(x,m//i)
print(x) | 11 | 11 | 232 | 244 | n, m = list(map(int, input().split()))
x = 1
if m % n == 0:
print((m // n))
else:
for i in range(1, m // n + 1):
if m % i == 0 and i * n <= m:
x = max(x, i)
if m % i == 0 and (m // i) * n <= m:
x = max(x, m // i)
print(x)
| n, m = list(map(int, input().split()))
x = 1
if m % n == 0:
print((m // n))
else:
for i in range(1, int(m**0.5) + 1):
if m % i == 0 and i * n <= m:
x = max(x, i)
if m % (m // i) == 0 and (m // i) * n <= m:
x = max(x, m // i)
print(x)
| false | 0 | [
"- for i in range(1, m // n + 1):",
"+ for i in range(1, int(m**0.5) + 1):",
"- if m % i == 0 and (m // i) * n <= m:",
"+ if m % (m // i) == 0 and (m // i) * n <= m:"
] | false | 0.081516 | 0.118957 | 0.68526 | [
"s666834532",
"s555755271"
] |
u969190727 | p03112 | python | s523908022 | s241686984 | 1,641 | 735 | 12,092 | 12,188 | Accepted | Accepted | 55.21 | import bisect
a,b,q=list(map(int,input().split()))
S,T=[],[]
for i in range(a):
S.append(int(eval(input())))
for i in range(b):
T.append(int(eval(input())))
def f(list,n):
if n<list[0]:
return [-float("inf"),list[0]]
elif list[-1]<n:
return [list[-1],float("inf")]
else:
i=bisect.bisec... | import bisect
import sys
input = sys.stdin.readline
a,b,q=list(map(int,input().split()))
S,T=[],[]
for i in range(a):
S.append(int(eval(input())))
for i in range(b):
T.append(int(eval(input())))
def f(list,n):
if n<list[0]:
return [-float("inf"),list[0]]
elif list[-1]<n:
return [list[-1],fl... | 25 | 27 | 596 | 636 | import bisect
a, b, q = list(map(int, input().split()))
S, T = [], []
for i in range(a):
S.append(int(eval(input())))
for i in range(b):
T.append(int(eval(input())))
def f(list, n):
if n < list[0]:
return [-float("inf"), list[0]]
elif list[-1] < n:
return [list[-1], float("inf")]
... | import bisect
import sys
input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
S, T = [], []
for i in range(a):
S.append(int(eval(input())))
for i in range(b):
T.append(int(eval(input())))
def f(list, n):
if n < list[0]:
return [-float("inf"), list[0]]
elif list[-1] < n:
... | false | 7.407407 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.040297 | 0.040486 | 0.995331 | [
"s523908022",
"s241686984"
] |
u672475305 | p03418 | python | s117570746 | s840317876 | 102 | 75 | 3,060 | 2,940 | Accepted | Accepted | 26.47 | n,k = list(map(int,input().split()))
cnt = 0
for b in range(1,n+1):
p = n//b
r = n%b
cnt += max(0, b-k)*p + max(0, r-k+1)
else:
if k==0:
cnt -= n
print(cnt) | n,k = list(map(int,input().split()))
if k==0:
print((n**2))
else:
ans = 0
for b in range(k,n+1):
ans += (n//b)*(b-k)
if n%b>=k:
ans += n%b-(k-1)
print(ans) | 10 | 10 | 183 | 200 | n, k = list(map(int, input().split()))
cnt = 0
for b in range(1, n + 1):
p = n // b
r = n % b
cnt += max(0, b - k) * p + max(0, r - k + 1)
else:
if k == 0:
cnt -= n
print(cnt)
| n, k = list(map(int, input().split()))
if k == 0:
print((n**2))
else:
ans = 0
for b in range(k, n + 1):
ans += (n // b) * (b - k)
if n % b >= k:
ans += n % b - (k - 1)
print(ans)
| false | 0 | [
"-cnt = 0",
"-for b in range(1, n + 1):",
"- p = n // b",
"- r = n % b",
"- cnt += max(0, b - k) * p + max(0, r - k + 1)",
"+if k == 0:",
"+ print((n**2))",
"- if k == 0:",
"- cnt -= n",
"-print(cnt)",
"+ ans = 0",
"+ for b in range(k, n + 1):",
"+ ans += (... | false | 0.08457 | 0.043853 | 1.9285 | [
"s117570746",
"s840317876"
] |
u882209234 | p02702 | python | s396399300 | s144929811 | 388 | 357 | 17,112 | 9,760 | Accepted | Accepted | 7.99 | S = eval(input())
N = len(S)
rS = S[::-1]
cum = [0] * (N+1)
for i in range(N):
cum[i+1] = (cum[i] + (int(rS[i]) * pow(10,i,2019)) % 2019) % 2019
ans = 0
from collections import Counter
from math import factorial
c = Counter(cum)
for v in list(c.values()):
if v >= 2:
ans += factorial(v) /... | S = eval(input())
N = len(S)
rS = S[::-1]
ans = 0
tot = 0
from collections import defaultdict
dic = defaultdict(int)
for i in range(N):
dic[tot] += 1
tot += int(rS[i]) * pow(10,i,2019)
tot %= 2019
ans += dic[tot]
print(ans) | 17 | 15 | 342 | 249 | S = eval(input())
N = len(S)
rS = S[::-1]
cum = [0] * (N + 1)
for i in range(N):
cum[i + 1] = (cum[i] + (int(rS[i]) * pow(10, i, 2019)) % 2019) % 2019
ans = 0
from collections import Counter
from math import factorial
c = Counter(cum)
for v in list(c.values()):
if v >= 2:
ans += factorial(v) // (factor... | S = eval(input())
N = len(S)
rS = S[::-1]
ans = 0
tot = 0
from collections import defaultdict
dic = defaultdict(int)
for i in range(N):
dic[tot] += 1
tot += int(rS[i]) * pow(10, i, 2019)
tot %= 2019
ans += dic[tot]
print(ans)
| false | 11.764706 | [
"-cum = [0] * (N + 1)",
"+ans = 0",
"+tot = 0",
"+from collections import defaultdict",
"+",
"+dic = defaultdict(int)",
"- cum[i + 1] = (cum[i] + (int(rS[i]) * pow(10, i, 2019)) % 2019) % 2019",
"-ans = 0",
"-from collections import Counter",
"-from math import factorial",
"-",
"-c = Counte... | false | 0.046267 | 0.039985 | 1.157102 | [
"s396399300",
"s144929811"
] |
u255673886 | p03796 | python | s771624661 | s997269334 | 291 | 170 | 43,120 | 81,568 | Accepted | Accepted | 41.58 | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,c... | from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from bisect import bisect_left,bisect_right
from math import sqrt,gcd,ceil,floor,factorial
#... | 98 | 108 | 2,161 | 2,556 | from collections import deque
from heapq import heapify, heappop, heappush, heappushpop
from copy import copy, deepcopy
from itertools import product, permutations, combinations, combinations_with_replacement
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
# from math import g... | from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
from copy import copy, deepcopy
from itertools import product, permutations, combinations, combinations_with_replacement
from bisect import bisect_left, bisect_right
from math import sqrt, gcd, ceil, floor, fac... | false | 9.259259 | [
"-from collections import deque",
"+from collections import deque, defaultdict, Counter",
"-from collections import defaultdict, Counter",
"+from math import sqrt, gcd, ceil, floor, factorial",
"-# from math import gcd,ceil,floor,factorial",
"+from statistics import mean, median, mode",
"+import sys",
... | false | 0.094676 | 0.133942 | 0.706843 | [
"s771624661",
"s997269334"
] |
u729133443 | p03473 | python | s886624063 | s654133807 | 34 | 29 | 27,884 | 9,044 | Accepted | Accepted | 14.71 | print(-eval(input())+48) | print((48-int(eval(input())))) | 1 | 1 | 16 | 22 | print(-eval(input()) + 48)
| print((48 - int(eval(input()))))
| false | 0 | [
"-print(-eval(input()) + 48)",
"+print((48 - int(eval(input()))))"
] | false | 0.044728 | 0.043403 | 1.030526 | [
"s886624063",
"s654133807"
] |
u046187684 | p02984 | python | s701699331 | s990418954 | 115 | 83 | 16,200 | 20,168 | Accepted | Accepted | 27.83 | def solve(string):
n, *a = list(map(int, string.split()))
e = [sum(a[1::2]), sum(a[2::2])]
s = a[0] + sum(e)
ans = []
for i in range(n):
ans.append(str(s - e[i % 2] * 2))
if i < n - 1:
e[i % 2] += a[i] - a[i + 1]
return " ".join(ans)
if __name__ == '__ma... | def solve(string):
n, *a = list(map(int, string.split()))
ans = [sum(a) - 2 * sum(a[1::2])]
for i in range(n - 1):
ans.append(2 * a[i] - ans[-1])
return " ".join(map(str, ans))
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| 14 | 10 | 370 | 281 | def solve(string):
n, *a = list(map(int, string.split()))
e = [sum(a[1::2]), sum(a[2::2])]
s = a[0] + sum(e)
ans = []
for i in range(n):
ans.append(str(s - e[i % 2] * 2))
if i < n - 1:
e[i % 2] += a[i] - a[i + 1]
return " ".join(ans)
if __name__ == "__main__":
p... | def solve(string):
n, *a = list(map(int, string.split()))
ans = [sum(a) - 2 * sum(a[1::2])]
for i in range(n - 1):
ans.append(2 * a[i] - ans[-1])
return " ".join(map(str, ans))
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| false | 28.571429 | [
"- e = [sum(a[1::2]), sum(a[2::2])]",
"- s = a[0] + sum(e)",
"- ans = []",
"- for i in range(n):",
"- ans.append(str(s - e[i % 2] * 2))",
"- if i < n - 1:",
"- e[i % 2] += a[i] - a[i + 1]",
"- return \" \".join(ans)",
"+ ans = [sum(a) - 2 * sum(a[1::2])]",
... | false | 0.035055 | 0.036103 | 0.970961 | [
"s701699331",
"s990418954"
] |
u075304271 | p03281 | python | s045798083 | s573195593 | 176 | 135 | 13,072 | 77,492 | Accepted | Accepted | 23.3 | import math
import itertools
import numpy as np
def div(n):
c = 0
for i in range(1,n+1):
if n % i == 0:
c += 1
return c
def solve():
n = int(eval(input()))
ans = 0
for i in range(1,n+1):
if div(i) == 8 and i % 2 == 1:
ans += 1
print(... | import math
import collections
import fractions
import itertools
import functools
import operator
def yakusu_rekkyo(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_... | 22 | 33 | 376 | 711 | import math
import itertools
import numpy as np
def div(n):
c = 0
for i in range(1, n + 1):
if n % i == 0:
c += 1
return c
def solve():
n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if div(i) == 8 and i % 2 == 1:
ans += 1
print(ans)
... | import math
import collections
import fractions
import itertools
import functools
import operator
def yakusu_rekkyo(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.app... | false | 33.333333 | [
"+import collections",
"+import fractions",
"-import numpy as np",
"+import functools",
"+import operator",
"-def div(n):",
"- c = 0",
"- for i in range(1, n + 1):",
"+def yakusu_rekkyo(n):",
"+ lower_divisors, upper_divisors = [], []",
"+ i = 1",
"+ while i * i <= n:",
"- ... | false | 0.032906 | 0.034428 | 0.95581 | [
"s045798083",
"s573195593"
] |
u994988729 | p02837 | python | s048128534 | s256377596 | 702 | 571 | 3,064 | 3,064 | Accepted | Accepted | 18.66 | from itertools import product
N = int(eval(input()))
said = [[-1] * (N+1) for _ in range(N+1)]
for a in range(N):
K = int(eval(input()))
for _ in range(K):
x, y = list(map(int, input().split()))
said[a][x - 1] = y
ans = 0
for cand in product(list(range(2)), repeat=N):
isOK = Tr... | from itertools import product
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N = int(eval(input()))
mention = []
for _ in range(N):
A = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(A)]
mention.append(xy)
ans = 0
for pair in product(list(... | 29 | 25 | 640 | 575 | from itertools import product
N = int(eval(input()))
said = [[-1] * (N + 1) for _ in range(N + 1)]
for a in range(N):
K = int(eval(input()))
for _ in range(K):
x, y = list(map(int, input().split()))
said[a][x - 1] = y
ans = 0
for cand in product(list(range(2)), repeat=N):
isOK = True
fo... | from itertools import product
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
mention = []
for _ in range(N):
A = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(A)]
mention.append(xy)
ans = 0
for pair in product(list(range(2)), repea... | false | 13.793103 | [
"+import sys",
"+input = sys.stdin.buffer.readline",
"+sys.setrecursionlimit(10**7)",
"-said = [[-1] * (N + 1) for _ in range(N + 1)]",
"-for a in range(N):",
"- K = int(eval(input()))",
"- for _ in range(K):",
"- x, y = list(map(int, input().split()))",
"- said[a][x - 1] = y",
... | false | 0.036415 | 0.03664 | 0.993858 | [
"s048128534",
"s256377596"
] |
u156815136 | p02888 | python | s309513691 | s577348799 | 1,379 | 1,085 | 3,188 | 10,520 | Accepted | Accepted | 21.32 | n = int(eval(input()))
L = sorted(list(map(int,input().split())))
import bisect
ans = 0
#print(L)
for a in range(n-2):
for b in range(a+1,n-1):
p = bisect.bisect_left(L,L[a] + L[b])
#print(bisect.bisect_left(L,L[a]+L[b]),"-",L[a] + L[b])
ans += p - (b+1)
print(ans)
| #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdi... | 11 | 51 | 298 | 1,185 | n = int(eval(input()))
L = sorted(list(map(int, input().split())))
import bisect
ans = 0
# print(L)
for a in range(n - 2):
for b in range(a + 1, n - 1):
p = bisect.bisect_left(L, L[a] + L[b])
# print(bisect.bisect_left(L,L[a]+L[b]),"-",L[a] + L[b])
ans += p - (b + 1)
print(ans)
| # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate, product # (string,3) 3回
# from collections import deque
from collections import deque, defaul... | false | 78.431373 | [
"-n = int(eval(input()))",
"-L = sorted(list(map(int, input().split())))",
"+# from statistics import median",
"+# import collections",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+from fractions import gcd",
"+from itertools import combinations, permutations... | false | 0.039734 | 0.041086 | 0.967096 | [
"s309513691",
"s577348799"
] |
u796784914 | p02271 | python | s097379036 | s986600392 | 10,840 | 2,400 | 6,404 | 48,896 | Accepted | Accepted | 77.86 | class MyClass():
def main(self):
self.n = eval(input())
self.A = list(map(int,input().split()))
self.q = eval(input())
self.M = list(map(int,input().split()))
W = list(map(self.solve,self.M))
for w in W:
print(w)
def solve(self,m):... | from collections import deque
def main():
n = eval(input())
A = deque(list(map(int,input().split())))
q = eval(input())
M = list(map(int,input().split()))
p = rec([0],A)
for m in M:
if m in p:
print("yes")
else:
print("no")
def rec(a,A)... | 40 | 26 | 909 | 477 | class MyClass:
def main(self):
self.n = eval(input())
self.A = list(map(int, input().split()))
self.q = eval(input())
self.M = list(map(int, input().split()))
W = list(map(self.solve, self.M))
for w in W:
print(w)
def solve(self, m):
w = self.... | from collections import deque
def main():
n = eval(input())
A = deque(list(map(int, input().split())))
q = eval(input())
M = list(map(int, input().split()))
p = rec([0], A)
for m in M:
if m in p:
print("yes")
else:
print("no")
def rec(a, A):
if len... | false | 35 | [
"-class MyClass:",
"- def main(self):",
"- self.n = eval(input())",
"- self.A = list(map(int, input().split()))",
"- self.q = eval(input())",
"- self.M = list(map(int, input().split()))",
"- W = list(map(self.solve, self.M))",
"- for w in W:",
"- ... | false | 0.115899 | 0.036868 | 3.143588 | [
"s097379036",
"s986600392"
] |
u680851063 | p03945 | python | s330728377 | s163297663 | 60 | 43 | 3,188 | 3,188 | Accepted | Accepted | 28.33 | s = eval(input())
x = s[0]
for i in range(1, len(s)):
if s[i-1] != s[i]:
x += s[i]
print((len(x) - 1)) | s = eval(input())
x = 0
for i in range(len(s) - 1):
if s[i] != s[i+1]:
x += 1
print(x) | 8 | 8 | 115 | 101 | s = eval(input())
x = s[0]
for i in range(1, len(s)):
if s[i - 1] != s[i]:
x += s[i]
print((len(x) - 1))
| s = eval(input())
x = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
x += 1
print(x)
| false | 0 | [
"-x = s[0]",
"-for i in range(1, len(s)):",
"- if s[i - 1] != s[i]:",
"- x += s[i]",
"-print((len(x) - 1))",
"+x = 0",
"+for i in range(len(s) - 1):",
"+ if s[i] != s[i + 1]:",
"+ x += 1",
"+print(x)"
] | false | 0.090213 | 0.081304 | 1.109578 | [
"s330728377",
"s163297663"
] |
u506858457 | p02762 | python | s923438688 | s395297404 | 1,142 | 985 | 11,716 | 60,724 | Accepted | Accepted | 13.75 | class UnionFind():
def __init__(self,n):
self.n=n
self.root=[-1]*(n+1)
self.rank=[0]*(n+1)
def FindRoot(self,x):
if self.root[x]<0:
return x
else:
self.root[x]=self.FindRoot(self.root[x])
return self.root[x]
def Unite(self,x,y):
x=self.FindRoot(x)
y=self.FindRoot(y)
... | import sys
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
if self.table[x] < 0:
return x
else:
self.table[x] = self._root(self.table[x])
return self.table[x]
def count(self, x):
retu... | 47 | 55 | 1,303 | 1,384 | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rank = [0] * (n + 1)
def FindRoot(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.FindRoot(self.root[x])
return self.root[x]
def ... | import sys
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
if self.table[x] < 0:
return x
else:
self.table[x] = self._root(self.table[x])
return self.table[x]
def count(self, x):
return -self.table[self... | false | 14.545455 | [
"+import sys",
"+",
"+",
"- self.n = n",
"- self.root = [-1] * (n + 1)",
"- self.rank = [0] * (n + 1)",
"+ self.table = [-1] * n",
"- def FindRoot(self, x):",
"- if self.root[x] < 0:",
"+ def _root(self, x):",
"+ if self.table[x] < 0:",
"- ... | false | 0.042475 | 0.047458 | 0.894995 | [
"s923438688",
"s395297404"
] |
u896741788 | p02684 | python | s165102075 | s170975072 | 1,922 | 1,692 | 32,284 | 32,176 | Accepted | Accepted | 11.97 | def f():
n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
now=1
for i in range(k.bit_length()):
if k%2:now=l[now-1]
l=[l[l[i]-1]for i in range(n)]
k//=2
print(now)
if __name__ == "__main__":
f() | def f():
n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
now=1
for i in range(k.bit_length()):
if k%2:now=l[now-1]
l=tuple(l[l[i]-1]for i in range(n))
k//=2
print(now)
if __name__ == "__main__":
f() | 12 | 12 | 267 | 272 | def f():
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
now = 1
for i in range(k.bit_length()):
if k % 2:
now = l[now - 1]
l = [l[l[i] - 1] for i in range(n)]
k //= 2
print(now)
if __name__ == "__main__":
f()
| def f():
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
now = 1
for i in range(k.bit_length()):
if k % 2:
now = l[now - 1]
l = tuple(l[l[i] - 1] for i in range(n))
k //= 2
print(now)
if __name__ == "__main__":
f()
| false | 0 | [
"- l = [l[l[i] - 1] for i in range(n)]",
"+ l = tuple(l[l[i] - 1] for i in range(n))"
] | false | 0.13104 | 0.041173 | 3.182634 | [
"s165102075",
"s170975072"
] |
u367130284 | p03634 | python | s780381918 | s517843387 | 854 | 757 | 110,044 | 105,176 | Accepted | Accepted | 11.36 | from collections import *
from heapq import*
import sys
input=sys.stdin.readline
d=defaultdict(list)
n=int(eval(input()))
for s in range(n-1):
a,b,c=list(map(int,input().split()))
d[a].append([b,c])
d[b].append([a,c])
#defaultdict(<class 'list'>, {1: [[2, 1], [3, 1]], 2: [[1, 1], [3, 3]], 3: [[... | from collections import *
from heapq import*
import sys
input=sys.stdin.readline
d=defaultdict(list)
n=int(eval(input()))
for s in range(n-1):
a,b,c=list(map(int,input().split()))
d[a].append([b,c])
d[b].append([a,c])
#defaultdict(<class 'list'>, {1: [[2, 1], [3, 1]], 2: [[1, 1], [3, 3]], 3: [[... | 35 | 35 | 927 | 920 | from collections import *
from heapq import *
import sys
input = sys.stdin.readline
d = defaultdict(list)
n = int(eval(input()))
for s in range(n - 1):
a, b, c = list(map(int, input().split()))
d[a].append([b, c])
d[b].append([a, c])
# defaultdict(<class 'list'>, {1: [[2, 1], [3, 1]], 2: [[1, 1], [3, 3]], ... | from collections import *
from heapq import *
import sys
input = sys.stdin.readline
d = defaultdict(list)
n = int(eval(input()))
for s in range(n - 1):
a, b, c = list(map(int, input().split()))
d[a].append([b, c])
d[b].append([a, c])
# defaultdict(<class 'list'>, {1: [[2, 1], [3, 1]], 2: [[1, 1], [3, 3]], ... | false | 0 | [
"- cost = {node: float(\"inf\") for node in list(d.keys())}",
"+ cost = {node: 1e18 for node in list(d.keys())}"
] | false | 0.094214 | 0.070406 | 1.338156 | [
"s780381918",
"s517843387"
] |
u888092736 | p03329 | python | s791497541 | s315597167 | 495 | 397 | 9,488 | 128,508 | Accepted | Accepted | 19.8 | N = int(eval(input()))
dp = [N] * (N + 1)
dp[0] = 0
for i in range(N):
j = 1
while i + j <= N:
dp[i + j] = min(dp[i + j], dp[i] + 1)
j *= 6
j = 9
while i + j <= N:
dp[i + j] = min(dp[i + j], dp[i] + 1)
j *= 9
print((dp[-1]))
| import sys
from functools import lru_cache
sys.setrecursionlimit(500000)
@lru_cache(maxsize=None)
def rec(n):
if n == 0:
return 0
res = n
i = 1
while i <= n:
res = min(res, rec(n - i) + 1)
i *= 6
i = 9
while i <= n:
res = min(res, rec(n - i) ... | 13 | 27 | 277 | 398 | N = int(eval(input()))
dp = [N] * (N + 1)
dp[0] = 0
for i in range(N):
j = 1
while i + j <= N:
dp[i + j] = min(dp[i + j], dp[i] + 1)
j *= 6
j = 9
while i + j <= N:
dp[i + j] = min(dp[i + j], dp[i] + 1)
j *= 9
print((dp[-1]))
| import sys
from functools import lru_cache
sys.setrecursionlimit(500000)
@lru_cache(maxsize=None)
def rec(n):
if n == 0:
return 0
res = n
i = 1
while i <= n:
res = min(res, rec(n - i) + 1)
i *= 6
i = 9
while i <= n:
res = min(res, rec(n - i) + 1)
i *= 9... | false | 51.851852 | [
"+import sys",
"+from functools import lru_cache",
"+",
"+sys.setrecursionlimit(500000)",
"+",
"+",
"+@lru_cache(maxsize=None)",
"+def rec(n):",
"+ if n == 0:",
"+ return 0",
"+ res = n",
"+ i = 1",
"+ while i <= n:",
"+ res = min(res, rec(n - i) + 1)",
"+ ... | false | 0.231026 | 0.158537 | 1.457236 | [
"s791497541",
"s315597167"
] |
u498487134 | p02785 | python | s875171071 | s474912270 | 321 | 169 | 87,892 | 103,480 | Accepted | Accepted | 47.35 | N,K=list(map(int,input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)
for i in range(K):
if i>=N:
break
H[i]=0
print((sum(H))) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,K=MI()
h=LI()
h.sort()
if K>=N:
print((0))
exit()
... | 10 | 25 | 167 | 402 | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)
for i in range(K):
if i >= N:
break
H[i] = 0
print((sum(H)))
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, K = MI()
h = LI()
h.sort()
if K >= N:
print((0))
exit()
f... | false | 60 | [
"-N, K = list(map(int, input().split()))",
"-H = list(map(int, input().split()))",
"-H.sort(reverse=True)",
"-for i in range(K):",
"- if i >= N:",
"- break",
"- H[i] = 0",
"-print((sum(H)))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def I():",
"+ ret... | false | 0.050777 | 0.106489 | 0.476823 | [
"s875171071",
"s474912270"
] |
u049182844 | p02818 | python | s026858356 | s213965594 | 29 | 26 | 9,172 | 9,104 | Accepted | Accepted | 10.34 | a , b , k = list(map(int,input().split()))
if k - a >= b:
a = 0
b = 0
elif k >= a and k - a < b:
k -= a
a = 0
b -= k - a
else:
a -= k
print((a, b))
| a , b , k = list(map(int,input().split()))
if k <= a:
answer = ( a - k , b)
else:
answer = (0 , max(0 , a + b -k))
print((*answer)) | 11 | 6 | 164 | 133 | a, b, k = list(map(int, input().split()))
if k - a >= b:
a = 0
b = 0
elif k >= a and k - a < b:
k -= a
a = 0
b -= k - a
else:
a -= k
print((a, b))
| a, b, k = list(map(int, input().split()))
if k <= a:
answer = (a - k, b)
else:
answer = (0, max(0, a + b - k))
print((*answer))
| false | 45.454545 | [
"-if k - a >= b:",
"- a = 0",
"- b = 0",
"-elif k >= a and k - a < b:",
"- k -= a",
"- a = 0",
"- b -= k - a",
"+if k <= a:",
"+ answer = (a - k, b)",
"- a -= k",
"-print((a, b))",
"+ answer = (0, max(0, a + b - k))",
"+print((*answer))"
] | false | 0.064642 | 0.046422 | 1.392483 | [
"s026858356",
"s213965594"
] |
u408260374 | p00775 | python | s849776474 | s583633292 | 380 | 140 | 7,740 | 7,652 | Accepted | Accepted | 63.16 | while True:
R, N = list(map(int, input().split()))
if not (R | N):
break
geta = 20
buildings = [0] * (geta * 2)
for _ in range(N):
xl, xr, h = list(map(int, input().split()))
for i in range(xl + geta, xr + geta):
buildings[i] = max(buildings[i], h)
... | while True:
R, N = list(map(int, input().split()))
if not (R | N):
break
geta = 20
buildings = [0] * (geta * 2)
for _ in range(N):
xl, xr, h = list(map(int, input().split()))
for i in range(xl + geta, xr + geta):
buildings[i] = max(buildings[i], h)
... | 27 | 27 | 857 | 863 | while True:
R, N = list(map(int, input().split()))
if not (R | N):
break
geta = 20
buildings = [0] * (geta * 2)
for _ in range(N):
xl, xr, h = list(map(int, input().split()))
for i in range(xl + geta, xr + geta):
buildings[i] = max(buildings[i], h)
left, right... | while True:
R, N = list(map(int, input().split()))
if not (R | N):
break
geta = 20
buildings = [0] * (geta * 2)
for _ in range(N):
xl, xr, h = list(map(int, input().split()))
for i in range(xl + geta, xr + geta):
buildings[i] = max(buildings[i], h)
left, right... | false | 0 | [
"- for _ in range(100):",
"+ while right - left > 1e-4:"
] | false | 0.068433 | 0.037329 | 1.833222 | [
"s849776474",
"s583633292"
] |
u095021077 | p03078 | python | s664900013 | s012871520 | 876 | 38 | 4,848 | 4,976 | Accepted | Accepted | 95.66 | X, Y, Z, K=list(map(int, input().split()))
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
import heapq
nums=[[-(A[0]+B[0]+C[0]), 0, 0, 0]]
heapq.heapify(nums)
sumi=[[0, 0, 0]]
for _ in ra... | X, Y, Z, K=list(map(int, input().split()))
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
import heapq
nums=[[-(A[0]+B[0]+C[0]), 0, 0, 0]]
heapq.heapify(nums)
sumi=set()
sumi.add((0, 0, 0... | 25 | 27 | 769 | 777 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
import heapq
nums = [[-(A[0] + B[0] + C[0]), 0, 0, 0]]
heapq.heapify(nums)
sumi = [[0, 0, 0]]
for _ in ... | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
import heapq
nums = [[-(A[0] + B[0] + C[0]), 0, 0, 0]]
heapq.heapify(nums)
sumi = set()
sumi.add((0, 0,... | false | 7.407407 | [
"-sumi = [[0, 0, 0]]",
"+sumi = set()",
"+sumi.add((0, 0, 0))",
"- if a < X - 1 and not ([a + 1, b, c] in sumi):",
"+ if a < X - 1 and not ((a + 1, b, c) in sumi):",
"- sumi.append([a + 1, b, c])",
"- if b < Y - 1 and not ([a, b + 1, c] in sumi):",
"+ sumi.add((a + 1, b, c))",
... | false | 0.044526 | 0.036863 | 1.207902 | [
"s664900013",
"s012871520"
] |
u688319022 | p02887 | python | s385972353 | s727755333 | 65 | 48 | 3,956 | 3,956 | Accepted | Accepted | 26.15 |
N=int(eval(input()))
S=eval(input())
New=[]
for i in range(N-1):
New.append(S[i])
if S[i] == S[i+1]:
New.pop()
if len(New) == 0 or S[-1] != New[-1]:
New.append(S[-1])
print((len(New))) | N=int(eval(input()))
S=eval(input())
New=[]
for i in range(N-1):
if not S[i] == S[i+1]:
New.append(S[i])
if len(New) == 0 or S[-1] != New[-1]:
New.append(S[N-1])
print((len(New))) | 12 | 9 | 203 | 190 | N = int(eval(input()))
S = eval(input())
New = []
for i in range(N - 1):
New.append(S[i])
if S[i] == S[i + 1]:
New.pop()
if len(New) == 0 or S[-1] != New[-1]:
New.append(S[-1])
print((len(New)))
| N = int(eval(input()))
S = eval(input())
New = []
for i in range(N - 1):
if not S[i] == S[i + 1]:
New.append(S[i])
if len(New) == 0 or S[-1] != New[-1]:
New.append(S[N - 1])
print((len(New)))
| false | 25 | [
"- New.append(S[i])",
"- if S[i] == S[i + 1]:",
"- New.pop()",
"+ if not S[i] == S[i + 1]:",
"+ New.append(S[i])",
"- New.append(S[-1])",
"+ New.append(S[N - 1])"
] | false | 0.037287 | 0.037257 | 1.000791 | [
"s385972353",
"s727755333"
] |
u150984829 | p02234 | python | s850745513 | s526543301 | 110 | 100 | 5,720 | 5,712 | Accepted | Accepted | 9.09 | def s():
n=int(eval(input()))+1
e=[input().split()for _ in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if 1>m[r][c]or m[r][c]>x:m[r][c]=x
print((m[r]... | def s():
n=int(eval(input()))+1
e=[input().split()for _ in[0]*~-n]
p=[int(e[0][0])]+list(int(x[1])for x in e)
m=[[0]*n for _ in[0]*n]
for i in range(n):
for r in range(n-i-1):
c=r+i+1
for j in range(r+1,c):
x=m[r][j]+m[j][c]+p[r]*p[j]*p[c]
if 1>m[r][c]or m[r][c]>x:m[r][c]=x
print((m[r]... | 13 | 13 | 323 | 346 | def s():
n = int(eval(input())) + 1
e = [input().split() for _ in [0] * ~-n]
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
x = m[r][j... | def s():
n = int(eval(input())) + 1
e = [input().split() for _ in [0] * ~-n]
p = [int(e[0][0])] + list(int(x[1]) for x in e)
m = [[0] * n for _ in [0] * n]
for i in range(n):
for r in range(n - i - 1):
c = r + i + 1
for j in range(r + 1, c):
x = m[r][j... | false | 0 | [
"-s()",
"+if \"__main__\" == __name__:",
"+ s()"
] | false | 0.036737 | 0.036684 | 1.001443 | [
"s850745513",
"s526543301"
] |
u150984829 | p00009 | python | s467592802 | s436573567 | 320 | 280 | 23,224 | 21,104 | Accepted | Accepted | 12.5 | import sys
a=[0,0]+[1]*10**6
for i in range(999):
if a[i]:a[i*2::i]=[0 for j in[0]*len(a[i*2::i])]
for e in sys.stdin:print((sum(a[:int(e)+1])))
| import sys
a=[0,0]+[1]*10**6
for i in range(999):
if a[i]:a[i*2::i]=[0]*len(a[i*2::i])
for e in sys.stdin:print((sum(a[:int(e)+1])))
| 5 | 5 | 148 | 136 | import sys
a = [0, 0] + [1] * 10**6
for i in range(999):
if a[i]:
a[i * 2 :: i] = [0 for j in [0] * len(a[i * 2 :: i])]
for e in sys.stdin:
print((sum(a[: int(e) + 1])))
| import sys
a = [0, 0] + [1] * 10**6
for i in range(999):
if a[i]:
a[i * 2 :: i] = [0] * len(a[i * 2 :: i])
for e in sys.stdin:
print((sum(a[: int(e) + 1])))
| false | 0 | [
"- a[i * 2 :: i] = [0 for j in [0] * len(a[i * 2 :: i])]",
"+ a[i * 2 :: i] = [0] * len(a[i * 2 :: i])"
] | false | 0.310299 | 0.191296 | 1.622085 | [
"s467592802",
"s436573567"
] |
u596505843 | p02579 | python | s573516060 | s900449357 | 1,898 | 1,323 | 205,236 | 178,088 | Accepted | Accepted | 30.3 | import sys, math
from collections import defaultdict, deque, Counter
#from bisect import bisect_left, bisect_right
#from itertools import combinations, permutations, product
from heapq import heappush, heappop
#from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: ... | import sys, math
from collections import defaultdict, deque, Counter
#from bisect import bisect_left, bisect_right
#from itertools import combinations, permutations, product
from heapq import heappush, heappop
#from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: ... | 60 | 54 | 1,414 | 1,298 | import sys, math
from collections import defaultdict, deque, Counter
# from bisect import bisect_left, bisect_right
# from itertools import combinations, permutations, product
from heapq import heappush, heappop
# from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int... | import sys, math
from collections import defaultdict, deque, Counter
# from bisect import bisect_left, bisect_right
# from itertools import combinations, permutations, product
from heapq import heappush, heappop
# from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int... | false | 10 | [
"-dist = defaultdict(lambda: float(\"inf\"))",
"-",
"-",
"-def dijkstra(start, end):",
"- dist[start] = 0",
"- heap = []",
"- heappush(heap, (0, start))",
"- while heap:",
"- d, n = heappop(heap)",
"- if n == end:",
"- return d",
"- if dist[n] != d:"... | false | 0.035727 | 0.058508 | 0.610632 | [
"s573516060",
"s900449357"
] |
u934442292 | p02820 | python | s042517756 | s074163117 | 78 | 42 | 4,084 | 4,084 | Accepted | Accepted | 46.15 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
def get_point(s):
if s == "r":
return P
elif s == "s":
return R
elif s == "p":
return S
ans = 0
restricted = [False] * N
for i in range(N):
if (i+1) <= K:
ans += get_point(T[i])
... | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = input().rstrip()
n_win = {"r": 0, "s": 0, "p": 0}
lock = [False] * N
for i in range(K):
n_win[T[i]] += 1
lock[i] = True
for ... | 27 | 29 | 491 | 646 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
def get_point(s):
if s == "r":
return P
elif s == "s":
return R
elif s == "p":
return S
ans = 0
restricted = [False] * N
for i in range(N):
if (i + 1) <= K:
ans += get_p... | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = input().rstrip()
n_win = {"r": 0, "s": 0, "p": 0}
lock = [False] * N
for i in range(K):
n_win[T[i]] += 1
lock[i] = True
for i in range(K, ... | false | 6.896552 | [
"-N, K = list(map(int, input().split()))",
"-R, S, P = list(map(int, input().split()))",
"-T = eval(input())",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-def get_point(s):",
"- if s == \"r\":",
"- return P",
"- elif s == \"s\":",
"- return R",
"- elif s == \"p\... | false | 0.044306 | 0.173981 | 0.254662 | [
"s042517756",
"s074163117"
] |
u108617242 | p03329 | python | s097874190 | s264929321 | 337 | 195 | 44,396 | 45,040 | Accepted | Accepted | 42.14 | N = int(eval(input()))
ans = 10**13
Y = [9**i for i in range(1, 10)] + [6**i for i in range(1, 10)]
Y = sorted(Y, reverse=True)
for i in range(N+1):
tmp = 0
n = N-i
for j in range(10, -1, -1):
if i // 9**j > 0:
tmp += i // 9**j
i %= 9**j
for j in range(10, -1, ... | # dp answer
N = int(eval(input()))
dp = [N for i in range(N+1)]
dp[0] = 0
Y = [1] + [6**i for i in range(1, 10) if 6**i <= N] + [9**i for i in range(1, 10) if 9**i <= N]
Y = sorted(Y)
for i in range(1, N+1):
for y in Y:
if i-y < 0:
break
dp[i] = min(dp[i], dp[i-y]+1)
print((dp... | 21 | 12 | 492 | 318 | N = int(eval(input()))
ans = 10**13
Y = [9**i for i in range(1, 10)] + [6**i for i in range(1, 10)]
Y = sorted(Y, reverse=True)
for i in range(N + 1):
tmp = 0
n = N - i
for j in range(10, -1, -1):
if i // 9**j > 0:
tmp += i // 9**j
i %= 9**j
for j in range(10, -1, -1):
... | # dp answer
N = int(eval(input()))
dp = [N for i in range(N + 1)]
dp[0] = 0
Y = (
[1]
+ [6**i for i in range(1, 10) if 6**i <= N]
+ [9**i for i in range(1, 10) if 9**i <= N]
)
Y = sorted(Y)
for i in range(1, N + 1):
for y in Y:
if i - y < 0:
break
dp[i] = min(dp[i], dp[i - y]... | false | 42.857143 | [
"+# dp answer",
"-ans = 10**13",
"-Y = [9**i for i in range(1, 10)] + [6**i for i in range(1, 10)]",
"-Y = sorted(Y, reverse=True)",
"-for i in range(N + 1):",
"- tmp = 0",
"- n = N - i",
"- for j in range(10, -1, -1):",
"- if i // 9**j > 0:",
"- tmp += i // 9**j",
"- ... | false | 0.412064 | 0.189621 | 2.173096 | [
"s097874190",
"s264929321"
] |
u634079249 | p03945 | python | s378960050 | s245760125 | 42 | 31 | 4,400 | 4,396 | Accepted | Accepted | 26.19 | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.... | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.... | 41 | 39 | 1,014 | 957 | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffe... | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffe... | false | 4.878049 | [
"- S = itertools.groupby(list(iss()))",
"- q = \"\"",
"+ S = list(iss())",
"+ q = S[0]",
"- if q == \"\":",
"- q = s"
] | false | 0.08677 | 0.042241 | 2.054167 | [
"s378960050",
"s245760125"
] |
u883040023 | p02837 | python | s721191653 | s988886157 | 294 | 232 | 42,476 | 42,480 | Accepted | Accepted | 21.09 | n = int(eval(input()))
XY = []
ans = 0
for i in range(n):
z = []
for j in range(int(eval(input()))):
x,y = list(map(int,input().split()))
z.append([x,y])
XY.append(z)
for i in range(2**n):
honest = 0
mujunn = 0
for j in range(n):
... | n = int(eval(input()))
XY = []
ans = 0
for i in range(n):
z = []
for j in range(int(eval(input()))):
x,y = list(map(int,input().split()))
z.append([x,y])
XY.append(z)
for i in range(2**n):
honest = 0
mujunn = 0
for j in range(n):
... | 32 | 36 | 622 | 715 | n = int(eval(input()))
XY = []
ans = 0
for i in range(n):
z = []
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
z.append([x, y])
XY.append(z)
for i in range(2**n):
honest = 0
mujunn = 0
for j in range(n):
if (i >> j) & 1:
honest += ... | n = int(eval(input()))
XY = []
ans = 0
for i in range(n):
z = []
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
z.append([x, y])
XY.append(z)
for i in range(2**n):
honest = 0
mujunn = 0
for j in range(n):
if (i >> j) & 1:
honest += ... | false | 11.111111 | [
"+ break",
"+ if mujunn == 1:",
"+ break"
] | false | 0.044229 | 0.111456 | 0.396831 | [
"s721191653",
"s988886157"
] |
u644907318 | p02615 | python | s587828619 | s135286312 | 184 | 138 | 104,728 | 104,728 | Accepted | Accepted | 25 | import heapq
N = int(eval(input()))
A = list(map(int,input().split()))
heap = []
for i in range(N):
heapq.heappush(heap,-A[i])
if N==2:
ans = -heapq.heappop(heap)
elif N==3:
ans = -heapq.heappop(heap)-heapq.heappop(heap)
else:
ans = 0
ans = -heapq.heappop(heap)
if N%2==0:
f... | N = int(eval(input()))
A = sorted(list(map(int,input().split())),reverse=True)
if N%2==0:
cnt = A[0]
for i in range(1,N//2):
cnt += 2*A[i]
print(cnt)
else:
cnt = A[0]
for i in range(1,N//2):
cnt += 2*A[i]
cnt += A[N//2]
print(cnt) | 24 | 13 | 572 | 280 | import heapq
N = int(eval(input()))
A = list(map(int, input().split()))
heap = []
for i in range(N):
heapq.heappush(heap, -A[i])
if N == 2:
ans = -heapq.heappop(heap)
elif N == 3:
ans = -heapq.heappop(heap) - heapq.heappop(heap)
else:
ans = 0
ans = -heapq.heappop(heap)
if N % 2 == 0:
fo... | N = int(eval(input()))
A = sorted(list(map(int, input().split())), reverse=True)
if N % 2 == 0:
cnt = A[0]
for i in range(1, N // 2):
cnt += 2 * A[i]
print(cnt)
else:
cnt = A[0]
for i in range(1, N // 2):
cnt += 2 * A[i]
cnt += A[N // 2]
print(cnt)
| false | 45.833333 | [
"-import heapq",
"-",
"-A = list(map(int, input().split()))",
"-heap = []",
"-for i in range(N):",
"- heapq.heappush(heap, -A[i])",
"-if N == 2:",
"- ans = -heapq.heappop(heap)",
"-elif N == 3:",
"- ans = -heapq.heappop(heap) - heapq.heappop(heap)",
"+A = sorted(list(map(int, input().sp... | false | 0.107625 | 0.063379 | 1.698099 | [
"s587828619",
"s135286312"
] |
u357751375 | p03162 | python | s421799690 | s384721570 | 432 | 284 | 52,360 | 120,868 | Accepted | Accepted | 34.26 | n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n)]
a, b, c = [list(i) for i in zip(*l)]
dp = [[0, 0, 0] for i in range(n+1)]
for i in range(n):
dp[i+1][0] = max(dp[i][1]+a[i], dp[i][2]+a[i])
dp[i+1][1] = max(dp[i][0]+b[i], dp[i][2]+b[i])
dp[i+1][2] = max(dp[i][0]+c[i], dp[... | n = int(eval(input()))
l = [list(map(int,input().split())) for i in range(n)]
a,b,c = [list(i) for i in zip(*l)]
dp = [[0,0,0] for i in range(n+1)]
for i in range(n):
dp[i+1][0] = max(dp[i][1]+a[i],dp[i][2]+a[i])
dp[i+1][1] = max(dp[i][0]+b[i],dp[i][2]+b[i])
dp[i+1][2] = max(dp[i][0]+c[i],dp[i][1]+c[... | 9 | 9 | 371 | 337 | n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n)]
a, b, c = [list(i) for i in zip(*l)]
dp = [[0, 0, 0] for i in range(n + 1)]
for i in range(n):
dp[i + 1][0] = max(dp[i][1] + a[i], dp[i][2] + a[i])
dp[i + 1][1] = max(dp[i][0] + b[i], dp[i][2] + b[i])
dp[i + 1][2] = max(dp[i][0] ... | n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n)]
a, b, c = [list(i) for i in zip(*l)]
dp = [[0, 0, 0] for i in range(n + 1)]
for i in range(n):
dp[i + 1][0] = max(dp[i][1] + a[i], dp[i][2] + a[i])
dp[i + 1][1] = max(dp[i][0] + b[i], dp[i][2] + b[i])
dp[i + 1][2] = max(dp[i][0] ... | false | 0 | [
"-print((max(dp[-1][0], dp[-1][1], dp[-1][2])))",
"+print((max(dp[-1])))"
] | false | 0.007871 | 0.043019 | 0.182959 | [
"s421799690",
"s384721570"
] |
u525065967 | p02617 | python | s610076986 | s970466250 | 428 | 380 | 9,132 | 9,192 | Accepted | Accepted | 11.21 | n = int(eval(input()))
V = E = 0
for d in range(1,n+1): V += d * (d + 1) // 2
for _ in range(n-1):
a, b = list(map(int, input().split()))
if a > b: a, b = b, a
E += a * (n - b + 1)
print((V - E))
| n = int(eval(input()))
V = n*(n+1)*(n+2)//6; E = 0
for _ in range(n-1):
u, v = list(map(int, input().split()))
if u > v: u, v = v, u
E += u * (n - v + 1)
print((V - E))
| 8 | 7 | 201 | 173 | n = int(eval(input()))
V = E = 0
for d in range(1, n + 1):
V += d * (d + 1) // 2
for _ in range(n - 1):
a, b = list(map(int, input().split()))
if a > b:
a, b = b, a
E += a * (n - b + 1)
print((V - E))
| n = int(eval(input()))
V = n * (n + 1) * (n + 2) // 6
E = 0
for _ in range(n - 1):
u, v = list(map(int, input().split()))
if u > v:
u, v = v, u
E += u * (n - v + 1)
print((V - E))
| false | 12.5 | [
"-V = E = 0",
"-for d in range(1, n + 1):",
"- V += d * (d + 1) // 2",
"+V = n * (n + 1) * (n + 2) // 6",
"+E = 0",
"- a, b = list(map(int, input().split()))",
"- if a > b:",
"- a, b = b, a",
"- E += a * (n - b + 1)",
"+ u, v = list(map(int, input().split()))",
"+ if u >... | false | 0.044078 | 0.036451 | 1.20925 | [
"s610076986",
"s970466250"
] |
u699089116 | p03435 | python | s988013648 | s429988554 | 272 | 199 | 40,940 | 40,940 | Accepted | Accepted | 26.84 | l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
for a1 in range(101):
b1 = [l1[0]-a1, l1[1]-a1, l1[2]-a1]
for a2 in range(101):
b2 = [l2[0] - a2, l2[1] - a2, l2[2] - a2]
for a3 in range(101):
b3 = [l3[0] - a3, l... | c = [list(map(int, input().split())) for i in range(3)]
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
if (c[0][0] - a1 == c[1][0] - a2 == c[2][0] - a3) and (c[0][1] - a1 == c[1][1] - a2 == c[2][1] - a3) and (c[0][2] - a1 == c[1][2] - a2 == c[2][2] - a3):
... | 15 | 10 | 452 | 383 | l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
for a1 in range(101):
b1 = [l1[0] - a1, l1[1] - a1, l1[2] - a1]
for a2 in range(101):
b2 = [l2[0] - a2, l2[1] - a2, l2[2] - a2]
for a3 in range(101):
b3 = [l3[0] - a3, l3[1]... | c = [list(map(int, input().split())) for i in range(3)]
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
if (
(c[0][0] - a1 == c[1][0] - a2 == c[2][0] - a3)
and (c[0][1] - a1 == c[1][1] - a2 == c[2][1] - a3)
and (c[0][2] - a1 == c[... | false | 33.333333 | [
"-l1 = list(map(int, input().split()))",
"-l2 = list(map(int, input().split()))",
"-l3 = list(map(int, input().split()))",
"+c = [list(map(int, input().split())) for i in range(3)]",
"- b1 = [l1[0] - a1, l1[1] - a1, l1[2] - a1]",
"- b2 = [l2[0] - a2, l2[1] - a2, l2[2] - a2]",
"- b3 ... | false | 0.387649 | 0.213894 | 1.812346 | [
"s988013648",
"s429988554"
] |
u729133443 | p02929 | python | s385807834 | s138638864 | 253 | 225 | 3,316 | 3,316 | Accepted | Accepted | 11.07 | n,s=open(0)
a=i=1
l=0
for c in s:f=(c>'B')^i%2;l+=f;a=a*l**f*(i>int(n)or i)%(10**9+7);l-=f^1;i+=1
print((a*(l==1))) | n,s=open(0)
a=i=1
l=0
for c in s:f=(c>'B')^i%2;l+=f or-1;a=a*l**f*(i>int(n)or i)%(10**9+7);i+=1
print((a*(l==1))) | 5 | 5 | 117 | 115 | n, s = open(0)
a = i = 1
l = 0
for c in s:
f = (c > "B") ^ i % 2
l += f
a = a * l**f * (i > int(n) or i) % (10**9 + 7)
l -= f ^ 1
i += 1
print((a * (l == 1)))
| n, s = open(0)
a = i = 1
l = 0
for c in s:
f = (c > "B") ^ i % 2
l += f or -1
a = a * l**f * (i > int(n) or i) % (10**9 + 7)
i += 1
print((a * (l == 1)))
| false | 0 | [
"- l += f",
"+ l += f or -1",
"- l -= f ^ 1"
] | false | 0.044096 | 0.045488 | 0.969404 | [
"s385807834",
"s138638864"
] |
u863370423 | p03448 | python | s263622173 | s879162399 | 47 | 43 | 3,064 | 3,060 | Accepted | Accepted | 8.51 | #!/usr/bin/env python3
from itertools import product
import sys
def solve(A: int, B: int, C: int, X: int):
print((sum(
1
for a, b, c in product(list(range(A + 1)), list(range(B + 1)), list(range(C + 1)))
if a * 500 + b * 100 + c * 50 == X
)))
def main():
def iterate... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for xx in range(a+1):
A = 500*xx
for y in range(b+1) :
B = 100*y
for z in range(c+1):
C = 50*z
if x == A+B+C:
ans += 1
else:
... | 28 | 20 | 668 | 339 | #!/usr/bin/env python3
from itertools import product
import sys
def solve(A: int, B: int, C: int, X: int):
print(
(
sum(
1
for a, b, c in product(
list(range(A + 1)), list(range(B + 1)), list(range(C + 1))
)
if... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for xx in range(a + 1):
A = 500 * xx
for y in range(b + 1):
B = 100 * y
for z in range(c + 1):
C = 50 * z
if x == A + B + C:
ans += 1
else:
... | false | 28.571429 | [
"-#!/usr/bin/env python3",
"-from itertools import product",
"-import sys",
"-",
"-",
"-def solve(A: int, B: int, C: int, X: int):",
"- print(",
"- (",
"- sum(",
"- 1",
"- for a, b, c in product(",
"- list(range(A + 1)), lis... | false | 0.063831 | 0.255722 | 0.249613 | [
"s263622173",
"s879162399"
] |
u241159583 | p02802 | python | s038488665 | s689750897 | 252 | 233 | 31,876 | 33,276 | Accepted | Accepted | 7.54 | n,m = list(map(int, input().split()))
ps = [list(input().split()) for _ in range(m)]
ac = [0] * (n+1)
pena = [0] * (n+1)
for p,s in ps:
p = int(p)
if ac[p] == 0:
if s == "WA": pena[p] += 1
else: ac[p] = 1
ans = [0,0]
for i in range(1,n+1):
if ac[i] == 1:
ans[0] += 1
... | n,m = list(map(int, input().split()))
ps = [list(input().split()) for _ in range(m)]
ac = [0] * (n+1)
pena = [0] * (n+1)
for p,s in ps:
p = int(p)
if s == "AC":
ac[p] = 1
continue
if ac[p] == 0:
pena[p] += 1
ans = [0,0]
for x,y in zip(ac[1:],pena[1:]):
if x == 1:
... | 16 | 18 | 369 | 386 | n, m = list(map(int, input().split()))
ps = [list(input().split()) for _ in range(m)]
ac = [0] * (n + 1)
pena = [0] * (n + 1)
for p, s in ps:
p = int(p)
if ac[p] == 0:
if s == "WA":
pena[p] += 1
else:
ac[p] = 1
ans = [0, 0]
for i in range(1, n + 1):
if ac[i] == 1:
... | n, m = list(map(int, input().split()))
ps = [list(input().split()) for _ in range(m)]
ac = [0] * (n + 1)
pena = [0] * (n + 1)
for p, s in ps:
p = int(p)
if s == "AC":
ac[p] = 1
continue
if ac[p] == 0:
pena[p] += 1
ans = [0, 0]
for x, y in zip(ac[1:], pena[1:]):
if x == 1:
... | false | 11.111111 | [
"+ if s == \"AC\":",
"+ ac[p] = 1",
"+ continue",
"- if s == \"WA\":",
"- pena[p] += 1",
"- else:",
"- ac[p] = 1",
"+ pena[p] += 1",
"-for i in range(1, n + 1):",
"- if ac[i] == 1:",
"+for x, y in zip(ac[1:], pena[1:]):",
"+ if ... | false | 0.047476 | 0.041526 | 1.143289 | [
"s038488665",
"s689750897"
] |
u832039789 | p03352 | python | s511782481 | s144246995 | 23 | 19 | 3,060 | 2,940 | Accepted | Accepted | 17.39 | x=int(eval(input()))
for i in range(x,0,-1):
for p in range(1,int(i**.5)+1):
for q in range(10):
if i==p**q:
print(i)
break
else:
continue
break
else:
continue
break
| x = int(eval(input()))
res = 0
for i in range(1,int(x**.5)+1):
for j in range(2,1000):
if i ** j > x:
break
res = max(res, i ** j)
print(res)
| 13 | 8 | 272 | 175 | x = int(eval(input()))
for i in range(x, 0, -1):
for p in range(1, int(i**0.5) + 1):
for q in range(10):
if i == p**q:
print(i)
break
else:
continue
break
else:
continue
break
| x = int(eval(input()))
res = 0
for i in range(1, int(x**0.5) + 1):
for j in range(2, 1000):
if i**j > x:
break
res = max(res, i**j)
print(res)
| false | 38.461538 | [
"-for i in range(x, 0, -1):",
"- for p in range(1, int(i**0.5) + 1):",
"- for q in range(10):",
"- if i == p**q:",
"- print(i)",
"- break",
"- else:",
"- continue",
"- break",
"- else:",
"- continue",
"- b... | false | 0.13361 | 0.059839 | 2.232822 | [
"s511782481",
"s144246995"
] |
u241159583 | p03814 | python | s700233283 | s673649659 | 73 | 61 | 3,512 | 4,840 | Accepted | Accepted | 16.44 | s = eval(input())
a = -1
z = 0
for i in range(len(s)):
if s[i] == "A" and a == -1:
a = i
if s[-(i + 1)] == "Z" and z == 0:
z = len(s) - (i + 1)
print((z - a + 1)) | s = list(eval(input()))
a = -1
z = 0
for i in range(len(s)):
if s[i] == "A" and a == -1:
a = i
elif s[i] == "Z":
z = i
print((z - a + 1)) | 9 | 10 | 174 | 151 | s = eval(input())
a = -1
z = 0
for i in range(len(s)):
if s[i] == "A" and a == -1:
a = i
if s[-(i + 1)] == "Z" and z == 0:
z = len(s) - (i + 1)
print((z - a + 1))
| s = list(eval(input()))
a = -1
z = 0
for i in range(len(s)):
if s[i] == "A" and a == -1:
a = i
elif s[i] == "Z":
z = i
print((z - a + 1))
| false | 10 | [
"-s = eval(input())",
"+s = list(eval(input()))",
"- if s[-(i + 1)] == \"Z\" and z == 0:",
"- z = len(s) - (i + 1)",
"+ elif s[i] == \"Z\":",
"+ z = i"
] | false | 0.035505 | 0.037002 | 0.959523 | [
"s700233283",
"s673649659"
] |
u267549387 | p02580 | python | s162774473 | s517925383 | 1,177 | 877 | 157,956 | 84,844 | Accepted | Accepted | 25.49 | #!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(... | #!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(... | 50 | 51 | 1,256 | 1,269 | #!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(args[2])
codList... | #!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(args[2])
codList... | false | 1.960784 | [
"- codList = {}",
"+ codList = set()",
"- codList.setdefault(h, {})",
"- codList[h][w] = item",
"+ codList.add(item)",
"+ # codList.setdefault(h, {})",
"+ # codList[h][w] = item",
"- if row + 1 in codList and column + 1 in codList[row + 1]:",
"+ ... | false | 0.085782 | 0.083021 | 1.033265 | [
"s162774473",
"s517925383"
] |
u120691615 | p03074 | python | s300909256 | s156365347 | 148 | 125 | 4,212 | 7,932 | Accepted | Accepted | 15.54 | n,k = list(map(int,input().split()))
sss = eval(input())
now = 1
cnt = 0
x = []
for i in range(n):
if sss[i] == str(now):
cnt += 1
else:
x.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
x.append(cnt)
if len(x) % 2 == 0:
x.append(0)
Add = 2 * k + 1
a... | n,k = list(map(int,input().split()))
sss = eval(input())
now = 1
cnt = 0
x = []
for i in range(n):
if sss[i] == str(now):
cnt += 1
else:
x.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
x.append(cnt)
if len(x) % 2 == 0:
x.append(0)
Add = 2 * k + 1
a... | 39 | 34 | 625 | 536 | n, k = list(map(int, input().split()))
sss = eval(input())
now = 1
cnt = 0
x = []
for i in range(n):
if sss[i] == str(now):
cnt += 1
else:
x.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
x.append(cnt)
if len(x) % 2 == 0:
x.append(0)
Add = 2 * k + 1
ans = 0
left = 0
right... | n, k = list(map(int, input().split()))
sss = eval(input())
now = 1
cnt = 0
x = []
for i in range(n):
if sss[i] == str(now):
cnt += 1
else:
x.append(cnt)
now = 1 - now
cnt = 1
if cnt != 0:
x.append(cnt)
if len(x) % 2 == 0:
x.append(0)
Add = 2 * k + 1
ans = 0
y = [0]
for i ... | false | 12.820513 | [
"-left = 0",
"-right = 0",
"-tmp = 0",
"+y = [0]",
"+for i in range(len(x)):",
"+ y.append(y[i] + x[i])",
"- nextleft = i",
"- nextright = min(i + Add, len(x))",
"- while nextleft > left:",
"- tmp -= x[left]",
"- left += 1",
"- while nextright > right:",
"- ... | false | 0.040531 | 0.036308 | 1.116329 | [
"s300909256",
"s156365347"
] |
u620084012 | p04043 | python | s016377473 | s867167961 | 1,392 | 17 | 7,528 | 2,940 | Accepted | Accepted | 98.78 | A=sorted(list(map(int, input().split())))
if A[0] == A[1] == 5 and A[2] == 7:
print("YES")
else:
print("NO") | import sys, math
def input():
return sys.stdin.readline()[:-1]
def main():
A = list(map(int,input().split()))
if A.count(5) == 2 and A.count(7) == 1:
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
| 6 | 14 | 122 | 267 | A = sorted(list(map(int, input().split())))
if A[0] == A[1] == 5 and A[2] == 7:
print("YES")
else:
print("NO")
| import sys, math
def input():
return sys.stdin.readline()[:-1]
def main():
A = list(map(int, input().split()))
if A.count(5) == 2 and A.count(7) == 1:
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| false | 57.142857 | [
"-A = sorted(list(map(int, input().split())))",
"-if A[0] == A[1] == 5 and A[2] == 7:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+import sys, math",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+def main():",
"+ A = list(map(int, input().... | false | 0.046208 | 0.045779 | 1.009372 | [
"s016377473",
"s867167961"
] |
u303039933 | p02712 | python | s847645826 | s004940947 | 118 | 32 | 10,728 | 10,572 | Accepted | Accepted | 72.88 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner():
... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner():
... | 115 | 118 | 2,380 | 2,448 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner:
@staticmethod
d... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner:
@staticmethod
d... | false | 2.542373 | [
"- return [eval(input()) for i in range(n)]",
"+ return [Scanner.string() for i in range(n)]",
"- return [int(eval(input())) for i in range(n)]",
"+ return [Scanner.int() for i in range(n)]",
"- ans = 0",
"- for i in range(1, N + 1):",
"- if i % 3 == 0 or i % 5 =... | false | 0.385914 | 0.043186 | 8.936055 | [
"s847645826",
"s004940947"
] |
u340781749 | p04003 | python | s325267431 | s541237451 | 2,191 | 1,350 | 216,480 | 218,540 | Accepted | Accepted | 38.38 | import sys
from collections import deque, defaultdict
def bfs01(s, t, links):
q = deque([(0, s, -1)]) # cost, station, last-company
visited = set()
while q:
d, v, e = q.popleft()
if v == t:
return d
if (v, e) in visited:
continue
visite... | import sys
from collections import deque, defaultdict
def bfs01(s, t, links):
q = deque([(0, s, -1)]) # cost, station, last-company
visited = set()
while q:
d, v, e = q.popleft()
if v == t:
return d
if (v, e) in visited:
continue
visite... | 45 | 42 | 1,173 | 1,110 | import sys
from collections import deque, defaultdict
def bfs01(s, t, links):
q = deque([(0, s, -1)]) # cost, station, last-company
visited = set()
while q:
d, v, e = q.popleft()
if v == t:
return d
if (v, e) in visited:
continue
visited.add((v, e))... | import sys
from collections import deque, defaultdict
def bfs01(s, t, links):
q = deque([(0, s, -1)]) # cost, station, last-company
visited = set()
while q:
d, v, e = q.popleft()
if v == t:
return d
if (v, e) in visited:
continue
visited.add((v, e))... | false | 6.666667 | [
"- lv = links[v]",
"- for c in lv:",
"- for u in lv[c]:",
"- if (u, c) in visited:",
"- continue",
"- q.append((d + 1, u, c))",
"+ for c in links[v]:",
"+ for u in links[v][c]:",... | false | 0.038305 | 0.038013 | 1.007694 | [
"s325267431",
"s541237451"
] |
u141610915 | p02883 | python | s786478621 | s754801946 | 597 | 313 | 107,084 | 102,724 | Accepted | Accepted | 47.57 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse = True)
res = 0
l = 0
r = 10 ** 12
m = int((l + r) / 2)
c = 0
if sum(a) <= K:
print((0))
exit(0)
def check(x):
k = K + 0
f... | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort(reverse = True)
def check(x):
k = K
for i in range(N):
if a[i] * b[i] > x: k += (x - a[i] * b[i]) // b[i]
return k >= 0
ok = 10 *... | 33 | 21 | 640 | 419 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
res = 0
l = 0
r = 10**12
m = int((l + r) / 2)
c = 0
if sum(a) <= K:
print((0))
exit(0)
def check(x):
k = K + 0
for i in ra... | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort(reverse=True)
def check(x):
k = K
for i in range(N):
if a[i] * b[i] > x:
k += (x - a[i] * b[i]) // b[i]
return k >= 0
... | false | 36.363636 | [
"-f = list(map(int, input().split()))",
"+b = list(map(int, input().split()))",
"-f.sort(reverse=True)",
"-res = 0",
"-l = 0",
"-r = 10**12",
"-m = int((l + r) / 2)",
"-c = 0",
"-if sum(a) <= K:",
"- print((0))",
"- exit(0)",
"+b.sort(reverse=True)",
"- k = K + 0",
"+ k = K",
... | false | 0.037912 | 0.038267 | 0.990732 | [
"s786478621",
"s754801946"
] |
u024807881 | p03102 | python | s840617761 | s263318608 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))
count = 0
for _ in range(n):
if sum(x * y for x, y in zip(list(map(int, input().split())), bs)) + c > 0:
count += 1
print(count)
| from sys import stdin
def na():
return list(map(int, stdin.readline().split()))
n, _, c = na()
bs = tuple(na())
cnt = 0
for _ in range(n):
if sum(x * y for x, y in zip(na(), bs)) > -c:
cnt += 1
print(cnt)
| 9 | 16 | 219 | 236 | n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))
count = 0
for _ in range(n):
if sum(x * y for x, y in zip(list(map(int, input().split())), bs)) + c > 0:
count += 1
print(count)
| from sys import stdin
def na():
return list(map(int, stdin.readline().split()))
n, _, c = na()
bs = tuple(na())
cnt = 0
for _ in range(n):
if sum(x * y for x, y in zip(na(), bs)) > -c:
cnt += 1
print(cnt)
| false | 43.75 | [
"-n, _, c = list(map(int, input().split()))",
"-bs = tuple(map(int, input().split()))",
"-count = 0",
"+from sys import stdin",
"+",
"+",
"+def na():",
"+ return list(map(int, stdin.readline().split()))",
"+",
"+",
"+n, _, c = na()",
"+bs = tuple(na())",
"+cnt = 0",
"- if sum(x * y f... | false | 0.050869 | 0.048053 | 1.058614 | [
"s840617761",
"s263318608"
] |
u794173881 | p03003 | python | s417392541 | s463701726 | 361 | 327 | 72,412 | 72,668 | Accepted | Accepted | 9.42 | n, m = list(map(int, input().split()))
s = list(map(str, input().split()))
t = list(map(str, input().split()))
MOD = 10**9 + 7
def count_cs(str1, str2, MOD):
'''
計算量O(len(str1)*len(str2))
'''
dp = [[0]*(len(str2) + 1) for _ in range(len(str1) + 1)]
for i in range(len(str1)):
for ... | n, m = list(map(int, input().split()))
s = list(map(int, input().split()))
t = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0]*(m+1) for i in range(n+1)]
for si in range(n+1):
dp[si][0] = 1
for ti in range(m+1):
dp[0][ti] = 1
for si in range(n):
for ti in range(m):
if s[si] ... | 20 | 21 | 630 | 566 | n, m = list(map(int, input().split()))
s = list(map(str, input().split()))
t = list(map(str, input().split()))
MOD = 10**9 + 7
def count_cs(str1, str2, MOD):
"""
計算量O(len(str1)*len(str2))
"""
dp = [[0] * (len(str2) + 1) for _ in range(len(str1) + 1)]
for i in range(len(str1)):
for j in ran... | n, m = list(map(int, input().split()))
s = list(map(int, input().split()))
t = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (m + 1) for i in range(n + 1)]
for si in range(n + 1):
dp[si][0] = 1
for ti in range(m + 1):
dp[0][ti] = 1
for si in range(n):
for ti in range(m):
if s[si] == t[... | false | 4.761905 | [
"-s = list(map(str, input().split()))",
"-t = list(map(str, input().split()))",
"+s = list(map(int, input().split()))",
"+t = list(map(int, input().split()))",
"-",
"-",
"-def count_cs(str1, str2, MOD):",
"- \"\"\"",
"- 計算量O(len(str1)*len(str2))",
"- \"\"\"",
"- dp = [[0] * (len(str2... | false | 0.042749 | 0.112269 | 0.380772 | [
"s417392541",
"s463701726"
] |
u562935282 | p03284 | python | s757499685 | s370063972 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n, k = list(map(int, input().split()))
ans = 0 if n % k == 0 else 1
print(ans) | n, k = list(map(int, input().split()))
print((0 if n % k == 0 else 1)) | 3 | 2 | 74 | 63 | n, k = list(map(int, input().split()))
ans = 0 if n % k == 0 else 1
print(ans)
| n, k = list(map(int, input().split()))
print((0 if n % k == 0 else 1))
| false | 33.333333 | [
"-ans = 0 if n % k == 0 else 1",
"-print(ans)",
"+print((0 if n % k == 0 else 1))"
] | false | 0.06573 | 0.065789 | 0.999106 | [
"s757499685",
"s370063972"
] |
u197615397 | p02345 | python | s168038441 | s076834375 | 1,200 | 1,090 | 16,364 | 16,368 | Accepted | Accepted | 9.17 | import math
class SegmentTree:
__slots__ = ["elem_size", "tree_size", "tree", "default", "op"]
def __init__(self, a: list, default: int, op):
real_size = len(a)
self.elem_size = 1 << math.ceil(math.log2(real_size))
self.tree_size = 2 * self.elem_size
self.tree = [default... | import math
import sys
def make_tree(a: list, default: int, op):
real_size = len(a)
elem_size = 1 << math.ceil(math.log2(real_size))
tree = [default] * elem_size + a + [default] * (elem_size - real_size)
for i in range(elem_size-1, 0, -1):
left, right = tree[i << 1], tree[(i << 1) + 1... | 65 | 49 | 2,098 | 1,395 | import math
class SegmentTree:
__slots__ = ["elem_size", "tree_size", "tree", "default", "op"]
def __init__(self, a: list, default: int, op):
real_size = len(a)
self.elem_size = 1 << math.ceil(math.log2(real_size))
self.tree_size = 2 * self.elem_size
self.tree = (
... | import math
import sys
def make_tree(a: list, default: int, op):
real_size = len(a)
elem_size = 1 << math.ceil(math.log2(real_size))
tree = [default] * elem_size + a + [default] * (elem_size - real_size)
for i in range(elem_size - 1, 0, -1):
left, right = tree[i << 1], tree[(i << 1) + 1]
... | false | 24.615385 | [
"+import sys",
"-class SegmentTree:",
"- __slots__ = [\"elem_size\", \"tree_size\", \"tree\", \"default\", \"op\"]",
"-",
"- def __init__(self, a: list, default: int, op):",
"- real_size = len(a)",
"- self.elem_size = 1 << math.ceil(math.log2(real_size))",
"- self.tree_size ... | false | 0.119419 | 0.037211 | 3.209224 | [
"s168038441",
"s076834375"
] |
u863370423 | p03564 | python | s245538050 | s523208921 | 20 | 11 | 2,940 | 2,568 | Accepted | Accepted | 45 | n = int(eval(input()))
k = int(eval(input()))
val = 1
for i in range(n):
if val > k:
val += k
else:
val *= 2
print(val) | x = int(input())
y = int(input())
d = 1
for i in range(0, x):
if y > d:
d += d
else:
d += y
print(d)
| 12 | 9 | 127 | 123 | n = int(eval(input()))
k = int(eval(input()))
val = 1
for i in range(n):
if val > k:
val += k
else:
val *= 2
print(val)
| x = int(input())
y = int(input())
d = 1
for i in range(0, x):
if y > d:
d += d
else:
d += y
print(d)
| false | 25 | [
"-n = int(eval(input()))",
"-k = int(eval(input()))",
"-val = 1",
"-for i in range(n):",
"- if val > k:",
"- val += k",
"+x = int(input())",
"+y = int(input())",
"+d = 1",
"+for i in range(0, x):",
"+ if y > d:",
"+ d += d",
"- val *= 2",
"-print(val)",
"+ ... | false | 0.061819 | 0.036801 | 1.679826 | [
"s245538050",
"s523208921"
] |
u692453235 | p02972 | python | s411515248 | s025550944 | 1,029 | 277 | 14,120 | 14,056 | Accepted | Accepted | 73.08 | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
ans = []
for i in range(N, 0, -1):
j = 1
cnt = 0
while i * j <= N:
cnt += B[(i*j) - 1]
j += 1
cnt %= 2
B[i-1] = A[i-1] ^ cnt #排他的論理和XOR
if B[i-1] == 1:
ans.append(i)
print((sum(B)))
print((*ans)) | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
ans = []
for i in range(N, 0, -1):
cnt = sum(B[(i-1)::i])%2
B[i-1] = A[i-1] ^ cnt
if B[i-1]:
ans.append(i)
print((sum(B)))
print((*ans)) | 21 | 13 | 309 | 221 | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
ans = []
for i in range(N, 0, -1):
j = 1
cnt = 0
while i * j <= N:
cnt += B[(i * j) - 1]
j += 1
cnt %= 2
B[i - 1] = A[i - 1] ^ cnt # 排他的論理和XOR
if B[i - 1] == 1:
ans.append(i)
print((sum(B)))
print((*a... | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
ans = []
for i in range(N, 0, -1):
cnt = sum(B[(i - 1) :: i]) % 2
B[i - 1] = A[i - 1] ^ cnt
if B[i - 1]:
ans.append(i)
print((sum(B)))
print((*ans))
| false | 38.095238 | [
"- j = 1",
"- cnt = 0",
"- while i * j <= N:",
"- cnt += B[(i * j) - 1]",
"- j += 1",
"- cnt %= 2",
"- B[i - 1] = A[i - 1] ^ cnt # 排他的論理和XOR",
"- if B[i - 1] == 1:",
"+ cnt = sum(B[(i - 1) :: i]) % 2",
"+ B[i - 1] = A[i - 1] ^ cnt",
"+ if B[i - 1]:"
] | false | 0.038746 | 0.038953 | 0.994699 | [
"s411515248",
"s025550944"
] |
u186838327 | p03163 | python | s956064360 | s172266934 | 507 | 286 | 120,684 | 92,056 | Accepted | Accepted | 43.59 | n, W = list(map(int, input().split()))
ws = [0]*n
vs = [0]*n
for i in range(n):
w, v = list(map(int, input().split()))
ws[i] = w
vs[i] = v
dp = [[0]*(W+1) for _ in range(n+1)]
for i in range(n):
for j in range(W+1):
if j - ws[i] >= 0:
dp[i+1][j] = max(dp[i+1][j], dp[i][j-ws[i]]+vs[i])... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros((N+1, W+1), dtype='uint64')
for i in range(N):
w, v = list(map(int, input().split()))
dp[i+1][:w] = dp[i][:w]
dp[i+1][w:] = np.maximum(dp[i][w:], dp[i][:-w]+v)
print((np.max(dp[N, :]))) | 17 | 12 | 376 | 266 | n, W = list(map(int, input().split()))
ws = [0] * n
vs = [0] * n
for i in range(n):
w, v = list(map(int, input().split()))
ws[i] = w
vs[i] = v
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(n):
for j in range(W + 1):
if j - ws[i] >= 0:
dp[i + 1][j] = max(dp[i + 1][j], dp[i... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros((N + 1, W + 1), dtype="uint64")
for i in range(N):
w, v = list(map(int, input().split()))
dp[i + 1][:w] = dp[i][:w]
dp[i + 1][w:] = np.maximum(dp[i][w:], dp[i][:-w] + v)
print((np.max(dp[N, :])))
| false | 29.411765 | [
"-n, W = list(map(int, input().split()))",
"-ws = [0] * n",
"-vs = [0] * n",
"-for i in range(n):",
"+import numpy as np",
"+",
"+N, W = list(map(int, input().split()))",
"+dp = np.zeros((N + 1, W + 1), dtype=\"uint64\")",
"+for i in range(N):",
"- ws[i] = w",
"- vs[i] = v",
"-dp = [[0] ... | false | 0.114359 | 0.464824 | 0.246027 | [
"s956064360",
"s172266934"
] |
u309834353 | p03162 | python | s260307317 | s227965099 | 1,090 | 672 | 56,420 | 76,632 | Accepted | Accepted | 38.35 | import sys
import numpy as np
n = int(eval(input()))
days = []
for _ in range(n):
day = list(map(int, input().split()))
days.append(day)
dp = [[10000] * 3 for _ in range(n)]
# 1日目
dp[0][0] = days[0][0]
dp[0][1] = days[0][1]
dp[0][2] = days[0][2]
for d in range(1,n):
for i in range(3):
... | n = int(eval(input()))
hh = []
for i in range(n):
h = list(map(int, input().split()))
hh.append(h)
c = [[0 for j in range(3)] for i in range(n)]
for i in range(3):
c[0][i] = hh[0][i]
for i in range(1,n):
c[i][0] = max(c[i-1][1], c[i-1][2]) + hh[i][0]
c[i][1] = max(c[i-1][0], c[i-1][2]... | 25 | 15 | 540 | 397 | import sys
import numpy as np
n = int(eval(input()))
days = []
for _ in range(n):
day = list(map(int, input().split()))
days.append(day)
dp = [[10000] * 3 for _ in range(n)]
# 1日目
dp[0][0] = days[0][0]
dp[0][1] = days[0][1]
dp[0][2] = days[0][2]
for d in range(1, n):
for i in range(3):
mx = 0
... | n = int(eval(input()))
hh = []
for i in range(n):
h = list(map(int, input().split()))
hh.append(h)
c = [[0 for j in range(3)] for i in range(n)]
for i in range(3):
c[0][i] = hh[0][i]
for i in range(1, n):
c[i][0] = max(c[i - 1][1], c[i - 1][2]) + hh[i][0]
c[i][1] = max(c[i - 1][0], c[i - 1][2]) + hh... | false | 40 | [
"-import sys",
"-import numpy as np",
"-",
"-days = []",
"-for _ in range(n):",
"- day = list(map(int, input().split()))",
"- days.append(day)",
"-dp = [[10000] * 3 for _ in range(n)]",
"-# 1日目",
"-dp[0][0] = days[0][0]",
"-dp[0][1] = days[0][1]",
"-dp[0][2] = days[0][2]",
"-for d in r... | false | 0.036083 | 0.036107 | 0.999325 | [
"s260307317",
"s227965099"
] |
u256315261 | p02990 | python | s867656046 | s629639056 | 882 | 274 | 3,316 | 5,364 | Accepted | Accepted | 68.93 | import math
def bi(x, y):
if x < y or y < 0 or x < 0: return 0
if y == 0: return 1
return math.factorial(x) // math.factorial(y) // math.factorial(x - y)
n, k = list(map(int, input().split(' ')))
for i in range(1, k + 1):
print((bi(k - 1, i - 1) * bi(n - k + 1, i) % (10**9 + 7)))
| def BC132_D():
n, k = list(map(int, input().split(' ')))
f = [1] * max(k, n - k + 2)
for i in range(1, len(f)):
f[i] = f[i - 1] * i
def comb(n, r):
if n < r: return 0
return f[n] // f[r] // f[n - r]
for i in range(1, k + 1):
print((comb(k - 1, i - 1) * co... | 9 | 14 | 296 | 364 | import math
def bi(x, y):
if x < y or y < 0 or x < 0:
return 0
if y == 0:
return 1
return math.factorial(x) // math.factorial(y) // math.factorial(x - y)
n, k = list(map(int, input().split(" ")))
for i in range(1, k + 1):
print((bi(k - 1, i - 1) * bi(n - k + 1, i) % (10**9 + 7)))
| def BC132_D():
n, k = list(map(int, input().split(" ")))
f = [1] * max(k, n - k + 2)
for i in range(1, len(f)):
f[i] = f[i - 1] * i
def comb(n, r):
if n < r:
return 0
return f[n] // f[r] // f[n - r]
for i in range(1, k + 1):
print((comb(k - 1, i - 1) * c... | false | 35.714286 | [
"-import math",
"+def BC132_D():",
"+ n, k = list(map(int, input().split(\" \")))",
"+ f = [1] * max(k, n - k + 2)",
"+ for i in range(1, len(f)):",
"+ f[i] = f[i - 1] * i",
"+",
"+ def comb(n, r):",
"+ if n < r:",
"+ return 0",
"+ return f[n] // f[r] ... | false | 0.084946 | 0.144565 | 0.587594 | [
"s867656046",
"s629639056"
] |
u102242691 | p03095 | python | s889856693 | s492171955 | 62 | 28 | 4,084 | 4,340 | Accepted | Accepted | 54.84 |
n = int(eval(input()))
s = list(eval(input()))
t = []
ans = 1
count= []
t = set(s)
t = list(t)
for i in range(len(t)):
count.append(s.count(t[i]))
for j in range(len(count)):
ans *= (count[j] + 1)
print(((ans-1)%(10**9 + 7)))
|
import collections
n = int(eval(input()))
s = list(eval(input()))
ans = 1
c = collections.Counter(s)
for i in set(s):
ans *= (c[i] + 1)
print(((ans - 1) % (pow(10, 9) + 7)))
| 17 | 10 | 241 | 175 | n = int(eval(input()))
s = list(eval(input()))
t = []
ans = 1
count = []
t = set(s)
t = list(t)
for i in range(len(t)):
count.append(s.count(t[i]))
for j in range(len(count)):
ans *= count[j] + 1
print(((ans - 1) % (10**9 + 7)))
| import collections
n = int(eval(input()))
s = list(eval(input()))
ans = 1
c = collections.Counter(s)
for i in set(s):
ans *= c[i] + 1
print(((ans - 1) % (pow(10, 9) + 7)))
| false | 41.176471 | [
"+import collections",
"+",
"-t = []",
"-count = []",
"-t = set(s)",
"-t = list(t)",
"-for i in range(len(t)):",
"- count.append(s.count(t[i]))",
"-for j in range(len(count)):",
"- ans *= count[j] + 1",
"-print(((ans - 1) % (10**9 + 7)))",
"+c = collections.Counter(s)",
"+for i in set(... | false | 0.037505 | 0.035789 | 1.047926 | [
"s889856693",
"s492171955"
] |
u778814286 | p03044 | python | s577680651 | s923676784 | 1,209 | 582 | 156,188 | 80,668 | Accepted | Accepted | 51.86 | ###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return list(map(int, input().split()))
###template###
import sys
sys.setrecursionlimit(10000000)
N = int(eval(input()))
adj = [set() for _ in range(N)] #adj[i] = (i_adj, 距離0or1)
for _ in range(N-1):
u, v, w = mi()
#... | ###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return list(map(int, input().split()))
###template###
N = int(eval(input()))
adj = [set() for _ in range(N)] #adj[i] = (i_adj, 距離0or1)
for _ in range(N-1):
u, v, w = mi()
#0スタートに
u -= 1
v -= 1
adj[u].add((v, ... | 51 | 41 | 904 | 738 | ###template###
import sys
def input():
return sys.stdin.readline().rstrip()
def mi():
return list(map(int, input().split()))
###template###
import sys
sys.setrecursionlimit(10000000)
N = int(eval(input()))
adj = [set() for _ in range(N)] # adj[i] = (i_adj, 距離0or1)
for _ in range(N - 1):
u, v, w = mi... | ###template###
import sys
def input():
return sys.stdin.readline().rstrip()
def mi():
return list(map(int, input().split()))
###template###
N = int(eval(input()))
adj = [set() for _ in range(N)] # adj[i] = (i_adj, 距離0or1)
for _ in range(N - 1):
u, v, w = mi()
# 0スタートに
u -= 1
v -= 1
ad... | false | 19.607843 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10000000)",
"-seen = [0] * N",
"-bw = [0] * N",
"+seen = [-1] * N # 色を兼ねる。0or1",
"-bw[0] = 0 # 必要無いが、分かりやすくするために",
"-seen[0] = 1",
"-",
"-",
"-def solve(): # 前のノードまでの色(0or1)を引き継ぐ",
"- try:",
"- nownode = q.popleft()",
"- except:",... | false | 0.036918 | 0.046058 | 0.801558 | [
"s577680651",
"s923676784"
] |
u191874006 | p03014 | python | s907014702 | s464823794 | 1,504 | 1,314 | 348,424 | 312,584 | Accepted | Accepted | 12.63 | #!/usr/bin/env python3
#ABC129 D
H,W = list(map(int,input().split()))
Lamp = [list(eval(input())) for _ in range(H)]
field = [[True for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if Lamp[i][j] == '#':
field[i][j] = False
L = [[1 for _ in range(W)... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from co... | 39 | 62 | 1,165 | 1,785 | #!/usr/bin/env python3
# ABC129 D
H, W = list(map(int, input().split()))
Lamp = [list(eval(input())) for _ in range(H)]
field = [[True for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if Lamp[i][j] == "#":
field[i][j] = False
L = [[1 for _ in range(W)] for _ in range(H... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections ... | false | 37.096774 | [
"-# ABC129 D",
"-H, W = list(map(int, input().split()))",
"-Lamp = [list(eval(input())) for _ in range(H)]",
"-field = [[True for _ in range(W)] for _ in range(H)]",
"-for i in range(H):",
"- for j in range(W):",
"- if Lamp[i][j] == \"#\":",
"- field[i][j] = False",
"-L = [[1 fo... | false | 0.158648 | 0.101528 | 1.562598 | [
"s907014702",
"s464823794"
] |
u729133443 | p02964 | python | s697138332 | s332112387 | 1,106 | 1,018 | 105,764 | 105,764 | Accepted | Accepted | 7.96 | n,k,*a=list(map(int,open(0).read().split()))
l,r,*b=[[]for _ in range(10**6)]
for i,v in enumerate(a):
b[v]+=i,
l+=len(b[v]),
s=a[0]
i=c=0
while i<n:
j=l[i]%len(b[s])
c+=j<1
i=b[s][j]+1
s=a[i%n]
k%=c+1
i=c=0
while i<n:
j=l[i]%len(b[s])
if(c>k-2)>j:
r+=s,
i+=1
else:i=b[s][j]+... | n,k,*a=list(map(int,open(0).read().split()))
l,r,*b=[[]for _ in range(10**6)]
for i,v in enumerate(a):
b[v]+=i,
l+=len(b[v]),
s=a[0]
i=c=0
while 1:
j=l[i]%len(b[s])
if(c>k-2)>j:
r+=s,
i+=1
else:i=b[s][j]+1
c+=j<1
if i==n:
if c>k-2:break
k%=c+1
i=c=0
s=a[i]
print((*... | 23 | 20 | 348 | 315 | n, k, *a = list(map(int, open(0).read().split()))
l, r, *b = [[] for _ in range(10**6)]
for i, v in enumerate(a):
b[v] += (i,)
l += (len(b[v]),)
s = a[0]
i = c = 0
while i < n:
j = l[i] % len(b[s])
c += j < 1
i = b[s][j] + 1
s = a[i % n]
k %= c + 1
i = c = 0
while i < n:
j = l[i] % len(b[s])... | n, k, *a = list(map(int, open(0).read().split()))
l, r, *b = [[] for _ in range(10**6)]
for i, v in enumerate(a):
b[v] += (i,)
l += (len(b[v]),)
s = a[0]
i = c = 0
while 1:
j = l[i] % len(b[s])
if (c > k - 2) > j:
r += (s,)
i += 1
else:
i = b[s][j] + 1
c += j < 1
if i... | false | 13.043478 | [
"-while i < n:",
"- j = l[i] % len(b[s])",
"- c += j < 1",
"- i = b[s][j] + 1",
"- s = a[i % n]",
"-k %= c + 1",
"-i = c = 0",
"-while i < n:",
"+while 1:",
"- s = a[i % n]",
"+ if i == n:",
"+ if c > k - 2:",
"+ break",
"+ k %= c + 1",
"+ ... | false | 1.002792 | 0.801324 | 1.251419 | [
"s697138332",
"s332112387"
] |
u968846084 | p02814 | python | s652829989 | s675232344 | 359 | 202 | 89,184 | 16,280 | Accepted | Accepted | 43.73 | import copy
import fractions
import sys
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
a=copy.copy(A[0])
c=0
while a%2==0:
a=a//2
c=c+1
d=2**c
for i in range(n):
if A[i]//d!=float(A[i])/d or A[i]//(2*d)==float(A[i])/(2*d):
print((0))
sys.exit()
B=[]
for i in range(n):
... | import sys
import fractions as f
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
a=A[0]
b=0
while a%2==0:
a=a//2
b=b+1
b=2**b
B=[0]*n
for i in range(n):
B[i]=A[i]//b
if B[i]*b!=A[i] or B[i]%2==0:
print((0))
sys.exit()
G=1
for i in range(n):
G=G*B[i]//(f.gcd(G,B[i]... | 28 | 20 | 486 | 345 | import copy
import fractions
import sys
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
a = copy.copy(A[0])
c = 0
while a % 2 == 0:
a = a // 2
c = c + 1
d = 2**c
for i in range(n):
if A[i] // d != float(A[i]) / d or A[i] // (2 * d) == float(A[i]) / (2 * d):
print((0))
... | import sys
import fractions as f
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
a = A[0]
b = 0
while a % 2 == 0:
a = a // 2
b = b + 1
b = 2**b
B = [0] * n
for i in range(n):
B[i] = A[i] // b
if B[i] * b != A[i] or B[i] % 2 == 0:
print((0))
sys.exit()
G = 1
fo... | false | 28.571429 | [
"-import copy",
"-import fractions",
"+import fractions as f",
"-a = copy.copy(A[0])",
"-c = 0",
"+a = A[0]",
"+b = 0",
"- c = c + 1",
"-d = 2**c",
"+ b = b + 1",
"+b = 2**b",
"+B = [0] * n",
"- if A[i] // d != float(A[i]) / d or A[i] // (2 * d) == float(A[i]) / (2 * d):",
"+ B... | false | 0.048006 | 0.052719 | 0.910607 | [
"s652829989",
"s675232344"
] |
u691018832 | p02694 | python | s380461659 | s851680994 | 65 | 22 | 63,484 | 9,112 | Accepted | Accepted | 66.15 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from math import floor
x = int(readline())
v = 100
for i in range(x):
v = floor(v * 1.01)
if v >= x:
print((i + 1))
exit()
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from math import floor
x = int(read())
v = 100
for i in range(x):
v = floor(v * 1.01)
if v >= x:
print((i + 1))
exit()
| 15 | 15 | 308 | 304 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from math import floor
x = int(readline())
v = 100
for i in range(x):
v = floor(v * 1.01)
if v >= x:
print((i + 1))
exit()
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from math import floor
x = int(read())
v = 100
for i in range(x):
v = floor(v * 1.01)
if v >= x:
print((i + 1))
exit()
| false | 0 | [
"-x = int(readline())",
"+x = int(read())"
] | false | 0.037636 | 0.038304 | 0.982566 | [
"s380461659",
"s851680994"
] |
u193182854 | p02792 | python | s970925545 | s384679444 | 231 | 138 | 3,064 | 9,160 | Accepted | Accepted | 40.26 | n = int(eval(input()))
table = [[0 for _ in range(9)] for _ in range(9)]
for i in range(1, n+1):
s = str(i)
f, l = s[0], s[-1]
if "0" in [f, l]: continue
table[int(f)-1][int(l)-1] += 1
ans = 0
for i in range(9):
for j in range(9):
ans += table[i][j] * table[j][i]
print(ans)
| n = int(eval(input()))
t = [[0] * 10 for _ in range(10)]
for i in range(1, n+1):
si = str(i)
t[int(si[0])][int(si[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += t[i][j] * t[j][i]
print(ans)
| 15 | 13 | 314 | 238 | n = int(eval(input()))
table = [[0 for _ in range(9)] for _ in range(9)]
for i in range(1, n + 1):
s = str(i)
f, l = s[0], s[-1]
if "0" in [f, l]:
continue
table[int(f) - 1][int(l) - 1] += 1
ans = 0
for i in range(9):
for j in range(9):
ans += table[i][j] * table[j][i]
print(ans)
| n = int(eval(input()))
t = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
si = str(i)
t[int(si[0])][int(si[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += t[i][j] * t[j][i]
print(ans)
| false | 13.333333 | [
"-table = [[0 for _ in range(9)] for _ in range(9)]",
"+t = [[0] * 10 for _ in range(10)]",
"- s = str(i)",
"- f, l = s[0], s[-1]",
"- if \"0\" in [f, l]:",
"- continue",
"- table[int(f) - 1][int(l) - 1] += 1",
"+ si = str(i)",
"+ t[int(si[0])][int(si[-1])] += 1",
"-for i ... | false | 0.152954 | 0.142471 | 1.073579 | [
"s970925545",
"s384679444"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.