Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02937 (python)

Fixed submission:
import sys
import numpy as np
import bisect
s = input()
t = input()



count = 0
s_len = len(s)
s_list = np.zeros(len(s))
t_list = []*len(t)
indexes = []

for i in range(26):
  
  indexes.append([j for j, x in enumerate(s) if x == chr(i + ord('a')) ])
  


for i,k in enumerate(t):

  index = indexes[ord(k)-ord('a')]
  
  if len(index) == 0:
    print(-1)
    sys.exit(0)
  else:
    t_list.insert(i,index)
    


pre = -1
for i in range(len(t)):
  
  #high = [j  for j in t_list[i] if j > pre]
  high = bisect.bisect_left(t_list[i], pre+1) 

  if high >= len(t_list[i]):
    
    count += s_len - pre  + t_list[i][0]
    pre = t_list[i][0] 
  else:
    
    count += t_list[i][high] - pre 
    pre = t_list[i][high]

print(count)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import bisect
s = input()
t = input()



count = 0
s_len = len(s)
s_list = np.zeros(len(s))
t_list = []*len(t)
indexes = []

for i in range(26):
  
  indexes.append([j for j, x in enumerate(s) if x == chr(i + ord('a')) ])
  

for i,k in enumerate(t):

  index = indexes[ord(k)-97]
  
  if len(indexes) == 0:
    print(-1)
    sys.exit(0)
  else:
    t_list.insert(i,index)
    


pre = -1
for i in range(len(t)):
  
  #high = [j  for j in t_list[i] if j > pre]
  high = bisect.bisect_left(t_list[i], pre) 

  if high >= len(t_list[i]):
    
    count += s_len - pre  + t_list[i][0]
    pre = t_list[i][0] 
  else:
    
    count += t_list[i][high] - pre 
    pre = t_list[i][high]

print(count)
Problem p02946 (python)

Fixed submission:
s = list(map(int, input().split(' ')))
k = s[0]
x = s[1]

min = 1000000*-1
max =  1000000


if x-k+1 > min:
  min = x-k+1

if x+k < max:
  max = x+k

for i in range(min,max):
	print(i,end=' ')
print()

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split(' ')))
k = s[0]
x = s[1]

min = −1000000
max =  1000000


if x-k+1 > min:
  min = x-k+1

if x+k-1 < max:
  max = x+k-1

for i in range(min,max)
	print(i,end=' ')
print()

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split(' ')))
k = s[0]
x = s[1]

min = −1000000
max =  1000000


if x-k+1 > min:
  min = x-k+1

if x+k-1 < max:
  max = x+k-1

for i in range(min,max)
	print(i,end=' ')
print()
Problem p02957 (python)

Fixed submission:
import sys

ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

if (a+b)%2 == 1:
  print("IMPOSSIBLE")
  sys.exit(0)

print(int((a+b)/2))

Buggy submission (verdict: Runtime Error):


ab = list(map(int, input().sprit()))
a = ab[0]
b = ab[1]

if (a+b)%2 == 1:
  print("IMPOSSIBLE")
  return 0

print((a+b)/2)
Problem p02640 (python)

Fixed submission:
X, Y = map(int, input().split())

add = 0
flag =0

for i in range(X+1):
    add = i*4 + (X-i)*2
    if add == Y:
        print('Yes')
        flag = 1
        break

if flag == 0:
    print('No')

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

add = 0
flug =0

for i in range(X):
    add = i*4 + (X-i)*2
    if add == Y:
        print('Yes')
        flag = 1
        break

if flag == 0:
    print('No')

Buggy submission (verdict: Runtime Error):
X, Y = map(int,input().split())

sum = 0
flug =0

for i in range(X):
    sum = i*4 + (X-i)*2
    if sum == Y:
        print('Yes')
        flag = 1
        break

if flag == 0:
    print('No')

Buggy submission (verdict: Runtime Error):
X, Y = map(int,input().split())

sum = 0
flug =0

for i in range(X):
    sum = i*4 + (X-i)*2
    if sum == Y:
        print('Yes')
        flag = 1
        break

if flag == 0:
    print('No')
Problem p02658 (python)

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

multi = 1

if A[-1]==0:
    print('0')
else:
    for n in range(N):
        multi = multi*A[n]
        if multi>10**18:
            multi=-1
            break
        
    print(multi)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int,input().split()))
A.sort()

multi = 1
i = 0

if A[-1]==0:
    multi = 0

while A[-1] < 2:
    A.pop()
    i+=1

