qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
K = int(input())
ans = 1
for i in range(N)
	if ans < K:
		ans *= 2
	else:
		ans += K
print(ans)

Fixed code:
N = int(input())
K = int(input())

ans = 1
for i in range(N):
    if( ans*2 < ans+K ):
        ans = ans*2
    else:
        ans = ans + K

print(ans)
Buggy code:
n = int(input())
k = int(input())

ans = 1
for i in range(n):
    ans += min(n*2,n+k)

print(ans)

Fixed code:
n = int(input())
k = int(input())
outcome = 1

for i in range(n):
    outcome = min(outcome*2, outcome+k)

print(outcome)
Buggy code:
n=int(input())
k=int(input())

a=1

for i  in range(n):
  if a >=k:
    a=+k
  else:
    a=2*a

print(a)

Fixed code:
n = int(input())
k = int(input())
ans = 1
for i in range(n):
  if ans > k:
    ans += k
  else:
    ans *= 2
print(ans)
Buggy code:
n=int(input())
k=int(input())

a=1

for i range(n):
  if a >=k:
    a=+k
  else:
    a=2*a

print(a)

Fixed code:
n=int(input())
k=int(input())

a=1

for i  in range(n):
  if a >=k:
    a+=k
  else:
    a=2*a

print(a)
Buggy code:
N = int(input())
K = int(input())

ans = 1

for i in range(N):
  if i>K:
    ans += K
  else:
    ans *= 2
print(ans)

Fixed code:
N = int(input())
K = int(input())
ans = 1
for i in range(N):
    if ans > K:
        ans += K
    else:
        ans = ans*2
print(ans)
Buggy code:
a = int(input())
b = int(input())
ans = 1
for i in range(a):
  ans = min(a * 2,a + b)
print(ans)

Fixed code:
a,b=int(input()),int(input())
ans=1
for i in range(a):
    ans=min(ans*2,ans+b)
print(ans)
Buggy code:
N = int(input())
K = int(input())
number = 1

for i in N:
    if number * 2 < number + K:
        number = number * 2
    else:
        number = number + K

print(number)

Fixed code:
N = int(input())
K = int(input())
number = 1

for i in range(N):
    if number * 2 < number + K:
        number = number * 2
    else:
        number = number + K

print(number)
Buggy code:
N = int(input())
R = int(input())

max = 0
maxcounter = 0
j = 1

for i in range(N):
  # counter = 0
  # while j > 1:
  if j * 2 <= j + R:
    j = j * 2
    # counter += 1
  else:
    j = j + R
 

Fixed code:
N = int(input())
R = int(input())

max = 0
maxcounter = 0
j = 1

for i in range(N):
  # counter = 0
  # while j > 1:
  if j * 2 <= j + R:
    j = j * 2
    # counter += 1
  else:
    j = j + R
 
print(j)
Buggy code:
n=int(input())
k=int(input())
a=1

for i in range (1:n):
    if a < k:
        a=2*a
    else:
        a=a+k	

print(a)

Fixed code:
n = int(input())
k = int(input())

now = 1

for i in range(n):
    if now * 2 < now + k:
        now *= 2
    else:
        now += k

print(now)
Buggy code:
N = int(input())
K = int(input())
i = 1
for num in range(N):
  if i < K:
    i *= 2
  else:
    i += K
print (K)

Fixed code:
N = int(input())
K = int(input())
i = 1
for num in range(N):
  if i < K:
    i *= 2
  else:
    i += K
print (i)
Buggy code:
a = int(input())
b = int(input())
n=1
for i in range(a):
    n=min(n*2, n+k)
print(n)

Fixed code:
a = int(input())
b = int(input())
n=1
for i in range(a):
    n=min(n*2, n+b)
print(n)
Buggy code:
N,K=int(input()),int(input())
res=1
for _ in range(K):
  res=min(res*2,res+K)
print(res)

Fixed code:
N,K=int(input()),int(input())
res=1
for _ in range(N):
  res=min(res*2,res+K)
