Harryxun/stf_run huggingface dataset:
n=int(input())
a=list(map(int,input().split()))
x=[0]*(1e9+10)
edge=[0]*2
for i in a:
  x[i]+=1
  if x[i]==2:
    edge.append(i)
    x[i]=0
edge.sort(reverse=True)
print(edge[0]*edge[1])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
x={}
edge=[0]*2
for i in a:
  if i in x:
    x[i]+=1
    if x[i]==2:
      edge.append(i)
      x[i]=0
  else:
    x[i]=1
edge.sort(reverse=True)
print(edge[0]*edge[1])
N = int(input())

M = []
for _ in range(N):
  t, x, y = map(int, input().split())
  M.append([t, x, y])

current = [0, 0, 0]
can = True
for m in M:
  dt = m[0] - current[0]
  dist = abs(m[1] - current[1]) + abs(m[2] - current[2])
  if (dist > dt):
    can = False
    break
  else:
    if (dist % 2 != dt % 2):
      can = False
      break
  current = m

result = "Yes" if (can == True) else "No"
print(result)


### FIXED CODE ###

a, b = map(int, input().split())
result = "Even" if (a*b % 2 == 0) else "Odd"
print(result)
while 1:
   x, y = input()
   if x == 0 and y == 0:
      break
   if x < y:
      print (x y)
   if x > y:
      print (y x)

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x <= y:
      print "%d %d" %(x, y)
   elif x > y:
      print "%d %d" %(y, x)
def main():
    # input
    N, T = map(int, input().split())
    a, b = [], []
    a0_b = []
    for i in range(N):
        a_in, b_in = map(int, input().split())
        if a_in == 0:
            a0_b.append(b_in)
        else:
            a.append(a_in)
            b.append(b_in)
    L = len(a)

    # sort
    ab_ratio = [a[i] / (b[i] + 1) for i in range(L)]
    key = sorted(range(L), key=lambda x: -ab_ratio[x])
    a = [a[i] for i in key]
    b = [b[i] for i in key]
    a0_b.sort()

    # --- case a >= 1 --- #
    # dp[for i shops][passed j shops] := min time
    # j:29 for T < 10^9
    J_MAX = min(L + 1, 29)
    dp = [[float('inf') for _ in range(J_MAX)] for _ in range(L + 1)]
    dp[0][0] = 0
    for i in range(L):
        for j in range(J_MAX):
            if j > 0:
                dt = 1 + a[i] * (dp[i][j - 1] + 1) + b[i]
                if dp[i][j - 1] + dt <= T:
                    dp[i + 1][j] = min(dp[i][j], dp[i][j - 1] + dt)
                else:
                    dp[i + 1][j] = dp[i][j]
            else:
                dp[i + 1][j] = dp[i][j]

    # --- case a = 0 --- #
    ans = 0
    for i in range(J_MAX):
        if dp[N][i] == float('inf'):
            break
        else:
            time_cnt = dp[N][i]
            shop_cnt = i
            for t_b in a0_b:
                if time_cnt + t_b <= T:
                    time_cnt += t_b
                    shop_cnt += 1
            if ans < shop_cnt:
                ans = shop_cnt

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    # input
    N, T = map(int, input().split())
    a, b = [], []
    a0_b = []
    for i in range(N):
        a_in, b_in = map(int, input().split())
        if a_in == 0:
            a0_b.append(b_in)
        else:
            a.append(a_in)
            b.append(b_in)
    L = len(a)

    # sort
    ab_ratio = [a[i] / (b[i] + 1) for i in range(L)]
    key = sorted(range(L), key=lambda x: -ab_ratio[x])
    a = [a[i] for i in key]
    b = [b[i] for i in key]
    a0_b.sort()

    # --- case a >= 1 --- #
    # dp[for i shops][passed j shops] := min time
    # j:29 for T < 10^9
    J_MAX = min(L + 1, 29)
    dp = [[float('inf') for _ in range(J_MAX)] for _ in range(L + 1)]
    dp[0][0] = 0
    for i in range(L):
        for j in range(J_MAX):
            if j > 0:
                dt = 1 + a[i] * (dp[i][j - 1] + 1) + b[i]
                if dp[i][j - 1] + dt <= T:
                    dp[i + 1][j] = min(dp[i][j], dp[i][j - 1] + dt)
                else:
                    dp[i + 1][j] = dp[i][j]
            else:
                dp[i + 1][j] = dp[i][j]

    # --- case a = 0 --- #
    ans = 0
    for i in range(J_MAX):
        if dp[L][i] == float('inf'):
            break
        else:
            time_cnt = dp[L][i]
            shop_cnt = i
            for t_b in a0_b:
                if time_cnt + 1 + t_b <= T:
                    time_cnt += 1 + t_b
                    shop_cnt += 1
            if ans < shop_cnt:
                ans = shop_cnt

    print(ans)