for n in range(N-i):
    if multi == 0:
        break
    multi = multi*A[n]

print(multi)
Problem p02553 (python)

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

x1 = a*c
x2 = a*d
x3 = b*c
x4 = b*d

z = x1
if z < x2:
    z = x2
if z < x3:
    z = x3
if z < x4:
    z = x4

print(z)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

if a < 0:
    a = -a
if b < 0:
    b = -b
if c < 0:
    c = -c
if d < 0:
    d = -d

if a <= b:
    x = b
if c <= d:
    y = d

print(x*y)
Problem p02556 (python)

Fixed submission:
N = int(input())
i = 0
a_max = 2
a_min = 2*(10**9)
s_max = 1-10**9
s_min = 10**9-1

for i in range(N):
    x,y=map(int,input().split())
    add = x+y
    sub = x-y

    if add > a_max:
        a_max = add
    if add < a_min:
        a_min = add
    
    if sub > s_max:
        s_max = sub
    if sub < s_min:
        s_min = sub

d_add = a_max - a_min
d_sub = s_max - s_min

#if d_add >= d_sub:
#    print(d_add)
#if d_add < d_sub:
#    print(d_sub)
print(max(d_add,d_sub))

Buggy submission (verdict: Runtime Error):
N = int(input())
#i = 0
a_max = 2
a_min = 2*(10**9)
s_max = 0
s_min = 10**9

for i in N:
    x,y=map(int,input().split())
    add = x+y
    sub = x-y

    if add > a_max:
        a_max = add
    if add < a_min:
        a_min = add
    if sub > s_max:
        s_max = sub
    if sub < s_max:
        s_max = sub

d_add = a_max - a_min
d_sub = s_max - s_min

print(max(d_add,d_sub))
Problem p02600 (python)

Fixed submission:
x = int(input())
if 400 <= x <= 599:
    print ("8")
if 600 <= x <= 799:
    print ("7")
if 800 <= x <= 999:
    print ("6")
if 1000 <= x <= 1199:
    print ("5")
if 1200 <= x <= 1399:
    print ("4")
if 1400 <= x <= 1599:
    print ("3")
if 1600 <= x <= 1799:
    print ("2")
if 1800 <= x <= 1999:
    print ("1")

Buggy submission (verdict: Runtime Error):
x = int(input())
for i in range(2,10):
    if i <= x/200 < i+1:
        print(10-i):

Buggy submission (verdict: Runtime Error):
x = int(input())
	for i in range(2,10):
	    if i <= x/200 < i+1:
    	    print(10-i)
Problem p02553 (python)

Fixed submission:
A,B,C,D = map(int, input().split())

a1 = A * C
a2 = A * D
a3 = B * C
a4 = B * D

list = (a1,a2,a3,a4)

print(max(list))

Buggy submission (verdict: Runtime Error):
s = int(input()).split()

a1 = s[0] * s[2]
a2 = s[0] * s[3]
a3 = s[1] * s[2]
a4 = s[1] * s[3]

list = (a1,a2,a3,a4)

print(max(list))

Buggy submission (verdict: Runtime Error):
a1 = a * c
a2 = a * d
a3 = b * c
a4 = b * d

list = [a1,a2,a3,a4]
print(max(list))
Problem p02664 (python)

Fixed submission:
line = list(input())
N = len(line)
i = 1
for i in range(N):
    if line[i] == "?":
        line[i] = "D"
print("".join(line))

Buggy submission (verdict: Runtime Error):
line = list(input())
N = len(line)
i = 1
for i in range(N):
    if line[i] == "?":
        if line[i-1] == "P":
            line[i] = "D"
        elif i <= 2 and line[i-2] == "D":
            line[i] = "D"
        else:
            line[i] = "P"
print("".join(line))

Buggy submission (verdict: Runtime Error):
line = list(input())
N = len(line)
i = 1
for i in range(N):
    if line[i] == "?":
        if line[i-1] == "P":
            line[i] = "D"
        elif line[i-2] == "D":
            line[i] = "D"
        else:
            line[i] = "P"
print("".join(line))
Problem p02683 (python)

Fixed submission:
N, M, X = map(int, input().split(" "))
B_list = []


for Books in range(N):
    B_list.append(list(map(int, input().split(" "))))
# print(B_list)

bug = []
for k in range(M + 1):
    bug.append(0)
# print(bug)
ways = []