print(res)
Buggy code:
N = int(input())
K = int(input())

now = 1
for i in range(N):
	if(now>=K):
		now*=2
    else:
		now+=K
print(now)

Fixed code:
N = int(input())
K = int(input())
total = 1
for i in range(N):
    if total*2 > total + K:
        total += K
    else:
        total *= 2
print(total)
Buggy code:
n=int(input())
k=int(input())
s=1

for i in range(n):
    if (2*s)<k:
        s=2*s
    else:
        s+=k
print(s)

Fixed code:
n = int(input())
k = int(input())
num = 1

for i in range(n):
  if num * 2 < num + k:
    num *= 2
  else:
    num += k


print(num)
Buggy code:
n=int(input())
k=int(input())
ans=1
for _ in range(n):
  ans=min(ans+k,2*k)
print(ans)

Fixed code:
n=int(input())
k=int(input())
ans=1
for _ in range(n):
  ans=min(ans+k,2*ans)
print(ans)
Buggy code:
#abc076 b 
n=int(input())
k=int(input())
ans=1
for i in range(k):
    ans=min(ans*2,ans+k)
print(ans)

Fixed code:
#abc076 b 
n=int(input())
k=int(input())
ans=1
for i in range(n):
    ans=min(ans*2,ans+k)
print(ans)
Buggy code:
N = int(input())
K = int(input())
ans = 1
for _ in range(N):
  ans += min(ans*2, ans+K)
print(ans)

Fixed code:
N = int(input())
K = int(input())
ans = 1
for _ in range(N):
  ans = min(ans*2, ans+K)
print(ans)
Buggy code:
N=int(input())
k=int(input())

ans=1

for i in range(1,n):
  if ans*2 < ans+k:
    ans = ans*2
  else:
    ans = ans+k

print(ans)

Fixed code:
n=int(input())
k=int(input())

ans=1

for i in range(n):
  if ans*2 < ans+k:
    ans = ans*2
  else:
    ans = ans+k

print(ans)
Buggy code:
n, k = map(int(input()))
ans = 1
for i in range(n):
  ans = min([ans*2, ans+k])
print(ans)

Fixed code:
n = int(input())
k = int(input())
ans = 1
for i in range(n):
  ans = min([ans*2, ans+k])
print(ans)
Buggy code:
N = int(input())
K = int(input())
ans = 1
for i in range(N + K):
    if i <= N -1:
        ans *= 2
    else:
        ans += K
print(ans)

Fixed code:
N = int(input())
K = int(input())
ans = 1
for i in range(N):
    if ans+K <= ans*2:
        ans = ans+K
    else:
        ans = ans*2
print(ans)
Buggy code:
n=int(input())
k=int(input())
d=1
for i in range(n):
  if k>2*d:
    d=d*2
  else:
    d=d+k
print(d)

Fixed code:
n = int(input())
k = int(input())
d = 1
for i in range(n):
  if d <= k:
    d *= 2
  else:
    d += k
print(d)
Buggy code:
N=input()
K=input()
a=1
for i in range(N):
    if a<K:
        a*=2
    else:
        a+=K
print(a)
 

Fixed code:
N = int(input())
K = int(input())
a = 1
for i in range(N):
    if a * 2 < a + K:
        a *= 2
    else:
        a += K
print(a)
Buggy code:
N = int(input())
K = int(input())
a = 1
for i in range(N):
  if a < K:
    a *= 2:
  else:
    a += K
print(a)

Fixed code:
N = int(input())
K = int(input())
a = 1
for i in range(N):
  if a < K:
    a *= 2
  else:
    a += K
print(a)
Buggy code:
n = int(intput())
k = int(input())
ans = 1
for i in range(n):
  if ans <= k:
    ans *= 2
  else:
    ans += k
print(ans)

Fixed code:
n = int(input())
k = int(input())
ans = 1
for i in range(n):
  if ans <= k:
    ans *= 2
  else:
    ans += k
