Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
lis = []
for i in range(n):lis.append(int(input()))
if lis[0] != 0:
    print("-1")
    exit()
cou = 0
print(lis,cou)
for k in range(n-1):
    if lis[n-(k+1)] > lis[n-(k+2)]:
        a =  math.ceil(lis[n-(k+1)] / (lis[n-(k+2)]+1))
        cou += a
        lis[n-(k+1)] = 0
        lis[n-(k+2)] = min(lis[n-(k+1)]-1,lis[n-(k+2)],math.ceil(lis[n-(k+1)]/a)-1)
    else:
        cou += lis[n-(k+1)]
        lis[n-(k+2)] -= lis[n-(k+1)]-1
        lis[n-(k+1)] = 0
    print(lis,cou)
print(cou)

Fixed submission:
n = int(input())
lis = [int(input()) for i in range(n)]
if lis[0] != 0:print(-1);exit()
ans = 0
for i in range(n-1,0,-1):
    if lis[i] - lis[i-1] > 1:print(-1);exit()
    elif lis[i] - lis[i-1] == 1:ans += 1
    else:ans += lis[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
lis = []
for i in range(n):lis.append(int(input()))
if lis[0] != 0:
    print("-1")
    exit()
cou = 0
print(lis,cou)
for k in range(n-1):
    if lis[n-(k+1)] > lis[n-(k+2)]:
        a =  math.ceil(lis[n-(k+1)] / (lis[n-(k+2)]+1))
        cou += a
        lis[n-(k+1)] = 0
        lis[n-(k+2)] = min(lis[n-(k+1)]-1,lis[n-(k+2)],math.ceil(lis[n-(k+1)]/a))
    else:
        cou += lis[n-(k+1)]
        lis[n-(k+2)] -= lis[n-(k+1)]-1
        lis[n-(k+1)] = 0
    print(lis,cou)
print(cou)

Fixed submission:
n = int(input())
lis = [int(input()) for i in range(n)]
if lis[0] != 0:print(-1);exit()
ans = 0
for i in range(n-1,0,-1):
    if lis[i] - lis[i-1] > 1:print(-1);exit()
    elif lis[i] - lis[i-1] == 1:ans += 1
    else:ans += lis[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
lis = []
for i in range(n):lis.append(int(input()))
if lis[0] != 0:
    print("-1")
    exit()
cou = 0
print(lis,cou)
for k in range(n-1):
    if lis[n-(k+1)] > lis[n-(k+2)]:
        cou += math.ceil(lis[n-(k+1)] / (lis[n-(k+2)]+1))
        lis[n-(k+1)] = 0
        lis[n-(k+2)] = min(lis[n-(k+1)]-1,lis[n-(k+2)])
    else:
        cou += lis[n-(k+1)]
        lis[n-(k+2)] -= lis[n-(k+1)]-1
        lis[n-(k+1)] = 0
    print(lis,cou)
print(cou)

Fixed submission:
n = int(input())
lis = [int(input()) for i in range(n)]
if lis[0] != 0:print(-1);exit()
ans = 0
for i in range(n-1,0,-1):
    if lis[i] - lis[i-1] > 1:print(-1);exit()
    elif lis[i] - lis[i-1] == 1:ans += 1
    else:ans += lis[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
lis = []
for i in range(n):lis.append(int(input()))
if lis[0] != 0:
    print("-1")
    exit()
cou = 0
print(lis,cou)
for k in range(n-1):
    if lis[n-(k+1)] > lis[n-(k+2)]:
        cou += math.ceil(lis[n-(k+1)] / (lis[n-(k+2)]+1))
        lis[n-(k+1)] = 0
    else:
        cou += lis[n-(k+1)]
        lis[n-(k+2)] -= lis[n-(k+1)]-1
        lis[n-(k+1)] = 0
    print(lis,cou)
print(cou)

Fixed submission:
n = int(input())
lis = [int(input()) for i in range(n)]
if lis[0] != 0:print(-1);exit()
ans = 0
for i in range(n-1,0,-1):
    if lis[i] - lis[i-1] > 1:print(-1);exit()
    elif lis[i] - lis[i-1] == 1:ans += 1
    else:ans += lis[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
k = str(input())
lis = []
for u in range(6):
	for i in range(len(s)):
		try:
			if s[i:i+u] == "":
				continue
			if s[i:i+u] not in lis:
				lis.append(s[i:i+u])
		except:
			continue
lis.sort()
print(lis[k-1])

Fixed submission:
s = str(input())
k = int(input())
lis = []
for u in range(6):
	for i in range(len(s)):
		try:
			if s[i:i+u] == "":
				continue
			if s[i:i+u] not in lis:
				lis.append(s[i:i+u])
		except:
			continue
lis.sort()
print(lis[k-1])

Buggy python submission (verdict: Runtime Error):
s = str(input())
k = str(input())
lis = []
ans = "zzz"
li = ["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 k in range(6):
	for i in range(len(s)):
		try:
			if s[i:i+k] == "":
				continue
			if s[i:i+k] not in lis:
				lis.append(s[i:i+k])
		except:
			continue
lis.sort()

for i in range(k-1):
	lis.remove(lis[0])

print(lis[0])

Fixed submission:
s = str(input())
k = int(input())
lis = []
for u in range(6):
	for i in range(len(s)):
		try:
			if s[i:i+u] == "":
				continue
			if s[i:i+u] not in lis:
				lis.append(s[i:i+u])
		except:
			continue
lis.sort()
print(lis[k-1])
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
ans = []
num = 11
for i in range(n):
  while True:
    key = 1
    for j in range(2,math.ceil(math.sqrt(num))+1):
      if i % j == 0:
        key = 0
    num += 10
    if key == 1:
      ans.append(str(num))
      break
print(" ".join(ans))


Fixed submission:
a,b = map(int,input().split())
if a > b:
    print(a-1)
else:
    print(a)
Buggy python submission (verdict: Runtime Error):
s = str(input())
cou = 700
for i in range(3):


Fixed submission:
s = str(input())
cou = 700
for i in range(3):
    if s[i] == "o":
        cou += 100
print(cou)
Buggy python submission (verdict: Time Limit Exceeded):
n,c = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n)]
ans = 0
left = [[0,0]]
right = [[0,0]]
for i in range(n):
    left.append([lis[i][0],left[-1][1]+lis[i][1]])
    right.append([c-lis[-(i+1)][0],right[-1][1]+lis[-(i+1)][1]])
for i in range(n+1):
    for j in range(n-i+1):
          # print(left[i],right[j],left[i][1]+right[j][1]-left[i][0]*2-right[j][0],left[i][1]+right[j][1]-left[i][0]-right[j][0]*2)
        ans = max(ans,left[i][1]+right[j][1]-left[i][0]*2-right[j][0])
        ans = max(ans,left[i][1]+right[j][1]-left[i][0]-right[j][0]*2)
print(ans)

Fixed submission:
n,c = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n)]
ans = 0
num = 0
nu = 0
cou = 0
co = 0
go = 0
left = []
right = []
for i in range(n):
    num += lis[i][1]
    go = lis[i][0]
    ans = max(ans,num-go)
    if cou < num-go:
        cou = num-go
        left.append([go,num])
    else:
        try:left.append(left[-1])
        except:left.append([0,0])

for i in reversed(range(n)):
    nu += lis[i][1]
    go = c-lis[i][0]
    ans = max(ans,nu-go)
    if co < nu-go:
        co = nu-go
        right.append([go,nu])
    else:
        try:right.append(right[-1])
        except:right.append([0,0])
gone = 0
gon = 0
for i in range(n-1):
    gone += lis[i][1]
    ans = max(ans,gone + right[n-i-2][1] - lis[i][0] * 2 - right[n-i-2][0])
    gon += lis[-(i+1)][1]
    ans = max(ans,gon + left[n-i-2][1] - (c-lis[-(i+1)][0]) * 2 - left[n-i-2][0])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
lis = list(map(int,input().split()))

num = int((n-2)/2)
for i in range(n):
	li = lis
	a = li.pop(i)
	lislis = li
	print(sorted(lislis)[int((n-2)/2)])
	li.insert(i,a)

Fixed submission:
import math
n = int(input())
lis = list(map(int,input().split()))
li = sorted(lis)
ans2 = li[math.ceil((n-1)/2)]
cou2 = lis.count(ans2)
ans1 = li[math.floor((n-1)/2)]
cou1 = lis.count(ans1)
for i in range(n):
	if lis[i] >= ans2:
		print(ans1)
	else:
		print(ans2)
Buggy python submission (verdict: Runtime Error):
n = int(input().split())
lis = list(map(int,input().split()))
lis.sort(reverse = True)
cou = lis[1]
for i in range(2,n-1):
  if abs(cou - (lis[0]/2)) > abs(lis[i] - (lis[0]/2)):
    cou = lis[i]
print(lis[0],cou)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
a = max(lis)
lis.remove(a)
ans = 100000000000
for i in range(n-1):
	if abs(a/2 - lis[i]) < ans:
		ans = abs(a/2 - lis[i])
		an = lis[i]
print(a,an)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
d,x = map(int,input().split())
cou = x
for i in range(n):
  cou += math.ceil(d/int(input()))
print(int(cou))


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans = 0
for i in range(a,b):
    if str(i[0]) == str(i[4]) and str(i[1]) == str(i[3]):
        ans += 1
print(ans)

Fixed submission:
a,b = map(int,input().split())
ans = 0
for i in range(a,b+1):
    i = str(i)
    if i[0] == i[4] and i[1] == i[3]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
lis=list(map(int,input().split()))
if lis.count("Y"):
  print("Four")
else:
  print("Three")


Fixed submission:
n = int(input())
lis = list(input().split())
for i in range(n):
  if lis[i] == "Y":
    print("Four")
    break
  if i == n-1:
    print("Three")

Buggy python submission (verdict: Runtime Error):
n=int(input())
lis=list(map(int,input().split()))
if "Y" in lis:
  print("Four")
else:
  print("Three")

Fixed submission:
n = int(input())
lis = list(input().split())
for i in range(n):
  if lis[i] == "Y":
    print("Four")
    break
  if i == n-1:
    print("Three")
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
if a % b == 0:
    print("-1")
else:
    c = math.gcd(a,b)
    print(c * a)

Fixed submission:
import math
a,b = map(int,input().split())
if a % b == 0:
    print("-1")
else:
    k = 1
    while ( a * k ) % b == 0:
        k += 1
    print(a * k)

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
if a % b == 0:
    print("-1")
else:
    c =  math.gcd(a,b)
    print(c * a)

Fixed submission:
import math
a,b = map(int,input().split())
if a % b == 0:
    print("-1")
else:
    k = 1
    while ( a * k ) % b == 0:
        k += 1
    print(a * k)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def judge(x):
    print(x)
    sys.stdout.flush()
    ans = str(input())
    if ans == "Vacant":
        exit()
    else:
        return ans

n = int(input())

left = 0
mid = n//2
right = n-1

l = judge(left)
m = judge(mid)
r = judge(right)

while True:
    if ((mid-left)%2 == 0 and l == m) or ((mid-left)%2 == 1 and l != m):
        left = mid + 1
        right -= 1
        mid = (left + right)//2
    else:
        right = mid - 1
        left += 1
        mid = (left + right)//2

Fixed submission:
import sys

def judge(x):
    print(x)
    sys.stdout.flush()
    ans = str(input())
    if ans == "0":
        exit()
    else:
        return ans



n = int(input())
left = 0
mid = n//2
right = n-1

l = judge(left)
m = judge(mid)
r = judge(right)

while True:
    if ((mid-left)%2 == 0 and l == m) or ((mid-right)%2 == 1 and r == m) or ((left-mid)%2 == 1 and l != m) or ((mid-right)% 2 == 0 and r != m):
        left = mid
        mid = (left + right)//2
        l = m
        m = judge(mid)
    else:
        right = mid
        mid = (left + right)//2
        r = m
        m = judge(mid)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input()))
