Harryxun/stf_run huggingface dataset:
N = int(input())
L = int(input().split(' '))
L2 = set(L) # 重複を削除

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)      
    


### FIXED CODE ###

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

L2 = list(set(L)) # 重複を削除

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)
from functools import lru_cache
import sys
def input() -> str:
    return sys.stdin.readline().rstrip()
mod = 10**9 + 7
@lru_cache(maxsize=None)
def dp(i):
    if i == n - 1:
        return 1
    if i == n - 2:
        return 2 - int(n - 1 in a)
    return dp(i + 1) * int(i + 1 not in a) % mod + dp(i + 2) * int(i + 2 not in a) % mod
n, m = [int(i) for i in input().split()]
a = [int(input()) for _ in range(m)]
print(dp(0))

### FIXED CODE ###

import sys
def input():
  return sys.stdin.readline().rstrip()
mod = 10**9 + 7
n, m = [int(i) for i in input().split()]
a = [int(input()) for _ in range(m)]
notin = [1] * n
for i in a:
  notin[i] = 0
dp = [0] * n
dp[n - 1] = 1
if n > 1:
	dp[n - 2] = 1 + notin[n - 1]
for i in range(n - 3, -1, -1):
  dp[i] += dp[i + 1] * notin[i + 1] % mod
  dp[i] += dp[i + 2] * notin[i + 2] % mod
  dp[i] %= mod
print(dp[0])
a,b,k = map(int, input().split())

if(a<k):
  k -= a
  a = 0
else:
  tmp = k
  k -= a
  a -= tmp
  
if(b<k):
  b = 0
else:
  b -= k

print("{0} {1}".format(a,b))

### FIXED CODE ###

import math

x = int(input())

def is_prime(n):
  for i in range(2, int(math.sqrt(n))):
    if(n%i==0):
      return False
  return True

for i in range(x, x+100):
  if is_prime(i):
    print(i)
    exit()
class Node:
    def __init__(self, parent, num):
        self.parent = parent
        self.num = num
        self.score = 0

    def add_score(self, score):
        self.score += score

class Tree:
    @classmethod
    def calc_sum(cls, node):
        if node.parent:
            return node.score + cls.calc_sum(node.parent)
        else:
            return node.score

N, Q = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(1, N):
    A[i], B[i] = map(int, input().split())

P = [0] * (Q+1)
X = [0] * (Q+1)
for i in range(1, Q+1):
    P[i], X[i] = map(int, input().split())

nodes = [0] * (N+1)
nodes[1] = Node(None, 1)

for i in range(1, N):
    nodes[B[i]] = Node(nodes[A[i]], B[i])

for i in range(1, Q+1):
    nodes[P[i]].add_score(X[i])

for i in range(1, N+1):
    sum_score = Tree.calc_sum(nodes[i])
    print(sum_score, end=' ')


### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print('red')
n=int(input())

A=list(map(int,input().split()))
        
A.sort(reverse=True)

X=[]

t=None

for i in A:
    if t==i:
        t=None
        X.append(t)
        if len(X)>1:
            break
    else:
        t=i
        
if len(X)>1:
    print(X[0]*X[1])
else:
    print(0)

### FIXED CODE ###

import collections

n=int(input())

A=list(map(int,input().split()))
        
X=collections.Counter(A)

ans=1
cnt_1=0
cnt_2=0

for k,v in sorted(X.items(),key=lambda x:x[0],reverse=True):
    if v>=2:
        cnt_1+=1
        ans*=k
        if cnt_1==2:
            break
        if v>=4:
            ans*=k
            break
    else:
        cnt_2+=1
        if cnt_2==n or cnt_2==n-2 or cnt_2==n-3:
            ans=0
            break
print(ans)
N,K = list(map(int,input().split()))
xs = list(map(int,input().split()))

ans = 10 ** 10
for  i,x  in enumerate(xs):
    if N == 1:
        ans = abs(x)
    if i +  K  > N and i > 0:
        break
    num = abs(xs[ i + K - 1 ] - xs[i]) + abs(xs[i])
    num1 = abs(xs[ i + K - 1 ] - xs[i]) + abs(xs[i + K -1])
    ans = min([num,num1,ans])
print(ans)

### FIXED CODE ###

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

ans = 10 ** 10
for  i,x  in enumerate(xs):
    if N == 1:
        ans = abs(x)
    if i +  K  > N and i > 0:
        break
    num = abs(xs[ i + K - 1 ] - xs[i]) + abs(xs[i])
    num1 = abs(xs[ i + K - 1 ] - xs[i]) + abs(xs[i + K -1])
    ans = min([num,num1,ans])