print(ans)
Buggy code:
n=int(input())
k=int(input())
ans = 1
for i in range(n):
  ans=max(2*ans,ans+k)
print(ans)

Fixed code:
n=int(input())
k=int(input())
ans = 1
for i in range(n):
  ans=min(2*ans,ans+k)
print(ans)
Buggy code:
if __name__ == "__main__":
    n = int(input())
    k = int(input())

    result=1
    while(n==0):
        if (result+k > result*2):
            result=result*2
        else:
            result=result+k
        n=n-1
    print(result)


Fixed code:
if __name__ == "__main__":
    n = int(input())
    k = int(input())

    result=1
    while(n!=0):
        if (result+k > result*2):
            result=result*2
        else:
            result=result+k
        n=n-1
    print(result)
Buggy code:
n=int(input())
m=int(input())
num=1
for i in range(n):
  if num<k:
    num*=2
  else:
    num+=k
print(num)

Fixed code:
n=int(input())
m=int(input())
num=1
for i in range(n):
  if num<m:
    num*=2
  else:
    num+=m
print(num)
Buggy code:
n = int(input())
k = int(input())
for i in range(n):
    if n*2 < n+k:
        n = n*2
    else:
        n += k
print(n)

Fixed code:
n = int(input())
k = int(input())
x = 1
for i in range(n):
    if x*2 < x+k:
        x = x*2
    else:
        x += k
print(x)
Buggy code:
N=int(input())
K=int(input())

ans=2**N
tmp=1
for i in range(2**N - 1):
  for j in range(N):
    if i>>j %2==1:
      tmp*=2
    else:
      tmp+=K
      
  ans=min(ans,tmp)
print(ans)

Fixed code:
N=int(input())
K=int(input())

ans=2**N

for i in range(2**N):
  tmp=1
  for j in range(N):
    if (i>>j) %2==1:
      tmp*=2
    else:
      tmp+=K     
  ans=min(ans,tmp)
print(ans)
Buggy code:
n=int(input())
k=int(input())

now=1
for i in range(n):
  if now*2 >=k
  	now+=k
  else:
    now*=2
print(now)


Fixed code:
n=int(input())
k=int(input())

now=1
for i in range(n):
  if now*2 >=now+k:
  	now+=k
  else:
    now*=2
print(now)
Buggy code:
N = int(input())
K = int(input())

def ans(i,x):
    print(i)
    if i == 0:
        return min(2*x, x+K)
    else:
        return min(ans(i-1, 2*x), ans(i-1, x+K))

print(ans(N-1, 1))


Fixed code:
N = int(input())
K = int(input())

def ans(i,x):
    if i == 0:
        return min(2*x, x+K)
    else:
        return min(ans(i-1, 2*x), ans(i-1, x+K))

print(ans(N-1, 1))
Buggy code:
n=int(input())
k=int(input())
i=1
for _ in range(k):
  if(i<k):
    i*=2
  else:
    i+=k
print(i)


Fixed code:
n=int(input())
k=int(input())
i=1
for _ in range(n):
  if(i<k):
    i*=2
  else:
    i+=k
print(i)
Buggy code:
N=int(input())
K=int(input())
ans=1

for i in range(N):
  ans=mini(ans*2,ans+K)
  
print(ans)

Fixed code:
N=int(input())
K=int(input())
ans=1

for i in range(N):
  ans=min(ans*2,ans+K)
  
print(ans)
Buggy code:
n = int(input())
k = int(input())

d = 1

for i in range(n):
	print(d)
	if d < k:
		d = d*2
	else:
		d += k

print(d)

Fixed code:
n = int(input())
k = int(input())
o = 1
for i in range(n):
    if(o + k <= o * 2):
        o += k
    else:
        o *= 2
print(o)
Buggy code:
num = int( input() )
k = int( input() )
ans = 1
for i in range( num ):
    if ( ans*2 > ans+k ):
        ans = ans * 2
    else:
        ans = ans + k
print( ans )


