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

Fixed submission:
n = int(input())
lis = []
for i in range(n):
  a = list(map(int,input().split()))
  if a[2] != 0:lis.append(a)
if len(lis) == 1:
  print(lis[0][0],lis[0][1],lis[0][2])
  exit()
for x in range(101):
  for y in range(101):
    co = abs(x -lis[0][0])+abs(y -lis[0][1])+lis[0][2]
    for j in range(1,len(lis)):
      if co != abs(x -lis[j][0])+abs(y -lis[j][1])+lis[j][2]:
        break
      if j == len(lis)-1:
        print(x,y,co)
        exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = []
for i in range(n):
  a = list(map(int,input().split()))
  if a[2] != 0:lis.append(a)
if len(lis) == 1:
  print(lis[0][0],lis[0][1],lis[0][2])
  exit()
for x in range(101):
  for y in range(101):
    co = abs(x -lis[0][0])+abs(y -lis[0][1])+lis[0][2]
    for j in range(1,n):
      if lis[j][2] != 0 and co != abs(x -lis[j][0])+abs(y -lis[j][1])+lis[j][2]:
        break
      if j == n-1:
        print(x,y,co)
        exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = [list(map(int,input().split())) for i in range(n)]
ans = []
for x in range(101):
  for y in range(101):
    co = abs(x -lis[0][0])+abs(y -lis[0][1])+lis[0][2]
    for j in range(n):
      if co != abs(x -lis[j][0])+abs(y -lis[j][1])+lis[j][2]:
        break
      if j == n-1:
        ans.append([x,y,co])
print(ans[0][0],ans[0][1],ans[0][2])
Problem p03254 (python)

Fixed submission:
n,x = map(int,input().split())
cou = 0
lis = list(map(int,input().split()))
lis.sort()
for i in range(n):
  if i != n-1:
    if x >= lis[i]:
      x -= lis[i]
      cou += 1
  else:
    if x == lis[i]:
      cou += 1
print(cou)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
cou = 0
lis = list(map(int,input().split()))
for i in range(n):
  if i != n-1:
    if x >= lis[i]:
      x -= lis[i]:
        cou += 1
  else:
    if x == lis[i]:
      cou += 1
print(cou)
Problem p03256 (python)

Fixed submission:
import collections

n,m = map(int,input().split())
s = list(str(input()))
key = collections.deque()
lis = [[] for i in range(n)]
li = [{"A":0,"B":0} for i in range(n)]

for i in range(m):
  a,b = map(int,input().split())
  lis[a-1].append(b-1)
  lis[b-1].append(a-1)
  li[a-1][s[b-1]] += 1
  li[b-1][s[a-1]] += 1
  
ans = [0 for i in range(n)]

for i in range(n):
  if li[i]["A"] == 0 or li[i]["B"] == 0:
    key.append(i)
    ans[i] = 1
    
while len(key) > 0:
  num = key.popleft()
  for nu in lis[num]:
    li[nu][s[num]] -= 1
    if li[nu]["A"] == 0 or li[nu]["B"] == 0:
      if ans[nu] == 0:
        key.append(nu)
        ans[nu] = 1

if sum(ans) == n:print("No")
else:print("Yes")

Buggy submission (verdict: Runtime Error):
import collections

n,m = map(int,input().split())
s = list(str(input()))
key = collection.deque()
lis = [[] for i in range(n)]
li = [{"A":0,"B":0} for i in range(n)]

for i in range(m):
  a,b = map(int,input().split())
  lis[a-1].append(b-1)
  lis[b-1].append(a-1)
  li[a-1][s[b-1]] += 1
  li[b-1][s[a-1]] += 1
  
ans = [0 for i in range(n)]

for i in range(n):
  if li[i]["A"] == 0 or li[i]["B"] == 0:
    key.append(i)
    ans[i] = 1
    
while len(key) > 0:
  num = key.popleft()
  for nu in lis[num]:
    li[nu][s[num]] -= 1
    if li[nu]["A"] == 0 or li[nu]["B"] == 0:
      if ans[nu] == 0:
        key.append(nu)
        ans[nu] = 1

if sum(ans) == n:print("No")
else:print("Yes")

Buggy submission (verdict: Runtime Error):
import collections

n,m = map(int,input().split())
s = list(str(input()))
key = collection.deque()
lis = [[] for i in range(n)]
li = [{"A":0,"B":0} for i in range(n)]

