Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
R,G,B,N=map(int, input().split())

x = 0
for i in range(N//R+1):
    k = N - (i*R)
    for j in range(k//G+1):
        l = k - (j*G)
        if l % B == 0:
            x += 1
        else:
            x += 0

print(x)

Fixed submission:
N,K=map(int, input().split())
x = N - K +1
print(x)
Buggy python submission (verdict: Runtime Error):
if A >= B+2:
    n = 2*A - 1
elif A <= B-2:
    n = 2*B - 1
else:
    n = A+B
    
print(n)

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

if A >= B+2:
    n = 2*A - 1
elif A <= B-2:
    n = 2*B - 1
else:
    n = A+B
    
print(n)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A,B = map(int,input().split())
P=list(map(int,input().split()))
a = sum(x<=A for x in P)
b = sum(x<=B and x>A for x in P) 
c = sum(x>B for x in P)

print(min(a,b,c))

Fixed submission:
N = int(input())
H = int(input())
W = int(input())
print((N-H+1)*(N-W+1))
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B and B == C and C == A:
    print(Yes)
print(No)

Fixed submission:
A, B, C = map(int, input().split())
if A == B and B == C and C == A:
    print("Yes")
elif A!=B or B!=C or C!=A:
    print("No")

Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B and B == C:
    print(Yes)
elif A!=B or B!=C or C!=A:
    print(No)

Fixed submission:
A, B, C = map(int, input().split())
if A == B and B == C and C == A:
    print("Yes")
elif A!=B or B!=C or C!=A:
    print("No")

Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B and B == C:
    print(Yes)
else:
    print(No)

Fixed submission:
A, B, C = map(int, input().split())
if A == B and B == C and C == A:
    print("Yes")
elif A!=B or B!=C or C!=A:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m.sort(reverse=True)
m = d[K-1]
print(m)

Fixed submission:
A,B,K=map(int,input().split())
L=[]
for i in range(1,101):
  if A%(i)==0 and B%(i)==0 :
    L.append(i)
L.sort(reverse=True)
print(L[K-1])

Buggy python submission (verdict: Runtime Error):
A B K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m.sort(reverse=True)
m = d[K-1]
print(m)

Fixed submission:
A,B,K=map(int,input().split())
L=[]
for i in range(1,101):
  if A%(i)==0 and B%(i)==0 :
    L.append(i)
L.sort(reverse=True)
print(L[K-1])

Buggy python submission (verdict: Runtime Error):
A B K = map(int,input().split())
d = []
m = 0
for i in range(1,101):
    if A % i == 0 and B % i == 0:
        d.append(i)
m = d[K-1]
print(m)

Fixed submission:
A,B,K=map(int,input().split())
L=[]
for i in range(1,101):
  if A%(i)==0 and B%(i)==0 :
    L.append(i)
L.sort(reverse=True)
print(L[K-1])

Buggy python submission (verdict: Runtime Error):
A B K = int(input().split())
d = []
m = 0
for i in range(max(A, B)):
    if A % i == 0 and B % i == 0:
        d[i] = d[i].append(i)
m = d[-K]
print(m)

Fixed submission:
A,B,K=map(int,input().split())
L=[]
for i in range(1,101):
  if A%(i)==0 and B%(i)==0 :
    L.append(i)
L.sort(reverse=True)
print(L[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = []
cnt = 0
for i in range(N):
  A = int(input())
  list.append(A)
  if list.count(A) > 1:
    cnt -= 1
  else:
    cnt += 1
print(cnt)

Fixed submission:
N = int(input())
set = set()
for i in range(N):
  A = int(input())
  if A in set:
    set.remove(A)
  else:
    set.add(A)
print(len(set))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list = []
cnt = 0
for i in range(N):
  A = int(input())
  list.append(A)
  if list.count(A) > 1:
    cnt -= 1
  elif list.count(A) == 1:
    cnt += 1
print(cnt)

Fixed submission:
N = int(input())
set = set()
for i in range(N):
  A = int(input())
  if A in set:
    set.remove(A)
  else:
    set.add(A)
print(len(set))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
  if(b == 0):
    return a
  
  return gcd(b, a % b)

def lcm(a, b):
  return a * b / gcd(a, b)

N = int(input())
T = [int(input()) for i in range(N)]
ans = max(T)

for i in range(N):
  if ans % T[i] != 0:
    ans = lcm(ans, T[i])

print(int(ans))


Fixed submission:
def gcd(a, b):
  v0 = a
  v1 = b
  v2 = a % b
  while v2 > 0:
    v0 = v1
    v1 = v2
    v2 = v0 %v1
  return v1

def lcm(a, b):
  return a * b // gcd(a, b)

N = int(input())
tmp = 1
for i in range(N):
  T = int(input())
  ans = lcm(T, tmp)
  tmp = ans
print(int(ans))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 20:49:53 2017

@author: thvinmei
"""

import numpy as np

if __name__ == '__main__':
    answer = False
    N,M,K=map(int,input().split())

    tile = np.zeros((N,M))
    
    if( K > N*M):
        print("No")
        
    for j in range(M):
        for i in range(N):
            tile[i,j] = 1

        if np.sum(tile)==K:
            answer = True
    
        if (np.sum(tile)>K):
            for i in range(N):
                tile[i,j] = 0
            break
    
    for i in range(N):
        for j in range(M):
            if tile[i,j] == 0:
                tile[i,j] = 1
            else:
                tile[i,j] = 0
        
        if np.sum(tile)==K:
            answer = True
            break

    if answer == True:
        print("Yes")
    else:
        print("No")

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 20:49:53 2017

@author: thvinmei
"""

if __name__ == '__main__':
    S=input()
    
    if (S[0:4]=="YAKI"):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
# import math
import fractions
import numpy as np
from itertools import accumulate, chain, islice, starmap
N = int(input())
numbers = list(map(int, input().split()))
# numbers = [2, 4, 8, 8]
# N = len(numbers)


def calculate_maximum_subgcd_with_np_ufunc(numbers):
    gcd = np.frompyfunc(fractions.gcd, 2, 1)
    cumgcds = gcd.accumulate(numbers, dtype=np.object).astype(np.int)
    sub_cumgcds = np.roll(cumgcds, 1)
    sub_cumgcds[0] = 0
    reverse_cumgcds = gcd.accumulate(
        numbers[::-1], dtype=np.object).astype(np.int)
    sub_reverse_cumgcds = np.roll(reverse_cumgcds, 1)
    sub_reverse_cumgcds[0] = 0
    return np.max(gcd(sub_cumgcds, sub_reverse_cumgcds[::-1]))


def calculate_maximum_subgcd_with_func(numbers):
    operation = fractions.gcd
    cumgcds = accumulate(numbers, operation)
    sub_cumgcds = islice(chain([0], cumgcds), len(numbers))
    reverse_cumgcds = accumulate(numbers[::-1], operation)
    sub_reverse_cumgcds = islice(chain([0], reverse_cumgcds), len(numbers))
    sub_gcds = starmap(operation, zip(sub_cumgcds, list(sub_reverse_cumgcds)[::-1]))
    return max(sub_gcds)


calculate_maximum_subgcd = calculate_maximum_subgcd_with_np_ufunc
# calculate_maximum_subgcd = calculate_maximum_subgcd_with_func

print(calculate_maximum_subgcd(numbers))


Fixed submission:
A, B, T = map(int, input().split())
# A, B, T = 20, 20, 19


def count_total_biscuit(A, B, T):
    return (T // A) * B


print(count_total_biscuit(A, B, T))
Buggy python submission (verdict: Runtime Error):
N = map(int, input().split())
values = [int(input()) for _ in range(N)]
costs = [int(input()) for _ in range(N)]
# N = 3
# values = [10, 2, 5]
# costs = [6, 3, 4]
# N = 4
# values = [13, 21, 6, 19]
# costs = [11, 30, 6, 15]
# N = 1
# values = [1,]
# costs = [50,]


def calculate_maximum_gain(values, costs):
    gain = 0
    for value, cost in zip(values, costs):
        if value - cost > 0:
            gain = gain + value - cost
    
    return gain


print(calculate_maximum_gain(values, costs))


Fixed submission:
N = map(int, input().split())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
# N = 3
# values = [10, 2, 5]
# costs = [6, 3, 4]
# N = 4
# values = [13, 21, 6, 19]
# costs = [11, 30, 6, 15]
# N = 1
# values = [1,]
# costs = [50,]


def calculate_maximum_gain(values, costs):
    gain = 0
    for value, cost in zip(values, costs):
        if value - cost > 0:
            gain = gain + value - cost
    
    return gain


print(calculate_maximum_gain(values, costs))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
stones = input()
# stones = "...."


def count_painted_stones(stones, length):
    repainted_times = []
    for i in range(length+1):
        left_stones = stones[:i]
        left_black_stones = left_stones.count("#")
        right_stones = stones[i:]
        right_white_stones = right_stones.count(".")
        repainted_stones = left_black_stones + right_white_stones
        repainted_times.append(repainted_stones)

    return min(repainted_times)


print(count_painted_stones(stones, len(stones)))


Fixed submission:
import numpy as np
N = int(input())
stones = np.array([0 if stone == "." else 1 for stone in input()])
# stones = np.array([0 if stone == "." else 1 for stone in ".#....."])


def count_painted_stones_by_cumsum(stones, length):
    left_black_stones = np.roll(np.cumsum(stones), 1)
    left_black_stones[0] = 0
    right_white_stones = np.roll(np.cumsum(1 - stones[::-1]), 1)
    right_white_stones[0] = 0

    return np.min(left_black_stones + right_white_stones[::-1])


print(count_painted_stones_by_cumsum(stones, len(stones)))
Buggy python submission (verdict: Runtime Error):
# tiles = list(map(int, input()))
# inputs = "10010010"
# tiles = list(map(int, inputs))


def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        if tile == color:
            counts = counts + 1
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))


Fixed submission:
tiles = list(map(int, input()))
# inputs = "10010010"
# tiles = list(map(int, inputs))


def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        if tile == color:
            counts = counts + 1
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))

Buggy python submission (verdict: Runtime Error):
tiles = map(int, input())
# inputs = "10010010"
# tiles = list(map(int, inputs))


def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        counts = counts + 1 if tile != color else 0
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))


