Harryxun/stf_run huggingface dataset:
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n,k = map(int, input().split())
    n += 1
    l = [i for i in range(n)]
    L = [0]
    for i in range(1,n):
        L.append(L[i-1] + l[i])
    ans = 0
    for i in range(k, n):
        mi = L[i-1]
        ma = L[-1] - L[len(L)-i-1]
        ans += (ma-mi+1)
    ans += 1
    print(ans)

if __name__=="__main__":
    main()
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n,k = map(int, input().split())
    n += 1
    l = [i for i in range(n)]
    L = [0]
    for i in range(1,n):
        L.append(L[i-1] + l[i])
    ans = 0
    for i in range(k, n):
        mi = L[i-1]
        ma = L[-1] - L[len(L)-i-1]
        ans += (ma-mi+1)
    ans += 1
    print(ans)

if __name__=="__main__":
    main()


### FIXED CODE ###

import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n,k = map(int, input().split())
    ans = 0
    mn = mx = 0
    for i in range(n+1):
        j = n-i
        mn += i
        mx += j
        if i+1 >= k:
            ans += mx-mn+1
    print(ans%(10**9+7))

if __name__=="__main__":
    main()
moji_S=input()
moji_T=input()

flag=0
for i in range(len(moji_S)):
	if moji_S==moji_T:
		flag =1
		break
	moji_S=moji_S[-1]+moji_S[0:-1]
if flag:
	print("Yes")
else:
	print("No")


### FIXED CODE ###

A=list(map(int,input().split(' ')))
A.sort()
cost=A[1]-A[0]
cost+=A[2]-A[1]
print(cost)
N=int(input())
table=list(map(int,input().split()))
num=0
for i in table:
    if i%2==1 and (table[i])%2==1:
        num+=1
    print(num)


### FIXED CODE ###

N=int(input())
table=list(map(int,input().split()))
num=0
for i in range(1,N+1):
    if i%2==1 and (table[i-1])%2==1:
        num+=1
print(num)
N,Z,W = map(int,input().split())
a = list(map(int,input().split()))
A = abs(a[-1]-W)
B = abs(a[-2]-a[-1])
print(max(A,B))

### FIXED CODE ###

N,Z,W = map(int,input().split())
a = list(map(int,input().split()))
A = abs(a[-1]-W)
if N == 1:
    print(A)
else:
    B = abs(a[-2]-a[-1])
    print(max(A,B))
n = int(input())

if n[0] == 9 or n[1] == 9:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())

if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 or n == 92 or n == 93 or n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 :
  print("Yes")
else:
  print("No")
from scipy.special import comb

n, k = map(int, input().split())
MOD = 1000000007
ans = [0] * (k + 2)
S = 0

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


for i in range(1, k+1):
    ans[i] = comb( (k-1), (i-1) , exact=True) * ( comb( (n-k+i), (n-k) , exact=True) - S )
    S += ans[i] 
    print(ans[i] % MOD)

### FIXED CODE ###

n, k = map(int, input().split())
ans = [0] * (k + 2)
S = 0

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 )


for i in range(1, k+1):
    if i > n - k + 1:
        print(0)
    else:
        ans[i] = cmb( (k-1), (i-1) , mod ) * cmb( (n - k + 1), (i) , mod ) % mod
        if ans[i] < 0:
            ans[i] + mod
        print(ans[i])
