Harryxun/stf_run huggingface dataset:
# Python 3 program to implement 
# the above approach 
from math import pow
  
# Function to calculate number of characters 
# in corresponding string of 'A' and 'B' 
def no_of_characters(M): 
      
    # Since the minimum number 
    # of characters will be 1 
    k = 1
  
    # Calculating number of characters 
    while (True): 
          
        # Since k length string can 
        # represent at most pow(2, k+1)-2 
        # that is if k = 4, it can 
        # represent at most pow(2, 4+1)-2 = 30 
        # so we have to calculate the 
        # length of the corresponding string 
        if (pow(2, k + 1) - 2 < M): 
            k += 1
        else: 
            break
  
    # return the length of 
    # the corresponding string 
    return k 
  
# Function to print corresponding 
# string of 'A' and 'B' 
def print_string(M): 
      
    # Find length of string 
    k = no_of_characters(M) 
  
    # Since the first number that can be  
    # represented by k length string will  
    # be (pow(2, k)-2)+1 and it will be  
    # AAA...A, k times, therefore, N will  
    # store that how much we have to print 
    N = M - (pow(2, k) - 2) 
  
    # At a particular time, 
    # we have to decide whether 
    # we have to print 'A' or 'B', 
    # this can be check by calculating 
    # the value of pow(2, k - 1) 
    while (k > 0): 
        num = pow(2, k - 1) 
  
        if (num >= N): 
            print("A", end = "") 
        else: 
            print("B", end = "") 
            N -= num 
        k -= 1
          
    print("\n", end = "") 
  

M=input()
print_string(M)

### FIXED CODE ###

n = int(input())
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
s = ''
while n>0:
    n -= 1
    i = n % 26
    s += ascii_lowercase[i]
    n = n // 26
out = s[::-1]
print(out)
n = input()
count = 0
for i in n:
  	if i == "×":
      	break
    else:
      	count += 1
print(700+count*100)
  	

### FIXED CODE ###

n = input()
count = 0
for i in n:
    if i == "o":
        count += 1
print(700+count*100)
x = 0
for i in (input()+1):
  x += i
print(x)


### FIXED CODE ###

x = 0
n = int(input())
for i in range(n+1):
  x += i
print(x)
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    N = INT()
    xbin = input()
    xdec = int(xbin, 2)
    m = xbin.count('1')

    num = [0]*2*10**5
    for i in range(1, 2*10**5):
        num[i] = num[i % bin(i).count('1')] + 1
    
    reg = [0]*N
    reg[N-1] = 1
    for i in range(N-2, -1, -1):
        reg[i] = reg[i+1]*2

    for i in range(N):
        if xbin[i] == '0':
            x = xdec + reg[i]
            popcount = m + 1
        else:
            x = xdec - reg[i]
            popcount = m - 1
        print(num[x % popcount] + 1)

if __name__ == '__main__':
    solve()

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    N = INT()
    xbin = input()
    xdec = int(xbin, 2)
    m = xbin.count('1')

    a = xdec % (m+1)
    b = xdec % (m-1) if m > 1 else 0

    num = [0]*N
    for i in range(1, N):
        num[i] = num[i % bin(i).count('1')] + 1

    for i in range(N):
        if xbin[i] == '0':
            y = ( a + pow(2, N-i-1, m+1) ) % ( m+1 )
            print(num[y] + 1)
        elif m <= 1:
            print(0)
        else:
            y = ( b - pow(2, N-i-1, m-1) ) % ( m-1 )
            print(num[y] + 1)

if __name__ == '__main__':
    solve()
import sys

args = sys.argv

length = args[1]
focus = args[2]
abcs = args[3]


def change_upper_to_lower(str, num):
  if(str[int(num)] == "A"):
    str[int(num)] == "a"
  elif(str[int(num)] == "B"):
    str[int(num)] == "b"
  else:
    str[int(num)] == "c"
    
  return str


changed_abcs = change_upper_to_lower(abcs, focus)

print(changed_abcs)