Fixed code:
num = int( input() )
k = int( input() )
ans = 1
for i in range( num ):
    if ( ans*2 < ans+k ):
        ans = ans * 2
    else:
        ans = ans + k
print( ans )
Buggy code:
N = int(input())
K = int(input())
ans = 0
for _ in range(N):
  if ans + K > ans * 2:
    ans *= 2
  else:
    ans += K
print(ans)
    

Fixed code:
N = int(input())
K = int(input())
ans = 1
for _ in range(N):
  if ans + K > ans * 2:
    ans *= 2
  else:
    ans += K
print(ans)
Buggy code:
S = list(input())
T = list(input())
flag = False

if "".join(map(str, T)) in "".join(map(str, S)):
  for i in range(len(S)):
      if S[i] == "?":
        S[i] = "a"
    print("".join(map(str,S)))

else:
  for i in reversed(range(len(S) - len(T) + 1)):
    if S[i] == (T[0] or "?"):
      for j in range(len(T)):
        if S[i + j] != T[j] and S[i + j] != "?":
          print(S[i + j])
          break
      else:
        flag = True
        S[i:i + len(T)] = T

  if flag == False:
    print("UNRESTORABLE")
  else:
    for i in range(len(S)):
      if S[i] == "?":
        S[i] = "a"
    print("".join(map(str,S)))


Fixed code:
S = list(input())
T = list(input())
flag = False

for i in reversed(range(len(S) - len(T) + 1)):
  T_flg = S[i: i + len(T)]
  for j in range(len(T)):
    if T_flg[j] != T[j] and T_flg[j] != "?":
      break
  else:
    flag = True
    S[i:i + len(T)] = T
    break

if flag == False:
  print("UNRESTORABLE")
else:
  for i in range(len(S)):
    if S[i] == "?":
      S[i] = "a"
  print("".join(map(str,S)))
Buggy code:
S = input()
T = input()

n = len(S)
m = len(T)

s = []

for i in reversed(range(n - m + 1)):
  t_kamo = S[i: i + m]
  for j in range(m + 1):
    if j == m:
      print((S[:i] + T +  S[i + m:]).replace("?", "a"))
      exit()
    if t_kamo[j] == "?":
      continue
    elif t_kamo[j] != t[j]:
      break

print("UNRESTORABLE")


Fixed code:
S = input()
T = input()

n = len(S)
m = len(T)


for i in reversed(range(n - m + 1)):
  t_kamo = S[i: i + m]
  for j in range(m + 1):
    if j == m:
      print((S[:i] + T +  S[i + m:]).replace("?", "a"))
      exit()
    if t_kamo[j] == "?":
      continue
    elif t_kamo[j] != T[j]:
      break

print("UNRESTORABLE")
Buggy code:
s=list(input())
t=list(input())
n=len(s)
m=len(t)
if m>n:
    print('UNRESTORABLE')
    exit()
af=0
for i in range(n-m+1):
    k=s[n-m-i:n-i]
    f=0
    for j in range(m):
        if k[i]=='?' or k[i]==t[i]:
            f+=1
    if f==m:
        af+=1
        s[n-m-i:n-i]=t
        break
if af>0:
    ans=''
    for i in range(n):
        if s[i]=='?':
            ans+='a'
        else:
            ans+=s[i]
    print(ans)
else:
    print('UNSTORABLE')
        

Fixed code:
s=list(input())
t=list(input())
n=len(s)
m=len(t)
if m>n:
    print('UNRESTORABLE')
    exit()
af=0
for i in range(n-m+1):
    k=s[n-m-i:n-i]
    f=0
    for j in range(m):
        if k[j]=='?' or k[j]==t[j]:
            f+=1
    if f==m:
        af+=1
        s[n-m-i:n-i]=t
        break
if af>0:
    ans=''
    for i in range(n):
        if s[i]=='?':
            ans+='a'
        else:
            ans+=s[i]
    print(ans)
else:
    print('UNRESTORABLE')
Buggy code:
import sys  
import numpy as np

input = sys.stdin.readline

S_ = input()
T = input()

