Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
odd = [a for a in A if a%2]

if odd%2:
  print('NO')
else:
  print('YES')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
odd = [a for a in A if a%2]

if len(odd)%2:
  print('NO')
else:
  print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import math

N=int(input())

def divceil(a,b):
  n=0
  while a>n*b:
    n+=1
  return n

T=1
A=1
for _ in range(N):
  t,a=list(map(int, input().split()))
  m = max(divceil(T,t), divceil(A,a))
  T = t*m
  A = a*m
  
print(T+A)
  
  


Fixed submission:
from fractions import gcd
import math

N=int(input())

def divceil(a,b):
  if a%b==0:
    return a//b
  else:
    return a//b + 1

T=1
A=1
for _ in range(N):
  t,a=list(map(int, input().split()))
  m = max(divceil(T,t), divceil(A,a))
  T = t*m
  A = a*m
  
print(T+A)
Buggy python submission (verdict: Time Limit Exceeded):
X = input()
for _ in range(len(X)//2):
  X = X.replace('ST','')

print(len(X))

Fixed submission:
X = input()

s_stack=0
t_stack=0

for x in X:
  if x=='S':
    s_stack +=1
  if x=='T':
    if s_stack:
      s_stack -=1
    else:
      t_stack +=1

answer = s_stack + t_stack
print(answer)
Buggy python submission (verdict: Runtime Error):
H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]

from itertools import product

S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)

for a,b in AB:
  for x,y in product([-1,0,1], repeat=2):
    X = a+x-1
    Y = b+y-1
    if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
      continue
    for i in range(10):
      if (X, Y) in S[i]:
        S[i].remove((X, Y))
        S[i+1].add((X, Y))
        N[i] -=1
        N[i+1] +=1
        break
    else:
      S[1].add((X, Y))
      N[1] +=1
      N[0] -=1

L = [len(s) for s in S[1:]]
print((H-2)*(W-2) - sum(L))

for l in L:
  print(l)

Fixed submission:
H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]

from itertools import product

S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)

for a,b in AB:
  for x,y in product([-1,0,1], repeat=2):
    X = a+x-1
    Y = b+y-1
    if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
      continue
    for i in range(10):
      if (X, Y) in S[i]:
        S[i].remove((X, Y))
        S[i+1].add((X, Y))
        break
    else:
      S[1].add((X, Y))

L = [len(s) for s in S[1:]]
print((H-2)*(W-2) - sum(L))

for l in L:
  print(l)

Buggy python submission (verdict: Time Limit Exceeded):
H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]

from itertools import product

S = [set() for _ in range(10)]
N = [0]*10
N[0] = (H-2)*(W-2)
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)

for a,b in AB:
  for x,y in product([-1,0,1], repeat=2):
    X = a+x-1
    Y = b+y-1
    if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
      continue
    for i in range(10):
      if (X, Y) in S[i]:
        S[i].remove((X, Y))
        S[i+1].add((X, Y))
        N[i] -=1
        N[i+1] +=1
        break
    else:
      S[1].add((X, Y))
      N[1] +=1
      N[0] -=1

for n in N:
  print(n)

Fixed submission:
H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]

from itertools import product

S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)

for a,b in AB:
  for x,y in product([-1,0,1], repeat=2):
    X = a+x-1
    Y = b+y-1
    if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
      continue
    for i in range(10):
      if (X, Y) in S[i]:
        S[i].remove((X, Y))
        S[i+1].add((X, Y))
        break
    else:
      S[1].add((X, Y))

L = [len(s) for s in S[1:]]
print((H-2)*(W-2) - sum(L))

for l in L:
  print(l)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

n = 1
x = 7


if K % 2 == 0:
  print( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x * 10 + 7) % K
  n += 1
  if x == 7:
    print( -1 )
    break
#


Fixed submission:
K = int(input())

n = 1
x = 7


if (K % 2 == 0)or(K % 5 == 0):
  print( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x * 10 + 7) % K
  n += 1
#

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

n = 1
x = 7


if K % 2 == 0:
  print( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x % K) * 10 + 7
  n += 1
#


Fixed submission:
K = int(input())

n = 1
x = 7


