Harryxun/stf_run huggingface dataset:
import itertools
from collections import Counter

N = int(input())
S = input()

C=Counter(S)
r = C['R']
g = C['G']
b = C['B']


cnt = r * g * b

for i in range(0,N-2):
    for j in range(i,N-1):
        k = j + j - i
        if k < N:
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]):
                cnt -= 1

print(cnt)

### FIXED CODE ###

import itertools
from collections import Counter

N = int(input())
S = input()

C=Counter(S)
r = C['R']
g = C['G']
b = C['B']


cnt = r * g * b

for i in range(0,N-2):
    for j in range(i,N-1):
        k = j + j - i
        if k < N:
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                cnt -= 1

print(cnt)
N=int(input())
A=list(map(int,input().split()))
g='APPROVED'
for i in A:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            g='DENIED'
            break
print(g)

### FIXED CODE ###

A=list(map(int,input().split()))
B=len(set(A))
if B==2:
    print('Yes')
else:
    print('No')
n = int(input())
c = 0 
for _ in range(n):
  n,m = map(int,input().split())
  c += m-n+1
print(count)

### FIXED CODE ###

n = int(input())
c = 0 
for _ in range(n):
  n,m = map(int,input().split())
  c += m-n+1
print(c)
N = int(input())
S = input()
ans = ""
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(S)):
    if a.index(S[i]) + N > 26:
        ans += a[a.index(S[i]) + N - 26]
    else:
        ans += a[a.index(S[i]) + N]

print(ans)


### FIXED CODE ###

N = int(input())
S = input()
ans = ""
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(S)):
    if a.index(S[i]) + N > 25:
        ans += a[a.index(S[i]) + N - 26]
    else:
        ans += a[a.index(S[i]) + N]

print(ans)
a, b = map(int, input())
th = a-1
if a<b:
    print(th)
else:
    print(th+1)

### FIXED CODE ###

a, b = map(int, input().split())
th = a-1
if b>=a:
    th+=1
print(th)
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    def COMinit(n,MOD):
        fac,finv,inv=[0]*(n+1),[0]*(n+1),[0]*(n+1)
        fac[0]=fac[1]=1
        finv[0]=finv[1]=1
        inv[1]=1
        for i in range(2,(n+1)):
            fac[i]=fac[i-1]*i%MOD
            inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
            finv[i]=finv[i-1]*inv[i]%MOD
        return fac,finv,inv
    
    def COM(n, k, MOD):
        fac,finv,inv=COMinit(n,MOD)
        if n<k or n<0 or k<0:
            return 0
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD
    
    for i in range(K):
        print(COM((K-2)*2,i,MOD)*COM(N-K+1,i+1,MOD)%MOD)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    def COMinit(n,MOD):
        fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
        fac[0]=fac[1]=1
        finv[0]=finv[1]=1
        inv[1]=1
        for i in range(2,(n+1)):
            fac[i]=fac[i-1]*i%MOD
            inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
            finv[i]=finv[i-1]*inv[i]%MOD
        return fac,finv,inv
    
    def COM(n, k, MOD):
        if n<k or n<0 or k<0:
            return 0
        fac,finv,inv=COMinit(n,MOD)
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD
    
    for i in range(K):
        print(COM(K-1,i,MOD)*COM(N-K+1,i+1,MOD)%MOD)

if __name__ == '__main__':
    main()
def f(level,x):
    if level==0: return x

    if x in [1,0]:
        return 0
    elif x==b[level][0]:
        return b[level][1]
    elif 2<=x<b[level-1][0]+2:
        return f(level-1,x-1)
    elif x==b[level-1][0]+2:
        return b[level-1][1]+1
    elif b[level-1][0]+2<x<b[level][0]:
        return b[level-1][1]+1+f( level-1, x-(b[level-1][0]+2))

N,X=map(int,input().split())
b=[[1,1] for i in range(N+1)]
for i in range(1,N+1):
    b[i][0]=b[i-1][0]*2+3
    b[i][1]=b[i-1][1]*2+1

print(f(N,X))

### FIXED CODE ###

n=int(input())

dic={22:"Christmas Eve Eve Eve",23:"Christmas Eve Eve",24:"Christmas Eve",25:"Christmas"}

print(dic[n])
def bin_search(lis, target, low, high):
    while high-low!=1:
        mid = (low+high) // 2
        #print(low, mid, high)
        if lis[mid] == target:
            return mid, 1
        elif lis[mid] > target:
            high = mid
        else:
            low = mid
    if lis[low] == target:
        return low, 1
    elif lis[high] < target:
        return high, 0
    else:
        return low, 0
    
    
