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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u867826040 | p03945 | python | s794463776 | s075717671 | 42 | 31 | 9,124 | 9,108 | Accepted | Accepted | 26.19 | s = eval(input())
print((sum((s[i] != s[i+1] for i in range(len(s)-1)))))
| s = eval(input())
print((s.count("BW")+s.count("WB"))) | 2 | 2 | 67 | 47 | s = eval(input())
print((sum((s[i] != s[i + 1] for i in range(len(s) - 1)))))
| s = eval(input())
print((s.count("BW") + s.count("WB")))
| false | 0 | [
"-print((sum((s[i] != s[i + 1] for i in range(len(s) - 1)))))",
"+print((s.count(\"BW\") + s.count(\"WB\")))"
] | false | 0.040435 | 0.169677 | 0.238306 | [
"s794463776",
"s075717671"
] |
u562935282 | p02600 | python | s971990977 | s843361713 | 28 | 25 | 9,084 | 9,088 | Accepted | Accepted | 10.71 | def main():
X = int(eval(input()))
a = X // 200
print((10 - a))
if __name__ == '__main__':
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
# while a... | def main():
x = int(eval(input()))
print((10 - x // 200))
if __name__ == '__main__':
main()
| 26 | 7 | 468 | 104 | def main():
X = int(eval(input()))
a = X // 200
print((10 - a))
if __name__ == "__main__":
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
# while abs(ok - ng) > 1:
# ... | def main():
x = int(eval(input()))
print((10 - x // 200))
if __name__ == "__main__":
main()
| false | 73.076923 | [
"- X = int(eval(input()))",
"- a = X // 200",
"- print((10 - a))",
"+ x = int(eval(input()))",
"+ print((10 - x // 200))",
"-# import sys",
"-# input = sys.stdin.readline",
"-#",
"-# sys.setrecursionlimit(10 ** 7)",
"-#",
"-# (int(x)-1 for x in input().split())",
"-# rstrip()",
... | false | 0.037785 | 0.103346 | 0.365614 | [
"s971990977",
"s843361713"
] |
u547608423 | p02802 | python | s020020094 | s768436215 | 387 | 343 | 7,704 | 17,096 | Accepted | Accepted | 11.37 | N,M=list(map(int,input().split()))
AC=[0]*N
WA=[0]*N
ac=0
wa=0
for i in range(M):
p,s=list(map(str,input().split()))
P=int(p)
if s=="AC":
if AC[P-1]!=P:
AC[P-1]+=P
ac+=1
wa+=WA[P-1]
else:
if AC[P-1]!=P:
WA[P-1]+=1
prin... | N,M=list(map(int,input().split()))
AC={}
WA={}
pe=0
ac=0
for i in range(M):
p,S=list(map(str,input().split()))
if S=="AC":
if p in list(AC.keys()):
pass
else:
AC[p]=1
if p in list(WA.keys()):
pe+=WA[p]
ac+=1
e... | 20 | 23 | 316 | 400 | N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
ac = 0
wa = 0
for i in range(M):
p, s = list(map(str, input().split()))
P = int(p)
if s == "AC":
if AC[P - 1] != P:
AC[P - 1] += P
ac += 1
wa += WA[P - 1]
else:
if AC[P - 1] != P:
... | N, M = list(map(int, input().split()))
AC = {}
WA = {}
pe = 0
ac = 0
for i in range(M):
p, S = list(map(str, input().split()))
if S == "AC":
if p in list(AC.keys()):
pass
else:
AC[p] = 1
if p in list(WA.keys()):
pe += WA[p]
ac += 1
... | false | 13.043478 | [
"-AC = [0] * N",
"-WA = [0] * N",
"+AC = {}",
"+WA = {}",
"+pe = 0",
"-wa = 0",
"- p, s = list(map(str, input().split()))",
"- P = int(p)",
"- if s == \"AC\":",
"- if AC[P - 1] != P:",
"- AC[P - 1] += P",
"+ p, S = list(map(str, input().split()))",
"+ if S ==... | false | 0.158706 | 0.190987 | 0.830977 | [
"s020020094",
"s768436215"
] |
u729133443 | p03767 | python | s446800485 | s224400183 | 313 | 201 | 119,520 | 37,084 | Accepted | Accepted | 35.78 | n=int(eval(input()));print((sum(sorted(map(int,input().split()))[::-1][1:n*2:2]))) | n=int(eval(input()));print((sum(sorted(map(int,input().split()))[n::2]))) | 1 | 1 | 74 | 65 | n = int(eval(input()))
print((sum(sorted(map(int, input().split()))[::-1][1 : n * 2 : 2])))
| n = int(eval(input()))
print((sum(sorted(map(int, input().split()))[n::2])))
| false | 0 | [
"-print((sum(sorted(map(int, input().split()))[::-1][1 : n * 2 : 2])))",
"+print((sum(sorted(map(int, input().split()))[n::2])))"
] | false | 0.03952 | 0.03686 | 1.072178 | [
"s446800485",
"s224400183"
] |
u997641430 | p02616 | python | s217456154 | s816396694 | 163 | 150 | 100,096 | 104,868 | Accepted | Accepted | 7.98 | n, k = list(map(int, input().split()))
*A, = list(map(int, input().split()))
p = 10**9 + 7
A.sort()
ans = 1
# 全部0以下の場合かつkが奇数の場合はトップk個の積
if A[n - 1] <= 0 and k % 2 == 1:
for i in range(k):
ans *= A[n - 1 - i]
ans %= p
print(ans)
exit()
i = 0
j = n - 1
# kが奇数なら最大は絶対使う
if k % 2... | n, k = list(map(int, input().split()))
*A, = list(map(int, input().split()))
p = 10**9 + 7
A.sort()
ans = 1
if A[n - 1] <= 0 and k % 2 == 1:
for i in range(k):
ans *= A[n - 1 - i]
ans %= p
print(ans)
exit()
i = 0
j = n - 1
if k % 2 == 1:
ans *= A[j]
ans %= p
j -= ... | 37 | 31 | 695 | 574 | n, k = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
p = 10**9 + 7
A.sort()
ans = 1
# 全部0以下の場合かつkが奇数の場合はトップk個の積
if A[n - 1] <= 0 and k % 2 == 1:
for i in range(k):
ans *= A[n - 1 - i]
ans %= p
print(ans)
exit()
i = 0
j = n - 1
# kが奇数なら最大は絶対使う
if k % 2 == 1:
ans ... | n, k = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
p = 10**9 + 7
A.sort()
ans = 1
if A[n - 1] <= 0 and k % 2 == 1:
for i in range(k):
ans *= A[n - 1 - i]
ans %= p
print(ans)
exit()
i = 0
j = n - 1
if k % 2 == 1:
ans *= A[j]
ans %= p
j -= 1
k -= 1
... | false | 16.216216 | [
"-# 全部0以下の場合かつkが奇数の場合はトップk個の積",
"-# kが奇数なら最大は絶対使う",
"-# 以下A[n-1]を除いてkを偶数として考える",
"-k //= 2",
"-for _ in range(min(k, n // 2)):",
"- # 2個ずつのペアを作って採用するかを決めていく",
"+for _ in range(k // 2):"
] | false | 0.068532 | 0.037743 | 1.815739 | [
"s217456154",
"s816396694"
] |
u644907318 | p03001 | python | s738204584 | s904019358 | 75 | 58 | 61,700 | 61,896 | Accepted | Accepted | 22.67 | W,H,x,y = list(map(int,input().split()))
if x*2==W and y*2==H:
z = 1
else:
z = 0
print((W*H/2,z)) | W,H,x,y = list(map(int,input().split()))
S = (W*H)/2
if 2*x==W and 2*y==H:
flag = 1
else:
flag = 0
print((S,flag)) | 6 | 7 | 102 | 120 | W, H, x, y = list(map(int, input().split()))
if x * 2 == W and y * 2 == H:
z = 1
else:
z = 0
print((W * H / 2, z))
| W, H, x, y = list(map(int, input().split()))
S = (W * H) / 2
if 2 * x == W and 2 * y == H:
flag = 1
else:
flag = 0
print((S, flag))
| false | 14.285714 | [
"-if x * 2 == W and y * 2 == H:",
"- z = 1",
"+S = (W * H) / 2",
"+if 2 * x == W and 2 * y == H:",
"+ flag = 1",
"- z = 0",
"-print((W * H / 2, z))",
"+ flag = 0",
"+print((S, flag))"
] | false | 0.035072 | 0.041743 | 0.840195 | [
"s738204584",
"s904019358"
] |
u445404615 | p03352 | python | s464511990 | s552911708 | 757 | 181 | 40,172 | 38,896 | Accepted | Accepted | 76.09 | x = int(eval(input()))
s = set([1])
for i in range(2,501):
for j in range(2,501):
if (i**j) <= x:
s.add(i**j)
print((max(list(s)))) | x = int(eval(input()))
s = set([1])
for i in range(2,501):
for j in range(2,10):
if (i**j) <= x:
s.add(i**j)
print((max(list(s)))) | 9 | 9 | 157 | 156 | x = int(eval(input()))
s = set([1])
for i in range(2, 501):
for j in range(2, 501):
if (i**j) <= x:
s.add(i**j)
print((max(list(s))))
| x = int(eval(input()))
s = set([1])
for i in range(2, 501):
for j in range(2, 10):
if (i**j) <= x:
s.add(i**j)
print((max(list(s))))
| false | 0 | [
"- for j in range(2, 501):",
"+ for j in range(2, 10):"
] | false | 0.942837 | 0.08245 | 11.435233 | [
"s464511990",
"s552911708"
] |
u169350228 | p02720 | python | s603082540 | s799375780 | 1,036 | 326 | 12,452 | 80,480 | Accepted | Accepted | 68.53 | import queue
k = int(eval(input()))
q = queue.Queue()
for i in range(1,10):
q.put(i)
for i in range(k):
x = q.get()
if not x%10 == 0:
q.put(10*x+(x%10)-1)
q.put(10*x+(x%10))
if not x%10 == 9:
q.put(10*x+(x%10)+1)
print(x)
| import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
def main():
k = int(ipt())
... | 16 | 28 | 270 | 649 | import queue
k = int(eval(input()))
q = queue.Queue()
for i in range(1, 10):
q.put(i)
for i in range(k):
x = q.get()
if not x % 10 == 0:
q.put(10 * x + (x % 10) - 1)
q.put(10 * x + (x % 10))
if not x % 10 == 9:
q.put(10 * x + (x % 10) + 1)
print(x)
| import math
# import numpy as np
import queue
from collections import deque, defaultdict
import heapq as hpq
from sys import stdin, setrecursionlimit
# from scipy.sparse.csgraph import dijkstra
# from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
def main():
k = int(ipt())
q =... | false | 42.857143 | [
"+import math",
"+",
"+# import numpy as np",
"+from collections import deque, defaultdict",
"+import heapq as hpq",
"+from sys import stdin, setrecursionlimit",
"-k = int(eval(input()))",
"-q = queue.Queue()",
"-for i in range(1, 10):",
"- q.put(i)",
"-for i in range(k):",
"- x = q.get(... | false | 0.107194 | 0.106297 | 1.008433 | [
"s603082540",
"s799375780"
] |
u905203728 | p03326 | python | s964089928 | s581274201 | 220 | 26 | 40,816 | 3,316 | Accepted | Accepted | 88.18 | n,m=list(map(int,input().split()))
box=list(list(map(int,input().split())) for i in range(n))
ans = 0
for i in (1,-1):
for j in (1,-1):
for k in (1,-1):
cost=list(i*x+j*y+z*k for x,y,z in box)
cost.sort(reverse=True)
ans=max(ans,sum(cost[:m]))
print(ans) | n,m=list(map(int,input().split()))
XYZ=[list(map(int,input().split())) for _ in range(n)]
ans=0
for i in (-1,1):
for j in (-1,1):
for k in (-1,1):
cost=list(i*x+j*y+z*k for x,y,z in XYZ)
cost.sort(reverse=True)
ans=max(ans,sum(cost[:m]))
print(ans) | 10 | 11 | 305 | 301 | n, m = list(map(int, input().split()))
box = list(list(map(int, input().split())) for i in range(n))
ans = 0
for i in (1, -1):
for j in (1, -1):
for k in (1, -1):
cost = list(i * x + j * y + z * k for x, y, z in box)
cost.sort(reverse=True)
ans = max(ans, sum(cost[:m]))
p... | n, m = list(map(int, input().split()))
XYZ = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in (-1, 1):
for j in (-1, 1):
for k in (-1, 1):
cost = list(i * x + j * y + z * k for x, y, z in XYZ)
cost.sort(reverse=True)
ans = max(ans, sum(cost[:m]))
print... | false | 9.090909 | [
"-box = list(list(map(int, input().split())) for i in range(n))",
"+XYZ = [list(map(int, input().split())) for _ in range(n)]",
"-for i in (1, -1):",
"- for j in (1, -1):",
"- for k in (1, -1):",
"- cost = list(i * x + j * y + z * k for x, y, z in box)",
"+for i in (-1, 1):",
"+ ... | false | 0.035802 | 0.058393 | 0.613121 | [
"s964089928",
"s581274201"
] |
u379142263 | p02628 | python | s171765021 | s569890035 | 37 | 33 | 9,608 | 9,492 | Accepted | Accepted | 10.81 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
if __name__ == "__main__":
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in... | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
def main():
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(k):
... | 17 | 19 | 361 | 387 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify, heappop, heappush, heappushpop
import math
import collections
import copy
if __name__ == "__main__":
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = 0
for i in range(k... | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify, heappop, heappush, heappushpop
import math
import collections
import copy
def main():
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = 0
for i in range(k):
ans... | false | 10.526316 | [
"-if __name__ == \"__main__\":",
"+",
"+def main():",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.042194 | 0.042087 | 1.002542 | [
"s171765021",
"s569890035"
] |
u924467864 | p02881 | python | s453046279 | s873427203 | 488 | 283 | 3,060 | 12,488 | Accepted | Accepted | 42.01 | n = int(eval(input()))
i = 1
ans = n
while i * i <= n:
j, m = divmod(n, i)
if m == 0:
ans = min(ans, i + j - 2)
i += 1
print(ans) | import numpy as np
n = int(eval(input()))
a = 1
b = n
ans = n - 1
for i in range(2, int(np.sqrt(n) + 1)):
if n % i == 0:
a = int(i)
b = int(n / i)
ans = min(ans, int(a + b - 2))
print(ans) | 11 | 16 | 157 | 231 | n = int(eval(input()))
i = 1
ans = n
while i * i <= n:
j, m = divmod(n, i)
if m == 0:
ans = min(ans, i + j - 2)
i += 1
print(ans)
| import numpy as np
n = int(eval(input()))
a = 1
b = n
ans = n - 1
for i in range(2, int(np.sqrt(n) + 1)):
if n % i == 0:
a = int(i)
b = int(n / i)
ans = min(ans, int(a + b - 2))
print(ans)
| false | 31.25 | [
"+import numpy as np",
"+",
"-i = 1",
"-ans = n",
"-while i * i <= n:",
"- j, m = divmod(n, i)",
"- if m == 0:",
"- ans = min(ans, i + j - 2)",
"- i += 1",
"+a = 1",
"+b = n",
"+ans = n - 1",
"+for i in range(2, int(np.sqrt(n) + 1)):",
"+ if n % i == 0:",
"+ a =... | false | 0.099742 | 0.382644 | 0.260664 | [
"s453046279",
"s873427203"
] |
u370429022 | p02386 | python | s982749317 | s201115231 | 90 | 50 | 7,356 | 7,356 | Accepted | Accepted | 44.44 | import copy, sys
class Dice(object):
def __init__(self, nums):
self.top, self.front, self.right, self.left, self.back, self.bottom = nums
def roll(self, directions):
if directions == 'E':
self.top, self.right, self.left, self.bottom = self.left, self.top, self.bottom, self.... | import copy, sys
class Dice(object):
def __init__(self, nums):
self.top, self.front, self.right, self.left, self.back, self.bottom = nums
def roll(self, directions):
if directions == 'E':
self.top, self.right, self.left, self.bottom = self.left, self.top, self.bottom, self.... | 60 | 62 | 1,916 | 1,988 | import copy, sys
class Dice(object):
def __init__(self, nums):
self.top, self.front, self.right, self.left, self.back, self.bottom = nums
def roll(self, directions):
if directions == "E":
self.top, self.right, self.left, self.bottom = (
self.left,
s... | import copy, sys
class Dice(object):
def __init__(self, nums):
self.top, self.front, self.right, self.left, self.back, self.bottom = nums
def roll(self, directions):
if directions == "E":
self.top, self.right, self.left, self.bottom = (
self.left,
s... | false | 3.225806 | [
"- dices = []",
"+ dices = [[] for _ in range(600)]",
"- d = Dice([int(_) for _ in input().split()])",
"- for dice in dices:",
"+ nums = [int(_) for _ in input().split()]",
"+ d = Dice(nums)",
"+ s = sum(nums)",
"+ for dice in dices[s]:",
"- dic... | false | 0.03932 | 0.038311 | 1.026328 | [
"s982749317",
"s201115231"
] |
u135389999 | p02642 | python | s532716585 | s235025251 | 1,598 | 459 | 39,948 | 39,444 | Accepted | Accepted | 71.28 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0] * (10 ** 6 + 1)
a.sort()
ans = 0
for i in a:
cnt[i] += 1
a = set(a)
for k in a:
for l in range(k * 2, (10 ** 6 + 1), k):
cnt[l] += 1
for m in a:
if cnt[m] == 1:
ans += 1
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
max_num = a[-1] + 1
cnt = [0] * (max_num)
a.sort()
ans = 0
for i in a:
cnt[i] += 1
a = set(a)
for k in a:
for l in range(k * 2, (max_num), k):
cnt[l] += 1
for m in a:
if cnt[m] == 1:
ans += 1
... | 23 | 25 | 305 | 329 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0] * (10**6 + 1)
a.sort()
ans = 0
for i in a:
cnt[i] += 1
a = set(a)
for k in a:
for l in range(k * 2, (10**6 + 1), k):
cnt[l] += 1
for m in a:
if cnt[m] == 1:
ans += 1
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
max_num = a[-1] + 1
cnt = [0] * (max_num)
a.sort()
ans = 0
for i in a:
cnt[i] += 1
a = set(a)
for k in a:
for l in range(k * 2, (max_num), k):
cnt[l] += 1
for m in a:
if cnt[m] == 1:
ans += 1
print(ans)
| false | 8 | [
"-cnt = [0] * (10**6 + 1)",
"+a.sort()",
"+max_num = a[-1] + 1",
"+cnt = [0] * (max_num)",
"- for l in range(k * 2, (10**6 + 1), k):",
"+ for l in range(k * 2, (max_num), k):"
] | false | 0.215862 | 0.042804 | 5.043028 | [
"s532716585",
"s235025251"
] |
u580806822 | p03294 | python | s516159282 | s348641715 | 154 | 28 | 3,316 | 9,336 | Accepted | Accepted | 81.82 | n=eval(input())
a=[int(i) for i in input().split()]
ac=a[:]
def lcm(x, y):
x2=x
y2=y
while y != 0:
x, y = y, x%y
return (x2 * y2) // x
while(len(ac)>1):
x=ac.pop()
y=ac.pop()
ac.append(lcm(x, y))
g=ac[0]-1
ans=0
for i in a:
ans+=g%i
print(ans)
| [n]=[int(i) for i in input().split()]
li=[int(i) for i in input().split()]
#print(li)
ans=0
for i in li:
ans+=i
print((ans-n)) | 24 | 10 | 307 | 140 | n = eval(input())
a = [int(i) for i in input().split()]
ac = a[:]
def lcm(x, y):
x2 = x
y2 = y
while y != 0:
x, y = y, x % y
return (x2 * y2) // x
while len(ac) > 1:
x = ac.pop()
y = ac.pop()
ac.append(lcm(x, y))
g = ac[0] - 1
ans = 0
for i in a:
ans += g % i
print(ans)
| [n] = [int(i) for i in input().split()]
li = [int(i) for i in input().split()]
# print(li)
ans = 0
for i in li:
ans += i
print((ans - n))
| false | 58.333333 | [
"-n = eval(input())",
"-a = [int(i) for i in input().split()]",
"-ac = a[:]",
"-",
"-",
"-def lcm(x, y):",
"- x2 = x",
"- y2 = y",
"- while y != 0:",
"- x, y = y, x % y",
"- return (x2 * y2) // x",
"-",
"-",
"-while len(ac) > 1:",
"- x = ac.pop()",
"- y = ac.po... | false | 0.040091 | 0.038617 | 1.038169 | [
"s516159282",
"s348641715"
] |
u729133443 | p03737 | python | s652711029 | s989573954 | 164 | 17 | 38,484 | 2,940 | Accepted | Accepted | 89.63 | a,b,c=input().upper().split();print((''.join([a[0],b[0],c[0]]))) | a,*_=zip(*input().upper().split());print(*a,sep='')
| 1 | 1 | 62 | 51 | a, b, c = input().upper().split()
print(("".join([a[0], b[0], c[0]])))
| a, *_ = zip(*input().upper().split())
print(*a, sep="")
| false | 0 | [
"-a, b, c = input().upper().split()",
"-print((\"\".join([a[0], b[0], c[0]])))",
"+a, *_ = zip(*input().upper().split())",
"+print(*a, sep=\"\")"
] | false | 0.040921 | 0.041624 | 0.98312 | [
"s652711029",
"s989573954"
] |
u729133443 | p03071 | python | s349868556 | s921459245 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | a,b=list(map(int,input().split()));print((max(a+a-1,b+b-1,a+b))) | a,b=list(map(int,input().split()));print((max(a,b)*2-(a!=b))) | 1 | 1 | 56 | 53 | a, b = list(map(int, input().split()))
print((max(a + a - 1, b + b - 1, a + b)))
| a, b = list(map(int, input().split()))
print((max(a, b) * 2 - (a != b)))
| false | 0 | [
"-print((max(a + a - 1, b + b - 1, a + b)))",
"+print((max(a, b) * 2 - (a != b)))"
] | false | 0.0358 | 0.033183 | 1.078859 | [
"s349868556",
"s921459245"
] |
u753803401 | p02925 | python | s279034197 | s733546648 | 652 | 552 | 70,236 | 67,420 | Accepted | Accepted | 15.34 | import collections
def slove():
import sys
import collections
input = sys.stdin.readline
n = int(input().rstrip('\n'))
a = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
for i in range(n):
for j in range(n-1):
a[i][j] -= 1
ad = [0] * n
... | import sys
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = [list(map(int, readline().split())) for _ in range(n)]
for i in range(n):
for j in range(n - 1):
a[i][j] -= 1
ls = [0] * n
ql = collect... | 45 | 49 | 1,429 | 1,496 | import collections
def slove():
import sys
import collections
input = sys.stdin.readline
n = int(input().rstrip("\n"))
a = [list(map(int, input().rstrip("\n").split())) for _ in range(n)]
for i in range(n):
for j in range(n - 1):
a[i][j] -= 1
ad = [0] * n
q = colle... | import sys
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = [list(map(int, readline().split())) for _ in range(n)]
for i in range(n):
for j in range(n - 1):
a[i][j] -= 1
ls = [0] * n
ql = collections.deque()
... | false | 8.163265 | [
"+import sys",
"-def slove():",
"- import sys",
"- import collections",
"-",
"- input = sys.stdin.readline",
"- n = int(input().rstrip(\"\\n\"))",
"- a = [list(map(int, input().rstrip(\"\\n\").split())) for _ in range(n)]",
"+def solve():",
"+ readline = sys.stdin.buffer.readline... | false | 0.034576 | 0.036807 | 0.939379 | [
"s279034197",
"s733546648"
] |
u941753895 | p03317 | python | s884714907 | s006227057 | 87 | 68 | 16,296 | 16,296 | Accepted | Accepted | 21.84 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
a,b=... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n,k=... | 27 | 28 | 452 | 441 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 3.571429 | [
"- a, b = LI()",
"+ n, k = LI()",
"- _b = b",
"+ n -= k",
"- if a <= _b:",
"+ if n <= 0:",
"- else:",
"- _b += b - 1",
"- c += 1",
"+ n -= k - 1",
"+ c += 1"
] | false | 0.042204 | 0.037759 | 1.117717 | [
"s884714907",
"s006227057"
] |
u078349616 | p02983 | python | s133172639 | s322421070 | 1,086 | 74 | 3,060 | 3,060 | Accepted | Accepted | 93.19 | L, R = list(map(int,input().split()))
mod = 2019
ans = 2019
if R - L >= 2019:
print((0))
else:
for i in range(L, R):
for j in range(i+1, R+1):
val = ((i%mod) * (j%mod))%mod
ans = min(ans, val)
print(ans) | L, R = list(map(int, input().split()))
tmp = float("INF")
ans = tmp
for i in range(L, R):
for j in range(i+1, R+1):
tmp = (i % 2019) * (j % 2019) % 2019
ans = min(ans, tmp)
if ans == 0:
print((0))
exit()
print(ans) | 12 | 13 | 229 | 252 | L, R = list(map(int, input().split()))
mod = 2019
ans = 2019
if R - L >= 2019:
print((0))
else:
for i in range(L, R):
for j in range(i + 1, R + 1):
val = ((i % mod) * (j % mod)) % mod
ans = min(ans, val)
print(ans)
| L, R = list(map(int, input().split()))
tmp = float("INF")
ans = tmp
for i in range(L, R):
for j in range(i + 1, R + 1):
tmp = (i % 2019) * (j % 2019) % 2019
ans = min(ans, tmp)
if ans == 0:
print((0))
exit()
print(ans)
| false | 7.692308 | [
"-mod = 2019",
"-ans = 2019",
"-if R - L >= 2019:",
"- print((0))",
"-else:",
"- for i in range(L, R):",
"- for j in range(i + 1, R + 1):",
"- val = ((i % mod) * (j % mod)) % mod",
"- ans = min(ans, val)",
"- print(ans)",
"+tmp = float(\"INF\")",
"+ans = t... | false | 0.152706 | 0.036109 | 4.229024 | [
"s133172639",
"s322421070"
] |
u919633157 | p02975 | python | s217955837 | s931337177 | 139 | 57 | 14,708 | 14,212 | Accepted | Accepted | 58.99 | #
n=int(eval(input()))
a=list(map(int,input().split()))
A=set(a[1:])
res=[-1]*n
dct={}
for e in a:
dct[e]=dct.get(e,0)+1
tmp=a[0]
res[0]=tmp
dct[tmp]-=1
for i in range(1,n):
tmp=res[0]^a[i]
if dct.get(tmp,0)>0:
res[1]=a[i]
res[-1]=res[0]^a[i]
dct[res[1]]-=1
... | # ACするけど不正解のやつ
n=int(eval(input()))
a=list(map(int,input().split()))
ans=a[0]
for i in range(1,n):
ans=ans^a[i]
print(('No' if ans else 'Yes')) | 42 | 9 | 649 | 149 | #
n = int(eval(input()))
a = list(map(int, input().split()))
A = set(a[1:])
res = [-1] * n
dct = {}
for e in a:
dct[e] = dct.get(e, 0) + 1
tmp = a[0]
res[0] = tmp
dct[tmp] -= 1
for i in range(1, n):
tmp = res[0] ^ a[i]
if dct.get(tmp, 0) > 0:
res[1] = a[i]
res[-1] = res[0] ^ a[i]
dct... | # ACするけど不正解のやつ
n = int(eval(input()))
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
ans = ans ^ a[i]
print(("No" if ans else "Yes"))
| false | 78.571429 | [
"-#",
"+# ACするけど不正解のやつ",
"-A = set(a[1:])",
"-res = [-1] * n",
"-dct = {}",
"-for e in a:",
"- dct[e] = dct.get(e, 0) + 1",
"-tmp = a[0]",
"-res[0] = tmp",
"-dct[tmp] -= 1",
"+ans = a[0]",
"- tmp = res[0] ^ a[i]",
"- if dct.get(tmp, 0) > 0:",
"- res[1] = a[i]",
"- ... | false | 0.071303 | 0.034932 | 2.041201 | [
"s217955837",
"s931337177"
] |
u623814058 | p02887 | python | s338516077 | s376887964 | 59 | 42 | 9,092 | 8,988 | Accepted | Accepted | 28.81 | eval(input())
S=eval(input())
while True:
x=''
ans=''
for i in S:
if (x==''):
x=i
continue
if x!=i:
ans+=x
x=i
ans+=x
if ans==S:
break
else:
S=ans
print((len(ans))) | eval(input())
S=eval(input())
l=S[0]
c=1
for i in S[1:]:
if l!=i:
c+=1
l=i
print(c) | 19 | 10 | 210 | 86 | eval(input())
S = eval(input())
while True:
x = ""
ans = ""
for i in S:
if x == "":
x = i
continue
if x != i:
ans += x
x = i
ans += x
if ans == S:
break
else:
S = ans
print((len(ans)))
| eval(input())
S = eval(input())
l = S[0]
c = 1
for i in S[1:]:
if l != i:
c += 1
l = i
print(c)
| false | 47.368421 | [
"-while True:",
"- x = \"\"",
"- ans = \"\"",
"- for i in S:",
"- if x == \"\":",
"- x = i",
"- continue",
"- if x != i:",
"- ans += x",
"- x = i",
"- ans += x",
"- if ans == S:",
"- break",
"- else:",
"- ... | false | 0.036941 | 0.036828 | 1.003076 | [
"s338516077",
"s376887964"
] |
u433380437 | p03324 | python | s691844606 | s970856970 | 245 | 60 | 61,548 | 61,704 | Accepted | Accepted | 75.51 | d,n =list(map(int,input().split()))
if d==0:
if n==100:
print((101))
else:
print(n)
else:
if n==100 and d==1:
print((100**1*100+100))
elif n==100 and d==2:
print((100**2*100+10000))
else :
print((100**d*n)) | d,n =list(map(int,input().split()))
if n == 100:
n+=1
print((100**d*n)) | 13 | 4 | 264 | 70 | d, n = list(map(int, input().split()))
if d == 0:
if n == 100:
print((101))
else:
print(n)
else:
if n == 100 and d == 1:
print((100**1 * 100 + 100))
elif n == 100 and d == 2:
print((100**2 * 100 + 10000))
else:
print((100**d * n))
| d, n = list(map(int, input().split()))
if n == 100:
n += 1
print((100**d * n))
| false | 69.230769 | [
"-if d == 0:",
"- if n == 100:",
"- print((101))",
"- else:",
"- print(n)",
"-else:",
"- if n == 100 and d == 1:",
"- print((100**1 * 100 + 100))",
"- elif n == 100 and d == 2:",
"- print((100**2 * 100 + 10000))",
"- else:",
"- print((100**d * ... | false | 0.036394 | 0.045253 | 0.804249 | [
"s691844606",
"s970856970"
] |
u912237403 | p00016 | python | s199281703 | s681093534 | 20 | 10 | 4,444 | 4,436 | Accepted | Accepted | 50 | import math
pi=3.14159265358979
def radians(x):
return 1.0*x/180*pi
x = 0
y = 0
theta = radians(90)
while True:
a, b = list(map(float, input().split(',')))
if a==0 and b==0: break
x += a * math.cos(theta)
y += a * math.sin(theta)
theta += radians(-b)
print(int(x))
print... | import math
pi=3.14159265358979
x = 0
y = 0
theta = math.radians(90)
while True:
a, b = list(map(float, input().split(',')))
if a==0 and b==0: break
x += a * math.cos(theta)
y += a * math.sin(theta)
theta += math.radians(-b)
print(int(x))
print(int(y)) | 19 | 16 | 324 | 286 | import math
pi = 3.14159265358979
def radians(x):
return 1.0 * x / 180 * pi
x = 0
y = 0
theta = radians(90)
while True:
a, b = list(map(float, input().split(",")))
if a == 0 and b == 0:
break
x += a * math.cos(theta)
y += a * math.sin(theta)
theta += radians(-b)
print(int(x))
print(... | import math
pi = 3.14159265358979
x = 0
y = 0
theta = math.radians(90)
while True:
a, b = list(map(float, input().split(",")))
if a == 0 and b == 0:
break
x += a * math.cos(theta)
y += a * math.sin(theta)
theta += math.radians(-b)
print(int(x))
print(int(y))
| false | 15.789474 | [
"-",
"-",
"-def radians(x):",
"- return 1.0 * x / 180 * pi",
"-",
"-",
"-theta = radians(90)",
"+theta = math.radians(90)",
"- theta += radians(-b)",
"+ theta += math.radians(-b)"
] | false | 0.039633 | 0.042242 | 0.938226 | [
"s199281703",
"s681093534"
] |
u945181840 | p03611 | python | s834872129 | s265911664 | 116 | 79 | 14,564 | 13,964 | Accepted | Accepted | 31.9 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
ac = Counter(a)
ans = 0
for i in list(ac.keys()):
ans = max(ans, ac[i] + ac[i + 1] + ac[i - 1])
print(ans) | N = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * (10 ** 5 + 2)
for i in a:
b[i - 1] += 1
b[i] += 1
b[i + 1] += 1
print((max(b))) | 11 | 9 | 202 | 161 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
ac = Counter(a)
ans = 0
for i in list(ac.keys()):
ans = max(ans, ac[i] + ac[i + 1] + ac[i - 1])
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * (10**5 + 2)
for i in a:
b[i - 1] += 1
b[i] += 1
b[i + 1] += 1
print((max(b)))
| false | 18.181818 | [
"-from collections import Counter",
"-",
"-ac = Counter(a)",
"-ans = 0",
"-for i in list(ac.keys()):",
"- ans = max(ans, ac[i] + ac[i + 1] + ac[i - 1])",
"-print(ans)",
"+b = [0] * (10**5 + 2)",
"+for i in a:",
"+ b[i - 1] += 1",
"+ b[i] += 1",
"+ b[i + 1] += 1",
"+print((max(b))... | false | 0.038708 | 0.14264 | 0.27137 | [
"s834872129",
"s265911664"
] |
u762420987 | p03645 | python | s572273693 | s571278724 | 659 | 598 | 38,504 | 18,892 | Accepted | Accepted | 9.26 | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
one_to_other = set([b for a, b in ab if a == 1])
other_to_n = set([a for a, b in ab if b == N])
way = one_to_other & other_to_n
if len(way) >= 1:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| N, M = list(map(int, input().split()))
first = set()
second = set()
for i in range(M):
a, b = list(map(int, input().split()))
if a == 1:
first.add(b)
if b == N:
second.add(a)
if first & second:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| 10 | 15 | 299 | 260 | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
one_to_other = set([b for a, b in ab if a == 1])
other_to_n = set([a for a, b in ab if b == N])
way = one_to_other & other_to_n
if len(way) >= 1:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| N, M = list(map(int, input().split()))
first = set()
second = set()
for i in range(M):
a, b = list(map(int, input().split()))
if a == 1:
first.add(b)
if b == N:
second.add(a)
if first & second:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 33.333333 | [
"-ab = [tuple(map(int, input().split())) for _ in range(M)]",
"-one_to_other = set([b for a, b in ab if a == 1])",
"-other_to_n = set([a for a, b in ab if b == N])",
"-way = one_to_other & other_to_n",
"-if len(way) >= 1:",
"+first = set()",
"+second = set()",
"+for i in range(M):",
"+ a, b = lis... | false | 0.049875 | 0.046565 | 1.071084 | [
"s572273693",
"s571278724"
] |
u272557899 | p02792 | python | s791459834 | s750366666 | 410 | 317 | 70,888 | 5,464 | Accepted | Accepted | 22.68 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left,... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left,... | 82 | 60 | 3,009 | 2,461 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bise... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bise... | false | 26.829268 | [
"- if y == \"0\":",
"+ if y == \"0\": # 0が先頭になるときを考えない",
"- # digit = len(str(i))",
"- if x == y:",
"+ if x == y: # xとyが同じとき3などの一桁の値をとりうるので+1する",
"- if y < nx:",
"- if digit - 2 < 0:",
"- continue",
"- ans += is_full[digit - 2]",
"- ... | false | 0.095716 | 0.096044 | 0.996579 | [
"s791459834",
"s750366666"
] |
u669812251 | p02614 | python | s006978433 | s420087576 | 167 | 59 | 27,508 | 9,028 | Accepted | Accepted | 64.67 | # -*- coding: utf-8 -*-
import numpy as np
import itertools
from copy import deepcopy
H, W , K = [int(i) for i in input().split()]
Arr = np.zeros((H, W))
for i in range(H):
words = eval(input())
for j, w in enumerate(words):
if w == "#":
Arr[i,j] = 1
#print(Arr)
ans = 0
for ... | # -*- coding: utf-8 -*-
from itertools import product
H, W , K = [int(i) for i in input().split()]
c = [list(eval(input())) for _ in range(H)]
ans = 0
for row_bit in product(list(range(2)),repeat=H):
for col_bit in product(list(range(2)),repeat=W):
cnt = 0
for row in range(H):
... | 30 | 17 | 761 | 489 | # -*- coding: utf-8 -*-
import numpy as np
import itertools
from copy import deepcopy
H, W, K = [int(i) for i in input().split()]
Arr = np.zeros((H, W))
for i in range(H):
words = eval(input())
for j, w in enumerate(words):
if w == "#":
Arr[i, j] = 1
# print(Arr)
ans = 0
for t in range(0, H... | # -*- coding: utf-8 -*-
from itertools import product
H, W, K = [int(i) for i in input().split()]
c = [list(eval(input())) for _ in range(H)]
ans = 0
for row_bit in product(list(range(2)), repeat=H):
for col_bit in product(list(range(2)), repeat=W):
cnt = 0
for row in range(H):
for col ... | false | 43.333333 | [
"-import numpy as np",
"-import itertools",
"-from copy import deepcopy",
"+from itertools import product",
"-Arr = np.zeros((H, W))",
"-for i in range(H):",
"- words = eval(input())",
"- for j, w in enumerate(words):",
"- if w == \"#\":",
"- Arr[i, j] = 1",
"-# print(Arr... | false | 0.169352 | 0.038306 | 4.421039 | [
"s006978433",
"s420087576"
] |
u543954314 | p03768 | python | s386996530 | s936844723 | 1,962 | 841 | 57,580 | 43,916 | Accepted | Accepted | 57.14 | import sys
readline = sys.stdin.readline
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
def solve():
n, m = nm()
G = [list() for _ in range(n)]
for _ in range(m):
a, b = nm()
... | import sys
from collections import deque
readline = sys.stdin.readline
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
def solve():
n, m = nm()
G = [list() for _ in range(n)]
for _ in r... | 36 | 39 | 857 | 856 | import sys
readline = sys.stdin.readline
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
def solve():
n, m = nm()
G = [list() for _ in range(n)]
for _ in range(m):
a, b = nm()
... | import sys
from collections import deque
readline = sys.stdin.readline
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
def solve():
n, m = nm()
G = [list() for _ in range(n)]
for _ in range(m)... | false | 7.692308 | [
"+from collections import deque",
"+ color = [0] * n",
"+ dist = [-1] * n",
"- dp = [[Q] * 11 for _ in range(n)]",
"- for i in range(Q - 1, -1, -1):",
"- v, d, _ = queries[i]",
"- dp[v - 1][d] = i",
"- for d in range(10, 0, -1):",
"- for v in range(n):",
"- ... | false | 0.038172 | 0.043179 | 0.884038 | [
"s386996530",
"s936844723"
] |
u445624660 | p03141 | python | s752909390 | s499857837 | 490 | 367 | 26,876 | 34,256 | Accepted | Accepted | 25.1 | n = int(eval(input()))
a, b, c = [], [], []
for i in range(n):
av, bv = list(map(int, input().split()))
a.append(av)
b.append(bv)
c.append((i, av + bv))
c = sorted(c, key=lambda x: x[1], reverse=True)
takahaship, aokip = 0, 0
i = 0
for _ in c:
if i % 2 == 0:
takahaship += a[c[i... | n = int(eval(input()))
sb = 0
a, b, d = [], [], []
for i in range(n):
av, bv = list(map(int, input().split()))
a.append(av)
b.append(bv)
d.append([i, av + bv])
d = sorted(d, key=lambda x: x[1], reverse=True)
tk, ao = 0, 0
for i in range(n):
if i % 2 == 0:
tk += a[d[i][0]]
el... | 18 | 16 | 393 | 353 | n = int(eval(input()))
a, b, c = [], [], []
for i in range(n):
av, bv = list(map(int, input().split()))
a.append(av)
b.append(bv)
c.append((i, av + bv))
c = sorted(c, key=lambda x: x[1], reverse=True)
takahaship, aokip = 0, 0
i = 0
for _ in c:
if i % 2 == 0:
takahaship += a[c[i][0]]
else... | n = int(eval(input()))
sb = 0
a, b, d = [], [], []
for i in range(n):
av, bv = list(map(int, input().split()))
a.append(av)
b.append(bv)
d.append([i, av + bv])
d = sorted(d, key=lambda x: x[1], reverse=True)
tk, ao = 0, 0
for i in range(n):
if i % 2 == 0:
tk += a[d[i][0]]
else:
a... | false | 11.111111 | [
"-a, b, c = [], [], []",
"+sb = 0",
"+a, b, d = [], [], []",
"- c.append((i, av + bv))",
"-c = sorted(c, key=lambda x: x[1], reverse=True)",
"-takahaship, aokip = 0, 0",
"-i = 0",
"-for _ in c:",
"+ d.append([i, av + bv])",
"+d = sorted(d, key=lambda x: x[1], reverse=True)",
"+tk, ao = 0, ... | false | 0.036748 | 0.037891 | 0.96984 | [
"s752909390",
"s499857837"
] |
u694233896 | p02640 | python | s027925465 | s304008424 | 28 | 25 | 9,176 | 9,048 | Accepted | Accepted | 10.71 | import sys
X, Y = list(map(int, input().split()))
if X * 4 < Y or X * 2 > Y:
print("No")
sys.exit()
while (1):
if Y % 4 == 0:
Y = Y - 4
elif Y % 2 == 0:
Y = Y - 2
else:
print("No")
break
if Y == 0:
print("Yes")
break
| import sys
X, Y = list(map(int, input().split()))
if Y % 2 != 0:
print("No")
sys.exit()
else:
for i in range(0, X + 1):
for j in range(0, X + 1 - i):
if i + j == X and (i * 2) + (j * 4) == Y:
print("Yes")
sys.exit()
print("No") | 20 | 14 | 306 | 304 | import sys
X, Y = list(map(int, input().split()))
if X * 4 < Y or X * 2 > Y:
print("No")
sys.exit()
while 1:
if Y % 4 == 0:
Y = Y - 4
elif Y % 2 == 0:
Y = Y - 2
else:
print("No")
break
if Y == 0:
print("Yes")
break
| import sys
X, Y = list(map(int, input().split()))
if Y % 2 != 0:
print("No")
sys.exit()
else:
for i in range(0, X + 1):
for j in range(0, X + 1 - i):
if i + j == X and (i * 2) + (j * 4) == Y:
print("Yes")
sys.exit()
print("No")
| false | 30 | [
"-if X * 4 < Y or X * 2 > Y:",
"+if Y % 2 != 0:",
"-while 1:",
"- if Y % 4 == 0:",
"- Y = Y - 4",
"- elif Y % 2 == 0:",
"- Y = Y - 2",
"- else:",
"- print(\"No\")",
"- break",
"- if Y == 0:",
"- print(\"Yes\")",
"- break",
"+else:",
"... | false | 0.046733 | 0.042437 | 1.101235 | [
"s027925465",
"s304008424"
] |
u588568850 | p03814 | python | s023151595 | s671564666 | 75 | 25 | 3,516 | 3,756 | Accepted | Accepted | 66.67 | s = eval(input())
l = 1000000
r = 0
for i, c in enumerate(s):
if c == "A":
l = min(l, i)
if c == "Z":
r = i
print((r - l + 1)) | import re
s = eval(input())
ans = re.search("A.*Z", s).group()
print((len(ans))) | 9 | 4 | 150 | 75 | s = eval(input())
l = 1000000
r = 0
for i, c in enumerate(s):
if c == "A":
l = min(l, i)
if c == "Z":
r = i
print((r - l + 1))
| import re
s = eval(input())
ans = re.search("A.*Z", s).group()
print((len(ans)))
| false | 55.555556 | [
"+import re",
"+",
"-l = 1000000",
"-r = 0",
"-for i, c in enumerate(s):",
"- if c == \"A\":",
"- l = min(l, i)",
"- if c == \"Z\":",
"- r = i",
"-print((r - l + 1))",
"+ans = re.search(\"A.*Z\", s).group()",
"+print((len(ans)))"
] | false | 0.130706 | 0.041422 | 3.155495 | [
"s023151595",
"s671564666"
] |
u627600101 | p02715 | python | s412492040 | s564737784 | 445 | 389 | 12,092 | 12,240 | Accepted | Accepted | 12.58 | N, K = list(map(int, input().split()))
mod = 10**9 + 7
fact_count = [0 for _ in range(K+1)]
for k in range(1, K+1):
fact_count[k] = K//k
ans = 0
count = [0 for _ in range(K+1)]
for k in range(K, 0, -1):
c = pow(fact_count[k], N, mod)
j = 2*k
l = 2
while(j<=K):
c -= count[j]
l += 1... | #from line_profiler import LineProfiler
N, K = list(map(int, input().split()))
mod = 10**9 + 7
def main():
b = N
blis = []
c = 0
while b >0:
if b & 1 == 1:
blis.append(c)
c += 1
b >>= 1
def modpow(a, blis= blis, c = c):
if a == 1:
return 1
else:
res... | 24 | 55 | 399 | 1,013 | N, K = list(map(int, input().split()))
mod = 10**9 + 7
fact_count = [0 for _ in range(K + 1)]
for k in range(1, K + 1):
fact_count[k] = K // k
ans = 0
count = [0 for _ in range(K + 1)]
for k in range(K, 0, -1):
c = pow(fact_count[k], N, mod)
j = 2 * k
l = 2
while j <= K:
c -= count[j]
... | # from line_profiler import LineProfiler
N, K = list(map(int, input().split()))
mod = 10**9 + 7
def main():
b = N
blis = []
c = 0
while b > 0:
if b & 1 == 1:
blis.append(c)
c += 1
b >>= 1
def modpow(a, blis=blis, c=c):
if a == 1:
return 1
... | false | 56.363636 | [
"+# from line_profiler import LineProfiler",
"-fact_count = [0 for _ in range(K + 1)]",
"-for k in range(1, K + 1):",
"- fact_count[k] = K // k",
"-ans = 0",
"-count = [0 for _ in range(K + 1)]",
"-for k in range(K, 0, -1):",
"- c = pow(fact_count[k], N, mod)",
"- j = 2 * k",
"- l = 2"... | false | 0.262458 | 0.235927 | 1.112457 | [
"s412492040",
"s564737784"
] |
u852690916 | p02922 | python | s761817150 | s664093127 | 176 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.34 | A, B = list(map(int, input().split()))
ans = 0
k = 1
while k < B:
ans += 1
k += A - 1
print(ans) | a,b=list(map(int, input().split()))
k=1
for i in range(1000):
if k>=b:
print(i)
break
k = k - 1 + a
| 8 | 7 | 106 | 124 | A, B = list(map(int, input().split()))
ans = 0
k = 1
while k < B:
ans += 1
k += A - 1
print(ans)
| a, b = list(map(int, input().split()))
k = 1
for i in range(1000):
if k >= b:
print(i)
break
k = k - 1 + a
| false | 12.5 | [
"-A, B = list(map(int, input().split()))",
"-ans = 0",
"+a, b = list(map(int, input().split()))",
"-while k < B:",
"- ans += 1",
"- k += A - 1",
"-print(ans)",
"+for i in range(1000):",
"+ if k >= b:",
"+ print(i)",
"+ break",
"+ k = k - 1 + a"
] | false | 0.097265 | 0.036705 | 2.649932 | [
"s761817150",
"s664093127"
] |
u806976856 | p02861 | python | s258716869 | s009163462 | 334 | 86 | 15,716 | 74,808 | Accepted | Accepted | 74.25 | from itertools import permutations as per
n=int(eval(input()))
ans=[]
l=list(per(list(range(1,n+1))))
xy=[[] for i in range(n+1)]
for i in range(n):
x,y=list(map(int,input().split()))
xy[i+1].append(x)
xy[i+1].append(y)
def f(x):
m=1
while x>0:
m*=x
x=x-1
return m
... | n=int(eval(input()))
x=[]
y=[]
for i in range(n):
a,b=list(map(int,input().split()))
x.append(a)
y.append(b)
p=1
for i in range(n):
p*=i+1
def D(a,b):
a=a-1
b=b-1
return ((x[a]-x[b])**2+(y[a]-y[b])**2)**(0.5)
def f(x):
ans=0
while x>0:
ans+=x%2
... | 24 | 39 | 517 | 685 | from itertools import permutations as per
n = int(eval(input()))
ans = []
l = list(per(list(range(1, n + 1))))
xy = [[] for i in range(n + 1)]
for i in range(n):
x, y = list(map(int, input().split()))
xy[i + 1].append(x)
xy[i + 1].append(y)
def f(x):
m = 1
while x > 0:
m *= x
x = ... | n = int(eval(input()))
x = []
y = []
for i in range(n):
a, b = list(map(int, input().split()))
x.append(a)
y.append(b)
p = 1
for i in range(n):
p *= i + 1
def D(a, b):
a = a - 1
b = b - 1
return ((x[a] - x[b]) ** 2 + (y[a] - y[b]) ** 2) ** (0.5)
def f(x):
ans = 0
while x > 0:
... | false | 38.461538 | [
"-from itertools import permutations as per",
"+n = int(eval(input()))",
"+x = []",
"+y = []",
"+for i in range(n):",
"+ a, b = list(map(int, input().split()))",
"+ x.append(a)",
"+ y.append(b)",
"+p = 1",
"+for i in range(n):",
"+ p *= i + 1",
"-n = int(eval(input()))",
"-ans = ... | false | 0.044919 | 0.043133 | 1.041399 | [
"s258716869",
"s009163462"
] |
u561083515 | p03796 | python | s416394904 | s073137147 | 38 | 35 | 2,940 | 2,940 | Accepted | Accepted | 7.89 | N = int(eval(input()))
power = 1
for i in range(1,N+1):
power = (power*i) % (10**9 + 7)
print(power) | N = int(eval(input()))
MOD = 10**9 +7
ans = 1
for i in range(1,N+1):
ans = (ans * i) % MOD
print(ans) | 8 | 9 | 111 | 111 | N = int(eval(input()))
power = 1
for i in range(1, N + 1):
power = (power * i) % (10**9 + 7)
print(power)
| N = int(eval(input()))
MOD = 10**9 + 7
ans = 1
for i in range(1, N + 1):
ans = (ans * i) % MOD
print(ans)
| false | 11.111111 | [
"-power = 1",
"+MOD = 10**9 + 7",
"+ans = 1",
"- power = (power * i) % (10**9 + 7)",
"-print(power)",
"+ ans = (ans * i) % MOD",
"+print(ans)"
] | false | 0.05003 | 0.053355 | 0.937678 | [
"s416394904",
"s073137147"
] |
u340781749 | p03166 | python | s536557547 | s705560630 | 1,373 | 534 | 238,820 | 120,752 | Accepted | Accepted | 61.11 | import sys
sys.setrecursionlimit(1000000)
def dfs(v):
if cache[v] > -1:
return cache[v]
lv = links[v]
cache[v] = ret = max(list(map(dfs, lv))) + 1 if lv else 0
return ret
n, m = list(map(int, input().split()))
sss = set(range(n))
links = [set() for _ in range(n)]
cache = [-1... | import sys
sys.setrecursionlimit(1000000)
def dfs(v):
if cache[v] > -1:
return cache[v]
lv = links[v]
cache[v] = ret = max(list(map(dfs, lv))) + 1 if lv else 0
return ret
n, m = list(map(int, input().split()))
links = [set() for _ in range(n)]
cache = [-1] * n
for line in sy... | 25 | 23 | 479 | 443 | import sys
sys.setrecursionlimit(1000000)
def dfs(v):
if cache[v] > -1:
return cache[v]
lv = links[v]
cache[v] = ret = max(list(map(dfs, lv))) + 1 if lv else 0
return ret
n, m = list(map(int, input().split()))
sss = set(range(n))
links = [set() for _ in range(n)]
cache = [-1] * n
for line i... | import sys
sys.setrecursionlimit(1000000)
def dfs(v):
if cache[v] > -1:
return cache[v]
lv = links[v]
cache[v] = ret = max(list(map(dfs, lv))) + 1 if lv else 0
return ret
n, m = list(map(int, input().split()))
links = [set() for _ in range(n)]
cache = [-1] * n
for line in sys.stdin.readline... | false | 8 | [
"-sss = set(range(n))",
"- sss.discard(y)",
"-print((max(list(map(dfs, sss)))))",
"+print((max(list(map(dfs, list(range(n)))))))"
] | false | 0.117005 | 0.139274 | 0.840105 | [
"s536557547",
"s705560630"
] |
u497596438 | p02990 | python | s927085567 | s509421954 | 243 | 220 | 45,552 | 42,608 | Accepted | Accepted | 9.47 | def factorials(M):#M!までのリストxと其の逆元のリストyを返すmod INF
INF=int(1e9+7)
fac=[0]*(M+1)
finv=[0]*(M+1)
inv=[0]*(M+1)
fac[0]=fac[1]=1
finv[0]=finv[1]=1
inv[1]=1
for i in range(2,M+1):
fac[i]=(fac[i-1]*i)%INF
inv[i]=INF-(inv[INF%i]*(INF//i))%INF
finv[i]=finv[i-1]*i... | def factorials(M):#M!までのリストxと其の逆元のリストyを返すmod INF
INF=int(1e9+7)
fac=[0]*(M+1)
finv=[0]*(M+1)
inv=[0]*(M+1)
fac[0]=fac[1]=1
finv[0]=finv[1]=1
inv[1]=1
for i in range(2,M+1):
fac[i]=(fac[i-1]*i)%INF
inv[i]=INF-(inv[INF%i]*(INF//i))%INF
finv[i]=finv[i-1]*i... | 26 | 24 | 659 | 631 | def factorials(M): # M!までのリストxと其の逆元のリストyを返すmod INF
INF = int(1e9 + 7)
fac = [0] * (M + 1)
finv = [0] * (M + 1)
inv = [0] * (M + 1)
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, M + 1):
fac[i] = (fac[i - 1] * i) % INF
inv[i] = INF - (inv[INF % i] ... | def factorials(M): # M!までのリストxと其の逆元のリストyを返すmod INF
INF = int(1e9 + 7)
fac = [0] * (M + 1)
finv = [0] * (M + 1)
inv = [0] * (M + 1)
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, M + 1):
fac[i] = (fac[i - 1] * i) % INF
inv[i] = INF - (inv[INF % i] ... | false | 7.692308 | [
"-MOD = 10**9 + 7",
"-fac, finv = factorials(10**5)",
"+fac, finv = factorials(N)",
"- # N-K+1このポケットにi個選ぶ",
"- l = nCr(N - K + 1, i)",
"- s = nCr(K - 1, i - 1)",
"- print(((l * s) % MOD))",
"+ a = nCr(N - K + 1, i)",
"+ b = nCr(K - i + (i - 1), i - 1)",
"+ print(((a * b) % (10... | false | 0.371519 | 0.110146 | 3.372986 | [
"s927085567",
"s509421954"
] |
u729133443 | p03149 | python | s444424865 | s601702814 | 181 | 18 | 38,256 | 2,940 | Accepted | Accepted | 90.06 | s=eval(input());print(('YNEOS'[sum(t in s for t in'1479')<4::2])) | print(('YNEOS'[set(eval(input()))!=set('1974 ')::2])) | 1 | 1 | 57 | 45 | s = eval(input())
print(("YNEOS"[sum(t in s for t in "1479") < 4 :: 2]))
| print(("YNEOS"[set(eval(input())) != set("1974 ") :: 2]))
| false | 0 | [
"-s = eval(input())",
"-print((\"YNEOS\"[sum(t in s for t in \"1479\") < 4 :: 2]))",
"+print((\"YNEOS\"[set(eval(input())) != set(\"1974 \") :: 2]))"
] | false | 0.047394 | 0.034904 | 1.357863 | [
"s444424865",
"s601702814"
] |
u905203728 | p03031 | python | s179336989 | s410074025 | 39 | 32 | 3,188 | 3,188 | Accepted | Accepted | 17.95 | n,m=list(map(int,input().split()))
S=[list(map(int,input().split()))[1:] for i in range(m)]
P=list(map(int,input().split()))
cnt=0
for i in range(2**n):
pattern=format(i,"b").zfill(n)
point=0
for j in range(m):
swi=0
for k in S[j]:
if pattern[k-1]=="1":swi +=1
... | n,m=list(map(int,input().split()))
S=[list(map(int,input().split()))[1:] for i in range(m)]
P=list(map(int,input().split()))
cnt=0
for i in range(2**n):
Q=0
light=set([i+1 for i,j in enumerate(format(i,"b").zfill(n)[::-1]) if j=="1"])
for k,j in enumerate(S):
if len(light&set(j))%2==P[k]:Q... | 14 | 13 | 375 | 353 | n, m = list(map(int, input().split()))
S = [list(map(int, input().split()))[1:] for i in range(m)]
P = list(map(int, input().split()))
cnt = 0
for i in range(2**n):
pattern = format(i, "b").zfill(n)
point = 0
for j in range(m):
swi = 0
for k in S[j]:
if pattern[k - 1] == "1":
... | n, m = list(map(int, input().split()))
S = [list(map(int, input().split()))[1:] for i in range(m)]
P = list(map(int, input().split()))
cnt = 0
for i in range(2**n):
Q = 0
light = set(
[i + 1 for i, j in enumerate(format(i, "b").zfill(n)[::-1]) if j == "1"]
)
for k, j in enumerate(S):
if ... | false | 7.142857 | [
"- pattern = format(i, \"b\").zfill(n)",
"- point = 0",
"- for j in range(m):",
"- swi = 0",
"- for k in S[j]:",
"- if pattern[k - 1] == \"1\":",
"- swi += 1",
"- if swi % 2 == P[j]:",
"- point += 1",
"- if point == m:",
"+ ... | false | 0.118351 | 0.111638 | 1.060129 | [
"s179336989",
"s410074025"
] |
u353797797 | p03806 | python | s493382569 | s563254440 | 1,256 | 69 | 127,764 | 6,256 | Accepted | Accepted | 94.51 | # 半分全列挙バージョン
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [... | from itertools import permutations
import sys
sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
de... | 59 | 42 | 1,652 | 1,254 | # 半分全列挙バージョン
import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):... | from itertools import permutations
import sys
sys.setrecursionlimit(10**6)
from bisect import *
from collections import *
from heapq import *
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split())... | false | 28.813559 | [
"-# 半分全列挙バージョン",
"+from itertools import permutations",
"-int1 = lambda x: int(x) - 1",
"-p2D = lambda x: print(*x, sep=\"\\n\")",
"+from bisect import *",
"+from collections import *",
"+from heapq import *",
"+def SI():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"-def SI():",
"- ... | false | 0.108323 | 0.03727 | 2.906405 | [
"s493382569",
"s563254440"
] |
u353919145 | p03073 | python | s785299107 | s705016592 | 193 | 65 | 48,368 | 3,188 | Accepted | Accepted | 66.32 | import math
import sys
def main():
s = eval(input())
a = [(ch) for ch in s]
ans = 0
for i in range(1, len(a)):
if a[i] == a[i - 1]:
ans += 1
a[i] = ('1' if a[i] == '0' else '0')
print(ans)
if __name__ == '__main__':
sys.exit(main()) | string = eval(input())
predicted_value = 0
last_colour = bool(int(string[0]))
for s in string[1:]:
was_white = bool(int(s))
if last_colour == was_white:
predicted_value += 1
last_colour = not was_white
else:
last_colour = was_white
print(predicted_value) | 18 | 11 | 304 | 294 | import math
import sys
def main():
s = eval(input())
a = [(ch) for ch in s]
ans = 0
for i in range(1, len(a)):
if a[i] == a[i - 1]:
ans += 1
a[i] = "1" if a[i] == "0" else "0"
print(ans)
if __name__ == "__main__":
sys.exit(main())
| string = eval(input())
predicted_value = 0
last_colour = bool(int(string[0]))
for s in string[1:]:
was_white = bool(int(s))
if last_colour == was_white:
predicted_value += 1
last_colour = not was_white
else:
last_colour = was_white
print(predicted_value)
| false | 38.888889 | [
"-import math",
"-import sys",
"-",
"-",
"-def main():",
"- s = eval(input())",
"- a = [(ch) for ch in s]",
"- ans = 0",
"- for i in range(1, len(a)):",
"- if a[i] == a[i - 1]:",
"- ans += 1",
"- a[i] = \"1\" if a[i] == \"0\" else \"0\"",
"- print(... | false | 0.082823 | 0.042772 | 1.936393 | [
"s785299107",
"s705016592"
] |
u186838327 | p02873 | python | s662617312 | s470940488 | 492 | 239 | 31,144 | 77,800 | Accepted | Accepted | 51.42 | s = str(eval(input()))
n = len(s)
l = [0]*(n+1)
temp = 0
for i in range(n):
if s[i] == '<':
temp += 1
l[i+1] = temp
else:
temp = 0
l[i+1] = temp
r = [0]*(n+1)
temp = 0
for i in reversed(list(range(n))):
if s[i] == '>':
temp += 1
r[i] = temp
else:
temp = 0
r[i... | s = str(eval(input()))
n = len(s)
cnt = 0
l = []
for i in range(n):
l.append(cnt)
if s[i] == '<':
cnt += 1
else:
cnt = 0
else:
l.append(cnt)
#print(l)
r = []
cnt = 0
for i in reversed(list(range(n))):
r.append(cnt)
if s[i] == '>':
cnt += 1
else:
... | 28 | 31 | 435 | 460 | s = str(eval(input()))
n = len(s)
l = [0] * (n + 1)
temp = 0
for i in range(n):
if s[i] == "<":
temp += 1
l[i + 1] = temp
else:
temp = 0
l[i + 1] = temp
r = [0] * (n + 1)
temp = 0
for i in reversed(list(range(n))):
if s[i] == ">":
temp += 1
r[i] = temp
els... | s = str(eval(input()))
n = len(s)
cnt = 0
l = []
for i in range(n):
l.append(cnt)
if s[i] == "<":
cnt += 1
else:
cnt = 0
else:
l.append(cnt)
# print(l)
r = []
cnt = 0
for i in reversed(list(range(n))):
r.append(cnt)
if s[i] == ">":
cnt += 1
else:
cnt = 0
else:... | false | 9.677419 | [
"-l = [0] * (n + 1)",
"-temp = 0",
"+cnt = 0",
"+l = []",
"+ l.append(cnt)",
"- temp += 1",
"- l[i + 1] = temp",
"+ cnt += 1",
"- temp = 0",
"- l[i + 1] = temp",
"-r = [0] * (n + 1)",
"-temp = 0",
"+ cnt = 0",
"+else:",
"+ l.append(cnt)",
... | false | 0.070105 | 0.03476 | 2.016822 | [
"s662617312",
"s470940488"
] |
u294721290 | p03804 | python | s958671953 | s883721438 | 160 | 18 | 3,064 | 3,064 | Accepted | Accepted | 88.75 | N,M = list(map(int,input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
#ans = False
for dx in range(N-M+1):
for dy in range(N-M+1):
flg = True
for i in range(M):
for j in range(M):
if A[i+dx][j+dy] != B[i][j]:
... | N,M = list(map(int,input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
for dx in range(N-M+1):
for dy in range(N-M+1):
flg = True
for i in range(M):
if A[i+dx][dy:dy+M] != B[i]:
flg = False
break
if flg:
... | 15 | 14 | 399 | 354 | N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
# ans = False
for dx in range(N - M + 1):
for dy in range(N - M + 1):
flg = True
for i in range(M):
for j in range(M):
if A[i + dx][j + dy] != B[i][j]:
... | N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
for dx in range(N - M + 1):
for dy in range(N - M + 1):
flg = True
for i in range(M):
if A[i + dx][dy : dy + M] != B[i]:
flg = False
break
... | false | 6.666667 | [
"-# ans = False",
"- for j in range(M):",
"- if A[i + dx][j + dy] != B[i][j]:",
"- flg = False",
"+ if A[i + dx][dy : dy + M] != B[i]:",
"+ flg = False",
"+ break"
] | false | 0.106098 | 0.037285 | 2.845575 | [
"s958671953",
"s883721438"
] |
u146803137 | p02898 | python | s094251187 | s463926292 | 82 | 52 | 83,772 | 18,316 | Accepted | Accepted | 36.59 | n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
print((sum(h[i] >= k for i in range(n))))
| n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
ans = sum(h[i] >= k for i in range(n))
print(ans)
| 3 | 4 | 108 | 119 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
print((sum(h[i] >= k for i in range(n))))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
ans = sum(h[i] >= k for i in range(n))
print(ans)
| false | 25 | [
"-print((sum(h[i] >= k for i in range(n))))",
"+ans = sum(h[i] >= k for i in range(n))",
"+print(ans)"
] | false | 0.046695 | 0.036618 | 1.275216 | [
"s094251187",
"s463926292"
] |
u588341295 | p03634 | python | s487792363 | s271088916 | 760 | 692 | 47,020 | 53,700 | Accepted | Accepted | 8.95 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 49 | 50 | 1,314 | 1,342 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 2 | [
"+ans = []",
"- ans = res[x] + res[y]",
"- print(ans)",
"+ ans.append(str(res[x] + res[y]))",
"+print((\"\\n\".join(ans)))"
] | false | 0.03649 | 0.049605 | 0.735627 | [
"s487792363",
"s271088916"
] |
u426108351 | p03160 | python | s777913679 | s887844025 | 225 | 174 | 53,240 | 13,924 | Accepted | Accepted | 22.67 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [1000000001 for i in range(N+1)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print((dp[N-1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [10000000000]*(N)
dp[0] = 0
for i in range(N-2):
dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]))
dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2] - h[i]))
dp[N-1] = min(dp[N-1], dp[N-2] + abs(h[N-1] - h[N-2]))
print((dp[N-1]))
| 8 | 9 | 246 | 295 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [1000000001 for i in range(N + 1)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [10000000000] * (N)
dp[0] = 0
for i in range(N - 2):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
dp[N - 1] = min(dp[N - 1], dp[N - 2] + abs(h[N - 1] - h[N - 2]))
print((dp[N - 1]... | false | 11.111111 | [
"-dp = [1000000001 for i in range(N + 1)]",
"+dp = [10000000000] * (N)",
"-dp[1] = abs(h[1] - h[0])",
"-for i in range(2, N):",
"- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))",
"+for i in range(N - 2):",
"+ dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i])... | false | 0.044264 | 0.044068 | 1.004452 | [
"s777913679",
"s887844025"
] |
u353895424 | p03378 | python | s951676526 | s701099054 | 165 | 30 | 38,256 | 9,048 | Accepted | Accepted | 81.82 | n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans1 = 0
ans2 = 0
for i in range(x+1, n+1):
if i in a:
ans1 += 1
for i in range(x):
if i in a:
ans2 += 1
print((min(ans1, ans2))) | n, m, x = list(map(int, input().split()))
A = list(map(int, input().split()))
start = 0
end = 0
for i in range(x):
if i in A:
start += 1
for i in range(x,n+1):
if i in A:
end += 1
print((min(start, end))) | 12 | 13 | 259 | 234 | n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans1 = 0
ans2 = 0
for i in range(x + 1, n + 1):
if i in a:
ans1 += 1
for i in range(x):
if i in a:
ans2 += 1
print((min(ans1, ans2)))
| n, m, x = list(map(int, input().split()))
A = list(map(int, input().split()))
start = 0
end = 0
for i in range(x):
if i in A:
start += 1
for i in range(x, n + 1):
if i in A:
end += 1
print((min(start, end)))
| false | 7.692308 | [
"-a = list(map(int, input().split()))",
"-ans1 = 0",
"-ans2 = 0",
"-for i in range(x + 1, n + 1):",
"- if i in a:",
"- ans1 += 1",
"+A = list(map(int, input().split()))",
"+start = 0",
"+end = 0",
"- if i in a:",
"- ans2 += 1",
"-print((min(ans1, ans2)))",
"+ if i in A... | false | 0.040209 | 0.036828 | 1.091799 | [
"s951676526",
"s701099054"
] |
u792078574 | p03081 | python | s656456149 | s354285398 | 1,821 | 612 | 41,392 | 40,892 | Accepted | Accepted | 66.39 | N, Q = list(map(int, input().split()))
S = ' ' + eval(input()) + ' '
ps = [0, N+1]
dirs = { 'L': -1, 'R': 1 }
QS = [input().split() for _ in range(Q)]
def drop(p):
for t, d in QS:
if S[p] == t:
p = p + dirs[d]
if p == 0 or p == N+1:
return 1 if p == N+1 else -1
return 0
# 二分探... | N, Q = list(map(int, input().split()))
S = ' ' + eval(input()) + ' '
ps = [0, N+1]
dirs = { 'L': 1, 'R': -1 }
QS = [input().split() for _ in range(Q)][::-1]
p = 0
for t, d in QS:
di = dirs[d]
np = p + di
if 0 <= np <= N+1 and di == 1 and S[np] == t:
p += 1
if 0 <= np <= N+1 and di == -1 and S[p... | 37 | 26 | 602 | 552 | N, Q = list(map(int, input().split()))
S = " " + eval(input()) + " "
ps = [0, N + 1]
dirs = {"L": -1, "R": 1}
QS = [input().split() for _ in range(Q)]
def drop(p):
for t, d in QS:
if S[p] == t:
p = p + dirs[d]
if p == 0 or p == N + 1:
return 1 if p == N + 1 else -1
... | N, Q = list(map(int, input().split()))
S = " " + eval(input()) + " "
ps = [0, N + 1]
dirs = {"L": 1, "R": -1}
QS = [input().split() for _ in range(Q)][::-1]
p = 0
for t, d in QS:
di = dirs[d]
np = p + di
if 0 <= np <= N + 1 and di == 1 and S[np] == t:
p += 1
if 0 <= np <= N + 1 and di == -1 and ... | false | 29.72973 | [
"-dirs = {\"L\": -1, \"R\": 1}",
"-QS = [input().split() for _ in range(Q)]",
"-",
"-",
"-def drop(p):",
"- for t, d in QS:",
"- if S[p] == t:",
"- p = p + dirs[d]",
"- if p == 0 or p == N + 1:",
"- return 1 if p == N + 1 else -1",
"- return 0",
... | false | 0.046083 | 0.046145 | 0.998659 | [
"s656456149",
"s354285398"
] |
u028973125 | p02946 | python | s942043394 | s287662421 | 35 | 28 | 28,012 | 9,160 | Accepted | Accepted | 20 | import sys
def solve(k, x):
min_x = max(-1000000, x - k + 1)
max_x = min(x + k - 1, 1000000)
ans = [i for i in range(min_x, max_x + 1)]
print(" ".join(map(str,ans)))
if __name__ == '__main__':
k, x = list(map(int, sys.stdin.readline().strip().split(" ")))
solve(k, x) | import sys
K, X = list(map(int, sys.stdin.readline().split()))
left = max(-1000000, X - K + 1)
right = min(1000000, X + K - 1)
# print(left, right)
ans = [i for i in range(left, right+1)]
print((*ans)) | 13 | 9 | 289 | 203 | import sys
def solve(k, x):
min_x = max(-1000000, x - k + 1)
max_x = min(x + k - 1, 1000000)
ans = [i for i in range(min_x, max_x + 1)]
print(" ".join(map(str, ans)))
if __name__ == "__main__":
k, x = list(map(int, sys.stdin.readline().strip().split(" ")))
solve(k, x)
| import sys
K, X = list(map(int, sys.stdin.readline().split()))
left = max(-1000000, X - K + 1)
right = min(1000000, X + K - 1)
# print(left, right)
ans = [i for i in range(left, right + 1)]
print((*ans))
| false | 30.769231 | [
"-",
"-def solve(k, x):",
"- min_x = max(-1000000, x - k + 1)",
"- max_x = min(x + k - 1, 1000000)",
"- ans = [i for i in range(min_x, max_x + 1)]",
"- print(\" \".join(map(str, ans)))",
"-",
"-",
"-if __name__ == \"__main__\":",
"- k, x = list(map(int, sys.stdin.readline().strip().... | false | 0.043953 | 0.041547 | 1.057923 | [
"s942043394",
"s287662421"
] |
u167932128 | p02813 | python | s298154021 | s877364719 | 52 | 17 | 8,052 | 3,064 | Accepted | Accepted | 67.31 | n = int(eval(input()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
import itertools
plist = list(itertools.permutations([i+1 for i in range(n)]))
count = 1
resultp = 0
resultq = 0
for pp in plist:
if(list(pp) == p):
resultp = count
if (list(pp) == q):
result... | # 問題文: 大きさ N の順列 ((1, 2, ..., N) を並び替えてできる数列) P, Q があります。大きさ N の順列は N! 通り考えられます。
# このうち、P が辞書順で a 番目に小さく、Q が辞書順で b 番目に小さいとして、|a−b| を求めてください。
# 注記: 2 つの数列 X, Y について、ある整数 k が存在して Xi=Yi (1≤i<k) かつ Xk<Yk が成り立つとき、X は Y より辞書順で小さいと定義されます。
# 制約: 2≤N≤8 P,Qは大きさNの順列である。入力は全て整数である。
import math
# 数列が何番目かを返却するメソッド
... | 15 | 46 | 370 | 1,108 | n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
import itertools
plist = list(itertools.permutations([i + 1 for i in range(n)]))
count = 1
resultp = 0
resultq = 0
for pp in plist:
if list(pp) == p:
resultp = count
if list(pp) == q:
resultq = count
... | # 問題文: 大きさ N の順列 ((1, 2, ..., N) を並び替えてできる数列) P, Q があります。大きさ N の順列は N! 通り考えられます。
# このうち、P が辞書順で a 番目に小さく、Q が辞書順で b 番目に小さいとして、|a−b| を求めてください。
# 注記: 2 つの数列 X, Y について、ある整数 k が存在して Xi=Yi (1≤i<k) かつ Xk<Yk が成り立つとき、X は Y より辞書順で小さいと定義されます。
# 制約: 2≤N≤8 P,Qは大きさNの順列である。入力は全て整数である。
import math
# 数列が何番目かを返却するメソッド
def junba... | false | 67.391304 | [
"-n = int(eval(input()))",
"-p = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"-import itertools",
"+# 問題文: 大きさ N の順列 ((1, 2, ..., N) を並び替えてできる数列) P, Q があります。大きさ N の順列は N! 通り考えられます。",
"+# このうち、P が辞書順で a 番目に小さく、Q が辞書順で b 番目に小さいとして、|a−b| を求めてください。",
"+# 注記: 2 つの数列 X, Y... | false | 0.034248 | 0.042691 | 0.802232 | [
"s298154021",
"s877364719"
] |
u131638468 | p03682 | python | s906452698 | s830863934 | 1,760 | 1,471 | 62,700 | 69,088 | Accepted | Accepted | 16.42 | n=int(eval(input()))
x=[]
y=[]
for i in range(n):
xx,yy=list(map(int,input().split()))
x.append([xx,i])
y.append([yy,i])
x.sort()
y.sort()
px=[[x1-x0,i0,i1] for (x0,i0),(x1,i1) in zip(x,x[1:])]
py=[[y1-y0,i0,i1] for (y0,i0),(y1,i1) in zip(y,y[1:])]
p=px+py
x=[]
y=[]
px=[]
py=[]
p.sort()
r=[i for ... | n,*xy=list(map(int,open(0).read().split()))
x=[[xx,i] for i,xx in enumerate(xy[::2])]
y=[[yy,i] for i,yy in enumerate(xy[1::2])]
x.sort()
y.sort()
px=[[x1-x0,i0,i1] for (x0,i0),(x1,i1) in zip(x,x[1:])]
py=[[y1-y0,i0,i1] for (y0,i0),(y1,i1) in zip(y,y[1:])]
p=px+py
x=[]
y=[]
px=[]
py=[]
p.sort()
r=[i for i ... | 42 | 38 | 741 | 745 | n = int(eval(input()))
x = []
y = []
for i in range(n):
xx, yy = list(map(int, input().split()))
x.append([xx, i])
y.append([yy, i])
x.sort()
y.sort()
px = [[x1 - x0, i0, i1] for (x0, i0), (x1, i1) in zip(x, x[1:])]
py = [[y1 - y0, i0, i1] for (y0, i0), (y1, i1) in zip(y, y[1:])]
p = px + py
x = []
y = []
p... | n, *xy = list(map(int, open(0).read().split()))
x = [[xx, i] for i, xx in enumerate(xy[::2])]
y = [[yy, i] for i, yy in enumerate(xy[1::2])]
x.sort()
y.sort()
px = [[x1 - x0, i0, i1] for (x0, i0), (x1, i1) in zip(x, x[1:])]
py = [[y1 - y0, i0, i1] for (y0, i0), (y1, i1) in zip(y, y[1:])]
p = px + py
x = []
y = []
px = ... | false | 9.52381 | [
"-n = int(eval(input()))",
"-x = []",
"-y = []",
"-for i in range(n):",
"- xx, yy = list(map(int, input().split()))",
"- x.append([xx, i])",
"- y.append([yy, i])",
"+n, *xy = list(map(int, open(0).read().split()))",
"+x = [[xx, i] for i, xx in enumerate(xy[::2])]",
"+y = [[yy, i] for i, y... | false | 0.046482 | 0.046782 | 0.993589 | [
"s906452698",
"s830863934"
] |
u353797797 | p03040 | python | s490904243 | s050665515 | 1,629 | 1,429 | 19,064 | 19,068 | Accepted | Accepted | 12.28 | # youtube
from heapq import *
q = int(eval(input()))
sum_a = 0
sum_b = 0
L = []
R = []
for _ in range(q):
qi = list(map(int, input().split()))
if qi[0] == 1:
a = qi[1]
heappush(L, -a)
heappush(R, a)
if -L[0] > R[0]:
LtoR = -heappop(L)
RtoL... | from heapq import *
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): r... | 23 | 43 | 497 | 1,232 | # youtube
from heapq import *
q = int(eval(input()))
sum_a = 0
sum_b = 0
L = []
R = []
for _ in range(q):
qi = list(map(int, input().split()))
if qi[0] == 1:
a = qi[1]
heappush(L, -a)
heappush(R, a)
if -L[0] > R[0]:
LtoR = -heappop(L)
RtoL = heappop(R)
... | from heapq import *
import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_n... | false | 46.511628 | [
"-# youtube",
"+import sys",
"-q = int(eval(input()))",
"-sum_a = 0",
"-sum_b = 0",
"-L = []",
"-R = []",
"-for _ in range(q):",
"- qi = list(map(int, input().split()))",
"- if qi[0] == 1:",
"- a = qi[1]",
"- heappush(L, -a)",
"- heappush(R, a)",
"- if -L[... | false | 0.041982 | 0.042245 | 0.993777 | [
"s490904243",
"s050665515"
] |
u797016134 | p03290 | python | s754122988 | s900543634 | 25 | 19 | 3,064 | 3,064 | Accepted | Accepted | 24 | d,g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
for bit in range(1 << d):
total = 0
count = 0
left = set(range(1, d+1))
for i in range(d):
if bit & (1 << i):
total += pc[i][0] * 100 * (i+1) + pc[i][1]
... | def dfs(i, total, count, left):
global ans
if i == d:
if total < g:
target = max(left)
n = min(pc[target - 1][0], -(-(g - total) // (target * 100)))
count += n
total += n * target * 100
if total >= g:
ans = min(ans, count)
... | 28 | 24 | 665 | 637 | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
for bit in range(1 << d):
total = 0
count = 0
left = set(range(1, d + 1))
for i in range(d):
if bit & (1 << i):
total += pc[i][0] * 100 * (i + 1) + pc[i][1]
... | def dfs(i, total, count, left):
global ans
if i == d:
if total < g:
target = max(left)
n = min(pc[target - 1][0], -(-(g - total) // (target * 100)))
count += n
total += n * target * 100
if total >= g:
ans = min(ans, count)
else:
... | false | 14.285714 | [
"+def dfs(i, total, count, left):",
"+ global ans",
"+ if i == d:",
"+ if total < g:",
"+ target = max(left)",
"+ n = min(pc[target - 1][0], -(-(g - total) // (target * 100)))",
"+ count += n",
"+ total += n * target * 100",
"+ if total... | false | 0.046723 | 0.047288 | 0.988032 | [
"s754122988",
"s900543634"
] |
u254871849 | p03835 | python | s179973454 | s424942885 | 787 | 18 | 2,940 | 3,060 | Accepted | Accepted | 97.71 | # author: kagemeka
# created: 2019-11-08 23:31:18(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator... | # author: kagemeka
# created: 2019-11-08 23:31:18(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator... | 36 | 37 | 820 | 797 | # author: kagemeka
# created: 2019-11-08 23:31:18(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from exte... | # author: kagemeka
# created: 2019-11-08 23:31:18(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from exte... | false | 2.702703 | [
"- if 0 <= s - x <= k * 2: # s - x = y + z",
"- for y in range(k + 1):",
"- if 0 <= s - x - y <= k:",
"- count += 1",
"+ if 0 <= s - x <= k:",
"+ count += s - x + 1",
"+ elif k < s - x <= 2 * k:",
"+ count += k - ... | false | 0.039943 | 0.033353 | 1.197574 | [
"s179973454",
"s424942885"
] |
u025501820 | p02733 | python | s176635570 | s899461469 | 561 | 300 | 54,620 | 44,268 | Accepted | Accepted | 46.52 | from itertools import product
H, W, K = list(map(int, input().split()))
G = [list(map(int, list(eval(input())))) for _ in range(H)]
ans = float("inf")
for pattern in product([0, 1], repeat = H - 1):
div = [0] + [i for i, p in enumerate(pattern, 1) if p == 1] + [H]
rows = []
for i in range(len(div... | import sys
#da[i][j]:(0,0)~(i,j)の長方形の和
def da_generate(h, w, a):
da = [[0] * w for j in range(h)]
da[0][0] = a[0][0]
for i in range(1, w):
da[0][i] = da[0][i - 1] + a[0][i]
for i in range(1, h):
cnt_w = 0
for j in range(w):
cnt_w += a[i][j]
da... | 43 | 58 | 1,052 | 1,523 | from itertools import product
H, W, K = list(map(int, input().split()))
G = [list(map(int, list(eval(input())))) for _ in range(H)]
ans = float("inf")
for pattern in product([0, 1], repeat=H - 1):
div = [0] + [i for i, p in enumerate(pattern, 1) if p == 1] + [H]
rows = []
for i in range(len(div) - 1):
... | import sys
# da[i][j]:(0,0)~(i,j)の長方形の和
def da_generate(h, w, a):
da = [[0] * w for j in range(h)]
da[0][0] = a[0][0]
for i in range(1, w):
da[0][i] = da[0][i - 1] + a[0][i]
for i in range(1, h):
cnt_w = 0
for j in range(w):
cnt_w += a[i][j]
da[i][j] = da... | false | 25.862069 | [
"-from itertools import product",
"+import sys",
"-H, W, K = list(map(int, input().split()))",
"-G = [list(map(int, list(eval(input())))) for _ in range(H)]",
"-ans = float(\"inf\")",
"-for pattern in product([0, 1], repeat=H - 1):",
"- div = [0] + [i for i, p in enumerate(pattern, 1) if p == 1] + [H... | false | 0.038918 | 0.035572 | 1.094057 | [
"s176635570",
"s899461469"
] |
u759938562 | p02845 | python | s632832191 | s914055243 | 131 | 120 | 14,396 | 14,396 | Accepted | Accepted | 8.4 | N = int(eval(input()))
A = list(map(int, input().split()))
c = [-1, -1 ,-1]
sum = 1
tmp = 0
for i in range(N):
sum = sum * c.count(A[i]-1) % 1000000007
if (A[i]-1) == c[0]:
c[0] += 1
tmp = c.count(c[0] - 1) + 1
elif (A[i]-1) == c[1]:
c[1] += 1
tmp = c.count(c[... | N = int(eval(input()))
A = list(map(int, input().split()))
c = [-1, -1 ,-1]
sum = 1
tmp = 0
for a in A:
sum = sum * c.count(a-1) % 1000000007
if a-1 == c[0]:
c[0] += 1
tmp = c.count(c[0] - 1) + 1
elif a-1 == c[1]:
c[1] += 1
tmp = c.count(c[1]-1) + 1
elif ... | 19 | 19 | 420 | 395 | N = int(eval(input()))
A = list(map(int, input().split()))
c = [-1, -1, -1]
sum = 1
tmp = 0
for i in range(N):
sum = sum * c.count(A[i] - 1) % 1000000007
if (A[i] - 1) == c[0]:
c[0] += 1
tmp = c.count(c[0] - 1) + 1
elif (A[i] - 1) == c[1]:
c[1] += 1
tmp = c.count(c[1] - 1) + ... | N = int(eval(input()))
A = list(map(int, input().split()))
c = [-1, -1, -1]
sum = 1
tmp = 0
for a in A:
sum = sum * c.count(a - 1) % 1000000007
if a - 1 == c[0]:
c[0] += 1
tmp = c.count(c[0] - 1) + 1
elif a - 1 == c[1]:
c[1] += 1
tmp = c.count(c[1] - 1) + 1
elif a - 1 == ... | false | 0 | [
"-for i in range(N):",
"- sum = sum * c.count(A[i] - 1) % 1000000007",
"- if (A[i] - 1) == c[0]:",
"+for a in A:",
"+ sum = sum * c.count(a - 1) % 1000000007",
"+ if a - 1 == c[0]:",
"- elif (A[i] - 1) == c[1]:",
"+ elif a - 1 == c[1]:",
"- elif (A[i] - 1) == c[2]:",
"+ eli... | false | 0.044284 | 0.080327 | 0.551301 | [
"s632832191",
"s914055243"
] |
u197956883 | p03752 | python | s165018439 | s734988871 | 217 | 196 | 42,860 | 40,924 | Accepted | Accepted | 9.68 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10**19
for bit in range(2**N):
if bin(bit).count('1') != K:
continue
cost, height = 0, 0
for i in range(N):
if bit & (1 << i) == 0:
if height < a[i]:
height = a[i]
... | def main():
n, k = list(map(int, input().split()))
num_list = list(map(int, input().split()))
ans = 10**19
for bit in range(2**n):
if bin(bit).count('1') != k:
continue
tmp = 0
max_hight = 0
for i in range(n):
if bit & (1 << i) == 0:
... | 24 | 31 | 521 | 829 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10**19
for bit in range(2**N):
if bin(bit).count("1") != K:
continue
cost, height = 0, 0
for i in range(N):
if bit & (1 << i) == 0:
if height < a[i]:
height = a[i]
continu... | def main():
n, k = list(map(int, input().split()))
num_list = list(map(int, input().split()))
ans = 10**19
for bit in range(2**n):
if bin(bit).count("1") != k:
continue
tmp = 0
max_hight = 0
for i in range(n):
if bit & (1 << i) == 0:
... | false | 22.580645 | [
"-N, K = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-ans = 10**19",
"-for bit in range(2**N):",
"- if bin(bit).count(\"1\") != K:",
"- continue",
"- cost, height = 0, 0",
"- for i in range(N):",
"- if bit & (1 << i) == 0:",
"- if he... | false | 0.036416 | 0.035149 | 1.036029 | [
"s165018439",
"s734988871"
] |
u884087839 | p02682 | python | s719165733 | s367436285 | 25 | 22 | 9,204 | 8,920 | Accepted | Accepted | 12 | #!/usr/bin/env python3
import sys
def solve(A: int, B: int, C: int, K: int):
sum = 0
l = K - A
if l <= 0:
sum += K
else:
sum += A
l -= B
if l > 0:
sum -= l
print(sum)
return
# Generated by 1.1.6 https://github.com/kyuriden... | #!/usr/bin/env python3
import sys
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)
def main():
A, B, C, K = list(map(int, input().split()))
score = min(K, A) * 1
K -= A + B
if K ... | 35 | 13 | 833 | 397 | #!/usr/bin/env python3
import sys
def solve(A: int, B: int, C: int, K: int):
sum = 0
l = K - A
if l <= 0:
sum += K
else:
sum += A
l -= B
if l > 0:
sum -= l
print(sum)
return
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use th... | #!/usr/bin/env python3
import sys
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)
def main():
A, B, C, K = list(map(int, input().split()))
score = min(K, A) * 1
K -= A + B
if K > 0:
... | false | 62.857143 | [
"-",
"-def solve(A: int, B: int, C: int, K: int):",
"- sum = 0",
"- l = K - A",
"- if l <= 0:",
"- sum += K",
"- else:",
"- sum += A",
"- l -= B",
"- if l > 0:",
"- sum -= l",
"- print(sum)",
"- return",
"-",
"-",
"- def iterate_tokens():... | false | 0.047776 | 0.047691 | 1.00178 | [
"s719165733",
"s367436285"
] |
u729133443 | p03987 | python | s790930232 | s647518270 | 964 | 205 | 25,872 | 34,512 | Accepted | Accepted | 78.73 | from bisect import*
class SquareSkipList:
def __init__(self,values=[],square=1000,seed=42):
INF=10**18
self.square=square
self.layer1=layer1=[]
self.layer0=layer0=[]
y=seed
l0=[]
for v in values:
y^=(y&0x7ffff)<<13
y^=y>>17
... | code = r"""
# distutils: language=c++
from libcpp.set cimport set
from libcpp.vector cimport vector
from libcpp.iterator cimport iterator
from cython.operator cimport dereference as deref, predecrement as dec
cdef int n = int(input()), i
cdef long c
cdef iterator it, jt
cdef vector[long] a = [*map(int, input()... | 83 | 23 | 2,592 | 743 | from bisect import *
class SquareSkipList:
def __init__(self, values=[], square=1000, seed=42):
INF = 10**18
self.square = square
self.layer1 = layer1 = []
self.layer0 = layer0 = []
y = seed
l0 = []
for v in values:
y ^= (y & 0x7FFFF) << 13
... | code = r"""
# distutils: language=c++
from libcpp.set cimport set
from libcpp.vector cimport vector
from libcpp.iterator cimport iterator
from cython.operator cimport dereference as deref, predecrement as dec
cdef int n = int(input()), i
cdef long c
cdef iterator it, jt
cdef vector[long] a = [*map(int, input().split())... | false | 72.289157 | [
"-from bisect import *",
"+code = r\"\"\"",
"+# distutils: language=c++",
"+from libcpp.set cimport set",
"+from libcpp.vector cimport vector",
"+from libcpp.iterator cimport iterator",
"+from cython.operator cimport dereference as deref, predecrement as dec",
"+cdef int n = int(input()), i",
"+cdef... | false | 0.039332 | 0.037393 | 1.051845 | [
"s790930232",
"s647518270"
] |
u241159583 | p03610 | python | s887019730 | s092410024 | 41 | 19 | 3,188 | 3,188 | Accepted | Accepted | 53.66 | s = eval(input())
ans = ""
for i in range(len(s)):
if (i+1) % 2 != 0:
ans += s[i]
print(ans) | s = eval(input())
print((s[::2])) | 8 | 2 | 103 | 26 | s = eval(input())
ans = ""
for i in range(len(s)):
if (i + 1) % 2 != 0:
ans += s[i]
print(ans)
| s = eval(input())
print((s[::2]))
| false | 75 | [
"-ans = \"\"",
"-for i in range(len(s)):",
"- if (i + 1) % 2 != 0:",
"- ans += s[i]",
"-print(ans)",
"+print((s[::2]))"
] | false | 0.046843 | 0.042973 | 1.090069 | [
"s887019730",
"s092410024"
] |
u183896397 | p03252 | python | s170612533 | s860578340 | 252 | 88 | 3,632 | 19,248 | Accepted | Accepted | 65.08 | s = eval(input())
t = eval(input())
alfa = list('abcdefghijklmnopqrstuvwxyz')
s_count = [0 for i in range(26)]
t_count = [0 for i in range(26)]
for i in range(len(s)):
x = alfa.index(s[i])
y = alfa.index(t[i])
s_count[x] += 1
t_count[y] += 1
s_count.sort()
t_count.sort()
if s_count == t_coun... | s = list(eval(input()))
t = list(eval(input()))
s_len = len(set(s))
t_len = len(set(t))
pare = []
for i,j in zip(s,t):
pare.append(i+j)
if len(set(pare)) == s_len == t_len:
print('Yes')
else:
print('No')
| 16 | 12 | 353 | 216 | s = eval(input())
t = eval(input())
alfa = list("abcdefghijklmnopqrstuvwxyz")
s_count = [0 for i in range(26)]
t_count = [0 for i in range(26)]
for i in range(len(s)):
x = alfa.index(s[i])
y = alfa.index(t[i])
s_count[x] += 1
t_count[y] += 1
s_count.sort()
t_count.sort()
if s_count == t_count:
print... | s = list(eval(input()))
t = list(eval(input()))
s_len = len(set(s))
t_len = len(set(t))
pare = []
for i, j in zip(s, t):
pare.append(i + j)
if len(set(pare)) == s_len == t_len:
print("Yes")
else:
print("No")
| false | 25 | [
"-s = eval(input())",
"-t = eval(input())",
"-alfa = list(\"abcdefghijklmnopqrstuvwxyz\")",
"-s_count = [0 for i in range(26)]",
"-t_count = [0 for i in range(26)]",
"-for i in range(len(s)):",
"- x = alfa.index(s[i])",
"- y = alfa.index(t[i])",
"- s_count[x] += 1",
"- t_count[y] += 1"... | false | 0.046254 | 0.045851 | 1.008783 | [
"s170612533",
"s860578340"
] |
u658993896 | p03700 | python | s681940543 | s801480462 | 1,499 | 1,133 | 7,068 | 7,068 | Accepted | Accepted | 24.42 | import math
N,A,B=list(map(int,input().split()))
arr=[]
for i in range(N):
arr.append(int(eval(input())))
max_=max(arr)//B+1
min_=min(arr)//A
d=A-B
while min_!=max_:
mid=(max_+min_)//2
sum_=0
for x in arr:
y=(x-mid*B)
if y<=0:
continu... | import math
N,A,B=list(map(int,input().split()))
arr=[]
h_sum=0
for i in range(N):
h=int(eval(input()))
arr.append(h)
h_sum+=h
max_=max(arr)//B+1
min_=h_sum//(A+B*(N-1))
d=A-B
while min_!=max_:
mid=(max_+min_)//2
sum_=0
for x in arr:
y=(x-mid*B)
if y... | 29 | 31 | 438 | 463 | import math
N, A, B = list(map(int, input().split()))
arr = []
for i in range(N):
arr.append(int(eval(input())))
max_ = max(arr) // B + 1
min_ = min(arr) // A
d = A - B
while min_ != max_:
mid = (max_ + min_) // 2
sum_ = 0
for x in arr:
y = x - mid * B
if y <= 0:
continue
... | import math
N, A, B = list(map(int, input().split()))
arr = []
h_sum = 0
for i in range(N):
h = int(eval(input()))
arr.append(h)
h_sum += h
max_ = max(arr) // B + 1
min_ = h_sum // (A + B * (N - 1))
d = A - B
while min_ != max_:
mid = (max_ + min_) // 2
sum_ = 0
for x in arr:
y = x - mi... | false | 6.451613 | [
"+h_sum = 0",
"- arr.append(int(eval(input())))",
"+ h = int(eval(input()))",
"+ arr.append(h)",
"+ h_sum += h",
"-min_ = min(arr) // A",
"+min_ = h_sum // (A + B * (N - 1))"
] | false | 0.066138 | 0.066282 | 0.997833 | [
"s681940543",
"s801480462"
] |
u247366051 | p03548 | python | s044240693 | s261409823 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a = input().split()
print(((int(a[0]) - int(a[2])) // (int(a[1]) + int(a[2]))))
| x,y,z=input().split()
print(((int(x)-int(z))//(int(y)+int(z))))
| 3 | 2 | 81 | 63 | a = input().split()
print(((int(a[0]) - int(a[2])) // (int(a[1]) + int(a[2]))))
| x, y, z = input().split()
print(((int(x) - int(z)) // (int(y) + int(z))))
| false | 33.333333 | [
"-a = input().split()",
"-print(((int(a[0]) - int(a[2])) // (int(a[1]) + int(a[2]))))",
"+x, y, z = input().split()",
"+print(((int(x) - int(z)) // (int(y) + int(z))))"
] | false | 0.044925 | 0.043288 | 1.037833 | [
"s044240693",
"s261409823"
] |
u188827677 | p02785 | python | s637458866 | s309938736 | 181 | 159 | 26,180 | 26,024 | Accepted | Accepted | 12.15 | n,k = list(map(int, input().split()))
h = list(map(int, input().split()))
h = sorted(h, reverse = True)
s = 0
t = 0
for i in h:
if t < k:
t += 1
continue
s += i
print(s) | n,k = list(map(int, input().split()))
h = sorted(list(map(int, input().split())), reverse=True)
print((sum(h[k:]))) | 13 | 4 | 189 | 111 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h = sorted(h, reverse=True)
s = 0
t = 0
for i in h:
if t < k:
t += 1
continue
s += i
print(s)
| n, k = list(map(int, input().split()))
h = sorted(list(map(int, input().split())), reverse=True)
print((sum(h[k:])))
| false | 69.230769 | [
"-h = list(map(int, input().split()))",
"-h = sorted(h, reverse=True)",
"-s = 0",
"-t = 0",
"-for i in h:",
"- if t < k:",
"- t += 1",
"- continue",
"- s += i",
"-print(s)",
"+h = sorted(list(map(int, input().split())), reverse=True)",
"+print((sum(h[k:])))"
] | false | 0.040276 | 0.090444 | 0.445317 | [
"s637458866",
"s309938736"
] |
u492910842 | p02766 | python | s147672293 | s237630879 | 71 | 64 | 61,804 | 62,164 | Accepted | Accepted | 9.86 | n,k=list(map(int,input().split()))
ans=0
while n!=0:
n//=k
ans+=1
print(ans)
| import math
n,k=list(map(int,input().split()))
print((int(math.log(n,k))+1)) | 6 | 3 | 80 | 70 | n, k = list(map(int, input().split()))
ans = 0
while n != 0:
n //= k
ans += 1
print(ans)
| import math
n, k = list(map(int, input().split()))
print((int(math.log(n, k)) + 1))
| false | 50 | [
"+import math",
"+",
"-ans = 0",
"-while n != 0:",
"- n //= k",
"- ans += 1",
"-print(ans)",
"+print((int(math.log(n, k)) + 1))"
] | false | 0.04323 | 0.043308 | 0.998202 | [
"s147672293",
"s237630879"
] |
u780698286 | p03041 | python | s982105011 | s798551533 | 29 | 25 | 9,108 | 9,052 | Accepted | Accepted | 13.79 | n, k = map(int, input().split())
s = input()
for i in range(n):
if i == k-1:
print(s[i].lower(),end="")
else:
print(s[i],end="")
| n, k = list(map(int, input().split()))
s = eval(input())
print((s[:k-1]+s[k-1].lower()+s[k:])) | 7 | 3 | 146 | 82 | n, k = map(int, input().split())
s = input()
for i in range(n):
if i == k - 1:
print(s[i].lower(), end="")
else:
print(s[i], end="")
| n, k = list(map(int, input().split()))
s = eval(input())
print((s[: k - 1] + s[k - 1].lower() + s[k:]))
| false | 57.142857 | [
"-n, k = map(int, input().split())",
"-s = input()",
"-for i in range(n):",
"- if i == k - 1:",
"- print(s[i].lower(), end=\"\")",
"- else:",
"- print(s[i], end=\"\")",
"+n, k = list(map(int, input().split()))",
"+s = eval(input())",
"+print((s[: k - 1] + s[k - 1].lower() + s[k... | false | 0.121153 | 0.041155 | 2.943788 | [
"s982105011",
"s798551533"
] |
u143492911 | p03137 | python | s551133690 | s358432183 | 126 | 116 | 13,968 | 13,968 | Accepted | Accepted | 7.94 | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
ans=[]
if m==1:
print((0))
exit()
if n==1:
print((max(a)-min(a)))
exit()
for i in range(m-1):
ans.append(abs(a[i+1]-a[i]))
total=0
ans.sort(reverse=True)
if len(ans)<=n:
print((0))
exit()
for i in r... | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
d=[]
for i in range(m-1):
d.append(a[i+1]-a[i])
d.sort()
total=0
for i in range(m-n):
total+=d[i]
print(total)
| 20 | 11 | 361 | 200 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
ans = []
if m == 1:
print((0))
exit()
if n == 1:
print((max(a) - min(a)))
exit()
for i in range(m - 1):
ans.append(abs(a[i + 1] - a[i]))
total = 0
ans.sort(reverse=True)
if len(ans) <= n:
print((0))
exit()
fo... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
d = []
for i in range(m - 1):
d.append(a[i + 1] - a[i])
d.sort()
total = 0
for i in range(m - n):
total += d[i]
print(total)
| false | 45 | [
"-ans = []",
"-if m == 1:",
"- print((0))",
"- exit()",
"-if n == 1:",
"- print((max(a) - min(a)))",
"- exit()",
"+d = []",
"- ans.append(abs(a[i + 1] - a[i]))",
"+ d.append(a[i + 1] - a[i])",
"+d.sort()",
"-ans.sort(reverse=True)",
"-if len(ans) <= n:",
"- print((0))"... | false | 0.059655 | 0.038306 | 1.557305 | [
"s551133690",
"s358432183"
] |
u498487134 | p02954 | python | s126845105 | s699579135 | 197 | 119 | 51,184 | 84,356 | Accepted | Accepted | 39.59 | S=eval(input())
N=len(S)
ans=[0]*N
S+="R"
RL=0
LR=0
for i in range(1,N+1):
if S[i-1]=="R" and S[i]=="L":
RL=i
elif S[i-1]=="L" and S[i]=="R":
LR_next=i
length=LR_next-LR
if length%2==0:
ans[RL-1]=length//2
ans[RL]=length//2
else:... |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
import bisect
mod=10**9+7
S=eval(input())
N=len(S)
R=[]
L=[]
for i in range(N):
if S[i]=="R":
R.append(i)
... | 27 | 48 | 581 | 978 | S = eval(input())
N = len(S)
ans = [0] * N
S += "R"
RL = 0
LR = 0
for i in range(1, N + 1):
if S[i - 1] == "R" and S[i] == "L":
RL = i
elif S[i - 1] == "L" and S[i] == "R":
LR_next = i
length = LR_next - LR
if length % 2 == 0:
ans[RL - 1] = length // 2
ans... | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
import bisect
mod = 10**9 + 7
S = eval(input())
N = len(S)
R = []
L = []
for i in range(N):
if S[i] == "R":
... | false | 43.75 | [
"-S = eval(input())",
"-N = len(S)",
"-ans = [0] * N",
"-S += \"R\"",
"-RL = 0",
"-LR = 0",
"-for i in range(1, N + 1):",
"- if S[i - 1] == \"R\" and S[i] == \"L\":",
"- RL = i",
"- elif S[i - 1] == \"L\" and S[i] == \"R\":",
"- LR_next = i",
"- length = LR_next - LR... | false | 0.036879 | 0.037943 | 0.971965 | [
"s126845105",
"s699579135"
] |
u342537066 | p00009 | python | s808152794 | s089648361 | 2,670 | 2,260 | 14,552 | 14,584 | Accepted | Accepted | 15.36 | lis=[1 for i in range(int(1e6+1))]
lis[0]=lis[1]=0
for i in range(int(1e6)+1):
if lis[i]:
for j in range(i*2,int(1e6+1),i):
lis[j]=0
while True:
try:
n=int(eval(input()))
cnt=0
for i in range(n+1):
if lis[i]:
cnt+=1
... | lis=[True for i in range(int(1e6+1))]
lis[0]=lis[1]=False
end=int(1e6**0.5)
for i in range(end+1):
if lis[i]:
for j in range(i*2,int(1e6+1),i):
lis[j]=False
while True:
try:
n=int(eval(input()))
cnt=0
for i in range(n+1):
if lis[i]:cnt+=1
... | 22 | 20 | 377 | 389 | lis = [1 for i in range(int(1e6 + 1))]
lis[0] = lis[1] = 0
for i in range(int(1e6) + 1):
if lis[i]:
for j in range(i * 2, int(1e6 + 1), i):
lis[j] = 0
while True:
try:
n = int(eval(input()))
cnt = 0
for i in range(n + 1):
if lis[i]:
cnt += ... | lis = [True for i in range(int(1e6 + 1))]
lis[0] = lis[1] = False
end = int(1e6**0.5)
for i in range(end + 1):
if lis[i]:
for j in range(i * 2, int(1e6 + 1), i):
lis[j] = False
while True:
try:
n = int(eval(input()))
cnt = 0
for i in range(n + 1):
if lis[i... | false | 9.090909 | [
"-lis = [1 for i in range(int(1e6 + 1))]",
"-lis[0] = lis[1] = 0",
"-for i in range(int(1e6) + 1):",
"+lis = [True for i in range(int(1e6 + 1))]",
"+lis[0] = lis[1] = False",
"+end = int(1e6**0.5)",
"+for i in range(end + 1):",
"- lis[j] = 0",
"+ lis[j] = False",
"- except... | false | 0.859617 | 0.604578 | 1.421847 | [
"s808152794",
"s089648361"
] |
u546285759 | p00354 | python | s222622522 | s265630758 | 60 | 20 | 8,228 | 7,700 | Accepted | Accepted | 66.67 | from datetime import date
days = {i: d for i, d in enumerate(["mon", "tue", "wed", "thu", "fri", "sat", "sun"])}
day = int(eval(input()))
result = date(2017, 9, day)
index = result.weekday()
print((days[index])) | d = ["fri", "sat", "sun", "mon", "tue", "wed", "thu"]
d = [None] + d * 4 + d[:2]
print((d[int(eval(input()))])) | 6 | 3 | 208 | 105 | from datetime import date
days = {i: d for i, d in enumerate(["mon", "tue", "wed", "thu", "fri", "sat", "sun"])}
day = int(eval(input()))
result = date(2017, 9, day)
index = result.weekday()
print((days[index]))
| d = ["fri", "sat", "sun", "mon", "tue", "wed", "thu"]
d = [None] + d * 4 + d[:2]
print((d[int(eval(input()))]))
| false | 50 | [
"-from datetime import date",
"-",
"-days = {i: d for i, d in enumerate([\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"])}",
"-day = int(eval(input()))",
"-result = date(2017, 9, day)",
"-index = result.weekday()",
"-print((days[index]))",
"+d = [\"fri\", \"sat\", \"sun\", \"mon\", \"tu... | false | 0.077294 | 0.100081 | 0.772314 | [
"s222622522",
"s265630758"
] |
u606045429 | p03040 | python | s418250246 | s132247186 | 729 | 587 | 42,352 | 43,748 | Accepted | Accepted | 19.48 | from heapq import heappush, heappop
INF = 10 ** 18
sum_B = 0
L, R = [INF], [INF]
sum_L = sum_R = 0
L_size = R_size = 0
A = list(map(int, open(0).read().split()))
Q = next(A)
for _ in range(Q):
q = next(A)
if q == 1:
a, b = next(A), next(A)
sum_B += b
max_L = -hea... | from heapq import heappush, heappop
def main():
INF = 10 ** 18
sum_B = 0
L, R = [INF], [INF]
sum_L = sum_R = 0
L_size = R_size = 0
A = list(map(int, open(0).read().split()))
Q = next(A)
for _ in range(Q):
q = next(A)
if q == 1:
a, b = next(... | 47 | 52 | 917 | 1,114 | from heapq import heappush, heappop
INF = 10**18
sum_B = 0
L, R = [INF], [INF]
sum_L = sum_R = 0
L_size = R_size = 0
A = list(map(int, open(0).read().split()))
Q = next(A)
for _ in range(Q):
q = next(A)
if q == 1:
a, b = next(A), next(A)
sum_B += b
max_L = -heappop(L)
min_R = he... | from heapq import heappush, heappop
def main():
INF = 10**18
sum_B = 0
L, R = [INF], [INF]
sum_L = sum_R = 0
L_size = R_size = 0
A = list(map(int, open(0).read().split()))
Q = next(A)
for _ in range(Q):
q = next(A)
if q == 1:
a, b = next(A), next(A)
... | false | 9.615385 | [
"-INF = 10**18",
"-sum_B = 0",
"-L, R = [INF], [INF]",
"-sum_L = sum_R = 0",
"-L_size = R_size = 0",
"-A = list(map(int, open(0).read().split()))",
"-Q = next(A)",
"-for _ in range(Q):",
"- q = next(A)",
"- if q == 1:",
"- a, b = next(A), next(A)",
"- sum_B += b",
"- ... | false | 0.041149 | 0.041075 | 1.001807 | [
"s418250246",
"s132247186"
] |
u423665486 | p03044 | python | s869351829 | s450401519 | 1,464 | 862 | 152,224 | 88,548 | Accepted | Accepted | 41.12 | import sys
sys.setrecursionlimit(100**4)
class Edge():
def __init__(self, v, w):
self._v = v
self._w = w
def v(self):
return self._v
def w(self):
return self._w
def dfs(v, g, colors, color = 0):
colors[v] = color
if not len(g[v]):
return
for nv in g[v]:
if colors[nv.v()] != -1:
... | import sys
from io import StringIO
import unittest
sys.setrecursionlimit(100**3)
def coloring(v, p, vs, cs, color):
cs[v] = color
for e in vs[v]:
if e[0] == p:
continue
nc = color if e[1] % 2 == 0 else 1 - color
coloring(e[0], v, vs, cs, nc)
def resolve():
n = int(eval(input()))
vs = [[]... | 37 | 26 | 738 | 536 | import sys
sys.setrecursionlimit(100**4)
class Edge:
def __init__(self, v, w):
self._v = v
self._w = w
def v(self):
return self._v
def w(self):
return self._w
def dfs(v, g, colors, color=0):
colors[v] = color
if not len(g[v]):
return
for nv in g[v]:... | import sys
from io import StringIO
import unittest
sys.setrecursionlimit(100**3)
def coloring(v, p, vs, cs, color):
cs[v] = color
for e in vs[v]:
if e[0] == p:
continue
nc = color if e[1] % 2 == 0 else 1 - color
coloring(e[0], v, vs, cs, nc)
def resolve():
n = int(ev... | false | 29.72973 | [
"+from io import StringIO",
"+import unittest",
"-sys.setrecursionlimit(100**4)",
"+sys.setrecursionlimit(100**3)",
"-class Edge:",
"- def __init__(self, v, w):",
"- self._v = v",
"- self._w = w",
"-",
"- def v(self):",
"- return self._v",
"-",
"- def w(self):",... | false | 0.035244 | 0.072134 | 0.488582 | [
"s869351829",
"s450401519"
] |
u679759899 | p03208 | python | s189673592 | s726304970 | 520 | 259 | 50,264 | 43,868 | Accepted | Accepted | 50.19 | N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
m = 10 ** 10
for i in range(N-K+1):
tmp = h[i+K-1] - h[i]
if tmp < m:
m = tmp
print(m) | # input 高速化
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
m = 10 ** 10
for i in range(N-K+1):
tmp = h[i+K-1] - h[i]
if tmp < m:
m = tmp
print(m) | 9 | 13 | 189 | 244 | N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
m = 10**10
for i in range(N - K + 1):
tmp = h[i + K - 1] - h[i]
if tmp < m:
m = tmp
print(m)
| # input 高速化
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
m = 10**10
for i in range(N - K + 1):
tmp = h[i + K - 1] - h[i]
if tmp < m:
m = tmp
print(m)
| false | 30.769231 | [
"+# input 高速化",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.036196 | 0.036338 | 0.996076 | [
"s189673592",
"s726304970"
] |
u997648604 | p02720 | python | s180801579 | s320392777 | 312 | 175 | 22,056 | 46,064 | Accepted | Accepted | 43.91 | import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)
def get_lcm(num):
return reduce(lambda x,y:(x * y) // fractions.gcd(x, y... | import sys
sys.setrecursionlimit(10**9)
def main():
K = int(eval(input()))
if 0<=K<=10:
print(K)
exit()
lunlun = [i for i in range(1,10)]
m = 0
while len(lunlun) < K:
x = lunlun[m]
btm = x % 10
if btm - 1 >= 0:
lunlun.append(10... | 41 | 30 | 816 | 526 | import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)
def get_lcm(num):
return reduce(lambda x, y: (x * y) // fractions.gcd(x, y), num, ... | import sys
sys.setrecursionlimit(10**9)
def main():
K = int(eval(input()))
if 0 <= K <= 10:
print(K)
exit()
lunlun = [i for i in range(1, 10)]
m = 0
while len(lunlun) < K:
x = lunlun[m]
btm = x % 10
if btm - 1 >= 0:
lunlun.append(10 * x + btm - ... | false | 26.829268 | [
"-import itertools",
"-import math",
"-import numpy as np",
"-import fractions",
"-from collections import deque",
"-from itertools import combinations",
"-from functools import reduce",
"-from functools import lru_cache",
"-",
"-",
"-def get_lcm(num):",
"- return reduce(lambda x, y: (x * y... | false | 0.132289 | 0.045945 | 2.879281 | [
"s180801579",
"s320392777"
] |
u969850098 | p03681 | python | s385543023 | s530318348 | 50 | 35 | 3,064 | 3,064 | Accepted | Accepted | 30 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
def factorial(N, mod=MOD):
res = 1
for i in range(2, N+1):
res *= i
res %= mod
return res
def main():
N, M = list(map(int, readline().rstrip().split()))
if abs(N-M) > 1:
ans = 0
elif N == M:
... | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
def factorial(N, mod=MOD):
res = 1
for i in range(2, N+1):
res *= i
res %= mod
return res
def main():
N, M = list(map(int, readline().rstrip().split()))
if abs(N-M) > 1:
ans = 0
elif N == M:
... | 25 | 25 | 477 | 477 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
def factorial(N, mod=MOD):
res = 1
for i in range(2, N + 1):
res *= i
res %= mod
return res
def main():
N, M = list(map(int, readline().rstrip().split()))
if abs(N - M) > 1:
ans = 0
elif N == M:
ans = f... | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
def factorial(N, mod=MOD):
res = 1
for i in range(2, N + 1):
res *= i
res %= mod
return res
def main():
N, M = list(map(int, readline().rstrip().split()))
if abs(N - M) > 1:
ans = 0
elif N == M:
ans = f... | false | 0 | [
"- ans = factorial(N) * factorial(M) * 2",
"+ ans = factorial(N) ** 2 * 2",
"- ans = factorial(N) * factorial(M)",
"+ ans = factorial(min(N, M)) ** 2 * max(N, M)"
] | false | 0.039756 | 0.062257 | 0.638577 | [
"s385543023",
"s530318348"
] |
u814986259 | p02947 | python | s009419188 | s212810855 | 567 | 463 | 23,140 | 18,192 | Accepted | Accepted | 18.34 | from collections import defaultdict
Sdic = defaultdict(int)
N = int(eval(input()))
S = ['']* N
ans = 0
for i in range(N):
Sdic[str(sorted(eval(input())))] += 1
for i in list(Sdic.keys()):
ans += (Sdic[i] * (Sdic[i] - 1)) // 2
print(ans)
| import collections
N = int(eval(input()))
t = collections.defaultdict(int)
ans = 0
for _ in range(N):
s = list(eval(input()))
s.sort()
t[''.join(s)] += 1
for x in t:
ans += (t[x] * (t[x] - 1)) // 2
print(ans)
| 13 | 16 | 242 | 233 | from collections import defaultdict
Sdic = defaultdict(int)
N = int(eval(input()))
S = [""] * N
ans = 0
for i in range(N):
Sdic[str(sorted(eval(input())))] += 1
for i in list(Sdic.keys()):
ans += (Sdic[i] * (Sdic[i] - 1)) // 2
print(ans)
| import collections
N = int(eval(input()))
t = collections.defaultdict(int)
ans = 0
for _ in range(N):
s = list(eval(input()))
s.sort()
t["".join(s)] += 1
for x in t:
ans += (t[x] * (t[x] - 1)) // 2
print(ans)
| false | 18.75 | [
"-from collections import defaultdict",
"+import collections",
"-Sdic = defaultdict(int)",
"-S = [\"\"] * N",
"+t = collections.defaultdict(int)",
"-for i in range(N):",
"- Sdic[str(sorted(eval(input())))] += 1",
"-for i in list(Sdic.keys()):",
"- ans += (Sdic[i] * (Sdic[i] - 1)) // 2",
"+fo... | false | 0.043498 | 0.043209 | 1.006692 | [
"s009419188",
"s212810855"
] |
u533883485 | p02265 | python | s604347725 | s923852018 | 4,870 | 1,600 | 557,132 | 214,404 | Accepted | Accepted | 67.15 | # coding=utf-8
from collections import deque
n = int(eval(input()))
deque = deque()
input_lines = [input().split() for x in range(n)]
for i in range(n):
inp = input_lines[i]
if inp[0] == 'deleteFirst':
deque.popleft()
elif inp[0] == 'deleteLast':
deque.pop()
elif inp[0] == '... | from collections import deque
import sys
deque = deque()
num = int(sys.stdin.readline())
line = sys.stdin.readlines()
for i in range(num):
order = line[i].split()
if order[0] == 'insert':
deque.appendleft(order[1])
elif order[0] == 'deleteFirst':
deque.popleft()
el... | 19 | 22 | 456 | 474 | # coding=utf-8
from collections import deque
n = int(eval(input()))
deque = deque()
input_lines = [input().split() for x in range(n)]
for i in range(n):
inp = input_lines[i]
if inp[0] == "deleteFirst":
deque.popleft()
elif inp[0] == "deleteLast":
deque.pop()
elif inp[0] == "insert":
... | from collections import deque
import sys
deque = deque()
num = int(sys.stdin.readline())
line = sys.stdin.readlines()
for i in range(num):
order = line[i].split()
if order[0] == "insert":
deque.appendleft(order[1])
elif order[0] == "deleteFirst":
deque.popleft()
elif order[0] == "delete... | false | 13.636364 | [
"-# coding=utf-8",
"+import sys",
"-n = int(eval(input()))",
"-input_lines = [input().split() for x in range(n)]",
"-for i in range(n):",
"- inp = input_lines[i]",
"- if inp[0] == \"deleteFirst\":",
"+num = int(sys.stdin.readline())",
"+line = sys.stdin.readlines()",
"+for i in range(num):",... | false | 0.036914 | 0.094995 | 0.388587 | [
"s604347725",
"s923852018"
] |
u297574184 | p03453 | python | s826526546 | s666889390 | 1,961 | 1,643 | 85,128 | 105,940 | Accepted | Accepted | 16.22 | from heapq import heappop, heappush
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
S, T = [int(x) - 1 for x in input().split()]
adjList = [[] for i in range(N)]
for i in range(M):
U, V, D = list(map(int, input().split()))
adjList[U - 1].append((V - 1, D))
adjList[V - 1].append((U - 1, ... | from heapq import heappush, heappop
import sys
input = sys.stdin.readline
INF = float('inf')
MOD = 10**9 + 7
def Dijkstra(adjList, vSt):
numV = len(adjList)
numUsed = 0
costs = [INF] * numV
costs[vSt] = 0
nums = [0] * numV
nums[vSt] = 1
PQ = []
heappush(PQ, (0, vSt))
... | 68 | 63 | 1,697 | 1,753 | from heapq import heappop, heappush
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
S, T = [int(x) - 1 for x in input().split()]
adjList = [[] for i in range(N)]
for i in range(M):
U, V, D = list(map(int, input().split()))
adjList[U - 1].append((V - 1, D))
adjList[V - 1].append((U - 1, D))
# 頂点Sから各頂... | from heapq import heappush, heappop
import sys
input = sys.stdin.readline
INF = float("inf")
MOD = 10**9 + 7
def Dijkstra(adjList, vSt):
numV = len(adjList)
numUsed = 0
costs = [INF] * numV
costs[vSt] = 0
nums = [0] * numV
nums[vSt] = 1
PQ = []
heappush(PQ, (0, vSt))
while PQ:
... | false | 7.352941 | [
"-from heapq import heappop, heappush",
"+from heapq import heappush, heappop",
"+import sys",
"+input = sys.stdin.readline",
"+INF = float(\"inf\")",
"-N, M = list(map(int, input().split()))",
"-S, T = [int(x) - 1 for x in input().split()]",
"-adjList = [[] for i in range(N)]",
"-for i in range(M):... | false | 0.037561 | 0.037608 | 0.998762 | [
"s826526546",
"s666889390"
] |
u079022693 | p02702 | python | s988028401 | s761273622 | 623 | 106 | 107,716 | 9,224 | Accepted | Accepted | 82.99 | from sys import stdin
from numba import jit
@jit(nopython=True)
def nC2(n):
return n*(n-1)//2
def main():
#入力
readline=stdin.readline
s=readline().strip()
d=dict()
p=1
t=0
for i in range(len(s)-1,-1,-1):
n=int(s[i])
m=(n*p+t)%2019
t=m
p... | from sys import stdin
def nC2(n):
return n*(n-1)//2
def main():
#入力
readline=stdin.readline
s=readline().strip()
d=dict()
p=1
t=0
for i in range(len(s)-1,-1,-1):
n=int(s[i])
m=(n*p+t)%2019
t=m
p*=10
p%=2019
if m not in... | 35 | 34 | 598 | 556 | from sys import stdin
from numba import jit
@jit(nopython=True)
def nC2(n):
return n * (n - 1) // 2
def main():
# 入力
readline = stdin.readline
s = readline().strip()
d = dict()
p = 1
t = 0
for i in range(len(s) - 1, -1, -1):
n = int(s[i])
m = (n * p + t) % 2019
... | from sys import stdin
def nC2(n):
return n * (n - 1) // 2
def main():
# 入力
readline = stdin.readline
s = readline().strip()
d = dict()
p = 1
t = 0
for i in range(len(s) - 1, -1, -1):
n = int(s[i])
m = (n * p + t) % 2019
t = m
p *= 10
p %= 2019
... | false | 2.857143 | [
"-from numba import jit",
"-@jit(nopython=True)"
] | false | 0.045371 | 0.007121 | 6.371702 | [
"s988028401",
"s761273622"
] |
u464205401 | p02725 | python | s733724752 | s292229835 | 123 | 107 | 26,444 | 25,840 | Accepted | Accepted | 13.01 | k,n=list(map(int,input().split()))
A=list(map(int,input().split()))
l=[]
for i in range(n-1):
l.append(A[i+1]-A[i])
l.append(k-A[-1]+A[0])
print((sum(l)-max(l))) | k,n=list(map(int,input().split()))
A=list(map(int,input().split()))
l=[k-A[-1]+A[0]]
[l.append(A[i+1]-A[i]) for i in range(n-1)]
print((k-max(l))) | 7 | 5 | 167 | 148 | k, n = list(map(int, input().split()))
A = list(map(int, input().split()))
l = []
for i in range(n - 1):
l.append(A[i + 1] - A[i])
l.append(k - A[-1] + A[0])
print((sum(l) - max(l)))
| k, n = list(map(int, input().split()))
A = list(map(int, input().split()))
l = [k - A[-1] + A[0]]
[l.append(A[i + 1] - A[i]) for i in range(n - 1)]
print((k - max(l)))
| false | 28.571429 | [
"-l = []",
"-for i in range(n - 1):",
"- l.append(A[i + 1] - A[i])",
"-l.append(k - A[-1] + A[0])",
"-print((sum(l) - max(l)))",
"+l = [k - A[-1] + A[0]]",
"+[l.append(A[i + 1] - A[i]) for i in range(n - 1)]",
"+print((k - max(l)))"
] | false | 0.103543 | 0.036249 | 2.856404 | [
"s733724752",
"s292229835"
] |
u966364923 | p02361 | python | s258798423 | s409284297 | 3,260 | 2,740 | 83,948 | 75,872 | Accepted | Accepted | 15.95 | import heapq
V, E, root = list(map(int, input().split()))
visited = [False] * V
nodes = [[] for i in range(V)]
cost = [[] for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
nodes[s].append(t)
cost[s].append(d)
dist = [float('inf')] * V
dist[root] = 0
h = [(0, root... | import heapq
V, E, root = list(map(int, input().split()))
visited = [False] * V
nodes = [[] for i in range(V)]
cost = [[] for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
nodes[s].append(t)
cost[s].append(d)
dist = [float('inf')] * V
dist[root] = 0
h = [(0, root... | 32 | 31 | 770 | 704 | import heapq
V, E, root = list(map(int, input().split()))
visited = [False] * V
nodes = [[] for i in range(V)]
cost = [[] for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
nodes[s].append(t)
cost[s].append(d)
dist = [float("inf")] * V
dist[root] = 0
h = [(0, root)]
while h:
... | import heapq
V, E, root = list(map(int, input().split()))
visited = [False] * V
nodes = [[] for i in range(V)]
cost = [[] for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
nodes[s].append(t)
cost[s].append(d)
dist = [float("inf")] * V
dist[root] = 0
h = [(0, root)]
while h:
... | false | 3.125 | [
"- if dist[t] > c + cost[v][i]:",
"- dist[t] = c + cost[v][i]",
"- if not visited[t]:",
"- visited[v] = True",
"- heapq.heappush(h, (c + cost[v][i], t))",
"+ nc = c + cost[v][i]",
"+ if dist[t] > nc:",
"+ dist[t] = nc",
"+ ... | false | 0.043963 | 0.04523 | 0.971993 | [
"s258798423",
"s409284297"
] |
u879870653 | p04047 | python | s893985208 | s595384518 | 170 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90 | "#!/usr/bin/env python3"
N = int(eval(input()))
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
for i in range(0, 2*N, 2) :
ans += L[i]
print(ans)
| N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(0,2*N,2) :
ans += L[i]
print(ans)
| 12 | 7 | 169 | 128 | "#!/usr/bin/env python3"
N = int(eval(input()))
L = list(map(int, input().split()))
L = sorted(L)
ans = 0
for i in range(0, 2 * N, 2):
ans += L[i]
print(ans)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(0, 2 * N, 2):
ans += L[i]
print(ans)
| false | 41.666667 | [
"-\"#!/usr/bin/env python3\"",
"-L = sorted(L)",
"+L.sort()"
] | false | 0.042982 | 0.037131 | 1.157597 | [
"s893985208",
"s595384518"
] |
u020604402 | p03565 | python | s020029187 | s362903443 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | try:
S = list(input())
T = list(input())
t = len(T)
candidate = []
for i in range(len(S)):
tmp = S[i:i+t]
for j in range(len(tmp)):
if tmp[j] == T[j] or '?' == tmp[j]:
pass
else:
break
else:
cand... | S = eval(input())
T = eval(input())
ls = len(S)
lt = len(T)
cand = []
for i in range(ls-lt+1):
frac = S[i:i+lt]
for j in range(lt):
if frac[j] != T[j] and frac[j] != '?': break
else:
cand.append(S[0:i] + T + S[i+lt:ls])
if cand == []:
print("UNRESTORABLE")
else:
cand =... | 27 | 17 | 728 | 390 | try:
S = list(input())
T = list(input())
t = len(T)
candidate = []
for i in range(len(S)):
tmp = S[i : i + t]
for j in range(len(tmp)):
if tmp[j] == T[j] or "?" == tmp[j]:
pass
else:
break
else:
candidate.app... | S = eval(input())
T = eval(input())
ls = len(S)
lt = len(T)
cand = []
for i in range(ls - lt + 1):
frac = S[i : i + lt]
for j in range(lt):
if frac[j] != T[j] and frac[j] != "?":
break
else:
cand.append(S[0:i] + T + S[i + lt : ls])
if cand == []:
print("UNRESTORABLE")
else:
... | false | 37.037037 | [
"-try:",
"- S = list(input())",
"- T = list(input())",
"- t = len(T)",
"- candidate = []",
"- for i in range(len(S)):",
"- tmp = S[i : i + t]",
"- for j in range(len(tmp)):",
"- if tmp[j] == T[j] or \"?\" == tmp[j]:",
"- pass",
"- ... | false | 0.054687 | 0.05112 | 1.069776 | [
"s020029187",
"s362903443"
] |
u977697682 | p02624 | python | s192620212 | s507947855 | 32 | 29 | 9,108 | 9,096 | Accepted | Accepted | 9.38 | N = int(eval(input()))
s,k,n = 0,1,N
while k<=n:
m = N//k
s += (k-1)*k*(n-m)*(n+m+1)//2
s += k*m*(m+1)
k,n = k+1,m
if m<k-1:
s -= (k-1)*m*(m+1)
print((s//2))
| N = int(eval(input()))
s=k=kn=0;n=N
while k<n:
k += 1
n = N//k
kn = k*n*(n+1)
s += 4*kn
s -= (k+1)*kn
if n<k:
s -= 2*kn
print((s//4))
| 11 | 12 | 167 | 144 | N = int(eval(input()))
s, k, n = 0, 1, N
while k <= n:
m = N // k
s += (k - 1) * k * (n - m) * (n + m + 1) // 2
s += k * m * (m + 1)
k, n = k + 1, m
if m < k - 1:
s -= (k - 1) * m * (m + 1)
print((s // 2))
| N = int(eval(input()))
s = k = kn = 0
n = N
while k < n:
k += 1
n = N // k
kn = k * n * (n + 1)
s += 4 * kn
s -= (k + 1) * kn
if n < k:
s -= 2 * kn
print((s // 4))
| false | 8.333333 | [
"-s, k, n = 0, 1, N",
"-while k <= n:",
"- m = N // k",
"- s += (k - 1) * k * (n - m) * (n + m + 1) // 2",
"- s += k * m * (m + 1)",
"- k, n = k + 1, m",
"-if m < k - 1:",
"- s -= (k - 1) * m * (m + 1)",
"-print((s // 2))",
"+s = k = kn = 0",
"+n = N",
"+while k < n:",
"+ k... | false | 0.047365 | 0.0418 | 1.133152 | [
"s192620212",
"s507947855"
] |
u314906167 | p02949 | python | s598970535 | s123003195 | 854 | 704 | 48,444 | 52,184 | Accepted | Accepted | 17.56 | N, M, P = list(map(int, input().split()))
ABC = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
ABC.append((a - 1, b - 1, P - c))
inf = float("inf")
d = [inf] * N
d[0] = 0
# Bellman-Ford
for i in range(N):
for a, b, c in ABC:
if d[b] <= d[a] + c:
continu... | from collections import deque
N, M, P = list(map(int, input().split()))
ABC = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
ABC.append((a - 1, b - 1, P - c))
# preprocess
to = [[] for _ in range(N)]
fr = [[] for _ in range(N)]
for a, b, c in ABC:
to[a].append(b)
fr[b].... | 27 | 56 | 542 | 1,207 | N, M, P = list(map(int, input().split()))
ABC = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
ABC.append((a - 1, b - 1, P - c))
inf = float("inf")
d = [inf] * N
d[0] = 0
# Bellman-Ford
for i in range(N):
for a, b, c in ABC:
if d[b] <= d[a] + c:
continue
d[b] = d... | from collections import deque
N, M, P = list(map(int, input().split()))
ABC = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
ABC.append((a - 1, b - 1, P - c))
# preprocess
to = [[] for _ in range(N)]
fr = [[] for _ in range(N)]
for a, b, c in ABC:
to[a].append(b)
fr[b].append(a)
visita... | false | 51.785714 | [
"+from collections import deque",
"+",
"+# preprocess",
"+to = [[] for _ in range(N)]",
"+fr = [[] for _ in range(N)]",
"+for a, b, c in ABC:",
"+ to[a].append(b)",
"+ fr[b].append(a)",
"+visitable_s = [False] * N",
"+q = deque()",
"+q.append(0)",
"+visitable_s[0] = True",
"+while len(... | false | 0.100498 | 0.040223 | 2.498527 | [
"s598970535",
"s123003195"
] |
u075012704 | p02900 | python | s904966690 | s630869423 | 433 | 220 | 3,268 | 3,064 | Accepted | Accepted | 49.19 | A, B = list(map(int, input().split()))
common_divisors = []
for n in range(1, int(min(A, B) ** 0.5) + 1):
if (A % n == 0) & (B % n == 0):
common_divisors.append(n)
if A % n == 0:
x = A // n
if B % x == 0:
common_divisors.append(x)
# ある自然数の素数判定
def is_prime(n... | A, B = list(map(int, input().split()))
def prime_factorization(n):
table = []
for x in range(2, int(n ** 0.5) + 1):
while n % x == 0:
table.append(x)
n //= x
if n > 1:
table.append(n)
return table
A_factor = set(prime_factorization(A))
B_factor ... | 30 | 17 | 566 | 381 | A, B = list(map(int, input().split()))
common_divisors = []
for n in range(1, int(min(A, B) ** 0.5) + 1):
if (A % n == 0) & (B % n == 0):
common_divisors.append(n)
if A % n == 0:
x = A // n
if B % x == 0:
common_divisors.append(x)
# ある自然数の素数判定
def is_prime(n):
if n == 1:
... | A, B = list(map(int, input().split()))
def prime_factorization(n):
table = []
for x in range(2, int(n**0.5) + 1):
while n % x == 0:
table.append(x)
n //= x
if n > 1:
table.append(n)
return table
A_factor = set(prime_factorization(A))
B_factor = set(prime_facto... | false | 43.333333 | [
"-common_divisors = []",
"-for n in range(1, int(min(A, B) ** 0.5) + 1):",
"- if (A % n == 0) & (B % n == 0):",
"- common_divisors.append(n)",
"- if A % n == 0:",
"- x = A // n",
"- if B % x == 0:",
"- common_divisors.append(x)",
"-# ある自然数の素数判定",
"-def is_prim... | false | 0.034035 | 0.040106 | 0.848624 | [
"s904966690",
"s630869423"
] |
u611239490 | p02717 | python | s697684326 | s800488209 | 28 | 24 | 9,072 | 9,176 | Accepted | Accepted | 14.29 | X,Y,Z = list(map(int,input().split()))
print((Z,X,Y)) | X,Y,Z=list(map(int,input().split()))
X,Y=Y,X
X,Z=Z,X
print((X,Y,Z)) | 2 | 4 | 46 | 62 | X, Y, Z = list(map(int, input().split()))
print((Z, X, Y))
| X, Y, Z = list(map(int, input().split()))
X, Y = Y, X
X, Z = Z, X
print((X, Y, Z))
| false | 50 | [
"-print((Z, X, Y))",
"+X, Y = Y, X",
"+X, Z = Z, X",
"+print((X, Y, Z))"
] | false | 0.047546 | 0.03601 | 1.320356 | [
"s697684326",
"s800488209"
] |
u256678932 | p02386 | python | s901107048 | s188874967 | 280 | 20 | 7,816 | 5,620 | Accepted | Accepted | 92.86 | def main():
n = int(eval(input()))
dices = []
for i in range(n):
dices.append(Dice(list(map(int, input().split(' ')))))
if not equals_any(dices):
print('Yes')
else:
print('No')
def equals_any(dices):
for i, d1 in enumerate(dices):
for d2 in [d for... | class Dice:
def __init__(self, nums):
self.top = nums[0]
self.front = nums[1]
self.right = nums[2]
self.left = nums[3]
self.back = nums[4]
self.bottom = nums[5]
def toN(self):
tmp = self.top
self.top = self.front
self.... | 117 | 126 | 2,629 | 3,035 | def main():
n = int(eval(input()))
dices = []
for i in range(n):
dices.append(Dice(list(map(int, input().split(" ")))))
if not equals_any(dices):
print("Yes")
else:
print("No")
def equals_any(dices):
for i, d1 in enumerate(dices):
for d2 in [d for d in dices[i +... | class Dice:
def __init__(self, nums):
self.top = nums[0]
self.front = nums[1]
self.right = nums[2]
self.left = nums[3]
self.back = nums[4]
self.bottom = nums[5]
def toN(self):
tmp = self.top
self.top = self.front
self.front = self.bottom
... | false | 7.142857 | [
"-def main():",
"- n = int(eval(input()))",
"- dices = []",
"- for i in range(n):",
"- dices.append(Dice(list(map(int, input().split(\" \")))))",
"- if not equals_any(dices):",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"-",
"-",
"-def equals_any(dice... | false | 0.035608 | 0.036641 | 0.971812 | [
"s901107048",
"s188874967"
] |
u729133443 | p03720 | python | s009052175 | s866911500 | 185 | 18 | 38,256 | 2,940 | Accepted | Accepted | 90.27 | n,_,*r=list(map(int,open(0).read().split()))
for i in range(n):print((r.count(-~i))) | n,_,*r=list(map(int,open(0).read().split()));print((*list(map(r.count,list(range(1,n+1)))))) | 2 | 1 | 77 | 72 | n, _, *r = list(map(int, open(0).read().split()))
for i in range(n):
print((r.count(-~i)))
| n, _, *r = list(map(int, open(0).read().split()))
print((*list(map(r.count, list(range(1, n + 1))))))
| false | 50 | [
"-for i in range(n):",
"- print((r.count(-~i)))",
"+print((*list(map(r.count, list(range(1, n + 1))))))"
] | false | 0.040274 | 0.036278 | 1.110132 | [
"s009052175",
"s866911500"
] |
u844646164 | p03681 | python | s029318792 | s688987689 | 443 | 208 | 4,096 | 79,596 | Accepted | Accepted | 53.05 | import math
n, m = list(map(int, input().split()))
MOD = 1000000007
count_n = 0
count_m = 0
count = 0
if abs(n-m) == 1:
count_n = math.factorial(n) % MOD
count_m = math.factorial(m) % MOD
count = count_m * count_n % MOD
elif abs(n-m) == 0:
count_n = math.factorial(n) % MOD
count_m = math.factorial... | import math
N, M = list(map(int, input().split()))
mod = 10**9+7
if abs(N-M) > 1:
print((0))
exit()
if N < M:
N, M = M, N
if N == M:
ans = math.factorial(N)
ans %= mod
ans *= math.factorial(M)
ans %= mod
ans *= 2
ans %= mod
else:
ans = math.factorial(M)
ans %= mod
ans *= ... | 18 | 26 | 404 | 361 | import math
n, m = list(map(int, input().split()))
MOD = 1000000007
count_n = 0
count_m = 0
count = 0
if abs(n - m) == 1:
count_n = math.factorial(n) % MOD
count_m = math.factorial(m) % MOD
count = count_m * count_n % MOD
elif abs(n - m) == 0:
count_n = math.factorial(n) % MOD
count_m = math.factor... | import math
N, M = list(map(int, input().split()))
mod = 10**9 + 7
if abs(N - M) > 1:
print((0))
exit()
if N < M:
N, M = M, N
if N == M:
ans = math.factorial(N)
ans %= mod
ans *= math.factorial(M)
ans %= mod
ans *= 2
ans %= mod
else:
ans = math.factorial(M)
ans %= mod
an... | false | 30.769231 | [
"-n, m = list(map(int, input().split()))",
"-MOD = 1000000007",
"-count_n = 0",
"-count_m = 0",
"-count = 0",
"-if abs(n - m) == 1:",
"- count_n = math.factorial(n) % MOD",
"- count_m = math.factorial(m) % MOD",
"- count = count_m * count_n % MOD",
"-elif abs(n - m) == 0:",
"- count_... | false | 0.03932 | 0.058381 | 0.673511 | [
"s029318792",
"s688987689"
] |
u312025627 | p03645 | python | s833216799 | s080888934 | 1,056 | 912 | 97,740 | 106,572 | Accepted | Accepted | 13.64 | def main():
from collections import deque
N, M = (int(i) for i in input().split())
G = [[] for i in range(N+1)]
G_color = ['WHITE' for _ in range(N+1)]
G_distance = [float('inf') for _ in range(N+1)]
for i in range(M):
a, b = (int(i) for i in input().split())
G[a].append(... | def main():
import sys
input = sys.stdin.buffer.readline
N, M = (int(i) for i in input().split())
edge = [[] for _ in range(N)]
for i in range(M):
a, b = (int(i) for i in input().split())
edge[a-1].append((1, b-1))
edge[b-1].append((1, a-1))
from heapq import hea... | 41 | 39 | 1,261 | 1,019 | def main():
from collections import deque
N, M = (int(i) for i in input().split())
G = [[] for i in range(N + 1)]
G_color = ["WHITE" for _ in range(N + 1)]
G_distance = [float("inf") for _ in range(N + 1)]
for i in range(M):
a, b = (int(i) for i in input().split())
G[a].append(b... | def main():
import sys
input = sys.stdin.buffer.readline
N, M = (int(i) for i in input().split())
edge = [[] for _ in range(N)]
for i in range(M):
a, b = (int(i) for i in input().split())
edge[a - 1].append((1, b - 1))
edge[b - 1].append((1, a - 1))
from heapq import hea... | false | 4.878049 | [
"- from collections import deque",
"+ import sys",
"+ input = sys.stdin.buffer.readline",
"- G = [[] for i in range(N + 1)]",
"- G_color = [\"WHITE\" for _ in range(N + 1)]",
"- G_distance = [float(\"inf\") for _ in range(N + 1)]",
"+ edge = [[] for _ in range(N)]",
"- G[a]... | false | 0.142803 | 0.071702 | 1.991629 | [
"s833216799",
"s080888934"
] |
u803684095 | p02759 | python | s348957810 | s855856483 | 31 | 24 | 9,092 | 9,048 | Accepted | Accepted | 22.58 | print((int((int(eval(input()))+1)/2))) | print(((int(eval(input()))+1)//2)) | 1 | 1 | 30 | 26 | print((int((int(eval(input())) + 1) / 2)))
| print(((int(eval(input())) + 1) // 2))
| false | 0 | [
"-print((int((int(eval(input())) + 1) / 2)))",
"+print(((int(eval(input())) + 1) // 2))"
] | false | 0.048381 | 0.047812 | 1.011893 | [
"s348957810",
"s855856483"
] |
u690536347 | p03250 | python | s896395413 | s936642520 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | *l,=list(map(int,input().split()))
l.sort()
print((l[2]*10+l[1]+l[0])) | l=sorted(map(int,input().split()))
print((l[2]*10+sum(l[:2]))) | 3 | 2 | 64 | 61 | (*l,) = list(map(int, input().split()))
l.sort()
print((l[2] * 10 + l[1] + l[0]))
| l = sorted(map(int, input().split()))
print((l[2] * 10 + sum(l[:2])))
| false | 33.333333 | [
"-(*l,) = list(map(int, input().split()))",
"-l.sort()",
"-print((l[2] * 10 + l[1] + l[0]))",
"+l = sorted(map(int, input().split()))",
"+print((l[2] * 10 + sum(l[:2])))"
] | false | 0.113227 | 0.046693 | 2.424938 | [
"s896395413",
"s936642520"
] |
u344655022 | p02583 | python | s758381006 | s873101533 | 131 | 118 | 87,128 | 90,732 | Accepted | Accepted | 9.92 | import sys
input = sys.stdin.readline
import itertools as it
def li():
return [int(x) for x in input().split()]
N = int(eval(input()))
L = li()
# 組み合わせ列挙
c = it.combinations(L, 3)
c_list = list(c)
cnt = 0
for l in c_list:
unique_l = len(set(l))
if unique_l != 3:
continue
s... | import sys
input = sys.stdin.readline
import itertools as it
def li():
return [int(x) for x in input().split()]
N = int(eval(input()))
L = li()
# 組み合わせ列挙
com = it.combinations(L, 3)
com_list = list(com)
cnt = 0
for l in com_list:
unique_l = len(set(l))
if unique_l != 3:
continu... | 26 | 24 | 447 | 426 | import sys
input = sys.stdin.readline
import itertools as it
def li():
return [int(x) for x in input().split()]
N = int(eval(input()))
L = li()
# 組み合わせ列挙
c = it.combinations(L, 3)
c_list = list(c)
cnt = 0
for l in c_list:
unique_l = len(set(l))
if unique_l != 3:
continue
sum_l = l[0] + l[1]... | import sys
input = sys.stdin.readline
import itertools as it
def li():
return [int(x) for x in input().split()]
N = int(eval(input()))
L = li()
# 組み合わせ列挙
com = it.combinations(L, 3)
com_list = list(com)
cnt = 0
for l in com_list:
unique_l = len(set(l))
if unique_l != 3:
continue
a, b, c = l... | false | 7.692308 | [
"-c = it.combinations(L, 3)",
"-c_list = list(c)",
"+com = it.combinations(L, 3)",
"+com_list = list(com)",
"-for l in c_list:",
"+for l in com_list:",
"- sum_l = l[0] + l[1] + l[2]",
"- max_l = max(l)",
"- sum_lest = sum_l - max_l",
"- if sum_lest > max_l:",
"+ a, b, c = l[0], l[... | false | 0.049507 | 0.157937 | 0.313458 | [
"s758381006",
"s873101533"
] |
u860002137 | p03476 | python | s598721888 | s918248192 | 1,096 | 475 | 23,896 | 15,292 | Accepted | Accepted | 56.66 | import numpy as np
q = int(input())
# 素数列挙
n = 10**5 + 1
primes = set(range(3, n+1, 2))
for i in range(3, int(n**0.5+1)):
primes.difference_update(range(i*2, n+1, i))
primes.add(2)
arr = np.array(list(primes))
arr = np.bincount(arr)
# 素数かつ2017に似た数を列挙
like_2017 = np.zeros(n, bool)
for i in np.whe... | from itertools import accumulate
n = 10**5 + 1
primes = set(range(3, n+1, 2))
for i in range(3, int(n**0.5+1)):
primes.difference_update(list(range(i*2, n+1, i)))
primes.add(2)
def like_2017(n):
return n in primes and (n + 1) // 2 in primes
result = [0] * 10**5
for i in range(1, 10**5 + 1, 2)... | 35 | 25 | 662 | 502 | import numpy as np
q = int(input())
# 素数列挙
n = 10**5 + 1
primes = set(range(3, n + 1, 2))
for i in range(3, int(n**0.5 + 1)):
primes.difference_update(range(i * 2, n + 1, i))
primes.add(2)
arr = np.array(list(primes))
arr = np.bincount(arr)
# 素数かつ2017に似た数を列挙
like_2017 = np.zeros(n, bool)
for i in np.where(arr == 1... | from itertools import accumulate
n = 10**5 + 1
primes = set(range(3, n + 1, 2))
for i in range(3, int(n**0.5 + 1)):
primes.difference_update(list(range(i * 2, n + 1, i)))
primes.add(2)
def like_2017(n):
return n in primes and (n + 1) // 2 in primes
result = [0] * 10**5
for i in range(1, 10**5 + 1, 2):
... | false | 28.571429 | [
"-import numpy as np",
"+from itertools import accumulate",
"-q = int(input())",
"-# 素数列挙",
"- primes.difference_update(range(i * 2, n + 1, i))",
"+ primes.difference_update(list(range(i * 2, n + 1, i)))",
"-arr = np.array(list(primes))",
"-arr = np.bincount(arr)",
"-# 素数かつ2017に似た数を列挙",
"-li... | false | 0.750082 | 0.138041 | 5.433759 | [
"s598721888",
"s918248192"
] |
u790710233 | p03494 | python | s938482169 | s401779407 | 23 | 18 | 3,316 | 2,940 | Accepted | Accepted | 21.74 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
while True:
if n == sum(1 if x % 2 == 0 else 0 for x in a):
a = list([x//2 for x in a])
cnt += 1
else:
break
print(cnt)
| n = int(eval(input()))
# 10**9
a = list(map(int, input().split()))
cnt = 0
while all(x % 2 == 0 for x in a):
a = list([x//2 for x in a])
cnt += 1
print(cnt)
| 11 | 8 | 229 | 171 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
while True:
if n == sum(1 if x % 2 == 0 else 0 for x in a):
a = list([x // 2 for x in a])
cnt += 1
else:
break
print(cnt)
| n = int(eval(input()))
# 10**9
a = list(map(int, input().split()))
cnt = 0
while all(x % 2 == 0 for x in a):
a = list([x // 2 for x in a])
cnt += 1
print(cnt)
| false | 27.272727 | [
"+# 10**9",
"-while True:",
"- if n == sum(1 if x % 2 == 0 else 0 for x in a):",
"- a = list([x // 2 for x in a])",
"- cnt += 1",
"- else:",
"- break",
"+while all(x % 2 == 0 for x in a):",
"+ a = list([x // 2 for x in a])",
"+ cnt += 1"
] | false | 0.042541 | 0.047226 | 0.900796 | [
"s938482169",
"s401779407"
] |
u828706986 | p03088 | python | s709169492 | s987196344 | 199 | 109 | 5,544 | 5,588 | Accepted | Accepted | 45.23 | import functools
N, MOD = int(eval(input())), 10 ** 9 + 7
def ok(last4):
for i in range(4):
t = list(last4)
if i >= 1:
t[i-1], t[i] = t[i], t[i-1]
if ''.join(t).count('AGC') >= 1:
return False
return True
@functools.lru_cache(maxsize=None)
d... | import functools
N, MOD = int(eval(input())), 10 ** 9 + 7
@functools.lru_cache(maxsize=None)
def ok(last4):
for i in range(4):
t = list(last4)
if i >= 1:
t[i-1], t[i] = t[i], t[i-1]
if ''.join(t).count('AGC') >= 1:
return False
return True
@... | 28 | 29 | 535 | 571 | import functools
N, MOD = int(eval(input())), 10**9 + 7
def ok(last4):
for i in range(4):
t = list(last4)
if i >= 1:
t[i - 1], t[i] = t[i], t[i - 1]
if "".join(t).count("AGC") >= 1:
return False
return True
@functools.lru_cache(maxsize=None)
def dfs(cur, last... | import functools
N, MOD = int(eval(input())), 10**9 + 7
@functools.lru_cache(maxsize=None)
def ok(last4):
for i in range(4):
t = list(last4)
if i >= 1:
t[i - 1], t[i] = t[i], t[i - 1]
if "".join(t).count("AGC") >= 1:
return False
return True
@functools.lru_ca... | false | 3.448276 | [
"+@functools.lru_cache(maxsize=None)"
] | false | 0.064103 | 0.042523 | 1.507517 | [
"s709169492",
"s987196344"
] |
u072717685 | p03775 | python | s007175801 | s361427352 | 129 | 70 | 4,316 | 64,708 | Accepted | Accepted | 45.74 | from itertools import combinations
from functools import reduce
from operator import mul
def prime_dec(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n /= i
table.append(int(i))
i += 1
if n > 1:
table.append(n)
return table
n = int(eval(input()))
ps = prime_d... | from math import floor
def main():
n = int(eval(input()))
nsq = floor(n ** 0.5)
r = 11
for nsqe in range(nsq, 0, -1):
if n % nsqe == 0:
rt = max(len(str(nsqe)), len(str(n // nsqe)))
r = min(r, rt)
print(r)
if __name__ == '__main__':
main() | 28 | 14 | 676 | 304 | from itertools import combinations
from functools import reduce
from operator import mul
def prime_dec(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n /= i
table.append(int(i))
i += 1
if n > 1:
table.append(n)
return table
n = int(eval(i... | from math import floor
def main():
n = int(eval(input()))
nsq = floor(n**0.5)
r = 11
for nsqe in range(nsq, 0, -1):
if n % nsqe == 0:
rt = max(len(str(nsqe)), len(str(n // nsqe)))
r = min(r, rt)
print(r)
if __name__ == "__main__":
main()
| false | 50 | [
"-from itertools import combinations",
"-from functools import reduce",
"-from operator import mul",
"+from math import floor",
"-def prime_dec(n):",
"- i = 2",
"- table = []",
"- while i * i <= n:",
"- while n % i == 0:",
"- n /= i",
"- table.append(int(i))... | false | 0.036532 | 0.060252 | 0.606325 | [
"s007175801",
"s361427352"
] |
u788137651 | p03426 | python | s148611770 | s348502822 | 434 | 395 | 77,404 | 45,492 | Accepted | Accepted | 8.99 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections i... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | 65 | 67 | 1,816 | 1,810 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | false | 2.985075 | [
"-from math import floor, ceil, sqrt, factorial, hypot, log # log2ないyp",
"+from math import floor, sqrt, factorial, hypot, log # log2ないyp",
"+from fractions import gcd",
"+from random import randint",
"+",
"+",
"+def ceil(a, b):",
"+ return (a + b - 1) // b",
"+",
"-",
"- def get_cost(fr... | false | 0.07049 | 0.071336 | 0.988139 | [
"s148611770",
"s348502822"
] |
u318414416 | p03170 | python | s541344771 | s750108351 | 395 | 81 | 3,828 | 3,828 | Accepted | Accepted | 79.49 | # coding: utf-8
import sys
input = sys.stdin.readline
def f(N, A, K):
dp = [0] * (K + 1)
for i in range(K + 1):
for x in A:
if i < x:
break
if not dp[i - x]:
dp[i] = 1
break
return(dp[K])
ans = [ "Second", "Fi... | # coding: utf-8
import sys
input = sys.stdin.readline
def f2(N, A, K):
dp = [0] * (K + 1)
for i in range(K + 1):
if dp[i] == 0:
# 残りi個で負けなので、ai個足した状況は勝ちになる。
for x in A:
if i + x <= K:
dp[i + x] = 1
return(dp[K])
ans = [ "S... | 20 | 19 | 454 | 466 | # coding: utf-8
import sys
input = sys.stdin.readline
def f(N, A, K):
dp = [0] * (K + 1)
for i in range(K + 1):
for x in A:
if i < x:
break
if not dp[i - x]:
dp[i] = 1
break
return dp[K]
ans = ["Second", "First"]
n, k = lis... | # coding: utf-8
import sys
input = sys.stdin.readline
def f2(N, A, K):
dp = [0] * (K + 1)
for i in range(K + 1):
if dp[i] == 0:
# 残りi個で負けなので、ai個足した状況は勝ちになる。
for x in A:
if i + x <= K:
dp[i + x] = 1
return dp[K]
ans = ["Second", "First"... | false | 5 | [
"-def f(N, A, K):",
"+def f2(N, A, K):",
"- for x in A:",
"- if i < x:",
"- break",
"- if not dp[i - x]:",
"- dp[i] = 1",
"- break",
"+ if dp[i] == 0:",
"+ # 残りi個で負けなので、ai個足した状況は勝ちになる。",
"+ for... | false | 0.037431 | 0.036946 | 1.013139 | [
"s541344771",
"s750108351"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.