print(ans)
from collections import Counter

N = int(input())
D = int, input().split()
M = int(input())
T = input().split()

d = Counter(D)
t = Counter(T)
for key, value in t.items():
    if d.get(key, 0) < value:
        print('NO')
        exit()
else:
    print('YES')

### FIXED CODE ###

from collections import Counter

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

d = Counter(D)
t = Counter(T)
for key, value in t.items():
    if d.get(key, 0) < value:
        print('NO')
        exit()
else:
    print('YES')
S = dict()

S['a'] = input()[::-1]
S['b'] = input()[::-1]
S['c'] = input()[::-1]

player = 'a'

while S[player]:
  player = S[player].pop()

  
res = player.upper()
print(res)
  

### FIXED CODE ###

A = input()
B = input()
C = input()

x = A[0]

def turn(A, B, C, x):
  if x == 'a':
    if len(A) == 0:
      print('A')
      return
    else:
      y = A[0]
      A = A[1:]
      
  if x == 'b':
    if len(B) == 0:
      print('B')
      return
    else:
      y = B[0]
      B = B[1:]
  
  if x == 'c':
    if len(C) == 0:
      print('C')
      return
    else:
      y = C[0]
      C = C[1:]
  
  return turn(A, B, C, y)

turn(A, B, C, x)
n = int(input())
a = [int(i) for i in input().split()]

count = 0
check = True
while check:
    a = sorted(list(filter(lambda x : (x % 2) == 0, a)), reverse=True)
    if a == []:
        check = False
    else:
        a[0] = int(a[0] / 2)
        for i in range(1,len(a)):
            a[i] *= 3
        count += 1
print(count)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
count = 0
for i in a:
    while i % 2 == 0:
        i /= 2
        count += 1
print(count)
import numpy as np
n = int(input())
a = list(map(int,input().split()))
sum = 0
aa = np.array(a).reshape(1,n)
mat = np.dot(aa.T,aa)
s = np.sum(mat)
for i in range(n):
  s -= a[i]*a[i]
sum = int(s/2)
sum = sum % (10**9+7)

print(sum)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
sum = 0
m = 10**9+7

for i in range(n):
  sum = sum+a[i]

#sum = sum%m
#sum = sum*sum
ans = 0
for i in range(n):
  ans = ans + sum*a[i]
  ans = ans - a[i]*a[i]
ans = ans//2%m

print(ans)
a = map(int, raw_input().split())
if ((a[0] == a[1]) or (a[0] == a[2]) or (a[2] == a[1])):
  if ((a[0] == a[1]) and (a[2] == a[1])):
    print("No")
  else:
    print("Yes")