print a.count("1")

Fixed submission:
a = input()
if a == "000":
  print("0")
elif a == "001" or a == "010" or a == "100":
  print("1")
elif a == "111":
  print("3")
else:
  print("2")

Buggy python submission (verdict: Runtime Error):
a = int(input())
print a.count("1")

Fixed submission:
a = input()
if a == "000":
  print("0")
elif a == "001" or a == "010" or a == "100":
  print("1")
elif a == "111":
  print("3")
else:
  print("2")

Buggy python submission (verdict: Runtime Error):
a = int(input())
ans = 0
if a[0] == 1:
  ans = ans+1
else:
  ans = ans
if a[1] == 1:
  ans = ans+1
else:
  ans = ans
if a[2] == 1:
  ans = ans+1
else:
  ans = ans
print(ans)

Fixed submission:
a = input()
if a == "000":
  print("0")
elif a == "001" or a == "010" or a == "100":
  print("1")
elif a == "111":
  print("3")
else:
  print("2")
Buggy python submission (verdict: Runtime Error):
もうだめだ...

Fixed submission:
a=input()
A=a[0]
b=a[1]
c=a[2]
d=a[3]
if A==b and b==c:
  print("Yes")
elif b==c and c==d:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
r = int(input())
a = r[0]
b = r[1]
c = r[2]
d = r[3]
if a+b+c+d ==7:
  print(a+"+"+b+"+"+c+"+"+d"=7")