if (K % 2 == 0)or(K % 5 == 0):
  print( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x * 10 + 7) % K
  n += 1
#

Buggy python submission (verdict: Runtime Error):
K = int(input())

n = 1
x = 7


if K % 2 == 0:
  peint( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x % K) * 3 + 7
  n += 1
#


Fixed submission:
K = int(input())

n = 1
x = 7


if (K % 2 == 0)or(K % 5 == 0):
  print( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x * 10 + 7) % K
  n += 1
#

Buggy python submission (verdict: Runtime Error):
K = int(input())

n = 1
x = 7


if K % 2 == 0:
  peint( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x % K) * 10 + 7
  n += 1
#


Fixed submission:
K = int(input())

n = 1
x = 7


if (K % 2 == 0)or(K % 5 == 0):
  print( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x * 10 + 7) % K
  n += 1
#
Buggy python submission (verdict: Runtime Error):
N = int(input())

N2 = int(N**0.5)

cnt = [0] * (9000)

for x in range(1,N2+1):
  for y in range(1,N2+1):
    for z in range(1,N2+1):
      xyz = x*x + y*y + z*z + x*y + y*z + z*x
      cnt[xyz] += 1
#
for i in range(1,N+1):
  print( cnt[i] )


Fixed submission:
N = int(input())

N2 = int(N**0.5)

cnt = [0] * (90000)

for x in range(1,N2+1):
  for y in range(1,N2+1):
    for z in range(1,N2+1):
      xyz = x*x + y*y + z*z + x*y + y*z + z*x
      cnt[xyz] += 1
#
for i in range(1,N+1):
  print( cnt[i] )
Buggy python submission (verdict: Runtime Error):
import numpy as np

D = int(input())
c = np.array( list(map(int, input().split())) )
#
s = [[] for i in range(D)]
for i in range(D):
  s[i] = np.array( list(map(int, input().split())) )
#
v = 0
cc =  np.array( [0]*26 )
last = np.array( [-1]*26 )
for d in range(D):
  cc += c
  av = s[d] - sum( cc ) + cc
  av2 = av + cc*(D-d-1) + c*(D-d-1)(D-d)//2
  m = max(av2)
  for t in range(26):
    if av2[t] == m:
      cc[t] = 0
      v += av[t]
      print(t+1)
      break
#
#print( v )


Fixed submission:
import numpy as np

D = int(input())
c = np.array( list(map(int, input().split())) )
s = [[] for i in range(365)]
for i in range(D):
  s[i] = np.array( list(map(int, input().split())) )
#
last = np.array( [-1]*26 )
av = np.array( [0]*26 )
id = np.identity(4,dtype=int)

v = 0
for d in range(D):
  av = s[d] - sum( c*(d-last) ) + c*(d-last) 
  m = max(av)
  for t in range(26):
    if av[t] == m:
      last[t] = d
      v += av[t]
      print(t+1)
      break
#
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

na = 0
nb = 0
t = 0
b = 0
hq = []
heapq.heappush(hq,(t, na, nb))

while hq:
  t, na, nb = heapq.heappop(hq)
  if (na < N) and (t + A[na] <= K):
    heapq.heappush(hq,(t + A[na], na + 1, nb))
    b = max(b,na + nb + 1)
  if (nb < M) and (t + B[nb] <= K):
    heapq.heappush(hq,(t + B[nb], na, nb + 1))
    b = max(b,na + nb + 1)
#
print(b)




Fixed submission:
import heapq
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

TA = [0]
TB = [0]
na = 0
nb = 0

for i in range(N):
  n = TA[-1]+A[i]
  if n > K:
    break
  TA.append(n)
  na = i + 1
#
for i in range(M):
  n = TB[-1]+B[i]
  if n > K:
    break
  TB.append(n)
  nb = i + 1
#
a = 0
ans = 0

for b in range(nb,-1,-1):
  while TB[b]+TA[a] <= K:
    ans = max(ans,a+b)
    a += 1
    if a > na:
      a -= 1
      break
#
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

na = 0
nb = 0
t = 0
b = 0
hq = []
heapq.heappush(hq,(t, na, nb))