if __name__ == '__main__':
    main()
import itertools as it
n,m,k=list(map(int,input().split()))
S=[list(str(input())) for h in range(m)]
ans=0
for i in it.product([0,1],repeat=n):
  for j in it.product(range(2),repeat=m):
    count=0
    for h in range(n):
      for c in range(m):
        if S[h][c]=="#" and i[h]+j[c]==0:
          count+=1
    if count==k:
      ans+=1
print(ans)

### FIXED CODE ###

import itertools as it
H,W,N=map(int,input().split())
c=[list(input()) for t in range(H)]
ans=0
for con in it.product(range(2),repeat=H):
  for row in it.product(range(2),repeat=W):
    count=0
    for h in range(H):
      for w in range(W):
        if c[h][w]=='#' and con[h]==1 and row[w]==1 :
          count+=1
    if count==N:
      ans+=1
print(ans)
A,B = map(int, input().split())

if if A-B <=1 or B-A <=1:
	print("Yay!")
else:
	print(":(")


### FIXED CODE ###

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

if A<9 and B<9:
	print("Yay!")
else:
	print(":(")
n=int(input())
sp=0
A=list(map(int,input.split()))
for i in range(n):
  if i+1!=A[i]:
    sp+=1
if sp==0 or sp==2:
  print("YES")
  exit()
print("NO")


### FIXED CODE ###

n=int(input())
sp=0
A=list(map(int,input().split()))
for i in range(n):
  if i+1!=A[i]:
    sp+=1
if sp==0 or sp==2:
  print("YES")
  exit()
print("NO")
import sys
from math import gcd
from functools import reduce

def solve():
    n = int(input())
    a = [int(i) for i in input().split()]

    ans = reduce(lcm, a, 1)

    print(ans)

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

if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
from fractions import gcd
from functools import reduce

def solve():
    n = int(input())
    a = [int(i) for i in input().split()]

    ans = reduce(lcm, a, 1)

    print(ans)

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

if __name__ == '__main__':
    solve()
n,l = map(int,input().split())
s = []
for i in range(n):
    s.append(input())
s.sort()
print(s[0]+s[1]+s[2])

### FIXED CODE ###

n,l = input().split()
n = int(n)
s = []
for i in range(n):
    s.append(input())
s.sort()
print("".join(s))
def main():
  x=[]
  r,D,X=map(int,input().split())
  x.append(X)
  for i in range(1:11):
    x.append(r*x[i-1]-D)
    print(x[i])
main()

### FIXED CODE ###

def main():
  r,D,X_2000=map(int,input().split())
  x=[]
  x.append(X_2000)
  for i in range(1,11):
    x.append(r*x[i-1]-D)
    print(x[i])
main()
N,K=map(int,input().split())
AB=[0]*N
dic=defaultdict(int)
for i in range(N):
    a,b=map(int,input().split())
    if a in dic.keys():
        AB[dic[a]]=[a,AB[dic[a]][1]+b]
    else:
        dic[a]=i
        AB[i]=[a,b]
AB_=[]
for i in AB:
    if i==0:
        continue
    k=bin(i[0])[2:].zfill(4)
    AB_.append([k,i[1]])
AB=AB_
l=len(AB)

k=bin(K)[2:].zfill(4)
ans=0
for i in range(4):
    if k[i]=="1":
        t=k[:i]+"0"
        sum=0
        for j in range(l):
            if int(t)|int(AB[j][0][:i+1])<=int(t):
                sum+=AB[j][1]
        ans=max(ans,sum)
sum=0
t=k
for j in range(l):
    if int(t)|int(AB[j][0])<=int(t):
        sum+=AB[j][1]
ans=max(ans,sum)
print(ans)


### FIXED CODE ###

N,K=map(int,input().split())
AB=[]
for i in range(N):
    a,b=map(int,input().split())
    AB.append([a,b])
ans=sum([b for a,b in AB if K|a==K])