for i in range(m):
  a,b = map(int,input().split())
  lis[a-1].append(b-1)
  lis[b-1].append(a-1)
  li[a-1][s[b-1]] += 1
  li[b-1][s[a-1]] += 1
  
ans = [0 for i in range(n)]

for i in range(n):
  if li[i]["A"] == 0 or li[i]["B"] == 0:
    key.append(i)
    ans[i] = 1
    
while len(key) > 0:
  num = key.popleft()
  for nu in lis[num]:
    li[j][s[num]] -= 1
    if li[j]["A"] == 0 or li[j]["B"] == 0:
      if ans[j] == 0:
        key.append(j)
        ans[j] = 1

if sum(ans) == n:print("No")
else:print("Yes")
Problem p03263 (python)

Fixed submission:
h,w = map(int,input().split())
lis = []
for i in range(h):
  lis.append(list(map(int,input().split())))
cou = 0
ans = []
for i in range(h):
  for j in range(w):
    if lis[i][j] % 2 == 1:
      if j != w-1:
        ans.append([str(i+1),str(j+1),str(i+1),str(j+2)])
        lis[i][j]-=1
        lis[i][j+1]+= 1
        cou += 1
      else:
        if i != h-1:
          ans.append([str(i+1),str(j+1),str(i+2),str(j+1)])
          lis[i][j]-=1
          lis[i+1][j]+= 1
          cou += 1
print(cou)
for i in range(len(ans)):
  print(" ".join(ans[i]))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
lis = []
for i in range(h):
  lis.append(list(map(int,input().split())))
cou = 0
ans = []
for i in range(h):
  for j in range(w):
    if lis[i][j] % 2 == 1:
      if j != w-1:
        ans.append([str(i+1),str(j+1),str(i+1),str(j+2)])
        lis[i][j]-=1
        lis[i][j+1]+= 1
        cou += 1
      else:
        if i != h-1:
          ans.append([i+1,j+1,i+2,j+1])
          lis[i][j]-=1
          lis[i+1][j]+= 1
          cou += 1
print(cou)
for i in range(len(ans)):
  print(" ".join(ans[i]))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
lis = []
for i in range(h):
  lis.append(list(map(int,input().split())))
cou = 0
ans = []
for i in range(h):
  for j in range(w):
    if lis[i][j] % 2 == 1:
      if j != w-1:
        ans.append([str(i+1),str(j+1),str(i+1),str(j+2)])
        lis[i][j]-=1
        lis[i][j+1]+= 1
        cou += 1
      else:
        ans.append([i+1,j+1,i+2,j+1])
        lis[i][j]-=1
        lis[i+1][j]+= 1
        cou += 1
print(cou)
for i in range(len(ans)):
  print(" ".join(ans[i]))
Problem p03282 (python)

Fixed submission:
n = list(str(input()))
k = int(input())
for i in range(min(k,len(n))):
  if n[i] != "1":
    print(n[i])
    exit()
print("1")

Buggy submission (verdict: Runtime Error):
n = list(str(input()))
k = int(input())
for i in range(n):
  if n[i] != "1":
    print(n[i])
    exit()
print("1")
Problem p03293 (python)

Fixed submission:
s = str(input())
t = str(input())
for i in range(len(s)):
  if s == t:
    print("Yes")
    exit()
  nu = t[-1]
  t = nu+t[:-1]
print("No")

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

string s,t;
int i;

int main(){
    cin >> s;
    cin >> t;

    s = s + s;
    if(s.find(t) != s.npos){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

string s,t;
int si;
int i;

int main(){
    cin >> s >> t;

    s = s + s;
    if(s.find(t) != s.npos){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}
Problem p03294 (python)

Fixed submission:
import fractions
n = int(input())
lis = list(map(int,input().split()))
cou = 1
for i in range(n):
  cou = (cou * lis[i])//fractions.gcd(cou, lis[i])
cou -= 1
print(sum([cou % lis[i] for i in range(n)]))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
lis = list(map(int,input().split()))
now = 1
for num in lis:
    now = (now * num)//math.gcd(now,num)
now -= 1
ans = sum([now%lis[i] for i in range(n)])
print(ans)
Problem p03311 (python)

Fixed submission:
import math
n = int(input())
lis = list(map(int,input().split()))
if n == 1:
  print("0")
  exit()
for i in range(n):lis[-(i+1)] += i
lis.sort()
cou = 0
co = 0
num = lis[math.ceil(n/2)]
nu = lis[math.floor(n/2)]
for i in range(n):
  cou += abs(lis[i]-num)
  co += abs(lis[i]-nu)
print(min(cou,co))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
lis = list(map(int,input().split()))
for i in range(n):lis[-(i+1)] += i
lis.sort()
cou = 0
co = 0
num = lis[math.ceil(n/2)]
nu = lis[math.floor(n/2)]
for i in range(n):
  cou += abs(lis[i]-num)
  co += abs(lis[i]-nu)
print(min(cou,co))
Problem p03347 (python)

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 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)

Buggy 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)

Buggy 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)