n, m = map(int, input().split())
a = [int(i) for i in input().split(" ")]
bc = [[int(i) for i in input().split(" ")] for i in range(m)]
bc = sorted(bc, key=lambda x: x[1])
bc.reverse()
a = sorted(a)
ind = 0
ans = 0
flag = 0
for i in bc:
    if ind >= n:
        break
    if a[min(ind+i[0], n-1)] <= i[1]:
        ans += min(i[0], n-ind)*i[1]
        ind += i[0]
    elif a[ind] >= i[1]:
        ans += sum(a[ind:])
        flag = 1
        break
    else:
        tm = bin_search(a[ind:ind+i[0]], i[1], 0, i[0])
        ans += i[1]*(tm[0]+1)
        ind += tm[0]+1
        ans += sum(a[ind:])
        flag = 1
        break
if flag == 0:
    ans += sum(a[ind:])
print(ans)

### FIXED CODE ###

def bin_search(lis, target, low, high):
    while high-low!=1:
        mid = (low+high) // 2
        #print(low, mid, high)
        if lis[mid] == target:
            return mid, 1
        elif lis[mid] > target:
            high = mid
        else:
            low = mid
    if lis[low] == target:
        return low, 1
    elif lis[high] < target:
        return high, 0
    else:
        return low, 0
    
    
n, m = map(int, input().split())
a = [int(i) for i in input().split(" ")]
bc = [[int(i) for i in input().split(" ")] for i in range(m)]
bc = sorted(bc, key=lambda x: x[1])
bc.reverse()
a = sorted(a)
ind = 0
ans = 0
flag = 0
for i in bc:
    if ind >= n:
        break
    if a[min(ind+i[0], n-1)] <= i[1]:
        ans += min(i[0], n-ind)*i[1]
        ind += i[0]
    elif a[ind] >= i[1]:
        ans += sum(a[ind:])
        flag = 1
        break
    else:
        tm = bin_search(a[ind:min(ind+i[0], n-1)], i[1], 0, min(i[0], n-ind))
        ans += i[1]*(tm[0]+1)
        ind += tm[0]+1
        ans += sum(a[ind:])
        flag = 1
        break
if flag == 0:
    ans += sum(a[ind:])
print(ans)
A,B,K = [int(i) for i in input().split()]
if (A>B):
    A,B=B,A
f=[]
j=A
for i in range(1,A):
    if (A % i == 0 and B % i == 0):
        if (i>=j):
            break
        j=int(A/i)
        f.append(i)
        if (i!=j and B % j == 0):
            f.append(j)
f.sort(reverse=True)
if A==1:
    print(1)
else:
    print(f[K-1])



### FIXED CODE ###

A,B,K = [int(i) for i in input().split()]
if (A>B):
    A,B=B,A
k=0
for i in reversed(range(1,A+1)):
    if (A % i == 0 and B % i == 0):
        k+=1
    if (k==K):
        print(i)
        break
a,b,c,d=map(int,input().split())
print(max[a*c,a*d,b*c,b*c])

### FIXED CODE ###

a,b,c,d=map(int,input().split())
print(max([a*c,a*d,b*c,b*d]))
n = int(input())
ans = 0
#print('start')
while n!=0:
    ans += n%10
    n = int(n/10)
    #print(ans)
    #print(n)
if ans%9==0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = input()
ans = 0
for i in range(len(n)):
    ans += int(n[i])
if(ans%9==0):
    print('Yes')
else:
    print('No')
N, Q = map(int, input().split())

S = input()

lr = []

for q in range(Q):
  lr.append(input().split())
  
for q in lr:
  st = q[0]-1
  en = q[1]
  s = S[st:en]
  print(s.count('AC'))

### FIXED CODE ###

import sys
 
N, Q = map(int, input().split())
 
S = input()
 
lr = [list(map(int, i.split())) for i in sys.stdin]

Sum = [0]

sum_ = 0

for i in range(len(S)-1):
  if S[i] == 'A' and S[i+1] == 'C':
    sum_ += 1
  Sum.append(sum_)

for  q in range(Q):
  ans = Sum[lr[q][1]-1]-Sum[lr[q][0]-1]
  print(ans)
from scipy.special import comb, factorial