for i in range(int.bit_length(K)-1,0,-1):
    if not K &(1<<i):
        continue
    m=K & ~(1<<i)|(1<<i)-1
    s=sum([b for a,b in AB if m | a ==m])
    ans=max(s,ans)
print(ans)
import sys

sys.setrecursionlimit(2 * 10 ** 5)


def dfs(v, p, links):
    farthest_d = 0
    farthest_v = v

    for u in links[v]:
        if u == p:
            continue
        res_d, res_v = dfs(u, v, links)
        if res_d > farthest_d:
            farthest_d = res_d
            farthest_v = res_v
    return farthest_d + 1, farthest_v


def solve(n, links):
    if n == 1:
        return True

    d, v = dfs(0, -1, links)
    d, v = dfs(v, -1, links)
    if (d + 1) % 3 == 0:
        return False
    return True


n = int(input())
links = [set() for _ in [0] * n]
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)
print('First' if solve(n, links) else 'Second')


### FIXED CODE ###

import sys

sys.setrecursionlimit(2 * 10 ** 5 + 5)


def dfs(v, p, links):
    farthest_d = 0
    farthest_v = v

    for u in links[v]:
        if u == p:
            continue
        res_d, res_v = dfs(u, v, links)
        if res_d > farthest_d:
            farthest_d = res_d
            farthest_v = res_v
    return farthest_d + 1, farthest_v


def solve(n, links):
    if n == 1:
        return True

    d, v = dfs(0, -1, links)
    d, v = dfs(v, -1, links)
    if (d + 1) % 3 == 0:
        return False
    return True


n = int(input())
links = [set() for _ in [0] * n]
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)
print('First' if solve(n, links) else 'Second')
input();a=eval(input().replace(' ','*'));print((a,-1)[a>1e18])

### FIXED CODE ###

n,*a=map(int,open(0).read().split());z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(0 if 0in a else z)
n = int(input())
p = list(map(int, input().split(' ')))

p = sorted(p)
if p[0] < sum(p[1:]):
	print('Yes')
else:
	print('No')

### FIXED CODE ###


t, x = map(int, input().split(' '))
print(t/x)
import sys
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

input = sys.stdin.readline

cost = []
row = []
col = []

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

for _ in range(m):
    a, b, c = map(int, input().split())
    cost.append(c)
    row.append(a-1)
    col.append(b-1)

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

csr = csr_matrix((cost, (row, col)), shape = (n, n))
path = floyd_warshall(csr, directed=False)

cost = []
row = []
col = []

for i in range(n):
    for j in range(n):
        if path[i][j] <= l:
            cost.append(1)
            row.append(i)
            col.append(j) 

csr = csr_matrix((cost, (row, col)), shape = (n, n))
path = shortest_path(csr, directed=False)

INF = float('inf')

for s,t in st:
    ans = path[s-1][t-1]
    if ans == INF:
        print(-1)
    else:
        print(int(ans) - 1)






### FIXED CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix

input = sys.stdin.readline

n, m, l = list(map(int, input().split()))
g_dense = np.zeros((n, n))

for _ in range(m):
    a, b, c = map(int, input().split())
    g_dense[a-1][b-1] = c

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

path = shortest_path(g_dense, directed=False)

g_dense = np.zeros((n, n))

for i in range(n):
    for j in range(n):
        if path[i][j] <= l:
            g_dense[i][j] = 1

path = shortest_path(g_dense, directed=False)

INF = float('inf')

for s,t in st:
    ans = path[s-1][t-1]
    if ans == INF:
        print(-1)
    else:
        print(int(ans) - 1)
import math

r = imt(input())
pi = math.pi
ans = 2 * pi * r

print(ans)

### FIXED CODE ###

import math

r = int(input())
pi = math.pi
ans = 2 * pi * r

print(ans)
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = []
for i in range(a - b + 1):
	h = 0
	h = sum(c[i:k + i])
	d.append(h)
e = 0
f = 0
g = d.index(max(d))
for i in range(b):
	f = sum(range(1, c[g + i] + 1))
	e += f / c[g + i]
print(e)

### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = [(i + 1) / 2 for i in c]
e = sum(d[:b])
f = e
for i in range(a - b):
	f -= d[i]
	f += d[i + b]
	if f > e:
		e = f
print(e)
import math
X , Y = map(input().split())
X = int(X)
Y = float(Y)
print(math.floor(X * Y))


### FIXED CODE ###

