Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import operator as op
from functools import reduce

m = 10**9 + 7

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

x,y = map(int,input().split())

if max(x,y) > 2 *min(x,y):
    print(0)
elif (x+y) % 3 == 0:
    k = (x+y)//3
    n = (2*x-y)//3
    print(int(ncr(k,n)) % m)
else:
    print(0)

Fixed submission:
def nCr(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

x,y = map(int,input().split())

if max(x,y) > 2 *min(x,y):
    print(0)
elif (x+y) % 3 == 0:
    k = (x+y)//3
    n = (2*x-y)//3
    print(nCr(k,n))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import math
m = 10**9 + 7
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

x,y = map(int,input().split())

if max(x,y) > 2 *min(x,y):
    print(0)
elif (x+y) % 3 == 0:
    k = (x+y)//3
    n = (2*x-y)//3
    print(nCr(k,n) % m)
else:
    print(0)



Fixed submission:
def nCr(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

x,y = map(int,input().split())

if max(x,y) > 2 *min(x,y):
    print(0)
elif (x+y) % 3 == 0:
    k = (x+y)//3
    n = (2*x-y)//3
    print(nCr(k,n))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans=1
for i in range(n):
    ans *= a[i]

if ans > (10**18):
    print('-1')
else:
     print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

ans=1

if 0 in a:
    print(0)
    exit()
else:
    for i in range(n):
        ans *= a[i]
        if ans > (10 ** 18):
            print('-1')
            exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
ar=input().split()
    print(ar.index('0')+1)

Fixed submission:
ar=input().split()
print(ar.index('0')+1)
Buggy python submission (verdict: Runtime Error):
p=int(input())
ans=1
ar=[map(int,input().split())]
if 0 in ar:ans=0
else:
    for i in range(p):
        if ans<1e18:ans*=ar[i]
        else:ans=-1;break
    
print(ans,end='')

Fixed submission:
p=int(input())
ans=1
ar=list(map(int,input().split()))
if 0 in ar:ans=0
else:
    for i in range(p):
        if ans<1e18:ans*=ar[i]
        else:ans=-1;break
if ans>1e18:ans=-1
print(ans,end='')
Buggy python submission (verdict: Runtime Error):
def main():
    n,a,b=mi()
    s=input()
    nover=0
    tot=0
    for i in range(n):
        if tot<a+b:
            if s[i]=='a':
                print('Yes')
                tot+=1
            elif s[i]=='b' and nover<b:
                print('Yes')
                nover+=1
                tot+=1
            else:
                print('No')
        else:
            print('No')
main()

Fixed submission:
n,a,b=map(int,input().split())
s=list(input())
nover=0
tot=0
for i in range(n):
    if tot<a+b:
        if s[i]=='a':
            print('Yes')
            tot+=1
        elif s[i]=='b' and nover<b:
            print('Yes')
            nover+=1
            tot+=1
        else:
            print('No')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
def main():
    n,a,b=mi()
    s=list(input())
    nover=0
    tot=0
    for i in range(n):
        if tot<a+b:
            if s[i]=='a':
                print('Yes')
                tot+=1
            elif s[i]=='b' and nover<b:
                print('Yes')
                nover+=1
                tot+=1
            else:
                print('No')
        else:
            print('No')
main()                

Fixed submission:
n,a,b=map(int,input().split())
s=list(input())
nover=0
tot=0
for i in range(n):
    if tot<a+b:
        if s[i]=='a':
            print('Yes')
            tot+=1
        elif s[i]=='b' and nover<b:
            print('Yes')
            nover+=1
            tot+=1
        else:
            print('No')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
make=False
def check_possible(req,num,cur,count):
  if cur<num:
    check_possible(req,num,cur+2,count+1)
    check_possible(req,num,cur+4,count+1)
  if cur==num:
    if count==req:
      global make
      make=True
req,num=list(map(int,input().split()))
check_possible(req,num,0,0)
if make:
  print('Yes')
else:
  print('No')

Fixed submission:
make=False
def check_possible(req,num):
  for i in range(0,req+1):
      for j in range(0,req+1):
          if 2*i+4*j==num and i+j==req:
              return True
  return False
req,num=list(map(int,input().split()))
if check_possible(req,num):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = 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[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

stack = [1]

parent = [0] * (N+1)
while stack:
    x = stack.pop()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]

print(' '.join(map(ste,val[1:])))


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = 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[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

stack = [1]

parent = [0] * (N+1)
while stack:
    x = stack.pop()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]

print(' '.join(map(str,val[1:])))

Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = 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[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

stack = [1]

parent = [0] * (N+1)
while stack:
    x = stack.pop()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]

print(' '.join(map(std,val[i:])))


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = 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[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

stack = [1]

parent = [0] * (N+1)
while stack:
    x = stack.pop()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]

print(' '.join(map(str,val[1:])))
Buggy python submission (verdict: Runtime Error):
a,b,c,x = map(int,[intut() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500 + j*100 + k*50 == x:
                ans +=1

print(ans)


Fixed submission:
a,b,c,x = map(int,[input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500 + j*100 + k*50 == x:
                ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c,x = map(int,[intut() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500 + j*100 + k*50 == x:
                ans +=1

print(ans)


Fixed submission:
a,b,c,x = map(int,[input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500 + j*100 + k*50 == x:
                ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split)
if(a*b)%2:
    print("Odd")
else:
    print("Even")


Fixed submission:
a,b = map(int,input().split())
if(a*b)%2:
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int,input().split()))
ans = float("inf")
for i in a:
    ans = min(ans,len(bin(i))-bin(i).rfind("1")-1)
printf(round(ans))


Fixed submission:
import math
n = input()
a = list(map(int,input().split()))
ans = float("inf")
for i in a:
    ans = min(ans,len(bin(i))-bin(i).rfind("1")-1)
print(round(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors
 
n = int(input())
 
l = make_divisors(n)
ans = n-1
for i in range(0, len(l)):
  for j in range(0, len(l)):
    if l[i] * l[j] == n:
      ans = min(ans, (l[i]+l[j]-2))
 
print(ans)

Fixed submission:
import math

n = int(input())
ans = n-1

for i in range(1, math.floor(math.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, (i+(n/i)-2))
      
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())

l = make_divisors(n)
ans = n-1
for i in range(0, len(l)):
  for j in range(0, len(l)):
    a = l[i]
    b = l[j]
    if a * b == n:
      ans = min(ans, (a+b-2))

print(ans)


Fixed submission:
import math

n = int(input())
ans = n-1

for i in range(1, math.floor(math.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, (i+(n/i)-2))
      
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())
l = make_divisors(n)

ans = 999999999999999999
for i in range(0, len(l), 2):
  a = l[i]
  b = l[i+1]
  ans = min(ans,(a+b-2))
  
print(ans)


Fixed submission:
import math

n = int(input())
ans = n-1

for i in range(1, math.floor(math.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, (i+(n/i)-2))
      
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())
l = make_divisors(n)
ans = 999999999999999999
for i in range(0,len(l), 2):
  a = l[i]
  b = l[i+1]
  ans = min(ans,(a+b-2))
  
print(ans)


Fixed submission:
import math

n = int(input())
ans = n-1

for i in range(1, math.floor(math.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, (i+(n/i)-2))
      
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
 
n, k, q = map(int, input().split())
a = list(int(input()) for i in range(q))
 
for i in range(n):
  cnt = a.count(i+1)
  if k - q + cnt > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

score = [k - q]*(n+1)

for i in range(q):
  score[a[i]] += 1

for i in range(1,n+1):
  if score[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
a = list(int(input()) for i in range(q))

for i in range(n):
  cnt = a.count(i+1)
  if k - q + cnt > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

score = [k - q]*(n+1)

for i in range(q):
  score[a[i]] += 1

for i in range(1,n+1):
  if score[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
a = list(int(input()) for i in range(q))

for i in range(n):
  cnt = a.count(i+1)
  if k - q + cnt > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

score = [k - q]*(n+1)

for i in range(q):
  score[a[i]] += 1

for i in range(1,n+1):
  if score[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

for i in range(n):
  cnt = a.count(i+1)
  if k - q + cnt > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

score = [k - q]*(n+1)

for i in range(q):
  score[a[i]] += 1

for i in range(1,n+1):
  if score[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

for i in range(n):
  cnt = a.count(i+1)
  if k - q + cnt > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

score = [k - q]*(n+1)

for i in range(q):
  score[a[i]] += 1

for i in range(1,n+1):
  if score[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
a = list(int(input()) for i in range(q))

p = np.zeros(n, dtype=int)

for i in range(q):
  ind = np.ones(n, dtype=bool)
  ind[a[i]-1] = False
  p[ind] -=1

for i in range(n):
  if k + p[i] > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

score = [k - q]*(n+1)

for i in range(q):
  score[a[i]] += 1

for i in range(1,n+1):
  if score[i] > 0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

int main() {
	int A, B; cin >> A >> B;
	int ans = 0;
	int outlet = 1;
	while (outlet < B) {
		--outlet;
		outlet += A;
		++ans;
	}
	cout << ans << endl;
}

Fixed submission:
import math
a,b = map(int, input().split())

print(math.ceil((b-1)/(a-1)))
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
 
ans = 0

  
print(sum(range(1,a)))

Fixed submission:
n = int(input())

print(n*(n-1)//2)

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

ans = 0
for i in range(1,a):
  ans += i
  
print(ans)

Fixed submission:
n = int(input())

print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = string(input())

if a >= 3200:
  print(s)
elif:
  print('red')  

Fixed submission:
a = int(input())
s = str(input())

if a >= 3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n == 1:
  print('Hello World')
else:
  a = int(input()
  b = int(input()
  print(a+b)

Fixed submission:
n = int(input())

if n == 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)

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

if n == 1:
  print('Hello World')
else:
  a, b = map(int, input().split())
  print(a+b)

Fixed submission:
n = int(input())

if n == 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
r = int(input())
g = int(input())

print(abs(g - r)*2 + mint(g,r))

Fixed submission:
r = int(input())
g = int(input())

print((g - r)*2 + r)
Buggy python submission (verdict: Runtime Error):
a = sorted(list[map(int, input().split())])

print(a[0] + a[1])

Fixed submission:
a = sorted(list(map(int, input().split())))

print(a[0] + a[1])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if:
  print('Draw')
elif a == 1:
  print('Alice')
elif b == 1:
  print('Bob')
elif a < b:
  print('Bob')
elif a > b:
  print('Alice')


Fixed submission:
a, b = map(int, input().split())

if a == b:
  print('Draw')
elif a == 1:
  print('Alice')
elif b == 1:
  print('Bob')
elif a < b:
  print('Bob')
elif a > b:
  print('Alice')

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

if a < b:
  print('Bob')
elif a > b:
  print('Alice')
else:
  print('Draw')

Fixed submission:
a, b = map(int, input().split())

if a == b:
  print('Draw')
elif a == 1:
  print('Alice')
elif b == 1:
  print('Bob')
elif a < b:
  print('Bob')
elif a > b:
  print('Alice')
Buggy python submission (verdict: Runtime Error):

b = int(input())
h = int(input())

print((a+b)*h/2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print((a+b)*h//2)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
h = int(input())

print(a*b*h/2)a = int(input())
b = int(input())
h = int(input())

print((a+b)*h/2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print((a+b)*h//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n - k >= 0:
  print(k * x + (n-k) * y)
else
  print(k * x)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n - k >= 0:
  print(k * x + (n-k) * y)
else:
  print(n * x)
Buggy python submission (verdict: Runtime Error):
arr = list(map(int, input().split()))


i=1
for num in arr:
    if(num==0):
        print(i)
    else:
        i++;


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


i=1
for num in arr:
    if(num==0):
        print(i)
    else:
        i = i +1
Buggy python submission (verdict: Time Limit Exceeded):
import math

fuga = int(input())
arr = list(map(int, input().split()))

hoge =1
for num in arr:
    hoge = hoge*num

if hoge <= 10**18:
    print(hoge)
else:
    print(-1)


Fixed submission:
import math

kosuu = int(input())
arr = list(map(int, input().split()))

hoge =1

if 0 in arr:
    print(0)

else:
    for num in arr:
        hoge = hoge*num
        if hoge>1000000000000000000:
            print(-1)
            kosuu=0
            break
    if kosuu>0:
        print(hoge)
Buggy python submission (verdict: Runtime Error):
s = [input() for i in range(2)]

s_length = len(s[0])
s2_length = len(s[1])

if s2_length==s_length+1 and s[0]==s[1][:s_length]:
    print("Yes")
else:
    print("NO")_l

Fixed submission:
s = [input() for i in range(2)]

s_length = len(s[0])
s2_length = len(s[1])

if s2_length==s_length+1 and s[0]==s[1][:s_length]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# 自分の
N = int(input())
a_arr = list(map(int, input().split()))

for i in range(N):
    if i==N-1:
        print("YES")
        break
    for j in range(1, N-i):
        if a_arr[i] == a_arr[i+j]:
            print("NO")
            break
    else:
        continue
    break

Fixed submission:
# 自分の
N = int(input())
a_arr = list(map(int, input().split()))

new_a_arr = sorted(a_arr)

for i in range(N-1):
    if new_a_arr[i]==new_a_arr[i+1]:
        print("NO")
        break
    elif i==N-2:
        print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
# 自分の
N = int(input())
a_arr = list(map(int, input().split()))

for i in range(N):
    if i==N-1:
        print("YES")
        break
    for j in range(1, N-i):
        if a_arr[i] == a_arr[i+j]:
            print("NO")
            break
    else:
        continue
    break

Fixed submission:
# 自分の
N = int(input())
a_arr = list(map(int, input().split()))

new_a_arr = sorted(a_arr)

for i in range(N-1):
    if new_a_arr[i]==new_a_arr[i+1]:
        print("NO")
        break
    elif i==N-2:
        print("YES")
Buggy python submission (verdict: Runtime Error):
T=input()

result=[]

for i in range(len(T)):
    if T[i]=='?':
        if i==len(T)-1:
            result.append('D')
        elif result[i-1]=='P':
            result.append('D')
        else:
            if T[i+1]=='P':
                result.append('D')
            else:
                result.append('P')
    else:
        result.append(T[i])

print(''.join(result))

Fixed submission:
T=input()

result=[]

for i in range(len(T)):
    if T[i]=='?':
        if i==len(T)-1:
            result.append('D')
        elif i==0:
            if T[i+1]=='P':
                result.append('D')
            else:
                result.append('P')
        elif result[i-1]=='P':
            result.append('D')
        else:
            if T[i+1]=='P':
                result.append('D')
            else:
                result.append('P')
    else:
        result.append(T[i])

print(''.join(result))
Buggy python submission (verdict: Runtime Error):
X=int(input())

a=0
b=0

while True:
    hantei_p=X+b**5
    hantei_n=X-b**5

    if hantei_p**0.2==int(hantei_p**0.2):
       a=int(hantei_p**0.2)
       print("{} {}".format(a,b))
       break
    if hantei_n**0.2==int(hantei_n**0.2):
       a=int(hantei_n**0.2)
       print("{} {}".format(a,-b))
       break
    
    b +=1




Fixed submission:
X=int(input())

a=0
b=0

while True:
    hantei_p=(X+b**5)**0.2
    hantei_n=(X-b**5)**0.2

    if abs(int(hantei_p)-hantei_p)<1:
       a=int(hantei_p)
       if a**5-b**5==X:
           print("{} {}".format(a,b))
           break
    if isinstance(hantei_n**0.2,float):
        if abs(int(hantei_n)-hantei_n)<1:
            a=int(hantei_n)
            if a**5+b**5==X:
                print("{} {}".format(a,-b))
                break
    
    b +=1
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
h=list(map(int,input().split()))

cost=[-1 for _ in range(N)]


for i in range(N):
    if i==0:
        cost[i]=0
    else:
        siten=max(i-K,0)
        min_cost=10**12
        for j in range(siten,i):
            m=cost[j]+abs(h[j]-h[i])
            min_cost=min(m,min_cost)
        cost[i]=min_cost

print(int(cost[N-1]))

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

cost=[-1 for _ in range(N)]


for i in range(N):
    if i==0:
        cost[i]=0
    else:
        siten=max(i-K,0)
        min_cost=10**12
        for j in range(siten,i):
            m=cost[j]+abs(h[j]-h[i])
            if m<min_cost:
                min_cost=m
        cost[i]=min_cost

print(int(cost[N-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

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

dp=[[0]*(W+1) for _ in range(N+1)]

for i in range(1,N+1):
    w,v=map(int,input().split())

    for j in range(1,W+1):
        if j>=w:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]

print(dp[N][W])

Fixed submission:
import sys
input = sys.stdin.readline

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

dp=[[0]*(W+1) for _ in range(N+1)]

for i in range(1,N+1):
    w,v=map(int,input().split())

    for j in range(1,W+1):
        if j>=w:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]

print(dp[N][W])