Buggy 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)
Problem p03355 (python)

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 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])

Buggy 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])
Problem p03356 (python)

Fixed submission:
import numpy as np
n,m = map(int,input().split())
lis = list(map(int,input().split()))
path = [[] for i in range(n)]

for i in range(m):
    x,y = map(int,input().split())
    x -= 1;y -= 1
    path[x].append(y)
    path[y].append(x)

gone = np.array([-1] * n)
numberindex = set()
realnumber = set()
ans = 0

for i in range(n):
    if gone[i] == -1:
        now = [i]
        while now:
            a = now.pop(0)
            gone[a] = 1
            numberindex.add(a)
            realnumber.add(lis[a]-1)
            for go in path[a]:
                if gone[go] == -1:
                    now.append(go)
                    gone[go] = 1
        ans += len(realnumber & numberindex)
        realnumber,numberindex = set(),set()
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m = map(int,input().split())
lis = list(map(int,input().split()))
path = [[] for i in range(n)]

for i in range(m):
    x,y = map(int,input().split())
    x -= 1;y -= 1
    path[x].append(y)
    path[y].append(x)

gone = np.array([-1] * n)
numberindex = set()
realnumber = set()
ans = 0

for i in range(n):
    if gone[i] == -1:
        now = [i]
        while now:
            a = now.pop(0)
            gone[a] = 1
            numberindex.add(a)
            realnumber.add(lis[a]-1)
            for go in path[a]:
                if gone[go] == -1:
                    now.append(go)
                    gone[go] = 1
        ans += len(realnumber & numberindex)
        realnumber,numberindex = set(),set()
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m = map(int,input().split())
lis = list(map(int,input().split()))
path = [[] for i in range(n)]

for i in range(m):
    x,y = map(int,input().split())
    x -= 1;y -= 1
    path[x].append(y)
    path[y].append(x)

gone = np.array([-1] * n)
numberindex = set()
ans = 0

for i in range(n):
    if gone[i] == -1:
        now = [i]
        realnumber = np.array([0] * n)
        numberindex.add(i)
        while now:
            a = now.pop(0)
            gone[a] = 1
            numberindex.add(a)
            realnumber[lis[a]-1] = 1
            for go in path[a]:
                if gone[go] == -1:
                    now.append(go)
                    gone[go] = 1
        for num in numberindex:
            if realnumber[num] == 1:
                ans += 1
        numberindex = set()
print(ans)
Problem p03359 (python)

Fixed submission:
a,b = map(int,input().split())
if a > b:
    print(a-1)
else:
    print(a)

Buggy 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))
Problem p03369 (python)

Fixed submission:
s = str(input())
cou = 700
for i in range(3):
    if s[i] == "o":
        cou += 100
print(cou)

Buggy submission (verdict: Runtime Error):
s = str(input())
cou = 700
for i in range(3):
Problem p03380 (python)

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 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)
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c,d))

Buggy 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))
Problem p03416 (python)

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 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)
Problem p03424 (python)

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 submission (verdict: Runtime Error):
n=int(input())
lis=list(map(int,input().split()))
if lis.count("Y"):
  print("Four")
else:
  print("Three")

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

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 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)

Buggy 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)
Problem p03493 (python)

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 submission (verdict: Runtime Error):
a = list(map(int,input()))
print a.count("1")

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

Buggy 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)
Problem p03543 (python)

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 submission (verdict: Runtime Error):
もうだめだ...

Buggy 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")
Problem p03545 (python)

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 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")

Buggy 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")
Problem p03546 (python)

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 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)

Buggy 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)

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

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

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 submission (verdict: Runtime Error):
a = int(input())
import math
b = math.sqrt(a)
c = math.floor(b)
d = c**2
print(d)

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

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 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])

Buggy 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])
Problem p03567 (python)

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

Buggy submission (verdict: Runtime Error):
a = input()
if "AC" in a:
 print("Yes")
elif:
 print("No")

Buggy 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")

Buggy 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")