Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):



n, x = (int(x) for x in input().split())

f = [0] * (n+1)
g = [0] * (n+1)
f[0] = 1
g[0] = 1
for i in range(1, n+1):
    f[i] = f[i-1]* 2 + 3
    g[i] = g[i-1]* 2 + 1

total = 0
remain = x

def eat(n):

    global total
    global f
    global remain

    if remain == 0:
        return
    if f[n] <= remain:
        total += g[n]
        remain -= f[n]
        return
    if f[n] > remain:
        remain -=1
        if f[n-1] > remain:
            eat(n-1)
        else:
            total += g[n-1]
            remain -= f[n-1]
            total += 1
            remain -= 1
            eat(n-1)

eat(n)
print(total)


Fixed submission:



n, x = (int(x) for x in input().split())

f = [0] * (n+1)
g = [0] * (n+1)
f[0] = 1
g[0] = 1
for i in range(1, n+1):
    f[i] = f[i-1]* 2 + 3
    g[i] = g[i-1]* 2 + 1

total = 0
remain = x

def eat(n):

    global total
    global f
    global remain

    if remain == 0:
        return
    if n < 0:
        return
    if f[n] <= remain:
        total += g[n]
        remain -= f[n]
        return
    if f[n] > remain:
        remain -=1
        if remain == 0:
            return
        if f[n-1] > remain:
            eat(n-1)
        else:
            total += g[n-1]
            remain -= f[n-1]
            if remain == 0:
                return
            total += 1
            remain -= 1
            eat(n-1)

eat(n)
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
n , k = map(int, input().strip().split(' '))

w = [0] * n
d = [0] * n
p = None
for i in range(n):
    w[i], d[i] = map(int, input().strip().split(' '))
    p1 = w[i] + (k - 1) * d[i]
    if p == None or p1 < p:
        p = p1


p1 = 1
p2 = p

def getk(p):
    kk = 0
    for i in range(n):
        if p <w[i]:
            kk += 0
        else:
            kk += (p - w[i]) // d[i] + 1
    return kk

def search(pmin, pmax):
    if pmin == pmax:
        return pmin
    else:
        mid = (pmin + pmax) // 2
        findk = getk(mid)        
        if (findk >= k):
            return search(pmin, mid)
        else:
            return search(mid+1, pmax)


print(search(p1, p2))


Fixed submission:
n , k = map(int, input().strip().split(' '))

w = [0] * n
d = [0] * n
p = None
for i in range(n):
    w[i], d[i] = map(int, input().strip().split(' '))
    p1 = w[i] + (k - 1) * d[i]
    if p == None or p1 < p:
        p = p1


p1 = 1
p2 = p

def getk(p):
    kk = 0
    for i in range(n):
        if p <w[i]:
            kk += 0
        else:
            kk += (p - w[i]) // d[i] + 1
        if kk > k:
            return kk
    return kk

def search(pmin, pmax):
    if pmin == pmax:
        return pmin
    else:
        mid = (pmin + pmax) // 2
        findk = getk(mid)
        if (findk >= k):
            return search(pmin, mid)
        else:
            return search(mid+1, pmax)


print(search(p1, p2))
Buggy python submission (verdict: Runtime Error):
l = int(input())
a = input()
b = input()

if len(a) > len(b):
    k = b
    b = a
    a = k

mina = None
maxa = None

f = [None] * (l + 1)

f[0] = ''
#print(f)
for i in range(l):
    tmpa = None
    tmpb = None
    if i + 1 >= len(a) and f[i + 1 - len(a)] is not None:
        tmpa = a + f[i + 1 - len(a)]
    if i + 1 >= len(b) and f[i + 1 - len(b)] is not None:
        tmpb = b + f[i + 1 - len(b)]
    if tmpa is None and tmpb is None:
        continue
    if tmpa is None and tmpb is not None:
        f[i+1] = tmpb
        continue
    if tmpb is None and tmpa is not None:
        f[i+1] = tmpa
        continue
    if tmpa < tmpb:
        f[i+1] = tmpa
    else:
        f[i+1] = tmpb
print(f[l])

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

if len(a) > len(b):
    k = b
    b = a
    a = k