else:
  print("No)

### FIXED CODE ###

a = list(map(int, input().split()))
if ((a[0] == a[1]) or (a[0] == a[2]) or (a[2] == a[1])):
  if ((a[0] == a[1]) and (a[2] == a[1])):
    print("No")
  else:
    print("Yes")
else:
  print("No")
from bisect import *
S = input()
mod = 10**9 + 7
A = []
B = []
C = []
X = []
q = 0
for i,s in enumerate(S):
    if s == 'A':
        A.append(i)
    elif s == 'B':
        B.append((i,0))
    elif s == 'C':
        C.append(i)
    else:
        X.append(i)
        B.append((i,1))
        q += 1

pow3 = [pow(3,q,mod),pow(3,q-1,mod),pow(3,q-2,mod),pow(3,q-3,mod)]
ans = 0
for b,flag in B:
    Al = bisect_left(A,b)
    Cr = (len(C) - bisect_right(C,b))
    Xl = bisect_left(X,b)
    Xr = (len(X) - bisect_right(X,b))
    ans += (Al*Cr%mod)*pow3[flag]%mod
    ans %= mod
    ans += (Al*Xr%mod + Xl*Cr%mod)*pow3[flag+1]%mod
    ans %= mod
    ans += (Xl*Xr%mod)*pow3[flag+2]%mod
print(ans)


### FIXED CODE ###

from bisect import *
S = input()
mod = 10**9 + 7
A = []
B = []
C = []
X = []
q = 0
for i,s in enumerate(S):
    if s == 'A':
        A.append(i)
    elif s == 'B':
        B.append((i,0))
    elif s == 'C':
        C.append(i)
    else:
        X.append(i)
        B.append((i,1))
        q += 1

pow3 = [pow(3,q,mod),pow(3,max(0,q-1),mod),pow(3,max(0,q-2),mod),pow(3,max(0,q-3),mod)]
ans = 0
for b,flag in B:
    Al = bisect_left(A,b)
    Cr = (len(C) - bisect_right(C,b))
    Xl = bisect_left(X,b)
    Xr = (len(X) - bisect_right(X,b))
    ans += (Al*Cr%mod)*pow3[flag]%mod
    ans %= mod
    ans += (Al*Xr%mod + Xl*Cr%mod)*pow3[flag+1]%mod
    ans %= mod
    ans += (Xl*Xr%mod)*pow3[flag+2]%mod
print(ans)
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print('No')
else:
	print('Yes')


### FIXED CODE ###

N = int(input())
A = int(input())
if (N % 500 > A):
    print('No')
else:
    print('Yes')
N = input()
s = input()

r = 0
b = 0
for s_i in s:
    if s_i == 'R':
	r += 1
    else:
	b += 1

if r > b:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = input()
s = input()

r = 0
b = 0
for s_i in s:
    if s_i == 'R':
        r += 1
    else:
        b += 1

if r > b:
    print('Yes')
else:
    print('No')
#-*- coding: utf-8 -*- 
import numpy as np
a,b = map(str, input().split())
p = int(a+b)
 
if p == int(np.sqrt(p))**2 :
   print("Yes")
else:
   print(No)
 

### FIXED CODE ###

#-*- coding: utf-8 -*- 
import numpy as np
a,b = map(str, input().split())
p = int(a+b)
 
if p == int(np.sqrt(p))**2 :
   print("Yes")
else:
   print("No")
N, x = map(int, input().split())
a_list = sorted(list(map(int, input().split())))
sum = 0
num = 0

while sum < x:
    sum += a_list[num]
    num += 1
    
print(num)

### FIXED CODE ###

N, x = map(int, input().split())
a_list = sorted(list(map(int, input().split())))

for i in range(N):
    x = x - a_list[i]
    if x < 0:
        break
if i == N-1 and x == 0:
    i += 1

print(i)
#dpg
#根になってるものからsearch
#1.行き先にいくための現時点での最長経路と根から来た場合の経路を比較
#2.その枝はもう見なくて良いので削除(行き先に入る枝のカウントを1減らす)
#入る枝がなくなったら根として考えてそっからまたsearch
#計算量はsearchの回数分(m+n)
n, m = map(int, input().split())
dest = [[] for _ in range(n)]
comein = [0 for _ in range(n)]
for _ in range(m):
	x, y = map(int, input().split())
	dest[x-1].append(y-1)
	comein[y-1] += 1
dp = [0 for _ in range(n)]

def search(leaf):
	global dp
	for i in dest[leaf]:
		comein[i] -= 1
		dp[i] = max(dp[i], dp[leaf] + 1)
		if comein[i] == 0:
			search(i)
	return
ro = []
for i in range(n):
	if comein[i] == 0:
		ro.append(i)
for j in ro:
	search(j)

print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
dest = [[] for _ in range(n)]
comein = [0 for _ in range(n)]
ro = [True for _ in range(n)]
dp = [0 for _ in range(n)]
for _ in range(m):
	x, y = map(int, input().split())
	dest[x-1].append(y-1)
	comein[y-1] += 1
	ro[y-1] = False

def search(leaf):
	global dp
	for i in dest[leaf]:
		comein[i] -= 1
		dp[i] = max(dp[i], dp[leaf] + 1)
		if comein[i] == 0:
			search(i)
	return

for j in range(n):
	if ro[j] == True:
		search(j)

print(max(dp))
s=input()
ans = 0
for i in range(slen()):
  if s[i] == 1:
    ans +=1
print(ans)
    

### FIXED CODE ###

print(input().count("1"))
import math
    
a,b,c,d = map(int,input().split())
cd = c*d//math.gcd(c, d)
 
c1 = b//c
d1 = b//d
cd1 = b//(cd)
 
c2 = (a-1)//c
d2 = (a-1)//d
cd2 = (a-1)//cd
 
c3 = c1-c2
d3 = d1-d2
cd3 = cd1-cd2
 
print(b-a+1-c3-d3+cd3)

### FIXED CODE ###

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

c1 = b//c
d1 = b//d
cd1 = b//(cd)

c2 = (a-1)//c
d2 = (a-1)//d
cd2 = (a-1)//cd

c3 = c1-c2
d3 = d1-d2
cd3 = cd1-cd2

print(b-a+1-c3-d3+cd3)
h, w = map(int,input().split())
a = [list(input()) for _ in range(H)]
c = 0
for p in a :
    for q in p:
        if q=="#":
            c +=1
 
if c == h + w - 1:
    print("Possible")
else:
    print("Impossible")

### FIXED CODE ###

h, w = map(int,input().split())
a = [list(input()) for _ in range(h)]
c = 0
for p in a :
    for q in p:
        if q=="#":
            c +=1
 
if c == h + w - 1:
    print("Possible")
else:
    print("Impossible")
n=input()
s=raw_input()
t=raw_input()
for i in xrange(0, n + 1):
	if s[i : n] == t[0 : n - i]:
		print n + i
		break


### FIXED CODE ###

n=input()
s=raw_input()
t=raw_input()
for i in xrange(0,n+1):
	if s[i:n]==t[0:n-i]:
		print n+i
		break
from collections import deque

N = int(input())
G = [deque([]) for _ in range(N)]
arrive = [0] *N

for _ in range(N-1):
    a,b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

MAX = 0
for i,g in enumerate(G):
    if MAX < len(g):
        MAX = len(g)
        t = i

c_l = list(range(MAX))
C = dict()

def bfs(v,c):
    arrive[v] = 1
    # print(v)
    cnt = 0
    for w in G[v]:
        if arrive[w] == 0:
            if c == cnt:
                cnt += 1
            bfs(w,cnt)
            if v > w:
                v,w = w,v
            C[(v+1,w+1)] = cnt+1
            cnt += 1

bfs(t,-1)

print(MAX)
for k in sorted(C.keys()):
    print(C[k])

### FIXED CODE ###

from collections import defaultdict,deque

graph = defaultdict(list)
N, *AB = map(int, open(0).read().split())
for a, b in zip(*[iter(AB)] * 2):
    graph[a].append(b)


stack = deque([1])
C = [0] * (N + 1)
while stack:
    v = stack.popleft()
    c = 0
    for w in graph[v]:
        c += 1 + (c + 1 == C[v])
        C[w] = c
        stack.append(w)
        
print(max(C))
print("\n".join(str(C[b]) for b in AB[1::2]))
A = int(input())
B = int(input())
print(str(A*B))

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
s = sorted(list(str(input())))
t = reversed(sorted(list(str(input()))))
print('Yes' if s<t else 'No')

### FIXED CODE ###

s = sorted(list(str(input())))
t = reversed(sorted(list(str(input()))))
S = str()
T = str()
for i in s:
    S += i
for k in t:
    T += k
print('Yes' if S<T else 'No')
tmp = list(map(int,input().split()))
As = list(map(int,input().split()))
n,p = tmp[0],tmp[1]
o ,e  = 0,0
for i in range(n):
  if As[i] % 2:
    o += 1
  else:
    e += 1
def comb(j,k):
  if k == 1:
    return(j)
  else:
    return comb(j-1,k-1) * j / k
ans = 0
if p == 0:
  for i in range(o+1):
    if not i % 2:
      ans += int(comb(o,i))
else:
  for i in range(o+1):
    if i % 2:
      ans += int(comb(o,i))
ans *= (2 ** e)
print(ans)

### FIXED CODE ###

tmp = list(map(int,input().split()))
As = list(map(int,input().split()))
n,p = tmp[0],tmp[1]
o ,e  = 0,0
for i in range(n):
  if As[i] % 2:
    o += 1
  else:
    e += 1
def comb(j,k):
  if k == 0:
    return(1)
  else:
    return comb(j-1,k-1) * j / k
ans = 0
if p == 0:
  for i in range(o+1):
    if not i % 2:
      ans += int(comb(o,i))
else:
  for i in range(o+1):
    if i % 2:
      ans += int(comb(o,i))
ans *= (2 ** e)
print(ans)
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=list(map(int,input().split()))
    d=defaultdict(int)
    t=[0]
    f=[]
    for x in A:
        d[x]+=1
        if d[x]==2:
            t.append(x)
        elif d[x]==4:
            f.append(x)
    t.sort()
    f.sort()
    if not f:
        if len(t)<2:
            print(0)
        else:
            print(t[-1]*t[-2])
    else:
        if f[-1]>=t[-1]:
            print(f**2)
        else:
            print(t[-1]*t[-2])

if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=list(map(int,input().split()))
    d=defaultdict(int)
    t=[0]
    f=[0]
    for x in A:
        d[x]+=1
        if d[x]==2:
            t.append(x)
        elif d[x]==4:
            f.append(x)
    t.sort()
    f.sort()
    if len(t)>=2:
        print(max(f[-1]**2,t[-1]*t[-2]))
    else:
        print(0)

if __name__ == '__main__':
    main()
import queue
N,M = map(int,input().split())
tree = [[] for _ in range(M+1)]
for i in range(M):
    a,b = map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)