n, k = tuple(map(int, input().split(' ')))
for i in range(1, k+1):
    print(comb(k-1, i-1, exact=True) * (factorial(n-k+1, exact=True) // (factorial(n-k-i+1, exact=True) * factorial(i, exact=True))) % (10 ** 9 + 7))


### FIXED CODE ###

from scipy.misc import comb

n, k = tuple(map(int, input().split(' ')))
for i in range(1, k+1):
    # 青玉k個をi個の群に分割する。これはk個の青玉の間のk-1箇所のいずれかからi-1個を選んで仕切りとすることで可能
    # これはk-1Ci-1
    # その上で、できたi個の群の前後i+1箇所に赤玉を埋めていく
    # はじめに、i個の群の内側であるi-1箇所には必ず1つ以上赤玉が存在しなければならないので、予めi-1個の赤玉を配置したものとみなす
    # 結局、n-k-(i-1)=n-k-i+1個の赤玉をi+1箇所のどこかにおいていくことと同値
    # これはn-k-i+1個の赤玉とi個の仕切りの並べ方であるので、(n-k+1)Ci
    # 以上より、求める答えはk-1Ci-1 * (n-k+1)Ci
    s = comb(k-1, i-1, exact=True) * comb(n-k+1, i, exact=True)
    print(int(s) % (10 ** 9 + 7))
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限x
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X, Y = map(int, input().strip().split())

min_num = min(X,Y)
z = min_num//3

tX = z * 3
tY = z * 3
cA = z
cB = z

rx = X - tX
ry = Y - tY
if rx == 0 and ry == 0:
    print(cmb(cA+cB, cA, mod))
    exit(0)
if rx * 2 == ry:
    cA += rx
elif ry * 2 == rx:
    cB += ry
else:
    raise Exception
    print(0)
    exit(0)
print(cmb(cA+cB, cA, mod))


### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限x
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X, Y = map(int, input().strip().split())
if (X + Y) % 3 != 0:
    print(0)
    exit(0)

a = (2*X-Y)//3
b = (2*Y-X)//3

if a < 0 or b < 0:
    print(0)
    exit(0)

print(cmb(a+b,a, mod))
class Union_find:
    def __init__(self,n):
        self.group=[i for i in range(n)]
    
    def root(self,x):
        if(self.group[x]==x):
            return x
        else:
            tmp=self.root(self.group[x])
            self.group[x]=tmp
            return tmp
    
    def make(self,x,y):
        self.group[self.root(x)]=y
    
    def judge(self,x,y):
        if(self.root(x)==self.root(y)):
            return True
        else:
            return False


n,m=map(int,input().split())
T=Union_find(n+1)
P=list(map(int,input().split()))

for _ in range(m):
    
    x,y=map(int,input().split())
    T.make(x,y)


ans=0

for i in range(n):
    if(T.judge(P[i],i+1)):
        ans+=1

print(ans)

### FIXED CODE ###

class Union_find:
    def __init__(self,n):
        self.group=[i for i in range(n)]
    
    def root(self,x):
        if(self.group[x]==x):
            return x
        else:
            tmp=self.root(self.group[x])
            self.group[x]=tmp
            return tmp
    
    def make(self,x,y):
        self.group[self.root(x)]=self.root(y)
    
    def judge(self,x,y):
        if(self.root(x)==self.root(y)):
            return True
        else:
            return False


n,m=map(int,input().split())
T=Union_find(n+1)
P=list(map(int,input().split()))

for _ in range(m):
    
    x,y=map(int,input().split())
    T.make(x,y)


ans=0

for i in range(n):
    if(T.judge(P[i],i+1)):
        ans+=1

print(ans)
n,k=list(map(int,input().split(" ")))
s=list(input())
s_str=""
s[k-1]=s[k-2].lower()
for i in s:
    s_str +=s[i]
print(s_str)


### FIXED CODE ###

n,k=list(map(int,input().split(" ")))
s=list(input())
s_str = ""
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
for i in s:
    s_str += i
print(s_str)
import numpy as np
N = int(input())
lis = np.zeros((101,101))
s = list()
for k in range(N):
    tmp = list()
    x,y,h = map(int,input().split())
    if s:
        if len(s) == 1:
            break
        for i in s:
            if i[2] == h+abs(i[0]-x)+abs(i[1]-y):
                tmp.append(i)
        s = tmp
    else:
        for i in range(101):
            for j in range(101):
                if lis[i][j] == 0:
                    lis[i][j] = h+abs(i-x)+abs(j-y)
                elif lis[i][j] == h+abs(i-x)+abs(j-y):
                    s.append([i,j,lis[i][j]])
print(s[0][0], s[0][1], int(s[0][2]))

### FIXED CODE ###

import numpy as np
N = int(input())
lis = np.zeros((101,101))
s = list()
for k in range(N):
    tmp = list()
    x,y,h = map(int,input().split())
    if h == 0:
        continue
    if s:
        if len(s) == 1:
            break
        for i in s:
            if i[2] == h+abs(i[0]-x)+abs(i[1]-y):
                tmp.append(i)
        s = tmp
    else:
        for i in range(101):
            for j in range(101):
                if lis[i][j] == 0:
                    lis[i][j] = h+abs(i-x)+abs(j-y)
                elif lis[i][j] == h+abs(i-x)+abs(j-y):
                    s.append([i,j,lis[i][j]])
else:
    for i in range(101):
        for j in range(101):
            if lis[i][j] == 1:
                s.append([i,j,lis[i][j]])
print(s[0][0], s[0][1], int(s[0][2]))
n=int(input())
s=list(str(n))
a=n%(sum(s))

if a==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n=int(input())
s=list(str(n))
for i in range(len(s)):
  s[i]=int(s[i])
b=sum(s)
a=n%b

if a==0:
  print('Yes')
else:
  print('No')
S = input().strip()
T = input().strip()

ds = {}
dt = {}
ans = 'Yes'
for s, t in zip(S, T):
    if s not in ds or ds[s] == t:
        ds[s] = t
    else:
        ans = 'No'
        break
    if t not in dt or dt[s] == s:
        dt[t] = s
    else:
        ans = 'No'
        break
print(ans)

### FIXED CODE ###

S = input().strip()
T = input().strip()

ds = {}
dt = {}
ans = 'Yes'
for s, t in zip(S, T):
    if s not in ds or ds[s] == t:
        ds[s] = t
    else:
        ans = 'No'
        break
    if t not in dt or dt[t] == s:
        dt[t] = s
    else:
        ans = 'No'
        break
print(ans)
import sys
def MI(): return map(int, sys.stdin.readline().split())

H,W = MI()
s = [list(input()) for _ in range(H)]
dp = [[0 for _ in range(W)] for _ in range(H)]

if s[0][0]=='#':
	dp[0][0] = 1

for i in range(W-1):
	if s[0][i+1]=='#' and s[0][i]=='.':
		dp[0][i+1] = dp[0][i] + 1
	else:
		dp[0][i+1] = dp[0][i]

for i in range(H-1):
	if s[i+1][0]=='#' and s[i][0]=='.':
		dp[i+1][0] = dp[i][0] + 1
	else:
		dp[i+1][0] = dp[i][0]

def next(start, goal, start_value):
	if start=='.' and goal=='#':
		start_value += 1
	return start_value

for i in range(1,W):
	for j in range(1,H):
		# print(next(s[i][j-1],s[i][j],dp[i][j-1]),next(s[i-1][j],s[i][j],dp[i-1][j]))
		dp[i][j] = min(next(s[i][j-1],s[i][j],dp[i][j-1]), next(s[i-1][j],s[i][j],dp[i-1][j]))



### FIXED CODE ###

import sys
def MI(): return map(int, sys.stdin.readline().split())

H,W = MI()
s = [list(input()) for _ in range(H)]
dp = [[0 for _ in range(W)] for _ in range(H)]

if s[0][0]=='#':
	dp[0][0] = 1

for i in range(W-1):
	if s[0][i+1]=='#' and s[0][i]=='.':
		dp[0][i+1] = dp[0][i] + 1
	else:
		dp[0][i+1] = dp[0][i]

for i in range(H-1):
	if s[i+1][0]=='#' and s[i][0]=='.':
		dp[i+1][0] = dp[i][0] + 1
	else:
		dp[i+1][0] = dp[i][0]

def next(start, goal, start_value):
	if start=='.' and goal=='#':
		start_value += 1
	return start_value

for i in range(1,H):
	for j in range(1,W):
		# print(next(s[i][j-1],s[i][j],dp[i][j-1]),next(s[i-1][j],s[i][j],dp[i-1][j]))
		dp[i][j] = min(next(s[i][j-1],s[i][j],dp[i][j-1]), next(s[i-1][j],s[i][j],dp[i-1][j]))

print(dp[H-1][W-1])
s=input()
b=input()
n=input()
list=[s,b,n]
print(len(set(list)))

### FIXED CODE ###

s=list(input().split())
print(len(set(s)))
import sys


def input():
    return sys.stdin.readline().strip()


def dfs(v):
    if dp[v] > 0:
        return dp[v]
    res = 0
    for nv in g[v]:
        res = max(res, dfs(nv) + 1)
    dp[v] = res
    return res


n, m = map(int, input().split())
g = {i: set() for i in range(1, n + 1)}
for _ in range(m):
    x, y = map(int, input().split())
    g[x].add(y)

dp = [-1] * (n + 1)
for v in g:
    dp[v] = max(dp[v], dfs(v))
    print(v, dp)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)


def input():
    return sys.stdin.readline().strip()


def dfs(v):
    if dp[v] >= 0:
        return dp[v]
    res = 0
    for nv in g[v]:
        res = max(res, dfs(nv) + 1)
    dp[v] = res
    return res


n, m = map(int, input().split())
g = {i: set() for i in range(1, n + 1)}
for _ in range(m):
    x, y = map(int, input().split())
    g[x].add(y)

dp = [-1] * (n + 1)
for v in g:
    dp[v] = max(dp[v], dfs(v))
print(max(dp))
import numpy as np
s = input()
# s = "RRLLLLRLRRLL"*10000

n = len(s)

pop = [0]*n

for i in range(n):
    if s[i] == "L":
        # iより左でもっとも右のRをみつける
        for dx in range(1, n-1):
            if s[i-dx] == "R":
                break
        idx = i-dx
        
        if (idx - i)%2 == 1:
            pop[idx+1] += 1
        else:
            pop[idx] += 1
    else:
        # iより右でもっとも左のLをみつける
        for dx in range(1, n-1):
            if s[i+dx] == "L":
                break
        idx = i+dx
        if (idx - i)%2 == 1:
            pop[idx-1] += 1
        else:
            pop[idx] += 1
print(" ".join(map(str, pop)))   

### FIXED CODE ###

import numpy as np
s = input()
n = len(s)

pop = [0]*n

lastR = 0
for i in range(n):
    if s[i] == "L":
        if (lastR - i)%2 == 1:
            pop[lastR+1] += 1
        else:
            pop[lastR] += 1
    else:
        lastR = i
            
lastL = n
for i in range(n-1, -1, -1):  
    if s[i] == "R":
        if (lastL - i)%2 == 1:
            pop[lastL-1] += 1
        else:
            pop[lastL] += 1
    else:
        lastL = i
        
print(" ".join(map(str, pop)))
a,b=map(int,inpput().split())

if a+b>24:
    print((a+b)-24)
else:
    print(a+b)


### FIXED CODE ###

a,b=map(int,input().split())

if a+b>=24:
    print((a+b)-24)
else:
    print(a+b)
import math

N,A,B = map(int,input().split())
v = [map(int,input().split())]

v.sort(reverse = True)
total = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(A):
    total = total + v[i]
else:
    print(total / A)
    
count = 0
min = v[A-1]
number = v.count(min)

if(v.index(min) == 0):
    for i in range(A,B+1):
        count = combinations_count(number,i) + count
    print(count)
else:
    print(combinations_count(number,A - v.index(min)))


### FIXED CODE ###

import math

N,A,B = map(int,input().split())
v = list(map(int,input().split()))

v.sort(reverse = True)
total = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(A):
    total = total + v[i]
else:
    print(total / A)
    
count = 0
min = v[A-1]
number = v.count(min)

if(v.index(min) == 0):
    for i in range(A,number+1):
        if(i>B):
            break
        count = combinations_count(number,i) + count
    print(count)
else:
    print(combinations_count(number,A - v.index(min)))
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]