for way in range(2**N):
    for book in range(N):
        if ((way >> book) & 1) == 1:
            for i in range(M + 1):
                bug[i] += B_list[book][i]

    # print(bug)
    O = bug.pop(0)
    clear = [l for l in bug if l >= X]
    # print(clear)

    if len(bug) == len(clear):
        ways.append(O)

    bug = []
    for k in range(M + 1):
        bug.append(0)

if len(ways) == 0:
    print(-1)
else:
    print(min(ways))

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split(" "))
B_list = []


for Books in range(N):
    B_list.append(list(map(int, input().split(" "))))
# print(B_list)

bug = []
for k in range(M + 1):
    bug.append(0)
# print(bug)
ways = []

for way in range(2**N):
    for book in range(N):
        if ((way >> book) & 1) == 1:
            for i in range(M + 1):
                bug[i] += B_list[book][i]

    # print(bug)
    clear = [l for l in bug if l >= X]
    # print(clear)
    bug.pop(0)
    if len(clear) > 1:
        O = clear.pop(0)

    if len(bug) == len(clear):
        ways.append(O)

    bug = []
    for k in range(M + 1):
        bug.append(0)

if len(ways) == 0:
    print(-1)
else:
    print(min(ways))

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split(" "))
B_list = []


for Books in range(N):
    B_list.append(list(map(int, input().split(" "))))
# print(B_list)

bug = []
for k in range(M + 1):
    bug.append(0)
#print(bug)
ways = []

for way in range(2**N):
    for book in range(N):
        if ((way >> book) & 1) == 1:
            for i in range(M + 1):
                bug[i] += B_list[book][i]

    # print(bug)
    clear = [l for l in bug if l >= X]
    #print(clear)
    bug.pop(0)
    O = clear.pop(0)

    if len(bug) == len(clear):
        ways.append(O)

    bug = []
    for k in range(M + 1):
        bug.append(0)

if len(ways) == 0:
    print(-1)
else:
    print(min(ways))
Problem p02621 (python)

Fixed submission:
num = int(input())
print(num + (num*num) + (num*num*num))

Buggy submission (verdict: Runtime Error):
num = input()
print(num + (num*num) + (num*num*num))
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if (a*b)%2 ==0:
    print('Even')
else:
    print('Odd')

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

if a % 2 == 1 && b % 2 == 1:
  print("Odd")
else:
  print("Even")
Problem p03493 (python)

Fixed submission:
s = input()
 
count = 0
 
for i in s:
  if i == '1':
    count = count + 1
  
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
 
count = 0
 
for i in s:
  if s[i] == '1':
    count = count + 1
  
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
 
count = 0
 
for i in s:
  if i == '1':
    count++
  
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
 
count = 0
 
for i in s:
  if s[i] == '1':
    count++
  
print(count)

Buggy submission (verdict: Runtime Error):
s = input()

count = 0;

for i in s:
  if s[i] == '1':
    count++
  
print(count)
Problem p02553 (python)

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

print(max(a*c,a*d,b*c,b*d))

Buggy submission (verdict: Runtime Error):
a, b, c, d = int(input()).split()
 
if b > 0 && d > 0:
  print(b * d)
elif b < 0 && d > 0:
  print(b * c)
elif b > 0 && d < 0:
  print(a * d)
elif a < 0 && c < 0:
  print(a * c)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a, b, c, d = int(input()).split()
 
if b > 0 && d > 0:
  print(b * d)
elif b < 0 && d > 0:
  print(b * c)
elif b > 0 && d < 0:
  print(a * d)
elif b <= 0 && d <= 0:
  print(a * c)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a, b, c, d = int(input()).split()

if b > 0 && d > 0:
  print(b * d)
elif b < 0 && d > 0:
  print(b * c)
elif b > 0 && d < 0:
  print(a * d)
else:
  print(a * c)
Problem p02576 (python)

Fixed submission:
import math

a = list(map(int, input().split()))

print(math.ceil(a[0] / a[1]) * a[2])

Buggy submission (verdict: Runtime Error):
import math

a = list(map(int, input()split()))

print(math.ceil(a[0] / a[1]) * a[2])

Buggy submission (verdict: Runtime Error):
import math

a = list(map(int, input().split()))

print(math.ceil(a[0]/a[1]) * math[2])

Buggy submission (verdict: Runtime Error):
import math

a = list(map(int, input().split()))

print(math.ceil(a[0]/a[1]) * a[3])

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))

print(math.ceil(a[0] / a[1]) * t)