elif a+b+c-d ==7:
  print(a+"+"+b+"+"+c+"-"+d"=7")
elif a+b-c+d ==7:
  print(a+"+"+b+"-"+c+"+"+d"=7")
elif a+b-c-d ==7:
  print(a+"+"+b+"-"+c+"-"+d"=7")
elif a-b+c+d ==7:
  print(a+"-"+b+"+"+c+"+"+d"=7")
elif a-b+c-d ==7:
  print(a+"-"+b+"+"+c+"-"+d"=7")
elif a-b-c+d ==7:
  print(a+"-"+b+"-"+c+"+"+d"=7")
else:
  print(a+"-"+b+"-"+c+"-"+d"=7")

Fixed submission:
a=input()
A=a[0]
b=a[1]
c=a[2]
d=a[3]
if A==b and b==c:
  print("Yes")
elif b==c and c==d:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
r = int(input())
a = r[0]
b = r[1]
c = r[2]
d = r[3]
if a+b+c+d ==7:
  print(a+"+"+b+"+"+c+"+"+d"=7")
elif a+b+c-d ==7:
  print(a+"+"+b+"+"+c+"-"+d"=7")
elif a+b-c+d ==7:
  print(a+"+"+b+"-"+c+"+"+d"=7")
elif a+b-c-d ==7:
  print(a+"+"+b+"-"+c+"-"+d"=7")
