Harryxun/stf_run huggingface dataset:
import math
n=int(input())
SN = 0
for i in range(1,math.ceil(math.log(n,10))+1):
  SN = SN + math.floor(n%(10**i)/(10**(i-1)))
if math.log(n,10)%1 == 0:
  print('Yes')
elif n%SN==0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

S=str(input())
total = 0
for i in range(len(S)):
  total = total + int(S[i])
if int(S)%total==0:
  print('Yes')
else:
  print('No')
N,Q = map(int, input().split())
graph = [[] for _ in range(N)]
counter = [0]*N
for i in range(N-1):
    a,b = map(int, input().split()) 
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

for i in range(Q):
    p, x = map(int, input().split())
    counter[p-1] += x

def dfs(v, parent):
    for i in graph[v]:
        if i==parent:
            continue
        counter[i] += counter[v]
        dfs(i, v)
        
dfs(0, -1)
print(*counter)      


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

# AB = [[int(x) for x in input().split()] for _ in range(N-1)]

# print(AB)

# 添字を1からにしたいのでN+1
graph = [[] for _ in range(N+1)]

# 各頂点に隣接する頂点
for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

# print(graph)
counter = [0] * (N+1)

# print(counter)

# PX = [[int(x) for x in input().split()] for _ in range(Q)]

# 各頂点に点数を足す
for _ in range(Q):
  p, x = map(int, input().split())
  counter[p] += x


def shori(pa,c,val):
  val += counter[c]
  counter[c] = val
  for i in graph[c]:
    if i == pa:
      continue
    shori(c,i,val)
  
shori(0,1,0)
  

print(" ".join(map(str, counter[1:])))
input = input).strip().split()

a = int(input[0])
b = int(input[1])
c = int(input[2])

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

### FIXED CODE ###

input = input().strip().split()
 
a = int(input[0])
b = int(input[1])
c = int(input[2])
 
if a<b<c:
    print("Yes")
else:
    print("No")
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
alpha = ''
b = []
one = 0
zero = 0
for i in range(n):
    b.append(format(a[i], '041b'))
if k == 0:
    print(sum(a))
    exit()
else:
    k = len(format(k,'b'))

for i in range(k):
    one = 0
    zero = 0
    for j in range(n):
        if b[-j][-i] == '1':
            one += 1
        else:
            zero += 1
    if one >= zero:
        alpha += '0'
    else:
        alpha += '1'
beta = int(alpha, 2)
sumA = 0
for i in range(n):
    sum += a[i] ^ beta
print(sum)


### FIXED CODE ###

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
bit_len = len(format(k, 'b'))
for i in range(n):
    bit_len = max(bit_len, len(format(a[i],'b')))
bit_count = [0 for i in range(bit_len)]
for i in range(n):
    bit = format(a[i], 'b').zfill(bit_len)
    for j in range(bit_len):
        if bit[j] == '1':
            bit_count[j] += 1
ans = 0
now_num = 0
for i in range(bit_len):
    if bit_count[i] < n - bit_count[i]:
        if now_num + 2 ** (bit_len - i - 1) <= k:
            now_num += 2 ** (bit_len - i - 1)
            ans += (n - bit_count[i]) * (2 ** (bit_len - i - 1))
            continue
    ans += bit_count[i] * (2 ** (bit_len - i - 1))
print(ans)
def fragOptimalJump(h,n,k):
    dp=[0]*(n+1)
    dp[2]=abs(h[1]-h[2])
    for i in range(3,n+1):
        l=i-k
        if l<0:
            l=1
        min=1000000
        for j in range(l,i):
            d=dp[j]+abs(h[i]-h[j])
            if d<min:
                min=d
            
        dp[i]=min
    return dp[n]



N,k=input().split()
N,k=int(N),int(k)
H=[0]*(N+1)
read = [int(n) for n in input().split()]
H=[0]+read
print(fragOptimalJump(H,N,k))