print(input()-input()//15*200)

### FIXED CODE ###

x=int(input())*800
print(x-x//12000*200)
A,B = map(int,input().split())
c = 2
for i in (2,A):
    for j in range(2, B):
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

### FIXED CODE ###

N  = int(input())
if N%2 == 0:
    print((N/2)/N)
else:
    print(((N+1)/2)/N)
nums = map(int,input().split())
multiple = nums[0]*nums[1]
if multiple % 2 == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a,b = map(int,input().split())
multiple = a*b
if multiple % 2 == 0:
  print('Even')
else:
  print('Odd')
import numpy
import math
import collections
from decimal import *

def main():
    n = int(input())
    a = input_list()
    ca = collections.Counter(a)
    max_n = 10 ** 18
    if 0 in a:
        print(0)
        exit()
    ans = 1
    for num, count in ca.items():
        if num == 1:
            continue
        ans *= num**count
        if ans > max_n:
            print(-1)
            exit()
    print(ans)


def yogen(a, b, angle):
    coss = math.cos((angle/180)*math.pi)
    return math.sqrt(a**2 + b**2 - 2*a*b*coss)


def get_angle(hour, minute):
    h = (hour * 360) / 12 + (minute * 360) / (12 * 60)
    m = (minute * 360) / 60
    angle = abs(h-m)
    return min(angle, 360-angle)

def has(v, l):
    for vl in l:
        if v == vl:
            return True
    return False

def input_list():
    return list(map(Decimal, input().split()))


if __name__ == '__main__':
    main()


### FIXED CODE ###

#import numpy
import math
import sys

def main():
    n = int(input())
    a = sorted(input_list())
    max_n = 10 ** 18
    ans = 1
    for v in a:
        ans *= v
        if ans > max_n:
            ans = -1
            break
        if ans == 0:
            break
    print(ans)


def yogen(a, b, angle):
    coss = math.cos((angle/180)*math.pi)
    return math.sqrt(a**2 + b**2 - 2*a*b*coss)


def get_angle(hour, minute):
    h = (hour * 360) / 12 + (minute * 360) / (12 * 60)
    m = (minute * 360) / 60
    angle = abs(h-m)
    return min(angle, 360-angle)

def has(v, l):
    for vl in l:
        if v == vl:
            return True
    return False

def input_list():
    return list(map(int, sys.stdin.readline().split()))


if __name__ == '__main__':
    main()
a, b, c = map(int, input().split())
if a + b >= c:
    print('No')
elif a**0.5+b**0.5-c**0.5 < 1e-100:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

dataset = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
k = int(input())
print(dataset[k-1])
for i in xrange(1,10):
    for j in xrange(1,10):
        print('%sx%s=%s'%(i,j,i*j))

### FIXED CODE ###

for i in xrange(1,10):
    for j in xrange(1,10):
        print '%sx%s=%s'%(i,j,i*j)
import collections
q = collections.deque(maxlen=1000000)

n = int(input())
for i in range(n):
    com = input().split()
    if com[0]=='insert':
        q.appendleft(int(com[1]))
    elif com[0]=='delete':
        try:
            q.remove(int(com[1]))
        except ValueError:
            pass
    elif com[0]=='deleteFirst':
        q.popleft()
    elif com[0]=='deleteLast':
        q.pop()
print(' '.join(q))

### FIXED CODE ###

import collections
q = collections.deque()
n = int(input())
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        q.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            q.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        q.popleft()
    elif com[0] == 'deleteLast':
        q.pop()
print(*q)
print(x **3 )

### FIXED CODE ###

x = int(input())
print(x ** 3)
N = int(input())
A = input()
A = eval(A.replace(" ","^"))
#print(A)
print("Yes" if not A else "No")



### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
flag = False
x = len(set(A))
if x == 1 and A[0] == 0:
  flag = True
elif x == 2 and A.count(0) == N // 3:
  flag = True
elif x == 3:
  X = A[0]
  Y = -1
  Z = -1
  i = 1
  while i < N:
    if A[i] != X:
      Y = A[i]
      break
    i += 1
  while i < N:
    if A[i] != X and A[i] != Y:
      Z = A[i]
    i += 1
  if X ^ Y ^ Z == 0 and A.count(X)  == N // 3 and A.count(Y)  == N // 3:
    flag = True
print("Yes" if flag else "No")
input = (a, b)
int a 
int b

int c = a * b

if a * b % 2 = 0:
  print('Even')
  
  else:
    print('Odd')


### FIXED CODE ###

a,b = (int(x) for x in input().split())
c = (a*b) % 2 
if c == 0:
    print('Even')
else:
    print('Odd')
black_flag = False
white = False
counter = 0
for item in s:
    if item == "#":
        black_flag = True
        continue
    if black_flag:
        if item == '.':
            counter += 1
            white = True
        if white and item == '#':
            black_flag = 0
print(counter)


### FIXED CODE ###

def seek(n, s):
    s = s.rstrip('#').lstrip('.')
    turn_to_black = s.count('.')
    current_min = turn_to_black
    turn_to_white = 0

    if current_min == 0 or current_min == len(s):
        return 0

    # seek minimum turns to create "^\.*#*$"
    for i in range(len(s)):
        if s[i] == '#':
            turn_to_white += 1
        else:
            turn_to_black -= 1
        current_min = min(current_min, turn_to_black + turn_to_white)
    return current_min


def input_from_console():
    n = int(input())
    s = input()
    return n, s


def main():
    n, s = input_from_console()
    print(seek(n, s))
    

if __name__ == "__main__":
    main()
a = input().split()
N = int(a[0])
M = int(a[1])

l = []
f = []
for i in range(N):
	temp = []
	l.append(temp)
	f.append(0)

for i in range(M):
	b = input().split()
	X = int(b[0]) - 1
	Y = int(b[1]) - 1
	l[X].append(Y)
	l[Y].append(X)

def search(cnt, li, flag, num):
	if(flag[num] == 0):
		flag[num] = cnt
		if(len(li[num]) != 0):
			for i in range(len(li[num])):
				search(cnt, li, flag, li[num][i])
		
cnt = 0
for i in range(N):
	if(f[i] == 0):
		cnt += 1
		search(cnt, l, f, i)			
print(cnt)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

a = input().split()
N = int(a[0])
M = int(a[1])

l = []
f = []
for i in range(N):
	temp = []
	l.append(temp)
	f.append(0)

for i in range(M):
	b = input().split()
	X = int(b[0]) - 1
	Y = int(b[1]) - 1
	l[X].append(Y)
	l[Y].append(X)

def search(cnt, li, flag, num):
	if(flag[num] == 0):
		flag[num] = cnt
		if(len(li[num]) != 0):
			for i in range(len(li[num])):
				search(cnt, li, flag, li[num][i])
		
cnt = 0
for i in range(N):
	if(f[i] == 0):
		cnt += 1
		search(cnt, l, f, i)			
print(cnt)
N, K = map(int, input().split())
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K])

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])
N,R = map(int, input().split())
if N >= 10:
    k = R
    print(k)
