Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():

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

    AA = Counter(A)
    ans = 0
    val = 0
    for k, v in AA.items():
        if v % 2 == 0:
            ans += 1
        else:
            val += 1
    if ans % 2 !=0:
        ans -= 1
    print(val+ans)


resolve()

### FIXED CODE ###

from collections import Counter, deque, OrderedDict
# from copy import copy, deepcopy
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():

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

    AA = Counter(A)
    ans = 0
    val = 0
    for k, v in AA.items():
        if v % 2 == 0:
            ans += 1
        else:
            val += 1
    if ans % 2 !=0:
        ans -= 1
    print(val+ans)


resolve()
sa=input()
sb=input()
sc=input()
pointa=len(sa)
sua=0
pointb=len(sb)
sub=0
pointc=len(sc)
suc=0
turn="a"
for i in range(500):
 if pointa==-1:
  print("A")
  break
 elif pointb==0:
  print("B")
  break
 elif pointc==0:
  print("C")
  break
 elif turn=="a":
  turn=sa[sua]
  pointa-=1
  sua+=1
 elif turn=="b":
  turn=sb[sub]
  pointb-=1
  sub+=1
 else:
  turn=sc[suc]
  pointc-=1
  suc+=1

### FIXED CODE ###

sa=input()
sb=input()
sc=input()
pta=0
ptb=0
ptc=0
turn="a"
for i in range(300):
 if pta==len(sa) and turn=="a":
  print("A")
  break
 elif ptb==len(sb) and turn=="b":
  print("B")
  break
 elif ptc==len(sc) and turn=="c":
  print("C")
  break
 elif turn=="a":
  turn=sa[pta]
  pta+=1
 elif turn=="b":
  turn=sb[ptb]
  ptb+=1
 else:
  turn=sc[ptc]
  ptc+=1
s=list(input())
 
if( s[0] == s[1] and s[1] == s[2] and s[2] == s[3] ):
  print('No')
else if(( s[0]==s[1] and s[2]==s[3] )or( s[0]==s[2] and s[1]==s[3] )or( s[0]==s[3] and s[1]==s[2] )):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s=list(input())
 
if( s[0] == s[1] and s[1] == s[2] and s[2] == s[3] ):
  print('No')
elif(( s[0]==s[1] and s[2]==s[3] )or( s[0]==s[2] and s[1]==s[3] )or( s[0]==s[3] and s[1]==s[2] )):
    print('Yes')
else:
    print('No')
import bisect
from collections import deque

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

ans = deque([A[0]])
for i in range(1, N):
    index = bisect.bisect_left(ans, A[i])
    if index > 0:
        ans[index - 1] = A[i]
    else:
        ans = [A[i]] + ans

print(len(ans))


### FIXED CODE ###

import bisect
from collections import deque

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

ans = deque([A[0]])
for i in range(1, N):
    index = bisect.bisect_left(ans, A[i])
    if index > 0:
        ans[index - 1] = A[i]
    else:
        ans.appendleft(A[i])

print(len(ans))
import numpy as np
K = int(input())
lis = [1,2,3,4,5,6,7,8,9]
lis = np.array(lis)
  
if K < 10:
  print(K)
    
else:
  count = 9
  sub_count = 0
  while count < K:
    tmp = lis[sub_count]
    if tmp % 10 == 9:
      count += 2
      lis.append(tmp * 10  + 8)
      lis.append(tmp * 10 + 9)
      sub_count += 1
    elif  tmp % 10== 0:
      count += 2
      lis.append(tmp * 10 )
      lis.append(tmp * 10 + 1)
      sub_count += 1
    else:
      count += 3
      for i in range(-1,2):
        lis.append(tmp * 10 + tmp % 10 + i)
      sub_count += 1
  print(lis[count-1])


### FIXED CODE ###

import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for add in ['0', '1']:
      q.put(tmp + add)
  elif tmp[-1] == '9':
    for add in ['8', '9']:
      q.put(tmp + add)
  else:
    for add in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + add)
# 青の文字の辞書にtupleの1つ目に数を数える
# 赤の文字の辞書のtupleの２つ目に数を数える
# 青 -　赤を計算する

N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(N)]

# 別のインスタンスを作成する
s2 = s[:]

# 
ans = 0

for i in s2:
    if ans < s.count(i) - t.count(i):
        ans = s.count(i) - t.count(i)

print(ans)

### FIXED CODE ###