S_ = list(S_)[:-1]
T = list(T)[:-1]

for i in range(len(S_)-len(T)+1):
    part = S_[-len(T)-i:-i]
    j = False
    for k in range(len(part)-1,-1,-1):
        if part[k] == "?":
            if k==0:
                j = True
        elif part[k] == T[k]:
            if k==0:
                j = True

        else:

            break
    if j:
        break


if j:
    for p in range(len(T)):
        S_[len(S_)-len(T)-i+p] = T[p]
    # print("*",S_)
    for k in range(len(S_)):
        if S_[k] == "?":
            S_[k] = "a"

    print("".join(S_))
else:
    print("UNRESTORABLE")

Fixed code:

import sys  
import numpy as np

input = sys.stdin.readline

S_ = input()
T = input()

S_ = list(S_)[:-1]
T = list(T)[:-1]

j = False
for i in range(len(S_)-len(T)+1):
    if i==0:
        part = S_[-len(T):]
    else :
        part = S_[-len(T)-i:-i]
    j = False
    for k in range(len(part)-1,-1,-1):
        if part[k] == "?":
            if k==0:
                j = True
            continue
        elif part[k] == T[k]:
            if k==0:
                j = True
        else:
            break
    if j:
        break


if j:
    for p in range(len(T)):
        S_[len(S_)-len(T)-i+p] = T[p]
    # print("*",S_)
    for k in range(len(S_)):
        if S_[k] == "?":
            S_[k] = "a"

    print("".join(S_))
else:
    print("UNRESTORABLE")
Buggy code:
S = input()
T = input()

for i in range(len(S)-len(T),-1,-1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
  if flag:
    print(S[i:i+len(T)])
    S = S[:i]+T+S[i+len(T):]
    S = S.replace('?','a')
    print(S)
    exit()

print('UNRESTORABLE')

Fixed code:
S = input()
T = input()

for i in range(len(S)-len(T),-1,-1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
  if flag:
    S = S[:i]+T+S[i+len(T):]
    S = S.replace('?','a')
    print(S)
    exit()

print('UNRESTORABLE')
Buggy code:
from copy import deepcopy

S = input()
T = input()

answer = ''
for i in range(len(S)-len(T)):
    found = True
    for j in range(len(T)):
        if S[i+j] != '?' and S[i+j] != T[j]:
            found = False
            break
    if found:
        tmp = deepcopy(S).replace('?', 'a')
        tmp = tmp[:i] + T + tmp[i+len(T):]
        if answer == '' or tmp < answer:
            answer = tmp

if answer == '':
    print('UNRESTORABLE')
else:
    print(answer)

Fixed code:
from copy import deepcopy

S = input()
T = input()

answer = ''
for i in range(len(S)-len(T)+1):
    found = True
    for j in range(len(T)):
        if S[i+j] != '?' and S[i+j] != T[j]:
            found = False
            break
    if found:
        tmp = deepcopy(S).replace('?', 'a')
        tmp = tmp[:i] + T + tmp[i+len(T):]
        if answer == '' or tmp < answer:
            answer = tmp

if answer == '':
    print('UNRESTORABLE')
else:
    print(answer)
Buggy code:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))

Sd = input()
T = input()

def match(L):
    for l, t in zip(L, T):
        if l == "?":
            continue
        else:
            if l != t:
                return False
            else:
                pass
    return True

res = []

for i in range(len(Sd)-len(T)+1)[::-1]:
    print(Sd[i:i+len(T)])
    if match(Sd[i:i+len(T)]):
        print(i)
        res.append((Sd[:i] + T + Sd[i+len(T):]).replace("?", "a"))

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

Fixed code:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))

Sd = input()
T = input()

def match(L):
    for l, t in zip(L, T):
        if l == "?":
            continue
        else:
            if l != t:
                return False
            else:
                pass
    return True

res = []

for i in range(len(Sd)-len(T)+1)[::-1]:
    if match(Sd[i:i+len(T)]):
        res.append((Sd[:i] + T + Sd[i+len(T):]).replace("?", "a"))