mina = None
maxa = None
"""
f = [None] * (l + 1)

f[0] = ''
#print(f)
for i in range(l):
    tmpa = None
    tmpb = None
    if i + 1 >= len(a) and f[i + 1 - len(a)] is not None:
        tmpa = a + f[i + 1 - len(a)]
    if i + 1 >= len(b) and f[i + 1 - len(b)] is not None:
        tmpb = b + f[i + 1 - len(b)]
    if tmpa is None and tmpb is None:
        continue
    if tmpa is None and tmpb is not None:
        f[i+1] = tmpb
        continue
    if tmpb is None and tmpa is not None:
        f[i+1] = tmpa
        continue
    if tmpa < tmpb:
        f[i+1] = tmpa
    else:
        f[i+1] = tmpb
print(f[l])

def less(a, b):
    if a < b:
        if not b.startswith(a):
            return True
        else:
            c = b
            while c.startswith(a):
                c = c[len(a):]
            if a < c:
                return True
            else:
                return False

"""
for i in range(l+ 1) :
    if i * len(a) > l:
        break
    if (l - i * len(a)) % len(b) == 0:
        if mina is None:
            mina = i
            maxb = (l - i * len(a)) // len(b)
        maxa = i
        minb = (l - i * len(a)) // len(b)


ans1 = a * maxa + b * minb
ans2 = b * maxb + a * mina

if ans1 < ans2:
    print(ans1)
else:
    print(ans2)
Buggy python submission (verdict: Runtime Error):
a=[]
b=1000
n,t=map(int,input().split(" "))
for _ in range(n):
    a.append(tuple(map(int,input().split(" "))))
for i in range(n):
    if t>=a[i][1]:
        if b>a[i][0]:
            b=a[i][0]
if b !=1000:
    print(b)
if b==1000
    print("TLE")

Fixed submission:
a=[]
b=1001
n,t=map(int,input().split(" "))
for _ in range(n):
    a.append(tuple(map(int,input().split(" "))))
for i in range(n):
    if t>=a[i][1]:
        if b>a[i][0]:
            b=a[i][0]
if b !=1001:
    print(b)
else:
    print("TLE")

Buggy python submission (verdict: Runtime Error):
a=[]
b=1000
n,t=map(int,input().split(" "))
for _ in range(n+1):
    a.append(tuple(map(int,input().split(" "))))
for i in range(n+1):
    if t>=a[i][1]:
        if b>a[i][0]:
            b=a[i][0]
if b !=1000:
    print(b)
else:
    print("TLE")

Fixed submission:
a=[]
b=1001
n,t=map(int,input().split(" "))
for _ in range(n):
    a.append(tuple(map(int,input().split(" "))))
for i in range(n):
    if t>=a[i][1]:
        if b>a[i][0]:
            b=a[i][0]
if b !=1001:
    print(b)
else:
    print("TLE")
Buggy python submission (verdict: Runtime Error):
a,b,c,=list(input()),list(input()),list(input())
d=a[0]
e=0
a.remove(d)
while True:
    if eval(d)==[]:
        break
    e=eval(d)[0]
    eval(d).remove(e)
    d=e
print(str.upper(e))

Fixed submission:
a,b,c,=list(input()),list(input()),list(input())
d=a[0]
e=0
a.remove(d)
while True:
    if eval(d)==[]:
        break
    e=eval(d)[0]
    eval(d).remove(e)
    d=e
print(str.upper(d))
Buggy python submission (verdict: Runtime Error):
a = input()
if a='Sunny':
  print('Cloudy')

Fixed submission:
a = input()
if a=='Sunny':
  print('Cloudy')
elif a=='Cloudy':
  print('Rainy')
elif a=='Rainy':
  print('Sunny')

Buggy python submission (verdict: Runtime Error):
a = input()
if a='Sunny':
  print('Cloudy')
elif a='Cloudy':
  print('Rainy')
elif a='Rainy':
  print('Sunny')
  

Fixed submission:
a = input()
if a=='Sunny':
  print('Cloudy')
elif a=='Cloudy':
  print('Rainy')
elif a=='Rainy':
  print('Sunny')

Buggy python submission (verdict: Runtime Error):
a = input()
if a = "Sunny":
  print("Cloudy")