Fixed submission:
tiles = list(map(int, input()))
# inputs = "10010010"
# tiles = list(map(int, inputs))


def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        if tile == color:
            counts = counts + 1
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))

Buggy python submission (verdict: Runtime Error):
tiles = map(int, input().split())
# inputs = "10010010"
# tiles = list(map(int, inputs))


def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        counts = counts + 1 if tile != color else 0
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))


Fixed submission:
tiles = list(map(int, input()))
# inputs = "10010010"
# tiles = list(map(int, inputs))


def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        if tile == color:
            counts = counts + 1
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(K+1):
            if i + j >= length:
                break
            substrings.append(s[i:i + j])
    unique_substrings = list(set(substrings))
    unique_substrings.sort()
    return substrings[K]


print(substring(s, K))


Fixed submission:
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(1, K+1):
            if i + j > length:
                break
            substrings.append(s[i:i + j])
    unique_substrings = list(set(substrings))
    unique_substrings.sort()
    return unique_substrings[K - 1]


print(substring(s, K))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(K+1):
            if i + j >= length:
                break
            substrings.append(s[i:i+j])
    return substrings[K]


print(substring(s, K))


Fixed submission:
# -*- coding: utf-8 -*-
s = input()
K = int(input())


def substring(s, K):
    substrings = []
    length = len(s)
    for i in range(length):
        for j in range(1, K+1):
            if i + j > length:
                break
            substrings.append(s[i:i + j])
    unique_substrings = list(set(substrings))
    unique_substrings.sort()
    return unique_substrings[K - 1]


