Harryxun/stf_run huggingface dataset:
import sys

while True:
	n, x = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 == n and 0 == x:
		break
		
	cnt = 0
	ave = x / 3
	for i in range( 1, ave ):
		for j in range( i+1, n ):
			if  x <= ( i+j ):
				break
			for k in range( j+1, n+1 ):
				s = ( i + j + k )
				if x == s:
					cnt += 1
					break
				elif   x < s:
					break
	
	print( cnt )

### FIXED CODE ###

import sys

while True:
	n, x = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 == n and 0 == x:
		break
		
	cnt = 0
	ave = x // 3
	for i in range( 1, ave ):
		ave2 = (x-i) // 2
		for j in range( i+1, ave2+1 ):
			k = x-i-j
			if j < k and k <= n:
				cnt += 1
	
	print( cnt )
# coding: utf-8
# Your code here!

a,b = input().split()
a = int(a)
b = int(b)
ngo = 1
ans = 0
while ngo < b:
    ngo += a-1
    ans + =1
print(ans)

### FIXED CODE ###

# coding: utf-8
# Your code here!

a,b = input().split()
a = int(a)
b = int(b)
ngo = 1
ans = 0
while ngo < b:
    ngo += a-1
    ans += 1
print(ans)
#from functools import lru_cache
import sys
import math
def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

ls = rvfunc(int)(reader())
n,k=ls[0]
a=ls[1]

def reqk(num):
    return sum(vfunc(lambda aa:math.ceil(aa/float(num))-1)(a))
def binary_search(imin=None,imax=None):
    if [imin,imax]==[None]*2: imin,imax=0,10**9
    if (imax < imin):
        return imin
    else:
        imid = int(imin + (imax - imin) / 2)
        if (reqk(imid)<k):return binary_search(imin, imid - 1)
        elif (reqk(imid)>k):return binary_search(imid + 1, imax)
        else:return imid
print(binary_search() if k!=0 else max(a))


### FIXED CODE ###

#from functools import lru_cache
import sys
from itertools import product
from itertools import combinations
from functools import reduce

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

k=int(input())
t=0
m=7%k
md=7%k
for i in range(k+1):
    if m==0:break
    else:
        md=(md*10)%k
        m=(m+md)%k
if i==k: i=-2
print(i+1)
from fractions import gcd

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

M = max(A)
G = gcd(A[0], A[1])
for i in range(2, N):
    G = gcd(G, A[i])
# print(M, G)

if K <= M and K % G == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

from fractions import gcd

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

M = max(A)
G = A[0]
for i in range(1, N):
    G = gcd(G, A[i])

if K <= M and K % G == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
N = int(input())
a_list = list(map(int, input().split()))

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count == N:
    result = 'Yes'
elif two_count * 2 + 1 >= N:
    if (N - two_count) == 1:
        if four_count >= 1:
            result = 'Yes'
    else:
        if (N - two_count) - 1<= four_count:
            result = 'Yes'


print(result)


### FIXED CODE ###

n ,m = [int(i) for i in input().split()]
print((n - 1) * (m - 1))
n=int(input())
a=[str() for i in range(n)]
b=[]
for j in range(n):
  for k in range(n):
    if a[j]==a[k]:
      b=a[j]
b.sort()
print(b)

### FIXED CODE ###

def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
#s = {s():0 for _ in range(n)}

a = {}
for i in range(n):
	s = input()
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
b = sorted(a.items(),key = lambda x:x[0])

memo = max([i[1] for i in a.items()])
for i in b:
	"""print(i,"i")
	print(i[0],"i[0]")
	print(i[1],"i[1]")
	print(max(b)[0],"max(b)[0]")"""
	if i[1] == memo:
		print(i[0])
n=int(input())
import math
a=math.floor(math.sqrt(n/6))+1
for i in range(1,n+1):
    t=0
    for x in range(1,a):
        b=math.floor(math.sqrt((i-x**2)/3))+1
        for y in range(x,b):
            c=math.floor(math.sqrt(i-x**2-y**2-x*y))+1
            for z in range(y,c):
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    if x==y and y==z:
                        t+=1
                    elif x!=y and y!=z and z!=x:
                        t+=6
                    else:
                        t+=3
    print(t)

### FIXED CODE ###