N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]

# 別のインスタンスを作成する
s2 = s[:]
# 和集合をとる
set(s2)
ans = 0

for i in s2:
    if ans < s.count(i) - t.count(i):
        ans = s.count(i) - t.count(i)

print(ans)
from functools import reduce
import math
N = int(input())
a = list(map(int, input().split()))

gcd = []
for i in range(N):
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(reduce(math.gcd, list_not_i))

print(max(gcd))

### FIXED CODE ###

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

L = [0] * N
for i in range(N) :
        if i == 0 :
                L[0] = 0
        elif i == 1 :
                L[1] = a[0]
        else :
                L[i] = fractions.gcd(L[i-1], a[i-1])

a.reverse()
R = [0] * N
for i in range(N) :
        if i == 0 :
                R[0] = 0
        elif i == 1 :
                R[1] = a[0]
        else :
                R[i] = fractions.gcd(R[i-1], a[i-1])
R.reverse()
a.reverse()

gcd = [0] * N
for i in range(N) :
        if i == 0 :
                gcd[0] = R[0]
        elif i == N-1 :
                gcd[N-1] = L[N-1]
        else :
                gcd[i] = fractions.gcd(L[i],R[i])

print(max(gcd))
from collections import deque

N, A, B, C, D = map(int, input().split(' '))
S = input()
blocks = [i+1 for i, s in enumerate([s for s in S]) if s == '#']
flag = False
check_set = set()

que = deque([(A, B)])
while que:
    A, B = que.pop()
    check_list.add((A, B))
    if A == C and B == D:
        flag = True
        break
    for i in range(3):
        for j in range(3):
            if i == j == 0:
                continue
            if A+i <= C and B+j <= D and A+i != B+j and (A+i) not in blocks and (B+j) not in blocks:
                if (A+i, B+j) not in check_set:
                    que.append((A+i, B+j))

if flag:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N, A, B, C, D = map(int, input().split(' '))
S = input()
blocks = [i+1 for i, s in enumerate([s for s in S]) if s == '#']

if '##' in S[A-1:C] or '##' in S[B-1:D]:
    print('No')
elif C < D:
    if S[C-1] == '.' and S[D-1] == '.':
        print('Yes')
    else:
        print('No')
else:
    if '...' in S[max(0, B - 2):D+1]:
        print('Yes')
    else:
        print('No')
lista = []
for i in range(3):
  a,b = map(int,input().split()))
  lista.append(a)
  lista.append(b)
l1 = 0
l2 = 0
l3 = 0
l4 = 0
for j in lista:
  if j == 1:
    l1 += 1
  if j == 2:
    l2 += 1
  if j == 3:
    l3 += 1
  if j == 4:
    l4 += 1
c = l1%2 + l2%2 + l3%2 + l4%2
if c%2 == 0:
  print('YES')
else:
  print('NO')
  


### FIXED CODE ###

lista = []
for i in range(3):
  a,b = map(int,input().split())
  lista.append(a)
  lista.append(b)
l1 = 0
l2 = 0
l3 = 0
l4 = 0
for j in lista:
  if j == 1:
    l1 += 1
  if j == 2:
    l2 += 1
  if j == 3:
    l3 += 1
  if j == 4:
    l4 += 1
c = (l1)%2 + (l2)%2 + (l3)%2 + (l4)%2
if c <= 2:
  print('YES')
else:
  print('NO')
n=input()

print(n.replace("1","x").replace("9","1"),replace("x","9"))

### FIXED CODE ###

n=list(input())

for i in range(3):
      if n[i] == "1":
            n[i] = "9"
      elif n[i] == "9":
            n[i] = "1"

print("".join(n))
D, N = map(int, raw_input().split())
if N == 100
 if D == 0:
    print(101)
  elif D == 1:
    print(10001)
  elif D == 2:
    print(1000001)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)

### FIXED CODE ###

D, N = map(int, raw_input().split())
if N == 100:
 if D == 0:
    print(101)
 elif D == 1:
    print(10100)
 elif D == 2:
    print(1010000)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)
1 K, X = map(int, input().split())
2 print(' '.join(map(str, range(X - K + 1, X + K))))

### FIXED CODE ###

K, X = map(int, input().split())
print(' '.join(map(str, range(X - K + 1, X + K))))
N = int(input())
K = int(input())