elif a-b+c+d ==7:
  print(a+"-"+b+"+"+c+"+"+d"=7")
elif a-b+c-d ==7:
  print(a+"-"+b+"+"+c+"-"+d"=7")
elif a-b-c+d ==7:
  print(a+"-"+b+"-"+c+"+"+d"=7")
else:
  print(a+"-"+b+"-"+c+"-"+d"=7")

Fixed submission:
r = input()
a = int(r[0])
b = int(r[1])
c = int(r[2])
d = int(r[3])
import sys

if a+b+c+d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"+"+r[2]+"+"+r[3]+"=7")
elif a+b+c-d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"+"+r[2]+"-"+r[3]+"=7")
elif a+b-c+d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"-"+r[2]+"+"+r[3]+"=7")
elif a+b-c-d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"-"+r[2]+"-"+r[3]+"=7")
elif a-b+c+d ==7:
  sys.stdout.write(r[0]+"-"+r[1]+"+"+r[2]+"+"+r[3]+"=7")
elif a-b+c-d ==7:
  sys.stdout.write(r[0]+"-"+r[1]+"+"+r[2]+"-"+r[3]+"=7")
elif a-b-c+d ==7:
  sys.stdout.write(r[0]+"-"+r[1]+"-"+r[2]+"+"+r[3]+"=7")