X , Y = input().split()
X = int(X)
Y = round(float(Y) * 100)
print((X * Y) // 100 )
import numpy as np
from numba import njit
@njit
def solve():
    n=int(input())
    s=input()
    dp=np.zeros((n+1,n+1),dtype=int)
    for i in range(n):
        for j in range(i+1,n):
            if s[i]==s[j]:
                if dp[i][j]<j-i:
                    dp[i+1][j+1]=dp[i][j]+1
    print(np.amax(dp))
solve()

### FIXED CODE ###

n=int(input())
s=input()
dp=[[0]*n for i in range(n)]
for i in range(n-2,-1,-1):
    for j in range(n-1,i,-1):
        if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,dp[i][j])
print(ans)
imporet re

N = input()

if re.match(r'[2,4,5,7,9]', N[-1]):
	print('hon')
elif re.match(r'[0,1,6,8]', N[-1]):
	print('pon')
else:
	print('bon')

### FIXED CODE ###

import re

N = input()

if re.match(r'[2,4,5,7,9]', N[-1]):
	print('hon')
elif re.match(r'[0,1,6,8]', N[-1]):
	print('pon')
else:
	print('bon')
from fractions import gcd

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

ans = x[0]
for i in range(n):
	ans = gcd(ans, x[i])
	if ans == 1:
		break
print(ans)

### FIXED CODE ###

from fractions import gcd

n, x = map(int, input().split())
x_lis = [abs(int(i)-x) for i in input().split()]

ans = x_lis[0]
for i in range(n):
	ans = gcd(ans, x_lis[i])
	if ans == 1:
		break
print(ans)
from operator import itemgetter
from scipy.sparse import lil_matrix, csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree

def main():
    N = int(input())
    M = 10**10
    XY = [tuple(map(int, input().split())) for _ in range(N)]
    xy = [(x, i) for i, (x, _) in enumerate(XY)]
    yx = [(y, i) for i, (_, y) in enumerate(XY)]
    xy.sort()
    yx.sort()
    d = {}
    x1, i1 = xy[0]
    for x, i in xy[1:]:
        t = (i1, i) if i1 < i else (i, i1)
        d[t] = min(abs(x1 - x), d.get(t, M))
        x1, i1 = x, i
    x1, i1 = yx[0]
    for x, i in yx[1:]:
        t = (i1, i) if i1 < i else (i, i1)
        d[t] = min(abs(x1 - x), d.get(t, M))
        x1, i1 = x, i
    row = list(map(itemgetter(0), d.keys()))
    col = list(map(itemgetter(1), d.keys()))
    c = csr_matrix((list(d.values()), (row, col)), shape=(N, N))
    a = minimum_spanning_tree(c, overwrite=True)
    return a.sum(dtype=int)

print(main())


### FIXED CODE ###

from operator import itemgetter
from scipy.sparse import lil_matrix, csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree

def main():
    N = int(input())
    M = 10**10
    XY = [tuple(map(int, input().split())) for _ in range(N)]
    xy = [(x, i) for i, (x, _) in enumerate(XY)]
    yx = [(y, i) for i, (_, y) in enumerate(XY)]
    xy.sort()
    yx.sort()
    d = {}
    x1, i1 = xy[0]
    for x, i in xy[1:]:
        t = (i1, i) if i1 < i else (i, i1)
        d[t] = min(abs(x1 - x), d.get(t, M))
        x1, i1 = x, i
    x1, i1 = yx[0]
    for x, i in yx[1:]:
        t = (i1, i) if i1 < i else (i, i1)
        d[t] = min(abs(x1 - x), d.get(t, M))
        x1, i1 = x, i
    row = list(map(itemgetter(0), d.keys()))
    col = list(map(itemgetter(1), d.keys()))
    c = csr_matrix((list(d.values()), (row, col)), shape=(N, N))
    a = minimum_spanning_tree(c, overwrite=True)
    return int(a.sum())

print(main())
import sys
from functools import lru_cache
def input(): return sys.stdin.readline().strip()