que = queue.Queue()
que.put(1)
rank = [-1]*(N+1)
result = [0]*(N+1)
while(True):
    if que.empty():
        break
    start = que.get()
    for i in tree[start]:
        if rank[i] == -1:
            rank[i] = rank[start]+1
            result[i] = start
            que.put(i)


print("Yes")
for i in range(2,N+1):
    print(result[i])






### FIXED CODE ###

import queue
N,M = map(int,input().split())
tree = [[] for _ in range(N+1)]
for i in range(M):
    a,b = map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)

que = queue.Queue()
que.put(1)
result = [-1]*(N+1)
result[1] = 0
while(True):
    if que.empty():
        break
    start = que.get()
    for i in tree[start]:
        if result[i] == -1:
            result[i] = start
            que.put(i)

if -1 in result[2:]:
    print("No")
else:
    print("Yes")
    for i in result[2:]:
        print(i)
def b():
    n = int(input())
    AC=0
    WA=0
    TLE=0
    RE=0
    while n:
        n-=1
        if input()=='AC':
            AC+=1
        elif input()=='WA':
            WA+=1
        elif input()=='TLE':
            TLE+=1
        else:
            RE+=1
    print("AC x %d"%AC)
    print("WA x %d"% WA)
    print("TLE x %d"% TLE)
    print("RE x %d"% RE)
