Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split())
a = list(map(int,input().split()))
kaburi = []

for i in range(n):
    if not a[i] in kaburi:
        kaburi.append(a[i])

kaisu = 0

while True:
    p = n
    q = 0
    if k >= len(kaburi):
        print(kaisu)
        break
    else:
        for j in range(len(kaburi)):
            p = min(p,a.count(kaburi[j]))
            if p > a.count(kaburi[j]):
                q = kaburi[j]
        kaisu += p
        print(p,q,kaisu,len(kaburi))
        kaburi.remove(q)

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
kosu = [0]*n
kaburi = []

for i in range(n):
    kosu[a[i]-1] += 1

for j in range(n):
    if kosu[j] != 0:
        kaburi.append(kosu[j])

kaburi.sort()
print(sum(kaburi[:len(kaburi)-k]))
n,m,K = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

#累積和
sa = [0]*len(a)
sa[0] = a[0]
for i,k in enumerate(a):
    if i == 0:continue
    sa[i] = sa[i-1] + a[i]
sb = [0]*len(b)
sb[0] = b[0]
for i,k in enumerate(b):
    if i == 0:continue
    sb[i] = sb[i-1] + b[i]

ai = len(a)-1
bi = len(b)-1

minu = sa[ai] + sb[bi]
while(minu > K):
    if (sa[ai] - sa[ai-1]) > (sb[bi] - sb[bi-1]):
        ai -= 1
        minu = sa[ai] + sb[bi]
    else:
        bi -= 1
        minu = sa[ai] + sb[bi]

print(sa)
print(sb)
print(ai + bi + 2)


### FIXED CODE ###

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])

#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if sa[i] > k:
        break
    while sb[m] > k - sa[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)
s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt):
    cou = 0
    for j in range(lt):
        if s[i+j] != t[j]:
            cou += 1
    A.append(cou)
print(min(A))

### FIXED CODE ###

s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt+1):
    cou = 0
    for j in range(lt):
        if s[i+j] == t[j]:
            cou += 1
    A.append(cou)
print(lt-max(A))
#!/usr/bin/env python

def search(i):
    global edge, child, visit
    work= {i}
    visit[i]= True
    #
    for e in edge[i]:
        if visit[e]: continue
        work|= search(e)
    #
    child[i]= work
    return work

import sys

n,q = [ int(x) for x in sys.stdin.readline().strip().split() ]
n1= n-1
sys.setrecursionlimit(2*10**5)
#
edge= [ [] for _ in range(n) ]
for i in range(n1):
    a,b = [ int(x)-1 for x in sys.stdin.readline().strip().split() ]
    edge[a].append( b )
    edge[b].append( a )
#

visit= [ False for _ in range(n) ]
child= [ set() for _ in range(n) ]
search(0)
#
query= dict()
for i in range(q):
    p,x= [ int(x) for x in sys.stdin.readline().strip().split() ]
    query[p-1]= query.get(p-1,0) + x
#
score= [ 0 for _ in range(n) ]
for p,x in query.items():
    for v in child[p]: score[v]+= x
#
for s in score: print( s,end= " " )


### FIXED CODE ###

import sys
from operator import itemgetter

n,q = [ int(x) for x in sys.stdin.readline().strip().split() ]
edge= [ [] for _ in range(n-1) ]
for i in range(n-1):
    edge[i] = [ int(x)-1 for x in sys.stdin.readline().strip().split() ]
edge.sort( key=itemgetter(0) )
c= [ 0 for _ in range(n) ]
for i in range(q):
    p,x= [ int(x) for x in sys.stdin.readline().strip().split() ]
    c[p-1]+= x
#
for a,b in edge: c[b]+= c[a]

print( *c )
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
diff = []
if M <= N:
    print(0)

for i in range(1, m):
    diff.append(x[i] - x[i - 1])
diff.sort()
print(sum(diff[:m-n]))


### FIXED CODE ###

n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
diff = []
if m <= n:
    print(0)
    exit()
for i in range(1, m):
    diff.append(x[i] - x[i - 1])