else:
    k = 100*(10-N)+R
    orint(k)

### FIXED CODE ###

N,R = map(int, input().split())
if N >= 10:
    k = R
    print(k)
else:
    k = 100*(10-N)+R
    print(k)
# coding: utf-8
# Here your code !
 
import numpy
 
def func():
    try:
        (n,m,l) = [ int(item) for item in input().rstrip().split(" ") ]
        matrix_A = numpy.array([ [ int(item) for item in input().rstrip().split(" ") ] for i in range(n) ])
        matrix_B = numpy.array([ [ int(item) for item in input().rstrip().split(" ") ] for i in range(m) ])
    except:
        return inputError()
        
    matrix_C = numpy.dot(matrix_A, matrix_B)

    result=""
    for vector in matrix_C:
        for item in vector:
            result+=str(item)+" "
        result.rstrip()
        result+="\n"
    print(result.rstrip())

def inputError():
    '''
    print("input Error")
    return -1
    '''
 
    print("input Error")
    return -1
     
func()

### FIXED CODE ###

# coding: utf-8
# Here your code !
 
def func():
    try:
        (n,m,l) = [ int(item) for item in input().rstrip().split(" ") ]
        matrix_A = [ [ int(item) for item in input().rstrip().split(" ") ] for i in range(n) ]
        matrix_B = [ [ int(item) for item in input().rstrip().split(" ") ] for i in range(m) ]
    except:
        return inputError()
        
    matrix_C = [ [ sum([ matrix_A[i][j]*matrix_B[j][k] for j in range(m) ]) for k in range(l) ] for i in range(n) ]
    result=""

    for vector in matrix_C:
        for item in vector:
            result+=str(item)+" "
        result=result.rstrip()
        result+="\n"
    print(result.rstrip())

