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())
cnt = 0
tables = [2*i for i in range(N)] + [2*i+1 for i in range(M)]
for i in range(len(tables)-1):
  for j in range(i+1, len(tables)):
    if not (tables[i] + tables[j]) % 2:
      cnt += 1
print(cnt)

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

Solution (Python):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N,M = map(int,input().split(" "))
if N>1:
    n = combinations_count(N, 2)
else:
    n=0
if M>1:
    m = combinations_count(M, 2)
else:
    m=0
print(n+m)

Solution (Python):
import itertools

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

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

print(a+b)

Solution (Python):
import sys,math
sys.setrecursionlimit(10**9)
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())
 
n,m=IA()
def f1(n):
    res=1
    for i in range(1,n+1):
        res*=i
    return res
def f(n):
    if n<2:return 0
    return f1(n)//(f1(n-2)*f1(2))

print(f(n)+f(m))

Solution (Python):
from math import factorial

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

if N > 1 and M > 1:
	a = factorial(N) / factorial(2) / factorial(N - 2)
	b = factorial(M) / factorial(2) / factorial(M - 2)
elif N <= 1 and M > 1:
	b = factorial(M) / factorial(2) / factorial(M - 2)
	a = 0
elif M <= 1 and N > 1:
	a = factorial(N) / factorial(2) / factorial(N - 2)
	b = 0
else:
	a, b = 0, 0


print(int(a+b))

Solution (Python):
N, M = map(int, input().split())
cnt = 0
ls = [0]
for i in range(1, 110):
    ls.append(ls[i - 1] + i)
if N == 0:
    N +=1
if M == 0:
    M += 1

print(ls[N-1] + ls[M-1])

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

nkai = 1
nkaid = 1
mkai = 1
mkaid = 1
for i in range(n):
  nkai *= (n-i)
for i in range(n-2):
  nkaid *= (n-2-i)
for i in range(m):
  mkai *= (m-i)
for i in range(m-2):
  mkaid *= (m-2-i)

if n == 1:
  nans= 0
else:
  nans= int(nkai/(nkaid*2))
if m == 1:
  mans= 0
else:
  mans= int(mkai/(mkaid*2))


print(nans + mans)

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())

if N == 1 and M == 1:
    print('0')
elif N == 1:
    calc = (M * (M-1)) // 2
    print(calc)
elif M == 1:
    calc = (N * (N-1)) // 2
    print(calc)
else:
    calc = (M * (M-1)) // 2 + (N * (N-1)) // 2
    print(calc)

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

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

print(ans)

Solution (Python):
N,M= list(map(int, input().split()))
s = int(N * (N -1) /2)
t = int(M * (M -1) /2)

print(s + t)

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

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

if m >= 0:
    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):
from operator import mul
from functools import reduce


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


def cmb(n, r):
    
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, M = inpl()

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

Solution (Python):
N,M=map(int,input().split())
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)]

a = cmb(N+M,2)-N*M
print(a)

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>1:
    ans += n*(n-1) /2
if m>1:
    ans += m*(m-1) /2
print(int(ans))

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

def comb2(x):
    if x == 0 or x == 1:
        return 0
    return (x*(x-1)) // 2

print(comb2(N)+comb2(M))

Solution (Python):
import math

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

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

result1 = 0
result2 = 0

if N > 1:
    result1 = combinations_count(N, 2)

if M > 1:
    result2 = combinations_count(M, 2)

print(result1 + result2)

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

Solution (Python):
m, n = map(int, input().split())
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)

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

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

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

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


a = N*(N-1)/2
b = M*(M-1)/2
print(str(int(a+b)))

Solution (Python):


import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (n, m) = [int(e) for e in lines[0].split(' ')]

    return (n, m)


def solve(n, m):
    
    
    result = (n + m) * (n + m - 1) // 2 - n * m
    
    return result
    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Solution (Python):
import math
n, m = raw_input().split()
n = int(n)
m = int(m)
if n < 2 and m < 2:
  print(0)
