Harryxun/stf_run huggingface dataset:
a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)

for i in range(1,a_l-b_l+2):
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break

if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")


### FIXED CODE ###


a = list(input())
b = list(input())
a_l = len(a)
b_l = len(b)
f = False
for i in range(1,a_l-b_l+2):
    f = True
    for j in range(1,b_l+1):
        if not(b[b_l-j] == a[a_l-i-j+1] or a[a_l-i-j+1] == "?"):
            f = False
            break
    if f:
        for j in range(1,b_l+1):
            a[a_l-i-j+1] = b[b_l-j]
        break
 
if f:
    print("".join(a).replace("?", "a"))
else:
    print("UNRESTORABLE")
r, g, b = map(str, input().split())
rgb = r + g + b
if rgb % 4 == 0:
	print('YES')
else:
	print('NO')

### FIXED CODE ###

c = input().split()
c = int(''.join(c))
if c % 4 == 0:
	print('YES')
else:
	print('NO')
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

a_res = a + (v*t)
b_res = b + (w*t)

if a_res > b_res:

  print("YES")
else:
  print("NO")
  
  


### FIXED CODE ###

name = input()

print(name[:3])
x,y=map(int,input.split())
print(x+y/2)

### FIXED CODE ###

x,y=map(int,input().split())
print(int(x+y/2))
import math
A,B,K=map(int,input().split())
d=[]
if math.gcd(A,B)==1:
    d.append(1)
else:
    for i in range(2,math.gcd(A,B)+1):
        if A%i==0 and B%i==0:
            d.append(i)
print(d[len(d)-K])

### FIXED CODE ###

A,B,C=map(int,input().split())
if B>A*C:
    print(C)
