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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u073852194 | p03283 | python | s890834094 | s757154999 | 1,449 | 510 | 111,192 | 55,516 | Accepted | Accepted | 64.8 | N,M,Q = list(map(int,input().split()))
Train = [list(map(int,input().split())) for i in range(M)]
Query = [list(map(int,input().split())) for i in range(Q)]
City = [[0]*N for i in range(N)]
Accum = [[0]*(N+1) for i in range(N+1)]
for train in Train:
City[train[0]-1][train[1]-1] += 1
for i in range(N):
... | import sys
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
D = [[0 for j in range(N)] for i in range(N)]
for _ in range(M):
l, r = list(map(int, input().split()))
D[l - 1][r - 1] += 1
for i in range(N):
for j in range(1, N):
D[i][j] += D[i][j - 1]
for j in ra... | 24 | 22 | 635 | 469 | N, M, Q = list(map(int, input().split()))
Train = [list(map(int, input().split())) for i in range(M)]
Query = [list(map(int, input().split())) for i in range(Q)]
City = [[0] * N for i in range(N)]
Accum = [[0] * (N + 1) for i in range(N + 1)]
for train in Train:
City[train[0] - 1][train[1] - 1] += 1
for i in range(... | import sys
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
D = [[0 for j in range(N)] for i in range(N)]
for _ in range(M):
l, r = list(map(int, input().split()))
D[l - 1][r - 1] += 1
for i in range(N):
for j in range(1, N):
D[i][j] += D[i][j - 1]
for j in range(N):
for i i... | false | 8.333333 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-Train = [list(map(int, input().split())) for i in range(M)]",
"-Query = [list(map(int, input().split())) for i in range(Q)]",
"-City = [[0] * N for i in range(N)]",
"-Accum = [[0] * (N + 1) for i in range(N + 1)]",
"-for train in Train:",
"- Ci... | false | 0.110835 | 0.037779 | 2.933776 | [
"s890834094",
"s757154999"
] |
u600402037 | p03722 | python | s006774591 | s638795833 | 592 | 208 | 3,316 | 14,072 | Accepted | Accepted | 64.86 | N, M = list(map(int, input().split()))
edges = []
for i in range(M):
a, b, c = list(map(int, input().split()))
edges.append((a, b, c))
edges.sort()
def bellmanford(n, edges, start):
INF = float('inf')
dist = [-INF] * (n+1) # dist[0]は使わない
dist[start] = 0
for i in range(n):
... | # D - Score Attack
import sys
sys.setrecursionlimit(10 ** 9)
import numpy as np
from heapq import heappush, heappop
N, M, = list(map(int, input().split()))
graph = [[] for _ in range(N+1)] # graph[0]は使わない
for _ in range(M):
a, b, c = list(map(int, input().split()))
graph[a].append((b, c))
def ... | 22 | 35 | 603 | 1,055 | N, M = list(map(int, input().split()))
edges = []
for i in range(M):
a, b, c = list(map(int, input().split()))
edges.append((a, b, c))
edges.sort()
def bellmanford(n, edges, start):
INF = float("inf")
dist = [-INF] * (n + 1) # dist[0]は使わない
dist[start] = 0
for i in range(n):
for (pre, ... | # D - Score Attack
import sys
sys.setrecursionlimit(10**9)
import numpy as np
from heapq import heappush, heappop
(
N,
M,
) = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)] # graph[0]は使わない
for _ in range(M):
a, b, c = list(map(int, input().split()))
graph[a].append((b, c))
def d... | false | 37.142857 | [
"-N, M = list(map(int, input().split()))",
"-edges = []",
"-for i in range(M):",
"+# D - Score Attack",
"+import sys",
"+",
"+sys.setrecursionlimit(10**9)",
"+import numpy as np",
"+from heapq import heappush, heappop",
"+",
"+(",
"+ N,",
"+ M,",
"+) = list(map(int, input().split()))... | false | 0.036684 | 0.195498 | 0.187646 | [
"s006774591",
"s638795833"
] |
u766926358 | p02360 | python | s868965210 | s201940832 | 710 | 560 | 35,820 | 13,648 | Accepted | Accepted | 21.13 | from itertools import accumulate
N = int(eval(input()))
xys = []
m_x = 0
m_y = 0
for i in range(N):
xy = list(map(int, input().split()))
xys += [xy]
x_1,y_1,x_2,y_2 = xy
m_x = max(x_2, m_x)
m_y = max(y_2, m_y)
im = [[0]*(m_x+1) for i in range(m_y+1)]
for xy in xys:
x_1,y_1,x_2,y_2 = xy
im[y... | from itertools import accumulate
im = [[0]*1001 for i in range(1001)]
for x_1, y_1, x_2, y_2 in (list(map(int, input().split())) for _ in range(int(eval(input())))):
im[x_1][y_1] += 1
im[x_1][y_2] -= 1
im[x_2][y_1] -= 1
im[x_2][y_2] += 1
print((max(list(map(max, list(map(accumulate, list(zip(*list(map(accumu... | 25 | 8 | 458 | 302 | from itertools import accumulate
N = int(eval(input()))
xys = []
m_x = 0
m_y = 0
for i in range(N):
xy = list(map(int, input().split()))
xys += [xy]
x_1, y_1, x_2, y_2 = xy
m_x = max(x_2, m_x)
m_y = max(y_2, m_y)
im = [[0] * (m_x + 1) for i in range(m_y + 1)]
for xy in xys:
x_1, y_1, x_2, y_2 =... | from itertools import accumulate
im = [[0] * 1001 for i in range(1001)]
for x_1, y_1, x_2, y_2 in (
list(map(int, input().split())) for _ in range(int(eval(input())))
):
im[x_1][y_1] += 1
im[x_1][y_2] -= 1
im[x_2][y_1] -= 1
im[x_2][y_2] += 1
print(
(max(list(map(max, list(map(accumulate, list(z... | false | 68 | [
"-N = int(eval(input()))",
"-xys = []",
"-m_x = 0",
"-m_y = 0",
"-for i in range(N):",
"- xy = list(map(int, input().split()))",
"- xys += [xy]",
"- x_1, y_1, x_2, y_2 = xy",
"- m_x = max(x_2, m_x)",
"- m_y = max(y_2, m_y)",
"-im = [[0] * (m_x + 1) for i in range(m_y + 1)]",
"-f... | false | 0.169087 | 0.190213 | 0.888936 | [
"s868965210",
"s201940832"
] |
u347640436 | p02900 | python | s072052095 | s849717734 | 130 | 82 | 5,176 | 5,172 | Accepted | Accepted | 36.92 | from fractions import gcd
from math import sqrt
def prime_factorize(n):
result = []
for i in range(2, int(sqrt(n)) + 1):
if n % i != 0:
continue
t = 0
while n % i == 0:
n //= i
t += 1
result.append((i, t))
if n == 1:
... | from fractions import gcd
def prime_factorize(n):
result = []
if n % 2 == 0:
t = 0
while n % 2 == 0:
n //= 2
t += 1
result.append((2, t))
for i in range(3, int(n ** 0.5) + 1, 2):
if n % i != 0:
continue
t = 0
... | 23 | 29 | 484 | 601 | from fractions import gcd
from math import sqrt
def prime_factorize(n):
result = []
for i in range(2, int(sqrt(n)) + 1):
if n % i != 0:
continue
t = 0
while n % i == 0:
n //= i
t += 1
result.append((i, t))
if n == 1:
break... | from fractions import gcd
def prime_factorize(n):
result = []
if n % 2 == 0:
t = 0
while n % 2 == 0:
n //= 2
t += 1
result.append((2, t))
for i in range(3, int(n**0.5) + 1, 2):
if n % i != 0:
continue
t = 0
while n % i == ... | false | 20.689655 | [
"-from math import sqrt",
"- for i in range(2, int(sqrt(n)) + 1):",
"+ if n % 2 == 0:",
"+ t = 0",
"+ while n % 2 == 0:",
"+ n //= 2",
"+ t += 1",
"+ result.append((2, t))",
"+ for i in range(3, int(n**0.5) + 1, 2):"
] | false | 0.063173 | 0.051635 | 1.223454 | [
"s072052095",
"s849717734"
] |
u297574184 | p02792 | python | s536292692 | s932029920 | 325 | 154 | 3,064 | 3,064 | Accepted | Accepted | 52.62 | def solve():
N = int(eval(input()))
numss = [[0]*(10) for _ in range(10)]
for A in range(1, N+1):
ss = str(A)
numss[int(ss[-1])][int(ss[0])] += 1
ans = 0
for A in range(1, N+1):
ss = str(A)
ans += numss[int(ss[0])][int(ss[-1])]
print(ans)
solve(... | def solve():
strN = eval(input())
N = int(strN)
maxD = len(strN)
numss = [[0]*(10) for _ in range(10)]
for x in range(1, 10):
for y in range(1, 10):
num = 0
for d in range(1, maxD-2):
num += 10**d
if maxD-2 > 0:
... | 16 | 37 | 316 | 910 | def solve():
N = int(eval(input()))
numss = [[0] * (10) for _ in range(10)]
for A in range(1, N + 1):
ss = str(A)
numss[int(ss[-1])][int(ss[0])] += 1
ans = 0
for A in range(1, N + 1):
ss = str(A)
ans += numss[int(ss[0])][int(ss[-1])]
print(ans)
solve()
| def solve():
strN = eval(input())
N = int(strN)
maxD = len(strN)
numss = [[0] * (10) for _ in range(10)]
for x in range(1, 10):
for y in range(1, 10):
num = 0
for d in range(1, maxD - 2):
num += 10**d
if maxD - 2 > 0:
if x <... | false | 56.756757 | [
"- N = int(eval(input()))",
"+ strN = eval(input())",
"+ N = int(strN)",
"+ maxD = len(strN)",
"- for A in range(1, N + 1):",
"- ss = str(A)",
"- numss[int(ss[-1])][int(ss[0])] += 1",
"+ for x in range(1, 10):",
"+ for y in range(1, 10):",
"+ num =... | false | 0.151459 | 0.088413 | 1.713093 | [
"s536292692",
"s932029920"
] |
u847467233 | p00447 | python | s045923645 | s192912947 | 980 | 70 | 5,620 | 5,724 | Accepted | Accepted | 92.86 | # AOJ 0524: Searching Constellation
# Python3 2018.7.1 bal4u
def check(dx, dy):
f = True
for x, y in goal:
if (x+dx, y+dy) not in star:
f = False
break
return f
while True:
m = int(eval(input()))
if m == 0: break
goal, star = [], []
for i in range(m):
x, y = list(map(int, input().spl... | # AOJ 0524: Searching Constellation
# Python3 2018.7.1 bal4u
def check(dx, dy):
f = True
for x, y in goal:
if (x+dx, y+dy) not in tbl:
f = False
break
return f
while True:
m = int(eval(input()))
if m == 0: break
goal, star, tbl = [], [], {}
for i in range(m):
goal.append(tuple(map(in... | 25 | 25 | 531 | 545 | # AOJ 0524: Searching Constellation
# Python3 2018.7.1 bal4u
def check(dx, dy):
f = True
for x, y in goal:
if (x + dx, y + dy) not in star:
f = False
break
return f
while True:
m = int(eval(input()))
if m == 0:
break
goal, star = [], []
for i in rang... | # AOJ 0524: Searching Constellation
# Python3 2018.7.1 bal4u
def check(dx, dy):
f = True
for x, y in goal:
if (x + dx, y + dy) not in tbl:
f = False
break
return f
while True:
m = int(eval(input()))
if m == 0:
break
goal, star, tbl = [], [], {}
for i... | false | 0 | [
"- if (x + dx, y + dy) not in star:",
"+ if (x + dx, y + dy) not in tbl:",
"- goal, star = [], []",
"+ goal, star, tbl = [], [], {}",
"- x, y = list(map(int, input().split()))",
"- goal.append((x, y))",
"+ goal.append(tuple(map(int, input().split())))",
"+ ... | false | 0.111816 | 0.037761 | 2.961114 | [
"s045923645",
"s192912947"
] |
u562935282 | p02972 | python | s735737062 | s928418824 | 1,109 | 479 | 77,180 | 14,132 | Accepted | Accepted | 56.81 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
a = [None] + a
a = tuple(a)
ans = set()
cnt = [0] * (n + 1)
for i in range(n, 0, -1):
if cnt[i] % 2 != a[i] % 2:
ans.add(i)
st = set()
j = 1
while j * j <= i:
... | def main():
N = int(input())
a = [0]
a += map(int, input().split())
b = [0] * (N + 1)
x = N
k = 1
while x > 0:
while x * (k + 1) > N:
t = 0
for j in range(2, k + 1):
t ^= b[x * j]
b[x] = a[x] ^ t
x -= ... | 28 | 43 | 495 | 833 | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
a = [None] + a
a = tuple(a)
ans = set()
cnt = [0] * (n + 1)
for i in range(n, 0, -1):
if cnt[i] % 2 != a[i] % 2:
ans.add(i)
st = set()
j = 1
while j * j <= i:
if i % j == 0:
... | def main():
N = int(input())
a = [0]
a += map(int, input().split())
b = [0] * (N + 1)
x = N
k = 1
while x > 0:
while x * (k + 1) > N:
t = 0
for j in range(2, k + 1):
t ^= b[x * j]
b[x] = a[x] ^ t
x -= 1
k += 1
... | false | 34.883721 | [
"-import sys",
"+def main():",
"+ N = int(input())",
"+ a = [0]",
"+ a += map(int, input().split())",
"+ b = [0] * (N + 1)",
"+ x = N",
"+ k = 1",
"+ while x > 0:",
"+ while x * (k + 1) > N:",
"+ t = 0",
"+ for j in range(2, k + 1):",
"+ ... | false | 0.065196 | 0.036164 | 1.802797 | [
"s735737062",
"s928418824"
] |
u281303342 | p03457 | python | s480616531 | s254879491 | 437 | 247 | 27,380 | 28,080 | Accepted | Accepted | 43.48 | import sys
N = int(eval(input()))
TXY = [list(map(int,input().split())) for _ in range(N)]
t0,x0,y0 = 0,0,0
for i in range(N):
t,x,y = TXY[i][0],TXY[i][1],TXY[i][2]
if t-t0 >= abs(x-x0)+abs(y-y0) and (t-t0)%2 == abs(x-x0+y-y0)%2:
t0,x0,y0 = t,x,y
continue
else:
print("N... | # atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7
# main
N = int(eval(input()))
TXY = [[0,0,0]]+[list(map(int,input().split())) for _ in range(N)]
ans = "Yes"
for i in range(N):
t0,x0,y0 = TXY[i]
t1,x1,y1 = TXY[i+1]
t = t1-t0
d ... | 16 | 21 | 353 | 411 | import sys
N = int(eval(input()))
TXY = [list(map(int, input().split())) for _ in range(N)]
t0, x0, y0 = 0, 0, 0
for i in range(N):
t, x, y = TXY[i][0], TXY[i][1], TXY[i][2]
if t - t0 >= abs(x - x0) + abs(y - y0) and (t - t0) % 2 == abs(x - x0 + y - y0) % 2:
t0, x0, y0 = t, x, y
continue
el... | # atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9 + 7
# main
N = int(eval(input()))
TXY = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
ans = "Yes"
for i in range(N):
t0, x0, y0 = TXY[i]
t1, x1, y1 = TXY[i + 1]
t = t1 - t0
d =... | false | 23.809524 | [
"+# atcoder : python3 (3.4.3)",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**6)",
"+mod = 10**9 + 7",
"+# main",
"-TXY = [list(map(int, input().split())) for _ in range(N)]",
"-t0, x0, y0 = 0, 0, 0",
"+TXY = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]",
"+ans = \"... | false | 0.086602 | 0.040422 | 2.142453 | [
"s480616531",
"s254879491"
] |
u532966492 | p02992 | python | s477532812 | s897813005 | 1,628 | 1,492 | 16,020 | 11,600 | Accepted | Accepted | 8.35 | from itertools import accumulate
N,K=list(map(int,input().split()))
N_s=int(N**0.5)
list_a=[1]*N_s
list_b=[N//j-N_s for j in range(1,N_s+1)]
list_p=[N//j-N_s for j in range(1,N_s+1)]
for p in range(1,len(list_p)):
list_p[p-1]=list_p[p-1]-list_p[p]
for p in range(1,len(list_b)):
list_b[p-1... | from itertools import accumulate as ac
N,K=list(map(int,input().split()))
n=int(N**0.5)
mod=10**9+7
list_a=[1]*n
list_b=[N//j-N//(j+1) for j in range(1,n)]+[(N//n-n)]
list_p=[p for p in list_b]
list_aa=list(ac(list_a))
list_bb=list(reversed(list(ac(reversed(list_b)))))
for i in range(K-1):
temp=sum(list... | 29 | 18 | 834 | 555 | from itertools import accumulate
N, K = list(map(int, input().split()))
N_s = int(N**0.5)
list_a = [1] * N_s
list_b = [N // j - N_s for j in range(1, N_s + 1)]
list_p = [N // j - N_s for j in range(1, N_s + 1)]
for p in range(1, len(list_p)):
list_p[p - 1] = list_p[p - 1] - list_p[p]
for p in range(1, len(list_b))... | from itertools import accumulate as ac
N, K = list(map(int, input().split()))
n = int(N**0.5)
mod = 10**9 + 7
list_a = [1] * n
list_b = [N // j - N // (j + 1) for j in range(1, n)] + [(N // n - n)]
list_p = [p for p in list_b]
list_aa = list(ac(list_a))
list_bb = list(reversed(list(ac(reversed(list_b)))))
for i in ran... | false | 37.931034 | [
"-from itertools import accumulate",
"+from itertools import accumulate as ac",
"-N_s = int(N**0.5)",
"-list_a = [1] * N_s",
"-list_b = [N // j - N_s for j in range(1, N_s + 1)]",
"-list_p = [N // j - N_s for j in range(1, N_s + 1)]",
"-for p in range(1, len(list_p)):",
"- list_p[p - 1] = list_p[p ... | false | 0.258856 | 0.419346 | 0.617286 | [
"s477532812",
"s897813005"
] |
u928254435 | p03448 | python | s285468827 | s134325040 | 52 | 46 | 3,064 | 3,064 | Accepted | Accepted | 11.54 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
l = []
for _ in range(4):
l.append(int(eval(input())))
a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )
b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )
c_c = min(c, math.floor(x / 50) if x >= 50 else 0 )
... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
l = []
for _ in range(4):
l.append(int(eval(input())))
a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )
b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )
c_c = min(c, math.floor(x / 50) if x >= 50 else 0 )
... | 46 | 34 | 845 | 724 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
l = []
for _ in range(4):
l.append(int(eval(input())))
a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0)
b_c = min(b, math.floor(x / 100) if x >= 100 else 0)
c_c = min(c, math.floor(x / 50) if x >= 50 else 0)
i, j, k, sum, cnt ... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
l = []
for _ in range(4):
l.append(int(eval(input())))
a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0)
b_c = min(b, math.floor(x / 100) if x >= 100 else 0)
c_c = min(c, math.floor(x / 50) if x >= 50 else 0)
sum, cnt = [0] * 2... | false | 26.086957 | [
"-i, j, k, sum, cnt = [0] * 5",
"-while i <= a_c:",
"+sum, cnt = [0] * 2",
"+for i in range(a_c + 1):",
"- if sum < 0:",
"- break",
"- else:",
"- while j <= b_c:",
"- sum = x - 500 * i - 100 * j",
"- if sum < 0:",
"- break",
"+ if sum... | false | 0.050884 | 0.049139 | 1.035523 | [
"s285468827",
"s134325040"
] |
u254871849 | p03699 | python | s279325477 | s864606391 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | import sys
input = sys.stdin.readline
from itertools import combinations
N = int(input().rstrip())
score = [int(input().rstrip()) for _ in range(N)]
score.sort(reverse=1)
s_multiple_of_10 = [s for s in score if s % 10 == 0]
if len(s_multiple_of_10) == N: print((0))
s_not_multiple_of_10 = [s for s in score i... | # import sys
# input = sys.stdin.readline
N, *score = [int(x) for x in open(0)]
a = sum(score)
print((max([a - s for s in score + [0] if (a - s) % 10] + [0])))
# 最後の行は、scoreのなかの何か一つの要素を合計から引いたときと何も引かなかったとき(+ [0]は何も引かない場合のため)を
# それぞれ10で割ったあまりが0でない(0の論理値はFalse, 1以上の論理値はTrue) 物の中から最大値を出力する
# ややこしいが、もしaが10の倍数だった... | 21 | 13 | 630 | 476 | import sys
input = sys.stdin.readline
from itertools import combinations
N = int(input().rstrip())
score = [int(input().rstrip()) for _ in range(N)]
score.sort(reverse=1)
s_multiple_of_10 = [s for s in score if s % 10 == 0]
if len(s_multiple_of_10) == N:
print((0))
s_not_multiple_of_10 = [s for s in score if s % ... | # import sys
# input = sys.stdin.readline
N, *score = [int(x) for x in open(0)]
a = sum(score)
print((max([a - s for s in score + [0] if (a - s) % 10] + [0])))
# 最後の行は、scoreのなかの何か一つの要素を合計から引いたときと何も引かなかったとき(+ [0]は何も引かない場合のため)を
# それぞれ10で割ったあまりが0でない(0の論理値はFalse, 1以上の論理値はTrue) 物の中から最大値を出力する
# ややこしいが、もしaが10の倍数だった場合、scoreの要素... | false | 38.095238 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-from itertools import combinations",
"-",
"-N = int(input().rstrip())",
"-score = [int(input().rstrip()) for _ in range(N)]",
"-score.sort(reverse=1)",
"-s_multiple_of_10 = [s for s in score if s % 10 == 0]",
"-if len(s_multiple_of_10) == N:",
... | false | 0.138013 | 0.055183 | 2.501027 | [
"s279325477",
"s864606391"
] |
u811733736 | p00181 | python | s099853180 | s528439627 | 50 | 40 | 7,744 | 7,768 | Accepted | Accepted | 20 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0181
"""
import sys
from sys import stdin
input = stdin.readline
def Cond(m, n, mid, books):
if max(books) > mid:
return False
rem = mid
while books:
while rem >= books[0]:
r... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0181
"""
import sys
from sys import stdin
input = stdin.readline
def Cond(m, n, mid, books):
rem = mid
i = 0
while True:
while rem >= books[i]:
rem -= books[i]
i += 1
... | 57 | 58 | 1,147 | 1,121 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0181
"""
import sys
from sys import stdin
input = stdin.readline
def Cond(m, n, mid, books):
if max(books) > mid:
return False
rem = mid
while books:
while rem >= books[0]:
rem -= books[0]
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0181
"""
import sys
from sys import stdin
input = stdin.readline
def Cond(m, n, mid, books):
rem = mid
i = 0
while True:
while rem >= books[i]:
rem -= books[i]
i += 1
if i == n... | false | 1.724138 | [
"- if max(books) > mid:",
"- return False",
"- while books:",
"- while rem >= books[0]:",
"- rem -= books[0]",
"- books = books[1:]",
"- if len(books) == 0:",
"+ i = 0",
"+ while True:",
"+ while rem >= books[i]:",
"+ r... | false | 0.036876 | 0.037442 | 0.984896 | [
"s099853180",
"s528439627"
] |
u844646164 | p03354 | python | s233801279 | s514507567 | 911 | 606 | 101,100 | 94,292 | Accepted | Accepted | 33.48 | class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
... | import sys
input = sys.stdin.readline
class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.Find_Root(self.root... | 42 | 53 | 1,360 | 1,549 | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def... | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])... | false | 20.754717 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"-n, m = list(map(int, input().split()))",
"+N, M = list(map(int, input().split()))",
"+uf = UnionFind(N + 1)",
"-xy = [list(map(int, input().split())) for _ in range(m)]",
"-uf = UnionFind(n + 1)",
"-for x, y in xy:",
"- uf.Unite... | false | 0.148361 | 0.045908 | 3.231695 | [
"s233801279",
"s514507567"
] |
u226108478 | p04019 | python | s683135450 | s772560099 | 23 | 17 | 3,316 | 2,940 | Accepted | Accepted | 26.09 | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == '__main__':
from collections import Counter
s = Counter(eval(input()))
if ('S' in list(s.keys())) and ('N' not in list(s.keys())):
print('No')
elif ('N' in list(s.keys())) and ('S' not in list(s.keys()))... | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == '__main__':
s = eval(input())
# See:
# http://agc003.contest.atcoder.jp/data/agc/003/editorial.pdf
# https://beta.atcoder.jp/contests/agc003/submissions/849782
if (('S' in s) ^ ('N' in s)) or (('W' in s) ^ ('E... | 21 | 16 | 498 | 378 | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == "__main__":
from collections import Counter
s = Counter(eval(input()))
if ("S" in list(s.keys())) and ("N" not in list(s.keys())):
print("No")
elif ("N" in list(s.keys())) and ("S" not in list(s.keys())):
print("... | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == "__main__":
s = eval(input())
# See:
# http://agc003.contest.atcoder.jp/data/agc/003/editorial.pdf
# https://beta.atcoder.jp/contests/agc003/submissions/849782
if (("S" in s) ^ ("N" in s)) or (("W" in s) ^ ("E" in s)):
... | false | 23.809524 | [
"- from collections import Counter",
"-",
"- s = Counter(eval(input()))",
"- if (\"S\" in list(s.keys())) and (\"N\" not in list(s.keys())):",
"- print(\"No\")",
"- elif (\"N\" in list(s.keys())) and (\"S\" not in list(s.keys())):",
"- print(\"No\")",
"- elif (\"W\" in lis... | false | 0.038814 | 0.03991 | 0.972553 | [
"s683135450",
"s772560099"
] |
u226108478 | p03557 | python | s543807848 | s976327156 | 334 | 290 | 23,744 | 22,720 | Accepted | Accepted | 13.17 | # -*- coding: utf-8 -*-
def main():
from bisect import bisect_left
from bisect import bisect_right
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))
ans = 0
for bi in b:
... | # -*- coding: utf-8 -*-
def main():
from bisect import bisect_left
from bisect import bisect_right
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans = 0
for bi in... | 23 | 23 | 481 | 489 | # -*- coding: utf-8 -*-
def main():
from bisect import bisect_left
from bisect import bisect_right
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))
ans = 0
for bi in b:
less = bisec... | # -*- coding: utf-8 -*-
def main():
from bisect import bisect_left
from bisect import bisect_right
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans = 0
for bi in b:
less... | false | 0 | [
"- b = list(map(int, input().split()))",
"+ b = sorted(list(map(int, input().split())))"
] | false | 0.04586 | 0.049937 | 0.918361 | [
"s543807848",
"s976327156"
] |
u046187684 | p03353 | python | s258657952 | s831505494 | 30 | 18 | 4,596 | 3,060 | Accepted | Accepted | 40 | from collections import Counter
def solve(string):
s, k = string.split()
k = int(k)
count = Counter(s)
chars = sorted(set(s))
for t in range(min(3, len(chars))):
tmp = []
i = s.index(chars[t])
tmp.append(s[i:i + k])
if count[chars[t]] > 1:
f... | def solve(string):
s, k = string.split()
k = int(k)
chars = sorted(set(s))
exists = []
def dfs(base):
exists.append(base)
if len(exists) >= k:
return
for c in chars:
if base + c in s:
dfs(base + c)
for c in chars:
... | 29 | 22 | 763 | 443 | from collections import Counter
def solve(string):
s, k = string.split()
k = int(k)
count = Counter(s)
chars = sorted(set(s))
for t in range(min(3, len(chars))):
tmp = []
i = s.index(chars[t])
tmp.append(s[i : i + k])
if count[chars[t]] > 1:
for _ in ran... | def solve(string):
s, k = string.split()
k = int(k)
chars = sorted(set(s))
exists = []
def dfs(base):
exists.append(base)
if len(exists) >= k:
return
for c in chars:
if base + c in s:
dfs(base + c)
for c in chars:
dfs(c)
... | false | 24.137931 | [
"-from collections import Counter",
"-",
"-",
"- count = Counter(s)",
"- for t in range(min(3, len(chars))):",
"- tmp = []",
"- i = s.index(chars[t])",
"- tmp.append(s[i : i + k])",
"- if count[chars[t]] > 1:",
"- for _ in range(count[chars[t]] - 1):",
... | false | 0.046099 | 0.035264 | 1.307245 | [
"s258657952",
"s831505494"
] |
u445624660 | p03450 | python | s178239224 | s086855916 | 1,875 | 1,484 | 16,560 | 11,044 | Accepted | Accepted | 20.85 | import sys
sys.setrecursionlimit(10**7)
class WeightedUnionFindTree:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0 for _ in range(n)]
self.weight = [0 for _ in range(n)]
def root(self, t):
if t == self.par[t]:
return t
# 経路圧縮してみる
r = self.root(self.p... | import sys
sys.setrecursionlimit(10**7)
n, m = list(map(int, input().split()))
par = list(range(n+1))
dist = [0 for _ in range(n+1)]
def root(x):
if x == par[x]:
return x
r = root(par[x])
dist[x] += dist[par[x]]
par[x] = r
return r
def direct_cost(x):
if x == par[x]:
return 0
... | 67 | 69 | 1,656 | 1,435 | import sys
sys.setrecursionlimit(10**7)
class WeightedUnionFindTree:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0 for _ in range(n)]
self.weight = [0 for _ in range(n)]
def root(self, t):
if t == self.par[t]:
return t
# 経路圧縮してみる
... | import sys
sys.setrecursionlimit(10**7)
n, m = list(map(int, input().split()))
par = list(range(n + 1))
dist = [0 for _ in range(n + 1)]
def root(x):
if x == par[x]:
return x
r = root(par[x])
dist[x] += dist[par[x]]
par[x] = r
return r
def direct_cost(x):
if x == par[x]:
ret... | false | 2.898551 | [
"-",
"-",
"-class WeightedUnionFindTree:",
"- def __init__(self, n):",
"- self.par = list(range(n))",
"- self.rank = [0 for _ in range(n)]",
"- self.weight = [0 for _ in range(n)]",
"-",
"- def root(self, t):",
"- if t == self.par[t]:",
"- return t",
... | false | 0.040086 | 0.045704 | 0.877083 | [
"s178239224",
"s086855916"
] |
u462831976 | p00111 | python | s868926767 | s762095835 | 80 | 60 | 11,728 | 11,740 | Accepted | Accepted | 25 | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L":... | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L":... | 116 | 117 | 2,542 | 2,551 | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L": "01011",
"M": "0... | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L": "01011",
"M": "0... | false | 0.854701 | [
"- # lst = []",
"- # for c in s:",
"- # lst.append(tableA[c])",
"- # s = ''.join(lst)",
"- en = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" + \" .,-'?\"",
"+ lst = []",
"+ for c in s:",
"+ lst.append(tableA[c])",
"+ s = \"\".join(lst)",
"+ # en = 'ABCDEFGHIJKLMNOPQRSTUVWXY... | false | 0.045469 | 0.045701 | 0.994915 | [
"s868926767",
"s762095835"
] |
u074220993 | p03962 | python | s220007903 | s463530443 | 26 | 23 | 9,020 | 9,000 | Accepted | Accepted | 11.54 | Set = {int(x) for x in input().split()}
print((len(Set))) | print((len(set(input().split())))) | 2 | 1 | 56 | 32 | Set = {int(x) for x in input().split()}
print((len(Set)))
| print((len(set(input().split()))))
| false | 50 | [
"-Set = {int(x) for x in input().split()}",
"-print((len(Set)))",
"+print((len(set(input().split()))))"
] | false | 0.039011 | 0.03674 | 1.061808 | [
"s220007903",
"s463530443"
] |
u745554846 | p03073 | python | s047257976 | s715461967 | 25 | 18 | 5,284 | 3,188 | Accepted | Accepted | 28 | a = list(str(eval(input())))
empty = []
empty.append([i for i in a[0::2]])
empty.append([i for i in a[1::2]])
aa = empty[0].count('0') + empty[1].count('1')
bb = empty[0].count('1') + empty[1].count('0')
if aa >= bb:
print(bb)
else:
print(aa) | s = eval(input())
candi = []
candi.append(s[0::2].count('0') + s[1::2].count('1'))
candi.append(s[0::2].count('1') + s[1::2].count('0'))
print((min(candi))) | 14 | 8 | 261 | 158 | a = list(str(eval(input())))
empty = []
empty.append([i for i in a[0::2]])
empty.append([i for i in a[1::2]])
aa = empty[0].count("0") + empty[1].count("1")
bb = empty[0].count("1") + empty[1].count("0")
if aa >= bb:
print(bb)
else:
print(aa)
| s = eval(input())
candi = []
candi.append(s[0::2].count("0") + s[1::2].count("1"))
candi.append(s[0::2].count("1") + s[1::2].count("0"))
print((min(candi)))
| false | 42.857143 | [
"-a = list(str(eval(input())))",
"-empty = []",
"-empty.append([i for i in a[0::2]])",
"-empty.append([i for i in a[1::2]])",
"-aa = empty[0].count(\"0\") + empty[1].count(\"1\")",
"-bb = empty[0].count(\"1\") + empty[1].count(\"0\")",
"-if aa >= bb:",
"- print(bb)",
"-else:",
"- print(aa)",... | false | 0.038023 | 0.047522 | 0.800124 | [
"s047257976",
"s715461967"
] |
u057109575 | p02948 | python | s763988151 | s728242162 | 812 | 618 | 92,632 | 105,088 | Accepted | Accepted | 23.89 | from heapq import heappush, heappop
from collections import defaultdict
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
cand = defaultdict(list)
for a, b in X:
cand[a].append(b)
pq = []
ans = 0
for i in range(1, M + 1):
for c in cand[i]:
heap... | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
pq = []
for a, b in X:
heappush(pq, (a, b))
cand = []
ans = 0
for t in range(1, M + 1):
while pq:
a, b = heappop(pq)
if a <= t:
hea... | 20 | 25 | 389 | 474 | from heapq import heappush, heappop
from collections import defaultdict
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
cand = defaultdict(list)
for a, b in X:
cand[a].append(b)
pq = []
ans = 0
for i in range(1, M + 1):
for c in cand[i]:
heappush(pq, -c)
... | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
pq = []
for a, b in X:
heappush(pq, (a, b))
cand = []
ans = 0
for t in range(1, M + 1):
while pq:
a, b = heappop(pq)
if a <= t:
heappush(cand, -b)
... | false | 20 | [
"-from collections import defaultdict",
"-cand = defaultdict(list)",
"+pq = []",
"- cand[a].append(b)",
"-pq = []",
"+ heappush(pq, (a, b))",
"+cand = []",
"-for i in range(1, M + 1):",
"- for c in cand[i]:",
"- heappush(pq, -c)",
"- if pq:",
"- ans -= heappop(pq)",
... | false | 0.033864 | 0.037413 | 0.905157 | [
"s763988151",
"s728242162"
] |
u123756661 | p02601 | python | s522737119 | s043731694 | 70 | 64 | 61,756 | 62,000 | Accepted | Accepted | 8.57 | a,b,c=list(map(int,input().split()))
k=int(eval(input()))
d={"a":a,"b":b,"c":c}
for i in range(k+1):
if d["a"]<d["b"]<d["c"]:
print("Yes")
exit()
elif d["a"]>=d["c"]:
d["c"]*=2
elif d["a"]>=d["b"]:
d["b"]*=2
elif d["b"]>=d["c"]:
d["c"]*=2
print("No") | a,b,c=list(map(int,input().split()))
d={"a":a,"b":b,"c":c}
for i in range(int(eval(input()))+1):
if d["a"]<d["b"]<d["c"]:
print("Yes")
exit()
elif d["a"]>=d["c"]: d["c"]*=2
elif d["a"]>=d["b"]: d["b"]*=2
elif d["b"]>=d["c"]: d["c"]*=2
print("No")
| 14 | 10 | 307 | 276 | a, b, c = list(map(int, input().split()))
k = int(eval(input()))
d = {"a": a, "b": b, "c": c}
for i in range(k + 1):
if d["a"] < d["b"] < d["c"]:
print("Yes")
exit()
elif d["a"] >= d["c"]:
d["c"] *= 2
elif d["a"] >= d["b"]:
d["b"] *= 2
elif d["b"] >= d["c"]:
d["c"... | a, b, c = list(map(int, input().split()))
d = {"a": a, "b": b, "c": c}
for i in range(int(eval(input())) + 1):
if d["a"] < d["b"] < d["c"]:
print("Yes")
exit()
elif d["a"] >= d["c"]:
d["c"] *= 2
elif d["a"] >= d["b"]:
d["b"] *= 2
elif d["b"] >= d["c"]:
d["c"] *= 2... | false | 28.571429 | [
"-k = int(eval(input()))",
"-for i in range(k + 1):",
"+for i in range(int(eval(input())) + 1):"
] | false | 0.08808 | 0.138097 | 0.637817 | [
"s522737119",
"s043731694"
] |
u424768586 | p02734 | python | s781146167 | s880776772 | 111 | 101 | 74,448 | 68,712 | Accepted | Accepted | 9.01 | import sys
def input(): return sys.stdin.readline()[:-1]
#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True) #二個目の要素で降順並び替え
#N = int(input())
N, S = list(map(int, input().split()))
#L = [int(input()) for i in range(N)]
A = tuple(map(int, input().split()))
#S = [list(map(int, input().split())) for i i... | import sys
def input(): return sys.stdin.readline()[:-1]
#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True) #二個目の要素で降順並び替え
#N = int(input())
N, S = list(map(int, input().split()))
#L = [int(input()) for i in range(N)]
A = tuple(map(int, input().split()))
#S = [list(map(int, input().split())) for i i... | 26 | 26 | 534 | 527 | import sys
def input():
return sys.stdin.readline()[:-1]
# mod = 10**9+7
# w.sort(key=itemgetter(1),reversed=True) #二個目の要素で降順並び替え
# N = int(input())
N, S = list(map(int, input().split()))
# L = [int(input()) for i in range(N)]
A = tuple(map(int, input().split()))
# S = [list(map(int, input().split())) for i in... | import sys
def input():
return sys.stdin.readline()[:-1]
# mod = 10**9+7
# w.sort(key=itemgetter(1),reversed=True) #二個目の要素で降順並び替え
# N = int(input())
N, S = list(map(int, input().split()))
# L = [int(input()) for i in range(N)]
A = tuple(map(int, input().split()))
# S = [list(map(int, input().split())) for i in... | false | 0 | [
"- for i in reversed(list(range(a, S + 1))):",
"+ for i in range(S, a - 1, -1):"
] | false | 0.136742 | 0.040781 | 3.353063 | [
"s781146167",
"s880776772"
] |
u399721252 | p03634 | python | s986854591 | s443622695 | 1,578 | 582 | 83,152 | 72,180 | Accepted | Accepted | 63.12 | n = int(eval(input()))
connect_list = [[] for i in range(n)]
for i in range(n-1):
a, b, c = [ int(v)-1 for v in input().split() ]
c += 1
connect_list[a].append((b,c))
connect_list[b].append((a,c))
q, k = [ int(v) for v in input().split() ]
k -= 1
shortest_list = [-1 for i in range(n)]
sh... | import sys
input = sys.stdin.readline
n = int(eval(input()))
connect_list = [[] for i in range(n)]
for i in range(n-1):
a, b, c = [ int(v)-1 for v in input().split() ]
c += 1
connect_list[a].append((b,c))
connect_list[b].append((a,c))
q, k = [ int(v) for v in input().split() ]
k -= 1
... | 32 | 35 | 803 | 845 | n = int(eval(input()))
connect_list = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = [int(v) - 1 for v in input().split()]
c += 1
connect_list[a].append((b, c))
connect_list[b].append((a, c))
q, k = [int(v) for v in input().split()]
k -= 1
shortest_list = [-1 for i in range(n)]
shortest_list[k]... | import sys
input = sys.stdin.readline
n = int(eval(input()))
connect_list = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = [int(v) - 1 for v in input().split()]
c += 1
connect_list[a].append((b, c))
connect_list[b].append((a, c))
q, k = [int(v) for v in input().split()]
k -= 1
shortest_list = ... | false | 8.571429 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.045925 | 0.041288 | 1.112315 | [
"s986854591",
"s443622695"
] |
u893962649 | p02572 | python | s480554590 | s693859715 | 130 | 118 | 31,560 | 31,632 | Accepted | Accepted | 9.23 | N = int(eval(input()))
A = list(map(int, input().split()))
sum_a = sum(A)
ans = 0
mod = int(1e9+7)
for a in A:
sum_a -= a
ans += (sum_a * a) % 1000000007
ans %= 1000000007
print((int(ans)))
| N = int(eval(input()))
A = list(map(int, input().split()))
sum_a = sum(A)
ans = 0
mod = int(1e9+7)
for a in A:
sum_a -= a
ans += (sum_a * a)
ans %= 1000000007
print((int(ans)))
| 14 | 15 | 207 | 196 | N = int(eval(input()))
A = list(map(int, input().split()))
sum_a = sum(A)
ans = 0
mod = int(1e9 + 7)
for a in A:
sum_a -= a
ans += (sum_a * a) % 1000000007
ans %= 1000000007
print((int(ans)))
| N = int(eval(input()))
A = list(map(int, input().split()))
sum_a = sum(A)
ans = 0
mod = int(1e9 + 7)
for a in A:
sum_a -= a
ans += sum_a * a
ans %= 1000000007
print((int(ans)))
| false | 6.666667 | [
"- ans += (sum_a * a) % 1000000007",
"+ ans += sum_a * a"
] | false | 0.035935 | 0.097592 | 0.368211 | [
"s480554590",
"s693859715"
] |
u102461423 | p03787 | python | s780098374 | s513838631 | 608 | 469 | 54,416 | 56,656 | Accepted | Accepted | 22.86 | import sys
input = sys.stdin.readline
N,M = list(map(int,input().split()))
UV = [[int(x) for x in row.split()] for row in sys.stdin.readlines()]
graph = [[] for _ in range(N+1)]
for u,v in UV:
graph[u].append(v)
graph[v].append(u)
color = [None] * (N+1)
def calc_comp_data(v):
c = 0
q ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
m = list(map(int, read().split()))
G = [[] for _ in range(N + 1)]
for a, b in zip(m, m):
G[a].append(b)
G[b].append(a)
comp = [0] * (N + 1... | 65 | 49 | 1,542 | 1,118 | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
UV = [[int(x) for x in row.split()] for row in sys.stdin.readlines()]
graph = [[] for _ in range(N + 1)]
for u, v in UV:
graph[u].append(v)
graph[v].append(u)
color = [None] * (N + 1)
def calc_comp_data(v):
c = 0
q = [v]
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
m = list(map(int, read().split()))
G = [[] for _ in range(N + 1)]
for a, b in zip(m, m):
G[a].append(b)
G[b].append(a)
comp = [0] * (N + 1)
comp_size = [... | false | 24.615385 | [
"-input = sys.stdin.readline",
"-N, M = list(map(int, input().split()))",
"-UV = [[int(x) for x in row.split()] for row in sys.stdin.readlines()]",
"-graph = [[] for _ in range(N + 1)]",
"-for u, v in UV:",
"- graph[u].append(v)",
"- graph[v].append(u)",
"-color = [None] * (N + 1)",
"-",
"-"... | false | 0.039266 | 0.042353 | 0.927111 | [
"s780098374",
"s513838631"
] |
u020373088 | p03457 | python | s494754495 | s276525779 | 423 | 390 | 11,824 | 3,064 | Accepted | Accepted | 7.8 | n = int(eval(input()))
t = [0]
x = [0]
y = [0]
for i in range(n):
ti, xi, yi = list(map(int, input().split()))
t.append(ti)
x.append(xi)
y.append(yi)
ok = True
for i in range(n):
ti = t[i+1] - t[i]
if ((ti - (abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]))) < 0
or (ti - (abs(x[i+1]-x[i]) + abs(y... | n = int(eval(input()))
pre_t, pre_x, pre_y = [0, 0, 0]
ok = True
for i in range(n):
t, x, y = list(map(int, input().split()))
if (((t-pre_t) - (abs(x-pre_x) + abs(y-pre_y))) < 0
or ((t-pre_t) - (abs(x-pre_x) + abs(y-pre_y))) % 2 != 0):
ok = False
break
pre_t, pre_x, pre_y = [t, x, y]
... | 21 | 16 | 405 | 353 | n = int(eval(input()))
t = [0]
x = [0]
y = [0]
for i in range(n):
ti, xi, yi = list(map(int, input().split()))
t.append(ti)
x.append(xi)
y.append(yi)
ok = True
for i in range(n):
ti = t[i + 1] - t[i]
if (ti - (abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]))) < 0 or (
ti - (abs(x[i + 1] - x[... | n = int(eval(input()))
pre_t, pre_x, pre_y = [0, 0, 0]
ok = True
for i in range(n):
t, x, y = list(map(int, input().split()))
if ((t - pre_t) - (abs(x - pre_x) + abs(y - pre_y))) < 0 or (
(t - pre_t) - (abs(x - pre_x) + abs(y - pre_y))
) % 2 != 0:
ok = False
break
pre_t, pre_x, p... | false | 23.809524 | [
"-t = [0]",
"-x = [0]",
"-y = [0]",
"-for i in range(n):",
"- ti, xi, yi = list(map(int, input().split()))",
"- t.append(ti)",
"- x.append(xi)",
"- y.append(yi)",
"+pre_t, pre_x, pre_y = [0, 0, 0]",
"- ti = t[i + 1] - t[i]",
"- if (ti - (abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[... | false | 0.041604 | 0.035225 | 1.181095 | [
"s494754495",
"s276525779"
] |
u255280439 | p03493 | python | s390897405 | s940498998 | 45 | 40 | 4,932 | 4,796 | Accepted | Accepted | 11.11 | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v):k for k,v in list(inspect.currentframe().f_back.f_locals.items())}
print((', '.join(names.get(id(arg),'?... | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {
id(v): k
for k, v in list(inspect.currentframe().f_back.f_locals.items())
}
print(('... | 42 | 40 | 828 | 651 | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v): k for k, v in list(inspect.currentframe().f_back.f_locals.items())}
print((", ".join(names.get(id(arg), "???") + " = ... | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v): k for k, v in list(inspect.currentframe().f_back.f_locals.items())}
print((", ".join(names.get(id(arg), "???") + " = ... | false | 4.761905 | [
"-# Set 2 dimension list",
"-def dim2input(N):",
"- li = []",
"- for _ in range(N):",
"- li.append(list(map(int, eval(input()))))",
"- return li",
"+def li_input():",
"+ return [int(_) for _ in input().split()]",
"-\"\"\" input template",
"-S = input()",
"-N = int(input())",
... | false | 0.103054 | 0.097524 | 1.056711 | [
"s390897405",
"s940498998"
] |
u268516119 | p03680 | python | s380708661 | s378128269 | 644 | 202 | 106,456 | 7,852 | Accepted | Accepted | 68.63 | import sys
sys.setrecursionlimit(500000)
N=int(eval(input()))
A=[int(eval(input()))-1 for _ in range(N)]
result=[False]*N
def next(k):
newlight=A[k]
if k==1:
return(1)
elif result[k]:
return(0)
else:
result[k]=True
return(next(newlight))
if not next(0):
print((-1))
else:print((sum(result))) | N=int(eval(input()))
A=[int(eval(input()))-1 for _ in range(N)]
result=[False]*N
k=0
while 1:
newlight=A[k]
if k==1:
ans=0
break
elif result[k]:
ans=1
break
else:
result[k]=True
k=newlight
if ans:
print((-1))
else:print((sum(result))) | 17 | 18 | 304 | 252 | import sys
sys.setrecursionlimit(500000)
N = int(eval(input()))
A = [int(eval(input())) - 1 for _ in range(N)]
result = [False] * N
def next(k):
newlight = A[k]
if k == 1:
return 1
elif result[k]:
return 0
else:
result[k] = True
return next(newlight)
if not next(0):
... | N = int(eval(input()))
A = [int(eval(input())) - 1 for _ in range(N)]
result = [False] * N
k = 0
while 1:
newlight = A[k]
if k == 1:
ans = 0
break
elif result[k]:
ans = 1
break
else:
result[k] = True
k = newlight
if ans:
print((-1))
else:
print((su... | false | 5.555556 | [
"-import sys",
"-",
"-sys.setrecursionlimit(500000)",
"-",
"-",
"-def next(k):",
"+k = 0",
"+while 1:",
"- return 1",
"+ ans = 0",
"+ break",
"- return 0",
"+ ans = 1",
"+ break",
"- return next(newlight)",
"-",
"-",
"-if not next(0)... | false | 0.036714 | 0.079324 | 0.46283 | [
"s380708661",
"s378128269"
] |
u080364835 | p03644 | python | s650591969 | s110297647 | 28 | 25 | 9,084 | 9,124 | Accepted | Accepted | 10.71 | n = int(eval(input()))
ans, cnt = 1, 0
for i in range(1, n+1):
j = i
t_cnt = 0
if i%2 == 0:
# print(i)
while i%2 == 0:
i = i//2
t_cnt += 1
# print(i, t_cnt)
if t_cnt >= cnt:
ans = j
cnt = t_cnt
print(ans) | import math
n = int(eval(input()))
ans, i = 0, 1
while ans <= n:
ans = 2**i
i += 1
print((ans//2)) | 16 | 9 | 310 | 108 | n = int(eval(input()))
ans, cnt = 1, 0
for i in range(1, n + 1):
j = i
t_cnt = 0
if i % 2 == 0:
# print(i)
while i % 2 == 0:
i = i // 2
t_cnt += 1
# print(i, t_cnt)
if t_cnt >= cnt:
ans = j
cnt = t_cnt
print(ans)
| import math
n = int(eval(input()))
ans, i = 0, 1
while ans <= n:
ans = 2**i
i += 1
print((ans // 2))
| false | 43.75 | [
"+import math",
"+",
"-ans, cnt = 1, 0",
"-for i in range(1, n + 1):",
"- j = i",
"- t_cnt = 0",
"- if i % 2 == 0:",
"- # print(i)",
"- while i % 2 == 0:",
"- i = i // 2",
"- t_cnt += 1",
"- # print(i, t_cnt)",
"- if t_cnt >= cnt... | false | 0.041913 | 0.032718 | 1.281031 | [
"s650591969",
"s110297647"
] |
u083960235 | p02819 | python | s145531167 | s849775767 | 46 | 41 | 5,200 | 5,168 | Accepted | Accepted | 10.87 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 62 | 52 | 1,465 | 1,389 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 16.129032 | [
"+from bisect import bisect, bisect_left, bisect_right",
"-# 最小公倍数",
"-def gcd(a, b):",
"- if a < b:",
"- a, b = b, a",
"- while a % b != 0:",
"- a, b = b, a % b",
"- return b",
"+N = INT()",
"-# 最大公約数",
"-def lcm(a, b):",
"- y = a * b / gcd(a, b)",
"- return int... | false | 0.053529 | 0.042377 | 1.263166 | [
"s145531167",
"s849775767"
] |
u936985471 | p03599 | python | s950595895 | s279078016 | 137 | 34 | 3,064 | 9,208 | Accepted | Accepted | 75.18 | import sys
readline = sys.stdin.readline
# A + Bの組み合わせはせいぜい1~30のうち作れる数字のみなので全探索
A,B,C,D,E,F = list(map(int,readline().split()))
ans = [0,0]
maxrate = 0.0
for a in range(0,F,100 * A):
for b in range(0,F,100 * B):
if a == 0 and b == 0:
continue
if a + b > F:
break
water = a + b... | import sys
readline = sys.stdin.readline
# 作れる水の量を全探索(せいぜい30種類)
# 各水の量に対して、溶かせる砂糖の最大値は決まる(DPする)
# 最大値とすることができる砂糖に最も近づいたら割合を求め、答えの最大値を更新する
A,B,C,D,E,F = list(map(int,readline().split()))
max_rate = -1
ans_water = 0
ans_sugar = 0
for a in range(30):
for b in range(30):
if a * A * 100 + b * B * 100 >=... | 35 | 46 | 824 | 1,087 | import sys
readline = sys.stdin.readline
# A + Bの組み合わせはせいぜい1~30のうち作れる数字のみなので全探索
A, B, C, D, E, F = list(map(int, readline().split()))
ans = [0, 0]
maxrate = 0.0
for a in range(0, F, 100 * A):
for b in range(0, F, 100 * B):
if a == 0 and b == 0:
continue
if a + b > F:
break
... | import sys
readline = sys.stdin.readline
# 作れる水の量を全探索(せいぜい30種類)
# 各水の量に対して、溶かせる砂糖の最大値は決まる(DPする)
# 最大値とすることができる砂糖に最も近づいたら割合を求め、答えの最大値を更新する
A, B, C, D, E, F = list(map(int, readline().split()))
max_rate = -1
ans_water = 0
ans_sugar = 0
for a in range(30):
for b in range(30):
if a * A * 100 + b * B * 100 >= F... | false | 23.913043 | [
"-# A + Bの組み合わせはせいぜい1~30のうち作れる数字のみなので全探索",
"+# 作れる水の量を全探索(せいぜい30種類)",
"+# 各水の量に対して、溶かせる砂糖の最大値は決まる(DPする)",
"+# 最大値とすることができる砂糖に最も近づいたら割合を求め、答えの最大値を更新する",
"-ans = [0, 0]",
"-maxrate = 0.0",
"-for a in range(0, F, 100 * A):",
"- for b in range(0, F, 100 * B):",
"- if a == 0 and b == 0:",
"+m... | false | 0.076317 | 0.083989 | 0.908648 | [
"s950595895",
"s279078016"
] |
u622045059 | p02900 | python | s932593501 | s682630488 | 265 | 128 | 5,048 | 5,292 | Accepted | Accepted | 51.7 | from fractions import gcd
A,B = list(map(int, input().split()))
g=gcd(A,B)
def prime_factorization(n):
prime_num = []
for i in range(2, int(n**.5)+1):
num = 0
while True:
x,y = divmod(n, i)
if y!= 0:
break
n = x
num += 1... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b... | 19 | 67 | 471 | 2,231 | from fractions import gcd
A, B = list(map(int, input().split()))
g = gcd(A, B)
def prime_factorization(n):
prime_num = []
for i in range(2, int(n**0.5) + 1):
num = 0
while True:
x, y = divmod(n, i)
if y != 0:
break
n = x
num += 1... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(... | false | 71.641791 | [
"-from fractions import gcd",
"+import math",
"+import fractions",
"+import bisect",
"+import collections",
"+import itertools",
"+import heapq",
"+import string",
"+import sys",
"+import copy",
"+from decimal import *",
"+from collections import deque",
"-A, B = list(map(int, input().split(... | false | 0.043558 | 0.046437 | 0.938013 | [
"s932593501",
"s682630488"
] |
u600402037 | p02660 | python | s602400235 | s543289088 | 162 | 96 | 40,360 | 9,212 | Accepted | Accepted | 40.74 | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
U = 10 ** 7 + 10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
if p*p > U:
break
if is_... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def prime_factorize(n): # Nの素因数分解
A = []
while n % 2 == 0:
A.append(2); n //= 2
f = 3
while f * f <= n:
if n % f == 0:
A.appe... | 38 | 32 | 703 | 600 | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
U = 10**7 + 10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
if p * p > U:
break
if is_prime[p]:
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def prime_factorize(n): # Nの素因数分解
A = []
while n % 2 == 0:
A.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
A.append(f)... | false | 15.789474 | [
"-import numpy as np",
"-U = 10**7 + 10",
"-is_prime = np.zeros(U, np.bool)",
"-is_prime[2] = 1",
"-is_prime[3::2] = 1",
"-for p in range(3, U, 2):",
"- if p * p > U:",
"- break",
"- if is_prime[p]:",
"- is_prime[p * p :: p + p] = 0",
"-M = 10**6",
"-small_primes = np.where... | false | 0.677078 | 0.039436 | 17.168876 | [
"s602400235",
"s543289088"
] |
u648881683 | p03557 | python | s241854780 | s259445899 | 789 | 341 | 23,328 | 22,720 | Accepted | Accepted | 56.78 | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
def binsearch_left(a, x):
l = -1... | import sys
input = lambda: sys.stdin.readline().rstrip()
import bisect
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
for b in B:
a_r = ... | 45 | 23 | 916 | 475 | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
def binsearch_left(a, x):
l = -1
r = l... | import sys
input = lambda: sys.stdin.readline().rstrip()
import bisect
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
for b in B:
a_r = bisect.bisect_le... | false | 48.888889 | [
"+import bisect",
"- B.sort()",
"-",
"- def binsearch_left(a, x):",
"- l = -1",
"- r = len(a)",
"- while r - l > 1:",
"- m = (l + r) // 2",
"- if x < a[m]:",
"- r = m",
"- else:",
"- l = m",
"- r... | false | 0.046147 | 0.046579 | 0.990726 | [
"s241854780",
"s259445899"
] |
u901850884 | p02570 | python | s601011757 | s221427055 | 33 | 29 | 9,160 | 9,148 | Accepted | Accepted | 12.12 | d,t,s = (int(y) for y in input().split())
x=d/s
if x>t:
print("No")
else:
print("Yes")
| d,t,s=(int(x) for x in input().split())
if d<=t*s:
print("Yes")
else :
print("No") | 8 | 5 | 107 | 94 | d, t, s = (int(y) for y in input().split())
x = d / s
if x > t:
print("No")
else:
print("Yes")
| d, t, s = (int(x) for x in input().split())
if d <= t * s:
print("Yes")
else:
print("No")
| false | 37.5 | [
"-d, t, s = (int(y) for y in input().split())",
"-x = d / s",
"-if x > t:",
"+d, t, s = (int(x) for x in input().split())",
"+if d <= t * s:",
"+ print(\"Yes\")",
"+else:",
"-else:",
"- print(\"Yes\")"
] | false | 0.042437 | 0.123793 | 0.342806 | [
"s601011757",
"s221427055"
] |
u625864724 | p02573 | python | s476691390 | s211181631 | 829 | 616 | 16,824 | 16,760 | Accepted | Accepted | 25.69 | n, m = list(map(int,input().split()))
par = [-1 for i in range(n + 1)]
par[0] = 0
def find(x):
if (par[x] < 0):
return x
else:
x = par[x]
return find(x)
def unit(x, y):
if (find(x) == find(y)):
pass
else:
x = find(x)
y = find(y)
if (... | n, m = list(map(int,input().split()))
lst = [-1 for i in range(n + 1)]
lst[0] = 0
def find(x):
if(lst[x] < 0):
return(x)
else:
return(find(lst[x]))
def unit(x, y):
xr = find(x)
yr = find(y)
if (xr == yr):
pass
else:
if (xr > yr):
x, y = ... | 27 | 26 | 521 | 510 | n, m = list(map(int, input().split()))
par = [-1 for i in range(n + 1)]
par[0] = 0
def find(x):
if par[x] < 0:
return x
else:
x = par[x]
return find(x)
def unit(x, y):
if find(x) == find(y):
pass
else:
x = find(x)
y = find(y)
if x > y:
... | n, m = list(map(int, input().split()))
lst = [-1 for i in range(n + 1)]
lst[0] = 0
def find(x):
if lst[x] < 0:
return x
else:
return find(lst[x])
def unit(x, y):
xr = find(x)
yr = find(y)
if xr == yr:
pass
else:
if xr > yr:
x, y = y, x
... | false | 3.703704 | [
"-par = [-1 for i in range(n + 1)]",
"-par[0] = 0",
"+lst = [-1 for i in range(n + 1)]",
"+lst[0] = 0",
"- if par[x] < 0:",
"+ if lst[x] < 0:",
"- x = par[x]",
"- return find(x)",
"+ return find(lst[x])",
"- if find(x) == find(y):",
"+ xr = find(x)",
"+ yr =... | false | 0.007564 | 0.144968 | 0.052176 | [
"s476691390",
"s211181631"
] |
u440566786 | p03181 | python | s655544643 | s108806795 | 1,203 | 1,004 | 132,400 | 129,840 | Accepted | Accepted | 16.54 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n, MOD = map(int,input().split())
if n == 1:
print(1)
return
E = [[] for _ in range(n)]
nv_to_idx = [{} for _ in range(n)]
for... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n, MOD = map(int,input().split())
E = [[] for _ in range(n)]
nv_to_idx = [{} for _ in range(n)]
for _ in range(n - 1):
u, v = map(int,input().... | 85 | 76 | 2,393 | 2,165 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, MOD = map(int, input().split())
if n == 1:
print(1)
return
E = [[] for _ in range(n)]
nv_to_idx = [{} for _ in range(n)]
for... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, MOD = map(int, input().split())
E = [[] for _ in range(n)]
nv_to_idx = [{} for _ in range(n)]
for _ in range(n - 1):
u, v = map(int, inp... | false | 10.588235 | [
"- if n == 1:",
"- print(1)",
"- return",
"- p_res = 1",
"- if idx > 0:",
"- p_res *= cum_left[p][idx - 1]",
"- if idx < len(E[p]) - 1:",
"- p_res *= cum_right[p][idx + 1]",
"- dp[p] = p_res % MOD",
"+ ... | false | 0.042371 | 0.042256 | 1.002733 | [
"s655544643",
"s108806795"
] |
u228223940 | p03157 | python | s566842302 | s596398447 | 825 | 469 | 67,592 | 66,824 | Accepted | Accepted | 43.15 | h,w = list(map(int,input().split()))
si = [eval(input()) for i in range(h)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
self.size = [1 for _ in range(n+1)]
# 検索
def find(self, x):
if self.par[x] == x:
... | h,w = list(map(int,input().split()))
si = [eval(input()) for i in range(h)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
self.size = [1 for _ in range(n+1)]
# 検索
def find(self, x):
if self.par[x] == x:
... | 65 | 65 | 1,668 | 1,666 | h, w = list(map(int, input().split()))
si = [eval(input()) for i in range(h)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
self.size = [1 for _ in range(n + 1)]
# 検索
def find(self, x):
if self.par[x] == x:
... | h, w = list(map(int, input().split()))
si = [eval(input()) for i in range(h)]
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
self.size = [1 for _ in range(n + 1)]
# 検索
def find(self, x):
if self.par[x] == x:
... | false | 0 | [
"- # if ki.same_check(i*w+j,ny*w+nx) == True:",
"- # continue",
"+ if ki.same_check(i * w + j, ny * w + nx) == True:",
"+ continue"
] | false | 0.038979 | 0.037727 | 1.033194 | [
"s566842302",
"s596398447"
] |
u883048396 | p03255 | python | s846813854 | s502058826 | 745 | 661 | 25,840 | 27,244 | Accepted | Accepted | 11.28 |
iN ,iX = [int(x) for x in input().split()]
aX = [int(x) for x in input().split()]
aCum = [0]*iN
aCum[0] = aX[0]
for i in range(1,iN):
aCum[i]=aCum[i-1]+aX[i]
def fCeil(iT,iR):
return -1 * iT // iR * -1
#マネして記法を圧縮してみたがどうだろう
def fCalcCost(iN,iX,aCum,iK):
return (iN + iK ) * iX + 5 * aCum[-1] ... | iN ,iX = [int(x) for x in input().split()]
#かえって遅い?
aCum = [0]
for x in input().split():
aCum += [aCum[-1] + int(x)]
def fCeil(iT,iR):
return -1 * iT // iR * -1
def fCalcCost(iN,iX,aCum,iK):
iCost = (iN + iK ) * iX + 5 * aCum[-1]
for i in range(2,fCeil(iN,iK) ):
iCost += 2 * aCum[... | 24 | 24 | 625 | 586 | iN, iX = [int(x) for x in input().split()]
aX = [int(x) for x in input().split()]
aCum = [0] * iN
aCum[0] = aX[0]
for i in range(1, iN):
aCum[i] = aCum[i - 1] + aX[i]
def fCeil(iT, iR):
return -1 * iT // iR * -1
# マネして記法を圧縮してみたがどうだろう
def fCalcCost(iN, iX, aCum, iK):
return (
(iN + iK) * iX
... | iN, iX = [int(x) for x in input().split()]
# かえって遅い?
aCum = [0]
for x in input().split():
aCum += [aCum[-1] + int(x)]
def fCeil(iT, iR):
return -1 * iT // iR * -1
def fCalcCost(iN, iX, aCum, iK):
iCost = (iN + iK) * iX + 5 * aCum[-1]
for i in range(2, fCeil(iN, iK)):
iCost += 2 * aCum[iN - i... | false | 0 | [
"-aX = [int(x) for x in input().split()]",
"-aCum = [0] * iN",
"-aCum[0] = aX[0]",
"-for i in range(1, iN):",
"- aCum[i] = aCum[i - 1] + aX[i]",
"+# かえって遅い?",
"+aCum = [0]",
"+for x in input().split():",
"+ aCum += [aCum[-1] + int(x)]",
"-# マネして記法を圧縮してみたがどうだろう",
"- return (",
"- ... | false | 0.047701 | 0.137327 | 0.347355 | [
"s846813854",
"s502058826"
] |
u653999581 | p03160 | python | s767822457 | s334392811 | 140 | 121 | 13,924 | 13,928 | Accepted | Accepted | 13.57 | if __name__=='__main__':
N = int(eval(input()))
hi = [int(i) for i in input().split()]
dp = [0 for i in range(N)]
dp[1] = abs(hi[0]-hi[1])
for i in range(2,N):
dp_1 = dp[i-1] + abs(hi[i]-hi[i-1])
dp_2 = dp[i-2] + abs(hi[i]-hi[i-2])
dp[i] = min(dp_1,dp_2)
... | if __name__=='__main__':
N = int(eval(input()))
hi = list(map(int,input().split()))
dp = [0]*N
dp[1] = abs(hi[0]-hi[1])
for i in range(2,N):
dp_1 = dp[i-1] + abs(hi[i]-hi[i-1])
dp_2 = dp[i-2] + abs(hi[i]-hi[i-2])
dp[i] = dp_1 if dp_1 < dp_2 else dp_2
... | 12 | 12 | 340 | 335 | if __name__ == "__main__":
N = int(eval(input()))
hi = [int(i) for i in input().split()]
dp = [0 for i in range(N)]
dp[1] = abs(hi[0] - hi[1])
for i in range(2, N):
dp_1 = dp[i - 1] + abs(hi[i] - hi[i - 1])
dp_2 = dp[i - 2] + abs(hi[i] - hi[i - 2])
dp[i] = min(dp_1, dp_2)
... | if __name__ == "__main__":
N = int(eval(input()))
hi = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(hi[0] - hi[1])
for i in range(2, N):
dp_1 = dp[i - 1] + abs(hi[i] - hi[i - 1])
dp_2 = dp[i - 2] + abs(hi[i] - hi[i - 2])
dp[i] = dp_1 if dp_1 < dp_2 else dp_2
p... | false | 0 | [
"- hi = [int(i) for i in input().split()]",
"- dp = [0 for i in range(N)]",
"+ hi = list(map(int, input().split()))",
"+ dp = [0] * N",
"- dp[i] = min(dp_1, dp_2)",
"- print((dp[N - 1]))",
"+ dp[i] = dp_1 if dp_1 < dp_2 else dp_2",
"+ print((dp[-1]))"
] | false | 0.095187 | 0.113495 | 0.838688 | [
"s767822457",
"s334392811"
] |
u887207211 | p03162 | python | s811353914 | s453795913 | 1,022 | 436 | 47,328 | 30,580 | Accepted | Accepted | 57.34 | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for i in range(N):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i+1][k] = max(dp[i+1][k], dp[i][j]+A[i][k])
print((max(dp[N]))) | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(N)]
x = y = z = 0
for a,b,c in A:
x,y,z = max(y,z)+a,max(x,z)+b,max(x,y)+c
print((max(x,y,z))) | 12 | 7 | 285 | 169 | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N + 1)]
for i in range(N):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + A[i][k])
print((max(dp[N])))
| N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
x = y = z = 0
for a, b, c in A:
x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c
print((max(x, y, z)))
| false | 41.666667 | [
"-dp = [[0] * 3 for _ in range(N + 1)]",
"-for i in range(N):",
"- for j in range(3):",
"- for k in range(3):",
"- if j == k:",
"- continue",
"- dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + A[i][k])",
"-print((max(dp[N])))",
"+x = y = z = 0",
"+for a, ... | false | 0.093547 | 0.035626 | 2.625793 | [
"s811353914",
"s453795913"
] |
u251515715 | p03731 | python | s014133966 | s617265907 | 168 | 153 | 26,708 | 26,832 | Accepted | Accepted | 8.93 | n,t=list(map(int,input().split()))
a=list(map(int,input().split()))
a.append(10**10)
cnt=0
for i in range(n):
fir=a[i]
if a[i]+t>a[i+1]:
las=a[i+1]
else:
las=a[i]+t
cnt+=las-fir
print(cnt) | n,t=list(map(int,input().split()))
a=list(map(int,input().split()))
a.append(10**10)
cnt=0
for i in range(n):
if a[i]+t>a[i+1]:
cnt+=a[i+1]-a[i]
else:
cnt+=t
print(cnt) | 12 | 10 | 209 | 183 | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(10**10)
cnt = 0
for i in range(n):
fir = a[i]
if a[i] + t > a[i + 1]:
las = a[i + 1]
else:
las = a[i] + t
cnt += las - fir
print(cnt)
| n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(10**10)
cnt = 0
for i in range(n):
if a[i] + t > a[i + 1]:
cnt += a[i + 1] - a[i]
else:
cnt += t
print(cnt)
| false | 16.666667 | [
"- fir = a[i]",
"- las = a[i + 1]",
"+ cnt += a[i + 1] - a[i]",
"- las = a[i] + t",
"- cnt += las - fir",
"+ cnt += t"
] | false | 0.042679 | 0.043098 | 0.990278 | [
"s014133966",
"s617265907"
] |
u945181840 | p03294 | python | s204342143 | s448991514 | 151 | 19 | 12,392 | 3,316 | Accepted | Accepted | 87.42 | import numpy as np
N = int(eval(input()))
a = np.array(list(map(int, input().split())))
print((np.sum(a - 1))) | N = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - N)) | 6 | 4 | 109 | 75 | import numpy as np
N = int(eval(input()))
a = np.array(list(map(int, input().split())))
print((np.sum(a - 1)))
| N = int(eval(input()))
a = list(map(int, input().split()))
print((sum(a) - N))
| false | 33.333333 | [
"-import numpy as np",
"-",
"-a = np.array(list(map(int, input().split())))",
"-print((np.sum(a - 1)))",
"+a = list(map(int, input().split()))",
"+print((sum(a) - N))"
] | false | 0.271473 | 0.040245 | 6.745473 | [
"s204342143",
"s448991514"
] |
u067975558 | p02409 | python | s090957652 | s693023221 | 40 | 30 | 6,796 | 6,732 | Accepted | Accepted | 25 | floor = [
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
... | floor = [[[0] * 10 for x in range(3)] for y in range(4)]
for c in range(int(eval(input()))):
(b,f,r,v) = [int(x) for x in input().split()]
if 1 > b > 5 or 1 > f > 4 or 1 > r > 10:
break
floor[b-1][f-1][r-1] += v
for x in range(3 * 4):
if x % 3 == 0 and not x == 0:
print(('#' ... | 34 | 12 | 948 | 384 | floor = [
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]... | floor = [[[0] * 10 for x in range(3)] for y in range(4)]
for c in range(int(eval(input()))):
(b, f, r, v) = [int(x) for x in input().split()]
if 1 > b > 5 or 1 > f > 4 or 1 > r > 10:
break
floor[b - 1][f - 1][r - 1] += v
for x in range(3 * 4):
if x % 3 == 0 and not x == 0:
print(("#" * 2... | false | 64.705882 | [
"-floor = [",
"- [",
"- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],",
"- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],",
"- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],",
"- ],",
"- [",
"- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],",
"- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],",
"- [0, 0, 0, 0, 0, 0, 0, 0... | false | 0.037626 | 0.037701 | 0.998006 | [
"s090957652",
"s693023221"
] |
u788137651 | p03679 | python | s537618339 | s063606907 | 76 | 52 | 7,496 | 6,156 | Accepted | Accepted | 31.58 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | 53 | 54 | 1,514 | 1,508 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | false | 1.851852 | [
"- day = B - A",
"- if day <= 0:",
"+ C = A - B",
"+ if A >= B:",
"- elif day <= X:",
"+ elif B - A <= X:"
] | false | 0.048555 | 0.036342 | 1.336053 | [
"s537618339",
"s063606907"
] |
u258073778 | p03835 | python | s544363071 | s921789004 | 1,982 | 18 | 3,060 | 3,060 | Accepted | Accepted | 99.09 | K, S = list(map(int, input().split()))
ct = 0
for X in range(K+1):
for Y in range(K+1):
if S - (X + Y) >= 0 and S - (X + Y) <= K :
ct += 1
print(ct) | K, S = list(map(int, input().split()))
ans = 0
for Z in range(K+1):
r = S - Z
if r < 0:
ans += 0
elif r <= K:
ans += r+1
elif r <= K*2:
ans += (K+1)*2 - (r+1)
print(ans) | 8 | 11 | 165 | 193 | K, S = list(map(int, input().split()))
ct = 0
for X in range(K + 1):
for Y in range(K + 1):
if S - (X + Y) >= 0 and S - (X + Y) <= K:
ct += 1
print(ct)
| K, S = list(map(int, input().split()))
ans = 0
for Z in range(K + 1):
r = S - Z
if r < 0:
ans += 0
elif r <= K:
ans += r + 1
elif r <= K * 2:
ans += (K + 1) * 2 - (r + 1)
print(ans)
| false | 27.272727 | [
"-ct = 0",
"-for X in range(K + 1):",
"- for Y in range(K + 1):",
"- if S - (X + Y) >= 0 and S - (X + Y) <= K:",
"- ct += 1",
"-print(ct)",
"+ans = 0",
"+for Z in range(K + 1):",
"+ r = S - Z",
"+ if r < 0:",
"+ ans += 0",
"+ elif r <= K:",
"+ ans ... | false | 0.046717 | 0.047629 | 0.98087 | [
"s544363071",
"s921789004"
] |
u962718741 | p03971 | python | s938633739 | s287406606 | 298 | 184 | 50,904 | 48,880 | Accepted | Accepted | 38.26 | def resolve():
N, A, B = list(map(int, input().split()))
S = eval(input())
Atmp = 0
Btmp = 0
for i in S:
if i == 'a':
if Atmp + Btmp < A+B:
Atmp += 1
print('Yes')
else:
print('No')
elif i == 'b':
... | def resolve():
N, A, B = list(map(int, input().split()))
S = eval(input())
Atmp = 0
Btmp = 0
ans = []
my_append = ans.append
for i in S:
if i == 'a':
if Atmp + Btmp < A+B:
Atmp += 1
my_append('Yes')
else:
... | 21 | 24 | 508 | 596 | def resolve():
N, A, B = list(map(int, input().split()))
S = eval(input())
Atmp = 0
Btmp = 0
for i in S:
if i == "a":
if Atmp + Btmp < A + B:
Atmp += 1
print("Yes")
else:
print("No")
elif i == "b":
if... | def resolve():
N, A, B = list(map(int, input().split()))
S = eval(input())
Atmp = 0
Btmp = 0
ans = []
my_append = ans.append
for i in S:
if i == "a":
if Atmp + Btmp < A + B:
Atmp += 1
my_append("Yes")
else:
my_ap... | false | 12.5 | [
"+ ans = []",
"+ my_append = ans.append",
"- print(\"Yes\")",
"+ my_append(\"Yes\")",
"- print(\"No\")",
"+ my_append(\"No\")",
"- print(\"Yes\")",
"+ my_append(\"Yes\")",
"- print(\"No\")"... | false | 0.040734 | 0.040473 | 1.006436 | [
"s938633739",
"s287406606"
] |
u561083515 | p02881 | python | s774927530 | s942748787 | 154 | 142 | 2,940 | 3,060 | Accepted | Accepted | 7.79 | N = int(eval(input()))
tmp = 0
for i in range(int(N ** (0.5)), 0, -1):
if N % i == 0:
tmp = i + (N // i)
break
print((tmp - 2)) | N = int(eval(input()))
ans = 0
for n in range(int(N ** 0.5), 0, -1):
if N % n == 0:
ans = n + (N // n) - 2
break
print(ans) | 9 | 9 | 149 | 147 | N = int(eval(input()))
tmp = 0
for i in range(int(N ** (0.5)), 0, -1):
if N % i == 0:
tmp = i + (N // i)
break
print((tmp - 2))
| N = int(eval(input()))
ans = 0
for n in range(int(N**0.5), 0, -1):
if N % n == 0:
ans = n + (N // n) - 2
break
print(ans)
| false | 0 | [
"-tmp = 0",
"-for i in range(int(N ** (0.5)), 0, -1):",
"- if N % i == 0:",
"- tmp = i + (N // i)",
"+ans = 0",
"+for n in range(int(N**0.5), 0, -1):",
"+ if N % n == 0:",
"+ ans = n + (N // n) - 2",
"-print((tmp - 2))",
"+print(ans)"
] | false | 0.049088 | 0.049261 | 0.99649 | [
"s774927530",
"s942748787"
] |
u358254559 | p02588 | python | s319297605 | s624443918 | 1,777 | 365 | 284,536 | 111,640 | Accepted | Accepted | 79.46 | import decimal
n = int(eval(input()))
a=[eval(input()) for i in range(n)]
biga=[]
for i in range(n):
num = decimal.Decimal(a[i])
biga.append(int(num*10**9))
def fact25(n):
cnt2=0
cnt5=0
while n%2==0:
n//=2
cnt2+=1
while n%5==0:
n//=5
cnt5+=1
re... | n = int(eval(input()))
biga = []
for _ in range(n):
a = float(eval(input()))
a = round(a * 10 ** 9 + 0.1)
biga.append(a)
def fact25(n):
cnt2=0
cnt5=0
while n%2==0:
n//=2
cnt2+=1
while n%5==0:
n//=5
cnt5+=1
return cnt2,cnt5
arr = [[0 for... | 41 | 41 | 946 | 915 | import decimal
n = int(eval(input()))
a = [eval(input()) for i in range(n)]
biga = []
for i in range(n):
num = decimal.Decimal(a[i])
biga.append(int(num * 10**9))
def fact25(n):
cnt2 = 0
cnt5 = 0
while n % 2 == 0:
n //= 2
cnt2 += 1
while n % 5 == 0:
n //= 5
cnt... | n = int(eval(input()))
biga = []
for _ in range(n):
a = float(eval(input()))
a = round(a * 10**9 + 0.1)
biga.append(a)
def fact25(n):
cnt2 = 0
cnt5 = 0
while n % 2 == 0:
n //= 2
cnt2 += 1
while n % 5 == 0:
n //= 5
cnt5 += 1
return cnt2, cnt5
arr = [[0 ... | false | 0 | [
"-import decimal",
"-",
"-a = [eval(input()) for i in range(n)]",
"-for i in range(n):",
"- num = decimal.Decimal(a[i])",
"- biga.append(int(num * 10**9))",
"+for _ in range(n):",
"+ a = float(eval(input()))",
"+ a = round(a * 10**9 + 0.1)",
"+ biga.append(a)"
] | false | 0.038099 | 0.057952 | 0.657414 | [
"s319297605",
"s624443918"
] |
u408071652 | p03163 | python | s711297532 | s840067376 | 393 | 320 | 154,412 | 146,400 | Accepted | Accepted | 18.58 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N, W = list(map(int, input().split()))
dp = [[0] * (N + 1) for _ in range(W + 1)]
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
for j in range(W + 1):
if j >= w:
... | import sys
import math
import itertools
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, WW = list(map(int, input().split()))
W = []
V = []
for i in range(N):
w, v = list(map(int, input().split()))
W.append(w)
V.append(v)
d... | 23 | 37 | 496 | 646 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N, W = list(map(int, input().split()))
dp = [[0] * (N + 1) for _ in range(W + 1)]
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
for j in range(W + 1):
if j >= w:
dp... | import sys
import math
import itertools
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, WW = list(map(int, input().split()))
W = []
V = []
for i in range(N):
w, v = list(map(int, input().split()))
W.append(w)
V.append(v)
dp = [[0] * (WW + 1) for _... | false | 37.837838 | [
"+import math",
"+import itertools",
"-",
"+# \\n",
"- N, W = list(map(int, input().split()))",
"- dp = [[0] * (N + 1) for _ in range(W + 1)]",
"- for i in range(1, N + 1):",
"+ N, WW = list(map(int, input().split()))",
"+ W = []",
"+ V = []",
"+ for i in range(N):",
"- ... | false | 0.049796 | 0.039997 | 1.244987 | [
"s711297532",
"s840067376"
] |
u785578220 | p03287 | python | s057690706 | s602079293 | 388 | 90 | 19,364 | 19,368 | Accepted | Accepted | 76.8 | import itertools
from math import factorial
from collections import Counter
ans = 0
N, L = list(map(int, input().split()))
x = list(map(int, input().split()))
y = itertools.accumulate(x)
y = [e % L for e in y]
#print(y)
#print(y)
so = set(y)
#print(so)
#print(so)
counter = Counter([0]+y)
#print(counter.... | import itertools
from math import factorial
from collections import Counter
ans = 0
N, L = list(map(int, input().split()))
x = list(map(int, input().split()))
y = itertools.accumulate(x)
y = [e % L for e in y]
#print(y)
#print(y)
so = set(y)
#print(so)
#print(so)
counter = Counter([0]+y)
#print(counter.... | 21 | 21 | 441 | 415 | import itertools
from math import factorial
from collections import Counter
ans = 0
N, L = list(map(int, input().split()))
x = list(map(int, input().split()))
y = itertools.accumulate(x)
y = [e % L for e in y]
# print(y)
# print(y)
so = set(y)
# print(so)
# print(so)
counter = Counter([0] + y)
# print(counter.values()... | import itertools
from math import factorial
from collections import Counter
ans = 0
N, L = list(map(int, input().split()))
x = list(map(int, input().split()))
y = itertools.accumulate(x)
y = [e % L for e in y]
# print(y)
# print(y)
so = set(y)
# print(so)
# print(so)
counter = Counter([0] + y)
# print(counter.values()... | false | 0 | [
"- if i > 1:",
"- ans += factorial(i) // 2 // factorial(i - 2)",
"+ ans += i * (i - 1) // 2"
] | false | 0.041573 | 0.037341 | 1.113351 | [
"s057690706",
"s602079293"
] |
u847467233 | p00693 | python | s125439470 | s833376514 | 1,850 | 1,640 | 8,228 | 7,704 | Accepted | Accepted | 11.35 | # AOJ 1111: Cyber Guardian
# Python3 2018.7.15 bal4u
import re
while True:
n, m = list(map(int, input().split()))
if (n|m) == 0: break
rule, ans = [], []
for i in range(n):
g, s, d = input().split()
rule.append((g[0] == 'p', \
re.compile(s.replace("?", "[0-9]")), \
r... | # AOJ 1111: Cyber Guardian
# Python3 2018.7.15 bal4u
import re
while True:
n, m = list(map(int, input().split()))
if (n|m) == 0: break
rule, ans = [], []
for i in range(n):
g, s, d = input().split()
rule.append((g[0] == 'p', re.compile((s+d).replace("?", "[0-9]"))))
for i in range(m):
s, d, m = ... | 23 | 21 | 563 | 485 | # AOJ 1111: Cyber Guardian
# Python3 2018.7.15 bal4u
import re
while True:
n, m = list(map(int, input().split()))
if (n | m) == 0:
break
rule, ans = [], []
for i in range(n):
g, s, d = input().split()
rule.append(
(
g[0] == "p",
re.com... | # AOJ 1111: Cyber Guardian
# Python3 2018.7.15 bal4u
import re
while True:
n, m = list(map(int, input().split()))
if (n | m) == 0:
break
rule, ans = [], []
for i in range(n):
g, s, d = input().split()
rule.append((g[0] == "p", re.compile((s + d).replace("?", "[0-9]"))))
for ... | false | 8.695652 | [
"- rule.append(",
"- (",
"- g[0] == \"p\",",
"- re.compile(s.replace(\"?\", \"[0-9]\")),",
"- re.compile(d.replace(\"?\", \"[0-9]\")),",
"- )",
"- )",
"+ rule.append((g[0] == \"p\", re.compile((s + d).replace(\"?\"... | false | 0.145008 | 0.051528 | 2.814168 | [
"s125439470",
"s833376514"
] |
u989345508 | p02697 | python | s458472606 | s637721538 | 80 | 70 | 9,260 | 9,208 | Accepted | Accepted | 12.5 | n,m=list(map(int,input().split()))
if n%2==1:
l=n//2
for i in range(m):
if i%2==1:
print((i//2+1,l-i//2))
else:
print((l+i//2+1,n-i//2))
else:
l=n//2
for i in range(m):
if i%2==0:
print((i//2+1,l-i//2))
else:
p... | n,m=list(map(int,input().split()))
if n%2==1:
for i in range(m):
print((i+1,n-i))
else:
for i in range(m):
if i<m/2:
print((i+1,n-i))
else:
print((i+1,n-i-1)) | 16 | 10 | 332 | 211 | n, m = list(map(int, input().split()))
if n % 2 == 1:
l = n // 2
for i in range(m):
if i % 2 == 1:
print((i // 2 + 1, l - i // 2))
else:
print((l + i // 2 + 1, n - i // 2))
else:
l = n // 2
for i in range(m):
if i % 2 == 0:
print((i // 2 + 1, l... | n, m = list(map(int, input().split()))
if n % 2 == 1:
for i in range(m):
print((i + 1, n - i))
else:
for i in range(m):
if i < m / 2:
print((i + 1, n - i))
else:
print((i + 1, n - i - 1))
| false | 37.5 | [
"- l = n // 2",
"- if i % 2 == 1:",
"- print((i // 2 + 1, l - i // 2))",
"+ print((i + 1, n - i))",
"+else:",
"+ for i in range(m):",
"+ if i < m / 2:",
"+ print((i + 1, n - i))",
"- print((l + i // 2 + 1, n - i // 2))",
"-else:",
"- ... | false | 0.047467 | 0.047893 | 0.991111 | [
"s458472606",
"s637721538"
] |
u905895868 | p02927 | python | s203528239 | s016755072 | 35 | 32 | 9,176 | 9,188 | Accepted | Accepted | 8.57 | months, d = list(map(int, input().split()))
ans_count = 0
for month in range(4, months + 1):
for i in range(1, d + 1):
if i <= 9:
continue
a, b = list(map(int, str(i)))
if a >= 2 and b >= 2 and a * b == month:
ans_count += 1
print(ans_count) | months, d = list(map(int, input().split()))
ans_count = 0
for month in range(4, months + 1):
for i in range(1, d + 1):
if i <= 9:
continue
a, b = list(map(int, str(i)))
if a <= 1 or b <= 1:
continue
if a * b == month:
ans_count ... | 15 | 18 | 300 | 332 | months, d = list(map(int, input().split()))
ans_count = 0
for month in range(4, months + 1):
for i in range(1, d + 1):
if i <= 9:
continue
a, b = list(map(int, str(i)))
if a >= 2 and b >= 2 and a * b == month:
ans_count += 1
print(ans_count)
| months, d = list(map(int, input().split()))
ans_count = 0
for month in range(4, months + 1):
for i in range(1, d + 1):
if i <= 9:
continue
a, b = list(map(int, str(i)))
if a <= 1 or b <= 1:
continue
if a * b == month:
ans_count += 1
print(ans_count... | false | 16.666667 | [
"- if a >= 2 and b >= 2 and a * b == month:",
"+ if a <= 1 or b <= 1:",
"+ continue",
"+ if a * b == month:"
] | false | 0.183803 | 0.039356 | 4.670245 | [
"s203528239",
"s016755072"
] |
u065446124 | p02678 | python | s240037463 | s731524880 | 527 | 455 | 110,980 | 34,868 | Accepted | Accepted | 13.66 | import sys
input=sys.stdin.readline
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
def YesNo(x):print("Yes")if x==True else print("No")
n,m=NM()
edge=[[] for i in range(n+1)]
for ... | import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
def YesNo(x):print("Yes")if x==True else print("No")
n,m=NM()
edge=[[] for i ... | 38 | 35 | 933 | 858 | import sys
input = sys.stdin.readline
def N():
return int(input())
def NM():
return map(int, input().split())
def L():
return list(NM())
def LN(n):
return [N() for i in range(n)]
def LL(n):
return [L() for i in range(n)]
def YesNo(x):
print("Yes") if x == True else print("No")
n, ... | import sys
def input():
return sys.stdin.readline()[:-1]
def N():
return int(input())
def NM():
return map(int, input().split())
def L():
return list(NM())
def LN(n):
return [N() for i in range(n)]
def LL(n):
return [L() for i in range(n)]
def YesNo(x):
print("Yes") if x == Tru... | false | 7.894737 | [
"-input = sys.stdin.readline",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"- c = 1",
"- edge[a].append((b, c))",
"- edge[b].append((a, c))",
"+ edge[a].append(b)",
"+ edge[b].append(a)",
"-from heapq import *",
"+from collections import deque",
"-def dijkstra... | false | 0.101801 | 0.081003 | 1.256759 | [
"s240037463",
"s731524880"
] |
u045953894 | p03478 | python | s289050733 | s474331245 | 35 | 32 | 2,940 | 2,940 | Accepted | Accepted | 8.57 | N, A, B = list(map(int, input().split()))
res = 0
for i in range(N+1):
if A <= sum([int(s) for s in str(i)]) <= B:
res += i
print(res) | n,a,b = list(map(int,input().split()))
s = 0
for i in range(n+1):
if a <= sum([int(j) for j in str(i)]) <= b:
s += i
print(s) | 6 | 6 | 145 | 136 | N, A, B = list(map(int, input().split()))
res = 0
for i in range(N + 1):
if A <= sum([int(s) for s in str(i)]) <= B:
res += i
print(res)
| n, a, b = list(map(int, input().split()))
s = 0
for i in range(n + 1):
if a <= sum([int(j) for j in str(i)]) <= b:
s += i
print(s)
| false | 0 | [
"-N, A, B = list(map(int, input().split()))",
"-res = 0",
"-for i in range(N + 1):",
"- if A <= sum([int(s) for s in str(i)]) <= B:",
"- res += i",
"-print(res)",
"+n, a, b = list(map(int, input().split()))",
"+s = 0",
"+for i in range(n + 1):",
"+ if a <= sum([int(j) for j in str(i)]... | false | 0.043772 | 0.04801 | 0.911725 | [
"s289050733",
"s474331245"
] |
u580093517 | p03737 | python | s464500688 | s122746029 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | s1,s2,s3 = list(map(str,input().split()))
s = s1[0] + s2[0] + s3[0]
s = s.upper()
print(s) | a,b,c = input().split()
print(((a[0]+b[0]+c[0]).upper())) | 7 | 2 | 93 | 56 | s1, s2, s3 = list(map(str, input().split()))
s = s1[0] + s2[0] + s3[0]
s = s.upper()
print(s)
| a, b, c = input().split()
print(((a[0] + b[0] + c[0]).upper()))
| false | 71.428571 | [
"-s1, s2, s3 = list(map(str, input().split()))",
"-s = s1[0] + s2[0] + s3[0]",
"-s = s.upper()",
"-print(s)",
"+a, b, c = input().split()",
"+print(((a[0] + b[0] + c[0]).upper()))"
] | false | 0.089918 | 0.04344 | 2.069926 | [
"s464500688",
"s122746029"
] |
u077291787 | p02948 | python | s844999137 | s517118489 | 253 | 165 | 18,512 | 24,932 | Accepted | Accepted | 34.78 | # ABC137D - Summer Vacation
import sys
input = sys.stdin.readline
from heapq import heappush, heappushpop
def main():
N, M = tuple(map(int, input().split()))
T = [[] for _ in range(M + 1)]
for _ in range(N):
a, b = list(map(int, input().rstrip().split()))
if a <= M:
... | # ABC137D - Summer Vacation
from heapq import heappush, heappushpop
def main():
N, M, *A = list(map(int, open(0).read().split()))
# T[i] := candidates of values on i-th deadline
T = [[] for _ in range(M + 1)]
for a, b in zip(*[iter(A)] * 2):
if a <= M:
T[M - a] += [b]
... | 26 | 24 | 574 | 612 | # ABC137D - Summer Vacation
import sys
input = sys.stdin.readline
from heapq import heappush, heappushpop
def main():
N, M = tuple(map(int, input().split()))
T = [[] for _ in range(M + 1)]
for _ in range(N):
a, b = list(map(int, input().rstrip().split()))
if a <= M:
T[M - a] +... | # ABC137D - Summer Vacation
from heapq import heappush, heappushpop
def main():
N, M, *A = list(map(int, open(0).read().split()))
# T[i] := candidates of values on i-th deadline
T = [[] for _ in range(M + 1)]
for a, b in zip(*[iter(A)] * 2):
if a <= M:
T[M - a] += [b]
q = [] #... | false | 7.692308 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"- N, M = tuple(map(int, input().split()))",
"+ N, M, *A = list(map(int, open(0).read().split()))",
"+ # T[i] := candidates of values on i-th deadline",
"- for _ in range(N):",
"- a, b = list(map(int, input().rstrip().split()))",
... | false | 0.185548 | 0.062328 | 2.976958 | [
"s844999137",
"s517118489"
] |
u367130284 | p03425 | python | s554870225 | s009319342 | 56 | 40 | 10,668 | 10,664 | Accepted | Accepted | 28.57 | from itertools import*;print((sum(p*q*r for p,q,r in list(combinations([len(list(v))for k,v in groupby(sorted(s[0]for s in open(0).readlines()[1:]))if k in"MARCH"],3))))) | from itertools import*;x=[s[0]for s in open(0).readlines()];print((sum(p*q*r for p,q,r in combinations([x.count(s)for s in"MARCH"],3)))) | 1 | 1 | 168 | 134 | from itertools import *
print(
(
sum(
p * q * r
for p, q, r in list(
combinations(
[
len(list(v))
for k, v in groupby(
sorted(s[0] for s in open(0).readlines()[1:])
... | from itertools import *
x = [s[0] for s in open(0).readlines()]
print((sum(p * q * r for p, q, r in combinations([x.count(s) for s in "MARCH"], 3))))
| false | 0 | [
"-print(",
"- (",
"- sum(",
"- p * q * r",
"- for p, q, r in list(",
"- combinations(",
"- [",
"- len(list(v))",
"- for k, v in groupby(",
"- sorted(s[0] for s... | false | 0.036918 | 0.035849 | 1.029804 | [
"s554870225",
"s009319342"
] |
u057109575 | p02609 | python | s066390220 | s455023222 | 349 | 321 | 79,768 | 84,536 | Accepted | Accepted | 8.02 | N = int(eval(input()))
X = eval(input())
cnt = X.count("1")
res0 = 0
res1 = 0
for i in range(N):
if X[i] == "1":
res0 = (res0 + pow(2, N - i - 1, cnt + 1)) % (cnt + 1)
if cnt - 1 > 0:
res1 = (res1 + pow(2, N - i - 1, cnt - 1)) % (cnt - 1)
for i in range(N):
ans = 0
... |
N = int(input())
X = input()
mod0 = X.count("1") + 1
mod1 = X.count("1") - 1
full0 = 0
full1 = 0
for i in range(N):
if X[i] == "1":
full0 = (full0 + pow(2, N - i - 1, mod0)) % mod0
if mod1 > 0:
full1 = (full1 + pow(2, N - i - 1, mod1)) % mod1
ans = [0] * N
for i in ra... | 33 | 34 | 727 | 712 | N = int(eval(input()))
X = eval(input())
cnt = X.count("1")
res0 = 0
res1 = 0
for i in range(N):
if X[i] == "1":
res0 = (res0 + pow(2, N - i - 1, cnt + 1)) % (cnt + 1)
if cnt - 1 > 0:
res1 = (res1 + pow(2, N - i - 1, cnt - 1)) % (cnt - 1)
for i in range(N):
ans = 0
if X[i] == "0"... | N = int(input())
X = input()
mod0 = X.count("1") + 1
mod1 = X.count("1") - 1
full0 = 0
full1 = 0
for i in range(N):
if X[i] == "1":
full0 = (full0 + pow(2, N - i - 1, mod0)) % mod0
if mod1 > 0:
full1 = (full1 + pow(2, N - i - 1, mod1)) % mod1
ans = [0] * N
for i in range(N):
if X[i] ... | false | 2.941176 | [
"-N = int(eval(input()))",
"-X = eval(input())",
"-cnt = X.count(\"1\")",
"-res0 = 0",
"-res1 = 0",
"+N = int(input())",
"+X = input()",
"+mod0 = X.count(\"1\") + 1",
"+mod1 = X.count(\"1\") - 1",
"+full0 = 0",
"+full1 = 0",
"- res0 = (res0 + pow(2, N - i - 1, cnt + 1)) % (cnt + 1)",
... | false | 0.040297 | 0.037406 | 1.077278 | [
"s066390220",
"s455023222"
] |
u116038906 | p02850 | python | s584411917 | s559475009 | 861 | 662 | 117,036 | 68,748 | Accepted | Accepted | 23.11 | from collections import deque
import sys
input =sys.stdin.readline
N = int(eval(input()))
#構造入力
color_max =0
connection ={i:deque() for i in range(1,N+1)}
edge_color={}
A =[(-1,-1)]*N
for i in range(1,N):
a,b = (int(x) for x in input().split())
connection[a].append(b)
connection[b].append(a)
... | """2020/7/2再挑戦"""
#幅優先探索 親の頂点と色を覚えておく。親の色を除く+1ずつ足していく。color_maxを超えたら余りをとる。
from collections import deque
N = int(eval(input()))
connection ={i:set() for i in range(1,N+1)}
connection_parent =[]
for i in range(1,N):
a,b = (int(i) for i in input().split())
connection[a].add(b)
connection[b].add(a)
... | 49 | 37 | 1,227 | 944 | from collections import deque
import sys
input = sys.stdin.readline
N = int(eval(input()))
# 構造入力
color_max = 0
connection = {i: deque() for i in range(1, N + 1)}
edge_color = {}
A = [(-1, -1)] * N
for i in range(1, N):
a, b = (int(x) for x in input().split())
connection[a].append(b)
connection[b].append(a... | """2020/7/2再挑戦"""
# 幅優先探索 親の頂点と色を覚えておく。親の色を除く+1ずつ足していく。color_maxを超えたら余りをとる。
from collections import deque
N = int(eval(input()))
connection = {i: set() for i in range(1, N + 1)}
connection_parent = []
for i in range(1, N):
a, b = (int(i) for i in input().split())
connection[a].add(b)
connection[b].add(a)
... | false | 24.489796 | [
"+\"\"\"2020/7/2再挑戦\"\"\"",
"+# 幅優先探索 親の頂点と色を覚えておく。親の色を除く+1ずつ足していく。color_maxを超えたら余りをとる。",
"-import sys",
"-input = sys.stdin.readline",
"-# 構造入力",
"-color_max = 0",
"-connection = {i: deque() for i in range(1, N + 1)}",
"-edge_color = {}",
"-A = [(-1, -1)] * N",
"+connection = {i: set() for i in r... | false | 0.0401 | 0.040083 | 1.000425 | [
"s584411917",
"s559475009"
] |
u475503988 | p02947 | python | s880380965 | s683789964 | 538 | 384 | 26,304 | 17,808 | Accepted | Accepted | 28.62 | N = int(eval(input()))
ss = []
for i in range(N):
s = list(eval(input()))
s.sort()
ss.append(s)
ss.sort()
ans = 0
tmp = 1
for i in range(N-1):
if ss[i] == ss[i+1]:
tmp += 1
if i == N-2:
ans += (tmp * (tmp-1)) // 2
else:
ans += (tmp * (tmp-1)) // 2... | N = int(eval(input()))
d = dict()
for i in range(N):
s = list(eval(input()))
s.sort()
s = ''.join(s)
if s in d:
d[s] += 1
else:
d[s] = 1
ans = 0
for i in list(d.values()):
ans += (i * (i-1)) // 2
print(ans) | 20 | 16 | 340 | 245 | N = int(eval(input()))
ss = []
for i in range(N):
s = list(eval(input()))
s.sort()
ss.append(s)
ss.sort()
ans = 0
tmp = 1
for i in range(N - 1):
if ss[i] == ss[i + 1]:
tmp += 1
if i == N - 2:
ans += (tmp * (tmp - 1)) // 2
else:
ans += (tmp * (tmp - 1)) // 2
... | N = int(eval(input()))
d = dict()
for i in range(N):
s = list(eval(input()))
s.sort()
s = "".join(s)
if s in d:
d[s] += 1
else:
d[s] = 1
ans = 0
for i in list(d.values()):
ans += (i * (i - 1)) // 2
print(ans)
| false | 20 | [
"-ss = []",
"+d = dict()",
"- ss.append(s)",
"-ss.sort()",
"+ s = \"\".join(s)",
"+ if s in d:",
"+ d[s] += 1",
"+ else:",
"+ d[s] = 1",
"-tmp = 1",
"-for i in range(N - 1):",
"- if ss[i] == ss[i + 1]:",
"- tmp += 1",
"- if i == N - 2:",
"- ... | false | 0.043423 | 0.035277 | 1.230904 | [
"s880380965",
"s683789964"
] |
u332906195 | p03545 | python | s982257359 | s246964530 | 20 | 17 | 3,188 | 3,060 | Accepted | Accepted | 15 | # -*- coding: utf-8 -*-
import itertools
ABCD = eval(input())
l = len(ABCD)
cs = itertools.product(['+', '-'], repeat=l-1)
ans = 0
for c in cs:
ex = ''.join([ABCD[i] + c[i] for i in range(l-1)] + [ABCD[-1]])
exec("ans = {}".format(ex))
if ans == 7:
break
print((ex + "=7"))
| import itertools
S = eval(input())
for op1, op2, op3 in itertools.product('+-', repeat=3):
if eval(S[0] + op1 + S[1] + op2 + S[2] + op3 + S[3]) == 7:
print((S[0] + op1 + S[1] + op2 + S[2] + op3 + S[3] + "=7"))
exit()
| 16 | 8 | 305 | 238 | # -*- coding: utf-8 -*-
import itertools
ABCD = eval(input())
l = len(ABCD)
cs = itertools.product(["+", "-"], repeat=l - 1)
ans = 0
for c in cs:
ex = "".join([ABCD[i] + c[i] for i in range(l - 1)] + [ABCD[-1]])
exec("ans = {}".format(ex))
if ans == 7:
break
print((ex + "=7"))
| import itertools
S = eval(input())
for op1, op2, op3 in itertools.product("+-", repeat=3):
if eval(S[0] + op1 + S[1] + op2 + S[2] + op3 + S[3]) == 7:
print((S[0] + op1 + S[1] + op2 + S[2] + op3 + S[3] + "=7"))
exit()
| false | 50 | [
"-# -*- coding: utf-8 -*-",
"-ABCD = eval(input())",
"-l = len(ABCD)",
"-cs = itertools.product([\"+\", \"-\"], repeat=l - 1)",
"-ans = 0",
"-for c in cs:",
"- ex = \"\".join([ABCD[i] + c[i] for i in range(l - 1)] + [ABCD[-1]])",
"- exec(\"ans = {}\".format(ex))",
"- if ans == 7:",
"- ... | false | 0.044767 | 0.041289 | 1.08424 | [
"s982257359",
"s246964530"
] |
u707124227 | p02727 | python | s085586931 | s994346623 | 237 | 161 | 23,328 | 29,688 | Accepted | Accepted | 32.07 | x,y,a,b,c=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
p=p[-x:]
q.sort()
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort()
p=p[-x-y:]
print((sum(p))) | x,y,nr,ng,nm=list(map(int,input().split()))
r=list(map(int,input().split()))
g=list(map(int,input().split()))
m=list(map(int,input().split()))
r.sort(reverse=True)
g.sort(reverse=True)
a=r[:x]+g[:y]+m
a.sort(reverse=True)
print((sum(a[:x+y])))
| 13 | 9 | 253 | 244 | x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
p = p[-x:]
q.sort()
q = q[-y:]
p[len(p) : len(p)] = q
p[len(p) : len(p)] = r
p.sort()
p = p[-x - y :]
print((sum(p)))
| x, y, nr, ng, nm = list(map(int, input().split()))
r = list(map(int, input().split()))
g = list(map(int, input().split()))
m = list(map(int, input().split()))
r.sort(reverse=True)
g.sort(reverse=True)
a = r[:x] + g[:y] + m
a.sort(reverse=True)
print((sum(a[: x + y])))
| false | 30.769231 | [
"-x, y, a, b, c = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"+x, y, nr, ng, nm = list(map(int, input().split()))",
"-p.sort()",
"-p = p[-x:]",
"-q.sort()",
"-q = q[-y:]",
"-p[len(p) : len(p)] = q",
"-p[len(p) : len(p)] = r",
... | false | 0.084633 | 0.035491 | 2.384659 | [
"s085586931",
"s994346623"
] |
u994521204 | p02887 | python | s124228620 | s381229278 | 44 | 33 | 3,316 | 3,316 | Accepted | Accepted | 25 | n=int(eval(input()))
s=eval(input())
c=1
for i in range(1,n):
if s[i]!=s[i-1]:
c+=1
print(c) | n = int(eval(input()))
s = eval(input())
ans = 0
prev = ""
for a in s:
if prev == a:
continue
else:
ans += 1
prev = a
print(ans)
| 7 | 11 | 98 | 159 | n = int(eval(input()))
s = eval(input())
c = 1
for i in range(1, n):
if s[i] != s[i - 1]:
c += 1
print(c)
| n = int(eval(input()))
s = eval(input())
ans = 0
prev = ""
for a in s:
if prev == a:
continue
else:
ans += 1
prev = a
print(ans)
| false | 36.363636 | [
"-c = 1",
"-for i in range(1, n):",
"- if s[i] != s[i - 1]:",
"- c += 1",
"-print(c)",
"+ans = 0",
"+prev = \"\"",
"+for a in s:",
"+ if prev == a:",
"+ continue",
"+ else:",
"+ ans += 1",
"+ prev = a",
"+print(ans)"
] | false | 0.047662 | 0.047342 | 1.006767 | [
"s124228620",
"s381229278"
] |
u423665486 | p03713 | python | s568369018 | s130003024 | 336 | 194 | 3,064 | 41,196 | Accepted | Accepted | 42.26 | def min_value(w, h):
ans = float('inf')
for i in range(1, h):
a = w*i
v_t = (h-i)//2 * w
v_b = (h-i)*w - v_t
v_re = max(a, v_t, v_b) - min(a, v_t, v_b)
h_l = (h-i)*(w//2)
h_r = (h-i)*w-h_l
h_re = max(a, h_l, h_r) - min(a, h_l, h_r)
ans = min(ans, v_re, h_re)
return ans
def resolve():
... | def calc(w, h):
v = float('inf')
a = w * h
for i in range(1, h):
h_a = w*i
h_b = (h - i)//2*w
h_c = a - h_a - h_b
h_max = max(h_a, h_b, h_c)
h_min = min(h_a, h_b, h_c)
v = min(v, h_max - h_min)
v_b = w//2*(h-i)
v_c = a - h_a - v_b
v_max = max(h_a, v_b, v_c)
v_min = min(h_a, v_b, v_c)... | 19 | 21 | 426 | 461 | def min_value(w, h):
ans = float("inf")
for i in range(1, h):
a = w * i
v_t = (h - i) // 2 * w
v_b = (h - i) * w - v_t
v_re = max(a, v_t, v_b) - min(a, v_t, v_b)
h_l = (h - i) * (w // 2)
h_r = (h - i) * w - h_l
h_re = max(a, h_l, h_r) - min(a, h_l, h_r)
... | def calc(w, h):
v = float("inf")
a = w * h
for i in range(1, h):
h_a = w * i
h_b = (h - i) // 2 * w
h_c = a - h_a - h_b
h_max = max(h_a, h_b, h_c)
h_min = min(h_a, h_b, h_c)
v = min(v, h_max - h_min)
v_b = w // 2 * (h - i)
v_c = a - h_a - v_b
... | false | 9.52381 | [
"-def min_value(w, h):",
"- ans = float(\"inf\")",
"+def calc(w, h):",
"+ v = float(\"inf\")",
"+ a = w * h",
"- a = w * i",
"- v_t = (h - i) // 2 * w",
"- v_b = (h - i) * w - v_t",
"- v_re = max(a, v_t, v_b) - min(a, v_t, v_b)",
"- h_l = (h - i) * (w //... | false | 0.385581 | 0.007067 | 54.563145 | [
"s568369018",
"s130003024"
] |
u079022693 | p02714 | python | s722393332 | s875018255 | 917 | 831 | 70,424 | 9,048 | Accepted | Accepted | 9.38 | from sys import stdin
import bisect
def main():
#入力
readline=stdin.readline
N=int(readline())
S=readline().strip()
res=0
R=[]
G=[]
B=[]
flags=[""]*N
for i in range(N):
if S[i]=="R":
R.append(i)
flags[i]="R"
elif S[i]=="G... | from sys import stdin
def main():
#入力
readline=stdin.readline
n=int(readline())
s=readline().strip()
ans=s.count("R")*s.count("G")*s.count("B")
for i in range(n):
for j in range(i+1,n):
k=2*j-i
if k>=n: break
x=s[i]
y=s[j]
... | 56 | 22 | 1,348 | 458 | from sys import stdin
import bisect
def main():
# 入力
readline = stdin.readline
N = int(readline())
S = readline().strip()
res = 0
R = []
G = []
B = []
flags = [""] * N
for i in range(N):
if S[i] == "R":
R.append(i)
flags[i] = "R"
elif S[i... | from sys import stdin
def main():
# 入力
readline = stdin.readline
n = int(readline())
s = readline().strip()
ans = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
for j in range(i + 1, n):
k = 2 * j - i
if k >= n:
break
x... | false | 60.714286 | [
"-import bisect",
"- N = int(readline())",
"- S = readline().strip()",
"- res = 0",
"- R = []",
"- G = []",
"- B = []",
"- flags = [\"\"] * N",
"- for i in range(N):",
"- if S[i] == \"R\":",
"- R.append(i)",
"- flags[i] = \"R\"",
"- ... | false | 0.038531 | 0.093882 | 0.410415 | [
"s722393332",
"s875018255"
] |
u995004106 | p03426 | python | s912581746 | s595938446 | 911 | 819 | 92,892 | 84,188 | Accepted | Accepted | 10.1 | import pprint
H,W,D=list(map(int,input().split()))
table=[list(map(int,input().split())) for _ in range(H)]
Q=int(eval(input()))
query=[list(map(int,input().split())) for _ in range(Q)]
num=[]
distfrom1D=[]
for i in range(H):
for j in range(W):
num.append([table[i][j],i,j])
num.sort(key=lambda x:x... | import pprint
H,W,D=list(map(int,input().split()))
table=[list(map(int,input().split())) for _ in range(H)]
Q=int(eval(input()))
query=[list(map(int,input().split())) for _ in range(Q)]
num=[]
distfrom1D=[]
cumldist=[0]*(H*W+1)
for i in range(H):
for j in range(W):
num.append([table[i][j],i,j])
n... | 40 | 52 | 890 | 1,257 | import pprint
H, W, D = list(map(int, input().split()))
table = [list(map(int, input().split())) for _ in range(H)]
Q = int(eval(input()))
query = [list(map(int, input().split())) for _ in range(Q)]
num = []
distfrom1D = []
for i in range(H):
for j in range(W):
num.append([table[i][j], i, j])
num.sort(key=... | import pprint
H, W, D = list(map(int, input().split()))
table = [list(map(int, input().split())) for _ in range(H)]
Q = int(eval(input()))
query = [list(map(int, input().split())) for _ in range(Q)]
num = []
distfrom1D = []
cumldist = [0] * (H * W + 1)
for i in range(H):
for j in range(W):
num.append([tabl... | false | 23.076923 | [
"+cumldist = [0] * (H * W + 1)",
"+\"\"\"",
"- buf = [0]",
"- for j in range(i, H * W - D, D):",
"- # print(i+j,i+j+D)",
"- buf.append(",
"- buf[len(buf) - 1]",
"- + abs(num[j][1] - num[j + D][1])",
"- + abs(num[j][2] - num[j + D][2])",
"+ bu... | false | 0.048794 | 0.037261 | 1.309529 | [
"s912581746",
"s595938446"
] |
u285681431 | p03682 | python | s971990373 | s109098511 | 879 | 792 | 135,260 | 133,184 | Accepted | Accepted | 9.9 | # UnionFind
#############################################################
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, v): # vが属する集合の根を返す
if self.parents[v] < 0:
return v
else:
self.parents[v] = s... | # UnionFind
#############################################################
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, v): # vが属する集合の根を返す
if self.parents[v] < 0:
return v
else:
self.parents[v] = s... | 56 | 58 | 1,487 | 1,527 | # UnionFind
#############################################################
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, v): # vが属する集合の根を返す
if self.parents[v] < 0:
return v
else:
self.parents[v] = self.find(self... | # UnionFind
#############################################################
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, v): # vが属する集合の根を返す
if self.parents[v] < 0:
return v
else:
self.parents[v] = self.find(self... | false | 3.448276 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.095235 | 0.09496 | 1.002895 | [
"s971990373",
"s109098511"
] |
u281303342 | p03425 | python | s914912025 | s636683202 | 182 | 154 | 9,752 | 10,112 | Accepted | Accepted | 15.38 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
from itertools import combinations
c = list(combinations([i for i in range(5)],3))
cnt = [0]*6
for i in range(N):
cnt["MARCH".find(S[i][0])] += 1
ans = 0
for (i,j,k) in c:
ans += cnt[i]*cnt[j]*cnt[k]
print(ans) | from collections import defaultdict
from itertools import combinations
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
dic = defaultdict(int)
for s in S:
dic[s[0]] += 1
comb = combinations("MARCH", 3)
ans = 0
for x1,x2,x3 in comb:
ans += dic[x1]*dic[x2]*dic[x3]
print(ans)
| 15 | 17 | 285 | 303 | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
from itertools import combinations
c = list(combinations([i for i in range(5)], 3))
cnt = [0] * 6
for i in range(N):
cnt["MARCH".find(S[i][0])] += 1
ans = 0
for (i, j, k) in c:
ans += cnt[i] * cnt[j] * cnt[k]
print(ans)
| from collections import defaultdict
from itertools import combinations
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
dic = defaultdict(int)
for s in S:
dic[s[0]] += 1
comb = combinations("MARCH", 3)
ans = 0
for x1, x2, x3 in comb:
ans += dic[x1] * dic[x2] * dic[x3]
print(ans)
| false | 11.764706 | [
"+from collections import defaultdict",
"+from itertools import combinations",
"+",
"-from itertools import combinations",
"-",
"-c = list(combinations([i for i in range(5)], 3))",
"-cnt = [0] * 6",
"-for i in range(N):",
"- cnt[\"MARCH\".find(S[i][0])] += 1",
"+dic = defaultdict(int)",
"+for... | false | 0.039179 | 0.038145 | 1.027106 | [
"s914912025",
"s636683202"
] |
u585482323 | p02918 | python | s478321713 | s458838240 | 205 | 184 | 51,568 | 40,048 | Accepted | Accepted | 10.24 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [l... | 125 | 41 | 2,298 | 958 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
... | false | 67.2 | [
"+from itertools import permutations",
"-# A",
"-def A():",
"- n = I()",
"- print((n**3))",
"- return",
"-# B",
"-def B():",
"- n = I()",
"- a = LI()",
"- b = LI()",
"- c = LI()",
"- ans = sum(b)",
"- for i in range(n - 1):",
"- x = a[i]",
"- y ... | false | 0.046404 | 0.046078 | 1.007059 | [
"s478321713",
"s458838240"
] |
u332906195 | p02813 | python | s686559734 | s988551343 | 34 | 27 | 8,052 | 8,052 | Accepted | Accepted | 20.59 | import itertools
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
LUT = list(itertools.permutations(list(range(1, N + 1))))
Pi, Qi = -1, -1
for i in range(len(LUT)):
if LUT[i] == P:
Pi = i
if LUT[i] == Q:
Qi = i
print((abs(Qi - P... | from itertools import *
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
LUT = list(permutations(list(range(1, N + 1)))).index
print((abs(LUT(P) - LUT(Q))))
| 16 | 8 | 311 | 200 | import itertools
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
LUT = list(itertools.permutations(list(range(1, N + 1))))
Pi, Qi = -1, -1
for i in range(len(LUT)):
if LUT[i] == P:
Pi = i
if LUT[i] == Q:
Qi = i
print((abs(Qi - Pi)))
| from itertools import *
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
LUT = list(permutations(list(range(1, N + 1)))).index
print((abs(LUT(P) - LUT(Q))))
| false | 50 | [
"-import itertools",
"+from itertools import *",
"-LUT = list(itertools.permutations(list(range(1, N + 1))))",
"-Pi, Qi = -1, -1",
"-for i in range(len(LUT)):",
"- if LUT[i] == P:",
"- Pi = i",
"- if LUT[i] == Q:",
"- Qi = i",
"-print((abs(Qi - Pi)))",
"+LUT = list(permutatio... | false | 0.07332 | 0.070257 | 1.043593 | [
"s686559734",
"s988551343"
] |
u499381410 | p02651 | python | s456516379 | s807229640 | 465 | 143 | 80,124 | 77,692 | Accepted | Accepted | 69.25 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 93 | 48 | 2,396 | 1,399 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gc... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gc... | false | 48.387097 | [
"-",
"-",
"-def least_bit_set(x):",
"- return x & (-x)",
"-",
"-",
"-def delete_zeros_from(values, start):",
"- i = start",
"- for j in range(start, len(values)):",
"- if values[j] != 0:",
"- values[i] = values[j]",
"- i += 1",
"- del values[i:]",
"... | false | 0.079713 | 0.045584 | 1.748701 | [
"s456516379",
"s807229640"
] |
u320567105 | p03504 | python | s931442247 | s955741712 | 884 | 715 | 22,428 | 36,892 | Accepted | Accepted | 19.12 | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
N,C=rl()
st = [[] for _ in range(... | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
N,C=rl()
stc = [rl() for _ in ran... | 54 | 27 | 1,349 | 707 | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
yn = lambda b: print("Yes") if b else print("No")
OE = lambda x: print("Odd") if x % 2 else print("Even")
INF = 10**18
N, C = rl()
st = [[] for _ in range(C)]
... | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
yn = lambda b: print("Yes") if b else print("No")
OE = lambda x: print("Odd") if x % 2 else print("Even")
INF = 10**18
N, C = rl()
stc = [rl() for _ in range(N... | false | 50 | [
"-st = [[] for _ in range(C)]",
"-TT1 = [0 for _ in range(10**5 + 2)]",
"-for i in range(N):",
"- s, t, c = rl()",
"- TT1[s] += 1",
"- TT1[t + 1] -= 1",
"- st[c - 1].append([s, t])",
"-for st_i in range(len(st)):",
"- st_ = st[st_i]",
"- if len(st_) <= 1:",
"- continue",... | false | 0.106036 | 0.143932 | 0.73671 | [
"s931442247",
"s955741712"
] |
u342563578 | p02579 | python | s158909014 | s390962846 | 1,004 | 920 | 185,524 | 181,384 | Accepted | Accepted | 8.37 | h,w = list(map(int,input().split()))
c = list(map(int,input().split()))
c[0] -= 1
c[1] -= 1
d = list(map(int,input().split()))
d[0] -= 1
d[1] -= 1
p = []
q = [[None for i in range(w)]for i in range(h)]
r = [[] for i in range(10**6)]
for i in range(h):
s = eval(input())
s = list(s)
p.append(s)
... | h,w = list(map(int,input().split()))
c = list(map(int,input().split()))
c[0] -= 1
c[1] -= 1
d = list(map(int,input().split()))
d[0] -= 1
d[1] -= 1
p = []
q = [[None for i in range(w)]for i in range(h)]
r = [[] for i in range(10**6)]
for i in range(h):
s = eval(input())
s = list(s)
p.append(s)
... | 54 | 54 | 1,742 | 1,738 | h, w = list(map(int, input().split()))
c = list(map(int, input().split()))
c[0] -= 1
c[1] -= 1
d = list(map(int, input().split()))
d[0] -= 1
d[1] -= 1
p = []
q = [[None for i in range(w)] for i in range(h)]
r = [[] for i in range(10**6)]
for i in range(h):
s = eval(input())
s = list(s)
p.append(s)
from coll... | h, w = list(map(int, input().split()))
c = list(map(int, input().split()))
c[0] -= 1
c[1] -= 1
d = list(map(int, input().split()))
d[0] -= 1
d[1] -= 1
p = []
q = [[None for i in range(w)] for i in range(h)]
r = [[] for i in range(10**6)]
for i in range(h):
s = eval(input())
s = list(s)
p.append(s)
from coll... | false | 0 | [
"- v = de.popleft()",
"+ v = de.pop()"
] | false | 0.758793 | 0.79767 | 0.951261 | [
"s158909014",
"s390962846"
] |
u241159583 | p03273 | python | s355153208 | s196449523 | 20 | 18 | 3,188 | 3,188 | Accepted | Accepted | 10 | h,w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
A = list(zip(*a))
skip_h = []
skip_w = []
for i in range(h):
if a[i] == ["."] * w: skip_h.append(i)
for i in range(w):
if A[i] == tuple(".") * h: skip_w.append(i)
for i in range(h):
if i in skip_h: continue
ans = ""
... | h,w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
skip = []
for i in range(h):
if a[i] == ["."] * w: skip.append(i)
a = list(zip(*a))
d = []
for i in range(w):
if set(a[i]) == {"."}: d.append(i)
d.sort(reverse=True)
for i in d:
a.pop(i)
a = list(zip(*a))
for i in... | 17 | 20 | 393 | 379 | h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
A = list(zip(*a))
skip_h = []
skip_w = []
for i in range(h):
if a[i] == ["."] * w:
skip_h.append(i)
for i in range(w):
if A[i] == tuple(".") * h:
skip_w.append(i)
for i in range(h):
if i in skip_h:
con... | h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
skip = []
for i in range(h):
if a[i] == ["."] * w:
skip.append(i)
a = list(zip(*a))
d = []
for i in range(w):
if set(a[i]) == {"."}:
d.append(i)
d.sort(reverse=True)
for i in d:
a.pop(i)
a = list(zip(*a))
for ... | false | 15 | [
"-A = list(zip(*a))",
"-skip_h = []",
"-skip_w = []",
"+skip = []",
"- skip_h.append(i)",
"+ skip.append(i)",
"+a = list(zip(*a))",
"+d = []",
"- if A[i] == tuple(\".\") * h:",
"- skip_w.append(i)",
"+ if set(a[i]) == {\".\"}:",
"+ d.append(i)",
"+d.sort(rev... | false | 0.044462 | 0.046261 | 0.961109 | [
"s355153208",
"s196449523"
] |
u105210954 | p03160 | python | s620753358 | s406254109 | 991 | 123 | 22,832 | 13,928 | Accepted | Accepted | 87.59 | import numpy as np
def resolve():
n = int(eval(input()))
h = np.array(list(map(int, input().split())))
k = 2
dp = np.zeros(n, dtype=int)
for i in range(1, n):
start = max(0, i - k)
dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i]))
print((dp[n - 1]))
resolve... | def resolve():
n = int(eval(input()))
h = list(map(int, input().split()))
# i 番目の足場にたどり着くまでの最小コスト
dp = [float('inf')] * n
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i... | 16 | 16 | 314 | 369 | import numpy as np
def resolve():
n = int(eval(input()))
h = np.array(list(map(int, input().split())))
k = 2
dp = np.zeros(n, dtype=int)
for i in range(1, n):
start = max(0, i - k)
dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i]))
print((dp[n - 1]))
resolve()
| def resolve():
n = int(eval(input()))
h = list(map(int, input().split()))
# i 番目の足場にたどり着くまでの最小コスト
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2])... | false | 0 | [
"-import numpy as np",
"-",
"-",
"- h = np.array(list(map(int, input().split())))",
"- k = 2",
"- dp = np.zeros(n, dtype=int)",
"+ h = list(map(int, input().split()))",
"+ # i 番目の足場にたどり着くまでの最小コスト",
"+ dp = [float(\"inf\")] * n",
"+ dp[0] = 0",
"- start = max(0, i - k)... | false | 0.398426 | 0.043638 | 9.13016 | [
"s620753358",
"s406254109"
] |
u597374218 | p03109 | python | s219387227 | s746132407 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | print(("Heisei" if eval(input())<="2019/04/30" else "TBD")) | s=eval(input())
print(("Heisei" if s<="2019/04/30" else "TBD")) | 1 | 2 | 51 | 56 | print(("Heisei" if eval(input()) <= "2019/04/30" else "TBD"))
| s = eval(input())
print(("Heisei" if s <= "2019/04/30" else "TBD"))
| false | 50 | [
"-print((\"Heisei\" if eval(input()) <= \"2019/04/30\" else \"TBD\"))",
"+s = eval(input())",
"+print((\"Heisei\" if s <= \"2019/04/30\" else \"TBD\"))"
] | false | 0.068638 | 0.069188 | 0.992046 | [
"s219387227",
"s746132407"
] |
u499381410 | p03806 | python | s271370217 | s528113303 | 455 | 270 | 59,868 | 46,300 | Accepted | Accepted | 40.66 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_... | 50 | 57 | 1,505 | 1,737 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bise... | false | 12.280702 | [
"+from pprint import pprint",
"+from copy import deepcopy",
"+from pprint import pprint",
"-INF = float(\"inf\")",
"+sys.setrecursionlimit(2147483647)",
"+INF = 10**20",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return list(map(int, sys.stdin.buffer.readline().split()))",
"- ... | false | 0.795761 | 0.044965 | 17.697312 | [
"s271370217",
"s528113303"
] |
u279460955 | p02579 | python | s554039232 | s313838856 | 840 | 591 | 161,668 | 129,488 | Accepted | Accepted | 29.64 | from collections import deque
h, w = (int(x) for x in input().split())
ch, cw = (int(x) - 1 for x in input().split())
dh, dw = (int(x) - 1 for x in input().split())
S = [list(eval(input())) for _ in range(h)]
grid = [[-1] * w for _ in range(h)]
grid[ch][cw] = 0
walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]
warp =... | from collections import deque
h, w = (int(x) for x in input().split())
ch, cw = (int(x) - 1 for x in input().split())
dh, dw = (int(x) - 1 for x in input().split())
S = [list(eval(input())) for _ in range(h)]
grid = [[-1] * w for _ in range(h)]
grid[ch][cw] = 0
NX = [1, 0, -1, 0]
NY = [0, 1, 0, -1]
PX = [-2,... | 29 | 34 | 1,215 | 1,171 | from collections import deque
h, w = (int(x) for x in input().split())
ch, cw = (int(x) - 1 for x in input().split())
dh, dw = (int(x) - 1 for x in input().split())
S = [list(eval(input())) for _ in range(h)]
grid = [[-1] * w for _ in range(h)]
grid[ch][cw] = 0
walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]
warp = [
[2... | from collections import deque
h, w = (int(x) for x in input().split())
ch, cw = (int(x) - 1 for x in input().split())
dh, dw = (int(x) - 1 for x in input().split())
S = [list(eval(input())) for _ in range(h)]
grid = [[-1] * w for _ in range(h)]
grid[ch][cw] = 0
NX = [1, 0, -1, 0]
NY = [0, 1, 0, -1]
PX = [-2, -2, -2, -... | false | 14.705882 | [
"-walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]",
"-warp = [",
"- [2, 2],",
"- [2, 1],",
"- [2, 0],",
"- [2, -1],",
"- [2, -2],",
"- [1, 2],",
"- [1, 1],",
"- [1, -1],",
"- [1, -2],",
"- [0, 2],",
"- [0, -2],",
"- [-1, 2],",
"- [-1, 1],",
"- [-1, -... | false | 0.037749 | 0.06115 | 0.617325 | [
"s554039232",
"s313838856"
] |
u127499732 | p02899 | python | s921810814 | s659969305 | 88 | 72 | 15,528 | 18,316 | Accepted | Accepted | 18.18 | import sys
n=int(eval(input()))
a=tuple(map(int,sys.stdin.readline().split()))
b=[0]*n
i=1
for index in a:
b[index-1]=str(i)
i+=1
print((" ".join(b))) | def main():
import sys
n=int(eval(input()))
a=tuple(map(int,sys.stdin.readline().split()))
b=[0]*n
i=1
for index in a:
b[index-1]=i
i+=1
print((" ".join(map(str,b))))
if __name__=="__main__":
main() | 9 | 12 | 154 | 225 | import sys
n = int(eval(input()))
a = tuple(map(int, sys.stdin.readline().split()))
b = [0] * n
i = 1
for index in a:
b[index - 1] = str(i)
i += 1
print((" ".join(b)))
| def main():
import sys
n = int(eval(input()))
a = tuple(map(int, sys.stdin.readline().split()))
b = [0] * n
i = 1
for index in a:
b[index - 1] = i
i += 1
print((" ".join(map(str, b))))
if __name__ == "__main__":
main()
| false | 25 | [
"-import sys",
"+def main():",
"+ import sys",
"-n = int(eval(input()))",
"-a = tuple(map(int, sys.stdin.readline().split()))",
"-b = [0] * n",
"-i = 1",
"-for index in a:",
"- b[index - 1] = str(i)",
"- i += 1",
"-print((\" \".join(b)))",
"+ n = int(eval(input()))",
"+ a = tu... | false | 0.110167 | 0.184382 | 0.597492 | [
"s921810814",
"s659969305"
] |
u186838327 | p02756 | python | s019954272 | s337169365 | 380 | 334 | 100,864 | 101,192 | Accepted | Accepted | 12.11 | s = list(str(eval(input())))
q = int(eval(input()))
from collections import deque
s = deque(s)
cnt = 0
for i in range(q):
query = list(map(str, input().split()))
if len(query) == 1:
cnt += 1
else:
t, f, c = query
if f == '1':
if cnt%2 == 0:
... | s = list(str(eval(input())))
q = int(eval(input()))
flag = 1
from collections import deque
s = deque(s)
for i in range(q):
query = list(map(str, input().split()))
if len(query) == 1:
flag = 1-flag
else:
t, f, c = query
if f == '1':
if flag:
s.... | 28 | 26 | 565 | 553 | s = list(str(eval(input())))
q = int(eval(input()))
from collections import deque
s = deque(s)
cnt = 0
for i in range(q):
query = list(map(str, input().split()))
if len(query) == 1:
cnt += 1
else:
t, f, c = query
if f == "1":
if cnt % 2 == 0:
s.appendleft... | s = list(str(eval(input())))
q = int(eval(input()))
flag = 1
from collections import deque
s = deque(s)
for i in range(q):
query = list(map(str, input().split()))
if len(query) == 1:
flag = 1 - flag
else:
t, f, c = query
if f == "1":
if flag:
s.appendleft... | false | 7.142857 | [
"+flag = 1",
"-cnt = 0",
"- cnt += 1",
"+ flag = 1 - flag",
"- if cnt % 2 == 0:",
"+ if flag:",
"- if cnt % 2 == 0:",
"+ if flag:",
"-if cnt % 2 == 1:",
"+if not flag:"
] | false | 0.037646 | 0.045215 | 0.832604 | [
"s019954272",
"s337169365"
] |
u726615467 | p03607 | python | s104138824 | s791482308 | 228 | 196 | 7,508 | 19,472 | Accepted | Accepted | 14.04 | # encoding: utf-8
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
tag = -1
cnt = 0
ans = 0
for Ai in A:
if Ai > tag:
tag = Ai
ans += cnt % 2
cnt = 0
cnt += 1
else:
ans += cnt % 2
print(ans) | N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
cnt = {}
for Ai in A:
key = str(Ai)
cnt[key] = cnt.setdefault(key, 0) + 1
ans = sum([cnt[key] % 2 for key in list(cnt.keys())])
print(ans) | 19 | 10 | 269 | 200 | # encoding: utf-8
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
tag = -1
cnt = 0
ans = 0
for Ai in A:
if Ai > tag:
tag = Ai
ans += cnt % 2
cnt = 0
cnt += 1
else:
ans += cnt % 2
print(ans)
| N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
cnt = {}
for Ai in A:
key = str(Ai)
cnt[key] = cnt.setdefault(key, 0) + 1
ans = sum([cnt[key] % 2 for key in list(cnt.keys())])
print(ans)
| false | 47.368421 | [
"-# encoding: utf-8",
"-A = [int(eval(input())) for i in range(N)]",
"-A.sort()",
"-tag = -1",
"-cnt = 0",
"-ans = 0",
"+A = [eval(input()) for _ in range(N)]",
"+cnt = {}",
"- if Ai > tag:",
"- tag = Ai",
"- ans += cnt % 2",
"- cnt = 0",
"- cnt += 1",
"-else:",
... | false | 0.044127 | 0.043831 | 1.006751 | [
"s104138824",
"s791482308"
] |
u777283665 | p03559 | python | s913713822 | s819109722 | 475 | 315 | 106,344 | 23,092 | Accepted | Accepted | 33.68 | from bisect import bisect_right, bisect_left
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))
ans = 0
for x in b:
ans += bisect_left(a, x) * (n - bisect_right(c, x))
print(ans) | import bisect
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
ans += bisect.bisect_left(A, b) * (n - bisect.bisect_right(C, b))
print(ans) | 13 | 12 | 286 | 277 | from bisect import bisect_right, bisect_left
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))
ans = 0
for x in b:
ans += bisect_left(a, x) * (n - bisect_right(c, x))
print(ans)
| import bisect
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
ans += bisect.bisect_left(A, b) * (n - bisect.bisect_right(C, b))
print(ans)
| false | 7.692308 | [
"-from bisect import bisect_right, bisect_left",
"+import bisect",
"-a = sorted(list(map(int, input().split())))",
"-b = list(map(int, input().split()))",
"-c = sorted(list(map(int, input().split())))",
"+A = sorted(list(map(int, input().split())))",
"+B = sorted(list(map(int, input().split())))",
"+C... | false | 0.045512 | 0.148648 | 0.306175 | [
"s913713822",
"s819109722"
] |
u737758066 | p02772 | python | s791589749 | s955573580 | 191 | 163 | 38,384 | 38,256 | Accepted | Accepted | 14.66 | n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
if a[i] % 2 == 0:
if a[i] % 3 != 0 and a[i] % 5 != 0:
print('DENIED')
exit()
print('APPROVED')
| n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
if a[i] % 2 == 0:
if a[i] % 3 == 0 or a[i] % 5 == 0:
continue
else:
print('DENIED')
exit(0)
print('APPROVED') | 8 | 11 | 210 | 248 | n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
if a[i] % 2 == 0:
if a[i] % 3 != 0 and a[i] % 5 != 0:
print("DENIED")
exit()
print("APPROVED")
| n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
if a[i] % 2 == 0:
if a[i] % 3 == 0 or a[i] % 5 == 0:
continue
else:
print("DENIED")
exit(0)
print("APPROVED")
| false | 27.272727 | [
"- if a[i] % 3 != 0 and a[i] % 5 != 0:",
"+ if a[i] % 3 == 0 or a[i] % 5 == 0:",
"+ continue",
"+ else:",
"- exit()",
"+ exit(0)"
] | false | 0.036867 | 0.037163 | 0.992061 | [
"s791589749",
"s955573580"
] |
u761320129 | p03986 | python | s952229387 | s130169263 | 48 | 43 | 3,500 | 3,500 | Accepted | Accepted | 10.42 | X = eval(input())
s = ans = 0
for c in X:
if c=='S':
s += 1
else:
if s > 0:
s -= 1
else:
ans += 1
print((ans+s)) | S = eval(input())
s = ans = 0
for c in S:
if c=='S':
s += 1
else:
if s:
s -= 1
else:
ans += 1
print((ans+s)) | 11 | 11 | 170 | 166 | X = eval(input())
s = ans = 0
for c in X:
if c == "S":
s += 1
else:
if s > 0:
s -= 1
else:
ans += 1
print((ans + s))
| S = eval(input())
s = ans = 0
for c in S:
if c == "S":
s += 1
else:
if s:
s -= 1
else:
ans += 1
print((ans + s))
| false | 0 | [
"-X = eval(input())",
"+S = eval(input())",
"-for c in X:",
"+for c in S:",
"- if s > 0:",
"+ if s:"
] | false | 0.046105 | 0.080254 | 0.574491 | [
"s952229387",
"s130169263"
] |
u124498235 | p02995 | python | s791717550 | s680040135 | 53 | 36 | 5,600 | 5,048 | Accepted | Accepted | 32.08 | from fractions import gcd
a, b, c, d = list(map(int, input().split()))
e = b//c - (a-1)//c
f = b//d - (a-1)//d
def lcm(x, y):
return (x * y) // gcd(x, y)
g = lcm(c, d)
h = b//g - (a-1)//g
print((b-a+1 -(e+f-h))) | from fractions import gcd
a, b, c, d = list(map(int, input().split()))
def lcm(x,y):
return (x*y)//gcd(x,y)
e = lcm(c,d)
f = (b//c + b//d) - b//e
g = ((a-1)//c + (a-1)//d) - (a-1)//e
print((b-a+1-(f-g))) | 10 | 10 | 215 | 208 | from fractions import gcd
a, b, c, d = list(map(int, input().split()))
e = b // c - (a - 1) // c
f = b // d - (a - 1) // d
def lcm(x, y):
return (x * y) // gcd(x, y)
g = lcm(c, d)
h = b // g - (a - 1) // g
print((b - a + 1 - (e + f - h)))
| from fractions import gcd
a, b, c, d = list(map(int, input().split()))
def lcm(x, y):
return (x * y) // gcd(x, y)
e = lcm(c, d)
f = (b // c + b // d) - b // e
g = ((a - 1) // c + (a - 1) // d) - (a - 1) // e
print((b - a + 1 - (f - g)))
| false | 0 | [
"-e = b // c - (a - 1) // c",
"-f = b // d - (a - 1) // d",
"-g = lcm(c, d)",
"-h = b // g - (a - 1) // g",
"-print((b - a + 1 - (e + f - h)))",
"+e = lcm(c, d)",
"+f = (b // c + b // d) - b // e",
"+g = ((a - 1) // c + (a - 1) // d) - (a - 1) // e",
"+print((b - a + 1 - (f - g)))"
] | false | 0.046391 | 0.043537 | 1.065561 | [
"s791717550",
"s680040135"
] |
u743164083 | p02767 | python | s797302676 | s606311960 | 187 | 17 | 40,432 | 2,940 | Accepted | Accepted | 90.91 | N = int(eval(input()))
X = list(map(int, input().split()))
sav = float("inf")
for i in range(min(X), max(X)+1):
Xe = [abs(x-i)**2 for x in X]
health = sum(Xe)
if sav > health:
sav = health
print(sav)
| N = int(eval(input()))
X = list(map(int, input().split()))
xp = round(sum(X) / N)
Xe = [abs(x - xp) ** 2 for x in X]
print((sum(Xe)))
| 10 | 5 | 227 | 135 | N = int(eval(input()))
X = list(map(int, input().split()))
sav = float("inf")
for i in range(min(X), max(X) + 1):
Xe = [abs(x - i) ** 2 for x in X]
health = sum(Xe)
if sav > health:
sav = health
print(sav)
| N = int(eval(input()))
X = list(map(int, input().split()))
xp = round(sum(X) / N)
Xe = [abs(x - xp) ** 2 for x in X]
print((sum(Xe)))
| false | 50 | [
"-sav = float(\"inf\")",
"-for i in range(min(X), max(X) + 1):",
"- Xe = [abs(x - i) ** 2 for x in X]",
"- health = sum(Xe)",
"- if sav > health:",
"- sav = health",
"-print(sav)",
"+xp = round(sum(X) / N)",
"+Xe = [abs(x - xp) ** 2 for x in X]",
"+print((sum(Xe)))"
] | false | 0.046167 | 0.038061 | 1.212973 | [
"s797302676",
"s606311960"
] |
u392319141 | p03599 | python | s098647673 | s179953432 | 207 | 24 | 42,732 | 3,064 | Accepted | Accepted | 88.41 | A, B, C, D, E, F = list(map(int, input().split()))
maxVal = 0
ans = (100 * A, 0)
for aWater in range(0, F + 1, A * 100):
for bWater in range(0, F + 1, B * 100):
sumWater = aWater + bWater
if sumWater == 0 or sumWater > F:
continue
maxSuger = sumWater * E // 100
... | A, B, C, D, E, F = list(map(int, input().split()))
A *= 100
B *= 100
dp = [-1] * (F + 1) # dp[f] = sugar
dp[0] = 0
for f in range(F + 1):
if A + f <= F:
dp[A + f] = max(dp[A + f], dp[f])
if B + f <= F:
dp[B + f] = max(dp[B + f], dp[f])
if C + f <= F and dp[f] >= 0:
wa... | 20 | 30 | 748 | 793 | A, B, C, D, E, F = list(map(int, input().split()))
maxVal = 0
ans = (100 * A, 0)
for aWater in range(0, F + 1, A * 100):
for bWater in range(0, F + 1, B * 100):
sumWater = aWater + bWater
if sumWater == 0 or sumWater > F:
continue
maxSuger = sumWater * E // 100
for cSuger... | A, B, C, D, E, F = list(map(int, input().split()))
A *= 100
B *= 100
dp = [-1] * (F + 1) # dp[f] = sugar
dp[0] = 0
for f in range(F + 1):
if A + f <= F:
dp[A + f] = max(dp[A + f], dp[f])
if B + f <= F:
dp[B + f] = max(dp[B + f], dp[f])
if C + f <= F and dp[f] >= 0:
water = f - dp[f]... | false | 33.333333 | [
"-maxVal = 0",
"-ans = (100 * A, 0)",
"-for aWater in range(0, F + 1, A * 100):",
"- for bWater in range(0, F + 1, B * 100):",
"- sumWater = aWater + bWater",
"- if sumWater == 0 or sumWater > F:",
"- continue",
"- maxSuger = sumWater * E // 100",
"- for cSu... | false | 0.162194 | 0.08068 | 2.010325 | [
"s098647673",
"s179953432"
] |
u189023301 | p02567 | python | s348023003 | s534220536 | 1,423 | 764 | 99,896 | 116,636 | Accepted | Accepted | 46.31 | def solve():
def segfunc(x, y):
return max(x, y)
def init(init_val):
for i in range(n):
seg[i + num - 1] = init_val[i]
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
... | import sys
input = lambda: sys.stdin.readline()
def solve():
def init(init_val):
for i in range(n):
seg[i + num - 1] = init_val[i]
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
... | 65 | 69 | 1,644 | 1,745 | def solve():
def segfunc(x, y):
return max(x, y)
def init(init_val):
for i in range(n):
seg[i + num - 1] = init_val[i]
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... | import sys
input = lambda: sys.stdin.readline()
def solve():
def init(init_val):
for i in range(n):
seg[i + num - 1] = init_val[i]
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] =... | false | 5.797101 | [
"+import sys",
"+",
"+input = lambda: sys.stdin.readline()",
"+",
"+",
"- def segfunc(x, y):",
"- return max(x, y)",
"-",
"+ segfunc = lambda x, y: max(x, y)",
"+ res = []",
"- print((query(a - 1, b)))",
"+ res.append(query(a - 1, b))",
"- pri... | false | 0.039464 | 0.079853 | 0.49421 | [
"s348023003",
"s534220536"
] |
u094191970 | p03645 | python | s734699505 | s538976579 | 895 | 549 | 38,320 | 38,320 | Accepted | Accepted | 38.66 | n,m=list(map(int,input().split()))
tree=[[] for i in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
for i in tree[0]:
for j in tree[i]:
if j==n-1:
print('POSSIBLE')
exit()
print('IMPOSSIBLE') | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
tree=[[] for i in range(n)]
for i in range(m):
a,b=nii()
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
for i in tree[0]:
for j in tree[i]:
if j==n-1:
print('POSSIBLE')
exit()
print('IMPOSS... | 16 | 19 | 287 | 320 | n, m = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
for i in tree[0]:
for j in tree[i]:
if j == n - 1:
print("POSSIBLE")
exit()
print("IMPO... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
n, m = nii()
tree = [[] for i in range(n)]
for i in range(m):
a, b = nii()
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
for i in tree[0]:
for j in tree[i]:
if j == n - 1:
print("POSSIBLE")
... | false | 15.789474 | [
"-n, m = list(map(int, input().split()))",
"+from sys import stdin",
"+",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"+n, m = nii()",
"- a, b = list(map(int, input().split()))",
"+ a, b = nii()"
] | false | 0.046423 | 0.045428 | 1.021906 | [
"s734699505",
"s538976579"
] |
u729133443 | p03730 | python | s989999152 | s498932426 | 318 | 17 | 65,644 | 2,940 | Accepted | Accepted | 94.65 | from fractions import*;a,b,c=list(map(int,input().split()));print(('YNEOS'[c%gcd(a,b)>0::2])) | a,b,c=list(map(int,input().split()));print(('YNEOS'[all(a*i%b-c for i in range(99))::2])) | 1 | 1 | 85 | 81 | from fractions import *
a, b, c = list(map(int, input().split()))
print(("YNEOS"[c % gcd(a, b) > 0 :: 2]))
| a, b, c = list(map(int, input().split()))
print(("YNEOS"[all(a * i % b - c for i in range(99)) :: 2]))
| false | 0 | [
"-from fractions import *",
"-",
"-print((\"YNEOS\"[c % gcd(a, b) > 0 :: 2]))",
"+print((\"YNEOS\"[all(a * i % b - c for i in range(99)) :: 2]))"
] | false | 0.05445 | 0.034142 | 1.594842 | [
"s989999152",
"s498932426"
] |
u762420987 | p03999 | python | s744441601 | s036105416 | 210 | 38 | 39,664 | 3,444 | Accepted | Accepted | 81.9 | from copy import copy
S = list(eval(input()))
n = len(S)
total = int("".join(S))
siki = set()
for i in range(2 ** (n - 1)):
S_ = copy(S)
plus_count = 0
for j in range(n - 1): # このループが一番のポイント
if ((i >> j) & 1): # 順に右にシフトさせ最下位bitのチェックを行う
S_.insert(plus_count + j + 1, "+") # ... | S = list(eval(input()))
ls = len(S)
n = ls - 1
ans = 0
from copy import deepcopy
for i in range(2 ** n):
siki = deepcopy(S)
add = 1
for j in range(n):
if ((i >> j) & 1):
siki.insert(j+add, "+")
add += 1
# print("".join(siki))
ans += eval("".join(siki))
p... | 17 | 15 | 473 | 324 | from copy import copy
S = list(eval(input()))
n = len(S)
total = int("".join(S))
siki = set()
for i in range(2 ** (n - 1)):
S_ = copy(S)
plus_count = 0
for j in range(n - 1): # このループが一番のポイント
if (i >> j) & 1: # 順に右にシフトさせ最下位bitのチェックを行う
S_.insert(plus_count + j + 1, "+") # フラグが立っていたら ba... | S = list(eval(input()))
ls = len(S)
n = ls - 1
ans = 0
from copy import deepcopy
for i in range(2**n):
siki = deepcopy(S)
add = 1
for j in range(n):
if (i >> j) & 1:
siki.insert(j + add, "+")
add += 1
# print("".join(siki))
ans += eval("".join(siki))
print(ans)
| false | 11.764706 | [
"-from copy import copy",
"+S = list(eval(input()))",
"+ls = len(S)",
"+n = ls - 1",
"+ans = 0",
"+from copy import deepcopy",
"-S = list(eval(input()))",
"-n = len(S)",
"-total = int(\"\".join(S))",
"-siki = set()",
"-for i in range(2 ** (n - 1)):",
"- S_ = copy(S)",
"- plus_count = 0... | false | 0.038969 | 0.060949 | 0.639363 | [
"s744441601",
"s036105416"
] |
u752906728 | p03447 | python | s063451933 | s735362708 | 818 | 18 | 3,056 | 3,064 | Accepted | Accepted | 97.8 | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((ans%10) * 0.1)
print(ans) | eval(input())
a = int(eval(input()))
if a == 100: print((87))
if a == 436: print((57))
if a == 551: print((0))
if a == 968: print((846))
if a == 222: print((0))
if a == 893: print((812))
if a == 150: print((84))
if a == 108: print((28))
if a == 123: print((0))
if a == 549: print((405)) | 11 | 13 | 138 | 267 | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((ans % 10) * 0.1)
print(ans)
| eval(input())
a = int(eval(input()))
if a == 100:
print((87))
if a == 436:
print((57))
if a == 551:
print((0))
if a == 968:
print((846))
if a == 222:
print((0))
if a == 893:
print((812))
if a == 150:
print((84))
if a == 108:
print((28))
if a == 123:
print((0))
if a == 549:
print(... | false | 15.384615 | [
"-from time import sleep",
"-",
"-x = int(eval(input()))",
"+eval(input())",
"-b = int(eval(input()))",
"-ans = (x - a) % b",
"-sleep((ans % 10) * 0.1)",
"-print(ans)",
"+if a == 100:",
"+ print((87))",
"+if a == 436:",
"+ print((57))",
"+if a == 551:",
"+ print((0))",
"+if a ==... | false | 0.486774 | 0.03393 | 14.346473 | [
"s063451933",
"s735362708"
] |
u947883560 | p03103 | python | s678041073 | s577773431 | 400 | 193 | 22,756 | 16,436 | Accepted | Accepted | 51.75 | N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
AB.sort(key=lambda x: x[0])
s = 0
for ab in AB:
if ab[1] > M:
s += M*ab[0]
break
else:
s += ab[0]*ab[1]
M -= ab[1]
print(s)
| #!/usr/bin/env python3
import sys
def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
AB = sorted(list(range(N)), key=lambda x: A[x])
s = 0
for i in AB:
if B[i] > M:
s += M*A[i]
break
else:
s += A[i]*B[i]
M -= B[i]
... | 14 | 39 | 279 | 1,005 | N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
AB.sort(key=lambda x: x[0])
s = 0
for ab in AB:
if ab[1] > M:
s += M * ab[0]
break
else:
s += ab[0] * ab[1]
M -= ab[1]
print(s)
| #!/usr/bin/env python3
import sys
def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
AB = sorted(list(range(N)), key=lambda x: A[x])
s = 0
for i in AB:
if B[i] > M:
s += M * A[i]
break
else:
s += A[i] * B[i]
M -= B[i]
print(s)
... | false | 64.102564 | [
"-N, M = [int(x) for x in input().split()]",
"-AB = [[int(x) for x in input().split()] for _ in range(N)]",
"-AB.sort(key=lambda x: x[0])",
"-s = 0",
"-for ab in AB:",
"- if ab[1] > M:",
"- s += M * ab[0]",
"- break",
"- else:",
"- s += ab[0] * ab[1]",
"- M -= a... | false | 0.077058 | 0.077976 | 0.988226 | [
"s678041073",
"s577773431"
] |
u818349438 | p03805 | python | s952755929 | s865648363 | 36 | 29 | 3,064 | 3,064 | Accepted | Accepted | 19.44 | n,m = list(map(int,input().split()))
graph = [[]for i in range(n)]
for i in range(m):
a,b = list(map(int,input().split()))
a -=1
b-=1
graph[a].append(b)
graph[b].append(a)
def all_visited(l):
a = 0
for i in range(n):
if l[i]:
a+=1
if a == n:
... | import sys
sys.setrecursionlimit(10**8)
n,m = list(map(int,input().split()))
graph = [[]for i in range(n)]
visited = [0]*n
def all_v(visited):
cnt = 0
for x in visited:cnt+=x
return cnt == n
def dfs(now):
visited[now] = 1
if all_v(visited):return 1
res = 0
for next in graph[no... | 33 | 27 | 614 | 569 | n, m = list(map(int, input().split()))
graph = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
def all_visited(l):
a = 0
for i in range(n):
if l[i]:
a += 1
if a == n:
return... | import sys
sys.setrecursionlimit(10**8)
n, m = list(map(int, input().split()))
graph = [[] for i in range(n)]
visited = [0] * n
def all_v(visited):
cnt = 0
for x in visited:
cnt += x
return cnt == n
def dfs(now):
visited[now] = 1
if all_v(visited):
return 1
res = 0
for n... | false | 18.181818 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**8)",
"+visited = [0] * n",
"+",
"+",
"+def all_v(visited):",
"+ cnt = 0",
"+ for x in visited:",
"+ cnt += x",
"+ return cnt == n",
"+",
"+",
"+def dfs(now):",
"+ visited[now] = 1",
"+ if all_v(visited):",
"+ ... | false | 0.044334 | 0.043702 | 1.014454 | [
"s952755929",
"s865648363"
] |
u912237403 | p00068 | python | s546108945 | s613372520 | 300 | 30 | 4,260 | 4,284 | Accepted | Accepted | 90 | import sys
def side(p1, p2, p3):
y1,x1=p1
y2,x2=p2
y3,x3=p3
return (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)>0
while 1:
n=eval(input())
if n==0:break
D=[eval(input()) for i in range(n)]
for p1 in D:
c=0
for p2 in D:
if p1==p2:continue
f=[0,0]
for p3 in D:
if p1==p... | import sys
def side(p1, p2, p3):
y1,x1=p1
y2,x2=p2
y3,x3=p3
return (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)>0
while 1:
n=eval(input())
if n==0:break
D=sorted([list(eval(input())) for i in range(n)])
p1=D[0]
D1=D[:]
while True:
c=0
for p2 in D1:
if p1==p2:continue
f=[0,0]
... | 22 | 25 | 420 | 489 | import sys
def side(p1, p2, p3):
y1, x1 = p1
y2, x2 = p2
y3, x3 = p3
return (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) > 0
while 1:
n = eval(input())
if n == 0:
break
D = [eval(input()) for i in range(n)]
for p1 in D:
c = 0
for p2 in D:
if p1 ==... | import sys
def side(p1, p2, p3):
y1, x1 = p1
y2, x2 = p2
y3, x3 = p3
return (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1) > 0
while 1:
n = eval(input())
if n == 0:
break
D = sorted([list(eval(input())) for i in range(n)])
p1 = D[0]
D1 = D[:]
while True:
c = 0
... | false | 12 | [
"- D = [eval(input()) for i in range(n)]",
"- for p1 in D:",
"+ D = sorted([list(eval(input())) for i in range(n)])",
"+ p1 = D[0]",
"+ D1 = D[:]",
"+ while True:",
"- for p2 in D:",
"+ for p2 in D1:",
"- if min(f) == 0:",
"- n -= 1",
"+ ... | false | 0.103106 | 0.040594 | 2.539952 | [
"s546108945",
"s613372520"
] |
u254871849 | p02937 | python | s063175608 | s324508877 | 128 | 114 | 12,200 | 12,396 | Accepted | Accepted | 10.94 | from collections import defaultdict
from bisect import bisect_left
def main():
s = eval(input())
n = len(s)
s = s + s
t = eval(input())
if set(t) - set(s):
print((-1))
exit()
d = defaultdict(list)
for i in range(2 * n):
d[s[i]] += [i]
cur = ncnt = 0
for c in t:
x = d[c][bisect_left... | import sys
from bisect import bisect_left as bi_l
from collections import defaultdict
def main():
s, t = sys.stdin.read().split()
if set(t) - set(s):
print((-1))
sys.exit()
n = len(s)
s *= 2
c = defaultdict(list)
for i in range(n * 2):
c[s[i]].append(i)
... | 29 | 30 | 454 | 584 | from collections import defaultdict
from bisect import bisect_left
def main():
s = eval(input())
n = len(s)
s = s + s
t = eval(input())
if set(t) - set(s):
print((-1))
exit()
d = defaultdict(list)
for i in range(2 * n):
d[s[i]] += [i]
cur = ncnt = 0
for c in... | import sys
from bisect import bisect_left as bi_l
from collections import defaultdict
def main():
s, t = sys.stdin.read().split()
if set(t) - set(s):
print((-1))
sys.exit()
n = len(s)
s *= 2
c = defaultdict(list)
for i in range(n * 2):
c[s[i]].append(i)
i = 0
l ... | false | 3.333333 | [
"+import sys",
"+from bisect import bisect_left as bi_l",
"-from bisect import bisect_left",
"- s = eval(input())",
"- n = len(s)",
"- s = s + s",
"- t = eval(input())",
"+ s, t = sys.stdin.read().split()",
"- exit()",
"- d = defaultdict(list)",
"- for i in range(2 * ... | false | 0.037146 | 0.048165 | 0.771233 | [
"s063175608",
"s324508877"
] |
u863370423 | p03800 | python | s345146474 | s983484773 | 128 | 101 | 3,072 | 6,132 | Accepted | Accepted | 21.09 | #!/usr/bin/python
# -*- coding: utf-8 -*-
def gen(start, s):
for i in range(1, len(s)+1):
c = start[i]
h = s[i] if i < len(s) else s[0]
if h == 'o':
if c == 'S':
start += start[i-1]
else:
start += 'S' if start[i-1] == 'W' else 'W'
else:
if c == 'S':
start += 'S' if start... | n = int(input())
s = input()
def d(r):
for i in range(1, n):
if r[i] == "S":
if s[i] == "o":
r += r[i-1]
else:
r += "S" if r[i-1] == "W" else "W"
else:
if s[i] == "o":
r += "S" if r[i-1] == "W" else "W"
else:
r += r[i-1]
if r[0] != r[-1]:
return False
else:
if r... | 38 | 59 | 644 | 842 | #!/usr/bin/python
# -*- coding: utf-8 -*-
def gen(start, s):
for i in range(1, len(s) + 1):
c = start[i]
h = s[i] if i < len(s) else s[0]
if h == "o":
if c == "S":
start += start[i - 1]
else:
start += "S" if start[i - 1] == "W" else "W"... | n = int(input())
s = input()
def d(r):
for i in range(1, n):
if r[i] == "S":
if s[i] == "o":
r += r[i - 1]
else:
r += "S" if r[i - 1] == "W" else "W"
else:
if s[i] == "o":
r += "S" if r[i - 1] == "W" else "W"
... | false | 35.59322 | [
"-#!/usr/bin/python",
"-# -*- coding: utf-8 -*-",
"-def gen(start, s):",
"- for i in range(1, len(s) + 1):",
"- c = start[i]",
"- h = s[i] if i < len(s) else s[0]",
"- if h == \"o\":",
"- if c == \"S\":",
"- start += start[i - 1]",
"+n = int(input(... | false | 0.043215 | 0.043346 | 0.996976 | [
"s345146474",
"s983484773"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.