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

Fixed submission:
n = int(input())
s1 = []
t1 = []
for i in range(n):
  d =list( map(str,input().split()))
  s1.append(d[0])
  t1.append(int(d[1]))
print(sum(t1[s1.index(input())+1:]))

Buggy submission (verdict: Runtime Error):
n = int(input())
s1 = []
t1 = []
for in range(n):
  d = map(in,input().split())
  s1.append(d[0])
  t1.append(d[1])
print(sum(t1[s1.index(input()):]))
Problem p02817 (python)

Fixed submission:
s,t=map(str,input().split())
print(t+s)

Buggy submission (verdict: Runtime Error):
s,t=map(int,input().split())
print(t+s)
Problem p02818 (python)

Fixed submission:
a,b,k=map(int,input().split())
if a>k:
  print(str(a-k) + " " + str(b))
else:
  if b-(k-a) < 0:
    print("0 0")
  else:
  	print(str(0) +" " +str(b-(k-a)))

Buggy submission (verdict: Runtime Error):
s,t=map(str,input().split())
print(t+s)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a>k:
  print(str(a-k) + " " + str(b))
else:
  if str(b-(a-k)) < 0:
    print("0 0")
  else:
  	print(str(0) +" " +str(b-(a-k)))
Problem p02841 (python)

Fixed submission:
m,d = map(int,input().split())
m2,d2 = map(int,input().split())
if(m!=m2):
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
m,d = map(int,input().split())
m2,d2 = ap(int,input().split())
if(m!=m2):
  print(1)
else:
  print(0)
Problem p02909 (python)

Fixed submission:
asdf={"Sunny":0,"Cloudy":1,"Rainy":2}
a=asdf[input()]
a+=1
if a>2:
  a=0
print([k for k, v in asdf.items() if v == a][0])

Buggy submission (verdict: Runtime Error):
asdf={"Sunny":0,"Cloudy":1,"Rainy":2}
a=asdf[input()]
a+=1
if a>2:
  a=0
print([k for k, v in d.items() if v == a][0])
Problem p02934 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
asdf =  0
for i in range(n):
  asdf += 1/a[i]
print(1/asdf)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())
asdf =  0
for i in range(n):
  asdf += 1/a[i]
print(1/asdf)
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a,b=map(nit,input().split())
print(max([a+b,a-b,a*b]))
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b = map(nt,input().split())
print(min(a*n,b))
Problem p03067 (python)

Fixed submission:
a,b,c = map(int,input().split())
if (a<c and c<b) or (c<a and b<c):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if (a<b&&b<c)||(b<a&&c<b):
  print("Yes")
else:
  print("No")
Problem p03085 (python)

Fixed submission:
b = input()
aa = {"A":"T", "T":"A", "G":"C", "C":"G"}
print(aa[b])

Buggy submission (verdict: Runtime Error):
agct = ["A":"T","G":"C","T":"A","C":"G"]
print(agct[input()])

Buggy submission (verdict: Runtime Error):
b = input()
aa = {"A":"T","T":"A","G":"C","C","G"}
print(aa[b])
Problem p03125 (python)

Fixed submission:
a,b=map(int,input().split())
print(a+b if b%a==0 else b-a)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input())
if isinstance(A / B, int):
  print(A + B)
else:
  print(B - A)
Problem p03136 (python)

Fixed submission:
n = input()
l = map(int,input().split())
ld = sorted(l, reverse=True)
m = ld[0]
h = sum(ld[1:])
if m < h:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
l = map(int,input().split())
if max(l) < sum(l-[max(l)]):
  print("Yes")
else:
  print("No")
Problem p03149 (python)

Fixed submission:
n = list(map(int,input().split()))
if sorted(n) == [1,4,7,9]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = list(map(int,input().split()))
if n.sorted() == [1,4,7,9]:
  print("YES")
else:
  print("NO")
Problem p03219 (python)