def inputError():
    '''
    print("input Error")
    return -1
    '''
 
    print("input Error")
    return -1
     
func()
N, A, B = map(int, input().split(" "))


balls = ''
for i in range(2*N):
    balls += 'b'*A + 'r'*B
balls = balls[0:N]
print(balls)
print(balls.count('b'))

### FIXED CODE ###

def main():
    N, A, B = map(int, input().split(" "))
    if (A + B) == 0:
        print(0)
        return
    amari = N % (A+B)
    kaisuu = N // (A+B)
    print(kaisuu*A+min(amari, A))
main()
import math


a, b = map(float, input().split())
times = 0
a = int(a)
b = int(math.floot(100 * b))
times = a * b
new_times = times / 100
print(new_times)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=float(b)*1000
b=int(b)
print(int((a*b)//1000))
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(0)
else:
  p = 1
  f = True
  for i in a:
    p *= i
    if(p > 1000000000000000000):
      f = false
      break
  if(f):
    print(p)
  else:
    print(-1)
  

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(0)
else:
  p = 1
  f = True
  for i in a:
    p *= i
    if(p > 1000000000000000000):
      f = False
      break
  if(f):
    print(p)
  else:
    print(-1)
import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2

while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md


p=n-1
cnt=0
ans=0

for i in range(n):
    if p>-1:
        while p>-1 and a[i]+a[p]>md:
            p-=1
            if p==-1: break
    cnt+=n-1-p
    ans+=a[i]*(n-1-p)*2

ans+=(m-cnt)*md
print(ans)


### FIXED CODE ###

import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2
md=(r+l)//2
while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n and a[q]+a[p]<=md:
            p+=1
    except:
        b=1
        while True:
            b+=1

    if p==n: break
    cnt+=n-p
    ans+=a[q]*(n-p)*2


ans+=(m-cnt)*md
print(ans)
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**5]*n
dp[0]=0
for i in range(1,n):
    dp[i]=min(dp[j]+abs(h[j]-h[j+k]) for j in range(max(0,n-k),i))
    print(dp[n-1])

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**5]*n
dp[0]=0
for i in range(1,n):
    dp[i]=min(dp[j]+abs(h[j]-h[i]) for j in range(max(0,i-k),i))
print(dp[n-1])
N = int(input)
li = list(map(int,input().split()))
li2 = []
for i in li:
    li2.append(1/i)
print(sum(li2))

### FIXED CODE ###

N = int(input())
li = list(map(int,input().split()))
li2 = []
for i in li:
    li2.append(1/i)
print(1/sum(li2))
a,b,c,d = [int(x) for x in input.split()]
print(a*b) if (a*b) >= (c*d) else print(c*d)

### FIXED CODE ###

a,b,c,d = [int(x) for x in input().split()]
print(a*b) if (a*b) >= (c*d) else print(c*d)
from collections import defaultdict

N ,M = map(int,input().split())
H = list(map(int,input().split()))
graph = defaultdict(list)
for _ in range(M-1):
    A, B = map(int,input().split())
    graph[A].append(H[B-1])
    graph[B].append(H[A-1])

cnt = 0
for i in range(1,N+1):
    t = H[i-1]
    a = max(graph[i])
    if t >a:
        cnt += 1
print(cnt)

### FIXED CODE ###

from collections import defaultdict