@lru_cache
def func(num,counter):
    remain = num%10
    quotient = num//10
    
    
    if counter == 0:
        return 1
    
    if num<10:
        if counter ==1:
            return num
        else:
            return 0

    return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter)

print(func(N,K))

### FIXED CODE ###

N = int(input())
K = int(input())


def func(num,counter):
    remain = num%10
    quotient = num//10
    
    
    if counter == 0:
        return 1
    
    if num<10:
        if counter ==1:
            return num
        else:
            return 0

    return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter)

print(func(N,K))
s = input()

str=[]
for char in s:
    str.append(char)

str.sort()

for char in str:
    if str.count(char) > 1:
        print "no"
        break
else:
    print "yes"


### FIXED CODE ###

s = input()

str=[]
for char in s:
    str.append(char)

str.sort()

for char in str:
    if str.count(char) > 1:
        print("no")
        break
else:
    print("yes")
N, K = map(int, input().split())
A = list(map(int, input().split()))

m = {}
for i, a in enumerate(A):
    m[i+1] = a

visited = []
cycle = set()
current_city = 1
visited.append(current_city)
cycle.add(current_city)
cycle_start_index = -1
while 1:
    current_city = m[current_city]
    if current_city in cycle:
        cycle_start_index = visited.index(current_city)
        break
    else:
        visited.append(current_city)
        cycle.add(current_city)

cycle_before = visited[:cycle_start_index]
cycle_after = visited[cycle_start_index:]
if len(cycle_before) > K:
    print(cycle_after[(K - len(cycle_before)) % len(cycle_after)])
else:
    print(cycle_before[K - 1])

### FIXED CODE ###

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

m = {}
for i, a in enumerate(A):
    m[i+1] = a

visited = []
cycle = set()
current_city = 1
visited.append(current_city)
cycle.add(current_city)
cycle_start_index = -1
while 1:
    current_city = m[current_city]
    if current_city in cycle:
        cycle_start_index = visited.index(current_city)
        break
    else:
        visited.append(current_city)
        cycle.add(current_city)

cycle_before = visited[:cycle_start_index]
cycle_after = visited[cycle_start_index:]
if len(cycle_before) - 1 < K:
    print(cycle_after[(K - len(cycle_before)) % len(cycle_after)])
else:
    print(cycle_before[K])
IN = input()
if IN.isupper():
  return "A"
else:
  return "a"

### FIXED CODE ###

IN = input()
if IN.isupper():
  print("A")
else:
  print("a")
# ABC054C
# 方針：階乗の全探索

import itertools
N, M = map(int, input().split())
# Graph の作成
graph = [[] * N for _ in range(N)]
for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

# パターンの全列挙
lst = [_ for _ in range(0, N)]
search_list = itertools.permutations(lst)

ans = 0
for lst in search_list:
    flag = True
    if lst[0] != 0:    # 1度でも先頭が0以外ならそれ以降は全てダメ
        break
    for i in range(M-1):
        if lst[i+1] in graph[lst[i]]:   # 今の数字が次の数字と繋がっているかどうか
            pass
        else:
            flag = False
            break
    if flag:
        ans += 1

print(ans)

### FIXED CODE ###

# ABC054C
# 方針：階乗の全探索

import itertools
N, M = map(int, input().split())
# Graph の作成
graph = [[] * N for _ in range(N)]
for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

# パターンの全列挙
num_lst = [_ for _ in range(0, N)]
search_list = itertools.permutations(num_lst)

ans = 0
for lst in search_list:
    flag = True
    if lst[0] != 0:    # 1度でも先頭が0以外ならそれ以降は全てダメ
        break
    for i in range(N-1):
        if lst[i+1] in graph[lst[i]]:   # 今の数字が次の数字と繋がっているかどうか
            pass
        else:
            flag = False
            break
    if flag:
        ans += 1

print(ans)
W, H, x, y = map(int, input().split())
print(W*H/2, end=' ')
print(1 if W*y==x*H else 0)

### FIXED CODE ###

X, A = map(int, input().split())
print(0 if X<A else 10)
N= int(input())
i= int(input())

j=N-i+1

print (j)
    


### FIXED CODE ###

N, i = [int(x) for x in input().split()]
print(N - i + 1)
a, b, c = map(int, input().split())
    print('Yes' if 4 * a * b <= (c - a - b) ** 2 else 'No')

### FIXED CODE ###

a, b, c = map(int, input().split())
if a + b < c and 4 * a* b < (c - a- b) ** 2:
    print('Yes')