Buggy submission (verdict: Runtime Error):
n, x, t = list(map(input()))

if n % x == 0:
  return n / x * t
else n % x != 0:
  return (n // x + 1) * t

Buggy submission (verdict: Runtime Error):
import math

n = input()
x = input()
t = input()

if n % x == 0:
  return (n / x) * t
else n % x != 0:
  return math.ceil(n / x) * t

Buggy submission (verdict: Runtime Error):
import math

n = input()
x = input()
t = input()

def takoyakikun():
  times = math.ceil(n/x)
  return times * t

print(takoyakikun)
Problem p02582 (python)

Fixed submission:
s = input()
if s == "RRR":
  print(3)
if s == "SSS":
  print(0)
if s == "RRS":
  print(2)
if s == "SRR":
  print(2)
if s == "RSS":
  print(1)
if s == "SRS":
  print(1)
if s == "SSR":
  print(1)
if s == "RSR":
  print(1)

Buggy submission (verdict: Runtime Error):
s = input()
if s == "RRR":
  print(3)
  elif s == "RRS" or s == "SRR":
    print(2)
    elif s == "SSS":
      print(0)
      else:
        print(1)

Buggy submission (verdict: Runtime Error):
s = str(input())
if "RRR" in s:
  print(3)
  elif "RR" in s:
    print(2)
    elif "SSS" in s:
      print(0)
      else:
        print(1)

Buggy submission (verdict: Runtime Error):
s = str(input())
if RRR in s:
  print(3)
  elif RR in s:
    print(2)
    elif SSS in s:
      print(0)
      else:
        print(1)

Buggy submission (verdict: Runtime Error):
if S = "RRR":
  print(3)
  elif S = "RRS" or S = "SRR":
    print(2)
    elif S = "SSS":
      print(0)
      else:
        print(1)

Buggy submission (verdict: Runtime Error):
s = input()
if s = "RRR":
  print(3)
  elif s = "RRS" or s = "SRR":
    print(2)
    elif s = "SSS":
      print(0)
      else:
        print(1)

Buggy submission (verdict: Runtime Error):
S = str(input())
if S = "RRR":
  print(3)
elif S = "RRS" or S = "SRR":
  print(2)
elif S = "RSR":
  print(1)
else S = "SSS":
  print(0)

Buggy submission (verdict: Runtime Error):
s = str(input())
if s = "RRR":
  print(3)
elif s = "RRS" or s = "SRR":
  print(2)
elif s = "RSS" or s = "SRS" or s = "SSR" or s = "RSR":
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
s = str(input())
if s = "RRR":
  print(3)
if s = "RRS" and s = "SRR":
  print(2)
if s = "RSS" and s = "SRS" and s = "SSR" and s = "RSR":
  print(1)
if s = "SSS":
  print(0)

Buggy submission (verdict: Runtime Error):
s = str(input())
if s = "RRR":
  print(3)
elif s = "RRS" and s = "SRR":
  print(2)
elif s = "RSS" and s = "SRS" and s = "SSR" and s = "RSR":
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
s = str(input())
if s.count("R") = 3:
  print(3)
  elif s.count("R") = 2:
    print(2)
    elif s.count("R") = 1:
      print(1)
      else:
        print(0)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + a ** 2 + a ** 3);

Buggy submission (verdict: Runtime Error):
a = input()
print(a + a**2 + a**3)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
n1 = input()
n2 = input()

print(n1 * n2)

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

print(a * b)
Problem p02658 (python)

Fixed submission:
N = int(input())
arr = [int(x) for x in input().split()]
found = False
for x in arr:
  if x == 0:
    found = True
if found:
  print(0)
  exit(0)
res = 1
MAX = 10 ** 18
for x in arr:
  res *= x
  if res > MAX:
    print(-1)
    exit(0)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = [int(x) for x in input().split()]
found = false
for x in arr:
  if x == 0:
    found = True
if found:
  print(0)
  exit(0)
res = 1
MAX = 10 ** 18
for x in arr:
  res *= x
  if res > MAX:
    print(-1)
    exit(0)
print(res)
Problem p03210 (python)

Fixed submission:
x = int(input())

if ((x == 7) or (x == 5) or (x ==3)):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s = input()

x = []
for i in range(len(s) - 2):
    x.append(abs(int(s[i:i+3]) - 753))
    
print(min(x))
Problem p03211 (python)

Fixed submission:
s = list(str(input()))
m = []
for i in range(len(s)-2):
    x = s[i:i+3]
    a = 0
    a = int("".join(x))
    x = s
    m.append(abs(753-a))