for cx in range(101):
    for cy in range(101):
        # flag = True
        flag_init = True
        for _n in range(n):
            if s[_n][2] != 0:
                H = s[_n][2] + abs(s[_n][0] - cx) + abs(s[_n][1] - cy)
                if flag_init:
                    H0 = H
                    flag_init = False
                else:
                    if H != H0:
                        flag = False
        if flag == True:
            print(cx, cy, H)


### FIXED CODE ###

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

xyh.sort(key=lambda x:x[2], reverse=True)
for cx in range(101):
    for cy in range(101):
        x, y, h = xyh[0]
        H = abs(x - cx) + abs(y - cy) + h
        f = True

        for i in range(1, n):
            x, y, h = xyh[i]
            h2 = max(0, H - abs(x - cx) - abs(y - cy))
            if h != h2:
                f = False
                break

        if f:
            ans = (cx, cy, H)

print(ans[0], ans[1], ans[2])
s = input()
t = input()
cand = []
if len(s) < len(t):
  print('UNRESTORABLE')
else:
  for i in range(len(s)):
    if s[i] != t[0] and s[i] != '?':
      continue
    else:
      for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != '?':
          break
        elif j == (len(t)-1):
          cand.append(i)
  if len(cand) > 0:
    result = max(cand)
    S = s[:result]+t+s[result+len(t):]
    S = S.replace('?','a')
    print(S)
  else:
    print('UNRESTORABLE')