print(substring(s, K))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(input())
numbers = map(int, input().split())


def countSubZeroRange(numbers):
    partialSum = 0
    histogram = {}
    for number in numbers:
        partialSum += number
        histogram[partialSum] += 1
    
    zeroSumCounts = 0
    for column in histogram:
        zeroSumCounts += column - 1
    
    return zeroSumCounts


print(countSubZeroRange(numbers))


Fixed submission:
# -*- coding: utf-8 -*-
from scipy.misc import comb
import collections

N = int(input())
numbers = map(int, input().split())


def countSubZeroRange(numbers):
    Sums = [0]
    for number in numbers:
        Sums.append(Sums[-1] + number)
    zeroSumCounts = 0
    for key, value in collections.Counter(Sums).items():
        zeroSumCounts += comb(value, 2, 1)
    return zeroSumCounts


print(countSubZeroRange(numbers))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N = int(input())
numbers = map(int, input().split())


def countSubZeroRange(numbers):
    counter = 0
    for i in range(1, N + 1):  # i : 長さ
        for j in range(N - i + 1):
            if sum(numbers[j:j + i]) == 0:
                counter += 1
    return counter


print(countSubZeroRange(list(numbers)))


Fixed submission:
# -*- coding: utf-8 -*-
from scipy.misc import comb
import collections