else:
  sys.stdout.write(r[0]+"-"+r[1]+"-"+r[2]+"-"+r[3]+"=7")

Buggy python submission (verdict: Runtime Error):
r = int(input())
a = r[0]
b = r[1]
c = r[2]
d = r[3]
if a+b+c+d ==7:
  print(a+"+"+b+"+"+c+"+"+d"=7")
elif a+b+c-d ==7:
  print(a+"+"+b+"+"+c+"-"+d"=7")
elif a+b-c+d ==7:
  print(a+"+"+b+"-"+c+"+"+d"=7")
elif a+b-c-d ==7:
  print(a+"+"+b+"-"+c+"-"+d"=7")
elif a-b+c+d ==7:
  print(a+"-"+b+"+"+c+"+"+d"=7")
elif a-b+c-d ==7:
  print(a+"-"+b+"+"+c+"-"+d"=7")
elif a-b-c+d ==7:
  print(a+"-"+b+"-"+c+"+"+d"=7")
elif a-b-c-d ==7:
  print(a+"-"+b+"-"+c+"-"+d"=7")

Fixed submission:
r = input()
a = int(r[0])
b = int(r[1])
c = int(r[2])
d = int(r[3])
import sys

if a+b+c+d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"+"+r[2]+"+"+r[3]+"=7")
elif a+b+c-d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"+"+r[2]+"-"+r[3]+"=7")
elif a+b-c+d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"-"+r[2]+"+"+r[3]+"=7")
elif a+b-c-d ==7:
  sys.stdout.write(r[0]+"+"+r[1]+"-"+r[2]+"-"+r[3]+"=7")
elif a-b+c+d ==7:
  sys.stdout.write(r[0]+"-"+r[1]+"+"+r[2]+"+"+r[3]+"=7")
elif a-b+c-d ==7:
  sys.stdout.write(r[0]+"-"+r[1]+"+"+r[2]+"-"+r[3]+"=7")
elif a-b-c+d ==7:
  sys.stdout.write(r[0]+"-"+r[1]+"-"+r[2]+"+"+r[3]+"=7")
else:
  sys.stdout.write(r[0]+"-"+r[1]+"-"+r[2]+"-"+r[3]+"=7")
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(9)]
li = [list(map(int,input().split())) for i in range(h)]

for i in range(9):
    for j in range(9):
        for k in range(9):
            if lis[i][j] > lis[i][k] + lis[k][j]:
                lis[i][j] = lis[i][k] + lis[k][j]
ans = 0
for i in range(h):
    for j in range(w):
        if li[i][j] != -1:
            ans += lis[i][j]
print(ans)