### FIXED CODE ###

import sys

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

abcs = input()
 
def change_upper_to_lower(str, num):
  
  before = str[:int(num) - 1]
  after = str[int(num):]

  if(str[int(num) - 1] == "A"):
    newstr = before + "a" + after
  elif(str[int(num) - 1] == "B"):
    newstr = before + "b" + after
  else:
    newstr = before + "c" + after
    
  return newstr
 
 
changed_abcs = change_upper_to_lower(abcs, b)
 
print(changed_abcs)
a=int(input())
a=int(input())
b=input()
m=len(b)
if m<=a :
  print(b)
else :
  s=b[:a]+'...'
  
  print(s)

### FIXED CODE ###

a=int(input())
b=input()
m=len(b)
if m<=a :
  print(b)
else :
  s=b[:a]+'...'

  print(s)
A = int(input())
B = list(map(int, input().split()))  

dai=[0, 0, 0, 0, 0]
for i, l in enumerate(B):
  if i==0:
    continue
  if B[i-1]-B[i]>0:
    dai[i]=B[i-1]-B[i]
    
print(sum(dai))

### FIXED CODE ###

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

dai=[0 for _ in range(A)]

for i, l in enumerate(B):
  if i==0:
    continue
  if B[i-1]-B[i]>0:
    dai[i]=B[i-1]-B[i]
    B[i]+=B[i-1]-B[i]

print(sum(dai))
n,k = map(int,input().split())



for i in range(k):
    if not((n-k+2 > i)):
        print(1)

    else:
        total = 1
        total2 = 1
        total3 = 1
        for j in range(i+1):
            total *= n-k+1-j
            total2 *= j+1
            total3 = int(total/total2)
            
        ww = (i+1)**(k-i-1)
        ans = ww * total3

        ans2 = ans % 1000000007

        print(ans2)
    


### FIXED CODE ###

n,k = map(int,input().split())
mod = 10**9+7

a = [1 for i in range(2010)]

memo = 1
for i in range(1,2001):
    memo *= i
    a[i] = memo



for i in range(1,k+1):
    if not((n-k+2 > i)):
        print(0)

    else:
        memo1 = a[n-k+1]*a[k-1]
        memo2 = a[i]*a[n-k+1-i]*a[i-1]*a[k-i]

        ans2 = memo1//memo2
        print(ans2%mod)
# 入力                                                                                   
S = input()
K = int(input())

# kindリストに同じ文字が続くものごとに区切ったものを格納                                 
kind = []
back = "0"
len_S = len(S)
i = 0
for moji in S:
    if i == 0:
        back = moji
        i += 1
        continue
    if moji == back[-1]:
        back = moji + back
        if i == len_S-1:
            kind.append(back)
    else:
        kind.append(back)
        back = moji
    i += 1

score = 0
# 最初の文字と最後の文字が異なる時                                                       
if S[0] != S[-1]:
    for word in kind:
        len_word = len(word)
        score += len_word // 2
    print(score*K)
