Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

Answer = [p+1 for p in range(n)]

for i in range(m):
  l,r = map(int, input().split())
  Answer = [q for q in Answer if q >=l and q <= r]
  
print(len(Answer))  

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

min_value = 1
max_value = n

for _ in range(m):
  l, r = map(int, input().split())
  if l >= min_value:
    min_value = l
  if r <= max_value:
    max_value = r

Answer = max(max_value - min_value +1,0)

print(Answer)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

Answer = [p+1 for p in range(n)]

for i in range(m):
  l,r = map(int, input().split())
  Answer = [q for q in Answer if q >=l]
  Answer = [s for s in Answer if s <=r]
  
print(len(Answer)) 

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

min_value = 1
max_value = n

for _ in range(m):
  l, r = map(int, input().split())
  if l >= min_value:
    min_value = l
  if r <= max_value:
    max_value = r

Answer = max(max_value - min_value +1,0)

print(Answer)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
g_max = N//G+1
for r in range(r_max+1):
  temp = N - R*r
  for g in range(g_max+1):
    now = temp - G*g
    if now% B == 0 and now//B >= 0:
      counter +=1
print(counter)

Fixed submission:
R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
for r in range(r_max+1):
  temp = N - R*r
  for g in range(temp//G+1):
    now = temp - G*g
    if now% B == 0 and now//B >= 0:
      counter +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
g_max = N//G+1
for r in range(r_max+1):
  for g in range(g_max+1):
    temp = N - R*r - G*g
    if temp% B == 0 and temp//B >= 0:
      counter +=1
print(counter)

Fixed submission:
R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
for r in range(r_max+1):
  temp = N - R*r
  for g in range(temp//G+1):
    now = temp - G*g
    if now% B == 0 and now//B >= 0:
      counter +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
g_max = N//G+1
for r in range(r_max+1):
  for g in range(g_max+1):
    if (N - R*r - G*g)% B == 0 and (N - R*r -G*g)//B >= 0:
      counter +=1
print(counter)
  

Fixed submission:
R, G, B, N = map(int, input().split())
counter = 0
r_max = N//R+1
for r in range(r_max+1):
  temp = N - R*r
  for g in range(temp//G+1):
    now = temp - G*g
    if now% B == 0 and now//B >= 0:
      counter +=1
print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
s = list(s)
 
def del_01(s,counter):
  for i in range(len(s)-1):
    if s[i] == '1' and s[i+1] == '0':
      s[i] ='w'
      s[i+1] = 'w'
      counter += 2
    elif s[i] == '0' and s[i+1] == '1':
      s[i] = 'w'
      s[i+1] = 'w'
      counter += 2
  s.remove('w')
  return s, counter
counter = 0
while (s.count('0') != 0) and (s.count('1') != 0) and (s != []):
  s, counter = del_01(s, counter)

print(counter)

Fixed submission:
s = input()
s = list(s)

count0 = s.count('0')
count1 = s.count('1')
                 
print(min(count0,count1)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
s = list(s)

def del_01(s,counter):
  for i in range(len(s)-1):
    if s[i] == '1' and s[i+1] == '0':
      s[i] ='w'
      s[i+1] = 'w'
      counter += 2
    elif s[i] == '0' and s[i+1] == '1':
      s[i] = 'w'
      s[i+1] = 'w'
      counter += 2
  s.remove('w')
  return s, counter
counter = 0
while (s.count('0') != 0) and (s.count('1') != 0) and (s != []):
  s, counter = del_01(s, counter)
  x = del_01(s,0)

print(counter)

Fixed submission:
s = input()
s = list(s)

count0 = s.count('0')
count1 = s.count('1')
                 
print(min(count0,count1)*2)
Buggy python submission (verdict: Runtime Error):
N,K =map(int,input().split())
List = list(map(int,input().split()))
DP = [False]*(2*K+1)
for i in range(K):
  for item in List:
    if DP[i]==False:
      DP[i+item] = True
if DP[k]==True:
  print('First')
else:
  print('Second')

Fixed submission:
N,K =map(int,input().split())
List = list(map(int,input().split()))
DP = [False]*(2*K+1)
for i in range(K):
  for item in List:
    if DP[i]==False:
      DP[i+item] = True
if DP[K]==True:
  print('First')
else:
  print('Second')
Buggy python submission (verdict: Runtime Error):
100 10

Fixed submission:
N, K = (int(i) for i in input().split())
if N % K == 0:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
CS = [0]*N
for i in range(1,N):
  if S[i] == 'W':
    CS[i] = CS[i-1]+1
  else:
    CS[i] = CS[i-1]-1
min_value = min(CS)
Leader = CS.index(min_value) + 1
counter = 0
for i in range(1,Leader):
  if CS[i]<CS[i+1]:
    counter += 1
for i in range(Leader,N-1):
  if CS[i]>CS[i+1]:
    counter +=1
print(counter)

Fixed submission:
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] == 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    if cost < counter:
      counter = cost
    cost +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
 
counter = len(S)
 
for i in range(len(S)):
  cost = S[:i].count('W') + S[i+1:].count('E')
  if cost < counter:
    counter = cost
print(counter)

Fixed submission:
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] == 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    if cost < counter:
      counter = cost
    cost +=1
print(counter)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] = 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    cost +=1
print(counter)

Fixed submission:
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] == 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    if cost < counter:
      counter = cost
    cost +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