N = int(input())
numbers = map(int, input().split())


def countSubZeroRange(numbers):
    Sums = [0]
    for number in numbers:
        Sums.append(Sums[-1] + number)
    zeroSumCounts = 0
    for key, value in collections.Counter(Sums).items():
        zeroSumCounts += comb(value, 2, 1)
    return zeroSumCounts


print(countSubZeroRange(numbers))
Buggy python submission (verdict: Runtime Error):
#1行に1つと
#1行に複数行の読み込み方

n = int(input())
a = list(map(int, input().split()))
sum = 0
minus_count = 0
zero_flag = 0
min_ind = 0

for i in range(n):
	if a[i] < 0:
		minus_count += 1
	if a[i] == 0:
		zero_flag = 1

if zero_flag ==1:
	for i in range(n):
		sum += abs(a[i])
elif minus_count % 2 == 0:
	for i in range(n):
		sum += abs(a[i])
else:
	for i in range(n):
	min_ind = a[a.index(min(a))]
		sum += abs(a[i])
		sum -= abs(a[min_ind])

print(sum)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
zero_flag = 0
min_a = 0

for i in range(n):
	new_a.append(abs(a[i]))

for i in range(n):
	if a[i] < 0:
		minus_count += 1
	if a[i] == 0:
		zero_flag = 1

if zero_flag == 1:
	for i in range(n):
		sum += abs(a[i])
elif minus_count % 2 == 0:
	for i in range(n):
		sum += abs(a[i])
else:
	for i in range(n):
		sum += new_a[i]
	sum = sum - min(new_a) * 2

print(sum)
Buggy python submission (verdict: Runtime Error):
l = []
l= list(map(int,input().split()))

if a == b and a == c
	print("Yes")
else:
  	print("No")

Fixed submission:
l = []
l= list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[2]

if a == b and a == c:
	print("Yes")
else:
  	print("No")
Buggy python submission (verdict: Runtime Error):
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, min(l) + 1):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

    print(ans[-k])

Fixed submission:
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, min(l) + 1):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])

Buggy python submission (verdict: Runtime Error):
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, max(l)):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])


Fixed submission:
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, min(l) + 1):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])

Buggy python submission (verdict: Runtime Error):
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, max(l)):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[k-1])


Fixed submission:
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, min(l) + 1):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])

Buggy python submission (verdict: Runtime Error):
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

print('l:',l)


for i in range(1, max(l)):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 
    
print('ans:',ans)
print('k:',k)

if len(ans) == 0:
    print(1)
else:
    print('ans[k-1]',ans[k-1])


Fixed submission:
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, min(l) + 1):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])
Buggy python submission (verdict: Runtime Error):
s = input().split('/')
if s[0] <= 2018:
    print('Heisei')
elif s[0] == 2019 and s[1] <=4:
    print('Heisei')
elif s[0] == 2019 and s[1] >= 5:
    print('TBD')
elif s[0] >= 2020:
    print('TBD')


Fixed submission:
s =list(map(int,input().split('/')))

if s[0] <= 2018:
    print('Heisei')
elif s[0] == 2019 and s[1] <=4:
    print('Heisei')
elif s[0] == 2019 and s[1] >= 5:
    print('TBD')