def main():
    N, Z, W = map(int, input().split())
    A = list(map(int, input().split()))
    """
    O(N^2)dpでも行けるそうです。以下写経：
    https://atcoder.jp/contests/abc078/submissions/14886969
    dpテーブルが訳分からなくなったら@lru_cache使うのが楽。
    """
    @lru_cache(maxsize=None)
    def dfs(turn, top, x, y): # turn: 0 => x, 1 => y
        if top == N: return abs(x - y)
        if turn == 1:
            """
            yのターンは、top以降を取ってなるべくスコアが低くなるようなiを選ぶ
            """
            ret = 10**9
            for i in range(top, N): ret = min(ret, dfs(0, i + 1, x, A[i]))
            return ret
        else:
            """
            xのターンは、top以降を取ってなるべくスコアが高くなるようなiを選ぶ
            """
            ret = 0
            for i in range(top, N): ret = max(ret, dfs(1, i + 1, A[i], y))
            return ret
    
    print(dfs(0, 0, Z, W))

if __name__ == "__main__":
    main()


### FIXED CODE ###

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


def main():
    N, z, w = map(int, input().split())
    A = list(map(int, input().split()))
    """
    dpかと思ってずっとウンウン唸ってたのに、解説見て唖然。。。
    """
    if N == 1: print(abs(A[0] - w))
    else: print(max(abs(A[-1] - w), abs(A[-1] - A[-2])))


if __name__ == "__main__":
    main()
def main():
    a, b = map(int, input().split())
    print('Odd') if a*B % != 0 else print('Even')


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    a, b = map(int, input().split())
    print('Odd') if a*b % 2 != 0 else print('Even')


if __name__ == "__main__":
    main()
import math
n = int(input())
a_list = list(map(int, input().split()))
num = a_list[0]

for i in range(n):
    num = math.gcd(num, a_list[i])
print(num)

### FIXED CODE ###

a, b = map(int, input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)
x = input("1??\???100??\????????´??°?????\?????????????????????: ")
if (x < 1) or (x > 100):
    break
else:
    num = x * x * x
    print(num, end="\n")

### FIXED CODE ###

x = int(input(""))
if (x >= 1) or (x <= 100):
    num = x ** 3 
    print(num, end="\n")
else:
    pass
n = int(input())
s = input()

counter_s = Counter(s).most_common()
ans = 1
for i in counter_s:
    ans *= i[1] + 1

ans -= 1
print(ans)


### FIXED CODE ###

from collections import *
from operator import *

n = int(input())
s = input()

counter_s = Counter(s).most_common()
ans = 1
for i in counter_s:
    ans = (ans * (i[1] + 1)) % (10 ** 9 + 7)

ans -= 1
print(ans)
from functools import reduce
import sys

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


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

def gcd(a, b):
    import math
    return math.gcd(a, b)


def temp(a):
    return int(a * 0.5)

max_a = max(A)

i = 0
while True:
    num = int((i+0.5) * max_a)
    if num > M:
        print(0)
        sys.exit()

    found = True
    for a in A:
        if int(num - 0.5 * a) % a != 0:
            found = False
            break
    if found:
        ans = 1
        break
    i += 1

aa = reduce(lcm, A)

ans += (M - num) // aa

print(int(ans))


### FIXED CODE ###

from functools import reduce
import sys

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


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

def gcd(a, b):
    import fractions
    return fractions.gcd(a, b)


def temp(a):
    return int(a * 0.5)

max_a = max(A)

i = 0
while True:
    num = int((i+0.5) * max_a)
    if num > M:
        print(0)
        sys.exit()

    found = True
    for a in A:
        if int(num - 0.5 * a) % a != 0:
            found = False
            break
    if found:
        ans = 1
        break
    i += 1

aa = reduce(lcm, A)

ans += (M - num) // aa

print(int(ans))
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import sympy
import math
mod = 10**9+7
n = int(read())
cnt = sympy.divisor_count(math.factorial(n))
print(cnt%mod)

### FIXED CODE ###

import math
mod = 10**9+7
n = int(input())
n = math.factorial(n)
ans = 1
i = 2
while i*i<=n:
    cnt = 1
    while n % i == 0:
        cnt += 1
        n //= i
    i = i + 1
    ans = ans*cnt

if n != 1:
    ans = ans*2
print(ans%mod)
import sys
import itertools

def calcH(cx, cy, x, y, h):
  if h > 0:
  	return h + abs(x-cx) + abs(y-cy)
  else:
    return h - abs(x-cs) + abs(y-cy) <= 0

cols = []
for line in sys.stdin:
  col = line.strip().split(' ')
  col = [int(c) for c in col]
  cols.append(col)

cols = cols[1:]
for cx,cy in itertools.product(list(range(101)), list(range(101))):
  H = None
  flag = True
  for x,y,h in cols:
    now_H = calcH(cx, cy, x, y, h)
    if H is False:
      flag = False
      break
    if H is None:
      H = now_H
    else:
      if not H == now_H:
        flag = False
        break
  if flag:
    print(cx,cy,H)