counter = len(S)
 
for i in range(len(S)):
  cost = S[:i].count('W') + S[i+1:].count('E')
  if cost < counter:
    counter = cost
print(counter)

Fixed submission:
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] == 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    if cost < counter:
      counter = cost
    cost +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)

for i in range(len(S)):
  cost = S[:i].count('W') + S[i+1:].count('E')
  if cost < counter:
    counter = cost
print(counter)

Fixed submission:
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] == 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    if cost < counter:
      counter = cost
    cost +=1
print(counter)
Buggy python submission (verdict: Runtime Error):
calc_lsit = list(map(int,input().split()))
k = int(input())

calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]**k
print(Answer)

Fixed submission:
calc_list = list(map(int,input().split()))
k = int(input())
 
calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]*(2**k)
print(Answer)

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

calc_list = [a, b, c]
calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]**k
print(Answer)

Fixed submission:
calc_list = list(map(int,input().split()))
k = int(input())
 
calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]*(2**k)
print(Answer)
Buggy python submission (verdict: Runtime Error):
Bottom = min(A,B,C)
Middle = A+B+C - Top - Bottom
if (Middle - Bottom)%2 != 0:
  Top += 1
  Bottom += 1
  Answer = (Top -Middle) + (Middle - Bottom)//2 +1
else:
  Answer = (Top - Middle) + (Middle - Bottom)//2
print(Answer)

Fixed submission:
A,B,C = map(int,input().split())
Top = max(A,B,C)
Bottom = min(A,B,C)
Middle = A+B+C - Top - Bottom
if (Middle - Bottom)%2 != 0:
  Top += 1
  Bottom += 1
  Answer = (Top -Middle) + (Middle - Bottom)//2 +1
else:
  Answer = (Top - Middle) + (Middle - Bottom)//2
print(Answer)
Buggy python submission (verdict: Runtime Error):
n = int(input())
List = list(map(int,input().split()))
A = []
B = []
List = sorted(List,reverse=True)
for i in range(len(List)):
  if i%2 == 0:
    A.append(item)
  else:
    B.append(item)
Answer = sum(A) - sum(B)
print(Answer)

Fixed submission:
n = int(input())
List = list(map(int,input().split()))
A = []
B = []
List = sorted(List,reverse=True)
for i in range(len(List)):
  if i%2 == 0:
    A.append(List[i])
  else:
    B.append(List[i])
Answer = sum(A) - sum(B)
print(Answer)
Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
y = Y/1000
Answer = [-1, -1, -1]
for i in range(N+1):
  if i*10 <= y:
    for j in range(N-i):
      if i*10 + j*5 <= y:
        k = y - i*10 - j*5:
          if i + j + k == N:
            Answer = [i,j,k]
      else:
        break
    else:
      break
print(Answer[0],Answer[1],int(Answer[2]))

Fixed submission:
N,Y = map(int,input().split())
y = Y/1000
Answer = [-1, -1, -1]

for i in range(N+1):
  for j in range(N+1-i):
    if 10*i+5*j+(N-i-j) == Y/1000:
      Answer = [i, j, N-i-j]
      print(*Answer)
      exit()
print(*Answer)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
#q = deque()
q= []
m = {}
K = int(input())
q.append((1,1))
while len(q):
  #n,s = q.popleft()
  n,s = q.pop(0)
  if n in m:
    continue
  m[n] = s
  #q.appendleft((n*10%K,s))
  q.insert(0,(n*10%K,s))
  #q.append(((n+1)%K,s+1))
  q.append(((n+1)%K,s+1))