elif s[0] >= 2020:
    print('TBD')
Buggy python submission (verdict: Runtime Error):
kazu = int(input())
isi = input()
isilst = []
count=0
for i in range(kazu-1):
    if isi[i] =="#" and isi[i + 1] == ".":
        count += 1
print(count)

Fixed submission:
# coding: utf-8
# Your code here!
kazu = input().split()
for i in range(len(kazu)):
    kazu[i] = int(kazu[i])
if kazu[0] < kazu[1]:
    if kazu[0] < kazu[2] and kazu[1] > kazu[2]:
        print("Yes")
    else:
        print("No")
elif kazu[0] > kazu[1]:
    if kazu[0] > kazu[2] and kazu[1] < kazu[2]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
answer = 0
for i in range(N):
    a = i+1
    if(N //a == N % a):
        answer = answer + a
print(answer)

Fixed submission:
N = int(input())
answer = 0
divi=[]
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        divi.append(i)
        if i != N // i:
            divi.append(N//i)

divi.sort()
divi.pop(0)
for i in reversed(range(len(divi))):
    if N % (divi[i]-1) != N // (divi[i]-1):
        divi.pop(i)
        i = i-1



for i in  range(len(divi)):
    answer = answer + divi[i]-1
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int, input().split())
count=0
for p1 in range(0,N+1,R):
    for p2 in range(0,N-p1+1,G):
        rR = p1
        gG = p2
        bB = N-p1-p2
        if rR%R==0 and gG%G==0 and bB%B==0:
            count+=1
print(count)

Fixed submission:
R,G,B,N=map(int, input().split())

count=0
for p1 in range(0,N+1,R):
    for p2 in range(0,N-p1+1,G):
        rR = p1
        gG = p2
        bB = N-p1-p2
        if bB%B==0:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int, input().split())

count=0
for p1 in range(N+1):
    for p2 in range(p1+1):
        rR = p2
        gG = p1-p2
        bB = N-p1
        if rR%R==0 and gG%G==0 and bB%B==0:
            count+=1
print(count)

Fixed submission:
R,G,B,N=map(int, input().split())

count=0
for p1 in range(0,N+1,R):
    for p2 in range(0,N-p1+1,G):
        rR = p1
        gG = p2
        bB = N-p1-p2
        if bB%B==0:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int, input().split())

count=0
for r in range(N+1):
    for g in range(N+1):
        for b in range(N+1):
            if (r*R+g*G+b*B)==N:
                count+=1
print(count)

Fixed submission:
R,G,B,N=map(int, input().split())

count=0
for p1 in range(0,N+1,R):
    for p2 in range(0,N-p1+1,G):
        rR = p1
        gG = p2
        bB = N-p1-p2
        if bB%B==0:
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

S = list(S)
T = list(T)

not_find = False
start_i = 0
for i in range(s_l - t_l + 1):
    start_i = s_l - i - t_l
    here = True
    for j in range(t_l):
        if S[start_i+j] == T[j] or S[start_i+j] == '?':
            here = True
        else:
            here = False
            break
    if here:
        break
    if start_i == 0:
        not_find = True

if not_find:
    print("UNRESTORABLE")
else:
    for s in range(len(S[:start_i])):
        if S[s] == '?':
            S[s] = 'a'

    S[start_i:start_i+t_l] = T

    for s in range(len(S[start_i+t_l:])):
        if S[s] == '?':
            S[s] = 'a'
    print(S)

Fixed submission:
import numpy as np

S = input()
T = input()

npS =  np.array(list(S))
npT =  np.array(list(T))

must_sym_i = npS != '?'

accepted = []
for i in range(len(S)-len(T)+1):
    and_ = npS[i:i+len(T)] == npT
    if all(and_[must_sym_i[i:i+len(T)]]):
        temp = np.copy(npS)
        temp[i:i+len(T)] = npT
        temp[temp == '?'] = 'a'
        accepted.append(temp)

acc = [''.join(list(accepted[i])) for i in range(len(accepted))]

if len(acc) > 0:
    print(sorted(acc)[0])
else:
    print("UNRESTORABLE")