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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u493520238 | p02629 | python | s021136444 | s416383658 | 66 | 34 | 62,036 | 9,216 | Accepted | Accepted | 48.48 |
# def base_10_to_n(X, n):
# if (int(X/n)):
# return base_10_to_n(int(X/n), n)+str(X%n)
# return str(X%n)
# def main():
# alp = 'abcdefghijklmnopqrstuvwxyz'
# n = int(input())
# s = base_10_to_n(n-1,26)
# print(s)
# if __name__ == "__main__":
# main()
al... | alps = 'abcdefghijklmnopqrstuvwxyz'
n = int(eval(input()))
if n == 1:
print('a')
exit()
ansl = []
curr_n = n
for i in range(15, -1, -1):
if n <= pow(26,i):
continue
val = curr_n//pow(26,i)
ansl.append(val)
curr_n -= val*pow(26,i)
for j in range(100):
for i in ra... | 46 | 29 | 790 | 502 | # def base_10_to_n(X, n):
# if (int(X/n)):
# return base_10_to_n(int(X/n), n)+str(X%n)
# return str(X%n)
# def main():
# alp = 'abcdefghijklmnopqrstuvwxyz'
# n = int(input())
# s = base_10_to_n(n-1,26)
# print(s)
# if __name__ == "__main__":
# main()
alp = "abcdefghijklmnopqrstuvwxyz... | alps = "abcdefghijklmnopqrstuvwxyz"
n = int(eval(input()))
if n == 1:
print("a")
exit()
ansl = []
curr_n = n
for i in range(15, -1, -1):
if n <= pow(26, i):
continue
val = curr_n // pow(26, i)
ansl.append(val)
curr_n -= val * pow(26, i)
for j in range(100):
for i in range(len(ansl) -... | false | 36.956522 | [
"-# def base_10_to_n(X, n):",
"-# if (int(X/n)):",
"-# return base_10_to_n(int(X/n), n)+str(X%n)",
"-# return str(X%n)",
"-# def main():",
"-# alp = 'abcdefghijklmnopqrstuvwxyz'",
"-# n = int(input())",
"-# s = base_10_to_n(n-1,26)",
"-# print(s)",
"-# if __name__ =... | false | 0.036614 | 0.037437 | 0.978019 | [
"s021136444",
"s416383658"
] |
u312025627 | p02933 | python | s109063087 | s023947454 | 161 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.44 | def main():
N = int(eval(input()))
S = eval(input())
if 3200 <= N:
print(S)
else:
print("red")
if __name__ == '__main__':
main()
| def main():
N = int(eval(input()))
S = eval(input())
if N < 3200:
print("red")
else:
print(S)
if __name__ == '__main__':
main()
| 11 | 11 | 165 | 164 | def main():
N = int(eval(input()))
S = eval(input())
if 3200 <= N:
print(S)
else:
print("red")
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
S = eval(input())
if N < 3200:
print("red")
else:
print(S)
if __name__ == "__main__":
main()
| false | 0 | [
"- if 3200 <= N:",
"+ if N < 3200:",
"+ print(\"red\")",
"+ else:",
"- else:",
"- print(\"red\")"
] | false | 0.04354 | 0.044884 | 0.970054 | [
"s109063087",
"s023947454"
] |
u706786134 | p02936 | python | s192170568 | s190556634 | 1,704 | 843 | 75,012 | 96,500 | Accepted | Accepted | 50.53 | N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
C = [0] * (N + 1)
for _ in range(Q):
p, x = list(map(int, input().split()))
C[p] += x
se = set([1])
stack = [1]... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,Q = list(map(int,readline().split()))
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:N+N-2])
PX = iter(ABPX[N+N-2:])
graph = [[] for _ in range(N+1)]
for a,b in zip(AB,AB):
graph... | 26 | 33 | 547 | 684 | N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
C = [0] * (N + 1)
for _ in range(Q):
p, x = list(map(int, input().split()))
C[p] += x
se = set([1])
stack = [1]
while stack:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, Q = list(map(int, readline().split()))
ABPX = list(map(int, read().split()))
AB = iter(ABPX[: N + N - 2])
PX = iter(ABPX[N + N - 2 :])
graph = [[] for _ in range(N + 1)]
for a, b in zip(AB, AB):
g... | false | 21.212121 | [
"-N, Q = list(map(int, input().split()))",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+N, Q = list(map(int, readline().split()))",
"+ABPX = list(map(int, read().split()))",
"+AB = iter(ABPX[: N + N - 2])",... | false | 0.048264 | 0.048242 | 1.000458 | [
"s192170568",
"s190556634"
] |
u214887789 | p02959 | python | s117794218 | s045584813 | 164 | 135 | 19,004 | 18,476 | Accepted | Accepted | 17.68 | N = int( eval(input()) )
A, B = list( [int(x) for x in input().split(" ")] ), list( [int(x) for x in input().split(" ")] )
#A = monsters. B = number of to be able to kill monsters.殺せる数
def kill_monsters(Ai, Bi):
Ai -= Bi
Bi = 0
if Ai < 0:
Bi += -1*Ai
Ai = 0
return (Ai... | def read():
N = int(eval(input()))
A = list( map(int, input().split(" ")) )
B = list( map(int, input().split(" ")) )
return (N, A, B)
def kill(A, B):
if B < A:
A = A - B
B = 0
else:
B = B - A
A = 0
return (A, B)
def main(N, A, B):
... | 27 | 28 | 655 | 527 | N = int(eval(input()))
A, B = list([int(x) for x in input().split(" ")]), list(
[int(x) for x in input().split(" ")]
)
# A = monsters. B = number of to be able to kill monsters.殺せる数
def kill_monsters(Ai, Bi):
Ai -= Bi
Bi = 0
if Ai < 0:
Bi += -1 * Ai
Ai = 0
return (Ai, Bi)
def main(... | def read():
N = int(eval(input()))
A = list(map(int, input().split(" ")))
B = list(map(int, input().split(" ")))
return (N, A, B)
def kill(A, B):
if B < A:
A = A - B
B = 0
else:
B = B - A
A = 0
return (A, B)
def main(N, A, B):
for i in range(N):
... | false | 3.571429 | [
"-N = int(eval(input()))",
"-A, B = list([int(x) for x in input().split(\" \")]), list(",
"- [int(x) for x in input().split(\" \")]",
"-)",
"-# A = monsters. B = number of to be able to kill monsters.殺せる数",
"-def kill_monsters(Ai, Bi):",
"- Ai -= Bi",
"- Bi = 0",
"- if Ai < 0:",
"- ... | false | 0.045879 | 0.047058 | 0.974937 | [
"s117794218",
"s045584813"
] |
u929217794 | p02614 | python | s849757575 | s818340151 | 76 | 48 | 9,472 | 9,036 | Accepted | Accepted | 36.84 | import copy
h, w, k = list(map(int, input().split()))
ans = 0
c = []
for i in range(1, h+1):
l = eval(input())
for j in range(len(l)):
if l[j] == "#":
c.append((i, j+1))
combs = []
n_comb = 2**(h+w)
for n in range(n_comb):
combs.append(format(n, f"0{h+w}b"))
for comb in combs:
cc... | h, w, k = list(map(int, input().split()))
c = [eval(input()) for j in range(h)]
ans = 0
for rows in range(1 << h):
for cols in range(1 << w):
black = 0
for i in range(h):
if (rows >> i) & 1:
continue
for j in range(w):
if (cols >> j) & 1:
continue
bl... | 32 | 18 | 641 | 385 | import copy
h, w, k = list(map(int, input().split()))
ans = 0
c = []
for i in range(1, h + 1):
l = eval(input())
for j in range(len(l)):
if l[j] == "#":
c.append((i, j + 1))
combs = []
n_comb = 2 ** (h + w)
for n in range(n_comb):
combs.append(format(n, f"0{h+w}b"))
for comb in combs:
... | h, w, k = list(map(int, input().split()))
c = [eval(input()) for j in range(h)]
ans = 0
for rows in range(1 << h):
for cols in range(1 << w):
black = 0
for i in range(h):
if (rows >> i) & 1:
continue
for j in range(w):
if (cols >> j) & 1:
... | false | 43.75 | [
"-import copy",
"-",
"+c = [eval(input()) for j in range(h)]",
"-c = []",
"-for i in range(1, h + 1):",
"- l = eval(input())",
"- for j in range(len(l)):",
"- if l[j] == \"#\":",
"- c.append((i, j + 1))",
"-combs = []",
"-n_comb = 2 ** (h + w)",
"-for n in range(n_comb)... | false | 0.050351 | 0.048266 | 1.043197 | [
"s849757575",
"s818340151"
] |
u347640436 | p03479 | python | s876813594 | s156439059 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | x, y = list(map(int, input().split()))
result = 0
while x <= y:
result += 1
x *= 2
print(result)
| x, y = list(map(int, input().split()))
print(((y // x).bit_length())) | 6 | 2 | 100 | 62 | x, y = list(map(int, input().split()))
result = 0
while x <= y:
result += 1
x *= 2
print(result)
| x, y = list(map(int, input().split()))
print(((y // x).bit_length()))
| false | 66.666667 | [
"-result = 0",
"-while x <= y:",
"- result += 1",
"- x *= 2",
"-print(result)",
"+print(((y // x).bit_length()))"
] | false | 0.068931 | 0.069344 | 0.994047 | [
"s876813594",
"s156439059"
] |
u920103253 | p02708 | python | s421012347 | s372766617 | 145 | 61 | 30,096 | 67,792 | Accepted | Accepted | 57.93 | def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(eval(input())) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
n,k=n1()
down=[0]*(n+1)
up=[0]*(n+1)
up[0]=n
ans=0 if k>1 else n+1
for i in range(1,n+1):
... |
def s0():return eval(input())
def s1():return input().split()
def s2(n):return [eval(input()) for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(eval(input())) for _ in range(n)]
de... | 17 | 22 | 420 | 583 | def n0():
return int(eval(input()))
def n1():
return [int(x) for x in input().split()]
def n2(n):
return [int(eval(input())) for _ in range(n)]
def n3(n):
return [[int(x) for x in input().split()] for _ in range(n)]
n, k = n1()
down = [0] * (n + 1)
up = [0] * (n + 1)
up[0] = n
ans = 0 if k > 1 e... | def s0():
return eval(input())
def s1():
return input().split()
def s2(n):
return [eval(input()) for x in range(n)]
def s3(n):
return [[input().split()] for _ in range(n)]
def n0():
return int(eval(input()))
def n1():
return [int(x) for x in input().split()]
def n2(n):
return [in... | false | 22.727273 | [
"+def s0():",
"+ return eval(input())",
"+",
"+",
"+def s1():",
"+ return input().split()",
"+",
"+",
"+def s2(n):",
"+ return [eval(input()) for x in range(n)]",
"+",
"+",
"+def s3(n):",
"+ return [[input().split()] for _ in range(n)]",
"+",
"+"
] | false | 0.074963 | 0.073333 | 1.022226 | [
"s421012347",
"s372766617"
] |
u186838327 | p03141 | python | s762415869 | s171159894 | 845 | 211 | 55,712 | 81,500 | Accepted | Accepted | 75.03 | n = int(eval(input()))
AB = [[0, 0, 0] for i in range(n)]
for i in range(n):
a, b = list(map(int, input().split()))
AB[i][0] = a+b
AB[i][1] = a
AB[i][2] = b
AB.sort()
ans = 0
for i in range(n):
_, a, b = AB.pop()
if i%2 == 0:
ans += a
else:
ans -= b
print(a... | n =int(eval(input()))
AB = []
Sb = 0
for i in range(n):
a, b = list(map(int, input().split()))
AB.append(a+b)
Sb += b
AB.sort()
ans = 0
for i in range(n):
if i%2 == 0:
ans += AB.pop()
else:
AB.pop()
ans -= Sb
print(ans)
| 18 | 17 | 311 | 261 | n = int(eval(input()))
AB = [[0, 0, 0] for i in range(n)]
for i in range(n):
a, b = list(map(int, input().split()))
AB[i][0] = a + b
AB[i][1] = a
AB[i][2] = b
AB.sort()
ans = 0
for i in range(n):
_, a, b = AB.pop()
if i % 2 == 0:
ans += a
else:
ans -= b
print(ans)
| n = int(eval(input()))
AB = []
Sb = 0
for i in range(n):
a, b = list(map(int, input().split()))
AB.append(a + b)
Sb += b
AB.sort()
ans = 0
for i in range(n):
if i % 2 == 0:
ans += AB.pop()
else:
AB.pop()
ans -= Sb
print(ans)
| false | 5.555556 | [
"-AB = [[0, 0, 0] for i in range(n)]",
"+AB = []",
"+Sb = 0",
"- AB[i][0] = a + b",
"- AB[i][1] = a",
"- AB[i][2] = b",
"+ AB.append(a + b)",
"+ Sb += b",
"- _, a, b = AB.pop()",
"- ans += a",
"+ ans += AB.pop()",
"- ans -= b",
"+ AB.pop()",
"+... | false | 0.046134 | 0.158959 | 0.290225 | [
"s762415869",
"s171159894"
] |
u619379081 | p03291 | python | s135209914 | s337399896 | 1,965 | 96 | 3,188 | 3,188 | Accepted | Accepted | 95.11 | s = eval(input())
count = 0
a, qa, c, qc = 0, 0, 0, 0
def calc(x, qx, y, qy):
return ((3*x+qx) * (3*y+qy) * pow3q)
#x*y*pow(3,qx+qy)+qx*y*pow(3,qx+qy-1)+x*qy*pow(3,qx+qy-1)+qx*qy*pow(3,qx+qy-2)
for i in range(len(s)):
if s[i] == 'C':
c += 1
elif s[i] == '?':
qc += 1
else:
... | s = eval(input())
count = 0
a, c, q = 0, 0, 0
for i in range(len(s)):
if s[i] == 'C':
c += 1
elif s[i] == '?':
q += 1
else:
continue
c = 3 * c + q
p = pow(3, q-3)
for i in range(len(s)):
if s[i] == 'A':
a += 3
elif s[i] == 'C':
c -= 3
elif... | 26 | 24 | 626 | 450 | s = eval(input())
count = 0
a, qa, c, qc = 0, 0, 0, 0
def calc(x, qx, y, qy):
return (3 * x + qx) * (3 * y + qy) * pow3q
# x*y*pow(3,qx+qy)+qx*y*pow(3,qx+qy-1)+x*qy*pow(3,qx+qy-1)+qx*qy*pow(3,qx+qy-2)
for i in range(len(s)):
if s[i] == "C":
c += 1
elif s[i] == "?":
qc += 1
else:
... | s = eval(input())
count = 0
a, c, q = 0, 0, 0
for i in range(len(s)):
if s[i] == "C":
c += 1
elif s[i] == "?":
q += 1
else:
continue
c = 3 * c + q
p = pow(3, q - 3)
for i in range(len(s)):
if s[i] == "A":
a += 3
elif s[i] == "C":
c -= 3
elif s[i] == "B":
... | false | 7.692308 | [
"-a, qa, c, qc = 0, 0, 0, 0",
"-",
"-",
"-def calc(x, qx, y, qy):",
"- return (3 * x + qx) * (3 * y + qy) * pow3q",
"-",
"-",
"-# x*y*pow(3,qx+qy)+qx*y*pow(3,qx+qy-1)+x*qy*pow(3,qx+qy-1)+qx*qy*pow(3,qx+qy-2)",
"+a, c, q = 0, 0, 0",
"- qc += 1",
"+ q += 1",
"-pow3q = pow(3, qc ... | false | 0.122751 | 0.034944 | 3.512793 | [
"s135209914",
"s337399896"
] |
u981931040 | p02994 | python | s985668154 | s869148532 | 29 | 17 | 3,444 | 3,060 | Accepted | Accepted | 41.38 | import copy
N,L = list(map(int,input().split()))
flaver = []
for i in range(1,N + 1):
flaver.append(L + i - 1)
flaver_sum = sum(flaver)
for i in range(len(flaver)):
c_flaver = copy.deepcopy(flaver)
del c_flaver[i]
if i == 0:
tmp_min = abs(flaver_sum - sum(c_flaver))
index = i
... | N, L = list(map(int, input().split()))
apples = [i + L for i in range(N)]
apple_pie = sum(apples)
ans = float('inf')
for apple in apples:
if ans > abs(apple):
ans = abs(apple)
val = apple
print((sum(apples) - val)) | 17 | 9 | 474 | 234 | import copy
N, L = list(map(int, input().split()))
flaver = []
for i in range(1, N + 1):
flaver.append(L + i - 1)
flaver_sum = sum(flaver)
for i in range(len(flaver)):
c_flaver = copy.deepcopy(flaver)
del c_flaver[i]
if i == 0:
tmp_min = abs(flaver_sum - sum(c_flaver))
index = i
if ... | N, L = list(map(int, input().split()))
apples = [i + L for i in range(N)]
apple_pie = sum(apples)
ans = float("inf")
for apple in apples:
if ans > abs(apple):
ans = abs(apple)
val = apple
print((sum(apples) - val))
| false | 47.058824 | [
"-import copy",
"-",
"-flaver = []",
"-for i in range(1, N + 1):",
"- flaver.append(L + i - 1)",
"-flaver_sum = sum(flaver)",
"-for i in range(len(flaver)):",
"- c_flaver = copy.deepcopy(flaver)",
"- del c_flaver[i]",
"- if i == 0:",
"- tmp_min = abs(flaver_sum - sum(c_flaver)... | false | 0.066988 | 0.04702 | 1.424666 | [
"s985668154",
"s869148532"
] |
u970197315 | p03449 | python | s083115620 | s882300123 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | from itertools import accumulate
n=int(eval(input()))
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
a2=[0]+a2
a1=list(accumulate(a1))
a2=list(accumulate(a2))
ans=0
s=a2[-1]
for i in range(n):
t=0
t+=a1[i]
t+=s-a2[i]
ans=max(t,ans)
print(ans) | n=int(eval(input()))
a1=list(map(int,input().split()))
a2=[0]+list(map(int,input().split()))
from itertools import accumulate
a1=list(accumulate(a1))
a2=list(accumulate(a2))
ans=0
for i in range(n):
t=a1[i]+a2[-1]-a2[i]
ans=max(ans,t)
print(ans) | 15 | 11 | 287 | 253 | from itertools import accumulate
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a2 = [0] + a2
a1 = list(accumulate(a1))
a2 = list(accumulate(a2))
ans = 0
s = a2[-1]
for i in range(n):
t = 0
t += a1[i]
t += s - a2[i]
ans = max(t, ans)
print(ans)
| n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = [0] + list(map(int, input().split()))
from itertools import accumulate
a1 = list(accumulate(a1))
a2 = list(accumulate(a2))
ans = 0
for i in range(n):
t = a1[i] + a2[-1] - a2[i]
ans = max(ans, t)
print(ans)
| false | 26.666667 | [
"+n = int(eval(input()))",
"+a1 = list(map(int, input().split()))",
"+a2 = [0] + list(map(int, input().split()))",
"-n = int(eval(input()))",
"-a1 = list(map(int, input().split()))",
"-a2 = list(map(int, input().split()))",
"-a2 = [0] + a2",
"-s = a2[-1]",
"- t = 0",
"- t += a1[i]",
"- ... | false | 0.048589 | 0.05026 | 0.966761 | [
"s083115620",
"s882300123"
] |
u562935282 | p03457 | python | s996543613 | s316254630 | 333 | 165 | 3,060 | 3,064 | Accepted | Accepted | 50.45 | def main():
n = int(eval(input()))
pt, px, py = 0, 0, 0
for _ in range(n):
t, x, y = list(map(int, input().split()))
dt = t - pt
dx = abs(x - px)
dy = abs(y - py)
if (dx + dy) % 2 != dt % 2:
print('No')
return
if (dx + dy) ... | def main():
import sys
input = sys.stdin.readline
N = int(eval(input()))
pt, px, py = 0, 0, 0
for _ in range(N):
t, x, y = list(map(int, input().split()))
dt = t - pt
dx = abs(x - px)
dy = abs(y - py)
dl = dx + dy
if dt < dl or dl % 2 ... | 20 | 25 | 421 | 460 | def main():
n = int(eval(input()))
pt, px, py = 0, 0, 0
for _ in range(n):
t, x, y = list(map(int, input().split()))
dt = t - pt
dx = abs(x - px)
dy = abs(y - py)
if (dx + dy) % 2 != dt % 2:
print("No")
return
if (dx + dy) > dt:
... | def main():
import sys
input = sys.stdin.readline
N = int(eval(input()))
pt, px, py = 0, 0, 0
for _ in range(N):
t, x, y = list(map(int, input().split()))
dt = t - pt
dx = abs(x - px)
dy = abs(y - py)
dl = dx + dy
if dt < dl or dl % 2 != dt % 2:
... | false | 20 | [
"- n = int(eval(input()))",
"+ import sys",
"+",
"+ input = sys.stdin.readline",
"+ N = int(eval(input()))",
"- for _ in range(n):",
"+ for _ in range(N):",
"- if (dx + dy) % 2 != dt % 2:",
"+ dl = dx + dy",
"+ if dt < dl or dl % 2 != dt % 2:",
"- if... | false | 0.136183 | 0.156364 | 0.870934 | [
"s996543613",
"s316254630"
] |
u800058906 | p03860 | python | s204978867 | s597859362 | 28 | 25 | 9,028 | 9,024 | Accepted | Accepted | 10.71 | a,b,c=list(map(str,input().split()))
c=b[0]
print(('A'+c+'C'))
| xs = input().split()
print(("A"+xs[1][0]+"C")) | 3 | 3 | 63 | 48 | a, b, c = list(map(str, input().split()))
c = b[0]
print(("A" + c + "C"))
| xs = input().split()
print(("A" + xs[1][0] + "C"))
| false | 0 | [
"-a, b, c = list(map(str, input().split()))",
"-c = b[0]",
"-print((\"A\" + c + \"C\"))",
"+xs = input().split()",
"+print((\"A\" + xs[1][0] + \"C\"))"
] | false | 0.037889 | 0.075086 | 0.504611 | [
"s204978867",
"s597859362"
] |
u011555727 | p02706 | python | s677477566 | s329206375 | 31 | 28 | 9,824 | 9,876 | Accepted | Accepted | 9.68 | n,m=list(map(int,input().split(' ')))
a=list(map(int,input().split(' ')))
asum=sum(a)
if(n-asum)<0:
print("-1")
exit()
else:
print((n-asum))
exit()
| n,m=list(map(int,input().split(' ')))
a=list(map(int,input().split(' ')))
asum=sum(a)
if(n-asum)<0:
print("-1")
else:
print((n-asum))
| 10 | 8 | 166 | 142 | n, m = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
asum = sum(a)
if (n - asum) < 0:
print("-1")
exit()
else:
print((n - asum))
exit()
| n, m = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
asum = sum(a)
if (n - asum) < 0:
print("-1")
else:
print((n - asum))
| false | 20 | [
"- exit()",
"- exit()"
] | false | 0.050446 | 0.047897 | 1.053227 | [
"s677477566",
"s329206375"
] |
u678246254 | p02621 | python | s389180046 | s154013540 | 30 | 26 | 9,084 | 9,152 | Accepted | Accepted | 13.33 | a = int(eval(input()))
print((a*((a+1)*(a+1)-a))) | a = int(eval(input()))
print((a+a*a+a*a*a)) | 2 | 2 | 42 | 36 | a = int(eval(input()))
print((a * ((a + 1) * (a + 1) - a)))
| a = int(eval(input()))
print((a + a * a + a * a * a))
| false | 0 | [
"-print((a * ((a + 1) * (a + 1) - a)))",
"+print((a + a * a + a * a * a))"
] | false | 0.045454 | 0.079238 | 0.573639 | [
"s389180046",
"s154013540"
] |
u150984829 | p02414 | python | s556565506 | s537173585 | 150 | 130 | 6,796 | 6,580 | Accepted | Accepted | 13.33 | import sys
e=[list(map(int,e.split()))for e in sys.stdin]
n=e[0][0]+1
t=''
for c in e[1:n]:
for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '
t=t[:-1]+'\n'
print((t[:-1]))
| import sys
e=[list(map(int,e.split()))for e in sys.stdin]
n=e[0][0]+1
[print(*[sum(s*t for s,t in zip(c,l))for l in zip(*e[n:])])for c in e[1:n]]
| 8 | 4 | 188 | 149 | import sys
e = [list(map(int, e.split())) for e in sys.stdin]
n = e[0][0] + 1
t = ""
for c in e[1:n]:
for l in zip(*e[n:]):
t += f"{sum(s*t for s,t in zip(c,l))} "
t = t[:-1] + "\n"
print((t[:-1]))
| import sys
e = [list(map(int, e.split())) for e in sys.stdin]
n = e[0][0] + 1
[print(*[sum(s * t for s, t in zip(c, l)) for l in zip(*e[n:])]) for c in e[1:n]]
| false | 50 | [
"-t = \"\"",
"-for c in e[1:n]:",
"- for l in zip(*e[n:]):",
"- t += f\"{sum(s*t for s,t in zip(c,l))} \"",
"- t = t[:-1] + \"\\n\"",
"-print((t[:-1]))",
"+[print(*[sum(s * t for s, t in zip(c, l)) for l in zip(*e[n:])]) for c in e[1:n]]"
] | false | 0.035235 | 0.056884 | 0.619418 | [
"s556565506",
"s537173585"
] |
u150984829 | p02257 | python | s607520797 | s658853159 | 60 | 50 | 5,624 | 6,216 | Accepted | Accepted | 16.67 | import sys
eval(input())
def f():print((sum(2 in[x,pow(2,x,x)]for x in map(int,sys.stdin))))
f()
| import sys
eval(input())
print((sum(2 in[x,pow(2,x,x)]for x in map(int,sys.stdin.readlines()))))
| 4 | 3 | 92 | 91 | import sys
eval(input())
def f():
print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin))))
f()
| import sys
eval(input())
print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin.readlines()))))
| false | 25 | [
"-",
"-",
"-def f():",
"- print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin))))",
"-",
"-",
"-f()",
"+print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin.readlines()))))"
] | false | 0.037126 | 0.038138 | 0.973472 | [
"s607520797",
"s658853159"
] |
u098012509 | p02608 | python | s407459943 | s268909403 | 432 | 141 | 10,100 | 78,940 | Accepted | Accepted | 67.36 | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
c = collections.Counter()
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
if x * x + y * y + z * z + x ... | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
c = collections.Counter()
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
c[x * x + y * y + z * z + x *... | 27 | 25 | 545 | 439 | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
c = collections.Counter()
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
if x * x + y * y + z * z + x * y + y * z + z * x >... | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
c = collections.Counter()
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
c[x * x + y * y + z * z + x * y + y * z + z * x] +... | false | 7.407407 | [
"- if x * x + y * y + z * z + x * y + y * z + z * x >= 10001:",
"- continue"
] | false | 2.118943 | 1.346754 | 1.57337 | [
"s407459943",
"s268909403"
] |
u624475441 | p03739 | python | s742389924 | s464316110 | 173 | 140 | 14,464 | 14,468 | Accepted | Accepted | 19.08 | n = int(eval(input()))
a = list(map(int,input().split()))
sum1 = sum2 = cost1 = cost2 = 0
for i in range(n):
cur = a[i]
sum1 += cur
if (sum1<=0, sum1>=0)[i%2]:
cost1 += 1+sum1*[-1,1][i%2]
sum1 = [1,-1][i%2]
sum2 += cur
if (sum2>=0, sum2<=0)[i%2]:
cost2 += 1+sum2*[1... | def solve():
n = int(eval(input()))
a = list(map(int,input().split()))
sum1 = sum2 = cost1 = cost2 = 0
for i in range(n):
cur = a[i]
sum1 += cur
if (sum1<=0, sum1>=0)[i%2]:
cost1 += 1+sum1*[-1,1][i%2]
sum1 = [1,-1][i%2]
sum2 += cur
... | 14 | 17 | 377 | 488 | n = int(eval(input()))
a = list(map(int, input().split()))
sum1 = sum2 = cost1 = cost2 = 0
for i in range(n):
cur = a[i]
sum1 += cur
if (sum1 <= 0, sum1 >= 0)[i % 2]:
cost1 += 1 + sum1 * [-1, 1][i % 2]
sum1 = [1, -1][i % 2]
sum2 += cur
if (sum2 >= 0, sum2 <= 0)[i % 2]:
cost2 ... | def solve():
n = int(eval(input()))
a = list(map(int, input().split()))
sum1 = sum2 = cost1 = cost2 = 0
for i in range(n):
cur = a[i]
sum1 += cur
if (sum1 <= 0, sum1 >= 0)[i % 2]:
cost1 += 1 + sum1 * [-1, 1][i % 2]
sum1 = [1, -1][i % 2]
sum2 += cur... | false | 17.647059 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-sum1 = sum2 = cost1 = cost2 = 0",
"-for i in range(n):",
"- cur = a[i]",
"- sum1 += cur",
"- if (sum1 <= 0, sum1 >= 0)[i % 2]:",
"- cost1 += 1 + sum1 * [-1, 1][i % 2]",
"- sum1 = [1, -1][i % 2]",
"- sum2... | false | 0.036759 | 0.043159 | 0.851706 | [
"s742389924",
"s464316110"
] |
u083960235 | p02753 | python | s160046471 | s188594899 | 113 | 35 | 5,584 | 4,148 | Accepted | Accepted | 69.03 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 26 | 26 | 808 | 827 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 0 | [
"-from fractions import gcd",
"+from heapq import heapify, heappop, heappush",
"-s = eval(input())",
"-if s[0] == s[1] == s[2]:",
"+S = eval(input())",
"+if S[0] == S[1] == S[2]:"
] | false | 0.047839 | 0.038039 | 1.257633 | [
"s160046471",
"s188594899"
] |
u936985471 | p02803 | python | s614854889 | s877215428 | 637 | 458 | 3,316 | 9,512 | Accepted | Accepted | 28.1 | # すべてのスタートを試し、最大値の最大値を取る
import sys
readline = sys.stdin.readline
H,W = list(map(int,readline().split()))
grid = [readline().rstrip() for i in range(H)]
ans = 0
cases = ((0,1),(0,-1),(1,0),(-1,0))
from collections import deque
for i in range(H):
for j in range(W):
q = deque([[i,j,0]])
visited... | import sys
readline = sys.stdin.readline
H,W = list(map(int,readline().split()))
S = [None] * H
for i in range(H):
S[i] = readline().rstrip()
ans = 0
from collections import deque
cases = ((1,0),(-1,0),(0,1),(0,-1))
for i in range(H):
for j in range(W):
q = deque([[i,j,0]])
seen = set()
... | 28 | 29 | 678 | 635 | # すべてのスタートを試し、最大値の最大値を取る
import sys
readline = sys.stdin.readline
H, W = list(map(int, readline().split()))
grid = [readline().rstrip() for i in range(H)]
ans = 0
cases = ((0, 1), (0, -1), (1, 0), (-1, 0))
from collections import deque
for i in range(H):
for j in range(W):
q = deque([[i, j, 0]])
v... | import sys
readline = sys.stdin.readline
H, W = list(map(int, readline().split()))
S = [None] * H
for i in range(H):
S[i] = readline().rstrip()
ans = 0
from collections import deque
cases = ((1, 0), (-1, 0), (0, 1), (0, -1))
for i in range(H):
for j in range(W):
q = deque([[i, j, 0]])
seen = s... | false | 3.448276 | [
"-# すべてのスタートを試し、最大値の最大値を取る",
"-grid = [readline().rstrip() for i in range(H)]",
"+S = [None] * H",
"+for i in range(H):",
"+ S[i] = readline().rstrip()",
"-cases = ((0, 1), (0, -1), (1, 0), (-1, 0))",
"+cases = ((1, 0), (-1, 0), (0, 1), (0, -1))",
"- visited = [[False] * W for i in range(H)]... | false | 0.039352 | 0.043091 | 0.913224 | [
"s614854889",
"s877215428"
] |
u281303342 | p03804 | python | s663089952 | s878478100 | 155 | 33 | 3,064 | 3,064 | Accepted | Accepted | 78.71 | import sys
N,M = list(map(int,input().split()))
A,B = [],[]
for i in range(N):
A.append(eval(input()))
for i in range(M):
B.append(eval(input()))
for i in range(N-M+1):
for j in range(N-M+1):
ans = True
for ii in range(M):
for jj in range(M):
if A[i+... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 20 | 29 | 441 | 784 | import sys
N, M = list(map(int, input().split()))
A, B = [], []
for i in range(N):
A.append(eval(input()))
for i in range(M):
B.append(eval(input()))
for i in range(N - M + 1):
for j in range(N - M + 1):
ans = True
for ii in range(M):
for jj in range(M):
if A[i +... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 31.034483 | [
"+# Python3 (3.4.3)",
"+input = sys.stdin.readline",
"+# function",
"+# main",
"-A, B = [], []",
"-for i in range(N):",
"- A.append(eval(input()))",
"-for i in range(M):",
"- B.append(eval(input()))",
"-for i in range(N - M + 1):",
"- for j in range(N - M + 1):",
"- ans = True"... | false | 0.060367 | 0.036979 | 1.632487 | [
"s663089952",
"s878478100"
] |
u591503175 | p03565 | python | s665982866 | s744853437 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | def resolve():
'''
code here
'''
S_dash = input()
T = input()
is_flag = False
res = ''
res_list = ['zzzzz']
for i in range(len(S_dash) - len(T) +1):
res = S_dash[:i]
# print(i, res)
if len(S_dash) - len(res) >= len(T):
for j in ran... | def resolve():
'''
code here
'''
S_dash = input()[::-1]
T = input()[::-1]
is_flag = False
res = ''
for i in range(len(S_dash)):
res = S_dash[:i]
# print(res)
if len(S_dash) - len(res) >= len(T):
for j in range(len(T)):
... | 41 | 36 | 940 | 824 | def resolve():
"""
code here
"""
S_dash = input()
T = input()
is_flag = False
res = ""
res_list = ["zzzzz"]
for i in range(len(S_dash) - len(T) + 1):
res = S_dash[:i]
# print(i, res)
if len(S_dash) - len(res) >= len(T):
for j in range(len(T)):
... | def resolve():
"""
code here
"""
S_dash = input()[::-1]
T = input()[::-1]
is_flag = False
res = ""
for i in range(len(S_dash)):
res = S_dash[:i]
# print(res)
if len(S_dash) - len(res) >= len(T):
for j in range(len(T)):
if S_dash[i + j] ... | false | 12.195122 | [
"- S_dash = input()",
"- T = input()",
"+ S_dash = input()[::-1]",
"+ T = input()[::-1]",
"- res_list = [\"zzzzz\"]",
"- for i in range(len(S_dash) - len(T) + 1):",
"+ for i in range(len(S_dash)):",
"- # print(i, res)",
"+ # print(res)",
"- res += ... | false | 0.042104 | 0.04337 | 0.970807 | [
"s665982866",
"s744853437"
] |
u489959379 | p02708 | python | s723481410 | s601772370 | 133 | 106 | 9,164 | 9,176 | Accepted | Accepted | 20.3 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, k = list(map(int, input().split()))
res = 0
for i in range(k, n + 2):
mi = (i - 1) * i // 2
ma = n * (n + 1) // 2 - (n - i) * (n - i + 1) // 2
res += ma - mi + 1
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, k = list(map(int, input().split()))
res = 0
for i in range(k, n + 2):
mi = (i - 1) * i // 2
ma = (n + (n - i + 1)) * i // 2
res += ma - mi ... | 22 | 22 | 394 | 401 | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, k = list(map(int, input().split()))
res = 0
for i in range(k, n + 2):
mi = (i - 1) * i // 2
ma = n * (n + 1) // 2 - (n - i) * (n - i + 1) // 2
res += ma - mi + 1
res %= mod
p... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, k = list(map(int, input().split()))
res = 0
for i in range(k, n + 2):
mi = (i - 1) * i // 2
ma = (n + (n - i + 1)) * i // 2
res += ma - mi + 1
res %= m... | false | 0 | [
"+input = sys.stdin.readline",
"- ma = n * (n + 1) // 2 - (n - i) * (n - i + 1) // 2",
"+ ma = (n + (n - i + 1)) * i // 2"
] | false | 0.05757 | 0.143095 | 0.402318 | [
"s723481410",
"s601772370"
] |
u228232845 | p03861 | python | s297871087 | s781037086 | 30 | 26 | 9,100 | 9,092 | Accepted | Accepted | 13.33 | import sys
def input(): return sys.stdin.readline().strip()
def I(): return int(eval(input()))
def LI(): return list(map(int, input().split()))
a, b, x = LI()
acnt = (a - 1) // x
bcnt = b // x
ans = bcnt - acnt
print(ans)
| import sys
def input(): return sys.stdin.readline().strip()
def I(): return int(eval(input()))
def LI(): return list(map(int, input().split()))
a, b, x = LI()
acnt = (a - 1) // x if a > 0 else -1
bcnt = b // x if b != 0 else 1
ans = bcnt - acnt if not(a == b == 0) else 1
print(ans)
| 13 | 13 | 232 | 293 | import sys
def input():
return sys.stdin.readline().strip()
def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
a, b, x = LI()
acnt = (a - 1) // x
bcnt = b // x
ans = bcnt - acnt
print(ans)
| import sys
def input():
return sys.stdin.readline().strip()
def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
a, b, x = LI()
acnt = (a - 1) // x if a > 0 else -1
bcnt = b // x if b != 0 else 1
ans = bcnt - acnt if not (a == b == 0) else 1
print(ans)
| false | 0 | [
"-acnt = (a - 1) // x",
"-bcnt = b // x",
"-ans = bcnt - acnt",
"+acnt = (a - 1) // x if a > 0 else -1",
"+bcnt = b // x if b != 0 else 1",
"+ans = bcnt - acnt if not (a == b == 0) else 1"
] | false | 0.078244 | 0.035091 | 2.229771 | [
"s297871087",
"s781037086"
] |
u282228874 | p03163 | python | s289927863 | s438832407 | 679 | 299 | 171,528 | 42,092 | Accepted | Accepted | 55.96 | N,W = list(map(int,input().split()))
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
w,v = list(map(int,input().split()))
for j in range(W+1):
if j < w:
dp[i+1][j] = dp[i][j]
else:
dp[i+1][j] = max(dp[i][j-w]+v,dp[i][j])
print((dp[N][W])) | N,W = list(map(int, input().split()))
dp = [0]*(W+1)
for _ in range(N):
w,v = list(map(int,input().split()))
for i in range(W,-1,-1):
if i-w < 0:
continue
dp[i] = max(dp[i], dp[i-w]+v)
print((max(dp)))
| 10 | 9 | 303 | 232 | N, W = list(map(int, input().split()))
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W + 1):
if j < w:
dp[i + 1][j] = dp[i][j]
else:
dp[i + 1][j] = max(dp[i][j - w] + v, dp[i][j])
print((dp[... | N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(W, -1, -1):
if i - w < 0:
continue
dp[i] = max(dp[i], dp[i - w] + v)
print((max(dp)))
| false | 10 | [
"-dp = [[0 for i in range(W + 1)] for j in range(N + 1)]",
"-for i in range(N):",
"+dp = [0] * (W + 1)",
"+for _ in range(N):",
"- for j in range(W + 1):",
"- if j < w:",
"- dp[i + 1][j] = dp[i][j]",
"- else:",
"- dp[i + 1][j] = max(dp[i][j - w] + v, dp[i][j])"... | false | 0.059363 | 0.108771 | 0.545765 | [
"s289927863",
"s438832407"
] |
u608088992 | p03579 | python | s015633989 | s138067818 | 346 | 308 | 31,160 | 26,772 | Accepted | Accepted | 10.98 | import sys
sys.setrecursionlimit(100000)
F = sys.stdin
N, M = list(map(int, F.readline().strip("\n").split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
A, B = list(map(int, F.readline().strip("\n").split()))
Edge[A-1].append(B-1)
Edge[B-1].append(A-1)
Color = [0] * N
def dfs(v, c):
... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
Edge[a-1].append(b-1)
Edge[b-1].append(a-1)
Col = [-1] *... | 27 | 37 | 628 | 931 | import sys
sys.setrecursionlimit(100000)
F = sys.stdin
N, M = list(map(int, F.readline().strip("\n").split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
A, B = list(map(int, F.readline().strip("\n").split()))
Edge[A - 1].append(B - 1)
Edge[B - 1].append(A - 1)
Color = [0] * N
def dfs(v, c):
Co... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Edge = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
Edge[a - 1].append(b - 1)
Edge[b - 1].append(a - 1)
Col = [-1] * N... | false | 27.027027 | [
"-",
"-sys.setrecursionlimit(100000)",
"-F = sys.stdin",
"-N, M = list(map(int, F.readline().strip(\"\\n\").split()))",
"-Edge = [[] for _ in range(N)]",
"-for _ in range(M):",
"- A, B = list(map(int, F.readline().strip(\"\\n\").split()))",
"- Edge[A - 1].append(B - 1)",
"- Edge[B - 1].appe... | false | 0.042688 | 0.045719 | 0.933712 | [
"s015633989",
"s138067818"
] |
u977389981 | p03672 | python | s453060006 | s319357465 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | S = list(eval(input()))
for i in range(len(S)):
del S[-1]
if len(S) % 2 == 0:
if S[0:len(S)//2-1] == S[len(S)//2:-1]:
print((len(S)))
break | S = list(eval(input()))
for i in range(len(S)):
del S[- 1]
if len(S) % 2 == 0:
if S[: len(S) // 2] == S[len(S) // 2 :]:
print((len(S)))
break | 8 | 7 | 179 | 179 | S = list(eval(input()))
for i in range(len(S)):
del S[-1]
if len(S) % 2 == 0:
if S[0 : len(S) // 2 - 1] == S[len(S) // 2 : -1]:
print((len(S)))
break
| S = list(eval(input()))
for i in range(len(S)):
del S[-1]
if len(S) % 2 == 0:
if S[: len(S) // 2] == S[len(S) // 2 :]:
print((len(S)))
break
| false | 12.5 | [
"- if S[0 : len(S) // 2 - 1] == S[len(S) // 2 : -1]:",
"+ if S[: len(S) // 2] == S[len(S) // 2 :]:"
] | false | 0.042491 | 0.042818 | 0.992374 | [
"s453060006",
"s319357465"
] |
u102278909 | p02993 | python | s942959170 | s942400412 | 190 | 168 | 38,384 | 38,444 | Accepted | Accepted | 11.58 | # coding: utf-8
import sys
def input(): return sys.stdin.readline().strip()
# N = int(input())
# L = [int(x) for x in input().split()]
# N, M = map(int, input().split())
S = eval(input())
flag = False
for i in range(3):
if S[i] == S[i + 1]:
flag = True
print(("Bad" if flag else "Good"))
| # coding: utf-8
import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return... | 16 | 25 | 311 | 639 | # coding: utf-8
import sys
def input():
return sys.stdin.readline().strip()
# N = int(input())
# L = [int(x) for x in input().split()]
# N, M = map(int, input().split())
S = eval(input())
flag = False
for i in range(3):
if S[i] == S[i + 1]:
flag = True
print(("Bad" if flag else "Good"))
| # coding: utf-8
import sys
import math
import collections
import itertools
INF = 10**10
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def gcd(x, y):
return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y):
return (x * y) // gcd(x, y)
def I():
return int(input())
def LI():
... | false | 36 | [
"+import math",
"+import collections",
"+import itertools",
"+",
"+INF = 10**10",
"+MOD = 10**9 + 7",
"-# N = int(input())",
"-# L = [int(x) for x in input().split()]",
"-# N, M = map(int, input().split())",
"-S = eval(input())",
"-flag = False",
"+def gcd(x, y):",
"+ return y if x % y ==... | false | 0.034329 | 0.035746 | 0.960353 | [
"s942959170",
"s942400412"
] |
u201234972 | p02929 | python | s471738802 | s480693133 | 199 | 78 | 41,324 | 3,572 | Accepted | Accepted | 60.8 | import sys
input = sys.stdin.readline
Q = 10**9+7
def main():
N = int( eval(input()))
S = eval(input())
left = 0
ans = 1
for i in range(N*2):
s = S[i]
if s == "B":
if left%2 == 0:
left += 1
else:
ans *= left
... | # import sys
# input = sys.stdin.readline
Q = 10**9+7
def main():
N = int( eval(input()))
S = eval(input())
left = 0
ans = 1
# for i in range(N*2):
# s = S[i]
for s in S:
if s == "B":
if left%2 == 0:
left += 1
else:
... | 32 | 33 | 676 | 702 | import sys
input = sys.stdin.readline
Q = 10**9 + 7
def main():
N = int(eval(input()))
S = eval(input())
left = 0
ans = 1
for i in range(N * 2):
s = S[i]
if s == "B":
if left % 2 == 0:
left += 1
else:
ans *= left
... | # import sys
# input = sys.stdin.readline
Q = 10**9 + 7
def main():
N = int(eval(input()))
S = eval(input())
left = 0
ans = 1
# for i in range(N*2):
# s = S[i]
for s in S:
if s == "B":
if left % 2 == 0:
left += 1
else:
ans... | false | 3.030303 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"+# import sys",
"+# input = sys.stdin.readline",
"- for i in range(N * 2):",
"- s = S[i]",
"+ # for i in range(N*2):",
"+ # s = S[i]",
"+ for s in S:"
] | false | 0.100118 | 0.090165 | 1.110389 | [
"s471738802",
"s480693133"
] |
u891516200 | p02660 | python | s884783349 | s426093464 | 148 | 124 | 9,432 | 9,488 | Accepted | Accepted | 16.22 | use_list = []
def make_prime(n):
array = {}
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt = cnt + 1
temp = temp // i
array[i] = cnt
if temp != 1:
a... | import math
import sys
from collections import Counter
import time
N = int(eval(input()))
Ns = N
def create_sosu(n, max, Nso):
for i in range(2, max+1):
if n % i == 0:
while n % i == 0:
n = n // i
Nso.append(i)
return create_sosu(n,... | 42 | 56 | 818 | 1,087 | use_list = []
def make_prime(n):
array = {}
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt = cnt + 1
temp = temp // i
array[i] = cnt
if temp != 1:
array[temp]... | import math
import sys
from collections import Counter
import time
N = int(eval(input()))
Ns = N
def create_sosu(n, max, Nso):
for i in range(2, max + 1):
if n % i == 0:
while n % i == 0:
n = n // i
Nso.append(i)
return create_sosu(n, int(math.sqrt(... | false | 25 | [
"-use_list = []",
"+import math",
"+import sys",
"+from collections import Counter",
"+import time",
"+",
"+N = int(eval(input()))",
"+Ns = N",
"-def make_prime(n):",
"- array = {}",
"- temp = n",
"- for i in range(2, int(-(-(n**0.5) // 1)) + 1):",
"- if temp % i == 0:",
"-... | false | 0.074018 | 0.052807 | 1.401668 | [
"s884783349",
"s426093464"
] |
u762420987 | p03048 | python | s240653781 | s366172320 | 316 | 246 | 40,940 | 40,812 | Accepted | Accepted | 22.15 | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range(N // G + 1):
b = (N - R * r - G * g) / B
if b == int(b) and b >= 0:
ans += 1
print(ans)
| R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N//R + 1):
for g in range((N - R*r)//G + 1):
b = (N - (R*r+G*g)) / B
if b == int(b):
ans += 1
print(ans)
| 8 | 8 | 217 | 206 | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range(N // G + 1):
b = (N - R * r - G * g) / B
if b == int(b) and b >= 0:
ans += 1
print(ans)
| R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range((N - R * r) // G + 1):
b = (N - (R * r + G * g)) / B
if b == int(b):
ans += 1
print(ans)
| false | 0 | [
"- for g in range(N // G + 1):",
"- b = (N - R * r - G * g) / B",
"- if b == int(b) and b >= 0:",
"+ for g in range((N - R * r) // G + 1):",
"+ b = (N - (R * r + G * g)) / B",
"+ if b == int(b):"
] | false | 0.159966 | 0.110046 | 1.453627 | [
"s240653781",
"s366172320"
] |
u863370423 | p02958 | python | s433325163 | s759911031 | 95 | 29 | 61,692 | 9,092 | Accepted | Accepted | 69.47 | n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(n):
if p[i]!=i+1:
c+=1
if c>2:
print("NO")
else:
print("YES") | x = int(eval(input()))
p = list(map(int, input().strip().split()))
k = sorted(p)
count = 0
for i in range(0,x):
if p[i] == k[i]:
count += 1
if (x - count) == 2 or (x - count) == 0:
print('YES')
else:
print('NO')
| 10 | 12 | 164 | 238 | n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(n):
if p[i] != i + 1:
c += 1
if c > 2:
print("NO")
else:
print("YES")
| x = int(eval(input()))
p = list(map(int, input().strip().split()))
k = sorted(p)
count = 0
for i in range(0, x):
if p[i] == k[i]:
count += 1
if (x - count) == 2 or (x - count) == 0:
print("YES")
else:
print("NO")
| false | 16.666667 | [
"-n = int(eval(input()))",
"-p = list(map(int, input().split()))",
"-c = 0",
"-for i in range(n):",
"- if p[i] != i + 1:",
"- c += 1",
"-if c > 2:",
"+x = int(eval(input()))",
"+p = list(map(int, input().strip().split()))",
"+k = sorted(p)",
"+count = 0",
"+for i in range(0, x):",
... | false | 0.055127 | 0.037559 | 1.467752 | [
"s433325163",
"s759911031"
] |
u627600101 | p02573 | python | s890205191 | s641055824 | 873 | 477 | 212,224 | 82,480 | Accepted | Accepted | 45.36 | import sys
sys.setrecursionlimit(2*10**9)
N, M = list(map(int, input().split()))
friends = [[] for _ in range(N)]
for k in range(M):
A, B = list(map(int, input().split()))
A -= 1
B -= 1
friends[A].append(B)
friends[B].append(A)
group = []
sgn = [0 for _ in range(N)] #0なら未所属
def make_group(person... | ### https://note.nkmk.me/python-union-find/
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# 各要素の親要素の番号を格納するリスト
# 要素が根(ルート)の場合は-(そのグループの要素数)を格納する
def find(self, x): # 要素xが属するグループの根を返す
if self.parents[x] < 0:
return x
else:
self.paren... | 31 | 66 | 637 | 1,699 | import sys
sys.setrecursionlimit(2 * 10**9)
N, M = list(map(int, input().split()))
friends = [[] for _ in range(N)]
for k in range(M):
A, B = list(map(int, input().split()))
A -= 1
B -= 1
friends[A].append(B)
friends[B].append(A)
group = []
sgn = [0 for _ in range(N)] # 0なら未所属
def make_group(per... | ### https://note.nkmk.me/python-union-find/
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# 各要素の親要素の番号を格納するリスト
# 要素が根(ルート)の場合は-(そのグループの要素数)を格納する
def find(self, x): # 要素xが属するグループの根を返す
if self.parents[x] < 0:
return x
else:... | false | 53.030303 | [
"-import sys",
"+### https://note.nkmk.me/python-union-find/",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.parents = [-1] * n",
"+ # 各要素の親要素の番号を格納するリスト",
"+ # 要素が根(ルート)の場合は-(そのグループの要素数)を格納する",
"-sys.setrecursionlimit(2 * 10**9)",
"+ de... | false | 0.036612 | 0.036271 | 1.009399 | [
"s890205191",
"s641055824"
] |
u423665486 | p03476 | python | s162373159 | s834315305 | 801 | 653 | 78,552 | 70,360 | Accepted | Accepted | 18.48 | def isprime(n):
'''check if integer n is a prime'''
# make sure n is a positive integer
n = abs(int(n))
# 0 and 1 are not primes
if n < 2:
return False
# 2 is the only even prime number
if n == 2:
return True
# all other even numbers are not primes
... | def sieve(n):
is_prime = [1] * (n + 1)
is_prime[0], is_prime[1] = 0, 0
for i in range(2, n+1):
if not is_prime[i]:
continue
j = i*2
while j <= n:
is_prime[j] = 0
j += i
return is_prime
def resolve():
q = int(eval(input()))
qs = [list(map(int, input().split())) for _ in range(q)]
ps... | 39 | 29 | 916 | 602 | def isprime(n):
"""check if integer n is a prime"""
# make sure n is a positive integer
n = abs(int(n))
# 0 and 1 are not primes
if n < 2:
return False
# 2 is the only even prime number
if n == 2:
return True
# all other even numbers are not primes
if not n & 1:
... | def sieve(n):
is_prime = [1] * (n + 1)
is_prime[0], is_prime[1] = 0, 0
for i in range(2, n + 1):
if not is_prime[i]:
continue
j = i * 2
while j <= n:
is_prime[j] = 0
j += i
return is_prime
def resolve():
q = int(eval(input()))
qs = [l... | false | 25.641026 | [
"-def isprime(n):",
"- \"\"\"check if integer n is a prime\"\"\"",
"- # make sure n is a positive integer",
"- n = abs(int(n))",
"- # 0 and 1 are not primes",
"- if n < 2:",
"- return False",
"- # 2 is the only even prime number",
"- if n == 2:",
"- return True",... | false | 0.31873 | 0.147879 | 2.155347 | [
"s162373159",
"s834315305"
] |
u859897687 | p03011 | python | s019678781 | s399345045 | 167 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.82 | p=list(map(int,input().split()))
print((sum(p)-max(p))) | p,q,r=list(map(int,input().split()))
print((p+q+r-max(p,q,r))) | 2 | 2 | 54 | 55 | p = list(map(int, input().split()))
print((sum(p) - max(p)))
| p, q, r = list(map(int, input().split()))
print((p + q + r - max(p, q, r)))
| false | 0 | [
"-p = list(map(int, input().split()))",
"-print((sum(p) - max(p)))",
"+p, q, r = list(map(int, input().split()))",
"+print((p + q + r - max(p, q, r)))"
] | false | 0.039559 | 0.038117 | 1.037839 | [
"s019678781",
"s399345045"
] |
u729939940 | p02791 | python | s345856818 | s396605406 | 104 | 92 | 32,384 | 32,376 | Accepted | Accepted | 11.54 | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 1
min = A[0]
for i in range(1, N):
if min > A[i]:
cnt += 1
min = A[i]
print(cnt) | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 1
min = A[0]
for a in A:
if min > a:
cnt += 1
min = a
print(cnt) | 9 | 9 | 157 | 141 | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 1
min = A[0]
for i in range(1, N):
if min > A[i]:
cnt += 1
min = A[i]
print(cnt)
| N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 1
min = A[0]
for a in A:
if min > a:
cnt += 1
min = a
print(cnt)
| false | 0 | [
"-for i in range(1, N):",
"- if min > A[i]:",
"+for a in A:",
"+ if min > a:",
"- min = A[i]",
"+ min = a"
] | false | 0.036084 | 0.035252 | 1.02359 | [
"s345856818",
"s396605406"
] |
u759412327 | p03085 | python | s052687593 | s861274867 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | print(("ATCG"["TAGC".find(eval(input()))])) | d = {"A":"T","T":"A","C":"G","G":"C"}
print((d[eval(input())])) | 1 | 2 | 35 | 56 | print(("ATCG"["TAGC".find(eval(input()))]))
| d = {"A": "T", "T": "A", "C": "G", "G": "C"}
print((d[eval(input())]))
| false | 50 | [
"-print((\"ATCG\"[\"TAGC\".find(eval(input()))]))",
"+d = {\"A\": \"T\", \"T\": \"A\", \"C\": \"G\", \"G\": \"C\"}",
"+print((d[eval(input())]))"
] | false | 0.069001 | 0.044535 | 1.549379 | [
"s052687593",
"s861274867"
] |
u670180528 | p03575 | python | s054958243 | s057072558 | 22 | 19 | 3,064 | 3,064 | Accepted | Accepted | 13.64 | class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rank = [0]*(n+1)
def find(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x]
def unite(self, x, y):
x = self.find(x)
y = self.find(y)
i... | import sys
input = sys.stdin.buffer.readline
n,m=list(map(int,input().split()))
es=[list(map(int,input().split())) for _ in range(m)]
def check(s,t):
q=[0]
vis=[0]*n
vis[0]=1
while q:
c=q.pop()
for x in con[c]:
if (c==s and x==t) or (c==t and x==s) or vis[x]:
continue
vis[x]=1
q.appen... | 43 | 21 | 886 | 460 | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
self.rank = [0] * (n + 1)
def find(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x]
def unite(se... | import sys
input = sys.stdin.buffer.readline
n, m = list(map(int, input().split()))
es = [list(map(int, input().split())) for _ in range(m)]
def check(s, t):
q = [0]
vis = [0] * n
vis[0] = 1
while q:
c = q.pop()
for x in con[c]:
if (c == s and x == t) or (c == t and x == s... | false | 51.162791 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.root = [-1] * (n + 1)",
"- self.rank = [0] * (n + 1)",
"+import sys",
"- def find(self, x):",
"- if self.root[x] < 0:",
"- return x",
"- else:",
"- self.root[x]... | false | 0.04093 | 0.042759 | 0.957242 | [
"s054958243",
"s057072558"
] |
u932465688 | p03325 | python | s237958864 | s133960997 | 107 | 88 | 4,148 | 4,148 | Accepted | Accepted | 17.76 | N = int(eval(input()))
A = list(map(int,input().split()))
k = 0
for i in range(N):
while (A[i] % 2 == 0):
A[i] = A[i]//2
k += 1
else:
i += 1
print(k) | N = int(eval(input()))
L = list(map(int,input().split()))
cnt = 0
for i in range(N):
k = L[i]
while k%2 == 0:
cnt += 1
k = k//2
print(cnt) | 10 | 9 | 168 | 152 | N = int(eval(input()))
A = list(map(int, input().split()))
k = 0
for i in range(N):
while A[i] % 2 == 0:
A[i] = A[i] // 2
k += 1
else:
i += 1
print(k)
| N = int(eval(input()))
L = list(map(int, input().split()))
cnt = 0
for i in range(N):
k = L[i]
while k % 2 == 0:
cnt += 1
k = k // 2
print(cnt)
| false | 10 | [
"-A = list(map(int, input().split()))",
"-k = 0",
"+L = list(map(int, input().split()))",
"+cnt = 0",
"- while A[i] % 2 == 0:",
"- A[i] = A[i] // 2",
"- k += 1",
"- else:",
"- i += 1",
"-print(k)",
"+ k = L[i]",
"+ while k % 2 == 0:",
"+ cnt += 1",
"... | false | 0.040202 | 0.039913 | 1.007253 | [
"s237958864",
"s133960997"
] |
u941753895 | p02934 | python | s186003024 | s669678219 | 60 | 17 | 6,480 | 2,940 | Accepted | Accepted | 71.67 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | # 入力
n=int(eval(input()))
l=list(map(int,input().split()))
# 各項の逆数の和を取る
sm=0
for x in l:
sm+=1/x
# 和の逆数を出力
print((1/sm))
| 26 | 11 | 616 | 129 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | # 入力
n = int(eval(input()))
l = list(map(int, input().split()))
# 各項の逆数の和を取る
sm = 0
for x in l:
sm += 1 / x
# 和の逆数を出力
print((1 / sm))
| false | 57.692308 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy",
"-",
"-sys.setrecursionlimit(10**7)",
"-inf = 10**20",
"-mod = 10**9 + 7",
"-dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]",
"-ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1),... | false | 0.036193 | 0.035193 | 1.028428 | [
"s186003024",
"s669678219"
] |
u878239774 | p02779 | python | s902966539 | s207322345 | 185 | 78 | 26,812 | 31,156 | Accepted | Accepted | 57.84 | N = int(eval(input()))
numList = list(map(int, input().split()))
numList.sort()
ans = "YES"
for z in range(N-1):
if numList[z] == numList[z+1]:
ans = "NO"
break
print(ans) | n = int(eval(input()))
a_list = [i for i in input().split()]
a_set = set(a_list)
if len(a_set) == n:
print('YES')
else:
print('NO')
| 13 | 9 | 195 | 144 | N = int(eval(input()))
numList = list(map(int, input().split()))
numList.sort()
ans = "YES"
for z in range(N - 1):
if numList[z] == numList[z + 1]:
ans = "NO"
break
print(ans)
| n = int(eval(input()))
a_list = [i for i in input().split()]
a_set = set(a_list)
if len(a_set) == n:
print("YES")
else:
print("NO")
| false | 30.769231 | [
"-N = int(eval(input()))",
"-numList = list(map(int, input().split()))",
"-numList.sort()",
"-ans = \"YES\"",
"-for z in range(N - 1):",
"- if numList[z] == numList[z + 1]:",
"- ans = \"NO\"",
"- break",
"-print(ans)",
"+n = int(eval(input()))",
"+a_list = [i for i in input().sp... | false | 0.080292 | 0.079069 | 1.015468 | [
"s902966539",
"s207322345"
] |
u562935282 | p02767 | python | s288707224 | s383572893 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | def main():
n = int(eval(input()))
*xs, = list(map(int, input().split()))
ret = float('inf')
for p in range(100 + 1):
t = 0
for x in xs:
t += (p - x) ** 2
ret = min(ret, t)
print(ret)
if __name__ == '__main__':
main()
# import sys
#
# sys... | n = int(eval(input()))
xs = tuple(map(int, input().split()))
ret = min(
sum(
(x - p) * (x - p)
for x in xs
) for p in range(1, 100 + 1)
)
print(ret)
| 24 | 11 | 426 | 179 | def main():
n = int(eval(input()))
(*xs,) = list(map(int, input().split()))
ret = float("inf")
for p in range(100 + 1):
t = 0
for x in xs:
t += (p - x) ** 2
ret = min(ret, t)
print(ret)
if __name__ == "__main__":
main()
# import sys
#
# sys.setrecursionlimit... | n = int(eval(input()))
xs = tuple(map(int, input().split()))
ret = min(sum((x - p) * (x - p) for x in xs) for p in range(1, 100 + 1))
print(ret)
| false | 54.166667 | [
"-def main():",
"- n = int(eval(input()))",
"- (*xs,) = list(map(int, input().split()))",
"- ret = float(\"inf\")",
"- for p in range(100 + 1):",
"- t = 0",
"- for x in xs:",
"- t += (p - x) ** 2",
"- ret = min(ret, t)",
"- print(ret)",
"-",
"-",
... | false | 0.042988 | 0.042994 | 0.999839 | [
"s288707224",
"s383572893"
] |
u389910364 | p02998 | python | s290051249 | s337036073 | 775 | 457 | 116,684 | 68,952 | Accepted | Accepted | 41.03 | import os
import sys
from collections import defaultdict
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
N = int(sys.stdin.readline())
X, Y = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(N)]))
yx = defaultdict(la... | """
https://atcoder.jp/contests/abc131/submissions/6086380
"""
import os
import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf... | 56 | 33 | 1,253 | 920 | import os
import sys
from collections import defaultdict
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
N = int(sys.stdin.readline())
X, Y = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(N)]))
yx = defaultdict(lambda: set())
xy ... | """
https://atcoder.jp/contests/abc131/submissions/6086380
"""
import os
import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
N = int(sys.s... | false | 41.071429 | [
"+\"\"\"",
"+https://atcoder.jp/contests/abc131/submissions/6086380",
"+\"\"\"",
"-from collections import defaultdict",
"+import numpy as np",
"+from scipy.sparse import csr_matrix",
"+from scipy.sparse.csgraph import connected_components",
"-yx = defaultdict(lambda: set())",
"-xy = defaultdict(lam... | false | 0.141668 | 1.085806 | 0.130473 | [
"s290051249",
"s337036073"
] |
u675918663 | p03201 | python | s135397535 | s541444269 | 397 | 337 | 44,560 | 44,560 | Accepted | Accepted | 15.11 | eval(input())
nbs = list(map(int, input().split()))
answer = 0
count = {}
for nb in nbs:
count[nb] = count.get(nb, 0) + 1
for nb in sorted(list(count.keys()), reverse=True):
searching = (1 << nb.bit_length()) - nb
nb_count = count[nb]
sr_count = count.get(searching, 0)
if sr_count:
... | def main(l):
counts = {}
answer = 0
for nb in l:
counts[nb] = counts.get(nb, 0) + 1
for a in sorted(list(counts.keys()), reverse=True):
b = (1 << a.bit_length()) - a
c_a = counts[a]
c_b = counts.get(b)
if c_b:
if a == b:
answ... | 22 | 24 | 543 | 629 | eval(input())
nbs = list(map(int, input().split()))
answer = 0
count = {}
for nb in nbs:
count[nb] = count.get(nb, 0) + 1
for nb in sorted(list(count.keys()), reverse=True):
searching = (1 << nb.bit_length()) - nb
nb_count = count[nb]
sr_count = count.get(searching, 0)
if sr_count:
if nb == ... | def main(l):
counts = {}
answer = 0
for nb in l:
counts[nb] = counts.get(nb, 0) + 1
for a in sorted(list(counts.keys()), reverse=True):
b = (1 << a.bit_length()) - a
c_a = counts[a]
c_b = counts.get(b)
if c_b:
if a == b:
answer += c_a /... | false | 8.333333 | [
"-eval(input())",
"-nbs = list(map(int, input().split()))",
"-answer = 0",
"-count = {}",
"-for nb in nbs:",
"- count[nb] = count.get(nb, 0) + 1",
"-for nb in sorted(list(count.keys()), reverse=True):",
"- searching = (1 << nb.bit_length()) - nb",
"- nb_count = count[nb]",
"- sr_count ... | false | 0.038495 | 0.096412 | 0.399279 | [
"s135397535",
"s541444269"
] |
u144304718 | p02707 | python | s608200761 | s812127744 | 129 | 109 | 25,936 | 25,860 | Accepted | Accepted | 15.5 | 社員数 = int(input())
部下数 = [0] * 社員数
for 上司 in map(int, input().split()):
部下数[上司-1] += 1
[print(_) for _ in 部下数]
| 社員数 = int(eval(input()))
部下数 = [0] * 社員数
for 上司 in map(int, input().split(' ')):
部下数[上司-1] += 1
print(('\n'.join(map(str, 部下数))))
| 7 | 7 | 123 | 134 | 社員数 = int(input())
部下数 = [0] * 社員数
for 上司 in map(int, input().split()):
部下数[上司 - 1] += 1
[print(_) for _ in 部下数]
| 社員数 = int(eval(input()))
部下数 = [0] * 社員数
for 上司 in map(int, input().split(" ")):
部下数[上司 - 1] += 1
print(("\n".join(map(str, 部下数))))
| false | 0 | [
"-社員数 = int(input())",
"+社員数 = int(eval(input()))",
"-for 上司 in map(int, input().split()):",
"+for 上司 in map(int, input().split(\" \")):",
"-[print(_) for _ in 部下数]",
"+print((\"\\n\".join(map(str, 部下数))))"
] | false | 0.035322 | 0.034357 | 1.028083 | [
"s608200761",
"s812127744"
] |
u248424983 | p02399 | python | s232188688 | s267059511 | 30 | 20 | 7,740 | 7,724 | Accepted | Accepted | 33.33 | import sys
(a, b) = [int(i) for i in input().split(' ')]
d = a // b
r = a % b
f = a / b
print((repr(d) +" "+ repr(r) +" "+ ('%0.5f' % f))) | (a, b) = [int(i) for i in input().split(' ')]
print(( repr(a // b) +" "+ repr(a % b) +" "+ ('%0.5f' % (a / b)))) | 6 | 2 | 145 | 113 | import sys
(a, b) = [int(i) for i in input().split(" ")]
d = a // b
r = a % b
f = a / b
print((repr(d) + " " + repr(r) + " " + ("%0.5f" % f)))
| (a, b) = [int(i) for i in input().split(" ")]
print((repr(a // b) + " " + repr(a % b) + " " + ("%0.5f" % (a / b))))
| false | 66.666667 | [
"-import sys",
"-",
"-d = a // b",
"-r = a % b",
"-f = a / b",
"-print((repr(d) + \" \" + repr(r) + \" \" + (\"%0.5f\" % f)))",
"+print((repr(a // b) + \" \" + repr(a % b) + \" \" + (\"%0.5f\" % (a / b))))"
] | false | 0.037509 | 0.041006 | 0.914726 | [
"s232188688",
"s267059511"
] |
u732963817 | p03671 | python | s445173739 | s323548383 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | i = sorted(list(map(int, input().split())))
print((i[0] + i[1]))
| print((sum(sorted(list(map(int, input().split())))[:2]))) | 2 | 1 | 64 | 55 | i = sorted(list(map(int, input().split())))
print((i[0] + i[1]))
| print((sum(sorted(list(map(int, input().split())))[:2])))
| false | 50 | [
"-i = sorted(list(map(int, input().split())))",
"-print((i[0] + i[1]))",
"+print((sum(sorted(list(map(int, input().split())))[:2])))"
] | false | 0.06784 | 0.135619 | 0.500226 | [
"s445173739",
"s323548383"
] |
u811841526 | p02421 | python | s485997650 | s395734039 | 30 | 20 | 7,664 | 5,596 | Accepted | Accepted | 33.33 | taro = 0
hanako = 0
n = int(eval(input()))
for _ in range(n):
taro_card, hanako_card = input().split()
if taro_card > hanako_card:
taro += 3
elif taro_card < hanako_card:
hanako += 3
else:
taro += 1
hanako += 1
print((taro, hanako)) | taro_point = 0
hanako_point = 0
n = int(eval(input()))
for i in range(n):
taro, hanako = input().split()
if taro == hanako:
taro_point += 1
hanako_point += 1
elif taro > hanako:
taro_point += 3
else:
hanako_point += 3
print((taro_point, hanako_point))
| 13 | 15 | 284 | 308 | taro = 0
hanako = 0
n = int(eval(input()))
for _ in range(n):
taro_card, hanako_card = input().split()
if taro_card > hanako_card:
taro += 3
elif taro_card < hanako_card:
hanako += 3
else:
taro += 1
hanako += 1
print((taro, hanako))
| taro_point = 0
hanako_point = 0
n = int(eval(input()))
for i in range(n):
taro, hanako = input().split()
if taro == hanako:
taro_point += 1
hanako_point += 1
elif taro > hanako:
taro_point += 3
else:
hanako_point += 3
print((taro_point, hanako_point))
| false | 13.333333 | [
"-taro = 0",
"-hanako = 0",
"+taro_point = 0",
"+hanako_point = 0",
"-for _ in range(n):",
"- taro_card, hanako_card = input().split()",
"- if taro_card > hanako_card:",
"- taro += 3",
"- elif taro_card < hanako_card:",
"- hanako += 3",
"+for i in range(n):",
"+ taro,... | false | 0.059186 | 0.062975 | 0.939833 | [
"s485997650",
"s395734039"
] |
u724687935 | p02720 | python | s486838627 | s695031352 | 194 | 119 | 42,736 | 11,944 | Accepted | Accepted | 38.66 | K = int(eval(input()))
N = 10
S = [[] for _ in range(N + 1)]
for i in range(1, 10):
S[1].append(i)
if K < 10:
print((S[1][K - 1]))
exit()
cnt = 9
for i in range(2, N + 1):
for j in S[i - 1]:
k = j % 10
if 1 <= k <= 8:
T = [-1, 0, 1]
elif k == 0:
... | from collections import deque
K = int(eval(input()))
q = deque()
for i in range(1, 10):
q.append(i)
while K > 0:
p = q.popleft()
K -= 1
r = p % 10
if r != 0:
q.append(10 * p + r - 1)
q.append(10 * p + r)
if r != 9:
q.append(10 * p + r + 1)
print(p)
| 27 | 19 | 543 | 309 | K = int(eval(input()))
N = 10
S = [[] for _ in range(N + 1)]
for i in range(1, 10):
S[1].append(i)
if K < 10:
print((S[1][K - 1]))
exit()
cnt = 9
for i in range(2, N + 1):
for j in S[i - 1]:
k = j % 10
if 1 <= k <= 8:
T = [-1, 0, 1]
elif k == 0:
T = [0, 1]... | from collections import deque
K = int(eval(input()))
q = deque()
for i in range(1, 10):
q.append(i)
while K > 0:
p = q.popleft()
K -= 1
r = p % 10
if r != 0:
q.append(10 * p + r - 1)
q.append(10 * p + r)
if r != 9:
q.append(10 * p + r + 1)
print(p)
| false | 29.62963 | [
"+from collections import deque",
"+",
"-N = 10",
"-S = [[] for _ in range(N + 1)]",
"+q = deque()",
"- S[1].append(i)",
"-if K < 10:",
"- print((S[1][K - 1]))",
"- exit()",
"-cnt = 9",
"-for i in range(2, N + 1):",
"- for j in S[i - 1]:",
"- k = j % 10",
"- if 1 ... | false | 0.03835 | 0.045468 | 0.843453 | [
"s486838627",
"s695031352"
] |
u017810624 | p02734 | python | s440068510 | s205141242 | 1,198 | 881 | 270,344 | 246,452 | Accepted | Accepted | 26.46 | n,s=list(map(int,input().split()))
a=list(map(int,input().split()))
mod=998244353
dp0=[[0 for i in range(s+1)] for j in range(n+1)]
dp1=[[0 for i in range(s+1)] for j in range(n+1)]
dp2=[[0 for i in range(s+1)] for j in range(n+1)]
dp0[0][0]=1
for i in range(n):
for j in range(s+1):
if j>=a[i]:
dp... | n,s=list(map(int,input().split()))
a=list(map(int,input().split()))
mod=998244353
dp0=[[0]*(s+1) for i in range(n+1)]
dp1=[[0]*(s+1) for i in range(n+1)]
dp2=[[0]*(s+1) for i in range(n+1)]
dp0[0][0]=1
for i in range(n):
for j in range(s+1):
if j>=a[i]:
dp1[i+1][j]=(dp0[i][j-a[i]]+dp1[i][j-a[i]]+d... | 17 | 17 | 626 | 584 | n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
dp0 = [[0 for i in range(s + 1)] for j in range(n + 1)]
dp1 = [[0 for i in range(s + 1)] for j in range(n + 1)]
dp2 = [[0 for i in range(s + 1)] for j in range(n + 1)]
dp0[0][0] = 1
for i in range(n):
for j in range(s + 1):
... | n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
dp0 = [[0] * (s + 1) for i in range(n + 1)]
dp1 = [[0] * (s + 1) for i in range(n + 1)]
dp2 = [[0] * (s + 1) for i in range(n + 1)]
dp0[0][0] = 1
for i in range(n):
for j in range(s + 1):
if j >= a[i]:
dp1... | false | 0 | [
"-dp0 = [[0 for i in range(s + 1)] for j in range(n + 1)]",
"-dp1 = [[0 for i in range(s + 1)] for j in range(n + 1)]",
"-dp2 = [[0 for i in range(s + 1)] for j in range(n + 1)]",
"+dp0 = [[0] * (s + 1) for i in range(n + 1)]",
"+dp1 = [[0] * (s + 1) for i in range(n + 1)]",
"+dp2 = [[0] * (s + 1) for i i... | false | 0.038003 | 0.03757 | 1.01154 | [
"s440068510",
"s205141242"
] |
u489959379 | p02796 | python | s494117632 | s441410010 | 1,935 | 194 | 22,132 | 26,324 | Accepted | Accepted | 89.97 | from operator import itemgetter
n = int(eval(input()))
XL = []
for _ in range(n):
x, l = list(map(int, input().split()))
XL.append([x-l, x+l])
XL = sorted(XL, key=itemgetter(1))
i = 1
while i != len(XL):
if XL[i][0] < XL[i-1][1]:
XL.pop(i)
else:
i += 1
print((len(XL))) | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
X = []
for _ in range(n):
x, l = list(map(int, input().split()))
X.append([x - l, x + l])
X = sorted(X, key=lambda x: x[1])
... | 17 | 28 | 306 | 538 | from operator import itemgetter
n = int(eval(input()))
XL = []
for _ in range(n):
x, l = list(map(int, input().split()))
XL.append([x - l, x + l])
XL = sorted(XL, key=itemgetter(1))
i = 1
while i != len(XL):
if XL[i][0] < XL[i - 1][1]:
XL.pop(i)
else:
i += 1
print((len(XL)))
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
X = []
for _ in range(n):
x, l = list(map(int, input().split()))
X.append([x - l, x + l])
X = sorted(X, key=lambda x: x[1])
remove = 0
... | false | 39.285714 | [
"-from operator import itemgetter",
"+import sys",
"-n = int(eval(input()))",
"-XL = []",
"-for _ in range(n):",
"- x, l = list(map(int, input().split()))",
"- XL.append([x - l, x + l])",
"-XL = sorted(XL, key=itemgetter(1))",
"-i = 1",
"-while i != len(XL):",
"- if XL[i][0] < XL[i - 1]... | false | 0.107697 | 0.039504 | 2.726204 | [
"s494117632",
"s441410010"
] |
u075012704 | p03326 | python | s313049518 | s839331034 | 243 | 26 | 41,072 | 3,384 | Accepted | Accepted | 89.3 | from itertools import product
N, M = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(N)]
P = product((1, -1), repeat=3)
ans = 0
for x, y, z in P:
tmp = []
for a, b, c in C:
tmp.append(a*x + b*y + c*z)
tmp.sort(reverse=True)
ans = max(ans, sum(tmp... | from itertools import product
N, M = list(map(int, input().split()))
cake = [list(map(int, input().split())) for i in range(N)]
ans = 0
for x, y, z in product([1, -1], repeat=3):
tmp = []
for a, b, c in cake:
tmp.append(a*x + b*y + c*z)
tmp.sort(reverse=True)
ans = max(ans, sum(tmp[:M... | 15 | 13 | 335 | 332 | from itertools import product
N, M = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(N)]
P = product((1, -1), repeat=3)
ans = 0
for x, y, z in P:
tmp = []
for a, b, c in C:
tmp.append(a * x + b * y + c * z)
tmp.sort(reverse=True)
ans = max(ans, sum(tmp[:M]))
... | from itertools import product
N, M = list(map(int, input().split()))
cake = [list(map(int, input().split())) for i in range(N)]
ans = 0
for x, y, z in product([1, -1], repeat=3):
tmp = []
for a, b, c in cake:
tmp.append(a * x + b * y + c * z)
tmp.sort(reverse=True)
ans = max(ans, sum(tmp[:M]))
... | false | 13.333333 | [
"-C = [list(map(int, input().split())) for i in range(N)]",
"-P = product((1, -1), repeat=3)",
"+cake = [list(map(int, input().split())) for i in range(N)]",
"-for x, y, z in P:",
"+for x, y, z in product([1, -1], repeat=3):",
"- for a, b, c in C:",
"+ for a, b, c in cake:"
] | false | 0.067888 | 0.040712 | 1.667521 | [
"s313049518",
"s839331034"
] |
u588341295 | p02589 | python | s236429580 | s015456131 | 2,011 | 1,646 | 205,336 | 206,404 | Accepted | Accepted | 18.15 | import sys
from collections import Counter
from string import ascii_lowercase
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j... | import sys
from collections import Counter
from string import ascii_lowercase
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j... | 111 | 108 | 3,381 | 3,240 | import sys
from collections import Counter
from string import ascii_lowercase
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return ... | import sys
from collections import Counter
from string import ascii_lowercase
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return ... | false | 2.702703 | [
"-ch = [0] * 26",
"-for i, c in enumerate(ascii_lowercase):",
"- ch[i] = RollingHash(c).get_hash(0, 1)",
"+ch = {}",
"+for c in ascii_lowercase:",
"+ ch[c] = RollingHash(c).get_hash(0, 1)",
"- for j, c in enumerate(ascii_lowercase):",
"- if C[c]:",
"- if rh.mer... | false | 0.115841 | 0.047316 | 2.448271 | [
"s236429580",
"s015456131"
] |
u952708174 | p03775 | python | s769969117 | s381382175 | 64 | 29 | 3,060 | 3,060 | Accepted | Accepted | 54.69 | N = int(eval(input()))
A = 1
ans = len(str(N))
while A**2 <= N:
if N % A != 0:
# Bが整数にならない
A += 1
continue
B = N // A
cur = max(len(str(A)), len(str(B)))
ans = min(ans, cur)
A += 1
print(ans) | N = int(eval(input()))
ans = len(str(N)) # Fの値は高々この値
for A in range(1, int(N**0.5) + 1):
if N % A != 0: # AはNの約数でない
continue
B = N // A
f = len(str(max(A,B)))
ans = min(ans, f)
print(ans) | 13 | 9 | 241 | 201 | N = int(eval(input()))
A = 1
ans = len(str(N))
while A**2 <= N:
if N % A != 0:
# Bが整数にならない
A += 1
continue
B = N // A
cur = max(len(str(A)), len(str(B)))
ans = min(ans, cur)
A += 1
print(ans)
| N = int(eval(input()))
ans = len(str(N)) # Fの値は高々この値
for A in range(1, int(N**0.5) + 1):
if N % A != 0: # AはNの約数でない
continue
B = N // A
f = len(str(max(A, B)))
ans = min(ans, f)
print(ans)
| false | 30.769231 | [
"-A = 1",
"-ans = len(str(N))",
"-while A**2 <= N:",
"- if N % A != 0:",
"- # Bが整数にならない",
"- A += 1",
"+ans = len(str(N)) # Fの値は高々この値",
"+for A in range(1, int(N**0.5) + 1):",
"+ if N % A != 0: # AはNの約数でない",
"- cur = max(len(str(A)), len(str(B)))",
"- ans = min(ans, c... | false | 0.067982 | 0.074294 | 0.915035 | [
"s769969117",
"s381382175"
] |
u309977459 | p03625 | python | s423841866 | s295687535 | 162 | 104 | 21,540 | 14,224 | Accepted | Accepted | 35.8 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter()
for a in A:
c[a] += 1
candidate = []
for k, v in c.most_common():
if v >= 4:
candidate.append(k)
candidate.append(k)
elif v >= 2:
candidate.append(k)
candidate.sort()... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
res = A[0]
cnt = 1
use = []
for i in range(1, N):
if A[i] == res:
cnt += 1
else:
cnt = 1
res = A[i]
if cnt >= 2:
use.append(A[i])
cnt -= 2
if len(use) >= 2:
... | 19 | 25 | 402 | 391 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter()
for a in A:
c[a] += 1
candidate = []
for k, v in c.most_common():
if v >= 4:
candidate.append(k)
candidate.append(k)
elif v >= 2:
candidate.append(k)
candidate.sort()
if len(cand... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
res = A[0]
cnt = 1
use = []
for i in range(1, N):
if A[i] == res:
cnt += 1
else:
cnt = 1
res = A[i]
if cnt >= 2:
use.append(A[i])
cnt -= 2
if len(use) >= 2:
break
if len(use) >... | false | 24 | [
"-from collections import Counter",
"-",
"-c = Counter()",
"-for a in A:",
"- c[a] += 1",
"-candidate = []",
"-for k, v in c.most_common():",
"- if v >= 4:",
"- candidate.append(k)",
"- candidate.append(k)",
"- elif v >= 2:",
"- candidate.append(k)",
"-candidate... | false | 0.038564 | 0.036963 | 1.043322 | [
"s423841866",
"s295687535"
] |
u221061152 | p02697 | python | s535247242 | s915019556 | 139 | 75 | 17,516 | 9,120 | Accepted | Accepted | 46.04 | n,m=list(map(int,input().split()))
#1とnがつながっているときのa,bの最短距離
def dist(a,b):
return min(abs(a-b),n-abs(a-b))
a,b = n,1
S=set()
for i in range(m):
distab = dist(a,b)
#distabがnの半分のとき
if 2*distab == n or distab in S:
a -= 1
print((a,b))
S.add(distab)
a -= 1
b += 1 | n,m=list(map(int,input().split()))
if n%2 == 1:
for i in range(1,m+1):
a,b=i,n-i
print((a,b))
else:
for i in range(1,m+1):
a,b = i,n-i
if b-a <= n//2:
a+=1
print((a,b))
| 16 | 13 | 286 | 204 | n, m = list(map(int, input().split()))
# 1とnがつながっているときのa,bの最短距離
def dist(a, b):
return min(abs(a - b), n - abs(a - b))
a, b = n, 1
S = set()
for i in range(m):
distab = dist(a, b)
# distabがnの半分のとき
if 2 * distab == n or distab in S:
a -= 1
print((a, b))
S.add(distab)
a -= 1
b +=... | n, m = list(map(int, input().split()))
if n % 2 == 1:
for i in range(1, m + 1):
a, b = i, n - i
print((a, b))
else:
for i in range(1, m + 1):
a, b = i, n - i
if b - a <= n // 2:
a += 1
print((a, b))
| false | 18.75 | [
"-# 1とnがつながっているときのa,bの最短距離",
"-def dist(a, b):",
"- return min(abs(a - b), n - abs(a - b))",
"-",
"-",
"-a, b = n, 1",
"-S = set()",
"-for i in range(m):",
"- distab = dist(a, b)",
"- # distabがnの半分のとき",
"- if 2 * distab == n or distab in S:",
"- a -= 1",
"- print((a, b)... | false | 0.040745 | 0.039231 | 1.038589 | [
"s535247242",
"s915019556"
] |
u673338219 | p03170 | python | s826476029 | s513378076 | 1,981 | 237 | 3,864 | 42,224 | Accepted | Accepted | 88.04 | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
tf = ["" for _ in range(k+1)]
tf[0] = False
for i in range(1,k+1):
j = 0
flag = 0
while j < n and i - a[j] >= 0:
if tf[i-a[j]] == False:
tf[i] = True
flag = 1
break
j += 1
if flag ==0:
tf[i] = Fal... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
s = [False]*(k+1)
for i in range(k+1):
for aj in a:
if i - aj >=0:
if s[i-aj] == False:
s[i] = True
break
if s[k]==True:
print("First")
else:
print("Second") | 22 | 13 | 390 | 267 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
tf = ["" for _ in range(k + 1)]
tf[0] = False
for i in range(1, k + 1):
j = 0
flag = 0
while j < n and i - a[j] >= 0:
if tf[i - a[j]] == False:
tf[i] = True
flag = 1
break
j += 1
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = [False] * (k + 1)
for i in range(k + 1):
for aj in a:
if i - aj >= 0:
if s[i - aj] == False:
s[i] = True
break
if s[k] == True:
print("First")
else:
print("Second")
| false | 40.909091 | [
"-tf = [\"\" for _ in range(k + 1)]",
"-tf[0] = False",
"-for i in range(1, k + 1):",
"- j = 0",
"- flag = 0",
"- while j < n and i - a[j] >= 0:",
"- if tf[i - a[j]] == False:",
"- tf[i] = True",
"- flag = 1",
"- break",
"- j += 1",
"- ... | false | 0.043489 | 0.041501 | 1.047902 | [
"s826476029",
"s513378076"
] |
u592248346 | p03835 | python | s666130389 | s655723228 | 1,602 | 1,246 | 2,940 | 9,084 | Accepted | Accepted | 22.22 | k,s = list(map(int,input().split()))
cnt = 0
for i in range(k+1):
for j in range(k+1):
n = s-i-j
if n>=0 and n<=k:
cnt += 1
print(cnt) | k,s = list(map(int,input().split()))
ans = 0
for i in range(k+1):
for j in range(k+1):
if i+j<=s and s-i-j<=k: ans+=1
print(ans) | 8 | 6 | 167 | 139 | k, s = list(map(int, input().split()))
cnt = 0
for i in range(k + 1):
for j in range(k + 1):
n = s - i - j
if n >= 0 and n <= k:
cnt += 1
print(cnt)
| k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
for j in range(k + 1):
if i + j <= s and s - i - j <= k:
ans += 1
print(ans)
| false | 25 | [
"-cnt = 0",
"+ans = 0",
"- n = s - i - j",
"- if n >= 0 and n <= k:",
"- cnt += 1",
"-print(cnt)",
"+ if i + j <= s and s - i - j <= k:",
"+ ans += 1",
"+print(ans)"
] | false | 0.037824 | 0.035955 | 1.051969 | [
"s666130389",
"s655723228"
] |
u608088992 | p03880 | python | s396189488 | s684372931 | 306 | 100 | 6,980 | 7,236 | Accepted | Accepted | 67.32 | import sys
def solve():
file = sys.stdin.readline
N = int(file())
A = [None] * N
mindig = [0 for i in range(30)]
nim = 0
for i in range(N):
a = int(file())
A[i] = a
nim ^= a
reverse = format(a ^ (a - 1), "b").zfill(30)
for j in range(30):
... | import sys, collections
def solve():
file = sys.stdin.readline
N = int(file())
A = [None] * N
mindig = collections.defaultdict(int)
nim = 0
for i in range(N):
a = int(file())
A[i] = a
nim ^= a
mindig[a^(a-1)] += 1
if nim == 0: print((0))
els... | 39 | 28 | 1,022 | 675 | import sys
def solve():
file = sys.stdin.readline
N = int(file())
A = [None] * N
mindig = [0 for i in range(30)]
nim = 0
for i in range(N):
a = int(file())
A[i] = a
nim ^= a
reverse = format(a ^ (a - 1), "b").zfill(30)
for j in range(30):
if ... | import sys, collections
def solve():
file = sys.stdin.readline
N = int(file())
A = [None] * N
mindig = collections.defaultdict(int)
nim = 0
for i in range(N):
a = int(file())
A[i] = a
nim ^= a
mindig[a ^ (a - 1)] += 1
if nim == 0:
print((0))
else... | false | 28.205128 | [
"-import sys",
"+import sys, collections",
"- mindig = [0 for i in range(30)]",
"+ mindig = collections.defaultdict(int)",
"- reverse = format(a ^ (a - 1), \"b\").zfill(30)",
"- for j in range(30):",
"- if reverse[j] == \"1\":",
"- mindig[j] += 1",
"- ... | false | 0.039366 | 0.038856 | 1.013125 | [
"s396189488",
"s684372931"
] |
u202112682 | p02663 | python | s199777660 | s317519426 | 22 | 20 | 9,132 | 9,152 | Accepted | Accepted | 9.09 | HM = list(map(int, input().split()))
hours = HM[2]-HM[0]
minutes = HM[3]-HM[1]
K = HM[4]
totalTimes = hours*60+minutes
print((totalTimes-K)) | H1, M1, H2, M2, K = list(map(int, input().split()))
print((60*(H2-H1)+(M2-M1)-K)) | 6 | 2 | 143 | 80 | HM = list(map(int, input().split()))
hours = HM[2] - HM[0]
minutes = HM[3] - HM[1]
K = HM[4]
totalTimes = hours * 60 + minutes
print((totalTimes - K))
| H1, M1, H2, M2, K = list(map(int, input().split()))
print((60 * (H2 - H1) + (M2 - M1) - K))
| false | 66.666667 | [
"-HM = list(map(int, input().split()))",
"-hours = HM[2] - HM[0]",
"-minutes = HM[3] - HM[1]",
"-K = HM[4]",
"-totalTimes = hours * 60 + minutes",
"-print((totalTimes - K))",
"+H1, M1, H2, M2, K = list(map(int, input().split()))",
"+print((60 * (H2 - H1) + (M2 - M1) - K))"
] | false | 0.056755 | 0.036304 | 1.563331 | [
"s199777660",
"s317519426"
] |
u263830634 | p03163 | python | s315508327 | s670272340 | 288 | 216 | 41,708 | 15,488 | Accepted | Accepted | 25 | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(W, w - 1, -1):
dp[i] = max(dp[i], dp[i - w] + v)
print((dp[W])) | def main():
import sys
input = sys.stdin.readline
import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W + 1, dtype = np.int64)
for _ in range(N):
w, v = list(map(int, input().split()))
dp[w:] = np.maximum(dp[w:], dp[:W - w + 1] + v)
... | 12 | 20 | 249 | 457 | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(W, w - 1, -1):
dp[i] = max(dp[i], dp[i - w] + v)
print((dp[W]))
| def main():
import sys
input = sys.stdin.readline
import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W + 1, dtype=np.int64)
for _ in range(N):
w, v = list(map(int, input().split()))
dp[w:] = np.maximum(dp[w:], dp[: W - w + 1] + v)
# for i in range(W... | false | 40 | [
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-N, W = list(map(int, input().split()))",
"-dp = [0] * (W + 1)",
"-for _ in range(N):",
"- w, v = list(map(int, input().split()))",
"- for i in range(W, w - 1, -1):",
"- dp[i] = max(dp[i], dp[i - w] + v)... | false | 0.044869 | 0.238847 | 0.187855 | [
"s315508327",
"s670272340"
] |
u502731482 | p03687 | python | s915081704 | s213869886 | 64 | 50 | 3,064 | 3,064 | Accepted | Accepted | 21.88 | s = eval(input())
ans = 10 ** 10
for i in range(26):
c = chr(ord("a") + i)
s_c = list(s)
cnt = 0
while len(set(s_c)) != 1:
t = ""
for i in range(len(s_c) - 1):
if s_c[i] == c or s_c[i + 1] == c:
t += c
else:
t += s_c[i]
... | s = eval(input())
ans = 10 ** 10
for i in range(26):
c = chr(ord("a") + i)
s_c = list(s)
cnt = 0
while len(set(s_c)) != 1:
t = ""
for i in range(len(s_c) - 1):
if s_c[i + 1] == c:
t += c
else:
t += s_c[i]
cnt +=... | 18 | 18 | 387 | 372 | s = eval(input())
ans = 10**10
for i in range(26):
c = chr(ord("a") + i)
s_c = list(s)
cnt = 0
while len(set(s_c)) != 1:
t = ""
for i in range(len(s_c) - 1):
if s_c[i] == c or s_c[i + 1] == c:
t += c
else:
t += s_c[i]
cnt +=... | s = eval(input())
ans = 10**10
for i in range(26):
c = chr(ord("a") + i)
s_c = list(s)
cnt = 0
while len(set(s_c)) != 1:
t = ""
for i in range(len(s_c) - 1):
if s_c[i + 1] == c:
t += c
else:
t += s_c[i]
cnt += 1
s_c ... | false | 0 | [
"- if s_c[i] == c or s_c[i + 1] == c:",
"+ if s_c[i + 1] == c:"
] | false | 0.04988 | 0.056681 | 0.880005 | [
"s915081704",
"s213869886"
] |
u594803920 | p02720 | python | s129280931 | s523206277 | 204 | 128 | 22,040 | 17,820 | Accepted | Accepted | 37.25 | #n桁のるんるん数のrisutoを求める
import sys
sys.setrecursionlimit(10**9)
def runrun(n):
if n == 1:
return [['1','2','3','4','5','6','7','8','9']]
else:
li = runrun(n-1)
li2 = []
for i in range(len(li[n-2])):
p = int(li[n-2][i][-1])
if p == 0:
... | #n桁のるんるん数のrisutoを求める
import sys
sys.setrecursionlimit(10**9)
from functools import lru_cache
@lru_cache(maxsize=None)
def runrun(n):
if n == 1:
return [['1','2','3','4','5','6','7','8','9']]
else:
li = runrun(n-1)
li2 = []
for i in range(len(li[n-2])):
... | 54 | 57 | 1,270 | 1,332 | # n桁のるんるん数のrisutoを求める
import sys
sys.setrecursionlimit(10**9)
def runrun(n):
if n == 1:
return [["1", "2", "3", "4", "5", "6", "7", "8", "9"]]
else:
li = runrun(n - 1)
li2 = []
for i in range(len(li[n - 2])):
p = int(li[n - 2][i][-1])
if p == 0:
... | # n桁のるんるん数のrisutoを求める
import sys
sys.setrecursionlimit(10**9)
from functools import lru_cache
@lru_cache(maxsize=None)
def runrun(n):
if n == 1:
return [["1", "2", "3", "4", "5", "6", "7", "8", "9"]]
else:
li = runrun(n - 1)
li2 = []
for i in range(len(li[n - 2])):
... | false | 5.263158 | [
"+from functools import lru_cache",
"+@lru_cache(maxsize=None)"
] | false | 0.164499 | 0.124609 | 1.320119 | [
"s129280931",
"s523206277"
] |
u845573105 | p02647 | python | s408161496 | s504874576 | 999 | 830 | 123,640 | 124,208 | Accepted | Accepted | 16.92 | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())), dtype=np.int64)
@njit
def loop1(a):
b = np.zeros(n+1, dtype=np.int64)
for i in range(n):
l = max(0, i-a[i])
r = min(i+a[i]+1, n)
b[l] += 1
if r <= n-1: b[r]... | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())), dtype=np.int64)
@njit
def imos(a):
b = np.zeros(n+1, dtype=np.int64)
for i in range(n):
l = max(0, i-a[i])
r = min(i+a[i]+1, n)
b[l] += 1
if r <= n-1: b[r] ... | 22 | 24 | 425 | 445 | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())), dtype=np.int64)
@njit
def loop1(a):
b = np.zeros(n + 1, dtype=np.int64)
for i in range(n):
l = max(0, i - a[i])
r = min(i + a[i] + 1, n)
b[l] += 1
if ... | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())), dtype=np.int64)
@njit
def imos(a):
b = np.zeros(n + 1, dtype=np.int64)
for i in range(n):
l = max(0, i - a[i])
r = min(i + a[i] + 1, n)
b[l] += 1
if r... | false | 8.333333 | [
"-def loop1(a):",
"+def imos(a):",
"-for q in range(min(42, k)):",
"- a = loop1(a)",
"+for q in range(k):",
"+ a = imos(a)",
"+ if np.min(a) == n:",
"+ break"
] | false | 0.216795 | 0.38658 | 0.560802 | [
"s408161496",
"s504874576"
] |
u201928947 | p02624 | python | s339898942 | s090112941 | 649 | 509 | 108,772 | 73,380 | Accepted | Accepted | 21.57 | import numba
@numba.njit
def main(N):
x = 0
for i in range(1,N+1):
for j in range(i,N+1,i):
x += j
return x
N = int(eval(input()))
print((main(N))) | def main(N):
x = 0
for i in range(1,N+1):
for j in range(i,N+1,i):
x += j
return x
N = int(eval(input()))
print((main(N))) | 11 | 8 | 182 | 153 | import numba
@numba.njit
def main(N):
x = 0
for i in range(1, N + 1):
for j in range(i, N + 1, i):
x += j
return x
N = int(eval(input()))
print((main(N)))
| def main(N):
x = 0
for i in range(1, N + 1):
for j in range(i, N + 1, i):
x += j
return x
N = int(eval(input()))
print((main(N)))
| false | 27.272727 | [
"-import numba",
"-",
"-",
"-@numba.njit"
] | false | 0.060516 | 0.008199 | 7.381223 | [
"s339898942",
"s090112941"
] |
u353895424 | p03311 | python | s438132173 | s870783330 | 316 | 247 | 27,248 | 27,240 | Accepted | Accepted | 21.84 | import statistics
n = int(eval(input()))
x = list(map(int, input().split()))
for i in range(n):
x[i] -= i+1
x.sort()
x_ = []
b = 0
if x.count(0) <= n//2:
for i in range(n):
if x[i] != 0:
x_.append(x[i])
b = statistics.median(x_)
ans = 0
for i in range(n):
ans ... | import statistics
n = int(eval(input()))
x = list(map(int, input().split()))
for i in range(n):
x[i] -= i+1
b = statistics.median(x)
ans = 0
for i in range(n):
ans += abs(x[i] - b)
print((int(ans)))
| 22 | 14 | 349 | 216 | import statistics
n = int(eval(input()))
x = list(map(int, input().split()))
for i in range(n):
x[i] -= i + 1
x.sort()
x_ = []
b = 0
if x.count(0) <= n // 2:
for i in range(n):
if x[i] != 0:
x_.append(x[i])
b = statistics.median(x_)
ans = 0
for i in range(n):
ans += abs(x[i] - b)
pr... | import statistics
n = int(eval(input()))
x = list(map(int, input().split()))
for i in range(n):
x[i] -= i + 1
b = statistics.median(x)
ans = 0
for i in range(n):
ans += abs(x[i] - b)
print((int(ans)))
| false | 36.363636 | [
"-x.sort()",
"-x_ = []",
"-b = 0",
"-if x.count(0) <= n // 2:",
"- for i in range(n):",
"- if x[i] != 0:",
"- x_.append(x[i])",
"- b = statistics.median(x_)",
"+b = statistics.median(x)"
] | false | 0.054267 | 0.045001 | 1.205924 | [
"s438132173",
"s870783330"
] |
u873482706 | p00006 | python | s062770033 | s883541612 | 20 | 10 | 4,184 | 6,400 | Accepted | Accepted | 50 | str = input()
str_lis = list(str)
str_lis.reverse()
print((''.join(str_lis))) | line = input()
lis = ['' for i in range(len(line))]
for i in range(len(line)-1, -1, -1):
lis[len(line)-1-i] = line[i]
else:
print(''.join(lis)) | 4 | 6 | 82 | 159 | str = input()
str_lis = list(str)
str_lis.reverse()
print(("".join(str_lis)))
| line = input()
lis = ["" for i in range(len(line))]
for i in range(len(line) - 1, -1, -1):
lis[len(line) - 1 - i] = line[i]
else:
print("".join(lis))
| false | 33.333333 | [
"-str = input()",
"-str_lis = list(str)",
"-str_lis.reverse()",
"-print((\"\".join(str_lis)))",
"+line = input()",
"+lis = [\"\" for i in range(len(line))]",
"+for i in range(len(line) - 1, -1, -1):",
"+ lis[len(line) - 1 - i] = line[i]",
"+else:",
"+ print(\"\".join(lis))"
] | false | 0.040788 | 0.008895 | 4.585651 | [
"s062770033",
"s883541612"
] |
u374531474 | p03804 | python | s530525392 | s660824099 | 164 | 20 | 3,060 | 3,060 | Accepted | Accepted | 87.8 | N, M = list(map(int, input().split()))
A = [eval(input()) for i in range(N)]
B = [eval(input()) for i in range(M)]
includes = False
for r in range(N - M + 1):
for c in range(N - M + 1):
matches = True
for i in range(M):
for j in range(M):
if A[r + i][c + j] != ... | N, M = list(map(int, input().split()))
A = [eval(input()) for i in range(N)]
B = [eval(input()) for i in range(M)]
includes = False
for r in range(N - M + 1):
for c in range(N - M + 1):
for i in range(M):
for j in range(M):
if A[r + i][c + j] != B[i][j]:
... | 16 | 18 | 436 | 460 | N, M = list(map(int, input().split()))
A = [eval(input()) for i in range(N)]
B = [eval(input()) for i in range(M)]
includes = False
for r in range(N - M + 1):
for c in range(N - M + 1):
matches = True
for i in range(M):
for j in range(M):
if A[r + i][c + j] != B[i][j]:
... | N, M = list(map(int, input().split()))
A = [eval(input()) for i in range(N)]
B = [eval(input()) for i in range(M)]
includes = False
for r in range(N - M + 1):
for c in range(N - M + 1):
for i in range(M):
for j in range(M):
if A[r + i][c + j] != B[i][j]:
break... | false | 11.111111 | [
"- matches = True",
"- matches = False",
"- if matches:",
"+ break",
"+ else:",
"+ continue",
"+ break",
"+ else:"
] | false | 0.04321 | 0.079695 | 0.542193 | [
"s530525392",
"s660824099"
] |
u433380437 | p02554 | python | s524991735 | s643674266 | 393 | 29 | 10,656 | 9,148 | Accepted | Accepted | 92.62 | N=int(eval(input()))
mod = 10**9+7
A=10**N%mod-2*9**N%mod+8**N%mod
print((A%mod)) | N=int(eval(input()))
mod = 10**9+7
A=pow(10,N,mod)-2*pow(9,N,mod)+pow(8,N,mod)
print((A%mod)) | 4 | 4 | 76 | 88 | N = int(eval(input()))
mod = 10**9 + 7
A = 10**N % mod - 2 * 9**N % mod + 8**N % mod
print((A % mod))
| N = int(eval(input()))
mod = 10**9 + 7
A = pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)
print((A % mod))
| false | 0 | [
"-A = 10**N % mod - 2 * 9**N % mod + 8**N % mod",
"+A = pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)"
] | false | 0.314919 | 0.034938 | 9.013734 | [
"s524991735",
"s643674266"
] |
u137226361 | p02899 | python | s039574881 | s460495498 | 92 | 84 | 20,640 | 20,948 | Accepted | Accepted | 8.7 | import sys
n= int(eval(input()))
an = list(map(int, sys.stdin.readline().split()))
ans = [0]*n
for i in range(n):
ans[an[i]-1] = i+1
print((*ans)) | import sys
n= int(eval(input()))
an = list(map(int, sys.stdin.readline().split()))
ans = [0]*n
for i in range(n):
ans[an[i]-1] = str(i+1)
print((' '.join(ans))) | 8 | 8 | 150 | 164 | import sys
n = int(eval(input()))
an = list(map(int, sys.stdin.readline().split()))
ans = [0] * n
for i in range(n):
ans[an[i] - 1] = i + 1
print((*ans))
| import sys
n = int(eval(input()))
an = list(map(int, sys.stdin.readline().split()))
ans = [0] * n
for i in range(n):
ans[an[i] - 1] = str(i + 1)
print((" ".join(ans)))
| false | 0 | [
"- ans[an[i] - 1] = i + 1",
"-print((*ans))",
"+ ans[an[i] - 1] = str(i + 1)",
"+print((\" \".join(ans)))"
] | false | 0.037522 | 0.038254 | 0.980869 | [
"s039574881",
"s460495498"
] |
u193264896 | p02882 | python | s660378441 | s783033481 | 174 | 28 | 14,564 | 9,372 | Accepted | Accepted | 83.91 | from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from ope... | import sys
import math
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
a, b, x = list(map(int, readline().split()))
V = a * a * b / 2
if V < x:
ans = math.degrees(math.atan((2 * (a * a * b - x... | 39 | 22 | 1,135 | 461 | from scipy.sparse.csgraph import (
shortest_path,
floyd_warshall,
dijkstra,
bellman_ford,
johnson,
minimum_spanning_tree,
)
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutatio... | import sys
import math
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
a, b, x = list(map(int, readline().split()))
V = a * a * b / 2
if V < x:
ans = math.degrees(math.atan((2 * (a * a * b - x)) / a**3))
el... | false | 43.589744 | [
"-from scipy.sparse.csgraph import (",
"- shortest_path,",
"- floyd_warshall,",
"- dijkstra,",
"- bellman_ford,",
"- johnson,",
"- minimum_spanning_tree,",
"-)",
"-from scipy.sparse import csr_matrix, coo_matrix, lil_matrix",
"-import numpy as np",
"-from collections import deq... | false | 0.041353 | 0.048845 | 0.846615 | [
"s660378441",
"s783033481"
] |
u461833298 | p03804 | python | s957575838 | s521921348 | 90 | 59 | 3,064 | 3,064 | Accepted | Accepted | 34.44 | N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
lenB = M**2
flg=False
for i in range(N-M+1):
for j in range(N-M+1):
if A[i][j] == B[0][0]:
cnt=0
for k in range(M):
for l in range(M):
... | N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
flg=False
def check(i, j):
cnt=0
for k in range(M):
for l in range(M):
if A[i+k][j+l] == B[k][l]:
cnt += 1
if cnt==M**2:
return True
... | 17 | 25 | 468 | 545 | N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
lenB = M**2
flg = False
for i in range(N - M + 1):
for j in range(N - M + 1):
if A[i][j] == B[0][0]:
cnt = 0
for k in range(M):
for l in range(M):
... | N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
flg = False
def check(i, j):
cnt = 0
for k in range(M):
for l in range(M):
if A[i + k][j + l] == B[k][l]:
cnt += 1
if cnt == M**2:
return True
fo... | false | 32 | [
"-lenB = M**2",
"+",
"+",
"+def check(i, j):",
"+ cnt = 0",
"+ for k in range(M):",
"+ for l in range(M):",
"+ if A[i + k][j + l] == B[k][l]:",
"+ cnt += 1",
"+ if cnt == M**2:",
"+ return True",
"+",
"+",
"- cnt = 0",
"- ... | false | 0.038001 | 0.062513 | 0.607883 | [
"s957575838",
"s521921348"
] |
u366996583 | p02571 | python | s614900290 | s561948103 | 67 | 59 | 9,104 | 8,976 | Accepted | Accepted | 11.94 | s=eval(input())
t=eval(input())
ans=1000000
num=len(s)-len(t)
for i in range(num+1):
r=0
for j in range(len(t)):
if s[i+j]!=t[j]:
r+=1
if r<ans:
ans=r
print(ans) | from sys import stdin
def i():
return stdin.readline().rstrip()
def mi():
return list(map(int(),stdin.readline().rstrip().split()))
def li():
return list(map(int,stdin.readline().rstrip()))
ans=10000
s=i()
t=i()
ls=len(s)
lt=len(t)
l=ls-lt
for i in range(l+1):
cnt=0
for j in range(lt)... | 14 | 22 | 192 | 409 | s = eval(input())
t = eval(input())
ans = 1000000
num = len(s) - len(t)
for i in range(num + 1):
r = 0
for j in range(len(t)):
if s[i + j] != t[j]:
r += 1
if r < ans:
ans = r
print(ans)
| from sys import stdin
def i():
return stdin.readline().rstrip()
def mi():
return list(map(int(), stdin.readline().rstrip().split()))
def li():
return list(map(int, stdin.readline().rstrip()))
ans = 10000
s = i()
t = i()
ls = len(s)
lt = len(t)
l = ls - lt
for i in range(l + 1):
cnt = 0
for j... | false | 36.363636 | [
"-s = eval(input())",
"-t = eval(input())",
"-ans = 1000000",
"-num = len(s) - len(t)",
"-for i in range(num + 1):",
"- r = 0",
"- for j in range(len(t)):",
"+from sys import stdin",
"+",
"+",
"+def i():",
"+ return stdin.readline().rstrip()",
"+",
"+",
"+def mi():",
"+ ret... | false | 0.044644 | 0.047716 | 0.935614 | [
"s614900290",
"s561948103"
] |
u423966555 | p03613 | python | s361211188 | s253404271 | 130 | 100 | 21,012 | 20,736 | Accepted | Accepted | 23.08 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
d = Counter(A)
ans = 0
for i in range(1, 10**5+1):
tmp = d[i-1] + d[i] + d[i+1]
ans = max(tmp, ans)
print(ans)
| from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
d = Counter(A)
ans = 0
for k in list(d.keys()):
tmp = d[k-1] + d[k] + d[k+1]
ans = max(ans, tmp)
print(ans)
| 12 | 12 | 218 | 209 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
d = Counter(A)
ans = 0
for i in range(1, 10**5 + 1):
tmp = d[i - 1] + d[i] + d[i + 1]
ans = max(tmp, ans)
print(ans)
| from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
d = Counter(A)
ans = 0
for k in list(d.keys()):
tmp = d[k - 1] + d[k] + d[k + 1]
ans = max(ans, tmp)
print(ans)
| false | 0 | [
"-for i in range(1, 10**5 + 1):",
"- tmp = d[i - 1] + d[i] + d[i + 1]",
"- ans = max(tmp, ans)",
"+for k in list(d.keys()):",
"+ tmp = d[k - 1] + d[k] + d[k + 1]",
"+ ans = max(ans, tmp)"
] | false | 0.2313 | 0.043027 | 5.37567 | [
"s361211188",
"s253404271"
] |
u146803137 | p02987 | python | s096460711 | s140834988 | 27 | 23 | 9,028 | 8,892 | Accepted | Accepted | 14.81 | s = eval(input())
if len(set(s)) == 2 and sum(s[i] == s[-i] for i in range(4))%2 == 0:
print('Yes')
else:
print('No') | s = eval(input())
sd = s[::-1]
ans = 'No'
if len(set(s)) == 2:
c = 0
for i in range(4):
if s[i] == sd[i]:
c += 1
if c%2 == 0:
ans = 'Yes'
print(ans)
| 5 | 11 | 123 | 193 | s = eval(input())
if len(set(s)) == 2 and sum(s[i] == s[-i] for i in range(4)) % 2 == 0:
print("Yes")
else:
print("No")
| s = eval(input())
sd = s[::-1]
ans = "No"
if len(set(s)) == 2:
c = 0
for i in range(4):
if s[i] == sd[i]:
c += 1
if c % 2 == 0:
ans = "Yes"
print(ans)
| false | 54.545455 | [
"-if len(set(s)) == 2 and sum(s[i] == s[-i] for i in range(4)) % 2 == 0:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+sd = s[::-1]",
"+ans = \"No\"",
"+if len(set(s)) == 2:",
"+ c = 0",
"+ for i in range(4):",
"+ if s[i] == sd[i]:",
"+ c += 1",
"+ if c ... | false | 0.044534 | 0.044251 | 1.006401 | [
"s096460711",
"s140834988"
] |
u075595666 | p02757 | python | s927442698 | s436936654 | 945 | 481 | 4,140 | 12,944 | Accepted | Accepted | 49.1 | def main():
import sys
input = sys.stdin.readline
n,p = [int(i) for i in input().split()]
s = eval(input())
ans = 0
import math
def nCr(n, r):
if n < r:
return 0
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if p == 2 or p == 5:
for i in ... | def main():
import sys
input = sys.stdin.readline
n,p = [int(i) for i in input().split()]
s = eval(input())
ans = 0
import collections
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
print(ans)
exit()
else:
c... | 32 | 30 | 663 | 649 | def main():
import sys
input = sys.stdin.readline
n, p = [int(i) for i in input().split()]
s = eval(input())
ans = 0
import math
def nCr(n, r):
if n < r:
return 0
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if p == 2 or p == 5:
... | def main():
import sys
input = sys.stdin.readline
n, p = [int(i) for i in input().split()]
s = eval(input())
ans = 0
import collections
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
print(ans)
exit()
else... | false | 6.25 | [
"- import math",
"-",
"- def nCr(n, r):",
"- if n < r:",
"- return 0",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"+ import collections",
"- chk = [0] * p",
"- chk[0] = 1",
"+ chk = []",
"+ chk = coll... | false | 0.112834 | 0.077972 | 1.447099 | [
"s927442698",
"s436936654"
] |
u811841526 | p02410 | python | s628239811 | s398938567 | 40 | 20 | 7,996 | 6,016 | Accepted | Accepted | 50 | n,m = list(map(int, input().split()))
# init
A = []
b = []
for _ in range(n):
A.append(list(map(int, input().split())))
for _ in range(m):
b.append(int(eval(input())))
for row in range(n):
p = 0
for i, j in zip(A[row], b):
p += i * j
print(p) | n, m = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
b = []
for i in range(m):
b.append(int(eval(input())))
for i in range(n):
sum = 0
for j in range(m):
sum += A[i][j] * b[j]
print(sum)
| 16 | 15 | 276 | 274 | n, m = list(map(int, input().split()))
# init
A = []
b = []
for _ in range(n):
A.append(list(map(int, input().split())))
for _ in range(m):
b.append(int(eval(input())))
for row in range(n):
p = 0
for i, j in zip(A[row], b):
p += i * j
print(p)
| n, m = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
b = []
for i in range(m):
b.append(int(eval(input())))
for i in range(n):
sum = 0
for j in range(m):
sum += A[i][j] * b[j]
print(sum)
| false | 6.25 | [
"-# init",
"+for i in range(n):",
"+ A.append(list(map(int, input().split())))",
"-for _ in range(n):",
"- A.append(list(map(int, input().split())))",
"-for _ in range(m):",
"+for i in range(m):",
"-for row in range(n):",
"- p = 0",
"- for i, j in zip(A[row], b):",
"- p += i *... | false | 0.037036 | 0.08285 | 0.447029 | [
"s628239811",
"s398938567"
] |
u114641312 | p02642 | python | s892632149 | s716633233 | 799 | 606 | 123,320 | 129,508 | Accepted | Accepted | 24.16 | import numpy as np
from numba import njit
# @njit('(i4[::1],)', cache=True)
# @njit
@njit(cache = True)
def solve(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = 0
for x in A:
ret += count[x] == 1... | import numpy as np
from numba import njit
# @njit
# @njit(cache = True)
@njit('(i4[::1],)', cache=True)
def solve(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = 0
for x in A:
ret += count[x] == 1... | 21 | 21 | 433 | 433 | import numpy as np
from numba import njit
# @njit('(i4[::1],)', cache=True)
# @njit
@njit(cache=True)
def solve(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = 0
for x in A:
ret += count[x] == 1
return ret
... | import numpy as np
from numba import njit
# @njit
# @njit(cache = True)
@njit("(i4[::1],)", cache=True)
def solve(A):
count = np.zeros(10**6 + 10, np.int32)
for x in A:
if count[x] > 1:
continue
count[::x] += 1
ret = 0
for x in A:
ret += count[x] == 1
return ret
... | false | 0 | [
"-# @njit('(i4[::1],)', cache=True)",
"-@njit(cache=True)",
"+# @njit(cache = True)",
"+@njit(\"(i4[::1],)\", cache=True)"
] | false | 0.193468 | 0.490631 | 0.394325 | [
"s892632149",
"s716633233"
] |
u790710233 | p03497 | python | s195771885 | s950020917 | 144 | 118 | 33,152 | 32,540 | Accepted | Accepted | 18.06 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a in list(d.keys()):
d[a] += 1
else:
d[a] = 1
ls = sorted(d.values())
ans = 0
for v in ls[:len(ls)-k]:
ans += v
print(ans)
| from collections import Counter
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
d = Counter(A)
ls = sorted(d.values())
ans = 0
for v in ls[:len(ls)-k]:
ans += v
print(ans)
| 18 | 10 | 258 | 207 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a in list(d.keys()):
d[a] += 1
else:
d[a] = 1
ls = sorted(d.values())
ans = 0
for v in ls[: len(ls) - k]:
ans += v
print(ans)
| from collections import Counter
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
d = Counter(A)
ls = sorted(d.values())
ans = 0
for v in ls[: len(ls) - k]:
ans += v
print(ans)
| false | 44.444444 | [
"+from collections import Counter",
"+",
"-d = {}",
"-for a in A:",
"- if a in list(d.keys()):",
"- d[a] += 1",
"- else:",
"- d[a] = 1",
"+d = Counter(A)"
] | false | 0.037037 | 0.034258 | 1.081103 | [
"s195771885",
"s950020917"
] |
u839537730 | p03645 | python | s378350307 | s259250619 | 860 | 786 | 38,440 | 38,320 | Accepted | Accepted | 8.6 | N, M = list(map(int, input().split()))
graph = [list() for i in range(N+1)]
for i in range(M):
a, b = tuple(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
pos_flag = False
for u in graph[1]:
if N in graph[u]:
pos_flag = True
break
if pos_flag == True:
... | N, M = list(map(int, input().split()))
graph = [list() for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
for g1 in graph[0]:
if N-1 in graph[g1]:
print("POSSIBLE")
break
else:
print(... | 17 | 15 | 371 | 321 | N, M = list(map(int, input().split()))
graph = [list() for i in range(N + 1)]
for i in range(M):
a, b = tuple(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
pos_flag = False
for u in graph[1]:
if N in graph[u]:
pos_flag = True
break
if pos_flag == True:
print("POSSI... | N, M = list(map(int, input().split()))
graph = [list() for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
for g1 in graph[0]:
if N - 1 in graph[g1]:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE")
| false | 11.764706 | [
"-graph = [list() for i in range(N + 1)]",
"-for i in range(M):",
"- a, b = tuple(map(int, input().split()))",
"- graph[a].append(b)",
"- graph[b].append(a)",
"-pos_flag = False",
"-for u in graph[1]:",
"- if N in graph[u]:",
"- pos_flag = True",
"+graph = [list() for _ in range... | false | 0.111584 | 0.047046 | 2.371818 | [
"s378350307",
"s259250619"
] |
u759651152 | p03240 | python | s862467308 | s729208719 | 419 | 61 | 3,064 | 3,064 | Accepted | Accepted | 85.44 | #-*-coding:utf-8-*-
def main():
n = int(eval(input()))
arrys = [tuple(map(int, input().split())) for _ in range(n)]
for i in range(101):
for j in range(101):
for arry in arrys:
x_tmp, y_tmp, h_tmp = arry
if h_tmp != 0:
break
... | #-*-coding:utf-8-*-
def main():
n = int(eval(input()))
arrys = [tuple(map(int, input().split())) for _ in range(n)]
for i in range(101):
for j in range(101):
for x_tmp, y_tmp, h_tmp in arrys:
if h_tmp != 0:
break
H = h_tmp + abs(... | 25 | 20 | 740 | 594 | # -*-coding:utf-8-*-
def main():
n = int(eval(input()))
arrys = [tuple(map(int, input().split())) for _ in range(n)]
for i in range(101):
for j in range(101):
for arry in arrys:
x_tmp, y_tmp, h_tmp = arry
if h_tmp != 0:
break
... | # -*-coding:utf-8-*-
def main():
n = int(eval(input()))
arrys = [tuple(map(int, input().split())) for _ in range(n)]
for i in range(101):
for j in range(101):
for x_tmp, y_tmp, h_tmp in arrys:
if h_tmp != 0:
break
H = h_tmp + abs(x_tmp - i)... | false | 20 | [
"- for arry in arrys:",
"- x_tmp, y_tmp, h_tmp = arry",
"+ for x_tmp, y_tmp, h_tmp in arrys:",
"- flag = 1",
"- for arry in arrys:",
"- x_t, y_t, h_t = arry",
"- if h_t == max(H - abs(x_t - i) - abs(y_t - j), 0):",
... | false | 0.0681 | 0.037253 | 1.828032 | [
"s862467308",
"s729208719"
] |
u864197622 | p02734 | python | s939000085 | s011935837 | 783 | 614 | 64,044 | 3,640 | Accepted | Accepted | 21.58 | def setM():
K2 = K // 2
k = K // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m))
k //= 2
def modp(n):
K2 = K // 2
k = K // 2
for k, m in M:
n = (n & (~m)) + ((n & m) >> (K2 + k)) * ((1 << K2 + k) % P)
return n
... | def setM():
k = K2 // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m, ~m, (1 << K2 + k) % P))
k //= 2
def modp(n):
for k, m, tm, a in M:
n = (n & tm) + ((n & m) >> K2 + k) * a
return n
K = 64
K2 = K // 2
P = 998244353
mm = ... | 33 | 31 | 617 | 589 | def setM():
K2 = K // 2
k = K // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m))
k //= 2
def modp(n):
K2 = K // 2
k = K // 2
for k, m in M:
n = (n & (~m)) + ((n & m) >> (K2 + k)) * ((1 << K2 + k) % P)
return n
K = 64
P = 99... | def setM():
k = K2 // 2
while k:
m = int(("1" * (K2 - k) + "0" * (K2 + k)) * 3001, 2)
M.append((k, m, ~m, (1 << K2 + k) % P))
k //= 2
def modp(n):
for k, m, tm, a in M:
n = (n & tm) + ((n & m) >> K2 + k) * a
return n
K = 64
K2 = K // 2
P = 998244353
mm = (1 << K * 300... | false | 6.060606 | [
"- K2 = K // 2",
"- k = K // 2",
"+ k = K2 // 2",
"- M.append((k, m))",
"+ M.append((k, m, ~m, (1 << K2 + k) % P))",
"- K2 = K // 2",
"- k = K // 2",
"- for k, m in M:",
"- n = (n & (~m)) + ((n & m) >> (K2 + k)) * ((1 << K2 + k) % P)",
"+ for k, m, tm, a i... | false | 0.125118 | 0.040658 | 3.077299 | [
"s939000085",
"s011935837"
] |
u279493135 | p03163 | python | s930859621 | s982462766 | 564 | 400 | 123,756 | 63,336 | Accepted | Accepted | 29.08 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | 31 | 29 | 998 | 933 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_u... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_u... | false | 6.451613 | [
"-dp = [[0] * (W + 1) for _ in range(N + 1)]",
"+dp = [0] * (W + 1)",
"- for j in range(W + 1):",
"+ for j in range(W, -1, -1):",
"- dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i])",
"- else:",
"- dp[i + 1][j] = dp[i][j]",
"-print((dp[N][W]))",
"+ d... | false | 0.047419 | 0.007538 | 6.290544 | [
"s930859621",
"s982462766"
] |
u970937288 | p02614 | python | s453332276 | s481228054 | 181 | 133 | 77,228 | 9,272 | Accepted | Accepted | 26.52 | import copy
h,w,k=list(map(int,input().split()))
c=[[[".","#"].index(i)for i in eval(input())]for j in range(h)]
l=0
for i in range(2**h):
for j in range(2**w):
x,y=bin(i)[2:].zfill(h),bin(j)[2:].zfill(w)
a,b=[],[]
for p in range(h):
if x[p]=="1":
a+=[p]... | import copy
h,w,k=list(map(int,input().split()))
c=[[[".","#"].index(j)for j in list(eval(input()))]for i in range(h)]
p=0
for i in range(2**h):
a=bin(i)[2:].zfill(h)
for j in range(2**w):
b=bin(j)[2:].zfill(w)
d=copy.deepcopy(c)
for x in range(w):
if b[x]=="1":
... | 25 | 22 | 631 | 557 | import copy
h, w, k = list(map(int, input().split()))
c = [[[".", "#"].index(i) for i in eval(input())] for j in range(h)]
l = 0
for i in range(2**h):
for j in range(2**w):
x, y = bin(i)[2:].zfill(h), bin(j)[2:].zfill(w)
a, b = [], []
for p in range(h):
if x[p] == "1":
... | import copy
h, w, k = list(map(int, input().split()))
c = [[[".", "#"].index(j) for j in list(eval(input()))] for i in range(h)]
p = 0
for i in range(2**h):
a = bin(i)[2:].zfill(h)
for j in range(2**w):
b = bin(j)[2:].zfill(w)
d = copy.deepcopy(c)
for x in range(w):
if b[x] ... | false | 12 | [
"-c = [[[\".\", \"#\"].index(i) for i in eval(input())] for j in range(h)]",
"-l = 0",
"+c = [[[\".\", \"#\"].index(j) for j in list(eval(input()))] for i in range(h)]",
"+p = 0",
"+ a = bin(i)[2:].zfill(h)",
"- x, y = bin(i)[2:].zfill(h), bin(j)[2:].zfill(w)",
"- a, b = [], []",
"- ... | false | 0.086339 | 0.082828 | 1.042386 | [
"s453332276",
"s481228054"
] |
u644907318 | p03283 | python | s194475465 | s266856324 | 1,730 | 626 | 60,780 | 81,724 | Accepted | Accepted | 63.82 | N,M,Q = list(map(int,input().split()))
A = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
l,r = list(map(int,input().split()))
A[l][r] += 1
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
dp[N][1] = A[N][1]
for j in range(2,N+1):
dp[N][j] = dp[N][j-1]+A[N][j]
for i in range(N-1... | N,M,Q = list(map(int,input().split()))
A = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
L,R = list(map(int,input().split()))
A[L][R] += 1
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
dp[N][N] = A[N][N]
for i in range(N-1,0,-1):
for j in range(i,N+1):
dp[i][j] = A[i... | 17 | 15 | 545 | 466 | N, M, Q = list(map(int, input().split()))
A = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for _ in range(M):
l, r = list(map(int, input().split()))
A[l][r] += 1
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[N][1] = A[N][1]
for j in range(2, N + 1):
dp[N][j] = dp[N][j - 1] + A[N][j]
for i i... | N, M, Q = list(map(int, input().split()))
A = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for _ in range(M):
L, R = list(map(int, input().split()))
A[L][R] += 1
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[N][N] = A[N][N]
for i in range(N - 1, 0, -1):
for j in range(i, N + 1):
dp[... | false | 11.764706 | [
"- l, r = list(map(int, input().split()))",
"- A[l][r] += 1",
"+ L, R = list(map(int, input().split()))",
"+ A[L][R] += 1",
"-dp[N][1] = A[N][1]",
"-for j in range(2, N + 1):",
"- dp[N][j] = dp[N][j - 1] + A[N][j]",
"+dp[N][N] = A[N][N]",
"- dp[i][1] = dp[i + 1][1] + A[i][1]",
"-... | false | 0.04427 | 0.036323 | 1.218776 | [
"s194475465",
"s266856324"
] |
u094999522 | p03319 | python | s477995782 | s967731542 | 52 | 31 | 20,156 | 8,984 | Accepted | Accepted | 40.38 | #!/usr/bin/env python3
n, k, *a = list(map(int, open(0).read().split()))
print((-(-(n - 1) // (k - 1))))
| n, k = list(map(int, input().split()))
print((-(-~-n // ~-k)))
| 3 | 2 | 99 | 56 | #!/usr/bin/env python3
n, k, *a = list(map(int, open(0).read().split()))
print((-(-(n - 1) // (k - 1))))
| n, k = list(map(int, input().split()))
print((-(-~-n // ~-k)))
| false | 33.333333 | [
"-#!/usr/bin/env python3",
"-n, k, *a = list(map(int, open(0).read().split()))",
"-print((-(-(n - 1) // (k - 1))))",
"+n, k = list(map(int, input().split()))",
"+print((-(-~-n // ~-k)))"
] | false | 0.042333 | 0.07567 | 0.559448 | [
"s477995782",
"s967731542"
] |
u663710122 | p03599 | python | s561720206 | s661986654 | 271 | 78 | 3,064 | 3,316 | Accepted | Accepted | 71.22 | A, B, C, D, E, F = list(map(int, input().split()))
ret_w = 1
ret_s = -1
for a in range(F // (100 * A) + 1):
w_a = a * A * 100
for b in range((F - w_a) // (100 * B) + 1):
if a + b == 0:
continue
w_b = b * B * 100
max_suger = min(F - w_a - w_b, (w_a + w_b) // 100 *... | A, B, C, D, E, F = list(map(int, input().split()))
x = set()
y = set()
for i in range(F // (100 * A) + 1):
for j in range((F - 100 * A * i) // (100 * B) + 1):
if i + j == 0:
continue
x.add(A * i * 100 + B * j * 100)
for i in range(F // C + 1):
for j in range((F - C * i... | 22 | 25 | 660 | 565 | A, B, C, D, E, F = list(map(int, input().split()))
ret_w = 1
ret_s = -1
for a in range(F // (100 * A) + 1):
w_a = a * A * 100
for b in range((F - w_a) // (100 * B) + 1):
if a + b == 0:
continue
w_b = b * B * 100
max_suger = min(F - w_a - w_b, (w_a + w_b) // 100 * E)
f... | A, B, C, D, E, F = list(map(int, input().split()))
x = set()
y = set()
for i in range(F // (100 * A) + 1):
for j in range((F - 100 * A * i) // (100 * B) + 1):
if i + j == 0:
continue
x.add(A * i * 100 + B * j * 100)
for i in range(F // C + 1):
for j in range((F - C * i) // D + 1):
... | false | 12 | [
"+x = set()",
"+y = set()",
"+for i in range(F // (100 * A) + 1):",
"+ for j in range((F - 100 * A * i) // (100 * B) + 1):",
"+ if i + j == 0:",
"+ continue",
"+ x.add(A * i * 100 + B * j * 100)",
"+for i in range(F // C + 1):",
"+ for j in range((F - C * i) // D + 1):... | false | 0.072367 | 0.114072 | 0.634395 | [
"s561720206",
"s661986654"
] |
u152353734 | p02401 | python | s823960627 | s440570500 | 30 | 20 | 7,496 | 7,496 | Accepted | Accepted | 33.33 | while True:
a = eval(input())
if '?' in a:
break
print((eval(a.replace("/", "//")))) | while True:
a = eval(input())
if '?' in a:
break
print(("%d" % eval(a))) | 5 | 5 | 100 | 88 | while True:
a = eval(input())
if "?" in a:
break
print((eval(a.replace("/", "//"))))
| while True:
a = eval(input())
if "?" in a:
break
print(("%d" % eval(a)))
| false | 0 | [
"- print((eval(a.replace(\"/\", \"//\"))))",
"+ print((\"%d\" % eval(a)))"
] | false | 0.037685 | 0.036503 | 1.032389 | [
"s823960627",
"s440570500"
] |
u732870425 | p03814 | python | s030302220 | s223916555 | 38 | 35 | 4,840 | 3,516 | Accepted | Accepted | 7.89 | s = list(eval(input()))
begin = 0
for i in range(len(s)):
if s[i] == "A":
begin = i
break
end = 0
for i in reversed(list(range(len(s)))):
if s[i] == "Z":
end = i
break
print((end - begin + 1)) | s = eval(input())
begin = 0
for i in range(len(s)):
if s[i] == "A":
begin = i
break
end = 0
for i in reversed(list(range(len(s)))):
if s[i] == "Z":
end = i
break
print((end - begin + 1)) | 14 | 14 | 233 | 227 | s = list(eval(input()))
begin = 0
for i in range(len(s)):
if s[i] == "A":
begin = i
break
end = 0
for i in reversed(list(range(len(s)))):
if s[i] == "Z":
end = i
break
print((end - begin + 1))
| s = eval(input())
begin = 0
for i in range(len(s)):
if s[i] == "A":
begin = i
break
end = 0
for i in reversed(list(range(len(s)))):
if s[i] == "Z":
end = i
break
print((end - begin + 1))
| false | 0 | [
"-s = list(eval(input()))",
"+s = eval(input())"
] | false | 0.03831 | 0.037714 | 1.01581 | [
"s030302220",
"s223916555"
] |
u480200603 | p02971 | python | s572678291 | s441407723 | 1,486 | 550 | 84,440 | 12,628 | Accepted | Accepted | 62.99 | n = int(eval(input()))
l = []
for i in range(n):
l.append([int(eval(input())), i])
l.sort(reverse=True)
m1 = l[0][0]
m2 = l[1][0]
id1 = l[0][1]
for i in range(n):
if i == id1:
print(m2)
else:
print(m1)
| n = int(eval(input()))
l = []
m1 = 0
m2 = 0
for i in range(n):
num = int(eval(input()))
l.append(num)
if num > m1:
m1 = num
elif num > m2:
m2 = num
for i in range(n):
if l[i] != m1:
print(m1)
else:
print(m2)
| 13 | 17 | 230 | 269 | n = int(eval(input()))
l = []
for i in range(n):
l.append([int(eval(input())), i])
l.sort(reverse=True)
m1 = l[0][0]
m2 = l[1][0]
id1 = l[0][1]
for i in range(n):
if i == id1:
print(m2)
else:
print(m1)
| n = int(eval(input()))
l = []
m1 = 0
m2 = 0
for i in range(n):
num = int(eval(input()))
l.append(num)
if num > m1:
m1 = num
elif num > m2:
m2 = num
for i in range(n):
if l[i] != m1:
print(m1)
else:
print(m2)
| false | 23.529412 | [
"+m1 = 0",
"+m2 = 0",
"- l.append([int(eval(input())), i])",
"-l.sort(reverse=True)",
"-m1 = l[0][0]",
"-m2 = l[1][0]",
"-id1 = l[0][1]",
"+ num = int(eval(input()))",
"+ l.append(num)",
"+ if num > m1:",
"+ m1 = num",
"+ elif num > m2:",
"+ m2 = num",
"- if... | false | 0.06761 | 0.04564 | 1.481371 | [
"s572678291",
"s441407723"
] |
u761320129 | p03800 | python | s964978116 | s449387072 | 179 | 148 | 3,444 | 3,444 | Accepted | Accepted | 17.32 | N = int(eval(input()))
S = eval(input())
for lf in ['SS','SW','WS','WW']:
tmp = lf
for c in S:
if (tmp[-1]=='W') ^ (c=='x'):
t = 'S' if tmp[-2]=='W' else 'W'
else:
t = 'S' if tmp[-2]=='S' else 'W'
tmp += t
if tmp[:2] == tmp[-2:]:
print((tm... | N = int(eval(input()))
S = eval(input())
for a,b in ['SS','SW','WS','WW']:
tmp = a+b
for c in S:
if (c=='x') ^ (tmp[-1]=='W'):
tmp += ('W' if tmp[-2]=='S' else 'S')
else:
tmp += tmp[-2]
#print(tmp)
if tmp[:2] == tmp[-2:]:
print((tmp[1:-1]))
... | 15 | 15 | 342 | 330 | N = int(eval(input()))
S = eval(input())
for lf in ["SS", "SW", "WS", "WW"]:
tmp = lf
for c in S:
if (tmp[-1] == "W") ^ (c == "x"):
t = "S" if tmp[-2] == "W" else "W"
else:
t = "S" if tmp[-2] == "S" else "W"
tmp += t
if tmp[:2] == tmp[-2:]:
print((tmp[... | N = int(eval(input()))
S = eval(input())
for a, b in ["SS", "SW", "WS", "WW"]:
tmp = a + b
for c in S:
if (c == "x") ^ (tmp[-1] == "W"):
tmp += "W" if tmp[-2] == "S" else "S"
else:
tmp += tmp[-2]
# print(tmp)
if tmp[:2] == tmp[-2:]:
print((tmp[1:-1]))
... | false | 0 | [
"-for lf in [\"SS\", \"SW\", \"WS\", \"WW\"]:",
"- tmp = lf",
"+for a, b in [\"SS\", \"SW\", \"WS\", \"WW\"]:",
"+ tmp = a + b",
"- if (tmp[-1] == \"W\") ^ (c == \"x\"):",
"- t = \"S\" if tmp[-2] == \"W\" else \"W\"",
"+ if (c == \"x\") ^ (tmp[-1] == \"W\"):",
"+ ... | false | 0.045757 | 0.152254 | 0.300534 | [
"s964978116",
"s449387072"
] |
u968166680 | p03999 | python | s448251124 | s116658482 | 35 | 32 | 9,448 | 9,536 | Accepted | Accepted | 8.57 | import sys
from functools import lru_cache
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
N = len(S)
@lru_cache(maxsize=None)
def rec(i):
if ... | import sys
from functools import lru_cache
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
N = len(S)
ans = 0
for bit in range(1 << (N - 1)):
... | 32 | 30 | 576 | 585 | import sys
from functools import lru_cache
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
N = len(S)
@lru_cache(maxsize=None)
def rec(i):
if i == N:
... | import sys
from functools import lru_cache
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
S = readline().strip()
N = len(S)
ans = 0
for bit in range(1 << (N - 1)):
vec = []
for... | false | 6.25 | [
"-",
"- @lru_cache(maxsize=None)",
"- def rec(i):",
"- if i == N:",
"- return 0",
"- ans = 0",
"- for j in range(i + 1, N + 1):",
"- ans += int(S[i:j]) * pow(2, max(N - j - 1, 0)) + rec(j)",
"- return ans",
"-",
"- print((rec(0)))",
"+... | false | 0.035342 | 0.034716 | 1.018038 | [
"s448251124",
"s116658482"
] |
u669819350 | p02813 | python | s638881422 | s239421759 | 269 | 182 | 73,436 | 44,656 | Accepted | Accepted | 32.34 | from collections import deque
def solve(N, P, Q):
stack = deque()
vals = [i for i in range(1, N + 1)]
for idx, next_val in enumerate(vals):
stack.append([[next_val], vals[: idx] + vals[idx + 1:]])
a, b = -1, -1
counter = 0
while stack:
cur_list, rest = stack.popleft()
... | from itertools import permutations
def solve(N, P, Q):
vals = [i for i in range(1, N + 1)]
perms = list(permutations(vals))
print((abs(perms.index(P) - perms.index(Q))))
if __name__ == "__main__":
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().... | 27 | 12 | 842 | 342 | from collections import deque
def solve(N, P, Q):
stack = deque()
vals = [i for i in range(1, N + 1)]
for idx, next_val in enumerate(vals):
stack.append([[next_val], vals[:idx] + vals[idx + 1 :]])
a, b = -1, -1
counter = 0
while stack:
cur_list, rest = stack.popleft()
i... | from itertools import permutations
def solve(N, P, Q):
vals = [i for i in range(1, N + 1)]
perms = list(permutations(vals))
print((abs(perms.index(P) - perms.index(Q))))
if __name__ == "__main__":
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split())... | false | 55.555556 | [
"-from collections import deque",
"+from itertools import permutations",
"- stack = deque()",
"- for idx, next_val in enumerate(vals):",
"- stack.append([[next_val], vals[:idx] + vals[idx + 1 :]])",
"- a, b = -1, -1",
"- counter = 0",
"- while stack:",
"- cur_list, rest ... | false | 0.046269 | 0.126173 | 0.36671 | [
"s638881422",
"s239421759"
] |
u876742094 | p02596 | python | s781982305 | s786195100 | 344 | 212 | 11,084 | 9,052 | Accepted | Accepted | 38.37 | import math
from functools import reduce
import collections
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
... | k=int(eval(input()))
if k%7==0:
k//=7
res=1
if k%2==0 or k%5==0:
print((-1))
else:
k*=9
for i in range(k):
res*=10
if res%k==1:
print((i+1))
break
else:
res%=k
| 58 | 15 | 1,136 | 240 | import math
from functools import reduce
import collections
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n... | k = int(eval(input()))
if k % 7 == 0:
k //= 7
res = 1
if k % 2 == 0 or k % 5 == 0:
print((-1))
else:
k *= 9
for i in range(k):
res *= 10
if res % k == 1:
print((i + 1))
break
else:
res %= k
| false | 74.137931 | [
"-import math",
"-from functools import reduce",
"-import collections",
"-",
"-",
"-def prime_factorize(n):",
"- a = []",
"- while n % 2 == 0:",
"- a.append(2)",
"- n //= 2",
"- f = 3",
"- while f * f <= n:",
"- if n % f == 0:",
"- a.append(f)",
... | false | 0.090387 | 0.180928 | 0.499574 | [
"s781982305",
"s786195100"
] |
u576432509 | p03111 | python | s500209429 | s101518942 | 275 | 76 | 3,064 | 3,064 | Accepted | Accepted | 72.36 |
n,a,b,c=list(map(int,input().split()))
l=[0]*n
for i in range(n):
l[i]=int(eval(input()))
import itertools
mpmin=a+b+c+1
for i in itertools.product([0,1,2,3], repeat=n):
aa=0
bb=0
cc=0
mpa=0
mpb=0
mpc=0
ia=0
ib=0
ic=0
for ii in range(n):
if... |
n,a,b,c=list(map(int,input().split()))
l=[0]*n
for i in range(n):
l[i]=int(eval(input()))
inf=10**9
def dfs(cur,aa,bb,cc):
if cur==n:
if min(aa,bb,cc)>0:
return abs(a-aa)+abs(b-bb)+abs(c-cc)-30
else:
return inf
ret0=dfs(cur+1,aa,bb,cc)
ret1=dfs(c... | 42 | 23 | 830 | 532 | n, a, b, c = list(map(int, input().split()))
l = [0] * n
for i in range(n):
l[i] = int(eval(input()))
import itertools
mpmin = a + b + c + 1
for i in itertools.product([0, 1, 2, 3], repeat=n):
aa = 0
bb = 0
cc = 0
mpa = 0
mpb = 0
mpc = 0
ia = 0
ib = 0
ic = 0
for ii in range(... | n, a, b, c = list(map(int, input().split()))
l = [0] * n
for i in range(n):
l[i] = int(eval(input()))
inf = 10**9
def dfs(cur, aa, bb, cc):
if cur == n:
if min(aa, bb, cc) > 0:
return abs(a - aa) + abs(b - bb) + abs(c - cc) - 30
else:
return inf
ret0 = dfs(cur + 1, ... | false | 45.238095 | [
"-import itertools",
"+inf = 10**9",
"-mpmin = a + b + c + 1",
"-for i in itertools.product([0, 1, 2, 3], repeat=n):",
"- aa = 0",
"- bb = 0",
"- cc = 0",
"- mpa = 0",
"- mpb = 0",
"- mpc = 0",
"- ia = 0",
"- ib = 0",
"- ic = 0",
"- for ii in range(n):",
"- ... | false | 0.367199 | 0.065196 | 5.632257 | [
"s500209429",
"s101518942"
] |
u970308980 | p03031 | python | s637519970 | s293625634 | 188 | 22 | 39,792 | 3,064 | Accepted | Accepted | 88.3 | # bit演算
N, M = list(map(int, input().split()))
# 各スイッチがどの電球に繋がっているかをbitで持つ
# スイッチ1が電球1、電球2に繋がっている場合は
# 101 -> 5 という持ち方
a = [0] * N
for i in range(M):
K, *S = list(map(int, input().split()))
for j in range(K):
s = S[j]
s -= 1
# s番目のスイッチにi番目の電球が繋がっている
a[s] |= 1 << i
... | N, M = list(map(int, input().split()))
a = [0] * N
for i in range(M):
K, *S = list(map(int, input().split()))
for j in range(K):
s = S[j]
s -= 1
# s番目のスイッチにi番目の電球が繋がっている
a[s] |= 1 << i
expected = 0
P = list(map(int, input().split()))
for i in range(M):
if P[i]... | 35 | 27 | 801 | 534 | # bit演算
N, M = list(map(int, input().split()))
# 各スイッチがどの電球に繋がっているかをbitで持つ
# スイッチ1が電球1、電球2に繋がっている場合は
# 101 -> 5 という持ち方
a = [0] * N
for i in range(M):
K, *S = list(map(int, input().split()))
for j in range(K):
s = S[j]
s -= 1
# s番目のスイッチにi番目の電球が繋がっている
a[s] |= 1 << i
expected = 0
l ... | N, M = list(map(int, input().split()))
a = [0] * N
for i in range(M):
K, *S = list(map(int, input().split()))
for j in range(K):
s = S[j]
s -= 1
# s番目のスイッチにi番目の電球が繋がっている
a[s] |= 1 << i
expected = 0
P = list(map(int, input().split()))
for i in range(M):
if P[i]:
expect... | false | 22.857143 | [
"-# bit演算",
"-# 各スイッチがどの電球に繋がっているかをbitで持つ",
"-# スイッチ1が電球1、電球2に繋がっている場合は",
"-# 101 -> 5 という持ち方",
"-l = list(map(int, input().split()))",
"+P = list(map(int, input().split()))",
"- expected |= l[i] << i",
"-# on/offの2通り、スイッチは最大10個なので、# 2^10=1024で全通り試してもOK",
"-# on/offの全ての組み合わせをbitでループする",
"+ i... | false | 0.039131 | 0.118023 | 0.331558 | [
"s637519970",
"s293625634"
] |
u561231954 | p03274 | python | s127222691 | s559291403 | 384 | 254 | 23,096 | 23,108 | Accepted | Accepted | 33.85 | def main():
import numpy as np
n,k=list(map(int,input().split()))
X=list(map(int,input().split()))
X=np.array(X)
Xp,Xz,Xm=X[X>0],X[X==0],X[X<0]
lp,lm=len(Xp),len(Xm)
if 0 in Xz:
k-=1
if k==0:
print((0))
exit()
ans=10**9
if k<=lp:
... | import numpy as np
n,k=list(map(int,input().split()))
X=list(map(int,input().split()))
X=np.array(X)
m=abs(X[:n-k+1])+abs(X[:n-k+1]-X[k-1:])
p=abs(X[k-1:])+abs(X[k-1:]-X[:n-k+1])
ans=np.min(np.minimum(p,m))
print(ans) | 37 | 8 | 740 | 221 | def main():
import numpy as np
n, k = list(map(int, input().split()))
X = list(map(int, input().split()))
X = np.array(X)
Xp, Xz, Xm = X[X > 0], X[X == 0], X[X < 0]
lp, lm = len(Xp), len(Xm)
if 0 in Xz:
k -= 1
if k == 0:
print((0))
exit()
ans = 10**9
if k... | import numpy as np
n, k = list(map(int, input().split()))
X = list(map(int, input().split()))
X = np.array(X)
m = abs(X[: n - k + 1]) + abs(X[: n - k + 1] - X[k - 1 :])
p = abs(X[k - 1 :]) + abs(X[k - 1 :] - X[: n - k + 1])
ans = np.min(np.minimum(p, m))
print(ans)
| false | 78.378378 | [
"-def main():",
"- import numpy as np",
"+import numpy as np",
"- n, k = list(map(int, input().split()))",
"- X = list(map(int, input().split()))",
"- X = np.array(X)",
"- Xp, Xz, Xm = X[X > 0], X[X == 0], X[X < 0]",
"- lp, lm = len(Xp), len(Xm)",
"- if 0 in Xz:",
"- k ... | false | 0.199641 | 0.181576 | 1.099492 | [
"s127222691",
"s559291403"
] |
u818349438 | p03107 | python | s692668173 | s425870727 | 22 | 17 | 3,956 | 3,188 | Accepted | Accepted | 22.73 | S = list(eval(input()))
a = S.count("0")
b = S.count("1")
ans = min(a,b)*2
print(ans) | s = eval(input())
n = len(s)
a = s.count('0')
ans = min(a,n-a)*2
print(ans) | 5 | 5 | 83 | 73 | S = list(eval(input()))
a = S.count("0")
b = S.count("1")
ans = min(a, b) * 2
print(ans)
| s = eval(input())
n = len(s)
a = s.count("0")
ans = min(a, n - a) * 2
print(ans)
| false | 0 | [
"-S = list(eval(input()))",
"-a = S.count(\"0\")",
"-b = S.count(\"1\")",
"-ans = min(a, b) * 2",
"+s = eval(input())",
"+n = len(s)",
"+a = s.count(\"0\")",
"+ans = min(a, n - a) * 2"
] | false | 0.045837 | 0.046572 | 0.984222 | [
"s692668173",
"s425870727"
] |
u369094007 | p02572 | python | s404535527 | s891026948 | 170 | 123 | 31,700 | 31,420 | Accepted | Accepted | 27.65 | N = int(eval(input()))
A = list(map(int, input().split()))
r = [A[0]]
m = 10**9 + 7
ans = 0
for i in range(1, N):
r.append(A[i] + r[i - 1])
for i in range(N - 1):
ans += A[i] * (r[N - 1] - r[i])
ans = ans % m
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
m = 10**9 + 7
r = 0
ans = 0
for i in range(1, N):
r += A[i - 1]
ans += A[i] * r
ans = ans % m
print(ans) | 15 | 13 | 237 | 178 | N = int(eval(input()))
A = list(map(int, input().split()))
r = [A[0]]
m = 10**9 + 7
ans = 0
for i in range(1, N):
r.append(A[i] + r[i - 1])
for i in range(N - 1):
ans += A[i] * (r[N - 1] - r[i])
ans = ans % m
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
m = 10**9 + 7
r = 0
ans = 0
for i in range(1, N):
r += A[i - 1]
ans += A[i] * r
ans = ans % m
print(ans)
| false | 13.333333 | [
"-r = [A[0]]",
"+r = 0",
"- r.append(A[i] + r[i - 1])",
"-for i in range(N - 1):",
"- ans += A[i] * (r[N - 1] - r[i])",
"+ r += A[i - 1]",
"+ ans += A[i] * r"
] | false | 0.107218 | 0.035655 | 3.007133 | [
"s404535527",
"s891026948"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.