elif n < 2:
  print(math.factorial(m)//(math.factorial(m-2) * 2))
elif m < 2:
  print(math.factorial(n)//(math.factorial(n-2) * 2))
else:
  print(math.factorial(n)//(math.factorial(n-2)*2) + math.factorial(m)//(math.factorial(m-2)*2))

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

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

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

count = 0
if N != 0:
    count += N * (N -1) // 2
if M != 0:
    count += M * (M -1) // 2
print(count)

Solution (Python):
n, m = input().split(' ')
n = int(n)
m = int(m)
a = 0
b = 0

if n != 0:
  a = n * ( n - 1 ) / 2 
if m != 0:
  b = m * (m - 1) / 2
print(int(a + b))

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 = list(map(int, input().split()))
ans = 0

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

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

print(int(ans))

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

def main():
    n, m = map(int, input().split())
    if n >= 2:
        n_comb = comb(n,2)
    elif n < 2:
        n_comb = 0
    if m >= 2:
        m_comb = comb(m, 2)
    elif m < 2:
        m_comb = 0
    print(n_comb + m_comb)

if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]




def cmb(n,r):
    return factorial(n) // factorial(r) // factorial(n - r)

n,m=mii()
ans=0
if n<2 and m<2:
    print(0)
elif n>=2 and m<2:
    print(cmb(n,2))
elif n<2 and m>=2:
    print(cmb(m,2))
else:
    print(cmb(n,2)+cmb(m,2))

Solution (Python):
import math

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


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

c = comb(a, 2)
d = comb(b, 2)

print(c+d)

Solution (Python):
inp = list(map(lambda x: int(x), input().split(" ")))
N = inp[0]
M = inp[1]

sum1 = N*(N-1)//2
sum2 = M*(M-1)//2

print(sum1+sum2)

Solution (Python):
def LI():
	return [ int(s) for s in input().split() ]
  
N,M = LI()

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):

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):
a, b = map(int, input().split())
import math
def combination(n, r):
    if n <= 1:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print(combination(a, 2) + combination(b, 2))

Solution (Python):
import math

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

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

a = 0
if N >= 2:
  a = combinations_count(N, 2)
b = 0
if K >= 2:
  b = combinations_count(K, 2)
print(a + b)

Solution (Python):
import math

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


n, m = [int(i) for i in input().split()]
print(combinations_count(n,2)+combinations_count(m,2))

Solution (Python):
n,m = map(int,input().split())
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if n >= 2:
  a = cmb(n,2)
else:
  a = 0
if m >= 2:
  b = cmb(m,2)
else:
  b = 0
print(a+b)

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

Solution (Python):
import math

n,m = map(int, input().split(' '))
res = 0
if n >= 2:
    res += math.factorial(n) // (math.factorial(n-2) * math.factorial(2))
if m >= 2:
    res += math.factorial(m) // (math.factorial(m-2) * math.factorial(2))
print(res)

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

ee = 0 if N < 2 else N * (N-1) // 2
oo = 0 if M < 2 else M * (M-1) // 2

ans = ee + oo

print(ans)

Solution (Python):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
a, b = map(int, input().split())
if a <= 1:
  basea = 0
else:
  basea = comb(a,2)
if b <= 1:
  baseb = 0
else:
  baseb = comb(b,2)
print(basea + baseb)

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())
n2=(n*(n-1))//2
m2=(m*(m-1))//2

print(n2+m2)

Solution (Python):
def cmb(n, r):
    if n < 2: return 0
    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())

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

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

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

ret = 0
if N>0:
    ret += int(N*(N-1)/2)
if M>0:
    ret += int(M*(M-1)/2)
print(ret)

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

for i in range(n):
  for k in range(i+1,n):
    count += 1
for i in range(m):
  for k in range(i+1,m):
    count += 1
print(count)

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

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

Solution (Python):
import math

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

def comb(n,k):
    if n >= k:
        return math.factorial(n) // (math.factorial(n-k) * math.factorial(k))
    else:
        return 0