elif a = "Cloudy":
  print("Rainy")
else:
  print("Sunny")
  

Fixed submission:
a = input()
if a=='Sunny':
  print('Cloudy')
elif a=='Cloudy':
  print('Rainy')
elif a=='Rainy':
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
s = int()
t = int()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)

Fixed submission:
s = input()
t = input()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)

Buggy python submission (verdict: Runtime Error):
s = int()
t = int()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
print(c)

Fixed submission:
s = input()
t = input()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)

Buggy python submission (verdict: Runtime Error):
s=map(str, input().split())
t=map(str, input().split())
c = 0
for i in range(3):
  if s[i]==t[i]:
    c = c + 1
print(c)

Fixed submission:
s = input()
t = input()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)

Buggy python submission (verdict: Runtime Error):
s=map(str, input().split())
t=map(str, input().split())
c = 0
for i in range(3):
  if s[i] == t[i]:
    c = c + 1
print(c)

Fixed submission:
s = input()
t = input()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)

Buggy python submission (verdict: Runtime Error):
s=map(str, input().split())
t=map(str,i nput().split())
c = 0
for i in range(3):
  if s[i] == t[i]:
    c = c + 1
print(c)

Fixed submission:
s = input()
t = input()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
int c = 0
for i in range(2):
  if (s[i] = t[i]):
    c = c + 1
print(c)

Fixed submission:
s = input()
t = input()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
ss = s.lower()
if k == 1:
  print(ss[0]+s[1:n])
elif k == n:
  print(s[0:n-1]+ss[n])
else:
  print(s[0:k-1]+ss[k]+s[k+1:n])

Fixed submission:
n,k = map(int,input().split())
s = input()
ss = s.lower()
if k == 1:
  print(ss[0]+s[1:n])
elif k == n:
  print(s[0:n-1]+ss[n-1])
else:
  print(s[0:k-1]+ss[k-1]+s[k:n])

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = input()
for i in range(n):
  if i == (k-1):
    a = a + s.lower[i]
  else:
    a = a + s[i]

print(a)    

Fixed submission:
n,k = map(int,input().split())
s = input()
ss = s.lower()
if k == 1:
  print(ss[0]+s[1:n])
elif k == n:
  print(s[0:n-1]+ss[n-1])
else:
  print(s[0:k-1]+ss[k-1]+s[k:n])
Buggy python submission (verdict: Runtime Error):
a = sorted(list(map(int, input().split())))
if a[1]-a[0] >= 1:
  print(a[2]*2-1)
else:
  print(a[2]*2)

Fixed submission:
a = sorted(list(map(int, input().split())))
if a[1]-a[0] >= 1:
  print(a[1]*2-1)
else:
  print(a[1]*2)

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

Fixed submission:
a = sorted(list(map(int, input().split())))
if a[1]-a[0] >= 1:
  print(a[1]*2-1)
else:
  print(a[1]*2)

Buggy python submission (verdict: Runtime Error):
a = sorted(list(map(int, input().split())))
if a[2]-a[1]>=1:
  print(a[2]*2-1)
elif a[2]-a[1]=0:
  print(a[2]*2)

Fixed submission:
a = sorted(list(map(int, input().split())))
if a[1]-a[0] >= 1:
  print(a[1]*2-1)
else:
  print(a[1]*2)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
else
  print('Yay!')

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
elif c-a > k:
  print(':(')
  exit()
elif d-a > k:
  print(':(')
  exit()
elif e-a > k:
  print(':(')
  exit()
else:
  print('Yay!')

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
elif c-a > k:
  print(':(')
  exit()
elif d-a > k:
  print(':(')
  exit()
elif e-a > k:
  print(':(')
  exit()
else
  print('Yay!')
  exit()

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a > k:
  print(':(')
  exit()
elif c-a > k:
  print(':(')
  exit()
elif d-a > k:
  print(':(')
  exit()
elif e-a > k:
  print(':(')
  exit()
else:
  print('Yay!')
Buggy python submission (verdict: Runtime Error):
hh, ww = map(int, input(),split())
h, w = map(int, input(),split())
s = hh*ww - h*ww - hh*w + hh*ww
print(s)