### FIXED CODE ###

def fragOptimalJump(h,n):
    dp=[0]*(n+1)
    dp[2]=abs(h[1]-h[2])
    for i in range(3,n+1):
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
    return dp[n]
  
N=int(input())
read = [int(n) for n in input().split()]
H=[0]+read
print(fragOptimalJump(H,N))
import sys
n, m = map(int, input().split())

ans = 0
li = [list(map(int, input().split())) for i in range(m)]

for i in range(m):
    for j in range(i+1, m):
        if (li[i][0] == li[j][0]) and (li[i][1] != li[j][1]):
            print(-1)
            sys.exit()

for i in range(m):
    if (li[i][1] == 0) and (n != 1):
        print(-1)
        sys.exit()
        
if n == 1:
    ans = li[i][1]
    print(ans)

elif n == 2:
    for i in range(m):
        if (li[i][0] == 1):
            ans -= (ans//10)*10
            ans += li[i][1]*10
        else:
            ans -= (ans%10)
            ans += li[i][1]
        
        if ans < 10:
            ans += 10
            
    print(ans)

else:
    for i in range(m):
        if (li[i][0] == 1):
            ans -= (ans//100)*100
            ans += li[i][1]*100
        elif (li[i][0] == 2):
            ans -= ((ans-(ans//100)*100)//10)*10
            ans += li[i][1]*10
        else:
            ans -= (ans%10)
            ans += li[i][1]
            
        if ans < 99:
            ans += 100
            
    print(ans)


### FIXED CODE ###

import sys
N, M = map(int, input().split())
li = [-1] * N
for i in range(M):
    s, c = map(int, input().split())
    if li[s-1] == -1 or li[s-1] == c:
        li[s-1] = c
    else:
        print(-1)
        sys.exit()
if N == 1:
    if li[0] == -1:
        ans = 0
    else:
        ans = li[0]
elif N == 2:
    if li[0] == 0:
        print(-1)
        sys.exit()
    else:
        if li[0] == -1:
            li[0] = 1
        if li[1] == -1:
            li[1] = 0
        ans = li[0]*10 + li[1]
else:
    if li[0] == 0:
        print(-1)
        sys.exit()
    else:
        if li[0] == -1:
            li[0] = 1
        if li[1] == -1:
            li[1] = 0
        if li[2] == -1:
            li[2] = 0
        ans = li[0]*100 + li[1]*10 + li[2]
print(ans)
K = input()
line = input().split(" ")
a = False
for i in range(int(line[0]), int(line[1])):
  if i%K==0:
    print("OK")
    a = True
  	break
if a == False:
  print("NG")    

### FIXED CODE ###


K = input()
line = input().split(" ")
a = False
for i in range(int(line[0]), int(line[1]) + 1):
    if i%int(K)==0:
        print("OK")
        a = True
        break
if a == False:
    print("NG")
a = input()[-1
if a == '3':
  print('bon')
elif a == '0' or a=='1' or a=='6' or a=='8':
  print('pon')
else:
  print('hon')

### FIXED CODE ###

a = input()[-1]
if a == '3':
  print('bon')
elif a == '0' or a=='1' or a=='6' or a=='8':
  print('pon')
else:
  print('hon')
import numpy as np

N = int(input())
VS = input().split()
CS = input().split()

V = [int(v) for v in VS]
C = [int(v) for v in CS]

R = [N]


for i in range(N-1):
    R[i] = V[i]/C[i]

RA = np.argsort(-R)

best = 0

Vsum=0
Csum=0

for r in RA:
    Vsum += V[i]
    Csum += C[i]

    if (Vsum-Csum) >= best:
        best = Vsum-Csum

print(best)


### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    if v[i] - c[i] > 0:
        ans += v[i] - c[i]
print(ans)
import collections as c
n,a=map(int,input().split())
X=[int(x)-a for x in input().split()]
C=c.Counter([0])
for x in X:
  itiji=Counter()
  for i,c in C.items():
    itiji[i+x]+=c
  C+=itiji
print(C[0]-1)

### FIXED CODE ###

import collections as co
n,a=map(int,input().split())
X=[int(x)-a for x in input().split()]
C=co.Counter([0])
for x in X:
  itiji=co.Counter()
  for i,c in C.items():
    itiji[i+x]+=c
  C+=itiji
print(C[0]-1)
N, M = [int(_) for _ in input().split()]
XY = [[int(_) - 1 for _ in input().split()] for _ in range(M)]

red = [False] * M
red[0] = True
num = [1] * M

for x, y in XY:
    num[x] -= 1
    num[y] += 1
    if red[x] == True:
        red[y] = True
        if num[x] == 0:
            red[x] = False
print(sum(red))

# http://agc002.contest.atcoder.jp/data/agc/002/editorial.pdf


### FIXED CODE ###

N, M = [int(_) for _ in input().split()]
XY = [[int(_) - 1 for _ in input().split()] for _ in range(M)]

red = [False] * N
red[0] = True
num = [1] * N

for x, y in XY:
    num[x] -= 1
    num[y] += 1
    if red[x] == True:
        red[y] = True
        if num[x] == 0:
            red[x] = False
print(sum(red))

# http://agc002.contest.atcoder.jp/data/agc/002/editorial.pdf
_,a _,b=map(int,open(0).read().split());print(1*(a+1==b))

### FIXED CODE ###

_,a,_,b=map(int,open(0).read().split());print(1*(a+1!=b))
Dict = {'A':'T','C':'G','T':'A','G':'C'}
tmp = input()
print(Dict(tmp))

### FIXED CODE ###

Dict = {'A':'T','C':'G','T':'A','G':'C'}
tmp = input()
print(Dict[tmp])
Y, M, D = list(map(int, input().split("/")))
s = ''.join([Y,M,D])

if s>20190430:
    print("TBD")
else:
    print("Heisei")

### FIXED CODE ###

Y, M, D = map(str, input().split("/"))
s = ''.join([Y,M,D])

if int(s)>20190430:
    print("TBD")
else:
    print("Heisei")
def calculate(j, eval, vval, ks):
    xi = max(eval)
    if xi == 0:
        return 0
    i = eval.index(xi)

    if d[i] >= n - d[i]:
        if ks[i] == '1':
            return calculate(i, eval[:i], vval[:i], ks[:i]) + sum(vval[i:])
        else:
            eval[i] = 0
            return vval[i] + calculate(j, eval, vval, ks)
    else:
        if ks[i] == '1':
            eval[i] = 0
            return vval[i] + calculate(j, eval, vval, ks)
        else:
            m = int(ks[:i + 1], 2)
            if m == 0:
                t = d[i] << (maxlen - i - 1)
                eval[i] = 0
                return t + calculate(j, eval, vval, ks)
            else:
                ks = format(m - 1, 'b')
                ks = '0'*(i - len(ks) + 1) + ks
                return calculate(i, eval[:i], vval[:i], ks[:i]) + sum(vval[i:])


if __name__ == "__main__":
    n, k = map(int, input().split())
    a = [format(int(x), 'b') for x in input().split()]

    maxlen = 40
    ks = format(k, 'b')
    ks = '0' * (maxlen - len(ks)) + ks

    d = [0] * maxlen
    for c in a:
        len_ = len(c)
        for j in range(len_):
            if c[j] == '1':
                d[j + maxlen - len_] += 1
    e = [0] * maxlen
    val = [0] * maxlen
    flag = True
    result = 0
    for j in range(maxlen):
        if flag:
            if ks[j] == '0' and d[j] == 0:
                continue
            else:
                flag = False
        e[j] = abs(2 * d[j] - n) << (maxlen - j - 1)
        if e[j] == 0:
            result += d[j] << (maxlen - j - 1)
        else:
            val[j] = max(d[j], n - d[j]) << (maxlen - j - 1)

    result += calculate(maxlen, e, val, ks)
    print(result)


### FIXED CODE ###

from sys import stdin
n, k = map(int, stdin.readline().rstrip().split())
a = [format(int(x), 'b')[::-1] for x in stdin.readline().rstrip().split()]

d = [0] * 64
maxlen = 0
for c in a:
    len_ = len(c)
    if len_ > maxlen:
        maxlen = len_
    for j in range(len(c)):
        if c[j] == '1':
            d[j] += 1

m = format(k, 'b')[::-1]
if len(m) >= maxlen:
    maxlen = len(m)
else:
    m = m + '0' * (maxlen - len(m))

flag = False
result = 0
for j in range(maxlen - 1, -1, -1):
    if d[j] >= n - d[j]:
        result = result * 2 + d[j]
        if m[j] == '1':
            flag = True
    else:
        if flag or m[j] == '1':
            result = result * 2 + n - d[j]
        else:
            result = result * 2 + d[j]

print(result)
def mulmod(x,y,p):
    return x*y % p

def fib_memo(n):
    memo = [0]*(n+1)

    def _fib(n):
        if n <= 1:
            return n
        if memo[n] != 0:
            return memo[n]
        memo[n] = _fib(n-1) + _fib(n-2)
        return memo[n]

    return _fib(n)

n,m = map(int,input().split())
a =[]
pos = 0
result = 1
last = -1
for i in range(m):
    x = int(input())
    if (last+1) == x:
        print(0)
        exit(0)
    last = x
    a.append(x)

for i in a:
    result = mulmod(fib_memo(i-pos),result,1000000007)
    pos = i+1

result = mulmod(fib_memo(n-pos+1),result,1000000007)

print(result)

### FIXED CODE ###

def fib_memo(n,broken):
    memo = [0]*(n+1)
    memo[0] = 1
    for x in range(1,n+1):
        if x < 1:
            continue
        if broken[x]==1:
            continue
        memo[x] = (memo[x-1] + memo[x-2])%1000000007

    return memo[n]

n,m = map(int,input().split())
a =[]
pos = 0
result = 1
last = -1
broken = [0]*(n+1)
for i in range(m):
    x = int(input())
    if (last+1) == x:
        print(0)
        exit(0)
    last = x
    a.append(x)
    broken[x] = 1

result = fib_memo(n,broken)

print(result)
def main():

    N, Q = map(int, input().split())
    S = input()

    sum = [0] * 100010

    for i in range(0, N):
        if S[i] == 'A' and S[i+1] == 'C': sum[i+1] = sum[i] + 1
        else: sum[i+1] = sum[i]

    for i in range(0, Q):
        l, r = map(int, input().split())
        print(sum[r-1] - sum[l-1])


if __name__ == '__main__':
    start = time.perf_counter()

    main()

    end = time.perf_counter()
    # print(end - start)


### FIXED CODE ###

import time


def main():

    N, Q = map(int, input().split())
    S = input()

    sum = [0] * (N + 1)

    for i in range(1, N):
        if S[i-1] == 'A' and S[i] == 'C': sum[i] = sum[i-1] + 1
        else: sum[i] = sum[i-1]

    for i in range(Q):
        l, r = map(int, input().split())
        print(sum[r-1] - sum[l-1])


if __name__ == '__main__':
    start = time.perf_counter()

    main()

    end = time.perf_counter()
    # print(end - start)
import sys
sys.setrecursionlimit(10**5+5)
n,q=map(int,input().split())
edge=[[] for _ in range(n)]
for i in range(n-1):
    x,y=map(int,input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)
ans=[0]*n
def count(p,x):
    ans[p]+=x
    for i in edge[p]:
        if i<p:
            continue
        count(i,x)
for i in range(q):
    p,x=map(int,input().split())
    count(p-1,x)
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,q=map(int,input().split())
edge=[[] for _ in range(n)]
for i in range(n-1):
    x,y=map(int,input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)
ans=[0]*n
for i in range(q):
    p,x=map(int,input().split())
    ans[p-1]+=x
def dfs(c,p):
    for i in edge[c]:
        if i==p:
            continue
        ans[i]+=ans[c]
        dfs(i,c)
dfs(0,-1)
print(*ans)
# -*- coding: utf-8 -*-
X, Y, A, B, C = map(int, input().split())
red_oishisa = list(map(int, input().split()))
green_oishisa = list(map(int, input().split()))
no_oishisa = list(map(int, input().split()))

red_oishisa = list(sorted(red_oishisa))[::-1]
green_oishisa = list(sorted(green_oishisa))[::-1]
no_oishisa = list(sorted(no_oishisa))[::-1]

eat_oishisas_red = red_oishisa[:X]
eat_oishisas_green = green_oishisa[:Y]

i=1
j=1
k=1
while(True):
    if i > A:
        break
    elif j > B:
        break
    elif k > C:
        break
    elif min([eat_oishisas_red[-i], eat_oishisas_green[-j]]) > no_oishisa[k-1]:
        break

    if eat_oishisas_red[-i] <= eat_oishisas_green[-j]:
        eat_oishisas_red[-i] = no_oishisa[k-1]
        i += 1
    else:
        eat_oishisas_green[-j] = no_oishisa[k-1]
        j += 1
    k += 1

print(sum(eat_oishisas_green) + sum(eat_oishisas_red))

### FIXED CODE ###

# -*- coding: utf-8 -*-
X, Y, A, B, C = map(int, input().split())
red_oishisa = list(map(int, input().split()))
green_oishisa = list(map(int, input().split()))
no_oishisa = list(map(int, input().split()))

red_oishisa = list(sorted(red_oishisa))[::-1]
green_oishisa = list(sorted(green_oishisa))[::-1]
no_oishisa = list(sorted(no_oishisa))[::-1]

oishisa_s = []

i=1
j=1
k=1
while(True):
    if len(oishisa_s) == X+Y:
        break
    
    hikaku_dict = dict()
    if i <= X:
        hikaku_dict['red'] = red_oishisa[i-1]
    if j <= Y:
        hikaku_dict['green'] = green_oishisa[j-1]
    if k <= C:
        hikaku_dict['no'] = no_oishisa[k-1]
    
    max_key, max_value = max(hikaku_dict.items(), key=lambda x:x[1])
    oishisa_s.append(max_value)
    if max_key == 'red':
        i += 1
    elif max_key == 'green':
        j += 1
    elif max_key == 'no':
        k += 1

print(sum(oishisa_s))
S=input()
S.replace("/","")
if (int(S) - "20190430") <= 0:
  print("Heisei")
else:
  print("TBD")

### FIXED CODE ###

S=input()
if (int(S.replace("/","")) - 20190430) <= 0:
  print("Heisei")
else:
  print("TBD")
string = list(input());
if (string[2] == string[3] and string[4] == string[5]):
	print("Yes");
  else:
    print("No");

### FIXED CODE ###

string = list(input());
if (string[2] == string[3]):
  if (string[4] == string[5]):
    print("Yes");
  else:
    print("No");
else:
  print("No");
n=int(input())
sp = 0
for i in range(1,n+1):
  s_i=i
  count =0
  a =True
  while a:
    if i % 2 ==0:
      i=i/2
      count += 1
    else:
      a =False
  if count >sp:
    sp = count
    sp_i = s_i
    
    
print(sp_i)


### FIXED CODE ###

n=int(input())
sp = 0
sp_i=1
for i in range(1,n+1):
  s_i=i
  count =0
  a =True
  while a:
    if i % 2 ==0:
      i=i/2
      count += 1
    else:
      a =False
  if count >sp:
    sp = count
    sp_i = s_i
    
    
print(sp_i)
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

if N>=k:
    print(X*K + Y*(K-N))
else:
    print(X*N)

### FIXED CODE ###

N=int(input())
K=int(input())
X=int(input())
Y=int(input())

if N>=K:
    print(X*K + Y*(N-K))
else:
    print(X*N)
from collections import deque
import sys
input = sys.stdin.readline
q = deque()
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
x = ((-1, 0), (1, 0), (0, -1), (0, 1))
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            for k in x:
                if 0 <= i + k[0] < h and 0 <= j + k[1] < w and a[i + k[0]][j + k[1]] == ".":
                    a[i + k[0]][j + k[1]] = "0"
                    q.append([i + k[0], j + k[1], 1])
ans = 0
while q:
    u, v, res = q.popleft()
    for k in x:
        if 0 <= u + k[0] < h and 0 <= v + k[1] < w and a[u + k[0]][v + k[1]] == ".":
            a[u + k[0]][v + k[1]] = "0"
            q.append((u + k[0], v + k[1], res + 1))
print(res+1)

### FIXED CODE ###

from collections import deque 
import sys
input = sys.stdin.readline
def main():
    q = deque([])
    h,w=map(int,input().split())
    a=[list(input()) for i in range(h)]
    x=[[-1,0],[1,0],[0,-1],[0,1]]
    for i in range(h):
        for j in range(w):
            if a[i][j]=="#":
                for k in x:
                    if 0<=i+k[0]<h and 0<=j+k[1]<w and a[i+k[0]][j+k[1]]==".":
                        a[i+k[0]][j+k[1]]="0"
                        q.append([i+k[0],j+k[1],1])
    ans=0
    while q:
        v=q.popleft()
        for k in x:
            if 0<=v[0]+k[0]<h and 0<=v[1]+k[1]<w and a[v[0]+k[0]][v[1]+k[1]]==".":
                a[v[0]+k[0]][v[1]+k[1]]="0"
                q.append([v[0]+k[0],v[1]+k[1],v[2]+1])
                ans=v[2]+1
    print(ans)
if __name__ == '__main__':
    main()
s, t = map(input().split())
a, b = map(int, input().split())
u = input()

if s == u:
    print(a-1, b, end="")
else:
    print(a, b-1, end="")

### FIXED CODE ###

s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
    print(a-1, b)
else:
    print(a, b-1)
import math.sqrt as sqrt
n=int(input())
ans=1+n
if(n%2==0):
  ans=2+int(n/2)
  
for i in range(3,int(sqrt(n))+1,2):
  if(n%i==0):
    ans=min(ans,(i+int(n/i)))
print(ans)


### FIXED CODE ###

n=int(input())
ans=n-1
e=int(n**(1/2))+1
for i in range(2,e):
  if(n%i==0):
    ans=min(ans,i+int(n/i)-2)
print(ans)
p={'RRR':3,'RRS':2,'SRR':2,'RSR':1,'SSR':1,'RSS':1,'SSS':0}
print(p[input()])

### FIXED CODE ###

p={'RRR':3,'RRS':2,'SRR':2,'RSR':1,'SSR':1,'RSS':1,'SSS':0,'SRS':1}
print(p[input()])
n=int(input())
if n<1200:
  print('ABC')
elif (n<2800)&&(n>=1200):
  print('ARC')
else:
  print('AGC')



### FIXED CODE ###

n=int(input())
if n<1200:
  print('ABC')
elif n>=2800:
  print('AGC')
else:
  print('ARC')
n, k = input().split()
n, k = int(n), int(k)
balls = input().split()
dic = {}
for x in balls:
	if x not in dic:
		dic[x] = 1
	else:
		dic[x] += 1
change = 0
qnt = list(dic.values())
qnt.sort()
dif = len(qnt) - k
while dif:
	change += qnt[0]
	qnt.pop(0)
	dif -= 1
print(change)

### FIXED CODE ###

n, k = input().split()
n, k = int(n), int(k)
balls = input().split()
dic = {}
for x in balls:
	if x not in dic:
		dic[x] = 1
	else:
		dic[x] += 1
change = 0
qnt = list(dic.values())
qnt.sort()
dif = len(qnt) - k
for x in range(0, dif):
	change += qnt[x]
print(change)
s = input()
t = input()

ans_list = []
if t in s:
    print(s.replace('?', 'a'))
else:
    for i in range(len(s) - len(t),-1,-1)[::-1]:
        flag = True
        for j in range(len(t)):
            if s[j] == t[j - i] or s[j] == '?':
                continue
            else:
                flag = False
                break
        if flag ==  True:
            tmp = s
            tmp = tmp.replace(tmp[i : i+len(t)] , t)
            ans_list.append(tmp.replace('?', 'a'))
    if len(ans_list) == 0:
        print('UNRESTORABLE')
    else:
        ans_list.sort()
        print(ans_list[0])

### FIXED CODE ###

s = input()
t = input()

ans_list = []
if t in s:
    print(s.replace('?', 'a'))
else:
    for i in range(0 , len(s) - len(t)+1):
        flag = True
        for j in range(i , i + len(t)):
            if s[j] == t[j - i] or s[j] == '?':
                continue
            else:
                flag = False
                break
        if flag ==  True:
            tmp = s
            tmp = tmp[:i] + t + tmp[i + len(t):]
            ans_list.append(tmp.replace('?', 'a'))
    if len(ans_list) == 0:
        print('UNRESTORABLE')
    else:
        ans_list.sort()
        print(ans_list[0])
from collections import deque
H, W = map(int, input().split())
a_list = []
dark = deque()
for h in range(H):
    a = input()
    a_list.append(a)
    for w in range(W):
        if a[w] == '#':
            dark.append([h, w])
ans = 0
distance = [[-1] * W for _ in range(H)]
while dark:
    h, w = dark.popleft()
    for x, y in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
        hx, wy = h + x, w + y
        if (0 <= hx < H) & (0 <= wy < W):
            if distance[hx][wy] == -1:
                distance[hx][wy] = distance[h][w] + 1
                ans = max(ans, distance[hx][wy])
                tmp.append([hx, wy])
    dark = tmp
print(ans + 1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

H,W = map(int,input().split())
INF = 10**18
q = []

visited = [[True]*(W+2)]
visited += [[True] + [x == '#' for x in input().rstrip()] + [True] for _ in range(H)]
visited.append([True]*(W+2))
for i in range(1,H+1):
  for j in range(1,W+1):
    if visited[i][j]:
      q.append((i,j))

moves = [(0,1),(0,-1),(1,0),(-1,0)] #全方向調べる

ans = -1
while q:
  qq = []
  ans += 1
  for x,y in q:
    if not visited[x-1][y]:
      visited[x-1][y] = True
      qq.append((x-1,y))
    if not visited[x+1][y]:
      visited[x+1][y] = True
      qq.append((x+1,y))
    if not visited[x][y-1]:
      visited[x][y-1] = True
      qq.append((x,y-1))
    if not visited[x][y+1]:
      visited[x][y+1] = True
      qq.append((x,y+1))
  q = qq
  
print(ans)
import numpy as np
import math
A, B, C, D = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
E = lcm(C, D)

u = np.arange(A,B+1)
count_U = len(u)
u_c = [i for i in u if i % C == 0]
count_C = len(u_c)
u_d = [i for i in u if i % D == 0]
count_D = len(u_d)
u_e = [i for i in u if i % E == 0]
count_E = len(u_e)

answer = count_U - (count_C + count_D -count_E)
print(answer)


### FIXED CODE ###

from fractions import gcd
 
a, b, c, d = map(int, input().split())
a = a - 1
 
def main():
    cd = c * d // gcd(c, d)
    print(b - a - f(c) - f(d) + f(cd))
 
def f(x):
    return b // x - a // x
 
main()