ans = comb(N,2)+comb(M,2)
print(ans)

Solution (Python):
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(int(N+M))

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

N, M = map(int, input().rstrip().split())
ret = 0
if N > 1:
    ret += combinations_count(N, 2)
if M > 1:
    ret += combinations_count(M, 2)
print(ret)

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

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

cg = sum([i for i in range(n-1, 0, -1)])
ck = sum([i for i in range(m-1, 0, -1)])
print(cg+ck)

Solution (Python):
N,M = map(int,input().split())
if N != 0 and M != 0:
  A = N*(N-1)+M*(M-1)
elif N == 0:
  A = M*(M-1)
elif M == 0:
  A = N*(N-1)
print(int(A/2))

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

ans = 0
if N < 2 and M < 2:
    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 fact(n):
    if n in (0,1):
        return 1
    return n * fact(n-1)

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

Solution (Python):
import math

n, m = list(map(int, input().split(" ")))
n_c = 0
m_c = 0

if n >= 2:
  n_c = math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
if m >= 2:
  m_c = math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))
  
print(n_c + m_c)

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

s = n+m

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

print(ans)

Solution (Python):
from itertools import combinations

if __name__ == '__main__':
    n, m = tuple([int(s) for s in input().split()])

    print((len(list(combinations(list(range(n)), 2)))) + (len(list(combinations(list(range(m)), 2)))))

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

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

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

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

print(ans)

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

Solution (Python):


n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(0, 10**2)
		m = rng(max(0, 2-n), 10**1)

def get_answer():
	answer = m * (m - 1) // 2 + n * (n - 1) // 2
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

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

if num_list[0] == num_list[1] == 1:
    print(0)

else:
    ans = (num_list[0] * (num_list[0] - 1))/2 + num_list[1] * (num_list[1] - 1) / 2
    print(int(ans))

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

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

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



if __name__ == "__main__":
    a()

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


def main():
    n, m = map(int, input().split())
    ans = 0
    for i in range(n):
        ans += n-(i+1)
    for i in range(m):
        ans += m-(i+1)
    print(ans)


main()

Solution (Python):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
n,m = map(int,input().split())
s = 0
if n > 1:
	s += combinations_count(n, 2)
if m > 1:
    s += combinations_count(m, 2)

print(s)

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

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

Solution (Python):
def binary(n):
    return bin(n)[2:]

def pow_w_mod(a, x, mod):  
    x = [int(b) for b in binary(x)]
    y = a
    for i in range(1, len(x)):
        y = (y**2) % mod
        if x[i] == 1:
            y = (y * a) % mod
    return y
def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n, r, mod=10**9 + 7):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i + 1, mod) % mod
    return res

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


if n < 2:
    b = 0 
else:
    b = combination(n, 2, mod=10**9 + 7)

if m < 2:
    c = 0
else:
    c = combination(m, 2, mod=10**9 + 7)
print(b+c)

Solution (Python):
N,M=map(int,input().split())
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

if N>=2:
    a=combinations_count(N,2)
else:
    a=0
if M>=2:
    b=combinations_count(M,2)
else:
    b=0
print(a+b)

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

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

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

Solution (Python):
NM = input().split(" ")
N = int(NM[0])
M = int(NM[1])


comb_N=0
comb_M=0
if N>=2:
  comb_N = (N*(N-1))/2
if M>=2:
  comb_M = (M*(M-1))/2

print(int(comb_N+comb_M))

Solution (Python):
import math


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

def comb(x, y):
    if x - y < 0:
        return 0
    return math.factorial(x) // (math.factorial(y) * math.factorial(x - y))


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

Solution (Python):

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

def comb(n, r):
    if n > 1:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    else:
        return 0

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

Solution (Python):
str = input()

list_in = str.split()

even = int(list_in[0])
odd = int(list_in[1])

num_patterns = (even * (even-1) / 2)
num_patterns += (odd * (odd-1) / 2)