N ,M = map(int,input().split())
H = list(map(int,input().split()))
graph = defaultdict(int)
for _ in range(M):
    A, B = map(int,input().split())
    graph[A]= max(graph[A],H[B-1])
    graph[B]= max(graph[B],H[A-1])

print(sum(H[i-1] > graph[i] for i in range(1,N+1)))
MOD = 10**9 + 7

def gen_candidate(N):
    for i in range(1 << (N-1)):
        bit = bin(i)[2:]
        bit = '0'*(N-1 - len(bit)) + bit
        yield bit+'1'

def main():
    N, X = list(map(int, input().split()))
    S = list(map(int, input().split()))
    S = sorted(S, reverse=True)
    total = 0
    for bit in gen_candidate(N):
        x = X
        for j, char in enumerate(bit):
            if int(char):
                x = x % S[j]
        num = 1
        num_one = 0
        num_zero = 0
        for b in reversed(bit):
            if int(b):
                num_one += 1
            else:
                num *= num_one + num_zero
                num_zero += 1
        total = (total + x * num) % MOD
    print(total)

main()


### FIXED CODE ###

from collections import defaultdict as dd
MOD = 10**9 + 7

def main():
    N, X = list(map(int, input().split()))
    S = list(map(int, input().split()))
    S = sorted(S, reverse=True)

    dp = dd(int)
    dp[X] = 1
    for i in range(N):
        new = dd(int)
        for x in dp:
            xx = x % S[i]
            new[x] += dp[x] * (N-i-1)
            new[x] %= MOD
            new[xx] += dp[x]
            new[xx] %= MOD
        dp = new

    total = 0
    for x in dp:
        total += dp[x] * x
        total %= MOD
    print(total)

main()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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

    for i in list(range(A, B + 1)):
        if A <= i <= A + K - 1 or B + 1 >= i >= B - K + 1:
            print(i)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, K = map(int, input().split())
    AK = [i for i in range(A, min(B + 1, A + K))]
    BK = [i for i in range(max(A, B - K + 1), B + 1)]

    result = list(set(AK) | set(BK))
    result.sort()

    for i in result:
        print(i)


if __name__ == "__main__":
    main()
n = int(input())
a = int(input())
Max = -999999
Min = a
for i in range(n):
    x = int(input())
    if (Max < (x - Min)):
        Max = x - Min
    if (x < Min):
        Min = x
print(Max)

### FIXED CODE ###

n = int(input())
a = int(input())
Max = -10 ** 9
Min = a
for i in range(n-1):
    x = int(input())
    if (Max < x - Min):
        Max = x - Min
    if (x < Min):
        Min = x
print(Max)
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
while b[j] > K - a[i]:
    j -= 1
    ans = max(ans, i + j)
print(ans)

### FIXED CODE ###

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
# Aの累積和
a_sum = [0]
for i in range(n):
    a_sum.append(a_sum[i] + a[i])
# Bの累積和
b_sum = [0]
for i in range(m):
    b_sum.append(b_sum[i] + b[i])
b_sum.append(10**20)
ans = 0
# Aを固定する
for i in range(n+1):
    t = a_sum[i]
    l = 0
    r = len(b_sum)
    # Bのうち何冊目まで読めるか二分探索する
    while l+1<r:
        # c:探索範囲の中央
        c = (l + r) // 2
        # 中央がK以下の場合は、求めたい位置が右にあるので
        # 探索範囲の左端を中央にする
        if t+b_sum[c]<=k:
            l = c
        # 中央がKよりも大きい場合は、求めたい位置が左にあるので
        # 探索範囲の右端を中央にする
        else:
            r = c
    # 合計がKを超えないか確認する
    if a_sum[i]+b_sum[l]<=k:
        ans = max(ans,i+l)
print(ans)
h, w = map(int, input().split(" "))
s = []
for _ in range(h):
    row = input()
    tmp = []
    for i in range(w):
        tmp.append(row[i])
    s.append(tmp)

for row in range(h):
    for column in range(w):
        if s[row][column] == "#":
            replace(s, row, column)