if len(res):
    print(sorted(res)[0])
else:
    print("UNRESTORABLE")
Buggy code:
import re

S2 = input()
T = input()

S_list = []

for j in range(len(S2) - len(T) + 1):
    if S2[j:(j + len(T))] == T:
        S_list.append(re.sub("\?", "a", S2))
    else:
        flag = 1
        tmp_S = ""
        for k in range(len(T)):
            if(S2[j + k] == T[k] or S2[j + k] == "?"):
                pass
            else:
                flag = 0
        if flag == 1:
            tmp = S2[:j] + T + S2[j + len(T):]
            S_list.append(re.sub("\?", "a", tmp))

if S_list == []:
    print("UNRESTORABL")
else:
    print(sorted(S_list)[0])


Fixed code:
import re

S2 = input()
T = input()

S_list = []

for j in range(len(S2) - len(T) + 1):
    if S2[j:(j + len(T))] == T:
        S_list.append(re.sub("\?", "a", S2))
    else:
        flag = 1
        tmp_S = ""
        for k in range(len(T)):
            if(S2[j + k] == T[k] or S2[j + k] == "?"):
                pass
            else:
                flag = 0
        if flag == 1:
            tmp = S2[:j] + T + S2[j + len(T):]
            S_list.append(re.sub("\?", "a", tmp))

if S_list == []:
    print("UNRESTORABLE")
else:
    print(sorted(S_list)[0])
Buggy code:
sd = input()
t = input()
li_answer = list()
c_loop = len(sd) - len(t) + 1

for i in range(c_loop):
    if all((w_sd == "?" or w_sd == w_t) for w_sd, w_t in zip(sd[i:i + len(t) + 1], t)):
        s_tmp = str(sd[0:i] + t + sd[i + len(t):]).replace("?", "a")
        li_answer.append(s_tmp)

if li_answer:
    print(sorted(li_answer)[0])
else:
    print("UNRESTORABLE")


                                            ｋ


Fixed code:
sd = input()
t = input()
li_answer = list()
c_loop = len(sd) - len(t) + 1

for i in range(c_loop):
    if all((w_sd == "?" or w_sd == w_t) for w_sd, w_t in zip(sd[i:i + len(t) + 1], t)):
        s_tmp = str(sd[0:i] + t + sd[i + len(t):]).replace("?", "a")
        li_answer.append(s_tmp)

if li_answer:
    print(sorted(li_answer)[0])
else:
    print("UNRESTORABLE")
Buggy code:
S = input()
T = input()
flag = False
for i in range(len(S) - len(T) + 1):
    k = i
    for j in range(len(T)):
        if S[k] == T[j] or S[k] == '?':
            k += 1
        else:
            break
    if k == i + len(T):
        flag = True
        st = i
        break
ret = ""
print(st)
if flag:
    for i in range(st):
        if S[i] == '?':
            ret += 'a'
        else:
            ret += S[i]
    ret += T
    for i in range(st + len(T), len(S)):
        if S[i] == '?':
            ret += 'a'
        else:
            ret += S[i]
else:
    ret = "UNRESTORABLE"
print(ret)

Fixed code:
S = input()
T = input()
flag = False
for i in range(len(S)):
    k = len(S) - i - len(T)
    for j in range(len(T)):
        if k >= 0 and (S[k] == T[j] or S[k] == '?'):
            k += 1
            if j == len(T) - 1:
                flag = True
                st = len(S) - len(T) - i
        else:
            break
    if flag:
        break
ret = ""
if flag:
    for i in range(st):
        if S[i] == '?':
            ret += 'a'
        else:
            ret += S[i]
    ret += T
    for i in range(st + len(T), len(S)):
        if S[i] == '?':
            ret += 'a'
        else:
            ret += S[i]
else:
    ret = "UNRESTORABLE"
print(ret)
Buggy code:
import sys
readline = sys.stdin.buffer.readline