Fixed submission:
X,Y=map(int,input().split())
print(X+Y//2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
PM = []
for i in range(N):
  PM = input().split()
  P = str(PM[0]).zfill(6)
  M = str(PM[1]).zfill(6)
  print(P + M)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split)
print((a+b)/2)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
print((a+b)/2)
Problem p03238 (python)

Fixed submission:
if input() == "1":
  print("Hello World")
else:
  print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
a = input()
if a == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)
Problem p03260 (python)

Fixed submission:
a, b = map(int, input().split())
print("Yes" if a*b%2==1 else "No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a%2==0or b%2==0:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
a,b=m(int,input().split())
if a%2==0or b%2==0:
  print("NO")
else:
  print("YES")
Problem p03284 (python)

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

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
print(n%k
Problem p03323 (python)

Fixed submission:
a,b = map(int,input().split())
if a<9and b<9:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a<8 and b8:
  print("Yay!")
else:
  print(":)")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a<8 && b<8:
  print("Yay!")
else:
  print(":)")
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,B = map(int, input().split())
if (A * B) % 2 == 0:
  print("Even")
else:
  plint("Odd")

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
if (A * b) % 2 == 0:
  print("Even")
else:
  plint("Odd")
Problem p03469 (python)

Fixed submission:
a=input()
print(a[:3]+"8"+a[4:])

Buggy submission (verdict: Runtime Error):
print(input()[:3]+"8"+input()[5:])
Problem p03501 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,inpot().split())
print(min(n*a,b))
Problem p03605 (python)

Fixed submission:
n = input()
if n.find("9") >= 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = Input()
ht = false
for char in n:
       if char == ‘9’:
               ht = true
               break
 
if ht :
     print(“Yes”)
else : 
    print(“No”)

Buggy submission (verdict: Runtime Error):
n = Input()
ht = false
for char in 'n':
       if char == ‘9’:
               ht = true

if ht :
     print(“Yes”)
else : 
    print(“No”)
Problem p03759 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("YES" if ((b-a)==(c-b)) else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("YES" if ((b-a)==(c-d)) else "NO")
Problem p03962 (python)

Fixed submission:
s = list(set(map(int,input().split())))
print(len(s))

Buggy submission (verdict: Runtime Error):
s = list(set(map(int,input.split())))
print(len(s))

Buggy submission (verdict: Runtime Error):
s = set(map(int,input.split()))
print(len(s))
Problem p02576 (python)

Fixed submission:
import math
a, b, c = map(int, input().split())
n = math.ceil(a / b)
print(c * n)

Buggy submission (verdict: Runtime Error):
from collections import deque
import numpy as np

H, W = map(int, input().split())
sh, sw = map(int, input().split())
sh -= 1
sw -= 1
gh, gw = list(map(int, input().split()))
gh -= 1
gw -= 1
lst = []
for _ in range(H):
    lst.append(list(str(input())))
    
dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]
visited = [[0]*W for _ in range(H)]

def dfs(sh, sw):
    global visited
    global flg
    flg = 0
    stack = deque([[sh, sw]])
    visited[sh][sw] = 1
    c = 0
    while stack:
        sh, sw = stack.pop()
        if sh == gh and sw  == gw:
            flg = 1
            break
        for i in range(4):
            nx = sh + dx[i]
            ny = sw + dy[i]
            if 0 > nx or nx >= H or 0 > ny or ny >= W:
                continue
            else:
                if lst[nx][ny] == '#' or visited[nx][ny] == 1:
                    continue
                else:
                    visited[nx][ny] = 1
                    stack.append([nx, ny])

c = lst.count('.')
ans = 0

dfs(sh, sw)

if visited[gh][gw]:
    print(ans)
ov = -1
nv = - 2
while ov != nv:
    ov = sum(visited[gh][gw], []).count(1)
    for h in range(H):
        for w in range (W):
            if visited[h][w] == 0 and lst[h][w] != '#':
                arr = np.array(visited)[max(0, h-2):min(H, h+3),max(0, w-2):min(W, w+3)].tolist()
                if sum(arr, []).count(1) >= 1:
                    ans += 1
                    dfs(h,w)
                    nv = sum(visited[gh][gw], []).count(1)
                    if flg:
                        break
                
if visited[gh][gw]:
    print(ans)
else:
    print(-1)
Problem p02660 (python)

Fixed submission:
n = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
                
            arr.append(cnt)

    if temp != 1:
        arr.append(1)
        
    if arr==[] and n != 1:
        arr.append(1)

    return arr
  
lst = factorization(n)
ans = 0
if not lst:
  print(ans)
else:
  mx = max(lst)
  for _ in lst:
    for i in range(1, mx+1):
      if _ - i >= 0:
      	_ -= i
      	ans += 1
      else:
      	break
  print(ans)

Buggy submission (verdict: Runtime Error):
import math
a, b = map(str, input().split())
a = int(a)
b = float(b)

b = int(b * 100)
ans = a * b // 100

ans = int(math.floor(ans))
print(ans)
Problem p02677 (python)

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

md = m / 60 * 360

bx = math.sin(math.radians(md)) * b
by = math.cos(math.radians(md)) * b

hd = h / 12 * 360 + m / 60 * 30

ax = math.sin(math.radians(hd)) * a
ay = math.cos(math.radians(hd)) * a

ans = math.sqrt((ax - bx)**2 + (by - ay)**2)
print(ans)

Buggy submission (verdict: Runtime Error):
md = m / 60 * 360

bx = math.sin(math.radians(md)) * b
by = math.cos(math.radians(md)) * b

hd = h / 12 * 360 + m / 60 * 30

ax = math.sin(math.radians(hd)) * a
ay = math.cos(math.radians(hd)) * a

ans = math.sqrt((ax - bx)**2 + (by - ay)**2)
print(ans)
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
lst = list(map(int, (input().split())))
lst = [_ - 1 for _ in lst]

visited = [0] * n
i = 0
now = 0
while k > i:
    if visited[now] == 0:
        i += 1
        visited[now] = i
        now = lst[now] 
    else:
        break

lp = (i + 1) - visited[now]
st = i - lp
k_bk = k - st
k_bk = k_bk // lp
lft = k - (k_bk * lp + st)

if lft == 0:
    print(now+1)
else:
    for _ in range(lft):
        now = lst[now]
    print(now+1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
lst = list(map(int, (input().split())))
lst = [_ - 1 for _ in lst]

visited = [0] * n
flg = 1
i = 0
now = 0
while flg:
    if visited[now] == 0:
        i += 1
        visited[now] = i
        now = lst[now] 
    else:
        break
        
k_bk = k - visited[now]
k_bk =  k_bk // (i - visited[now])

lft = k - k_bk * (i - visited[now])

if lft ==0:
    print(now+1)
else:
    for _ in range(lft):
        now = lst[now]
    print(now+1)

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

visited = [0] * n
flg = 1
i = 0
now = 0
while flg:
    if visited[now] == 0:
        i += 1
        visited[now] = i
        now = lst[now] 
    else:
        break
        
k_bk = k - visited[now]
k_bk =  k_bk // i

lft = (k - visited[now]) - i* k_bk

if lft ==0:
    print(now+1)
else:
    for _ in range(lft):
        now = lst[now]
    print(now+1)

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

visited = [0] * n
flg = 1
i = 0
now = 0
while flg:
    if visited[now] == 0:
        i += 1
        visited[now] = i
        now = lst[now] 
    else:
        break
print(i, now, visited)

k_bk = k - visited[now]
k_bk =  k_bk // i

lft = (k - visited[now]) - i* k_bk

if lft ==0:
    print(now+1)
else:
    for _ in range(lft):
        now = lst[now]
    print(now+1)
Problem p02690 (python)

Fixed submission:
import itertools
x = int(input())

comb = list(itertools.product([_ for _ in range(-70, 140)],repeat=2))

for c in comb:
    a, b = c[0], c[1]
    if a**5 - b**5 == x:
        print(a, b)
        break

Buggy submission (verdict: Runtime Error):
import itertools

comb = list(itertools.product([_ for _ in range(-70, 140)],repeat=2))

for c in comb:
    a, b = c[0], c[1]
    if a**5 - b**5 == x:
        print(a, b)
        break
Problem p02730 (python)

Fixed submission:
s = str(input())
n = len(s)
s1 = s[0:n//2]
s2 = s[(n+2)//2:n]
if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = int(input())
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s[(n +2)//2:n]
if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print('Yes')
else:
    print('No')
Problem p02760 (python)

Fixed submission:
import numpy as np
lst = []
nums = []
for _ in range(3):
    l = []
    l = list(map(int, input().split()))
    lst.append(l)
    array = np.array(lst)
 
n = int(input())
for _ in range(n):
    nums.append(int(input()))

for h in range(3):
    for w in range(3):
        if array[h][w] in nums:
            array[h][w] = 0

i = 0
for h in range(3):
    if sum(array[:, h]) == 0:
        i = 1
for w in range(3):
    if sum(array[w]) == 0:
        i = 1
if sum(np.diag(np.fliplr(array))) == 0:
    i = 1
if sum(np.diag(array)) == 0:
    i = 1

if i == 1:
    print("Yes")
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
lst = []
nums = []
for _ in range(3):
    l = []
    l = list(map(int, input().split()))
    lst.append(l)
    lst = np.array(lst)
n = int(input())
for _ in range(n):
    nums.append(int(input()))

for h in range(3):
    for w in range(3):
        if array[h][w] in nums:
            array[h][w] = 0

i = 0
for h in range(3):
    if sum(array[:, h]) == 0:
        i = 1
for w in range(3):
    if sum(array[w]) == 0:
        i = 1
if sum(np.diag(np.fliplr(array))) == 0:
    i = 1
if sum(np.diag(array)) == 0:
    i = 1

if i == 1:
    print("Yes")
else:
    print('No')
Problem p02791 (python)

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

i = 0
mini = n +1
for _ in lst:
    if mini > _:
        mini = _
        i += 1
print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = deque(map(int, input().split()))

lst2 = []
i = 0
while lst:
    now = lst.pop()
    lst2.append(now)
    if now == min(lst2):
        i += 1
print(i)
Problem p02802 (python)

Fixed submission:
lst = []
n, m  = map(int, input().split())
for _ in range(m):
    i, h = input().split()
    lst.append([int(i), str(h)])

jdg_wa = [0] * n 
jdg_ac = [0] * n

penalty = 0
for _ in lst:
    idx = _[0] - 1
    if  jdg_ac[idx] != 1:
        if _[1] == 'WA':
            jdg_wa[idx] += 1
        elif _[1] == 'AC':
            jdg_ac[idx] = 1
            penalty +=  jdg_wa[idx]
print(sum(jdg_ac), penalty)

Buggy submission (verdict: Runtime Error):
lst = []
n, m  = map(int, input().split())
for _ in range(m):
    i, h = input().split()
    lst.append([int(i), str(h)])

jdg_wa = [0] * n 
jdg_ac = [0] * n

for _ in lst:
    idx = _[0] - 1
    if _[1] == 'WA' and jdg_ac[idx] != 1:
        jdg_wa[idx] += 1
    elif _[1] == 'AC':
        jdg_ac[idx] = 1
        penalty += jdg_wa[idx]
        
print(sum(jdg_ac),penalty)

Buggy submission (verdict: Runtime Error):
lst = []
n, m  = map(int, input().split())
for _ in range(m):
    i, h = input().split()
    lst.append([int(i), str(h)])

jdg_wa = [0] * n 
jdg_ac = [0] * n

for _ in lst:
    if _[1] == 'WA' and jdg_ac[_[0]] == 0:
        jdg_wa[_[0]] += 1
    if _[1] == 'AC' and jdg_ac[_[0]] == 0:
        jdg_ac[_[0]] = 1

print(sum(jdg_ac),sum(jdg_wa))
Problem p02837 (python)

Fixed submission:
n = int(input())
lst = []
for _ in range(n):
    a = int(input())
    lst.append([[int(i) for i in input().split()] for _ in range(a)])
m = 0
for i in range(2 ** n):
    a = True
    for j in range(n):
        if i >> j & 1:
            for x, y in lst[j]:
                if (i >> (x - 1) & 1) != y:
                    a = False
                    break
    if a:
        m = max(m, bin(i).count('1'))
print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [[-1 for _ in range(n)] for _ in range(n)]
for _ in range(n):
    c = int(input())
    for c1 in range(c):
        x, y = map(int, input().split())
        x -= 1
        lst[_][x] = y

ans = 0
for bit in range(n**2 - 1):
    flg = True
    for a in range(n):
        if (bit >> a) & 1:
            for x in range(n):
                if lst[a][x] != -1 and ((bit >> x) & 1) != lst[a][x]:
                    flg = False
                    break
if flg:
  ans = max(ans, bin(bit).count('1'))
print(ans)
Problem p02921 (python)

Fixed submission:
s = list(input())
t = list(input())
p = []

for i in range(0,3):
    p.append(s[i] == t[i])
    
print(p.count(True))

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

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
print(int(int(n * (n - 1)) / 2))
Problem p03164 (python)

Fixed submission:
n, w = map(int, input().split())
lst = [[0,0]]
vmax = 0
for _ in range(n):
    a, b = map(int, input().split())
    lst.append([a,b])
    vmax += b

dp = [[w+1] * (vmax+1) for _ in range(n+1)]
dp[0][0] = 0
ans = 0

for i in range(0, n):
    for sum_v in range(0, vmax+1):
        if sum_v  >= lst[i+1][1]:
            dp[i+1][sum_v] = min(dp[i][sum_v -  lst[i+1][1]] + lst[i+1][0], dp[i][sum_v])
        else:
            dp[i+1][sum_v] = dp[i][sum_v]
        if dp[i+1][sum_v] <= w:
            ans = max(ans, sum_v)

print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
n, w = map(int, input().split())
lst = [[0,0]]
for _ in range(n):
    a, b = map(int, input().split())
    lst.append([a,b])
dp = [[0] * (w+1) for _ in range(n+1)]

for i in range(0, n):
    for sum_w in range(0, w+1):
        if sum_w  >= lst[i+1][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w -  lst[i+1][0]] + lst[i+1][1], dp[i][sum_w])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]
        ans = max(ans, dp[i+1][sum_w])    
print(ans)
Problem p03166 (python)

Fixed submission:
import sys

sys.setrecursionlimit(20000)

n, m = map(int, input().split())
lst = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    lst[x].append(y)

def rec_dp(x):
    global dp
    if dp[x] != -1:
        return dp[x]
    else:
        ans = 0
        for y in lst[x]:
            ans = max(ans, rec_dp(y) + 1)
        dp[x] = ans
        return dp[x]
      
dp = [-1] * n
ans = 0
for _ in range(n):
    ans = max(ans, rec_dp(_))
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    lst[x].append(y)

def rec_dp(x):
    global dp
    if dp[x] != -1:
        return dp[x]
    else:
        ans = 0
        for y in lst[x]:
            ans = max(ans, rec_dp(y) + 1)
        dp[x] = ans
        return dp[x]
      
dp = [-1] * n
ans = 0
for _ in range(n):
    ans = max(ans, rec_dp(_))
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    lst[x].append(y)
print(lst)

def rec_dp(x):
    global dp
    if dp[x] != -1:
        return dp[x]
    else:
        ans = 0
        for y in lst[x]:
            ans = max(ans, rec_dp(y) + 1)
        dp[x] = ans
        return dp[x]
      
dp = [-1] * n
ans = 0
for _ in range(n):
    ans = max(ans, rec_dp(_))
print(ans)
Problem p03565 (python)

Fixed submission:
s = str(input())
t = str(input())
lst = []
i= 0
for ss in range(len(s)-len(t)+1):
  flg = 1
  i= 0
  for tt in range(len(t)):
    now = ss + tt
    if s[now] == t[tt] or s[now] == '?':
      pass
    else:
      flg = 0
  if flg:
    ns = list(s)
    ns[ss:now+1] = list(t)
    lst.append(("").join(ns))
if lst:
  lst = [_.replace('?','a') for _ in lst]
  lst.sort()
  print(lst[0])

else:
  print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s = str(input())
t = str(input())
lst = []
i= 0
for ss in range(len(s)-len(t)+1):
  flg = 1
  i= 0
  for tt in range(len(t)):
    now = ss + tt
    if s[now] == t[tt] or s[now] == '?':
      pass
    else:
      flg = 0
  if flg:
    ns = list(s)
    ns[ss:now+1] = list(t)
    lst.append(("").join(ns))
if lst:
  lst = [_.replace('?','a') for _ in lst]
  sort(lst)
  print(lst[0])

else:
  print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s = str(input())
t = str(input())
lst = []
i= 0
for ss in range(len(s)-len(t)+1):
  flg = 1
  i= 0
  for tt in range(len(t)):
    now = ss + tt
    print(now)
    if s[now] == t[tt] or s[now] == '?':
      pass
    else:
      flg = 0
  if flg:
    print(ss, ss+tt+1)
    print(s[ss:ss+tt+1])
    ns = list(s)
    ns[ss:now+1] = list(t)
    lst.append(("").join(ns))
if lst:
  lst = [_.replace('?','a') for _ in lst]
  sort(lst)
  print(lst[0])

else:
  print('UNRESTORABLE')
print(lst)

Buggy submission (verdict: Runtime Error):
import sys
s = str(input())
t = str(input())
lst = []
i= 0
if len(s) < len(t):
  print('UNRESTORABLE')
  sys.exit()
  
else:
  for _ in range(len(s)):
    if s[_] == t[i] or s[_] == '?':
        i += 1       
    else:   
        i = 0
    if i == len(t):
      pt = _ - i + 1    
      s = s.replace(s[pt:_ + 1],t)
      lst.append(s)

if lst:
  lst = [_.replace('?','a') for _ in lst]
  sorted(lst)
  print(lst[0])

else:
  print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s = str(input())
t = str(input())
lst = []
i= 0
flg = 1
for _ in range(len(s)):
    if s[_] == t[i] or s[_] == '?':
        i += 1       
    else:   
        i = 0
    if i == len(t):
      pt = _ - i + 1    
      s = s.replace(s[pt:_ + 1],t)
      lst.append(s)

if lst:
  lst = [_.replace('?','a') for _ in lst]
  sorted(lst)
  print(lst[0])

else:
  print('UNRESTORABLE')
Problem p02910 (python)

Fixed submission:
s = list(input())
e = [s[i] for i in range(len(s)) if i%2==0]
o = [s[i] for i in range(len(s)) if i%2!=0]
if 'L' in e or 'R' in o:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s = list(input())
e = [s[i] for i in range(len(s)) if i%2==0]
o = [s[i] for i in range(len(s)) if i%2!=0]
if e in 'L' or o in 'R':
  print('No')
else:
  print('Yes')
Problem p02958 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
P = list(range(1,N+1))
if p == P:
    print('YES')
    exit()

tmp = [i for i in range(N) if P[i] - p[i] != 0]
#print(tmp)

if len(tmp) != 2:
    print('NO')
else:
    p[tmp[0]], p[tmp[1]] = p[tmp[1]], p[tmp[0]]
    if p == P:
        print('YES')
    else:
        print('NO')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
P = list(range(1,N+1))
tmp = [P[i]-p[i] for i in range(N)]
tmp = set(tmp)
tmp.discard(0)
if not tmp:
    print('YES')
elif len(tmp) == 2 and abs(tmp[0]) == abs(tmp[1]):
    print('YES')
else:
    print('NO')