diff.sort()
print(sum(diff[:m-n]))
A, B = map(int, input().split)
sum = 0
if A < B:
  sum += B
  B = B-1
else:
  sum += A
  A = A-1

if A < B:
  sum += B
  B = B-1
else:
  sum += A
  A = A-1

print(sum)

### FIXED CODE ###

A, B = map(int, input().split())
sum = 0
if A < B:
  sum += B
  B = B-1
else:
  sum += A
  A = A-1
 
if A < B:
  sum += B
  B = B-1
else:
  sum += A
  A = A-1
 
print(sum)
A,B,N=map(int,input().split())
import numpy as np
print(max([int(A*x/B)-A*int(x/B) for x in np.arange(0,N+1,max((B/A),1))]))

### FIXED CODE ###

A,B,N=map(int,input().split())
def f(x):
  return int(A*x/B)-A*int(x/B)

print(f(min(N,B-1)))
Big=["A","B","c"]
Small=["a","b","c"]

N,K=map(int,input().split())
S=list(input())

for i in range(3):
  if S[K]==Big[i]:
    S[K]=Small[i]

print("".join(S))

### FIXED CODE ###

Big=["A","B","C"]
Small=["a","b","c"]

N,K=map(int,input().split())
S=list(input())

for i in range(3):
  if S[K-1]==Big[i]:
    S[K-1]=Small[i]

print("".join(S))
N = int(input())
b_list = []
for _ in range(N):
  b_list.append(int(input()))

i = b_list[0]
keiyu_list = [0 for _ in range(N)]
cnt=0
while keiyu_list[i]==0:
  i = b_list[i-1]
  keiyu_list[i]=1
  cnt+=1
  if i == 2:
    cnt+1
    break
if i==2:
  print(cnt)
else:
  print(-1)

### FIXED CODE ###

N = int(input())
b_list = []
for _ in range(N):
  b_list.append(int(input())-1)

i = 0
cnt=0
keiyu_list = [0 for _ in range(N)]

while keiyu_list[i]==0:
  keiyu_list[i]=1
  i = b_list[i]
  cnt+=1
  if i == 1:
    cnt+1
    break
if i==1:
  print(cnt)
else:
  print(-1)
import numpy as np
import itertools


def pd(s):
    #print(s)
    pass


# input
H, W, M = map(int, input().split())
ms = [
    [int(i) for i in input().split()]
    for m in range(M)
]
pd(f"{H=} {W=} {M=}")
pd(f"{ms=}")

rows = [0]*(H+1)
cols = [0]*(W+1)
bombs = np.zeros((H+1,W+1))
for h,w in ms:
    rows[h] += 1
    cols[w] += 1
    bombs[m[0]][m[1]] += 1

rmax = max(rows)
cmax = max(cols)
rmax_hs = [i for i, v in enumerate(rows) if v == rmax]
cmax_wh = [i for i, v in enumerate(cols) if v == cmax]

for h,w in itertools.product(rmax_hs, cmax_wh):
    if bombs[h][w] == 0:
        print(rmax + cmax)
        exit()
print(rmax + cmax - 1)


### FIXED CODE ###

import numpy as np
import itertools


def pd(s):
    #print(s)
    pass


# input
H, W, M = map(int, input().split())
ms = [
    [int(i) for i in input().split()]
    for m in range(M)
]
pd(f"{H=} {W=} {M=}")
pd(f"{ms=}")

rows = [0]*(H+1)
cols = [0]*(W+1)
bombs = {}
for m in ms:
    h = m[0]
    w = m[1]
    rows[h] += 1
    cols[w] += 1
    bombs[f"{h},{w}"] = True

rmax = max(rows)
cmax = max(cols)
rmax_hs = [i for i, v in enumerate(rows) if v == rmax]
cmax_wh = [i for i, v in enumerate(cols) if v == cmax]

for m in itertools.product(rmax_hs, cmax_wh):
    h = m[0]
    w = m[1]
    if f"{h},{w}" not in bombs:
        print(rmax + cmax)
        exit()