n=int(input())
import math
for i in range(1,n+1):
    t=0
    for x in range(1,101):
        if (x**2)*6>i:
            break
        for y in range(x,101):
            if x**2+3*(y**2)+2*x*y>i:
                break
            B=(x+y)
            C=x**2+y**2+x*y-i
            r=(B**2-4*C)**0.5
            z1=(-B+r)/2
            z2=(-B-r)/2
            if z1.is_integer() and z1>0:
                if x==y and y==z1:
                    t+=1
                elif x!=y and y!=z1 and z1!=x:
                    t+=6
                else:
                    t+=3
            if z2.is_integer() and z2>0:
                if x==y and y==z2:
                    t+=1
                elif x!=y and y!=z2 and z2!=x:
                    t+=6
                else:
                    t+=3
    print(t)
def sieve(n):
	p=[True]*(n+1)
	p[0]=p[1]=False
	for i in range(2,n+1,2):
		if p[i]==True:
			for j in range(i*i,n+1,i):
				p[j]=False
	return p

def solve(n):
		if n<2:return 0
		c=1
		for i in range(3,n+1,2):
			if p[i]==1:
				c+=1
		return c

p=sieve(1e6)
while True:
	try:
		n = int(input())
		print(solve(n))
	except EOFError:
		break

### FIXED CODE ###

def sieve(n):
	p=[True for i in range(n+1)]
	p[0]=p[1]=False
	for i in range(2,n+1):
		if p[i]==True:
			for j in range(i*i,n+1,i):
				p[j]=False
	return p

def solve(n):
		if n<2:return 0
		c=1
		for i in range(3,n+1,2):
			if p[i]==1:
				c+=1
		return c

p=sieve(1000000)
while True:
	try:
		n = int(input())
		print(solve(n))
	except EOFError:
		break
a,b = map(int,input().split())
print(max(a + b,a - b,a*b)

### FIXED CODE ###

a,b = map(int,input().split())
print(max(a + b,a - b,a*b))
l = [0] * 2
l = raw_input().split()
a = l[0]
b = l[1]
if a == b:
print a, "=", b
elif a < b:
print a, "<", b
else:
print a, ">", b

### FIXED CODE ###

i = list(map(int, input().split()))

if i[0] > i[1]:
    print("a > b")
elif i[0] < i[1]:
    print("a < b")
else:
    print("a == b")
import math
a,b,c,d=map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

i_max=b//c
j_max=b//d
k_max=b//lcm(c,d)

i_min=a//c
j_min=a//d
k_min=a//lcm(c,d)

i=i_max-i_min
j=j_max-j_min
k=k_max-k_min

print(b-a+1-(i+j-k))


### FIXED CODE ###

from fractions import gcd
a,b,c,d=map(int,input().split())

def lcm(a, b):
    return a * b // gcd (a, b)

e=lcm(c,d)

i_max=b//c
j_max=b//d
k_max=b//e

i_min=a//c
if a%c==0:
    i_min-=1
j_min=a//d
if a%d==0:
    j_min-=1
k_min=a//e
if a%e==0:
    k_min-=1

i=i_max-i_min
j=j_max-j_min
k=k_max-k_min

print(b-a+1-(i+j-k))
import sys

def main():
    data = []
    while(True):
        line = raw_input()
        if not line: break
        data.append(line)
    for answer in proc(data):
        print answer
    return 0

def proc(data):
    return [passwd for passwd in data if is_hitofude(passwd)]

def is_hitofude(text):
    for first, second in get_pair(text):
        if second == '': break
        if not _can_slide(first, second):
            return False
    return True

def get_pair(text):
    pair_list = list(text)
    pair_list.reverse()
    while(True):
        if 2 <= len(pair_list):
            yield (pair_list.pop(), pair_list[-1])
        elif 1 == len(pair_list):
            yield (pair_list.pop(), '')
        else:
            break

matrix = ["ABC",
          "DEF",
          "GHI"]
pair = []
for y, row in enumerate(matrix):
    for x, base in enumerate(row):
        if x+1 < len(row): pair.append((base, row[x+1])) #EF
        if 0 <= x-1 : pair.append((base, row[x-1])) #ED
        if y+1 < 3: pair.append((base, matrix[y+1][x])) #EH
        if 0 <= y-1: pair.append((base, matrix[y-1][x])) #EB

def _can_slide(first, second):
    return (first, second) in pair

if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys

def main():
    data = []
    for passwd in sys.stdin.readlines():
        data.append(passwd.strip())
    for answer in proc(data):
        print answer
    return 0

def proc(data):
    return [passwd for passwd in data if is_hitofude(passwd)]

def is_hitofude(text):
    for first, second in get_pair(text):
        if second == '': break
        if not _can_slide(first, second):
            return False
    return True

def get_pair(text):
    pair_list = list(text)
    pair_list.reverse()
    while(True):
        if 2 <= len(pair_list):
            yield (pair_list.pop(), pair_list[-1])
        elif 1 == len(pair_list):
            yield (pair_list.pop(), '')
        else:
            break

matrix = ["ABC",
          "DEF",
          "GHI"]
pair = []
for y, row in enumerate(matrix):
    for x, base in enumerate(row):
        if x+1 < len(row): pair.append((base, row[x+1])) #EF
        if 0 <= x-1 : pair.append((base, row[x-1])) #ED
        if y+1 < 3: pair.append((base, matrix[y+1][x])) #EH
        if 0 <= y-1: pair.append((base, matrix[y-1][x])) #EB

def _can_slide(first, second):
    return (first, second) in pair

if __name__ == '__main__':
    main()
def get_survivors(n, pairs):
    survivors = {v: {v} for v in range(n)}
    for x, y in reversed(pairs):
        for v, srv in survivors.copy().items():
            if x in srv:
                if y in srv:
                    del survivors[v]
                else:
                    srv.add(y)
            elif y in srv:
                srv.add(x)
    return survivors.values()


def solve(n, pairs):
    survivors = get_survivors(n, pairs)
    ans = 0

    for i, su in enumerate(survivors):
        for sv in survivors[i + 1:]:
            if su.isdisjoint(sv):
                ans += 1
    return ans


n, m = map(int, input().split())
pairs = []
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    pairs.append((x, y))
print(solve(n, pairs))


### FIXED CODE ###

def get_survivors(n, pairs):
    survivors = {v: {v} for v in range(n)}
    for x, y in reversed(pairs):
        for v, srv in survivors.copy().items():
            if x in srv:
                if y in srv:
                    del survivors[v]
                else:
                    srv.add(y)
            elif y in srv:
                srv.add(x)
    return survivors


def solve(n, pairs):
    survivors = get_survivors(n, pairs)
    ans = 0
    for u, su in survivors.items():
        for v, sv in survivors.items():
            if u >= v:
                continue
            if su.isdisjoint(sv):
                ans += 1
    return ans


n, m = map(int, input().split())
pairs = []
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    pairs.append((x, y))
print(solve(n, pairs))
N,M = map(int, input().split())
answer = ['0']* (N-1)
answer.insert(0,1)
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))