while hq:
  t, na, nb = heapq.heappop(hq)
  if (na < N) and (t + A[na] <= K):
    heapq.heappush(hq,(t + A[na], na + 1, nb))
    b = max(b,na + nb + 1)
  if (nb < M) and (t + B[nb] <= K):
    heapq.heappush(hq,(t + B[nb], na, nb + 1))
    b = max(b,na + nb + 1)
#
print(b)





Fixed submission:
import heapq
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

TA = [0]
TB = [0]
na = 0
nb = 0

for i in range(N):
  n = TA[-1]+A[i]
  if n > K:
    break
  TA.append(n)
  na = i + 1
#
for i in range(M):
  n = TB[-1]+B[i]
  if n > K:
    break
  TB.append(n)
  nb = i + 1
#
a = 0
ans = 0

for b in range(nb,-1,-1):
  while TB[b]+TA[a] <= K:
    ans = max(ans,a+b)
    a += 1
    if a > na:
      a -= 1
      break
#
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

f = [1]*(N+1)

for i in range(2,N+1):
  for j in range(i,N+1,i):
    f[j] += 1
#
ans = 0
for k in range(1,N+1):
  ans += k * f[k]
#
print(ans)


Fixed submission:
N = int(input())

t = 0
for j in range(1,N+1):
  m = N//j
  t += (1+m)*m//2 * j
#
print(t)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

f = [1]*(N+1)

for i in range(2,N+1):
  for j in range(i,N+1,i):
    f[j] += 1
#
ans = 0
for k in range(1,N+1):
  ans += k * f[k]
#
print(ans)


Fixed submission:
N = int(input())

t = 0
for j in range(1,N+1):
  m = N//j
  t += (1+m)*m//2 * j
#
print(t)
Buggy python submission (verdict: Runtime Error):
X = int(input())

K=1
y=X % 360
while y != 0:
  K+=1
  y=(y+X)% 360
#
print(k)



Fixed submission:
X = int(input())

K=1
y=X % 360
while y != 0:
  K+=1
  y=(y+X)% 360
#
print(K)

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())

K=1
y=X
while y != 0:
  K+=1
  y+=X
#
print(k)



Fixed submission:
X = int(input())

K=1
y=X % 360
while y != 0:
  K+=1
  y=(y+X)% 360
#
print(K)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * 200001

for i in A:
  if cnt[i] == 1:
    continue 
  if cnt[i] == 2:
    cnt[i] = 1
    continue
  cnt[i] = 2
  for j in range( (i+i),200001,i):
    cnt[j] = 1
#
ans = 0
for i in range(200001):
  if cnt[i] == 2:
    ans += 1
#
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * 1000001

for i in A:
  if cnt[i] == 1:
    continue 
  if cnt[i] == 2:
    cnt[i] = 1
    continue
  cnt[i] = 2
  for j in range( (i+i),1000001,i):
    cnt[j] = 1
#
ans = 0
for i in range(1000001):
  if cnt[i] == 2:
    ans += 1
#
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if N == 1:
  print(1)
  exit(0)
#
A.sort()
A.append(0) 

b = []
ans = 0
i = 0

if A[0] ==1:
  if A[1] == 1:
    print(0)
  else:
    print(1)
  exit(0)
#
while i < N:
  c = A[i]
  for j in b:
    if c % j == 0:
      break
  else:
    b.append(c)
    if c != A[i+1]:
      ans += 1
  while c == A[i+1]:
    i += 1
  i += 1
#          
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * 1000001

for i in A:
  if cnt[i] == 1:
    continue 
  if cnt[i] == 2:
    cnt[i] = 1
    continue
  cnt[i] = 2
  for j in range( (i+i),1000001,i):
    cnt[j] = 1
#
ans = 0
for i in range(1000001):
  if cnt[i] == 2:
    ans += 1
#
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if N == 1:
  print(1)
  exit(0)
#
A.sort()
A.append(0) 

b = []
ans = 0
i = 0
while i < N:
  c = A[i]
  for j in b:
    if c % j == 0:
      break
  else:
    b.append(c)
    if c != A[i+1]:
      ans += 1
  while c == A[i+1]:
    i += 1
  i += 1
