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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u062147869 | p03782 | python | s996688955 | s254208187 | 1,503 | 1,246 | 42,608 | 42,608 | Accepted | Accepted | 17.1 | import sys
N,K=list(map(int,input().split()))
A=sorted([int(i) for i in input().split()])
sa=sum(A)
def f(x):
y=A[x]
if y>=K:
return True
L=set()
L.add(0)
dp=[False]*(K-y)
dp[0]=True
t=0
for i in range(N):
if i==x:
continue
s=A[i]
... | import sys
N,K=list(map(int,input().split()))
A=sorted([int(i) for i in input().split()])
sa=sum(A)
def f(x):
y=A[x]
if y>=K:
return True
dp=[False]*(K)
dp[0]=True
t=0
for i in range(N):
if i==x:
continue
s=A[i]
for k in range(t,-1,-1):
... | 45 | 43 | 792 | 724 | import sys
N, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()])
sa = sum(A)
def f(x):
y = A[x]
if y >= K:
return True
L = set()
L.add(0)
dp = [False] * (K - y)
dp[0] = True
t = 0
for i in range(N):
if i == x:
continue
... | import sys
N, K = list(map(int, input().split()))
A = sorted([int(i) for i in input().split()])
sa = sum(A)
def f(x):
y = A[x]
if y >= K:
return True
dp = [False] * (K)
dp[0] = True
t = 0
for i in range(N):
if i == x:
continue
s = A[i]
for k in rang... | false | 4.444444 | [
"- L = set()",
"- L.add(0)",
"- dp = [False] * (K - y)",
"+ dp = [False] * (K)",
"- if not dp[k]:",
"- continue",
"- if k + s + y >= K:",
"- return True",
"- dp[k + s] = True",
"- t = min(t + s, K - y - 1)",
"- ... | false | 0.041205 | 0.039055 | 1.05505 | [
"s996688955",
"s254208187"
] |
u052747412 | p02394 | python | s493339380 | s245240570 | 50 | 40 | 7,708 | 7,708 | Accepted | Accepted | 20 | input_line = eval(input())
# W,H,x,y,r
input_data = input_line.strip().split(' ')
W, H, x, y, r = [int(i) for i in input_data]
if x < 0 or y < 0:
print("No")
elif W >= (x+r) and H >= (y+r):
print("Yes")
else:
print("No") | input_data = input().split(' ')
W, H, x, y, r = [int(i) for i in input_data]
if ((x-r) >= 0 and (y-r) >= 0) and (W >= (x+r) and H >= (y+r)):
print("Yes")
else:
print("No") | 12 | 8 | 239 | 188 | input_line = eval(input())
# W,H,x,y,r
input_data = input_line.strip().split(" ")
W, H, x, y, r = [int(i) for i in input_data]
if x < 0 or y < 0:
print("No")
elif W >= (x + r) and H >= (y + r):
print("Yes")
else:
print("No")
| input_data = input().split(" ")
W, H, x, y, r = [int(i) for i in input_data]
if ((x - r) >= 0 and (y - r) >= 0) and (W >= (x + r) and H >= (y + r)):
print("Yes")
else:
print("No")
| false | 33.333333 | [
"-input_line = eval(input())",
"-# W,H,x,y,r",
"-input_data = input_line.strip().split(\" \")",
"+input_data = input().split(\" \")",
"-if x < 0 or y < 0:",
"- print(\"No\")",
"-elif W >= (x + r) and H >= (y + r):",
"+if ((x - r) >= 0 and (y - r) >= 0) and (W >= (x + r) and H >= (y + r)):"
] | false | 0.038973 | 0.039093 | 0.996921 | [
"s493339380",
"s245240570"
] |
u974231963 | p02802 | python | s230239831 | s819605263 | 299 | 260 | 4,596 | 10,360 | Accepted | Accepted | 13.04 |
n, m = list(map(int,input().split()))
AC = 0
# 各問題でACがとれているか確認用
# 0 = まだ正解していない, 1 = すでに正解済み
AC_list = [0] * (n + 1)
WA = 0
WA_List = [0] * (n + 1)
for i in range(m):
p,S = input().split()
p = int(p)
if S == "AC":
# 初めての正解
if AC_list[p] == 0:
AC += 1
... |
n, m = (int(x) for x in input().split())
# 0 = まだACなし, 1 = AC済み
ans_list = [0] * (n + 1)
# 誤った回数が記録され、ACのタイミングで加算
WA_list = [0] * (n + 1)
ans = 0
penalty = 0
for id in range(m):
# listを紐付けて要素を抜き出すことができる
query = list(map(str, input().split()))
# ACだった場合
if query[1] == 'AC':
if... | 28 | 26 | 531 | 622 | n, m = list(map(int, input().split()))
AC = 0
# 各問題でACがとれているか確認用
# 0 = まだ正解していない, 1 = すでに正解済み
AC_list = [0] * (n + 1)
WA = 0
WA_List = [0] * (n + 1)
for i in range(m):
p, S = input().split()
p = int(p)
if S == "AC":
# 初めての正解
if AC_list[p] == 0:
AC += 1
WA += WA_List[p... | n, m = (int(x) for x in input().split())
# 0 = まだACなし, 1 = AC済み
ans_list = [0] * (n + 1)
# 誤った回数が記録され、ACのタイミングで加算
WA_list = [0] * (n + 1)
ans = 0
penalty = 0
for id in range(m):
# listを紐付けて要素を抜き出すことができる
query = list(map(str, input().split()))
# ACだった場合
if query[1] == "AC":
if ans_list[int(query[... | false | 7.142857 | [
"-n, m = list(map(int, input().split()))",
"-AC = 0",
"-# 各問題でACがとれているか確認用",
"-# 0 = まだ正解していない, 1 = すでに正解済み",
"-AC_list = [0] * (n + 1)",
"-WA = 0",
"-WA_List = [0] * (n + 1)",
"-for i in range(m):",
"- p, S = input().split()",
"- p = int(p)",
"- if S == \"AC\":",
"- # 初めての正解",... | false | 0.095513 | 0.03687 | 2.590522 | [
"s230239831",
"s819605263"
] |
u022407960 | p02345 | python | s111871625 | s333330456 | 3,110 | 2,730 | 19,720 | 19,596 | Accepted | Accepted | 12.22 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 5
0 0 1
0 1 2
0 2 3
1 0 2
1 1 2
output:
1
2
"""
import math
import sys
class SegmentTree(object):
__slots__ = ('dat', 'tree_range')
def __init__(self, n):
"""
Init a SegmentTree with update and find for ra... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 5
0 0 1
0 1 2
0 2 3
1 0 2
1 1 2
output:
1
2
"""
import math
import sys
INIT_MAX = pow(2, 31) - 1
class SegmentTree(object):
__slots__ = ('dat', 'tree_range')
def __init__(self, n):
"""
Init a SegmentTre... | 79 | 80 | 1,875 | 1,821 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 5
0 0 1
0 1 2
0 2 3
1 0 2
1 1 2
output:
1
2
"""
import math
import sys
class SegmentTree(object):
__slots__ = ("dat", "tree_range")
def __init__(self, n):
"""
Init a SegmentTree with update and find for range minimum queries.
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 5
0 0 1
0 1 2
0 2 3
1 0 2
1 1 2
output:
1
2
"""
import math
import sys
INIT_MAX = pow(2, 31) - 1
class SegmentTree(object):
__slots__ = ("dat", "tree_range")
def __init__(self, n):
"""
Init a SegmentTree with update and find for rang... | false | 1.25 | [
"+INIT_MAX = pow(2, 31) - 1",
"+",
"- self.dat = [float(\"inf\")] * (2 * self.tree_range - 1)",
"+ self.dat = [INIT_MAX] * (2 * self.tree_range - 1)",
"- return float(\"inf\")",
"+ return INIT_MAX",
"- init_max = pow(2, 31) - 1",
"- cmd, ele_1, ele_2 = map... | false | 0.048675 | 0.048821 | 0.997011 | [
"s111871625",
"s333330456"
] |
u191394596 | p03476 | python | s691762436 | s035461044 | 1,216 | 1,072 | 56,280 | 52,952 | Accepted | Accepted | 11.84 | from bisect import bisect, bisect_left
size = 10 ** 5 + 1
is_prime = [True] * size
is_prime[0] = is_prime[1] = False
# √size まで
for i in range(2, 317):
j = 2 * i
while j < size:
is_prime[j] = False
j += i
# 先に like_numbers のテーブルを作っておく
like_numbers = [
i
for i, x in enumerate(... | from itertools import count
N = 10 ** 5 + 10
is_prime = [True] * N
is_prime[0] = is_prime[1] = False
# ほぼO(N)
for i in range(N):
if is_prime[i]:
for j in count(2 * i, i):
if j >= N:
break
is_prime[j] = False
is_2017_like_number = [0] * N
# O(N)
for i in range(N):
... | 29 | 35 | 583 | 666 | from bisect import bisect, bisect_left
size = 10**5 + 1
is_prime = [True] * size
is_prime[0] = is_prime[1] = False
# √size まで
for i in range(2, 317):
j = 2 * i
while j < size:
is_prime[j] = False
j += i
# 先に like_numbers のテーブルを作っておく
like_numbers = [
i
for i, x in enumerate(is_prime)
... | from itertools import count
N = 10**5 + 10
is_prime = [True] * N
is_prime[0] = is_prime[1] = False
# ほぼO(N)
for i in range(N):
if is_prime[i]:
for j in count(2 * i, i):
if j >= N:
break
is_prime[j] = False
is_2017_like_number = [0] * N
# O(N)
for i in range(N):
i... | false | 17.142857 | [
"-from bisect import bisect, bisect_left",
"+from itertools import count",
"-size = 10**5 + 1",
"-is_prime = [True] * size",
"+N = 10**5 + 10",
"+is_prime = [True] * N",
"-# √size まで",
"-for i in range(2, 317):",
"- j = 2 * i",
"- while j < size:",
"- is_prime[j] = False",
"- ... | false | 0.190045 | 0.225234 | 0.843769 | [
"s691762436",
"s035461044"
] |
u347640436 | p03167 | python | s238798327 | s054891061 | 1,037 | 452 | 49,564 | 49,532 | Accepted | Accepted | 56.41 | # 配るDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for h in range(H - 1):
for w in range(W - 1):
if a[h][w] == '#':
continue
if a[h][w + 1] != '#':
dp[h][w + 1] = (dp[... | # 貰うDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for w in range(1, W):
if a[0][w] != '#':
dp[0][w] = dp[0][w - 1]
for h in range(1, H):
if a[h][0] != '#':
dp[h][0] = dp[h - 1][0]
... | 27 | 20 | 763 | 444 | # 配るDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for h in range(H - 1):
for w in range(W - 1):
if a[h][w] == "#":
continue
if a[h][w + 1] != "#":
dp[h][w + 1] = (dp[h][w + 1] + dp[... | # 貰うDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for w in range(1, W):
if a[0][w] != "#":
dp[0][w] = dp[0][w - 1]
for h in range(1, H):
if a[h][0] != "#":
dp[h][0] = dp[h - 1][0]
for w in range(1,... | false | 25.925926 | [
"-# 配るDP",
"+# 貰うDP",
"-for h in range(H - 1):",
"- for w in range(W - 1):",
"- if a[h][w] == \"#\":",
"- continue",
"- if a[h][w + 1] != \"#\":",
"- dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % m",
"- if a[h + 1][w] != \"#\":",
"- dp[h + 1][w... | false | 0.040567 | 0.033889 | 1.197064 | [
"s238798327",
"s054891061"
] |
u747602774 | p02802 | python | s524243216 | s250124425 | 349 | 294 | 27,568 | 3,888 | Accepted | Accepted | 15.76 | N,M = list(map(int,input().split()))
sub = [list(input().split()) for i in range(M)]
wa = [0 for i in range(N)]
ac = [0 for i in range(N)]
waans = 0
acans = 0
for i in range(M):
if sub[i][1] == 'AC' and ac[int(sub[i][0])-1] == 0:
acans += 1
waans += wa[int(sub[i][0])-1]
ac[... | N,M = list(map(int,input().split()))
pro = [0 for i in range(N+1)]
ac,wa = 0,0
for i in range(M):
p,s = input().split()
p = int(p)
if s == 'AC':
if pro[p] != -1:
ac += 1
wa += pro[p]
pro[p] = -1
else:
if pro[p] != -1:
pro[p] +=... | 19 | 15 | 451 | 331 | N, M = list(map(int, input().split()))
sub = [list(input().split()) for i in range(M)]
wa = [0 for i in range(N)]
ac = [0 for i in range(N)]
waans = 0
acans = 0
for i in range(M):
if sub[i][1] == "AC" and ac[int(sub[i][0]) - 1] == 0:
acans += 1
waans += wa[int(sub[i][0]) - 1]
ac[int(sub[i][0... | N, M = list(map(int, input().split()))
pro = [0 for i in range(N + 1)]
ac, wa = 0, 0
for i in range(M):
p, s = input().split()
p = int(p)
if s == "AC":
if pro[p] != -1:
ac += 1
wa += pro[p]
pro[p] = -1
else:
if pro[p] != -1:
pro[p] += 1
pri... | false | 21.052632 | [
"-sub = [list(input().split()) for i in range(M)]",
"-wa = [0 for i in range(N)]",
"-ac = [0 for i in range(N)]",
"-waans = 0",
"-acans = 0",
"+pro = [0 for i in range(N + 1)]",
"+ac, wa = 0, 0",
"- if sub[i][1] == \"AC\" and ac[int(sub[i][0]) - 1] == 0:",
"- acans += 1",
"- waans... | false | 0.074411 | 0.03708 | 2.006761 | [
"s524243216",
"s250124425"
] |
u250664216 | p02948 | python | s206763106 | s406232878 | 442 | 379 | 26,872 | 31,652 | Accepted | Accepted | 14.25 | import sys
import heapq
input = sys.stdin.readline
n,m = list(map(int, input().split()))
job_list = []
for i in range(n):
a,b = list(map(int, input().split()))
job_list.append((a,b))
job_list.sort(key=lambda x:x[0])
# print(job_list)
hq = []
max_income = 0
j = 0
for i in range(1,m+1):
while ... | import sys
import heapq
input = sys.stdin.readline
n,m = list(map(int, input().split()))
job_list = {}
for i in range(n):
a,b = list(map(int, input().split()))
if a in job_list:
job_list[a].append((-b,a))
else:
job_list[a] = [(-b,a)]
# job_list.sort(key=lambda x:x[0])
# print(job... | 24 | 30 | 534 | 707 | import sys
import heapq
input = sys.stdin.readline
n, m = list(map(int, input().split()))
job_list = []
for i in range(n):
a, b = list(map(int, input().split()))
job_list.append((a, b))
job_list.sort(key=lambda x: x[0])
# print(job_list)
hq = []
max_income = 0
j = 0
for i in range(1, m + 1):
while j < n an... | import sys
import heapq
input = sys.stdin.readline
n, m = list(map(int, input().split()))
job_list = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a in job_list:
job_list[a].append((-b, a))
else:
job_list[a] = [(-b, a)]
# job_list.sort(key=lambda x:x[0])
# print(job_list)
... | false | 20 | [
"-job_list = []",
"+job_list = {}",
"- job_list.append((a, b))",
"-job_list.sort(key=lambda x: x[0])",
"+ if a in job_list:",
"+ job_list[a].append((-b, a))",
"+ else:",
"+ job_list[a] = [(-b, a)]",
"+# job_list.sort(key=lambda x:x[0])",
"-j = 0",
"+# j = 0",
"- while... | false | 0.043463 | 0.046966 | 0.925421 | [
"s206763106",
"s406232878"
] |
u188827677 | p02773 | python | s653375292 | s718317207 | 692 | 630 | 44,268 | 35,828 | Accepted | Accepted | 8.96 | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
count = Counter(s)
maxNum = max(count.values())
t = sorted(list(set(s)))
for i in t:
if count[i] == maxNum:
print(i) | from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
count = Counter(s)
t = max(count.values())
ans = []
for i in count.items():
if i[1] == t:
ans.append(i[0])
print(*sorted(ans), sep='\n')
| 10 | 11 | 213 | 235 | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
count = Counter(s)
maxNum = max(count.values())
t = sorted(list(set(s)))
for i in t:
if count[i] == maxNum:
print(i)
| from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
count = Counter(s)
t = max(count.values())
ans = []
for i in count.items():
if i[1] == t:
ans.append(i[0])
print(*sorted(ans), sep="\n")
| false | 9.090909 | [
"-n = int(eval(input()))",
"-s = [eval(input()) for _ in range(n)]",
"+n = int(input())",
"+s = [input() for _ in range(n)]",
"-maxNum = max(count.values())",
"-t = sorted(list(set(s)))",
"-for i in t:",
"- if count[i] == maxNum:",
"- print(i)",
"+t = max(count.values())",
"+ans = []",... | false | 0.04262 | 0.043147 | 0.987781 | [
"s653375292",
"s718317207"
] |
u432805419 | p03826 | python | s894850556 | s715549474 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | a = list(map(int,input().split()))
x = a[0] * a[1]
y = a[2] * a[3]
if x >= y:
print(x)
else:
print(y) | a = list(map(int,input().split()))
b = a[0] * a[1]
c = a[2] * a[3]
if b > c:
print(b)
else:
print(c) | 7 | 8 | 111 | 112 | a = list(map(int, input().split()))
x = a[0] * a[1]
y = a[2] * a[3]
if x >= y:
print(x)
else:
print(y)
| a = list(map(int, input().split()))
b = a[0] * a[1]
c = a[2] * a[3]
if b > c:
print(b)
else:
print(c)
| false | 12.5 | [
"-x = a[0] * a[1]",
"-y = a[2] * a[3]",
"-if x >= y:",
"- print(x)",
"+b = a[0] * a[1]",
"+c = a[2] * a[3]",
"+if b > c:",
"+ print(b)",
"- print(y)",
"+ print(c)"
] | false | 0.07779 | 0.042025 | 1.851039 | [
"s894850556",
"s715549474"
] |
u350093546 | p03545 | python | s881442006 | s312367891 | 244 | 26 | 61,156 | 9,204 | Accepted | Accepted | 89.34 | a=list(input())
for i in range(4):
a[i]=int(a[i])
x=sum(a)-7
dict={0:'+',1:'-'}
ans=0
for i in range(2):
for j in range(2):
for k in range(2):
if x==(i*a[1]+j*a[2]+k*a[3])*2:
print(a[0],dict[i],a[1],dict[j],a[2],dict[k],a[3],'=7',sep='')
ans=1
if ans==1:
... | import itertools
x=list(eval(input()))
for lst in itertools.product(['+','-'],repeat=3):
sum=int(x[0])
for i in range(3):
if lst[i]=='+':
sum+=int(x[i+1])
else:
sum-=int(x[i+1])
if sum==7:
print((x[0]+lst[0]+x[1]+lst[1]+x[2]+lst[2]+x[3]+'=7'))
break | 18 | 13 | 382 | 288 | a = list(input())
for i in range(4):
a[i] = int(a[i])
x = sum(a) - 7
dict = {0: "+", 1: "-"}
ans = 0
for i in range(2):
for j in range(2):
for k in range(2):
if x == (i * a[1] + j * a[2] + k * a[3]) * 2:
print(a[0], dict[i], a[1], dict[j], a[2], dict[k], a[3], "=7", sep="")
... | import itertools
x = list(eval(input()))
for lst in itertools.product(["+", "-"], repeat=3):
sum = int(x[0])
for i in range(3):
if lst[i] == "+":
sum += int(x[i + 1])
else:
sum -= int(x[i + 1])
if sum == 7:
print((x[0] + lst[0] + x[1] + lst[1] + x[2] + lst[2]... | false | 27.777778 | [
"-a = list(input())",
"-for i in range(4):",
"- a[i] = int(a[i])",
"-x = sum(a) - 7",
"-dict = {0: \"+\", 1: \"-\"}",
"-ans = 0",
"-for i in range(2):",
"- for j in range(2):",
"- for k in range(2):",
"- if x == (i * a[1] + j * a[2] + k * a[3]) * 2:",
"- pr... | false | 0.046325 | 0.043797 | 1.057742 | [
"s881442006",
"s312367891"
] |
u606045429 | p03681 | python | s664816798 | s420653472 | 41 | 29 | 3,060 | 3,060 | Accepted | Accepted | 29.27 | N, M = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
def mod_fact(n, mod = 10 ** 9 + 7):
result = 1
for i in range(2, n + 1):
result = (result * i) % mod
return result
if N == M:
print(((2 * mod_fact(N) * mod_fact(M)) % mod))
elif abs(N - M) == 1:
print(((mod_fact(N) * ... | def mod_fact(n, mod):
ans = 1
for i in range(2, n + 1):
ans = ans * i % mod
return ans
mod = 10 ** 9 + 7
N, M = list(map(int, input().split()))
if N == M:
print((2 * mod_fact(N, mod) ** 2 % mod))
elif abs(N - M) == 1:
print((mod_fact(min(M, N), mod) ** 2 * max(M, N) % mod))
... | 16 | 16 | 358 | 330 | N, M = [int(i) for i in input().split()]
mod = 10**9 + 7
def mod_fact(n, mod=10**9 + 7):
result = 1
for i in range(2, n + 1):
result = (result * i) % mod
return result
if N == M:
print(((2 * mod_fact(N) * mod_fact(M)) % mod))
elif abs(N - M) == 1:
print(((mod_fact(N) * mod_fact(M)) % mod... | def mod_fact(n, mod):
ans = 1
for i in range(2, n + 1):
ans = ans * i % mod
return ans
mod = 10**9 + 7
N, M = list(map(int, input().split()))
if N == M:
print((2 * mod_fact(N, mod) ** 2 % mod))
elif abs(N - M) == 1:
print((mod_fact(min(M, N), mod) ** 2 * max(M, N) % mod))
else:
print((... | false | 0 | [
"-N, M = [int(i) for i in input().split()]",
"-mod = 10**9 + 7",
"+def mod_fact(n, mod):",
"+ ans = 1",
"+ for i in range(2, n + 1):",
"+ ans = ans * i % mod",
"+ return ans",
"-def mod_fact(n, mod=10**9 + 7):",
"- result = 1",
"- for i in range(2, n + 1):",
"- resul... | false | 0.040007 | 0.042309 | 0.945584 | [
"s664816798",
"s420653472"
] |
u274504193 | p02622 | python | s279704191 | s345553426 | 65 | 58 | 9,404 | 9,248 | Accepted | Accepted | 10.77 | s = eval(input())
t = eval(input())
count = 0
for i in range(len(s)):
if s[i] != t[i]:
count += 1
print(count)
| s = eval(input())
t = eval(input())
count = 0
for i in range(len(s)):
count += s[i] != t[i]
print(count)
| 7 | 6 | 111 | 100 | s = eval(input())
t = eval(input())
count = 0
for i in range(len(s)):
if s[i] != t[i]:
count += 1
print(count)
| s = eval(input())
t = eval(input())
count = 0
for i in range(len(s)):
count += s[i] != t[i]
print(count)
| false | 14.285714 | [
"- if s[i] != t[i]:",
"- count += 1",
"+ count += s[i] != t[i]"
] | false | 0.076006 | 0.077812 | 0.976791 | [
"s279704191",
"s345553426"
] |
u167681750 | p03095 | python | s328691605 | s862524392 | 41 | 27 | 4,204 | 3,820 | Accepted | Accepted | 34.15 | from collections import *
from functools import *
n = int(eval(input()))
s = eval(input())
counter_s = [i[1] + 1 for i in Counter(s).most_common()]
ans = reduce(lambda x, y: (x * y) % (10 ** 9 + 7), counter_s)
print((ans - 1)) | from collections import *
from functools import *
n = int(eval(input()))
s = eval(input())
counter_s = [x + 1 for x in list(Counter(s).values())]
ans = reduce(lambda x, y: (x * y) % (10 ** 9 + 7), counter_s)
print((ans - 1)) | 10 | 10 | 224 | 221 | from collections import *
from functools import *
n = int(eval(input()))
s = eval(input())
counter_s = [i[1] + 1 for i in Counter(s).most_common()]
ans = reduce(lambda x, y: (x * y) % (10**9 + 7), counter_s)
print((ans - 1))
| from collections import *
from functools import *
n = int(eval(input()))
s = eval(input())
counter_s = [x + 1 for x in list(Counter(s).values())]
ans = reduce(lambda x, y: (x * y) % (10**9 + 7), counter_s)
print((ans - 1))
| false | 0 | [
"-counter_s = [i[1] + 1 for i in Counter(s).most_common()]",
"+counter_s = [x + 1 for x in list(Counter(s).values())]"
] | false | 0.044219 | 0.095233 | 0.464324 | [
"s328691605",
"s862524392"
] |
u644907318 | p03378 | python | s882178813 | s166198222 | 179 | 72 | 38,288 | 61,712 | Accepted | Accepted | 59.78 | N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0
for i in range(X,N+1):
if i in A:
cnt += 1
cntmin = cnt
cnt = 0
for i in range(X,-1,-1):
if i in A:
cnt += 1
cntmin = min(cntmin,cnt)
print(cntmin) | N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0
for i in range(M):
if X>A[i]:
cnt += 1
print((min(cnt,M-cnt))) | 13 | 7 | 259 | 154 | N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
for i in range(X, N + 1):
if i in A:
cnt += 1
cntmin = cnt
cnt = 0
for i in range(X, -1, -1):
if i in A:
cnt += 1
cntmin = min(cntmin, cnt)
print(cntmin)
| N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
for i in range(M):
if X > A[i]:
cnt += 1
print((min(cnt, M - cnt)))
| false | 46.153846 | [
"-for i in range(X, N + 1):",
"- if i in A:",
"+for i in range(M):",
"+ if X > A[i]:",
"-cntmin = cnt",
"-cnt = 0",
"-for i in range(X, -1, -1):",
"- if i in A:",
"- cnt += 1",
"-cntmin = min(cntmin, cnt)",
"-print(cntmin)",
"+print((min(cnt, M - cnt)))"
] | false | 0.039347 | 0.043287 | 0.908995 | [
"s882178813",
"s166198222"
] |
u652737716 | p03474 | python | s591327179 | s979554081 | 25 | 23 | 3,444 | 3,188 | Accepted | Accepted | 8 | import re
A, B = [int(x) for x in input().split()]
S = eval(input())
match = re.match('^[0-9]{' + str(A) + '}-[0-9]{' + str(B) + '}$', S)
if match:
print('Yes')
else:
print('No')
| import re
A, B = [x for x in input().split()]
print(('Yes' if re.match('^[0-9]{' + A + '}-[0-9]{' + B + '}$', eval(input())) else 'No'))
| 11 | 3 | 191 | 131 | import re
A, B = [int(x) for x in input().split()]
S = eval(input())
match = re.match("^[0-9]{" + str(A) + "}-[0-9]{" + str(B) + "}$", S)
if match:
print("Yes")
else:
print("No")
| import re
A, B = [x for x in input().split()]
print(
("Yes" if re.match("^[0-9]{" + A + "}-[0-9]{" + B + "}$", eval(input())) else "No")
)
| false | 72.727273 | [
"-A, B = [int(x) for x in input().split()]",
"-S = eval(input())",
"-match = re.match(\"^[0-9]{\" + str(A) + \"}-[0-9]{\" + str(B) + \"}$\", S)",
"-if match:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+A, B = [x for x in input().split()]",
"+print(",
"+ (\"Yes\" if re.match(\"^[0... | false | 0.048084 | 0.052201 | 0.921147 | [
"s591327179",
"s979554081"
] |
u291766461 | p03438 | python | s931145850 | s018755487 | 28 | 25 | 4,600 | 4,596 | Accepted | Accepted | 10.71 | import math
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_A = sum(A)
sum_B = sum(B)
cnt1 = sum_B - sum_A
cnt2 = 0
for a, b in zip(A, B):
# if a > b:
# cnt2 += a - b
if a < b:
cnt2 += math.ceil((b - a) / 2)
if cnt1 >= cnt2:
... | import math
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for a, b in zip(A, B):
if a > b:
cnt -= a - b
if a < b:
cnt += (b - a) // 2
if cnt < 0:
print("No")
else:
print("Yes") | 18 | 15 | 350 | 274 | import math
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_A = sum(A)
sum_B = sum(B)
cnt1 = sum_B - sum_A
cnt2 = 0
for a, b in zip(A, B):
# if a > b:
# cnt2 += a - b
if a < b:
cnt2 += math.ceil((b - a) / 2)
if cnt1 >= cnt2:
print("Yes")
el... | import math
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for a, b in zip(A, B):
if a > b:
cnt -= a - b
if a < b:
cnt += (b - a) // 2
if cnt < 0:
print("No")
else:
print("Yes")
| false | 16.666667 | [
"-sum_A = sum(A)",
"-sum_B = sum(B)",
"-cnt1 = sum_B - sum_A",
"-cnt2 = 0",
"+cnt = 0",
"- # if a > b:",
"- # cnt2 += a - b",
"+ if a > b:",
"+ cnt -= a - b",
"- cnt2 += math.ceil((b - a) / 2)",
"-if cnt1 >= cnt2:",
"+ cnt += (b - a) // 2",
"+if cnt < 0:",
... | false | 0.041123 | 0.044274 | 0.928823 | [
"s931145850",
"s018755487"
] |
u227082700 | p02754 | python | s798213403 | s471853980 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n,a,b=list(map(int,input().split()))
m=n//(a+b)
n-=m*(a+b)
print((m*a+min(a,n))) | n,a,b=list(map(int,input().split()))
ans=a*(n//(a+b))
ans+=min(a,n%(a+b))
print(ans)
| 4 | 4 | 75 | 82 | n, a, b = list(map(int, input().split()))
m = n // (a + b)
n -= m * (a + b)
print((m * a + min(a, n)))
| n, a, b = list(map(int, input().split()))
ans = a * (n // (a + b))
ans += min(a, n % (a + b))
print(ans)
| false | 0 | [
"-m = n // (a + b)",
"-n -= m * (a + b)",
"-print((m * a + min(a, n)))",
"+ans = a * (n // (a + b))",
"+ans += min(a, n % (a + b))",
"+print(ans)"
] | false | 0.070019 | 0.048547 | 1.442289 | [
"s798213403",
"s471853980"
] |
u822662438 | p02678 | python | s525472409 | s380477431 | 1,432 | 1,141 | 34,064 | 34,168 | Accepted | Accepted | 20.32 | n , m = list(map(int, input().split()))
root = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
root[a-1].append(b)
root[b-1].append(a)
kakutei = [1]
answer_li = [0]*n
while kakutei:
k = kakutei.pop(0)
for r in root[k-1]:
if answer_li[r-1] =... | import sys
input = sys.stdin.readline
n , m = list(map(int, input().split()))
root = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
root[a-1].append(b)
root[b-1].append(a)
kakutei = [1]
answer_li = [0]*n
while kakutei:
k = kakutei.pop(0)
for r ... | 26 | 29 | 510 | 552 | n, m = list(map(int, input().split()))
root = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
root[a - 1].append(b)
root[b - 1].append(a)
kakutei = [1]
answer_li = [0] * n
while kakutei:
k = kakutei.pop(0)
for r in root[k - 1]:
if answer_li[r - 1] == 0:
... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
root = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
root[a - 1].append(b)
root[b - 1].append(a)
kakutei = [1]
answer_li = [0] * n
while kakutei:
k = kakutei.pop(0)
for r in root[k - 1]:
... | false | 10.344828 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.037293 | 0.076255 | 0.48905 | [
"s525472409",
"s380477431"
] |
u652150585 | p03339 | python | s911216567 | s089536018 | 184 | 157 | 3,740 | 19,956 | Accepted | Accepted | 14.67 | N=int(eval(input()))
S=eval(input())
count=S[1:].count("E")
mincount=count
for i in range(1,N):
if S[i]=="E":
count-=1
if S[i-1]=="W":
count+=1
mincount=min(count,mincount)
print(mincount)
| n=int(eval(input()))
s=list(eval(input()))
ls=[0 if i=='W' else 1 for i in s]
a=sum(ls)
#print(a)
l=[0]*n
for i in range(n):
if ls[i]==1:
a-=1
l[i]=a
elif ls[i]==0:
a+=1
l[i]=a-1
print((min(l))) | 15 | 14 | 227 | 233 | N = int(eval(input()))
S = eval(input())
count = S[1:].count("E")
mincount = count
for i in range(1, N):
if S[i] == "E":
count -= 1
if S[i - 1] == "W":
count += 1
mincount = min(count, mincount)
print(mincount)
| n = int(eval(input()))
s = list(eval(input()))
ls = [0 if i == "W" else 1 for i in s]
a = sum(ls)
# print(a)
l = [0] * n
for i in range(n):
if ls[i] == 1:
a -= 1
l[i] = a
elif ls[i] == 0:
a += 1
l[i] = a - 1
print((min(l)))
| false | 6.666667 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-count = S[1:].count(\"E\")",
"-mincount = count",
"-for i in range(1, N):",
"- if S[i] == \"E\":",
"- count -= 1",
"- if S[i - 1] == \"W\":",
"- count += 1",
"- mincount = min(count, mincount)",
"-print(mincount)",
"+n =... | false | 0.048628 | 0.04732 | 1.027648 | [
"s911216567",
"s089536018"
] |
u604774382 | p02412 | python | s430774429 | s367038861 | 450 | 300 | 6,724 | 4,228 | Accepted | Accepted | 33.33 | import sys
while True:
n, x = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
if 0 == n and 0 == x:
break
cnt = 0
for i in range( 1, n-1 ):
if x <= i:
break
for j in range( i+1, n ):
if x <= ( i+j ):
break
for k in range( j+1, n+1 ):
s = ( i + j + k )
if ... | import sys
while True:
n, x = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
if 0 == n and 0 == x:
break
cnt = 0
goto = False
for i in range( 1, n-1 ):
if x < 3*(i+1):
break
for j in range( i+1, n ):
if x <= ( i+j ):
break
for k in range( j+1, n+1 ):
s = ( ... | 23 | 26 | 403 | 458 | import sys
while True:
n, x = [int(val) for val in sys.stdin.readline().split(" ")]
if 0 == n and 0 == x:
break
cnt = 0
for i in range(1, n - 1):
if x <= i:
break
for j in range(i + 1, n):
if x <= (i + j):
break
for k in range(... | import sys
while True:
n, x = [int(val) for val in sys.stdin.readline().split(" ")]
if 0 == n and 0 == x:
break
cnt = 0
goto = False
for i in range(1, n - 1):
if x < 3 * (i + 1):
break
for j in range(i + 1, n):
if x <= (i + j):
break
... | false | 11.538462 | [
"+ goto = False",
"- if x <= i:",
"+ if x < 3 * (i + 1):",
"+ goto = True",
"+ goto = False"
] | false | 0.041648 | 0.041887 | 0.994309 | [
"s430774429",
"s367038861"
] |
u057109575 | p03266 | python | s708560920 | s156490739 | 76 | 26 | 3,316 | 3,316 | Accepted | Accepted | 65.79 | N, K = list(map(int, input().split()))
if K % 2 == 1:
print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3))
else:
print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3 + sum(1 for n in range(1, N + 1) if n % K == K // 2) ** 3))
| N, K = list(map(int, input().split()))
ans = (N // K) ** 3
ans += ((N + K // 2) // K) ** 3 if K % 2 == 0 else 0
print(ans) | 5 | 4 | 240 | 119 | N, K = list(map(int, input().split()))
if K % 2 == 1:
print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3))
else:
print(
(
sum(1 for n in range(1, N + 1) if n % K == 0) ** 3
+ sum(1 for n in range(1, N + 1) if n % K == K // 2) ** 3
)
)
| N, K = list(map(int, input().split()))
ans = (N // K) ** 3
ans += ((N + K // 2) // K) ** 3 if K % 2 == 0 else 0
print(ans)
| false | 20 | [
"-if K % 2 == 1:",
"- print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3))",
"-else:",
"- print(",
"- (",
"- sum(1 for n in range(1, N + 1) if n % K == 0) ** 3",
"- + sum(1 for n in range(1, N + 1) if n % K == K // 2) ** 3",
"- )",
"- )",
"+ans =... | false | 0.00703 | 0.037914 | 0.185428 | [
"s708560920",
"s156490739"
] |
u126232616 | p03127 | python | s435522458 | s367901829 | 134 | 88 | 16,296 | 14,224 | Accepted | Accepted | 34.33 | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
g = 0
for i in range(N):
g = gcd(g, A[i])
print(g) | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(p,q):
if q == 0: return p
return gcd(q, p%q)
g = 0
for i in range(N):
g = gcd(g, A[i])
print(g) | 8 | 11 | 141 | 180 | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
g = 0
for i in range(N):
g = gcd(g, A[i])
print(g)
| N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(p, q):
if q == 0:
return p
return gcd(q, p % q)
g = 0
for i in range(N):
g = gcd(g, A[i])
print(g)
| false | 27.272727 | [
"-from fractions import gcd",
"-",
"+",
"+",
"+def gcd(p, q):",
"+ if q == 0:",
"+ return p",
"+ return gcd(q, p % q)",
"+",
"+"
] | false | 0.052626 | 0.095065 | 0.553584 | [
"s435522458",
"s367901829"
] |
u879870653 | p03733 | python | s910383001 | s414718115 | 168 | 150 | 26,708 | 25,196 | Accepted | Accepted | 10.71 | N,T = list(map(int,input().split()))
L = list(map(int,input().split()))
ans = 0
for i in range(len(L)) :
if i != N-1 :
if L[i+1]-L[i] > T :
ans += T
else :
ans += L[i+1]-L[i]
else :
ans += T
print(ans)
| N,T = list(map(int,input().split()))
L = list(map(int,input().split()))
ans = T
for i in range(N-1) :
ans += min(L[i+1]-L[i],T)
print(ans)
| 12 | 6 | 263 | 142 | N, T = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = 0
for i in range(len(L)):
if i != N - 1:
if L[i + 1] - L[i] > T:
ans += T
else:
ans += L[i + 1] - L[i]
else:
ans += T
print(ans)
| N, T = list(map(int, input().split()))
L = list(map(int, input().split()))
ans = T
for i in range(N - 1):
ans += min(L[i + 1] - L[i], T)
print(ans)
| false | 50 | [
"-ans = 0",
"-for i in range(len(L)):",
"- if i != N - 1:",
"- if L[i + 1] - L[i] > T:",
"- ans += T",
"- else:",
"- ans += L[i + 1] - L[i]",
"- else:",
"- ans += T",
"+ans = T",
"+for i in range(N - 1):",
"+ ans += min(L[i + 1] - L[i], T)"
] | false | 0.062365 | 0.036639 | 1.702155 | [
"s910383001",
"s414718115"
] |
u176796545 | p03494 | python | s209130959 | s594238995 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | n=int(eval(input()))
A=list(map(int,input().split()))
c=0
loop=True
while(loop):
for a in A:
if a%2!=0:
loop=False
break
if loop:
A = list([i//2 for i in A])
c+=1
else:
break
print(c) | n=int(eval(input()))
A=list(map(int,input().split()))
c=0
while(all([a%2==0 for a in A])):
A = list([i//2 for i in A])
c+=1
print(c) | 15 | 7 | 263 | 144 | n = int(eval(input()))
A = list(map(int, input().split()))
c = 0
loop = True
while loop:
for a in A:
if a % 2 != 0:
loop = False
break
if loop:
A = list([i // 2 for i in A])
c += 1
else:
break
print(c)
| n = int(eval(input()))
A = list(map(int, input().split()))
c = 0
while all([a % 2 == 0 for a in A]):
A = list([i // 2 for i in A])
c += 1
print(c)
| false | 53.333333 | [
"-loop = True",
"-while loop:",
"- for a in A:",
"- if a % 2 != 0:",
"- loop = False",
"- break",
"- if loop:",
"- A = list([i // 2 for i in A])",
"- c += 1",
"- else:",
"- break",
"+while all([a % 2 == 0 for a in A]):",
"+ A = li... | false | 0.036008 | 0.036365 | 0.990164 | [
"s209130959",
"s594238995"
] |
u163783894 | p02763 | python | s407840820 | s125531713 | 1,429 | 791 | 441,976 | 52,244 | Accepted | Accepted | 44.65 | import sys
input = lambda: sys.stdin.readline().rstrip()
class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.ide_ele = ide_ele
self.segfunc = segfunc
self.num = 2**(n - 1).bit_length()
self.seg = [self.ide_ele] * 2 * self.nu... | import sys
input = lambda: sys.stdin.readline().rstrip()
class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.ide_ele = ide_ele
self.segfunc = segfunc
self.num = 2**(n - 1).bit_length()
self.seg = [self.ide_ele] * 2 * self.nu... | 89 | 81 | 2,303 | 2,084 | import sys
input = lambda: sys.stdin.readline().rstrip()
class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.ide_ele = ide_ele
self.segfunc = segfunc
self.num = 2 ** (n - 1).bit_length()
self.seg = [self.ide_ele] * 2 * self.num
for... | import sys
input = lambda: sys.stdin.readline().rstrip()
class SegTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.ide_ele = ide_ele
self.segfunc = segfunc
self.num = 2 ** (n - 1).bit_length()
self.seg = [self.ide_ele] * 2 * self.num
for... | false | 8.988764 | [
"- seg = [[0 for _ in range(N)] for _ in range(26)]",
"- for i in range(N):",
"- al = ord(S[i]) - ord(\"a\")",
"- seg[al][i] = 1",
"+ seg = [1 << (ord(s) - ord(\"a\")) for s in S]",
"- for i in range(26):",
"- segtree.append(SegTree(seg[i], segfunc, 0))",
"+ segtree... | false | 0.135584 | 0.048536 | 2.793489 | [
"s407840820",
"s125531713"
] |
u297801580 | p03171 | python | s959811389 | s635842340 | 325 | 299 | 111,964 | 111,708 | Accepted | Accepted | 8 | import sys
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
a = [int(x) for x in input().split()]
dp=[]
for i in range(n):
dp.append([0]*n)
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
dp[i][j] = max(a[i] - dp[i + ... | n = int(eval(input()))
a = list(map(int, input().split()))
def calc():
dp = [[0] * n for _ in range(n)]
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1])
return dp
... | 18 | 15 | 364 | 349 | import sys
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
a = [int(x) for x in input().split()]
dp = []
for i in range(n):
dp.append([0] * n)
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
dp[i][j] = max(a[i] - dp[i + 1][j], ... | n = int(eval(input()))
a = list(map(int, input().split()))
def calc():
dp = [[0] * n for _ in range(n)]
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1])
return dp
dp = calc... | false | 16.666667 | [
"-import sys",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"-def input():",
"- return sys.stdin.readline()[:-1]",
"+def calc():",
"+ dp = [[0] * n for _ in range(n)]",
"+ for i in range(n):",
"+ dp[i][i] = a[i]",
"+ for i in range(n - 2, -1, -1):",
"+ ... | false | 0.044197 | 0.047789 | 0.924836 | [
"s959811389",
"s635842340"
] |
u492049124 | p03475 | python | s887940912 | s010114553 | 112 | 86 | 3,188 | 3,188 | Accepted | Accepted | 23.21 | N = int(eval(input()))
lines = []
for i in range(N-1):
lines.append(eval(input()))
C = []
S = []
F = []
for line in lines:
c, s, f = line.split()
C.append(int(c))
S.append(int(s))
F.append(int(f))
A = []
for i in range(N-1):
a = C[i] + S[i]
for j in range(i + 1, N - 1):
n = S[j] - ... | N = int(eval(input()))
lines = []
for i in range(N-1):
lines.append(eval(input()))
C = []
S = []
F = []
for line in lines:
c, s, f = line.split()
C.append(int(c))
S.append(int(s))
F.append(int(f))
A = []
for i in range(N-1):
a = C[i] + S[i]
for j in range(i + 1, N - 1):
if a <= S[j... | 31 | 33 | 509 | 467 | N = int(eval(input()))
lines = []
for i in range(N - 1):
lines.append(eval(input()))
C = []
S = []
F = []
for line in lines:
c, s, f = line.split()
C.append(int(c))
S.append(int(s))
F.append(int(f))
A = []
for i in range(N - 1):
a = C[i] + S[i]
for j in range(i + 1, N - 1):
n = S[j] ... | N = int(eval(input()))
lines = []
for i in range(N - 1):
lines.append(eval(input()))
C = []
S = []
F = []
for line in lines:
c, s, f = line.split()
C.append(int(c))
S.append(int(s))
F.append(int(f))
A = []
for i in range(N - 1):
a = C[i] + S[i]
for j in range(i + 1, N - 1):
if a <= S... | false | 6.060606 | [
"- n = S[j] - a if a <= S[j] else (a - S[j]) % F[j]",
"- n = F[j] - n if a > S[j] and n != 0 else n",
"- # n = S[j] - a if a <= S[j] else a % F[j]",
"+ if a <= S[j]:",
"+ n = S[j] - a",
"+ else:",
"+ mod = a % F[j]",
"+ n = F[j] - mod... | false | 0.036709 | 0.044195 | 0.830624 | [
"s887940912",
"s010114553"
] |
u471684875 | p03745 | python | s828382956 | s674202025 | 116 | 90 | 14,436 | 14,252 | Accepted | Accepted | 22.41 | n=int(eval(input()))
a=list(map(int,input().split()))
b=[]
c=[]
if n==1:
print((1))
else:
for i in range(n-1):
if a[i]!=a[i+1]:
b.append(a[i])
b.append(a[n-1])
ans=1
for i in range(len(b)-1):
c.append(b[i+1]-b[i])
d=c[0]
... | #参考(傾きの捉え方)
N = int(eval(input()))
A = list(map(int, input().split()))
f = 0
c = 1
i = 0
while i < N-1:
if f == 0:
if A[i] < A[i+1]:
f = 1
elif A[i] > A[i+1]:
f = -1
elif f == 1:
if A[i] > A[i+1]:
c += 1
f = 0
elif f == ... | 28 | 22 | 487 | 405 | n = int(eval(input()))
a = list(map(int, input().split()))
b = []
c = []
if n == 1:
print((1))
else:
for i in range(n - 1):
if a[i] != a[i + 1]:
b.append(a[i])
b.append(a[n - 1])
ans = 1
for i in range(len(b) - 1):
c.append(b[i + 1] - b[i])
d = c[0]
for i in range... | # 参考(傾きの捉え方)
N = int(eval(input()))
A = list(map(int, input().split()))
f = 0
c = 1
i = 0
while i < N - 1:
if f == 0:
if A[i] < A[i + 1]:
f = 1
elif A[i] > A[i + 1]:
f = -1
elif f == 1:
if A[i] > A[i + 1]:
c += 1
f = 0
elif f == -1:
... | false | 21.428571 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-b = []",
"-c = []",
"-if n == 1:",
"- print((1))",
"-else:",
"- for i in range(n - 1):",
"- if a[i] != a[i + 1]:",
"- b.append(a[i])",
"- b.append(a[n - 1])",
"- ans = 1",
"- for i in range(... | false | 0.042423 | 0.04255 | 0.997025 | [
"s828382956",
"s674202025"
] |
u750651325 | p03486 | python | s980325535 | s267487192 | 39 | 35 | 10,028 | 9,988 | Accepted | Accepted | 10.26 | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return eval(input())
def i(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split()))
def X(): return list(ev... | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
from functools import reduce
def s(): return eval(input())
def i(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split... | 32 | 32 | 628 | 702 | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
def s():
return eval(input())
def i():
return int(eval(input()))
def S():
return input().split()
def I():
return list(map(int, input().split()))
def X(... | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
from functools import reduce
def s():
return eval(input())
def i():
return int(eval(input()))
def S():
return input().split()
def I():
return list(map(in... | false | 0 | [
"+from functools import reduce",
"+def gcd(*numbers):",
"+ reduce(math.gcd, numbers)",
"+",
"+",
"-s = X()",
"-t = X()",
"-s.sort()",
"-t.sort()",
"-t.reverse()",
"-a = \"\".join(s)",
"-b = \"\".join(t)",
"-if a < b:",
"+count = 0",
"+ans = 0",
"+a = s()",
"+t = s()",
"+a = sort... | false | 0.041968 | 0.047086 | 0.891294 | [
"s980325535",
"s267487192"
] |
u191874006 | p03730 | python | s271484823 | s032540253 | 175 | 74 | 38,512 | 65,400 | Accepted | Accepted | 57.71 | #!/usr/bin/env python3
#ABC60 B
a,b,c = list(map(int,input().split()))
s = a
for i in range(a*b):
x = s % b
if x == c:
print('YES')
quit()
s += a
print('NO')
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 13 | 26 | 194 | 685 | #!/usr/bin/env python3
# ABC60 B
a, b, c = list(map(int, input().split()))
s = a
for i in range(a * b):
x = s % b
if x == c:
print("YES")
quit()
s += a
print("NO")
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 50 | [
"-# ABC60 B",
"-a, b, c = list(map(int, input().split()))",
"-s = a",
"-for i in range(a * b):",
"- x = s % b",
"- if x == c:",
"+import sys",
"+import math",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"+",
"+sys.setrecursionlimit(2147483647)",
"... | false | 0.055602 | 0.088807 | 0.626094 | [
"s271484823",
"s032540253"
] |
u934442292 | p02844 | python | s563035599 | s411816707 | 22 | 20 | 3,316 | 3,064 | Accepted | Accepted | 9.09 | import re
N = int(eval(input()))
S = eval(input())
res = 0
fmt = "[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*"
for i in range(10):
idx_1 = S.find(str(i))
if (idx_1 == -1) or (idx_1 > N-3):
continue
for j in range(10):
idx_2 = S[idx_1+1:].find(str(j))
if (idx_2 == -1) or (idx_2 > N-2):
continu... | N = int(eval(input()))
S = eval(input())
res = 0
for i in range(10):
idx_1 = S.find(str(i))
if (idx_1 == -1) or (idx_1 > N-3):
continue
for j in range(10):
idx_2 = S[idx_1+1:].find(str(j))
if (idx_2 == -1) or (idx_2 > N-2):
continue
for k in range(10):
idx_3 = S[idx_1+1+i... | 21 | 18 | 438 | 385 | import re
N = int(eval(input()))
S = eval(input())
res = 0
fmt = "[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*"
for i in range(10):
idx_1 = S.find(str(i))
if (idx_1 == -1) or (idx_1 > N - 3):
continue
for j in range(10):
idx_2 = S[idx_1 + 1 :].find(str(j))
if (idx_2 == -1) or (idx_2 > N - 2):
... | N = int(eval(input()))
S = eval(input())
res = 0
for i in range(10):
idx_1 = S.find(str(i))
if (idx_1 == -1) or (idx_1 > N - 3):
continue
for j in range(10):
idx_2 = S[idx_1 + 1 :].find(str(j))
if (idx_2 == -1) or (idx_2 > N - 2):
continue
for k in range(10):
... | false | 14.285714 | [
"-import re",
"-",
"-fmt = \"[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*\""
] | false | 0.081602 | 0.034497 | 2.365495 | [
"s563035599",
"s411816707"
] |
u017415492 | p02820 | python | s425987683 | s516344157 | 84 | 74 | 4,084 | 4,084 | Accepted | Accepted | 11.9 | n,k=list(map(int,input().split()))
r,s,p=list(map(int,input().split()))
t=list(eval(input()))
ans=0
for i in range(0,n):
if t[i]=="r":
ans+=p
elif t[i]=="s":
ans+=r
elif t[i]=="p":
ans+=s
for i in range(0,n-k):
if t[i]==t[i+k]:
t[i+k]="M"
if t[i]=="r":
ans-=p
el... | n,k=list(map(int,input().split()))
r,s,p=list(map(int,input().split()))
t=list(eval(input()))
ans=0
for i in range(n):
if i<k:
if t[i]=="r":
ans+=p
elif t[i]=="s":
ans+=r
elif t[i]=="p":
ans+=s
else:
if t[i]=="r" and t[i-k]!=t[i]:
ans+=p
elif t[i]=="s" an... | 23 | 24 | 379 | 428 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = list(eval(input()))
ans = 0
for i in range(0, n):
if t[i] == "r":
ans += p
elif t[i] == "s":
ans += r
elif t[i] == "p":
ans += s
for i in range(0, n - k):
if t[i] == t[i + k]:
t[i + k] = ... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = list(eval(input()))
ans = 0
for i in range(n):
if i < k:
if t[i] == "r":
ans += p
elif t[i] == "s":
ans += r
elif t[i] == "p":
ans += s
else:
if t[i] == "r" an... | false | 4.166667 | [
"-for i in range(0, n):",
"- if t[i] == \"r\":",
"- ans += p",
"- elif t[i] == \"s\":",
"- ans += r",
"- elif t[i] == \"p\":",
"- ans += s",
"-for i in range(0, n - k):",
"- if t[i] == t[i + k]:",
"- t[i + k] = \"M\"",
"+for i in range(n):",
"+ if i <... | false | 0.036145 | 0.043734 | 0.826461 | [
"s425987683",
"s516344157"
] |
u489959379 | p02953 | python | s591660915 | s388971695 | 96 | 66 | 14,396 | 14,480 | Accepted | Accepted | 31.25 | n = int(eval(input()))
h = list(map(int, input().split()))
ans = "Yes"
for i in range(1, n):
if h[i] > h[i-1]:
h[i] -= 1
if h == sorted(h):
print("Yes")
else:
print("No")
| import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
H = list(map(int, input().split()))
for i in range(1, n):
if H[i - 1] < H[i]:
H[i] -= 1
for j in range(1, n):
if H[j - 1] > H[j]:
... | 12 | 25 | 198 | 432 | n = int(eval(input()))
h = list(map(int, input().split()))
ans = "Yes"
for i in range(1, n):
if h[i] > h[i - 1]:
h[i] -= 1
if h == sorted(h):
print("Yes")
else:
print("No")
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
H = list(map(int, input().split()))
for i in range(1, n):
if H[i - 1] < H[i]:
H[i] -= 1
for j in range(1, n):
if H[j - 1] > H[j]:
print("No")
... | false | 52 | [
"-n = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-ans = \"Yes\"",
"-for i in range(1, n):",
"- if h[i] > h[i - 1]:",
"- h[i] -= 1",
"-if h == sorted(h):",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
... | false | 0.037706 | 0.035976 | 1.04809 | [
"s591660915",
"s388971695"
] |
u222668979 | p02803 | python | s672032867 | s918789879 | 553 | 138 | 3,316 | 74,920 | Accepted | Accepted | 75.05 | from collections import deque
h, w = list(map(int, input().split()))
s = [list(str(eval(input()))) for _ in range(h)]
def bfs(h, w, s, s_h, s_w):
if s[s_h][s_w] == '#':
return 0
d_max = 0
pas = [[-1 for _ in range(w)] for _ in range(h)]
dist = [[-1 for _ in range(w)] for _ in range... | from collections import deque
def bfs(y, x):
dist = [[-1] * w for _ in range(h)]
dist[y][x] = 0
que, frag = deque([(x, y)]), set([(x, y)])
while que:
qx, qy = que.popleft()
near = [(qx - 1, qy), (qx, qy - 1), (qx + 1, qy), (qx, qy + 1)]
for i, j in near:
... | 35 | 29 | 1,062 | 774 | from collections import deque
h, w = list(map(int, input().split()))
s = [list(str(eval(input()))) for _ in range(h)]
def bfs(h, w, s, s_h, s_w):
if s[s_h][s_w] == "#":
return 0
d_max = 0
pas = [[-1 for _ in range(w)] for _ in range(h)]
dist = [[-1 for _ in range(w)] for _ in range(h)]
di... | from collections import deque
def bfs(y, x):
dist = [[-1] * w for _ in range(h)]
dist[y][x] = 0
que, frag = deque([(x, y)]), set([(x, y)])
while que:
qx, qy = que.popleft()
near = [(qx - 1, qy), (qx, qy - 1), (qx + 1, qy), (qx, qy + 1)]
for i, j in near:
if (i, j) i... | false | 17.142857 | [
"-h, w = list(map(int, input().split()))",
"-s = [list(str(eval(input()))) for _ in range(h)]",
"+",
"+def bfs(y, x):",
"+ dist = [[-1] * w for _ in range(h)]",
"+ dist[y][x] = 0",
"+ que, frag = deque([(x, y)]), set([(x, y)])",
"+ while que:",
"+ qx, qy = que.popleft()",
"+ ... | false | 0.0574 | 0.117784 | 0.487336 | [
"s672032867",
"s918789879"
] |
u285891772 | p02819 | python | s649029969 | s804520010 | 133 | 38 | 5,192 | 5,200 | Accepted | Accepted | 71.43 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | 32 | 32 | 883 | 1,020 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 0 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"-from itertools import accumulate, permutations, combinations, product",
"+from math import (",
"+ ceil,",
"+ sqrt,",
"+ hypot,",
"+ factorial,",
"+ pi,",
"+ sin,",
"+ cos,",
"+ tan,",
"+ asin,... | false | 0.252432 | 0.062157 | 4.061203 | [
"s649029969",
"s804520010"
] |
u066413086 | p02888 | python | s062836034 | s460755940 | 1,835 | 1,240 | 3,188 | 9,288 | Accepted | Accepted | 32.43 | from bisect import bisect
from bisect import bisect_right
from bisect import bisect_left
from bisect import insort
from bisect import insort_right
from bisect import insort_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
#print(L)
cnt = 0
for i in range(N):
for j in range(i+1,... | from bisect import bisect
from bisect import bisect_right
from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
#print(L)
cnt = 0
for i in range(N):
for j in range(i+1, N):
s = L[i] + L[j]
x = bisect_left(L, s)
#print((L[i], L[j]), s, x)
... | 20 | 17 | 440 | 350 | from bisect import bisect
from bisect import bisect_right
from bisect import bisect_left
from bisect import insort
from bisect import insort_right
from bisect import insort_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
# print(L)
cnt = 0
for i in range(N):
for j in range(i + 1, N):
... | from bisect import bisect
from bisect import bisect_right
from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
# print(L)
cnt = 0
for i in range(N):
for j in range(i + 1, N):
s = L[i] + L[j]
x = bisect_left(L, s)
# print((L[i], L[j]), s, x)
... | false | 15 | [
"-from bisect import insort",
"-from bisect import insort_right",
"-from bisect import insort_left"
] | false | 0.046111 | 0.078596 | 0.586689 | [
"s062836034",
"s460755940"
] |
u077291787 | p03006 | python | s770849957 | s944009754 | 24 | 20 | 3,572 | 3,444 | Accepted | Accepted | 16.67 | # div2019-2B - Picking Up
from collections import defaultdict
n = int(eval(input()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cnt = defaultdict(int)
for i in range(n):
for j in range(i + 1, n):
dif = (arr[j][0] - arr[i][0], arr[j][1] - arr[i][1])
cnt[dif] ... | n = int(eval(input()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cnt = {}
for i, j in arr:
for k, l in arr:
if (i, j) == (k, l):
continue
dif = (k - i, l - j)
cnt.setdefault(dif, 0)
cnt[dif] += 1
print((n - max(list(cnt.values())... | 11 | 11 | 359 | 320 | # div2019-2B - Picking Up
from collections import defaultdict
n = int(eval(input()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cnt = defaultdict(int)
for i in range(n):
for j in range(i + 1, n):
dif = (arr[j][0] - arr[i][0], arr[j][1] - arr[i][1])
cnt[dif] += 1
prin... | n = int(eval(input()))
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cnt = {}
for i, j in arr:
for k, l in arr:
if (i, j) == (k, l):
continue
dif = (k - i, l - j)
cnt.setdefault(dif, 0)
cnt[dif] += 1
print((n - max(list(cnt.values()), default=... | false | 0 | [
"-# div2019-2B - Picking Up",
"-from collections import defaultdict",
"-",
"-cnt = defaultdict(int)",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- dif = (arr[j][0] - arr[i][0], arr[j][1] - arr[i][1])",
"+cnt = {}",
"+for i, j in arr:",
"+ for k, l in arr:",
"+ if ... | false | 0.049816 | 0.048751 | 1.021831 | [
"s770849957",
"s944009754"
] |
u186838327 | p03361 | python | s593269986 | s734455030 | 190 | 68 | 39,664 | 66,584 | Accepted | Accepted | 64.21 | h, w = list(map(int, input().split()))
S = [str(eval(input())) for i in range(h)]
for i in range(h):
for j in range(w):
if S[i][j] == '#':
flag = False
for di,dj in (-1, 0), (1, 0), (0, 1), (0, -1):
ni, nj = i+di, j+dj
if 0 <= ni < h and 0 <=... | h, w = list(map(int, input().split()))
S = [list(str(eval(input()))) for _ in range(h)]
for i in range(h):
for j in range(w):
if S[i][j] == '#':
flag = False
for di, dj in (-1, 0), (1, 0), (0, 1), (0, -1):
ni, nj = i+di, j+dj
if 0 <= ni < h a... | 17 | 18 | 500 | 538 | h, w = list(map(int, input().split()))
S = [str(eval(input())) for i in range(h)]
for i in range(h):
for j in range(w):
if S[i][j] == "#":
flag = False
for di, dj in (-1, 0), (1, 0), (0, 1), (0, -1):
ni, nj = i + di, j + dj
if 0 <= ni < h and 0 <= nj <... | h, w = list(map(int, input().split()))
S = [list(str(eval(input()))) for _ in range(h)]
for i in range(h):
for j in range(w):
if S[i][j] == "#":
flag = False
for di, dj in (-1, 0), (1, 0), (0, 1), (0, -1):
ni, nj = i + di, j + dj
if 0 <= ni < h and 0 <... | false | 5.555556 | [
"-S = [str(eval(input())) for i in range(h)]",
"+S = [list(str(eval(input()))) for _ in range(h)]",
"+ break"
] | false | 0.036907 | 0.034171 | 1.080045 | [
"s593269986",
"s734455030"
] |
u623231048 | p03608 | python | s118015079 | s774367085 | 605 | 392 | 63,964 | 52,700 | Accepted | Accepted | 35.21 | import heapq
import itertools
import sys
input = sys.stdin.readline
def main():
n,m,r = list(map(int,input().split()))
R = list(map(int,input().split()))
for i in range(r):
R[i] -= 1
roots = [[] for _ in range(n)]
for _ in range(m):
a,b,c = list(map(int,input().spl... | import sys, itertools
input = sys.stdin.readline
def main():
# d[i][j]は2頂点間i, j間の移動コストを格納, Vは頂点数
def warshall_floyd(d, V):
for k in range(V):
for i in range(V):
for j in range(V):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d # ... | 51 | 39 | 1,145 | 937 | import heapq
import itertools
import sys
input = sys.stdin.readline
def main():
n, m, r = list(map(int, input().split()))
R = list(map(int, input().split()))
for i in range(r):
R[i] -= 1
roots = [[] for _ in range(n)]
for _ in range(m):
a, b, c = list(map(int, input().split()))
... | import sys, itertools
input = sys.stdin.readline
def main():
# d[i][j]は2頂点間i, j間の移動コストを格納, Vは頂点数
def warshall_floyd(d, V):
for k in range(V):
for i in range(V):
for j in range(V):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d # d[i][j]に頂点i... | false | 23.529412 | [
"-import heapq",
"-import itertools",
"-import sys",
"+import sys, itertools",
"+ # d[i][j]は2頂点間i, j間の移動コストを格納, Vは頂点数",
"+ def warshall_floyd(d, V):",
"+ for k in range(V):",
"+ for i in range(V):",
"+ for j in range(V):",
"+ d[i][j] = min(... | false | 0.006731 | 0.058493 | 0.115067 | [
"s118015079",
"s774367085"
] |
u594859393 | p03330 | python | s335502723 | s480620636 | 1,098 | 194 | 21,216 | 6,132 | Accepted | Accepted | 82.33 | from itertools import product
n, c = list(map(int, input().split()))
color_costs = [list(map(int, input().split())) for _ in range(c)]
matrix = [list(map(int, input().split())) for _ in range(n)]
colord = {(i+1, j+1):cost for i, row in enumerate(color_costs)
for j, cost in enumerate(row)}
... | from itertools import product
from collections import Counter
n, c = list(map(int, input().split()))
color_costs = [list(map(int, input().split())) for _ in range(c)]
matrix = [list(map(int, input().split())) for _ in range(n)]
colord = {(i, j):cost
for i, row in enumerate(color_costs)
... | 19 | 25 | 776 | 1,052 | from itertools import product
n, c = list(map(int, input().split()))
color_costs = [list(map(int, input().split())) for _ in range(c)]
matrix = [list(map(int, input().split())) for _ in range(n)]
colord = {
(i + 1, j + 1): cost
for i, row in enumerate(color_costs)
for j, cost in enumerate(row)
}
cellgroups... | from itertools import product
from collections import Counter
n, c = list(map(int, input().split()))
color_costs = [list(map(int, input().split())) for _ in range(c)]
matrix = [list(map(int, input().split())) for _ in range(n)]
colord = {
(i, j): cost for i, row in enumerate(color_costs) for j, cost in enumerate(r... | false | 24 | [
"+from collections import Counter",
"- (i + 1, j + 1): cost",
"- for i, row in enumerate(color_costs)",
"- for j, cost in enumerate(row)",
"+ (i, j): cost for i, row in enumerate(color_costs) for j, cost in enumerate(row)",
"-cellgroups = [[] for _ in range(3)]",
"-for i, row in enumerate(ma... | false | 0.036072 | 0.049609 | 0.727126 | [
"s335502723",
"s480620636"
] |
u046187684 | p03379 | python | s024396186 | s617946905 | 410 | 340 | 53,532 | 125,268 | Accepted | Accepted | 17.07 | def solve(string):
n, *x = list(map(int, string.split()))
mid = n // 2
x = [(i, _x) for i, _x in enumerate(x)]
x = sorted(x, key=lambda x: x[1])
ans = [[] for _ in range(n)]
for i, _x in enumerate(x):
ans[_x[0]] = str(x[mid][1]) if i < mid else str(x[mid - 1][1])
return "\n".... | def solve(string):
n, *x = list(map(int, string.split()))
mid = n // 2
l, r = sorted(x)[mid - 1:mid + 1]
return "\n".join([str(r) if _x < r else str(l) for _x in x])
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| 13 | 9 | 405 | 261 | def solve(string):
n, *x = list(map(int, string.split()))
mid = n // 2
x = [(i, _x) for i, _x in enumerate(x)]
x = sorted(x, key=lambda x: x[1])
ans = [[] for _ in range(n)]
for i, _x in enumerate(x):
ans[_x[0]] = str(x[mid][1]) if i < mid else str(x[mid - 1][1])
return "\n".join(ans... | def solve(string):
n, *x = list(map(int, string.split()))
mid = n // 2
l, r = sorted(x)[mid - 1 : mid + 1]
return "\n".join([str(r) if _x < r else str(l) for _x in x])
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| false | 30.769231 | [
"- x = [(i, _x) for i, _x in enumerate(x)]",
"- x = sorted(x, key=lambda x: x[1])",
"- ans = [[] for _ in range(n)]",
"- for i, _x in enumerate(x):",
"- ans[_x[0]] = str(x[mid][1]) if i < mid else str(x[mid - 1][1])",
"- return \"\\n\".join(ans)",
"+ l, r = sorted(x)[mid - 1 : m... | false | 0.112771 | 0.077735 | 1.45072 | [
"s024396186",
"s617946905"
] |
u271469978 | p03164 | python | s750955322 | s329759864 | 227 | 175 | 44,912 | 14,000 | Accepted | Accepted | 22.91 | def main():
N, W = list(map(int, input().split()))
#dp[v] vとなる最小のW
dp = [10**9+1 for _ in range(10**5+1)]
for _ in range(N):
w,v = list(map(int, input().split()))
for val in range(10**5, 1, -1):
if val - v < 1:
break
dp[val] = min(dp[val],... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.ones(10**5+1, dtype=np.int64) * np.inf
dp[0] = 0
for _ in range(N):
w,v = list(map(int, input().split()))
np.minimum(dp[v:], dp[:-v] + w , dp[v:])
print((max(np.where(dp <= W)[0]))) | 19 | 8 | 523 | 248 | def main():
N, W = list(map(int, input().split()))
# dp[v] vとなる最小のW
dp = [10**9 + 1 for _ in range(10**5 + 1)]
for _ in range(N):
w, v = list(map(int, input().split()))
for val in range(10**5, 1, -1):
if val - v < 1:
break
dp[val] = min(dp[val], dp... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.ones(10**5 + 1, dtype=np.int64) * np.inf
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
np.minimum(dp[v:], dp[:-v] + w, dp[v:])
print((max(np.where(dp <= W)[0])))
| false | 57.894737 | [
"-def main():",
"- N, W = list(map(int, input().split()))",
"- # dp[v] vとなる最小のW",
"- dp = [10**9 + 1 for _ in range(10**5 + 1)]",
"- for _ in range(N):",
"- w, v = list(map(int, input().split()))",
"- for val in range(10**5, 1, -1):",
"- if val - v < 1:",
"- ... | false | 0.390024 | 0.35831 | 1.088511 | [
"s750955322",
"s329759864"
] |
u197300773 | p03488 | python | s981892435 | s846020252 | 1,391 | 920 | 3,936 | 3,952 | Accepted | Accepted | 33.86 | def cul(x,X):
dic={0:1}
for i in range(len(x)):
tmp={}
for j in dic:
tmp[j+x[i]]=1
tmp[j-x[i]]=1
dic=tmp
if X in dic: return True
else: return False
S=eval(input())
s=list(S.split("T"))
X,Y=list(map(int,input().split()))
x,y=[len(i) for i in... | import sys
import math
from itertools import accumulate as acc
def cul(x,X):
dic={0:1}
for i in range(len(x)):
tmp={}
for j in dic:
tmp[j+x[i]]=1
tmp[j-x[i]]=1
dic=tmp
if X in dic: return True
else: return False
S=eval(input())
s=list(S.s... | 22 | 24 | 494 | 507 | def cul(x, X):
dic = {0: 1}
for i in range(len(x)):
tmp = {}
for j in dic:
tmp[j + x[i]] = 1
tmp[j - x[i]] = 1
dic = tmp
if X in dic:
return True
else:
return False
S = eval(input())
s = list(S.split("T"))
X, Y = list(map(int, input().spl... | import sys
import math
from itertools import accumulate as acc
def cul(x, X):
dic = {0: 1}
for i in range(len(x)):
tmp = {}
for j in dic:
tmp[j + x[i]] = 1
tmp[j - x[i]] = 1
dic = tmp
if X in dic:
return True
else:
return False
S = eval... | false | 8.333333 | [
"+import sys",
"+import math",
"+from itertools import accumulate as acc",
"+",
"+",
"-dx = sorted(x, reverse=True)",
"-dy = sorted(y, reverse=True)",
"-print((\"Yes\" if cul(dx, X) and cul(dy, Y) else \"No\"))",
"+print((\"Yes\" if cul(x, X) and cul(y, Y) else \"No\"))"
] | false | 0.053634 | 0.037405 | 1.433857 | [
"s981892435",
"s846020252"
] |
u418197217 | p02597 | python | s727233817 | s869072449 | 43 | 27 | 12,068 | 9,308 | Accepted | Accepted | 37.21 | n = int(eval(input()))
ls = list(eval(input()))
r = ls.count('R')
w = ls.count('W')
if r == 0 or w == 0:
print((0))
else:
r_in_half = ls[:r].count('R')
ans = r - r_in_half
print(ans)
| import sys
input = sys.stdin.readline
n = eval(input())
s = eval(input())
r = s.count('R')
print((s[:r].count('W')))
| 10 | 8 | 194 | 112 | n = int(eval(input()))
ls = list(eval(input()))
r = ls.count("R")
w = ls.count("W")
if r == 0 or w == 0:
print((0))
else:
r_in_half = ls[:r].count("R")
ans = r - r_in_half
print(ans)
| import sys
input = sys.stdin.readline
n = eval(input())
s = eval(input())
r = s.count("R")
print((s[:r].count("W")))
| false | 20 | [
"-n = int(eval(input()))",
"-ls = list(eval(input()))",
"-r = ls.count(\"R\")",
"-w = ls.count(\"W\")",
"-if r == 0 or w == 0:",
"- print((0))",
"-else:",
"- r_in_half = ls[:r].count(\"R\")",
"- ans = r - r_in_half",
"- print(ans)",
"+import sys",
"+",
"+input = sys.stdin.readlin... | false | 0.045944 | 0.083335 | 0.551315 | [
"s727233817",
"s869072449"
] |
u241159583 | p03607 | python | s216595331 | s297496909 | 171 | 155 | 20,568 | 23,880 | Accepted | Accepted | 9.36 | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
p = {}
for a in A:
if a in p:
if p[a] == 1:
p[a] = 0
continue
p[a] = 1
ans = 0
for i in list(p.values()):ans += i
print(ans) | from collections import Counter
n = int(eval(input()))
a = Counter([eval(input()) for _ in range(n)])
ans = 0
for x in list(a.values()):
if x%2!=0: ans += 1
print(ans) | 13 | 7 | 225 | 159 | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
p = {}
for a in A:
if a in p:
if p[a] == 1:
p[a] = 0
continue
p[a] = 1
ans = 0
for i in list(p.values()):
ans += i
print(ans)
| from collections import Counter
n = int(eval(input()))
a = Counter([eval(input()) for _ in range(n)])
ans = 0
for x in list(a.values()):
if x % 2 != 0:
ans += 1
print(ans)
| false | 46.153846 | [
"+from collections import Counter",
"+",
"-A = [int(eval(input())) for _ in range(n)]",
"-p = {}",
"-for a in A:",
"- if a in p:",
"- if p[a] == 1:",
"- p[a] = 0",
"- continue",
"- p[a] = 1",
"+a = Counter([eval(input()) for _ in range(n)])",
"-for i in list(... | false | 0.035663 | 0.040194 | 0.887266 | [
"s216595331",
"s297496909"
] |
u794173881 | p03040 | python | s964279465 | s328050289 | 1,790 | 1,311 | 124,752 | 109,528 | Accepted | Accepted | 26.76 | # Binary Indexed Tree (Fenwick Tree)
class BIT():
def __init__(self, n):
'''
n = 要素数
添字は i = 0 ~ n-1 となる
'''
self.n = n
self.bit = [0] * (n + 1)
def add(self, i, x):
'''i番目の要素にxを加算する'''
i = i + 1
while i <= self.n:
... | import heapq
class DynamicMedian():
"""値をO(logN)で追加し、中央値クエリにO(1)で応える
add(val): valを追加する
median_low(): 小さい方の中央値(low median)を返す
median_high(): 大きい方の中央値(high median)を返す
"""
def __init__(self):
self.left_q = [] # 小さい値を降順で格納する
self.right_q = [] # 大きい値を昇順で格納する
... | 85 | 59 | 2,013 | 1,700 | # Binary Indexed Tree (Fenwick Tree)
class BIT:
def __init__(self, n):
"""
n = 要素数
添字は i = 0 ~ n-1 となる
"""
self.n = n
self.bit = [0] * (n + 1)
def add(self, i, x):
"""i番目の要素にxを加算する"""
i = i + 1
while i <= self.n:
self.bit[i] +=... | import heapq
class DynamicMedian:
"""値をO(logN)で追加し、中央値クエリにO(1)で応える
add(val): valを追加する
median_low(): 小さい方の中央値(low median)を返す
median_high(): 大きい方の中央値(high median)を返す
"""
def __init__(self):
self.left_q = [] # 小さい値を降順で格納する
self.right_q = [] # 大きい値を昇順で格納する
self.left_sum ... | false | 30.588235 | [
"-# Binary Indexed Tree (Fenwick Tree)",
"-class BIT:",
"- def __init__(self, n):",
"- \"\"\"",
"- n = 要素数",
"- 添字は i = 0 ~ n-1 となる",
"- \"\"\"",
"- self.n = n",
"- self.bit = [0] * (n + 1)",
"-",
"- def add(self, i, x):",
"- \"\"\"i番目の要素に... | false | 0.076308 | 0.039059 | 1.953656 | [
"s964279465",
"s328050289"
] |
u408260374 | p02373 | python | s782555454 | s426917104 | 2,750 | 2,320 | 74,212 | 41,016 | Accepted | Accepted | 15.64 | class Edge:
def __init__(self, dst, weight):
self.dst, self.weight = dst, weight
def __lt__(self, e):
return self.weight > e.weight
class Graph:
def __init__(self, V):
self.V = V
self.E = [[] for _ in range(V)]
def add_edge(self, src, dst, weight):
... | class HeavyLightDecomposition:
def __init__(self, g, root=0):
self.g = g
self.vid, self.head, self.heavy, self.parent = [0] * len(g), [-1] * len(g), [-1] * len(g), [-1] * len(g)
self.dfs(root)
self.bfs(root)
def dfs(self, root):
stack = [(root, -1)]
sub,... | 76 | 59 | 2,276 | 1,911 | class Edge:
def __init__(self, dst, weight):
self.dst, self.weight = dst, weight
def __lt__(self, e):
return self.weight > e.weight
class Graph:
def __init__(self, V):
self.V = V
self.E = [[] for _ in range(V)]
def add_edge(self, src, dst, weight):
self.E[src]... | class HeavyLightDecomposition:
def __init__(self, g, root=0):
self.g = g
self.vid, self.head, self.heavy, self.parent = (
[0] * len(g),
[-1] * len(g),
[-1] * len(g),
[-1] * len(g),
)
self.dfs(root)
self.bfs(root)
def dfs(se... | false | 22.368421 | [
"-class Edge:",
"- def __init__(self, dst, weight):",
"- self.dst, self.weight = dst, weight",
"-",
"- def __lt__(self, e):",
"- return self.weight > e.weight",
"-",
"-",
"-class Graph:",
"- def __init__(self, V):",
"- self.V = V",
"- self.E = [[] for _ in ... | false | 0.036043 | 0.086226 | 0.418007 | [
"s782555454",
"s426917104"
] |
u152331265 | p02720 | python | s741423279 | s691469963 | 98 | 69 | 15,768 | 7,200 | Accepted | Accepted | 29.59 | k = int(eval(input()))
lunlun = list(range(1, 10))
for i in range(k - 1):
a = lunlun[i]
b = a * 10 + a % 10
if a % 10 != 0:
lunlun.append(b - 1)
lunlun.append(b)
if a % 10 != 9:
lunlun.append(b + 1)
print((lunlun[k - 1])) | k = int(eval(input()))
li = [i + 1 for i in range(9)]
c = 0
while len(li) < k:
if li[c] % 10 != 0:
li.append(li[c] * 10 + li[c] % 10 - 1)
li.append(li[c] * 10 + li[c] % 10)
if li[c] % 10 != 9:
li.append(li[c] * 10 + li[c] % 10 + 1)
c += 1
print((li[k - 1])) | 12 | 12 | 261 | 293 | k = int(eval(input()))
lunlun = list(range(1, 10))
for i in range(k - 1):
a = lunlun[i]
b = a * 10 + a % 10
if a % 10 != 0:
lunlun.append(b - 1)
lunlun.append(b)
if a % 10 != 9:
lunlun.append(b + 1)
print((lunlun[k - 1]))
| k = int(eval(input()))
li = [i + 1 for i in range(9)]
c = 0
while len(li) < k:
if li[c] % 10 != 0:
li.append(li[c] * 10 + li[c] % 10 - 1)
li.append(li[c] * 10 + li[c] % 10)
if li[c] % 10 != 9:
li.append(li[c] * 10 + li[c] % 10 + 1)
c += 1
print((li[k - 1]))
| false | 0 | [
"-lunlun = list(range(1, 10))",
"-for i in range(k - 1):",
"- a = lunlun[i]",
"- b = a * 10 + a % 10",
"- if a % 10 != 0:",
"- lunlun.append(b - 1)",
"- lunlun.append(b)",
"- if a % 10 != 9:",
"- lunlun.append(b + 1)",
"-print((lunlun[k - 1]))",
"+li = [i + 1 for i i... | false | 0.057218 | 0.06891 | 0.83033 | [
"s741423279",
"s691469963"
] |
u017435045 | p02263 | python | s651574210 | s244079996 | 30 | 20 | 6,004 | 5,608 | Accepted | Accepted | 33.33 | from collections import deque as D
line, stack = D(input().split()), D()
while line:
hoge = line.popleft()
if hoge.isdigit():
stack.append(hoge)
else:
a, b = int(stack.pop()),int(stack.pop())
if hoge =="*":
stack.append(a*b)
elif hoge == "+":
... | s = list(input().split())
a = []
for x in s:
if x in ['+', '-', '*']:
c, b = str(a.pop()), str(a.pop())
b+= x+c
a+=[int(eval(b))]
else:
a+= [int(x)]
print((a.pop()))
| 17 | 13 | 469 | 237 | from collections import deque as D
line, stack = D(input().split()), D()
while line:
hoge = line.popleft()
if hoge.isdigit():
stack.append(hoge)
else:
a, b = int(stack.pop()), int(stack.pop())
if hoge == "*":
stack.append(a * b)
elif hoge == "+":
stac... | s = list(input().split())
a = []
for x in s:
if x in ["+", "-", "*"]:
c, b = str(a.pop()), str(a.pop())
b += x + c
a += [int(eval(b))]
else:
a += [int(x)]
print((a.pop()))
| false | 23.529412 | [
"-from collections import deque as D",
"-",
"-line, stack = D(input().split()), D()",
"-while line:",
"- hoge = line.popleft()",
"- if hoge.isdigit():",
"- stack.append(hoge)",
"+s = list(input().split())",
"+a = []",
"+for x in s:",
"+ if x in [\"+\", \"-\", \"*\"]:",
"+ ... | false | 0.052269 | 0.050184 | 1.04156 | [
"s651574210",
"s244079996"
] |
u835482198 | p03951 | python | s904810811 | s726190272 | 22 | 17 | 3,064 | 3,060 | Accepted | Accepted | 22.73 | N = int(eval(input()))
s = eval(input())
t = eval(input())
ans = 2 * N
for i in range(1, N+1):
# print(s[-i:], t[:i])
if s[-i:] == t[:i]:
ans = min(ans, 2 * N - i)
print(ans)
| N = int(eval(input()))
prefix = eval(input())
suffix = eval(input())
if len(prefix) + len(suffix) < N:
d = N - len(prefix) + len(suffix)
print((len(prefix + 'a' * d + suffix)))
else:
s = ""
for i in range(1, N):
# print(prefix[-i:], suffix[:i])
if prefix[-i:] == suffix[:i]:... | 10 | 20 | 183 | 456 | N = int(eval(input()))
s = eval(input())
t = eval(input())
ans = 2 * N
for i in range(1, N + 1):
# print(s[-i:], t[:i])
if s[-i:] == t[:i]:
ans = min(ans, 2 * N - i)
print(ans)
| N = int(eval(input()))
prefix = eval(input())
suffix = eval(input())
if len(prefix) + len(suffix) < N:
d = N - len(prefix) + len(suffix)
print((len(prefix + "a" * d + suffix)))
else:
s = ""
for i in range(1, N):
# print(prefix[-i:], suffix[:i])
if prefix[-i:] == suffix[:i]:
s... | false | 50 | [
"-s = eval(input())",
"-t = eval(input())",
"-ans = 2 * N",
"-for i in range(1, N + 1):",
"- # print(s[-i:], t[:i])",
"- if s[-i:] == t[:i]:",
"- ans = min(ans, 2 * N - i)",
"-print(ans)",
"+prefix = eval(input())",
"+suffix = eval(input())",
"+if len(prefix) + len(suffix) < N:",
... | false | 0.036263 | 0.036879 | 0.983312 | [
"s904810811",
"s726190272"
] |
u997641430 | p03161 | python | s266175269 | s198554348 | 423 | 367 | 61,024 | 61,024 | Accepted | Accepted | 13.24 | n, k = list(map(int, input().split()))
*H, = list(map(int, input().split()))
X = [0]
for i in range(1, n):
x = 1 << 30
for j in range(1, k+1):
if i-j >= 0:
x = min(x, X[i-j]+abs(H[i]-H[i-j]))
X.append(x)
print((X[n-1]))
| n, k = list(map(int, input().split()))
*H, = list(map(int, input().split()))
X = [0]
for i in range(1, n):
x = 1 << 30
for j in range(1, min(i, k)+1):
x = min(x, X[i-j]+abs(H[i]-H[i-j]))
X.append(x)
print((X[n-1]))
| 10 | 9 | 247 | 229 | n, k = list(map(int, input().split()))
(*H,) = list(map(int, input().split()))
X = [0]
for i in range(1, n):
x = 1 << 30
for j in range(1, k + 1):
if i - j >= 0:
x = min(x, X[i - j] + abs(H[i] - H[i - j]))
X.append(x)
print((X[n - 1]))
| n, k = list(map(int, input().split()))
(*H,) = list(map(int, input().split()))
X = [0]
for i in range(1, n):
x = 1 << 30
for j in range(1, min(i, k) + 1):
x = min(x, X[i - j] + abs(H[i] - H[i - j]))
X.append(x)
print((X[n - 1]))
| false | 10 | [
"- for j in range(1, k + 1):",
"- if i - j >= 0:",
"- x = min(x, X[i - j] + abs(H[i] - H[i - j]))",
"+ for j in range(1, min(i, k) + 1):",
"+ x = min(x, X[i - j] + abs(H[i] - H[i - j]))"
] | false | 0.036302 | 0.031287 | 1.160311 | [
"s266175269",
"s198554348"
] |
u340781749 | p03357 | python | s400916093 | s704901984 | 1,530 | 991 | 167,812 | 165,124 | Accepted | Accepted | 35.23 | from itertools import accumulate
def solve(n, rev):
def existence_right(rev_c):
n2 = n * 2
acc = [[0] * n2]
row = [0] * n2
for x in rev_c:
row[n2 - x - 1] += 1
acc.append(list(reversed(list(accumulate(row)))))
return acc
# How many ... | from itertools import accumulate
def solve(n, rev):
def existence_right(rev_c):
n2 = n * 2
acc = [[0] * n2]
row = [0] * n2
for x in rev_c:
row[n2 - x - 1] += 1
acc.append(list(reversed(list(accumulate(row)))))
return acc
# How many ... | 36 | 37 | 1,104 | 1,117 | from itertools import accumulate
def solve(n, rev):
def existence_right(rev_c):
n2 = n * 2
acc = [[0] * n2]
row = [0] * n2
for x in rev_c:
row[n2 - x - 1] += 1
acc.append(list(reversed(list(accumulate(row)))))
return acc
# How many white/black b... | from itertools import accumulate
def solve(n, rev):
def existence_right(rev_c):
n2 = n * 2
acc = [[0] * n2]
row = [0] * n2
for x in rev_c:
row[n2 - x - 1] += 1
acc.append(list(reversed(list(accumulate(row)))))
return acc
# How many white/black b... | false | 2.702703 | [
"- cost = list(map(existence_right, rev))",
"- dp = [0] + list(accumulate(c[y] for y, c in zip(rev[1], cost[1])))",
"- for x, cw0, cw1 in zip(rev[0], cost[0], cost[0][1:]):",
"+ cost_w, cost_b = list(map(existence_right, rev))",
"+ dp = [0] + list(accumulate(c[y] for y, c in zip(rev[1], cost_... | false | 0.071513 | 0.069234 | 1.032916 | [
"s400916093",
"s704901984"
] |
u488127128 | p03401 | python | s820122203 | s939435428 | 227 | 176 | 14,172 | 14,176 | Accepted | Accepted | 22.47 | N = int(eval(input()))
A = list(map(int, input().split()))
total = 0
p = 0
for a in A:
total += abs(p-a)
p = a
total += abs(p)
print((total - abs(A[0]) - abs(A[0]-A[1]) + abs(A[1])))
for n in range(1,N-1):
print((total - abs(A[n-1]-A[n]) - abs(A[n]-A[n+1]) + abs(A[n-1]-A[n+1])))
print((total - ... | def solve():
N = int(eval(input()))
A = list(map(int, input().split()))
total = 0
p = 0
for a in A:
total += abs(p-a)
p = a
total += abs(p)
print((total - abs(A[0]) - abs(A[0]-A[1]) + abs(A[1])))
for n in range(1,N-1):
print((total - abs(A[n-1]-A[... | 13 | 18 | 356 | 467 | N = int(eval(input()))
A = list(map(int, input().split()))
total = 0
p = 0
for a in A:
total += abs(p - a)
p = a
total += abs(p)
print((total - abs(A[0]) - abs(A[0] - A[1]) + abs(A[1])))
for n in range(1, N - 1):
print(
(total - abs(A[n - 1] - A[n]) - abs(A[n] - A[n + 1]) + abs(A[n - 1] - A[n + 1]))... | def solve():
N = int(eval(input()))
A = list(map(int, input().split()))
total = 0
p = 0
for a in A:
total += abs(p - a)
p = a
total += abs(p)
print((total - abs(A[0]) - abs(A[0] - A[1]) + abs(A[1])))
for n in range(1, N - 1):
print(
(
t... | false | 27.777778 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-total = 0",
"-p = 0",
"-for a in A:",
"- total += abs(p - a)",
"- p = a",
"-total += abs(p)",
"-print((total - abs(A[0]) - abs(A[0] - A[1]) + abs(A[1])))",
"-for n in range(1, N - 1):",
"- print(",
"- (total -... | false | 0.048709 | 0.04812 | 1.012232 | [
"s820122203",
"s939435428"
] |
u597374218 | p02743 | python | s043461483 | s842847563 | 36 | 30 | 9,936 | 8,996 | Accepted | Accepted | 16.67 | from decimal import Decimal
a,b,c=list(map(int,input().split()))
print(("Yes" if Decimal(a).sqrt()+Decimal(b).sqrt()<Decimal(c).sqrt() else "No")) | a,b,c=list(map(int,input().split()))
print(("Yes" if c-a-b>0 and 4*a*b<(c-a-b)**2 else "No")) | 3 | 2 | 140 | 86 | from decimal import Decimal
a, b, c = list(map(int, input().split()))
print(("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No"))
| a, b, c = list(map(int, input().split()))
print(("Yes" if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2 else "No"))
| false | 33.333333 | [
"-from decimal import Decimal",
"-",
"-print((\"Yes\" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else \"No\"))",
"+print((\"Yes\" if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2 else \"No\"))"
] | false | 0.046067 | 0.035689 | 1.290781 | [
"s043461483",
"s842847563"
] |
u591016708 | p02983 | python | s197898200 | s266071795 | 1,569 | 98 | 2,940 | 3,060 | Accepted | Accepted | 93.75 | L, R = list(map(int, input().split()))
ans = 2018
for x in range(L, min(R, L+2019)):
for y in range(L+1, min(R+1, L+2019)):
ans = min(ans, (x*y)%2019)
print(ans)
| L, R = list(map(int, input().split()))
ans = 2018
for x in range(L, min(R, L+2019)):
for y in range(L+1, min(R+1, L+2019)):
ans = min(ans, (x*y)%2019)
if ans == 0:
print((0))
quit()
print(ans) | 6 | 9 | 173 | 236 | L, R = list(map(int, input().split()))
ans = 2018
for x in range(L, min(R, L + 2019)):
for y in range(L + 1, min(R + 1, L + 2019)):
ans = min(ans, (x * y) % 2019)
print(ans)
| L, R = list(map(int, input().split()))
ans = 2018
for x in range(L, min(R, L + 2019)):
for y in range(L + 1, min(R + 1, L + 2019)):
ans = min(ans, (x * y) % 2019)
if ans == 0:
print((0))
quit()
print(ans)
| false | 33.333333 | [
"+ if ans == 0:",
"+ print((0))",
"+ quit()"
] | false | 0.11715 | 0.036434 | 3.215391 | [
"s197898200",
"s266071795"
] |
u296518383 | p03448 | python | s480693259 | s718064967 | 49 | 37 | 3,060 | 3,060 | Accepted | Accepted | 24.49 | A, B, C, X = int(eval(input())), int(eval(input())), int(eval(input())), int(eval(input()))
answer = 0
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
if a * 500 + b * 100 + c * 50 == X:
answer += 1
print(answer) | A, B, C, X = int(eval(input())), int(eval(input())), int(eval(input())), int(eval(input()))
X //= 50
answer = 0
for a in range(A + 1):
if a * 10 > X:
continue
for b in range(B + 1):
for c in range(C + 1):
if a * 10 + b * 2 + c == X:
answer += 1
print(answer) | 10 | 13 | 240 | 274 | A, B, C, X = (
int(eval(input())),
int(eval(input())),
int(eval(input())),
int(eval(input())),
)
answer = 0
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
if a * 500 + b * 100 + c * 50 == X:
answer += 1
print(answer)
| A, B, C, X = (
int(eval(input())),
int(eval(input())),
int(eval(input())),
int(eval(input())),
)
X //= 50
answer = 0
for a in range(A + 1):
if a * 10 > X:
continue
for b in range(B + 1):
for c in range(C + 1):
if a * 10 + b * 2 + c == X:
answer += 1
pr... | false | 23.076923 | [
"+X //= 50",
"+ if a * 10 > X:",
"+ continue",
"- if a * 500 + b * 100 + c * 50 == X:",
"+ if a * 10 + b * 2 + c == X:"
] | false | 0.095459 | 0.057126 | 1.671037 | [
"s480693259",
"s718064967"
] |
u644907318 | p03545 | python | s459275004 | s446163129 | 172 | 68 | 38,384 | 61,888 | Accepted | Accepted | 60.47 | from itertools import product
A,B,C,D =list(eval(input()))
for z in product(("+","-"),repeat=3):
if eval(A+z[0]+B+z[1]+C+z[2]+D)==7:
print((A+z[0]+B+z[1]+C+z[2]+D+"=7"))
break | from itertools import product
A,B,C,D = list(input().strip())
for x in product(("+","-"),repeat=3):
if eval(A+x[0]+B+x[1]+C+x[2]+D)==7:
print((A+x[0]+B+x[1]+C+x[2]+D+"=7"))
break | 6 | 6 | 192 | 201 | from itertools import product
A, B, C, D = list(eval(input()))
for z in product(("+", "-"), repeat=3):
if eval(A + z[0] + B + z[1] + C + z[2] + D) == 7:
print((A + z[0] + B + z[1] + C + z[2] + D + "=7"))
break
| from itertools import product
A, B, C, D = list(input().strip())
for x in product(("+", "-"), repeat=3):
if eval(A + x[0] + B + x[1] + C + x[2] + D) == 7:
print((A + x[0] + B + x[1] + C + x[2] + D + "=7"))
break
| false | 0 | [
"-A, B, C, D = list(eval(input()))",
"-for z in product((\"+\", \"-\"), repeat=3):",
"- if eval(A + z[0] + B + z[1] + C + z[2] + D) == 7:",
"- print((A + z[0] + B + z[1] + C + z[2] + D + \"=7\"))",
"+A, B, C, D = list(input().strip())",
"+for x in product((\"+\", \"-\"), repeat=3):",
"+ if ... | false | 0.037718 | 0.042837 | 0.880504 | [
"s459275004",
"s446163129"
] |
u927534107 | p03339 | python | s787174754 | s940332099 | 230 | 168 | 20,556 | 15,520 | Accepted | Accepted | 26.96 | n=int(eval(input()))
s=list(eval(input()))
n_W,n_E=0,0
l_W,l_E=[0],[0]
for i in s:
if i=="W":n_W+=1
else:n_E+=1
l_W.append(n_W)
l_E.append(n_E)
ans=10**9+7
for i in range(n):
tmp=l_W[i]+l_E[-1]-l_E[i+1]
if tmp<ans:ans=tmp
print(ans) | n = int(eval(input()))
s = str(eval(input()))
lst_ans=[]
num_e= s.count("E")
ans = num_e
for i in range(n):
if s[i] == "E":ans -= 1
if i != 0:
if s[i-1]=="W":ans += 1
lst_ans.append(ans)
print((min(lst_ans))) | 14 | 12 | 257 | 226 | n = int(eval(input()))
s = list(eval(input()))
n_W, n_E = 0, 0
l_W, l_E = [0], [0]
for i in s:
if i == "W":
n_W += 1
else:
n_E += 1
l_W.append(n_W)
l_E.append(n_E)
ans = 10**9 + 7
for i in range(n):
tmp = l_W[i] + l_E[-1] - l_E[i + 1]
if tmp < ans:
ans = tmp
print(ans)
| n = int(eval(input()))
s = str(eval(input()))
lst_ans = []
num_e = s.count("E")
ans = num_e
for i in range(n):
if s[i] == "E":
ans -= 1
if i != 0:
if s[i - 1] == "W":
ans += 1
lst_ans.append(ans)
print((min(lst_ans)))
| false | 14.285714 | [
"-s = list(eval(input()))",
"-n_W, n_E = 0, 0",
"-l_W, l_E = [0], [0]",
"-for i in s:",
"- if i == \"W\":",
"- n_W += 1",
"- else:",
"- n_E += 1",
"- l_W.append(n_W)",
"- l_E.append(n_E)",
"-ans = 10**9 + 7",
"+s = str(eval(input()))",
"+lst_ans = []",
"+num_e = s... | false | 0.141743 | 0.037903 | 3.739596 | [
"s787174754",
"s940332099"
] |
u127499732 | p03435 | python | s247200265 | s753774868 | 148 | 18 | 12,424 | 3,060 | Accepted | Accepted | 87.84 | def main():
import numpy as np
c = [list(map(int, input().split())) for _ in range(3)]
f = [[x[0] - x[1], x[1] - x[2], x[2] - x[0]] for x in c]
g = f[0] == f[1] == f[2]
print(('Yes' if g else 'No'))
if __name__ == '__main__':
main()
| def main():
c = [list(map(int, input().split())) for _ in range(3)]
f = [[x[0] - x[1], x[1] - x[2], x[2] - x[0]] for x in c]
g = f[0] == f[1] == f[2]
print(('Yes' if g else 'No'))
if __name__ == '__main__':
main()
| 10 | 9 | 266 | 242 | def main():
import numpy as np
c = [list(map(int, input().split())) for _ in range(3)]
f = [[x[0] - x[1], x[1] - x[2], x[2] - x[0]] for x in c]
g = f[0] == f[1] == f[2]
print(("Yes" if g else "No"))
if __name__ == "__main__":
main()
| def main():
c = [list(map(int, input().split())) for _ in range(3)]
f = [[x[0] - x[1], x[1] - x[2], x[2] - x[0]] for x in c]
g = f[0] == f[1] == f[2]
print(("Yes" if g else "No"))
if __name__ == "__main__":
main()
| false | 10 | [
"- import numpy as np",
"-"
] | false | 0.064536 | 0.036443 | 1.770866 | [
"s247200265",
"s753774868"
] |
u472065247 | p02878 | python | s666170527 | s897929566 | 2,543 | 1,843 | 192,136 | 190,616 | Accepted | Accepted | 27.53 | N,A,B=list(map(int,input().split()));M=998244353;P=N+1;f=1;F=[1]*P;I=[1]*P;z=0;R=range
for n in R(1,P):F[n]=f=f*n%M
I[N]=i=pow(f,M-2,M)
for n in R(N,1,-1):I[n-1]=i=i*n%M
for k in R(min(A+1,N-B)if N-B-A else A+1):Q=N-B-k-1;z=(z+(B-k)*F[B+k-1]*I[B]*I[k]*F[Q+A-k]*I[Q]*I[A-k])%M
print((z if B else 1)) | N,A,B=list(map(int,input().split()));M=998244353;P=N+1;f=1;F=[1]*P;I=[1]*P;z=0;R=range
for n in R(1,P):F[n]=f=f*n%M
I[N]=i=pow(f,M-2,M)
for n in R(N,1,-1):I[n-1]=i=i*n%M
for k in R(min(A+1,N-B)if N-B-A else A+1):Q=N-B-k-1;z+=(B-k)*F[B+k-1]*I[B]*I[k]*F[Q+A-k]*I[Q]*I[A-k]
print((z%M if B else 1)) | 6 | 6 | 295 | 292 | N, A, B = list(map(int, input().split()))
M = 998244353
P = N + 1
f = 1
F = [1] * P
I = [1] * P
z = 0
R = range
for n in R(1, P):
F[n] = f = f * n % M
I[N] = i = pow(f, M - 2, M)
for n in R(N, 1, -1):
I[n - 1] = i = i * n % M
for k in R(min(A + 1, N - B) if N - B - A else A + 1):
Q = N - B - k - 1
z = (... | N, A, B = list(map(int, input().split()))
M = 998244353
P = N + 1
f = 1
F = [1] * P
I = [1] * P
z = 0
R = range
for n in R(1, P):
F[n] = f = f * n % M
I[N] = i = pow(f, M - 2, M)
for n in R(N, 1, -1):
I[n - 1] = i = i * n % M
for k in R(min(A + 1, N - B) if N - B - A else A + 1):
Q = N - B - k - 1
z += ... | false | 0 | [
"- z = (z + (B - k) * F[B + k - 1] * I[B] * I[k] * F[Q + A - k] * I[Q] * I[A - k]) % M",
"-print((z if B else 1))",
"+ z += (B - k) * F[B + k - 1] * I[B] * I[k] * F[Q + A - k] * I[Q] * I[A - k]",
"+print((z % M if B else 1))"
] | false | 0.60445 | 0.495188 | 1.220647 | [
"s666170527",
"s897929566"
] |
u652081898 | p03284 | python | s488928401 | s462388268 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | N, K = list(map(int, input().split() ))
if N%K == 0:
print((0))
else:
print((1)) | n, k = list(map(int, input().split()))
if n%k == 0:
print("0")
else:
print("1") | 5 | 6 | 78 | 87 | N, K = list(map(int, input().split()))
if N % K == 0:
print((0))
else:
print((1))
| n, k = list(map(int, input().split()))
if n % k == 0:
print("0")
else:
print("1")
| false | 16.666667 | [
"-N, K = list(map(int, input().split()))",
"-if N % K == 0:",
"- print((0))",
"+n, k = list(map(int, input().split()))",
"+if n % k == 0:",
"+ print(\"0\")",
"- print((1))",
"+ print(\"1\")"
] | false | 0.041831 | 0.03959 | 1.056614 | [
"s488928401",
"s462388268"
] |
u009961299 | p02392 | python | s222617454 | s196368170 | 30 | 20 | 6,720 | 5,600 | Accepted | Accepted | 33.33 | [ a, b, c ] = list(map ( int, input ( ).split ( ) ));
if a < b < c:
print ( "Yes" )
else:
print ( "No" ) | x = input().split()
a, b, c = int(x[0]), int(x[1]), int(x[2])
if a < b < c:
print("Yes")
else:
print("No")
| 6 | 8 | 108 | 124 | [a, b, c] = list(map(int, input().split()))
if a < b < c:
print("Yes")
else:
print("No")
| x = input().split()
a, b, c = int(x[0]), int(x[1]), int(x[2])
if a < b < c:
print("Yes")
else:
print("No")
| false | 25 | [
"-[a, b, c] = list(map(int, input().split()))",
"+x = input().split()",
"+a, b, c = int(x[0]), int(x[1]), int(x[2])"
] | false | 0.039093 | 0.038159 | 1.024481 | [
"s222617454",
"s196368170"
] |
u729133443 | p02691 | python | s990321197 | s795233306 | 184 | 124 | 142,024 | 98,856 | Accepted | Accepted | 32.61 | from collections import*
n,*a=list(map(int,open(0).read().split()))
s=0
d=defaultdict(int)
for i,a in enumerate(a):
s+=d[i-a]
d[i+a]+=1
print(s) | n,*a=list(map(int,open(0).read().split()))
i=s=0
d=[0]*n
for a in a:
if i>=a:s+=d[i-a]
if i+a<n:d[i+a]+=1
i+=1
print(s) | 8 | 8 | 149 | 126 | from collections import *
n, *a = list(map(int, open(0).read().split()))
s = 0
d = defaultdict(int)
for i, a in enumerate(a):
s += d[i - a]
d[i + a] += 1
print(s)
| n, *a = list(map(int, open(0).read().split()))
i = s = 0
d = [0] * n
for a in a:
if i >= a:
s += d[i - a]
if i + a < n:
d[i + a] += 1
i += 1
print(s)
| false | 0 | [
"-from collections import *",
"-",
"-s = 0",
"-d = defaultdict(int)",
"-for i, a in enumerate(a):",
"- s += d[i - a]",
"- d[i + a] += 1",
"+i = s = 0",
"+d = [0] * n",
"+for a in a:",
"+ if i >= a:",
"+ s += d[i - a]",
"+ if i + a < n:",
"+ d[i + a] += 1",
"+ ... | false | 0.061167 | 0.07718 | 0.792519 | [
"s990321197",
"s795233306"
] |
u298297089 | p03737 | python | s319804129 | s830806771 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a,b,c = input().split()
ans = a[0]+b[0]+c[0]
print((ans.upper())) | a,b,c = input().split()
print(((a[0] + b[0] + c[0]).upper()))
| 3 | 2 | 65 | 61 | a, b, c = input().split()
ans = a[0] + b[0] + c[0]
print((ans.upper()))
| a, b, c = input().split()
print(((a[0] + b[0] + c[0]).upper()))
| false | 33.333333 | [
"-ans = a[0] + b[0] + c[0]",
"-print((ans.upper()))",
"+print(((a[0] + b[0] + c[0]).upper()))"
] | false | 0.038369 | 0.038126 | 1.006385 | [
"s319804129",
"s830806771"
] |
u634046173 | p02843 | python | s835279631 | s118100115 | 163 | 28 | 9,084 | 9,140 | Accepted | Accepted | 82.82 | N=int(eval(input()))
b=0
for x in range(1,N//100+1):
for y in range(100*x,105*x+1):
if N==y:
print((1))
exit()
print((0)) | N=int(eval(input()))
b=0
x = N //100
for y in range(100*x,105*x+1):
if N==y:
print((1))
exit()
print((0))
| 8 | 8 | 136 | 113 | N = int(eval(input()))
b = 0
for x in range(1, N // 100 + 1):
for y in range(100 * x, 105 * x + 1):
if N == y:
print((1))
exit()
print((0))
| N = int(eval(input()))
b = 0
x = N // 100
for y in range(100 * x, 105 * x + 1):
if N == y:
print((1))
exit()
print((0))
| false | 0 | [
"-for x in range(1, N // 100 + 1):",
"- for y in range(100 * x, 105 * x + 1):",
"- if N == y:",
"- print((1))",
"- exit()",
"+x = N // 100",
"+for y in range(100 * x, 105 * x + 1):",
"+ if N == y:",
"+ print((1))",
"+ exit()"
] | false | 0.036953 | 0.036378 | 1.015795 | [
"s835279631",
"s118100115"
] |
u761320129 | p03722 | python | s141294741 | s051959743 | 1,481 | 877 | 3,388 | 9,344 | Accepted | Accepted | 40.78 | N,M = list(map(int,input().split()))
es = [tuple(map(int,input().split())) for i in range(M)]
INF = float('inf')
d = [INF] * N
d[0] = 0
for i in range(N):
for fr,to,cost in es:
fr,to = fr-1,to-1
cost *= -1
if d[fr] != INF and d[to] > d[fr]+cost:
d[to] = d[fr] + cost
... | N,M = list(map(int,input().split()))
ABC = [tuple(map(int,input().split())) for i in range(M)]
INF = float('inf')
dist = [INF] * N
dist[0] = 0
for i in range(N):
for a,b,c in ABC:
a,b,c = a-1,b-1,-c
if dist[b] > dist[a] + c:
dist[b] = dist[a] + c
if i==N-1 and b =... | 16 | 15 | 421 | 392 | N, M = list(map(int, input().split()))
es = [tuple(map(int, input().split())) for i in range(M)]
INF = float("inf")
d = [INF] * N
d[0] = 0
for i in range(N):
for fr, to, cost in es:
fr, to = fr - 1, to - 1
cost *= -1
if d[fr] != INF and d[to] > d[fr] + cost:
d[to] = d[fr] + cost
... | N, M = list(map(int, input().split()))
ABC = [tuple(map(int, input().split())) for i in range(M)]
INF = float("inf")
dist = [INF] * N
dist[0] = 0
for i in range(N):
for a, b, c in ABC:
a, b, c = a - 1, b - 1, -c
if dist[b] > dist[a] + c:
dist[b] = dist[a] + c
if i == N - 1 an... | false | 6.25 | [
"-es = [tuple(map(int, input().split())) for i in range(M)]",
"+ABC = [tuple(map(int, input().split())) for i in range(M)]",
"-d = [INF] * N",
"-d[0] = 0",
"+dist = [INF] * N",
"+dist[0] = 0",
"- for fr, to, cost in es:",
"- fr, to = fr - 1, to - 1",
"- cost *= -1",
"- if d... | false | 0.046682 | 0.087462 | 0.533742 | [
"s141294741",
"s051959743"
] |
u261103969 | p02659 | python | s801741654 | s292922122 | 63 | 23 | 61,784 | 9,168 | Accepted | Accepted | 63.49 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
a, b = input().split()
c, d = int(a), int(b[0] + b[-2:])
print((c * d // 100))
if __name__ == '__main__':
main()
| a, b = input().split() # まず文字列で受け取ります
p = int(a) # aはそのままint型にします
q = int(b[0] + b[2] + b[3]) # b[0] + b[2] + b[3]を整数に変換すれば、bの100倍を正確に得られます
print((p * q // 100)) # 2つを掛けて100で整数の割り算をすれば終わりです | 17 | 5 | 270 | 195 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
a, b = input().split()
c, d = int(a), int(b[0] + b[-2:])
print((c * d // 100))
if __name__ == "__main__":
main()
| a, b = input().split() # まず文字列で受け取ります
p = int(a) # aはそのままint型にします
q = int(b[0] + b[2] + b[3]) # b[0] + b[2] + b[3]を整数に変換すれば、bの100倍を正確に得られます
print((p * q // 100)) # 2つを掛けて100で整数の割り算をすれば終わりです
| false | 70.588235 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- a, b = input().split()",
"- c, d = int(a), int(b[0] + b[-2:])",
"- print((c * d // 100))",
"-",
"-",
"-if __name__ == ... | false | 0.04084 | 0.04544 | 0.898771 | [
"s801741654",
"s292922122"
] |
u792078574 | p02610 | python | s109543653 | s251575173 | 972 | 727 | 111,544 | 42,532 | Accepted | Accepted | 25.21 | from heapq import heappush, heappop
T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
arr1 = []
arr2 = []
for _ in range(N):
K, L, R = list(map(int, input().split()))
if L > R:
arr1.append((K, L, R))
else:
arr2.append((N-K, R, L... | from heapq import heappush, heappop
T = int(eval(input()))
def process(arr):
arr.sort()
baseS = 0
diffS = 0
q = []
length = 0
for K, L, R in arr:
baseS += R
diff = L - R
heappush(q, diff)
diffS += diff
length += 1
while length > K:
... | 48 | 32 | 1,018 | 716 | from heapq import heappush, heappop
T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
arr1 = []
arr2 = []
for _ in range(N):
K, L, R = list(map(int, input().split()))
if L > R:
arr1.append((K, L, R))
else:
arr2.append((N - K, R, L))
arr... | from heapq import heappush, heappop
T = int(eval(input()))
def process(arr):
arr.sort()
baseS = 0
diffS = 0
q = []
length = 0
for K, L, R in arr:
baseS += R
diff = L - R
heappush(q, diff)
diffS += diff
length += 1
while length > K:
d... | false | 33.333333 | [
"+",
"+",
"+def process(arr):",
"+ arr.sort()",
"+ baseS = 0",
"+ diffS = 0",
"+ q = []",
"+ length = 0",
"+ for K, L, R in arr:",
"+ baseS += R",
"+ diff = L - R",
"+ heappush(q, diff)",
"+ diffS += diff",
"+ length += 1",
"+ w... | false | 0.034382 | 0.032505 | 1.057724 | [
"s109543653",
"s251575173"
] |
u367965715 | p02735 | python | s210195932 | s458589664 | 207 | 189 | 12,500 | 12,752 | Accepted | Accepted | 8.7 | import numpy as np
h, w = list(map(int, input().split()))
grid = np.array(['*'*(w+2)] + ['*'+eval(input())+'*' for _ in range(h)] + ['*'*(w+2)])
cnt = np.full((h+3, w+3), h+w, dtype=np.int)
MAX = h + w
for i in range(1, h+2):
for k in range(1, w+2):
if i == k == 1:
cnt[i+1][k+1] = 1 ... | import numpy as np
h, w = list(map(int, input().split()))
grid = np.array([list(eval(input())) for _ in range(h)])
dp = np.full((h+1, w+1), h+w, dtype=np.int)
for i in range(h):
for k in range(w):
if i == k == 0:
dp[i+1, k+1] = 1 if grid[i, k] == '#' else 0
else:
... | 30 | 20 | 963 | 623 | import numpy as np
h, w = list(map(int, input().split()))
grid = np.array(
["*" * (w + 2)] + ["*" + eval(input()) + "*" for _ in range(h)] + ["*" * (w + 2)]
)
cnt = np.full((h + 3, w + 3), h + w, dtype=np.int)
MAX = h + w
for i in range(1, h + 2):
for k in range(1, w + 2):
if i == k == 1:
c... | import numpy as np
h, w = list(map(int, input().split()))
grid = np.array([list(eval(input())) for _ in range(h)])
dp = np.full((h + 1, w + 1), h + w, dtype=np.int)
for i in range(h):
for k in range(w):
if i == k == 0:
dp[i + 1, k + 1] = 1 if grid[i, k] == "#" else 0
else:
i... | false | 33.333333 | [
"-grid = np.array(",
"- [\"*\" * (w + 2)] + [\"*\" + eval(input()) + \"*\" for _ in range(h)] + [\"*\" * (w + 2)]",
"-)",
"-cnt = np.full((h + 3, w + 3), h + w, dtype=np.int)",
"-MAX = h + w",
"-for i in range(1, h + 2):",
"- for k in range(1, w + 2):",
"- if i == k == 1:",
"- ... | false | 0.186813 | 0.191469 | 0.975682 | [
"s210195932",
"s458589664"
] |
u511824539 | p02803 | python | s197976342 | s877663273 | 458 | 282 | 3,316 | 3,316 | Accepted | Accepted | 38.43 | from collections import deque
def shortestpath(y0, x0):
step_cnt = [[-1] * w for _ in range(h)]
step_cnt[y0-1][x0-1] = 0
q.append((y0, x0))
while q:
y, x = q.popleft()
for i in range(4):
y_next = y + dy[i]
x_next = x + dx[i]
if 1 <= y_next ... | from collections import deque
def shortestpath(y0, x0):
step_cnt = [[-1] * (w+2) for _ in range(h+2)]
step_cnt[y0][x0] = 0
q.append((y0, x0))
while q:
y, x = q.popleft()
for i in range(4):
y_next = y + dy[i]
x_next = x + dx[i]
if maze[y_nex... | 34 | 34 | 984 | 918 | from collections import deque
def shortestpath(y0, x0):
step_cnt = [[-1] * w for _ in range(h)]
step_cnt[y0 - 1][x0 - 1] = 0
q.append((y0, x0))
while q:
y, x = q.popleft()
for i in range(4):
y_next = y + dy[i]
x_next = x + dx[i]
if (
... | from collections import deque
def shortestpath(y0, x0):
step_cnt = [[-1] * (w + 2) for _ in range(h + 2)]
step_cnt[y0][x0] = 0
q.append((y0, x0))
while q:
y, x = q.popleft()
for i in range(4):
y_next = y + dy[i]
x_next = x + dx[i]
if maze[y_next][x_n... | false | 0 | [
"- step_cnt = [[-1] * w for _ in range(h)]",
"- step_cnt[y0 - 1][x0 - 1] = 0",
"+ step_cnt = [[-1] * (w + 2) for _ in range(h + 2)]",
"+ step_cnt[y0][x0] = 0",
"- if (",
"- 1 <= y_next < h + 1",
"- and 1 <= x_next < w + 1",
"- and maz... | false | 0.184471 | 0.206926 | 0.891484 | [
"s197976342",
"s877663273"
] |
u070561949 | p03215 | python | s118246419 | s819757878 | 936 | 671 | 29,152 | 28,700 | Accepted | Accepted | 28.31 | n,k=list(map(int,input().split()))
d=list(map(int,input().split()))
ds = []
for i in range(0,n):
sum = 0
for j in range(i,n):
sum += d[j]
ds.append(sum)
ds.sort(reverse=True)
for i in range(40,-1,-1):
count = 0
o = []
for dss in ds:
if dss & (1 << i)... | line = str(eval(input()))
lines = line.split(' ')
n = int(lines[0])
k = int(lines[1])
d = list()
line = str(eval(input()))
lines = line.split(' ')
for l in lines:
d.append(int(l))
ds = list()
for i in range(0,n):
sum = 0
for j in range(i,n):
sum += d[j]
ds.app... | 29 | 39 | 491 | 602 | n, k = list(map(int, input().split()))
d = list(map(int, input().split()))
ds = []
for i in range(0, n):
sum = 0
for j in range(i, n):
sum += d[j]
ds.append(sum)
ds.sort(reverse=True)
for i in range(40, -1, -1):
count = 0
o = []
for dss in ds:
if dss & (1 << i) > 0:
... | line = str(eval(input()))
lines = line.split(" ")
n = int(lines[0])
k = int(lines[1])
d = list()
line = str(eval(input()))
lines = line.split(" ")
for l in lines:
d.append(int(l))
ds = list()
for i in range(0, n):
sum = 0
for j in range(i, n):
sum += d[j]
ds.append(sum)
for i in range(40, -1... | false | 25.641026 | [
"-n, k = list(map(int, input().split()))",
"-d = list(map(int, input().split()))",
"-ds = []",
"+line = str(eval(input()))",
"+lines = line.split(\" \")",
"+n = int(lines[0])",
"+k = int(lines[1])",
"+d = list()",
"+line = str(eval(input()))",
"+lines = line.split(\" \")",
"+for l in lines:",
... | false | 0.060976 | 0.060148 | 1.013757 | [
"s118246419",
"s819757878"
] |
u644907318 | p03361 | python | s703721415 | s303918849 | 170 | 66 | 38,768 | 65,220 | Accepted | Accepted | 61.18 | H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
flag = 0
for i in range(H):
for j in range(W):
if S[i][j]=="#":
if j+1<W and S[i][j+1]=="." and i-1>=0 and S[i-1][j]=="." and j-1>=0 and S[i][j-1]=="." \
and i+1<H and S[i+1][j]==".":
flag ... | H,W = list(map(int,input().split()))
S = [input().strip() for _ in range(H)]
for i in range(H):
S[i] = "."+S[i]+"."
S.insert(0,"."*(W+2))
S.append("."*(W+2))
flag = 0
for i in range(1,H+1):
for j in range(1,W+1):
if S[i][j]=="#" and S[i][j+1]=="." and S[i-1][j]=="." and S[i][j-1]=="." and S[i+1... | 15 | 17 | 423 | 442 | H, W = map(int, input().split())
S = [input().strip() for _ in range(H)]
flag = 0
for i in range(H):
for j in range(W):
if S[i][j] == "#":
if (
j + 1 < W
and S[i][j + 1] == "."
and i - 1 >= 0
and S[i - 1][j] == "."
a... | H, W = list(map(int, input().split()))
S = [input().strip() for _ in range(H)]
for i in range(H):
S[i] = "." + S[i] + "."
S.insert(0, "." * (W + 2))
S.append("." * (W + 2))
flag = 0
for i in range(1, H + 1):
for j in range(1, W + 1):
if (
S[i][j] == "#"
and S[i][j + 1] == "."
... | false | 11.764706 | [
"-H, W = map(int, input().split())",
"+H, W = list(map(int, input().split()))",
"+for i in range(H):",
"+ S[i] = \".\" + S[i] + \".\"",
"+S.insert(0, \".\" * (W + 2))",
"+S.append(\".\" * (W + 2))",
"-for i in range(H):",
"- for j in range(W):",
"- if S[i][j] == \"#\":",
"- ... | false | 0.035565 | 0.069136 | 0.514416 | [
"s703721415",
"s303918849"
] |
u222841610 | p03543 | python | s063099416 | s840677089 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a = list(map(int,list(eval(input()))))
count = 1
check = False
for i in range(len(a)-1):
if a[i] == a[i+1]:
count += 1
if count==3:
check = True
else:
count = 1
print(('Yes' if check==True else 'No')) | a = list(map(int,list(eval(input()))))
check = False
if a[0] == a[1] == a[2] or a[1]==a[2]==a[3]:
check = True
print(('Yes' if check==True else 'No')) | 11 | 6 | 247 | 153 | a = list(map(int, list(eval(input()))))
count = 1
check = False
for i in range(len(a) - 1):
if a[i] == a[i + 1]:
count += 1
if count == 3:
check = True
else:
count = 1
print(("Yes" if check == True else "No"))
| a = list(map(int, list(eval(input()))))
check = False
if a[0] == a[1] == a[2] or a[1] == a[2] == a[3]:
check = True
print(("Yes" if check == True else "No"))
| false | 45.454545 | [
"-count = 1",
"-for i in range(len(a) - 1):",
"- if a[i] == a[i + 1]:",
"- count += 1",
"- if count == 3:",
"- check = True",
"- else:",
"- count = 1",
"+if a[0] == a[1] == a[2] or a[1] == a[2] == a[3]:",
"+ check = True"
] | false | 0.066477 | 0.035754 | 1.859316 | [
"s063099416",
"s840677089"
] |
u717626627 | p02933 | python | s395857362 | s608423030 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a = int(eval(input()))
s = str(eval(input()))
if a >= 3200:
print(s)
else:
print('red') | a = int(eval(input()))
s = eval(input())
if a < 3200:
print('red')
else:
print(s) | 7 | 7 | 86 | 80 | a = int(eval(input()))
s = str(eval(input()))
if a >= 3200:
print(s)
else:
print("red")
| a = int(eval(input()))
s = eval(input())
if a < 3200:
print("red")
else:
print(s)
| false | 0 | [
"-s = str(eval(input()))",
"-if a >= 3200:",
"+s = eval(input())",
"+if a < 3200:",
"+ print(\"red\")",
"+else:",
"-else:",
"- print(\"red\")"
] | false | 0.044741 | 0.038925 | 1.14941 | [
"s395857362",
"s608423030"
] |
u022979415 | p02881 | python | s548688012 | s780750030 | 391 | 185 | 2,940 | 3,272 | Accepted | Accepted | 52.69 | def main():
N = int(eval(input()))
i = 2
ans = N + 1
while i ** 2 <= N:
if N % i == 0:
ans = min(i + N / i, ans)
i += 1
print((int(ans - 2)))
if __name__ == '__main__':
main() | def main():
n = int(eval(input()))
f = []
i = 2
while i * i <= n:
if n % i == 0:
f.append(i)
if i * i != n:
f.append(n // i)
i += 1
if n != 1:
f.append(n)
f.sort()
answer = float("inf")
for ff in f:
an... | 13 | 22 | 233 | 416 | def main():
N = int(eval(input()))
i = 2
ans = N + 1
while i**2 <= N:
if N % i == 0:
ans = min(i + N / i, ans)
i += 1
print((int(ans - 2)))
if __name__ == "__main__":
main()
| def main():
n = int(eval(input()))
f = []
i = 2
while i * i <= n:
if n % i == 0:
f.append(i)
if i * i != n:
f.append(n // i)
i += 1
if n != 1:
f.append(n)
f.sort()
answer = float("inf")
for ff in f:
answer = min(answ... | false | 40.909091 | [
"- N = int(eval(input()))",
"+ n = int(eval(input()))",
"+ f = []",
"- ans = N + 1",
"- while i**2 <= N:",
"- if N % i == 0:",
"- ans = min(i + N / i, ans)",
"+ while i * i <= n:",
"+ if n % i == 0:",
"+ f.append(i)",
"+ if i * i !... | false | 0.055469 | 0.044425 | 1.248607 | [
"s548688012",
"s780750030"
] |
u463655976 | p03107 | python | s675600836 | s516433063 | 109 | 54 | 3,188 | 3,188 | Accepted | Accepted | 50.46 | s = 0
p = 0
for c in eval(input()):
n = int(c) * 2 - 1
p += max(abs(s) - abs(s+n), 0) * 2
s += n
print(p) | s = 0
S = eval(input())
for c in S:
n = int(c) * 2 - 1
s += n
print((len(S) - abs(s)))
| 7 | 6 | 111 | 88 | s = 0
p = 0
for c in eval(input()):
n = int(c) * 2 - 1
p += max(abs(s) - abs(s + n), 0) * 2
s += n
print(p)
| s = 0
S = eval(input())
for c in S:
n = int(c) * 2 - 1
s += n
print((len(S) - abs(s)))
| false | 14.285714 | [
"-p = 0",
"-for c in eval(input()):",
"+S = eval(input())",
"+for c in S:",
"- p += max(abs(s) - abs(s + n), 0) * 2",
"-print(p)",
"+print((len(S) - abs(s)))"
] | false | 0.082253 | 0.045229 | 1.818595 | [
"s675600836",
"s516433063"
] |
u416758623 | p03469 | python | s957062362 | s207437767 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = eval(input())
print((n.replace("2017","2018",1))) | s = eval(input())
print((s.replace("7","8",1))) | 2 | 2 | 46 | 40 | n = eval(input())
print((n.replace("2017", "2018", 1)))
| s = eval(input())
print((s.replace("7", "8", 1)))
| false | 0 | [
"-n = eval(input())",
"-print((n.replace(\"2017\", \"2018\", 1)))",
"+s = eval(input())",
"+print((s.replace(\"7\", \"8\", 1)))"
] | false | 0.043938 | 0.068615 | 0.640356 | [
"s957062362",
"s207437767"
] |
u560867850 | p03274 | python | s968044826 | s835442399 | 74 | 63 | 14,596 | 14,172 | Accepted | Accepted | 14.86 | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
X = [int(c) for c in input().split()]
def fullsearch():
for i in range(N-K+1):
l = X[i]
r = X[i+K-1]
distance = abs(r - l)
yield min(distance + abs... | import sys
input = sys.stdin.readline
def main():
_, K = list(map(int, input().split()))
X = [int(c) for c in input().split()]
def fullsearch():
for l, r in zip(X, X[K-1:]):
distance = abs(r - l)
yield distance + abs(r)
yield distance + abs(l)
... | 18 | 17 | 379 | 350 | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
X = [int(c) for c in input().split()]
def fullsearch():
for i in range(N - K + 1):
l = X[i]
r = X[i + K - 1]
distance = abs(r - l)
yield min(distance + abs(r),... | import sys
input = sys.stdin.readline
def main():
_, K = list(map(int, input().split()))
X = [int(c) for c in input().split()]
def fullsearch():
for l, r in zip(X, X[K - 1 :]):
distance = abs(r - l)
yield distance + abs(r)
yield distance + abs(l)
print((m... | false | 5.555556 | [
"- N, K = list(map(int, input().split()))",
"+ _, K = list(map(int, input().split()))",
"- for i in range(N - K + 1):",
"- l = X[i]",
"- r = X[i + K - 1]",
"+ for l, r in zip(X, X[K - 1 :]):",
"- yield min(distance + abs(r), distance + abs(l))",
"+ ... | false | 0.095358 | 0.041019 | 2.324698 | [
"s968044826",
"s835442399"
] |
u282228874 | p03573 | python | s260598187 | s449736745 | 24 | 17 | 3,316 | 2,940 | Accepted | Accepted | 29.17 | a,b,c = list(map(int,input().split()))
print((a^b^c)) | a,b,c = list(map(int,input().split()))
if a==b:
print(c)
elif a == c:
print(b)
else:
print(a) | 2 | 7 | 46 | 105 | a, b, c = list(map(int, input().split()))
print((a ^ b ^ c))
| a, b, c = list(map(int, input().split()))
if a == b:
print(c)
elif a == c:
print(b)
else:
print(a)
| false | 71.428571 | [
"-print((a ^ b ^ c))",
"+if a == b:",
"+ print(c)",
"+elif a == c:",
"+ print(b)",
"+else:",
"+ print(a)"
] | false | 0.037077 | 0.079833 | 0.464428 | [
"s260598187",
"s449736745"
] |
u195912432 | p03194 | python | s220370688 | s791427742 | 203 | 78 | 3,064 | 3,064 | Accepted | Accepted | 61.58 | # -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))
import math
N, P = list(map(int, input().split()))
ans = 1
target = 2
sum = {}
while True:
if P % target == 0:
if target in su... | # -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))
import math
N, P = list(map(int, input().split()))
ans = 1
target = 2
sum = {}
if N == 1:
ans = P
else:
while True:
if P % tar... | 42 | 44 | 781 | 833 | # -*- coding: utf-8 -*-
# 整数の入力
# a = int(input())
# スペース区切りの整数の入力
# b, c = map(int, input().split())
# 文字列の入力
# s = input()
# 出力
# print("{} {}".format(a+b+c, s))
import math
N, P = list(map(int, input().split()))
ans = 1
target = 2
sum = {}
while True:
if P % target == 0:
if target in sum:
su... | # -*- coding: utf-8 -*-
# 整数の入力
# a = int(input())
# スペース区切りの整数の入力
# b, c = map(int, input().split())
# 文字列の入力
# s = input()
# 出力
# print("{} {}".format(a+b+c, s))
import math
N, P = list(map(int, input().split()))
ans = 1
target = 2
sum = {}
if N == 1:
ans = P
else:
while True:
if P % target == 0:
... | false | 4.545455 | [
"-while True:",
"- if P % target == 0:",
"- if target in sum:",
"- sum[target] += 1",
"+if N == 1:",
"+ ans = P",
"+else:",
"+ while True:",
"+ if P % target == 0:",
"+ if target in sum:",
"+ sum[target] += 1",
"+ else:",
... | false | 0.043737 | 0.036261 | 1.206187 | [
"s220370688",
"s791427742"
] |
u065446124 | p03682 | python | s360328315 | s050379247 | 1,644 | 1,283 | 132,052 | 50,448 | Accepted | Accepted | 21.96 | class unionfind:
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def find(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x]
def unite(s... | class unionfind:
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def find(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x]
def unite(s... | 54 | 54 | 1,412 | 1,395 | class unionfind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def find(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x]
def unite(sel... | class unionfind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def find(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x]
def unite(sel... | false | 0 | [
"-pq.sort(key=lambda x: x[0])",
"+pq.sort()"
] | false | 0.085985 | 0.07731 | 1.1122 | [
"s360328315",
"s050379247"
] |
u564589929 | p02935 | python | s017268420 | s215910821 | 22 | 20 | 3,316 | 3,316 | Accepted | Accepted | 9.09 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(... | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(... | 33 | 23 | 697 | 535 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LLI(rows_number):
return [L... | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LLI(rows_number):
return [L... | false | 30.30303 | [
"- V = LI()",
"- V = deque(sorted(V))",
"- vi = V.popleft()",
"- while 1:",
"- vj = V.popleft()",
"- avg = (vi + vj) / 2",
"- V.append(avg)",
"- V = deque(sorted(V))",
"- vi = V.popleft()",
"- if len(V) == 0:",
"- break",
"- p... | false | 0.042675 | 0.081705 | 0.522308 | [
"s017268420",
"s215910821"
] |
u459798349 | p03043 | python | s521999902 | s159671159 | 125 | 51 | 3,188 | 8,980 | Accepted | Accepted | 59.2 | n, k = list(map(int, input().split()))
import math
def get_p(nums,k):
p=1/(2**math.ceil(max(math.log(k/nums,2),0)))
return p
ans=0
for nums in range(n):
ans+=get_p(nums+1,k)
print(("{0:.20f}".format(ans/n))) | import math
n,k=list(map(int,input().split()))
ans=0
for i in range(1,n+1):
cnt=0
now=i
while now<k:
now*=2
cnt+=1
ans+=1/pow(2,cnt)
print((ans/n))
| 12 | 14 | 229 | 195 | n, k = list(map(int, input().split()))
import math
def get_p(nums, k):
p = 1 / (2 ** math.ceil(max(math.log(k / nums, 2), 0)))
return p
ans = 0
for nums in range(n):
ans += get_p(nums + 1, k)
print(("{0:.20f}".format(ans / n)))
| import math
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
cnt = 0
now = i
while now < k:
now *= 2
cnt += 1
ans += 1 / pow(2, cnt)
print((ans / n))
| false | 14.285714 | [
"-n, k = list(map(int, input().split()))",
"-",
"-def get_p(nums, k):",
"- p = 1 / (2 ** math.ceil(max(math.log(k / nums, 2), 0)))",
"- return p",
"-",
"-",
"+n, k = list(map(int, input().split()))",
"-for nums in range(n):",
"- ans += get_p(nums + 1, k)",
"-print((\"{0:.20f}\".format(a... | false | 0.079267 | 0.05209 | 1.521749 | [
"s521999902",
"s159671159"
] |
u062147869 | p03276 | python | s750887887 | s125097170 | 128 | 104 | 14,224 | 14,252 | Accepted | Accepted | 18.75 | import sys
N,K=list(map(int,input().split()))
X=[int(i) for i in input().split()]
A=[]
B=[]
for x in X:
if x<0:
A.append(x)
else:
B.append(x)
ans=10**18
a=len(A)
b=len(B)
if a==0:
print((B[K-1]))
sys.exit()
if b==0:
print((abs(A[-K])))
sys.exit()
for i in range... | N,K=list(map(int,input().split()))
X=[int(i) for i in input().split()]
ans=10**18
for i in range(N-K+1):
ans=min(ans,abs(X[i])+abs(X[i+K-1]-X[i]))
ans=min(ans,abs(X[i+K-1])+abs(X[i+K-1]-X[i]))
print(ans) | 30 | 7 | 590 | 211 | import sys
N, K = list(map(int, input().split()))
X = [int(i) for i in input().split()]
A = []
B = []
for x in X:
if x < 0:
A.append(x)
else:
B.append(x)
ans = 10**18
a = len(A)
b = len(B)
if a == 0:
print((B[K - 1]))
sys.exit()
if b == 0:
print((abs(A[-K])))
sys.exit()
for i in... | N, K = list(map(int, input().split()))
X = [int(i) for i in input().split()]
ans = 10**18
for i in range(N - K + 1):
ans = min(ans, abs(X[i]) + abs(X[i + K - 1] - X[i]))
ans = min(ans, abs(X[i + K - 1]) + abs(X[i + K - 1] - X[i]))
print(ans)
| false | 76.666667 | [
"-import sys",
"-",
"-A = []",
"-B = []",
"-for x in X:",
"- if x < 0:",
"- A.append(x)",
"- else:",
"- B.append(x)",
"-a = len(A)",
"-b = len(B)",
"-if a == 0:",
"- print((B[K - 1]))",
"- sys.exit()",
"-if b == 0:",
"- print((abs(A[-K])))",
"- sys.exi... | false | 0.046671 | 0.046353 | 1.006849 | [
"s750887887",
"s125097170"
] |
u252828980 | p02803 | python | s667049068 | s585509287 | 570 | 305 | 4,716 | 9,488 | Accepted | Accepted | 46.49 | import collections
H,W = list(map(int,input().split()))
if H == W == 1:
print((0))
exit()
if (H == 1 and W == 2) or (H == 2 and W == 1):
print((1))
exit()
LL=[]
for i in range(H):
LL.append(eval(input()))
L = ((1,0),(0,1),(-1,0),(0,-1))
q = collections.deque()
max_L = []
for i in ran... | h,w = list(map(int,input().split()))
L = [[]*w for i in range(h)]
for i in range(h):
L[i] = list("#" + eval(input()) + "#")
L = [["#" for i in range(w+2)]] + L + [["#" for i in range(w+2)]]
#print(L)
from collections import deque
ans = 0
q = deque([])
for j in range(1,h+1):
for i in range(1,w+1):
... | 34 | 35 | 998 | 1,051 | import collections
H, W = list(map(int, input().split()))
if H == W == 1:
print((0))
exit()
if (H == 1 and W == 2) or (H == 2 and W == 1):
print((1))
exit()
LL = []
for i in range(H):
LL.append(eval(input()))
L = ((1, 0), (0, 1), (-1, 0), (0, -1))
q = collections.deque()
max_L = []
for i in range(H... | h, w = list(map(int, input().split()))
L = [[] * w for i in range(h)]
for i in range(h):
L[i] = list("#" + eval(input()) + "#")
L = [["#" for i in range(w + 2)]] + L + [["#" for i in range(w + 2)]]
# print(L)
from collections import deque
ans = 0
q = deque([])
for j in range(1, h + 1):
for i in range(1, w + 1)... | false | 2.857143 | [
"-import collections",
"+h, w = list(map(int, input().split()))",
"+L = [[] * w for i in range(h)]",
"+for i in range(h):",
"+ L[i] = list(\"#\" + eval(input()) + \"#\")",
"+L = [[\"#\" for i in range(w + 2)]] + L + [[\"#\" for i in range(w + 2)]]",
"+# print(L)",
"+from collections import deque",
... | false | 0.045845 | 0.039264 | 1.167615 | [
"s667049068",
"s585509287"
] |
u062147869 | p03807 | python | s276489225 | s095703706 | 249 | 215 | 63,216 | 62,448 | Accepted | Accepted | 13.65 | N=int(eval(input()))
A=[int(i) for i in input().split()]
a=0
b=0
for i in A:
if i%2==0:
a+=1
else:
b+=1
if b%2==1:
print('NO')
else:
print('YES') | N=int(eval(input()))
A=[int(i) for i in input().split()]
L=[0,0]
for a in A:
L[a%2]+=1
if L[1]%2==1:
print('NO')
else:
print('YES') | 13 | 9 | 183 | 145 | N = int(eval(input()))
A = [int(i) for i in input().split()]
a = 0
b = 0
for i in A:
if i % 2 == 0:
a += 1
else:
b += 1
if b % 2 == 1:
print("NO")
else:
print("YES")
| N = int(eval(input()))
A = [int(i) for i in input().split()]
L = [0, 0]
for a in A:
L[a % 2] += 1
if L[1] % 2 == 1:
print("NO")
else:
print("YES")
| false | 30.769231 | [
"-a = 0",
"-b = 0",
"-for i in A:",
"- if i % 2 == 0:",
"- a += 1",
"- else:",
"- b += 1",
"-if b % 2 == 1:",
"+L = [0, 0]",
"+for a in A:",
"+ L[a % 2] += 1",
"+if L[1] % 2 == 1:"
] | false | 0.155986 | 0.04733 | 3.295728 | [
"s276489225",
"s095703706"
] |
u576432509 | p03108 | python | s119686334 | s321529951 | 1,979 | 1,819 | 86,592 | 91,012 | Accepted | Accepted | 8.08 | import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict
input = sys.stdin.readline
icase=0
if icase==0:
n,m=list(map(int,input().split()))
a=[0]*m
b=[0]*m
for i in range(m):
ai,bi=list(map(int,input().split()))
a[i]=ai-1
b[i]=bi-1
pair=[i ... | import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict
input = sys.stdin.readline
icase=0
if icase==0:
n,m=list(map(int,input().split()))
a=[0]*m
b=[0]*m
for i in range(m):
ai,bi=list(map(int,input().split()))
a[i]=ai-1
b[i]=bi-1
pair=[i ... | 96 | 96 | 2,072 | 2,072 | import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict
input = sys.stdin.readline
icase = 0
if icase == 0:
n, m = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
ai, bi = list(map(int, input().split()))
a[i] = ai - 1
b[i] = bi - 1... | import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict
input = sys.stdin.readline
icase = 0
if icase == 0:
n, m = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
ai, bi = list(map(int, input().split()))
a[i] = ai - 1
b[i] = bi - 1... | false | 0 | [
"- pair[rtb] = rta",
"- # unite(a[m-i-1],b[m-i-1])",
"+ # pair[rtb]=rta",
"+ unite(a[m - i - 1], b[m - i - 1])",
"- pair[rta] = rtb",
"- # unite(a[m-i-1],b[m-i-1])",
"+ # pair[rta]=rtb",
"+... | false | 0.03812 | 0.039441 | 0.966513 | [
"s119686334",
"s321529951"
] |
u075012704 | p03700 | python | s060235472 | s324268521 | 1,330 | 1,230 | 15,024 | 15,076 | Accepted | Accepted | 7.52 | from math import ceil
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
A -= B # 爆発は追加ダメージ扱いとする
# にぶたん
ok, ng = 10 ** 9, 0
while abs(ok - ng) > 1:
X = (ok + ng) // 2
h = [max(hi - B * X, 0) for hi in H]
h = [ceil(hi / A) for hi in h]
if sum(h) <= X... | from math import ceil
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
A -= B # Aを追加ダメージ扱いにする
ok, ng = 10 ** 9, 0
while abs(ok - ng) > 1:
X = (ok + ng) // 2
H_damaged = [h - (B * X) for h in H if h - (B * X) > 0]
Need = sum([ceil(h / A) for h in H_damaged])
... | 21 | 18 | 366 | 384 | from math import ceil
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
A -= B # 爆発は追加ダメージ扱いとする
# にぶたん
ok, ng = 10**9, 0
while abs(ok - ng) > 1:
X = (ok + ng) // 2
h = [max(hi - B * X, 0) for hi in H]
h = [ceil(hi / A) for hi in h]
if sum(h) <= X:
ok = X
... | from math import ceil
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
A -= B # Aを追加ダメージ扱いにする
ok, ng = 10**9, 0
while abs(ok - ng) > 1:
X = (ok + ng) // 2
H_damaged = [h - (B * X) for h in H if h - (B * X) > 0]
Need = sum([ceil(h / A) for h in H_damaged])
if X >= Ne... | false | 14.285714 | [
"-A -= B # 爆発は追加ダメージ扱いとする",
"-# にぶたん",
"+A -= B # Aを追加ダメージ扱いにする",
"- h = [max(hi - B * X, 0) for hi in H]",
"- h = [ceil(hi / A) for hi in h]",
"- if sum(h) <= X:",
"+ H_damaged = [h - (B * X) for h in H if h - (B * X) > 0]",
"+ Need = sum([ceil(h / A) for h in H_damaged])",
"+ i... | false | 0.108426 | 0.088238 | 1.228789 | [
"s060235472",
"s324268521"
] |
u461513098 | p02861 | python | s249983406 | s977828527 | 457 | 344 | 4,400 | 3,188 | Accepted | Accepted | 24.73 | import itertools
import math
N = int(eval(input()))
crd_list = []
for _ in range(N):
crd_list.append([int(xy) for xy in input().split()])
cost_list = []
for way in itertools.permutations([n for n in range(N)]):
cost = 0
for index in range(1, N):
cost += ((crd_list[way[index]][0]-crd_li... | import sys
import itertools
input = sys.stdin.readline
def fact(n):
res = 1
for i in range(n):
res *= n - i
return res
def main():
dst_sum = 0
for p in itertools.permutations(T):
for i in range(1, N):
px, py = p[i-1]
cx, cy = p[i]
... | 16 | 28 | 471 | 527 | import itertools
import math
N = int(eval(input()))
crd_list = []
for _ in range(N):
crd_list.append([int(xy) for xy in input().split()])
cost_list = []
for way in itertools.permutations([n for n in range(N)]):
cost = 0
for index in range(1, N):
cost += (
(crd_list[way[index]][0] - crd_... | import sys
import itertools
input = sys.stdin.readline
def fact(n):
res = 1
for i in range(n):
res *= n - i
return res
def main():
dst_sum = 0
for p in itertools.permutations(T):
for i in range(1, N):
px, py = p[i - 1]
cx, cy = p[i]
dst_sum +=... | false | 42.857143 | [
"+import sys",
"-import math",
"-N = int(eval(input()))",
"-crd_list = []",
"-for _ in range(N):",
"- crd_list.append([int(xy) for xy in input().split()])",
"-cost_list = []",
"-for way in itertools.permutations([n for n in range(N)]):",
"- cost = 0",
"- for index in range(1, N):",
"- ... | false | 0.121245 | 0.048611 | 2.494189 | [
"s249983406",
"s977828527"
] |
u079022693 | p02787 | python | s474688876 | s898333931 | 563 | 432 | 121,196 | 12,608 | Accepted | Accepted | 23.27 | H,N=list(map(int,input().split()))
A=[]
B=[]
for i in range(N):
a,b=list(map(int,input().split()))
A.append(a)
B.append(b)
DP=[[0]*(H+1) for i in range(N)]
DP.insert(0,[float("inf")]*(H+max(A)))
DP[0][0]=0
for i in range(1,N+1):
for j in range(1,H+1):
if j-A[i-1]>0:
DP[i][j]=... | from sys import stdin
import numpy as np
def main():
#入力
readline=stdin.readline
h,n=list(map(int,readline().split()))
ab=np.array([list(map(int,readline().split())) for _ in range(n)],dtype=np.int64)
a=ab[:,0]
b=ab[:,1]
dp=np.zeros(h+1,dtype=np.int64)
for i in range(1,h+1):
... | 20 | 18 | 420 | 420 | H, N = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
DP = [[0] * (H + 1) for i in range(N)]
DP.insert(0, [float("inf")] * (H + max(A)))
DP[0][0] = 0
for i in range(1, N + 1):
for j in range(1, H + 1):
if j - A[i - ... | from sys import stdin
import numpy as np
def main():
# 入力
readline = stdin.readline
h, n = list(map(int, readline().split()))
ab = np.array(
[list(map(int, readline().split())) for _ in range(n)], dtype=np.int64
)
a = ab[:, 0]
b = ab[:, 1]
dp = np.zeros(h + 1, dtype=np.int64)
... | false | 10 | [
"-H, N = list(map(int, input().split()))",
"-A = []",
"-B = []",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"- A.append(a)",
"- B.append(b)",
"-DP = [[0] * (H + 1) for i in range(N)]",
"-DP.insert(0, [float(\"inf\")] * (H + max(A)))",
"-DP[0][0] = 0",
"-for i in ... | false | 0.126961 | 0.437789 | 0.290006 | [
"s474688876",
"s898333931"
] |
u021548497 | p02793 | python | s865518878 | s454923622 | 1,836 | 435 | 4,844 | 114,796 | Accepted | Accepted | 76.31 | import sys
from collections import Counter
def prime_factorize(n):
ans = []
while not n%2:
ans.append(2)
n //= 2
mod = 3
while mod**2 <= n:
if n%mod == 0:
ans.append(mod)
n //= mod
else:
mod += 2
if n != 1:
... | import sys
from collections import Counter
import time
class Osa_k:
def __init__(self, n):
self.n = n
self.min_factor = [int(x) for x in range(n+1)]
self.is_prime = [True] * (self.n + 1)
self.is_prime[0] = False
self.is_prime[1] = False
for j in ... | 50 | 66 | 1,129 | 1,769 | import sys
from collections import Counter
def prime_factorize(n):
ans = []
while not n % 2:
ans.append(2)
n //= 2
mod = 3
while mod**2 <= n:
if n % mod == 0:
ans.append(mod)
n //= mod
else:
mod += 2
if n != 1:
ans.append(... | import sys
from collections import Counter
import time
class Osa_k:
def __init__(self, n):
self.n = n
self.min_factor = [int(x) for x in range(n + 1)]
self.is_prime = [True] * (self.n + 1)
self.is_prime[0] = False
self.is_prime[1] = False
for j in range(4, self.n + ... | false | 24.242424 | [
"+import time",
"-def prime_factorize(n):",
"- ans = []",
"- while not n % 2:",
"- ans.append(2)",
"- n //= 2",
"- mod = 3",
"- while mod**2 <= n:",
"- if n % mod == 0:",
"- ans.append(mod)",
"- n //= mod",
"- else:",
"- ... | false | 0.038927 | 0.629528 | 0.061835 | [
"s865518878",
"s454923622"
] |
u140480594 | p03399 | python | s177566395 | s539816514 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | A, B, C, D = int(eval(input())), int(eval(input())), int(eval(input())), int(eval(input()))
fare = 0
if A <= B : fare += A
else : fare += B
if C <= D : fare += C
else : fare += D
print(fare) | Train = [int(eval(input())), int(eval(input()))]
Bus = [int(eval(input())), int(eval(input()))]
print((min(Train) + min(Bus))) | 7 | 3 | 172 | 102 | A, B, C, D = (
int(eval(input())),
int(eval(input())),
int(eval(input())),
int(eval(input())),
)
fare = 0
if A <= B:
fare += A
else:
fare += B
if C <= D:
fare += C
else:
fare += D
print(fare)
| Train = [int(eval(input())), int(eval(input()))]
Bus = [int(eval(input())), int(eval(input()))]
print((min(Train) + min(Bus)))
| false | 57.142857 | [
"-A, B, C, D = (",
"- int(eval(input())),",
"- int(eval(input())),",
"- int(eval(input())),",
"- int(eval(input())),",
"-)",
"-fare = 0",
"-if A <= B:",
"- fare += A",
"-else:",
"- fare += B",
"-if C <= D:",
"- fare += C",
"-else:",
"- fare += D",
"-print(fare)"... | false | 0.040931 | 0.042873 | 0.954706 | [
"s177566395",
"s539816514"
] |
u296518383 | p02936 | python | s398152210 | s759457429 | 1,993 | 1,440 | 128,160 | 130,216 | Accepted | Accepted | 27.75 | N, Q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N - 1)]
PX = [list(map(int, input().split())) for _ in range(Q)]
graph = [[] for _ in range(N + 1)]
for A, B in AB:
graph[A].append(B)
graph[B].append(A)
graph = tuple(graph)
#print("graph:", graph)
X = [0] * ... | import sys
input = sys.stdin.buffer.readline
N, Q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N - 1)]
PX = [list(map(int, input().split())) for _ in range(Q)]
graph = [[] for _ in range(N + 1)]
for a, b in AB:
graph[a].append(b)
graph[b].append(a)
cost = [... | 30 | 29 | 627 | 588 | N, Q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N - 1)]
PX = [list(map(int, input().split())) for _ in range(Q)]
graph = [[] for _ in range(N + 1)]
for A, B in AB:
graph[A].append(B)
graph[B].append(A)
graph = tuple(graph)
# print("graph:", graph)
X = [0] * (N + 1)
fo... | import sys
input = sys.stdin.buffer.readline
N, Q = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N - 1)]
PX = [list(map(int, input().split())) for _ in range(Q)]
graph = [[] for _ in range(N + 1)]
for a, b in AB:
graph[a].append(b)
graph[b].append(a)
cost = [0] * (N + 1)... | false | 3.333333 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"-for A, B in AB:",
"- graph[A].append(B)",
"- graph[B].append(A)",
"-graph = tuple(graph)",
"-# print(\"graph:\", graph)",
"-X = [0] * (N + 1)",
"+for a, b in AB:",
"+ graph[a].append(b)",
"+ graph[b].append(a)",
"+cost =... | false | 0.092726 | 0.043455 | 2.133832 | [
"s398152210",
"s759457429"
] |
u855775311 | p02370 | python | s356193603 | s911024234 | 210 | 170 | 10,940 | 11,044 | Accepted | Accepted | 19.05 | def main():
nvertices, nedges = list(map(int, input().split()))
indegrees = [0 for i in range(nvertices)]
adj = [[] for i in range(nvertices)]
for i in range(nedges):
s, t = list(map(int, input().split()))
adj[s].append(t)
indegrees[t] += 1
S = []
for i in rang... | def main():
nvertices, nedges = list(map(int, input().split()))
Adj = [[] for i in range(nvertices)]
for i in range(nedges):
s, t = list(map(int, input().split()))
Adj[s].append(t)
visited = [False] * nvertices
ordering = []
for u in range(nvertices):
if not vi... | 27 | 26 | 637 | 609 | def main():
nvertices, nedges = list(map(int, input().split()))
indegrees = [0 for i in range(nvertices)]
adj = [[] for i in range(nvertices)]
for i in range(nedges):
s, t = list(map(int, input().split()))
adj[s].append(t)
indegrees[t] += 1
S = []
for i in range(nvertices... | def main():
nvertices, nedges = list(map(int, input().split()))
Adj = [[] for i in range(nvertices)]
for i in range(nedges):
s, t = list(map(int, input().split()))
Adj[s].append(t)
visited = [False] * nvertices
ordering = []
for u in range(nvertices):
if not visited[u]:
... | false | 3.703704 | [
"- indegrees = [0 for i in range(nvertices)]",
"- adj = [[] for i in range(nvertices)]",
"+ Adj = [[] for i in range(nvertices)]",
"- adj[s].append(t)",
"- indegrees[t] += 1",
"- S = []",
"- for i in range(nvertices):",
"- if indegrees[i] == 0:",
"- S.a... | false | 0.046525 | 0.039446 | 1.179452 | [
"s356193603",
"s911024234"
] |
u944886577 | p02628 | python | s361403440 | s630434633 | 33 | 28 | 8,972 | 9,160 | Accepted | Accepted | 15.15 | a,b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=sorted(c)
ans=0
for i in range(0,b):
ans+=d[i]
print(ans) | a,b=list(map(int,input().split()))
c=[]
c=list(map(int,input().split()))
d=list(c)
d2=sorted(d)
ans=0
for i in range(b):
ans+=d2[i]
print(ans) | 7 | 9 | 128 | 140 | a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = sorted(c)
ans = 0
for i in range(0, b):
ans += d[i]
print(ans)
| a, b = list(map(int, input().split()))
c = []
c = list(map(int, input().split()))
d = list(c)
d2 = sorted(d)
ans = 0
for i in range(b):
ans += d2[i]
print(ans)
| false | 22.222222 | [
"+c = []",
"-d = sorted(c)",
"+d = list(c)",
"+d2 = sorted(d)",
"-for i in range(0, b):",
"- ans += d[i]",
"+for i in range(b):",
"+ ans += d2[i]"
] | false | 0.04268 | 0.129384 | 0.329873 | [
"s361403440",
"s630434633"
] |
u063052907 | p02953 | python | s733047509 | s729280766 | 79 | 72 | 14,252 | 14,252 | Accepted | Accepted | 8.86 | N = int(eval(input()))
lst_H = list(map(int, input().split()))
lst_H = lst_H[::-1]
ans = "Yes"
for i in range(N - 1):
if lst_H[i] + 1 == lst_H[i + 1]:
lst_H[i + 1] -= 1
elif lst_H[i] >= lst_H[i + 1]:
continue
else:
ans = "No"
break
print(ans)
| N = int(eval(input()))
lst_H = list(map(int, input().split()))
ans = "Yes"
lst_H[0] -= 1
for i in range(1, N):
if lst_H[i - 1] < lst_H[i]:
lst_H[i] -= 1
elif lst_H[i - 1] == lst_H[i]:
continue
else:
ans = "No"
break
print(ans) | 14 | 15 | 295 | 280 | N = int(eval(input()))
lst_H = list(map(int, input().split()))
lst_H = lst_H[::-1]
ans = "Yes"
for i in range(N - 1):
if lst_H[i] + 1 == lst_H[i + 1]:
lst_H[i + 1] -= 1
elif lst_H[i] >= lst_H[i + 1]:
continue
else:
ans = "No"
break
print(ans)
| N = int(eval(input()))
lst_H = list(map(int, input().split()))
ans = "Yes"
lst_H[0] -= 1
for i in range(1, N):
if lst_H[i - 1] < lst_H[i]:
lst_H[i] -= 1
elif lst_H[i - 1] == lst_H[i]:
continue
else:
ans = "No"
break
print(ans)
| false | 6.666667 | [
"-lst_H = lst_H[::-1]",
"-for i in range(N - 1):",
"- if lst_H[i] + 1 == lst_H[i + 1]:",
"- lst_H[i + 1] -= 1",
"- elif lst_H[i] >= lst_H[i + 1]:",
"+lst_H[0] -= 1",
"+for i in range(1, N):",
"+ if lst_H[i - 1] < lst_H[i]:",
"+ lst_H[i] -= 1",
"+ elif lst_H[i - 1] == lst_... | false | 0.088071 | 0.0383 | 2.29951 | [
"s733047509",
"s729280766"
] |
u543954314 | p03575 | python | s031544107 | s516357845 | 27 | 17 | 3,316 | 3,064 | Accepted | Accepted | 37.04 | from collections import defaultdict as dd
n,m = list(map(int, input().split()))
dic = dd(list)
l = []
cnt = 0
for _ in range(m):
a,b = list(map(int, input().split()))
l.append((a,b))
dic[a].append(b)
dic[b].append(a)
def con(x):
visit.add(x)
for i in dic[x]:
if i in visit:
continue
... | int1 = lambda x: int(x) - 1
N, M = list(map(int, input().split()))
G = [list() for _ in range(N)]
edges = [tuple(map(int1, input().split())) for _ in range(M)]
for u,v in edges:
G[u].append(v)
G[v].append(u)
pre = [-1]*N
low = [-1]*N
def detect_bridge(v, p=None, c=0):
ret = list()
pre[v... | 26 | 29 | 511 | 676 | from collections import defaultdict as dd
n, m = list(map(int, input().split()))
dic = dd(list)
l = []
cnt = 0
for _ in range(m):
a, b = list(map(int, input().split()))
l.append((a, b))
dic[a].append(b)
dic[b].append(a)
def con(x):
visit.add(x)
for i in dic[x]:
if i in visit:
... | int1 = lambda x: int(x) - 1
N, M = list(map(int, input().split()))
G = [list() for _ in range(N)]
edges = [tuple(map(int1, input().split())) for _ in range(M)]
for u, v in edges:
G[u].append(v)
G[v].append(u)
pre = [-1] * N
low = [-1] * N
def detect_bridge(v, p=None, c=0):
ret = list()
pre[v] = low[v]... | false | 10.344828 | [
"-from collections import defaultdict as dd",
"-",
"-n, m = list(map(int, input().split()))",
"-dic = dd(list)",
"-l = []",
"-cnt = 0",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- l.append((a, b))",
"- dic[a].append(b)",
"- dic[b].append(a)",
"+int1 = lamb... | false | 0.043847 | 0.047162 | 0.929721 | [
"s031544107",
"s516357845"
] |
u968166680 | p03266 | python | s206456689 | s241790478 | 104 | 61 | 9,136 | 10,328 | Accepted | Accepted | 41.35 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
ans = 0
step = K if K % 2 else K // 2
for a in range(step, N + 1, step):... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
R = [0] * K
for n in range(1, N + 1):
R[n % K] += 1
ans = 0
... | 28 | 29 | 496 | 501 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
ans = 0
step = K if K % 2 else K // 2
for a in range(step, N + 1, step):
l = a // K ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
R = [0] * K
for n in range(1, N + 1):
R[n % K] += 1
ans = 0
for a in range(K):
... | false | 3.448276 | [
"+ R = [0] * K",
"+ for n in range(1, N + 1):",
"+ R[n % K] += 1",
"- step = K if K % 2 else K // 2",
"- for a in range(step, N + 1, step):",
"- l = a // K + 1",
"- r = (N + a) // K",
"- if r >= l:",
"- ans += (r - l + 1) ** 2",
"+ for a in ran... | false | 0.044676 | 0.039318 | 1.136257 | [
"s206456689",
"s241790478"
] |
u047796752 | p02727 | python | s398479082 | s720731090 | 521 | 159 | 101,672 | 103,048 | Accepted | Accepted | 69.48 | import sys
input = sys.stdin.readline
from heapq import *
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)
pq = []
ans = 0
for i in range(X):
heappush(... | import sys
input = sys.stdin.readline
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)
r.sort(reverse=True)
l = p[:X]+q[:Y]
l.sort()
s = sum(l)
ans = s
pre ... | 31 | 21 | 564 | 426 | import sys
input = sys.stdin.readline
from heapq import *
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)
pq = []
ans = 0
for i in range(X):
heappush(pq, p[i])
... | import sys
input = sys.stdin.readline
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)
r.sort(reverse=True)
l = p[:X] + q[:Y]
l.sort()
s = sum(l)
ans = s
pre = s
for i in... | false | 32.258065 | [
"-from heapq import *",
"-",
"-pq = []",
"-ans = 0",
"-for i in range(X):",
"- heappush(pq, p[i])",
"- ans += p[i]",
"-for i in range(Y):",
"- heappush(pq, q[i])",
"- ans += q[i]",
"-now = ans",
"-for i in range(C):",
"- now -= heappop(pq)",
"- heappush(pq, r[i])",
"- ... | false | 0.112747 | 0.071791 | 1.570488 | [
"s398479082",
"s720731090"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.