### FIXED CODE ###


N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,'1')
else:
    answer =['0']
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))
n,x=map(int, input().split())
l =list(map(int,input().split()))

sum = 0
ans = 0

while sum+l[ans] <= x:
    sum+=l[ans]
    ans += 1
    
print(ans+1)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))

sum = 0
ans = 0

for i in range(n):
    if sum + l[ans] > x:
        break
    sum += l[ans]
    ans += 1

print(ans+1)
output (x**3)


### FIXED CODE ###

x = input()
x = int(x)
print(x**3)
def find(tab, a):
    try:
        if tab[0][a]==-1:
            return a
        tab[0][a] = find(tab, tab[0][a])
        return tab[0][a]
    except:
        pass

def union(tab, a, b):
    p1, p2 = find(tab, a), find(tab, b)
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[-1]*N, [1]*N]
arr = []



for a, b in reversed(ABs):
    a, b = a-1, b-1
    pa, pb = find(tab, a), find(tab, b)
    na, nb = size(tab, pa), size(tab, pb)
    if pa!=pb:
        dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
        arr.append(dn)
        union(tab, a, b)
    else:
        arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)


### FIXED CODE ###

A, B, C = [int(a) for a in input().split()]
print(min(C, B//A))
n = 6;
a = [input() for i in range(n)];

k = a[-1];
ans = "Yay!";

for i in range(n-1):
  for j in reversed(range(n-1)):
    if k < a[i] - a[j]:
      ans = ":( ";
      break;
print ans;

### FIXED CODE ###

n = 6;
a = [input() for i in range(n)];
 
k = a[-1];
ans = "Yay!";
 
for i in range(n-1):
  for j in reversed(range(n-1)):
    if k < a[i] - a[j]:
      ans = ":( ";
      break;
print ans;
n=int(input())
x_=input()
px=x_.count("1")
if not px:
    print(0)
    for i in range(n-1):
        print(1)
    exit()
if px==1:
    for i in range(n):
        if int(x_[-i-1]):
            print(0)
        else:
            if not i or int(x[-1])==1:###
                print(2)
            else:
                print(1)
    exit()
x=int(x_,2)

pow2=[1]

for i in range(n):
    tmp=pow2[-1]
    tmp*=2
    tmp%=px+1
    pow2.append(tmp)
pow22=[1]
for i in range(n):
    tmp=pow22[-1]
    tmp*=2
    tmp%=px-1
    pow22.append(tmp)
x1=x%(px+1)
x2=x%(px-1)
ans=[]
for i in range(n):
    tmp=0;dv=0
    if int(x_[-i-1]):
        tmp=x2-pow22[i]
        tmp%=(px-1)
        dv=px-1
    else:
        tmp=x1+pow2[i]
        tmp%=(px+1)
        dv=px+1
    
    cnt=1
    while tmp:
        
        dv=bin(tmp).count("1")
        if not dv or not tmp:
            break
        
        tmp%=dv
        cnt+=1
    ans.append(cnt)
for i in ans[::-1]:
    print(i)


### FIXED CODE ###

n=int(input())
x_=input()
px=x_.count("1")
if not px:
    for i in range(n):
        print(1)
    exit()
if px==1:
####[上から] i 桁目
    for i in range(n):
        if int(x_[i]):
            print(0)
        else:
            if i==n-1 or int(x_[-1])==1:###
                print(2)
            else:
                print(1)
    exit()
x=int(x_,2)

pow2=[1]

for i in range(n):
    tmp=pow2[-1]
    tmp*=2
    tmp%=px+1
    pow2.append(tmp)
pow22=[1]
for i in range(n):
    tmp=pow22[-1]
    tmp*=2
    tmp%=px-1
    pow22.append(tmp)
x1=x%(px+1)
x2=x%(px-1)
ans=[]
for i in range(n):
    tmp=0;dv=0
    if int(x_[-i-1]):
        tmp=x2-pow22[i]
        tmp%=(px-1)
        dv=px-1
    else:
        tmp=x1+pow2[i]
        tmp%=(px+1)
        dv=px+1
    
    cnt=1
    while tmp:
        
        dv=bin(tmp).count("1")
        if not dv or not tmp:
            break
        
        tmp%=dv
        cnt+=1
    ans.append(cnt)
for i in ans[::-1]:
    print(i)
a = int(input())

b = []

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

b.sort()

c = []

if a % 2 == 0:
  k = a//2
else:
  k = a//2+1

bb = b[0:k]

bbb = b[k:]

j = len(bb)-1
jj = len(bbb)
bbb.reverse()
i = 0
ii = 0
c.append(bb[-1])
for llll in range(a-1):
    if i != j and ii != jj:
        p = abs(c[-1]-bb[i])
        pp = abs(c[-1]-bbb[ii])
        if max(abs(c[-1]-bb[i]),abs(c[-1]-bbb[ii])) == p:
            c.append(bb[i])
            c.append(bbb[ii])
            i += 1
            ii += 1
            llll += 1
        else:
            c.append(bbb[ii])
            c.append(bb[i])
            i += 1
            ii += 1
            llll += 1
    elif i == j:
        c.append(bbb[ii])
        ii += 1
    elif ii == jj:
        c.append(bb[i])
        i += 1

su = 0
for i in range(a-1):
    su += abs(c[i]-c[i+1])
print(su)



### 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 = onem()
a = []
for i in range(n):
    a.append(onem())
a.sort()
bbb = a[n//2+(n%2):]
bbb.reverse()

bbbb = a[n//2:]

if len(bbb) >= 3:
    bbbb = [bbbb[0]] + bbbb[2:] + [bbbb[1]]


aaa = a[:n//2+(n%2)]
if len(aaa) >= 3:
    aaa = [aaa[-1]] + aaa[:-2] + [aaa[-2]]

aaaa = a[:n//2]

lll = []
llll = []

for i in range(n):
    if i % 2 == 0:
        lll.append(aaa[i//2])
        llll.append(bbbb[i//2])
    else:
        lll.append(bbb[i//2])
        llll.append(aaaa[i//2])
ans = 0
an = 0
for i in range(n):
    if i == 0:
        st = lll[0]
        stt = llll[0]
    else:
        ans += abs(lll[i] - st)
        st = lll[i]
        an += abs(llll[i] - stt)
        stt = llll[i]
print(max(ans,an))
n = int(input())
plist = [tuple(map(int, input().split())) for i in range(n)]

for x in range(0,101):
    for y in range(0,101):
        h = -1
        for i in plist:
            if plist[2] == 0:
                continue
            diff = abs(i[0]-x) + abs(i[1]-y)
            if h == -1:
                h = diff + i[2]
            else:
                if h != diff + i[2] or diff + i[2] == 0:
                    break
        else:
            print("{} {} {}".format(x, y, h))

### FIXED CODE ###

n = int(input())
plist = [tuple(map(int, input().split())) for i in range(n)]
plist = sorted(plist, key = lambda x: -x[2])

for x in range(0,101):
    for y in range(0,101):
        h = -1
        for i in plist:
            diff = abs(i[0]-x) + abs(i[1]-y)
            if h == -1:
                h = diff + i[2]
            elif i[2] == 0:
                if h > diff:
                    break
            else:
                if h != diff + i[2]:
                    break
        else:
            if h <= 0:
                pass
            else:
                print("{} {} {}".format(x, y, h))
X = int(input())
for i in range(1, 10**9):
    if pow(i, 5, X-1) == 0:
        a = i

print(a, -1)


### FIXED CODE ###

X = int(input())
for a in range(-200, 200):
    for b in range(-200, 200):
        if a**5 - b**5 == X:
            print(a, b)
            exit()
# Aizu Problem ITP_1_4_B: Circle
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

pi = math.pi
r = int(input())
print("%.6f %.6f" % (pi * r**2, 2 * pi * r))

### FIXED CODE ###

# Aizu Problem ITP_1_4_B: Circle
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

pi = math.pi
r = float(input())
print("%.6f %.6f" % (pi * r**2, 2 * pi * r))
import fractions

def lcm(a,b):
    g = fractions.gcd(a,b)
    return (a/g) * b

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)

print(int(ans))

### FIXED CODE ###

n = input()

if n == n[::-1]:
    print("Yes")
else:
    print("No")
N, M = map(int, input().split())

A = list(map(int, input().split()))
B = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

DP = [-1]*(N+1)
DP[0] = 0 

for i in range(N):
    for j in A:
        if i+B[j] <= N:
            DP[i+B[j]] = max(DP[i]*10+i,DP[i+B[j]])

print(DP[N+1]) 

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [-1]*(N+1)
dp[0]=0  
for i in range(N+1):
    for j in A:
        if i + B[j] <= N:
            dp[i+B[j]]= max(dp[i]*10+j, dp[i+B[j]])
print(dp[N])
S,T=input().split()
A,B=map(int,input().split())
U=input()

if S=U:
  print(A-1, B)
else:
  print(A, B-1)

### 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)
# Author: cr4zjh0bp
# Created: Tue Mar 24 00:01:43 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import Counter

n = ni()
a = na()
c = Counter(a)
m = list(c.items())
m.sort(reverse=True)
xy = [0] * 2
i = 0
flag = False
for k, v in m:
    if v >= 4:
        if i != 0:
            print(xy[0] * k)
        else:
            print(k * K)
        flag = True
        break
    elif v >= 2:
        xy[i] = k
        i += 1
        if i == 2:
            print(xy[0] * xy[1])
            flag = True
            break
if not flag:
    print(0)

### FIXED CODE ###

# Author: cr4zjh0bp
# Created: Tue Mar 24 00:01:43 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import Counter

n = ni()
a = na()
c = Counter(a)
m = list(c.items())
m.sort(reverse=True)
xy = [0] * 2
i = 0
flag = False
for k, v in m:
    if v >= 4:
        if i != 0:
            print(xy[0] * k)
        else:
            print(k * k)
        flag = True
        break
    elif v >= 2:
        xy[i] = k
        i += 1
        if i == 2:
            print(xy[0] * xy[1])
            flag = True
            break
if not flag:
    print(0)
a, b = map(int, input().split())
print(6 - a - b)

### FIXED CODE ###

a = int(input())
b = int(input())
print(6 - a - b)
S=input()
flag = True
 
for i in range(len(S)):
  if i%2==0 and S[i] == R:
    print('No')
    flag = False
    break
  elif i%2==1 and S[i] == L:
    print('No')
    flag = False
    break
if flag:
  print('Yes')

### FIXED CODE ###

s=input()
flag=True
for i in range(len(s)):
  if i%2==1 and s[i]=="R":
    flag=False
    break
  elif i%2==0 and s[i]=="L":
    flag = False
    break
if flag:
  print('Yes')
else:
  print('No')