print(int(num_patterns))

Solution (Python):
import sys

n, m = map(int, sys.stdin.readline().split())

def main():
    res = n * (n - 1) // 2 + m * (m - 1) // 2
    return res

if __name__ == "__main__":
    ans = main()
    print(ans)

Solution (Python):

from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

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

def In():
    return map(int, stdin.readline().split())

def I():
    return int(stdin.readline())

P = 1000000007
n, m = In()
c = 0
if n > 1:
    c += (n*(n-1))//2
if m > 2:
    c += (m*(m-1))//2
print(c)

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

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

if N > 1 and M > 1:
	print(cmb(N, 2) + cmb(M, 2))
elif N > 1:
    print(cmb(N, 2))
elif M > 1:
    print(cmb(M, 2))
else:
    print(0)

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

if n >= 2:
    n2 = int(n * (n - 1) / 2)
else:
    n2 = 0

if m >= 2:
    m2 = int(m * (m - 1) / 2)
else:
    m2 = 0
print(n2 + m2)

Solution (Python):
n, m = map(int, input().split())
ans = sum(range(n))
ans +=sum(range(m))
print(ans)

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

import math

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

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

    print(combinations_count(n+m, 2) - n * m)

if __name__ == '__main__':
    main()

Solution (Python):
n,m=map(int, input().split())
print(sum(range(0,n))+sum(range(0,m)) if 1 < m else sum(range(0,n)))

Solution (Python):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,m = map(int,input().split())
ans = 0
if n >= 2:
    ans += combinations_count(n, 2)
if m >= 2:
    ans += combinations_count(m, 2)