from collections import deque
from copy import copy,deepcopy
from itertools import permutations,combinations
from pprint import pprint

def myinput():
    return map(int,input().split())

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

s = input()
t = input()

for i in range(len(s)-len(t)):
    print(s[i])
    flag = True
    for j in range(len(t)):
        if s[i]=="?":
            pass
        elif s[i]==t[i+j]:
            pass
        else:
            flag = False
    if flag:
        break
    else:
        continue

if flag==False:
    print("UNRESTORABLE")
    exit()

# print(len(s)-len(t)-i)
# print(j)

k = len(s) - len(t) - i

ans = copy(s)
ans = list(ans)
# print(ans)
# print(list(str(t)))

for l in range(len(t)):
    ans[k+l] = t[l]

# print(ans)


ans = "".join(ans)
# print(ans)

ans2 = ans.replace("?","a")
# print(ans2)

Fixed code:
# import sys
# readline = sys.stdin.buffer.readline

# from collections import deque
# from copy import copy,deepcopy
# from itertools import permutations,combinations
# from pprint import pprint

# def myinput():
#     return map(int,input().split())

# def mycol(data,col):
#     return [ row[col] for row in data ]

# def mysort(data,col):
#     data.sort(key=lambda x:x[col],reverse=False)
#     return data

s = input()
t = input()
if len(s)<len(t):
    print("UNRESTORABLE")
    exit()

for i in reversed(range(len(s)-len(t)+1)):
    flag = False
    for j in range(len(t)):
        if j==(len(t)-1):
            if s[i+j]=="?":
                flag = True
            elif s[i+j]==t[j]:
                flag = True
            else:
                flag = False
        elif s[i+j]=="?":
            pass
        elif s[i+j]==t[j]:
            pass
        else:
            flag = False
            break
    if flag:
        break
    else:
        continue

if flag:
    pass
else:
    print("UNRESTORABLE")
    exit()

ans = list(s)

for l in range(len(t)):
    ans[i+l] = t[l]

ans2 = "".join(ans)

# if "?" in ans2:
ans3 = ans2.replace("?","a")
print(ans3)
Buggy code:
import sys
S=input()
T=input()
if len(S)<len(T):
    print('UNRESTORABLE')
    sys.exit()
L=[]
for i in range(len(S)-len(T)+1):
    K=S[i:i+len(T)]
    flag=True
    print(K)
    for j in range(len(T)):
        if T[j]!=K[j] and K[j]!='?':
            flag=False
    if flag:
        U=S[:i]+T+S[i+len(T):]
        L.append(U.replace('?','a'))
#print(L)
if len(L)!=0:
    print(min(L))
else:
    print('UNRESTORABLE')

Fixed code:
import sys
S=input()
T=input()
if len(S)<len(T):
    print('UNRESTORABLE')
    sys.exit()
L=[]
for i in range(len(S)-len(T)+1):
    K=S[i:i+len(T)]
    flag=True
    #print(K)
    for j in range(len(T)):
        if T[j]!=K[j] and K[j]!='?':
            flag=False
    if flag:
        U=S[:i]+T+S[i+len(T):]
        L.append(U.replace('?','a'))
#print(L)
if len(L)!=0:
    print(min(L))
else:
    print('UNRESTORABLE')
Buggy code:
sd=input()
t=input()
lsd=len(sd)
lt=len(t)
ans='UNRESTRABLE'
for i in range(lsd-lt,-1,-1):
    for j in range(lt):
        if sd[i+j]!='?' and sd[i+j]!=t[j]:
            break
        else:
            ans=(sd[:i]+t+sd[i+lt:]).replace('?','a')
        break
print(ans)

Fixed code:
sd=input()
t=input()
lsd=len(sd)
lt=len(t)
for i in range(lsd-lt,-1,-1):
    for j in range(lt):
        if sd[i+j]!='?' and sd[i+j]!=t[j]:
            break
    else:
            print((sd[:i]+t+sd[i+lt:]).replace('?','a'))
            break
else:
    print('UNRESTORABLE')