print(rmax + cmax - 1)
def rn(x):
    z = list(map(int,list(str(x))))
    N = len(z)
    z.insert(0,0)
    dp = [[[0 for _ in range(10)] for _ in range(2)] for _ in range(N+1)]
    dp[1][0][z[1]]=1
    for j in range(z[1]):
        cp[1][1][j]=1
    for i in range(2,N+1):
        if abs(z[i]-z[i-1])<=1:
            dp[i][0][z[i]] = 1
        for j in range(10):
            dp[i][1][j] = dp[i-1][0][z[i-1]]*int(j<z[i])*int(abs(j-z[i-1])<=1)
            for k in range(10):
                dp[i][1][j] += dp[i-1][1][k]*int(abs(j-k)<=1)
    cnt = dp[N][0][z[N]]
    for j in range(10):
        cnt += dp[N][1][j]
    return cnt
K = int(input())
high = 3234566667
low = 0
while high-low>1:
    mid = (high+low)//2
    if rn(mid)>=K:
        high = mid
    else:
        low = mid
print(high)

### FIXED CODE ###

def f(N): # N is string
    k = len(N)
    dp = [[[[0 for _ in range(10)] for _ in range(2)] for _ in range(2)] for _ in range(k+1)]
    for j in range(10):
        dp[1][0][0][j]=(j==int(N[0]))
        dp[1][0][1][j]=0
        dp[1][1][0][j]=(j<int(N[0]))
        dp[1][1][1][j]=0
    for i in range(2,k+1):
        for j in range(10):
            for m in range(10):
                dp[i][0][1][j] += (dp[i-1][0][0][m]+dp[i-1][0][1][m])*(abs(m-j)<=1)*(j==int(N[i-1]))
            dp[i][1][0][j]=1
            for m in range(10):
                dp[i][1][1][j] += (dp[i-1][0][0][m]+dp[i-1][0][1][m])*(abs(m-j)<=1)*(j<int(N[i-1]))\
                                    +dp[i-1][1][1][m]*(abs(m-j)<=1)
            for m in range(1,10):
                dp[i][1][1][j] += dp[i-1][1][0][m]*(abs(m-j)<=1)
    cnt = 0
    for j in range(10):
        cnt += dp[k][0][0][j]+dp[k][0][1][j]+dp[k][1][0][j]+dp[k][1][1][j]
    return cnt-1
K = int(input())
low = 0
high = 4*10**9
while high-low>1:
    mid = (high+low)//2
    n = f(str(mid))
    if n<K:
        low = mid
    elif n>=K:
        high = mid
print(high)
l = [int(input()) for _ in range(3)]
s = sorted(l)[::-1]
ans = s[0] + s[1]
print(ans)

### FIXED CODE ###

a,b,c = sorted(map(int, input().split()))
ans = a + b
print(ans)
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]*(N+1)
b = [0]*(M+1)

#累積和の計算
for i in range(1, N+1):
    a[i] = a[i-1] + A[i-1]
for j in range(1, M+1):
    b[j] = b[j-1] + B[j-1]

ans = 0
for i in range(N+1):
    left = 0
    right = M+1
    while left <= right:
        mid = (left + right)//2
        if b[mid] < K - a[i]:
            left = mid + 1
        elif b[mid] > K - a[i]:
            right = mid - 1
    if b[mid] <= K - a[i]:
        j = mid
    else:
        j = mid - 1
    ans = max(ans, i + j)
print(ans)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]*(N+1)
b = [0]*(M+1)
for i in range(1, N+1):
    a[i] = a[i-1] + A[i-1]
for j in range(1, M+1):
    b[j] = b[j-1] + B[j-1]

ans = 0
j = M
for i in range(N+1):
    if K - a[i] < 0:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
H, W = list(map(int, input().split()))
s = []
s.append(['.']*(W+2))
for i in range(W):
    #二次元配列に入力を入れる
    array =['.']
    array.extend(list(input()))
    array.extend(['.'])
    s.append(array)