### FIXED CODE ###

import sys
import itertools

cols = []
for line in sys.stdin:
  col = line.strip().split(' ')
  col = [int(c) for c in col]
  cols.append(col)

cols = cols[1:]
for cx,cy in itertools.product(list(range(101)), list(range(101))):
  H, H_max, flag = None, None, True
  for x,y,h in cols:
    if h <= 0:
      tmp_H_max = abs(x-cx) + abs(y-cy)
      if tmp_H_max < 1:
        flag = False
        break
      else:
        H_max = min(H_max, tmp_H_max) if H_max else tmp_H_max
      if H and H_max < H:
        flag = False
        break
    else:
      tmp_H = h + abs(x-cx) + abs(y-cy)
      if not H:
        H = tmp_H
      elif H and H != tmp_H:
        flag = False
        break
      if H_max and H_max < tmp_H:
        flag = False
        break
  if flag:
    print(cx,cy,H)
K,S = int(input())
c=0
L=list(range(0,K+1))
for i in L:
    for j in L:
        for k in L:
            if i+j+k == S:
                c+=1
print(c)

### FIXED CODE ###

K,S = map(int, input().split())
res = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        if 0 <= S - x - y <= K:
            res += 1
print(res)
import bisect
N = int(input())

c = []
for i in range(N):
    n = int(input())
    index = bisect.bisect_left(c,n)
    if index == 0:
        c.append(n)
    else:
        c[index-1] = n
    c.sort()
    #print(c)

print(len(c))      

### FIXED CODE ###

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

b = [0 for i in range(N)]

def check(i):
    cnt = 0
    n = i
    while n <= N:
        cnt += b[n-1]
        n += i
    return cnt

for i in range(N-1,-1,-1):
    if (a[i] + check(i+1))%2 == 1:
        b[i] = 1

ans = []
cnt = 0
for i in range(N):
    if b[i] == 1:
        cnt += 1
        ans.append(i+1)

print(cnt)
L = [str(int(i)) for i in ans]
print(' '.join(L))
N = int(input())

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

### FIXED CODE ###

N = int(input())

if N % 2 == 0:
    print(N // 2)
else:
    print(N // 2 + 1)
def match(x, y):
    return x == y or x == '?' or y == '?'


def check(s, t):
    ANS = [1] * (10 ** 4)
    S = len(s); T = len(t)
    for i in range(S):
        for j in range(T):
            if not match(s[i], t[j]):
                ANS[i - j + 5000] = 0
    return ANS


def solve(a, b, c):
    lenA = len(a)
    lenB = len(b)
    lenC = len(c)

    AB = check(a, b)
    AC = check(a, c)
    BC = check(b, c)

    ans = lenA + lenB + lenC
    for i in range(-lenB, lenA + lenB + 1):
        for j in range(-lenC, lenA + lenC + 1):
            if AB[i + 5000] and AC[j + 5000] and BC[j - i + 5000]:
                L = min(0, min(i, j))
                R = max(lenA, max(lenB + i, lenC + j))
                ans = min(ans, R - L)

    return ans


a = input()
b = input()
c = input()


ans = min(solve(a, b, c), min(solve(b, c, a), solve(c, a, b)))

print(ans)


### FIXED CODE ###

def match(x, y):
    return x == y or x == '?' or y == '?'


def check(s, t):
    ANS = [1] * (10 ** 5)
    S = len(s); T = len(t)
    for i in range(S):
        for j in range(T):
            if not match(s[i], t[j]):
                ANS[i - j + 50000] = 0
    return ANS


def solve(a, b, c):
    lenA = len(a)
    lenB = len(b)
    lenC = len(c)

    AB = check(a, b)
    AC = check(a, c)
    BC = check(b, c)

    ans = lenA + lenB + lenC
    for i in range(-lenB, lenA + lenB + 1):
        for j in range(-lenC, lenA + lenC + 1):
            if AB[i + 50000] and AC[j + 50000] and BC[j - i + 50000]:
                L = min(0, min(i, j))
                R = max(lenA, max(lenB + i, lenC + j))
                ans = min(ans, R - L)

    return ans


a = input()
b = input()
c = input()


ans = min(solve(a, b, c), min(solve(b, c, a), solve(c, a, b)))

print(ans)