#          
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * 1000001

for i in A:
  if cnt[i] == 1:
    continue 
  if cnt[i] == 2:
    cnt[i] = 1
    continue
  cnt[i] = 2
  for j in range( (i+i),1000001,i):
    cnt[j] = 1
#
ans = 0
for i in range(1000001):
  if cnt[i] == 2:
    ans += 1
#
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if N == 1:
  print(1)
  exit(0)
#
A.append(10000000) 
if N == 1:
  print(0)
  exit(0)
#
A.sort()
ans = 0

for i in range(N):
  if A[i] == A[i+1] or A[i-1] == A[i]:
    continue
  for j in range(i):
    if A[i] % A[j] == 0:
      break
  else:
    ans += 1
#

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * 1000001

for i in A:
  if cnt[i] == 1:
    continue 
  if cnt[i] == 2:
    cnt[i] = 1
    continue
  cnt[i] = 2
  for j in range( (i+i),1000001,i):
    cnt[j] = 1
#
ans = 0
for i in range(1000001):
  if cnt[i] == 2:
    ans += 1
#
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
m =  10**18 
ans = 1
for i in range(N):
  ans *= A[i]
#
if ans > m:
  print(-1)
else:
  print(ans)
#

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
m =  10**18 
ans = 1
A.sort()
for i in range(N):
  ans *= A[i]
  if ans > m:
    print(-1)
    exit(0)
  if ans == 0:
    break;
#
print(ans)
#
Buggy python submission (verdict: Time Limit Exceeded):
import heapq



def pay(N,A,B,C,D):
  q = []
  heapq.heapify(q)
  num = {}
  num[0] = 0
  num[-1] = -1
  heapq.heappush(q,( 0, 0 ))
  while q:
    c, n = heapq.heappop(q)
#    print(n,c)
    if n == N:
      break
    if num.setdefault(n*2,N*D+1) > c+A:
      heapq.heappush(q,( c+A, n*2 ))
      num[n*2] = c+A
    if num.setdefault(n*3,N*D+1) > c+B:
      heapq.heappush(q,( c+B, n*3 ))
      num[n*3] = c+B
    if num.setdefault(n*5,N*D+1) > c+C:
      heapq.heappush(q,( c+C, n*5 ))
      num[n*5] = c+C
    if num.setdefault(n+1,N*D+1) > c+D:
      heapq.heappush(q,( c+D, n+1 ))
      num[n+1] = c+D
    if num.setdefault(n-1,N*D+1) > c+D:
      heapq.heappush(q,( c+D, n-1 ))
      num[n-1] = c+D
  #
  print(num.setdefault(N,-1))
#

T = int(input())
for i in range(T):
  N,A,B,C,D = map(int, input().split())
  pay(N,A,B,C,D)


Fixed submission:
import heapq

def pay2win():
  num = set()
  q = []
  heapq.heapify(q)
  heapq.heappush(q,( 0, N ))
  cost = N*D
  while q:
    c0, n0 = heapq.heappop(q)
    if n0 in num:
      continue
    num.add(n0)
    if n0 == 0:
      break
    if c0 >= cost:
      break
    cost = min(cost,c0+n0*D)
    #
    n2, m = divmod(n0, 2)
    if m == 0:
      heapq.heappush(q,( c0+A, n2 ))
    else:
      heapq.heappush(q,( c0+D+A, n2 ))
      heapq.heappush(q,( c0+D+A, n2+1 ))
    #
    n3, m = divmod(n0, 3)
    if m == 0:
      heapq.heappush(q,( c0+B, n3 ))
    elif m == 1:
      heapq.heappush(q,( c0+D+B, n3 ))
    else:
      heapq.heappush(q,( c0+D+B, n3+1 ))
    #
    n5, m = divmod(n0, 5)
    if m == 0:
      heapq.heappush(q,( c0+C, n5 ))
    elif m <= 2:
      heapq.heappush(q,( c0+D*m+C, n5 ))
    else:
      heapq.heappush(q,( c0+D*(5-m)+C, n5+1 ))
    #
  print(cost)
#