s.append(['.']*(W+2))
count = 0
for i in range(1,W+1):
    for j in range(1,H+1):
        if(s[i][j] == '#' and s[i][j-1] != '#' and s[i][j+1] != '#' and s[i-1][j] != '#' and s[i+1][j] != '#'):
            count += 1

if (count==0):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

H, W = list(map(int, input().split()))
s = []
s.append(['.']*(W+2))
for i in range(H):
    #二次元配列に入力を入れる
    array =['.']
    array.extend(list(input()))
    array.extend(['.'])
    s.append(array)
s.append(['.']*(W+2))
#print(s)
count = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        if(s[i][j] == '#' and s[i][j-1] != '#' and s[i][j+1] != '#' and s[i-1][j] != '#' and s[i+1][j] != '#'):
            count = count+1

if (count==0):
    print("Yes")
else:
    print("No")
N = int(input())
a=[list(map(int,input().split())) for i in range(N)]
count = 0

for i in range(N+1):
  count += a[i][1] - a[i][0] + 1
  
print(count)
  


### FIXED CODE ###

N = int(input())
a=[list(map(int,input().split())) for i in range(N)]
count = 0

for i in range(N):
  count += a[i][1] - a[i][0] + 1
  
print(count)
a,b = int(x) for x in input().split()
if a > 0 and a < 10:
    if b > 0 and b < 10:
        print(a*b)
     else:
         print(-1)
else:
    print(-1)

### FIXED CODE ###

a,b = (int(x) for x in input().split())
if a > 0 and a < 10:
    if b > 0 and b < 10:
        print(a*b)
    else:
         print(-1)
else:
    print(-1)
4
20 18 2 18

### FIXED CODE ###

def li():
    return list(map(int, input().split()))


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


def ii():
    return int(input())


N = ii()
a = li()

a.sort(reverse=True)

alice = 0
bob = 0

for i in range(len(a)):
    if i % 2 == 0:
        alice += a[i]
    else:
        bob += a[i]

print(alice - bob)
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
  int a,b,c;
  cin >>a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c << endl;
}


### FIXED CODE ###

a,b,c=map(int,input().split())
print(c,a,b)
import sys
sys.setrecursionlimit(2*10**5)
def parent(array,count,index,root):
    array[index-1].remove(root)
    count[index-1]+=count[root-1]
    for i in array[index-1]:
        parent(array,count,i,index)
num,q=map(int,input().split())
counter=[0 for _ in range(num)]
roots=[set() for _ in range(num)]
for _ in range(num-1):
    a,b=map(int,input().split())
    roots[a-1].add(b)
    roots[b-1].add(a)
for _ in range(q):
    p,x=map(int,input().split())
    counter[p-1]+=x
for ele in roots[0]:
    parent(roots,counter,ele,1)
print(" ".join([str(counter[i]) for i in range(num)]))

### FIXED CODE ###

a=int(input())
s=input()
if a >= 3200:
    print(s)
else:
    print("red")
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())

grid = [["#"]*(W+2) for _ in range(H+2)]

for i in range(1, H+1):
    l = list(input().split())
    for j in range(1, W+1):
        grid[i][j] = l[j-1]

for i in grid:
    print(" ".join(i))


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())

grid = [["#"]*(W+2) for _ in range(H+2)]

for i in range(1, H+1):
    for j, c in enumerate(input()):
        grid[i][j+1] = c

for i in grid:
    print("".join(i))
p = int(input())
a_list = list(map(int, input().split()))
r_list = [0] * p

fact = [0] * p
fact[0] = 1
for i in range(1, p):
    fact[i] = fact[i - 1] * i % p

fact_inv = [pow(fact[i], p-2, p) for i in range(p)]

ncr = [(fact[p-1] * fact_inv[p-1-i] * fact_inv[i]) % p for i in range(p)]

for j in range(p):
    if a_list[j] == 0:
        continue
    for i in range(p):
        s = (ncr[i] * pow(-j, p-1-i, p)) % s
        r_list[i] -= s
    r_list[0] += 1


print(" ".join([str(r % p) for r in r_list]))


### FIXED CODE ###

