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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u968166680 | p03111 | python | s309005812 | s691564108 | 157 | 68 | 9,204 | 9,220 | Accepted | Accepted | 56.69 | import sys
from itertools import product
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, readline().split()))
(*L,) = list(map(int, read().split()))
ans = IN... | import sys
from itertools import product
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, B, C = list(map(int, readline().split()))
(*L,) = list(map(int, read().split()))
def... | 39 | 32 | 853 | 751 | import sys
from itertools import product
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, readline().split()))
(*L,) = list(map(int, read().split()))
ans = INF
for p in pro... | import sys
from itertools import product
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, B, C = list(map(int, readline().split()))
(*L,) = list(map(int, read().split()))
def rec(i, a, b, c):... | false | 17.948718 | [
"- N, *A = list(map(int, readline().split()))",
"+ N, A, B, C = list(map(int, readline().split()))",
"- ans = INF",
"- for p in product(list(range(4)), repeat=N):",
"- num = [0] * 3",
"- length = [0] * 3",
"- for i, j in enumerate(p):",
"- if j < 3:",
"- ... | false | 0.214916 | 0.053946 | 3.983917 | [
"s309005812",
"s691564108"
] |
u698693989 | p02399 | python | s548170141 | s520613556 | 30 | 20 | 7,608 | 5,608 | Accepted | Accepted | 33.33 | a,b=list(map(int,input().split()))
d = a // b
r = a % b
f = ("%.5f" % (a/b))
l=[d,r,f]
print(("{0} {1} {2}".format(l[0],l[1],l[2]))) | num=input().split()
a=int(num[0])
b=int(num[1])
d=a//b
r=a%b
f=float(a/b)
print((d,r,"{:.5f}".format(f)))
| 6 | 8 | 184 | 112 | a, b = list(map(int, input().split()))
d = a // b
r = a % b
f = "%.5f" % (a / b)
l = [d, r, f]
print(("{0} {1} {2}".format(l[0], l[1], l[2])))
| num = input().split()
a = int(num[0])
b = int(num[1])
d = a // b
r = a % b
f = float(a / b)
print((d, r, "{:.5f}".format(f)))
| false | 25 | [
"-a, b = list(map(int, input().split()))",
"+num = input().split()",
"+a = int(num[0])",
"+b = int(num[1])",
"-f = \"%.5f\" % (a / b)",
"-l = [d, r, f]",
"-print((\"{0} {1} {2}\".format(l[0], l[1], l[2])))",
"+f = float(a / b)",
"+print((d, r, \"{:.5f}\".format(f)))"
] | false | 0.039133 | 0.037306 | 1.048972 | [
"s548170141",
"s520613556"
] |
u524870111 | p02779 | python | s242734732 | s982274054 | 103 | 83 | 25,944 | 25,808 | Accepted | Accepted | 19.42 | import sys
stdin = sys.stdin
from collections import deque
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n = ni()
a = na()
b = set(a)
if len(a)==len(b):
print("YES")
else:
print("NO") | import sys
stdin = sys.stdin
from itertools import accumulate
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n = ni()
a = na()
if n == len(set(a)):
print("YES")
else:
print("NO") | 15 | 14 | 277 | 270 | import sys
stdin = sys.stdin
from collections import deque
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n = ni()
a = na()
b = set(a)
if len(a) == len(b):
print("YES")
else:
print("NO")
| import sys
stdin = sys.stdin
from itertools import accumulate
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n = ni()
a = na()
if n == len(set(a)):
print("YES")
else:
print("NO")
| false | 6.666667 | [
"-from collections import deque",
"+from itertools import accumulate",
"-b = set(a)",
"-if len(a) == len(b):",
"+if n == len(set(a)):"
] | false | 0.086542 | 0.034621 | 2.4997 | [
"s242734732",
"s982274054"
] |
u263830634 | p03703 | python | s194359474 | s081494738 | 1,451 | 1,159 | 46,696 | 40,960 | Accepted | Accepted | 20.12 | N, K = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(N)]
B = [0] * (N + 1)
B[1] = A[0] - K
for i in range(1, N):
A[i] += A[i - 1]
B[i + 1] = A[i] - K * (i + 1)
tmp = sorted(B)
dic = dict()
for index, x in enumerate(tmp):
dic[x] = index
N = len(B)
bit = [0] * (N... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N, K = list(map(int, input().split()))
A = [0] + [int(eval(input())) - K for _ in range(N)]
# print (A)
for i in range(N):
A[i + 1] += A[i]
B = sorted(A)
dic = dict()
for i, b in enumerate(B):
dic[b] = i + 1... | 44 | 42 | 701 | 670 | N, K = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(N)]
B = [0] * (N + 1)
B[1] = A[0] - K
for i in range(1, N):
A[i] += A[i - 1]
B[i + 1] = A[i] - K * (i + 1)
tmp = sorted(B)
dic = dict()
for index, x in enumerate(tmp):
dic[x] = index
N = len(B)
bit = [0] * (N + 1)
def total(i):
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, K = list(map(int, input().split()))
A = [0] + [int(eval(input())) - K for _ in range(N)]
# print (A)
for i in range(N):
A[i + 1] += A[i]
B = sorted(A)
dic = dict()
for i, b in enumerate(B):
dic[b] = i + 1
N += 1
bit = [0] * (... | false | 4.545455 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-A = [int(eval(input())) for _ in range(N)]",
"-B = [0] * (N + 1)",
"-B[1] = A[0] - K",
"-for i in range(1, N):",
"- A[i] += A[i - 1]",
"- B[i + 1] = A[i] - K * (i + 1)",
"-tmp = sort... | false | 0.039083 | 0.044666 | 0.875008 | [
"s194359474",
"s081494738"
] |
u279493135 | p03576 | python | s394701011 | s133208146 | 1,981 | 299 | 67,288 | 61,164 | Accepted | Accepted | 84.91 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lower... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lower... | 38 | 29 | 1,081 | 1,053 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | false | 23.684211 | [
"-X = sorted([x[0] for x in xy])",
"-Y = sorted([x[1] for x in xy])",
"-for p in combinations(X, 2):",
"- x_min = p[0]",
"- x_max = p[1]",
"- for q in combinations(Y, 2):",
"- y_min = q[0]",
"- y_max = q[1]",
"- cnt = 0",
"- for x, y in xy:",
"- if... | false | 0.086707 | 0.046055 | 1.882675 | [
"s394701011",
"s133208146"
] |
u472065247 | p03634 | python | s983252944 | s750193307 | 806 | 697 | 87,500 | 46,188 | Accepted | Accepted | 13.52 | import sys
input = sys.stdin.readline
N = int(eval(input()))
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(Q)]
G = [[] * N for _ in range(N)]
for a, b, c in ABC:
G[a - 1].append((b - 1, c))
G[b -... | import sys
input = sys.stdin.readline
N = int(eval(input()))
G = [[] * N for _ in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a - 1].append((b - 1, c))
G[b - 1].append((a - 1, c))
Q, K = list(map(int, input().split()))
D = [-1] * N
s = [(K - 1, 0)]
while s:
v... | 24 | 25 | 527 | 487 | import sys
input = sys.stdin.readline
N = int(eval(input()))
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(Q)]
G = [[] * N for _ in range(N)]
for a, b, c in ABC:
G[a - 1].append((b - 1, c))
G[b - 1].appe... | import sys
input = sys.stdin.readline
N = int(eval(input()))
G = [[] * N for _ in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a - 1].append((b - 1, c))
G[b - 1].append((a - 1, c))
Q, K = list(map(int, input().split()))
D = [-1] * N
s = [(K - 1, 0)]
while s:
v, c = s.pop... | false | 4 | [
"-ABC = [list(map(int, input().split())) for _ in range(N - 1)]",
"-Q, K = list(map(int, input().split()))",
"-XY = [list(map(int, input().split())) for _ in range(Q)]",
"-for a, b, c in ABC:",
"+for _ in range(N - 1):",
"+ a, b, c = list(map(int, input().split()))",
"+Q, K = list(map(int, input().sp... | false | 0.035855 | 0.085548 | 0.419118 | [
"s983252944",
"s750193307"
] |
u525065967 | p02555 | python | s684956214 | s786253056 | 523 | 43 | 9,068 | 9,124 | Accepted | Accepted | 91.78 | s = int(eval(input()))
MOD = 10**9 + 7
C = [0]*(s + 1)
C[0] = 1
for n in range(3, s+1): # n:[3,s]
for i in range(3, n+1): # i:[3,n]
C[n] += C[n-i]
C[n] %= MOD
print((C[s]))
| s = int(eval(input()))
MOD = 10**9 + 7
C = [0]*(s + 1)
C[0] = 1
for n in range(3, s+1): # n:[3,s]
C[n] = sum(C[:n-3+1]) % MOD # sum(C[0,n-3])
print((C[s]))
| 9 | 7 | 193 | 158 | s = int(eval(input()))
MOD = 10**9 + 7
C = [0] * (s + 1)
C[0] = 1
for n in range(3, s + 1): # n:[3,s]
for i in range(3, n + 1): # i:[3,n]
C[n] += C[n - i]
C[n] %= MOD
print((C[s]))
| s = int(eval(input()))
MOD = 10**9 + 7
C = [0] * (s + 1)
C[0] = 1
for n in range(3, s + 1): # n:[3,s]
C[n] = sum(C[: n - 3 + 1]) % MOD # sum(C[0,n-3])
print((C[s]))
| false | 22.222222 | [
"- for i in range(3, n + 1): # i:[3,n]",
"- C[n] += C[n - i]",
"- C[n] %= MOD",
"+ C[n] = sum(C[: n - 3 + 1]) % MOD # sum(C[0,n-3])"
] | false | 0.329569 | 0.038685 | 8.51926 | [
"s684956214",
"s786253056"
] |
u751277549 | p03434 | python | s714321697 | s960412575 | 199 | 170 | 38,524 | 38,384 | Accepted | Accepted | 14.57 | n = int(eval(input()))
a = list(map(int, input().split()))
Alice = 0
Bob = 0
ans = 0
while len(a) != 0:
Alice += max(a)
a.remove(max(a))
if a:
Bob += max(a)
a.remove(max(a))
ans = Alice - Bob
print(ans)
| n = int(eval(input()))
a = sorted(list(map(int, input().split())), reverse=True)
print((sum(a[::2]) - sum(a[1::2]))) | 13 | 3 | 237 | 110 | n = int(eval(input()))
a = list(map(int, input().split()))
Alice = 0
Bob = 0
ans = 0
while len(a) != 0:
Alice += max(a)
a.remove(max(a))
if a:
Bob += max(a)
a.remove(max(a))
ans = Alice - Bob
print(ans)
| n = int(eval(input()))
a = sorted(list(map(int, input().split())), reverse=True)
print((sum(a[::2]) - sum(a[1::2])))
| false | 76.923077 | [
"-a = list(map(int, input().split()))",
"-Alice = 0",
"-Bob = 0",
"-ans = 0",
"-while len(a) != 0:",
"- Alice += max(a)",
"- a.remove(max(a))",
"- if a:",
"- Bob += max(a)",
"- a.remove(max(a))",
"-ans = Alice - Bob",
"-print(ans)",
"+a = sorted(list(map(int, input().s... | false | 0.037553 | 0.047684 | 0.787551 | [
"s714321697",
"s960412575"
] |
u727051308 | p02578 | python | s519698127 | s008019001 | 233 | 166 | 26,140 | 25,152 | Accepted | Accepted | 28.76 | N = int(eval(input()))
A = input().split()
count = 0
for i in range(N-1):
if int(A[i]) > int(A[i+1]):
count += int(A[i]) - int(A[i+1])
A[i+1] = int(A[i])
print(count) | N = int(eval(input()))
A = input().split()
count = 0
for i in range(N):
A[i] = int(A[i])
for i in range(N-1):
if A[i] > A[i+1]:
count += A[i] - A[i+1]
A[i+1] = A[i]
print(count) | 9 | 12 | 179 | 196 | N = int(eval(input()))
A = input().split()
count = 0
for i in range(N - 1):
if int(A[i]) > int(A[i + 1]):
count += int(A[i]) - int(A[i + 1])
A[i + 1] = int(A[i])
print(count)
| N = int(eval(input()))
A = input().split()
count = 0
for i in range(N):
A[i] = int(A[i])
for i in range(N - 1):
if A[i] > A[i + 1]:
count += A[i] - A[i + 1]
A[i + 1] = A[i]
print(count)
| false | 25 | [
"+for i in range(N):",
"+ A[i] = int(A[i])",
"- if int(A[i]) > int(A[i + 1]):",
"- count += int(A[i]) - int(A[i + 1])",
"- A[i + 1] = int(A[i])",
"+ if A[i] > A[i + 1]:",
"+ count += A[i] - A[i + 1]",
"+ A[i + 1] = A[i]"
] | false | 0.112318 | 0.089267 | 1.258225 | [
"s519698127",
"s008019001"
] |
u554503378 | p02262 | python | s395470328 | s476766744 | 22,780 | 19,500 | 45,508 | 45,520 | Accepted | Accepted | 14.4 | def insertion_sort(num_list,gap):
global cnt
for i in range(gap,len(num_list)):
evc = num_list[i]
j = i-gap
while j >= 0 and num_list[j] > evc:
num_list[j+gap] = num_list[j]
j = j-gap
cnt += 1
num_list[j+gap] = evc
def shel... | def insertion_sort(num_list,gap):
global cnt
for i in range(gap,len(num_list)):
swap_num = num_list[i]
j = i-gap
while j >= 0 and num_list[j] > swap_num:
num_list[j+gap] = num_list[j]
j -= gap
cnt += 1
num_list[j+gap] = swap_num
def... | 35 | 32 | 784 | 791 | def insertion_sort(num_list, gap):
global cnt
for i in range(gap, len(num_list)):
evc = num_list[i]
j = i - gap
while j >= 0 and num_list[j] > evc:
num_list[j + gap] = num_list[j]
j = j - gap
cnt += 1
num_list[j + gap] = evc
def shell_sor... | def insertion_sort(num_list, gap):
global cnt
for i in range(gap, len(num_list)):
swap_num = num_list[i]
j = i - gap
while j >= 0 and num_list[j] > swap_num:
num_list[j + gap] = num_list[j]
j -= gap
cnt += 1
num_list[j + gap] = swap_num
def s... | false | 8.571429 | [
"- evc = num_list[i]",
"+ swap_num = num_list[i]",
"- while j >= 0 and num_list[j] > evc:",
"+ while j >= 0 and num_list[j] > swap_num:",
"- j = j - gap",
"+ j -= gap",
"- num_list[j + gap] = evc",
"+ num_list[j + gap] = swap_num",
... | false | 0.069139 | 0.068597 | 1.007913 | [
"s395470328",
"s476766744"
] |
u088372268 | p02397 | python | s169789895 | s653297005 | 60 | 50 | 7,708 | 7,564 | Accepted | Accepted | 16.67 | for i in range(3000):
x = list(input().split(" "))
idx = 0
if x[0] == "0" and x[1] == "0":
break
for j in x:
x[idx] = int(j)
idx += 1
x.sort()
print((x[0], x[1])) | for i in range(3000):
x = list(input().split(" "))
if x[0] == "0" and x[1] == "0":
break
idx = 0
for j in x:
x[idx] = int(j)
idx += 1
x.sort()
print((x[0], x[1])) | 10 | 10 | 217 | 217 | for i in range(3000):
x = list(input().split(" "))
idx = 0
if x[0] == "0" and x[1] == "0":
break
for j in x:
x[idx] = int(j)
idx += 1
x.sort()
print((x[0], x[1]))
| for i in range(3000):
x = list(input().split(" "))
if x[0] == "0" and x[1] == "0":
break
idx = 0
for j in x:
x[idx] = int(j)
idx += 1
x.sort()
print((x[0], x[1]))
| false | 0 | [
"- idx = 0",
"+ idx = 0"
] | false | 0.039844 | 0.040772 | 0.977231 | [
"s169789895",
"s653297005"
] |
u935558307 | p03305 | python | s067696782 | s967017290 | 1,516 | 1,245 | 101,196 | 122,672 | Accepted | Accepted | 17.88 | import heapq
n,m,s,t = list(map(int,input().split()))
edgesYen = [[]for _ in range(n+1)]
edgesSnuuk = [[]for _ in range(n+1)]
for _ in range(m):
u,v,a,b = list(map(int,input().split()))
edgesYen[u].append((v,a))
edgesYen[v].append((u,a))
edgesSnuuk[u].append((v,b))
edgesSnuuk[v].append(... | def main():
import sys
input = sys.stdin.readline
import heapq
n,m,s,t = list(map(int,input().split()))
edgesYen = [[]for _ in range(n+1)]
edgesSnuuk = [[]for _ in range(n+1)]
for _ in range(m):
u,v,a,b = list(map(int,input().split()))
edgesYen[u].append((v,a))
... | 46 | 41 | 1,121 | 1,236 | import heapq
n, m, s, t = list(map(int, input().split()))
edgesYen = [[] for _ in range(n + 1)]
edgesSnuuk = [[] for _ in range(n + 1)]
for _ in range(m):
u, v, a, b = list(map(int, input().split()))
edgesYen[u].append((v, a))
edgesYen[v].append((u, a))
edgesSnuuk[u].append((v, b))
edgesSnuuk[v].ap... | def main():
import sys
input = sys.stdin.readline
import heapq
n, m, s, t = list(map(int, input().split()))
edgesYen = [[] for _ in range(n + 1)]
edgesSnuuk = [[] for _ in range(n + 1)]
for _ in range(m):
u, v, a, b = list(map(int, input().split()))
edgesYen[u].append((v, a... | false | 10.869565 | [
"-import heapq",
"+def main():",
"+ import sys",
"-n, m, s, t = list(map(int, input().split()))",
"-edgesYen = [[] for _ in range(n + 1)]",
"-edgesSnuuk = [[] for _ in range(n + 1)]",
"-for _ in range(m):",
"- u, v, a, b = list(map(int, input().split()))",
"- edgesYen[u].append((v, a))",
... | false | 0.046701 | 0.048239 | 0.968117 | [
"s067696782",
"s967017290"
] |
u892305365 | p02836 | python | s138850604 | s360647119 | 26 | 23 | 9,036 | 9,012 | Accepted | Accepted | 11.54 | S=eval(input());N=len(S);print((sum(S[i]!=S[N-i-1] for i in range(N//2)))) | S=eval(input());print((sum(a!=b for a,b in zip(S,S[::-1]))//2)) | 1 | 1 | 66 | 55 | S = eval(input())
N = len(S)
print((sum(S[i] != S[N - i - 1] for i in range(N // 2))))
| S = eval(input())
print((sum(a != b for a, b in zip(S, S[::-1])) // 2))
| false | 0 | [
"-N = len(S)",
"-print((sum(S[i] != S[N - i - 1] for i in range(N // 2))))",
"+print((sum(a != b for a, b in zip(S, S[::-1])) // 2))"
] | false | 0.038256 | 0.040033 | 0.955614 | [
"s138850604",
"s360647119"
] |
u818283165 | p03273 | python | s532153274 | s208285541 | 27 | 21 | 3,572 | 3,064 | Accepted | Accepted | 22.22 | import copy
H,W = list(map(int,input().split()))
a = []
for i in range(H):
a.append(input().split())
aa = copy.copy(a)
#print(a)
aaa = 0
d = ""
for i in range(W):
d += "."
for i in range(H):
if a[i][0] == d:
aa.pop(i-aaa)
aaa += 1
#print(aa)
b = []
bb = ""
for i in range(... | H,W = list(map(int,input().split()))
a = []
for i in range(H):
a.append(input().split())
g = []
r = []
for i in range(H):
for j in range(W):
if a[i][0][j] == "#":
g.append(i)
break
#print(g)
for i in range(W):
for j in range(H):
if a[j][0][i] == "#":
... | 46 | 24 | 783 | 462 | import copy
H, W = list(map(int, input().split()))
a = []
for i in range(H):
a.append(input().split())
aa = copy.copy(a)
# print(a)
aaa = 0
d = ""
for i in range(W):
d += "."
for i in range(H):
if a[i][0] == d:
aa.pop(i - aaa)
aaa += 1
# print(aa)
b = []
bb = ""
for i in range(W):
for j... | H, W = list(map(int, input().split()))
a = []
for i in range(H):
a.append(input().split())
g = []
r = []
for i in range(H):
for j in range(W):
if a[i][0][j] == "#":
g.append(i)
break
# print(g)
for i in range(W):
for j in range(H):
if a[j][0][i] == "#":
r.... | false | 47.826087 | [
"-import copy",
"-",
"-aa = copy.copy(a)",
"-# print(a)",
"-aaa = 0",
"-d = \"\"",
"+g = []",
"+r = []",
"+for i in range(H):",
"+ for j in range(W):",
"+ if a[i][0][j] == \"#\":",
"+ g.append(i)",
"+ break",
"+# print(g)",
"- d += \".\"",
"-for i in ... | false | 0.036259 | 0.037042 | 0.978847 | [
"s532153274",
"s208285541"
] |
u117348081 | p03125 | python | s815050303 | s206332730 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | A,B=list(map(int,input().split()))
if B%A==0:
print((A+B))
else:
print((B-A)) | a,b = list(map(int, input().split()))
if b%a==0:
print((a+b))
else:
print((b-a)) | 5 | 5 | 79 | 82 | A, B = list(map(int, input().split()))
if B % A == 0:
print((A + B))
else:
print((B - A))
| a, b = list(map(int, input().split()))
if b % a == 0:
print((a + b))
else:
print((b - a))
| false | 0 | [
"-A, B = list(map(int, input().split()))",
"-if B % A == 0:",
"- print((A + B))",
"+a, b = list(map(int, input().split()))",
"+if b % a == 0:",
"+ print((a + b))",
"- print((B - A))",
"+ print((b - a))"
] | false | 0.035905 | 0.035957 | 0.998554 | [
"s815050303",
"s206332730"
] |
u489959379 | p02995 | python | s369517143 | s370434179 | 35 | 17 | 5,076 | 3,064 | Accepted | Accepted | 51.43 | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = list(map(int, input().split()))
c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
CD = lcm(C, D)
cd = B // CD - (A - 1) // CD
ans = (B - A + 1) - (c + d - cd)
print(ans) | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def resolve():
a, b, c, d = list(map(int, input().split()))
l = lcm(c, d)
def cal... | 14 | 31 | 268 | 467 | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = list(map(int, input().split()))
c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
CD = lcm(C, D)
cd = B // CD - (A - 1) // CD
ans = (B - A + 1) - (c + d - cd)
print(ans)
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def resolve():
a, b, c, d = list(map(int, input().split()))
l = lcm(c, d)
def calc(n):
res = n // c ... | false | 54.83871 | [
"-from fractions import gcd",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+f_inf = float(\"inf\")",
"+mod = 10**9 + 7",
"-def lcm(x, y):",
"- return (x * y) // gcd(x, y)",
"+def gcd(a, b):",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ return a",
"-A, B, C, D = list(m... | false | 0.058869 | 0.037993 | 1.54946 | [
"s369517143",
"s370434179"
] |
u777283665 | p03127 | python | s235779892 | s589853686 | 74 | 68 | 14,224 | 15,020 | Accepted | Accepted | 8.11 | n = int(eval(input()))
a = list(map(int, input().split()))
while True:
min_num = min(a)
min_ind = a.index(min_num)
a = [n % min_num for n in (a[:min_ind] + a[min_ind+1:]) if n % min_num != 0]
if a == []:
print(min_num)
exit()
a.append(min_num) | n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a%b
return a
g = a[0]
for n in a:
g = gcd(g, n)
print(g) | 11 | 13 | 285 | 178 | n = int(eval(input()))
a = list(map(int, input().split()))
while True:
min_num = min(a)
min_ind = a.index(min_num)
a = [n % min_num for n in (a[:min_ind] + a[min_ind + 1 :]) if n % min_num != 0]
if a == []:
print(min_num)
exit()
a.append(min_num)
| n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
g = a[0]
for n in a:
g = gcd(g, n)
print(g)
| false | 15.384615 | [
"-while True:",
"- min_num = min(a)",
"- min_ind = a.index(min_num)",
"- a = [n % min_num for n in (a[:min_ind] + a[min_ind + 1 :]) if n % min_num != 0]",
"- if a == []:",
"- print(min_num)",
"- exit()",
"- a.append(min_num)",
"+",
"+",
"+def gcd(a, b):",
"+ whi... | false | 0.04849 | 0.045495 | 1.065824 | [
"s235779892",
"s589853686"
] |
u970197315 | p03363 | python | s471836732 | s058233219 | 262 | 208 | 41,620 | 34,452 | Accepted | Accepted | 20.61 | # A - Zero-Sum Ranges
from itertools import accumulate
from collections import defaultdict as dd
n=int(eval(input()))
a=[0]+list(map(int,input().split()))
acc=accumulate(a)
acc=list(acc)
acc.sort()
# print(acc)
d=dd(int)
for aa in acc:
d[aa]+=1
ans=0
for k,v in list(d.items()):
if v>=2:
... | n=int(eval(input()))
a=[0]+list(map(int,input().split()))
from itertools import accumulate
a=accumulate(a)
a=list(a)
a.sort()
from collections import Counter
c=Counter(a)
ans=0
for k,v in list(c.items()):
if v>=2:
ans+=v*(v-1)//2
print(ans)
| 19 | 13 | 338 | 253 | # A - Zero-Sum Ranges
from itertools import accumulate
from collections import defaultdict as dd
n = int(eval(input()))
a = [0] + list(map(int, input().split()))
acc = accumulate(a)
acc = list(acc)
acc.sort()
# print(acc)
d = dd(int)
for aa in acc:
d[aa] += 1
ans = 0
for k, v in list(d.items()):
if v >= 2:
... | n = int(eval(input()))
a = [0] + list(map(int, input().split()))
from itertools import accumulate
a = accumulate(a)
a = list(a)
a.sort()
from collections import Counter
c = Counter(a)
ans = 0
for k, v in list(c.items()):
if v >= 2:
ans += v * (v - 1) // 2
print(ans)
| false | 31.578947 | [
"-# A - Zero-Sum Ranges",
"-from itertools import accumulate",
"-from collections import defaultdict as dd",
"-",
"-acc = accumulate(a)",
"-acc = list(acc)",
"-acc.sort()",
"-# print(acc)",
"-d = dd(int)",
"-for aa in acc:",
"- d[aa] += 1",
"+from itertools import accumulate",
"+",
"+a ... | false | 0.036085 | 0.034557 | 1.044218 | [
"s471836732",
"s058233219"
] |
u763177133 | p02922 | python | s136047842 | s503556399 | 31 | 28 | 9,040 | 9,168 | Accepted | Accepted | 9.68 | a,b = list(map(int,input().split()))
num = 0
while True:
if a * num - (num-1) >= b:
break
num += 1
print(num) | a,b=list(map(int, input().split()))
c="必要な電源タップ数は"
d="個です。"
count=0
total=1
while True:
# total+=a
# if total<b:
# total-=1
# count+=1
# else:
# break
if total >= b:
break
total += (a-1)
count+=1
print(count) | 10 | 19 | 129 | 280 | a, b = list(map(int, input().split()))
num = 0
while True:
if a * num - (num - 1) >= b:
break
num += 1
print(num)
| a, b = list(map(int, input().split()))
c = "必要な電源タップ数は"
d = "個です。"
count = 0
total = 1
while True:
# total+=a
# if total<b:
# total-=1
# count+=1
# else:
# break
if total >= b:
break
total += a - 1
count += 1
print(count)
| false | 47.368421 | [
"-num = 0",
"+c = \"必要な電源タップ数は\"",
"+d = \"個です。\"",
"+count = 0",
"+total = 1",
"- if a * num - (num - 1) >= b:",
"+ # total+=a",
"+ # if total<b:",
"+ # total-=1",
"+ # count+=1",
"+ # else:",
"+ # break",
"+ if total >= b:",
"- num... | false | 0.11458 | 0.11197 | 1.023308 | [
"s136047842",
"s503556399"
] |
u392319141 | p02755 | python | s824090252 | s541929971 | 47 | 37 | 3,060 | 2,940 | Accepted | Accepted | 21.28 | A, B = list(map(int, input().split()))
for i in range(1, 10**5):
if int(i * 0.08) == A and int(i * 0.1) == B:
print(i)
exit()
print((-1)) | A, B = list(map(int, input().split()))
for i in range(100000):
if (i * 8) // 100 == A and (i * 10) // 100 == B:
print(i)
exit()
print((-1))
| 8 | 8 | 158 | 161 | A, B = list(map(int, input().split()))
for i in range(1, 10**5):
if int(i * 0.08) == A and int(i * 0.1) == B:
print(i)
exit()
print((-1))
| A, B = list(map(int, input().split()))
for i in range(100000):
if (i * 8) // 100 == A and (i * 10) // 100 == B:
print(i)
exit()
print((-1))
| false | 0 | [
"-for i in range(1, 10**5):",
"- if int(i * 0.08) == A and int(i * 0.1) == B:",
"+for i in range(100000):",
"+ if (i * 8) // 100 == A and (i * 10) // 100 == B:"
] | false | 0.072661 | 0.044175 | 1.644845 | [
"s824090252",
"s541929971"
] |
u884323674 | p03171 | python | s157301461 | s035182995 | 510 | 398 | 112,604 | 111,836 | Accepted | Accepted | 21.96 | import sys
input = sys.stdin.readline
def func():
N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [[0] * (N+1) for i in range(N+1)]
if (N - 1) % 2 == 0:
fl = 1
else:
fl = -1
for i in range(N):
dp[i][i+1] = fl * A[i]
for s in range(2... | import sys
input = sys.stdin.readline
def func():
N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [[0] * (N+1) for i in range(N+1)]
for i in range(N):
dp[i][i+1] = A[i]
for s in range(2, N+1):
for l in range(N-s+1):
r = l + s
... | 26 | 19 | 624 | 433 | import sys
input = sys.stdin.readline
def func():
N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [[0] * (N + 1) for i in range(N + 1)]
if (N - 1) % 2 == 0:
fl = 1
else:
fl = -1
for i in range(N):
dp[i][i + 1] = fl * A[i]
for s in range(2, N + 1):... | import sys
input = sys.stdin.readline
def func():
N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [[0] * (N + 1) for i in range(N + 1)]
for i in range(N):
dp[i][i + 1] = A[i]
for s in range(2, N + 1):
for l in range(N - s + 1):
r = l + s
d... | false | 26.923077 | [
"- if (N - 1) % 2 == 0:",
"- fl = 1",
"- else:",
"- fl = -1",
"- dp[i][i + 1] = fl * A[i]",
"+ dp[i][i + 1] = A[i]",
"- if (N - s) % 2 == 0:",
"- dp[l][r] = max(dp[l + 1][r] + A[l], dp[l][r - 1] + A[r - 1])",
"- continue",
... | false | 0.035131 | 0.04373 | 0.803356 | [
"s157301461",
"s035182995"
] |
u163783894 | p03682 | python | s303472395 | s249992989 | 1,019 | 728 | 114,760 | 118,644 | Accepted | Accepted | 28.56 | import sys
input = sys.stdin.buffer.readline
in_n = lambda: int(eval(input()))
in_nn = lambda: list(map(int, input().split()))
in_s = lambda: input().rstrip().decode('utf-8')
in_map = lambda: [s == ord('.') for s in eval(input()) if s != ord('\n')]
MOD = 10**9 + 7
INF = 8 * 10**18
class UnionFind():
... | import sys
from heapq import heappush, heappop, heapify
input = sys.stdin.buffer.readline
in_n = lambda: int(eval(input()))
in_nn = lambda: list(map(int, input().split()))
in_s = lambda: input().rstrip().decode('utf-8')
in_map = lambda: [s == ord('.') for s in eval(input()) if s != ord('\n')]
MOD = 10**9 + 7... | 103 | 59 | 2,379 | 1,346 | import sys
input = sys.stdin.buffer.readline
in_n = lambda: int(eval(input()))
in_nn = lambda: list(map(int, input().split()))
in_s = lambda: input().rstrip().decode("utf-8")
in_map = lambda: [s == ord(".") for s in eval(input()) if s != ord("\n")]
MOD = 10**9 + 7
INF = 8 * 10**18
class UnionFind:
def __init__(s... | import sys
from heapq import heappush, heappop, heapify
input = sys.stdin.buffer.readline
in_n = lambda: int(eval(input()))
in_nn = lambda: list(map(int, input().split()))
in_s = lambda: input().rstrip().decode("utf-8")
in_map = lambda: [s == ord(".") for s in eval(input()) if s != ord("\n")]
MOD = 10**9 + 7
INF = 8 *... | false | 42.718447 | [
"+from heapq import heappush, heappop, heapify",
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.parents = [-1] * n",
"-",
"- def find(self, x):",
"- if self.parents[x] < 0:",
"- return x",
"- else:",
"- self.parent... | false | 0.041887 | 0.075084 | 0.557874 | [
"s303472395",
"s249992989"
] |
u489691149 | p02657 | python | s565407651 | s089963569 | 24 | 21 | 9,160 | 9,088 | Accepted | Accepted | 12.5 | a,b=list(map(int,input().split()))
print((a*b)) | a,b=input().split()
a=int(a)
b=int(float(b)*100)
print((int(a*b/100))) | 2 | 4 | 40 | 71 | a, b = list(map(int, input().split()))
print((a * b))
| a, b = input().split()
a = int(a)
b = int(float(b) * 100)
print((int(a * b / 100)))
| false | 50 | [
"-a, b = list(map(int, input().split()))",
"-print((a * b))",
"+a, b = input().split()",
"+a = int(a)",
"+b = int(float(b) * 100)",
"+print((int(a * b / 100)))"
] | false | 0.041609 | 0.097762 | 0.425619 | [
"s565407651",
"s089963569"
] |
u201928947 | p02561 | python | s264655172 | s442533299 | 347 | 287 | 18,148 | 88,276 | Accepted | Accepted | 17.29 | from collections import deque
class mf_graph:
def __init__(self,N):
self.N = N
self.graph = [[] for _ in range(N)]
def add_edge(self,v,w,cap):
edge = [w,cap,None]
edge[2] = rev_edge = [v,0,edge]
self.graph[v].append(edge)
self.graph[w].append(rev_... | # Dinic's algorithm
#https://tjkendev.github.io/procon-library/python/max_flow/dinic.htmlより
from collections import deque
class Dinic:
def __init__(self, N):
self.N = N
self.G = [[] for i in range(N)]
def add_edge(self, fr, to, cap):
forward = [to, cap, None]
forward[2... | 123 | 107 | 3,705 | 3,074 | from collections import deque
class mf_graph:
def __init__(self, N):
self.N = N
self.graph = [[] for _ in range(N)]
def add_edge(self, v, w, cap):
edge = [w, cap, None]
edge[2] = rev_edge = [v, 0, edge]
self.graph[v].append(edge)
self.graph[w].append(rev_edge)
... | # Dinic's algorithm
# https://tjkendev.github.io/procon-library/python/max_flow/dinic.htmlより
from collections import deque
class Dinic:
def __init__(self, N):
self.N = N
self.G = [[] for i in range(N)]
def add_edge(self, fr, to, cap):
forward = [to, cap, None]
forward[2] = bac... | false | 13.00813 | [
"+# Dinic's algorithm",
"+# https://tjkendev.github.io/procon-library/python/max_flow/dinic.htmlより",
"-class mf_graph:",
"+class Dinic:",
"- self.graph = [[] for _ in range(N)]",
"+ self.G = [[] for i in range(N)]",
"- def add_edge(self, v, w, cap):",
"- edge = [w, cap, None]",... | false | 0.040878 | 0.064363 | 0.635116 | [
"s264655172",
"s442533299"
] |
u937782958 | p03775 | python | s528000863 | s903178382 | 38 | 30 | 3,064 | 2,940 | Accepted | Accepted | 21.05 | N = int(eval(input()))
def check(a, b):
return max(len(str(a)), len(str(b)))
n = int(N ** (1/2))
#arr =[]
res = check(1, N)
i = 1
while i <= n:
if N % i == 0:
res = min(res, check(i,int(N / i)))
i += 1
print(res) | N = int(eval(input()))
n = int(N**.5)
res = len(str(N))
for i in range(2,n+1):
if N % i == 0:
#print(len(str(i)),len(str(N/i)))
f = max(len(str(i)),len(str(N//i)))
res = min(res, f)
# print(i, len(str(i)),len(str(N/i)),res, f)
print(res)
| 16 | 10 | 237 | 277 | N = int(eval(input()))
def check(a, b):
return max(len(str(a)), len(str(b)))
n = int(N ** (1 / 2))
# arr =[]
res = check(1, N)
i = 1
while i <= n:
if N % i == 0:
res = min(res, check(i, int(N / i)))
i += 1
print(res)
| N = int(eval(input()))
n = int(N**0.5)
res = len(str(N))
for i in range(2, n + 1):
if N % i == 0:
# print(len(str(i)),len(str(N/i)))
f = max(len(str(i)), len(str(N // i)))
res = min(res, f)
# print(i, len(str(i)),len(str(N/i)),res, f)
print(res)
| false | 37.5 | [
"-",
"-",
"-def check(a, b):",
"- return max(len(str(a)), len(str(b)))",
"-",
"-",
"-n = int(N ** (1 / 2))",
"-# arr =[]",
"-res = check(1, N)",
"-i = 1",
"-while i <= n:",
"+n = int(N**0.5)",
"+res = len(str(N))",
"+for i in range(2, n + 1):",
"- res = min(res, check(i, int(N ... | false | 0.112432 | 0.182981 | 0.614444 | [
"s528000863",
"s903178382"
] |
u133936772 | p02952 | python | s889031008 | s017198128 | 48 | 19 | 2,940 | 2,940 | Accepted | Accepted | 60.42 | print((sum(len(str(i+1))%2 for i in range(int(eval(input())))))) | n=eval(input());k=len(n)
print((sum(9*10**~-i for i in range(k) if i%2)-(10**~-k-int(n)-1)*(k%2))) | 1 | 2 | 56 | 91 | print((sum(len(str(i + 1)) % 2 for i in range(int(eval(input()))))))
| n = eval(input())
k = len(n)
print(
(sum(9 * 10 ** ~-i for i in range(k) if i % 2) - (10 ** ~-k - int(n) - 1) * (k % 2))
)
| false | 50 | [
"-print((sum(len(str(i + 1)) % 2 for i in range(int(eval(input()))))))",
"+n = eval(input())",
"+k = len(n)",
"+print(",
"+ (sum(9 * 10 ** ~-i for i in range(k) if i % 2) - (10 ** ~-k - int(n) - 1) * (k % 2))",
"+)"
] | false | 0.041505 | 0.045496 | 0.912282 | [
"s889031008",
"s017198128"
] |
u562577097 | p03163 | python | s618085729 | s697928695 | 718 | 542 | 111,208 | 113,052 | Accepted | Accepted | 24.51 | import sys
# import numpy as np
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))
# import profile
def solve():
n, w = read();
dp = [[0 for i in range(w+1)] for j in range(n)]
w_v_list = [read() for i in range(n)]
# for i in dp:print(*i)
# print("\n")
# print(w_v_list)
... | import sys
# import numpy as np
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))
# import profile
def solve():
n, w = read();
dp = [[0 for i in range(w+1)] for j in range(3)]
w_v_list = [read() for i in range(n)]
# for i in dp:print(*i)
# print("\n")
# print(w_v_list)
... | 29 | 31 | 661 | 730 | import sys
# import numpy as np
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))
# import profile
def solve():
n, w = read()
dp = [[0 for i in range(w + 1)] for j in range(n)]
w_v_list = [read() for i in range(n)]
# for i in dp:print(*i)
# print("\n")
# print(w_v_li... | import sys
# import numpy as np
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))
# import profile
def solve():
n, w = read()
dp = [[0 for i in range(w + 1)] for j in range(3)]
w_v_list = [read() for i in range(n)]
# for i in dp:print(*i)
# print("\n")
# print(w_v_li... | false | 6.451613 | [
"- dp = [[0 for i in range(w + 1)] for j in range(n)]",
"+ dp = [[0 for i in range(w + 1)] for j in range(3)]",
"- dp[i][j] = max(",
"- elem_v + dp[i - 1][j - elem_w], dp[i][j - 1], dp[i - 1][j]",
"+ dp[i % 3][j] = max(",
"+ elem_v ... | false | 0.04532 | 0.042719 | 1.060889 | [
"s618085729",
"s697928695"
] |
u254871849 | p02775 | python | s144809793 | s195701302 | 1,225 | 1,093 | 83,232 | 5,492 | Accepted | Accepted | 10.78 | import sys
n = sys.stdin.readline().rstrip()
l = len(n)
def main():
dp0 = [None] * (l + 1)
dp1 = [None] * (l + 1)
dp0[0] = 0
dp1[0] = 1
for i in range(l):
d = int(n[i])
dp0[i+1] = min(dp0[i]+d, dp1[i]+10-d)
dp1[i+1] = min(dp0[i]+d+1, dp1[i]+10-d-1)
... | import sys
n = sys.stdin.readline().rstrip()
def main():
dp = [0, 1]
for d in n:
d = int(d)
dp[0], dp[1] = min(dp[0]+d, dp[1]+10-d), min(dp[0]+d+1, dp[1]+10-d-1)
return dp[0]
if __name__ == '__main__':
ans = main()
print(ans) | 21 | 15 | 398 | 279 | import sys
n = sys.stdin.readline().rstrip()
l = len(n)
def main():
dp0 = [None] * (l + 1)
dp1 = [None] * (l + 1)
dp0[0] = 0
dp1[0] = 1
for i in range(l):
d = int(n[i])
dp0[i + 1] = min(dp0[i] + d, dp1[i] + 10 - d)
dp1[i + 1] = min(dp0[i] + d + 1, dp1[i] + 10 - d - 1)
... | import sys
n = sys.stdin.readline().rstrip()
def main():
dp = [0, 1]
for d in n:
d = int(d)
dp[0], dp[1] = min(dp[0] + d, dp[1] + 10 - d), min(
dp[0] + d + 1, dp[1] + 10 - d - 1
)
return dp[0]
if __name__ == "__main__":
ans = main()
print(ans)
| false | 28.571429 | [
"-l = len(n)",
"- dp0 = [None] * (l + 1)",
"- dp1 = [None] * (l + 1)",
"- dp0[0] = 0",
"- dp1[0] = 1",
"- for i in range(l):",
"- d = int(n[i])",
"- dp0[i + 1] = min(dp0[i] + d, dp1[i] + 10 - d)",
"- dp1[i + 1] = min(dp0[i] + d + 1, dp1[i] + 10 - d - 1)",
"- ... | false | 0.037128 | 0.059913 | 0.619695 | [
"s144809793",
"s195701302"
] |
u440566786 | p02720 | python | s658493579 | s312246700 | 184 | 89 | 40,688 | 91,052 | Accepted | Accepted | 51.63 | from collections import deque
k = int(eval(input()))
Q = deque()
for i in range(1, 10):
Q.append(i)
for _ in range(k-1):
a = Q.popleft()
d = a % 10
if d != 0:
Q.append(10 * a + d - 1)
Q.append(10 * a + d)
if d != 9:
Q.append(10 * a + d + 1)
print((Q.popleft())) | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
k = int(eval(input()))
queue = list(range(1, 10))
cnt = 0
for v in queue:
cnt += 1
if k == cnt:
print(v)
... | 16 | 19 | 290 | 462 | from collections import deque
k = int(eval(input()))
Q = deque()
for i in range(1, 10):
Q.append(i)
for _ in range(k - 1):
a = Q.popleft()
d = a % 10
if d != 0:
Q.append(10 * a + d - 1)
Q.append(10 * a + d)
if d != 9:
Q.append(10 * a + d + 1)
print((Q.popleft()))
| import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
k = int(eval(input()))
queue = list(range(1, 10))
cnt = 0
for v in queue:
cnt += 1
if k == cnt:
print(v)
return
... | false | 15.789474 | [
"-from collections import deque",
"+import sys",
"-k = int(eval(input()))",
"-Q = deque()",
"-for i in range(1, 10):",
"- Q.append(i)",
"-for _ in range(k - 1):",
"- a = Q.popleft()",
"- d = a % 10",
"- if d != 0:",
"- Q.append(10 * a + d - 1)",
"- Q.append(10 * a + d)",
... | false | 0.07516 | 0.117613 | 0.639041 | [
"s658493579",
"s312246700"
] |
u523087093 | p02861 | python | s371444445 | s164820796 | 257 | 28 | 9,436 | 9,452 | Accepted | Accepted | 89.11 | import itertools
N = int(eval(input()))
dots = [tuple(map(int, input().split())) for _ in range(N)]
total_distance = 0
total_count = 0
for route in itertools.permutations(dots):
for i in range(len(route)-1):
x1, y1 = route[i]
x2, y2 = route[i+1]
total_distance += ((x2 - x1)**2... | # import math
N = int(eval(input()))
towns = [tuple(map(int, input().split())) for _ in range(N)]
total_distance = 0
count = 0
for start in range(N-1):
for end in range(start+1, N):
start_x, start_y = towns[start]
end_x, end_y = towns[end]
total_distance += ((end_x - start_x)*... | 20 | 20 | 418 | 524 | import itertools
N = int(eval(input()))
dots = [tuple(map(int, input().split())) for _ in range(N)]
total_distance = 0
total_count = 0
for route in itertools.permutations(dots):
for i in range(len(route) - 1):
x1, y1 = route[i]
x2, y2 = route[i + 1]
total_distance += ((x2 - x1) ** 2 + (y2 -... | # import math
N = int(eval(input()))
towns = [tuple(map(int, input().split())) for _ in range(N)]
total_distance = 0
count = 0
for start in range(N - 1):
for end in range(start + 1, N):
start_x, start_y = towns[start]
end_x, end_y = towns[end]
total_distance += ((end_x - start_x) ** 2 + (end... | false | 0 | [
"-import itertools",
"-",
"+# import math",
"-dots = [tuple(map(int, input().split())) for _ in range(N)]",
"+towns = [tuple(map(int, input().split())) for _ in range(N)]",
"-total_count = 0",
"-for route in itertools.permutations(dots):",
"- for i in range(len(route) - 1):",
"- x1, y1 = r... | false | 0.069966 | 0.039847 | 1.755882 | [
"s371444445",
"s164820796"
] |
u127499732 | p03128 | python | s897375649 | s706073696 | 51 | 40 | 3,692 | 3,692 | Accepted | Accepted | 21.57 | def main():
n, m, *a = list(map(int, open(0).read().split()))
t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
a.sort(reverse=True)
dp = [-float('Inf')] * (n + 10)
dp[0] = 0
for i in range(2, n + 1):
for j in a:
dp[i] = max(dp[i], dp[i - t[j]] + 1)
... | def main():
n, m, *a = list(map(int, open(0).read().split()))
t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
a.sort(reverse=True)
b = [t[i] for i in a]
dp = [-float('Inf')] * (n + 10)
dp[0] = 0
for i in range(2, n + 1):
dp[i] = max(dp[i - j] + 1 for j in b)
... | 25 | 24 | 598 | 599 | def main():
n, m, *a = list(map(int, open(0).read().split()))
t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
a.sort(reverse=True)
dp = [-float("Inf")] * (n + 10)
dp[0] = 0
for i in range(2, n + 1):
for j in a:
dp[i] = max(dp[i], dp[i - t[j]] + 1)
nums = []
... | def main():
n, m, *a = list(map(int, open(0).read().split()))
t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
a.sort(reverse=True)
b = [t[i] for i in a]
dp = [-float("Inf")] * (n + 10)
dp[0] = 0
for i in range(2, n + 1):
dp[i] = max(dp[i - j] + 1 for j in b)
nums = []
... | false | 4 | [
"+ b = [t[i] for i in a]",
"- for j in a:",
"- dp[i] = max(dp[i], dp[i - t[j]] + 1)",
"+ dp[i] = max(dp[i - j] + 1 for j in b)"
] | false | 0.043546 | 0.096745 | 0.450111 | [
"s897375649",
"s706073696"
] |
u600402037 | p02713 | python | s000204615 | s992820344 | 1,953 | 452 | 9,192 | 57,432 | Accepted | Accepted | 76.86 | # coding: utf-8
import sys
from math import gcd
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
answer = 0
for a in range(1, K+1):
for b in range(1, K+1):
for c in range(1, K+1):
answer += gcd(a, gcd(b, c))
pr... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
A = np.arange(1, K+1, dtype=np.int32)
B = np.gcd.outer(np.gcd.outer(A, A), A)
answer = B.sum()
print(answer)
| 16 | 13 | 332 | 286 | # coding: utf-8
import sys
from math import gcd
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
answer = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
answer += gcd(a, gcd(b, c))
print(answer)... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
A = np.arange(1, K + 1, dtype=np.int32)
B = np.gcd.outer(np.gcd.outer(A, A), A)
answer = B.sum()
print(answer)
| false | 18.75 | [
"-from math import gcd",
"+import numpy as np",
"-answer = 0",
"-for a in range(1, K + 1):",
"- for b in range(1, K + 1):",
"- for c in range(1, K + 1):",
"- answer += gcd(a, gcd(b, c))",
"+A = np.arange(1, K + 1, dtype=np.int32)",
"+B = np.gcd.outer(np.gcd.outer(A, A), A)",
"... | false | 0.073848 | 0.256847 | 0.287518 | [
"s000204615",
"s992820344"
] |
u162612857 | p02609 | python | s154466852 | s073110322 | 778 | 425 | 26,848 | 26,848 | Accepted | Accepted | 45.37 | n = int(eval(input()))
x = eval(input())
f = [-1] * (n+10)
f[0] = 0
for i in range(1, n+10):
# python bitcount で見つけたこれを参考に https://ameblo.jp/316228/entry-10518720149.html
f[i] = f[i % bin(i).count('1')] + 1
init_bitcount = x.count('1')
# Xを init_bitcount+1とinit_bitcount-1で割った余り
x_mod_01 = 0
x_... | n = int(eval(input()))
x = eval(input())
f = [-1] * (n+10)
f[0] = 0
for i in range(1, n+10):
# python bitcount で見つけたこれを参考に https://ameblo.jp/316228/entry-10518720149.html
f[i] = f[i % bin(i).count('1')] + 1
init_bitcount = x.count('1')
# Xを init_bitcount+1とinit_bitcount-1で割った余り
x_mod_01 = 0
fo... | 51 | 60 | 1,322 | 1,660 | n = int(eval(input()))
x = eval(input())
f = [-1] * (n + 10)
f[0] = 0
for i in range(1, n + 10):
# python bitcount で見つけたこれを参考に https://ameblo.jp/316228/entry-10518720149.html
f[i] = f[i % bin(i).count("1")] + 1
init_bitcount = x.count("1")
# Xを init_bitcount+1とinit_bitcount-1で割った余り
x_mod_01 = 0
x_mod_10 = 0
for... | n = int(eval(input()))
x = eval(input())
f = [-1] * (n + 10)
f[0] = 0
for i in range(1, n + 10):
# python bitcount で見つけたこれを参考に https://ameblo.jp/316228/entry-10518720149.html
f[i] = f[i % bin(i).count("1")] + 1
init_bitcount = x.count("1")
# Xを init_bitcount+1とinit_bitcount-1で割った余り
x_mod_01 = 0
for digit in x:
... | false | 15 | [
"-x_mod_10 = 0",
"- x_mod_10 *= 2",
"- x_mod_10 += 1",
"- if init_bitcount != 1:",
"+if init_bitcount != 1:",
"+ x_mod_10 = 0",
"+ for digit in x:",
"+ x_mod_10 *= 2",
"+ if digit == \"1\":",
"+ x_mod_10 += 1",
"+ # 立っているビットの数は0桁、つまりX_i = 0な... | false | 0.052738 | 0.080897 | 0.651911 | [
"s154466852",
"s073110322"
] |
u365364616 | p02952 | python | s856000500 | s492318673 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
n = int(s)
m = len(s)
ans = 0
i = 1
while(True):
if i == m:
ans += n - 10 ** (i - 1) + 1
break
elif i > m:
break
ans += 10 ** i - 10 ** (i - 1)
i += 2
print(ans)
| s = eval(input())
n = int(s)
m = len(s)
ans = 0
i = 1
while(True):
if i == m:
ans += n - 10 ** (i - 1) + 1
break
elif i > m:
break
ans += 9 * 10 ** (i - 1)
i += 2
print(ans)
| 14 | 14 | 227 | 221 | s = eval(input())
n = int(s)
m = len(s)
ans = 0
i = 1
while True:
if i == m:
ans += n - 10 ** (i - 1) + 1
break
elif i > m:
break
ans += 10**i - 10 ** (i - 1)
i += 2
print(ans)
| s = eval(input())
n = int(s)
m = len(s)
ans = 0
i = 1
while True:
if i == m:
ans += n - 10 ** (i - 1) + 1
break
elif i > m:
break
ans += 9 * 10 ** (i - 1)
i += 2
print(ans)
| false | 0 | [
"- ans += 10**i - 10 ** (i - 1)",
"+ ans += 9 * 10 ** (i - 1)"
] | false | 0.048515 | 0.0495 | 0.980103 | [
"s856000500",
"s492318673"
] |
u488401358 | p02756 | python | s877952477 | s339649885 | 932 | 160 | 81,112 | 100,332 | Accepted | Accepted | 82.83 | S=eval(input())
Q=int(eval(input()))
x=0
A=[]
B=[]
for i in range(0,Q):
query=list(input().split())
if query[0]=='1':
x+=1
else:
if query[1]=='1':
if x%2==1:
B.append(query[2])
else:
A.append(query[2])
else:
... | from collections import deque
import sys
input=sys.stdin.readline
S=input().rstrip()
string = deque([S[i] for i in range(len(S))])
reverse = False
for _ in range(int(eval(input()))):
q = input().rstrip().split()
if q[0] == "1":
reverse = not reverse
else:
if q[1] == ... | 33 | 36 | 708 | 673 | S = eval(input())
Q = int(eval(input()))
x = 0
A = []
B = []
for i in range(0, Q):
query = list(input().split())
if query[0] == "1":
x += 1
else:
if query[1] == "1":
if x % 2 == 1:
B.append(query[2])
else:
A.append(query[2])
els... | from collections import deque
import sys
input = sys.stdin.readline
S = input().rstrip()
string = deque([S[i] for i in range(len(S))])
reverse = False
for _ in range(int(eval(input()))):
q = input().rstrip().split()
if q[0] == "1":
reverse = not reverse
else:
if q[1] == "1":
if ... | false | 8.333333 | [
"-S = eval(input())",
"-Q = int(eval(input()))",
"-x = 0",
"-A = []",
"-B = []",
"-for i in range(0, Q):",
"- query = list(input().split())",
"- if query[0] == \"1\":",
"- x += 1",
"+from collections import deque",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+S = input... | false | 0.07702 | 0.074636 | 1.031943 | [
"s877952477",
"s339649885"
] |
u255555420 | p03644 | python | s158200487 | s705552425 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | N=int(eval(input()))
if N==1:
print((1))
elif 2<=N<=3:
print((2))
elif 4<=N<=7:
print((4))
elif 8<=N<=15:
print((8))
elif 16<=N<=31:
print((16))
elif 32<=N<=63:
print((32))
elif 64<=N<=100:
print((64)) | N=int(eval(input()))
C=0
L=[]
if N==1:
print((1))
else:
for i in range(8):
C=2**i
L.append(C)
if C>N:
print((L[-2]))
break | 16 | 15 | 225 | 186 | N = int(eval(input()))
if N == 1:
print((1))
elif 2 <= N <= 3:
print((2))
elif 4 <= N <= 7:
print((4))
elif 8 <= N <= 15:
print((8))
elif 16 <= N <= 31:
print((16))
elif 32 <= N <= 63:
print((32))
elif 64 <= N <= 100:
print((64))
| N = int(eval(input()))
C = 0
L = []
if N == 1:
print((1))
else:
for i in range(8):
C = 2**i
L.append(C)
if C > N:
print((L[-2]))
break
| false | 6.25 | [
"+C = 0",
"+L = []",
"-elif 2 <= N <= 3:",
"- print((2))",
"-elif 4 <= N <= 7:",
"- print((4))",
"-elif 8 <= N <= 15:",
"- print((8))",
"-elif 16 <= N <= 31:",
"- print((16))",
"-elif 32 <= N <= 63:",
"- print((32))",
"-elif 64 <= N <= 100:",
"- print((64))",
"+else:",
... | false | 0.037079 | 0.03602 | 1.029413 | [
"s158200487",
"s705552425"
] |
u438662618 | p03435 | python | s992591340 | s287067159 | 21 | 17 | 3,064 | 3,064 | Accepted | Accepted | 19.05 | c = [list(map(int, input().split())) for i in range(3) ]
ans = False
for i in range(101) :
a1 = 0
b1 = c[0][0]
b2 = c[0][1]
b3 = c[0][2]
a2 = c[1][0] - b1
a3 = c[2][0] - b1
a = []
a.append(a1)
a.append(a2)
a.append(a3)
if a2 + b2 != c[1][1] :
continu... | c = [list(map(int, input().split())) for i in range(3) ]
ans = True
X = 0
b = [c[i][0] - X for i in range(3)]
a = [c[0][i] - b[0] for i in range(3)]
for i in range(3) :
for j in range(3) :
if a[j] + b[i] != c[i][j] :
ans = False
if ans :
print('Yes')
else :
print('No'... | 30 | 17 | 551 | 322 | c = [list(map(int, input().split())) for i in range(3)]
ans = False
for i in range(101):
a1 = 0
b1 = c[0][0]
b2 = c[0][1]
b3 = c[0][2]
a2 = c[1][0] - b1
a3 = c[2][0] - b1
a = []
a.append(a1)
a.append(a2)
a.append(a3)
if a2 + b2 != c[1][1]:
continue
elif a3 + b2 !=... | c = [list(map(int, input().split())) for i in range(3)]
ans = True
X = 0
b = [c[i][0] - X for i in range(3)]
a = [c[0][i] - b[0] for i in range(3)]
for i in range(3):
for j in range(3):
if a[j] + b[i] != c[i][j]:
ans = False
if ans:
print("Yes")
else:
print("No")
| false | 43.333333 | [
"-ans = False",
"-for i in range(101):",
"- a1 = 0",
"- b1 = c[0][0]",
"- b2 = c[0][1]",
"- b3 = c[0][2]",
"- a2 = c[1][0] - b1",
"- a3 = c[2][0] - b1",
"- a = []",
"- a.append(a1)",
"- a.append(a2)",
"- a.append(a3)",
"- if a2 + b2 != c[1][1]:",
"- ... | false | 0.037743 | 0.073742 | 0.511824 | [
"s992591340",
"s287067159"
] |
u094191970 | p02994 | python | s241381281 | s398551768 | 20 | 17 | 3,064 | 3,060 | Accepted | Accepted | 15 | n, l = list(map(int, input().split()))
sa = 1000
sum = 0
for i in range(1,n+1):
if sa != min(abs(l+i-1), sa):
sa = min(abs(l+i-1), sa)
app = l+i-1
sum += l+i-1
print((sum-app)) | n,l=list(map(int,input().split()))
ans=0
min_a=10**9
for i in range(n):
ans+=l+i
if abs(min_a)>abs(l+i):
min_a=l+i
print((ans-min_a)) | 10 | 9 | 202 | 142 | n, l = list(map(int, input().split()))
sa = 1000
sum = 0
for i in range(1, n + 1):
if sa != min(abs(l + i - 1), sa):
sa = min(abs(l + i - 1), sa)
app = l + i - 1
sum += l + i - 1
print((sum - app))
| n, l = list(map(int, input().split()))
ans = 0
min_a = 10**9
for i in range(n):
ans += l + i
if abs(min_a) > abs(l + i):
min_a = l + i
print((ans - min_a))
| false | 10 | [
"-sa = 1000",
"-sum = 0",
"-for i in range(1, n + 1):",
"- if sa != min(abs(l + i - 1), sa):",
"- sa = min(abs(l + i - 1), sa)",
"- app = l + i - 1",
"- sum += l + i - 1",
"-print((sum - app))",
"+ans = 0",
"+min_a = 10**9",
"+for i in range(n):",
"+ ans += l + i",
"+ ... | false | 0.057214 | 0.057888 | 0.98836 | [
"s241381281",
"s398551768"
] |
u411203878 | p03150 | python | s903850944 | s770999288 | 188 | 63 | 38,512 | 63,844 | Accepted | Accepted | 66.49 | s=eval(input())
if s == 'keyence':
print('YES')
exit()
else:
for i in range(len(s)):
for j in range(i,len(s)):
if s[:i]+s[j:] == 'keyence':
print('YES')
exit()
print('NO') | S = eval(input())
for i in range(len(S)-1):
for j in range(i,len(S)):
memo = S[:i]+S[j:]
#print(memo)
if memo == 'keyence':
print('YES')
exit()
print('NO') | 12 | 10 | 245 | 211 | s = eval(input())
if s == "keyence":
print("YES")
exit()
else:
for i in range(len(s)):
for j in range(i, len(s)):
if s[:i] + s[j:] == "keyence":
print("YES")
exit()
print("NO")
| S = eval(input())
for i in range(len(S) - 1):
for j in range(i, len(S)):
memo = S[:i] + S[j:]
# print(memo)
if memo == "keyence":
print("YES")
exit()
print("NO")
| false | 16.666667 | [
"-s = eval(input())",
"-if s == \"keyence\":",
"- print(\"YES\")",
"- exit()",
"-else:",
"- for i in range(len(s)):",
"- for j in range(i, len(s)):",
"- if s[:i] + s[j:] == \"keyence\":",
"- print(\"YES\")",
"- exit()",
"- print(\"NO\")... | false | 0.126275 | 0.03834 | 3.293531 | [
"s903850944",
"s770999288"
] |
u622523700 | p03001 | python | s037610455 | s552464652 | 202 | 162 | 38,256 | 38,256 | Accepted | Accepted | 19.8 | w, h, x, y = list(map(int, input().split()))
ans = []
ans.append(w * h / 2)
if w == x * 2 and h == y * 2:
ans.append(1)
else:
ans.append(0)
print((" ".join(map(str, ans)))) | w, h, x, y = list(map(int, input().split()))
ans = []
ans.append(w * h / 2)
if w / 2 == x and h / 2 == y:
ans.append(1)
else:
ans.append(0)
print((" ".join(map(str, ans))))
| 8 | 8 | 179 | 180 | w, h, x, y = list(map(int, input().split()))
ans = []
ans.append(w * h / 2)
if w == x * 2 and h == y * 2:
ans.append(1)
else:
ans.append(0)
print((" ".join(map(str, ans))))
| w, h, x, y = list(map(int, input().split()))
ans = []
ans.append(w * h / 2)
if w / 2 == x and h / 2 == y:
ans.append(1)
else:
ans.append(0)
print((" ".join(map(str, ans))))
| false | 0 | [
"-if w == x * 2 and h == y * 2:",
"+if w / 2 == x and h / 2 == y:"
] | false | 0.041916 | 0.047644 | 0.879787 | [
"s037610455",
"s552464652"
] |
u535171899 | p03147 | python | s476221968 | s722119319 | 23 | 21 | 9,212 | 3,064 | Accepted | Accepted | 8.7 | n = int(eval(input()))
h_input = list(map(int,input().split()))
ans=0
for i in range(max(h_input)):
x = h_input[:]
for j in range(n):
if j==0 and x[0]!=0:#左端
ans+=1
h_input[j]-=1
if j!=0:
if x[j-1]==0 and x[j]!=0:#探索の左が0でかつ自身が0になっていない解き
... | n = int(eval(input()))
H = list(map(int,input().split()))
ans = 0
tmp = 0
max_h = max(H)
for i in range(max_h,0,-1):
H_c = H.copy()
if H[0]==i:
ans+=1
H_c[0]-=1
for j in range(1,n):
if H[j]==i:
if H[j-1]!=H[j]:
ans+=1
H_c[j]... | 17 | 20 | 396 | 388 | n = int(eval(input()))
h_input = list(map(int, input().split()))
ans = 0
for i in range(max(h_input)):
x = h_input[:]
for j in range(n):
if j == 0 and x[0] != 0: # 左端
ans += 1
h_input[j] -= 1
if j != 0:
if x[j - 1] == 0 and x[j] != 0: # 探索の左が0でかつ自身が0になっていない解... | n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
tmp = 0
max_h = max(H)
for i in range(max_h, 0, -1):
H_c = H.copy()
if H[0] == i:
ans += 1
H_c[0] -= 1
for j in range(1, n):
if H[j] == i:
if H[j - 1] != H[j]:
ans += 1
H_c[... | false | 15 | [
"-h_input = list(map(int, input().split()))",
"+H = list(map(int, input().split()))",
"-for i in range(max(h_input)):",
"- x = h_input[:]",
"- for j in range(n):",
"- if j == 0 and x[0] != 0: # 左端",
"- ans += 1",
"- h_input[j] -= 1",
"- if j != 0:",
"- ... | false | 0.043058 | 0.139801 | 0.307992 | [
"s476221968",
"s722119319"
] |
u781535828 | p02707 | python | s715063383 | s455419348 | 274 | 242 | 50,552 | 50,700 | Accepted | Accepted | 11.68 | n = int(eval(input()))
a = input().split()
joshi = {}
for i in range(1, n+1):
joshi[str(i)] = 0
for i in range(n-1):
joshi[a[i]] += 1
for key in list(joshi.keys()):
print((joshi[key])) | n = int(eval(input()))
a = input().split()
joshi = {}
for i in range(1, n+1):
joshi[str(i)] = 0
for i in range(n-1):
joshi[a[i]] += 1
for ans in list(joshi.values()):
print(ans) | 13 | 13 | 198 | 197 | n = int(eval(input()))
a = input().split()
joshi = {}
for i in range(1, n + 1):
joshi[str(i)] = 0
for i in range(n - 1):
joshi[a[i]] += 1
for key in list(joshi.keys()):
print((joshi[key]))
| n = int(eval(input()))
a = input().split()
joshi = {}
for i in range(1, n + 1):
joshi[str(i)] = 0
for i in range(n - 1):
joshi[a[i]] += 1
for ans in list(joshi.values()):
print(ans)
| false | 0 | [
"-for key in list(joshi.keys()):",
"- print((joshi[key]))",
"+for ans in list(joshi.values()):",
"+ print(ans)"
] | false | 0.049742 | 0.045749 | 1.087282 | [
"s715063383",
"s455419348"
] |
u905203728 | p03339 | python | s610393733 | s765033780 | 196 | 169 | 42,612 | 3,676 | Accepted | Accepted | 13.78 | n=int(eval(input()))
s=eval(input())
p=s[1:].count("E")
ans=p
for i in range(1,n):
if s[i]=="E":p -=1
if s[i-1]=="W":p +=1
ans=min(ans,p)
print(ans) | n=int(eval(input()))
s=eval(input())
num=s.count("E")
length=len(s)
ans=num
for i in range(length):
if s[i]=="W":num +=1
elif s[i]=="E":num -=1
ans=min(ans,num)
print(ans) | 9 | 12 | 156 | 184 | n = int(eval(input()))
s = eval(input())
p = s[1:].count("E")
ans = p
for i in range(1, n):
if s[i] == "E":
p -= 1
if s[i - 1] == "W":
p += 1
ans = min(ans, p)
print(ans)
| n = int(eval(input()))
s = eval(input())
num = s.count("E")
length = len(s)
ans = num
for i in range(length):
if s[i] == "W":
num += 1
elif s[i] == "E":
num -= 1
ans = min(ans, num)
print(ans)
| false | 25 | [
"-p = s[1:].count(\"E\")",
"-ans = p",
"-for i in range(1, n):",
"- if s[i] == \"E\":",
"- p -= 1",
"- if s[i - 1] == \"W\":",
"- p += 1",
"- ans = min(ans, p)",
"+num = s.count(\"E\")",
"+length = len(s)",
"+ans = num",
"+for i in range(length):",
"+ if s[i] == \"W... | false | 0.046235 | 0.039054 | 1.183866 | [
"s610393733",
"s765033780"
] |
u492049124 | p03475 | python | s470539869 | s728874969 | 89 | 82 | 3,188 | 3,188 | Accepted | Accepted | 7.87 | N = int(eval(input()))
Nminus1 = N - 1
# lines = []
C = [0 for _ in range(Nminus1)]
S = [0 for _ in range(Nminus1)]
F = [0 for _ in range(Nminus1)]
for i in range(Nminus1):
c, s, f = input().split()
C[i] = int(c)
S[i] = int(s)
F[i] = int(f)
# for line in lines:
# c, s, f = line.s... | N = int(eval(input()))
Nminus1 = N - 1
# lines = []
CSF = [0 for _ in range(Nminus1)]
# S = [0 for _ in range(Nminus1)]
# F = [0 for _ in range(Nminus1)]
for i in range(Nminus1):
c, s, f = input().split()
CSF[i] = (int(c), int(s), int(f))
# C[i] = int(c)
# S[i] = int(s)
# F[i] = int(f... | 33 | 34 | 671 | 716 | N = int(eval(input()))
Nminus1 = N - 1
# lines = []
C = [0 for _ in range(Nminus1)]
S = [0 for _ in range(Nminus1)]
F = [0 for _ in range(Nminus1)]
for i in range(Nminus1):
c, s, f = input().split()
C[i] = int(c)
S[i] = int(s)
F[i] = int(f)
# for line in lines:
# c, s, f = line.split()
# C.appen... | N = int(eval(input()))
Nminus1 = N - 1
# lines = []
CSF = [0 for _ in range(Nminus1)]
# S = [0 for _ in range(Nminus1)]
# F = [0 for _ in range(Nminus1)]
for i in range(Nminus1):
c, s, f = input().split()
CSF[i] = (int(c), int(s), int(f))
# C[i] = int(c)
# S[i] = int(s)
# F[i] = int(f)
# for line in... | false | 2.941176 | [
"-C = [0 for _ in range(Nminus1)]",
"-S = [0 for _ in range(Nminus1)]",
"-F = [0 for _ in range(Nminus1)]",
"+CSF = [0 for _ in range(Nminus1)]",
"+# S = [0 for _ in range(Nminus1)]",
"+# F = [0 for _ in range(Nminus1)]",
"- C[i] = int(c)",
"- S[i] = int(s)",
"- F[i] = int(f)",
"+ CSF[... | false | 0.043902 | 0.043643 | 1.005927 | [
"s470539869",
"s728874969"
] |
u796942881 | p03854 | python | s359246839 | s585568722 | 70 | 28 | 3,188 | 3,188 | Accepted | Accepted | 60 | dreamer = "dreamer"
eraser = "eraser"
dream = "dream"
erase = "erase"
def main():
S = eval(input())
while len(S):
lens = len(S)
if S[-len(dreamer) :] == dreamer:
S = S[: -len(dreamer)]
if S[-len(eraser) :] == eraser:
S = S[: -len(eraser)]
... | dreamer = "dreamer"
eraser = "eraser"
dream = "dream"
erase = "erase"
def main():
S = eval(input())
i = len(S)
while 0 < i:
pre = i
if S[i - len(dreamer):i] == dreamer:
i -= len(dreamer)
if S[i - len(eraser):i] == eraser:
i -= len(eraser)
... | 27 | 27 | 567 | 560 | dreamer = "dreamer"
eraser = "eraser"
dream = "dream"
erase = "erase"
def main():
S = eval(input())
while len(S):
lens = len(S)
if S[-len(dreamer) :] == dreamer:
S = S[: -len(dreamer)]
if S[-len(eraser) :] == eraser:
S = S[: -len(eraser)]
if S[-len(dream... | dreamer = "dreamer"
eraser = "eraser"
dream = "dream"
erase = "erase"
def main():
S = eval(input())
i = len(S)
while 0 < i:
pre = i
if S[i - len(dreamer) : i] == dreamer:
i -= len(dreamer)
if S[i - len(eraser) : i] == eraser:
i -= len(eraser)
if S[i ... | false | 0 | [
"- while len(S):",
"- lens = len(S)",
"- if S[-len(dreamer) :] == dreamer:",
"- S = S[: -len(dreamer)]",
"- if S[-len(eraser) :] == eraser:",
"- S = S[: -len(eraser)]",
"- if S[-len(dream) :] == dream:",
"- S = S[: -len(dream)]",
"- ... | false | 0.15864 | 0.033013 | 4.805359 | [
"s359246839",
"s585568722"
] |
u461833298 | p02695 | python | s938398239 | s464993953 | 1,054 | 605 | 9,204 | 9,144 | Accepted | Accepted | 42.6 | import itertools
N, M, Q = list(map(int, input().split()))
P = [[int(x) for x in input().split()] for _ in range(Q)]
li = [x for x in range(1, M+1)]
Com = itertools.combinations_with_replacement(li, N)
ans=0
for com in Com:
reg=0
for a,b,c,d in P:
if com[b-1] - com[a-1] == c:
r... | N, M, Q = list(map(int, input().split()))
ABCD = [[int(x) for x in input().split()] for _ in range(Q)]
def dfs(A):
if len(A)==N:
return calc(A)
res = 0
s = A[-1] if len(A)>0 else 1
for i in range(s, M+1):
A.append(i)
res = max(res, dfs(A))
A.pop()
... | 15 | 27 | 358 | 503 | import itertools
N, M, Q = list(map(int, input().split()))
P = [[int(x) for x in input().split()] for _ in range(Q)]
li = [x for x in range(1, M + 1)]
Com = itertools.combinations_with_replacement(li, N)
ans = 0
for com in Com:
reg = 0
for a, b, c, d in P:
if com[b - 1] - com[a - 1] == c:
r... | N, M, Q = list(map(int, input().split()))
ABCD = [[int(x) for x in input().split()] for _ in range(Q)]
def dfs(A):
if len(A) == N:
return calc(A)
res = 0
s = A[-1] if len(A) > 0 else 1
for i in range(s, M + 1):
A.append(i)
res = max(res, dfs(A))
A.pop()
return res
... | false | 44.444444 | [
"-import itertools",
"+N, M, Q = list(map(int, input().split()))",
"+ABCD = [[int(x) for x in input().split()] for _ in range(Q)]",
"-N, M, Q = list(map(int, input().split()))",
"-P = [[int(x) for x in input().split()] for _ in range(Q)]",
"-li = [x for x in range(1, M + 1)]",
"-Com = itertools.combinat... | false | 0.061332 | 0.076758 | 0.799037 | [
"s938398239",
"s464993953"
] |
u291766461 | p03845 | python | s875283650 | s869255049 | 175 | 18 | 38,256 | 3,064 | Accepted | Accepted | 89.71 | N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
P, X = [], []
for i in range(M):
p, x = list(map(int, input().split()))
P.append(p)
X.append(x)
total_time = sum(T)
abs_diff = 0
for i in range(M):
index = P[i] - 1
tmp_diff = X[i] - T[index]
print((... | N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
P, X = [], []
for i in range(M):
p, x = list(map(int, input().split()))
P.append(p)
X.append(x)
total_time = sum(T)
for i in range(M):
index = P[i] - 1
tmp_diff = X[i] - T[index]
print((total_time + t... | 15 | 14 | 323 | 309 | N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
P, X = [], []
for i in range(M):
p, x = list(map(int, input().split()))
P.append(p)
X.append(x)
total_time = sum(T)
abs_diff = 0
for i in range(M):
index = P[i] - 1
tmp_diff = X[i] - T[index]
print((total_time + tm... | N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
P, X = [], []
for i in range(M):
p, x = list(map(int, input().split()))
P.append(p)
X.append(x)
total_time = sum(T)
for i in range(M):
index = P[i] - 1
tmp_diff = X[i] - T[index]
print((total_time + tmp_diff))
| false | 6.666667 | [
"-abs_diff = 0"
] | false | 0.131485 | 0.037453 | 3.51067 | [
"s875283650",
"s869255049"
] |
u761320129 | p02991 | python | s544101834 | s309121406 | 614 | 411 | 70,468 | 74,656 | Accepted | Accepted | 33.06 | from collections import deque
import sys
inputs = sys.stdin.readline
N,M = list(map(int,input().split()))
UV = [tuple([int(x)-1 for x in inputs().split()]) for i in range(M)]
S,T = [int(x)-1 for x in input().split()]
es = [[] for i in range(3*N)]
for u,v in UV:
es[u].append(v+N)
es[u+N].append(v+2*N)... | import sys
input = sys.stdin.readline
N,M = list(map(int,input().split()))
UV = [tuple(map(int,input().split())) for i in range(M)]
S,T = list(map(int,input().split()))
S,T = S-1,T-1
es = [[] for _ in range(N*3)]
for u,v in UV:
u,v = u-1,v-1
es[u].append(v+N)
es[u+N].append(v+N+N)
es[u+N+N]... | 28 | 29 | 649 | 655 | from collections import deque
import sys
inputs = sys.stdin.readline
N, M = list(map(int, input().split()))
UV = [tuple([int(x) - 1 for x in inputs().split()]) for i in range(M)]
S, T = [int(x) - 1 for x in input().split()]
es = [[] for i in range(3 * N)]
for u, v in UV:
es[u].append(v + N)
es[u + N].append(v ... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
UV = [tuple(map(int, input().split())) for i in range(M)]
S, T = list(map(int, input().split()))
S, T = S - 1, T - 1
es = [[] for _ in range(N * 3)]
for u, v in UV:
u, v = u - 1, v - 1
es[u].append(v + N)
es[u + N].append(v + N + ... | false | 3.448276 | [
"-from collections import deque",
"-inputs = sys.stdin.readline",
"+input = sys.stdin.readline",
"-UV = [tuple([int(x) - 1 for x in inputs().split()]) for i in range(M)]",
"-S, T = [int(x) - 1 for x in input().split()]",
"-es = [[] for i in range(3 * N)]",
"+UV = [tuple(map(int, input().split())) for i ... | false | 0.046226 | 0.046096 | 1.002811 | [
"s544101834",
"s309121406"
] |
u522506260 | p02947 | python | s720585015 | s402343238 | 1,307 | 434 | 19,300 | 17,808 | Accepted | Accepted | 66.79 | alphabet = "abcdefghijklmnopqrstuvwxyz"
n = int(eval(input()))
res = dict()
for _ in range(n):
s = str(eval(input()))
freqency = [0 for _ in alphabet]
for __ in s:
freqency[alphabet.index(__)] += 1
freq = "".join([str(___) for ___ in freqency])
if freq not in res:
res[f... | alphabet = "abcdefghijklmnopqrstuvwxyz"
n = int(eval(input()))
res = dict()
ans = 0
for _ in range(n):
s = str(eval(input()))
s = "".join(sorted(s))
if s not in list(res.keys()):
res[s] = 1
else:
ans += res[s]
res[s] += 1
print(ans)
| 21 | 16 | 443 | 272 | alphabet = "abcdefghijklmnopqrstuvwxyz"
n = int(eval(input()))
res = dict()
for _ in range(n):
s = str(eval(input()))
freqency = [0 for _ in alphabet]
for __ in s:
freqency[alphabet.index(__)] += 1
freq = "".join([str(___) for ___ in freqency])
if freq not in res:
res[freq] = 1
e... | alphabet = "abcdefghijklmnopqrstuvwxyz"
n = int(eval(input()))
res = dict()
ans = 0
for _ in range(n):
s = str(eval(input()))
s = "".join(sorted(s))
if s not in list(res.keys()):
res[s] = 1
else:
ans += res[s]
res[s] += 1
print(ans)
| false | 23.809524 | [
"+ans = 0",
"- freqency = [0 for _ in alphabet]",
"- for __ in s:",
"- freqency[alphabet.index(__)] += 1",
"- freq = \"\".join([str(___) for ___ in freqency])",
"- if freq not in res:",
"- res[freq] = 1",
"+ s = \"\".join(sorted(s))",
"+ if s not in list(res.keys()):"... | false | 0.056959 | 0.034835 | 1.635131 | [
"s720585015",
"s402343238"
] |
u592248346 | p02934 | python | s785205841 | s765589541 | 39 | 17 | 5,048 | 2,940 | Accepted | Accepted | 56.41 | import fractions
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
if n==1:
print((*a))
else:
s = a[0]
for i in range(1,n):
s = s * a[i] / fractions.gcd(s, a[i])
ans = 0
for i in a:
ans += s/i
print((s/ans)) | n = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
for i in range(n):
ans += 1/a[i]
print((1/ans))
| 14 | 6 | 267 | 115 | import fractions
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
if n == 1:
print((*a))
else:
s = a[0]
for i in range(1, n):
s = s * a[i] / fractions.gcd(s, a[i])
ans = 0
for i in a:
ans += s / i
print((s / ans))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
ans += 1 / a[i]
print((1 / ans))
| false | 57.142857 | [
"-import fractions",
"-",
"-a.sort()",
"-if n == 1:",
"- print((*a))",
"-else:",
"- s = a[0]",
"- for i in range(1, n):",
"- s = s * a[i] / fractions.gcd(s, a[i])",
"- ans = 0",
"- for i in a:",
"- ans += s / i",
"- print((s / ans))",
"+ans = 0",
"+for i i... | false | 0.092757 | 0.066979 | 1.38487 | [
"s785205841",
"s765589541"
] |
u780342333 | p02408 | python | s912115435 | s626378637 | 30 | 20 | 7,760 | 5,616 | Accepted | Accepted | 33.33 | line = int(eval(input()))
s_set = [x for x in range(1, 14)]
h_set = s_set[:]
c_set = s_set[:]
d_set = s_set[:]
taro_list = []
for i in range(line):
taro_list.append(eval(input()))
for card in taro_list:
suite = card.split(" ")[0]
num = int(card.split(" ")[1])
if suite == "S": s_set.remo... | s, h, c, d = [],[],[],[]
n = int(eval(input()))
#add cards
for _ in range(n):
suit, rank = input().split()
rank = int(rank)
if suit == "S":
s.append(rank)
elif suit == "H":
h.append(rank)
elif suit == "C":
c.append(rank)
elif suit == "D":
d.append... | 31 | 40 | 617 | 831 | line = int(eval(input()))
s_set = [x for x in range(1, 14)]
h_set = s_set[:]
c_set = s_set[:]
d_set = s_set[:]
taro_list = []
for i in range(line):
taro_list.append(eval(input()))
for card in taro_list:
suite = card.split(" ")[0]
num = int(card.split(" ")[1])
if suite == "S":
s_set.remove(num)
... | s, h, c, d = [], [], [], []
n = int(eval(input()))
# add cards
for _ in range(n):
suit, rank = input().split()
rank = int(rank)
if suit == "S":
s.append(rank)
elif suit == "H":
h.append(rank)
elif suit == "C":
c.append(rank)
elif suit == "D":
d.append(rank)
# chec... | false | 22.5 | [
"-line = int(eval(input()))",
"-s_set = [x for x in range(1, 14)]",
"-h_set = s_set[:]",
"-c_set = s_set[:]",
"-d_set = s_set[:]",
"-taro_list = []",
"-for i in range(line):",
"- taro_list.append(eval(input()))",
"-for card in taro_list:",
"- suite = card.split(\" \")[0]",
"- num = int(... | false | 0.036454 | 0.142146 | 0.256451 | [
"s912115435",
"s626378637"
] |
u036104576 | p02709 | python | s496389022 | s868907753 | 1,866 | 138 | 9,460 | 74,720 | Accepted | Accepted | 92.6 | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted([(a, i) for i, a in enumerate(A)], reverse=True)
dp = [0] * (N + 1)
for i in range(N):
dp2 = dp[:]
for l in range(i + 1):
a, pos = A[i]
# add left side
dp2[l + 1] = max(dp2[l + 1], dp[l] + (pos - l) * a)
... | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted([(a, i) for i, a in enumerate(A)], reverse=True)
dp = [0] * (N + 1)
for i in range(N):
dp2 = dp[:]
for l in range(i + 1):
a, pos = A[i]
# add left side
dp2[l + 1] = max(dp2[l + 1], dp[l] + abs(pos - l) * a)
... | 16 | 16 | 446 | 452 | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted([(a, i) for i, a in enumerate(A)], reverse=True)
dp = [0] * (N + 1)
for i in range(N):
dp2 = dp[:]
for l in range(i + 1):
a, pos = A[i]
# add left side
dp2[l + 1] = max(dp2[l + 1], dp[l] + (pos - l) * a)
# add ... | N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted([(a, i) for i, a in enumerate(A)], reverse=True)
dp = [0] * (N + 1)
for i in range(N):
dp2 = dp[:]
for l in range(i + 1):
a, pos = A[i]
# add left side
dp2[l + 1] = max(dp2[l + 1], dp[l] + abs(pos - l) * a)
# a... | false | 0 | [
"- dp2[l + 1] = max(dp2[l + 1], dp[l] + (pos - l) * a)",
"+ dp2[l + 1] = max(dp2[l + 1], dp[l] + abs(pos - l) * a)",
"- dp2[l] = max(dp2[l], dp[l] + (N - r - pos) * a)",
"+ dp2[l] = max(dp2[l], dp[l] + abs(N - r - pos) * a)"
] | false | 0.079406 | 0.037145 | 2.13775 | [
"s496389022",
"s868907753"
] |
u285891772 | p03945 | python | s783133356 | s688474187 | 64 | 58 | 5,464 | 5,460 | Accepted | Accepted | 9.38 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | 28 | 30 | 949 | 968 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 6.666667 | [
"-ans = 0",
"-for i in range(1, len(S)):",
"- if S[i] != S[i - 1]:",
"- ans += 1",
"-print(ans)",
"+now = \"\"",
"+count = 0",
"+for stone in S:",
"+ if stone != now:",
"+ count += 1",
"+ now = stone",
"+print((count - 1))"
] | false | 0.035705 | 0.037 | 0.964992 | [
"s783133356",
"s688474187"
] |
u275392848 | p02756 | python | s371869378 | s523574436 | 1,815 | 1,402 | 4,388 | 4,388 | Accepted | Accepted | 22.75 |
s=eval(input())
count=0
s1=str()
s2=str()
for _ in range(int(eval(input()))):
l=list(map(str,input().split()))
if l[0]=='1':
count+=1
elif count%2==0:
if l[1]=='1':
s1=l[2]+s1
else:
s2=s2+l[2]
else:
if l[1]=='2':
s1=l[2]+s1
else:
s2=s2+l[2]
s=s... | import sys
input = lambda: sys.stdin.readline().rstrip()
s=eval(input())
count=0
s1=str()
s2=str()
for _ in range(int(eval(input()))):
l=list(map(str,input().split()))
if l[0]=='1':
count+=1
elif count%2==0:
if l[1]=='1':
s1=l[2]+s1
else:
s2=s2+l[2]
else:
if l[1]... | 24 | 25 | 353 | 411 | s = eval(input())
count = 0
s1 = str()
s2 = str()
for _ in range(int(eval(input()))):
l = list(map(str, input().split()))
if l[0] == "1":
count += 1
elif count % 2 == 0:
if l[1] == "1":
s1 = l[2] + s1
else:
s2 = s2 + l[2]
else:
if l[1] == "2":
... | import sys
input = lambda: sys.stdin.readline().rstrip()
s = eval(input())
count = 0
s1 = str()
s2 = str()
for _ in range(int(eval(input()))):
l = list(map(str, input().split()))
if l[0] == "1":
count += 1
elif count % 2 == 0:
if l[1] == "1":
s1 = l[2] + s1
else:
... | false | 4 | [
"+import sys",
"+",
"+input = lambda: sys.stdin.readline().rstrip()"
] | false | 0.093901 | 0.107301 | 0.875121 | [
"s371869378",
"s523574436"
] |
u863397945 | p02791 | python | s087447260 | s651692741 | 157 | 143 | 32,256 | 32,316 | Accepted | Accepted | 8.92 | N = int(eval(input()))
P = list(map(int,input().split()))
T = [P[0]]+[10**10]*(N-1)
ans = 0
for i in range(N):
T[i] = min(T[i-1],P[i])
for i in range(N):
if P[i] <= T[i]:
ans += 1
print(ans) | N = int(eval(input()))
P = list(map(int,input().split()))
T = [P[0]]+[10**10]*(N-1)
ans = 0
for i in range(N):
T[i] = min(T[i-1],P[i])
if P[i] <= T[i]:
ans += 1
print(ans) | 13 | 11 | 215 | 193 | N = int(eval(input()))
P = list(map(int, input().split()))
T = [P[0]] + [10**10] * (N - 1)
ans = 0
for i in range(N):
T[i] = min(T[i - 1], P[i])
for i in range(N):
if P[i] <= T[i]:
ans += 1
print(ans)
| N = int(eval(input()))
P = list(map(int, input().split()))
T = [P[0]] + [10**10] * (N - 1)
ans = 0
for i in range(N):
T[i] = min(T[i - 1], P[i])
if P[i] <= T[i]:
ans += 1
print(ans)
| false | 15.384615 | [
"-for i in range(N):"
] | false | 0.038319 | 0.128917 | 0.297242 | [
"s087447260",
"s651692741"
] |
u017810624 | p02762 | python | s886729501 | s151717754 | 1,390 | 1,172 | 125,872 | 111,152 | Accepted | Accepted | 15.68 | import sys
input=sys.stdin.readline
n,m,k=list(map(int,input().split()))
class UF():
def __init__(self, N):
self._parent=[n for n in range(0, N)]
self._size=[1] * N
def find_root(self, x):
if self._parent[x]==x:return x
self._parent[x]=self.find_root(self._parent[x])
return self._p... | import sys
input=sys.stdin.readline
n,m,k=list(map(int,input().split()))
class UF():
def __init__(self, N):
self._parent=[n for n in range(0, N)]
self._size=[1] * N
def find_root(self, x):
if self._parent[x]==x:return x
self._parent[x]=self.find_root(self._parent[x])
return self._p... | 66 | 64 | 1,424 | 1,391 | import sys
input = sys.stdin.readline
n, m, k = list(map(int, input().split()))
class UF:
def __init__(self, N):
self._parent = [n for n in range(0, N)]
self._size = [1] * N
def find_root(self, x):
if self._parent[x] == x:
return x
self._parent[x] = self.find_root... | import sys
input = sys.stdin.readline
n, m, k = list(map(int, input().split()))
class UF:
def __init__(self, N):
self._parent = [n for n in range(0, N)]
self._size = [1] * N
def find_root(self, x):
if self._parent[x] == x:
return x
self._parent[x] = self.find_root... | false | 3.030303 | [
"-UFb = UF(n)",
"- UFb.unite(x - 1, y - 1)"
] | false | 0.042096 | 0.035676 | 1.179939 | [
"s886729501",
"s151717754"
] |
u254871849 | p03457 | python | s874700285 | s293498501 | 294 | 215 | 34,224 | 34,276 | Accepted | Accepted | 26.87 | import sys
import numpy as np
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
txy = I[1:].reshape(-1, 3)
def main():
t1, x1, y1 = txy[0]
d1 = x1 + y1
if d1 > t1 or (t1 - d1) & 1:
return 'No'
dt, dx, dy = np.absolute(np.transpose(txy[1:] - txy[:-1]))
d = dx + dy... | import sys
import numpy as np
n = int(sys.stdin.readline().rstrip())
txy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, 3)
t, x, y = np.concatenate((np.array([[0, 0, 0]]), txy), axis=0).T
def main():
dt = t[1:] - t[:-1]
dd = np.absolute(x[1:] - x[:-1]) + np.absolute(y[1:] - y[:-1])
... | 20 | 15 | 461 | 448 | import sys
import numpy as np
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
txy = I[1:].reshape(-1, 3)
def main():
t1, x1, y1 = txy[0]
d1 = x1 + y1
if d1 > t1 or (t1 - d1) & 1:
return "No"
dt, dx, dy = np.absolute(np.transpose(txy[1:] - txy[:-1]))
d = dx + dy
return ... | import sys
import numpy as np
n = int(sys.stdin.readline().rstrip())
txy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, 3)
t, x, y = np.concatenate((np.array([[0, 0, 0]]), txy), axis=0).T
def main():
dt = t[1:] - t[:-1]
dd = np.absolute(x[1:] - x[:-1]) + np.absolute(y[1:] - y[:-1])
ans =... | false | 25 | [
"-I = np.array(sys.stdin.read().split(), dtype=np.int64)",
"-n = I[0]",
"-txy = I[1:].reshape(-1, 3)",
"+n = int(sys.stdin.readline().rstrip())",
"+txy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, 3)",
"+t, x, y = np.concatenate((np.array([[0, 0, 0]]), txy), axis=0).T",
"- t1, x1, ... | false | 1.018306 | 0.503249 | 2.023464 | [
"s874700285",
"s293498501"
] |
u117193815 | p02820 | python | s971909413 | s537206831 | 80 | 71 | 4,796 | 4,084 | Accepted | Accepted | 11.25 | n,k=list(map(int, input().split()))
r,s,p=list(map(int, input().split()))
t=list(eval(input()))
hl=[]
ans=0
for i in range(n):
if i<k:
if t[i]=='r':
ans+=p
hl.append('r')
elif t[i]=='p':
ans+=s
hl.append('p')
elif t[i]=='s':
ans+=r
hl.append('s')
elif i>=k:
if t[... | n,k = list(map(int ,input().split()))
s,p,r = list(map(int ,input().split()))
t=list(eval(input()))
ans=0
for i in range(n):
if i<k:
if t[i]=="r":
ans+=r
elif t[i]=="s":
ans+=s
elif t[i]=="p":
ans+=p
else:
if t[i]==t[i-k]:
... | 31 | 23 | 527 | 499 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = list(eval(input()))
hl = []
ans = 0
for i in range(n):
if i < k:
if t[i] == "r":
ans += p
hl.append("r")
elif t[i] == "p":
ans += s
hl.append("p")
elif t[i] ==... | n, k = list(map(int, input().split()))
s, p, r = list(map(int, input().split()))
t = list(eval(input()))
ans = 0
for i in range(n):
if i < k:
if t[i] == "r":
ans += r
elif t[i] == "s":
ans += s
elif t[i] == "p":
ans += p
else:
if t[i] == t[i - ... | false | 25.806452 | [
"-r, s, p = list(map(int, input().split()))",
"+s, p, r = list(map(int, input().split()))",
"-hl = []",
"+ ans += r",
"+ elif t[i] == \"s\":",
"+ ans += s",
"+ elif t[i] == \"p\":",
"- hl.append(\"r\")",
"- elif t[i] == \"p\":",
"- a... | false | 0.044589 | 0.037983 | 1.173921 | [
"s971909413",
"s537206831"
] |
u348805958 | p02679 | python | s005104050 | s345396288 | 606 | 459 | 83,164 | 83,176 | Accepted | Accepted | 24.26 | #!python3
import sys
from collections import defaultdict
from math import gcd
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
N = eval(input())
it = list(map(int, sys.stdin.read().split()))
mod = 10**9 + 7
d1 = [defaultdict(int), defaultdict(int)]
z0 = 0
... | #!python3
import sys
from collections import defaultdict
from math import gcd
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
N = eval(input())
it = list(map(int, sys.stdin.read().split()))
mod = 10**9 + 7
d1 = [defaultdict(int), defaultdict(int)]
z0 = 0
... | 58 | 59 | 1,139 | 1,135 | #!python3
import sys
from collections import defaultdict
from math import gcd
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
N = eval(input())
it = list(map(int, sys.stdin.read().split()))
mod = 10**9 + 7
d1 = [defaultdict(int), defaultdict(int)]
z0 = 0
for ai, bi in zi... | #!python3
import sys
from collections import defaultdict
from math import gcd
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
N = eval(input())
it = list(map(int, sys.stdin.read().split()))
mod = 10**9 + 7
d1 = [defaultdict(int), defaultdict(int)]
z0 = 0
for ai, bi in zi... | false | 1.694915 | [
"+ z1 = 0",
"+ ans %= mod",
"- ans *= pow(2, v, mod)",
"- ans %= mod",
"+ z1 += v",
"- ans *= pow(2, v, mod)",
"- ans %= mod",
"+ z1 += v",
"+ ans *= pow(2, z1, mod)"
] | false | 0.047161 | 0.040625 | 1.160867 | [
"s005104050",
"s345396288"
] |
u644907318 | p02900 | python | s925568124 | s675812923 | 834 | 448 | 14,076 | 114,544 | Accepted | Accepted | 46.28 | def gcd(x,y):
if x<y:
x,y = y,x
while y>0:
x,y = y,x%y
return x
INFTY = 10**6
P = [1 for i in range(INFTY+1)]
P[0] = 0
P[1] = 0
for i in range(2,int((INFTY+1)**0.5)+1):
for j in range(i*i,INFTY+1,i):
P[j] = 0
Q = []
for i in range(INFTY):
if P[i]==1:
Q... | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3):
for j in range(i*i,10**6,i):
P[j] = 0
Q = []
for i in range(2,10**6):
if P[i]==1:
Q.append(i)
A,B = list(map(int,input().split()))
N = gcd(A,B)
R = [... | 28 | 25 | 512 | 452 | def gcd(x, y):
if x < y:
x, y = y, x
while y > 0:
x, y = y, x % y
return x
INFTY = 10**6
P = [1 for i in range(INFTY + 1)]
P[0] = 0
P[1] = 0
for i in range(2, int((INFTY + 1) ** 0.5) + 1):
for j in range(i * i, INFTY + 1, i):
P[j] = 0
Q = []
for i in range(INFTY):
if P[i] =... | def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
P = [1 for _ in range(10**6)]
P[0] = 0
P[1] = 0
for i in range(2, 10**3):
for j in range(i * i, 10**6, i):
P[j] = 0
Q = []
for i in range(2, 10**6):
if P[i] == 1:
Q.append(i)
A, B = list(map(int, input().split()))
N = gcd(A, ... | false | 10.714286 | [
"- if x < y:",
"- x, y = y, x",
"-INFTY = 10**6",
"-P = [1 for i in range(INFTY + 1)]",
"+P = [1 for _ in range(10**6)]",
"-for i in range(2, int((INFTY + 1) ** 0.5) + 1):",
"- for j in range(i * i, INFTY + 1, i):",
"+for i in range(2, 10**3):",
"+ for j in range(i * i, 10**6, i):",
... | false | 1.125574 | 1.514114 | 0.743388 | [
"s925568124",
"s675812923"
] |
u477977638 | p03032 | python | s827353650 | s409824062 | 274 | 69 | 3,188 | 73,632 | Accepted | Accepted | 74.82 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
#MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
# import bisect
# from heapq import heapify,h... | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input... | 52 | 51 | 1,308 | 866 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
# MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
# import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappush... | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return ... | false | 1.923077 | [
"-read = sys.stdin.buffer.read",
"-inputs = sys.stdin.buffer.readlines",
"-# rstrip().decode('utf-8')",
"-# INF=float(\"inf\")",
"-# MOD=10**9+7",
"-# sys.setrecursionlimit(2147483647)",
"-# import math",
"-# import numpy as np",
"-# import operator",
"-# import bisect",
"-# from heapq import he... | false | 0.046238 | 0.039873 | 1.159631 | [
"s827353650",
"s409824062"
] |
u790710233 | p03243 | python | s029247756 | s204703430 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
while True:
if len(set(str(n))) == 1:
print(n)
break
n += 1
| n = int(eval(input()))
print((((n-1)//111+1)*111)) | 6 | 2 | 106 | 43 | n = int(eval(input()))
while True:
if len(set(str(n))) == 1:
print(n)
break
n += 1
| n = int(eval(input()))
print((((n - 1) // 111 + 1) * 111))
| false | 66.666667 | [
"-while True:",
"- if len(set(str(n))) == 1:",
"- print(n)",
"- break",
"- n += 1",
"+print((((n - 1) // 111 + 1) * 111))"
] | false | 0.038713 | 0.036821 | 1.051385 | [
"s029247756",
"s204703430"
] |
u545368057 | p03937 | python | s832797479 | s618009564 | 20 | 17 | 3,316 | 3,064 | Accepted | Accepted | 15 | H,W = list(map(int, input().split()))
fields = [list(eval(input())) for i in range(H)]
mvs = [(0,1),(1,0)]
from collections import deque
q = deque()
q.append((0,0))
cnt = 0
for f in fields:
cnt += f.count("#")
if cnt != H + W - 1:
print("Impossible")
exit()
# ゴールまで連結しているか
while len(q) > ... | H,W = list(map(int, input().split()))
fields = [list(eval(input())) for i in range(H)]
cnt = 0
for f in fields:
cnt += f.count("#")
if cnt == H + W - 1:
print("Possible")
else:
print("Impossible")
| 28 | 9 | 620 | 206 | H, W = list(map(int, input().split()))
fields = [list(eval(input())) for i in range(H)]
mvs = [(0, 1), (1, 0)]
from collections import deque
q = deque()
q.append((0, 0))
cnt = 0
for f in fields:
cnt += f.count("#")
if cnt != H + W - 1:
print("Impossible")
exit()
# ゴールまで連結しているか
while len(q) > 0:
h, w = ... | H, W = list(map(int, input().split()))
fields = [list(eval(input())) for i in range(H)]
cnt = 0
for f in fields:
cnt += f.count("#")
if cnt == H + W - 1:
print("Possible")
else:
print("Impossible")
| false | 67.857143 | [
"-mvs = [(0, 1), (1, 0)]",
"-from collections import deque",
"-",
"-q = deque()",
"-q.append((0, 0))",
"-if cnt != H + W - 1:",
"+if cnt == H + W - 1:",
"+ print(\"Possible\")",
"+else:",
"- exit()",
"-# ゴールまで連結しているか",
"-while len(q) > 0:",
"- h, w = q.popleft()",
"- if h == H ... | false | 0.064129 | 0.100072 | 0.640831 | [
"s832797479",
"s618009564"
] |
u314930630 | p03031 | python | s846112549 | s319298662 | 40 | 31 | 3,316 | 3,188 | Accepted | Accepted | 22.5 | [input_n, input_m] = list(map(int, input().split()))
input_ks = [list(map(int, input().split())) for i in range(input_m)]
input_p = list(map(int, input().split()))
switch_list = [[bool(i & 2 ** j) for j in range(input_n)]
for i in range(2 ** input_n)]
count = 0
for switch in switch_list:
... | [input_n, input_m] = list(map(int, input().split()))
input_ks = [list(map(int, input().split())) for i in range(input_m)]
input_p = list(map(int, input().split()))
switch_list = [[bool(i & 2 ** j) for j in range(input_n)]
for i in range(2 ** input_n)]
count = len(switch_list)
for switch in sw... | 16 | 15 | 519 | 488 | [input_n, input_m] = list(map(int, input().split()))
input_ks = [list(map(int, input().split())) for i in range(input_m)]
input_p = list(map(int, input().split()))
switch_list = [[bool(i & 2**j) for j in range(input_n)] for i in range(2**input_n)]
count = 0
for switch in switch_list:
switchPattern = []
for m in... | [input_n, input_m] = list(map(int, input().split()))
input_ks = [list(map(int, input().split())) for i in range(input_m)]
input_p = list(map(int, input().split()))
switch_list = [[bool(i & 2**j) for j in range(input_n)] for i in range(2**input_n)]
count = len(switch_list)
for switch in switch_list:
for m in range(i... | false | 6.25 | [
"-count = 0",
"+count = len(switch_list)",
"- switchPattern = []",
"- switchPattern.append(",
"- sum(switch[l - 1] for l in input_ks[m][1:]) % 2 == input_p[m]",
"- )",
"- if all(switchPattern):",
"- count += 1",
"+ if (sum(switch[l - 1] for l in input_ks[... | false | 0.050775 | 0.048711 | 1.042376 | [
"s846112549",
"s319298662"
] |
u785205215 | p03589 | python | s791155623 | s691444930 | 313 | 258 | 42,576 | 41,068 | Accepted | Accepted | 17.57 | N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
a = 4 * h * n - h * N - n * N
if a == 0:
break
w = int((h * n * N) / a)
if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
print((h, n, w))
exit() | N = int(eval(input()))
for h in range(1, 3501):
for n in range(h, 3501):
a = 4 * h * n - h * N - n * N
if a == 0:
break
w = int((h * n * N) / a)
if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
print((h, n, w))
exit() | 10 | 10 | 286 | 286 | N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
a = 4 * h * n - h * N - n * N
if a == 0:
break
w = int((h * n * N) / a)
if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
print((h, n, w))
exit()
| N = int(eval(input()))
for h in range(1, 3501):
for n in range(h, 3501):
a = 4 * h * n - h * N - n * N
if a == 0:
break
w = int((h * n * N) / a)
if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
print((h, n, w))
exit()
| false | 0 | [
"- for n in range(1, 3501):",
"+ for n in range(h, 3501):"
] | false | 0.087621 | 0.05964 | 1.469179 | [
"s791155623",
"s691444930"
] |
u928784113 | p03416 | python | s458022077 | s393491595 | 63 | 44 | 2,940 | 2,940 | Accepted | Accepted | 30.16 | # -*- coding: utf-8 -*-
A,B = list(map(int,input().split()))
a = [] # 回文数の個数を入れるリストの作成
for i in range(A,B+1):
if str(i) == str(i)[::-1]: #回文数を発見した場合
a.append(1) #リストaに1を追加する
else: #iが回文数でない場合
pass # 何もしない
print((sum(a))) #リスト内の1をすべて足す
| ans = 0
A,B = list(map(int,input().split()))
for i in range(A,B+1):
I = str(i)
if I[0] == I[4] and I[1] == I[3]:
ans += 1
print(ans) | 11 | 8 | 256 | 174 | # -*- coding: utf-8 -*-
A, B = list(map(int, input().split()))
a = [] # 回文数の個数を入れるリストの作成
for i in range(A, B + 1):
if str(i) == str(i)[::-1]: # 回文数を発見した場合
a.append(1) # リストaに1を追加する
else: # iが回文数でない場合
pass # 何もしない
print((sum(a))) # リスト内の1をすべて足す
| ans = 0
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
I = str(i)
if I[0] == I[4] and I[1] == I[3]:
ans += 1
print(ans)
| false | 27.272727 | [
"-# -*- coding: utf-8 -*-",
"+ans = 0",
"-a = [] # 回文数の個数を入れるリストの作成",
"- if str(i) == str(i)[::-1]: # 回文数を発見した場合",
"- a.append(1) # リストaに1を追加する",
"- else: # iが回文数でない場合",
"- pass # 何もしない",
"-print((sum(a))) # リスト内の1をすべて足す",
"+ I = str(i)",
"+ if I[0] == I[4] and I[1]... | false | 0.049179 | 0.044008 | 1.117492 | [
"s458022077",
"s393491595"
] |
u543954314 | p02678 | python | s612344591 | s740499674 | 499 | 429 | 40,212 | 39,252 | Accepted | Accepted | 14.03 | import sys
from collections import deque
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
n, m = nm()
G... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
def bfs(G, s, t=None):
"""
G[v] = [x1, x2,...]
"""
dist = [-1] * len(G)
dist[s]... | 34 | 44 | 725 | 935 | import sys
from collections import deque
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
n, m = nm()
G = [list() fo... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
def bfs(G, s, t=None):
"""
G[v] = [x1, x2,...]
"""
dist = [-1] * len(G)
dist[s] = 0
par... | false | 22.727273 | [
"-readline = sys.stdin.readline",
"-readall = sys.stdin.read",
"-ns = lambda: readline().rstrip()",
"+readline = sys.stdin.buffer.readline",
"-prn = lambda x: print(*x, sep=\"\\n\")",
"-n, m = nm()",
"-G = [list() for _ in range(n)]",
"-for _ in range(m):",
"- u, v = nm()",
"- u -= 1",
"- ... | false | 0.037372 | 0.03633 | 1.02868 | [
"s612344591",
"s740499674"
] |
u671060652 | p03109 | python | s851391472 | s917262326 | 334 | 166 | 64,876 | 38,256 | Accepted | Accepted | 50.3 | import itertools
import math
import fractions
import functools
s = eval(input())
y = int(s[0]) * 1000 + int(s[1]) * 100 + int(s[2]) * 10 + int(s[3])
m = int(s[5]) * 10 + int(s[6])
d = int(s[8]) * 10 + int(s[9])
if (y == 2019 and m > 4) or y >= 2020:
print('TBD')
else:
print('Heisei') | s = eval(input())
if s > "2019/04/30":
print("TBD")
else: print("Heisei")
| 14 | 5 | 301 | 77 | import itertools
import math
import fractions
import functools
s = eval(input())
y = int(s[0]) * 1000 + int(s[1]) * 100 + int(s[2]) * 10 + int(s[3])
m = int(s[5]) * 10 + int(s[6])
d = int(s[8]) * 10 + int(s[9])
if (y == 2019 and m > 4) or y >= 2020:
print("TBD")
else:
print("Heisei")
| s = eval(input())
if s > "2019/04/30":
print("TBD")
else:
print("Heisei")
| false | 64.285714 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-",
"-y = int(s[0]) * 1000 + int(s[1]) * 100 + int(s[2]) * 10 + int(s[3])",
"-m = int(s[5]) * 10 + int(s[6])",
"-d = int(s[8]) * 10 + int(s[9])",
"-if (y == 2019 and m > 4) or y >= 2020:",
"+if s > \"2019/04/30\":"
] | false | 0.109404 | 0.153831 | 0.711197 | [
"s851391472",
"s917262326"
] |
u996665352 | p02837 | python | s054579366 | s124733454 | 142 | 103 | 3,064 | 3,064 | Accepted | Accepted | 27.46 | N = int(eval(input()))
testimony = [[] for _ in range(N)]
ans = 0
for n in range(N):
A = int(eval(input()))
for _ in range(A):
x,y = list(map(int,input().split()))
testimony[n].append([x-1,y]) # 人のナンバリングを0startにする
# print(testimony)
for bit in range(2**N):
# print("bit",bit)
h... | import itertools
N = int(eval(input()))
testimony = []
for n in range(N):
A = int(eval(input()))
testimony.append([list(map(int,input().split())) for _ in range(A)])
ans = 0
for bit in itertools.product([0,1],repeat = N):
for n in range(N):
if bit[n]:
for t in testimony[n]:
... | 29 | 20 | 779 | 494 | N = int(eval(input()))
testimony = [[] for _ in range(N)]
ans = 0
for n in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
testimony[n].append([x - 1, y]) # 人のナンバリングを0startにする
# print(testimony)
for bit in range(2**N):
# print("bit",bit)
ho... | import itertools
N = int(eval(input()))
testimony = []
for n in range(N):
A = int(eval(input()))
testimony.append([list(map(int, input().split())) for _ in range(A)])
ans = 0
for bit in itertools.product([0, 1], repeat=N):
for n in range(N):
if bit[n]:
for t in testimony[n]:
... | false | 31.034483 | [
"+import itertools",
"+",
"-testimony = [[] for _ in range(N)]",
"-ans = 0",
"+testimony = []",
"- for _ in range(A):",
"- x, y = list(map(int, input().split()))",
"- testimony[n].append([x - 1, y]) # 人のナンバリングを0startにする",
"-# print(testimony)",
"-for bit in range(2**N):",
"- ... | false | 0.041501 | 0.092746 | 0.447471 | [
"s054579366",
"s124733454"
] |
u345966487 | p03355 | python | s644057511 | s388303284 | 52 | 48 | 3,060 | 3,060 | Accepted | Accepted | 7.69 | s,k=open(0);k=int(k);q=[];N=len(s)
for i in range(N):
for j in range(min(k,N-1-i)):x=s[i:i+j+1];q=q if x in q else sorted(q+[x])[:k]
print((q[-1])) | s=eval(input());k=int(eval(input()));q=[]
for i in range(len(s)):
for j in range(k):x=s[i:i+j+1];q=q if x in q else sorted(q+[x])[:k]
print((q[-1])) | 4 | 4 | 149 | 138 | s, k = open(0)
k = int(k)
q = []
N = len(s)
for i in range(N):
for j in range(min(k, N - 1 - i)):
x = s[i : i + j + 1]
q = q if x in q else sorted(q + [x])[:k]
print((q[-1]))
| s = eval(input())
k = int(eval(input()))
q = []
for i in range(len(s)):
for j in range(k):
x = s[i : i + j + 1]
q = q if x in q else sorted(q + [x])[:k]
print((q[-1]))
| false | 0 | [
"-s, k = open(0)",
"-k = int(k)",
"+s = eval(input())",
"+k = int(eval(input()))",
"-N = len(s)",
"-for i in range(N):",
"- for j in range(min(k, N - 1 - i)):",
"+for i in range(len(s)):",
"+ for j in range(k):"
] | false | 0.045082 | 0.047065 | 0.957862 | [
"s644057511",
"s388303284"
] |
u600402037 | p02720 | python | s087071332 | s587340106 | 187 | 61 | 40,816 | 9,268 | Accepted | Accepted | 67.38 | import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
A = deque([x for x in range(1, 10)])
count = 0
while True:
cur = A.popleft()
count += 1
if count == K:
answer = cur
b... | # coding: utf-8
import sys
sys.setrecursionlimit(10 ** 7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
num = -1
def dfs(A, i, bl):
global num
if i == 11:
num += 1
if num == K:
ans = ''.join(map... | 24 | 34 | 494 | 736 | import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
A = deque([x for x in range(1, 10)])
count = 0
while True:
cur = A.popleft()
count += 1
if count == K:
answer = cur
break
next = ... | # coding: utf-8
import sys
sys.setrecursionlimit(10**7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
K = ir()
num = -1
def dfs(A, i, bl):
global num
if i == 11:
num += 1
if num == K:
ans = "".join(map(str, A))
... | false | 29.411765 | [
"+# coding: utf-8",
"-from collections import deque",
"+sys.setrecursionlimit(10**7)",
"-A = deque([x for x in range(1, 10)])",
"-count = 0",
"-while True:",
"- cur = A.popleft()",
"- count += 1",
"- if count == K:",
"- answer = cur",
"- break",
"- next = 10 * cur + (... | false | 0.041589 | 0.050993 | 0.815589 | [
"s087071332",
"s587340106"
] |
u343292604 | p02928 | python | s146020412 | s637875336 | 675 | 612 | 3,188 | 3,188 | Accepted | Accepted | 9.33 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
div = 1000000007
s = 0
ss = 0
for i, a in enumerate(A):
for j in range(i+1, N):
if a > A[j]:
s += 1
for i in A:
for j in A:
if i > j:
ss += 1
print((((s * K) + (ss * K * (K-1) //... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
div = 1000000007
s = 0
ss = 0
for i, a in enumerate(A):
for j in A[i+1:]:
if a > j:
s += 1
for i in A:
for j in A:
if i > j:
ss += 1
print((((s * K) + (ss * K * (K-1) // 2)) % di... | 17 | 17 | 331 | 322 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
div = 1000000007
s = 0
ss = 0
for i, a in enumerate(A):
for j in range(i + 1, N):
if a > A[j]:
s += 1
for i in A:
for j in A:
if i > j:
ss += 1
print((((s * K) + (ss * K * (K - 1) // 2)) % div))
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
div = 1000000007
s = 0
ss = 0
for i, a in enumerate(A):
for j in A[i + 1 :]:
if a > j:
s += 1
for i in A:
for j in A:
if i > j:
ss += 1
print((((s * K) + (ss * K * (K - 1) // 2)) % div))
| false | 0 | [
"- for j in range(i + 1, N):",
"- if a > A[j]:",
"+ for j in A[i + 1 :]:",
"+ if a > j:"
] | false | 0.048107 | 0.046966 | 1.02429 | [
"s146020412",
"s637875336"
] |
u048945791 | p03317 | python | s291403809 | s192649697 | 40 | 17 | 13,812 | 3,060 | Accepted | Accepted | 57.5 | import math
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
print((math.ceil((N - 1) / (K - 1)))) | import math
N, K = list(map(int, input().split()))
print((math.ceil((N - 1) / (K - 1)))) | 6 | 4 | 123 | 84 | import math
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
print((math.ceil((N - 1) / (K - 1))))
| import math
N, K = list(map(int, input().split()))
print((math.ceil((N - 1) / (K - 1))))
| false | 33.333333 | [
"-A = list(map(int, input().split()))"
] | false | 0.037698 | 0.077688 | 0.485249 | [
"s291403809",
"s192649697"
] |
u535803878 | p02579 | python | s827994306 | s796414006 | 1,533 | 759 | 124,168 | 115,360 | Accepted | Accepted | 50.49 | 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
h,w = list(map(int, input().split()))
ch,cw = list(map(int... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
from heapq import *
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((b1[:, :], i8, i8, i8, i8), cache=True)
def main(wall, Sx, Sy, Tx, Ty):
INF = 1 << 30
... | 80 | 63 | 2,105 | 1,838 | 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
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input()... | import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
from heapq import *
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((b1[:, :], i8, i8, i8, i8), cache=True)
def main(wall, Sx, Sy, Tx, Ty):
INF = 1 << 30
H, W = wal... | false | 21.25 | [
"+import numpy as np",
"+import numba",
"+from numba import njit, b1, i4, i8, f8",
"+from heapq import *",
"-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... | false | 0.176563 | 0.209441 | 0.843017 | [
"s827994306",
"s796414006"
] |
u334712262 | p02769 | python | s310658318 | s298311501 | 477 | 255 | 117,736 | 171,720 | Accepted | Accepted | 46.54 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 124 | 112 | 2,469 | 2,248 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 9.677419 | [
"-import sys",
"+from fractions import Fraction",
"-from itertools import combinations, combinations_with_replacement, product, permutations",
"-from operator import add, mul, sub",
"+from itertools import (",
"+ combinations,",
"+ combinations_with_replacement,",
"+ product,",
"+ permut... | false | 0.430349 | 0.386014 | 1.114855 | [
"s310658318",
"s298311501"
] |
u075595666 | p03464 | python | s379213747 | s099922957 | 122 | 109 | 14,404 | 11,132 | Accepted | Accepted | 10.66 | import math
n = int(eval(input()))
a = [int(i) for i in input().split()]
mi = 2
ma = 2
for b in a[::-1]:
mi = math.ceil(mi/b)*b
ma = math.ceil((ma+1)/b)*b-1
if ma < b or mi > ma:
print((-1))
exit()
print((mi,ma)) | from math import ceil as c
eval(input())
m=M=2
for b in map(int,input().split()[::-1]):
m = c(m/b)*b
M = c((M+1)/b)*b-1
if m > M:
print((-1))
exit()
print((m,M)) | 12 | 10 | 227 | 174 | import math
n = int(eval(input()))
a = [int(i) for i in input().split()]
mi = 2
ma = 2
for b in a[::-1]:
mi = math.ceil(mi / b) * b
ma = math.ceil((ma + 1) / b) * b - 1
if ma < b or mi > ma:
print((-1))
exit()
print((mi, ma))
| from math import ceil as c
eval(input())
m = M = 2
for b in map(int, input().split()[::-1]):
m = c(m / b) * b
M = c((M + 1) / b) * b - 1
if m > M:
print((-1))
exit()
print((m, M))
| false | 16.666667 | [
"-import math",
"+from math import ceil as c",
"-n = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-mi = 2",
"-ma = 2",
"-for b in a[::-1]:",
"- mi = math.ceil(mi / b) * b",
"- ma = math.ceil((ma + 1) / b) * b - 1",
"- if ma < b or mi > ma:",
"+eval(input())",
"+m = ... | false | 0.040269 | 0.039911 | 1.008955 | [
"s379213747",
"s099922957"
] |
u530844517 | p02996 | python | s667817026 | s712511521 | 1,779 | 1,250 | 89,304 | 71,388 | Accepted | Accepted | 29.74 | n = int(eval(input()))
tasks = []
for _ in range(n):
a,b = list(map(int, input().split()))
tasks.append([a,b])
tasks.sort()
tasks = sorted( tasks, key = lambda a: a[1] )
time = 0
flg = 0
for task in tasks:
time += task[0]
if time > task[1]:
flg = 1
print(( 'No' if flg else 'Yes'... | import sys
input = sys.stdin.readline
n = int(eval(input()))
tasks = []
for _ in range(n):
a,b = list(map(int, input().split()))
tasks.append((a,b))
tasks.sort()
tasks = sorted( tasks, key = lambda a: a[1] )
time = 0
flg = 0
for task in tasks:
time += task[0]
if time > task[1]:
... | 16 | 21 | 309 | 364 | n = int(eval(input()))
tasks = []
for _ in range(n):
a, b = list(map(int, input().split()))
tasks.append([a, b])
tasks.sort()
tasks = sorted(tasks, key=lambda a: a[1])
time = 0
flg = 0
for task in tasks:
time += task[0]
if time > task[1]:
flg = 1
print(("No" if flg else "Yes"))
| import sys
input = sys.stdin.readline
n = int(eval(input()))
tasks = []
for _ in range(n):
a, b = list(map(int, input().split()))
tasks.append((a, b))
tasks.sort()
tasks = sorted(tasks, key=lambda a: a[1])
time = 0
flg = 0
for task in tasks:
time += task[0]
if time > task[1]:
print("No")
... | false | 23.809524 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"- tasks.append([a, b])",
"+ tasks.append((a, b))",
"- flg = 1",
"-print((\"No\" if flg else \"Yes\"))",
"+ print(\"No\")",
"+ break",
"+else:",
"+ print(\"Yes\")"
] | false | 0.042146 | 0.037003 | 1.138982 | [
"s667817026",
"s712511521"
] |
u170201762 | p03232 | python | s272045321 | s451081092 | 493 | 319 | 18,988 | 62,576 | Accepted | Accepted | 35.29 | r = 1000000007
N = 100000
l = [1]*N
def egcd(a, b):
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y, y)
return (lastx, lasty, a)
# ax ≡ 1 (mod m)
def modinv(a... | N = int(eval(input()))
A = list(map(int,input().split()))
mod = 10**9+7
def inv(n):
n %= mod
return pow(n,mod-2,mod)
H = [0]*(N+1)
for n in range(1,N+1):
H[n] = (inv(n)+H[n-1])%mod
N_f = 1
for n in range(1,N+1):
N_f = N_f*n%mod
ans = 0
for n in range(1,N+1):
ans += A[n-1]*(H[N-n+1]+H[n]-1)
a... | 33 | 23 | 630 | 361 | r = 1000000007
N = 100000
l = [1] * N
def egcd(a, b):
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y, y)
return (lastx, lasty, a)
# ax ≡ 1 (mod m)
def modinv(a, m):
(... | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
def inv(n):
n %= mod
return pow(n, mod - 2, mod)
H = [0] * (N + 1)
for n in range(1, N + 1):
H[n] = (inv(n) + H[n - 1]) % mod
N_f = 1
for n in range(1, N + 1):
N_f = N_f * n % mod
ans = 0
for n in range(1, N + 1):
ans += ... | false | 30.30303 | [
"-r = 1000000007",
"-N = 100000",
"-l = [1] * N",
"+N = int(eval(input()))",
"+A = list(map(int, input().split()))",
"+mod = 10**9 + 7",
"-def egcd(a, b):",
"- (x, lastx) = (0, 1)",
"- (y, lasty) = (1, 0)",
"- while b != 0:",
"- q = a // b",
"- (a, b) = (b, a % b)",
"-... | false | 1.247025 | 0.038269 | 32.585684 | [
"s272045321",
"s451081092"
] |
u816872429 | p03222 | python | s983842086 | s590653364 | 199 | 172 | 41,200 | 39,280 | Accepted | Accepted | 13.57 | h, w, k = list(map(int, input().split()))
dp = [1] + [0] * (w - 1)
mod = 1000000007
for _ in range(h):
newdp = [0] * w
for b in range(1 << (w - 1)):
valid = True
for i in range(w - 1):
if (b >> i) & 3 == 3:
valid = False
if valid:
for i ... | h, w, k = list(map(int, input().split()))
dp = [1] + [0] * (w - 1)
mod = 1000000007
def mul(a, b):
newmatrix = [[0] * w for _ in range(w)]
for i in range(w):
for j in range(w):
newmatrix[i][j] = sum(a[i][k] * b[k][j] for k in range(w)) % mod
return newmatrix
matrix = [[0] * ... | 20 | 34 | 675 | 938 | h, w, k = list(map(int, input().split()))
dp = [1] + [0] * (w - 1)
mod = 1000000007
for _ in range(h):
newdp = [0] * w
for b in range(1 << (w - 1)):
valid = True
for i in range(w - 1):
if (b >> i) & 3 == 3:
valid = False
if valid:
for i in range(w)... | h, w, k = list(map(int, input().split()))
dp = [1] + [0] * (w - 1)
mod = 1000000007
def mul(a, b):
newmatrix = [[0] * w for _ in range(w)]
for i in range(w):
for j in range(w):
newmatrix[i][j] = sum(a[i][k] * b[k][j] for k in range(w)) % mod
return newmatrix
matrix = [[0] * w for _ i... | false | 41.176471 | [
"-for _ in range(h):",
"- newdp = [0] * w",
"- for b in range(1 << (w - 1)):",
"- valid = True",
"- for i in range(w - 1):",
"- if (b >> i) & 3 == 3:",
"- valid = False",
"- if valid:",
"- for i in range(w):",
"- if (b ... | false | 0.045938 | 0.044223 | 1.038797 | [
"s983842086",
"s590653364"
] |
u644907318 | p03946 | python | s612826816 | s892975424 | 1,041 | 383 | 63,508 | 84,884 | Accepted | Accepted | 63.21 | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [(0,-1) for _ in range(N)]
amax = A[-1]
ind = N-1
bmax = 0
for i in range(N-2,-1,-1):
a = A[i]
if a>amax:
amax = a
ind = i
else:
B[i] = (amax-a,ind)
if bmax<amax-a:
bmax = am... | N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
C = {}
amin = A[0]
for i in range(1,N):
a = A[i]
if a>amin:
b = a-amin
if b not in C:
C[b] = []
C[b].append(i)
elif a==amin:
continue
else:
amin = a
C = sorted(list(... | 21 | 17 | 445 | 377 | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [(0, -1) for _ in range(N)]
amax = A[-1]
ind = N - 1
bmax = 0
for i in range(N - 2, -1, -1):
a = A[i]
if a > amax:
amax = a
ind = i
else:
B[i] = (amax - a, ind)
if bmax < amax - a:
bmax... | N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
C = {}
amin = A[0]
for i in range(1, N):
a = A[i]
if a > amin:
b = a - amin
if b not in C:
C[b] = []
C[b].append(i)
elif a == amin:
continue
else:
amin = a
C = sorted(list(C.ite... | false | 19.047619 | [
"-B = [(0, -1) for _ in range(N)]",
"-amax = A[-1]",
"-ind = N - 1",
"-bmax = 0",
"-for i in range(N - 2, -1, -1):",
"+C = {}",
"+amin = A[0]",
"+for i in range(1, N):",
"- if a > amax:",
"- amax = a",
"- ind = i",
"+ if a > amin:",
"+ b = a - amin",
"+ if... | false | 0.006468 | 0.040208 | 0.160868 | [
"s612826816",
"s892975424"
] |
u860002137 | p02862 | python | s607192922 | s636512895 | 1,398 | 408 | 121,856 | 38,368 | Accepted | Accepted | 70.82 | import sys
import math
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x:
print((0))
sys.exit()
# 手数
n = (x + y) // 3
x -= n
y -= n
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * facti... | import numpy as np
import sys
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x:
print((0))
sys.exit()
# 手数
n = (x + y) // 3
x -= n
y -= n
MOD = 10**9 + 7
def prepare(n, MOD):
f = 1
for m in range(1, n + 1):
f *= m
f %= MOD
... | 33 | 38 | 602 | 594 | import sys
import math
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x:
print((0))
sys.exit()
# 手数
n = (x + y) // 3
x -= n
y -= n
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % p
MOD... | import numpy as np
import sys
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x:
print((0))
sys.exit()
# 手数
n = (x + y) // 3
x -= n
y -= n
MOD = 10**9 + 7
def prepare(n, MOD):
f = 1
for m in range(1, n + 1):
f *= m
f %= MOD
fn = f
inv = pow(f... | false | 13.157895 | [
"+import numpy as np",
"-import math",
"+MOD = 10**9 + 7",
"-def cmb(n, r, p):",
"- if (r < 0) or (n < r):",
"- return 0",
"- r = min(r, n - r)",
"- return fact[n] * factinv[r] * factinv[n - r] % p",
"+def prepare(n, MOD):",
"+ f = 1",
"+ for m in range(1, n + 1):",
"+ ... | false | 1.777338 | 0.503235 | 3.531828 | [
"s607192922",
"s636512895"
] |
u726769307 | p03031 | python | s670373496 | s531493800 | 345 | 29 | 12,492 | 3,064 | Accepted | Accepted | 91.59 | from numpy import*
n,m=list(map(int,input().split()))
s=[[int(j) for j in input().split()][1:] for i in range(m)]
p=[int(i) for i in input().split()]
a=0
for i in range(2**n):
b=array([(i>>j)&1 for j in range(n)])
if [sum(b[array(k)-1])%2 for k in s]==p:
a+=1
print(a) | n, m = list(map(int, input().split()))
k = []
# s[i] := i番目のスイッチについている電球群
s = [[] for _ in range(n)]
for i in range(m):
temp = [int(i) for i in input().split()]
k.append(temp[0])
for j in temp[1:]:
s[j-1].append(i)
p = [int(i) for i in input().split()]
count = 0
for i in range(2 ** n):
state... | 10 | 23 | 285 | 526 | from numpy import *
n, m = list(map(int, input().split()))
s = [[int(j) for j in input().split()][1:] for i in range(m)]
p = [int(i) for i in input().split()]
a = 0
for i in range(2**n):
b = array([(i >> j) & 1 for j in range(n)])
if [sum(b[array(k) - 1]) % 2 for k in s] == p:
a += 1
print(a)
| n, m = list(map(int, input().split()))
k = []
# s[i] := i番目のスイッチについている電球群
s = [[] for _ in range(n)]
for i in range(m):
temp = [int(i) for i in input().split()]
k.append(temp[0])
for j in temp[1:]:
s[j - 1].append(i)
p = [int(i) for i in input().split()]
count = 0
for i in range(2**n):
state = [... | false | 56.521739 | [
"-from numpy import *",
"-",
"-s = [[int(j) for j in input().split()][1:] for i in range(m)]",
"+k = []",
"+# s[i] := i番目のスイッチについている電球群",
"+s = [[] for _ in range(n)]",
"+for i in range(m):",
"+ temp = [int(i) for i in input().split()]",
"+ k.append(temp[0])",
"+ for j in temp[1:]:",
"+... | false | 0.46213 | 0.036248 | 12.749118 | [
"s670373496",
"s531493800"
] |
u600402037 | p02803 | python | s807781094 | s127769487 | 646 | 281 | 3,316 | 45,916 | Accepted | Accepted | 56.5 | import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
grid = [sr() for _ in range(H)]
def bfs(sy, sx):
d = [[float('inf')] * W for _ in range(H)]
dy = [0, 1, 0, -1]
dx = [1, 0, -1, 0]
... | import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def bfs(sy, sx):
dist = [[-INF] * W for _ in range(H)]
dist[sy][sx] = 0
que = deque([(sy, sx)])
popleft = que.popleft; append = que.append
... | 44 | 31 | 1,106 | 938 | import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
grid = [sr() for _ in range(H)]
def bfs(sy, sx):
d = [[float("inf")] * W for _ in range(H)]
dy = [0, 1, 0, -1]
dx = [1, 0, -1, 0]
que = dequ... | import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def bfs(sy, sx):
dist = [[-INF] * W for _ in range(H)]
dist[sy][sx] = 0
que = deque([(sy, sx)])
popleft = que.popleft
append = que.append
while ... | false | 29.545455 | [
"-H, W = lr()",
"-grid = [sr() for _ in range(H)]",
"- d = [[float(\"inf\")] * W for _ in range(H)]",
"- dy = [0, 1, 0, -1]",
"- dx = [1, 0, -1, 0]",
"- que = deque()",
"- que.append((sy, sx))",
"- d[sy][sx] = 0",
"+ dist = [[-INF] * W for _ in range(H)]",
"+ dist[sy][sx] =... | false | 0.03429 | 0.035119 | 0.976405 | [
"s807781094",
"s127769487"
] |
u477977638 | p02678 | python | s686848313 | s271012848 | 511 | 279 | 113,556 | 106,836 | Accepted | Accepted | 45.4 | #import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return ... | import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return lis... | 90 | 90 | 1,025 | 1,022 | # import sys
# input = sys.stdin.readline
# input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(input())
def MI():
return map(int, input().split())
def MF():
return map(float, input().split())
d... | import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(input())
def MI():
return map(int, input().split())
def MF():
return map(float, input().split())
def LI... | false | 0 | [
"-# import sys",
"-# input = sys.stdin.readline",
"-# input = sys.stdin.buffer.readline",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+input = sys.stdin.buffer.readline"
] | false | 0.117977 | 0.125241 | 0.942002 | [
"s686848313",
"s271012848"
] |
u368796742 | p02669 | python | s556268050 | s877197826 | 363 | 302 | 11,060 | 20,448 | Accepted | Accepted | 16.8 | import sys
sys.setrecursionlimit(10**7)
def dfs(x):
if x == 0:
return 0
if x == 1:
return d
if x in dic:
return dic[x]
l2 = x//2
r2 = (x+1)//2
l3 = x//3
r3 = (x+2)//3
l5 = x//5
r5 = (x+4)//5
count = min(x*d,10**18)
count = min(count,abs... | import sys
from functools import lru_cache
sys.setrecursionlimit(10**7)
def solve(x,a,b,c,d):
@lru_cache(None)
def dfs(x):
if x == 0:
return 0
if x == 1:
return d
l2 = x//2
r2 = (x+1)//2
l3 = x//3
r3 = (x+2)//3
l5 = ... | 30 | 30 | 734 | 830 | import sys
sys.setrecursionlimit(10**7)
def dfs(x):
if x == 0:
return 0
if x == 1:
return d
if x in dic:
return dic[x]
l2 = x // 2
r2 = (x + 1) // 2
l3 = x // 3
r3 = (x + 2) // 3
l5 = x // 5
r5 = (x + 4) // 5
count = min(x * d, 10**18)
count = min(c... | import sys
from functools import lru_cache
sys.setrecursionlimit(10**7)
def solve(x, a, b, c, d):
@lru_cache(None)
def dfs(x):
if x == 0:
return 0
if x == 1:
return d
l2 = x // 2
r2 = (x + 1) // 2
l3 = x // 3
r3 = (x + 2) // 3
l5... | false | 0 | [
"+from functools import lru_cache",
"-def dfs(x):",
"- if x == 0:",
"- return 0",
"- if x == 1:",
"- return d",
"- if x in dic:",
"- return dic[x]",
"- l2 = x // 2",
"- r2 = (x + 1) // 2",
"- l3 = x // 3",
"- r3 = (x + 2) // 3",
"- l5 = x // 5",
... | false | 0.129734 | 0.267075 | 0.485757 | [
"s556268050",
"s877197826"
] |
u018679195 | p02706 | python | s774024062 | s588905856 | 28 | 25 | 9,504 | 9,828 | Accepted | Accepted | 10.71 | x=eval(input())
z=eval(input())
y=[]
a=[]
y = x.split()
a = z.split()
a = list(map(int,a))
y = list(map(int,y))
if (sum(a)>y[0]):
print((-1))
else:
print((y[0]-sum(a)))
| (n,m)=map(int,input().split())
x = [int(i) for i in input().split()]
sum=sum(x)
print(n-sum)if n>=sum else print("-1")
| 12 | 4 | 172 | 121 | x = eval(input())
z = eval(input())
y = []
a = []
y = x.split()
a = z.split()
a = list(map(int, a))
y = list(map(int, y))
if sum(a) > y[0]:
print((-1))
else:
print((y[0] - sum(a)))
| (n, m) = map(int, input().split())
x = [int(i) for i in input().split()]
sum = sum(x)
print(n - sum) if n >= sum else print("-1")
| false | 66.666667 | [
"-x = eval(input())",
"-z = eval(input())",
"-y = []",
"-a = []",
"-y = x.split()",
"-a = z.split()",
"-a = list(map(int, a))",
"-y = list(map(int, y))",
"-if sum(a) > y[0]:",
"- print((-1))",
"-else:",
"- print((y[0] - sum(a)))",
"+(n, m) = map(int, input().split())",
"+x = [int(i) ... | false | 0.079787 | 0.037365 | 2.135329 | [
"s774024062",
"s588905856"
] |
u562935282 | p03252 | python | s233932174 | s529634608 | 159 | 118 | 3,632 | 4,164 | Accepted | Accepted | 25.79 | """
import string
al = string.ascii_lowercase
ord('A') =65
chr(65) ='A'
"""
def c2i(c): return ord(c) - ord('a')
s = eval(input())
t = eval(input())
chrList = [-1 for _ in range(26)]
flg = True
for i in range(len(s)):
idx_s = c2i(s[i])
idx_t = c2i(t[i])
if chrList[idx_s] == -1:... | from string import ascii_lowercase
s = eval(input())
t = eval(input())
d_s2t = dict()
d_t2s = dict()
flg = True
for ss, tt in zip(s, t):
if d_s2t.get(ss) is None:
d_s2t[ss] = tt
else:
if not d_s2t[ss] == tt:
flg = False
break
if d_t2s.get(tt) is N... | 43 | 31 | 812 | 631 | """
import string
al = string.ascii_lowercase
ord('A') =65
chr(65) ='A'
"""
def c2i(c):
return ord(c) - ord("a")
s = eval(input())
t = eval(input())
chrList = [-1 for _ in range(26)]
flg = True
for i in range(len(s)):
idx_s = c2i(s[i])
idx_t = c2i(t[i])
if chrList[idx_s] == -1:
chrList[idx_s... | from string import ascii_lowercase
s = eval(input())
t = eval(input())
d_s2t = dict()
d_t2s = dict()
flg = True
for ss, tt in zip(s, t):
if d_s2t.get(ss) is None:
d_s2t[ss] = tt
else:
if not d_s2t[ss] == tt:
flg = False
break
if d_t2s.get(tt) is None:
d_t2s[t... | false | 27.906977 | [
"-\"\"\"",
"-import string",
"-al = string.ascii_lowercase",
"-ord('A') =65",
"-chr(65) ='A'",
"-\"\"\"",
"-",
"-",
"-def c2i(c):",
"- return ord(c) - ord(\"a\")",
"-",
"+from string import ascii_lowercase",
"-chrList = [-1 for _ in range(26)]",
"+d_s2t = dict()",
"+d_t2s = dict()",
... | false | 0.040801 | 0.038515 | 1.059333 | [
"s233932174",
"s529634608"
] |
u598229387 | p03127 | python | s779126414 | s436329668 | 93 | 76 | 14,252 | 14,224 | Accepted | Accepted | 18.28 | n=int(eval(input()))
a=[int(i) for i in input().split()]
def gcd(a,b):
while b:
a,b=b,a%b
return a
for i in range(n-1):
ans= gcd(a[i],a[i+1])
a[i+1]=ans
print(ans) | n=int(eval(input()))
a=[int(i) for i in input().split()]
def gcd(a,b):
while b:
a,b=b,a%b
return a
check=a[0]
for i in range(1,n):
check=gcd(check,a[i])
print(check)
| 12 | 12 | 194 | 193 | n = int(eval(input()))
a = [int(i) for i in input().split()]
def gcd(a, b):
while b:
a, b = b, a % b
return a
for i in range(n - 1):
ans = gcd(a[i], a[i + 1])
a[i + 1] = ans
print(ans)
| n = int(eval(input()))
a = [int(i) for i in input().split()]
def gcd(a, b):
while b:
a, b = b, a % b
return a
check = a[0]
for i in range(1, n):
check = gcd(check, a[i])
print(check)
| false | 0 | [
"-for i in range(n - 1):",
"- ans = gcd(a[i], a[i + 1])",
"- a[i + 1] = ans",
"-print(ans)",
"+check = a[0]",
"+for i in range(1, n):",
"+ check = gcd(check, a[i])",
"+print(check)"
] | false | 0.071233 | 0.116241 | 0.612805 | [
"s779126414",
"s436329668"
] |
u593567568 | p02775 | python | s769161692 | s557318938 | 764 | 563 | 152,136 | 150,728 | Accepted | Accepted | 26.31 | import sys
sys.setrecursionlimit(10 ** 7)
N = eval(input())
# TLE ()
# DP
INF = pow(10, 8)
L = len(N)
dp = [[INF] * 2 for _ in range(L+2)]
dp[0][0] = 0
# reverse
N = N[::-1] + '0'
for i in range(L+1):
for j in range(2):
# 繰り下がりも加味
n = int(N[i])
n += j
# ... | import sys
sys.setrecursionlimit(10 ** 7)
N = eval(input())
# TLE (Python3 3.4.3)
# AC (PyPy3 (2.4.0))
# DP
INF = pow(10, 8)
L = len(N)
dp = [[INF] * 2 for _ in range(L+2)]
dp[0][0] = 0
# reverse
N = N[::-1] + '0'
for i in range(L+1):
n = int(N[i])
# 更新後のdp
ni = i + 1
# ... | 42 | 50 | 719 | 828 | import sys
sys.setrecursionlimit(10**7)
N = eval(input())
# TLE ()
# DP
INF = pow(10, 8)
L = len(N)
dp = [[INF] * 2 for _ in range(L + 2)]
dp[0][0] = 0
# reverse
N = N[::-1] + "0"
for i in range(L + 1):
for j in range(2):
# 繰り下がりも加味
n = int(N[i])
n += j
# 更新後のdp
ni = i + 1
... | import sys
sys.setrecursionlimit(10**7)
N = eval(input())
# TLE (Python3 3.4.3)
# AC (PyPy3 (2.4.0))
# DP
INF = pow(10, 8)
L = len(N)
dp = [[INF] * 2 for _ in range(L + 2)]
dp[0][0] = 0
# reverse
N = N[::-1] + "0"
for i in range(L + 1):
n = int(N[i])
# 更新後のdp
ni = i + 1
# 前の桁で繰り下がりなし
# 同じだけ払う
... | false | 16 | [
"-# TLE ()",
"+# TLE (Python3 3.4.3)",
"+# AC (PyPy3 (2.4.0))",
"- for j in range(2):",
"- # 繰り下がりも加味",
"- n = int(N[i])",
"- n += j",
"- # 更新後のdp",
"- ni = i + 1",
"- # 同じだけ払う",
"- if n < 10:",
"- dp[ni][0] = min(dp[ni][0], dp[i]... | false | 0.044642 | 0.043014 | 1.037857 | [
"s769161692",
"s557318938"
] |
u656391577 | p02791 | python | s048805772 | s610671927 | 109 | 93 | 24,744 | 24,744 | Accepted | Accepted | 14.68 | N = int(eval(input()))
P = list(map(int, input().split()))
count = 0
min = P[0]
for i in range(N):
if P[i] <= min:
min = P[i]
count += 1
print(count) | N = int(eval(input()))
P = list(map(int, input().split()))
def main():
count = 0
min = P[0]
for i in range(N):
if P[i] <= min:
min = P[i]
count += 1
print(count)
main() | 12 | 13 | 177 | 224 | N = int(eval(input()))
P = list(map(int, input().split()))
count = 0
min = P[0]
for i in range(N):
if P[i] <= min:
min = P[i]
count += 1
print(count)
| N = int(eval(input()))
P = list(map(int, input().split()))
def main():
count = 0
min = P[0]
for i in range(N):
if P[i] <= min:
min = P[i]
count += 1
print(count)
main()
| false | 7.692308 | [
"-count = 0",
"-min = P[0]",
"-for i in range(N):",
"- if P[i] <= min:",
"- min = P[i]",
"- count += 1",
"-print(count)",
"+",
"+",
"+def main():",
"+ count = 0",
"+ min = P[0]",
"+ for i in range(N):",
"+ if P[i] <= min:",
"+ min = P[i]",
"+... | false | 0.041049 | 0.099989 | 0.410534 | [
"s048805772",
"s610671927"
] |
u347600233 | p02629 | python | s883586496 | s407559716 | 32 | 28 | 9,052 | 9,128 | Accepted | Accepted | 12.5 | n = int(eval(input()))
ans = ''
while n > 0:
n -= 1
ans += chr(ord('a') + n % 26)
n //= 26
print((ans[::-1])) | n = int(eval(input()))
ans = ''
while n:
n -= 1
ans += chr(ord('a') + n % 26)
n //= 26
print((ans[::-1])) | 7 | 7 | 119 | 115 | n = int(eval(input()))
ans = ""
while n > 0:
n -= 1
ans += chr(ord("a") + n % 26)
n //= 26
print((ans[::-1]))
| n = int(eval(input()))
ans = ""
while n:
n -= 1
ans += chr(ord("a") + n % 26)
n //= 26
print((ans[::-1]))
| false | 0 | [
"-while n > 0:",
"+while n:"
] | false | 0.121139 | 0.034855 | 3.47549 | [
"s883586496",
"s407559716"
] |
u648881683 | p02844 | python | s915727660 | s245916541 | 742 | 22 | 41,308 | 3,064 | Accepted | Accepted | 97.04 | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
s = str(i).zfill(3)
j = 0
flg0 = False
flg1 = False
flg2 = False
for j in S:
if not... | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
s = str(i).zfill(3)
i0 = S.find(s[0])
if i0 != -1:
i1 = S[i0+1:].find(s[1])
if i1 != -1:
... | 28 | 22 | 641 | 468 | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
s = str(i).zfill(3)
j = 0
flg0 = False
flg1 = False
flg2 = False
for j in S:
if not flg0 and j == ... | import sys
input = lambda: sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
s = str(i).zfill(3)
i0 = S.find(s[0])
if i0 != -1:
i1 = S[i0 + 1 :].find(s[1])
if i1 != -1:
i2... | false | 21.428571 | [
"- j = 0",
"- flg0 = False",
"- flg1 = False",
"- flg2 = False",
"- for j in S:",
"- if not flg0 and j == s[0]:",
"- flg0 = True",
"- elif flg0 and not flg1 and j == s[1]:",
"- flg1 = True",
"- elif f... | false | 0.087395 | 0.037808 | 2.311525 | [
"s915727660",
"s245916541"
] |
u896741788 | p03611 | python | s937537860 | s787597502 | 168 | 134 | 13,964 | 14,556 | Accepted | Accepted | 20.24 | n=int(eval(input()))
g=list(map(int,input().split()))
f=max(g)
l=[0]*(f+2)
for i in g:
for j in range(max(0,i-1),min(i+2,f+1)):
l[j]+=1
print((max(l))) | n=int(eval(input()))
from collections import Counter as co
var=co(list(map(int,input().split())))
ans=0
for k in var:
p=var[k]
if k-1 in var:p+=var[k-1]
if k+1 in var:p+=var[k+1]
ans=max(ans,p)
print(ans) | 8 | 11 | 156 | 219 | n = int(eval(input()))
g = list(map(int, input().split()))
f = max(g)
l = [0] * (f + 2)
for i in g:
for j in range(max(0, i - 1), min(i + 2, f + 1)):
l[j] += 1
print((max(l)))
| n = int(eval(input()))
from collections import Counter as co
var = co(list(map(int, input().split())))
ans = 0
for k in var:
p = var[k]
if k - 1 in var:
p += var[k - 1]
if k + 1 in var:
p += var[k + 1]
ans = max(ans, p)
print(ans)
| false | 27.272727 | [
"-g = list(map(int, input().split()))",
"-f = max(g)",
"-l = [0] * (f + 2)",
"-for i in g:",
"- for j in range(max(0, i - 1), min(i + 2, f + 1)):",
"- l[j] += 1",
"-print((max(l)))",
"+from collections import Counter as co",
"+",
"+var = co(list(map(int, input().split())))",
"+ans = 0"... | false | 0.085285 | 0.085227 | 1.000689 | [
"s937537860",
"s787597502"
] |
u029000441 | p03167 | python | s918803813 | s240517132 | 211 | 122 | 99,764 | 89,012 | Accepted | Accepted | 42.18 | #BFSにdpを乗っける
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from ... | #BFSにdpを乗っける
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from ... | 53 | 52 | 1,428 | 1,419 | # BFSにdpを乗っける
# float型を許すな
# numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq... | # BFSにdpを乗っける
# float型を許すな
# numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq... | false | 1.886792 | [
"-# print(lis)",
"-Q = deque([[0, 0]])",
"-dp = [[-1] * w for i in range(h)]",
"+dp = [[0] * w for i in range(h)]",
"-step = [[1, 0], [0, 1]]",
"-while Q:",
"- x, y = Q.popleft()",
"- for i, j in step:",
"- if x + i >= h or y + j >= w:",
"+for i in range(h):",
"+ for j in range(w... | false | 0.036128 | 0.065045 | 0.555425 | [
"s918803813",
"s240517132"
] |
u893063840 | p03576 | python | s145919500 | s077143090 | 748 | 31 | 55,260 | 3,064 | Accepted | Accepted | 95.86 | from collections import defaultdict
N, K = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 19
acc = defaultdict(int)
x = [-INF]
y = [-INF]
for ex, ey in xy:
acc[(ex, ey)] = 1
x.append(ex)
y.append(ey)
x.sort()
y.sort()
for i in range(N):
... | n, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]
INF = 10 ** 19
xy.sort()
ans = INF
for i in range(n):
for j in range(i + k - 1, n):
width = xy[j][0] - xy[i][0]
y = [xy[idx][1] for idx in range(i, j + 1)]
y.sort()
for e1, e2 in zip(y, y[k-1:]):
... | 38 | 20 | 803 | 399 | from collections import defaultdict
N, K = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(N)]
INF = 10**19
acc = defaultdict(int)
x = [-INF]
y = [-INF]
for ex, ey in xy:
acc[(ex, ey)] = 1
x.append(ex)
y.append(ey)
x.sort()
y.sort()
for i in range(N):
for j in range... | n, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]
INF = 10**19
xy.sort()
ans = INF
for i in range(n):
for j in range(i + k - 1, n):
width = xy[j][0] - xy[i][0]
y = [xy[idx][1] for idx in range(i, j + 1)]
y.sort()
for e1, e2 in zip(y, y[k ... | false | 47.368421 | [
"-from collections import defaultdict",
"-",
"-N, K = list(map(int, input().split()))",
"-xy = [list(map(int, input().split())) for _ in range(N)]",
"+n, k = list(map(int, input().split()))",
"+xy = [list(map(int, input().split())) for _ in range(n)]",
"-acc = defaultdict(int)",
"-x = [-INF]",
"-y =... | false | 0.109175 | 0.036487 | 2.992194 | [
"s145919500",
"s077143090"
] |
u773265208 | p02989 | python | s520574171 | s834910423 | 214 | 77 | 52,780 | 14,556 | Accepted | Accepted | 64.02 | n = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
ans = 0
start_num = d[int(n / 2 - 1)]
end_num = d[int(n / 2)]
ans = end_num - start_num
print(ans)
| n = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
print((d[n // 2] - d[n // 2 - 1]))
| 11 | 6 | 173 | 101 | n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
ans = 0
start_num = d[int(n / 2 - 1)]
end_num = d[int(n / 2)]
ans = end_num - start_num
print(ans)
| n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
print((d[n // 2] - d[n // 2 - 1]))
| false | 45.454545 | [
"-ans = 0",
"-start_num = d[int(n / 2 - 1)]",
"-end_num = d[int(n / 2)]",
"-ans = end_num - start_num",
"-print(ans)",
"+print((d[n // 2] - d[n // 2 - 1]))"
] | false | 0.045387 | 0.042707 | 1.062758 | [
"s520574171",
"s834910423"
] |
u773265208 | p03013 | python | s605581379 | s528066466 | 558 | 447 | 471,560 | 460,056 | Accepted | Accepted | 19.89 | import sys
n,m = list(map(int,input().split()))
t = [0] * 2
t[0] = 1
t[1] = 2
a = []
for _ in range(m):
a.append(int(eval(input())))
mod = 10**9 + 7
for i in range(1,m):
if a[i] - a[i-1] == 1:
print((0))
sys.exit()
a.append(n+1)
l = []
dan = 0
for i in range(m+1):
l.append(a[i]-1-dan)
da... | import sys
n,m = list(map(int,input().split()))
a = []
for _ in range(m):
a.append(int(eval(input())))
if n == 1:
print((1))
sys.exit()
dp = [0 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1
dp[2] = 2
if m == 0:
for i in range(2,n+1):
dp[i] = dp[i-1] + dp[i-2]
print((dp[n]%(10... | 36 | 30 | 518 | 538 | import sys
n, m = list(map(int, input().split()))
t = [0] * 2
t[0] = 1
t[1] = 2
a = []
for _ in range(m):
a.append(int(eval(input())))
mod = 10**9 + 7
for i in range(1, m):
if a[i] - a[i - 1] == 1:
print((0))
sys.exit()
a.append(n + 1)
l = []
dan = 0
for i in range(m + 1):
l.append(a[i] - 1... | import sys
n, m = list(map(int, input().split()))
a = []
for _ in range(m):
a.append(int(eval(input())))
if n == 1:
print((1))
sys.exit()
dp = [0 for _ in range(n + 1)]
dp[0] = 1
dp[1] = 1
dp[2] = 2
if m == 0:
for i in range(2, n + 1):
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[n] % (10**9 + 7... | false | 16.666667 | [
"-t = [0] * 2",
"-t[0] = 1",
"-t[1] = 2",
"-mod = 10**9 + 7",
"-for i in range(1, m):",
"- if a[i] - a[i - 1] == 1:",
"- print((0))",
"- sys.exit()",
"-a.append(n + 1)",
"-l = []",
"-dan = 0",
"-for i in range(m + 1):",
"- l.append(a[i] - 1 - dan)",
"- dan = a[i] + 1... | false | 0.045714 | 0.040752 | 1.121773 | [
"s605581379",
"s528066466"
] |
u724687935 | p02537 | python | s012232464 | s221207458 | 1,269 | 1,098 | 195,352 | 138,500 | Accepted | Accepted | 13.48 | class SegmentTree():
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
... | class SegmentTree():
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
... | 84 | 77 | 2,021 | 1,884 | class SegmentTree:
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
----------
... | class SegmentTree:
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
----------
... | false | 8.333333 | [
"-edge = [set() for _ in range(N)]",
"+dp = [1] * N",
"- edge[j].add(p1)",
"+ dp[j] = max(dp[p1] + 1, dp[j])",
"- edge[j].add(p2)",
"+ dp[j] = max(dp[p2] + 1, dp[j])",
"-dp = [1] * N",
"-for i in range(N - 1):",
"- here = dp[i]",
"- for ni in edge[i]:",
"- ... | false | 0.043989 | 0.040662 | 1.081815 | [
"s012232464",
"s221207458"
] |
u156815136 | p03745 | python | s025699089 | s396347089 | 115 | 102 | 16,328 | 14,636 | Accepted | Accepted | 11.3 | 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 deque,defaultdict
#import bisect
#
# d =... | 54 | 52 | 1,168 | 1,153 | 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 deque,defaultdict
# import bisect
#
# d = ... | false | 3.703704 | [
"-from statistics import median",
"+# from statistics import median",
"+import collections",
"-# import collections",
"-from fractions import gcd",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"-from collections import defaultdict",
"-import bisect",
"-... | false | 0.048763 | 0.125916 | 0.387268 | [
"s025699089",
"s396347089"
] |
u488401358 | p02913 | python | s647647022 | s290453014 | 1,058 | 562 | 95,504 | 209,288 | Accepted | Accepted | 46.88 | alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
alphabet={moji:alphabetlist.index(moji) for moji in alphabetlist}
N=int(eval(input()))
S=eval(input())
def condition(num):
if num==0:
return True
data=[]
x=0
for ... | N=int(eval(input()))
S=eval(input())
def condition(num):
data=[]
for i in range(0,N-num+1):
data.append((S[i:i+num],i))
data.sort()
if len(data)==1:
return False
small=data[0][1]
large=data[0][1]
for i in range(0,len(data)-1):
if data[i][0]==data[i+1... | 54 | 42 | 1,120 | 783 | alphabetlist = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
alphabet = {moji: alphabetlist.index(moji) for moji in alphabetlist... | N = int(eval(input()))
S = eval(input())
def condition(num):
data = []
for i in range(0, N - num + 1):
data.append((S[i : i + num], i))
data.sort()
if len(data) == 1:
return False
small = data[0][1]
large = data[0][1]
for i in range(0, len(data) - 1):
if data[i][0] ... | false | 22.222222 | [
"-alphabetlist = [",
"- \"a\",",
"- \"b\",",
"- \"c\",",
"- \"d\",",
"- \"e\",",
"- \"f\",",
"- \"g\",",
"- \"h\",",
"- \"i\",",
"- \"j\",",
"- \"k\",",
"- \"l\",",
"- \"m\",",
"- \"n\",",
"- \"o\",",
"- \"p\",",
"- \"q\",",
"- ... | false | 0.075677 | 0.155133 | 0.487822 | [
"s647647022",
"s290453014"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.