Fixed submission:
hh,ww = map(int, input().split())
h, w = map(int, input().split())
s = hh*ww - h*ww - hh*w + h*w
print(s)

Buggy python submission (verdict: Runtime Error):
hh, ww = map(int, input(),split())
h, w = map(int, input(),split())

print(hh*ww - h - w + 1)

Fixed submission:
hh,ww = map(int, input().split())
h, w = map(int, input().split())
s = hh*ww - h*ww - hh*w + h*w
print(s)
Buggy python submission (verdict: Runtime Error):
t,x = map(int, input().split)
print(float(t)/float(x))

Fixed submission:
t,x = map(int, input().split())
print(float(t)/float(x))

Buggy python submission (verdict: Runtime Error):
t,x = map(float, input().split)
print(t/x)

Fixed submission:
t,x = map(int, input().split())
print(float(t)/float(x))
Buggy python submission (verdict: Runtime Error):
n = int(input())

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

Fixed submission:
n = int(input())

if n == 1:
  print('Hello World')
  exit()
elif n == 2:
  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 if n == 2:
  a = int(input())
  b = int(input())
  print(a+b)

Fixed submission:
n = int(input())

if n == 1:
  print('Hello World')
  exit()
elif n == 2:
  a = int(input())
  b = int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
k = input()

if k%2==0:
  s = k*k//4
  print(s)
else:
  s = k//2
  s1 = s*(s+1)
  print(s1)

Fixed submission:
k = int(input())

if k%2 ==0 :
  s = k*k
  s1 = s//4
  print(s1)
else:
  s = k//2
  s1 = s*(s+1)
  print(s1)

Buggy python submission (verdict: Runtime Error):
k = input()