p = int(input())
a_list = list(map(int, input().split()))
r_list = [0] * p

fact = [0] * p
fact[0] = 1
for i in range(1, p):
    fact[i] = fact[i - 1] * i % p

fact_inv = [0] * p
fact_inv[-1] = pow(fact[-1], p-2, p)
for i in range(p-2, -1 ,-1):
    fact_inv[i] = (fact_inv[i+1] * (i+1)) % p

ncr = [(fact[p-1] * fact_inv[p-1-i] * fact_inv[i]) % p for i in range(p)]

for j in range(p):
    if a_list[j] == 0:
        continue
    k = 1
    for i in range(p-1, -1, -1):
        r_list[i] -= ncr[i] * k
        r_list[i] %= p
        k *= -j
        k %= p
    r_list[0] += 1

r_list[0] %= p
print(*r_list)
N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

if N < T:
    print('NO')
    exit()

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES') 

### FIXED CODE ###

N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

if N < M:
    print('NO')
    exit()

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES')
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if b[0]==0:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1
if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]
if nb>=k:
    ans=min(ans,b[k-1])
if nb==0:
    print(-a[-k])
    exit()
exit()
if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)


### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if 0 in x:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1

if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]

if nb>=k:
    ans=min(ans,b[k-1])

if nb==0:
    print(-a[-k])
    exit()

if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n, m = map(int, input().split())
g = [[] for _ in range(n)]

if n > 2000 or m > 2000:
    exit()

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

q = int(input())
if q > 2000:
    exit()

query = [list(map(int, input().split())) for _ in range(q)]

color = [0] * n

def dfs(node, dist, dist_max, col, pre_node):
    if dist > dist_max:
        return
    if color[node] == 0:
        color[node] = col
    if dist == dist_max:
        return
    for next_node in g[node]:
        if next_node == pre_node:
            continue
        dfs(next_node, dist+1, dist_max, col, node)

for v, d, c in query[::-1]:
    v -= 1
    dfs(v, 0, d, c, -1)

for co in color:
    print(co)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))

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

for l in range(1, n+1):
    for i in range(n - l + 1):
        j = i + l
        if (n - l) % 2 == 0:
            dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1] + a[j-1])
        else:
            dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1] - a[j-1])

print(dp[0][n])
a

### FIXED CODE ###

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

studentlis = []
for _ in range(N):
    a, b = map(int, input().split())
    studentlis.append([a,b])

checkpointlis = []
for _ in range(M):
    c, d = map(int, input().split())
    checkpointlis.append([c,d])

ans_lis = []


for i in range(len(studentlis)):
    ans = int(10**100)

    tmpstudentlis = studentlis[i]

    x1 = tmpstudentlis[0]
    y1 = tmpstudentlis[1]
    
    for j in range(len(checkpointlis)):
        tmpcheckpointlis = checkpointlis[j]

        x2 = tmpcheckpointlis[0]
        y2 = tmpcheckpointlis[1]
        
        distance = (abs(x1-x2) + abs(y1-y2))

        if distance < ans:
            ans = distance
            num = j

        if j == len(checkpointlis)-1:
            ans_lis.append(num+1)


for i in ans_lis:
    print(i)
def aux(x):
    while 29<x>=30:
        return'Yes'
    return 'No

### FIXED CODE ###

if 30<=int(input()):
    print('Yes')
else:
    print('No')
def main10():
    buf = int(input(""));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = [];
    for i in range(buf):
        buf2.append(int(strbufs[i]));
    if len(buf2) == 1:
        return("YES");
    else:
        ki = 0;
        for i in range(buf):
            if buf2 % 2 == 1:
                ki += 1;
        if ki % 2 == 0:
            print("YES");
        else:
            print("NO");



if __name__ == '__main__':
    main10()

### FIXED CODE ###

def main10():
    buf = int(input(""));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = [];
    for i in range(buf):
        buf2.append(int(strbufs[i]));
    if len(buf2) == 1:
        return("YES");
    else:
        ki = 0;
        for i in range(buf):
            if buf2[i] % 2 == 1:
                ki += 1;
        if ki % 2 == 0:
            print("YES");
        else:
            print("NO");



