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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u462434199 | p03283 | python | s036876361 | s250792567 | 2,045 | 1,857 | 78,460 | 57,540 | Accepted | Accepted | 9.19 | import numpy as np
n,m,q=list(map(int, input().split()))
a=[list(map(int, input().split())) for i in range(m)]
b=[list(map(int, input().split())) for i in range(q)]
x=np.zeros((501, 501), dtype=np.int)
for i in range(m):
x[a[i][0], a[i][1]]+=1
np.cumsum(x, axis=0, out=x)
np.cumsum(x, axis=1, out=x... | import numpy as np
n,m,q=list(map(int, input().split()))
a=np.array([list(map(int, input().split())) for i in range(m)])
b=[list(map(int, input().split())) for i in range(q)]
x=np.zeros((501, 501), dtype=np.int)
np.add.at(x, (a[:, 0], a[:, 1]), 1)
np.cumsum(x, axis=0, out=x)
np.cumsum(x, axis=1, out=x)... | 23 | 22 | 480 | 479 | import numpy as np
n, m, q = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(m)]
b = [list(map(int, input().split())) for i in range(q)]
x = np.zeros((501, 501), dtype=np.int)
for i in range(m):
x[a[i][0], a[i][1]] += 1
np.cumsum(x, axis=0, out=x)
np.cumsum(x, axis=1, out=x)
for... | import numpy as np
n, m, q = list(map(int, input().split()))
a = np.array([list(map(int, input().split())) for i in range(m)])
b = [list(map(int, input().split())) for i in range(q)]
x = np.zeros((501, 501), dtype=np.int)
np.add.at(x, (a[:, 0], a[:, 1]), 1)
np.cumsum(x, axis=0, out=x)
np.cumsum(x, axis=1, out=x)
for i... | false | 4.347826 | [
"-a = [list(map(int, input().split())) for i in range(m)]",
"+a = np.array([list(map(int, input().split())) for i in range(m)])",
"-for i in range(m):",
"- x[a[i][0], a[i][1]] += 1",
"+np.add.at(x, (a[:, 0], a[:, 1]), 1)"
] | false | 0.198674 | 0.270614 | 0.734161 | [
"s036876361",
"s250792567"
] |
u564589929 | p02819 | python | s030656868 | s575860031 | 30 | 21 | 3,316 | 3,316 | Accepted | Accepted | 30 | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): re... | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): re... | 41 | 41 | 1,000 | 1,017 | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | false | 0 | [
"- for i in range(2, X):",
"+ for i in range(2, int(pow(X, 0.5)) + 1):"
] | false | 0.062059 | 0.059835 | 1.037172 | [
"s030656868",
"s575860031"
] |
u644907318 | p03862 | python | s434806478 | s666385373 | 223 | 84 | 63,856 | 84,948 | Accepted | Accepted | 62.33 | N,x = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = 0
for i in range(1,N):
y = max(A[i]+A[i-1]-x,0)
if A[i]>=y:
A[i] -= y
else:
A[i] = 0
ans += y
print(ans) | N,x = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0
for i in range(1,N):
if A[i]+A[i-1]>x:
d = A[i]+A[i-1]-x
if A[i]>=d:
A[i] -= d
cnt += d
else:
A[i]=0
cnt += A[i]
d -= A[i]
A[i-... | 11 | 16 | 226 | 355 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
y = max(A[i] + A[i - 1] - x, 0)
if A[i] >= y:
A[i] -= y
else:
A[i] = 0
ans += y
print(ans)
| N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
for i in range(1, N):
if A[i] + A[i - 1] > x:
d = A[i] + A[i - 1] - x
if A[i] >= d:
A[i] -= d
cnt += d
else:
A[i] = 0
cnt += A[i]
d -= A[i]
... | false | 31.25 | [
"-ans = 0",
"+cnt = 0",
"- y = max(A[i] + A[i - 1] - x, 0)",
"- if A[i] >= y:",
"- A[i] -= y",
"- else:",
"- A[i] = 0",
"- ans += y",
"-print(ans)",
"+ if A[i] + A[i - 1] > x:",
"+ d = A[i] + A[i - 1] - x",
"+ if A[i] >= d:",
"+ A[i] -= d... | false | 0.04032 | 0.04032 | 1.000001 | [
"s434806478",
"s666385373"
] |
u729133443 | p03251 | python | s174496927 | s539628531 | 23 | 18 | 2,940 | 3,060 | Accepted | Accepted | 21.74 | (*z,X,Y),x,y=eval('map(int,input().split()),'*3);print(('No War'[3*(max(X,*x)>=min(Y,*y)):])) | (*_,X,Y),x,y=eval('map(int,input().split()),'*3);print(('No'*(max(X,*x)<min(Y,*y)),'War')) | 1 | 1 | 91 | 88 | (*z, X, Y), x, y = eval("map(int,input().split())," * 3)
print(("No War"[3 * (max(X, *x) >= min(Y, *y)) :]))
| (*_, X, Y), x, y = eval("map(int,input().split())," * 3)
print(("No" * (max(X, *x) < min(Y, *y)), "War"))
| false | 0 | [
"-(*z, X, Y), x, y = eval(\"map(int,input().split()),\" * 3)",
"-print((\"No War\"[3 * (max(X, *x) >= min(Y, *y)) :]))",
"+(*_, X, Y), x, y = eval(\"map(int,input().split()),\" * 3)",
"+print((\"No\" * (max(X, *x) < min(Y, *y)), \"War\"))"
] | false | 0.036291 | 0.055553 | 0.653274 | [
"s174496927",
"s539628531"
] |
u864641771 | p02713 | python | s526298321 | s123492433 | 1,889 | 1,089 | 9,120 | 9,120 | Accepted | Accepted | 42.35 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K+1):
for b in range(1, K+1):
for c in range(1, K+1):
ans += gcd(gcd(a, b), c)
print(ans) | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K+1):
for b in range(1, K+1):
x = gcd(a, b)
for c in range(1, K+1):
ans += gcd(x, c)
print(ans) | 9 | 10 | 186 | 201 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
| from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
x = gcd(a, b)
for c in range(1, K + 1):
ans += gcd(x, c)
print(ans)
| false | 10 | [
"+ x = gcd(a, b)",
"- ans += gcd(gcd(a, b), c)",
"+ ans += gcd(x, c)"
] | false | 0.055061 | 0.117782 | 0.467481 | [
"s526298321",
"s123492433"
] |
u678505520 | p02724 | python | s115207292 | s386774589 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | x = int(eval(input()))
y = x//500
print((y*1000+(x%500//5)*5)) | x = int(eval(input()))
print((1000*(x//500) + 5*((x//5)%100))) | 3 | 2 | 56 | 55 | x = int(eval(input()))
y = x // 500
print((y * 1000 + (x % 500 // 5) * 5))
| x = int(eval(input()))
print((1000 * (x // 500) + 5 * ((x // 5) % 100)))
| false | 33.333333 | [
"-y = x // 500",
"-print((y * 1000 + (x % 500 // 5) * 5))",
"+print((1000 * (x // 500) + 5 * ((x // 5) % 100)))"
] | false | 0.048132 | 0.049563 | 0.971126 | [
"s115207292",
"s386774589"
] |
u156815136 | p03937 | python | s104890711 | s226262259 | 37 | 21 | 5,148 | 3,316 | Accepted | Accepted | 43.24 | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import defaultdict
#import bisect
#
# d = m - k... | 76 | 37 | 2,106 | 834 | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
from collections import defaultdict
# import bisect
#
# d = m - k[... | false | 51.315789 | [
"-from statistics import median",
"-",
"+# from statistics import median",
"-from fractions import gcd",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"+# from fractions import gcd",
"+# from itertools import combinations # (string,3) 3回",
"+# from collect... | false | 0.04295 | 0.076941 | 0.558222 | [
"s104890711",
"s226262259"
] |
u576432509 | p03127 | python | s531034384 | s197198640 | 148 | 80 | 15,020 | 16,196 | Accepted | Accepted | 45.95 | def gcdf(a):
a.sort()
a0=a[0]
a=[int(x%a0) for x in a if x%a0 != 0]
if len(a)==0:
return a0
else:
a.append(a0)
a0=min(a)
return gcdf(a)
n=int(eval(input()))
a=list(map(int,input().split()))
gcdx=gcdf(a)
print(gcdx)
| from functools import reduce
#from math import gcd
from fractions import gcd
n=int(eval(input()))
a=list(map(int,input().split()))
print((reduce(gcd,a))) | 17 | 8 | 281 | 158 | def gcdf(a):
a.sort()
a0 = a[0]
a = [int(x % a0) for x in a if x % a0 != 0]
if len(a) == 0:
return a0
else:
a.append(a0)
a0 = min(a)
return gcdf(a)
n = int(eval(input()))
a = list(map(int, input().split()))
gcdx = gcdf(a)
print(gcdx)
| from functools import reduce
# from math import gcd
from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
print((reduce(gcd, a)))
| false | 52.941176 | [
"-def gcdf(a):",
"- a.sort()",
"- a0 = a[0]",
"- a = [int(x % a0) for x in a if x % a0 != 0]",
"- if len(a) == 0:",
"- return a0",
"- else:",
"- a.append(a0)",
"- a0 = min(a)",
"- return gcdf(a)",
"+from functools import reduce",
"+# from math import ... | false | 0.03607 | 0.043404 | 0.831041 | [
"s531034384",
"s197198640"
] |
u144913062 | p02912 | python | s257192203 | s159238354 | 1,389 | 164 | 15,292 | 14,252 | Accepted | Accepted | 88.19 | from queue import PriorityQueue
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
queue = PriorityQueue(N)
for a in A:
queue.put(-a)
for i in range(M):
a = -queue.get()
a /= 2
queue.put(-a)
ans = 0
for i in range(N):
ans += int(-queue.get())
print(ans)
| from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapify(A)
for i in range(M):
heappush(A, -(-heappop(A) // 2))
print((-sum(A)))
| 18 | 10 | 313 | 222 | from queue import PriorityQueue
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
queue = PriorityQueue(N)
for a in A:
queue.put(-a)
for i in range(M):
a = -queue.get()
a /= 2
queue.put(-a)
ans = 0
for i in range(N):
ans += int(-queue.get())
print(ans)
| from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapify(A)
for i in range(M):
heappush(A, -(-heappop(A) // 2))
print((-sum(A)))
| false | 44.444444 | [
"-from queue import PriorityQueue",
"+from heapq import heapify, heappush, heappop",
"-A = list(map(int, input().split()))",
"-queue = PriorityQueue(N)",
"-for a in A:",
"- queue.put(-a)",
"+A = list([-int(x) for x in input().split()])",
"+heapify(A)",
"- a = -queue.get()",
"- a /= 2",
... | false | 0.069158 | 0.081032 | 0.853465 | [
"s257192203",
"s159238354"
] |
u581187895 | p02972 | python | s093186075 | s083844624 | 233 | 190 | 17,220 | 12,700 | Accepted | Accepted | 18.45 | N = int(eval(input()))
A = [None] + [int(i) for i in input().split()]
ans = []
choose = [0] * (N+1)
for n in range(N, 0, -1):
x = sum(choose[2*n::n])
if x % 2 == A[n]:
continue
choose[n] += 1
ans.append(str(n))
print((len(ans)))
print((' '.join(ans))) | import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = int(inp())
A = [0] + list(map(int, inp().split()))
# A[i]余りが1: sum(A[i::i])が奇数
for i in range(N//2, 0... | 14 | 21 | 270 | 454 | N = int(eval(input()))
A = [None] + [int(i) for i in input().split()]
ans = []
choose = [0] * (N + 1)
for n in range(N, 0, -1):
x = sum(choose[2 * n :: n])
if x % 2 == A[n]:
continue
choose[n] += 1
ans.append(str(n))
print((len(ans)))
print((" ".join(ans)))
| import sys
sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline
def inpS():
return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N = int(inp())
A = [0] + list(map(int, inp().split()))
# A[i]余りが1: sum(A[i::i])が奇数
for i in range(N // 2, 0, -1)... | false | 33.333333 | [
"-N = int(eval(input()))",
"-A = [None] + [int(i) for i in input().split()]",
"-ans = []",
"-choose = [0] * (N + 1)",
"-for n in range(N, 0, -1):",
"- x = sum(choose[2 * n :: n])",
"- if x % 2 == A[n]:",
"- continue",
"- choose[n] += 1",
"- ans.append(str(n))",
"+import sys",
... | false | 0.043675 | 0.042033 | 1.039066 | [
"s093186075",
"s083844624"
] |
u968166680 | p02793 | python | s678861660 | s232240991 | 138 | 116 | 86,516 | 86,120 | Accepted | Accepted | 15.94 | import sys
from collections import defaultdict, Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
N_MAX = 10 ** 6
min_factor = list(... | import sys
from collections import defaultdict, Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
N_MAX = 10 ** 6
min_factor = list(... | 59 | 55 | 1,299 | 1,207 | import sys
from collections import defaultdict, Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
N_MAX = 10**6
min_factor = list(range(N_MAX + 1))
... | import sys
from collections import defaultdict, Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
N_MAX = 10**6
min_factor = list(range(N_MAX + 1))
... | false | 6.779661 | [
"- f = min_factor[n]",
"- p = 0",
"- while min_factor[n] == f:",
"- p += 1",
"- n //= f",
"- a[f] = p",
"+ a[min_factor[n]] += 1",
"+ n //= min_factor[n]"
] | false | 0.365909 | 0.439768 | 0.832049 | [
"s678861660",
"s232240991"
] |
u832381404 | p03448 | python | s710088634 | s503799645 | 52 | 18 | 3,060 | 3,060 | Accepted | Accepted | 65.38 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
cnt = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if(500*i+100*j+50*k == x):
cnt+=1
print(cnt)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
cnt = 0
for i in range(a+1):
for j in range(b+1):
z = x-(500*i+100*j)
if(z < 0):
break
if(z/50 <= c):
cnt += 1
print(cnt)
| 13 | 15 | 238 | 258 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
cnt = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
cnt += 1
print(cnt)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
cnt = 0
for i in range(a + 1):
for j in range(b + 1):
z = x - (500 * i + 100 * j)
if z < 0:
break
if z / 50 <= c:
cnt += 1
print(cnt)
| false | 13.333333 | [
"- for k in range(c + 1):",
"- if 500 * i + 100 * j + 50 * k == x:",
"- cnt += 1",
"+ z = x - (500 * i + 100 * j)",
"+ if z < 0:",
"+ break",
"+ if z / 50 <= c:",
"+ cnt += 1"
] | false | 0.108846 | 0.039291 | 2.770246 | [
"s710088634",
"s503799645"
] |
u047102107 | p03569 | python | s124016544 | s498437741 | 223 | 193 | 47,216 | 47,088 | Accepted | Accepted | 13.45 | from collections import Counter
s = eval(input())
snotx = "".join([ch for ch in s if ch != 'x'])
if s == s[::-1]:
print((0))
exit()
if snotx != snotx[::-1]:
print((-1))
exit()
# 回数を合わせる
# print(s)
# print(snotx)
# xのrun-length
rl = []
i = 0
while i < len(s):
j = i
whi... | from collections import Counter
s = eval(input())
snotx = "".join([ch for ch in s if ch != 'x'])
if s == s[::-1]:
print((0))
exit()
if snotx != snotx[::-1]:
print((-1))
exit()
# 両端から見てくる (解説解法)
index_l = 0
index_r = len(s) - 1
count = 0
while index_l < index_r:
if s[index_l] ==... | 36 | 31 | 598 | 568 | from collections import Counter
s = eval(input())
snotx = "".join([ch for ch in s if ch != "x"])
if s == s[::-1]:
print((0))
exit()
if snotx != snotx[::-1]:
print((-1))
exit()
# 回数を合わせる
# print(s)
# print(snotx)
# xのrun-length
rl = []
i = 0
while i < len(s):
j = i
while j < len(s) and s[j] == "... | from collections import Counter
s = eval(input())
snotx = "".join([ch for ch in s if ch != "x"])
if s == s[::-1]:
print((0))
exit()
if snotx != snotx[::-1]:
print((-1))
exit()
# 両端から見てくる (解説解法)
index_l = 0
index_r = len(s) - 1
count = 0
while index_l < index_r:
if s[index_l] == s[index_r]:
... | false | 13.888889 | [
"-# 回数を合わせる",
"-# print(s)",
"-# print(snotx)",
"-# xのrun-length",
"-rl = []",
"-i = 0",
"-while i < len(s):",
"- j = i",
"- while j < len(s) and s[j] == \"x\":",
"- j += 1",
"- rl.append(j - i)",
"- i = j + 1",
"-if s[-1] != \"x\":",
"- rl.append(0)",
"-# run-lengt... | false | 0.062727 | 0.072456 | 0.865725 | [
"s124016544",
"s498437741"
] |
u453055089 | p03163 | python | s179038828 | s864678611 | 502 | 301 | 120,684 | 150,256 | Accepted | Accepted | 40.04 | N, W = list(map(int, input().split()))
w = [0]*N
v = [0]*N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[0]*(W+1) for _ in range(N+1)]
# dp[i][sum_w]
# i-1番目までの品物から重さがsum_wを超えないように選んだ時の価値の総和
# sum_w = 0, 1, 2, ... ,W
for i in range(N):
for sum_w in range(W+1):
if ... | n, W = list(map(int, input().split()))
w, v = [0]*n, [0]*n
for i in range(n):
w[i], v[i] = list(map(int, input().split()))
dp = [[0]*(W+1) for i in range(n+1)]
#i品目までの中から重さwを超えないように選んだときの価値の総和の最大値
for i in range(1, n+1):
for j in range(W+1):
if j - w[i-1] >= 0:
dp[i][j] = max(dp[i... | 18 | 14 | 462 | 409 | N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(N + 1)]
# dp[i][sum_w]
# i-1番目までの品物から重さがsum_wを超えないように選んだ時の価値の総和
# sum_w = 0, 1, 2, ... ,W
for i in range(N):
for sum_w in range(W + 1):
if sum... | n, W = list(map(int, input().split()))
w, v = [0] * n, [0] * n
for i in range(n):
w[i], v[i] = list(map(int, input().split()))
dp = [[0] * (W + 1) for i in range(n + 1)]
# i品目までの中から重さwを超えないように選んだときの価値の総和の最大値
for i in range(1, n + 1):
for j in range(W + 1):
if j - w[i - 1] >= 0:
dp[i][j] = ma... | false | 22.222222 | [
"-N, W = list(map(int, input().split()))",
"-w = [0] * N",
"-v = [0] * N",
"-for i in range(N):",
"+n, W = list(map(int, input().split()))",
"+w, v = [0] * n, [0] * n",
"+for i in range(n):",
"-dp = [[0] * (W + 1) for _ in range(N + 1)]",
"-# dp[i][sum_w]",
"-# i-1番目までの品物から重さがsum_wを超えないように選んだ時の価値の... | false | 0.042794 | 0.044592 | 0.959675 | [
"s179038828",
"s864678611"
] |
u556225812 | p03416 | python | s350751198 | s918977401 | 54 | 45 | 2,940 | 2,940 | Accepted | Accepted | 16.67 | A, B = list(map(int, input().split()))
cnt = 0
for x in range(A, B + 1):
X = str(x)
if X == X[::-1]:
cnt += 1
print(cnt) | A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B+1):
x = str(i)
if x[0] == x[4] and x[1] == x[3]:
cnt += 1
print(cnt) | 7 | 7 | 136 | 143 | A, B = list(map(int, input().split()))
cnt = 0
for x in range(A, B + 1):
X = str(x)
if X == X[::-1]:
cnt += 1
print(cnt)
| A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B + 1):
x = str(i)
if x[0] == x[4] and x[1] == x[3]:
cnt += 1
print(cnt)
| false | 0 | [
"-for x in range(A, B + 1):",
"- X = str(x)",
"- if X == X[::-1]:",
"+for i in range(A, B + 1):",
"+ x = str(i)",
"+ if x[0] == x[4] and x[1] == x[3]:"
] | false | 0.132186 | 0.131519 | 1.005072 | [
"s350751198",
"s918977401"
] |
u562935282 | p03721 | python | s999129912 | s346705351 | 475 | 315 | 29,912 | 16,688 | Accepted | Accepted | 33.68 | def inpl(): return input().split()
n, k = list(map(int, inpl()))
M = list(list(map(int, inpl())) for _ in range(n))
M = sorted(M, key=lambda x:x[0])
for i in range(n):
a, b = M[i]
if k <= b:
print(a)
exit()
else:
k -= b | def main():
from heapq import heappush, heappop
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
h = []
for _ in range(N):
a, b = list(map(int, input().split()))
heappush(h, (a, b))
while h:
a, b = heappop(h)
K -=... | 11 | 23 | 259 | 417 | def inpl():
return input().split()
n, k = list(map(int, inpl()))
M = list(list(map(int, inpl())) for _ in range(n))
M = sorted(M, key=lambda x: x[0])
for i in range(n):
a, b = M[i]
if k <= b:
print(a)
exit()
else:
k -= b
| def main():
from heapq import heappush, heappop
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
h = []
for _ in range(N):
a, b = list(map(int, input().split()))
heappush(h, (a, b))
while h:
a, b = heappop(h)
K -= b
if K <=... | false | 52.173913 | [
"-def inpl():",
"- return input().split()",
"+def main():",
"+ from heapq import heappush, heappop",
"+ import sys",
"+",
"+ input = sys.stdin.readline",
"+ N, K = list(map(int, input().split()))",
"+ h = []",
"+ for _ in range(N):",
"+ a, b = list(map(int, input().sp... | false | 0.066961 | 0.110233 | 0.607452 | [
"s999129912",
"s346705351"
] |
u945181840 | p03599 | python | s254016679 | s593708902 | 391 | 320 | 3,064 | 3,064 | Accepted | Accepted | 18.16 | A, B, C, D, E, F = list(map(int, input().split()))
ans = [100 * A, 0]
c = 0
for i in range(1, F // (100 * A) + 1):
for j in range((F - 100 * A * i) // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
if a > F:
break
for k in range((F - a) // C + 1):
for l in r... | A, B, C, D, E, F = list(map(int, input().split()))
ans = [100 * A, 0]
c = 0
for i in range(1, F // (100 * A) + 1):
for j in range((F - 100 * A * i) // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
for k in range((F - a) // C + 1):
for l in range((F - a - C * k) // D + 1):
... | 21 | 19 | 704 | 651 | A, B, C, D, E, F = list(map(int, input().split()))
ans = [100 * A, 0]
c = 0
for i in range(1, F // (100 * A) + 1):
for j in range((F - 100 * A * i) // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
if a > F:
break
for k in range((F - a) // C + 1):
for l in range((F - a... | A, B, C, D, E, F = list(map(int, input().split()))
ans = [100 * A, 0]
c = 0
for i in range(1, F // (100 * A) + 1):
for j in range((F - 100 * A * i) // (100 * B) + 1):
a = 100 * A * i + 100 * B * j
for k in range((F - a) // C + 1):
for l in range((F - a - C * k) // D + 1):
... | false | 9.52381 | [
"- if a > F:",
"- break",
"- if (A * i + B * j) * E >= b and a + b <= F:",
"+ if (A * i + B * j) * E >= b:"
] | false | 0.089173 | 0.078213 | 1.140126 | [
"s254016679",
"s593708902"
] |
u327532412 | p03162 | python | s219040210 | s840101869 | 419 | 273 | 3,064 | 9,164 | Accepted | Accepted | 34.84 | n = int(eval(input()))
dp = [0] * 3
for i in range(n):
a, b, c = list(map(int, input().split()))
dp = [a + max(dp[1], dp[2]), b + max(dp[0], dp[2]), c + max(dp[0], dp[1])]
print((max(dp))) | N = int(eval(input()))
dp = [0, 0, 0]
for i in range(N):
a, b, c = list(map(int, input().split()))
tmp_a = a + max(dp[1], dp[2])
tmp_b = b + max(dp[0], dp[2])
tmp_c = c + max(dp[0], dp[1])
dp = [tmp_a, tmp_b, tmp_c]
print((max(dp)))
| 6 | 9 | 187 | 247 | n = int(eval(input()))
dp = [0] * 3
for i in range(n):
a, b, c = list(map(int, input().split()))
dp = [a + max(dp[1], dp[2]), b + max(dp[0], dp[2]), c + max(dp[0], dp[1])]
print((max(dp)))
| N = int(eval(input()))
dp = [0, 0, 0]
for i in range(N):
a, b, c = list(map(int, input().split()))
tmp_a = a + max(dp[1], dp[2])
tmp_b = b + max(dp[0], dp[2])
tmp_c = c + max(dp[0], dp[1])
dp = [tmp_a, tmp_b, tmp_c]
print((max(dp)))
| false | 33.333333 | [
"-n = int(eval(input()))",
"-dp = [0] * 3",
"-for i in range(n):",
"+N = int(eval(input()))",
"+dp = [0, 0, 0]",
"+for i in range(N):",
"- dp = [a + max(dp[1], dp[2]), b + max(dp[0], dp[2]), c + max(dp[0], dp[1])]",
"+ tmp_a = a + max(dp[1], dp[2])",
"+ tmp_b = b + max(dp[0], dp[2])",
"+ ... | false | 0.037272 | 0.036829 | 1.012018 | [
"s219040210",
"s840101869"
] |
u729133443 | p03128 | python | s919891518 | s787601880 | 168 | 154 | 15,332 | 15,332 | Accepted | Accepted | 8.33 | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*n*9
for i in range(n):
for j in a:
c=(0,2,5,5,4,5,6,3,7,6)[j]
if d[i]or i<1:d[i+c]=max(d[i+c],d[i]*10+j)
print((d[n])) | n,m,*a=list(map(int,open(0).read().split()))
d=[0]*n*9
for i in range(n):
for j in a:
if d[i]or i<1:c=i+(0,2,5,5,4,5,6,3,7,6)[j];d[c]=max(d[c],d[i]*10+j)
print((d[n])) | 7 | 6 | 172 | 167 | n, m, *a = list(map(int, open(0).read().split()))
d = [0] * n * 9
for i in range(n):
for j in a:
c = (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)[j]
if d[i] or i < 1:
d[i + c] = max(d[i + c], d[i] * 10 + j)
print((d[n]))
| n, m, *a = list(map(int, open(0).read().split()))
d = [0] * n * 9
for i in range(n):
for j in a:
if d[i] or i < 1:
c = i + (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)[j]
d[c] = max(d[c], d[i] * 10 + j)
print((d[n]))
| false | 14.285714 | [
"- c = (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)[j]",
"- d[i + c] = max(d[i + c], d[i] * 10 + j)",
"+ c = i + (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)[j]",
"+ d[c] = max(d[c], d[i] * 10 + j)"
] | false | 0.101034 | 0.095097 | 1.062429 | [
"s919891518",
"s787601880"
] |
u936985471 | p02734 | python | s928371273 | s373868929 | 912 | 805 | 287,276 | 287,132 | Accepted | Accepted | 11.73 | import sys
readline = sys.stdin.readline
DIV = 998244353
N,S = list(map(int,readline().split()))
A = list(map(int,readline().split()))
# ある数の取り得る状態は以下
# (1)Lの区間がまだ開始していない
# (2)L-Rの区間に含まれ、和に使われている
# (3)L-Rの区間に含まれ、和に使われていない
# (4)Rの区間が終了している
# dp[i][j][k] = i - 1個目まで処理したときに、区間の開始状況がjで、総和がkになっている個数
dp = [[... | import sys
readline = sys.stdin.readline
DIV = 998244353
N,S = list(map(int,readline().split()))
A = list(map(int,readline().split()))
# ある数の取り得る状態は以下
# (1)Lの区間がまだ開始していない
# (2)L-Rの区間に含まれ、和に使われている
# (3)L-Rの区間に含まれ、和に使われていない
# (4)Rの区間が終了している
# dp[i][j][k] = i - 1個目まで処理したときに、区間の開始状況がjで、総和がkになっている個数
dp = [[... | 50 | 40 | 1,291 | 1,001 | import sys
readline = sys.stdin.readline
DIV = 998244353
N, S = list(map(int, readline().split()))
A = list(map(int, readline().split()))
# ある数の取り得る状態は以下
# (1)Lの区間がまだ開始していない
# (2)L-Rの区間に含まれ、和に使われている
# (3)L-Rの区間に含まれ、和に使われていない
# (4)Rの区間が終了している
# dp[i][j][k] = i - 1個目まで処理したときに、区間の開始状況がjで、総和がkになっている個数
dp = [[[0] * (S + 1)... | import sys
readline = sys.stdin.readline
DIV = 998244353
N, S = list(map(int, readline().split()))
A = list(map(int, readline().split()))
# ある数の取り得る状態は以下
# (1)Lの区間がまだ開始していない
# (2)L-Rの区間に含まれ、和に使われている
# (3)L-Rの区間に含まれ、和に使われていない
# (4)Rの区間が終了している
# dp[i][j][k] = i - 1個目まで処理したときに、区間の開始状況がjで、総和がkになっている個数
dp = [[[0] * (S + 1)... | false | 20 | [
"- # (2)区間に含まれ、和に使われている(開始していない区間からくる)",
"+ # (2)区間に含まれ、和に使われている",
"- dp[i + 1][1][k + A[i]] %= DIV",
"- # (2)区間に含まれ、和に使われている(開始済みの区間からくる)",
"- if k + A[i] <= S:",
"- # (3)区間に含まれ、和に使われていない(開始していない区間からくる)",
"+ # (3)区間に含まれ、和に使われていない",
"- dp[i +... | false | 0.049106 | 0.048491 | 1.012683 | [
"s928371273",
"s373868929"
] |
u185249212 | p03030 | python | s332991632 | s043100337 | 288 | 28 | 65,388 | 4,080 | Accepted | Accepted | 90.28 |
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
import math
import string
import fractions
import re
import array
import copy
import functools
import operator
import collections
import itert... |
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
# return int(n*m/... | 53 | 74 | 1,042 | 1,766 | # import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
import math
import string
import fractions
import re
import array
import copy
import functools
import operator
import collections
import itertools
import bisect... | # import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
# return int(n*m/gcd(n,m))
# i... | false | 28.378378 | [
"-import math",
"-import string",
"-import fractions",
"-import re",
"-import array",
"-import copy",
"-import functools",
"-import operator",
"-import collections",
"-import itertools",
"-import bisect",
"-import heapq",
"-from heapq import heappush",
"-from heapq import heappop",
"+# i... | false | 0.043522 | 0.045372 | 0.959216 | [
"s332991632",
"s043100337"
] |
u480138356 | p03800 | python | s481601456 | s969979002 | 178 | 127 | 3,700 | 3,572 | Accepted | Accepted | 28.65 | def main():
N = int(eval(input()))
s = eval(input())
# c = ["WS", "SW", "SS", "WW"]
c = ["SW", "WS", "SS", "WW"]
ok = False
for tmp in c:
ans = tmp
for i in range(1, N):
if s[i] == "o":# oの時
if ans[i-1] == "S" and ans[i] == "S":
... | def main():
N = int(eval(input()))
s = eval(input())
c = ["SW", "WS", "SS", "WW"]
o_ = {"SS": "S", "WS": "W", "SW": "W", "WW": "S"}
x_ = {"SS": "W", "WS": "S", "SW": "S", "WW": "W"}
_o_ = ["SSS", "WSW", "SWW", "WWS"]
_x_ = ["WSS", "SSW", "SWS", "WWW"]
ok = False
for tmp in c... | 52 | 33 | 1,874 | 892 | def main():
N = int(eval(input()))
s = eval(input())
# c = ["WS", "SW", "SS", "WW"]
c = ["SW", "WS", "SS", "WW"]
ok = False
for tmp in c:
ans = tmp
for i in range(1, N):
if s[i] == "o": # oの時
if ans[i - 1] == "S" and ans[i] == "S":
... | def main():
N = int(eval(input()))
s = eval(input())
c = ["SW", "WS", "SS", "WW"]
o_ = {"SS": "S", "WS": "W", "SW": "W", "WW": "S"}
x_ = {"SS": "W", "WS": "S", "SW": "S", "WW": "W"}
_o_ = ["SSS", "WSW", "SWW", "WWS"]
_x_ = ["WSS", "SSW", "SWS", "WWW"]
ok = False
for tmp in c:
... | false | 36.538462 | [
"- # c = [\"WS\", \"SW\", \"SS\", \"WW\"]",
"+ o_ = {\"SS\": \"S\", \"WS\": \"W\", \"SW\": \"W\", \"WW\": \"S\"}",
"+ x_ = {\"SS\": \"W\", \"WS\": \"S\", \"SW\": \"S\", \"WW\": \"W\"}",
"+ _o_ = [\"SSS\", \"WSW\", \"SWW\", \"WWS\"]",
"+ _x_ = [\"WSS\", \"SSW\", \"SWS\", \"WWW\"]",
"- ... | false | 0.053521 | 0.071469 | 0.748866 | [
"s481601456",
"s969979002"
] |
u338225045 | p03556 | python | s326843003 | s462630232 | 29 | 19 | 3,064 | 3,060 | Accepted | Accepted | 34.48 | N = int( eval(input()) )
ans = 0
for i in range( int(N**0.5)+1 ):
ans = max( ans, i*i )
print( ans ) | N = int( eval(input()) )
print(( int(N**0.5)**2 )) | 7 | 3 | 106 | 45 | N = int(eval(input()))
ans = 0
for i in range(int(N**0.5) + 1):
ans = max(ans, i * i)
print(ans)
| N = int(eval(input()))
print((int(N**0.5) ** 2))
| false | 57.142857 | [
"-ans = 0",
"-for i in range(int(N**0.5) + 1):",
"- ans = max(ans, i * i)",
"-print(ans)",
"+print((int(N**0.5) ** 2))"
] | false | 0.038602 | 0.050452 | 0.765118 | [
"s326843003",
"s462630232"
] |
u815878613 | p02983 | python | s912927735 | s861895144 | 832 | 220 | 2,940 | 75,976 | Accepted | Accepted | 73.56 | L, R = list(map(int, input().split()))
if R - L >= 2019:
ans = 0
else:
ans = 2019
for i in range(L, R):
x = i % 2019
for j in range(i + 1, R + 1):
a = x * j
ans = min(a % 2019, ans)
print(ans)
| import numpy as np
L, R = list(map(int, input().split()))
if R - L >= 2019:
ans = 0
else:
A = np.arange(L, R + 1) % 2019
B = A.reshape(1, -1)
C = (A.reshape(-1, 1) * B) % 2019
r = np.arange(len(A))
C[r, r] = 2019
ans = np.min(C)
print(ans)
| 13 | 15 | 253 | 279 | L, R = list(map(int, input().split()))
if R - L >= 2019:
ans = 0
else:
ans = 2019
for i in range(L, R):
x = i % 2019
for j in range(i + 1, R + 1):
a = x * j
ans = min(a % 2019, ans)
print(ans)
| import numpy as np
L, R = list(map(int, input().split()))
if R - L >= 2019:
ans = 0
else:
A = np.arange(L, R + 1) % 2019
B = A.reshape(1, -1)
C = (A.reshape(-1, 1) * B) % 2019
r = np.arange(len(A))
C[r, r] = 2019
ans = np.min(C)
print(ans)
| false | 13.333333 | [
"+import numpy as np",
"+",
"- ans = 2019",
"- for i in range(L, R):",
"- x = i % 2019",
"- for j in range(i + 1, R + 1):",
"- a = x * j",
"- ans = min(a % 2019, ans)",
"+ A = np.arange(L, R + 1) % 2019",
"+ B = A.reshape(1, -1)",
"+ C = (A.resh... | false | 0.041164 | 0.347428 | 0.118482 | [
"s912927735",
"s861895144"
] |
u209619667 | p03632 | python | s780023067 | s424056817 | 24 | 17 | 3,316 | 2,940 | Accepted | Accepted | 29.17 | A,B,C,D = list(map(int,input().split()))
AC = max(A,C)
BD = min(B,D)
flag = (BD-AC) <= 0
if flag:
print((0))
else:
print((BD-AC))
| A,B,C,D = list(map(int,input().split()))
AC = max(A,C)
BD = min(B,D)
if (BD-AC) <= 0:
print((0))
else:
print((BD-AC)) | 8 | 7 | 131 | 117 | A, B, C, D = list(map(int, input().split()))
AC = max(A, C)
BD = min(B, D)
flag = (BD - AC) <= 0
if flag:
print((0))
else:
print((BD - AC))
| A, B, C, D = list(map(int, input().split()))
AC = max(A, C)
BD = min(B, D)
if (BD - AC) <= 0:
print((0))
else:
print((BD - AC))
| false | 12.5 | [
"-flag = (BD - AC) <= 0",
"-if flag:",
"+if (BD - AC) <= 0:"
] | false | 0.083494 | 0.036548 | 2.284504 | [
"s780023067",
"s424056817"
] |
u634576930 | p02754 | python | s854127364 | s152643972 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N, A, B, =list(map(int, input().split()))
ans=N//(A+B)*A
rem=N%(A+B)
ans+=min(rem,A)
print(ans)
| N, A, B = list(map(int,input().split()))
ans = N//(A + B)*A
rem = N%(A + B)
ans+=min(rem,A)
print(ans) | 5 | 6 | 94 | 102 | (
N,
A,
B,
) = list(map(int, input().split()))
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
| N, A, B = list(map(int, input().split()))
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
| false | 16.666667 | [
"-(",
"- N,",
"- A,",
"- B,",
"-) = list(map(int, input().split()))",
"+N, A, B = list(map(int, input().split()))"
] | false | 0.052451 | 0.007534 | 6.961848 | [
"s854127364",
"s152643972"
] |
u202634017 | p02866 | python | s714824015 | s467988633 | 191 | 171 | 13,908 | 14,396 | Accepted | Accepted | 10.47 |
n = int(eval(input()))
d = list(map(int,input().split()))
db = [0] * (max(d)+1)
MOD = 998244353
#距離iの頂点の数をdb[i]に保存
for i in range(n):
db[d[i]] += 1
if (d[0] != 0)|(db[0] != 1):
print((0))
exit()
ans = 1
for i in range(len(db)-1):
ans *= pow(db[i],db[i+1],MOD)
print((ans%MOD))
| n = int(eval(input()))
d = list(map(int,input().split()))
db = [0] * (max(d)+1)
MOD = 998244353
#距離iの頂点の数をdb[i]に保存
for i in range(n):
db[d[i]] += 1
if (d[0] != 0)|(db[0] != 1):
print((0))
exit()
ans = 1
for i in range(len(db)-1):
ans *= db[i]**db[i+1]%MOD
print((ans%MOD))
| 20 | 19 | 308 | 302 | n = int(eval(input()))
d = list(map(int, input().split()))
db = [0] * (max(d) + 1)
MOD = 998244353
# 距離iの頂点の数をdb[i]に保存
for i in range(n):
db[d[i]] += 1
if (d[0] != 0) | (db[0] != 1):
print((0))
exit()
ans = 1
for i in range(len(db) - 1):
ans *= pow(db[i], db[i + 1], MOD)
print((ans % MOD))
| n = int(eval(input()))
d = list(map(int, input().split()))
db = [0] * (max(d) + 1)
MOD = 998244353
# 距離iの頂点の数をdb[i]に保存
for i in range(n):
db[d[i]] += 1
if (d[0] != 0) | (db[0] != 1):
print((0))
exit()
ans = 1
for i in range(len(db) - 1):
ans *= db[i] ** db[i + 1] % MOD
print((ans % MOD))
| false | 5 | [
"- ans *= pow(db[i], db[i + 1], MOD)",
"+ ans *= db[i] ** db[i + 1] % MOD"
] | false | 0.06442 | 0.065997 | 0.976104 | [
"s714824015",
"s467988633"
] |
u735069283 | p03220 | python | s596182125 | s249870568 | 153 | 19 | 13,520 | 3,064 | Accepted | Accepted | 87.58 | import numpy as np
N = int(eval(input()))
T,A =list(map(int,input().split()))
H = np.array(input().split(),dtype=np.float64)
x=np.abs(T-H*0.006-A)
ans=np.argmin(x)+1
print(ans) | N=int(eval(input()))
T,A=list(map(int,input().split()))
H=[int(x) for x in input().split()]
answer=0
deff=float('inf')
for i in range(N):
deff=min(deff,abs(H[i]-(T-A)/0.006))
if deff==abs(H[i]-(T-A)/0.006):
answer=i+1
print(answer) | 7 | 10 | 170 | 236 | import numpy as np
N = int(eval(input()))
T, A = list(map(int, input().split()))
H = np.array(input().split(), dtype=np.float64)
x = np.abs(T - H * 0.006 - A)
ans = np.argmin(x) + 1
print(ans)
| N = int(eval(input()))
T, A = list(map(int, input().split()))
H = [int(x) for x in input().split()]
answer = 0
deff = float("inf")
for i in range(N):
deff = min(deff, abs(H[i] - (T - A) / 0.006))
if deff == abs(H[i] - (T - A) / 0.006):
answer = i + 1
print(answer)
| false | 30 | [
"-import numpy as np",
"-",
"-H = np.array(input().split(), dtype=np.float64)",
"-x = np.abs(T - H * 0.006 - A)",
"-ans = np.argmin(x) + 1",
"-print(ans)",
"+H = [int(x) for x in input().split()]",
"+answer = 0",
"+deff = float(\"inf\")",
"+for i in range(N):",
"+ deff = min(deff, abs(H[i] - ... | false | 0.449201 | 0.044766 | 10.034499 | [
"s596182125",
"s249870568"
] |
u445624660 | p03457 | python | s109466024 | s362606799 | 416 | 256 | 3,064 | 9,080 | Accepted | Accepted | 38.46 | # from abs import math
n = int(eval(input()))
tmpt = 0
tmpx, tmpy = 0, 0
c = 0
def check(t, x, y):
if t>=x+y and ( (t%2==0 and (x+y)%2==0) or (t%2==1 and (x+y)%2==1) ):
return True
else:
return False
for i in range(n):
t, x, y = list(map(int, input().split()))
if x==tmpx ... | # 最高で進んでもtを超えることはできない
# 1ターンにつき1進むので偶奇をみる
n = int(eval(input()))
pre = [0, 0, 0] # time, x, y
for i in range(n):
t, x, y = list(map(int, input().split()))
t -= pre[0]
x -= pre[1]
y -= pre[2]
if t < abs(x) + abs(y) or (abs(x) + abs(y)) % 2 != t % 2:
print("No")
exit()
... | 32 | 15 | 574 | 340 | # from abs import math
n = int(eval(input()))
tmpt = 0
tmpx, tmpy = 0, 0
c = 0
def check(t, x, y):
if t >= x + y and (
(t % 2 == 0 and (x + y) % 2 == 0) or (t % 2 == 1 and (x + y) % 2 == 1)
):
return True
else:
return False
for i in range(n):
t, x, y = list(map(int, input().s... | # 最高で進んでもtを超えることはできない
# 1ターンにつき1進むので偶奇をみる
n = int(eval(input()))
pre = [0, 0, 0] # time, x, y
for i in range(n):
t, x, y = list(map(int, input().split()))
t -= pre[0]
x -= pre[1]
y -= pre[2]
if t < abs(x) + abs(y) or (abs(x) + abs(y)) % 2 != t % 2:
print("No")
exit()
pre = [t, x... | false | 53.125 | [
"-# from abs import math",
"+# 最高で進んでもtを超えることはできない",
"+# 1ターンにつき1進むので偶奇をみる",
"-tmpt = 0",
"-tmpx, tmpy = 0, 0",
"-c = 0",
"-",
"-",
"-def check(t, x, y):",
"- if t >= x + y and (",
"- (t % 2 == 0 and (x + y) % 2 == 0) or (t % 2 == 1 and (x + y) % 2 == 1)",
"- ):",
"- retu... | false | 0.046775 | 0.043126 | 1.08461 | [
"s109466024",
"s362606799"
] |
u497046426 | p02768 | python | s571652003 | s844505391 | 265 | 176 | 19,252 | 3,064 | Accepted | Accepted | 33.58 | def binom(n, r, mod):
if n < r or n < 0 or r < 0: return 0
if n - r < r: r = n - r
if r == 0: return 1
elif r == 1: return n
numerator = [(n - r + 1 + k) % mod for k in range(r)] # (n-r+1)*(n-r+2)*...*(n-1)*n
denominator = [1 + k for k in range(r)] # 1*2*...*(r-1)*r
... | def binom(n, r, mod):
if n < r or n < 0 or r < 0: return 0
if n - r < r: r = n - r
if r == 0: return 1
elif r == 1: return n
X = 1; Y = 1
for k in range(r):
X = (X * ((n - r + 1 + k) % mod)) % mod
Y = (Y * ((1 + k) % mod)) % mod
return X * pow(Y, mod-2, mod)
... | 20 | 17 | 632 | 469 | def binom(n, r, mod):
if n < r or n < 0 or r < 0:
return 0
if n - r < r:
r = n - r
if r == 0:
return 1
elif r == 1:
return n
numerator = [(n - r + 1 + k) % mod for k in range(r)] # (n-r+1)*(n-r+2)*...*(n-1)*n
denominator = [1 + k for k in range(r)] # 1*2*...*(r-... | def binom(n, r, mod):
if n < r or n < 0 or r < 0:
return 0
if n - r < r:
r = n - r
if r == 0:
return 1
elif r == 1:
return n
X = 1
Y = 1
for k in range(r):
X = (X * ((n - r + 1 + k) % mod)) % mod
Y = (Y * ((1 + k) % mod)) % mod
return X * p... | false | 15 | [
"- numerator = [(n - r + 1 + k) % mod for k in range(r)] # (n-r+1)*(n-r+2)*...*(n-1)*n",
"- denominator = [1 + k for k in range(r)] # 1*2*...*(r-1)*r"
] | false | 0.151024 | 0.105886 | 1.426291 | [
"s571652003",
"s844505391"
] |
u530383736 | p02685 | python | s632682828 | s002634273 | 864 | 411 | 9,248 | 40,300 | Accepted | Accepted | 52.43 | # -*- coding: utf-8 -*-
import sys
N,M,K = list(map(int, input().rstrip().split()))
#-----
if (M == 1) and (K == N-1):
print((1))
sys.exit()
elif (M == 1) and (K < N-1):
print((0))
sys.exit()
mod = 998244353
a = M * pow(M-1, N-1, mod)
inv_M1 = pow((M-1), mod-2, mod ) # inverse ele... | # -*- coding: utf-8 -*-
N,M,K = list(map(int, input().rstrip().split()))
#-----
# Calculate the Factorial and it's Inverse Element
fact = [0]*(N+1)
fact_inv = [0]*(N+1)
inv = [0]*(N+1)
mod = 998244353
fact[0] = fact[1] = 1
fact_inv[0] = fact_inv[1] = 1
inv[1] = 1
for i in range(2, N+1):
fact[i] ... | 36 | 38 | 612 | 806 | # -*- coding: utf-8 -*-
import sys
N, M, K = list(map(int, input().rstrip().split()))
# -----
if (M == 1) and (K == N - 1):
print((1))
sys.exit()
elif (M == 1) and (K < N - 1):
print((0))
sys.exit()
mod = 998244353
a = M * pow(M - 1, N - 1, mod)
inv_M1 = pow((M - 1), mod - 2, mod) # inverse element
co... | # -*- coding: utf-8 -*-
N, M, K = list(map(int, input().rstrip().split()))
# -----
# Calculate the Factorial and it's Inverse Element
fact = [0] * (N + 1)
fact_inv = [0] * (N + 1)
inv = [0] * (N + 1)
mod = 998244353
fact[0] = fact[1] = 1
fact_inv[0] = fact_inv[1] = 1
inv[1] = 1
for i in range(2, N + 1):
fact[i] = (... | false | 5.263158 | [
"-import sys",
"-",
"-if (M == 1) and (K == N - 1):",
"- print((1))",
"- sys.exit()",
"-elif (M == 1) and (K < N - 1):",
"- print((0))",
"- sys.exit()",
"+# Calculate the Factorial and it's Inverse Element",
"+fact = [0] * (N + 1)",
"+fact_inv = [0] * (N + 1)",
"+inv = [0] * (N + 1... | false | 0.0853 | 0.32911 | 0.259184 | [
"s632682828",
"s002634273"
] |
u268516119 | p03673 | python | s068793792 | s262620114 | 220 | 107 | 29,620 | 26,580 | Accepted | Accepted | 51.36 | import sys
fastinput=sys.stdin.readline
N=int(eval(input()))
a=[int(i) for i in fastinput().split()]
result=[None]*N
if N%2:#odd
c=(N-1)//2
for num,i in enumerate(a):
r=(num+1)//2
if num==0:
result[c]=i
else:
if num%2:#右半分
result[c+r]=... | import sys
fastinput=sys.stdin.readline
from collections import deque
N=int(eval(input()))
a=fastinput().split()
result=deque()
for k,i in enumerate(a):
if (N-k)%2:
result.appendleft(i)
else:result.append(i)
print((" ".join(result))) | 25 | 11 | 582 | 251 | import sys
fastinput = sys.stdin.readline
N = int(eval(input()))
a = [int(i) for i in fastinput().split()]
result = [None] * N
if N % 2: # odd
c = (N - 1) // 2
for num, i in enumerate(a):
r = (num + 1) // 2
if num == 0:
result[c] = i
else:
if num % 2: # 右半分
... | import sys
fastinput = sys.stdin.readline
from collections import deque
N = int(eval(input()))
a = fastinput().split()
result = deque()
for k, i in enumerate(a):
if (N - k) % 2:
result.appendleft(i)
else:
result.append(i)
print((" ".join(result)))
| false | 56 | [
"+from collections import deque",
"+",
"-a = [int(i) for i in fastinput().split()]",
"-result = [None] * N",
"-if N % 2: # odd",
"- c = (N - 1) // 2",
"- for num, i in enumerate(a):",
"- r = (num + 1) // 2",
"- if num == 0:",
"- result[c] = i",
"- else:",
... | false | 0.040646 | 0.03768 | 1.078712 | [
"s068793792",
"s262620114"
] |
u054106284 | p02889 | python | s400576954 | s358163481 | 1,874 | 1,107 | 20,228 | 23,864 | Accepted | Accepted | 40.93 | N, M, L = (int(i) for i in input().split())
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
graph = [[0]*N for i in range(N)]
for i in range(M):
a, b, c = (int(i) for i in input().split())
graph[a-1][b-1] = c
graph[b-1][a-1] = c
graph = c... | import sys
input = sys.stdin.readline
N, M, L = (int(i) for i in input().split())
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
graph = [[0]*N for i in range(N)]
for i in range(M):
a, b, c = (int(i) for i in input().split())
graph[a-1][b-1]... | 31 | 34 | 836 | 878 | N, M, L = (int(i) for i in input().split())
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
graph = [[0] * N for i in range(N)]
for i in range(M):
a, b, c = (int(i) for i in input().split())
graph[a - 1][b - 1] = c
graph[b - 1][a - 1] = c
graph = csr_m... | import sys
input = sys.stdin.readline
N, M, L = (int(i) for i in input().split())
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
graph = [[0] * N for i in range(N)]
for i in range(M):
a, b, c = (int(i) for i in input().split())
graph[a - 1][b - 1] = c
... | false | 8.823529 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 1.05893 | 0.439762 | 2.407961 | [
"s400576954",
"s358163481"
] |
u923279197 | p03578 | python | s510622426 | s064859347 | 446 | 410 | 122,960 | 122,832 | Accepted | Accepted | 8.07 | from collections import Counter
n = int(eval(input()))
D = list(map(int,input().split()))
D = Counter(D)
m = int(eval(input()))
T = list(map(int,input().split()))
T = Counter(T)
#print(D)
#print(T)
for key in T:
if D[key] < T[key]:
print('NO')
exit()
print('YES') | n = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
m = int(eval(input()))
t = list(map(int,input().split()))
t.sort()
now = 0
for x in t:
if now == n:
print("NO")
exit()
while d[now] != x:
now += 1
if now == n:
print("NO")
ex... | 15 | 19 | 286 | 342 | from collections import Counter
n = int(eval(input()))
D = list(map(int, input().split()))
D = Counter(D)
m = int(eval(input()))
T = list(map(int, input().split()))
T = Counter(T)
# print(D)
# print(T)
for key in T:
if D[key] < T[key]:
print("NO")
exit()
print("YES")
| n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
m = int(eval(input()))
t = list(map(int, input().split()))
t.sort()
now = 0
for x in t:
if now == n:
print("NO")
exit()
while d[now] != x:
now += 1
if now == n:
print("NO")
exit()
now ... | false | 21.052632 | [
"-from collections import Counter",
"-",
"-D = list(map(int, input().split()))",
"-D = Counter(D)",
"+d = list(map(int, input().split()))",
"+d.sort()",
"-T = list(map(int, input().split()))",
"-T = Counter(T)",
"-# print(D)",
"-# print(T)",
"-for key in T:",
"- if D[key] < T[key]:",
"+t ... | false | 0.042889 | 0.046768 | 0.917072 | [
"s510622426",
"s064859347"
] |
u883040023 | p02898 | python | s509279568 | s956134519 | 55 | 49 | 11,908 | 11,912 | Accepted | Accepted | 10.91 | N , K = list(map(int , input().split()))
h = list(map(int , input().split()))
can_ride = []
for i in range(N):
if h[i] >= K:
can_ride.append(h[i])
print((len(can_ride))) | n,k = list(map(int,input().split()))
H = list(map(int,input().split()))
ans = 0
for i in H:
if i >= k:
ans += 1
print(ans) | 10 | 9 | 193 | 146 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
can_ride = []
for i in range(N):
if h[i] >= K:
can_ride.append(h[i])
print((len(can_ride)))
| n, k = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = 0
for i in H:
if i >= k:
ans += 1
print(ans)
| false | 10 | [
"-N, K = list(map(int, input().split()))",
"-h = list(map(int, input().split()))",
"-can_ride = []",
"-for i in range(N):",
"- if h[i] >= K:",
"- can_ride.append(h[i])",
"-print((len(can_ride)))",
"+n, k = list(map(int, input().split()))",
"+H = list(map(int, input().split()))",
"+ans = ... | false | 0.047569 | 0.037234 | 1.277564 | [
"s509279568",
"s956134519"
] |
u653642801 | p04031 | python | s707418798 | s322446647 | 54 | 17 | 5,788 | 2,940 | Accepted | Accepted | 68.52 | from statistics import mean
def main():
n = int(eval(input()))
a = list(map(int,input().split()))
ave = mean(a)
ave = round(ave)
ans =0
for i in a:
ans += (i-ave)**2
print(ans)
if __name__ == "__main__":
main()
| n = int(eval(input()))
a = list(map(int, input().split()))
ave = round(sum(a)/n)
ans = 0
for i in a:
ans += (ave - i)**2
print(ans)
| 18 | 10 | 273 | 142 | from statistics import mean
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
ave = mean(a)
ave = round(ave)
ans = 0
for i in a:
ans += (i - ave) ** 2
print(ans)
if __name__ == "__main__":
main()
| n = int(eval(input()))
a = list(map(int, input().split()))
ave = round(sum(a) / n)
ans = 0
for i in a:
ans += (ave - i) ** 2
print(ans)
| false | 44.444444 | [
"-from statistics import mean",
"-",
"-",
"-def main():",
"- n = int(eval(input()))",
"- a = list(map(int, input().split()))",
"- ave = mean(a)",
"- ave = round(ave)",
"- ans = 0",
"- for i in a:",
"- ans += (i - ave) ** 2",
"- print(ans)",
"-",
"-",
"-if __na... | false | 0.075491 | 0.080081 | 0.942682 | [
"s707418798",
"s322446647"
] |
u952708174 | p02888 | python | s319040038 | s461823242 | 1,012 | 883 | 3,188 | 3,188 | Accepted | Accepted | 12.75 | def d_triangles():
from itertools import combinations
from bisect import bisect_right
N = int(eval(input()))
L = sorted([int(i) for i in input().split()])
ans = 0
for max_index in range(2, N):
c = L[max_index]
for second_index in range(max_index):
b = L[sec... | def d_triangles():
from bisect import bisect_right
N = int(eval(input()))
L = sorted([int(i) for i in input().split()])
ans = 0
for max_index in range(2, N):
for second_index in range(1, max_index):
b, c = L[second_index], L[max_index]
# b <= c となるように辺を選ぶ (ソ... | 19 | 18 | 587 | 630 | def d_triangles():
from itertools import combinations
from bisect import bisect_right
N = int(eval(input()))
L = sorted([int(i) for i in input().split()])
ans = 0
for max_index in range(2, N):
c = L[max_index]
for second_index in range(max_index):
b = L[second_index]... | def d_triangles():
from bisect import bisect_right
N = int(eval(input()))
L = sorted([int(i) for i in input().split()])
ans = 0
for max_index in range(2, N):
for second_index in range(1, max_index):
b, c = L[second_index], L[max_index]
# b <= c となるように辺を選ぶ (ソートしておけば簡単... | false | 5.263158 | [
"- from itertools import combinations",
"- c = L[max_index]",
"- for second_index in range(max_index):",
"- b = L[second_index]",
"- other_index = bisect_right(L, c - b)",
"- if max_index > other_index:",
"- ans += max_index - other_index"... | false | 0.045585 | 0.036878 | 1.236124 | [
"s319040038",
"s461823242"
] |
u047102107 | p02579 | python | s659268982 | s026355694 | 1,406 | 925 | 237,612 | 132,148 | Accepted | Accepted | 34.21 | from collections import deque
INF = int(1e10)
def main():
from builtins import int, map
H, W = list(map(int, input().split()))
Ch, Cw = [int(x) - 1 for x in input().split()]
Dh, Dw = [int(x) - 1 for x in input().split()]
S = [eval(input()) for _ in range(H)]
# dist = defaultdict(lamb... | from collections import deque
INF = int(1e10)
dh = [0, 0, 1, -1]
dw = [1, -1, 0, 0]
def main():
from builtins import int, map
H, W = list(map(int, input().split()))
Ch, Cw = [int(x) - 1 for x in input().split()]
Dh, Dw = [int(x) - 1 for x in input().split()]
S = [list(eval(input())) f... | 39 | 47 | 1,227 | 1,382 | from collections import deque
INF = int(1e10)
def main():
from builtins import int, map
H, W = list(map(int, input().split()))
Ch, Cw = [int(x) - 1 for x in input().split()]
Dh, Dw = [int(x) - 1 for x in input().split()]
S = [eval(input()) for _ in range(H)]
# dist = defaultdict(lambda: floa... | from collections import deque
INF = int(1e10)
dh = [0, 0, 1, -1]
dw = [1, -1, 0, 0]
def main():
from builtins import int, map
H, W = list(map(int, input().split()))
Ch, Cw = [int(x) - 1 for x in input().split()]
Dh, Dw = [int(x) - 1 for x in input().split()]
S = [list(eval(input())) for _ in ran... | false | 17.021277 | [
"+dh = [0, 0, 1, -1]",
"+dw = [1, -1, 0, 0]",
"- S = [eval(input()) for _ in range(H)]",
"- # dist = defaultdict(lambda: float(\"inf\"))",
"- dist = [[float(\"inf\")] * W for _ in range(H)]",
"- queue = deque([(Ch, Cw, 0)])",
"+ S = [list(eval(input())) for _ in range(H)]",
"+ dist =... | false | 0.036262 | 0.100649 | 0.360283 | [
"s659268982",
"s026355694"
] |
u057668615 | p02690 | python | s274470040 | s315141167 | 75 | 35 | 9,160 | 9,164 | Accepted | Accepted | 53.33 | X = int(eval(input()))
for A in range(1000):
for B in range(-500, 500):
if A**5-B**5 == X:
print((A, B))
exit()
| x = int(eval(input()))
for a in range(120):
for b in range(-120, 120):
if a**5 - b**5 == x:
print((a, b))
exit(0)
| 7 | 6 | 147 | 147 | X = int(eval(input()))
for A in range(1000):
for B in range(-500, 500):
if A**5 - B**5 == X:
print((A, B))
exit()
| x = int(eval(input()))
for a in range(120):
for b in range(-120, 120):
if a**5 - b**5 == x:
print((a, b))
exit(0)
| false | 14.285714 | [
"-X = int(eval(input()))",
"-for A in range(1000):",
"- for B in range(-500, 500):",
"- if A**5 - B**5 == X:",
"- print((A, B))",
"- exit()",
"+x = int(eval(input()))",
"+for a in range(120):",
"+ for b in range(-120, 120):",
"+ if a**5 - b**5 == x:",
"+... | false | 0.058791 | 0.052831 | 1.112829 | [
"s274470040",
"s315141167"
] |
u654470292 | p02954 | python | s010836531 | s824252032 | 198 | 103 | 50,800 | 79,956 | Accepted | Accepted | 47.98 | s=eval(input())
n=len(s)
guki=[0,0,"r",0]
ans=[0]*n
for i in range(n):
if guki[2]=="r":
if s[i]=="R":
guki[(i-guki[3])%2]+=1
else:
ans[i]+=guki[(i-guki[3])%2]
ans[i-1]+=guki[(i-guki[3]+1)%2]
guki[0]=0
guki[1]=1
guki... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 31 | 38 | 746 | 822 | s = eval(input())
n = len(s)
guki = [0, 0, "r", 0]
ans = [0] * n
for i in range(n):
if guki[2] == "r":
if s[i] == "R":
guki[(i - guki[3]) % 2] += 1
else:
ans[i] += guki[(i - guki[3]) % 2]
ans[i - 1] += guki[(i - guki[3] + 1) % 2]
guki[0] = 0
... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 18.421053 | [
"+import bisect, copy, heapq, math, sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+def ruiseki(lst):",
"+ return... | false | 0.038361 | 0.039215 | 0.978214 | [
"s010836531",
"s824252032"
] |
u605879293 | p02255 | python | s506966321 | s231509285 | 30 | 20 | 5,980 | 5,976 | Accepted | Accepted | 33.33 | def show(array):
for i in range(len(array)):
if i != len(array) - 1:
print(array[i], end=' ')
else:
print(array[i])
length = int(input())
array = [int(x) for x in input().split()]
for i in range(length):
v = array[i]
j = i-1
while j >= 0 and array[j... | def insertionSort(a):
n = len(a)
print((*a))
for i in range(1, n):
v = a[i]
j = i-1
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j += -1
a[j+1] = v
print((*a))
n = int(eval(input()))
a = [int(x) for x in input().split()]
insertio... | 19 | 17 | 413 | 319 | def show(array):
for i in range(len(array)):
if i != len(array) - 1:
print(array[i], end=" ")
else:
print(array[i])
length = int(input())
array = [int(x) for x in input().split()]
for i in range(length):
v = array[i]
j = i - 1
while j >= 0 and array[j] > v:
... | def insertionSort(a):
n = len(a)
print((*a))
for i in range(1, n):
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j + 1] = a[j]
j += -1
a[j + 1] = v
print((*a))
n = int(eval(input()))
a = [int(x) for x in input().split()]
insertionSort(a)
| false | 10.526316 | [
"-def show(array):",
"- for i in range(len(array)):",
"- if i != len(array) - 1:",
"- print(array[i], end=\" \")",
"- else:",
"- print(array[i])",
"+def insertionSort(a):",
"+ n = len(a)",
"+ print((*a))",
"+ for i in range(1, n):",
"+ v = a... | false | 0.066246 | 0.050039 | 1.323883 | [
"s506966321",
"s231509285"
] |
u340781749 | p03279 | python | s128763070 | s776320697 | 1,435 | 1,316 | 61,768 | 61,768 | Accepted | Accepted | 8.29 | from bisect import bisect
from collections import defaultdict
class Bit:
def __init__(self, n, MOD):
self.size = n
self.tree = [0] * (n + 1)
self.depth = n.bit_length()
self.mod = MOD
def sum(self, i):
s = 0
while i > 0:
s = (s + self.... | from bisect import bisect
from collections import defaultdict
class Bit:
def __init__(self, n, MOD):
self.size = n
self.tree = [0] * (n + 1)
self.depth = n.bit_length()
self.mod = MOD
def sum(self, i):
s = 0
while i > 0:
s += self.tree... | 67 | 67 | 1,697 | 1,692 | from bisect import bisect
from collections import defaultdict
class Bit:
def __init__(self, n, MOD):
self.size = n
self.tree = [0] * (n + 1)
self.depth = n.bit_length()
self.mod = MOD
def sum(self, i):
s = 0
while i > 0:
s = (s + self.tree[i]) % sel... | from bisect import bisect
from collections import defaultdict
class Bit:
def __init__(self, n, MOD):
self.size = n
self.tree = [0] * (n + 1)
self.depth = n.bit_length()
self.mod = MOD
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
... | false | 0 | [
"- s = (s + self.tree[i]) % self.mod",
"+ s += self.tree[i]",
"- return s",
"+ return s % self.mod"
] | false | 0.051687 | 0.076181 | 0.678483 | [
"s128763070",
"s776320697"
] |
u367130284 | p03356 | python | s167892262 | s383450962 | 1,530 | 722 | 41,276 | 13,812 | Accepted | Accepted | 52.81 | from numpy import*
from collections import*
class UNION_FIND(object):
def __init__(self,n):
#親の番号を格納する。親だった場合は-(その集合のサイズ)
#作るときはParentの値を全て-1にする
#こうすると全てバラバラになる
self.parent=[-1 for i in range(n)]
def root(self,x):
#Aがどのグループに属しているか調べる
if self.pa... | class UNION_FIND(object):
def __init__(self,n):
#親の番号を格納する。親だった場合は-(その集合のサイズ)
#作るときはParentの値を全て-1にする
#こうすると全てバラバラになる
self.parent=[-1 for i in range(n)]
def root(self,x):
#Aがどのグループに属しているか調べる
if self.parent[x]<0:
return x
else... | 56 | 49 | 1,464 | 1,300 | from numpy import *
from collections import *
class UNION_FIND(object):
def __init__(self, n):
# 親の番号を格納する。親だった場合は-(その集合のサイズ)
# 作るときはParentの値を全て-1にする
# こうすると全てバラバラになる
self.parent = [-1 for i in range(n)]
def root(self, x):
# Aがどのグループに属しているか調べる
if self.parent[x]... | class UNION_FIND(object):
def __init__(self, n):
# 親の番号を格納する。親だった場合は-(その集合のサイズ)
# 作るときはParentの値を全て-1にする
# こうすると全てバラバラになる
self.parent = [-1 for i in range(n)]
def root(self, x):
# Aがどのグループに属しているか調べる
if self.parent[x] < 0:
return x
else:
... | false | 12.5 | [
"-from numpy import *",
"-from collections import *",
"-",
"-",
"-d = defaultdict(list)",
"-p = array(p)",
"-for k, v in enumerate(u.root(i) for i in range(a)):",
"- d[v].append(k)",
"-for i in list(d.values()):",
"- i = array(i)",
"- ans += len(set(i + 1) & set(p[i]))",
"+for i in ra... | false | 0.183834 | 0.039265 | 4.681834 | [
"s167892262",
"s383450962"
] |
u633068244 | p00687 | python | s119226523 | s119486205 | 1,130 | 680 | 43,784 | 12,284 | Accepted | Accepted | 39.82 | while 1:
n,a,b = list(map(int,input().split()))
if n == 0: break
dp = [0]*(n+max(a,b)+1)
dp[a] = dp[b] = 1
for i in range(n+1):
if dp[i]:
dp[i+a] = dp[i+b] = 1
print(n - sum(dp[:n+1])) | while 1:
n,a,b = list(map(int,input().split()))
if n == 0: break
S = [1]*(n+1)
for i in range(a):
s = b*i
while s <= n:
S[s] = 0
s += a
print(sum(S)) | 9 | 10 | 200 | 170 | while 1:
n, a, b = list(map(int, input().split()))
if n == 0:
break
dp = [0] * (n + max(a, b) + 1)
dp[a] = dp[b] = 1
for i in range(n + 1):
if dp[i]:
dp[i + a] = dp[i + b] = 1
print(n - sum(dp[: n + 1]))
| while 1:
n, a, b = list(map(int, input().split()))
if n == 0:
break
S = [1] * (n + 1)
for i in range(a):
s = b * i
while s <= n:
S[s] = 0
s += a
print(sum(S))
| false | 10 | [
"- dp = [0] * (n + max(a, b) + 1)",
"- dp[a] = dp[b] = 1",
"- for i in range(n + 1):",
"- if dp[i]:",
"- dp[i + a] = dp[i + b] = 1",
"- print(n - sum(dp[: n + 1]))",
"+ S = [1] * (n + 1)",
"+ for i in range(a):",
"+ s = b * i",
"+ while s <= n:",
... | false | 0.036902 | 0.037717 | 0.978397 | [
"s119226523",
"s119486205"
] |
u597374218 | p02881 | python | s236612400 | s464675183 | 184 | 144 | 2,940 | 9,428 | Accepted | Accepted | 21.74 | N=int(eval(input()))
move=int(N**.5)
while N%move!=0:
move-=1
print((N//move+move-2)) | N=int(eval(input()))
move=10**12
for n in range(1,int(N**.5)+1):
if N%n==0:
move=min(move,N//n+n-2)
print(move) | 5 | 6 | 85 | 122 | N = int(eval(input()))
move = int(N**0.5)
while N % move != 0:
move -= 1
print((N // move + move - 2))
| N = int(eval(input()))
move = 10**12
for n in range(1, int(N**0.5) + 1):
if N % n == 0:
move = min(move, N // n + n - 2)
print(move)
| false | 16.666667 | [
"-move = int(N**0.5)",
"-while N % move != 0:",
"- move -= 1",
"-print((N // move + move - 2))",
"+move = 10**12",
"+for n in range(1, int(N**0.5) + 1):",
"+ if N % n == 0:",
"+ move = min(move, N // n + n - 2)",
"+print(move)"
] | false | 0.095692 | 0.03931 | 2.434291 | [
"s236612400",
"s464675183"
] |
u788137651 | p03450 | python | s588146473 | s020217811 | 1,471 | 1,096 | 138,528 | 10,268 | Accepted | Accepted | 25.49 | import sys
input = sys.stdin.readline
inf = float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return list(map(int, input().split()))
def MF(): return list(map(float, input().split()))
def MI_(): return list(map(INT_, input().split()))
def LI(): return list(MI())
def LI_(... | import sys
input = sys.stdin.readline
inf = float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return list(map(int, input().split()))
def MF(): return list(map(float, input().split()))
def MI_(): return list(map(INT_, input().split()))
def LI(): return list(MI())
def LI_(... | 104 | 98 | 2,432 | 2,280 | import sys
input = sys.stdin.readline
inf = float("inf")
mod = 10**9 + 7
def INT_(n):
return int(n) - 1
def MI():
return list(map(int, input().split()))
def MF():
return list(map(float, input().split()))
def MI_():
return list(map(INT_, input().split()))
def LI():
return list(MI())
def ... | import sys
input = sys.stdin.readline
inf = float("inf")
mod = 10**9 + 7
def INT_(n):
return int(n) - 1
def MI():
return list(map(int, input().split()))
def MF():
return list(map(float, input().split()))
def MI_():
return list(map(INT_, input().split()))
def LI():
return list(MI())
def ... | false | 5.769231 | [
"- edge = [[] for _ in range(N)]",
"- distanse = [0] * N",
"- distanse[0] = 0",
"- rev_edge = [[] for _ in range(N)]",
"- edge[l].append((r, d))"
] | false | 0.056931 | 0.145104 | 0.392347 | [
"s588146473",
"s020217811"
] |
u835482198 | p03848 | python | s628096859 | s720439755 | 90 | 62 | 14,812 | 16,620 | Accepted | Accepted | 31.11 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from collections import Counter
import sys
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
A = Counter(A)
if N % 2 == 1:
for num, cnt in list(A.items()):
# print(num, cnt)
if num == 0:
if cnt != 1:
... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
# N = 5
# A = [2, 4, 4, 0, 2]
mod = 10 ** 9 + 7
cnt = Counter(A)
if N % 2 == 0:
if len(list([c for c in list(cnt.values()) if c != 2])) != 0:
print((0))
else:
print(((2 ** (N // 2)) % mod))
... | 30 | 23 | 705 | 525 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from collections import Counter
import sys
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
A = Counter(A)
if N % 2 == 1:
for num, cnt in list(A.items()):
# print(num, cnt)
if num == 0:
if cnt != 1:
p... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
# N = 5
# A = [2, 4, 4, 0, 2]
mod = 10**9 + 7
cnt = Counter(A)
if N % 2 == 0:
if len(list([c for c in list(cnt.values()) if c != 2])) != 0:
print((0))
else:
print(((2 ** (N // 2)) % mod))
else:
if cnt... | false | 23.333333 | [
"-#!/usr/bin/env python",
"-# -*- coding:utf-8 -*-",
"-import sys",
"-MOD = 10**9 + 7",
"-A = Counter(A)",
"-if N % 2 == 1:",
"- for num, cnt in list(A.items()):",
"- # print(num, cnt)",
"- if num == 0:",
"- if cnt != 1:",
"- print((0))",
"- ... | false | 0.038233 | 0.038655 | 0.989087 | [
"s628096859",
"s720439755"
] |
u644907318 | p02846 | python | s753595093 | s038544850 | 167 | 65 | 38,384 | 62,100 | Accepted | Accepted | 61.08 | T1,T2 = list(map(int,input().split()))
A1,A2 = list(map(int,input().split()))
B1,B2 = list(map(int,input().split()))
dif = T1*A1+T2*A2-T1*B1-T2*B2
if dif==0:
print("infinity")
elif dif>0:
if B1>A1:
k = int(((B1-A1)*T1)/dif)
if abs(((B1-A1)*T1)/dif-round(((B1-A1)*T1)/dif))<1e-20:
... | T1,T2 = list(map(int,input().split()))
A1,A2 = list(map(int,input().split()))
B1,B2 = list(map(int,input().split()))
if T1*A1+T2*A2==T1*B1+T2*B2:
cnt="infinity"
elif T1*A1+T2*A2>T1*B1+T2*B2:
L = T1*(B1-A1)
d = T1*A1+T2*A2-(T1*B1+T2*B2)
if L<0:
cnt = 0
elif L==0:
cnt = 1
... | 24 | 36 | 666 | 768 | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
dif = T1 * A1 + T2 * A2 - T1 * B1 - T2 * B2
if dif == 0:
print("infinity")
elif dif > 0:
if B1 > A1:
k = int(((B1 - A1) * T1) / dif)
if abs(((B1 - A1) * T1) / dif - round(((... | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
if T1 * A1 + T2 * A2 == T1 * B1 + T2 * B2:
cnt = "infinity"
elif T1 * A1 + T2 * A2 > T1 * B1 + T2 * B2:
L = T1 * (B1 - A1)
d = T1 * A1 + T2 * A2 - (T1 * B1 + T2 * B2)
if L < 0:
... | false | 33.333333 | [
"-dif = T1 * A1 + T2 * A2 - T1 * B1 - T2 * B2",
"-if dif == 0:",
"- print(\"infinity\")",
"-elif dif > 0:",
"- if B1 > A1:",
"- k = int(((B1 - A1) * T1) / dif)",
"- if abs(((B1 - A1) * T1) / dif - round(((B1 - A1) * T1) / dif)) < 1e-20:",
"- print((2 * round(((B1 - A1) *... | false | 0.058093 | 0.043549 | 1.333975 | [
"s753595093",
"s038544850"
] |
u934066963 | p02802 | python | s215373521 | s836397594 | 241 | 185 | 98,212 | 76,256 | Accepted | Accepted | 23.24 | # input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
2 AC
"""
def main():
n, m= list(map(int, input().split()))
ps = [list(map(str,input().split())) for _ in range(m)]
str_l = ["WA"]*n
int_l = [0]*n
num = 0
ac = 0
for pp, s in ps:
p = int(pp)-1
if ... | # input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
2 AC
"""
def main():
n, m = list(map(int, input().split()))
seikai = [False] * n
matigai = [0] * n
for i in range(m):
p,q = list(map(str, input().split()))
p = int(p)-1
if q == "AC":
sei... | 63 | 44 | 1,199 | 757 | # input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
2 AC
"""
def main():
n, m = list(map(int, input().split()))
ps = [list(map(str, input().split())) for _ in range(m)]
str_l = ["WA"] * n
int_l = [0] * n
num = 0
ac = 0
for pp, s in ps:
p = int(pp) - 1
if s == "AC":
... | # input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
2 AC
"""
def main():
n, m = list(map(int, input().split()))
seikai = [False] * n
matigai = [0] * n
for i in range(m):
p, q = list(map(str, input().split()))
p = int(p) - 1
if q == "AC":
seikai[p] = True
... | false | 30.15873 | [
"- ps = [list(map(str, input().split())) for _ in range(m)]",
"- str_l = [\"WA\"] * n",
"- int_l = [0] * n",
"+ seikai = [False] * n",
"+ matigai = [0] * n",
"+ for i in range(m):",
"+ p, q = list(map(str, input().split()))",
"+ p = int(p) - 1",
"+ if q == \"AC... | false | 0.045624 | 0.041156 | 1.108563 | [
"s215373521",
"s836397594"
] |
u816872429 | p03108 | python | s109224899 | s535581040 | 867 | 636 | 55,476 | 46,968 | Accepted | Accepted | 26.64 | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
group = [i for i in range(n)]
islands = {i: [i] for i in range(n)}
ret = [0] * m + [n * (n - 1) // 2]
for i in range(m - 1, -1, -1):
a, b = ab[i]
ga, gb = group[a - 1], group[b - 1]
if ga == gb:
... | import sys
sys.setrecursionlimit(100000)
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
parent = [i for i in range(n)]
count = [1 for i in range(n)]
def root(i):
if i == parent[i]:
return i
parent[i] = root(parent[i])
return parent[i]
... | 23 | 30 | 728 | 685 | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
group = [i for i in range(n)]
islands = {i: [i] for i in range(n)}
ret = [0] * m + [n * (n - 1) // 2]
for i in range(m - 1, -1, -1):
a, b = ab[i]
ga, gb = group[a - 1], group[b - 1]
if ga == gb:
ret[i] = ... | import sys
sys.setrecursionlimit(100000)
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
parent = [i for i in range(n)]
count = [1 for i in range(n)]
def root(i):
if i == parent[i]:
return i
parent[i] = root(parent[i])
return parent[i]
def merge(i... | false | 23.333333 | [
"+import sys",
"+",
"+sys.setrecursionlimit(100000)",
"-group = [i for i in range(n)]",
"-islands = {i: [i] for i in range(n)}",
"+parent = [i for i in range(n)]",
"+count = [1 for i in range(n)]",
"+",
"+",
"+def root(i):",
"+ if i == parent[i]:",
"+ return i",
"+ parent[i] = r... | false | 0.037129 | 0.037543 | 0.988973 | [
"s109224899",
"s535581040"
] |
u427344224 | p03253 | python | s972365749 | s517709277 | 1,954 | 780 | 114,396 | 66,012 | Accepted | Accepted | 60.08 | def prime_factorize(num):
"""
This function performs prime factorization on the input natural number.
The result is returned in the form of a dictionary with the prime number as the key
and its number as the value.
:param num:
:return prime_factor: Dictionary with the prime number as the k... | def prime_factorize(num):
"""
This function performs prime factorization on the input natural number.
The result is returned in the form of a dictionary with the prime number as the key
and its number as the value.
:param num:
:return prime_factor: Dictionary with the prime number as the k... | 37 | 56 | 981 | 1,269 | def prime_factorize(num):
"""
This function performs prime factorization on the input natural number.
The result is returned in the form of a dictionary with the prime number as the key
and its number as the value.
:param num:
:return prime_factor: Dictionary with the prime number as the key and... | def prime_factorize(num):
"""
This function performs prime factorization on the input natural number.
The result is returned in the form of a dictionary with the prime number as the key
and its number as the value.
:param num:
:return prime_factor: Dictionary with the prime number as the key and... | false | 33.928571 | [
"-def comb(n, r):",
"- return factorial(n) // (factorial(n - r) * factorial(r))",
"+def comb(n, r, R):",
"+ if n not in R:",
"+ a = factorial(n)",
"+ R[n] = a",
"+ else:",
"+ a = R[n]",
"+ if n - r not in R:",
"+ b = factorial(n - r)",
"+ R[n - r] =... | false | 0.200508 | 0.163878 | 1.223519 | [
"s972365749",
"s517709277"
] |
u600402037 | p02695 | python | s391957682 | s032154965 | 195 | 151 | 76,284 | 73,408 | Accepted | Accepted | 22.56 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M, Q = lr()
ABCD = [lr() for _ in range(Q)]
A = [1] * N
ABCD.sort(key=lambda x: x[3], reverse=True)
ABCD.sort(key=lambda x: x[0])
answer = 0
for a in [1]:
for b i... | # coding: utf-8
import sys
from itertools import combinations_with_replacement
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M, Q = lr()
ABCD = [lr() for _ in range(Q)]
answer = 0
for x in combinations_with_replacement(list(range(1, M+1)), N)... | 32 | 21 | 1,159 | 483 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M, Q = lr()
ABCD = [lr() for _ in range(Q)]
A = [1] * N
ABCD.sort(key=lambda x: x[3], reverse=True)
ABCD.sort(key=lambda x: x[0])
answer = 0
for a in [1]:
for b in range(a, M + ... | # coding: utf-8
import sys
from itertools import combinations_with_replacement
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M, Q = lr()
ABCD = [lr() for _ in range(Q)]
answer = 0
for x in combinations_with_replacement(list(range(1, M + 1)), N):
temp... | false | 34.375 | [
"+from itertools import combinations_with_replacement",
"-A = [1] * N",
"-ABCD.sort(key=lambda x: x[3], reverse=True)",
"-ABCD.sort(key=lambda x: x[0])",
"-for a in [1]:",
"- for b in range(a, M + 1):",
"- for c in range(b, M + 1):",
"- for d in range(c, M + 1):",
"- ... | false | 0.064485 | 0.059629 | 1.081437 | [
"s391957682",
"s032154965"
] |
u065099501 | p03599 | python | s454012892 | s853105600 | 83 | 76 | 18,004 | 18,392 | Accepted | Accepted | 8.43 | A,B,C,D,E,F = list(map(int, input().split()))
x = sorted(set([w for i in range(0,F+1,A*100) for j in range(0,F+1,B*100) if (w := i + j) < F]))[1::]
y = sorted(set([s for i in range(0,F+1,C) for j in range(0,F+1,D) if (s := i + j) < F]))
n = 0
WS = S = 0
for w in x:
for s in y:
if w + s > F:
... | A,B,C,D,E,F = list(map(int, input().split()))
x = []
for i in range(0,F+1,A*100):
for j in range(0,F+1,B*100):
water = i + j
if water > F:
break
x.append(water)
y = []
for i in range(0,F+1,C):
for j in range(0,F+1,D):
sugar = i + j
if sugar > F... | 18 | 34 | 482 | 660 | A, B, C, D, E, F = list(map(int, input().split()))
x = sorted(
set(
[
w
for i in range(0, F + 1, A * 100)
for j in range(0, F + 1, B * 100)
if (w := i + j) < F
]
)
)[1::]
y = sorted(
set([s for i in range(0, F + 1, C) for j in range(0, F + 1, D... | A, B, C, D, E, F = list(map(int, input().split()))
x = []
for i in range(0, F + 1, A * 100):
for j in range(0, F + 1, B * 100):
water = i + j
if water > F:
break
x.append(water)
y = []
for i in range(0, F + 1, C):
for j in range(0, F + 1, D):
sugar = i + j
if ... | false | 47.058824 | [
"-x = sorted(",
"- set(",
"- [",
"- w",
"- for i in range(0, F + 1, A * 100)",
"- for j in range(0, F + 1, B * 100)",
"- if (w := i + j) < F",
"- ]",
"- )",
"-)[1::]",
"-y = sorted(",
"- set([s for i in range(0, F + 1, C) for j... | false | 0.049349 | 0.055787 | 0.884592 | [
"s454012892",
"s853105600"
] |
u875291233 | p02949 | python | s793970913 | s912237677 | 1,556 | 850 | 49,244 | 47,068 | Accepted | Accepted | 45.37 | # coding: utf-8
# Your code here!
def Bellman_Ford(g,start):
n = len(g)
dist = [float("inf")]*n
dist[start] = 0
a0 = float("inf")
negative = [False]*n
for i in range((2*n)):
updated = False
for v in range(n):
for to, cost in g[v]:
if ... | """
Bellman-Ford
始点と終点が決められているとき、
経由する閉路のみを確認する必要がある。
"""
def Bellman_Ford2(g,start,goal):
n = len(g)
dist = [float("inf")]*n
dist[start] = 0
a0 = float("inf")
for i in range(2*n):
updated = False
for v in range(n):
for to, cost in g[v]:
... | 41 | 41 | 1,034 | 1,070 | # coding: utf-8
# Your code here!
def Bellman_Ford(g, start):
n = len(g)
dist = [float("inf")] * n
dist[start] = 0
a0 = float("inf")
negative = [False] * n
for i in range((2 * n)):
updated = False
for v in range(n):
for to, cost in g[v]:
if negative[v]... | """
Bellman-Ford
始点と終点が決められているとき、
経由する閉路のみを確認する必要がある。
"""
def Bellman_Ford2(g, start, goal):
n = len(g)
dist = [float("inf")] * n
dist[start] = 0
a0 = float("inf")
for i in range(2 * n):
updated = False
for v in range(n):
for to, cost in g[v]:
if dist[to... | false | 0 | [
"-# coding: utf-8",
"-# Your code here!",
"-def Bellman_Ford(g, start):",
"+\"\"\"",
"+Bellman-Ford",
"+始点と終点が決められているとき、",
"+経由する閉路のみを確認する必要がある。",
"+\"\"\"",
"+",
"+",
"+def Bellman_Ford2(g, start, goal):",
"- negative = [False] * n",
"- for i in range((2 * n)):",
"+ for i in rang... | false | 0.034485 | 0.040997 | 0.841166 | [
"s793970913",
"s912237677"
] |
u561231954 | p02698 | python | s745014483 | s134549212 | 1,699 | 1,118 | 552,304 | 284,008 | Accepted | Accepted | 34.2 | import sys
sys.setrecursionlimit(100000000)
input = sys.stdin.readline
class SegmentTree():
f = max
unit = 0
def __init__(self,array):
self.N = len(array)
self.tree = [self.unit] * (2*self.N)
#self._build(array)
def _build(self,array):
for i,x in e... | import sys
sys.setrecursionlimit(100000000)
from bisect import bisect_left
input = sys.stdin.readline
INF = 1 << 30
MAXN = 200005
G = [[] for _ in range(MAXN)]
dp = [INF] * MAXN
stack = []
ans = [None] * MAXN
def dfs(v,A,p = -1):
idx = bisect_left(dp,A[v])
stack.append((idx,dp[idx]))
dp[idx]... | 81 | 40 | 2,035 | 825 | import sys
sys.setrecursionlimit(100000000)
input = sys.stdin.readline
class SegmentTree:
f = max
unit = 0
def __init__(self, array):
self.N = len(array)
self.tree = [self.unit] * (2 * self.N)
# self._build(array)
def _build(self, array):
for i, x in enumerate(array,... | import sys
sys.setrecursionlimit(100000000)
from bisect import bisect_left
input = sys.stdin.readline
INF = 1 << 30
MAXN = 200005
G = [[] for _ in range(MAXN)]
dp = [INF] * MAXN
stack = []
ans = [None] * MAXN
def dfs(v, A, p=-1):
idx = bisect_left(dp, A[v])
stack.append((idx, dp[idx]))
dp[idx] = A[v]
... | false | 50.617284 | [
"+from bisect import bisect_left",
"+",
"+INF = 1 << 30",
"+MAXN = 200005",
"+G = [[] for _ in range(MAXN)]",
"+dp = [INF] * MAXN",
"+stack = []",
"+ans = [None] * MAXN",
"-class SegmentTree:",
"- f = max",
"- unit = 0",
"-",
"- def __init__(self, array):",
"- self.N = len(... | false | 0.046928 | 0.198412 | 0.236519 | [
"s745014483",
"s134549212"
] |
u222668979 | p03163 | python | s731310451 | s394749793 | 1,380 | 978 | 382,080 | 307,352 | Accepted | Accepted | 29.13 | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
item = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] + [0]*w] + [[0] + [-float("inf")]*w for _ in range(n)]
wei, val = 0, 1
for i in range(n):
for j in range(w+1):
if item[i][wei] <= j:
dp[i... | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
item = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] + [0]*w] + [[-float("inf")]*(w+1) for _ in range(n)]
wei, val = 0, 1
for i in range(n):
for j in range(w+1):
if item[i][wei] <= j:
dp[i+1... | 16 | 16 | 444 | 442 | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
item = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] + [0] * w] + [[0] + [-float("inf")] * w for _ in range(n)]
wei, val = 0, 1
for i in range(n):
for j in range(w + 1):
if item[i][wei] <= j:
dp[i + 1][... | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
item = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] + [0] * w] + [[-float("inf")] * (w + 1) for _ in range(n)]
wei, val = 0, 1
for i in range(n):
for j in range(w + 1):
if item[i][wei] <= j:
dp[i + 1][... | false | 0 | [
"-dp = [[0] + [0] * w] + [[0] + [-float(\"inf\")] * w for _ in range(n)]",
"+dp = [[0] + [0] * w] + [[-float(\"inf\")] * (w + 1) for _ in range(n)]"
] | false | 0.042136 | 0.043052 | 0.978727 | [
"s731310451",
"s394749793"
] |
u188827677 | p02695 | python | s271708158 | s430438458 | 1,115 | 914 | 9,060 | 9,164 | Accepted | Accepted | 18.03 | from itertools import combinations_with_replacement
n,m,q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]
nums = combinations_with_replacement(list(range(1,m+1)), n)
ans = 0
for a in nums:
t = 0
for i in abcd:
if a[i[1]-1] - a[i[0]-1] == i[2]: t += i[3]
... | from itertools import combinations_with_replacement
n,m,q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for a in combinations_with_replacement(list(range(1,m+1)), n):
t = 0
for i in abcd:
if a[i[1]-1] - a[i[0]-1] == i[2]: t += i[3]
if ans < t: a... | 12 | 11 | 339 | 326 | from itertools import combinations_with_replacement
n, m, q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]
nums = combinations_with_replacement(list(range(1, m + 1)), n)
ans = 0
for a in nums:
t = 0
for i in abcd:
if a[i[1] - 1] - a[i[0] - 1] == i[2]:
... | from itertools import combinations_with_replacement
n, m, q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for a in combinations_with_replacement(list(range(1, m + 1)), n):
t = 0
for i in abcd:
if a[i[1] - 1] - a[i[0] - 1] == i[2]:
t += ... | false | 8.333333 | [
"-nums = combinations_with_replacement(list(range(1, m + 1)), n)",
"-for a in nums:",
"+for a in combinations_with_replacement(list(range(1, m + 1)), n):"
] | false | 0.040533 | 0.061589 | 0.658122 | [
"s271708158",
"s430438458"
] |
u440566786 | p02848 | python | s517207489 | s439556681 | 194 | 170 | 40,688 | 38,640 | Accepted | Accepted | 12.37 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
S=list(eval(input()))
S=list(map(ord,S))
for i in range(len(S)):
s=S[i]
S[i]=65+(s+n-65)%26
S=list(map(chr,S))
pr... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n=int(eval(input()))
ans=[]
for s in eval(input()):
k=(ord(s)-ord('A')+n)%26+ord('A')
ans.append(chr(k))
print((''.join(ans)))
resolve() | 15 | 14 | 334 | 300 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
S = list(eval(input()))
S = list(map(ord, S))
for i in range(len(S)):
s = S[i]
S[i] = 65 + (s + n - 65) % 26
S = list... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
ans = []
for s in eval(input()):
k = (ord(s) - ord("A") + n) % 26 + ord("A")
ans.append(chr(k))
print(("".join(ans)))
r... | false | 6.666667 | [
"- S = list(eval(input()))",
"- S = list(map(ord, S))",
"- for i in range(len(S)):",
"- s = S[i]",
"- S[i] = 65 + (s + n - 65) % 26",
"- S = list(map(chr, S))",
"- print((\"\".join(S)))",
"+ ans = []",
"+ for s in eval(input()):",
"+ k = (ord(s) - ord(\"A\... | false | 0.044686 | 0.043917 | 1.017522 | [
"s517207489",
"s439556681"
] |
u707500405 | p04002 | python | s545962443 | s827825810 | 2,510 | 2,132 | 98,084 | 98,084 | Accepted | Accepted | 15.06 | from collections import defaultdict
def gen_bound(x,B):
if x < 3: lb = 2
else: lb = x - 1
if x > B-2: ub = B-1
else: ub = x + 1
return lb,ub+1
def solve():
count = defaultdict(int)
ans = [0]*10
H,W,N = list(map(int,input().split()))
ans[0] = (H-2)*(W-2)
for i in range(N):
a,b = list(map(int,inp... | from collections import defaultdict
def gen_bound(x,B):
if x < 3: lb = 2
else: lb = x - 1
if x > B-2: ub = B-1
else: ub = x + 1
return lb,ub+1
def solve():
count = defaultdict(int)
ans = [0]*10
H,W,N = list(map(int,input().split()))
ans[0] = (H-2)*(W-2)
for i in range(N):
a,b = list(map(int,inp... | 26 | 23 | 586 | 573 | from collections import defaultdict
def gen_bound(x, B):
if x < 3:
lb = 2
else:
lb = x - 1
if x > B - 2:
ub = B - 1
else:
ub = x + 1
return lb, ub + 1
def solve():
count = defaultdict(int)
ans = [0] * 10
H, W, N = list(map(int, input().split()))
an... | from collections import defaultdict
def gen_bound(x, B):
if x < 3:
lb = 2
else:
lb = x - 1
if x > B - 2:
ub = B - 1
else:
ub = x + 1
return lb, ub + 1
def solve():
count = defaultdict(int)
ans = [0] * 10
H, W, N = list(map(int, input().split()))
an... | false | 11.538462 | [
"- k = x + (y << 34)",
"- bef_c = count[k]",
"- ans[bef_c] -= 1",
"- ans[bef_c + 1] += 1",
"- count[k] += 1",
"+ count[x + (y << 34)] += 1",
"+ for v in count.values():",
"+ ans[v] += 1",
"+ ans[0]... | false | 0.042776 | 0.042681 | 1.002215 | [
"s545962443",
"s827825810"
] |
u790710233 | p02642 | python | s458517142 | s373572473 | 386 | 347 | 51,420 | 51,236 | Accepted | Accepted | 10.1 | n = int(eval(input()))
A = sorted(map(int, input().split()))
U = 10**6
line = [1]*(U+1)
ans = set()
depricated = set()
cnt = [0]*(U+1)
for a in A:
cnt[a] += 1
if cnt[a] == 2 and line[a]:
depricated.add(a)
continue
if 2 < cnt[a]:
continue
if line[a]:
ans.a... | n = int(eval(input()))
A = sorted(map(int, input().split()))
U = A[-1]
line = [1]*(U+1)
ans = set()
depricated = set()
cnt = [0]*(U+1)
for a in A:
if a in ans:
depricated.add(a)
continue
if line[a]:
ans.add(a)
for p in range(2*a, U+1, a):
line[p] = 0
pr... | 20 | 16 | 411 | 338 | n = int(eval(input()))
A = sorted(map(int, input().split()))
U = 10**6
line = [1] * (U + 1)
ans = set()
depricated = set()
cnt = [0] * (U + 1)
for a in A:
cnt[a] += 1
if cnt[a] == 2 and line[a]:
depricated.add(a)
continue
if 2 < cnt[a]:
continue
if line[a]:
ans.add(a)
... | n = int(eval(input()))
A = sorted(map(int, input().split()))
U = A[-1]
line = [1] * (U + 1)
ans = set()
depricated = set()
cnt = [0] * (U + 1)
for a in A:
if a in ans:
depricated.add(a)
continue
if line[a]:
ans.add(a)
for p in range(2 * a, U + 1, a):
line[p] = 0
print... | false | 20 | [
"-U = 10**6",
"+U = A[-1]",
"- cnt[a] += 1",
"- if cnt[a] == 2 and line[a]:",
"+ if a in ans:",
"- continue",
"- if 2 < cnt[a]:"
] | false | 0.159851 | 0.079842 | 2.002091 | [
"s458517142",
"s373572473"
] |
u095021077 | p02720 | python | s597672313 | s877726309 | 379 | 121 | 10,768 | 11,908 | Accepted | Accepted | 68.07 | import heapq
K=int(eval(input()))
if K<10:
print(K)
exit()
nums=[1, 2, 3, 4, 5, 6, 7, 8, 9]
heapq.heapify(nums)
for i in range(K):
value=heapq.heappop(nums)
tmp=str(value)
if tmp[-1]=='0':
cand=[int(tmp+'0'), int(tmp+'1')]
elif tmp[-1]=='9':
cand=[int(tmp+'8'), int(tmp+'9')]
else... | from collections import deque
K=int(eval(input()))
q=deque()
for i in range(1, 10):
q.append(i)
for i in range(K):
v=q.popleft()
if v%10!=0:
q.append(10*v+v%10-1)
q.append(10*v+v%10)
if v%10!=9:
q.append(10*v+v%10+1)
print(v) | 21 | 18 | 462 | 271 | import heapq
K = int(eval(input()))
if K < 10:
print(K)
exit()
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
heapq.heapify(nums)
for i in range(K):
value = heapq.heappop(nums)
tmp = str(value)
if tmp[-1] == "0":
cand = [int(tmp + "0"), int(tmp + "1")]
elif tmp[-1] == "9":
cand = [int(tmp +... | from collections import deque
K = int(eval(input()))
q = deque()
for i in range(1, 10):
q.append(i)
for i in range(K):
v = q.popleft()
if v % 10 != 0:
q.append(10 * v + v % 10 - 1)
q.append(10 * v + v % 10)
if v % 10 != 9:
q.append(10 * v + v % 10 + 1)
print(v)
| false | 14.285714 | [
"-import heapq",
"+from collections import deque",
"-if K < 10:",
"- print(K)",
"- exit()",
"-nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-heapq.heapify(nums)",
"+q = deque()",
"+for i in range(1, 10):",
"+ q.append(i)",
"- value = heapq.heappop(nums)",
"- tmp = str(value)",
"- i... | false | 0.09738 | 0.046399 | 2.098727 | [
"s597672313",
"s877726309"
] |
u240096083 | p02689 | python | s356679298 | s227388707 | 248 | 223 | 84,780 | 84,808 | Accepted | Accepted | 10.08 | #展望台i:1 ~ Nこの展望台
#Hi: 展望台iの高さ
from copy import deepcopy
from pprint import pprint
n,m = list(map(int, input().split()))
h = list(map(int,input().split()))
anslist = [1]*n
for _ in range(m):
a,b = list(map(int,input().split()))
if h[a-1] > h[b-1]:
anslist[b-1] = 0
elif h[a-... | #展望台i:1 ~ Nこの展望台
#Hi: 展望台iの高さ
from copy import deepcopy
from pprint import pprint
n,m = list(map(int, input().split()))
h = list(map(int,input().split()))
nolist = [0] * n
for _ in range(m):
a,b = list(map(int,input().split()))
if h[a-1] > h[b-1]:
nolist[b-1] = 1
elif h[a-1] < h... | 28 | 33 | 486 | 596 | # 展望台i:1 ~ Nこの展望台
# Hi: 展望台iの高さ
from copy import deepcopy
from pprint import pprint
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
anslist = [1] * n
for _ in range(m):
a, b = list(map(int, input().split()))
if h[a - 1] > h[b - 1]:
anslist[b - 1] = 0
elif h[a - 1] < h[b -... | # 展望台i:1 ~ Nこの展望台
# Hi: 展望台iの高さ
from copy import deepcopy
from pprint import pprint
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
nolist = [0] * n
for _ in range(m):
a, b = list(map(int, input().split()))
if h[a - 1] > h[b - 1]:
nolist[b - 1] = 1
elif h[a - 1] < h[b - 1... | false | 15.151515 | [
"-anslist = [1] * n",
"+nolist = [0] * n",
"- anslist[b - 1] = 0",
"+ nolist[b - 1] = 1",
"- anslist[a - 1] = 0",
"+ nolist[a - 1] = 1",
"- anslist[a - 1] = 0",
"- anslist[b - 1] = 0",
"- # print(anslist)",
"-print((anslist.count(1)))",
"+ noli... | false | 0.037294 | 0.036794 | 1.013599 | [
"s356679298",
"s227388707"
] |
u562935282 | p03160 | python | s193171445 | s473721506 | 207 | 177 | 13,980 | 13,928 | Accepted | Accepted | 14.49 | inf = float('inf')
n = int(eval(input()))
h = list(map(int, input().split()))
dp = [inf] * n
dp[0] = 0
for i in range(n):
for j in 2, 1:
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print((dp[n - 1]))
| inf = float('inf')
n = int(eval(input()))
h = list(map(int, input().split())) + [inf]
dp = [inf] * (n + 1)
dp[0] = 0
# 配る
for i in range(n - 1):
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]))
print((dp[n - 1]))
| 14 | 13 | 260 | 293 | inf = float("inf")
n = int(eval(input()))
h = list(map(int, input().split()))
dp = [inf] * n
dp[0] = 0
for i in range(n):
for j in 2, 1:
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print((dp[n - 1]))
| inf = float("inf")
n = int(eval(input()))
h = list(map(int, input().split())) + [inf]
dp = [inf] * (n + 1)
dp[0] = 0
# 配る
for i in range(n - 1):
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]))
print((dp[n - 1]))
| false | 7.142857 | [
"-h = list(map(int, input().split()))",
"-dp = [inf] * n",
"+h = list(map(int, input().split())) + [inf]",
"+dp = [inf] * (n + 1)",
"-for i in range(n):",
"- for j in 2, 1:",
"- if i + j < n:",
"- dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))",
"+# 配る",
"+for i in r... | false | 0.045304 | 0.007649 | 5.922969 | [
"s193171445",
"s473721506"
] |
u112317104 | p02781 | python | s028514755 | s681442729 | 1,362 | 17 | 122,100 | 3,064 | Accepted | Accepted | 98.75 | S = eval(input())
N = len(S)
K = int(eval(input()))
MOD = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
# 必要なだけforを回す
for i in range(2, 10 ** 6):
fact.append((fact[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
factinv.append((factinv[-1] * inv[-1]) % MOD)
# nCr n... |
S = eval(input())
N = len(S)
K = int(eval(input()))
def cmb(n, r):
if r < 0 or r > n:
return 0
if r == 1:
return n
elif r == 2:
return n * (n-1) // 2
else:
return n * (n-1) * (n-2) // (3 * 2)
def rec(i, k, isSmaller):
if i == N:
if k == 0:... | 44 | 37 | 996 | 772 | S = eval(input())
N = len(S)
K = int(eval(input()))
MOD = 10**9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
# 必要なだけforを回す
for i in range(2, 10**6):
fact.append((fact[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
factinv.append((factinv[-1] * inv[-1]) % MOD)
# nCr n個から重複を許さずr個の組み合わせを選ぶ
d... | S = eval(input())
N = len(S)
K = int(eval(input()))
def cmb(n, r):
if r < 0 or r > n:
return 0
if r == 1:
return n
elif r == 2:
return n * (n - 1) // 2
else:
return n * (n - 1) * (n - 2) // (3 * 2)
def rec(i, k, isSmaller):
if i == N:
if k == 0:
... | false | 15.909091 | [
"-MOD = 10**9 + 7",
"-fact = [1, 1]",
"-factinv = [1, 1]",
"-inv = [0, 1]",
"-# 必要なだけforを回す",
"-for i in range(2, 10**6):",
"- fact.append((fact[-1] * i) % MOD)",
"- inv.append((-inv[MOD % i] * (MOD // i)) % MOD)",
"- factinv.append((factinv[-1] * inv[-1]) % MOD)",
"-# nCr n個から重複を許さずr個の組み... | false | 0.094099 | 0.048791 | 1.928641 | [
"s028514755",
"s681442729"
] |
u416011173 | p02629 | python | s693872120 | s338525787 | 31 | 27 | 9,156 | 9,080 | Accepted | Accepted | 12.9 | # -*- coding: utf-8 -*-
# 標準入力の取得
N = int(eval(input()))
def num_to_alpha(num):
if num <= 26:
return chr(96 + num)
elif num % 26 == 0:
return num_to_alpha(num // 26 - 1)+chr(122)
else:
return num_to_alpha(num // 26) + chr(96 + num % 26)
# 求解処理
ans = num_to_alpha(N)... | # -*- coding: utf-8 -*-
def get_input() -> int:
"""
標準入力を取得する.
Returns:\n
int: 標準入力
"""
N = int(eval(input()))
return N
def main(N: int) -> None:
"""
求解処理.
Args:\n
N (int): 整数
"""
# 求解処理
ans = ""
while N > 0:
N -... | 19 | 37 | 337 | 492 | # -*- coding: utf-8 -*-
# 標準入力の取得
N = int(eval(input()))
def num_to_alpha(num):
if num <= 26:
return chr(96 + num)
elif num % 26 == 0:
return num_to_alpha(num // 26 - 1) + chr(122)
else:
return num_to_alpha(num // 26) + chr(96 + num % 26)
# 求解処理
ans = num_to_alpha(N)
# 結果出力
print... | # -*- coding: utf-8 -*-
def get_input() -> int:
"""
標準入力を取得する.
Returns:\n
int: 標準入力
"""
N = int(eval(input()))
return N
def main(N: int) -> None:
"""
求解処理.
Args:\n
N (int): 整数
"""
# 求解処理
ans = ""
while N > 0:
N -= 1
ans += chr(ord("a"... | false | 48.648649 | [
"-# 標準入力の取得",
"-N = int(eval(input()))",
"+def get_input() -> int:",
"+ \"\"\"",
"+ 標準入力を取得する.",
"+ Returns:\\n",
"+ int: 標準入力",
"+ \"\"\"",
"+ N = int(eval(input()))",
"+ return N",
"-def num_to_alpha(num):",
"- if num <= 26:",
"- return chr(96 + num)",
... | false | 0.039776 | 0.03916 | 1.015724 | [
"s693872120",
"s338525787"
] |
u058433718 | p02388 | python | s464054671 | s155251641 | 40 | 20 | 7,664 | 5,580 | Accepted | Accepted | 50 | import sys
x = int(sys.stdin.readline().strip())
print(('%d' % (x ** 3))) | import sys
x = int(eval(input()))
print((x ** 3)) | 4 | 4 | 75 | 45 | import sys
x = int(sys.stdin.readline().strip())
print(("%d" % (x**3)))
| import sys
x = int(eval(input()))
print((x**3))
| false | 0 | [
"-x = int(sys.stdin.readline().strip())",
"-print((\"%d\" % (x**3)))",
"+x = int(eval(input()))",
"+print((x**3))"
] | false | 0.038873 | 0.040669 | 0.955832 | [
"s464054671",
"s155251641"
] |
u886747123 | p03171 | python | s985573180 | s051476706 | 1,632 | 553 | 308,104 | 113,500 | Accepted | Accepted | 66.12 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000000)
N = int(eval(input()))
a = list(map(int, input().split()))
dp = [[float("inf")]*(N+1) for _ in range(N+1)]
for shift_i in range(N+1):
for i in range(N+1):
if i+shift_i >= N+1:
continue
if shift... | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
a = list(map(int, input().split()))
# dp[i][j] 区間a[i,j)だけ残った時点で互いの点数を一旦0とし、ゲームを最後まで続けた場合のX-Yの値
dp = [[0]*(N+1) for _ in range(N+1)]
# こちらもメモ化再帰ではpypy3でも間に合わない
# j==i+1, i+2, ...とループしてdpテーブルの上三角部分を対角線と平行に埋めていく。jをshift_iと書き換えてループ
for shift_... | 21 | 21 | 646 | 709 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000000)
N = int(eval(input()))
a = list(map(int, input().split()))
dp = [[float("inf")] * (N + 1) for _ in range(N + 1)]
for shift_i in range(N + 1):
for i in range(N + 1):
if i + shift_i >= N + 1:
continue
if shift_... | import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
a = list(map(int, input().split()))
# dp[i][j] 区間a[i,j)だけ残った時点で互いの点数を一旦0とし、ゲームを最後まで続けた場合のX-Yの値
dp = [[0] * (N + 1) for _ in range(N + 1)]
# こちらもメモ化再帰ではpypy3でも間に合わない
# j==i+1, i+2, ...とループしてdpテーブルの上三角部分を対角線と平行に埋めていく。jをshift_iと書き換えてループ
for shift_i in ra... | false | 0 | [
"-sys.setrecursionlimit(1000000000)",
"-dp = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]",
"-for shift_i in range(N + 1):",
"+# dp[i][j] 区間a[i,j)だけ残った時点で互いの点数を一旦0とし、ゲームを最後まで続けた場合のX-Yの値",
"+dp = [[0] * (N + 1) for _ in range(N + 1)]",
"+# こちらもメモ化再帰ではpypy3でも間に合わない",
"+# j==i+1, i+2, ...とループしてdpテーブル... | false | 0.051482 | 0.059942 | 0.858865 | [
"s985573180",
"s051476706"
] |
u761087127 | p02748 | python | s490461812 | s112142054 | 518 | 443 | 18,488 | 18,488 | Accepted | Accepted | 14.48 | A, B, M = [int(n) for n in input().split()]
a = [int(n) for n in input().split()]
b = [int(n) for n in input().split()]
ma = sorted(a)[0]
mb = sorted(b)[0]
ans = ma + mb
for m in range(M):
x, y, c = [int(n) for n in input().split()]
dv = a[x-1] + b[y-1] - c
ans = min(ans , dv)
print(ans)
... | A, B, M = [int(n) for n in input().split()]
a = [int(n) for n in input().split()]
b = [int(n) for n in input().split()]
ans = min(a) + min(b)
for m in range(M):
x, y, c = [int(n) for n in input().split()]
dv = a[x-1] + b[y-1] - c
ans = min(ans , dv)
print(ans)
| 12 | 10 | 321 | 292 | A, B, M = [int(n) for n in input().split()]
a = [int(n) for n in input().split()]
b = [int(n) for n in input().split()]
ma = sorted(a)[0]
mb = sorted(b)[0]
ans = ma + mb
for m in range(M):
x, y, c = [int(n) for n in input().split()]
dv = a[x - 1] + b[y - 1] - c
ans = min(ans, dv)
print(ans)
| A, B, M = [int(n) for n in input().split()]
a = [int(n) for n in input().split()]
b = [int(n) for n in input().split()]
ans = min(a) + min(b)
for m in range(M):
x, y, c = [int(n) for n in input().split()]
dv = a[x - 1] + b[y - 1] - c
ans = min(ans, dv)
print(ans)
| false | 16.666667 | [
"-ma = sorted(a)[0]",
"-mb = sorted(b)[0]",
"-ans = ma + mb",
"+ans = min(a) + min(b)"
] | false | 0.048392 | 0.045868 | 1.055027 | [
"s490461812",
"s112142054"
] |
u305366205 | p03044 | python | s256559595 | s142527234 | 757 | 672 | 72,096 | 37,516 | Accepted | Accepted | 11.23 | from collections import deque
def main():
def bfs(start):
q = deque([start])
while q:
u = q.popleft()
for v, w in g[u]:
if color[v] == -1:
q.append(v)
if w == 0:
color[v] = color[u]
... | from collections import deque
def main():
# 幅優先探索
def bfs():
q = deque([0])
while q:
u = q.popleft()
# 接続頂点を精査
for v, w in g[u]:
# まだチェックしていない頂点をチェック
if color[v] == -1:
q.append(v)
... | 33 | 39 | 745 | 878 | from collections import deque
def main():
def bfs(start):
q = deque([start])
while q:
u = q.popleft()
for v, w in g[u]:
if color[v] == -1:
q.append(v)
if w == 0:
color[v] = color[u]
... | from collections import deque
def main():
# 幅優先探索
def bfs():
q = deque([0])
while q:
u = q.popleft()
# 接続頂点を精査
for v, w in g[u]:
# まだチェックしていない頂点をチェック
if color[v] == -1:
q.append(v)
# 偶数な... | false | 15.384615 | [
"- def bfs(start):",
"- q = deque([start])",
"+ # 幅優先探索",
"+ def bfs():",
"+ q = deque([0])",
"+ # 接続頂点を精査",
"+ # まだチェックしていない頂点をチェック",
"+ # 偶数なら同じ色で塗る",
"+ # 塗りつぶし結果",
"+ # スタートは黒で塗っておく",
"- bfs(0)",
"+ bfs()"
] | false | 0.045944 | 0.044935 | 1.022445 | [
"s256559595",
"s142527234"
] |
u780962115 | p03044 | python | s097099116 | s136343884 | 809 | 656 | 86,552 | 86,552 | Accepted | Accepted | 18.91 | import sys
sys.setrecursionlimit(100000)
n=int(eval(input()))
visitedlist=[-1 for i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
a,b,c=list(map(int,input().split()))
kilist[a-1].append((b,c))
kilist... | import sys
sys.setrecursionlimit(100000)
input=sys.stdin.readline
n=int(eval(input()))
visitedlist=[-1 for i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
a,b,c=list(map(int,input().split()))
kilist[a-1].appen... | 31 | 31 | 822 | 846 | import sys
sys.setrecursionlimit(100000)
n = int(eval(input()))
visitedlist = [-1 for i in range(n)]
kilist = [[] for i in range(n)]
anslist = [0 for i in range(n)]
searchedlist = [-1 for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
kilist[a - 1].append((b, c))
kilist[b -... | import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
n = int(eval(input()))
visitedlist = [-1 for i in range(n)]
kilist = [[] for i in range(n)]
anslist = [0 for i in range(n)]
searchedlist = [-1 for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
kilist[a - 1].ap... | false | 0 | [
"+input = sys.stdin.readline"
] | false | 0.041703 | 0.037601 | 1.109084 | [
"s097099116",
"s136343884"
] |
u268822556 | p02614 | python | s098610005 | s890889032 | 84 | 61 | 9,084 | 9,204 | Accepted | Accepted | 27.38 | import itertools
import copy
H, W, K = list(map(int, input().split()))
C = []
for _ in range(H):
C.append([c for c in eval(input())])
H_list = [i for i in range(H)]
H_comb = []
for i in range(1, H):
H_comb += itertools.combinations(H_list, i)
W_list = [i for i in range(W)]
W_comb = []
for i in r... | H, W, K = list(map(int, input().split()))
C = []
for _ in range(H): C.append([c for c in eval(input())])
ans = 0
for i in range(1<<H):
for j in range(1<<W):
cnt = 0
for m in range(H):
for n in range(W):
if i>>m&1: continue
if j>>n&1: continue
... | 44 | 14 | 1,106 | 392 | import itertools
import copy
H, W, K = list(map(int, input().split()))
C = []
for _ in range(H):
C.append([c for c in eval(input())])
H_list = [i for i in range(H)]
H_comb = []
for i in range(1, H):
H_comb += itertools.combinations(H_list, i)
W_list = [i for i in range(W)]
W_comb = []
for i in range(1, W):
... | H, W, K = list(map(int, input().split()))
C = []
for _ in range(H):
C.append([c for c in eval(input())])
ans = 0
for i in range(1 << H):
for j in range(1 << W):
cnt = 0
for m in range(H):
for n in range(W):
if i >> m & 1:
continue
i... | false | 68.181818 | [
"-import itertools",
"-import copy",
"-",
"-H_list = [i for i in range(H)]",
"-H_comb = []",
"-for i in range(1, H):",
"- H_comb += itertools.combinations(H_list, i)",
"-W_list = [i for i in range(W)]",
"-W_comb = []",
"-for i in range(1, W):",
"- W_comb += itertools.combinations(W_list, i... | false | 0.053432 | 0.095275 | 0.560819 | [
"s098610005",
"s890889032"
] |
u672475305 | p03436 | python | s827832272 | s053691358 | 192 | 154 | 40,688 | 12,496 | Accepted | Accepted | 19.79 | from collections import deque
h,w = list(map(int,input().split()))
S = [list(eval(input())) for _ in range(h)]
cost = [[-1]*w for _ in range(h)]
sy,sx = 0,0
gy,gx = h-1, w-1
que = deque([(sy,sx,0)])
flg = False
ret = -1
while que:
y,x,c = que.popleft()
if y==gy and x==gx:
flg = True
... | R,C = list(map(int,input().split()))
sy,sx = 1,1
gy,gx = R,C
maze = [list(eval(input())) for _ in range(R)]
mx = 0
for m in maze:
mx += m.count('.')
sx,sy = sx-1, sy-1
gx,gy = gx-1, gy-1
def bfs(R,C,sy,sx,gy,gx,maze):
from collections import deque
import numpy as np
INF = np.inf
vis... | 38 | 34 | 819 | 879 | from collections import deque
h, w = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(h)]
cost = [[-1] * w for _ in range(h)]
sy, sx = 0, 0
gy, gx = h - 1, w - 1
que = deque([(sy, sx, 0)])
flg = False
ret = -1
while que:
y, x, c = que.popleft()
if y == gy and x == gx:
flg = True
... | R, C = list(map(int, input().split()))
sy, sx = 1, 1
gy, gx = R, C
maze = [list(eval(input())) for _ in range(R)]
mx = 0
for m in maze:
mx += m.count(".")
sx, sy = sx - 1, sy - 1
gx, gy = gx - 1, gy - 1
def bfs(R, C, sy, sx, gy, gx, maze):
from collections import deque
import numpy as np
INF = np.inf... | false | 10.526316 | [
"-from collections import deque",
"+R, C = list(map(int, input().split()))",
"+sy, sx = 1, 1",
"+gy, gx = R, C",
"+maze = [list(eval(input())) for _ in range(R)]",
"+mx = 0",
"+for m in maze:",
"+ mx += m.count(\".\")",
"+sx, sy = sx - 1, sy - 1",
"+gx, gy = gx - 1, gy - 1",
"-h, w = list(map... | false | 0.048643 | 0.043223 | 1.125381 | [
"s827832272",
"s053691358"
] |
u189479417 | p02580 | python | s990917884 | s605083505 | 931 | 811 | 83,408 | 58,920 | Accepted | Accepted | 12.89 | import sys
H, W, M = list(map(int,input().split()))
R = [0] * H
C = [0] * W
S = set()
for _ in range(M):
h, w = list(map(int,input().split()))
S.add((h-1, w-1))
R[h-1] += 1
C[w-1] += 1
r = max(R)
c = max(C)
HL = [i for i in range(H) if R[i] == r]
WL = [i for i in range(W) if C[i] ... | H, W, M = list(map(int,input().split()))
R = [0] * H
C = [0] * W
L = []
for _ in range(M):
h, w = list(map(int,input().split()))
R[h-1] += 1
C[w-1] += 1
L.append([h-1, w-1])
r = max(R)
c = max(C)
print((r + c - (R.count(r) * C.count(c) == sum(R[h] + C[w] == r + c for h, w in L)))) | 27 | 16 | 446 | 302 | import sys
H, W, M = list(map(int, input().split()))
R = [0] * H
C = [0] * W
S = set()
for _ in range(M):
h, w = list(map(int, input().split()))
S.add((h - 1, w - 1))
R[h - 1] += 1
C[w - 1] += 1
r = max(R)
c = max(C)
HL = [i for i in range(H) if R[i] == r]
WL = [i for i in range(W) if C[i] == c]
for h ... | H, W, M = list(map(int, input().split()))
R = [0] * H
C = [0] * W
L = []
for _ in range(M):
h, w = list(map(int, input().split()))
R[h - 1] += 1
C[w - 1] += 1
L.append([h - 1, w - 1])
r = max(R)
c = max(C)
print((r + c - (R.count(r) * C.count(c) == sum(R[h] + C[w] == r + c for h, w in L))))
| false | 40.740741 | [
"-import sys",
"-",
"-S = set()",
"+L = []",
"- S.add((h - 1, w - 1))",
"+ L.append([h - 1, w - 1])",
"-HL = [i for i in range(H) if R[i] == r]",
"-WL = [i for i in range(W) if C[i] == c]",
"-for h in HL:",
"- for w in WL:",
"- if not (h, w) in S:",
"- print((r + c))... | false | 0.048898 | 0.046649 | 1.048219 | [
"s990917884",
"s605083505"
] |
u334712262 | p03476 | python | s866457673 | s930412096 | 811 | 746 | 92,244 | 89,172 | Accepted | Accepted | 8.01 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, perm... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, perm... | 106 | 97 | 1,995 | 1,756 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
... | false | 8.490566 | [
"- return p",
"+ return p, t",
"- p = eratosthenes(N)",
"+ p, t = eratosthenes(N)",
"- for i in range(2, N):",
"+ for i in range(3, N):",
"- if i % 2 == 0:",
"- continue",
"- q = (i + 1) // 2",
"- qi = bisect.bisect_left(p, q)",
"- ii = bi... | false | 0.187234 | 0.153769 | 1.217629 | [
"s866457673",
"s930412096"
] |
u630511239 | p03730 | python | s695883202 | s096713874 | 38 | 35 | 5,432 | 5,104 | Accepted | Accepted | 7.89 | A, B, C = list(map(int, input().split()))
import fractions
c = fractions.gcd(A,B)
ans = 'NO'
if C % c == 0:
ans = 'YES'
print(ans) | A, B, C = list(map(int, input().split()))
import fractions
a = fractions.gcd(A, B)
ans = 'NO'
if a == 1:
ans = 'YES'
elif C % a == 0:
ans = 'YES'
print(ans) | 7 | 9 | 132 | 162 | A, B, C = list(map(int, input().split()))
import fractions
c = fractions.gcd(A, B)
ans = "NO"
if C % c == 0:
ans = "YES"
print(ans)
| A, B, C = list(map(int, input().split()))
import fractions
a = fractions.gcd(A, B)
ans = "NO"
if a == 1:
ans = "YES"
elif C % a == 0:
ans = "YES"
print(ans)
| false | 22.222222 | [
"-c = fractions.gcd(A, B)",
"+a = fractions.gcd(A, B)",
"-if C % c == 0:",
"+if a == 1:",
"+ ans = \"YES\"",
"+elif C % a == 0:"
] | false | 0.057218 | 0.057286 | 0.998823 | [
"s695883202",
"s096713874"
] |
u684241248 | p02269 | python | s832221545 | s376671655 | 6,690 | 6,180 | 138,492 | 137,140 | Accepted | Accepted | 7.62 | import sys
n = int(eval(input()))
htable = [0 for _ in range(16777216)]
def to_int(s):
if s == 'A':
return 1
elif s == 'C':
return 2
elif s == 'G':
return 3
else:
return 4
def to_hash(string):
h = 0
for i, s in enumerate(string):
i... | import sys
htable = [0] * 16777216
def to_int(s):
if s == 'A':
return 1
elif s == 'C':
return 2
elif s == 'G':
return 3
else:
return 4
def to_hash(string):
h = 0
for i, s in enumerate(string):
ints = to_int(s)
h += 4**i * i... | 48 | 51 | 718 | 764 | import sys
n = int(eval(input()))
htable = [0 for _ in range(16777216)]
def to_int(s):
if s == "A":
return 1
elif s == "C":
return 2
elif s == "G":
return 3
else:
return 4
def to_hash(string):
h = 0
for i, s in enumerate(string):
ints = to_int(s)
... | import sys
htable = [0] * 16777216
def to_int(s):
if s == "A":
return 1
elif s == "C":
return 2
elif s == "G":
return 3
else:
return 4
def to_hash(string):
h = 0
for i, s in enumerate(string):
ints = to_int(s)
h += 4**i * ints
return h
d... | false | 5.882353 | [
"-n = int(eval(input()))",
"-htable = [0 for _ in range(16777216)]",
"+htable = [0] * 16777216",
"-for line in sys.stdin:",
"- cmd, string = line.strip().split()",
"- if cmd == \"insert\":",
"- insert(string)",
"- else:",
"- find(string)",
"+if __name__ == \"__main__\":",
... | false | 0.916304 | 0.564943 | 1.62194 | [
"s832221545",
"s376671655"
] |
u623819879 | p03043 | python | s342152641 | s629100914 | 167 | 68 | 38,768 | 65,068 | Accepted | Accepted | 59.28 | import sys
import math
sys.setrecursionlimit(10**6)
from collections import defaultdict
n,k=list(map(int,input().split()))
ans=0
for i in range(1,n+1):
if i>=k:
ans+=1/n
else:
ans+=1/(n*2**int(1-1/(10**9)+math.log((k/i),2)))
#print(i,2**int(math.log((k/i),2)),ans)
print(ans)
| n,k=list(map(int,input().split()))
a=0
for i in range(n):
x=i+1;y=0
while x<k:x*=2;y+=1
a+=1/2**y
print((a/n)) | 14 | 7 | 308 | 111 | import sys
import math
sys.setrecursionlimit(10**6)
from collections import defaultdict
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
if i >= k:
ans += 1 / n
else:
ans += 1 / (n * 2 ** int(1 - 1 / (10**9) + math.log((k / i), 2)))
# print(i,2**int(math.log((k/i),2)),a... | n, k = list(map(int, input().split()))
a = 0
for i in range(n):
x = i + 1
y = 0
while x < k:
x *= 2
y += 1
a += 1 / 2**y
print((a / n))
| false | 50 | [
"-import sys",
"-import math",
"-",
"-sys.setrecursionlimit(10**6)",
"-from collections import defaultdict",
"-",
"-ans = 0",
"-for i in range(1, n + 1):",
"- if i >= k:",
"- ans += 1 / n",
"- else:",
"- ans += 1 / (n * 2 ** int(1 - 1 / (10**9) + math.log((k / i), 2)))",
... | false | 0.05044 | 0.079923 | 0.631107 | [
"s342152641",
"s629100914"
] |
u680851063 | p02678 | python | s441784726 | s243743171 | 549 | 456 | 34,820 | 34,564 | Accepted | Accepted | 16.94 | # ダミーノード'0'を設定 ※※※
# AtCoder Beginner Contest 168
# https://atcoder.jp/contests/abc168/tasks/abc168_d
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split())) # nは頂点の数、mは辺の数
pic = [[] for _ in range(n+1)] # 隣接リスト_初期化 ※※※
for _ in range(m): # 隣接リスト_取り込み
a, b = list(map(int, input()... | # ダミーノード'0'を設定 ※※※
# AtCoder Beginner Contest 168
# https://atcoder.jp/contests/abc168/tasks/abc168_d
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split())) # nは頂点の数、mは辺の数
pic = [[] for _ in range(n+1)] # 隣接リスト_初期化 ※※※
for _ in range(m): # 隣接リスト_取り込み
a, b = list(map(int, input()... | 36 | 41 | 1,044 | 1,113 | # ダミーノード'0'を設定 ※※※
# AtCoder Beginner Contest 168
# https://atcoder.jp/contests/abc168/tasks/abc168_d
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split())) # nは頂点の数、mは辺の数
pic = [[] for _ in range(n + 1)] # 隣接リスト_初期化 ※※※
for _ in range(m): # 隣接リスト_取り込み
a, b = list(map(int, input().split())... | # ダミーノード'0'を設定 ※※※
# AtCoder Beginner Contest 168
# https://atcoder.jp/contests/abc168/tasks/abc168_d
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split())) # nは頂点の数、mは辺の数
pic = [[] for _ in range(n + 1)] # 隣接リスト_初期化 ※※※
for _ in range(m): # 隣接リスト_取り込み
a, b = list(map(int, input().split())... | false | 12.195122 | [
"+# print(pic)",
"- dis[i] = dis[v]",
"+ dis[i] = dis[v] + 1 # 'u'からの距離を記録",
"+ # print(ans)",
"+ # print(dis)",
"+print(\"Yes\")",
"-print(\"Yes\")"
] | false | 0.038617 | 0.044181 | 0.87407 | [
"s441784726",
"s243743171"
] |
u912237403 | p00046 | python | s777578886 | s742702277 | 20 | 10 | 4,200 | 4,200 | Accepted | Accepted | 50 | import sys
s = list(map(float, sys.stdin))
print(max(s)-min(s)) | import sys
s = sorted(map(float, sys.stdin))
print(s[-1]-s[0]) | 4 | 4 | 60 | 65 | import sys
s = list(map(float, sys.stdin))
print(max(s) - min(s))
| import sys
s = sorted(map(float, sys.stdin))
print(s[-1] - s[0])
| false | 0 | [
"-s = list(map(float, sys.stdin))",
"-print(max(s) - min(s))",
"+s = sorted(map(float, sys.stdin))",
"+print(s[-1] - s[0])"
] | false | 0.054347 | 0.035687 | 1.522875 | [
"s777578886",
"s742702277"
] |
u556326323 | p02390 | python | s678538001 | s648711746 | 30 | 20 | 7,660 | 7,640 | Accepted | Accepted | 33.33 | t, s = divmod(int(eval(input())), 60)
h, m = divmod(t, 60)
print((str(h) + ':' + str(m) + ':' + str(s))) | t, s = divmod(int(input()), 60)
h, m = divmod(t, 60)
print(h, m, s, sep=':')
| 3 | 3 | 98 | 78 | t, s = divmod(int(eval(input())), 60)
h, m = divmod(t, 60)
print((str(h) + ":" + str(m) + ":" + str(s)))
| t, s = divmod(int(input()), 60)
h, m = divmod(t, 60)
print(h, m, s, sep=":")
| false | 0 | [
"-t, s = divmod(int(eval(input())), 60)",
"+t, s = divmod(int(input()), 60)",
"-print((str(h) + \":\" + str(m) + \":\" + str(s)))",
"+print(h, m, s, sep=\":\")"
] | false | 0.038236 | 0.03764 | 1.015829 | [
"s678538001",
"s648711746"
] |
u002459665 | p03578 | python | s489670743 | s617562011 | 449 | 335 | 35,116 | 35,556 | Accepted | Accepted | 25.39 | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
D.sort()
T.sort()
flag = True
if N < M:
flag = False
else:
d_ind = 0
find = False
for i in range(M):
for j in range(d_ind, N):
if T[i] == D[j]:
... | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
D.sort()
T.sort()
flag = True
if N < M:
flag = False
else:
i = 0
for ti in T:
find = False
while i < N:
if ti == D[i]:
find = T... | 30 | 29 | 529 | 503 | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
D.sort()
T.sort()
flag = True
if N < M:
flag = False
else:
d_ind = 0
find = False
for i in range(M):
for j in range(d_ind, N):
if T[i] == D[j]:
find =... | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
D.sort()
T.sort()
flag = True
if N < M:
flag = False
else:
i = 0
for ti in T:
find = False
while i < N:
if ti == D[i]:
find = True
... | false | 3.333333 | [
"- d_ind = 0",
"- find = False",
"- for i in range(M):",
"- for j in range(d_ind, N):",
"- if T[i] == D[j]:",
"+ i = 0",
"+ for ti in T:",
"+ find = False",
"+ while i < N:",
"+ if ti == D[i]:",
"- d_ind = j + 1",
"+ ... | false | 0.043383 | 0.037613 | 1.153386 | [
"s489670743",
"s617562011"
] |
u067227603 | p03767 | python | s320167267 | s816628527 | 246 | 215 | 37,084 | 39,492 | Accepted | Accepted | 12.6 | n=int(eval(input()))
a=list([int(x) for x in input().split()])
a.sort(reverse=True)
print((sum(a[1:2*n:2]))) | n=int(eval(input()))
a=list(map(int, input().split()))
a.sort(reverse=True)
print((sum(a[1:2*n:2]))) | 4 | 4 | 108 | 95 | n = int(eval(input()))
a = list([int(x) for x in input().split()])
a.sort(reverse=True)
print((sum(a[1 : 2 * n : 2])))
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
print((sum(a[1 : 2 * n : 2])))
| false | 0 | [
"-a = list([int(x) for x in input().split()])",
"+a = list(map(int, input().split()))"
] | false | 0.035114 | 0.045564 | 0.770642 | [
"s320167267",
"s816628527"
] |
u968166680 | p02572 | python | s575812416 | s482548896 | 140 | 120 | 110,556 | 110,560 | Accepted | Accepted | 14.29 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
total = sum(A)
ans = 0
for a in A:
... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
total = sum(A) % MOD
ans = total * total % MOD... | 27 | 28 | 447 | 487 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
total = sum(A)
ans = 0
for a in A:
total -= a
... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
total = sum(A) % MOD
ans = total * total % MOD
for a in A:
... | false | 3.571429 | [
"- total = sum(A)",
"- ans = 0",
"+ total = sum(A) % MOD",
"+ ans = total * total % MOD",
"- total -= a",
"- ans = (ans + a * total % MOD) % MOD",
"+ ans = (ans - a * a) % MOD",
"+ ans = ans * pow(2, MOD - 2, MOD) % MOD"
] | false | 0.047167 | 0.146969 | 0.320931 | [
"s575812416",
"s482548896"
] |
u535803878 | p02579 | python | s713402137 | s982640752 | 1,424 | 816 | 124,192 | 117,740 | Accepted | Accepted | 42.7 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
@njit((b1[:, :],i8,i8,i8,i8))
def main(ss,ch,cw,dh,dw):
... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
@njit((b1[:, :],i8,i8,i8,i8), cache=True)
def main(ss,ch,c... | 63 | 63 | 1,574 | 1,586 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
@njit((b1[:, :], i8, i8, i8, i8))
def main(ss, ch, cw, dh, dw):
... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
@njit((b1[:, :], i8, i8, i8, i8), cache=True)
def main(ss, ch, cw, d... | false | 0 | [
"-@njit((b1[:, :], i8, i8, i8, i8))",
"+@njit((b1[:, :], i8, i8, i8, i8), cache=True)"
] | false | 0.179635 | 0.353526 | 0.508123 | [
"s713402137",
"s982640752"
] |
u813450984 | p03945 | python | s377694382 | s861705745 | 50 | 41 | 3,956 | 3,956 | Accepted | Accepted | 18 | l = list(eval(input()))
now = l[0]
count = 0
for i in range(1, len(l)):
if not now == l[i]:
count += 1
now = l[i]
print(count) | l = list(eval(input()))
now = l[0]
count = 0
for i in range(1, len(l)):
if not l[i] == now:
count += 1
now = l[i]
print(count) | 10 | 9 | 141 | 139 | l = list(eval(input()))
now = l[0]
count = 0
for i in range(1, len(l)):
if not now == l[i]:
count += 1
now = l[i]
print(count)
| l = list(eval(input()))
now = l[0]
count = 0
for i in range(1, len(l)):
if not l[i] == now:
count += 1
now = l[i]
print(count)
| false | 10 | [
"- if not now == l[i]:",
"+ if not l[i] == now:"
] | false | 0.049105 | 0.048778 | 1.006699 | [
"s377694382",
"s861705745"
] |
u340781749 | p02579 | python | s533110954 | s041723048 | 838 | 374 | 30,532 | 45,432 | Accepted | Accepted | 55.37 | import os
import sys
import numpy as np
from heapq import heappop, heappush
def solve(h, w, s, t, field):
WARP = (-(w * 2 + 10), -(w * 2 + 9), -(w * 2 + 8), -(w * 2 + 7), -(w * 2 + 6),
-(w + 6), -(w + 5), -(w + 3), -(w + 2),
-2, 2,
w + 2, w + 3, w + 5, w + 6,
... | import os
import sys
import numpy as np
from heapq import heappop, heappush
def solve(h, w, s, t, field):
WARP = (-(w * 2 + 10), -(w * 2 + 9), -(w * 2 + 8), -(w * 2 + 7), -(w * 2 + 6),
-(w + 6), -(w + 5), -(w + 3), -(w + 2),
-2, 2,
w + 2, w + 3, w + 5, w + 6,
... | 69 | 78 | 1,976 | 2,175 | import os
import sys
import numpy as np
from heapq import heappop, heappush
def solve(h, w, s, t, field):
WARP = (
-(w * 2 + 10),
-(w * 2 + 9),
-(w * 2 + 8),
-(w * 2 + 7),
-(w * 2 + 6),
-(w + 6),
-(w + 5),
-(w + 3),
-(w + 2),
-2,
... | import os
import sys
import numpy as np
from heapq import heappop, heappush
def solve(h, w, s, t, field):
WARP = (
-(w * 2 + 10),
-(w * 2 + 9),
-(w * 2 + 8),
-(w * 2 + 7),
-(w * 2 + 6),
-(w + 6),
-(w + 5),
-(w + 3),
-(w + 2),
-2,
... | false | 11.538462 | [
"- q = [(0, s)]",
"+ qc = np.zeros(2000000, dtype=np.int32)",
"+ qv = np.zeros(2000000, dtype=np.int32)",
"+ qv[0] = s",
"+ l, r = 0, 1",
"- while q:",
"- cost, v = heappop(q)",
"+ while l < r:",
"+ cost = qc[l]",
"+ v = qv[l]",
"+ l += 1",
"- ... | false | 0.199516 | 0.327693 | 0.608851 | [
"s533110954",
"s041723048"
] |
u030879708 | p02658 | python | s923407499 | s298146584 | 398 | 78 | 19,180 | 19,256 | Accepted | Accepted | 80.4 | eval(input());a=1
for i in input().split():a*=int(i);a=[-1,a][0<=a<=eval('1'+'0'*18)]
print(a) | eval(input());a=1
for i in input().split():a*=int(i);a=[-1,a][0<=a<=10**18]
print(a) | 3 | 3 | 90 | 80 | eval(input())
a = 1
for i in input().split():
a *= int(i)
a = [-1, a][0 <= a <= eval("1" + "0" * 18)]
print(a)
| eval(input())
a = 1
for i in input().split():
a *= int(i)
a = [-1, a][0 <= a <= 10**18]
print(a)
| false | 0 | [
"- a = [-1, a][0 <= a <= eval(\"1\" + \"0\" * 18)]",
"+ a = [-1, a][0 <= a <= 10**18]"
] | false | 0.094842 | 0.035838 | 2.646407 | [
"s923407499",
"s298146584"
] |
u130900604 | p03611 | python | s503150959 | s850925059 | 323 | 192 | 78,776 | 109,436 | Accepted | Accepted | 40.56 | n=int(eval(input()))
a=list(map(int,input().split()))
ans=[]
for i in a:
ans+=(i-1),
ans+=(i),
ans+=(i+1),
from collections import*
c=Counter(ans)
res=c.most_common()[0][1]
print(res) | n,*a=list(map(int,open(0).read().split()))
b=[q-1 for q in a]
c=[q+1 for q in a]
from collections import Counter
d=a+b+c
e=Counter(d)
print((e.most_common()[0][1])) | 14 | 7 | 201 | 162 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = []
for i in a:
ans += ((i - 1),)
ans += ((i),)
ans += ((i + 1),)
from collections import *
c = Counter(ans)
res = c.most_common()[0][1]
print(res)
| n, *a = list(map(int, open(0).read().split()))
b = [q - 1 for q in a]
c = [q + 1 for q in a]
from collections import Counter
d = a + b + c
e = Counter(d)
print((e.most_common()[0][1]))
| false | 50 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-ans = []",
"-for i in a:",
"- ans += ((i - 1),)",
"- ans += ((i),)",
"- ans += ((i + 1),)",
"-from collections import *",
"+n, *a = list(map(int, open(0).read().split()))",
"+b = [q - 1 for q in a]",
"+c = [q + 1 for q... | false | 0.045099 | 0.09062 | 0.497673 | [
"s503150959",
"s850925059"
] |
u314050667 | p02924 | python | s049659866 | s338291327 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | N = int(eval(input()))
tmp = (1+N) * N // 2
ans = tmp-N
print(ans) | N = int(eval(input()))
ans = (1+N)*N//2 - N
print(ans) | 6 | 3 | 67 | 50 | N = int(eval(input()))
tmp = (1 + N) * N // 2
ans = tmp - N
print(ans)
| N = int(eval(input()))
ans = (1 + N) * N // 2 - N
print(ans)
| false | 50 | [
"-tmp = (1 + N) * N // 2",
"-ans = tmp - N",
"+ans = (1 + N) * N // 2 - N"
] | false | 0.044723 | 0.045542 | 0.982021 | [
"s049659866",
"s338291327"
] |
u131811591 | p02329 | python | s844874803 | s481401574 | 1,040 | 900 | 179,200 | 179,068 | Accepted | Accepted | 13.46 | import sys
from collections import defaultdict
if __name__ == '__main__':
n, v = list(map(int, sys.stdin.readline().split()))
a = tuple(map(int, sys.stdin.readline().split()))
b = tuple(map(int, sys.stdin.readline().split()))
c = tuple(map(int, sys.stdin.readline().split()))
d = tuple(map(i... | import sys
from collections import defaultdict
def main():
n, v = list(map(int, sys.stdin.readline().split()))
a = tuple(map(int, sys.stdin.readline().split()))
b = tuple(map(int, sys.stdin.readline().split()))
c = tuple(map(int, sys.stdin.readline().split()))
d = tuple(map(int, sys.stdin... | 15 | 19 | 515 | 550 | import sys
from collections import defaultdict
if __name__ == "__main__":
n, v = list(map(int, sys.stdin.readline().split()))
a = tuple(map(int, sys.stdin.readline().split()))
b = tuple(map(int, sys.stdin.readline().split()))
c = tuple(map(int, sys.stdin.readline().split()))
d = tuple(map(int, sys.... | import sys
from collections import defaultdict
def main():
n, v = list(map(int, sys.stdin.readline().split()))
a = tuple(map(int, sys.stdin.readline().split()))
b = tuple(map(int, sys.stdin.readline().split()))
c = tuple(map(int, sys.stdin.readline().split()))
d = tuple(map(int, sys.stdin.readline... | false | 21.052632 | [
"-if __name__ == \"__main__\":",
"+",
"+def main():",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.037632 | 0.041718 | 0.90206 | [
"s844874803",
"s481401574"
] |
u690536347 | p02902 | python | s101055591 | s156379538 | 419 | 340 | 51,404 | 45,788 | Accepted | Accepted | 18.85 | from collections import deque
N, M = list(map(int, input().split()))
d = {i:[] for i in range(1, N+1)}
l = []
INF = 10**12
v = INF
for _ in range(M):
A, B = list(map(int, input().split()))
d[A].append(B)
l.append((A, B))
ans = []
for i, j in l:
INF = 10**12
dist = [-1]*(N+1)
... | from collections import deque
import sys
input=sys.stdin.readline
def solve():
N, M = list(map(int, input().split()))
d = {i:[] for i in range(1, N+1)}
l = []
INF = 10**12
v = INF
for _ in range(M):
A, B = list(map(int, input().split()))
d[A].append(B)
l... | 44 | 52 | 838 | 1,082 | from collections import deque
N, M = list(map(int, input().split()))
d = {i: [] for i in range(1, N + 1)}
l = []
INF = 10**12
v = INF
for _ in range(M):
A, B = list(map(int, input().split()))
d[A].append(B)
l.append((A, B))
ans = []
for i, j in l:
INF = 10**12
dist = [-1] * (N + 1)
prev = [-1] ... | from collections import deque
import sys
input = sys.stdin.readline
def solve():
N, M = list(map(int, input().split()))
d = {i: [] for i in range(1, N + 1)}
l = []
INF = 10**12
v = INF
for _ in range(M):
A, B = list(map(int, input().split()))
d[A].append(B)
l.append((A... | false | 15.384615 | [
"+import sys",
"-N, M = list(map(int, input().split()))",
"-d = {i: [] for i in range(1, N + 1)}",
"-l = []",
"-INF = 10**12",
"-v = INF",
"-for _ in range(M):",
"- A, B = list(map(int, input().split()))",
"- d[A].append(B)",
"- l.append((A, B))",
"-ans = []",
"-for i, j in l:",
"+i... | false | 0.04512 | 0.045119 | 1.000026 | [
"s101055591",
"s156379538"
] |
u170183831 | p02971 | python | s643364407 | s335093262 | 480 | 314 | 15,636 | 20,140 | Accepted | Accepted | 34.58 | n = int(input())
A = [int(input()) for _ in range(n)]
first = 0
second = 1
if A[first] < A[second]:
first, second = second, first
for i in range(2, n):
if A[first] < A[i]:
second = first
first = i
elif A[second] < A[i]:
second = i
print(*[A[first] if i != first else A... | import heapq
n = int(input())
A = [int(input()) for _ in range(n)]
m1, m2 = heapq.nlargest(2, A)
print(*[m2 if a == m1 else m1 for a in A], sep='\n')
| 15 | 6 | 359 | 155 | n = int(input())
A = [int(input()) for _ in range(n)]
first = 0
second = 1
if A[first] < A[second]:
first, second = second, first
for i in range(2, n):
if A[first] < A[i]:
second = first
first = i
elif A[second] < A[i]:
second = i
print(*[A[first] if i != first else A[second] for i i... | import heapq
n = int(input())
A = [int(input()) for _ in range(n)]
m1, m2 = heapq.nlargest(2, A)
print(*[m2 if a == m1 else m1 for a in A], sep="\n")
| false | 60 | [
"+import heapq",
"+",
"-first = 0",
"-second = 1",
"-if A[first] < A[second]:",
"- first, second = second, first",
"-for i in range(2, n):",
"- if A[first] < A[i]:",
"- second = first",
"- first = i",
"- elif A[second] < A[i]:",
"- second = i",
"-print(*[A[first... | false | 0.075689 | 0.102024 | 0.741874 | [
"s643364407",
"s335093262"
] |
u883040023 | p03011 | python | s485240626 | s543859115 | 24 | 17 | 2,940 | 2,940 | Accepted | Accepted | 29.17 | P , Q , R = list(map(int, input().split()))
if P >= Q and P >= R:
print((Q + R))
elif Q >= P and Q >= R:
print((P + R))
else:
print((P + Q)) | P , Q , R = list(map( int , input().split()))
distance = [P+Q , Q+R , R+P]
print((min(distance))) | 8 | 5 | 148 | 95 | P, Q, R = list(map(int, input().split()))
if P >= Q and P >= R:
print((Q + R))
elif Q >= P and Q >= R:
print((P + R))
else:
print((P + Q))
| P, Q, R = list(map(int, input().split()))
distance = [P + Q, Q + R, R + P]
print((min(distance)))
| false | 37.5 | [
"-if P >= Q and P >= R:",
"- print((Q + R))",
"-elif Q >= P and Q >= R:",
"- print((P + R))",
"-else:",
"- print((P + Q))",
"+distance = [P + Q, Q + R, R + P]",
"+print((min(distance)))"
] | false | 0.037601 | 0.043198 | 0.870442 | [
"s485240626",
"s543859115"
] |
u312025627 | p03229 | python | s085632199 | s921321968 | 804 | 608 | 61,448 | 58,840 | Accepted | Accepted | 24.38 | def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
from collections import deque
def make1():
d = deque(A)
ret = deque([d.popleft()])
for i in range((N-1)//2):
if i & 1:
j = d.popleft()
... | def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
le, ri = A[-1], A[-1]
# print(le, ri)
from collections import deque
A = deque(A[:N-1])
ans = 0
for i in range(N-1):
cur = [abs(A[0] - le), abs(A[-1] - ri),
abs(A[-... | 65 | 34 | 1,761 | 854 | def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
from collections import deque
def make1():
d = deque(A)
ret = deque([d.popleft()])
for i in range((N - 1) // 2):
if i & 1:
j = d.popleft()
k = d... | def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A.sort()
le, ri = A[-1], A[-1]
# print(le, ri)
from collections import deque
A = deque(A[: N - 1])
ans = 0
for i in range(N - 1):
cur = [abs(A[0] - le), abs(A[-1] - ri), abs(A[-1] - le), abs(A[0] -... | false | 47.692308 | [
"+ le, ri = A[-1], A[-1]",
"+ # print(le, ri)",
"- def make1():",
"- d = deque(A)",
"- ret = deque([d.popleft()])",
"- for i in range((N - 1) // 2):",
"- if i & 1:",
"- j = d.popleft()",
"- k = d.popleft()",
"- else:... | false | 0.041287 | 0.042031 | 0.982293 | [
"s085632199",
"s921321968"
] |
u984276646 | p04046 | python | s150935219 | s773831563 | 1,808 | 308 | 15,036 | 34,712 | Accepted | Accepted | 82.96 | H, W, A, B = list(map(int, input().split()))
mod = int(1e+9 + 7)
p = mod - 2
X, Y = H-A, W-B
L = []
while p != 0:
L = [p%2] + L[:]
p //= 2
S = 0
fL = [1]
invfL = []
for i in range(H+W):
fL.append(((i+1)*fL[i])%mod)
for i in range(H):
invi = 1
for j in range(len(L)):
if L[j] == 1:
in... | H, W, A, B = list(map(int, input().split()))
mod = int(1e9) + 7
def inved(a):
x, y, u, v, k, l = 1, 0, 0, 1, a, mod
while l != 0:
x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
k, l = l, k % l
return x % mod
fact = [1 for _ in range(H+W+A+B+1)]
invf = [1 for _ in range(H+W+A+B+1)]
for i i... | 40 | 23 | 775 | 639 | H, W, A, B = list(map(int, input().split()))
mod = int(1e9 + 7)
p = mod - 2
X, Y = H - A, W - B
L = []
while p != 0:
L = [p % 2] + L[:]
p //= 2
S = 0
fL = [1]
invfL = []
for i in range(H + W):
fL.append(((i + 1) * fL[i]) % mod)
for i in range(H):
invi = 1
for j in range(len(L)):
if L[j] == 1... | H, W, A, B = list(map(int, input().split()))
mod = int(1e9) + 7
def inved(a):
x, y, u, v, k, l = 1, 0, 0, 1, a, mod
while l != 0:
x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
k, l = l, k % l
return x % mod
fact = [1 for _ in range(H + W + A + B + 1)]
invf = [1 for _ in range(H +... | false | 42.5 | [
"-mod = int(1e9 + 7)",
"-p = mod - 2",
"-X, Y = H - A, W - B",
"-L = []",
"-while p != 0:",
"- L = [p % 2] + L[:]",
"- p //= 2",
"+mod = int(1e9) + 7",
"+",
"+",
"+def inved(a):",
"+ x, y, u, v, k, l = 1, 0, 0, 1, a, mod",
"+ while l != 0:",
"+ x, y, u, v = u, v, x - u *... | false | 0.073826 | 0.039814 | 1.854276 | [
"s150935219",
"s773831563"
] |
u706786134 | p02714 | python | s682999996 | s112306129 | 1,922 | 794 | 9,208 | 109,644 | Accepted | Accepted | 58.69 | n = int(eval(input()))
s = eval(input())
r = g = b = 0
for i in range(n):
if s[i] == 'R':
r += 1
elif s[i] == 'G':
g += 1
else:
b += 1
x = 0
for i in range(n):
for j in range(i+1, n):
k = j + j - i
if k < n and s[i] != s[j] and s[j] != s[k] and s... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
MOD = 10**9 + 7
N = int(readline())
S = np.array(list(read().rstrip()), np.int8)
R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S... | 19 | 31 | 357 | 666 | n = int(eval(input()))
s = eval(input())
r = g = b = 0
for i in range(n):
if s[i] == "R":
r += 1
elif s[i] == "G":
g += 1
else:
b += 1
x = 0
for i in range(n):
for j in range(i + 1, n):
k = j + j - i
if k < n and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
MOD = 10**9 + 7
N = int(readline())
S = np.array(list(read().rstrip()), np.int8)
R = np.sum(S == ord("R"))
B = np.sum(S == ord("B"))
G = np.sum(S == ord("G"))
... | false | 38.709677 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-r = g = b = 0",
"-for i in range(n):",
"- if s[i] == \"R\":",
"- r += 1",
"- elif s[i] == \"G\":",
"- g += 1",
"- else:",
"- b += 1",
"-x = 0",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- ... | false | 0.062212 | 0.22401 | 0.277718 | [
"s682999996",
"s112306129"
] |
u974620347 | p03160 | python | s561613528 | s995541354 | 132 | 104 | 13,928 | 13,976 | Accepted | Accepted | 21.21 | if __name__ == "__main__":
N = int(eval(input()))
h = [int(n) for n in input().split()]
dp = [0] * int(1e5) # dp[i]はiにたどり着くコストの最小値
# dp[0] = 0
# dp[n] = min(dp[n-1] + abs(h[n] - h[n-1]), dp[n-2] + |h[n] - h[n-2]|)
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [-1]*N
dp[0] = 0
dp[1] = abs(A[1] - A[0])
for i in range(2,N):
dp[i] = min(dp[i-1] + abs(A[i] - A[i-1]), dp[i-2] + abs(A[i] - A[i-2]))
print((dp[N-1]))
main() | 11 | 10 | 402 | 273 | if __name__ == "__main__":
N = int(eval(input()))
h = [int(n) for n in input().split()]
dp = [0] * int(1e5) # dp[i]はiにたどり着くコストの最小値
# dp[0] = 0
# dp[n] = min(dp[n-1] + abs(h[n] - h[n-1]), dp[n-2] + |h[n] - h[n-2]|)
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = ... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [-1] * N
dp[0] = 0
dp[1] = abs(A[1] - A[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(A[i] - A[i - 1]), dp[i - 2] + abs(A[i] - A[i - 2]))
print((dp[N - 1]))
main()
| false | 9.090909 | [
"-if __name__ == \"__main__\":",
"+def main():",
"- h = [int(n) for n in input().split()]",
"- dp = [0] * int(1e5) # dp[i]はiにたどり着くコストの最小値",
"- # dp[0] = 0",
"- # dp[n] = min(dp[n-1] + abs(h[n] - h[n-1]), dp[n-2] + |h[n] - h[n-2]|)",
"+ A = [int(i) for i in input().split()]",
"+ dp =... | false | 0.036178 | 0.034106 | 1.060737 | [
"s561613528",
"s995541354"
] |
u297574184 | p02850 | python | s751455051 | s928387096 | 649 | 363 | 77,292 | 86,524 | Accepted | Accepted | 44.07 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
adjL = [[] for _ in range(N)]
edges = []
for _ in range(N-1):
A, B = list(map(int, input().split()))
A, B = A-1, B-1
adjL[A].append(B)
adjL[B].append(A)
edges.append((A, B))
colors = dict()
def dfs(vNow, vPar, color):
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def solve():
N = int(eval(input()))
adjL = [[] for _ in range(N)]
for i in range(N-1):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
adjL[a].append((b, i))
adjL[b].append((a, i))
de... | 36 | 31 | 723 | 681 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
adjL = [[] for _ in range(N)]
edges = []
for _ in range(N - 1):
A, B = list(map(int, input().split()))
A, B = A - 1, B - 1
adjL[A].append(B)
adjL[B].append(A)
edges.append((A, B))
colors = dict()
def dfs(vNow, vPar, color):
c = 1
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def solve():
N = int(eval(input()))
adjL = [[] for _ in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
adjL[a].append((b, i))
adjL[b].append((a, i))
def dfs... | false | 13.888889 | [
"+input = sys.stdin.readline",
"-N = int(eval(input()))",
"-adjL = [[] for _ in range(N)]",
"-edges = []",
"-for _ in range(N - 1):",
"- A, B = list(map(int, input().split()))",
"- A, B = A - 1, B - 1",
"- adjL[A].append(B)",
"- adjL[B].append(A)",
"- edges.append((A, B))",
"-colo... | false | 0.035701 | 0.040597 | 0.879383 | [
"s751455051",
"s928387096"
] |
u380524497 | p02788 | python | s578414073 | s033952155 | 876 | 459 | 45,372 | 56,024 | Accepted | Accepted | 47.6 | from collections import deque
import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
monsters = []
for _ in range(n):
pos, hp = list(map(int, input().split()))
monsters.append([pos, hp])
monsters.sort()
bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
an... | def main():
import sys
from operator import itemgetter
from collections import deque
buf = sys.stdin.buffer
n, d, a = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
monsters = sorted(zip(m, m), key=itemgetter(0))
bomb_area = deque([])
... | 37 | 37 | 824 | 1,006 | from collections import deque
import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
monsters = []
for _ in range(n):
pos, hp = list(map(int, input().split()))
monsters.append([pos, hp])
monsters.sort()
bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
ans = 0
for pos, hp i... | def main():
import sys
from operator import itemgetter
from collections import deque
buf = sys.stdin.buffer
n, d, a = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
monsters = sorted(zip(m, m), key=itemgetter(0))
bomb_area = deque([])
bomb_power = dequ... | false | 0 | [
"-from collections import deque",
"-import sys",
"+def main():",
"+ import sys",
"+ from operator import itemgetter",
"+ from collections import deque",
"-input = sys.stdin.readline",
"-n, d, a = list(map(int, input().split()))",
"-monsters = []",
"-for _ in range(n):",
"- pos, hp = ... | false | 0.037875 | 0.0075 | 5.050215 | [
"s578414073",
"s033952155"
] |
u546285759 | p00062 | python | s534455446 | s695587548 | 30 | 20 | 7,740 | 7,688 | Accepted | Accepted | 33.33 | while True:
try:
nums = eval(input())
except:
break
a = list(map(int, list(nums)))
while len(a) > 1:
a = list(map(int, [str(a[i]+a[i+1])[-1] for i in range(len(a)-1)]))
print((*a)) | while True:
try:
nums = eval(input())
except:
break
a = list(map(int, list(nums)))
while len(a) > 1:
a = [(a[i]+a[i+1])%10 for i in range(len(a)-1)]
print((*a)) | 9 | 9 | 224 | 204 | while True:
try:
nums = eval(input())
except:
break
a = list(map(int, list(nums)))
while len(a) > 1:
a = list(map(int, [str(a[i] + a[i + 1])[-1] for i in range(len(a) - 1)]))
print((*a))
| while True:
try:
nums = eval(input())
except:
break
a = list(map(int, list(nums)))
while len(a) > 1:
a = [(a[i] + a[i + 1]) % 10 for i in range(len(a) - 1)]
print((*a))
| false | 0 | [
"- a = list(map(int, [str(a[i] + a[i + 1])[-1] for i in range(len(a) - 1)]))",
"+ a = [(a[i] + a[i + 1]) % 10 for i in range(len(a) - 1)]"
] | false | 0.035207 | 0.037865 | 0.929804 | [
"s534455446",
"s695587548"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.