T = int(input())
for i in range(T):
  N,A,B,C,D = map(int, input().split())
  pay2win()
Buggy python submission (verdict: Runtime Error):
6 9
3 4
6 1
2 4
5 3
4 6
1 5
6 2
4 5
5 6


Fixed submission:
import heapq

N, M  = map(int, input().split())

node = [[] for i in range(N+1)]
for i in range(M):
  a, b = map(int, input().split())
  node[a].append(b)
  node[b].append(a)
#

gw = [0]*(N+1)
gw[1] = 1
ng=1
hq = []
heapq.heapify(hq) 
heapq.heappush(hq,(0,1))
while hq:
  c, n = heapq.heappop(hq)
  for i in node[n]:
    if gw[i] == 0:
      gw[i] = n
      ng += 1
      heapq.heappush(hq,(c+1,i))
#
if ng < N:
  print("No")
else:
  print("Yes")
  for i in range(2,N+1):
    print(gw[i])
#
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, M, X = map(int, input().split())

ca = []
for _ in range(N):
  ca.append( list(map(int, input().split())))
ca.sort(key=lambda x:-x[0])
ca = np.array(ca)
#
ans = 10000000
skill = [0]*(M+1)


def DFS(n,skill):
  global ans
  if skill[0] >= ans:
    return
  if min(skill[1:]) >= X:
    ans = min(ans, skill[0])
    return
  if n >= N:
    return
  DFS(n+1,skill)
  skill = skill + ca[n]
  DFS(n+1,s)
  skill = skill - ca[n]
  return
#

DFS(0,skill)
if ans == 10000000:
  print(-1)
else:
  print(ans)
#

Fixed submission:
import numpy as np
import itertools

N, M, X = map(int, input().split())

ca = []
for _ in range(N):
  ca.append( list(map(int, input().split())))
ca = np.array(ca)
#print(ca)
ans = 10000000

b = [0,1]
for p in list(itertools.product(b, repeat=N)): 
  a = np.array(p)
  to = a@ca
  if min(to[1:]) >= X:
    ans = min(ans, to[0])
#
if ans == 10000000:
  print(-1)
else:
  print(ans)
#
Buggy python submission (verdict: Runtime Error):
#factorial
mod = 998244353 
N = 1000000
modinv_t = [0, 1]
modfact_t = [1, 1]
modfactinv_t = [1, 1]
for i in range(2,N+1):
  modfact_t.append(modfact_t[-1] * i % MOD)
  modinv_t.append(modinv_t[MOD%i] * (MOD-(MOD//i)) % MOD)
  modfactinv_t.append(modfactinv_t[-1] * modinv_t[-1] % MOD)
# permutation
def nPr(n, r):
  return  modfact_t[n] * modfactinv_t[n-r] % MOD
# combination
def nCr(n, r):
  return  modfact_t[n] * modfactinv_t[n-r] * modfactinv_t[r] % MOD
#
def nHr(n, r):
  return  nCr(n+r-1,r)
#

N, M, K = map(int, input().split()) 

t = M*pow(M-1,N-1,mod)
for i in range(1,K+1):
  t += M*pow(M-1,N-1-i,mod)*nCr((N-1),i)
  t %= mod
#
print(t)


Fixed submission:
#factorial
MOD = 998244353 

N, M, K = map(int, input().split()) 

modinv_t = [0, 1]
modfact_t = [1, 1]
modfactinv_t = [1, 1]
for i in range(2,N+1):
  modfact_t.append(modfact_t[-1] * i % MOD)
  modinv_t.append(modinv_t[MOD%i] * (MOD-(MOD//i)) % MOD)
  modfactinv_t.append(modfactinv_t[-1] * modinv_t[-1] % MOD)
# permutation
def nPr(n, r):
  return  modfact_t[n] * modfactinv_t[n-r] % MOD
# combination
def nCr(n, r):
  return  modfact_t[n] * modfactinv_t[n-r] * modfactinv_t[r] % MOD
#
def nHr(n, r):
  return  nCr(n+r-1,r)
#


t = M*pow(M-1,N-1,MOD)
for i in range(1,K+1):
  t += M*pow(M-1,N-1-i,MOD)*nCr((N-1),i)
  t %= MOD
#
t %= MOD
print(t)
Buggy python submission (verdict: Runtime Error):
x=int(input())

for b in range(0,200):
  b5 = b**5
  a5 = x + b5
  a = int( float(a5)**0.2 )
  if a**5 == a5:
    print(a,b)
    break
  a5 = x - b5
  a = int( float(a5)**0.2 )
  if a**5 == a5:
    print(a,-b)
    break
#


Fixed submission:
x=int(input())

for a in range(0,200):
  a5 = a**5
  b5 = a5 - x
  if b5 >= 0:
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,b)
      break
  else:
    b5 = -b5
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,-b)
      break
#

Buggy python submission (verdict: Runtime Error):
x=int(input())
a5=[0]
for i in range(1,200):
  a5.append(i**5)
#
r=0
for i in range(200):
  for j in range(i+1,200):
    if a5[j]-a5[i]>x:
      break
    if a[j]-a5[i]==a:
      print(a[i],a[j])


Fixed submission:
x=int(input())

for a in range(0,200):
  a5 = a**5
  b5 = a5 - x
  if b5 >= 0:
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,b)
      break
  else:
    b5 = -b5
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,-b)
      break
#

Buggy python submission (verdict: Runtime Error):
x=int(input())
a5=[0]
for i in range(1,200):
  a5.append(i**5)
#
r=0
for i in range(200):
  for j in range(i+1,200):
    if a5[j]-a5[i]>x:
      break
    if a[j]-a5[i]==a:
      print(a[i],a[j])


Fixed submission:
x=int(input())

for a in range(0,200):
  a5 = a**5
  b5 = a5 - x
  if b5 >= 0:
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,b)
      break
  else:
    b5 = -b5
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,-b)
      break