if k%2==0:
  print(k*k//4)
else:
  print(k//2 * (k//2 + 1))

Fixed submission:
k = int(input())

if k%2 ==0 :
  s = k*k
  s1 = s//4
  print(s1)
else:
  s = k//2
  s1 = s*(s+1)
  print(s1)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(str, input().split())
s = 0
if a == '+':
  s = s + 1
else:
  s = s - 1

if b == '+':
  s = s + 1
else:
  s = s - 1

if c == '+':
  s = s + 1
else:
  s = s - 1

if d == '+':
  s = s + 1
else:
  s = s - 1

print(s)

Fixed submission:
s = input()
pu = s.count('+')
mi = s.count('-')
print(pu-mi)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

if abs(c-a)<=d:
  print('Yes')
  exit()

if abs(b-a)<=d:
  if abs(c-b)<=d:
  print('Yes')
  exit()

print('No')

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

if abs(c-a)<=d:
  print('Yes')
  exit()

if abs(b-a)<=d:
  if abs(c-b)<=d:
    print('Yes')
    exit()

print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, imput().split())

if (a+b) >= c:
  print('Yes')
else:
  print('No')

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

if (a+b) >= c:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()

print(a[1]+b[2]+c[3])

Fixed submission:
a = input()
b = input()
c = input()

print(a[0]+b[1]+c[2])
Buggy python submission (verdict: Runtime Error):
s = input()
s[3] = 8
print(s)

Fixed submission:
s = input()
ss = s.replace('2017', '2018')
print(ss)
Buggy python submission (verdict: Runtime Error):
r,g = map(int, input().split())


Fixed submission:
r = int(input())
g = int(input())
print(2*g - r)

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

s = g * 2 - r
print(s)

Fixed submission:
r = int(input())
g = int(input())
print(2*g - r)

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

print(g*2-r)

Fixed submission:
r = int(input())
g = int(input())
print(2*g - r)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
print(s[0]+(n-2)+s[n-1])

Fixed submission:
s = input()
n = len(s)
print(s[0]+str(n-2)+s[n-1])
Buggy python submission (verdict: Runtime Error):
s1,s2,s3 = map(str,input())
bs1 = s1.upper()
bs2 = s2.upper()
bs3 = s3.upper()
print(bs1[0]+bs2[0]+bs3[0])

Fixed submission:
s1,s2,s3 = map(str,input().split())
bs1 = s1.upper()
bs2 = s2.upper()
bs3 = s3.upper()
print(bs1[0]+bs2[0]+bs3[0])
Buggy python submission (verdict: Runtime Error):
x = map(int, input().split())

if x < 1200:
  print('ABC')
else:
  print('ARC')

Fixed submission:
x = int(input())

if x < 1200:
  print('ABC')
else:
  print('ARC')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(str, input().split())
d = ' '
print(a+d+b+d+c)

Fixed submission:
a=input()
b = a.replace(',',' ')
print(b)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if a==b==c:
  print(1)
elif a==b/=c:
  print(2)
elif a==c/=b:
  print(2)
elif c==b/=a:
  print(2)
else:
  print(3)

Fixed submission:
a,b,c = map(int, input().split())
if a==b==c:
  print(1)
  exit()
if a==b:
  print(2)
elif a==c:
  print(2)
elif b==c:
  print(2)
else:
  print(3)
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
a = []
b = []
for i in range(n):
  a1, b1 = map(int, input().split())
  a.append(a1)
  b.append(b1)

mp = [10 ** 8] * (h + max(a))
mp[0] = 0
for i in range(h):
  for j in range(n):
    mp[i+a[j]] = min(mp[i+a[j]], mp[i] + b[j])

print(min(mp[h:]))


Fixed submission:
h, n = map(int, input().split())
a = []
b = []
for i in range(n):
  a1, b1 = map(int, input().split())
  a.append(a1)
  b.append(b1)

mp = [10 ** 8] * (h + max(a))
mp[0] = 0
for i in range(h):
  for j in range(n):
    mp[i+a[j]] = min(mp[i+a[j]], mp[i] + b[j])

print(min(mp[h:]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
flag = False
for i in range(2, 10):
  flag = flag or (n/i = n//i and n//i <= 9)    
print ("Yes" if n <= 9 or (flag and n <= 81) else "No")

Fixed submission:
n = int(input())
flag = False
for i in range(2, 10):
  flag = flag or (n/i == n//i and n//i <= 9)    
print ("Yes" if n <= 9 or (flag and n <= 81) else "No")
Buggy python submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
print(math.degrees(math.atan(2*b/a-2*x/a/a/a if x >= a*a*b/2 else a*b*b/2/x)


Fixed submission:
import math
a, b, x = map(int, input().split())
if x >= a*a*b/2:
  print(math.degrees(math.atan(2*b/a-2*x/a/a/a)))
else:
  print(math.degrees(math.atan(a * b * b / 2 / x)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
o = []

for i in range(n):
  o.append(a.index(i + 1) + 1)

print(" ".join(str(e) for e in o))


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

o = sorted(range(len(a)), key=lambda k: a[k])

print(" ".join(str(e+1) for e in o))
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
for i in range(n):
  if (k - q + a.count(i+1) > 0):
    print("Yes")
  else:
    print("No")


Fixed submission:
from collections import Counter
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
c = Counter(a)
for i in range(n):
  if (k - q + c.get(i+1, 0) > 0):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))

c = collections.Counter(a)
v = list(c.values())
k = list(c.keys())

if n % 3 == 0 and v[0] == v[1] == v[2] and k[0] ^ k[1] == k[2]:
  print("Yes")
else:
  print("No")


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

c = collections.Counter(a)
k = list(c.keys())
v = list(c.values())

if n % 3 == 0:
  if len(v) == 3:
    if v[0] == v[1] == v[2] and k[0] ^ k[1] == k[2]:
      print("Yes")
    else:
      print("No")
  elif len(v) == 2:
    if (k[0] == 0 and v[0] * 2 == v[1]) or (k[1] == 0 and v[1] * 2 == v[0]):
      print("Yes")
    else:
      print("No")
  elif len(v) == 1:
    if k[0] == 0:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
elif len(v) == 1:
  if k[0] == 0:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
s = 0

for p in range(1, int(math.sqrt(n)) + 1):
  t = (n - p) / p
  if t.is_integer():
    if (n // int(t)) == (n % int(t)):
      s += int(t)

print(s)


Fixed submission:
import math
 
n = int(input())
s = 0
if n > 2:
  for p in range(1, int(math.sqrt(n)) + 1):
    t = (n - p) / p
    if t.is_integer():
      if (n // int(t)) == (n % int(t)):
        s += int(t)
  print(s)

else:
  print(0)

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

n = int(input())
s = 0

for p in range(1, int(math.sqrt(n)) + 1):
  t = (n - p) / p
  if t.is_integer():
    if (n // int(t)) == (n % int(t)):
      s += int(t)

print(s)


Fixed submission:
import math
 
n = int(input())
s = 0
if n > 2:
  for p in range(1, int(math.sqrt(n)) + 1):
    t = (n - p) / p
    if t.is_integer():
      if (n // int(t)) == (n % int(t)):
        s += int(t)
  print(s)

else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0

for p in range(1, int(n/2) + 1):
  t = (n - p) / p
  if t.is_integer():
    if (n // int(t)) == (n % int(t)):
      s += int(t)

print(s)


Fixed submission:
import math
 
n = int(input())
s = 0
if n > 2:
  for p in range(1, int(math.sqrt(n)) + 1):
    t = (n - p) / p
    if t.is_integer():
      if (n // int(t)) == (n % int(t)):
        s += int(t)
  print(s)

else:
  print(0)
Buggy python submission (verdict: Runtime Error):
import heapq
import itertools

def dif(l):
  return max(l) - min(l)

x,y,z,k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

flag = True
while flag:
  fa = False
  while (x-1)*y*z > k and dif(a) > dif(b) and dif(a) > dif(c):
    a.pop()
    x -= 1
    fa = True

  fb = False
  while x*(y-1)*z > k and dif(b) > dif(a) and dif(b) > dif(c):
    b.pop()
    y -= 1
    fb = True

  fc = False
  while x*y*(z-1) > k and dif(c) > dif(b) and dif(c) > dif(a):
    c.pop()
    z -= 1
    fc = True
  
  flag = fa or fb or fc

l=[]
for a1 in a:
    for b1 in b:
        for c1 in c:
            l.append(a1+b1+c1)

m2 = heapq.nlargest(k, l)
for i in range(k):
  print(m2[i])


Fixed submission:
t = [int(input()) for i in range(6)]
print ("Yay!" if t[4]-t[0] <= t[5] else ":(")
Buggy python submission (verdict: Runtime Error):
b, c, _ = map(int, raw_input().split())
print(b * c / 2)

Fixed submission:
b, c, _ = map(int, input().split())
print(int(b * c / 2))
Buggy python submission (verdict: Time Limit Exceeded):
n, k  = list(map(int, input().split()))
h = list(map(int, input().split()))
c = [0]*n

for i in range(1, n):
  hi = h[i]
  c[i] = min(abs(hi-h[i-j-1]) + c[i-j-1] for j in range(min(i, k)))
  
print(c[-1])


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

c = [0]
for i in range(1, n):
  tmp = 10**100
  for j in range(1, min(i, k)+1):
    tmp = min(abs(h[i] - h[i - j]) + c[i - j], tmp)
  c.append(tmp)
  
print(c[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, k  = list(map(int, input().split()))
h = list(map(int, input().split()))
c = [0]*n

for i in range(1, n):
  c[i] = min(abs(h[i] - h[i - j]) + c[i - j] for j in range(1, min(i, k)+1))
  
print(c[-1])


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

c = [0]
for i in range(1, n):
  tmp = 10**100
  for j in range(1, min(i, k)+1):
    tmp = min(abs(h[i] - h[i - j]) + c[i - j], tmp)
  c.append(tmp)
  
print(c[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, mw = map(int, input().split())
iwv = [list(map(int, input().split())) for _ in range(n)]

vw = [0] * (mw + 1)

for i in range(n):
  for j in reversed(range(iwv[i][0], mw + 1)):
    vw[j] = max(vw[j], vw[j - iwv[i][0]] + iwv[i][1])
  
print(max(vw))


Fixed submission:
n, mw = map(int, input().split())
iwv = [list(map(int, input().split())) for _ in range(n)]

vw = [0] * (mw + 1)

for i in range(n):
  for j in reversed(range(iwv[i][0], mw + 1)):
    vw[j] = max(vw[j], vw[j - iwv[i][0]] + iwv[i][1])
  
print(max(vw))