else:
    print(B//A)
a,b,c = input().split
if a[-1] == b[1] and b[-1] == c[1]:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a,b,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')
S = input()
count = 0
for i in range(len(S)):
    for j in range(i + 5, i + 6):
        if int(S[i:j]) % 2019 == 0:
            count += 1
print(count)

### FIXED CODE ###

S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
import math
A,B=map(int,input().split())
print(math.gcd(A,B))

### FIXED CODE ###

import fractions
A,B=map(int,input().split())
print(A*B//fractions.gcd(A,B))
def main():
    H1, M1, H2, M2, K = map(int, input().split())
    print( K * ( abs((sleep - 1)-start) // K) )


if __name__ == "__main__":
    main()


### FIXED CODE ###

import datetime

def main():
    H1, M1, H2, M2, K = map(int, input().split())

    start = H1*60 + M1
    sleep = H2*60 + M2

    print(abs(sleep - start - K))


if __name__ == "__main__":
    main()
N,K=map(int,input().split(" "))
X=sorted(list(map(int,input().split(" "))))

ans=0
for i in range(N-K+1):
    tans=abs(X[i]-X[i+K])+abs(X[i])

    if i==0 or ans>tans:
        ans=tans
    
print(ans)

### FIXED CODE ###

N,K=map(int,input().split(" "))
X=sorted(list(map(int,input().split(" "))))

ans=0
for i in range(N-K+1):
    tans=abs(X[i]-X[i+K-1])+abs(X[i])

    if i==0 or ans>tans:
        ans=tans

for i in range(N-K+1):
    tans=abs(X[i]-X[i+K-1])+abs(X[i+K-1])

    if ans>tans:
        ans=tans

print(ans)
n, x, t = [int(x) for x in input().split()]
print(ceil(n/x*t))

### FIXED CODE ###

import math
n, x, t = [int(x) for x in input().split()]
print(math.ceil(n/x)*t)
from collections import deque
from sys import stdin
def create_groups(n, links):
  from builtins import len, set
  groups = [-1 for _ in range(n)]
  group_number = 0
  d = deque()
  for i in range(n):
    if groups[i] == -1:
      group_member = []
      d.append(i)
      while len(d) != 0:
        j = d.popleft()
        groups[j] = group_number
        group_member.append(j)
        for k in links[j]:
          if groups[k] == -1:
            d.append(k)
      group_number += 1
  return groups
def read_links(n, k):
  from builtins import int, map
  readline = stdin.readline
  links = [[] for _ in range(n)]
  for i in range(k):
    p, q = map(int, readline().split())
    links[p - 1].append(q - 1)
    links[q - 1].append(p - 1)
  return links
def main():
  from builtins import len
  n, k, l = map(int, input().split())
  road_links = read_links(n, k)
  train_links = read_links(n, l)
  road_groups = create_groups(n, road_links)
  train_groups = create_groups(n, train_links)
  result = {}
  for i in range(n):
    t = (road_groups[i], train_groups[i])
    if t in result:
      result[t] += 1
    else:
      result[t] +=1
  print(*[result[(road_groups[i], train_groups[i])] for i in range(n)])
main()


### FIXED CODE ###

from sys import stdin

def find(parent, i):
  if parent[i] == i:
    return i
  parent[i] = find(parent, parent[i])
  return parent[i]

def unite(parent, i, j):
  i = find(parent, i)
  j = find(parent, j)
  if i == j:
    return
  parent[i] = j

n, k, l = map(int, stdin.readline().split())

roads = list(range(n))
rails = list(range(n))

for i in range(k):
  p, q = map(int, stdin.readline().split())
  unite(roads, p - 1, q - 1)

for i in range(l):
  p, q = map(int, stdin.readline().split())
  unite(rails, p - 1, q - 1)

d = {}
for i in range(n):
  t = (find(roads, i), find(rails, i))
  if t in d:
    d[t] += 1
  else:
    d[t] = 1

print(*[d[(find(roads, i), find(rails, i))] for i in range(n)])
n = int(input())
numbers = list(map(int, input().split()))

def main() :
    x = numbers[n - 1]
    i = 0
    for j in range(n) :
        if numbers[j] <= x :
            numbers[i], numbers[j] = numbers[j], numbers[i]
            i += 1

    [print(numbers[j] if j != i - 1 else '['+str(numbers[j])+']', end = ' ' if j != n - 1 else '\n') for j in range(n)]

if __name__ == '__main__':
    main()



### FIXED CODE ###

def main() :
    n = int(input())
    cards = [Card(*input().split()) for i in range(n)]
    stableCards = sorted(cards[:], key=lambda c: c.number)
    quickSort(cards, 0, n - 1)
    print(isStable(cards, stableCards, n))
    list(map(lambda i : i.print_card(), cards))

def quickSort(cards, p, r) :
    if p < r:
        q = partion(cards, p, r)
        quickSort(cards, p, q - 1)
        quickSort(cards, q + 1, r)

def partion(cards, p, r) :
    x = cards[r]
    i = p
    for j in range(p, r + 1) :
        if int(cards[j].number) <= int(x.number) :
            cards[i], cards[j] = cards[j], cards[i]
            i += 1
    return i - 1

def isStable(a, b, n):
    for i in range(n):
        if a[i].prefix != b[i].prefix:
            return 'Not stable'

    return 'Stable'

class Card():
    def __init__(self, prefix, number):
        self.prefix = prefix
        self.number = number

    def print_card(self):
        print(self.prefix, self.number)

if __name__ == '__main__':
    main()
A,B,C = map(int,input().split())
print("Yes" if sum(A,B) >= C else "No")

### FIXED CODE ###

A,B,C = map(int,input().split())
print("Yes" if A+B >= C else "No")
k = int(input())
s = input()

if len(s)<=k:
	print(s)

else:
	print(s[0:k] + "…")

### FIXED CODE ###

n = int(input()) 
en = str(n)
if (en[-1:]=="2" or en[-1:]=="4" or en[-1:]=="5" or en[-1:]=="7" or en[-1:]=="9"):
	print("hon")
elif (en[-1:]=="0" or en[-1:]=="1" or en[-1:]=="6" or en[-1:]=="8"):
	print("pon")
else:
	print("bon")
oldMoney, hateNumberLength = map(list, input().split())
hateLines = list(str(input()).rsplit(" "))
okLines = []
FirstBigList = []
newMoney = list(oldMoney)
def FindFirstBig(okLines,m,FirstBig):
    for i in okLines:
        if i > m:
            FirstBig.append(i)
    return FirstBig

for i in range(10):
    if str(i) not in hateLines:
        okLines.append(str(i))

FirstFlag = -1
ProblemFlag = -1
for index, m in enumerate(oldMoney):
    if FirstFlag == -1:
        if m in hateLines:
            FirstBigList = FindFirstBig(okLines,m,FirstBigList)
            if len(FirstBigList) > 0:
                newMoney[index] = FirstBigList[0]
                FirstFlag = index
            ProblemFlag = index
    elif FirstFlag != -1:
        newMoney[index] = okLines[0]

if oldMoney == newMoney:
    if ProblemFlag is not 0:
        FirstBigList.clear()
        while ProblemFlag:
            FirstBigList = FindFirstBig(okLines, newMoney[ProblemFlag - 1], FirstBigList)
            if len(FirstBigList) > 0:
                newMoney[ProblemFlag - 1] = FirstBigList[0]
                for i in range(ProblemFlag,len(newMoney),1):
                    newMoney[i] = okLines[0]
            if oldMoney == newMoney:
                ProblemFlag -= 1
    if ProblemFlag is 0:
        newMoney.insert(0,okLines[0])
        for i in range(ProblemFlag, len(newMoney), 1):
            newMoney[i] = okLines[0]
resultnew = "".join(newMoney)
print(resultnew)

### FIXED CODE ###

oldMoney, hateNumberLength = map(list, input().split())
hateLines = list(str(input()).rsplit(" "))
okLines = []
FirstBigList = []
newMoney = list(oldMoney)


def FindFirstBig(okLines, m, FirstBig):
    for i in okLines:
        if i > m:
            FirstBig.append(i)
    return FirstBig


for i in range(10):
    if str(i) not in hateLines:
        okLines.append(str(i))

FirstFlag = -1
ProblemFlag = -1
for index, m in enumerate(oldMoney):
    if FirstFlag == -1:
        if m in hateLines:
            FirstBigList = FindFirstBig(okLines, m, FirstBigList)
            if len(FirstBigList) > 0:
                newMoney[index] = FirstBigList[0]
                FirstFlag = index
            ProblemFlag = index
    elif FirstFlag != -1:
        newMoney[index] = okLines[0]

if oldMoney == newMoney:
    if ProblemFlag is not 0 and ProblemFlag is not -1:
        FirstBigList.clear()
        while ProblemFlag:
            FirstBigList = FindFirstBig(okLines, newMoney[ProblemFlag - 1], FirstBigList)
            if len(FirstBigList) > 0:
                newMoney[ProblemFlag - 1] = FirstBigList[0]
                for i in range(ProblemFlag, len(newMoney), 1):
                    newMoney[i] = okLines[0]
            if oldMoney == newMoney:
                ProblemFlag -= 1
    if ProblemFlag is 0:
        if okLines[0] != '0':
            newMoney.insert(0, okLines[0])
        else:
            newMoney.insert(0, okLines[1])
        for i in range(ProblemFlag + 1, len(newMoney), 1):
            newMoney[i] = okLines[0]
resultnew = "".join(newMoney)
print(resultnew)
import numpy as np

x = list(map(int,input().split()))
if x[0] > x[1]:
    ans = np.repeat(x[1],x[0])
    for i in ans:
        print(i, end="")
    
elif x[0] < x[1]:
    for i in ans:
        print(i, end="")
    
else:
    for i in ans:
        print(i, end="")

### FIXED CODE ###

import numpy as np

x = list(map(int,input().split()))
if x[0] > x[1]:
    ans = np.repeat(x[1],x[0])
    for i in ans:
        print(i, end="")
    
elif x[0] < x[1]:
    ans = np.repeat(x[0],x[1])
    for i in ans:
        print(i, end="")
    
else:
    ans = np.repeat(x[0],x[1])
    for i in ans:
        print(i, end="")
a=input()
if a==SUN:
  print(7)
if a==MON:
  print(6)
if a==TUE:
  print(5)
if a==WED:
  print(4)
if a==THU:
  print(3)
if a==FRI:
  print(2)
if a==SAT
  print(1)

### FIXED CODE ###

a=input()
if a=="SUN":
  print(7)
if a=="MON":
  print(6)
if a=="TUE":
  print(5)
if a=="WED":
  print(4)
if a=="THU":
  print(3)
if a=="FRI":
  print(2)
if a=="SAT":
  print(1)
import math
import itertools

n = int(input())

distans = []
tmps = []
for i in range(n):
    x,y = map(int,input().split())
    tmps.append((x - y)**2)

ans = 0
comb = list(itertools.combinations(range(int((n*(n-1))/2)),2))
for k in range(len(comb)):
    distans.append(math.sqrt(tmps[comb[k][0]] + tmps[comb[k][1]]))
    ans += distans[k] * (math.factorial(n)-n+1) 
print(ans/math.factorial(n))

### FIXED CODE ###

import itertools
import math
n = int(input())
xy = [list(map(int,input().split()))for _ in range(n)]

ans = 0
for i in itertools.permutations(range(n), n):
    tmp = i[0]
    for j in i:
        ans += (((xy[tmp][0]-xy[j][0])**2 + (xy[tmp][1]-xy[j][1])**2)**0.5)
        tmp = j
print(ans/math.factorial(n))
import math

A, B, C, D = map(int, input().split())
lcm = int(C * D / math.gcd(C, D))

num_B_C = B // C
num_B_D = B // D
num_B_CD = B // (lcm)

num_A_C = (A-1) // C
num_A_D = (A-1) // D
num_A_CD = (A-1) // (lcm)

num_all = (num_B_C - num_A_C) + (num_B_D - num_A_D) - (num_B_CD - num_A_CD)
result = (B - (A-1)) - num_all

print(result)

### FIXED CODE ###


def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z
        
A, B, C, D = map(int, input().split())
lcm = int(C * D / gcd(C, D))

num_B_C = B // C
num_B_D = B // D
num_B_CD = B // (lcm)

num_A_C = (A-1) // C
num_A_D = (A-1) // D
num_A_CD = (A-1) // (lcm)

num_all = (num_B_C - num_A_C) + (num_B_D - num_A_D) - (num_B_CD - num_A_CD)
result = (B - (A-1)) - num_all

print(result)
#ABC071C
N=int(input())
A=list(map(int,input().split()))
max_A=max(A)
lines=[0]*(max_A+1)
long_line=0
sqare_area=0
rectangl_area=0
for i in range(N):
    lines[A[i]]+=1
if max(lines)<2:
    print(0)
    exit()
for i in range(max_A):
    j=max_A-i
    if lines[j]>=4:
        if sqare_area==0:
            sqare_area=j*j
            if long_line==0:
                print(sqare_area)
                exit()
    elif lines[j]>=2:
        if long_line>0:
            rectangle_area=long_line*j
            if rectangle_area>sqare_area:
                print(rectangle_area)
                exit()
            else:
                print(sqare_area)
                exit()
        else:
            long_line=j


### FIXED CODE ###

#ABC071C
N=int(input())
A=list(map(int,input().split()))
A_sorted=sorted(A,reverse=True)
long_line=0
lines=1
for i in range(N-1):
    if A_sorted[i]==A_sorted[i+1]:
        lines+=1
    if A_sorted[i]!=A_sorted[i+1] or i==N-2:
        if lines>=4:
            if long_line>0:
                print(long_line*A_sorted[i])
                exit()
            else:
                print(pow(A_sorted[i], 2))
                exit()
        elif lines>=2:
            if long_line>0:
                print(long_line * A_sorted[i])
                exit()
            else:
                long_line=A_sorted[i]
        lines=1
print(0)
l = input().split()

if l[0] == l[1] and l[1] == l[2]
	print("Yes")
else
	print("No")

### FIXED CODE ###

a = input().split()
if int(a[0]) == int(a[1]) and int(a[1]) == int(a[2]):
	print("Yes")
else:
	print("No")
a, b, c = map(int, input(),split())
if c >= a and c <= b:
    print('Yes')
else:
    print('No')
  

### FIXED CODE ###

a, b, c = map(int, input().split())
if c >= a and c <= b:
    print('Yes')
else:
    print('No')
def main():
	N, K = map(int, input().split())
	DIV = 10**9+7
	size = N
	fact = [0]*size
	inverse = [0]*size
	inv_cal = [0]*size
	fact[:2] = [1, 1]
	inverse[:2] = [1, 1]
	inv_cal[:2] = [0, 1]

	for i in range(2, size):
		fact[i] = (fact[i-1]*i%DIV)
		inv_cal[i] = (-inv_cal[DIV%i]*(DIV//i))%DIV
		inverse[i] = inverse[i-1]*inv_cal[i]%DIV

	def C(n, r):
		ans = fact[n]*inverse[r]%DIV
		return ans*inverse[n-r]%DIV

	for i in range(K):
		ans = (C(N-K+1, i+1)*C(K-1, i))%DIV
		print(ans)


if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	N, K = map(int, input().split())
	DIV = 10**9+7
	size = 2001
	fact = [0]*size
	inverse = [0]*size
	inv_cal = [0]*size
	fact[:2] = [1, 1]
	inverse[:2] = [1, 1]
	inv_cal[:2] = [0, 1]

	for i in range(2, size):
		fact[i] = (fact[i-1]*i%DIV)
		inv_cal[i] = (-inv_cal[DIV%i]*(DIV//i))%DIV
		inverse[i] = inverse[i-1]*inv_cal[i]%DIV

	def C(n, r):
		ans = fact[n]*inverse[r]%DIV
		return ans*inverse[n-r]%DIV

	for i in range(K):
		ans = 0
		if i+1 <= N-K+1:
			ans = (C(N-K+1, i+1)*C(K-1, i))%DIV
		print(ans)


if __name__ == '__main__':
	main()
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(4):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
print(sum([sum(map(lambda a: 0 if a == -1 else C[a][1], row)) for row in A])

### FIXED CODE ###

#http://abc079.contest.atcoder.jp/
# -*- coding: utf-8 -*-

h,w = map(int,input().split())

mp = []
for _ in range(10):
    mp.append(list(map(int,input().split())))

wall = []
for _ in range(h):
    wall.append(list(map(int,input().split())))

def min_cost(i,j,current,min_cost_current):
    if i == j: return current
    for index in range(10):
        if i == index: continue
        if current + mp[i][index] < min_cost_current:
            min_cost_current = min_cost(index,j,current+mp[i][index],min_cost_current)
    return min_cost_current


mp_min_cost =[]
for i in range(10):
    tmp = []
    for j in range(10):
        if i == j :
            tmp.append(0)
            continue

        min_cost_current = mp[i][j]
        if min_cost_current == sorted(mp[i])[1]:
            tmp.append(mp[i][j])
            continue

        # from i to j
        for index in range(10):
            if i == index: continue
            if mp[i][index] < min_cost_current:
                min_cost_current = min_cost(index,j,mp[i][index],min_cost_current)
        tmp.append(min_cost_current)
    mp_min_cost.append(tmp)

amount = 0
for i in wall:
    for j in i:
        if j == -1 or j == 1: continue
        amount += mp_min_cost[j][1]
print(amount)
import math
n, a, b = map(int,input().split())
score = 1
total = 0
if n % 2 == 1:
  for i in range(1,n//2+1):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
else:
  for i in range(1,n//2):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
  k = n//2 
  if k != a and k != b and k != n-a and K != n-b:
    total + score * (n-k+1) // k
print(total % (10**9 + 7))


### FIXED CODE ###

N, a, b = map(int,input().split())
p = pow(10,9) + 7
def comb(n,r):
  bunshi = 1
  for i in range(n-r+1, n+1):
    bunshi =bunshi * i % p
  bunbo = 1
  for i in range(1, r+1):
    bunbo = bunbo * i % p
  return bunshi * pow(bunbo, p-2, p)
print((pow(2,N, p) - 1 - comb(N,a) - comb(N,b)) % p)
n, total = map(int, input().split())

x = -1
y = -1
z = -1

for a in range(n+1):  #10000
    for b in range(n-a+1):  #5000
        c = n-a-b
        if total == 10000 * a + 5000 * b + 1000 * c:
            x, y, z = a, b, c
            break

print(x, y, z)


### FIXED CODE ###

print(input().replace('2017', '2018'))
N = input()
X = list(map(int, input().split()))
for a in X:
    sum = sum + a
C = sum/N
for b in X:
    ans = (b-C)**2
print(ans)

### FIXED CODE ###

N,R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(R+(100*(10-N)))
# import numpy as np
n=int(input())
l=input().split()
l=[float(x) for x in l]
t=(n+1)//2
dp=[[-1 for i in range(n+1)]for i in range(n+1)]
def recur(i,k,ans):
    if i==0:
        # global ans
        if k>=t:
            return 1
            
        return 0
    # a=dp[i][k]
    # dp[i][k]=recur(i+1,k+1,p*l[i],ans)+recur(i+1,k,p*(1-l[i]),ans)
    # b=dp[i][k]
    # if a!=0 and a!=b:
    #     print(a,b)
    # return dp[i][k]
    if dp[i][k]!=-1:
        return dp[i][k]
    
    dp[i][k]=l[i-1]*recur(i-1,k+1,ans)+recur(i-1,k,ans)*(1-l[i-1])
    # print(dp[i][k])
    # if dp[i+1][k+1] == 0:
    #     dp[i+1][k+1]=recur(i+1,k+1,p*l[i])
    # if dp[i+1][k]==0:
    #     dp[i+1][k]=recur(i+1,k,p*(1-l[i]))
    return dp[i][k]
# ans=0
# print(dp)
print("%0.10f"%recur(n,0,0))
# print(dp)
# print(ans)
            

### FIXED CODE ###

# import numpy as np
n=int(input())
l=[0]+list(map(float,input().split()))
n+=1
dp=[[0 for i in range(n)]for i in range(n)]
dp[0][0]=1
for i in range(1,n):
    for j in range(i+1):
        if j==0:
            dp[i][j] = (1-l[i])*dp[i-1][j]
        else:
            dp[i][j]=(1-l[i])*(dp[i-1][j])+l[i]*dp[i-1][j-1]
ans=0
# print(np.array(dp))
for i in range((n)//2,n):
    ans+=dp[-1][i]
print(ans)
from functools import reduce
import math
n = int(input())
a = list(map(int, input().split()))

#最小公倍数−1
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

m = lcm_list(a)-1
sum = 0
for i in a:
    sum += m%i

print(sum)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
sum = 0
for a_i in a:
    sum += a_i-1
print(sum)
import numpy as np
N, W = map(int, input().split())
ndp = np.zeros(W+1, dtype= np.int64)
for _ in range(N):
    w, v = map(int,input().split())

    # 離散より連続で扱った方が問題が簡単になる。
    np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1])


### FIXED CODE ###

import numpy as np
N, W = map(int, input().split())
ndp = np.full(1000*100+1, 10**11, dtype=np.int64)
ndp[0] = 0

for _ in range(N):
    w, v = map(int,input().split())

    np.minimum(ndp[:-v] + w, ndp[v:], out = ndp[v:])

print(np.max(np.where(ndp<=W)))

"""
https://atcoder.jp/contests/dp/submissions/6646897
から失敬

貪欲法はこの手の書き方で表現できるっぽい。
価値テープのなかで同価値のindexでは、より少ない重量の物品で済む方を残していく。
したがってテープの初期化は擬似infで行い、価値0の部分は重さも0で始める。

"""
a, b, x = [int(i) for i in input().split()]

i = 0

while True:
    #何桁円か確定させる
    price = a * (10**i) + b * (i+1)
    if price > x:
        break
    else:
        i += 1

x -= b * i
n = x//a

print(min(n,10**9))

### FIXED CODE ###

s = input()

if s == 'SUN':
    n = 7
elif s == 'MON':
    n = 6
elif s == 'TUE':
    n = 5
elif s == 'WED':
    n = 4
elif s == 'THU':
    n = 3
elif s == 'FRI':
    n = 2
elif s == 'SAT':
    n = 1

print(n)
def solve():
    N,H = list(map(int, input().split()))
    az = []
    bz = []
    for i in range(N):
        a,b = list(map(int, input().split()))
        az.append(a)
        bz.append(b)
        
    amax = max(az)
    bz.sort(reverse=True)
    cnt = 0
    for b in bz:
        if amax < b:
            H -= b
            cnt += 1
        if H <= 0:
            return cnt
    if H <= 0:
        return cnt)
    cnt += int(H / amax)
    cnt += min(H % amax, 1)
    return cnt
        
print(solve())

### FIXED CODE ###

def solve():
    N,H = list(map(int, input().split()))
    az = []
    bz = []
    for i in range(N):
        a,b = list(map(int, input().split()))
        az.append(a)
        bz.append(b)
        
    amax = max(az)
    bz.sort(reverse=True)
    cnt = 0
    for b in bz:
        if amax < b:
            H -= b
            cnt += 1
        if H <= 0:
            return cnt
    if H <= 0:
        return cnt
    cnt += int(H / amax)
    cnt += min(H % amax, 1)
    return cnt
        
print(solve())
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

ans=0
for i in range(n):
    if a[i]=<b[i]:
        ans+=a[i]
        ans+=min(a[i+1],b[i]-a[i])
        a[i+1]=max(a[i+1]-(b[i]-a[i]),0)
    else:
        ans+=b[i]
print(ans)

### FIXED CODE ###

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

ans=0
for i in range(n):
    if a[i]<=b[i]:
        ans+=a[i]
        ans+=min(a[i+1],b[i]-a[i])
        a[i+1]=max(a[i+1]-(b[i]-a[i]),0)
    else:
        ans+=b[i]
print(ans)
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
N = li()
A = list(li())

def gcd(A, B):
    # fast return
    if B == 1 or A == 1:
        return 1

    # normal gcd logic
    if A != B:
        return gcd(min(A, B), abs(A - B))
    else:
        return A

A = list(filter(lambda x:x>0, A))
A.sort()
if len(A) == 0:
    print(0)
else:
    res = A[0]
    for a in A:
        res = gcd(a, res)
        if res == 1:
            break

    print(res)


### FIXED CODE ###

import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
N = li()
A = list(li())

def gcd(A, B):

    # normal gcd logic
    while B not in (1, 0):
        A, B = (A, B) if A > B else (B, A)
        _, mod = divmod(A, B)
        A, B = B, mod
    if B == 0:
        return A
    elif B == 1:
        return 1

A = list(filter(lambda x:x>0, A))
A.sort()
if len(A) == 0:
    print(0)
else:
    res = A[0]
    for a in A:
        res = gcd(a, res)
        if res == 1:
            break

    print(res)