print(m[0])

Fixed submission:
from collections import deque
q = deque()
ans = {}
K = int(input())
q.append((1,1))
while len(q):
  resid,total = q.popleft()
  if resid in ans:
    continue
  ans[resid] = total
  q.appendleft((resid*10%K,total))
  q.append(((resid+1)%K,total+1))
print(ans[0])
Buggy python submission (verdict: Time Limit Exceeded):
Figures = []
N = int(input())
for _ in range(N):
  x = int(input())
  if x in Figures:
    Figures.remove(x)
  else:
    Figures.append(x)
print(len(Figures))

Fixed submission:
dic = {}
N = int(input())
for _ in range(N):
  x = int(input())
  if x in dic:
    dic[x] += 1
  else:
    dic[x] = 1
counter = 0
for i in dic.keys():
  if dic[i] %2 == 1:
    counter +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
Figures = []
N = int(input())
for _ in range(N):
  x = int(input())
  if x in Figures:
    Figures.remove(x)
  else:
    Figures.append(x)
print(len(Figures))

Fixed submission:
dic = {}
N = int(input())
for _ in range(N):
  x = int(input())
  if x in dic:
    dic[x] += 1
  else:
    dic[x] = 1
counter = 0
for i in dic.keys():
  if dic[i] %2 == 1:
    counter +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
Figures = []
N = int(input())
for _ in range(N):
  A = input()
  if A in Figures:
    Figures.remove(A)
  else:
    Figures.append(A)
Answer = len(Figures)
print(Answer)

Fixed submission:
dic = {}
N = int(input())
for _ in range(N):
  x = int(input())
  if x in dic:
    dic[x] += 1
  else:
    dic[x] = 1
counter = 0
for i in dic.keys():
  if dic[i] %2 == 1:
    counter +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
Figures = []
N = int(input())
for _ in range(N):
  A = input()
  if A in Figures:
    Figures.remove(A)
  else:
    Figures.append(A)
Answer = len(Figures)
print(Answer)

Fixed submission:
dic = {}
N = int(input())
for _ in range(N):
  x = int(input())
  if x in dic:
    dic[x] += 1
  else:
    dic[x] = 1
counter = 0
for i in dic.keys():
  if dic[i] %2 == 1:
    counter +=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
Figures = []
N = int(input())
for _ in range(N):
  A = int(input())
  if A in Figures:
    Figures.remove(A)
  else:
    Figures.append(A)
Answer = len(Figures)
print(Answer)

Fixed submission:
dic = {}
N = int(input())
for _ in range(N):
  x = int(input())
  if x in dic:
    dic[x] += 1
  else:
    dic[x] = 1
counter = 0
for i in dic.keys():
  if dic[i] %2 == 1:
    counter +=1
print(counter)
Buggy python submission (verdict: Runtime Error):
N = int(input())
dic = {}
for i in range(N):
  a = int(input())
  dic[i+1] = a
counter = 0
place = 1
while place != 2:
  if dic[place] in dic:
    temp = dic[place]
    dic.pop(place)
    place = temp
    counter += 1
  else:
    counter = -1
    break

print(counter)

Fixed submission:
N = int(input())
dic = {}
for i in range(N):
  a = int(input())
  dic[i+1] = a
counter = 0
place = 1
while place != 2:
  if dic[place] in dic and dic[place] != place:
    temp = dic[place]
    dic.pop(place)
    place = temp
    counter += 1
  else:
    counter = -1
    break
print(counter)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())  
if A + B < 10:
  prin(A+B)
else:
  print('error')

Fixed submission:
A,B = map(int,input().split())  
if A + B >= 10:
  print('error')
else:
  print(A+B)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
dic = {}
for i in range(M):
  a,b = map(int,input().split())
  if a not in dic:
    dic[a] = 1
  else:
    dic[a] +=1
  if b not in dic:
    dic[b] = 1
  else:
    dic[b] +=1

for j in range(N):
  print(dic[j+1])

Fixed submission:
N,M = map(int,input().split())
dic = {}

for i in range(N):
  dic[i+1] = 0

for i in range(M):
  a,b = map(int,input().split())
  dic[a] += 1
  dic[b] += 1
output = dic.values()
for item in output:
  print(item)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
dic = {}
for _ in range(N):
  a, b = map(int,input().split())
  if a in dic:
    dic[a] += b
  else:
    dic[a] = b
List = sorted(dic)
ans = 0
i = 0
while M >= 0:
  M -= dic[List[i]]
  ans = List[i]
  i += 1