for row in range(h):
    res = ""
    for column in range(w):
        res += str(s[row][column])
    print(res)


### FIXED CODE ###

def replace(s, r, c):
    for row in range(r - 1, r + 2):
        for column in range(c - 1, c + 2):
            if row < 0 or len(s) <= row:
                continue

            if column < 0 or len(s[row]) <= column:
                continue

            value = s[row][column]
            if value != "#":
                value += 1
                s[row][column] = value


h, w = map(int, input().split(" "))
s = []
for _ in range(h):
    row = input()
    tmp = []
    for i in range(w):
        tmp.append(row[i] if row[i] == "#" else 0)
    s.append(tmp)

for row in range(h):
    for column in range(w):
        if s[row][column] == "#":
            replace(s, row, column)

for row in range(h):
    res = ""
    for column in range(w):
        res += str(s[row][column])
    print(res)
input();a=list(map(int,input().split()))[::-1];print(a[0],sorted(a,key=lambda x:abs(a[0]-2*x))

### FIXED CODE ###

input();a=sorted(list(map(int,input().split())));print(a[-1],sorted(a,key=lambda x:abs(a[-1]-2*x))[0])
a, b, c ,d = map(int,input().split(' '))
L=a+b;R=c+d:
if L>R:
	print('Left')
elif L<R:
	print('Right')
else:
	print('Balanced')


### FIXED CODE ###

a , b, c ,d = map(int,input().split(' '))
L=a+b
R=c + d
if L> R:
    print('Left')
elif L<R:
    print('Right')
else:
    print('Balanced ')
A,B=map(int,input(),split())
print(A*B)

### FIXED CODE ###

# 入力
a,b = map(int, input().split())

# 処理
answer = a * b

# 出力
print(answer)
n=int(input())
a=list(map(int,input().split()))
b=set(a)
print("YES" if len(a) == len(b), else "NO")

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=set(a)
print("YES" if n == len(b) else "NO")
lists=[]
lists.append(s)
for i in range(2,1000000000000000):
    print("A",i)
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()

### FIXED CODE ###

#116 B
s =int(input())
lists=[]
lists.append(s)
for i in range(2,1000001):
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
L = str(input())
HWL = L/3

print(HWL ** 3)

### FIXED CODE ###

L = int(input())
HWL = L/3

print(HWL ** 3)
import math
from functools import reduce

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

print(int(reduce(math.gcd, A)))

### FIXED CODE ###

import fractions

N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
    ans = fractions.gcd(ans, A[i])
    
print(ans)
n = int(input())
XY = []
for i in range(n):
    a = int(input())
    xy = []
    for j in range(a):
        x, y = map(int, input().split())
        xy.append([x, y])
    XY.append(xy)
ans = 0
for k in range(2 ** n):
    s = [0] * n
    cnt = 0
    case = 0
    for j in range(n):
        if (k >> j) & 1:
            s[n - 1 - j] = 1
            cnt += 1
    for k in range(n):
        if s[k] == 1:
            for l in range(len(XY[l])):
                if s[XY[k][l][0] - 1] != XY[k][l][1]:
                    case = 1
    if case == 0:
        ans = max(ans, cnt)
print(ans)


### FIXED CODE ###

n = int(input())
XY = []
for i in range(n):
    a = int(input())
    xy = []
    for j in range(a):
        x, y = map(int, input().split())
        xy.append([x, y])
    XY.append(xy)
ans = 0
for i in range(2 ** n):
    s = [0] * n
    cnt = 0
    case = 0
    for j in range(n):
        if (i >> j) & 1:
            s[n - 1 - j] = 1
            cnt += 1
    for k in range(n):
        if s[k] == 1:
            for l in range(len(XY[k])):
                if s[XY[k][l][0] - 1] != XY[k][l][1]:
                    case = 1
    if case == 0:
        ans = max(ans, cnt)
print(ans)