b()



### FIXED CODE ###


def b():
    n = int(input())
    AC=0
    WA=0
    TLE=0
    RE=0
    while n:
        n-=1
        t= input()
        if t=='AC':
            AC+=1
        elif t=='WA':
            WA+=1
        elif t=='TLE':
            TLE+=1
        else:

            RE+=1
    print("AC x %d"%AC)
    print("WA x %d"% WA)
    print("TLE x %d"% TLE)
    print("RE x %d"% RE)
b()
x,y = map(int, input().split()))

ymax = 4 * x
ymin = 2 * x

if y >= ymin and y <= ymax and y % 2 == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

x, y = map(int, input().split())

ymax = 4 * x
ymin = 2 * x

if y >= ymin and y <= ymax and y % 2 == 0:
  print('Yes')
else:
  print('No')
n,a,b=map(int, input().split())

def cmb(n, r, mod):
    if (r<0) or (r>n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 
N = 10**4
g1 = [1, 1] 
g2 = [1, 1] 
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def pos(x, n, m):
    if n == 0:
        return 1
    res = pos(x*x%m, n//2, m)
    if n%2 == 1:
        res = res*x%m
    return res
    
if n==2:
    print(0)
else:
    ans=pos(2,n,mod)-1-comb(n,a,mod)-comb(n,b,mod)
    print(ans)

### FIXED CODE ###

n,a,b=map(int, input().split())
 
def comb(n, r,MOD):
    p, q = 1, 1
    for i in range(r):
        p = p * (n-i) % MOD
        q = q * (i+1) % MOD
    return p * pow(q, MOD-2, MOD) % MOD

mod=10**9+7
    
A=comb(n,a,mod)
B=comb(n,b,mod)  
C=pow(2,n,mod)

if n==2:
    print(0)
else:
    print((C-1-A-B)%mod)
n = input()
R = []
for i in range(n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n-1)
   if minv > R[v]:
      minv = R[v]
   if maxv < R[v] - minv:
      maxv = R[v] 
print maxv   

### FIXED CODE ###

n = input()
R = []
for i in range(0, n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n):
   if minv > R[v]:
      minv = R[v]
   elif maxv < R[v] - minv:
      maxv = R[v] - minv
print maxv
s = int(input())
an = []
an.append(s)
n = s
while an.count(4) != 2:
    if n % 2 == 0:
        n /= 2
        an.append(int(n))
    else:
        n = 3 * n + 1
        an.append(int(n))
print(an.index(4) + 4)

### FIXED CODE ###

x, y, z = map(int, input().split())
print(int(x * y / 2))
n,*p = map(int,open('abc135.txt').read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        if i+1 == p[p[i]-1]:
            ans += 1

print('YES' if ans == 0 or 2 else 'NO')

### FIXED CODE ###

n,*p = map(int,open(0).read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        ans += 1
print('YES' if ans == 2 or ans == 0 else 'NO')
A,B,C = int(input()),int(input()),int(input())
K = int(input())
for _ in range(K):
    if A >= B:
        B = 2*B
    else:
        C = 2*C
        

if C > B > A:
    print('Yes')
else:
  print('No')

### FIXED CODE ###

n = [int(i) for i in input().split()]
K = int(input())

for _ in range(K):
    if n[0] >= n[1]:
        n[1] = n[1] * 2
    else:
        n[2] = 2*n[2]
        

if n[2] > n[1] > n[0]:
    print('Yes')
else:
    print('No')
import sys
MAX_INT = int(10e9)
MIN_NUM = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = [IL()[::-1] for i in range(N)]

used = [-1]*N
total = N*(N-1)//2
flag = 1
cnt = 0
days = 0
while flag:
  flag = 0
  for i in range(N):
    #print(a)
    #print(i+1)
    if len(a[i]) > 0 and used[i] != days:
      numIND = a[i][-1] -1
      #print(numIND+1)
      if a[numIND][-1] == i+1 and used[numIND] != days:
        a[i].pop(-1)
        a[numIND].pop(-1)
        used[i] = days
        used[numIND] = days
        flag = 1
        cnt += 1
  else:
    if flag == 1:
      #days += 1
#print(a)
#print(cnt)
if cnt == total:
  print(days)
else:
  print(-1)


### FIXED CODE ###

import sys
MAX_INT = int(10e9)
MIN_NUM = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = [IL()[::-1] for i in range(N)]

used = [-1]*N
updatelist = [i for i in range(N)]
total = N*(N-1)//2
cnt = 0
days = 0
ul = []
while updatelist:
  ul = []
  for i in updatelist:
    #print(a)
    #print(i+1)
    if len(a[i]) > 0 and used[i] != days:
      numIND = a[i][-1] -1
      #print(numIND+1)
      if a[numIND][-1] == i+1 and used[numIND] != days:
        a[i].pop(-1)
        a[numIND].pop(-1)
        used[i] = days
        used[numIND] = days
        ul.append(i)
        ul.append(numIND)
        cnt += 1
  else:
    updatelist = ul[:]
    if len(ul) != 0:
      days += 1
#print(a)
#print(cnt)
if cnt == total:
  print(days)
else:
  print(-1)
n, m = map(int, input().split())

a = set()
for i in range(m):
    a_tmp = int(input())  # int(input())
    a.add(a_tmp)

# a = [1 for i in range(m)]

dp = [0] * (n + 1)
for i in range(n + 1):
    if i in a:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])


### FIXED CODE ###

import fractions

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

kobai = (c * d) // fractions.gcd(c, d)


def cnt(b, c, d, kobai):
    bc = b // c
    bd = b // d
    b_kobai = b // kobai

    return b - bc - bd + b_kobai


b_num = cnt(b, c, d, kobai)
a_num = cnt(a - 1, c, d, kobai)

ans = b_num - a_num

print(int(ans))
X = list(map(int,input().split()))

if X[0]==0:
  print(1)
  elif X[1] == 0:
    print(2)
    elif X[2] == 0:
      print(3)
      elif X[3] == 0:
        print(4)
        else:
          print(5)

### FIXED CODE ###

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

if X[0]==0:
  print(1)
elif X[1] == 0:
  print(2)
elif X[2] == 0:
  print(3)
elif X[3] == 0:
  print(4)
else:
  print(5)
def solve(n,k):
  counter = 0
  for i in range(n,k,-1):
    theValue = n//i * (i-k) + max(n%i-k+1,0)
    counter += theValue
  return counter

c = list(map(int, input().split()))
print(solve(c[0], c[1]))

### FIXED CODE ###

a = ""
for i in range(3):
  a += input()[i]

print(a)
a,b,c,k = int(input())
total = a*1 + b*0 - c*1
print(int(total))

### FIXED CODE ###

a,b,c,k = map(int, input().split())
s = 0
if k <= a:
    s += k
else:
    s += a
if 0 < k-(a+b):
    s -= k-(a+b)
print(s)