print(ans)

Fixed submission:
N,M = map(int,input().split())
dic = {}
for _ in range(N):
  a, b = map(int,input().split())
  if a in dic:
    dic[a] += b
  else:
    dic[a] = b
List = sorted(dic)
ans = 0
i = 0
while M > 0:
  M -= dic[List[i]]
  ans = List[i]
  i += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
dic = {}
for _ in range(N):
  a, b = map(int,input().split())
  if a in dic:
    dic[a] += b
  else:
    dic[a] = b
List = sorted(dic)[::-1]
ans = 0
i = 1
while M > 0:
  M -= dic[i]
  ans = i
  i += 1
print(ans)


Fixed submission:
N,M = map(int,input().split())
dic = {}
for _ in range(N):
  a, b = map(int,input().split())
  if a in dic:
    dic[a] += b
  else:
    dic[a] = b
List = sorted(dic)
ans = 0
i = 0
while M > 0:
  M -= dic[List[i]]
  ans = List[i]
  i += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
O = input()
E = input()
Answer = ''
for i in range(len(O)):
  Answer = Answer + O[i]
  Answer = Answer + E[i]
print(Answer)

Fixed submission:
O = input()
E = input()
Answer = ''
for i in range(len(O)-1):
  Answer = Answer + O[i]
  Answer = Answer + E[i]
if len(E)==len(O):
  Answer = Answer + O[len(O)-1]
  Answer = Answer + E[len(E)-1]
else:
  Answer = Answer + O[len(O)-1]