print(str( 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(int(ans))

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

Solution (Python):

import math
import itertools
import statistics
n, m = list(map(int, input().split()))
"""
if n%2==0 and m%2==0:
    
    print((n+m)*(n+m-1)/2)
elif n%2==0 and m%2!=0:
"""



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

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

n = inputs[0]
m = inputs[1]

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

Solution (Python):
a = list(map(int,input().split()))
ev = a[0]
od = a[1]
if (ev==0)and(od==0):
  n = 0
elif ev==0:
  n = a[1]*(a[1]-1)/2
elif od==0:
  n = a[0]*(a[0]-1)/2
else:
  n = a[0]*(a[0]-1)/2+a[1]*(a[1]-1)/2
print(int(n))

Solution (Python):
raw_input = input()
input_list = raw_input.split()
N = int(input_list[0])
M = int(input_list[1])

N_pair = N * (N-1) / 2
M_pair = M * (M-1) / 2

ans = N_pair + M_pair

print(int(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())
if N > 0 or M > 0:
    a = N - 1
    b = M - 1
else:
    a = 0
    b = 0
print((a * (a + 1)) // 2 + (b * (b + 1)) // 2)

Solution (Python):
from operator import mul
from functools import reduce

def cmb(n,r):
  r = min(n-r,r)
  if r == 0: return 1
  over = reduce(mul, range(n, n - r, -1))
  under = reduce(mul, range(1,r + 1))
  return over // under
ans = 0
n,m=map(int,input().split())
if n>1:
  ans += cmb(n,2)
if m>1:
  ans += cmb(m,2)
print(ans)

Solution (Python):



def main():
    n, m = map(int, input().split(" "))
    count = 0
    if n > 1:
        count += (n * (n - 1) // 2)
    if m > 1:
        count += (m * (m - 1) // 2)
    print(count)


if __name__ == '__main__':
    main()

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

Solution (Python):
n,m=input().strip().split(" ")
n,m=[int(n),int(m)]
k=n*(n-1)//2
p=m*(m-1)//2

print(k+p)

Solution (Python):
from math import factorial

M, N = [int(x) for x in input().split()]
ans = 0
if M > 1:
    ans += factorial(M) // (factorial(M - 2) * 2)

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

print(ans)

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

Solution (Python):
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)


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

Solution (Python):
from functools import reduce
def permu(n,r):
    return reduce(lambda a,b: a*b, range(n-r+1,n+1))
N,M = map(int, input().split())
print(int((permu(N,2)+permu(M,2))/2))

Solution (Python):

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

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

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

Solution (Python):
from itertools import combinations 
N, M = map(int, input().split())
ans = len(list(combinations(range(N), 2))) + \
      len(list(combinations(range(M), 2)))
if N == 1 and M == 1:
    print(0)
else:
    print(ans)

Solution (Python):
from math import factorial

n, m = map(int, input().split())
if n > 1 and m > 1:
    print(int(factorial(n)/factorial(2)/factorial(n-2) + factorial(m)/factorial(2)/factorial(m-2)))
elif n > 1:
    print(int(factorial(n)/factorial(2)/factorial(n-2)))
elif m > 1:
    print(int(factorial(m)/factorial(2)/factorial(m-2)))
else:
    print(0)

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

if N<=1:
    countN = 0

    if M <=1:
        countM = 0
    else:
        countM = (M*(M-1))/2


elif N>=2:
    countN = (N*(N-1))/2

    if M <=1:
        countM = 0
    else:
        countM = (M*(M-1))/2

print(int(countN + countM))

Solution (Python):
import itertools

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

l = []

for i in range(n):
    l.append(2)
for i in range(m):
    l.append(1)

ll = itertools.combinations(l, 2)

ans = 0
for i in ll:
    if (i[0]+i[1])%2 == 0:
        ans += 1

print(ans)

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

X = int((N * (N-1) / 2) + (M * (M-1) / 2))

print(X)

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

Solution (Python):
line = input()
line = line.split()
N,M = int(line[0]), int(line[1])

nN = N * (N-1) // 2
nM = M * (M-1) // 2

print(nN + nM)

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

Solution (Python):
import math
N,M = map(int,input().split())
def comb(n):
    return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))

if N >=2:
    a = comb(N)
else:
    a = 0

if M  >=2:
    b = comb(M)
else:
    b = 0

print(a+b)

Solution (Python):

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

x = (n*(n-1))/2
y = (m*(m-1))/2

print(int(x+y))

Solution (Python):



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

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

print(int(ans))

Solution (Python):
n,m=input().strip().split(" ")
n,m=[int(n),int(m)]
k=n*(n-1)//2
p=m*(m-1)//2

print(k+p)

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

x = 0

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

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

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

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

def main():
    N, M = map(int, input().split())
    ans = 0
    if N > 1:
        ans+=comb(N, 2)
    if M > 1:
        ans += comb(M, 2)
    print(ans)


    return 0


if __name__ == '__main__':
    main()

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

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

Solution (Python):


import math
import sys


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


def I():
    return int(sys.stdin.buffer.readline())


def LS():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()


def S():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8')


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


def SRL(n):
    return [list(S()) for i in range(n)]


def MSRL(n):
    return [[int(j) for j in list(S())] for i in range(n)]




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


def main():
    n, m = LI()

    if n + m < 2:
        print(0)
        sys.exit

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

    print(ans)


main()

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

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools

sys.setrecursionlimit(100001)







def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




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

def combinations_count(n, r):
    if n <= 1:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = 0

ans += combinations_count(x, 2)
ans += combinations_count(y, 2)
print(ans)

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

if N==1 and M==1:
  print(0)
elif N==2 and M==0:
  print(1)
elif N==0 and M==2:
  print(1)
else:
  print(int(N*(N-1)/2)+int(M*(M-1)/2))

Solution (Python):

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

nC2 = n* (n-1) /2 
mC2 = m* (m-1) /2 
Ans = nC2 + mC2 
print(int(Ans))

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

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

print(int(ans))

Solution (Python):
import math

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


a = 0
if N > 1:
    a = int(math.factorial(N) / (math.factorial(N-2)*2))


b = 0
if M > 1:
    b = int(math.factorial(M) / (math.factorial(M-2)*2))

print(a + b)