# 最初の文字と最後の文字が一緒の時                                                       
else:
    if len(set(kind)) == 1:
        print((len(kind[0])//2)*K)
    else:
        # 最初と最後がつながることでできる文字列の長さ                                   
        len_sg = len(kind[0] + kind[-1])
        for word in kind[1:-1]:
            len_word = len(word)
            score += len_word // 2
        print(score*K + (len_sg//2)*(K-1) + (len(kind[0]))//2 + (len(kind[-1]))//2 )

### FIXED CODE ###

# 入力                                                                                   
S = input()
K = int(input())

# kindリストに同じ文字が続くものごとに区切ったものを格納                                 
kind = []
back = "0"
len_S = len(S)
i = 0
for moji in S:
    if i == 0:
        back = moji
        i += 1
        continue
    if moji == back[-1]:
        back = moji + back
        if i == len_S-1:
            kind.append(back)
    else:
        kind.append(back)
        back = moji
    i += 1

score = 0
# 文字列が1文字の時
if len(S) == 1:
  	print(K//2)
   
# 最初の文字と最後の文字が異なる時                                                       
elif S[0] != S[-1]:
    for word in kind:
        len_word = len(word)
        score += len_word // 2
    print(score*K)
# 最初の文字と最後の文字が一緒の時                                                       
else:
    if len(set(kind)) == 1:
      	if len(kind) == 1:
          	print(len(kind[0])*K//2)
      	else:
        	print((len(kind[0])//2)*K)
    else:
        # 最初と最後がつながることでできる文字列の長さ                                   
        len_sg = len(kind[0] + kind[-1])
        for word in kind[1:-1]:
            len_word = len(word)
            score += len_word // 2
        print(score*K + (len_sg//2)*(K-1) + (len(kind[0]))//2 + (len(kind[-1]))//2 )
s=list(input())
t="keyence"

for i in range(len(s)):
    if s[i]==t[0]:
        t=t[1:]
if t=="":
    print("YES")
else:
    print("NO")


### FIXED CODE ###

import sys
s=input()

for i in range(len(s)):
    for g in range(i,len(s)):
        if "keyence"==s[:i]+s[g:]:
            print("YES")
            sys.exit()
print("NO")
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq


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

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

data = getInputListInt()
N = data[0]
K = data[1]
MOD = 1000000000 + 7

# nCa
def choose(n, a):
    if n < a: return 0
    if n == 0 or a == 0: return 1
    x = 1
    y = 1
    for i in range(a):
        x *= n-i
        y *= i+1
    return int(x / y)

for i in range(1, K+1, 1):
    blue = choose(K-1, i-1)
    red = choose(N-K-(i-1) +i, i)

    ans = (blue * red) % MOD
    print(int(ans))


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def fast_pow(num, kata, mod):
        if kata == 0:
            return 0

        res = 1
        while kata > 0:
            if kata & 1 == 1:
                res = res * num % mod
            num = num * num % mod

            kata >>= 1
        return res

    # MODのCombination nがでかくても関係なくrに依存　r<10**6なら回せる
    MOD = 10 ** 9 + 7

    def choose(n, r):
        res = 1
        fac = 1
        for i in range(r):
            res *= n - i
            res %= MOD
            fac *= i + 1
            fac %= MOD
        return res * fast_pow(fac, MOD - 2, MOD) % MOD

    n, k = ns()

    for i in range(1, k + 1):
        blue_pair = choose(k - i + (i - 1), i - 1)
        red_pair = choose((n - k) + 1, i)
        print(blue_pair * red_pair % MOD)


if __name__ == '__main__':
    main()
import sys
s = sys.stdin.readline()
i = 0
l = len(s)
flag = True
while flag and i <= l:
  if s[i] != s[l-1]:
    flag = False
  i += 1
  l -= 1
l = len(s)
a = s[0:(l-1)/2]
i = 0
l = len(a)
while flag and i <= l:
  if a[i] != a[l-1]:
    flag = False
  i += 1
  l -= 1
b = s[(len(s) + 3)/2 - 1:]
i = 0
l = len(b)
while flag and i <= l:
  if b[i] != b[l-1]:
    flag = False
  i += 1
  l -= 1
if flag:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

import sys
s = sys.stdin.readline().rstrip()
i = 0
l = len(s)
flag = True
while flag and i <= l:
  if s[i] != s[l-1]:
    flag = False
  i += 1
  l -= 1
l = len(s)
a = s[0:-(-(l-1)//2)]
i = 0
l = len(a)
while flag and i <= l:
  if a[i] != a[l-1]:
    flag = False
  i += 1
  l -= 1
b = s[(len(s) + 3)//2 - 1:]
i = 0
l = len(b)
while flag and i <= l:
  if b[i] != b[l-1]:
    flag = False
  i += 1
  l -= 1
if flag:
  print('Yes')
else:
  print('No')
dict={"A":"T","T":"A","G":"C","C":"G"}
print(dict(input))

### FIXED CODE ###

dict={"A":"T","T":"A","G":"C","C":"G"}
print(dict[input()])
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        for i in range(3):
            print(i+1)
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if i == m-2:
                    i += 4
                if j == n-1:
                    ans += a
                    i -= 1
                    if i == m + 1:
                        i += 1
                else:
                    ans.append(i)
        for i in range(2*n-1):
            print(ans[i])





### FIXED CODE ###

import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        ans = [1,2,3]
        print(jo(ans))
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if j == n-2:
                    ans += a
                    i -= 1
                else:
                    if i == m-2:
                        i += 4
                    ans.append(i)
        print(jo(ans))
1 1
1000

### FIXED CODE ###

n,k = list(map(int, input().split(' ')))
p = list(map(int, input().split(' ')))
p.sort()
print(sum(p[:k]))
from collections import deque
from copy import deepcopy

N,M = map(int,input().split())
Matrix = [[False for x in range(N)] for j in range(N)]

Path = []
for i in range(M) :
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    Path.append((a,b))
    Matrix[a][b] = True
    Matrix[b][a] = True

INF = 63
ans = 0
for i in range(M) :
    Matrix_duplicated = deepcopy(Matrix)
    a,b = Path[i]
    Matrix_duplicated[a][b] = False
    Matrix_duplicated[b][a] = False
    Distance = [INF for i in range(N)]
    Distance[0] = 0
    Queue = deque([0])
    while Queue :
        now = Queue.popleft()
        Visited.append(now)
        for i in range(N) :
            if Matrix_duplicated[now][i] :
                Matrix_duplicated[now][i] = False
                Matrix_duplicated[i][now] = False
                Distance[i] = min(Distance[now]+1, Distance[i])
                Queue.append(i)
    if INF in Distance :
        ans += 1
print(ans)


### FIXED CODE ###

from collections import deque
from copy import deepcopy

N,M = map(int,input().split())
Matrix = [[False for x in range(N)] for y in range(N)]

Path = []
for i in range(M) :
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    Path.append((a,b))

for i in range(M) :
    a,b = Path[i]
    Matrix[a][b] = True
    Matrix[b][a] = True
    
ans = 0
for i in range(M) :
    a,b = Path[i]
    Matrix_ = deepcopy(Matrix)
    Matrix_[a][b] = False
    Matrix_[b][a] = False
    INF = 63
    Distance = [INF for i in range(N)]
    Distance[0] = 0
    
    QUEUE = deque([0])
    while QUEUE :
        now = QUEUE.popleft()
        
        for i in range(N) :
            if Matrix_[now][i] :
                Matrix_[now][i] = False
                Matrix_[i][now] = False
                Distance[i] = min(Distance[now]+1,Distance[i])
                QUEUE.append(i)
    #print(Distance)
    if (INF in Distance) :
        ans += 1
print(ans)
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = finish/start
for i in range(ite):
	if i == ite-1:
      nums = list(range(start *i, finish ))
    else:
	  nums = list(range(start *i, start*(i+1) ))
	tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
    count += len(tmp)
print(count)


### FIXED CODE ###

import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
s = lcm(int(C),int(D))
#s = int(C)*int(D)
#numac = int(A)//int(C)#10//6 = 1
#numad = int(A)//int(D)#10//8 = 1
#numacd = int(A)//s#10//24 = 0
numa = int(A)//int(C) + int(A)//int(D) - int(A)//s
#numa = 1
#numbc = int(B)//int(C)#40//6 = 6
#numbd = int(B)//int(D)#40//8 = 5
#numbcd = int(B)//s#40//24= 1
numb = int(B)//int(C) + int(B)//int(D) - int(B)//s
#numb = 1
print(int(B)-int(A)-(numb - numa))
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n,c = map(int,input().split())
    xv = [list(map(int,input().split())) for i in range(n)]
    x = [xv[i][0] for i in range(n)]
    v = [xv[i][1] for i in range(n)]
    r1,r2,l1,l2 = [0]*(n+1),[0]*(n+1),[0]*(n+1),[0]*(n+1)
    ans = 0
    dis = 0
    for i in range(n):
        r1[i+1] = r1[i]+v[i]-(x[i]-dis)
        r2[i+1] = r2[i]+v[i]-2*(x[i]-dis)
        dis = x[i]
    dis = c
    for i in reversed(range(n)):
        l1[n-i] = l1[n-i-1]+v[i]-(dis-x[i])
        l2[n-i] = l1[n-i-1]+v[i]-2*(dis-x[i])
        dis = x[i]
    for i in range(n):
        l1[i+1] = max(l1[i+1],l1[i])
        r1[i+1] = max(r1[i+1],r1[i])
    for i in range(n+1):
        ans = max(ans,max(r2[i]+l1[n-i],l2[i]+r1[n-i]))
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================
    

### FIXED CODE ###

# -*- coding: utf-8 -*-
S = str(input())
T = S.count("o")
print("{}".format(700 + 100 * T))
import math


def run(A, B):
    return A * B // math.gcd(A, B)


def main():
    A, B = map(int, input().split())
    print(run(A, B))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import fractions


def run(A, B):
    return A * B // fractions.gcd(A, B)


def main():
    A, B = map(int, input().split())
    print(run(A, B))


if __name__ == '__main__':
    main()
n=int(input())
a=[int(x) for x in input().split()]
flag=True
for i in a:
  if i%2==0:
    if i%3==0 or i%5==0:
      f=True
    else:
      f=False
      break
if f:
  print("APPROVED")
else:
  print("DENIED")

### FIXED CODE ###

n=int(input())
a=[int(x) for x in input().split()]
f=True
for i in a:
  if i%2==0:
    if i%3==0 or i%5==0:
      f=True
    else:
      f=False
      break
if f:
  print("APPROVED")
else:
  print("DENIED")
a = list(input.split())
res = 0

num = a.pop(0) * 2

for i in range(a):
    if (a[i] == 'BTC'):
        b = int(a[i-1]) * 380000
        res += b
    elif (a[i] == 'JPY'):
        res += int(a[i-1])
    else:
        pass

print(res) 

### FIXED CODE ###

a = int(input())

b = []

for i in range(a):
    b.append(input().split())

res = 0

for i in b:
    if (i[1] == 'BTC'):
        res += float(i[0])*380000
    else:
        res += int(i[0])

print(res)
s = input()
t = input()

sl = len(s)
tl = len(t)

lst = []
for i in range(sl):
    if s[i] == t[0]:
        lst.append(i)
        
k = []

for i in lst:
    cnt = 0
    for j in range(tl):
        if s[i+j]==t[j] or s[i+j]=='?':
            cnt += 1
    if cnt == tl:
        ans = s[:i] + t + s[i+tl:]
        ans = ans.replace('?','a')
        k.append(ans)

if len(k)==0:
    print('UNRESTORABLE')
else:
    
    kk = sorted(k)
    print(kk[0])

### FIXED CODE ###

s_dash = input()
t = input()
len_s = len(s_dash)
len_t = len(t)
candidates = set()

for i in range(len_s - len_t + 1):
    part_s = s_dash[i:i+len_t+1]
    flag = True
    for j,k in zip(part_s,t):
        if j=='?' or j==k:
            continue
        else:
            flag = False
            break
    if flag:
        candidates.add(s_dash[0:i].replace("?","a")+t+s_dash[i+len_t::].replace("?","a"))

ret = 'UNRESTORABLE'
if len(candidates)>0:
    ret = min(candidates)
print(ret)
k = input()
s = input()
i = 0
l = int(k)
p = str()

while i < l:
    p = p + s[i]
    i = i + 1

print(p)

### FIXED CODE ###

k = input()
s = input()
i = 0
l = int(k)
p = str()
 
while i < l and len(s) > l:
    p = p + s[i]
    i = i + 1
while i < len(s) and len(s) <=l:
    p = p + s[i]
    i = i + 1
if len(s) > l:
	print(p + '...')
else:
	print(p)