Fixed submission:
h,w = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(10)]
li = [list(map(int,input().split())) for i in range(h)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            if lis[i][j] > lis[i][k] + lis[k][j]:
                lis[i][j] = lis[i][k] + lis[k][j]
ans = 0
for i in range(h):
    for num in li[i]:
        if num >= 0:
            ans += lis[num][1]
print(ans)

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
lis = [list(map(int,input().split())) for i in ragne(9)]
li = [list(map(int,input().split())) for i in range(h)]

for i in range(9):
    for j in range(9):
        for k in range(9):
            if lis[i][j] > lis[i][k] + lis[k][j]:
                lis[i][j] = lis[i][k] + lis[k][j]
ans = 0
for i in range(h):
    for j in range(w):
        if li[i][j] != -1:
            ans += lis[i][j]
print(ans)

Fixed submission:
h,w = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(10)]
li = [list(map(int,input().split())) for i in range(h)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            if lis[i][j] > lis[i][k] + lis[k][j]:
                lis[i][j] = lis[i][k] + lis[k][j]
ans = 0
for i in range(h):
    for num in li[i]:
        if num >= 0:
            ans += lis[num][1]
print(ans)

Buggy python submission (verdict: Runtime Error):
fantastic!!

Fixed submission:
h,w = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(10)]
li = [list(map(int,input().split())) for i in range(h)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            if lis[i][j] > lis[i][k] + lis[k][j]:
                lis[i][j] = lis[i][k] + lis[k][j]
ans = 0
for i in range(h):
    for num in li[i]:
        if num >= 0:
            ans += lis[num][1]
print(ans)

Buggy python submission (verdict: Runtime Error):
input!!!!
good!

Fixed submission:
h,w = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(10)]
li = [list(map(int,input().split())) for i in range(h)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            if lis[i][j] > lis[i][k] + lis[k][j]:
                lis[i][j] = lis[i][k] + lis[k][j]
ans = 0
for i in range(h):
    for num in li[i]:
        if num >= 0:
            ans += lis[num][1]
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
import math
b = math.sqrt(a)
c = math.floor(b)
d = c**2
print(d)

Fixed submission:
a = input()
b = input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a = int(input())
import math
b = math.sqrt(a)
c = math.floor(b)
d = c**2
print(d)

Fixed submission:
a = input()
b = input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s = list(str(input()))
t = list(str(input()))
ans = []
an = 0
if len(s) < len(t):
    print("UNRESTORABLE")
    exit()
for i in range(len(s)-len(t)+1):
    cou = s[i:i+len(t)]
    for k in range(len(t)):
        if s[i+k] != t[k] and s[i+k] != "?" and t[k] != "?":
            break
        if k == len(t)-1:
            ans.append(s[:i]+t+s[i+len(t):])
for h in range(len(ans)):
    for f in range(len(s)):
        if ans[h][f] == "?":ans[h][f] = "a"
    ans[h] = "".join(ans[h])
ans.sort()
print(ans[0])

Fixed submission:
s = list(str(input()))
t = list(str(input()))
ans = []
an = 0
if len(s) < len(t):
    print("UNRESTORABLE")
    exit()
for i in range(len(s)-len(t)+1):
    cou = s[i:i+len(t)]
    for k in range(len(t)):
        if s[i+k] != t[k] and s[i+k] != "?" and t[k] != "?":
            break
        if k == len(t)-1:
            ans.append(s[:i]+t+s[i+len(t):])
for h in range(len(ans)):
    for f in range(len(s)):
        if ans[h][f] == "?":ans[h][f] = "a"
    ans[h] = "".join(ans[h])
if ans == []:
    print("UNRESTORABLE")
    exit()
ans.sort()
print(ans[0])

Buggy python submission (verdict: Runtime Error):
s = list(str(input()))
n = list(str(input()))
ans = []
for i in range(len(s)-len(n)+1):
    nu = []
    for m in range(i):nu.append(s[m])
    for k in range(len(n)):
        if s[i + k] != n[k] and s[i+k]!="?" and n[k] != "?":
            break
        if k == len(n)-1:
            nu += n
            for h in range(len(s)-(len(n)+i)):
                nu.append(s[-(len(s)-(len(n)+i)+h)])
            while "?" in nu:nu[nu.index("?")] = "a"
            ans.append("".join(nu))
if ans == []:
    print("UNRESTORABLE")
    exit()
a = sorted(ans)
print(a[0])

Fixed submission:
s = list(str(input()))
t = list(str(input()))
ans = []
an = 0
if len(s) < len(t):
    print("UNRESTORABLE")
    exit()
for i in range(len(s)-len(t)+1):
    cou = s[i:i+len(t)]
    for k in range(len(t)):
        if s[i+k] != t[k] and s[i+k] != "?" and t[k] != "?":
            break
        if k == len(t)-1:
            ans.append(s[:i]+t+s[i+len(t):])
for h in range(len(ans)):
    for f in range(len(s)):
        if ans[h][f] == "?":ans[h][f] = "a"
    ans[h] = "".join(ans[h])
if ans == []:
    print("UNRESTORABLE")
    exit()
ans.sort()
print(ans[0])
Buggy python submission (verdict: Runtime Error):
a = input()
if "AC" in a:
 print("Yes")
elif:
 print("No")

Fixed submission:
a = input()
if "AC" in a:
 print("Yes")
else:
 print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
if len a[0]=A and len a[1]=C:
 print("Yes")
elif len a[1]=A and len a[2]=C:
 print("Yes")
elif len a[2]=A and len a[3]=C:
 print("Yes")
elif len a[3]=A and len a[4]=C:
 print("Yes")
elif:
 print("No")

Fixed submission:
a = input()
if "AC" in a:
 print("Yes")
else:
 print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
if len a[0]=A and len a[1]=C:
 print("Yes")
elif len a[1]=A and len a[2]=C:
 print("Yes")
elif len a[2]=A and len a[3]=C:
 print("Yes")
elif len a[3]=A and len a[4]=C:
 print("Yes")
elif:
 print("No")

Fixed submission:
a = input()
if "AC" in a:
 print("Yes")
else:
 print("No")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
lis = []
for i in range(n):
    a = list(input())
    for l in range(m):
        lis.append(a[l])
for t in range(15):
    if lis[t] == ".":
        cou = 0
        try:
            if lis[t-(m+1)] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t - m] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t -(m-1)] == "#":
              cou += 1
        except:
            cou = cou
        try:
            if lis[t -1] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t+1]== "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t +m] == "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t +(m-1)]== "#":
                cou += 1
        except:
            cou = cou
        try:
            if lis[t+(m+1)]== "#":
                cou += 1
        except:
            cou = cou
        lis[t] = cou