print(min(m))

Buggy submission (verdict: Runtime Error):
s = input()
x = []

for i in range(len(s) - 2):
    x.append(abs(s[i:i+3]-753))
    
print(min(x))

Buggy submission (verdict: Runtime Error):
s = input()

x = []
for i in range(len(s) - 2):
    x.append(abs(int(x[i:i+3]) - 753))
    
print(min(x))

Buggy submission (verdict: Runtime Error):
s = int(input())

x = []
for i in range(len(s) - 2):
    x.append(abs(int(x[i:i+3]) - 753))
    
print(min(x))
Problem p03324 (python)

Fixed submission:
d,n = map(int,input().split())
if n == 100:
    if d == 0:
        print(101)
    elif d == 1:
        print(10100)
    elif d == 2:
        print(101*10000)
else:
    if d == 0:
        print(n)
    elif d == 1:
        print(n*100)
    elif d == 2:
        print(n*10000)

Buggy submission (verdict: Runtime Error):
d,n = map(int,input().split())
l = []
for i in range(1,100):
    l.append(100**d*i)
print(l[n-1])
Problem p03386 (python)

Fixed submission:
a,b,k = map(int,input().split())
l = []
if b-a >= k:
    for i in range(k):
        l.append(a+i)
    for i in range(k):
        l.append(b-i)
    l = sorted(set(l))
    for i in range(len(l)):
        print(l[i])