print(Answer)
Buggy python submission (verdict: Runtime Error):
from collections import *
h,w,n = map(int,input().split())
dic = defaultdict(int)
for _ in range(n):
  a,b = map(int,input().split())
  for i in range(9):
    dic[a - i //3,b - i % 3] += 1
ans =[0]*n
for i, j in dic:
  ans[dic[i,j]] += h-1 > i > 0 < j < w -1
ans[0] = (h -2)*(w-2) - sum(ans)
for item in ans:
  print(item)

Fixed submission:
from collections import *
h,w,n = map(int,input().split())
dic = defaultdict(int)
for _ in range(n):
  a,b = map(int,input().split())
  for i in range(9):
    dic[a - i //3,b - i % 3] += 1
ans =[0]*10
for i, j in dic:
  ans[dic[i,j]] += h-1 > i > 0 < j < w -1
ans[0] = (h -2)*(w-2) - sum(ans)
for item in ans:
  print(item)
Buggy python submission (verdict: Runtime Error):
n = input()
k= input()
X = input()
y = input()
if n<=k:
    total = n*x
else:
    total = k*x + (n-k) * y
print(total)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
    total = n*x
else:
    total = k*x + (n-k)*y
print(total)
Buggy python submission (verdict: Runtime Error):
S = input()
for i in range(len(S)-1):
  for j in [i+1,i+2]:
    if S[i] == S[j]:
      print(i+1,j+1)
      exit()
print('-1 -1')

Fixed submission:
S = input()
for i in range(len(S)-2):
  for j in [i+1,i+2]:
    if S[i] == S[j]:
      print(i+1,j+1)
      exit()
if len(S) == 2 and S[0]==S[1]:
  print(1,2)
  exit()
print('-1 -1')

Buggy python submission (verdict: Time Limit Exceeded):
import collections
text = input()
candidates = []
m = len(text)
for i in range(m-1):
  for j in range(i+1,m):
    target = text[i:j+1]
    c = collections.Counter(target)
    mc = c.most_common()
    if mc[0][1]>(j-i+1)//2:
      print(i+1,j+1)
      exit()
print('-1 -1')

Fixed submission:
S = input()
for i in range(len(S)-2):
  for j in [i+1,i+2]:
    if S[i] == S[j]:
      print(i+1,j+1)
      exit()
if len(S) == 2 and S[0]==S[1]:
  print(1,2)
  exit()
print('-1 -1')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

sum=0
for i in range(len(str(n))):
    sum+=int(list(str(n))[i])

if sum%9==0:
    print('Yes')
else:
    print('No')

Fixed submission:
n=int(input())

sum=0
s=list(str(n))
for i in range(len(str(n))):
    sum+=int(s[i])

if sum%9==0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())
for q in range(1,n+1):
    ans=0
    for x in range(1,int(n**0.5)+1):
        for y in range(1,int((n-x**2)**0.5)+1):
            for z in range(1,int((n-x**2-y**2)**0.5)+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==q:
                    ans+=1
    print(ans)

Fixed submission:
n =int(input())
ans=[0]*n
for x in range(1,int(n**0.5)+1):
    for y in range(1,int((n-x**2)**0.5)+1):
        for z in range(1,int((n-x**2-y**2)**0.5)+1):
            p = x**2+y**2+z**2+x*y+y*z+z*x
            if 1<=p and p<=n:
                ans[p-1]+=1
for i in range(n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans=''
while(n>0):
     ans+=crd(ord('a')+n%26)
     n //=n
print(ans)

Fixed submission:
n = int(input())
ans=''
while(n>0):
     n -= 1
     ans += chr(ord('a')+n%26)
     n //= 26
print(ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0

l = {}
r = {}
for i in range(1,n+1):
    if i-a[i-1] in l:
        l[i-a[i-1]]+=1
    else:
        l[i-a[i-1]]=1

    
    
    if i+a[i-1] in r:
        r[i+a[i-1]]+=1
    else:
        r[i+a[i-1]]=1
    

for i,v in l.items():
    for j,w in r.items():
        if i==j:
            ans+=v*w


print(ans)





Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0

l = {}
r = {}
for i in range(1,n+1):
    if i-a[i-1] in l:
        l[i-a[i-1]]+=1
    else:
        l[i-a[i-1]]=1

    
    
    if i+a[i-1] in r:
        r[i+a[i-1]]+=1
    else:
        r[i+a[i-1]]=1
    

for i in l:
    if i in r:
        ans += l[i]*r[i]
    


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=[int(i) for i in input().split()]
h=[int(input()) for i in range(n)]
h.sort()
sub=[]

for i in range(n-k+1):
  sub.append(np.max(h[i:i+k])-np.min(h[i:i+k]))
print(np.min(sub))  
  
 

Fixed submission:
n,k=[int(i) for i in input().split()]
h=[int(input()) for i in range(n)]
h.sort()
sub=[]

for i in range(n-k+1):
  sub.append(h[i+k-1]-h[i])
print(min(sub))

Buggy python submission (verdict: Time Limit Exceeded):
n,k=[int(i) for i in input().split()]
h=[int(input()) for i in range(n)]
h.sort()
sub=[]

for i in range(n-k+1):
  sub.append(max(h[i:i+k])-min(h[i:i+k]))
print(min(sub))  
  
 

Fixed submission:
n,k=[int(i) for i in input().split()]
h=[int(input()) for i in range(n)]
h.sort()
sub=[]

for i in range(n-k+1):
  sub.append(h[i+k-1]-h[i])
print(min(sub))
Buggy python submission (verdict: Runtime Error):
import sys
from itertools import permutations
import math
from operator import itemgetter

s=input()
t=input()

flag2=True
for i in reversed(range(len(s))):
    if s[i]==t[0]:
        flag=True
        for j in range(1,len(t)):
            if (s[i+j]!=t[j]) & (s[i+j]!='?'):
                flag=False
        if flag:
            s=s[:i]+t+s[i+len(t):] 
            s=s.replace('?','a')
            print(s)
            flag2=False
            sys.exit()

if flag2:
    print('UNRESTORABLE')





Fixed submission:
import sys
from itertools import permutations
import math
from operator import itemgetter

s=input()
t=input()

if len(s)<len(t):
    print('UNRESTORABLE')
    sys.exit()

flag2=True
for i in reversed(range(len(s)-len(t)+1)):
    if (s[i]==t[0]) | (s[i]=='?'):
        flag=True
        for j in range(1,len(t)):
            if (s[i+j]!=t[j]) & (s[i+j]!='?'):
                flag=False
        if flag:
            s=s[:i]+t+s[i+len(t):] 
            s=s.replace('?','a')
            print(s)
            flag2=False
            sys.exit()

if flag2:
    print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  if(a+B+c==17):
    print("YES")
  else:
    print("NO")
else:
  print("NO")  

Fixed submission:
a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  if(a+b+c==17):
    print("YES")
  else:
    print("NO")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  ifa+B+c==17:
    print("YES")
  else:
    print("NO")
else:
  print("NO")  

Fixed submission:
a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  if(a+b+c==17):
    print("YES")
  else:
    print("NO")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  ifa+B+c==17:
    print(YES)
  else:
    print(NO)
else:
  print(NO)  

Fixed submission:
a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  if(a+b+c==17):
    print("YES")
  else:
    print("NO")
else:
  print("NO")