for p in range(n):
    li = []
    for h in range(m):
        li.append(lis[(p * m) + h])
    print("".join(map(str,li)))

Fixed submission:
h, w = map(int, input().split())
s = [input() for i in range(h)]

x = [-1, -1, 0, 1, 1, 1, 0, -1]
y = [0, 1, 1, 1, 0, -1, -1, -1]
for px in range(h):
    for py in range(w):
        if s[px][py] == '#': continue

        cou = 0
        for d in range(len(x)):
            tempx = px + x[d]
            tempy = py + y[d]

            if tempx < 0 or tempx >= h or tempy < 0 or tempy >= w:
                continue
            if s[tempx][tempy] == '#':
                cou += 1

        s[px] = s[px].replace('.', str(cou), 1)

for i in range(h):
    print(s[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = list(map(int,input().split()))
d = int(input())
li = list(map(int,input().split()))
for i in range(d):
    if li[i] in lis:
        lis.remove(li[i])
    else:
        print("NO")
        exit()
print("YES")

Fixed submission:
import collections
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
dcounter = collections.Counter(d)
tcounter = collections.Counter(t)
check = True
for i in tcounter.items():
	if dcounter[i[0]] < i[1]:
		check = False
if check:
	print('YES')
else:
	print('NO')
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = a[0]
c = a[1]
if b==9 or c==9:
print("Yes")
else:
print("No")

Fixed submission:
a = input()
b = int(a[0])
c = int(a[1])
if b==9 or c==9:
 print("Yes")
else:
 print("No")