else:
    for i in range(b-a+1):
        print(a+i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
l = []
for i in range(a,b+1):
    l.append(i)
for j in range(0,len(l)):
    if b <= k:
        print(l[j])
    elif l[j] <= l[k-1] :
        print(l[j])
    elif l[j] >=l[len(l)-k]:
        print(l[j])
Problem p03415 (python)

Fixed submission:
c1 = list(input())
c2 = list(input())
c3 = list(input())
d = (c1[0],c2[1],c3[2])
print("".join(d))

Buggy submission (verdict: Runtime Error):
c1 = list(map(str,input().split()))
c2 = list(map(str,input().split()))
c3 = list(map(str,input().split()))
d = (c1[0],c2[1],c3[2])
print("".join(d))

Buggy submission (verdict: Runtime Error):
c = list(map(str,input().split()))
d = (c[0],c[4],c[8])
print("".join(d))
Problem p03486 (python)

Fixed submission:
s = sorted(str(input()))
t = sorted(str(input()))[::-1]
a = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(min(len(s),len(t))):
    if t[i] > s[i]:
        print("Yes")
        break
    elif len(set(s)) == len(set(t)):
        if len(s) < len(t):
            print("Yes")
            break
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = sorted(str(input()))
t = sorted(str(input()))[::-1]
a = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(len(s)):
    if t[i] > s[i]:
        print("Yes")
        break
    elif len(set(s)) == len(set(t)):
        if len(s) < len(t):
            print("Yes")
            break
else:
    print("No")
Problem p03624 (python)

Fixed submission:
s = sorted(set(list(str(input()))))
t = "abcdefghijklmnopqrstuvwxyz"
l = []
if len(s) == 26:
    print("None")
for i in range(26):
    if t[i] not in s:
        print(t[i])
        break

Buggy submission (verdict: Runtime Error):
s = sorted(set(list(str(input()))))
t = "abcdefghijklmnopqrstuvwxyz"
if len(s) == 26:
    print("None")
for i in range(26):
    if t[i] != s[i]:
        print(t[i])
        break
Problem p03643 (python)

Fixed submission:
s = str(input())
print("ABC"+s)

Buggy submission (verdict: Runtime Error):
print("ABC"+str(input())
Problem p03720 (python)

Fixed submission:
l = []
n,m = map(int,input().split())
for i in range(m):
    a,b = map(int,input().split())
    l.append(a)
    l.append(b)
for i in range(1,n+1):
    print(l.count(i))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = []
for i in range(m):
    a,b = map(int,input().split())
    l.append(a)
    l.append(b)
    t = list(set(l))
for i in range(n):
    print(l.count(t[i]))
Problem p03814 (python)

Fixed submission:
s = str(input())
a = []
b = []
for i in range(len(s)):
    if s[i] == "A":
        a.append(i)
    elif s[i] == "Z":
        b.append(i)
print(max(b)-min(a)+1)

Buggy submission (verdict: Runtime Error):
s = str(input())
l = []
for i in range(len(s)):
    for j in range(len(s)-1,0,-1):
        if s[i] == "A":
            if s[j] == "Z":
                l.append((j+1-i)
                break
print(max(l))
Problem p03827 (python)

Fixed submission:
n = int(input())
s = str(input())
l = []
c = 0
for i in range(len(s)):
    if s[i] == "I":
        c += 1
    elif s[i] == "D":
        c -= 1
    l.append(c)
print(max(max(l),0))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
l = []
c = 0
if s.count("I") < s.count("D"):
    print(0)
else:
    for i in range(len(s)):
        if s[i] == "I":
            c += 1
        elif s[i] == "D":
            c -= 1
        l.append(c)
print(max(l))
Problem p02692 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1<<30)
d = 'ABC'
N, *v = map(int, input().split())
e = [tuple(map(d.index, input())) for _ in range(N)]
p = []
def f(i):
	if i == len(e):
		print('Yes')
		print('\n'.join(p))
		raise SystemExit
	k, j = e[i]
	for a, s in ((k, j), (j, k)):
		if v[s] == 0: continue
		v[a] += 1
		v[s] -= 1
		p.append(d[a])
		f(i+1)
		v[a] -= 1
		v[s] += 1
		p.pop()
f(0)
print('No')

Buggy submission (verdict: Runtime Error):
import sys
d = 'ABC'
N, *v = map(int, input().split())
e = [tuple(map(d.index, input())) for _ in range(N)]
p = []
def f(i):
	if i == len(e):
		print('Yes')
		print('\n'.join(p))
		raise SystemExit
	k, j = e[i]
	for a, s in ((k, j), (j, k)):
		if v[s] == 0: continue
		v[a] += 1
		v[s] -= 1
		p.append(d[a])
		f(i+1)
		v[a] -= 1
		v[s] += 1
		p.pop()
f(0)
print('No')
Problem p03240 (python)

Fixed submission:
import sys
N = int(input().strip())
grid = []
ref = 0
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
    if array[2]>0:
      ref = i
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    flag = 0
    h0 = grid[ref][2]+abs(x-grid[ref][0])+abs(y-grid[ref][1])
    for arrays in grid:
      h = max(0,h0-abs(x-arrays[0])-abs(y-arrays[1]))
      if h != arrays[2]:
        flag = 1
    if flag == 0:
      print(x,y,h0)
      sys.exit()
    x += 1
  y += 1

Buggy submission (verdict: Runtime Error):
import sys
N = int(input().strip())
grid = []
ref = 0
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
    if array[2]>0:
      ref = i
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    h0 = grid[ref][2]+abs(x-grid[ref][0])+abs(y-grid[ref][1])
    for arrays in grid:
      h = h0-abs(x-arrays[0])-abs(y-arrays[1])
      if h != arrays[2]:
        break
    print(x,y,h0)
      sys.exit()
    x += 1
  y += 1

Buggy submission (verdict: Runtime Error):
import sys
N = int(input().strip())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    lis = []
    for arrays in grid:
      if arrays[2]>=1:
        lis.append(arrays[2]+abs(x-arrays[0])+abs(y-arrays[1]))
    if min(lis)==max(lis):
      if print(x,y,max(0,arrays[2]+abs(x-arrays[0])+abs(y-arrays[1])))
      sys.exit()
    x += 1
  y += 1
Problem p03262 (python)

Fixed submission:
import fractions
n,x = map(int, input().split())
lis = [int(i) for i in input().split()]
lis2 = []
for nums in lis:
  lis2.append(abs(nums-x))
ans = 10000000000000
if n == 1:
  g = lis2[0]
else:
  i = 2
  g = fractions.gcd(lis2[0],lis2[1])
  while i < n:
    g = fractions.gcd(g,lis2[i])
    i += 1
print(g)

Buggy submission (verdict: Runtime Error):
import fractions
n,x = map(int, input().split())
lis = [int(i) for i in input().split()]
lis2 = []
for nums in lis:
  lis2.append(abs(nums-x))
ans = 10000000000000
if n == 1:
  ans = lis2[0]
else:
  i = 2
  g = fractions.gcd(lis2[0],lis2[1])
  while i < n:
    g = fractions.gcd(g,lis2[i])
    i += 1
print(g)
Problem p03264 (python)

Fixed submission:
K = int(input())
m = K//2
print(m*(K-m))

Buggy submission (verdict: Runtime Error):
K = int(input)
m = K//2
print(m*(K-m))