Problem:
 Score : 100 points    Problem Statement  We have N+M balls, each of which has an integer written on it. It is known that:   The numbers written on N of the balls are even.  The numbers written on M of the balls are odd.   Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.      Constraints   0 \leq N,M \leq 100  2 \leq N+M  All values in input are integers.         Input  Input is given from Standard Input in the following format:  N  M       Output  Print the answer.        Sample Input 1 2 1      Sample Output 1 1  For example, let us assume that the numbers written on the three balls are 1,2,4 .   If we choose the two balls with 1 and 2 , the sum is odd;  If we choose the two balls with 1 and 4 , the sum is odd;  If we choose the two balls with 2 and 4 , the sum is even.   Thus, the answer is 1 .       Sample Input 2 4 3      Sample Output 2 9       Sample Input 3 1 1      Sample Output 3 0       Sample Input 4 13 3      Sample Output 4 81       Sample Input 5 0 3      Sample Output 5 3

Solution (Python):
n, m = map(int, input().split())
if n * m == 0:
  if n == 0:
    print(m * (m-1) // 2)
  else:
    print(n * (n-1) // 2)
else:
  print((n * (n-1) + m * (m-1)) // 2)

Solution (Python):
N, M = map(int, input().split())

ans = 0
if N >= 2:
    ans += N*(N-1)/2.0

if M >= 2:
    ans += M*(M-1)/2.0

print(int(ans))

Solution (Python):
n,m = map(int,input().split())
if n >= 2:
    s1 = n*(n-1)/2
else:
    s1 = 0

if m >= 2:
    s2 = m*(m-1)/2
else:
    s2 = 0

print(int(s1+s2))

Solution (Python):
N, M = (int(x) for x in input().split())
print(int(N*(N-1)/2 + M*(M-1)/2))

Solution (Python):
n,m=map(int,input().split())
print((n*(n-1)+m*(m-1))//2)

Solution (Python):
N, M = map(int, input().split())
print(int(( N*(N-1) + M*(M-1) )/2))

Solution (Python):
N, M = map(int, input().split())
print(N*(N-1)//2 + M*(M-1)//2)

Solution (Python):
















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


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


ans = 0
if m >= 2:
    ans += combinations_count(m, 2)
if n >= 2:
    ans += combinations_count(n, 2)
print(ans)

Solution (Python):
a,b=map(int,input().split())
import itertools
a1 = len(list(itertools.combinations(range(a), 2)))
b1 = len(list(itertools.combinations(range(b), 2)))
print(a1+b1)

Solution (Python):
N, M = map(int, input().split())
print(int((N*(N-1)/2)+(M*(M-1)/2)))

Solution (Python):

import sys



def solve(N: int, M: int):
    print(N*(N-1)//2+M*(M-1)//2)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    solve(N, M)

if __name__ == '__main__':
    main()

Solution (Python):
N, M = map(int, input().split())

ans =  N * (N - 1) / 2 + M * (M - 1) / 2

print(int(ans))

Solution (Python):

N, M = [int(str) for str in input().strip().split()]

print((N * (N - 1) + M * (M - 1)) // 2)

Solution (Python):
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

import itertools as it

N,M=input_int()

N=len(list(it.combinations([N]*N,2)))

M=len(list(it.combinations([M]*M,2)))

print(N+M)

Solution (Python):
n, m = map(int, input().split())
ans = n * max(n-1, 0) //2 + m * max(m-1, 0) //2
print(ans)

Solution (Python):
n, m = map(int, input().split())

n_count = n*(n-1) // 2
m_count = m*(m-1) // 2
print(n_count+m_count)

Solution (Python):
n = list(map(int,input().split()))
ans = 0
if n[0]>=2:
    ans += n[0]*(n[0]-1)//2
if n[1]>=2:
    ans += n[1]*(n[1]-1)//2
print(ans)

Solution (Python):
N,M = map(int,input().split())

ans = N*(N-1) // 2 + M*(M-1)//2
print(ans)

Solution (Python):
N, M = map(int, input().split())

ans = N*(N-1)//2 + M*(M-1)//2
print(ans)

Solution (Python):
n, m = [int(x) for x in input().split()]

result = 0

if n > 1:
  result += n*(n-1)/2

if m > 1:
  result += m*(m-1)/2

print(int(result))

Solution (Python):


import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

def ncr(n, r, p=MOD):
    a = 1
    b = 1
    for i in range(r):
        a = (a * (n - i) % p)
        b = (b * (r - i) % p)

    return a * pow(b, p - 2, p) % p

N, M = LI()

print(ncr(N,2) + ncr(M,2))

Solution (Python):
x,y= list(map(int, input().split())) 
z=(x*(x-1)//2)+(y*(y-1)//2)
print(z)

Solution (Python):
n, m = input().split()
n = int(n)
m = int(m)

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans = 0

if n >= 2:
    ans += cmb(n, 2)
else:
    pass

if m >= 2:
    ans += cmb(m, 2)
else:
    pass

print(ans)

Solution (Python):
N, M = map(int, input().split())

print(N*(N-1)//2 + M*(M-1)//2)

Solution (Python):
N, M = map(int, input().split())
ans = 0 
if N >= 2:
  ans += N*(N-1)//2 
if M >= 2:
  ans += M*(M-1)//2
print(ans)

Solution (Python):
n,m=map(int,input().split())
ans=0
if n>=2:
    ans+=n*(n-1)//2
if m>=2:
    ans+=m*(m-1)//2
print(ans)

Solution (Python):
N,M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)

Solution (Python):
def MI():return map(int,input().split())
def LI():return list(MI())





n,m=MI()
ans=n*(n-1)//2+m*(m-1)//2

print(ans)

Solution (Python):
N, M = map(int, input().split())
way_odd = max(M * (M - 1) // 2, 0)
way_even = max(N * (N - 1) // 2, 0)
print(way_even + way_odd)

Solution (Python):
N, M = map(int, input().split())
ans = M*(M-1)/2+N*(N-1)/2
print(int(ans))

Solution (Python):
N, M = map(int, input().split())

gu = (N * (N-1))/2
ki = (M * (M-1))/2

print(int(gu + ki))

Solution (Python):
n,m = map(int,input().split())
a = [0,0,1]
for i in range(2,101):
	a.append(a[-1]+i)
print(a[n]+a[m])

Solution (Python):

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

print((N * (N - 1) + M * (M - 1)) // 2)

Solution (Python):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,m = [int(e) for e in input().split()]
res = 0
if n >= 2:
    res += comb(n,2)
if m >= 2:
    res += comb(m,2)
print(res)

Solution (Python):
from math import *

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

print(n*(n-1)//2 + m*(m-1)//2)

Solution (Python):
a,b = map(int,input().split())
print((a*(a-1)+b*(b-1))//2)

Solution (Python):
n, m = map(int, input().split())
cnt = 0
if m >= 2:
    cnt += m * (m-1) // 2

cnt += n * (n-1) // 2
print(cnt)

Solution (Python):
n, m = list(map(int, input().split()))
print(int(n*(n-1)/2 + m*(m-1)/2))

Solution (Python):
N,M = map(int,input().split())
ans = N*(N-1)//2 + M*(M-1)//2

print(ans)

Solution (Python):
n, m = map(int, input().split())
print(((n*(n-1))//2) + ((m*(m-1)//2)))

Solution (Python):

GBN_DEBUG = False
GBN_DEBUG = True
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)






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



ans = N * (N - 1) // 2 + M * (M - 1) // 2
print(ans)

Solution (Python):
n, m = map(int, input().split())
result = n * (n - 1) // 2 + m * (m-1)//2
print(result)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,m=MI()
    print(n*(n-1)//2+m*(m-1)//2)

main()

Solution (Python):
x,y = map(int,input().split())

sum = 0

if x > 1:
    sum += x*(x-1) / 2
if y > 1:
    sum += y*(y-1) / 2
print(int(sum))

Solution (Python):
import math

n, m = map(int, input().split(' '))
if n >= 2:
    ret_n = n * (n - 1) / 2
else:
    ret_n = 0

if m >= 2:
    ret_m = m * (m - 1) / 2
else:
    ret_m = 0

print(int(ret_n + ret_m))

Solution (Python):
inxx = input()
inxx = inxx.split()
n = int(inxx[0])
m = int(inxx[1])
sol = (n*(n-1))//2 + (m*(m-1))//2

print(sol)

Solution (Python):
def f(a):
	return a * (a-1) // 2
n,m = map(int, input().split())
print(f(n)+f(m))

Solution (Python):
n, m = map(int, input().split())			

a=max(0, n*(n-1)//2) + max(0,m*(m-1)//2)
print(a)

Solution (Python):
n, m = map(int, input().split())
r = (n*(n-1))/2 + (m*(m-1))/2
print(int(r))

Solution (Python):
N,M = map(int,input().split())
ans = 0
if N>=2:
    ans+=N*(N-1)/2
if M>=2:
    ans+=M*(M-1)/2
print(int(ans))

Solution (Python):
N, M=map(int, input().split())

def nc2(n):
  return n*(n-1)/2

print(int(nc2(N)+nc2(M)))

Solution (Python):
N, M = map(int,input().split())

print(int(N*(N-1)/2 + M*(M-1)/2))

Solution (Python):
def input_int_list():
    return [int(thing) for thing in input().split(" ")]

N,M=input_int_list()
print((N*N-N+M*M-M)//2)

Solution (Python):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def resolve():
    N, M = map(int, input().split())

    res = 0
    if N >= 2:
        res += combinations_count(N, 2)
    if M >= 2:
        res += combinations_count(M, 2)
    print(res)


if __name__ == "__main__":
    resolve()

Solution (Python):
def nCr(n, r):
    import math
    
    
    if r > n:
        return 0
    return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))

n, m = map(int, input().split())
res = 0
if n > 1:
    res += nCr(n, 2)
if m > 1:
    res += nCr(m, 2)
print(res)

Solution (Python):
n, m = map(int, input().split())
print(n * (n - 1) // 2 + m * (m - 1) // 2)

Solution (Python):
n, m = [int(i) for i in input().split()]

def calc(s):
  if s < 2:
    return int(0)
  else:
    return int(s * (s-1) / 2)

print(calc(n) + calc(m))

Solution (Python):
n,m = list(map(int,input().split()))
res = n*(n-1)//2
res+= m*(m-1)//2
print(res)

Solution (Python):
N, M = map(int, input().split())

ans = ((N + M) * (N + M - 1) / 2) - N * M

print(int(ans))

Solution (Python):
n, m = map(int, input().split())
a = n*(n-1)//2 + m*(m-1)//2
print(a)

Solution (Python):
a,b=list(map(int, input().split()))
ct=(a*(a-1))//2
ct+=(b*(b-1))//2
print(ct)

Solution (Python):
import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
from io import BytesIO, IOBase
 



 
def sieve(n):
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r
 
def divs(n, start=1):
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors
 
def divn(n, primes):
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t
 
def flin(d, x, default=-1):
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return (default, default)
    else:
        return (left, right)
 
def ceil(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def prr(a, sep=' '): print(sep.join(map(str, a)))
def dd(): return collections.defaultdict(int)
def ddl(): return collections.defaultdict(list)
 
 

 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
	newlines = 0
 
	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None
 
	def read(self):
			while True:
					b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
					if not b:
							break
					ptr = self.buffer.tell()
					self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
			self.newlines = 0
			return self.buffer.read()
 
	def readline(self):
			while self.newlines == 0:
					b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
					self.newlines = b.count(b"\n") + (not b)
					ptr = self.buffer.tell()
					self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
			self.newlines -= 1
			return self.buffer.readline()
 
	def flush(self):
			if self.writable:
					os.write(self._fd, self.buffer.getvalue())
					self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
	def __init__(self, file):
			self.buffer = FastIO(file)
			self.flush = self.buffer.flush
			self.writable = self.buffer.writable
			self.write = lambda s: self.buffer.write(s.encode("ascii"))
			self.read = lambda: self.buffer.read().decode("ascii")
			self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 

'''for _ in range(ii()):
    n=ii()
    a=li()
    m,k,md=0,0,0
    mn,mx=10**9+1,-10**9-1
    for i in range(n-1):
        if a[i]!=-1 and a[i+1]!=-1:
            m=max(m,abs(a[i]-a[i+1]))
    for i in range(1,n-1):
        if a[i]==-1:
            if a[i+1]!=-1:
                mn=min(mn,a[i+1])
                mx=max(mx,a[i+1])
            if a[i-1]!=-1:
                mn=min(mn,a[i-1])
                mx=max(mx,a[i-1])
    if mn==10**9+1 and mx==-10**9-1:
        print(0,0,sep=' ')
    else:
        md=(mn+mx+1)//2
        m=max(abs(mx-md),abs(mn-md),m)
        print(m,md,sep=' ')'''

'''for _ in range(ii()):
    n,m=mi()
    tg=n//2
    n0=n-m
    total=(n*(n+1))//2
    res=0
    if n0<n:
        if m>=tg:
            res=total-n0
        else:
            i=tg-m
            if n&1:
                nn0=2*i+1
            else:
                nn0=2*i
            res=total-((nn0*(nn0+1))//2)-(n0-nn0)
            
    print(res)'''



'''def solve():
    n=int(input())
    a=list(map(int,input().split()))
    diff=len(set(a))
    if diff==1: print (int((n*(n+1))/2))
    elif diff==n: print (1)
    else:
        i=j=ans=0
        ahead=True
        distinct={}
        while j<n:
            if ahead:
                distinct[a[j]]=distinct[a[j]]+1 if a[j] in distinct else 1
                if len(distinct)==diff:
                    ahead=False
                else:
                    j+=1
            else:
                ans+=n-j
                if distinct[a[i]]>1:
                    distinct[a[i]]-=1
                else:
                    distinct.pop(a[i])
                    j+=1
                    ahead=True
                i+=1
        print (ans)
 
solve()'''



'''s=input()
n=len(s)
i,cntl,cntg=0,0,0
res,fl,fg=0,0,0
while(i<n):
    if s[i]=='<':
        while(i<n and s[i]!='>'):
            fl=1
            cntl+=1
            i+=1
    else:
        while(i<n and s[i]!='<'):
            fg=1
            cntg+=1
            i+=1
    if fl==1 and fg==1:
        res+=max(cntl,cntg)
        cntl-=1
        cntg-=1
        res+=cntl*(cntl+1)//2
        res+=cntg*(cntg+1)//2
        fl,fg,cntl,cntg=0,0,0,0
if fl:
    res+=cntl*(cntl+1)//2
if fg:
    res+=cntg*(cntg+1)//2
print(res)'''





from math import factorial
def ncr(n,r):
    if n>=r:
        return factorial(n)//(factorial(r)*factorial(n-r))
    else:
        return 0
n,m=mi()
print(ncr(n,2)+ncr(m,2))

Solution (Python):
n,m = map(int, input().split())

if n==0:
    res = m*(m-1)//2
elif m==0:
    res = n*(n-1)//2
else:
    res = n*(n-1)//2 + m*(m-1)//2

print(res)

Solution (Python):
from math import factorial
def ncr(n,r):
	if n<r:
		return 0
	else:
		return factorial(n)/(factorial(n-r)*factorial(r))
n,m = map(int,input().split())
print(int(ncr(n,2)+ncr(m,2)))

Solution (Python):
N, M = [int(x) for x in input().split()]

ans = (N * (N - 1) + M * (M - 1))//2

print(ans)

Solution (Python):

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

def main():
    N, M = map(int, input().split())

    print(N*(N-1)//2+M*(M-1)//2)


if __name__ == '__main__':
    main()

Solution (Python):

n, m = [int(x) for x in input().split()]


ee = n * (n-1) / 2

oo = m * (m-1) / 2

print(int(ee + oo))

Solution (Python):
import sys
sys.setrecursionlimit(10000000)


def main():
    N, M = map(int, input().split())
    a = N * (N - 1) / 2
    b = M * (M - 1) / 2
    print(int(a + b))

if __name__ == '__main__':
    main()

Solution (Python):
N, M=map(int, input().split())
print(int(N*(N-1)/2+M*(M-1)/2))

Solution (Python):
N, M = map(int, input().split())

print(N * (N - 1) // 2 + M * (M - 1) // 2)

Solution (Python):
n,m=map(int, input().split())

ans = int((n * (n-1) + m * (m-1)) / 2)
print(ans)

Solution (Python):
n,m = map(int,input().split())
ans = 0

if n > 1:
    ans += n*(n-1)//2

if m > 1:
    ans += m*(m-1)//2
    
print(ans)

Solution (Python):
"""
NTC here
"""
import sys
inp = sys.stdin.readline


def input(): return inp().strip()


flush = sys.stdout.flush





def iin(): return int(input())


def lin(): return list(map(int, input().split()))





def main():
    def fn(n):
        return (n*(n+1))//2
    n, m = lin()
    print(fn(n-1)+fn(m-1))

main()

Solution (Python):
from scipy.misc import comb
N, M = map(int, input().split())
print(comb(N,2,exact=True)+comb(M,2,exact=True))

Solution (Python):
n,m = map(int, input().split())

print(int(n*(n-1)/2 + m*(m-1)/2))

Solution (Python):
n, m = map(int, input().split())


def nCr(n, r, mod=10**9+7):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod


if n >= 2 and m >= 2:
    print(nCr(n, 2) + nCr(m, 2))
elif n >= 2 and m <= 1:
    print(nCr(n, 2))
elif n <= 1 and m >= 2:
    print(nCr(m, 2))
else:
    print(0)

Solution (Python):
import itertools as it
n,m = map(int, input().split())
if n<2:
    n=0
else:
    n = n*(n-1)//2
if m<2:
    m=0
else:
    m = m*(m-1)//2
print(m+n)

Solution (Python):
N, M = map(int, input().split())
ans1 = N*(N-1)/2
ans2 = M*(M-1)/2

ans = ans1 + ans2

print(int(ans))

Solution (Python):
n,m=map(int,input().split())
s=(n*(n-1)+m*(m-1))//2
print(max(s,0))

Solution (Python):



import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    n = N * (N - 1) // 2 if N > 1 else 0
    m = M * (M - 1) // 2 if M > 1 else 0
    print(n + m)
    return

main()

Solution (Python):
a = list(map(int,input().split()))
print(int(a[0]*(a[0]-1)/2+a[1]*(a[1]-1)/2))

Solution (Python):
guu, ki = map(int, input().split())

print(int(guu*(guu-1)/2 + ki*(ki-1)/2))

Solution (Python):

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




total = n*(n-1)//2 + m*(m-1)//2
print(total)

Solution (Python):
N, M = map(int, input().split())
ret = N * (N - 1) // 2 + M * (M - 1)// 2
print(ret)

Solution (Python):
N, M = map(int, input().split())

print(int(N * (N - 1) / 2 + M * (M - 1) / 2))

Solution (Python):
N, M = map(int, input().split())
print((N*(N-1))//2+(M*(M-1))//2)

Solution (Python):
n, m = map(int, input().split())

ans = (m*(m-1)+n*(n-1))/2

print(int(ans))

Solution (Python):
n, m = map(int, input().split())


def comb(n, r):
    numerator = denominator = 1
    for i in range(r):
        numerator = numerator * (n - i)
        denominator = denominator * (i + 1)
    return numerator // denominator


ans = comb(m, 2) + comb(n, 2)
print(ans)

Solution (Python):
N,M=map(int,input().split())
ans=0
if N>=2:
  ans+=N*(N-1)/2
if M>=2:
  ans+=M*(M-1)/2
print(int(ans))

Solution (Python):
n, m = list(map(int, input().split()))

print(n * (n - 1) // 2 + m * (m - 1) // 2)

Solution (Python):
N, M = map(int, input().split())

def comb(n, r):
    bunshi = 1
    for i in range(n-r+1,n+1):
        bunshi = bunshi*i
    bunbo = 1
    for i in range(1,r+1):
        bunbo = bunbo * i 
    return bunshi//bunbo

print(comb(N,2)+comb(M,2))

Solution (Python):
N, M = map(int, input().split())

print(int(((N+M)*(N+M-1))/2-N*M))

Solution (Python):
N, M = map(int,input().split())
print (int(N*(N-1)/2 + M*(M-1)/2))

Solution (Python):
n, m = map(int, input().split())
if n <= 1 and m <= 1:
    print(0)
elif n <= 1:
    print(m * (m - 1) // 2)
elif m <= 1:
    print(n * (n - 1) // 2)
else:
    print(n * (n - 1) // 2 + m * (m - 1) // 2)

Solution (Python):
N, M = map(int, input().split())
print(M*(M-1)//2+N*(N-1)//2)

Solution (Python):
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n, m = map(int, input().split())
ans = 0
if n >= 2:
    ans += cmb(n, 2)

if m >= 2:
    ans += cmb(m, 2)

print(ans)

Solution (Python):
N, M = map(int, input().split())
cnt = 0
if M >= 2:
    cnt += M * (M - 1) // 2

if N >= 2:
    cnt += N * (N - 1) // 2

print(cnt)

Solution (Python):
N,M = map(int,input().split())

oo = N*(N-1)/2
ee = M*(M-1)/2


ans = int(oo+ee)
print(ans)

Solution (Python):
x = [int(x) for x in input().split()]

fromE = ((x[0])*(x[0]-1))//2
fromO = ((x[1])*(x[1]-1))//2

print(fromO+fromE)

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math

import itertools



import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n,m=map(int,input().split())
    ans=0
    if n==0:
        ans=cmb(m,2)
    elif n==1 and m==1:
        ans=0
    elif n==1 and m>=2:
        ans=cmb(m,2)
    elif n>=2 and m<=1:
        ans=cmb(n,2)
    elif n>=2 and m>=2:
        ans=cmb(n,2)+cmb(m,2)
    print(ans)


if __name__ == "__main__":

    main()

Solution (Python):
n, m = map(int, input().split())

print(int(n * (n-1) / 2 + m * (m-1) / 2))

Solution (Python):
N, M = map(int, input().split())
ans = 0
ans += (N*(N-1))//2 if N >= 2 else 0
ans += (M*(M-1))//2if M >= 2 else 0
print(ans)

Solution (Python):
n,m=map(int,input().split())
na=n*(n-1)//2
ma=m*(m-1)//2
print(na+ma)

Solution (Python):
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

x,y = map(int,input().split())
a = 0
b = 0

if x >= 2:
    a = comb(x,2)

if y >= 2:
    b = comb(y,2)

print(a+b)

Solution (Python):
N, M = map(int, input().split())

ans = 0
ans += N * (N - 1) / 2
ans += M * (M - 1) / 2
print(int(ans))

Solution (Python):
n,m=map(int, input().split())
from scipy.misc import comb
print(comb(n,2,exact=True)+comb(m,2,exact=True))

Solution (Python):
N,M=map(int,input().split())

print(N*(N-1)//2+M*(M-1)//2)

Solution (Python):
N,M = map(int,input().split())
from math import factorial
ans = 0
if N<=1:
  ans+=0
else:
  ans+=factorial(N)//factorial(2)//factorial(N-2)
if M<=1:
  ans+=0
else:
  ans+=factorial(M)//factorial(2)//factorial(M-2)
  
print(ans)

Solution (Python):
n,m = map(int,input().split())
print((n*(n-1))//2 + (m*(m-1))//2)

Solution (Python):
N, M = map(int, input().split())
print(N*(N-1)//2 + M*(M-1)//2)

Solution (Python):
n,m=map(int,raw_input().split())
print (n*(n-1))/2 + (m*(m-1))/2

Solution (Python):
N, M = [int(i) for i in input().split()]
print(N*(N-1)//2 + M*(M-1)//2)

Solution (Python):
n, m = map(int, input().split())
ansn = max(n * (n - 1) // 2, 0)
ansm = max(m * (m - 1) // 2, 0)
print(ansn + ansm)

Solution (Python):
a,b=map(int,input().split())
print(a*(a-1)//2+b*(b-1)//2)

Solution (Python):
A,B=map(int, raw_input().split())
print A*(A-1)/2+B*(B-1)/2

Solution (Python):
N, M = map(int, input().split())

print(int(N * (N-1) / 2) + int(M * (M-1) / 2))

Solution (Python):
n, m = map(int, input().split())
ans = n*(n - 1) // 2 + m*(m - 1) // 2
print(ans)

Solution (Python):
n,m=map(int,input().split())
r=n*(n-1)/2+m*(m-1)/2
print(int(r))

Solution (Python):
N, M = map(int,input().split())

print((N*(N-1)//2)+(M*(M-1)//2))

Solution (Python):
N,M = map(int,input().split())

def comb(n,k):
    n1, k = n+1, min(k, n-k)
    numer = denom = 1
    for i in range(1,k+1):
        numer = numer*(n1-i)
        denom = denom*i
    return numer//denom
if N >= 2 and M >= 2:
    ans = comb(N,2)+comb(M,2)
elif N < 2 and M >= 2:ans = comb(M,2)
elif N >= 2 and M < 2:ans = comb(N,2)
else:ans = 0
print(ans)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

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


def main():
   N, M = MAP()
   print(len(list(combinations(range(N), 2))) + len(list(combinations(range(M), 2))))


if __name__ == '__main__':
    main()

Solution (Python):
m,n =map(int,input().split())
print(int((n*n-n+m*m-m)/2))

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

ans = 0
if n > 1:
    ans += (n * (n-1))//2
if m > 1:
    ans += (m * (m-1))//2

print(ans)

Solution (Python):


def main():
    n, m = map(int, input().split())

    ret = n * (n - 1) // 2
    ret += m * (m - 1) // 2

    print(ret)

if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def solve(N: int, M: int):
    answer = 0
    if N >= 2:
        answer += comb(N,2)
    
    if M >= 2:
        answer += comb(M,2)

    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    solve(N, M)

if __name__ == '__main__':
    main()

Solution (Python):
NM = input().split(" ")

n = int(NM[0])
m = int(NM[1])

a = n*(n-1)/2
b = m*(m-1)/2

print(int(a+b))

Solution (Python):








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


def resolve():
    N,M=map(int,input().split())
    if N>1:
        if M>1:
            print(N*(N-1)//2+M*(M-1)//2)
        else:
            print(N*(N-1)//2)
    else:
        if M>1:
            print(M*(M-1)//2)
        else:
            print(0)



resolve()

Solution (Python):
N,M = map(int,input().split())
ans = 0
if N >= 2:
    ans += N*(N-1)/2
if M >= 2:
    ans += M*(M-1)/2
print(int(ans))

Solution (Python):
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
a = N * (N - 1) // 2
b = M * (M - 1) // 2

print(a + b)

Solution (Python):
N,M=map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)

Solution (Python):


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    
    

    N,M = map(int, input().split())
    a = N*(N-1)//2
    b = M*(M-1)//2
    print(a+b)

if __name__ == '__main__':
    main()

Solution (Python):
n,m = map(int, input().split())

if n == m == 1:
    print(0)
else:
    print(n * (n-1) // 2 + m * (m-1) //2)

Solution (Python):
n, m = map(int, input().split())

ans = 0
if n > 1:
    ans += n*(n-1)//2
if m > 1:
    ans += m*(m-1)//2

print(ans)

Solution (Python):
N,M=map(int, input().split())
print( N*(N-1)//2 + M*(M-1)//2 )

Solution (Python):
n = [list(map(int, s.split())) for s in open(0)][0]

x = 0
y = 0
if n[0] >= 1:
    x = n[0] * (n[0] - 1) / 2
if n[1] >= 1:
    y = n[1] * (n[1] - 1) / 2
print(int(x + y))

Solution (Python):
N,M=map(int,input().split())
print((M*(M-1)+N*(N-1))//2)

Solution (Python):
N, M = list(map(int, input().split()))

answer = (N * (N-1)) // 2 + (M * (M-1)) // 2
print(answer)

Solution (Python):
def RA():
    l = input().split()
    return list(map(lambda x: int(x), l))
    
a = RA()
n = a[0]
m = a[1]
print(int(m * (m - 1) / 2 + n * (n - 1) / 2))

Solution (Python):
n, m = map(int, input().split())
print(n * (n - 1) // 2 + m * (m - 1) // 2)