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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u517910772 | p02813 | python | s903909332 | s031171971 | 109 | 17 | 8,948 | 3,064 | Accepted | Accepted | 84.4 | def abc150_c_count_order():
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
def solve(items, current):
if items == []:
permutations.append(current)
return
for item in items:
next = current + [it... | def abc150_c_count_order_2():
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
factorial = [1]
for i in range(1, N+1):
factorial.append(factorial[i-1] * i)
def find_index(permutation, lst):
indices = []
for p in per... | 27 | 29 | 673 | 763 | def abc150_c_count_order():
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
def solve(items, current):
if items == []:
permutations.append(current)
return
for item in items:
next = current + [item]
... | def abc150_c_count_order_2():
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
factorial = [1]
for i in range(1, N + 1):
factorial.append(factorial[i - 1] * i)
def find_index(permutation, lst):
indices = []
for p in permutati... | false | 6.896552 | [
"-def abc150_c_count_order():",
"+def abc150_c_count_order_2():",
"+ factorial = [1]",
"+ for i in range(1, N + 1):",
"+ factorial.append(factorial[i - 1] * i)",
"- def solve(items, current):",
"- if items == []:",
"- permutations.append(current)",
"- ret... | false | 0.038413 | 0.042406 | 0.905843 | [
"s903909332",
"s031171971"
] |
u263830634 | p02720 | python | s700097790 | s326941431 | 170 | 17 | 11,796 | 3,064 | Accepted | Accepted | 90 | import heapq
K =int(eval(input()))
pque = []
for i in range(1, 10):
heapq.heappush(pque, i)
for i in range(K):
tmp = heapq.heappop(pque)
if tmp % 10 == 0:
heapq.heappush(pque, tmp * 10)
heapq.heappush(pque, tmp * 10 + 1)
elif tmp % 10 == 9:
heapq.heappush(pque, t... | K = int(eval(input()))
if K <= 9:
print (K)
exit()
lst = [[1] * 11 for _ in range(2)]
lst_append = lst.append
lst[0][10] = 0
lst[1][0] = 0
lst[1][10] = 0
now = 9
p = 0
flag = 0
while True:
if p == 0:
lst[flag + 1][0] = lst[flag][0] + lst[flag][1]
p += 1
continue... | 26 | 64 | 605 | 1,209 | import heapq
K = int(eval(input()))
pque = []
for i in range(1, 10):
heapq.heappush(pque, i)
for i in range(K):
tmp = heapq.heappop(pque)
if tmp % 10 == 0:
heapq.heappush(pque, tmp * 10)
heapq.heappush(pque, tmp * 10 + 1)
elif tmp % 10 == 9:
heapq.heappush(pque, tmp * 10 + 9)
... | K = int(eval(input()))
if K <= 9:
print(K)
exit()
lst = [[1] * 11 for _ in range(2)]
lst_append = lst.append
lst[0][10] = 0
lst[1][0] = 0
lst[1][10] = 0
now = 9
p = 0
flag = 0
while True:
if p == 0:
lst[flag + 1][0] = lst[flag][0] + lst[flag][1]
p += 1
continue
tmp = lst[flag][p ... | false | 59.375 | [
"-import heapq",
"-",
"-pque = []",
"-for i in range(1, 10):",
"- heapq.heappush(pque, i)",
"-for i in range(K):",
"- tmp = heapq.heappop(pque)",
"- if tmp % 10 == 0:",
"- heapq.heappush(pque, tmp * 10)",
"- heapq.heappush(pque, tmp * 10 + 1)",
"- elif tmp % 10 == 9:",
... | false | 0.215369 | 0.043684 | 4.93014 | [
"s700097790",
"s326941431"
] |
u417365712 | p02574 | python | s328205883 | s739810940 | 1,441 | 431 | 366,452 | 232,224 | Accepted | Accepted | 70.09 | from math import gcd, sqrt
from functools import reduce
n, *A = list(map(int, open(0).read().split()))
def f(A):
sup = max(A)+1
table = [set() for i in range(sup)]
for i in range(2, sup):
if not table[i]:
for j in range(i, sup, i):
table[j].add(i)
D = set(... | from math import gcd, sqrt
from functools import reduce
n, *A = list(map(int, open(0).read().split()))
def f(A):
sup = max(A)+1
table = [i for i in range(sup)]
for i in range(2, int(sqrt(sup))+1):
if table[i] == i:
for j in range(i**2, sup, i):
table[j] = i
... | 27 | 29 | 634 | 673 | from math import gcd, sqrt
from functools import reduce
n, *A = list(map(int, open(0).read().split()))
def f(A):
sup = max(A) + 1
table = [set() for i in range(sup)]
for i in range(2, sup):
if not table[i]:
for j in range(i, sup, i):
table[j].add(i)
D = set()
f... | from math import gcd, sqrt
from functools import reduce
n, *A = list(map(int, open(0).read().split()))
def f(A):
sup = max(A) + 1
table = [i for i in range(sup)]
for i in range(2, int(sqrt(sup)) + 1):
if table[i] == i:
for j in range(i**2, sup, i):
table[j] = i
D =... | false | 6.896552 | [
"- table = [set() for i in range(sup)]",
"- for i in range(2, sup):",
"- if not table[i]:",
"- for j in range(i, sup, i):",
"- table[j].add(i)",
"+ table = [i for i in range(sup)]",
"+ for i in range(2, int(sqrt(sup)) + 1):",
"+ if table[i] == i:",
... | false | 0.087765 | 0.085392 | 1.027791 | [
"s328205883",
"s739810940"
] |
u200571527 | p02859 | python | s149988782 | s960453703 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | x = eval(input())
sum = int(x) * int(x)
print(sum) | x = eval(input())
y = 2
print((int(x) ** y)) | 4 | 4 | 48 | 40 | x = eval(input())
sum = int(x) * int(x)
print(sum)
| x = eval(input())
y = 2
print((int(x) ** y))
| false | 0 | [
"-sum = int(x) * int(x)",
"-print(sum)",
"+y = 2",
"+print((int(x) ** y))"
] | false | 0.088067 | 0.07711 | 1.142091 | [
"s149988782",
"s960453703"
] |
u349091349 | p02659 | python | s315770547 | s784615021 | 134 | 61 | 71,016 | 61,856 | Accepted | Accepted | 54.48 | from decimal import *
a,b=input().split()
a = Decimal(a)
b = Decimal(b)
c = a*b
n = 0
ans =c.quantize(Decimal(str(10**(n*-1))), rounding = ROUND_DOWN)
print(ans) | a,b=input().split()
a=int(a)
b=int(b.replace(".",""))
print((a*b//100)) | 11 | 4 | 174 | 72 | from decimal import *
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
c = a * b
n = 0
ans = c.quantize(Decimal(str(10 ** (n * -1))), rounding=ROUND_DOWN)
print(ans)
| a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
print((a * b // 100))
| false | 63.636364 | [
"-from decimal import *",
"-",
"-a = Decimal(a)",
"-b = Decimal(b)",
"-c = a * b",
"-n = 0",
"-ans = c.quantize(Decimal(str(10 ** (n * -1))), rounding=ROUND_DOWN)",
"-print(ans)",
"+a = int(a)",
"+b = int(b.replace(\".\", \"\"))",
"+print((a * b // 100))"
] | false | 0.038474 | 0.056665 | 0.678977 | [
"s315770547",
"s784615021"
] |
u796942881 | p03252 | python | s747427960 | s672188273 | 114 | 44 | 3,632 | 3,632 | Accepted | Accepted | 61.4 | def main():
S = eval(input())
T = eval(input())
lst = [""] * (ord("z") - ord("a") + 1)
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if lst[ord(s) - ord("a")] and lst[ord(s) - ord("a")] != t:
flg = False
break
lst[ord(s) - ord("... | def main():
S = eval(input())
T = eval(input())
d = dict()
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if s in d and d[s] != t:
flg = False
break
d[s] = t
# 変換先の重複チェック
if len(list(d.values())) != len(set(d.values()))... | 20 | 19 | 489 | 384 | def main():
S = eval(input())
T = eval(input())
lst = [""] * (ord("z") - ord("a") + 1)
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if lst[ord(s) - ord("a")] and lst[ord(s) - ord("a")] != t:
flg = False
break
lst[ord(s) - ord("a")] = t
... | def main():
S = eval(input())
T = eval(input())
d = dict()
flg = True
for s, t in zip(S, T):
# 同アルファベット、違アルファベット変換チェック
if s in d and d[s] != t:
flg = False
break
d[s] = t
# 変換先の重複チェック
if len(list(d.values())) != len(set(d.values())):
fl... | false | 5 | [
"- lst = [\"\"] * (ord(\"z\") - ord(\"a\") + 1)",
"+ d = dict()",
"- if lst[ord(s) - ord(\"a\")] and lst[ord(s) - ord(\"a\")] != t:",
"+ if s in d and d[s] != t:",
"- lst[ord(s) - ord(\"a\")] = t",
"- lst = [i for i in lst if i != \"\"]",
"+ d[s] = t",
"- if len... | false | 0.035315 | 0.089178 | 0.396008 | [
"s747427960",
"s672188273"
] |
u562935282 | p03111 | python | s819729921 | s584807233 | 515 | 363 | 3,064 | 3,064 | Accepted | Accepted | 29.51 | inf = float('inf')
n, *goal = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = inf
for q in range(4 ** n):
cost = -30
t = [0] * 3
for j in range(n):
idx = (q // (4 ** j)) % 4
if idx == 3: continue
t[idx] += l[j]
cost += 10
... | inf = float('inf')
def calc(mask):
cost = -30
t = [0] * 3
for j in range(n):
idx = (mask >> (2 * j)) & 3
if idx == 3: continue
t[idx] += l[j]
cost += 10
if 0 in t[:3]:
return inf
cost += sum(abs(tt - gg) for tt, gg in zip(t, goal))
retu... | 24 | 37 | 467 | 719 | inf = float("inf")
n, *goal = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = inf
for q in range(4**n):
cost = -30
t = [0] * 3
for j in range(n):
idx = (q // (4**j)) % 4
if idx == 3:
continue
t[idx] += l[j]
cost += 10
if any(tt... | inf = float("inf")
def calc(mask):
cost = -30
t = [0] * 3
for j in range(n):
idx = (mask >> (2 * j)) & 3
if idx == 3:
continue
t[idx] += l[j]
cost += 10
if 0 in t[:3]:
return inf
cost += sum(abs(tt - gg) for tt, gg in zip(t, goal))
return cos... | false | 35.135135 | [
"-n, *goal = list(map(int, input().split()))",
"-l = [int(eval(input())) for _ in range(n)]",
"-ans = inf",
"-for q in range(4**n):",
"+",
"+",
"+def calc(mask):",
"- idx = (q // (4**j)) % 4",
"+ idx = (mask >> (2 * j)) & 3",
"- if any(tt == 0 for tt in t):",
"- continue"... | false | 0.47908 | 0.192256 | 2.49189 | [
"s819729921",
"s584807233"
] |
u864197622 | p02763 | python | s402848268 | s894360331 | 1,126 | 830 | 152,224 | 79,768 | Accepted | Accepted | 26.29 | N = int(eval(input()))
A = [ord(a) - 97 for a in eval(input())]
NN = 19
BIT=[[0]*(2**NN+1) for _ in range(26)]
def addbit(t, i, x):
while i <= 2**NN:
BIT[t][i] += x
i += i & (-i)
def getsum(t, i):
ret = 0
while i != 0:
ret += BIT[t][i]
i -= i&(-i)
return... | NN = 19
X = [0] * ((1<<NN+1)-1)
def popcount(x):
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
return x & 0x3f
def update(a, x):
i = (1<<NN) - 1 + a
X[i] = x
while True:
i =... | 36 | 50 | 767 | 1,029 | N = int(eval(input()))
A = [ord(a) - 97 for a in eval(input())]
NN = 19
BIT = [[0] * (2**NN + 1) for _ in range(26)]
def addbit(t, i, x):
while i <= 2**NN:
BIT[t][i] += x
i += i & (-i)
def getsum(t, i):
ret = 0
while i != 0:
ret += BIT[t][i]
i -= i & (-i)
return ret
... | NN = 19
X = [0] * ((1 << NN + 1) - 1)
def popcount(x):
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0F0F0F0F
x += x >> 8
x += x >> 16
return x & 0x3F
def update(a, x):
i = (1 << NN) - 1 + a
X[i] = x
while True:
i = (i - ... | false | 28 | [
"+NN = 19",
"+X = [0] * ((1 << NN + 1) - 1)",
"+",
"+",
"+def popcount(x):",
"+ x -= (x >> 1) & 0x55555555",
"+ x = (x & 0x33333333) + ((x >> 2) & 0x33333333)",
"+ x = (x + (x >> 4)) & 0x0F0F0F0F",
"+ x += x >> 8",
"+ x += x >> 16",
"+ return x & 0x3F",
"+",
"+",
"+def up... | false | 0.040514 | 0.058924 | 0.687571 | [
"s402848268",
"s894360331"
] |
u627803856 | p03993 | python | s669800287 | s071917947 | 248 | 208 | 62,316 | 53,292 | Accepted | Accepted | 16.13 | n = int(eval(input()))
a = [0] + list(map(int, input().split()))
G = [[] for _ in range(n + 1)]
for i in range(1, n + 1):
G[a[i]].append(i)
cnt = 0
for i in range(1, n + 1):
if a[i] in G[i] and i in G[a[i]]:
cnt += 1
print((cnt // 2)) | n = int(eval(input()))
a = [0] + list(map(int, input().split()))
cnt = 0
for i in range(1, n + 1):
if a[a[i]] == i:
cnt += 1
print((cnt // 2)) | 13 | 9 | 245 | 147 | n = int(eval(input()))
a = [0] + list(map(int, input().split()))
G = [[] for _ in range(n + 1)]
for i in range(1, n + 1):
G[a[i]].append(i)
cnt = 0
for i in range(1, n + 1):
if a[i] in G[i] and i in G[a[i]]:
cnt += 1
print((cnt // 2))
| n = int(eval(input()))
a = [0] + list(map(int, input().split()))
cnt = 0
for i in range(1, n + 1):
if a[a[i]] == i:
cnt += 1
print((cnt // 2))
| false | 30.769231 | [
"-G = [[] for _ in range(n + 1)]",
"-for i in range(1, n + 1):",
"- G[a[i]].append(i)",
"- if a[i] in G[i] and i in G[a[i]]:",
"+ if a[a[i]] == i:"
] | false | 0.038702 | 0.038196 | 1.01325 | [
"s669800287",
"s071917947"
] |
u764860452 | p02837 | python | s595792664 | s097947176 | 89 | 81 | 9,076 | 9,216 | Accepted | Accepted | 8.99 | from itertools import product
N=int(eval(input()))
datas=[]
for i in range(N):
A=int(eval(input()))
for j in range(A):
x,y=list(map(int,input().split()))
datas.append((i,x-1,y))
#print(datas)
ans=0
for i in product([0,1],repeat=N):
ok=True
for j in datas:
if (i... | from itertools import product
N=int(eval(input()))
datas=[]
for i in range(N):
A=int(eval(input()))
for j in range(A):
x,y=list(map(int,input().split()))
datas.append((i,x-1,y)) #誰が 誰に どう判断した?
#print(datas)
ans=0
for i in product([0,1],repeat=N):
ok=True
for j in datas:... | 22 | 22 | 416 | 438 | from itertools import product
N = int(eval(input()))
datas = []
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split()))
datas.append((i, x - 1, y))
# print(datas)
ans = 0
for i in product([0, 1], repeat=N):
ok = True
for j in datas:
if... | from itertools import product
N = int(eval(input()))
datas = []
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split()))
datas.append((i, x - 1, y)) # 誰が 誰に どう判断した?
# print(datas)
ans = 0
for i in product([0, 1], repeat=N):
ok = True
for j in ... | false | 0 | [
"- datas.append((i, x - 1, y))",
"+ datas.append((i, x - 1, y)) # 誰が 誰に どう判断した?",
"- ans = sum(i)",
"+ ans = max(ans, sum(i))"
] | false | 0.047148 | 0.046866 | 1.006014 | [
"s595792664",
"s097947176"
] |
u353855427 | p03048 | python | s306336692 | s657845508 | 1,865 | 278 | 3,060 | 40,940 | Accepted | Accepted | 85.09 | import math
R,G,B,N = list(map(int,input().split()))
cnt = 0
for i in range(math.ceil(N/G)+1):
for j in range(math.ceil(N/R)+1):
tmp = N - i * G - j * R
if tmp < 0:
break
if tmp % B == 0:
cnt += 1
print(cnt) | import math
R,G,B,N = list(map(int,input().split()))
cnt = 0
for i in range(math.ceil(N/G)+1):
for j in range(math.ceil(N/R)+1):
tmp = N - i * G - j * R
if tmp >=0 and tmp % B == 0:
cnt += 1
print(cnt) | 11 | 9 | 229 | 215 | import math
R, G, B, N = list(map(int, input().split()))
cnt = 0
for i in range(math.ceil(N / G) + 1):
for j in range(math.ceil(N / R) + 1):
tmp = N - i * G - j * R
if tmp < 0:
break
if tmp % B == 0:
cnt += 1
print(cnt)
| import math
R, G, B, N = list(map(int, input().split()))
cnt = 0
for i in range(math.ceil(N / G) + 1):
for j in range(math.ceil(N / R) + 1):
tmp = N - i * G - j * R
if tmp >= 0 and tmp % B == 0:
cnt += 1
print(cnt)
| false | 18.181818 | [
"- if tmp < 0:",
"- break",
"- if tmp % B == 0:",
"+ if tmp >= 0 and tmp % B == 0:"
] | false | 0.067546 | 0.088245 | 0.765434 | [
"s306336692",
"s657845508"
] |
u153665391 | p02277 | python | s672330183 | s330667112 | 1,580 | 1,300 | 39,444 | 19,228 | Accepted | Accepted | 17.72 | import copy
def partition(p, r):
i = p
for j in range(p, r):
if A[r][1] >= A[j][1]:
A[i], A[j] = A[j], A[i]
i += 1
A[r], A[i] = A[i], A[r]
return i
def quick_sort(p, r):
if p < r:
q = partition(p, r)
quick_sort(p, q-1)
quick_so... | import copy
def partition(p, r):
i = p
for j in range(p, r):
if A[r][1] >= A[j][1]:
A[i], A[j] = A[j], A[i]
i += 1
A[r], A[i] = A[i], A[r]
return i
def quick_sort(p, r):
if p < r:
q = partition(p, r)
quick_sort(p, q-1)
quick_so... | 59 | 49 | 1,335 | 1,060 | import copy
def partition(p, r):
i = p
for j in range(p, r):
if A[r][1] >= A[j][1]:
A[i], A[j] = A[j], A[i]
i += 1
A[r], A[i] = A[i], A[r]
return i
def quick_sort(p, r):
if p < r:
q = partition(p, r)
quick_sort(p, q - 1)
quick_sort(q + 1, r... | import copy
def partition(p, r):
i = p
for j in range(p, r):
if A[r][1] >= A[j][1]:
A[i], A[j] = A[j], A[i]
i += 1
A[r], A[i] = A[i], A[r]
return i
def quick_sort(p, r):
if p < r:
q = partition(p, r)
quick_sort(p, q - 1)
quick_sort(q + 1, r... | false | 16.949153 | [
"-def correct_same_num_suits(l, num, first):",
"- suits = []",
"- for i in range(first, N):",
"- if num == l[i][1]:",
"- suits.append(l[i][0])",
"- return suits",
"-",
"-",
"- idx = 0",
"- while idx < N - 1:",
"- idx_incr_flg = True",
"- if A[idx]... | false | 0.039637 | 0.04101 | 0.966514 | [
"s672330183",
"s330667112"
] |
u651109406 | p02678 | python | s014925351 | s694091672 | 766 | 557 | 104,492 | 99,288 | Accepted | Accepted | 27.28 | from collections import deque
class UnionFind:
def __init__(self, N):
self.parents = [-1 for i in range(N)]
self.unit = [0 for i in range(N)]
def find(self, x):
if self.parents[x] < 0:
return x
self.parents[x] = self.find(self.parents[x])
return... | from collections import deque
N, M = list(map(int, input().split()))
lists = [False for i in range(N)]
lists[0] = True
a = N - 1
dicts = {i:[] for i in range(N)}
d = deque([0])
for i in range(M):
tmpa, tmpb = [int(x) - 1 for x in input().split()]
dicts[tmpa] += [tmpb]
dicts[tmpb] += [tmpa]
... | 55 | 28 | 1,359 | 654 | from collections import deque
class UnionFind:
def __init__(self, N):
self.parents = [-1 for i in range(N)]
self.unit = [0 for i in range(N)]
def find(self, x):
if self.parents[x] < 0:
return x
self.parents[x] = self.find(self.parents[x])
return self.parent... | from collections import deque
N, M = list(map(int, input().split()))
lists = [False for i in range(N)]
lists[0] = True
a = N - 1
dicts = {i: [] for i in range(N)}
d = deque([0])
for i in range(M):
tmpa, tmpb = [int(x) - 1 for x in input().split()]
dicts[tmpa] += [tmpb]
dicts[tmpb] += [tmpa]
print("Yes")
wh... | false | 49.090909 | [
"-",
"-class UnionFind:",
"- def __init__(self, N):",
"- self.parents = [-1 for i in range(N)]",
"- self.unit = [0 for i in range(N)]",
"-",
"- def find(self, x):",
"- if self.parents[x] < 0:",
"- return x",
"- self.parents[x] = self.find(self.parents[x... | false | 0.041655 | 0.078011 | 0.533956 | [
"s014925351",
"s694091672"
] |
u546338822 | p02848 | python | s495985515 | s059535044 | 24 | 20 | 3,060 | 3,188 | Accepted | Accepted | 16.67 | N = int(eval(input()))
S = eval(input())
s=[]
for i in range(len(S)):
if ord(S[i])+N >= 91:
j = (ord(S[i])+N -65)%26+65
s.append(chr(j))
else:
s.append(chr(ord(S[i])+N))
print((''.join(s))) | n = int(eval(input()))
S = eval(input())
ol = [(ord(s)+n-65)%26+65 for s in S]
st = [chr(o) for o in ol]
print((''.join(st))) | 11 | 6 | 202 | 117 | N = int(eval(input()))
S = eval(input())
s = []
for i in range(len(S)):
if ord(S[i]) + N >= 91:
j = (ord(S[i]) + N - 65) % 26 + 65
s.append(chr(j))
else:
s.append(chr(ord(S[i]) + N))
print(("".join(s)))
| n = int(eval(input()))
S = eval(input())
ol = [(ord(s) + n - 65) % 26 + 65 for s in S]
st = [chr(o) for o in ol]
print(("".join(st)))
| false | 45.454545 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-s = []",
"-for i in range(len(S)):",
"- if ord(S[i]) + N >= 91:",
"- j = (ord(S[i]) + N - 65) % 26 + 65",
"- s.append(chr(j))",
"- else:",
"- s.append(chr(ord(S[i]) + N))",
"-print((\"\".join(s)))",
"+ol = [(ord(s... | false | 0.038484 | 0.076687 | 0.501827 | [
"s495985515",
"s059535044"
] |
u426534722 | p02317 | python | s518865439 | s338472606 | 320 | 280 | 12,304 | 13,316 | Accepted | Accepted | 12.5 | import bisect
n = int(eval(input()))
A = [int(eval(input())) for j in range(n)]
dp = [A[0]]
for i in range(1, n):
if dp[-1] < A[i]:
dp.append(A[i])
else:
dp[bisect.bisect_left(dp, A[i])] = A[i]
print((len(dp))) | import bisect
n = int(eval(input()))
A = [int(eval(input())) for j in range(n)]
dp = A[:1]
for a_i in A[1:]:
if dp[-1] < a_i:
dp.append(a_i)
else:
dp[bisect.bisect_left(dp, a_i)] = a_i
print((len(dp))) | 10 | 10 | 229 | 220 | import bisect
n = int(eval(input()))
A = [int(eval(input())) for j in range(n)]
dp = [A[0]]
for i in range(1, n):
if dp[-1] < A[i]:
dp.append(A[i])
else:
dp[bisect.bisect_left(dp, A[i])] = A[i]
print((len(dp)))
| import bisect
n = int(eval(input()))
A = [int(eval(input())) for j in range(n)]
dp = A[:1]
for a_i in A[1:]:
if dp[-1] < a_i:
dp.append(a_i)
else:
dp[bisect.bisect_left(dp, a_i)] = a_i
print((len(dp)))
| false | 0 | [
"-dp = [A[0]]",
"-for i in range(1, n):",
"- if dp[-1] < A[i]:",
"- dp.append(A[i])",
"+dp = A[:1]",
"+for a_i in A[1:]:",
"+ if dp[-1] < a_i:",
"+ dp.append(a_i)",
"- dp[bisect.bisect_left(dp, A[i])] = A[i]",
"+ dp[bisect.bisect_left(dp, a_i)] = a_i"
] | false | 0.042672 | 0.007544 | 5.656296 | [
"s518865439",
"s338472606"
] |
u380524497 | p02716 | python | s767544901 | s725613817 | 558 | 481 | 31,492 | 31,632 | Accepted | Accepted | 13.8 | n = int(eval(input()))
A = list(map(int, input().split()))
pick_DP = [-float('INF')] * n
unpick_DP = [-float('INF')] * n
pick_DP[0] = 0
unpick_DP[0] = 0
for i, a in enumerate(A, 1):
mini = (i-1)//2 - 1
if mini <= 0:
mini = 1
maxi = (i+1)//2
temp = []
for num in range(mini, ... | n = int(eval(input()))
A = list(map(int, input().split()))
pick_DP = [-float('INF')] * (n//2 + 2)
unpick_DP = [-float('INF')] * (n//2 + 2)
pick_DP[0] = 0
unpick_DP[0] = 0
for i, a in enumerate(A, 1):
mini = (i-1)//2 - 1
if mini <= 0:
mini = 1
maxi = (i+1)//2
for num in range(max... | 24 | 20 | 596 | 525 | n = int(eval(input()))
A = list(map(int, input().split()))
pick_DP = [-float("INF")] * n
unpick_DP = [-float("INF")] * n
pick_DP[0] = 0
unpick_DP[0] = 0
for i, a in enumerate(A, 1):
mini = (i - 1) // 2 - 1
if mini <= 0:
mini = 1
maxi = (i + 1) // 2
temp = []
for num in range(mini, maxi + 1):... | n = int(eval(input()))
A = list(map(int, input().split()))
pick_DP = [-float("INF")] * (n // 2 + 2)
unpick_DP = [-float("INF")] * (n // 2 + 2)
pick_DP[0] = 0
unpick_DP[0] = 0
for i, a in enumerate(A, 1):
mini = (i - 1) // 2 - 1
if mini <= 0:
mini = 1
maxi = (i + 1) // 2
for num in range(maxi, mi... | false | 16.666667 | [
"-pick_DP = [-float(\"INF\")] * n",
"-unpick_DP = [-float(\"INF\")] * n",
"+pick_DP = [-float(\"INF\")] * (n // 2 + 2)",
"+unpick_DP = [-float(\"INF\")] * (n // 2 + 2)",
"- temp = []",
"- for num in range(mini, maxi + 1):",
"- temp.append(pick_DP[num])",
"+ for num in range(maxi, mini ... | false | 0.035459 | 0.042271 | 0.838858 | [
"s767544901",
"s725613817"
] |
u606045429 | p03725 | python | s547672308 | s846704357 | 1,954 | 1,782 | 9,332 | 9,204 | Accepted | Accepted | 8.8 | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
break
distance = INF
Q = deque([(0, Si, Sj)])
while Q:
di... | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
break
distance = INF
Q = deque([(0, Si, Sj)])
while Q:
cn... | 30 | 30 | 679 | 663 | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
break
distance = INF
Q = deque([(0, Si, Sj)])
while Q:
dist, i, j = Q.popleft(... | from collections import deque
INF = float("inf")
H, W, K = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]
Si, Sj = (0, 0)
for i, a in enumerate(A):
if "S" in a:
Si, Sj = (i, a.index("S"))
break
distance = INF
Q = deque([(0, Si, Sj)])
while Q:
cnt, i, j = Q.popleft()... | false | 0 | [
"- dist, i, j = Q.popleft()",
"- if dist > K:",
"- break",
"+ cnt, i, j = Q.popleft()",
"- for di, dj in ((1, 0), (0, 1), (-1, 0), (0, -1)):",
"- ni, nj = i + di, j + dj",
"+ if cnt >= K:",
"+ continue",
"+ for ni, nj in ((i + 1, j), (i, j + 1), (i - 1, j), (i,... | false | 0.088717 | 0.035786 | 2.479135 | [
"s547672308",
"s846704357"
] |
u263737105 | p02595 | python | s479170385 | s111558385 | 391 | 194 | 9,124 | 9,120 | Accepted | Accepted | 50.38 | N, D = list(map(int, input().split()))
count = 0
for i in range(N):
a, b = list(map(int, input().split()))
if (a*a + b*b) <= D*D:
count += 1
print(count)
| import sys
input = sys.stdin.readline
N, D = list(map(int, input().split()))
count = 0
for i in range(N):
a, b = list(map(int, input().split()))
if (a*a + b*b) <= D*D:
count += 1
print(count)
| 7 | 9 | 164 | 204 | N, D = list(map(int, input().split()))
count = 0
for i in range(N):
a, b = list(map(int, input().split()))
if (a * a + b * b) <= D * D:
count += 1
print(count)
| import sys
input = sys.stdin.readline
N, D = list(map(int, input().split()))
count = 0
for i in range(N):
a, b = list(map(int, input().split()))
if (a * a + b * b) <= D * D:
count += 1
print(count)
| false | 22.222222 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.086904 | 0.094841 | 0.916316 | [
"s479170385",
"s111558385"
] |
u077291787 | p03721 | python | s209946964 | s377508719 | 196 | 147 | 30,172 | 5,740 | Accepted | Accepted | 25 | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = [list(map(int, input().rstrip().split())) for _ in range(n)]
memo = [0] * (10 ** 5 + 1)
for i, j in arr:
memo[i] += j
cnt = 0
for i, j in enumerate(me... | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
memo = [0] * (10 ** 5 + 1)
for _ in range(n):
i, j = list(map(int, input().rstrip().split()))
memo[i] += j
cnt = 0
for i, j in enumerate(memo):
... | 20 | 20 | 449 | 430 | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
arr = [list(map(int, input().rstrip().split())) for _ in range(n)]
memo = [0] * (10**5 + 1)
for i, j in arr:
memo[i] += j
cnt = 0
for i, j in enumerate(memo):
... | # ABC061C - Big Array
import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().rstrip().split()))
memo = [0] * (10**5 + 1)
for _ in range(n):
i, j = list(map(int, input().rstrip().split()))
memo[i] += j
cnt = 0
for i, j in enumerate(memo):
cnt += j
... | false | 0 | [
"- arr = [list(map(int, input().rstrip().split())) for _ in range(n)]",
"- for i, j in arr:",
"+ for _ in range(n):",
"+ i, j = list(map(int, input().rstrip().split()))"
] | false | 0.055935 | 0.038356 | 1.458288 | [
"s209946964",
"s377508719"
] |
u764569828 | p02936 | python | s094493415 | s432432323 | 1,895 | 1,234 | 66,996 | 66,996 | Accepted | Accepted | 34.88 | I0 = lambda :list(map(int,input().split()))
I1 = lambda :int(eval(input()))
I2 = lambda :list(map(int,input().split()))
#####################################################
n ,q = I0()
counter = [0]*n
tree = [[] for i in range(n)]
for i in range(n-1):
a,b=I0()
tree[a-1].append(b-1)
tree[b-1].appe... | I0 = lambda :list(map(int,input().split()))
I1 = lambda :int(eval(input()))
I2 = lambda :list(map(int,input().split()))
#####################################################
import sys
input=sys.stdin.readline
n ,q = I0()
counter = [0]*n
tree = [[] for i in range(n)]
for i in range(n-1):
a,b=I0()
tre... | 28 | 31 | 634 | 678 | I0 = lambda: list(map(int, input().split()))
I1 = lambda: int(eval(input()))
I2 = lambda: list(map(int, input().split()))
#####################################################
n, q = I0()
counter = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
a, b = I0()
tree[a - 1].append(b - 1)
tree[b - 1]... | I0 = lambda: list(map(int, input().split()))
I1 = lambda: int(eval(input()))
I2 = lambda: list(map(int, input().split()))
#####################################################
import sys
input = sys.stdin.readline
n, q = I0()
counter = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
a, b = I0()
tr... | false | 9.677419 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.05256 | 0.035784 | 1.468815 | [
"s094493415",
"s432432323"
] |
u216888678 | p02778 | python | s998666516 | s297348402 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | import re
S=list(eval(input()))
A,X="","x"
for i in range(len(S)):
A=A+X
print(A) | S=list(eval(input()))
A,X="","x"
for i in range(len(S)):
A=A+X
print(A) | 6 | 5 | 84 | 73 | import re
S = list(eval(input()))
A, X = "", "x"
for i in range(len(S)):
A = A + X
print(A)
| S = list(eval(input()))
A, X = "", "x"
for i in range(len(S)):
A = A + X
print(A)
| false | 16.666667 | [
"-import re",
"-"
] | false | 0.101205 | 0.042066 | 2.405856 | [
"s998666516",
"s297348402"
] |
u645250356 | p03767 | python | s369402240 | s130854317 | 340 | 281 | 107,548 | 40,168 | Accepted | Accepted | 17.35 | from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sy... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 22 | 21 | 594 | 491 | from collections import Counter, defaultdict, deque
import sys, bisect, math, itertools, string, queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str(... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 4.545455 | [
"-import sys, bisect, math, itertools, string, queue",
"-from heapq import heappop, heappush",
"+from heapq import heappop, heappush, heapify",
"+import sys, bisect, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpl_str():",
"- return list(sys.stdin.readline().split())",
"-",... | false | 0.111057 | 0.044593 | 2.490434 | [
"s369402240",
"s130854317"
] |
u463864151 | p03721 | python | s093305076 | s509808757 | 499 | 320 | 27,872 | 5,920 | Accepted | Accepted | 35.87 | N, K = list(map(int, input().split()))
a_b_list_list = []
for i in range(N):
a_b_list_list.append(list(map(int, input().split())))
a_b_list_list.sort()
counter = 0
answer = None
for a_b_list in a_b_list_list:
counter += a_b_list[1]
if counter >= K:
answer = a_b_list[0]
break
... | """
解説を読んでから、バケットソートで書き直した。
単純にリストのリストをソートすると、O(NlogN)かかる。
Nの最大値N_max個のバケットを用意してからバケットソートすると、O(N_max+A_max)になる。
A_max<=N_maxだから、要するにO(N_max)になる。
"""
N_max = 10**5+1
N, K = list(map(int, input().split()))
bucket_list = [0 for i in range(N_max)]
for i in range(N):
a, b = list(map(int, input().split()))
... | 16 | 24 | 330 | 497 | N, K = list(map(int, input().split()))
a_b_list_list = []
for i in range(N):
a_b_list_list.append(list(map(int, input().split())))
a_b_list_list.sort()
counter = 0
answer = None
for a_b_list in a_b_list_list:
counter += a_b_list[1]
if counter >= K:
answer = a_b_list[0]
break
print(answer)
| """
解説を読んでから、バケットソートで書き直した。
単純にリストのリストをソートすると、O(NlogN)かかる。
Nの最大値N_max個のバケットを用意してからバケットソートすると、O(N_max+A_max)になる。
A_max<=N_maxだから、要するにO(N_max)になる。
"""
N_max = 10**5 + 1
N, K = list(map(int, input().split()))
bucket_list = [0 for i in range(N_max)]
for i in range(N):
a, b = list(map(int, input().split()))
bucket_l... | false | 33.333333 | [
"+\"\"\"",
"+解説を読んでから、バケットソートで書き直した。",
"+単純にリストのリストをソートすると、O(NlogN)かかる。",
"+Nの最大値N_max個のバケットを用意してからバケットソートすると、O(N_max+A_max)になる。",
"+A_max<=N_maxだから、要するにO(N_max)になる。",
"+\"\"\"",
"+N_max = 10**5 + 1",
"-a_b_list_list = []",
"+bucket_list = [0 for i in range(N_max)]",
"- a_b_list_list.append(lis... | false | 0.045565 | 0.058461 | 0.779409 | [
"s093305076",
"s509808757"
] |
u298297089 | p03061 | python | s965028480 | s103794158 | 235 | 217 | 16,124 | 16,612 | Accepted | Accepted | 7.66 | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
L = []
R = []
tl = A[0]
tr = A[-1]
for i in range(N):
tl = gcd(tl, A[i])
L.append(tl)
tr = gcd(tr, A[N-1-i])
R.append(tr)
mx = 1
R.reverse()
for i in range(N):
tl = L[i-1] if i else R[i+1]
tr = R[i+1] if i... | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
b,c = [], []
bb,cc = a[0], a[-1]
for i in range(n):
bb, cc = gcd(bb, a[i]), gcd(cc, a[-i-1])
b.append(bb)
c.append(cc)
ans = 1
c = c[::-1]
for i in range(1,n-1):
ans = max(ans, gcd(b[i-1], c[i+1]))
print((max([... | 20 | 17 | 374 | 335 | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
L = []
R = []
tl = A[0]
tr = A[-1]
for i in range(N):
tl = gcd(tl, A[i])
L.append(tl)
tr = gcd(tr, A[N - 1 - i])
R.append(tr)
mx = 1
R.reverse()
for i in range(N):
tl = L[i - 1] if i else R[i + 1]
tr = R[i + 1]... | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
b, c = [], []
bb, cc = a[0], a[-1]
for i in range(n):
bb, cc = gcd(bb, a[i]), gcd(cc, a[-i - 1])
b.append(bb)
c.append(cc)
ans = 1
c = c[::-1]
for i in range(1, n - 1):
ans = max(ans, gcd(b[i - 1], c[i + 1]))
print((ma... | false | 15 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-L = []",
"-R = []",
"-tl = A[0]",
"-tr = A[-1]",
"-for i in range(N):",
"- tl = gcd(tl, A[i])",
"- L.append(tl)",
"- tr = gcd(tr, A[N - 1 - i])",
"- R.append(tr)",
"-mx = 1",
"-R.reverse()",
"-for i in range(N... | false | 0.061535 | 0.061554 | 0.999685 | [
"s965028480",
"s103794158"
] |
u835924161 | p03337 | python | s889753499 | s609924592 | 32 | 25 | 8,976 | 8,912 | Accepted | Accepted | 21.88 | a,b=list(map(int,input().split()))
A=[a+b,a-b,a*b]
print((max(A))) | a,b=list(map(int,input().split()))
print((max([a+b,a-b,a*b]))) | 5 | 3 | 64 | 57 | a, b = list(map(int, input().split()))
A = [a + b, a - b, a * b]
print((max(A)))
| a, b = list(map(int, input().split()))
print((max([a + b, a - b, a * b])))
| false | 40 | [
"-A = [a + b, a - b, a * b]",
"-print((max(A)))",
"+print((max([a + b, a - b, a * b])))"
] | false | 0.122589 | 0.087704 | 1.397755 | [
"s889753499",
"s609924592"
] |
u952708174 | p02707 | python | s010079579 | s893020752 | 226 | 167 | 60,096 | 44,304 | Accepted | Accepted | 26.11 | def c_management():
N = int(eval(input()))
A = [int(i) for i in input().split()]
tree = [[] for _ in range(N)]
for k, a in enumerate(A, 2):
tree[a - 1].append(k - 1)
ans = [len(t) for t in tree]
return '\n'.join(map(str, ans))
print((c_management())) | def c_management():
from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
count = Counter(A)
ans = [count[i] for i in range(1, N + 1)]
return ' '.join(map(str, ans))
print((c_management())) | 12 | 10 | 288 | 255 | def c_management():
N = int(eval(input()))
A = [int(i) for i in input().split()]
tree = [[] for _ in range(N)]
for k, a in enumerate(A, 2):
tree[a - 1].append(k - 1)
ans = [len(t) for t in tree]
return "\n".join(map(str, ans))
print((c_management()))
| def c_management():
from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
count = Counter(A)
ans = [count[i] for i in range(1, N + 1)]
return " ".join(map(str, ans))
print((c_management()))
| false | 16.666667 | [
"+ from collections import Counter",
"+",
"- tree = [[] for _ in range(N)]",
"- for k, a in enumerate(A, 2):",
"- tree[a - 1].append(k - 1)",
"- ans = [len(t) for t in tree]",
"- return \"\\n\".join(map(str, ans))",
"+ count = Counter(A)",
"+ ans = [count[i] for i in rang... | false | 0.037255 | 0.037795 | 0.98571 | [
"s010079579",
"s893020752"
] |
u201856486 | p03835 | python | s008964064 | s687032561 | 1,101 | 923 | 2,940 | 2,940 | Accepted | Accepted | 16.17 | k,s=list(map(int,input().split()));r=range;print((sum(1 for x in r(k+1) for y in r(k+1)if x+y<=s and s-x-y<=k))) | k,s=list(map(int,input().split()));r=range;print((sum(1for x in r(k+1)for y in r(k+1)if 0<=s-x-y<=k))) | 1 | 1 | 104 | 94 | k, s = list(map(int, input().split()))
r = range
print((sum(1 for x in r(k + 1) for y in r(k + 1) if x + y <= s and s - x - y <= k)))
| k, s = list(map(int, input().split()))
r = range
print((sum(1 for x in r(k + 1) for y in r(k + 1) if 0 <= s - x - y <= k)))
| false | 0 | [
"-print((sum(1 for x in r(k + 1) for y in r(k + 1) if x + y <= s and s - x - y <= k)))",
"+print((sum(1 for x in r(k + 1) for y in r(k + 1) if 0 <= s - x - y <= k)))"
] | false | 0.048896 | 0.008321 | 5.876199 | [
"s008964064",
"s687032561"
] |
u585482323 | p03137 | python | s573126822 | s641428144 | 278 | 107 | 57,384 | 14,332 | Accepted | Accepted | 61.51 | #!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def S... | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
... | 112 | 126 | 1,542 | 2,325 | #!usr/bin/env python3
from collections import defaultdict
import math
def LI():
return list(map(int, input().split()))
def II():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval(input())
def IIR(n):
return [II() for i in range(n)]
def LIR(n):
return [LI... | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(map(list, sys.stdin.readline().... | false | 11.111111 | [
"+from heapq import heappush, heappop",
"+import sys",
"+import bisect",
"+import random",
"- return list(map(int, input().split()))",
"+ return list(map(int, sys.stdin.readline().split()))",
"-def II():",
"- return int(eval(input()))",
"+def I():",
"+ return int(sys.stdin.readline())"... | false | 0.079787 | 0.044251 | 1.80304 | [
"s573126822",
"s641428144"
] |
u969850098 | p03088 | python | s850569560 | s265849679 | 41 | 34 | 4,080 | 3,420 | Accepted | Accepted | 17.07 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 6)
import math
from collections import Counter
from collections import deque
from operator import itemgetter
import time, random
MOD = 10 ** 9 + 7
from itertools import permutations
def dfs(s):
if len(... | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
def main():
N = int(readline())
A, G, C, T = 0, 1, 2, 3
dp = [[[[0] * 4 for _ in range(4)] for _ in range(4)] for _ in range(N+1)]
for j in range(4): # i - 2 文字目
for k in range(4): # i - 1 文字目
for l in range(4): ... | 58 | 40 | 2,042 | 1,396 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**6)
import math
from collections import Counter
from collections import deque
from operator import itemgetter
import time, random
MOD = 10**9 + 7
from itertools import permutations
def dfs(s):
if len(s) == N:
... | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
def main():
N = int(readline())
A, G, C, T = 0, 1, 2, 3
dp = [[[[0] * 4 for _ in range(4)] for _ in range(4)] for _ in range(N + 1)]
for j in range(4): # i - 2 文字目
for k in range(4): # i - 1 文字目
for l in range(4): # i 文字目... | false | 31.034483 | [
"-readlines = sys.stdin.readlines",
"-sys.setrecursionlimit(10**6)",
"-import math",
"-from collections import Counter",
"-from collections import deque",
"-from operator import itemgetter",
"-import time, random",
"-",
"-from itertools import permutations",
"-",
"-",
"-def dfs(s):",
"- i... | false | 0.135951 | 0.007273 | 18.692238 | [
"s850569560",
"s265849679"
] |
u893063840 | p03805 | python | s772343045 | s254167111 | 139 | 31 | 3,444 | 3,064 | Accepted | Accepted | 77.7 | from copy import deepcopy
cnt = 0
depth = 0
def main():
n, m = list(map(int, input().split()))
adj = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
adj[a].append(b)
adj[b].append(a)
def f(u, d):
... | class Graph:
def __init__(self, n, adj):
self.adj = adj
self.cnt = 0
self.depth = 0
self.ds = [-1] * n
def solve(self, u):
self.ds[u] = self.depth
if self.ds.count(-1) == 0:
self.cnt += 1
return
self.depth += 1
... | 37 | 38 | 697 | 822 | from copy import deepcopy
cnt = 0
depth = 0
def main():
n, m = list(map(int, input().split()))
adj = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
adj[a].append(b)
adj[b].append(a)
def f(u, d):
global cn... | class Graph:
def __init__(self, n, adj):
self.adj = adj
self.cnt = 0
self.depth = 0
self.ds = [-1] * n
def solve(self, u):
self.ds[u] = self.depth
if self.ds.count(-1) == 0:
self.cnt += 1
return
self.depth += 1
for v in sel... | false | 2.631579 | [
"-from copy import deepcopy",
"+class Graph:",
"+ def __init__(self, n, adj):",
"+ self.adj = adj",
"+ self.cnt = 0",
"+ self.depth = 0",
"+ self.ds = [-1] * n",
"-cnt = 0",
"-depth = 0",
"+ def solve(self, u):",
"+ self.ds[u] = self.depth",
"+ i... | false | 0.124857 | 0.042391 | 2.945371 | [
"s772343045",
"s254167111"
] |
u344065503 | p02706 | python | s367882466 | s269437195 | 61 | 56 | 68,084 | 68,116 | Accepted | Accepted | 8.2 | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
if n-sum(a)<0:
print((-1))
else:
print((n-sum(a)))
| n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
if n-sum(a) >= 0:
print((n-sum(a)))
else:
print((-1))
| 8 | 6 | 126 | 125 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
if n - sum(a) < 0:
print((-1))
else:
print((n - sum(a)))
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
if n - sum(a) >= 0:
print((n - sum(a)))
else:
print((-1))
| false | 25 | [
"-if n - sum(a) < 0:",
"+if n - sum(a) >= 0:",
"+ print((n - sum(a)))",
"+else:",
"-else:",
"- print((n - sum(a)))"
] | false | 0.047912 | 0.048523 | 0.987406 | [
"s367882466",
"s269437195"
] |
u761320129 | p03363 | python | s687743613 | s299874064 | 198 | 162 | 41,364 | 44,032 | Accepted | Accepted | 18.18 | N = int(eval(input()))
A = list(map(int,input().split()))
cums = [0]
for a in A:
cums.append(cums[-1] + a)
from collections import Counter
ctr = Counter(cums)
ans = 0
for v in list(ctr.values()):
ans += v*(v-1)//2
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
C = [0]
for a in A:
C.append(C[-1] + a)
from collections import Counter
ctr = Counter(C)
ans = 0
for v in list(ctr.values()):
ans += v*(v-1)//2
print(ans) | 11 | 11 | 230 | 218 | N = int(eval(input()))
A = list(map(int, input().split()))
cums = [0]
for a in A:
cums.append(cums[-1] + a)
from collections import Counter
ctr = Counter(cums)
ans = 0
for v in list(ctr.values()):
ans += v * (v - 1) // 2
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
C = [0]
for a in A:
C.append(C[-1] + a)
from collections import Counter
ctr = Counter(C)
ans = 0
for v in list(ctr.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 0 | [
"-cums = [0]",
"+C = [0]",
"- cums.append(cums[-1] + a)",
"+ C.append(C[-1] + a)",
"-ctr = Counter(cums)",
"+ctr = Counter(C)"
] | false | 0.098486 | 0.032517 | 3.028708 | [
"s687743613",
"s299874064"
] |
u148378522 | p02990 | python | s696087774 | s548865995 | 1,756 | 882 | 217,588 | 3,316 | Accepted | Accepted | 49.77 | from math import factorial
import sys
sys.setrecursionlimit(2000)
mod = 10**9+7
n, k = list(map(int, input().split()))
memo = {}
def combination(n,k):
if n < k:
return 0
if n / 2 < k:
k = n - k
if n in memo and k in memo[n]:
return memo[n][k]
v = 0
if k == 0:
v = 1
elif k... | from math import factorial
mod = 10**9+7
n, k = list(map(int, input().split()))
def combination(n,k):
if n < k:
return 0
if k == 0 or k == n:
return 1
if k == 1:
return n
return factorial(n)//factorial(k)//factorial(n-k)
for i in range(1, k + 1):
print((combination(n-k+1,i)*combi... | 26 | 16 | 527 | 334 | from math import factorial
import sys
sys.setrecursionlimit(2000)
mod = 10**9 + 7
n, k = list(map(int, input().split()))
memo = {}
def combination(n, k):
if n < k:
return 0
if n / 2 < k:
k = n - k
if n in memo and k in memo[n]:
return memo[n][k]
v = 0
if k == 0:
v ... | from math import factorial
mod = 10**9 + 7
n, k = list(map(int, input().split()))
def combination(n, k):
if n < k:
return 0
if k == 0 or k == n:
return 1
if k == 1:
return n
return factorial(n) // factorial(k) // factorial(n - k)
for i in range(1, k + 1):
print((combinat... | false | 38.461538 | [
"-import sys",
"-sys.setrecursionlimit(2000)",
"-memo = {}",
"- if n / 2 < k:",
"- k = n - k",
"- if n in memo and k in memo[n]:",
"- return memo[n][k]",
"- v = 0",
"- if k == 0:",
"- v = 1",
"- elif k == 1:",
"- v = n",
"- else:",
"- v ... | false | 0.044926 | 0.043829 | 1.025044 | [
"s696087774",
"s548865995"
] |
u187205913 | p03560 | python | s349542634 | s255252617 | 1,610 | 1,451 | 21,692 | 20,736 | Accepted | Accepted | 9.88 | k = int(eval(input()))
from collections import deque
dic = {1:1}
queue = deque([[1,1]])
while queue:
v,cost = queue.popleft()
if not (v+1)%k in dic or cost+1<dic[(v+1)%k]:
dic[(v+1)%k] = cost+1
queue.appendleft([(v+1)%k,cost+1])
if not v*10%k in dic or cost<dic[v*10%k]:
dic... | k = int(eval(input()))
from collections import deque
dic = {1:1}
queue = deque([[1,1]])
while queue:
v,cost = queue.popleft()
v_ = (v+1)%k
if not v_ in dic or cost+1<dic[v_]:
dic[v_] = cost+1
queue.appendleft([v_,cost+1])
v_ = v*10%k
if not v_ in dic or cost<dic[v_]:
... | 14 | 16 | 383 | 382 | k = int(eval(input()))
from collections import deque
dic = {1: 1}
queue = deque([[1, 1]])
while queue:
v, cost = queue.popleft()
if not (v + 1) % k in dic or cost + 1 < dic[(v + 1) % k]:
dic[(v + 1) % k] = cost + 1
queue.appendleft([(v + 1) % k, cost + 1])
if not v * 10 % k in dic or cost <... | k = int(eval(input()))
from collections import deque
dic = {1: 1}
queue = deque([[1, 1]])
while queue:
v, cost = queue.popleft()
v_ = (v + 1) % k
if not v_ in dic or cost + 1 < dic[v_]:
dic[v_] = cost + 1
queue.appendleft([v_, cost + 1])
v_ = v * 10 % k
if not v_ in dic or cost < di... | false | 12.5 | [
"- if not (v + 1) % k in dic or cost + 1 < dic[(v + 1) % k]:",
"- dic[(v + 1) % k] = cost + 1",
"- queue.appendleft([(v + 1) % k, cost + 1])",
"- if not v * 10 % k in dic or cost < dic[v * 10 % k]:",
"- dic[v * 10 % k] = cost",
"- queue.append([v * 10 % k, cost])",
"+ ... | false | 0.221015 | 0.112064 | 1.972234 | [
"s349542634",
"s255252617"
] |
u136090046 | p03815 | python | s477522980 | s464595686 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | X=int(eval(input()))
ans=X//11*2
if (X%11==0):
print(ans)
elif (X%11<=6):
print((ans+1))
else:
print((ans+2))
| x = int(eval(input()))
if x % 11 == 0:
print((x // 11 * 2))
elif x % 11 <= 6:
print((x // 11 * 2 + 1))
else:
print((x // 11 * 2 + 2))
| 8 | 8 | 110 | 142 | X = int(eval(input()))
ans = X // 11 * 2
if X % 11 == 0:
print(ans)
elif X % 11 <= 6:
print((ans + 1))
else:
print((ans + 2))
| x = int(eval(input()))
if x % 11 == 0:
print((x // 11 * 2))
elif x % 11 <= 6:
print((x // 11 * 2 + 1))
else:
print((x // 11 * 2 + 2))
| false | 0 | [
"-X = int(eval(input()))",
"-ans = X // 11 * 2",
"-if X % 11 == 0:",
"- print(ans)",
"-elif X % 11 <= 6:",
"- print((ans + 1))",
"+x = int(eval(input()))",
"+if x % 11 == 0:",
"+ print((x // 11 * 2))",
"+elif x % 11 <= 6:",
"+ print((x // 11 * 2 + 1))",
"- print((ans + 2))",
"... | false | 0.047979 | 0.045373 | 1.057442 | [
"s477522980",
"s464595686"
] |
u243572357 | p03814 | python | s536028880 | s068856934 | 25 | 18 | 6,180 | 3,500 | Accepted | Accepted | 28 | s = list(eval(input()))
print((len(s) - s.index('A') - s[::-1].index('Z'))) | a = eval(input())
l = len(a) - a.index('A') - a[::-1].index('Z')
print(l) | 2 | 3 | 68 | 69 | s = list(eval(input()))
print((len(s) - s.index("A") - s[::-1].index("Z")))
| a = eval(input())
l = len(a) - a.index("A") - a[::-1].index("Z")
print(l)
| false | 33.333333 | [
"-s = list(eval(input()))",
"-print((len(s) - s.index(\"A\") - s[::-1].index(\"Z\")))",
"+a = eval(input())",
"+l = len(a) - a.index(\"A\") - a[::-1].index(\"Z\")",
"+print(l)"
] | false | 0.120807 | 0.081111 | 1.489395 | [
"s536028880",
"s068856934"
] |
u525065967 | p02631 | python | s961340510 | s997990744 | 159 | 147 | 31,608 | 31,440 | Accepted | Accepted | 7.55 | n = int(input())
A = [*map(int, input().split())]
# print(n)
# print(A)
all_xor = 0
for a in A: all_xor ^= a
# print(all_xor)
ans = []
for a in A: ans.append(all_xor ^ a)
print(*ans,sep=' ')
| n = int(eval(input()))
A = [*list(map(int, input().split()))]
all_xor = 0
for a in A: all_xor ^= a
print((*[all_xor ^ a for a in A]))
| 10 | 5 | 200 | 124 | n = int(input())
A = [*map(int, input().split())]
# print(n)
# print(A)
all_xor = 0
for a in A:
all_xor ^= a
# print(all_xor)
ans = []
for a in A:
ans.append(all_xor ^ a)
print(*ans, sep=" ")
| n = int(eval(input()))
A = [*list(map(int, input().split()))]
all_xor = 0
for a in A:
all_xor ^= a
print((*[all_xor ^ a for a in A]))
| false | 50 | [
"-n = int(input())",
"-A = [*map(int, input().split())]",
"-# print(n)",
"-# print(A)",
"+n = int(eval(input()))",
"+A = [*list(map(int, input().split()))]",
"-# print(all_xor)",
"-ans = []",
"-for a in A:",
"- ans.append(all_xor ^ a)",
"-print(*ans, sep=\" \")",
"+print((*[all_xor ^ a for ... | false | 0.047384 | 0.041046 | 1.154409 | [
"s961340510",
"s997990744"
] |
u893063840 | p02727 | python | s197714216 | s993199938 | 1,530 | 241 | 126,308 | 22,720 | Accepted | Accepted | 84.25 | from heapq import heappush, heappop
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()))
hp = []
for e in p:
heappush(hp, [-e, 0])
for e in q:
heappush(hp, [-e, 1])
for e in r:
heappush(hp, ... | 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(reverse=True)
q.sort(reverse=True)
apples = p[:x] + q[:y] + r
apples.sort(reverse=True)
ans = sum(apples[:x+y])
print(ans)
| 34 | 13 | 579 | 295 | from heapq import heappush, heappop
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()))
hp = []
for e in p:
heappush(hp, [-e, 0])
for e in q:
heappush(hp, [-e, 1])
for e in r:
heappush(hp, [-e, 2])
ans =... | 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(reverse=True)
q.sort(reverse=True)
apples = p[:x] + q[:y] + r
apples.sort(reverse=True)
ans = sum(apples[: x + y])
print(ans)
| false | 61.764706 | [
"-from heapq import heappush, heappop",
"-",
"-hp = []",
"-for e in p:",
"- heappush(hp, [-e, 0])",
"-for e in q:",
"- heappush(hp, [-e, 1])",
"-for e in r:",
"- heappush(hp, [-e, 2])",
"-ans = 0",
"-cnt = [0] * 3",
"-sm = 0",
"-mx = [x, y, c]",
"-while hp:",
"- yum, col = he... | false | 0.0852 | 0.107849 | 0.789989 | [
"s197714216",
"s993199938"
] |
u242031676 | p02898 | python | s165211651 | s782669101 | 53 | 45 | 9,988 | 10,384 | Accepted | Accepted | 15.09 | n, k = list(map(int, input().split()))
ans = 0
for i in map(int, input().split()): ans+=(i>=k)
print(ans) | n,k=list(map(int,input().split()));print((sum([h>=k for h in map(int,input().split())]))) | 4 | 1 | 102 | 81 | n, k = list(map(int, input().split()))
ans = 0
for i in map(int, input().split()):
ans += i >= k
print(ans)
| n, k = list(map(int, input().split()))
print((sum([h >= k for h in map(int, input().split())])))
| false | 75 | [
"-ans = 0",
"-for i in map(int, input().split()):",
"- ans += i >= k",
"-print(ans)",
"+print((sum([h >= k for h in map(int, input().split())])))"
] | false | 0.032386 | 0.066326 | 0.488289 | [
"s165211651",
"s782669101"
] |
u098968285 | p03948 | python | s185252835 | s535728621 | 302 | 251 | 63,600 | 63,728 | Accepted | Accepted | 16.89 | # def makelist(n, m):
# return [[0 for i in range(m)] for j in range(n)]
# n = int(input())
# a, b = map(int, input().split())
# s = input()
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
diff = [0]*N
mini = A[0]
for i in range(1, N):
now = A[i]
if now <= mini:
min... | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
diff = -1
mini = A[0]
cnt = 0
ans = 0
for i in range(1, N):
now = A[i]
if mini > now:
mini = now
else:
if now - mini == diff:
cnt += 1
elif now - mini > diff:
diff = now - mini
ans = max(ans, cnt)
cnt =... | 44 | 22 | 660 | 350 | # def makelist(n, m):
# return [[0 for i in range(m)] for j in range(n)]
# n = int(input())
# a, b = map(int, input().split())
# s = input()
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
diff = [0] * N
mini = A[0]
for i in range(1, N):
now = A[i]
if now <= mini:
mini = now
... | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
diff = -1
mini = A[0]
cnt = 0
ans = 0
for i in range(1, N):
now = A[i]
if mini > now:
mini = now
else:
if now - mini == diff:
cnt += 1
elif now - mini > diff:
diff = now - mini
... | false | 50 | [
"-# def makelist(n, m):",
"-# \treturn [[0 for i in range(m)] for j in range(n)]",
"-# n = int(input())",
"-# a, b = map(int, input().split())",
"-# s = input()",
"-diff = [0] * N",
"+diff = -1",
"+cnt = 0",
"+ans = 0",
"- if now <= mini:",
"+ if mini > now:",
"- diff[i] = now - m... | false | 0.043329 | 0.03834 | 1.13014 | [
"s185252835",
"s535728621"
] |
u094191970 | p02579 | python | s109292644 | s196477575 | 1,110 | 738 | 135,784 | 134,888 | Accepted | Accepted | 33.51 | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
h,w=nii()
ch,cw=nii()
ch-=1
cw-=1
dh,dw=nii()
dh-=1
dw-=1
s=[list(eval(input())) for i in range(h)]
dist=[[-1]*w for i in range(h)]
def BFS(que):
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
h,w=nii()
ch,cw=nii()
ch-=1
cw-=1
dh,dw=nii()
dh-=1
dw-=1
s=[list(eval(input())) for i in range(h)]
dist=[[-1]*w for i in range(h)]
def BFS(que):
... | 50 | 48 | 1,115 | 938 | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
h, w = nii()
ch, cw = nii()
ch -= 1
cw -= 1
dh, dw = nii()
dh -= 1
dw -= 1
s = [list(eval(input())) for i in range(h)]
dist = [[-1] * w for i in range(h)]
... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
h, w = nii()
ch, cw = nii()
ch -= 1
cw -= 1
dh, dw = nii()
dh -= 1
dw -= 1
s = [list(eval(input())) for i in range(h)]
dist = [[-1] * w for i in range(h)]
... | false | 4 | [
"- for dy, dx in [",
"- [-2, -2],",
"- [-2, -1],",
"- [-2, 0],",
"- [-2, 1],",
"- [-2, 2],",
"- [-1, -2],",
"- [-1, -1],",
"- [-1, 1],",
"- [-1, 2],",
"- [0, -2],",
"- ... | false | 0.040247 | 0.040795 | 0.986563 | [
"s109292644",
"s196477575"
] |
u802963389 | p03037 | python | s053123140 | s363806571 | 306 | 248 | 11,024 | 27,144 | Accepted | Accepted | 18.95 | n, m = list(map(int, input().split()))
L = []
R = []
for _ in range(m):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
ans = max(0, min(R) - max(L) + 1)
print(ans)
| n, m = list(map(int, input().split()))
LR = [list(map(int, input().split())) for _ in range(m)]
l = 1
r = n
for i, j in LR:
l = max(l, i)
r = min(r, j)
print((max(0, r - l + 1))) | 12 | 11 | 190 | 189 | n, m = list(map(int, input().split()))
L = []
R = []
for _ in range(m):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
ans = max(0, min(R) - max(L) + 1)
print(ans)
| n, m = list(map(int, input().split()))
LR = [list(map(int, input().split())) for _ in range(m)]
l = 1
r = n
for i, j in LR:
l = max(l, i)
r = min(r, j)
print((max(0, r - l + 1)))
| false | 8.333333 | [
"-L = []",
"-R = []",
"-for _ in range(m):",
"- l, r = list(map(int, input().split()))",
"- L.append(l)",
"- R.append(r)",
"-ans = max(0, min(R) - max(L) + 1)",
"-print(ans)",
"+LR = [list(map(int, input().split())) for _ in range(m)]",
"+l = 1",
"+r = n",
"+for i, j in LR:",
"+ ... | false | 0.041251 | 0.094616 | 0.435986 | [
"s053123140",
"s363806571"
] |
u296518383 | p03206 | python | s356213859 | s635181994 | 20 | 17 | 2,940 | 3,064 | Accepted | Accepted | 15 | D = int(eval(input()))
print(("Christmas"+" Eve"*(25-D))) | import sys
input = sys.stdin.buffer.readline
D = int(eval(input()))
print(("Christmas" + " Eve" * (25 - D))) | 2 | 6 | 50 | 107 | D = int(eval(input()))
print(("Christmas" + " Eve" * (25 - D)))
| import sys
input = sys.stdin.buffer.readline
D = int(eval(input()))
print(("Christmas" + " Eve" * (25 - D)))
| false | 66.666667 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline"
] | false | 0.051999 | 0.048304 | 1.076481 | [
"s356213859",
"s635181994"
] |
u145145077 | p02983 | python | s391893542 | s144599883 | 653 | 71 | 9,100 | 9,196 | Accepted | Accepted | 89.13 | l,r=list(map(int,input().split()))
sho_l = l // 2019
sho_r = r // 2019
if sho_r-sho_l >= 1:
print((0))
else:
ans = 2018
for i in range(l,r):
for j in range(i+1,r+1):
ans = min((i*j)%2019,ans)
print(ans)
| l,r=list(map(int,input().split()))
sho_l = l // 2019
sho_r = r // 2019
if sho_r-sho_l >= 1:
print((0))
else:
ans = 2018
flg_end = 0
for i in range(l,r):
for j in range(i+1,r+1):
ans = min((i*j)%2019,ans)
if ans == 0:
flg_end = 1
if flg_end == 1:
break
print... | 13 | 18 | 227 | 318 | l, r = list(map(int, input().split()))
sho_l = l // 2019
sho_r = r // 2019
if sho_r - sho_l >= 1:
print((0))
else:
ans = 2018
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min((i * j) % 2019, ans)
print(ans)
| l, r = list(map(int, input().split()))
sho_l = l // 2019
sho_r = r // 2019
if sho_r - sho_l >= 1:
print((0))
else:
ans = 2018
flg_end = 0
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min((i * j) % 2019, ans)
if ans == 0:
flg_end = 1
if... | false | 27.777778 | [
"+ flg_end = 0",
"+ if ans == 0:",
"+ flg_end = 1",
"+ if flg_end == 1:",
"+ break"
] | false | 0.105803 | 0.00745 | 14.202151 | [
"s391893542",
"s144599883"
] |
u672475305 | p03546 | python | s118370391 | s044715429 | 38 | 34 | 3,444 | 3,188 | Accepted | Accepted | 10.53 | inf = 1000
h,w = list(map(int,input().split()))
dp = []
for i in range(10):
c = list(map(int,input().split()))
dp.append(c)
for k in range(10):
for i in range(10):
for j in range(10):
dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j])
ans = 0
A = [list(map(int, input().split()))... | h,w = list(map(int,input().split()))
C = []
for i in range(10):
C.append(list(map(int,input().split())))
def warshall_floyd(d):
for k in range(10):
for i in range(10):
for j in range(10):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
trans_map = warsh... | 22 | 25 | 463 | 540 | inf = 1000
h, w = list(map(int, input().split()))
dp = []
for i in range(10):
c = list(map(int, input().split()))
dp.append(c)
for k in range(10):
for i in range(10):
for j in range(10):
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
ans = 0
A = [list(map(int, input().split())) for _ in r... | h, w = list(map(int, input().split()))
C = []
for i in range(10):
C.append(list(map(int, input().split())))
def warshall_floyd(d):
for k in range(10):
for i in range(10):
for j in range(10):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
trans_map = warshall_floyd... | false | 12 | [
"-inf = 1000",
"-dp = []",
"+C = []",
"- c = list(map(int, input().split()))",
"- dp.append(c)",
"-for k in range(10):",
"- for i in range(10):",
"- for j in range(10):",
"- dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])",
"+ C.append(list(map(int, input().split())))",... | false | 0.139469 | 0.046968 | 2.969424 | [
"s118370391",
"s044715429"
] |
u588341295 | p02821 | python | s940143174 | s611608542 | 1,500 | 908 | 58,872 | 23,484 | Accepted | Accepted | 39.47 | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left
from itertools import accumulate
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left
from itertools import accumulate
import numpy as np
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ... | 65 | 64 | 1,575 | 1,561 | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left
from itertools import accumulate
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, ... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left
from itertools import accumulate
import numpy as np
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
... | false | 1.538462 | [
"+import numpy as np",
"-# 右手と左手(a,b)の和がx以上となる組の数",
"+# 右手と左手(a,b)の和がx以上となる組の数がM以上あるか",
"- # 各aについて、条件を満たす数を数える",
"- ans = 0",
"- for a in A:",
"- # 式変形: a + b >= x → b >= x - a",
"- ans += N - bisect_left(A, x - a)",
"- return ans >= M",
"+ # 数列Aの二分探索をまとめて処理",
"+ ... | false | 0.045351 | 0.233147 | 0.194518 | [
"s940143174",
"s611608542"
] |
u488401358 | p02763 | python | s075127927 | s346917594 | 456 | 209 | 183,652 | 119,228 | Accepted | Accepted | 54.17 | from collections import deque
class SegmentTree():
def __init__(self,n,ide_ele,merge_func,init_val):
self.n=n
self.ide_ele=ide_ele
self.merge_func=merge_func
self.val=[0 for i in range(1<<n)]
self.merge=[0 for i in range(1<<n)]
self.parent=[-1 for i in range... | class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.tree = [ide_ele] * 2 * self.num
# 配列の値を葉にセット
for i in range(n):
self.t... | 146 | 69 | 4,231 | 1,753 | from collections import deque
class SegmentTree:
def __init__(self, n, ide_ele, merge_func, init_val):
self.n = n
self.ide_ele = ide_ele
self.merge_func = merge_func
self.val = [0 for i in range(1 << n)]
self.merge = [0 for i in range(1 << n)]
self.parent = [-1 for ... | class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.tree = [ide_ele] * 2 * self.num
# 配列の値を葉にセット
for i in range(n):
self.tree[self.... | false | 52.739726 | [
"-from collections import deque",
"+class SegTree:",
"+ def __init__(self, init_val, segfunc, ide_ele):",
"+ n = len(init_val)",
"+ self.segfunc = segfunc",
"+ self.ide_ele = ide_ele",
"+ self.num = 1 << (n - 1).bit_length()",
"+ self.tree = [ide_ele] * 2 * self.n... | false | 0.706513 | 0.080624 | 8.763111 | [
"s075127927",
"s346917594"
] |
u207799478 | p03564 | python | s515688653 | s564626679 | 286 | 41 | 60,140 | 10,560 | Accepted | Accepted | 85.66 | import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
def has_duplicates2... | from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy
def readints():
return list(map(int, input().spli... | 44 | 54 | 843 | 998 | import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def has_duplicates2(seq):
... | from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy
def readints():
return list(map(int, input().split()))
def nCr... | false | 18.518519 | [
"+from copy import deepcopy",
"+import sys",
"+import fractions",
"+from operator import itemgetter",
"+import itertools",
"+import copy",
"+def gcd(a, b):",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"- if ans + k < ans * 2:",
"- ans = ans + k",... | false | 0.036462 | 0.04234 | 0.861161 | [
"s515688653",
"s564626679"
] |
u562935282 | p02658 | python | s560217554 | s743420366 | 1,606 | 55 | 22,036 | 21,760 | Accepted | Accepted | 96.58 | # https://atcoder.jp/contests/abc169/submissions/13893064
def main():
from itertools import zip_longest
LIMIT = 10 ** 18
N = int(eval(input()))
*A, = list(map(int, input().split()))
while len(A) > 1:
A = [x * y for x, y in zip_longest(A[::2], A[1::2], fillvalue=1)]
if A... | def main():
N = int(eval(input()))
*A, = list(map(int, input().split()))
if 0 in A:
print((0))
return
t = 1
for x in A:
t *= x
if t > 10 ** 18:
print((-1))
return
print(t)
if __name__ == '__main__':
main()
| 21 | 19 | 416 | 296 | # https://atcoder.jp/contests/abc169/submissions/13893064
def main():
from itertools import zip_longest
LIMIT = 10**18
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
while len(A) > 1:
A = [x * y for x, y in zip_longest(A[::2], A[1::2], fillvalue=1)]
if A[0] > LIMIT:
... | def main():
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
if 0 in A:
print((0))
return
t = 1
for x in A:
t *= x
if t > 10**18:
print((-1))
return
print(t)
if __name__ == "__main__":
main()
| false | 9.52381 | [
"-# https://atcoder.jp/contests/abc169/submissions/13893064",
"- from itertools import zip_longest",
"-",
"- LIMIT = 10**18",
"- while len(A) > 1:",
"- A = [x * y for x, y in zip_longest(A[::2], A[1::2], fillvalue=1)]",
"- if A[0] > LIMIT:",
"- print((-1))",
"- else:",
... | false | 0.125223 | 0.034613 | 3.617803 | [
"s560217554",
"s743420366"
] |
u678167152 | p02939 | python | s895595878 | s944078722 | 84 | 63 | 14,264 | 9,284 | Accepted | Accepted | 25 | S = eval(input())
lis = [S[0]]
i = 1
while i<len(S)-1:
if S[i]==lis[-1]:
lis.append(S[i:i+2])
i += 2
else:
lis.append(S[i])
i += 1
ans = len(lis)
if i==len(S)-1 and S[i]!=lis[-1]:
ans += 1
print(ans) | def solve():
S = eval(input())
ans = 0
now = ''
i = 0
while i<len(S)-1:
if S[i]==now:
now += S[i+1]
i += 1
else:
now = S[i]
i += 1
ans += 1
if i==len(S)-1 and now!=S[i]:
ans += 1
return ans
print((solve())) | 14 | 17 | 228 | 266 | S = eval(input())
lis = [S[0]]
i = 1
while i < len(S) - 1:
if S[i] == lis[-1]:
lis.append(S[i : i + 2])
i += 2
else:
lis.append(S[i])
i += 1
ans = len(lis)
if i == len(S) - 1 and S[i] != lis[-1]:
ans += 1
print(ans)
| def solve():
S = eval(input())
ans = 0
now = ""
i = 0
while i < len(S) - 1:
if S[i] == now:
now += S[i + 1]
i += 1
else:
now = S[i]
i += 1
ans += 1
if i == len(S) - 1 and now != S[i]:
ans += 1
return ans
print((sol... | false | 17.647059 | [
"-S = eval(input())",
"-lis = [S[0]]",
"-i = 1",
"-while i < len(S) - 1:",
"- if S[i] == lis[-1]:",
"- lis.append(S[i : i + 2])",
"- i += 2",
"- else:",
"- lis.append(S[i])",
"+def solve():",
"+ S = eval(input())",
"+ ans = 0",
"+ now = \"\"",
"+ i = ... | false | 0.11881 | 0.068096 | 1.744745 | [
"s895595878",
"s944078722"
] |
u952708174 | p03060 | python | s666997617 | s220175924 | 496 | 17 | 42,220 | 2,940 | Accepted | Accepted | 96.57 | N = int(eval(input()))
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
ans = -float('inf')
d = len(V)
for b in range(2 ** d):
tmp = 0
for j in range(d):
if ((b >> j) & 1):
tmp += V[j] - C[j]
ans = max(ans, tmp)
print(ans)
| N = int(eval(input()))
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
print((sum([v - c for v, c in zip(V, C) if v - c >= 0]))) | 13 | 5 | 289 | 153 | N = int(eval(input()))
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
ans = -float("inf")
d = len(V)
for b in range(2**d):
tmp = 0
for j in range(d):
if (b >> j) & 1:
tmp += V[j] - C[j]
ans = max(ans, tmp)
print(ans)
| N = int(eval(input()))
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
print((sum([v - c for v, c in zip(V, C) if v - c >= 0])))
| false | 61.538462 | [
"-ans = -float(\"inf\")",
"-d = len(V)",
"-for b in range(2**d):",
"- tmp = 0",
"- for j in range(d):",
"- if (b >> j) & 1:",
"- tmp += V[j] - C[j]",
"- ans = max(ans, tmp)",
"-print(ans)",
"+print((sum([v - c for v, c in zip(V, C) if v - c >= 0])))"
] | false | 0.10719 | 0.036177 | 2.96289 | [
"s666997617",
"s220175924"
] |
u859897687 | p02981 | python | s163696849 | s008918264 | 178 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.45 | n,a,b=list(map(int,input().split()))
print((n*a if n*a<b else b)) | n,a,b=list(map(int,input().split()))
print((min(n*a,b))) | 2 | 2 | 58 | 49 | n, a, b = list(map(int, input().split()))
print((n * a if n * a < b else b))
| n, a, b = list(map(int, input().split()))
print((min(n * a, b)))
| false | 0 | [
"-print((n * a if n * a < b else b))",
"+print((min(n * a, b)))"
] | false | 0.068067 | 0.038 | 1.791233 | [
"s163696849",
"s008918264"
] |
u771917453 | p02412 | python | s556171972 | s827071187 | 360 | 320 | 6,368 | 6,452 | Accepted | Accepted | 11.11 | while True:
n,x= list(map(int,input().split()))
if n == x == 0:
break
count = 0
for i in range(1,n-1):
for j in range(i+1,n):
for k in range(j+1,n+1):
if i + j + k == x:
count = count + 1
break
print... | while True:
n,x= list(map(int,input().split()))
if n == x == 0:
break
count = 0
for i in range(1,n-1):
for j in range(i+1,n):
for k in range(j+1,n+1):
s = i + j + k
if s == x:
count = count + 1
... | 14 | 17 | 324 | 404 | while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1, n - 1):
for j in range(i + 1, n):
for k in range(j + 1, n + 1):
if i + j + k == x:
count = count + 1
break
print(co... | while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1, n - 1):
for j in range(i + 1, n):
for k in range(j + 1, n + 1):
s = i + j + k
if s == x:
count = count + 1
... | false | 17.647059 | [
"- if i + j + k == x:",
"+ s = i + j + k",
"+ if s == x:",
"+ elif s > x:",
"+ break"
] | false | 0.035913 | 0.037338 | 0.961832 | [
"s556171972",
"s827071187"
] |
u536034761 | p02833 | python | s936930551 | s296886312 | 27 | 24 | 9,084 | 9,064 | Accepted | Accepted | 11.11 | n = int(eval(input()))
if n & 1:
print((0))
else:
ans = 0
x = 10
while n >= x:
ans += n // x
x *= 5
print(ans)
| n = int(eval(input()))
i = 10
ans = 0
while i <= n:
ans += (n // i)
i *= 5
print((ans if n & 1 == 0 else 0))
| 10 | 9 | 148 | 120 | n = int(eval(input()))
if n & 1:
print((0))
else:
ans = 0
x = 10
while n >= x:
ans += n // x
x *= 5
print(ans)
| n = int(eval(input()))
i = 10
ans = 0
while i <= n:
ans += n // i
i *= 5
print((ans if n & 1 == 0 else 0))
| false | 10 | [
"-if n & 1:",
"- print((0))",
"-else:",
"- ans = 0",
"- x = 10",
"- while n >= x:",
"- ans += n // x",
"- x *= 5",
"- print(ans)",
"+i = 10",
"+ans = 0",
"+while i <= n:",
"+ ans += n // i",
"+ i *= 5",
"+print((ans if n & 1 == 0 else 0))"
] | false | 0.038719 | 0.037582 | 1.030244 | [
"s936930551",
"s296886312"
] |
u886921509 | p02700 | python | s177046538 | s061038998 | 65 | 29 | 61,864 | 9,164 | Accepted | Accepted | 55.38 | import sys
A, B, C, D = list(map(int, input().split()))
while A > 0 or B > 0:
C = C - B
if C <= 0:
print("Yes")
sys.exit()
A = A - D
if A <= 0:
print("No")
sys.exit() | A, B, C, D = list(map(int, input().split()))
while A > 0 or B > 0:
C = C - B
if C <= 0:
print("Yes")
break
A = A - D
if A <= 0:
print("No")
break | 12 | 10 | 220 | 196 | import sys
A, B, C, D = list(map(int, input().split()))
while A > 0 or B > 0:
C = C - B
if C <= 0:
print("Yes")
sys.exit()
A = A - D
if A <= 0:
print("No")
sys.exit()
| A, B, C, D = list(map(int, input().split()))
while A > 0 or B > 0:
C = C - B
if C <= 0:
print("Yes")
break
A = A - D
if A <= 0:
print("No")
break
| false | 16.666667 | [
"-import sys",
"-",
"- sys.exit()",
"+ break",
"- sys.exit()",
"+ break"
] | false | 0.03565 | 0.061766 | 0.577181 | [
"s177046538",
"s061038998"
] |
u808427016 | p03112 | python | s985161255 | s770186670 | 1,275 | 1,140 | 24,876 | 25,196 | Accepted | Accepted | 10.59 | A, B, Q = [int(_) for _ in input().split()]
S = [int(eval(input())) for i in range(A)]
T = [int(eval(input())) for i in range(B)]
Q = [int(eval(input())) for i in range(Q)]
#print(S, T, Q)
def calc_m(xs):
return [(a + b) / 2 for a, b in zip(xs, xs[1:])]
sm = calc_m(S)
tm = calc_m(T)
#print(sm)
#pr... | A, B, Q = [int(_) for _ in input().split()]
S = [int(eval(input())) for i in range(A)]
T = [int(eval(input())) for i in range(B)]
Q = [int(eval(input())) for i in range(Q)]
import bisect
def calc_nearest_distance(xs, ys):
result = []
for x in xs:
i = bisect.bisect(ys, x)
if i == 0:
... | 63 | 43 | 1,356 | 1,084 | A, B, Q = [int(_) for _ in input().split()]
S = [int(eval(input())) for i in range(A)]
T = [int(eval(input())) for i in range(B)]
Q = [int(eval(input())) for i in range(Q)]
# print(S, T, Q)
def calc_m(xs):
return [(a + b) / 2 for a, b in zip(xs, xs[1:])]
sm = calc_m(S)
tm = calc_m(T)
# print(sm)
# print(tm)
impor... | A, B, Q = [int(_) for _ in input().split()]
S = [int(eval(input())) for i in range(A)]
T = [int(eval(input())) for i in range(B)]
Q = [int(eval(input())) for i in range(Q)]
import bisect
def calc_nearest_distance(xs, ys):
result = []
for x in xs:
i = bisect.bisect(ys, x)
if i == 0:
... | false | 31.746032 | [
"-# print(S, T, Q)",
"-def calc_m(xs):",
"- return [(a + b) / 2 for a, b in zip(xs, xs[1:])]",
"-",
"-",
"-sm = calc_m(S)",
"-tm = calc_m(T)",
"-# print(sm)",
"-# print(tm)",
"-def calc_nearest_0(xs, y, ym):",
"+def calc_nearest_distance(xs, ys):",
"- i = 0",
"- while i < len(ym... | false | 0.047774 | 0.047255 | 1.010984 | [
"s985161255",
"s770186670"
] |
u759412327 | p03739 | python | s593403528 | s318089927 | 121 | 107 | 14,332 | 19,920 | Accepted | Accepted | 11.57 | n = int(eval(input()))
A = list(map(int,input().split()))
ans = 10**15
for i in [-1,1]:
ansi,sum=0,0
for a in A:
sum+=a
if sum*i<=0:
ansi+=abs(sum-i)
sum=i
i*=-1
ans=min(ans,ansi)
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
ans = 10**15
for s in [1,-1]:
cos = 0
tot = 0
for a in A:
tot+=a
if s*tot<=0:
cos+=abs(tot-s)
tot=s
s*=-1
ans=min(ans,cos)
print(ans) | 14 | 18 | 254 | 242 | n = int(eval(input()))
A = list(map(int, input().split()))
ans = 10**15
for i in [-1, 1]:
ansi, sum = 0, 0
for a in A:
sum += a
if sum * i <= 0:
ansi += abs(sum - i)
sum = i
i *= -1
ans = min(ans, ansi)
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 10**15
for s in [1, -1]:
cos = 0
tot = 0
for a in A:
tot += a
if s * tot <= 0:
cos += abs(tot - s)
tot = s
s *= -1
ans = min(ans, cos)
print(ans)
| false | 22.222222 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-for i in [-1, 1]:",
"- ansi, sum = 0, 0",
"+for s in [1, -1]:",
"+ cos = 0",
"+ tot = 0",
"- sum += a",
"- if sum * i <= 0:",
"- ansi += abs(sum - i)",
"- sum = i",
"- i *= -1",
"- ... | false | 0.034748 | 0.036319 | 0.95676 | [
"s593403528",
"s318089927"
] |
u537905693 | p02887 | python | s900422828 | s978599235 | 33 | 25 | 3,316 | 3,316 | Accepted | Accepted | 24.24 | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
n = ri()
s = eval(input())
ans = 1
for i in range(1, len(s)):
if s[i] == s[i-1]:
... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
n = ri()
s = eval(input())
bc = '!'
ans = 0
for c in s:
if c != bc:
an... | 25 | 26 | 401 | 391 | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
n = ri()
s = eval(input())
ans = 1
for i in range(1, len(s)):
if s[i] == s[i - 1]:
continue... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
n = ri()
s = eval(input())
bc = "!"
ans = 0
for c in s:
if c != bc:
ans += 1
bc... | false | 3.846154 | [
"- ans = 1",
"- for i in range(1, len(s)):",
"- if s[i] == s[i - 1]:",
"- continue",
"- ans += 1",
"+ bc = \"!\"",
"+ ans = 0",
"+ for c in s:",
"+ if c != bc:",
"+ ans += 1",
"+ bc = c"
] | false | 0.043073 | 0.044379 | 0.970574 | [
"s900422828",
"s978599235"
] |
u977141657 | p02802 | python | s031039868 | s376310539 | 445 | 295 | 35,804 | 4,596 | Accepted | Accepted | 33.71 | import sys
N, M = list(map(int, input().split()))
if M == 0:
print((0, 0))
sys.exit()
p_S = []
for _ in range(M):
p_S.append(input().split())
p = []
S = []
for i in range(M):
p_S[i][0] = int(p_S[i][0])
p_S[i][1] = int(p_S[i][1] =='AC')
p_S.sort(key=lambda x: x[0])
... | n,m=list(map(int,input().split()))
ac=[0]*n
wa=[0]*n
for i in range(m):
p,s=input().split()
p=int(p)
if ac[p-1] == 1:#このテストをクリアしていたら飛ばす。
continue
if s=='AC':#テストをクリアしたらフラグをつける
ac[p-1] = 1
else:#テストをクリアするまでは失敗を繰り返す。
wa[p-1] += 1
# 最終的に出力するものを決める
AC... | 55 | 22 | 993 | 448 | import sys
N, M = list(map(int, input().split()))
if M == 0:
print((0, 0))
sys.exit()
p_S = []
for _ in range(M):
p_S.append(input().split())
p = []
S = []
for i in range(M):
p_S[i][0] = int(p_S[i][0])
p_S[i][1] = int(p_S[i][1] == "AC")
p_S.sort(key=lambda x: x[0])
for i in range(M):
p.append(p... | n, m = list(map(int, input().split()))
ac = [0] * n
wa = [0] * n
for i in range(m):
p, s = input().split()
p = int(p)
if ac[p - 1] == 1: # このテストをクリアしていたら飛ばす。
continue
if s == "AC": # テストをクリアしたらフラグをつける
ac[p - 1] = 1
else: # テストをクリアするまでは失敗を繰り返す。
wa[p - 1] += 1
# 最終的に出力するものを決... | false | 60 | [
"-import sys",
"-",
"-N, M = list(map(int, input().split()))",
"-if M == 0:",
"- print((0, 0))",
"- sys.exit()",
"-p_S = []",
"-for _ in range(M):",
"- p_S.append(input().split())",
"-p = []",
"-S = []",
"-for i in range(M):",
"- p_S[i][0] = int(p_S[i][0])",
"- p_S[i][1] = i... | false | 0.064643 | 0.073052 | 0.884887 | [
"s031039868",
"s376310539"
] |
u044459372 | p03283 | python | s254918553 | s726200107 | 1,213 | 588 | 59,316 | 57,948 | Accepted | Accepted | 51.53 | import sys
input = lambda :sys.stdin.readline().rstrip()
def main():
n, m, Q = list(map(int, input().split()))
Train= [[0 for _ in range(n)] for _ in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
Train[l][r] += 1
... | import sys
input = lambda :sys.stdin.readline().rstrip()
def main():
n, m, Q = list(map(int, input().split()))
Train= [[0 for _ in range(n)] for _ in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
Train[l][r] += 1
... | 35 | 34 | 844 | 907 | import sys
input = lambda: sys.stdin.readline().rstrip()
def main():
n, m, Q = list(map(int, input().split()))
Train = [[0 for _ in range(n)] for _ in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
Train[l][r] += 1
P_Train = [[0 for _ i... | import sys
input = lambda: sys.stdin.readline().rstrip()
def main():
n, m, Q = list(map(int, input().split()))
Train = [[0 for _ in range(n)] for _ in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
Train[l][r] += 1
P_Train = [[0 for _ i... | false | 2.857143 | [
"- P_Train = [[0 for _ in range(n + 1)] for _ in range(n)]",
"+ P_Train = [[0 for _ in range(n + 1)] for _ in range(n + 1)]",
"- tmp = 0",
"- tmp += Train[i][j]",
"- P_Train[i][j + 1] = tmp",
"+ P_Train[i + 1][j + 1] = (",
"+ P_Train[i][j + 1]... | false | 0.037734 | 0.061672 | 0.611859 | [
"s254918553",
"s726200107"
] |
u796942881 | p03673 | python | s170627561 | s842747629 | 97 | 45 | 26,588 | 22,620 | Accepted | Accepted | 53.61 | from collections import deque
def main():
n, *a = open(0).read().split()
dq = deque()
n = int(n) - 1
for i, ai in enumerate(a):
if i % 2 == n % 2:
dq.appendleft(ai)
else:
dq.append(ai)
print((" ".join(dq)))
return
main()
| def main():
n, *a = open(0).read().split()
if int(n) % 2:
print(" ".join(reversed(a[0::2])), end=" ")
print(" ".join(a[1::2]))
else:
print(" ".join(reversed(a[1::2])), end=" ")
print(" ".join(a[0::2]))
return
main()
| 17 | 12 | 303 | 277 | from collections import deque
def main():
n, *a = open(0).read().split()
dq = deque()
n = int(n) - 1
for i, ai in enumerate(a):
if i % 2 == n % 2:
dq.appendleft(ai)
else:
dq.append(ai)
print((" ".join(dq)))
return
main()
| def main():
n, *a = open(0).read().split()
if int(n) % 2:
print(" ".join(reversed(a[0::2])), end=" ")
print(" ".join(a[1::2]))
else:
print(" ".join(reversed(a[1::2])), end=" ")
print(" ".join(a[0::2]))
return
main()
| false | 29.411765 | [
"-from collections import deque",
"-",
"-",
"- dq = deque()",
"- n = int(n) - 1",
"- for i, ai in enumerate(a):",
"- if i % 2 == n % 2:",
"- dq.appendleft(ai)",
"- else:",
"- dq.append(ai)",
"- print((\" \".join(dq)))",
"+ if int(n) % 2:",
"... | false | 0.040416 | 0.074516 | 0.542384 | [
"s170627561",
"s842747629"
] |
u467736898 | p03321 | python | s623237659 | s644887339 | 880 | 714 | 22,364 | 20,980 | Accepted | Accepted | 18.86 | N, M = list(map(int, input().split()))
E = [[] for _ in range(N+1)]
E_mat = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
a, b = list(map(int, input().split()))
E[a].append(b)
E[b].append(a)
E_mat[a][b] = 1
E_mat[b][a] = 1
E_inv = [[] for _ in range(N+1)]
for v, e_mat in enumerate(E_m... | def main():
N, M = list(map(int, input().split()))
E_mat = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
a, b = list(map(int, input().split()))
E_mat[a][b] = 1
E_mat[b][a] = 1
E_inv = [[] for _ in range(N+1)]
for v, e_mat in enumerate(E_mat[1:], 1):
for ... | 46 | 48 | 1,055 | 1,200 | N, M = list(map(int, input().split()))
E = [[] for _ in range(N + 1)]
E_mat = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
a, b = list(map(int, input().split()))
E[a].append(b)
E[b].append(a)
E_mat[a][b] = 1
E_mat[b][a] = 1
E_inv = [[] for _ in range(N + 1)]
for v, e_mat in enumerate(E_m... | def main():
N, M = list(map(int, input().split()))
E_mat = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
a, b = list(map(int, input().split()))
E_mat[a][b] = 1
E_mat[b][a] = 1
E_inv = [[] for _ in range(N + 1)]
for v, e_mat in enumerate(E_mat[1:], 1):
for u... | false | 4.166667 | [
"-N, M = list(map(int, input().split()))",
"-E = [[] for _ in range(N + 1)]",
"-E_mat = [[0] * (N + 1) for _ in range(N + 1)]",
"-for _ in range(M):",
"- a, b = list(map(int, input().split()))",
"- E[a].append(b)",
"- E[b].append(a)",
"- E_mat[a][b] = 1",
"- E_mat[b][a] = 1",
"-E_in... | false | 0.106855 | 0.043483 | 2.457388 | [
"s623237659",
"s644887339"
] |
u073549161 | p03241 | python | s600087221 | s259157479 | 190 | 171 | 38,640 | 38,640 | Accepted | Accepted | 10 | def make_divisors(n):
divisors = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort()
return divisors
a,b = list(map(int, input().split()))
l = make_divisors(b)
l.... | # 約数のリストを得る
def make_divisors(n):
divisors = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
N, M = list(map(int, input().split()))
l = make_divisors(M)
# mの約数
res... | 19 | 21 | 425 | 457 | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort()
return divisors
a, b = list(map(int, input().split()))
l = make_divisors(b)
l.sort(reverse... | # 約数のリストを得る
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
N, M = list(map(int, input().split()))
l = make_divisors(M)
# mの約数
res = 1
# 全ての約数にお... | false | 9.52381 | [
"+# 約数のリストを得る",
"- # divisors.sort()",
"-a, b = list(map(int, input().split()))",
"-l = make_divisors(b)",
"-l.sort(reverse=False)",
"+N, M = list(map(int, input().split()))",
"+l = make_divisors(M)",
"+# mの約数",
"-# print(l)",
"-for x in l:",
"- if x <= b // a:",
"- res = max(x, r... | false | 0.045226 | 0.123585 | 0.365952 | [
"s600087221",
"s259157479"
] |
u003309334 | p02270 | python | s936754947 | s273482315 | 1,130 | 400 | 9,464 | 9,420 | Accepted | Accepted | 64.6 | '''
Search - Allocation
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_D
Algorythm
Referenced #1670532 Solution for ALDS1_4_D: Allocation by Chris_Kobayashi
1. Decide the searching point -> (top of the range + bottom of the range) / 2
2. Check whether it is possible to load all of the luggag... | '''
Search - Allocation
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_D
Algorythm
Referenced #1670532 Solution for ALDS1_4_D: Allocation by Chris_Kobayashi
1. Decide the searching point -> (top of the range + bottom of the range) / 2
2. Check whether it is possible to load all of the luggag... | 81 | 94 | 2,184 | 2,526 | """
Search - Allocation
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_D
Algorythm
Referenced #1670532 Solution for ALDS1_4_D: Allocation by Chris_Kobayashi
1. Decide the searching point -> (top of the range + bottom of the range) / 2
2. Check whether it is possible to load all of the luggage to the t... | """
Search - Allocation
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_D
Algorythm
Referenced #1670532 Solution for ALDS1_4_D: Allocation by Chris_Kobayashi
1. Decide the searching point -> (top of the range + bottom of the range) / 2
2. Check whether it is possible to load all of the luggage to the t... | false | 13.829787 | [
"+Note",
"+1. This program contains the idea below",
"+ - Using \"binary search\" idea",
"+ - The appropriate range",
"+2. To be the python program more fast",
"+ - Using int(raw_input()) instead of input()",
"+ - To rewrite the processings for the function is more fast",
"- w.append(ev... | false | 0.041593 | 0.036801 | 1.130222 | [
"s936754947",
"s273482315"
] |
u285443936 | p03290 | python | s491642452 | s790508785 | 243 | 46 | 3,064 | 3,064 | Accepted | Accepted | 81.07 | D, G = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(D)]
ans = 10**5
for i in range(2**D):
score = 0
tmp = 0
solved = [False]*D
for j in range(D):
if (i>>j) & 1:
score += (j+1) * 100 * pc[j][0] + pc[j][1]
tmp += pc[j][0]
solved[j] = True
... | D, G = list(map(int, input().split()))
table = []
for i in range(D):
p,c = list(map(int, input().split()))
table.append((i+1,p,c))
ans = 10**3
for i in range(1<<D):
score = 0
count = 0
remain = []
for j in range(D):
a,p,c = table[j]
if i & (1<<j):
score... | 27 | 29 | 637 | 677 | D, G = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(D)]
ans = 10**5
for i in range(2**D):
score = 0
tmp = 0
solved = [False] * D
for j in range(D):
if (i >> j) & 1:
score += (j + 1) * 100 * pc[j][0] + pc[j][1]
tmp += pc[j][0]
... | D, G = list(map(int, input().split()))
table = []
for i in range(D):
p, c = list(map(int, input().split()))
table.append((i + 1, p, c))
ans = 10**3
for i in range(1 << D):
score = 0
count = 0
remain = []
for j in range(D):
a, p, c = table[j]
if i & (1 << j):
score += ... | false | 6.896552 | [
"-pc = [list(map(int, input().split())) for i in range(D)]",
"-ans = 10**5",
"-for i in range(2**D):",
"+table = []",
"+for i in range(D):",
"+ p, c = list(map(int, input().split()))",
"+ table.append((i + 1, p, c))",
"+ans = 10**3",
"+for i in range(1 << D):",
"- tmp = 0",
"- solved... | false | 0.04797 | 0.038262 | 1.253729 | [
"s491642452",
"s790508785"
] |
u472065247 | p03576 | python | s225672333 | s677384887 | 34 | 29 | 3,064 | 3,064 | Accepted | Accepted | 14.71 | N, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
r = 10**20
for xi0 in range(N - K + 1):
for xi1 in range(K + xi0 - 1, N):
x = XY[xi1][0] - XY[xi0][0]
XY_ys = sorted(XY[xi0:xi1 + 1], key=lambda a: a[1])
for yi0 in range(len(XY_ys) - K + 1):
... | N, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
X, Y = list(zip(*XY))
r = 10**20
for x0 in range(N - K + 1):
for x1 in range(K + x0 - 1, N):
x = X[x1] - X[x0]
Y_s = sorted(Y[x0:x1 + 1])
for y0 in range(len(Y_s) - K + 1):
y = Y_s[y0 ... | 12 | 13 | 397 | 361 | N, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
r = 10**20
for xi0 in range(N - K + 1):
for xi1 in range(K + xi0 - 1, N):
x = XY[xi1][0] - XY[xi0][0]
XY_ys = sorted(XY[xi0 : xi1 + 1], key=lambda a: a[1])
for yi0 in range(len(XY_ys) - ... | N, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
X, Y = list(zip(*XY))
r = 10**20
for x0 in range(N - K + 1):
for x1 in range(K + x0 - 1, N):
x = X[x1] - X[x0]
Y_s = sorted(Y[x0 : x1 + 1])
for y0 in range(len(Y_s) - K + 1):
... | false | 7.692308 | [
"+X, Y = list(zip(*XY))",
"-for xi0 in range(N - K + 1):",
"- for xi1 in range(K + xi0 - 1, N):",
"- x = XY[xi1][0] - XY[xi0][0]",
"- XY_ys = sorted(XY[xi0 : xi1 + 1], key=lambda a: a[1])",
"- for yi0 in range(len(XY_ys) - K + 1):",
"- y = XY_ys[yi0 + K - 1][1] - XY_ys... | false | 0.039264 | 0.087647 | 0.44798 | [
"s225672333",
"s677384887"
] |
u102461423 | p03040 | python | s884702816 | s179424057 | 933 | 596 | 28,020 | 28,080 | Accepted | Accepted | 36.12 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappush, heappop
Q = int(readline())
query = (tuple(map(int,line.split())) for line in readlines())
# 適当に番兵を入れておく
INF = 10**12
L = [INF] # -1倍していれる
R = [INF]
sumL = 0; ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappush, heappop, heappushpop
Q = int(readline())
query = (tuple(map(int,line.split())) for line in readlines())
# 適当に番兵を入れておく
INF = 10**12
L = [INF] # -1倍していれる
R = [INF... | 42 | 38 | 935 | 895 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappush, heappop
Q = int(readline())
query = (tuple(map(int, line.split())) for line in readlines())
# 適当に番兵を入れておく
INF = 10**12
L = [INF] # -1倍していれる
R = [INF]
sumL = 0
sumR = 0 # 和
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappush, heappop, heappushpop
Q = int(readline())
query = (tuple(map(int, line.split())) for line in readlines())
# 適当に番兵を入れておく
INF = 10**12
L = [INF] # -1倍していれる
R = [INF]
sumL = 0
s... | false | 9.52381 | [
"-from heapq import heappush, heappop",
"+from heapq import heappush, heappop, heappushpop",
"- b = -heappop(L)",
"- sumL -= b",
"- c = heappop(R)",
"- sumR -= c",
"- a, b, c = sorted([a, b, c])",
"- heappush(L, -a)",
"- sumL += a",
"- heappush(R, c)",
"- sumR += c",
... | false | 0.03781 | 0.045041 | 0.839456 | [
"s884702816",
"s179424057"
] |
u392029857 | p03805 | python | s179569131 | s134028919 | 1,049 | 37 | 195,692 | 3,064 | Accepted | Accepted | 96.47 | from collections import deque
from copy import copy as dc
import sys
def main():
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
g = [[] for i in range(n+1)]
for i in ab:
g[i[0]].append(i[1])
g[i[1... | import sys
sys.setrecursionlimit(4100000)
def Dfs(G, v, n, visited):
all_visited = True
for i in range(n):
if visited[i] == False:
all_visited = False
if all_visited:
return 1
ret = 0
for i in range(n):
if not G[v][i]:
continue
... | 31 | 42 | 789 | 902 | from collections import deque
from copy import copy as dc
import sys
def main():
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
g = [[] for i in range(n + 1)]
for i in ab:
g[i[0]].append(i[1])
g[i[1]].appen... | import sys
sys.setrecursionlimit(4100000)
def Dfs(G, v, n, visited):
all_visited = True
for i in range(n):
if visited[i] == False:
all_visited = False
if all_visited:
return 1
ret = 0
for i in range(n):
if not G[v][i]:
continue
if visited[i]... | false | 26.190476 | [
"-from collections import deque",
"-from copy import copy as dc",
"+",
"+sys.setrecursionlimit(4100000)",
"+",
"+",
"+def Dfs(G, v, n, visited):",
"+ all_visited = True",
"+ for i in range(n):",
"+ if visited[i] == False:",
"+ all_visited = False",
"+ if all_visited:... | false | 0.073029 | 0.037722 | 1.935959 | [
"s179569131",
"s134028919"
] |
u145231176 | p03014 | python | s287430628 | s544457662 | 996 | 563 | 92,380 | 152,664 | Accepted | Accepted | 43.47 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import d... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 70 | 105 | 1,542 | 2,655 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import def... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 33.333333 | [
"+def rand_N(ran1, ran2):",
"+ return random.randint(ran1, ran2)",
"+",
"+",
"+def rand_List(ran1, ran2, rantime):",
"+ return [random.randint(ran1, ran2) for i in range(rantime)]",
"+",
"+",
"+def rand_ints_nodup(ran1, ran2, rantime):",
"+ ns = []",
"+ while len(ns) < rantime:",
"... | false | 0.038562 | 0.03874 | 0.995404 | [
"s287430628",
"s544457662"
] |
u608088992 | p03035 | python | s611315350 | s663205648 | 56 | 18 | 3,824 | 2,940 | Accepted | Accepted | 67.86 | import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()
def gcd(a, b):
a, b = max(a, b), min(a, b)
while a % b > 0: a, b = b, a % b
return b
def solve():
A, B = list(map(int, ... | import sys
def solve():
input = sys.stdin.readline
A, B = list(map(int, input().split()))
if A <= 5: B = 0
elif A <= 12: B //= 2
print(B)
return 0
if __name__ == "__main__":
solve() | 18 | 13 | 463 | 218 | import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input():
return F.readline().strip("\n")
def line_input():
return F.readline().strip("\n").split()
def gcd(a, b):
a, b = max(a, b), min(a, b)
while a % b > 0:
a, b = b, a % b
return b
def solve():
A, B = li... | import sys
def solve():
input = sys.stdin.readline
A, B = list(map(int, input().split()))
if A <= 5:
B = 0
elif A <= 12:
B //= 2
print(B)
return 0
if __name__ == "__main__":
solve()
| false | 27.777778 | [
"-import sys, math, collections, heapq, itertools",
"-",
"-F = sys.stdin",
"-",
"-",
"-def single_input():",
"- return F.readline().strip(\"\\n\")",
"-",
"-",
"-def line_input():",
"- return F.readline().strip(\"\\n\").split()",
"-",
"-",
"-def gcd(a, b):",
"- a, b = max(a, b), ... | false | 0.160661 | 0.15128 | 1.06201 | [
"s611315350",
"s663205648"
] |
u803848678 | p03182 | python | s866119890 | s354656936 | 1,652 | 1,460 | 107,468 | 105,292 | Accepted | Accepted | 11.62 | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
class RAQ_RMQ:
def __init__(self, n, a=None, F=min, e=float("inf")):
self.n = n
self.n0 = 2**(n-1).bit_length()
self.e = e
self.F = F
self.lazy = [0]*(2*self.n0)
if a is None:
... | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
class RAQ_RMQ:
def __init__(self, n, F=min, e=float("inf"), fill=None):
self.n = n
self.n0 = 2**(n-1).bit_length()
self.e = e
self.F = F
self.lazy = [0]*(2*self.n0)
if fill is None... | 101 | 99 | 2,594 | 2,529 | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
class RAQ_RMQ:
def __init__(self, n, a=None, F=min, e=float("inf")):
self.n = n
self.n0 = 2 ** (n - 1).bit_length()
self.e = e
self.F = F
self.lazy = [0] * (2 * self.n0)
if a is None:
... | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
class RAQ_RMQ:
def __init__(self, n, F=min, e=float("inf"), fill=None):
self.n = n
self.n0 = 2 ** (n - 1).bit_length()
self.e = e
self.F = F
self.lazy = [0] * (2 * self.n0)
if fill is None:... | false | 1.980198 | [
"- def __init__(self, n, a=None, F=min, e=float(\"inf\")):",
"+ def __init__(self, n, F=min, e=float(\"inf\"), fill=None):",
"- if a is None:",
"- self.data = [e] * (2 * self.n0)",
"- else:",
"- self.data = [0] * (2 * self.n0)",
"- self.construct(a)",... | false | 0.03976 | 0.125389 | 0.317091 | [
"s866119890",
"s354656936"
] |
u155024797 | p03409 | python | s750084978 | s870720240 | 201 | 178 | 39,024 | 38,768 | Accepted | Accepted | 11.44 | def main():
N = int(eval(input()))
points = []
for _ in range(N):
x, y = list(map(int, input().split()))
points.append((x, y, "r"))
for _ in range(N):
x, y = list(map(int, input().split()))
points.append((x, y, "b"))
points.sort(lambda x: x[0])
singles =... | import heapq
def main():
N = int(eval(input()))
R = [list(map(int, input().split())) + ['R'] for _ in range(N)]
B = [list(map(int, input().split())) + ['B'] for _ in range(N)]
P = R + B
P.sort(key=lambda x: (x[0], x[1]))
solo = []
ans = 0
for p in P:
x, y, c = p
... | 29 | 28 | 768 | 671 | def main():
N = int(eval(input()))
points = []
for _ in range(N):
x, y = list(map(int, input().split()))
points.append((x, y, "r"))
for _ in range(N):
x, y = list(map(int, input().split()))
points.append((x, y, "b"))
points.sort(lambda x: x[0])
singles = []
re... | import heapq
def main():
N = int(eval(input()))
R = [list(map(int, input().split())) + ["R"] for _ in range(N)]
B = [list(map(int, input().split())) + ["B"] for _ in range(N)]
P = R + B
P.sort(key=lambda x: (x[0], x[1]))
solo = []
ans = 0
for p in P:
x, y, c = p
if c ==... | false | 3.448276 | [
"+import heapq",
"+",
"+",
"- points = []",
"- for _ in range(N):",
"- x, y = list(map(int, input().split()))",
"- points.append((x, y, \"r\"))",
"- for _ in range(N):",
"- x, y = list(map(int, input().split()))",
"- points.append((x, y, \"b\"))",
"- point... | false | 0.036166 | 0.035351 | 1.023044 | [
"s750084978",
"s870720240"
] |
u076917070 | p02845 | python | s470438295 | s061463663 | 209 | 96 | 20,792 | 13,972 | Accepted | Accepted | 54.07 | import sys
input = sys.stdin.readline
def main():
mod = 1000000007
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [[0, 0, 0] for i in range(N+1)]
ans = 1
for i in range(N):
a = A[i]
ans = ans * cnt[i].count(a) % mod
for j in range(3):
... | import sys
input = sys.stdin.readline
def main():
mod = 1000000007
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0, 0, 0]
ans = 1
for a in A:
ans = ans * cnt.count(a) % mod
for j in range(3):
if cnt[j] == a:
cnt[j] =... | 24 | 21 | 525 | 402 | import sys
input = sys.stdin.readline
def main():
mod = 1000000007
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [[0, 0, 0] for i in range(N + 1)]
ans = 1
for i in range(N):
a = A[i]
ans = ans * cnt[i].count(a) % mod
for j in range(3):
cn... | import sys
input = sys.stdin.readline
def main():
mod = 1000000007
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0, 0, 0]
ans = 1
for a in A:
ans = ans * cnt.count(a) % mod
for j in range(3):
if cnt[j] == a:
cnt[j] = a + 1
... | false | 12.5 | [
"- cnt = [[0, 0, 0] for i in range(N + 1)]",
"+ cnt = [0, 0, 0]",
"- for i in range(N):",
"- a = A[i]",
"- ans = ans * cnt[i].count(a) % mod",
"+ for a in A:",
"+ ans = ans * cnt.count(a) % mod",
"- cnt[i + 1][j] = cnt[i][j]",
"- for j in range(3):"... | false | 0.036035 | 0.041375 | 0.870922 | [
"s470438295",
"s061463663"
] |
u780342333 | p02259 | python | s639991209 | s666331247 | 30 | 20 | 7,732 | 5,608 | Accepted | Accepted | 33.33 | N = int(eval(input()))
A = [int(x) for x in input().split(" ")]
flag = True
swap_count = 0
i = 0
while flag:
flag = False
for j in range(N-1, i, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
flag = True
swap_count += 1
i += 1
print((*A))
print... | 1# bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
2# flag = 1 // 逆の隣接要素が存在する
3# while flag
4# flag = 0
5# for j が N-1 から 1 まで
6# if A[j] < A[j-1]
7# A[j] と A[j-1] を交換
8# flag = 1
n = int(eval(input()))
nums = list(map(int, input().split()))
count = 0
flag = True
while flag:
... | 16 | 23 | 324 | 528 | N = int(eval(input()))
A = [int(x) for x in input().split(" ")]
flag = True
swap_count = 0
i = 0
while flag:
flag = False
for j in range(N - 1, i, -1):
if A[j] < A[j - 1]:
A[j], A[j - 1] = A[j - 1], A[j]
flag = True
swap_count += 1
i += 1
print((*A))
print(swap_co... | 1 # bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
2 # flag = 1 // 逆の隣接要素が存在する
3 # while flag
4 # flag = 0
5 # for j が N-1 から 1 まで
6 # if A[j] < A[j-1]
7 # A[j] と A[j-1] を交換
8 # flag = 1
n = int(eval(input()))
nums = list(map(int, input().split()))
count = 0
flag = True
while flag:
... | false | 30.434783 | [
"-N = int(eval(input()))",
"-A = [int(x) for x in input().split(\" \")]",
"+1 # bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A",
"+2 # flag = 1 // 逆の隣接要素が存在する",
"+3 # while flag",
"+4 # flag = 0",
"+5 # for j が N-1 から 1 まで",
"+6 # if A[j] < A[j-1]",
"+7 # A[j] と A[j-1] を交... | false | 0.043407 | 0.046315 | 0.937205 | [
"s639991209",
"s666331247"
] |
u296518383 | p02803 | python | s894373068 | s978955538 | 557 | 302 | 3,316 | 48,492 | Accepted | Accepted | 45.78 | from collections import deque
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
INF = 10**15
answer = 0
for i in range(H):
for j in range(W):
if S[i][j] == "#":
continue
else:
dist = [[INF for _ in range(W)] for _ in range(H)] # 始点からの距離
dist[i][j] =... | from collections import deque
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
INF = 10**15
answer = 0
for i in range(H):
for j in range(W):
if S[i][j] == "#":
continue
else:
dist = [[INF for _ in range(W)] for _ in range(H)] # 始点からの距離
dist[i][j] =... | 50 | 51 | 1,557 | 1,543 | from collections import deque
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
INF = 10**15
answer = 0
for i in range(H):
for j in range(W):
if S[i][j] == "#":
continue
else:
dist = [[INF for _ in range(W)] for _ in range(H)] # 始点からの距離
... | from collections import deque
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
INF = 10**15
answer = 0
for i in range(H):
for j in range(W):
if S[i][j] == "#":
continue
else:
dist = [[INF for _ in range(W)] for _ in range(H)] # 始点からの距離
... | false | 1.960784 | [
"- stack = deque([(i, j)]) # 始点を\"先入れ先出し\"の配列に入れる",
"- while stack:",
"+ queue = deque([(i, j)]) # 始点を\"先入れ先出し\"の配列に入れる",
"+ while queue:",
"- si, sj = stack.popleft()",
"+ si, sj = queue.popleft()",
"- # * ⇔後入れ後出... | false | 0.050956 | 0.10339 | 0.492855 | [
"s894373068",
"s978955538"
] |
u124605948 | p02578 | python | s493920779 | s195306907 | 150 | 136 | 32,344 | 32,244 | Accepted | Accepted | 9.33 | n = int(eval(input()))
a = list(map(int, input().split()))
base = a[0]
ans = 0
for i in range(1, n):
base = max(base, a[i])
ans += base - a[i]
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
fllor = a[0]
ans = 0
for i in range(n):
if fllor > a[i]:
ans += fllor - a[i]
else:
fllor = max(fllor, a[i])
print(ans) | 9 | 11 | 164 | 206 | n = int(eval(input()))
a = list(map(int, input().split()))
base = a[0]
ans = 0
for i in range(1, n):
base = max(base, a[i])
ans += base - a[i]
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
fllor = a[0]
ans = 0
for i in range(n):
if fllor > a[i]:
ans += fllor - a[i]
else:
fllor = max(fllor, a[i])
print(ans)
| false | 18.181818 | [
"-base = a[0]",
"+fllor = a[0]",
"-for i in range(1, n):",
"- base = max(base, a[i])",
"- ans += base - a[i]",
"+for i in range(n):",
"+ if fllor > a[i]:",
"+ ans += fllor - a[i]",
"+ else:",
"+ fllor = max(fllor, a[i])"
] | false | 0.091908 | 0.038708 | 2.374416 | [
"s493920779",
"s195306907"
] |
u928784113 | p03556 | python | s064617389 | s497116666 | 56 | 51 | 3,188 | 3,060 | Accepted | Accepted | 8.93 | N = int(eval(input()))
import math
for i in range(N):
if int(math.sqrt(N-i)) == math.sqrt(N-i):
print((N-i))
exit()
else:
continue | N = int(eval(input()))
import math
for i in range(N,0,-1):
if int(math.sqrt(i)) == math.sqrt(i):
print(i)
exit() | 8 | 6 | 166 | 131 | N = int(eval(input()))
import math
for i in range(N):
if int(math.sqrt(N - i)) == math.sqrt(N - i):
print((N - i))
exit()
else:
continue
| N = int(eval(input()))
import math
for i in range(N, 0, -1):
if int(math.sqrt(i)) == math.sqrt(i):
print(i)
exit()
| false | 25 | [
"-for i in range(N):",
"- if int(math.sqrt(N - i)) == math.sqrt(N - i):",
"- print((N - i))",
"+for i in range(N, 0, -1):",
"+ if int(math.sqrt(i)) == math.sqrt(i):",
"+ print(i)",
"- else:",
"- continue"
] | false | 0.047967 | 0.05242 | 0.915053 | [
"s064617389",
"s497116666"
] |
u597455618 | p03363 | python | s409257667 | s060865113 | 265 | 141 | 41,148 | 38,932 | Accepted | Accepted | 46.79 | n = int(eval(input()))
a = list(map(int, input().split()))
acc = [0 for i in range(n+1)]
for i in range(n):
acc[i+1] = a[i] + acc[i]
ans = {}
for x in acc:
ans.setdefault(x, 0)
ans[x] += 1
cnt = 0
for i in ans:
cnt += ans[i]*(ans[i]-1)//2
print(cnt) | from itertools import accumulate
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
acc = accumulate(a)
counter = Counter(acc)
def cal():
yield counter[0]
for v in list(counter.values()):
if v > 1:
yield v*(v-1)//2
print((sum(cal()))) | 16 | 15 | 277 | 306 | n = int(eval(input()))
a = list(map(int, input().split()))
acc = [0 for i in range(n + 1)]
for i in range(n):
acc[i + 1] = a[i] + acc[i]
ans = {}
for x in acc:
ans.setdefault(x, 0)
ans[x] += 1
cnt = 0
for i in ans:
cnt += ans[i] * (ans[i] - 1) // 2
print(cnt)
| from itertools import accumulate
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
acc = accumulate(a)
counter = Counter(acc)
def cal():
yield counter[0]
for v in list(counter.values()):
if v > 1:
yield v * (v - 1) // 2
print((sum(cal())))
| false | 6.25 | [
"+from itertools import accumulate",
"+from collections import Counter",
"+",
"-acc = [0 for i in range(n + 1)]",
"-for i in range(n):",
"- acc[i + 1] = a[i] + acc[i]",
"-ans = {}",
"-for x in acc:",
"- ans.setdefault(x, 0)",
"- ans[x] += 1",
"-cnt = 0",
"-for i in ans:",
"- cnt ... | false | 0.052624 | 0.047794 | 1.101069 | [
"s409257667",
"s060865113"
] |
u729008627 | p03078 | python | s845162162 | s376127734 | 832 | 37 | 4,592 | 4,976 | Accepted | Accepted | 95.55 | # solution 3
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
Q = []
s = []
heapq.heappush(Q, (-A[0]-B[0]-C[0], 0, 0, 0))
for n ... | # solution 3
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
Q = []
s = set()
heapq.heappush(Q, (-A[0]-B[0]-C[0], 0, 0, 0))
for... | 24 | 24 | 817 | 811 | # solution 3
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
Q = []
s = []
heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))
for n in rang... | # solution 3
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
Q = []
s = set()
heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))
for n in r... | false | 0 | [
"-s = []",
"+s = set()",
"- if i < X - 1 and [i + 1, j, k] not in s:",
"+ if i < X - 1 and (i + 1, j, k) not in s:",
"- s.append([i + 1, j, k])",
"- if j < Y - 1 and [i, j + 1, k] not in s:",
"+ s.add((i + 1, j, k))",
"+ if j < Y - 1 and (i, j + 1, k) not in s:",
"- ... | false | 0.053928 | 0.035324 | 1.52668 | [
"s845162162",
"s376127734"
] |
u266014018 | p02703 | python | s106524691 | s201818707 | 827 | 734 | 38,572 | 39,028 | Accepted | Accepted | 11.25 | import sys
from heapq import heappush, heappop
import numpy as np
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
def main():
def dijkstra(s):
def push(v, s, x):
if s < 0:
... | import sys
from heapq import heappush, heappop
import numpy as np
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
def main():
def dijkstra(xs, ss):
def push(v, s, x):
if s < 0... | 57 | 57 | 1,383 | 1,393 | import sys
from heapq import heappush, heappop
import numpy as np
def input():
return sys.stdin.readline().rstrip()
def ii():
return int(input())
def mi():
return map(int, input().split())
def li():
return list(mi())
def main():
def dijkstra(s):
def push(v, s, x):
if s ... | import sys
from heapq import heappush, heappop
import numpy as np
def input():
return sys.stdin.readline().rstrip()
def ii():
return int(input())
def mi():
return map(int, input().split())
def li():
return list(mi())
def main():
def dijkstra(xs, ss):
def push(v, s, x):
... | false | 0 | [
"- def dijkstra(s):",
"+ def dijkstra(xs, ss):",
"- push(0, s, 0)",
"+ push(xs, ss, 0)",
"- ans = dijkstra(s)",
"+ ans = dijkstra(0, s)"
] | false | 0.196051 | 0.231107 | 0.848313 | [
"s106524691",
"s201818707"
] |
u093492951 | p03424 | python | s439626366 | s153494171 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | num = int(eval(input()))
InA = [i for i in input().split()]
flgYel = 0
for cnt in range(num):
if InA[cnt] == "Y":
flgYel = 1
break
if flgYel > 0 :
print ("Four")
else :
print ("Three")
| #入力受け取り
arare_kazu = int(eval(input()))
arare_color = [i for i in input().split()]
#print(arare_color)
#判定
if 'Y' in arare_color:
print('Four')
else:
print('Three') | 16 | 10 | 227 | 176 | num = int(eval(input()))
InA = [i for i in input().split()]
flgYel = 0
for cnt in range(num):
if InA[cnt] == "Y":
flgYel = 1
break
if flgYel > 0:
print("Four")
else:
print("Three")
| # 入力受け取り
arare_kazu = int(eval(input()))
arare_color = [i for i in input().split()]
# print(arare_color)
# 判定
if "Y" in arare_color:
print("Four")
else:
print("Three")
| false | 37.5 | [
"-num = int(eval(input()))",
"-InA = [i for i in input().split()]",
"-flgYel = 0",
"-for cnt in range(num):",
"- if InA[cnt] == \"Y\":",
"- flgYel = 1",
"- break",
"-if flgYel > 0:",
"+# 入力受け取り",
"+arare_kazu = int(eval(input()))",
"+arare_color = [i for i in input().split()]",
... | false | 0.039149 | 0.037347 | 1.04825 | [
"s439626366",
"s153494171"
] |
u476225888 | p03168 | python | s060302479 | s175000292 | 1,996 | 1,542 | 3,700 | 3,692 | Accepted | Accepted | 22.75 | from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
# from math import *
from collections import defaultdict as dd, deque
def data(): return sys.stdin.readline()
def mdata(): return list(map(float, data().split()))
out = sys.stdout.write
# sys.setrecursionlimit(100000)
INF ... | def main():
from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
# from math import *
from collections import defaultdict as dd, deque
def data(): return eval(input())
def mdata(): return list(map(float, data().split()))
out = sys.stdout.write
... | 21 | 25 | 568 | 689 | from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
# from math import *
from collections import defaultdict as dd, deque
def data():
return sys.stdin.readline()
def mdata():
return list(map(float, data().split()))
out = sys.stdout.write
# sys.setrecursionlimit(100000... | def main():
from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
# from math import *
from collections import defaultdict as dd, deque
def data():
return eval(input())
def mdata():
return list(map(float, data().split()))
out = sys.s... | false | 16 | [
"-from bisect import bisect_left as bl, bisect_right as br, insort",
"-import sys",
"-import heapq",
"+def main():",
"+ from bisect import bisect_left as bl, bisect_right as br, insort",
"+ import sys",
"+ import heapq",
"-# from math import *",
"-from collections import defaultdict as dd, ... | false | 0.041064 | 0.049246 | 0.83385 | [
"s060302479",
"s175000292"
] |
u098012509 | p03546 | python | s111887343 | s497361987 | 276 | 210 | 17,768 | 37,808 | Accepted | Accepted | 23.91 | import sys
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, csgraph_from_dense
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, csgraph_from_dense
# [[10 ** 9, 1, 2],
# [3, 10 ** 9, 2]
# [10 ** 9, 4, 7]]
input ... | from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, csgraph_from_dense
H, W = [int(x) for x in input().split()]
C = [[int(x) for x in input().split()] for _ in range(10)]
A = [[int(x) for x in input().split()] for _ in range(H)]
G = csgraph_from_dense(C, null_value... | 33 | 23 | 812 | 526 | import sys
from scipy.sparse.csgraph import (
shortest_path,
floyd_warshall,
dijkstra,
bellman_ford,
johnson,
csgraph_from_dense,
)
from scipy.sparse.csgraph import (
shortest_path,
floyd_warshall,
dijkstra,
bellman_ford,
johnson,
csgraph_from_dense,
)
# [[10 ** 9, 1, 2]... | from scipy.sparse.csgraph import (
shortest_path,
floyd_warshall,
dijkstra,
bellman_ford,
johnson,
csgraph_from_dense,
)
H, W = [int(x) for x in input().split()]
C = [[int(x) for x in input().split()] for _ in range(10)]
A = [[int(x) for x in input().split()] for _ in range(H)]
G = csgraph_from... | false | 30.30303 | [
"-import sys",
"-from scipy.sparse.csgraph import (",
"- shortest_path,",
"- floyd_warshall,",
"- dijkstra,",
"- bellman_ford,",
"- johnson,",
"- csgraph_from_dense,",
"-)",
"-# [[10 ** 9, 1, 2],",
"-# [3, 10 ** 9, 2]",
"-# [10 ** 9, 4, 7]]",
"-input = sys.stdin.readline"... | false | 0.33223 | 0.319199 | 1.040823 | [
"s111887343",
"s497361987"
] |
u712822150 | p03848 | python | s310916549 | s841437055 | 249 | 221 | 56,556 | 56,556 | Accepted | Accepted | 11.24 | from sys import stdin
def resolve():
n = int(stdin.readline().rstrip())
# s = stdin.readline().rstrip()
# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = sorted(a)
predict = [n - (((n - i + 1) // 2) * 2) + 1 f... | import sys
from sys import stdin
mod = 1000000007
n = int(stdin.readline().rstrip())
# s = stdin.readline().rstrip()
# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = sorted(a)
predict = [n - (((n - i + 1) // 2) * 2) + 1 for i in ra... | 22 | 17 | 536 | 435 | from sys import stdin
def resolve():
n = int(stdin.readline().rstrip())
# s = stdin.readline().rstrip()
# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = sorted(a)
predict = [n - (((n - i + 1) // 2) * 2) + 1 for i in ran... | import sys
from sys import stdin
mod = 1000000007
n = int(stdin.readline().rstrip())
# s = stdin.readline().rstrip()
# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = sorted(a)
predict = [n - (((n - i + 1) // 2) * 2) + 1 for i in range(0, n)]
if... | false | 22.727273 | [
"+import sys",
"-",
"-def resolve():",
"- n = int(stdin.readline().rstrip())",
"- # s = stdin.readline().rstrip()",
"- # A, B, C = [int(x) for x in stdin.readline().rstrip().split()]",
"- a = [int(x) for x in stdin.readline().rstrip().split()]",
"- a = sorted(a)",
"- predict = [n -... | false | 0.125001 | 0.038465 | 3.249735 | [
"s310916549",
"s841437055"
] |
u493520238 | p03525 | python | s143605233 | s747654195 | 122 | 65 | 83,368 | 62,048 | Accepted | Accepted | 46.72 | from itertools import product
import random
def solve(n,dl):
# n = int(input())
# dl = list(map(int, input().split()))
if 0 in dl:
return 0
doubles = []
dl1 = []
dl2 = []
for i in range(1,13):
i_cnt = dl.count(i)
if i_cnt > 2:
return 0
... | n = int(eval(input()))
dl = list(map(int, input().split()))
if 0 in dl:
print((0))
exit()
dl.sort()
dl1 = [0,24]
dl2 = [0,24]
for i, d in enumerate(dl):
if i%2 == 0:
dl1.append(d)
dl2.append(24-d)
else:
dl1.append(24-d)
dl2.append(d)
dl1.sort()
dl2.s... | 82 | 33 | 2,133 | 544 | from itertools import product
import random
def solve(n, dl):
# n = int(input())
# dl = list(map(int, input().split()))
if 0 in dl:
return 0
doubles = []
dl1 = []
dl2 = []
for i in range(1, 13):
i_cnt = dl.count(i)
if i_cnt > 2:
return 0
elif i_c... | n = int(eval(input()))
dl = list(map(int, input().split()))
if 0 in dl:
print((0))
exit()
dl.sort()
dl1 = [0, 24]
dl2 = [0, 24]
for i, d in enumerate(dl):
if i % 2 == 0:
dl1.append(d)
dl2.append(24 - d)
else:
dl1.append(24 - d)
dl2.append(d)
dl1.sort()
dl2.sort()
min_1 = ... | false | 59.756098 | [
"-from itertools import product",
"-import random",
"-",
"-",
"-def solve(n, dl):",
"- # n = int(input())",
"- # dl = list(map(int, input().split()))",
"- if 0 in dl:",
"- return 0",
"- doubles = []",
"- dl1 = []",
"- dl2 = []",
"- for i in range(1, 13):",
"- ... | false | 0.038502 | 0.038548 | 0.998806 | [
"s143605233",
"s747654195"
] |
u417096287 | p02899 | python | s160193488 | s230114832 | 364 | 220 | 74,540 | 100,860 | Accepted | Accepted | 39.56 | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
A = list(enumerate(A))
A.sort(key = lambda x: x[1])
ans = deque()
for a in A:
ans.append(a[0] + 1)
print((" ".join(map(str, ans)))) | def INT():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
N = INT()
A = LI()
for i in range(N):
A[i] = [i + 1, A[i]]
A.sort(key = lambda x : x[1])
ans = []
for i in range(N):
ans.append(A[i][0... | 13 | 23 | 232 | 329 | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
A = list(enumerate(A))
A.sort(key=lambda x: x[1])
ans = deque()
for a in A:
ans.append(a[0] + 1)
print((" ".join(map(str, ans))))
| def INT():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
N = INT()
A = LI()
for i in range(N):
A[i] = [i + 1, A[i]]
A.sort(key=lambda x: x[1])
ans = []
for i in range(N):
ans.append(A[i][0])
print((*ans))
| false | 43.478261 | [
"-from collections import deque",
"+def INT():",
"+ return int(eval(input()))",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-A = list(enumerate(A))",
"+",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def LI():",
"+ return list(map(int... | false | 0.041987 | 0.045763 | 0.917482 | [
"s160193488",
"s230114832"
] |
u581187895 | p02572 | python | s258573847 | s407166238 | 133 | 92 | 31,528 | 31,412 | Accepted | Accepted | 30.83 |
from itertools import accumulate
def resolve():
MOD = 10**9+7
N = int(eval(input()))
A = list(map(int, input().split()))
Acc = [0] + list(accumulate(A))
ans = 0
for i in range(N):
ans += A[i] * (Acc[N] - Acc[i+1])
ans %= MOD
print(ans)
if __name__ == "_... |
def resolve():
MOD = 10 ** 9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
# 面積として見る: 縦*横
square = sum(A) ** 2
# 対角線
diag = sum([a * a for a in A])
ans = (square - diag) // 2
print((ans % MOD))
if __name__ == "__main__":
resolve() | 19 | 18 | 339 | 302 | from itertools import accumulate
def resolve():
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
Acc = [0] + list(accumulate(A))
ans = 0
for i in range(N):
ans += A[i] * (Acc[N] - Acc[i + 1])
ans %= MOD
print(ans)
if __name__ == "__main__":
r... | def resolve():
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
# 面積として見る: 縦*横
square = sum(A) ** 2
# 対角線
diag = sum([a * a for a in A])
ans = (square - diag) // 2
print((ans % MOD))
if __name__ == "__main__":
resolve()
| false | 5.263158 | [
"-from itertools import accumulate",
"-",
"-",
"- Acc = [0] + list(accumulate(A))",
"- ans = 0",
"- for i in range(N):",
"- ans += A[i] * (Acc[N] - Acc[i + 1])",
"- ans %= MOD",
"- print(ans)",
"+ # 面積として見る: 縦*横",
"+ square = sum(A) ** 2",
"+ # 対角線",
"+ ... | false | 0.037267 | 0.040727 | 0.91503 | [
"s258573847",
"s407166238"
] |
u400336986 | p02370 | python | s585745698 | s545120332 | 230 | 210 | 11,420 | 11,360 | Accepted | Accepted | 8.7 | nv, ne = map(int, input().split(' '))
in_degs = [0] * nv
q = []
outs = {}
o = []
for _ in range(ne):
s, t = map(int, input().split(' '))
if s in outs: outs[s].append(t)
else: outs[s] = [t]
in_degs[t] += 1
for i in range(nv):
if in_degs[i] == 0: q.append(i)
while len(q) > 0:
... | nv, ne = map(int, input().split(' '))
in_degs = [0] * nv
q = []
outs = {}
o = []
for _ in range(ne):
s, t = map(int, input().split(' '))
if s in outs: outs[s].append(t)
else: outs[s] = [t]
in_degs[t] += 1
for i in range(nv):
if in_degs[i] == 0: q.append(i)
while q:
v = q.p... | 27 | 27 | 506 | 497 | nv, ne = map(int, input().split(" "))
in_degs = [0] * nv
q = []
outs = {}
o = []
for _ in range(ne):
s, t = map(int, input().split(" "))
if s in outs:
outs[s].append(t)
else:
outs[s] = [t]
in_degs[t] += 1
for i in range(nv):
if in_degs[i] == 0:
q.append(i)
while len(q) > 0:
... | nv, ne = map(int, input().split(" "))
in_degs = [0] * nv
q = []
outs = {}
o = []
for _ in range(ne):
s, t = map(int, input().split(" "))
if s in outs:
outs[s].append(t)
else:
outs[s] = [t]
in_degs[t] += 1
for i in range(nv):
if in_degs[i] == 0:
q.append(i)
while q:
v = q.... | false | 0 | [
"-while len(q) > 0:",
"+while q:"
] | false | 0.037152 | 0.037052 | 1.00272 | [
"s585745698",
"s545120332"
] |
u389910364 | p03266 | python | s971410783 | s979256910 | 344 | 17 | 21,364 | 3,060 | Accepted | Accepted | 95.06 | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
... | import math
import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, K = list(map(int, sys.stdin.buffer.readline().split()))
# 全部 K の倍数
ans = (N // K) ** 3
# 偶数ならKの半分でもOK... | 36 | 21 | 727 | 402 | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
import numpy as... | import math
import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, K = list(map(int, sys.stdin.buffer.readline().split()))
# 全部 K の倍数
ans = (N // K) ** 3
# 偶数ならKの半分でもOK
if K % 2 == 0:
ans +=... | false | 41.666667 | [
"-import bisect",
"-import heapq",
"-import itertools",
"-import re",
"-import string",
"-from collections import Counter, deque, defaultdict",
"-from copy import deepcopy",
"-from decimal import Decimal",
"-from fractions import gcd",
"-from functools import lru_cache, reduce",
"-from operator ... | false | 0.040562 | 0.038844 | 1.044214 | [
"s971410783",
"s979256910"
] |
u131464432 | p02975 | python | s861963655 | s043545989 | 75 | 61 | 20,660 | 20,972 | Accepted | Accepted | 18.67 | N = int(eval(input()))
a = list(map(int,input().split()))
if len(set(a)) == 1 and a[0] == 0:
print("Yes")
exit()
if N%3 != 0:
print("No")
exit()
import collections
sa = list(set(a))
sa.sort()
B = collections.Counter(a)
if len(sa) == 2 and 0 in sa:
if B[0] == N//3 and B[sa[1]] == N*2... | import collections
N = int(eval(input()))
a = list(map(int,input().split()))
B = collections.Counter(a)
k = list(B.keys())
v = list(B.values())
if len(B) == 3 and k[0]^k[1]^k[2] == 0 and v[0] == v[1] == v[2]:
print("Yes")
elif len(B) == 2 and 0 in k and (v[0] == 2*v[1] or v[1] == 2*v[0]):
print("Yes"... | 27 | 14 | 540 | 382 | N = int(eval(input()))
a = list(map(int, input().split()))
if len(set(a)) == 1 and a[0] == 0:
print("Yes")
exit()
if N % 3 != 0:
print("No")
exit()
import collections
sa = list(set(a))
sa.sort()
B = collections.Counter(a)
if len(sa) == 2 and 0 in sa:
if B[0] == N // 3 and B[sa[1]] == N * 2 // 3:
... | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
B = collections.Counter(a)
k = list(B.keys())
v = list(B.values())
if len(B) == 3 and k[0] ^ k[1] ^ k[2] == 0 and v[0] == v[1] == v[2]:
print("Yes")
elif len(B) == 2 and 0 in k and (v[0] == 2 * v[1] or v[1] == 2 * v[0]):
print("Yes")... | false | 48.148148 | [
"+import collections",
"+",
"-if len(set(a)) == 1 and a[0] == 0:",
"+B = collections.Counter(a)",
"+k = list(B.keys())",
"+v = list(B.values())",
"+if len(B) == 3 and k[0] ^ k[1] ^ k[2] == 0 and v[0] == v[1] == v[2]:",
"- exit()",
"-if N % 3 != 0:",
"- print(\"No\")",
"- exit()",
"-im... | false | 0.044588 | 0.038854 | 1.147593 | [
"s861963655",
"s043545989"
] |
u562935282 | p02996 | python | s561851001 | s666767031 | 897 | 748 | 29,456 | 31,884 | Accepted | Accepted | 16.61 | n = int(eval(input()))
e = []
for _ in range(n):
a, b = list(map(int, input().split()))
e.append((b, a))
e.sort()
cur = 0
can = True
for b, a in e:
cur += a
if cur > b:
can = False
break
print(('Yes' if can else 'No'))
| n = int(eval(input()))
tlm = [tuple(map(int, input().split())) for _ in range(n)]
# time/limit
tlm.sort(key=lambda x: x[1])
flg = True
cur = 0
for t, lm in tlm:
cur += t
if cur > lm:
flg = False
break
print(('Yes' if flg else 'No'))
| 16 | 15 | 254 | 266 | n = int(eval(input()))
e = []
for _ in range(n):
a, b = list(map(int, input().split()))
e.append((b, a))
e.sort()
cur = 0
can = True
for b, a in e:
cur += a
if cur > b:
can = False
break
print(("Yes" if can else "No"))
| n = int(eval(input()))
tlm = [tuple(map(int, input().split())) for _ in range(n)]
# time/limit
tlm.sort(key=lambda x: x[1])
flg = True
cur = 0
for t, lm in tlm:
cur += t
if cur > lm:
flg = False
break
print(("Yes" if flg else "No"))
| false | 6.25 | [
"-e = []",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- e.append((b, a))",
"-e.sort()",
"+tlm = [tuple(map(int, input().split())) for _ in range(n)]",
"+# time/limit",
"+tlm.sort(key=lambda x: x[1])",
"+flg = True",
"-can = True",
"-for b, a in e:",
"- cur += ... | false | 0.038466 | 0.049158 | 0.782488 | [
"s561851001",
"s666767031"
] |
u175034939 | p02537 | python | s180918547 | s838904732 | 635 | 452 | 106,640 | 92,168 | Accepted | Accepted | 28.82 | import sys
sys.setrecursionlimit(10**8)
class SegTree:
def __init__(self, N, ele):
self.num = 2**(N-1).bit_length()
self.el = ele
self.data = [ele]*(2*self.num)
def calc(self, x, y):
return max(x, y)
def update(self, idx, x):
idx += (self.num - 1)
... | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
class SegTree:
def __init__(self, N, ele):
self.num = 2**(N-1).bit_length()
self.el = ele
self.data = [ele]*(2*self.num)
def calc(self, x, y):
return max(x, y)
def update(self, idx, x):
... | 49 | 50 | 1,223 | 1,251 | import sys
sys.setrecursionlimit(10**8)
class SegTree:
def __init__(self, N, ele):
self.num = 2 ** (N - 1).bit_length()
self.el = ele
self.data = [ele] * (2 * self.num)
def calc(self, x, y):
return max(x, y)
def update(self, idx, x):
idx += self.num - 1
s... | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
class SegTree:
def __init__(self, N, ele):
self.num = 2 ** (N - 1).bit_length()
self.el = ele
self.data = [ele] * (2 * self.num)
def calc(self, x, y):
return max(x, y)
def update(self, idx, x):
id... | false | 2 | [
"+input = sys.stdin.readline"
] | false | 0.184595 | 0.059328 | 3.111423 | [
"s180918547",
"s838904732"
] |
u981931040 | p02873 | python | s488708646 | s273663010 | 399 | 250 | 23,336 | 29,112 | Accepted | Accepted | 37.34 | S = eval(input())
ans = [0] * (len(S) + 1)
for i in range(len(S)):
if S[i] == '<':
ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
if S[i] == '>':
ans[i] = max(ans[i + 1] + 1, ans[i])
print((sum(ans)))
| S = eval(input())
ans = [0] * (len(S) + 1)
for i in range(len(S)):
if S[i] == '<':
ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
if S[i] == '>':
ans[i] = max(ans[i], ans[i + 1] + 1)
print((sum(ans))) | 11 | 9 | 242 | 237 | S = eval(input())
ans = [0] * (len(S) + 1)
for i in range(len(S)):
if S[i] == "<":
ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
if S[i] == ">":
ans[i] = max(ans[i + 1] + 1, ans[i])
print((sum(ans)))
| S = eval(input())
ans = [0] * (len(S) + 1)
for i in range(len(S)):
if S[i] == "<":
ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
if S[i] == ">":
ans[i] = max(ans[i], ans[i + 1] + 1)
print((sum(ans)))
| false | 18.181818 | [
"- ans[i] = max(ans[i + 1] + 1, ans[i])",
"+ ans[i] = max(ans[i], ans[i + 1] + 1)"
] | false | 0.037066 | 0.068542 | 0.540776 | [
"s488708646",
"s273663010"
] |
u889550481 | p03105 | python | s672885110 | s192628055 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | A,B,C=list(map(int,input().split()))
print((min(C,B//A))) | A,B,C=list(map(int,input().split()))
n=B//A
if n<C:
print(n)
else:
print(C) | 2 | 8 | 50 | 86 | A, B, C = list(map(int, input().split()))
print((min(C, B // A)))
| A, B, C = list(map(int, input().split()))
n = B // A
if n < C:
print(n)
else:
print(C)
| false | 75 | [
"-print((min(C, B // A)))",
"+n = B // A",
"+if n < C:",
"+ print(n)",
"+else:",
"+ print(C)"
] | false | 0.047751 | 0.162518 | 0.293816 | [
"s672885110",
"s192628055"
] |
u837673618 | p02728 | python | s128788162 | s042121387 | 1,547 | 1,430 | 89,464 | 80,336 | Accepted | Accepted | 7.56 | from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9+7
N = int(eval(input()))
@lru_cache(maxsize=None)
def mod_inv(x):
if x == 1:
return 1
return M // x * -mod_inv(M%x) % M
weight = [0]*(N+1)
size = [0]*(N+1)
d... | from functools import *
from itertools import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9+7
N = int(eval(input()))
@lru_cache(maxsize=None)
def mod_inv(x):
return 1 if x == 1 else M // x * -mod_inv(M%x) % M
Weight = [0]*(N+1)
Size = [0]*(N+1)
def calc_subtr... | 49 | 47 | 949 | 951 | from functools import *
from collections import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9 + 7
N = int(eval(input()))
@lru_cache(maxsize=None)
def mod_inv(x):
if x == 1:
return 1
return M // x * -mod_inv(M % x) % M
weight = [0] * (N + 1)
size = [0] * (N + ... | from functools import *
from itertools import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9 + 7
N = int(eval(input()))
@lru_cache(maxsize=None)
def mod_inv(x):
return 1 if x == 1 else M // x * -mod_inv(M % x) % M
Weight = [0] * (N + 1)
Size = [0] * (N + 1)
def calc_sub... | false | 4.081633 | [
"-from collections import *",
"+from itertools import *",
"- if x == 1:",
"- return 1",
"- return M // x * -mod_inv(M % x) % M",
"+ return 1 if x == 1 else M // x * -mod_inv(M % x) % M",
"-weight = [0] * (N + 1)",
"-size = [0] * (N + 1)",
"+Weight = [0] * (N + 1)",
"+Size = [0] * (... | false | 0.111415 | 0.085478 | 1.303437 | [
"s128788162",
"s042121387"
] |
u987164499 | p03240 | python | s854883004 | s364038775 | 583 | 33 | 3,064 | 3,064 | Accepted | Accepted | 94.34 | from sys import stdin
n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
point = 0
for i in range(101):
for j in range(101):
flag = True
kizyun = False
count = 0
for a,b,c in li:
if c != 0:
... | n = int(eval(input()))
low = 0
hi = 10**9
li = []
lin = []
for _ in range(n):
x,y,h = list(map(int,input().split()))
if h != 0:
li.append((x,y,h))
lin.append((x,y,h))
for i in range(101):
for j in range(101):
flag = True
h = li[0][2]+abs(i-li[0][0])+abs(j-li[0]... | 28 | 24 | 821 | 505 | from sys import stdin
n = int(stdin.readline().rstrip())
li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
point = 0
for i in range(101):
for j in range(101):
flag = True
kizyun = False
count = 0
for a, b, c in li:
if c != 0:
coun... | n = int(eval(input()))
low = 0
hi = 10**9
li = []
lin = []
for _ in range(n):
x, y, h = list(map(int, input().split()))
if h != 0:
li.append((x, y, h))
lin.append((x, y, h))
for i in range(101):
for j in range(101):
flag = True
h = li[0][2] + abs(i - li[0][0]) + abs(j - li[0][1])... | false | 14.285714 | [
"-from sys import stdin",
"-",
"-n = int(stdin.readline().rstrip())",
"-li = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]",
"-point = 0",
"+n = int(eval(input()))",
"+low = 0",
"+hi = 10**9",
"+li = []",
"+lin = []",
"+for _ in range(n):",
"+ x, y, h = list(map(int,... | false | 0.148855 | 0.03776 | 3.942167 | [
"s854883004",
"s364038775"
] |
u387774811 | p02996 | python | s368031988 | s757744626 | 979 | 699 | 119,644 | 85,156 | Accepted | Accepted | 28.6 | def merge_sort(arr):
if len(arr) <= 1:
return arr
mid = len(arr) // 2
# ここで分割を行う
left = arr[:mid]
right = arr[mid:]
# 再帰的に分割を行う
left = merge_sort(left)
right = merge_sort(right)
# returnが返ってきたら、結合を行い、結合したものを次に渡す
return merge(left, right)
def merge(left, right):
merged = []
l_i, r_i = 0, 0
# ソー... | import sys
input = sys.stdin.readline
N=int(eval(input()))
lst=[0]*N
lst=[list(map(int,input().split())) for i in range(N)]
lst.sort(key=lambda x: x[1])
ans=0
t=0
for i in range(N):
t+=lst[i][0]
if t>lst[i][1]:
ans+=1
if ans==0:
print("Yes")
else:
print("No") | 47 | 16 | 996 | 274 | def merge_sort(arr):
if len(arr) <= 1:
return arr
mid = len(arr) // 2
# ここで分割を行う
left = arr[:mid]
right = arr[mid:]
# 再帰的に分割を行う
left = merge_sort(left)
right = merge_sort(right)
# returnが返ってきたら、結合を行い、結合したものを次に渡す
return merge(left, right)
def merge(left, right):
merg... | import sys
input = sys.stdin.readline
N = int(eval(input()))
lst = [0] * N
lst = [list(map(int, input().split())) for i in range(N)]
lst.sort(key=lambda x: x[1])
ans = 0
t = 0
for i in range(N):
t += lst[i][0]
if t > lst[i][1]:
ans += 1
if ans == 0:
print("Yes")
else:
print("No")
| false | 65.957447 | [
"-def merge_sort(arr):",
"- if len(arr) <= 1:",
"- return arr",
"- mid = len(arr) // 2",
"- # ここで分割を行う",
"- left = arr[:mid]",
"- right = arr[mid:]",
"- # 再帰的に分割を行う",
"- left = merge_sort(left)",
"- right = merge_sort(right)",
"- # returnが返ってきたら、結合を行い、結合したものを次に渡... | false | 0.061019 | 0.037407 | 1.631212 | [
"s368031988",
"s757744626"
] |
u021906447 | p02701 | python | s117134163 | s094733858 | 315 | 289 | 35,724 | 35,656 | Accepted | Accepted | 8.25 | N = int(eval(input()))
a = []
for i in range(N):
S = str(eval(input()))
a.append(S)
count = len(list(set(a)))
print(count) | N = int(eval(input()))
a = []
for i in range(N):
f = eval(input())
a.append(f)
a=list(set(a))
print((len(a))) | 9 | 9 | 128 | 111 | N = int(eval(input()))
a = []
for i in range(N):
S = str(eval(input()))
a.append(S)
count = len(list(set(a)))
print(count)
| N = int(eval(input()))
a = []
for i in range(N):
f = eval(input())
a.append(f)
a = list(set(a))
print((len(a)))
| false | 0 | [
"- S = str(eval(input()))",
"- a.append(S)",
"-count = len(list(set(a)))",
"-print(count)",
"+ f = eval(input())",
"+ a.append(f)",
"+a = list(set(a))",
"+print((len(a)))"
] | false | 0.049607 | 0.049848 | 0.99515 | [
"s117134163",
"s094733858"
] |
u408071652 | p02883 | python | s210241571 | s646242907 | 362 | 314 | 113,692 | 113,856 | Accepted | Accepted | 13.26 | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True) # 0(NlogN)
F.sort() # O(NlogN)
def train(X, Y, T): # O(N) ... | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True) # 0(NlogN)
F.sort() # O(NlogN)
def train(X, Y, T): # O(N) ... | 37 | 42 | 714 | 791 | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True) # 0(NlogN)
F.sort() # O(NlogN)
def train(X, Y, T): # O(N) ans: 回数
... | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True) # 0(NlogN)
F.sort() # O(NlogN)
def train(X, Y, T): # O(N) ans: 回数
... | false | 11.904762 | [
"- ok = 10**18 + 1 # 時間",
"+ if K >= 10**12:",
"+ print((0))",
"+ exit()",
"+ ok = 10**12 + 1 # 時間",
"+ # O(Nlog(maxK)?)"
] | false | 0.046881 | 0.126263 | 0.371298 | [
"s210241571",
"s646242907"
] |
u989345508 | p02697 | python | s027225354 | s565874757 | 64 | 48 | 75,636 | 17,372 | Accepted | Accepted | 25 | n,m=list(map(int,input().split()))
if n%2==1:
x=[f"{i+1} {n-i}" for i in range(m)]
print((" ".join(x)))
else:
x=[f"{i+1} {n-i}" if i<m/2 else f"{i+1} {n-i-1}" for i in range(m)]
print((" ".join(x)))
| def main():
n,m=list(map(int,input().split()))
if n%2==1:
x=[f"{i+1} {n-i}" for i in range(m)]
print((" ".join(x)))
else:
x=[f"{i+1} {n-i}" if i<m/2 else f"{i+1} {n-i-1}" for i in range(m)]
print((" ".join(x)))
if __name__ == "__main__":
main() | 7 | 11 | 211 | 293 | n, m = list(map(int, input().split()))
if n % 2 == 1:
x = [f"{i+1} {n-i}" for i in range(m)]
print((" ".join(x)))
else:
x = [f"{i+1} {n-i}" if i < m / 2 else f"{i+1} {n-i-1}" for i in range(m)]
print((" ".join(x)))
| def main():
n, m = list(map(int, input().split()))
if n % 2 == 1:
x = [f"{i+1} {n-i}" for i in range(m)]
print((" ".join(x)))
else:
x = [f"{i+1} {n-i}" if i < m / 2 else f"{i+1} {n-i-1}" for i in range(m)]
print((" ".join(x)))
if __name__ == "__main__":
main()
| false | 36.363636 | [
"-n, m = list(map(int, input().split()))",
"-if n % 2 == 1:",
"- x = [f\"{i+1} {n-i}\" for i in range(m)]",
"- print((\" \".join(x)))",
"-else:",
"- x = [f\"{i+1} {n-i}\" if i < m / 2 else f\"{i+1} {n-i-1}\" for i in range(m)]",
"- print((\" \".join(x)))",
"+def main():",
"+ n, m = li... | false | 0.102339 | 0.040022 | 2.557028 | [
"s027225354",
"s565874757"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.