else:
    print('No')
mod = 10 ** 9 + 7

n, k = map(int, input().split())
otv = 0
D = [0] * (n + 1)
for i in range(1, n + 1):
    D[i] = pow(k // i, n, mod)

for i in range(k // 2, 0, -1):
    for j in range(i * 2, k + 1, i):
        D[i] -= D[j]

for i in range(1, n + 1):
    otv = (otv + D[i] * i) % mod

print(otv)

### FIXED CODE ###

mod = 10 ** 9 + 7

n, k = map(int, input().split())
otv = 0
D = [0] * (k + 1)
for i in range(1, k + 1):
    D[i] = pow(k // i, n, mod)

for i in range(k // 2, 0, -1):
    for j in range(i * 2, k + 1, i):
        D[i] -= D[j]

for i in range(1, k + 1):
    otv = (otv + D[i] * i) % mod

print(otv)
# -*- coding: utf-8 -*-
import math
from itertools import combinations_with_replacement


N = int(input())
items = {}
for n in list(range(N)):
  nth, a, b = map(int, input().split())
  items[n] = [nth, a, b]


def calcPosFromMoves(moves: list) -> list:
  points = {"x": 0, "y":0}
  for move in moves:
    points["x"] += move[0]
    points["y"] += move[1]
  return [points["x"], points["y"]]

def createMovePatterns(count: int) -> list:
  moves = [(1,0), (-1,0), (0,1), (0,-1)]
  return list(combinations_with_replacement(moves, count))
 
def observeTwoPoints(_observed: list, _expectation: list) -> bool:
  # print(observed,'?',expectation, '\n')
  result = [o == e for o, e in zip(_observed, _expectation)]
  return all(result)
    
def readByOneLine(_items: dict) -> list:
  _judges = []
  append = _judges.append
  for l, item in _items.items():  # read one line at once
    patterns = createMovePatterns(item[0])
    expectation = [item[1], item[2]]
    for pattern in patterns:  # brute force
      observed = calcPosFromMoves(pattern) 
      if observeTwoPoints(observed, expectation): 
        append(True)
        break;
  return _judges

judges = readByOneLine(items)
print('{}'.format('Yes' if len(judges) == N and all(judges) else 'No' ))

### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b = map(int, input().split())
print("{}".format('Even' if ((a*b)%2 == 0) else 'Odd'))
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    Color = [0] * 9
    for a in A:
        if a >= 3200:
            Color[-1] += 1
        else:
            Color[a // 400] = 1

    mi = sum(Color[:8]) + (1 if sum(Color[:8]) == 0 and Color[9] > 0 else 0)
    ma = sum(Color[:8]) + Color[8]

    print(mi, ma)


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    res1 = []
    res2 = []
    for i in range(n):
        a = A[i] // 400
        if a < 8:
            res1.append(a)
        else:
            res2.append(a)

    ma = len(set(res1)) + len(res2)
    mi = len(set(res1)) + 0 if len(set(res1)) != 0 else 1
    print(mi, ma)


if __name__ == '__main__':
    resolve()
s = input()
n = len(s)

if n < 4:
    print('0')
else:
    cnt = 0
    for i in range(n-3):
        for j in range(i+3, n):
            step = int(s[i:j+1])
            if step%2019 == 0:
                cnt += 1

print(cnt)

### FIXED CODE ###

import collections
s = input()
n = len(s)
mod_list = [0]

T = 0
for i in range(n):
    T += int(s[-1-i])*pow(10, i, 2019)%2019
    T = T%2019
    mod_list.append(T)

res = collections.Counter(mod_list)
cnt = 0
for d in res.values():
    cnt += int(d*(d-1)/2)
print(cnt)
N,K,Q = map(int,input().split())

A=[]
for i in range(Q):
    A.append(int(input()))

ans_list = [K] * N

for i in range(Q):
    ans_list[A[i-1]] +=1

for i in range(N):
    if ans_list[i] > K+1:
        print("Yes")
    else:print("No")

### FIXED CODE ###

import collections
N,K,Q = map(int,input().split())

A=[]
for i in range(Q):
    A.append(int(input()))
    
jud = Q - K

ans_list = [0] * N

c = collections.Counter(A)
key = list(c.keys())
val = list(c.values())
for i in range(len(c)):
  ans_list[key[i]-1] = val[i]

for i in range(len(c)):
    if val[i] > jud:
        ans_list[key[i]-1] +=1
for i in range(N):
    if ans_list[i] > jud:
        print("Yes")
    else:
        print("No")
a,b=map(int,input().split())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif b<a:
  print("Alice")
else a<b:
  print("Bob")

### FIXED CODE ###

a,b=map(int,input().split())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif b<a:
  print("Alice")
else:
  print("Bob")
A, B = map(int, input().split())

import math

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

print(lcm(A, B))

### FIXED CODE ###

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

import fractions

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

print(lcm(A, B))
N = int(input)
A = list(map(int, input().split()))
L = [0 for i in range(max(A)+2)]
ans = 1
L[0] = 3
p = 10 ** 9 + 7
for i in range(N):
  ai = A[i]
  ans *= (L[ai] - L[ai + 1])
  ans = ans % p
  L[ai + 1] += 1
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(max(A)+2)]
ans = 1
L[0] = 3
p = 10 ** 9 + 7
for i in range(N):
  ai = A[i]
  ans *= (L[ai] - L[ai + 1])
  ans = ans % p
  L[ai + 1] += 1
print(ans)
import heapq
import bisect

n = int(input())
n = n*3
a = list(map(int,input().split()))

big = a[0:n//3]
big.sort()
tempmin = a[n//3::]
tempmin.sort()
small = tempmin[0:n//3]
spare = tempmin[n//3::]

ans = sum(big)-sum(small)
mxm = ans

heapq.heapify(small)
heapq.heapify(spare)

for i in range(n//3,2*n//3):
    if len(spare) != 0 and a[i] >= spare[0]:
        index = bisect.bisect_left(spare,a[i])
        spare.pop(index)

    if a[i] > big[0]:
        ans += a[i]-big[0]
        index = bisect.bisect_left(big,a[i])
        big.insert(index,a[i])
        big.pop(0)
    
    if a[i] <= small[-1]:
        ans -= spare[0]-a[i]
        heapq.heappush(small,spare[0])
        heapq.heappop(spare)
        index = bisect.bisect_left(small,a[i])
        small.pop(index)
    
    if ans > mxm:
        mxm = ans
print(mxm)

### FIXED CODE ###

import heapq
import bisect

n = int(input())
n = n*3
a = list(map(int,input().split()))

left = a[0:n//3]
right = list(-i for i in a[2*n//3:])

leftsum = [0 for i in range(n//3+1)]
rightsum = [0 for i in range(n//3+1)]

heapq.heapify(left)
leftsum[0] = sum(left)
for i in range(n//3):
    k = i + n//3
    heapq.heappush(left,a[k])
    temp = heapq.heappop(left)
    leftsum[i+1] = leftsum[i]+a[k]-temp

heapq.heapify(right)
rightsum[-1] = -sum(right)
for i in range(n//3)[::-1]:
    k = i + n//3
    heapq.heappush(right,-a[k])
    temp = -heapq.heappop(right)
    rightsum[i] = rightsum[i+1] - temp + a[k]




mxm = -sum(a)
for i in range(n//3+1):
    if leftsum[i]-rightsum[i] > mxm:
        mxm = leftsum[i]-rightsum[i]
print(mxm)
ans_list =[]
point = []
for i in range(n):
  point.append(k)
#print(point)      
for j in range(q):
  ans_list.append(int(input()))
#print(ans_list)
for k in ans_list:
  point[k-1] += 1
#print(point)
for l in range(n):
  point[l] -= q
  if point[l]>0:
    print("Yes")
  else:
    print("No")
#print(point)

### FIXED CODE ###

n,k,q = map(int,input().split())
ans_list =[]
point = []
for i in range(n):
  point.append(k)
#print(point)      
for j in range(q):
  ans_list.append(int(input()))
#print(ans_list)
for k in ans_list:
  point[k-1] += 1
#print(point)
for l in range(n):
  point[l] -= q
  if point[l]>0:
    print("Yes")
  else:
    print("No")
#print(point)
R=int(input())
    print(R*3.141)


### FIXED CODE ###

R=int(input())
pai=3.14
print(R*2*pai)
inf=float('inf')
N = int(input())
x = list(map(int, input().split()))
a=[0]*8
b=0
for i in range(0,N):
    if x[i]>=3200:
        b +=1
for j in range(0,8):
    for i in range(0,N):
        if x[i]<400:
            a[j] +=1
            x[i] = inf
        x[i] -= 400

zerox=0
mincolar=0
 
for i in a:
    if i==0:
        zerox +=1  
    else:
        mincolar +=1

if(zerox<b):
    print(mincolar,mincolar+zerox)
else:
    print(mincolar,mincolar+b)


quit()



### FIXED CODE ###

x = list(map(int, input().split()))
y=x[0]*100+x[1]*10+x[2]
oyu=0

if y%4==0: 
    print('YES')
else:
    print('NO')


quit()
import sys
sys.setrecursionlimit(10**7)

n = int(input())
T = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  T[a].append(b)
  T[b].append(a)
L = [-1]*n
dist = [-1]*n
F_1 = [i for i in range(1, n+1) if i%3==1]
F_2 = [i for i in range(1, n+1) if i%3==2]
F_0 = [i for i in range(1, n+1) if i%3==0]
def dfs_1(v):
  stack = [v]
  D = [-1]*n
  D[v] = 0
  while stack:
    i = stack.pop()
    for nv in T[i]:
      if D[nv] == -1:
        D[nv] = D[i] + 1
        stack.append(nv)
  return D.index(max(D))
s = dfs_1(0)
dist[s] = 0
def dfs_2():
  S = [s]
  while S:
    v = S.pop()
    if dist[v]%2:
      if F_1:
        L[v] = F_1.pop()
      else:
        L[v] = F_0.pop()
    else:
      if F_2:
        L[v] = F_2.pop()
      else:
        L[v] = F_0.pop()
    for nv in T[v]:
      if dist[nv] == -1:
        dist[nv] = dist[v] + 1
        S.append(nv)
dfs_2()
print(*L)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

n = int(input())
T = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  T[a].append(b)
  T[b].append(a)
L = [-1]*n
dist = [-1]*n
dist[0] = 0
F_1 = [i for i in range(1, n+1) if i%3==1]
F_2 = [i for i in range(1, n+1) if i%3==2]
F_0 = [i for i in range(1, n+1) if i%3==0]
def dfs(v):
  for nv in T[v]:
    if dist[nv] == -1:
      dist[nv] = dist[v] ^ 1
      dfs(nv)
dfs(0)
l0 = dist.count(0)
l1 = n - l0
if l0 <= n//3:
  for i in range(n):
    if dist[i] == 0:
      L[i] = F_0.pop()
    else:
      if F_1:
        L[i] = F_1.pop()
      elif F_2:
        L[i] = F_2.pop()
      else:
        L[i] = F_0.pop()
elif l1 <= n//3:
  for i in range(n):
    if dist[i]:
      L[i] = F_0.pop()
    else:
      if F_1:
        L[i] = F_1.pop()
      elif F_2:
        L[i] = F_2.pop()
      else:
        L[i] = F_0.pop()
else:
  for i in range(n):
    if dist[i]:
      if F_1:
        L[i] = F_1.pop()
      else:
        L[i] = F_0.pop()
    else:
      if F_2:
        L[i] = F_2.pop()
      else:
        L[i] = F_0.pop()
print(*L)
print((int(input())+int(input())/2)

### FIXED CODE ###

r=int(input())
g=int(input())
print(g+g-r)
from functools import reduce
from operator import mul

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

if (X + Y) % 3 != 0:
  print(0)
  
else:
  a = Y - (X + Y) // 3
  b = X - (X + Y) // 3
  total = a + b
  m = min(a,b)
  nums = [i for i in range(m,total + 1)]
  div = [i for i in range(1,m + 1)]
  M = reduce(mul,div)
  N = reduce(mul,nums) * M
  print((N // M) % (10 ** 9 + 7))
  

### FIXED CODE ###

def cmb(n, k, mod, fac, infac):
  k = min(k,n-k)
  return fac[n] * infac[k] * infac[n-k] % mod

def tables(mod, n):
  fac = [1, 1] 
  infac = [1, 1] 
  inverse = [0, 1] 
  for i in range(2, n+1):
    fac.append((fac[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    infac.append((infac[-1] * inverse[-1]) % mod)
  return fac,infac

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

if X > Y:
  X, Y = Y, X

move = X + Y

if move % 3 != 0:
  print(0)
else:
  total = move // 3
  n = X - total
  
  if n < 0:
    print(0)
    
  else:
    MOD = 10 ** 9 + 7
    fac, infac = tables(MOD, total)
    ans = cmb(total, n, MOD, fac, infac)
    
    print(ans)