### FIXED CODE ###

s = input()
t = input()
cand = []
if len(s) < len(t):
  print('UNRESTORABLE')
else:
  for i in range(len(s)-len(t)+1):
    if s[i] != t[0] and s[i] != '?':
      continue
    else:
      for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != '?':
          break
        elif j == (len(t)-1):
          cand.append(i)
  if len(cand) > 0:
    result = max(cand)
    S = s[:result]+t+s[result+len(t):]
    S = S.replace('?','a')
    print(S)
  else:
    print('UNRESTORABLE')
import numpy as np
import math
k=int(input())
a,b=map(int,input().split())

#print((a%k*b%k))

if((b//k-a//k)>=1 or (b%k*a%k)==0):
  print("OK")
else:
  print("NG")

### FIXED CODE ###

import numpy as np
import math
k=int(input())
a,b=map(int,input().split())

#print((a%k*b%k))

if((b//k-a//k)>=1 or (b%k*a%k)==0):
  print("OK")
else:
  print("NG")
n,a,b,c,d = (int(i) for i in input().split())  
s = input()
if c<d:
  if s[a:c+1].count("##")>0 and s[b:d+1].count("##")>0:
    print("No")
  else:
    print("Yes")
else:
  if s[a:c+1].count("##")==0 and s[b:d+1].count("##")==0 and (s[b-1:d+1].count("...")>0 or s[b-1:B+2]):
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if c<d:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    print("Yes")
  else:
    print("No")
else:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    for i in range(b-1,d):
      if s[i-1:i+2]=="..." :
        e = 1 
    if e == 1:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
N=int(input())

if N%2==0:
  print(1/2)

else:
  print((n+1)/(2*n))

### FIXED CODE ###

N=int(input())

if N%2==0:
  print(1/2)

else:
  print((N+1)/(2*N))
n = input()
li = list(n)
li = list(map(int, li))
sn = sum(li)
if ( n % sn ): print("Yes")
else: print("No")

### FIXED CODE ###

n = int(input())
li = list(str(n))
li_ = [int(i) for i in li]
allSum = sum(li_)
if not n % allSum: print("Yes")
else: print("No")
from collections import deque
import numpy as np
n,m,k=map(int,input().split())
link=[[] for _ in range(n)]
block=[[]  for _ in range(n)]
ans=[]
s=[]
for i in range(m):
    a,b=map(int,input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)
for i in range(k):
  a,b=map(int,input().split())
  block[a-1].append(b-1)
  block[b-1].append(a-1)
for i in range(n):#スタートの選び方
    visited=set()
    q=deque([i])
    while len(q)>0:
        x=q.pop()
        visited.add(x)
        for j in link[x]:
            if j in visited:
              continue
            elif j in q:
              continue
            else:q.append(j)
    ans.append(len(visited))
    s.append(visited)

### FIXED CODE ###

n=int(input())
print(n//2+n%2)
import math
n = int(input())
k = int(math.sqrt(n)) if n != k ** 2 else int(math.sqrt(n)) - 1
ans = 0
for i in range(1, k + 1):
    t = int((n - 1) / i)
    ans += (t- i + 1) * 2
    if n != i ** 2:
        ans -= 1 
print(ans)

### FIXED CODE ###

import math
n = int(input())
m = int(math.sqrt(n))
if n == m ** 2:
    m -= 1

ans = 0
for i in range(1, m + 1):
    t = int((n - 1) / i)
    ans += (t- i + 1) * 2
    if n != i ** 2:
        ans -= 1 
print(ans)
from collections import Counter

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

c = Counter(a)

for i in values():
    if i >= 2:
        re += 1

if re >= 0:
    print("No")
else:
    print("Yes")


### FIXED CODE ###

from collections import Counter

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

c = Counter(a)
new = c.values()

for i in new:
    if i != 1:
        re = "NO"
        break
    else:
        re = "YES"

print(re)