if __name__ == '__main__':
    main10()
s_d=input()
t=input()
for i in range(len(s_d)-len(t),-1,-1):
    flag = True
    for j,k in zip(s_d[i:i+len(t)],t):
        if j != "?" and j != k:
            flag=False
            break
    if flag:
        s_d = s_d[:i]+t+s_d[i+len(t)+1:]
        break
if not flag:
    print("UNRESTORABLE")
else:
    for i in s_d:
        if i == "?":
            print("a",end="")
        else:
            print(i,end="")

### FIXED CODE ###

s_d=input()
t=input()
if len(s_d) < len(t):
    print("UNRESTORABLE")
    exit()
for i in range(len(s_d)-len(t),-1,-1):
    flag = True
    for j,k in zip(s_d[i:i+len(t)],t):
        if j != k:
            flag=False
            break
    if flag:
        s_d = s_d[:i]+t+s_d[i+len(t):]
        break
if not flag:
    for i in range(len(s_d) - len(t), -1, -1):
        flag = True
        for j, k in zip(s_d[i:i + len(t)], t):
            if j != "?" and j != k:
                flag = False
                break
        if flag:
            s_d = s_d[:i] + t + s_d[i + len(t):]
            break
if not flag:
    print("UNRESTORABLE")
else:
    for i in s_d:
        if i == "?":
            print("a",end="")
        else:
            print(i,end="")
a,b=map(int,input().split())
print(b-(b-a)(b-a+1)//2)

### FIXED CODE ###

a,b=map(int,input().split())
print((b-a)*(b-a+1)//2-b)
import numpy as np
N,M = map(int,input().split())
A = np.array([0]+[int(x) for x in input().split()],dtype=np.int64)
A_cum = np.mod(A.cumsum(),M)

counter = np.bincount(A_cum, dtype=np.int64)
counter[0] += 1 # empty
answer = (counter * (counter-1)).sum() // 2
print(answer)

### FIXED CODE ###

import numpy as np
from collections import Counter

N,M = map(int,input().split())
A = np.array([0]+[int(x) for x in input().split()],dtype=np.int64)
A_cum = np.mod(A.cumsum(),M)

c = Counter(A_cum)

answer = 0
for x in c.values():
  answer += x*(x-1)//2
print(answer)
x=int(input())
print(x//3600:a%3600//60:x%60)


### FIXED CODE ###

x=int(input())
print(x//3600,x%3600//60,x%60,sep=':')
n, a, b, c = map(int, input().split())
d = {'A':a, 'B':b, 'C':c}
ans = []
def move(inc, dec):
    d[inc]+=1
    d[dec]-=1
    ans.append(inc)
q = []
for i in range(n):
    q.append(input())
for i in range(n):
    x = q[i][0]
    y = q[i][1]
    if d[x] == 0 and d[y] == 0:
        print("No")
        exit()
    if d[x] == 1 and d[y] == 1:
        if i == n-1:
            move(x, y)
        if x in q[i+1]:
            move(x, y)
        else:
            move(y, x)
    else:
        if d[x] >= d[y]:
            move(y, x)
        else:
            move(x, y)
print("Yes")
print(*ans, sep = '\n')

### FIXED CODE ###

n, a, b, c = map(int, input().split())
d = {'A':a, 'B':b, 'C':c}
ans = []
def move(inc, dec):
    d[inc]+=1
    d[dec]-=1
    ans.append(inc)
q = []
for i in range(n):
    q.append(input())
for i in range(n):
    x = q[i][0]
    y = q[i][1]
    if d[x] == 0 and d[y] == 0:
        print("No")
        exit()
    if d[x] == 1 and d[y] == 1:
        if i == n-1:
            move(x, y)
            continue
        if x in q[i+1]:
            move(x, y)
        else:
            move(y, x)
    else:
        if d[x] >= d[y]:
            move(y, x)
        else:
            move(x, y)
print("Yes")
print(*ans, sep = '\n')