#
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

N,M,Q = map(int, input().split())

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,M))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]-1]-arr[:,abcd[0]-1])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())


Fixed submission:
import itertools
import numpy as np

N,M,Q = map(int, input().split())

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,N))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]-1]-arr[:,abcd[0]-1])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())

Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

N,M,Q = map(int, input().split())

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,M))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]]-arr[:,abcd[0]])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())


Fixed submission:
import itertools
import numpy as np

N,M,Q = map(int, input().split())

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,N))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]-1]-arr[:,abcd[0]-1])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

mod = 1000000000+7

z=0
for x in range(K, N+2):
  zz = 1
  for y in range(0,x):
    zz += (N-y) - y
    zz %= mod
  z += zz
  z %= mod
#
print(z)


Fixed submission:
N, K = map(int, input().split())
mod = 1000000000+7

z=0

zz = ((N-K+1)+N)*K//2 - (0+(K-1))*K//2 + 1
zz = zz % mod

for x in range(K+1, N+3):
#  print(zz)
  z = (z + zz) % mod
  zz += (N-x+1) - (x-1)
  zz = zz % mod
#
print(z)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

print(K,N)


mod = 1000000000+7

z=0
for x = range(K, N+2):
  for y = range(0,x):
    z += (N-y) - y + 1
    z %= mod
#
print(z)


Fixed submission:
N, K = map(int, input().split())
mod = 1000000000+7

z=0

zz = ((N-K+1)+N)*K//2 - (0+(K-1))*K//2 + 1
zz = zz % mod

for x in range(K+1, N+3):
#  print(zz)
  z = (z + zz) % mod
  zz += (N-x+1) - (x-1)
  zz = zz % mod
#
print(z)

Buggy python submission (verdict: Runtime Error):
#N = int( input() )
N, K = map(int, input().split())
#A = list(map(int, input().split()))

mod = 1000000000+7

z=0
for x = range(K, N+2):
  for y = range(x):
    z += (N-y) - y + 1
    z %= mod
#
print(z)


Fixed submission:
N, K = map(int, input().split())
mod = 1000000000+7

z=0

zz = ((N-K+1)+N)*K//2 - (0+(K-1))*K//2 + 1
zz = zz % mod

for x in range(K+1, N+3):
#  print(zz)
  z = (z + zz) % mod
  zz += (N-x+1) - (x-1)
  zz = zz % mod
#
print(z)