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, raw_input().split())
res = 0
if N >= 2:
    res += N*(N-1)/2
if M >= 2:
    res += M*(M-1)/2

print(res)

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

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

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

print(int(gusu + kisu))

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

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

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

print(ans)

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

ans = 0

for j in range(1,m):
    ans += j

for i in range(1,n):
    ans += i

print(ans)

Solution (Python):
"""def power(x, y): 
    res = 1
    x=x
    while (y > 0): 
        if ((y & 1) == 1) : 
            res = (res * x) 
        y = y >> 1
        x = (x * x)
    return res""" 
"""def fact(n):
    if(n==0):
        return 1
    if(n==1):
        return 1
    return fact(n-1)+fact(n-2)"""

import math





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

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

Solution (Python):
import sys
from math import factorial
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N, M = i_l()

a = 0
b = 0
if N > 1:
    a = factorial(N) / factorial(2) / factorial(N - 2)

if M > 1:
    b = factorial(M) / factorial(2) / factorial(M - 2)

print(int(a+b))

Solution (Python):
def main():
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    from itertools import combinations
    n,m = map(int, input().split())
    print(n*(n-1)//2+m*(m-1)//2)

if __name__ == '__main__':
    main()

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

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(int((N*(N-1)+M*(M-1))/2))

Solution (Python):



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

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


print(output)

Solution (Python):
import sys
import math
n,m = map(int, sys.stdin.readline().split())

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

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

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

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

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

print(int(ans))

Solution (Python):
import math
N,M=map(int,input().split())
if N>=2 and M>1:
    print(int(math.factorial(N)/(math.factorial(2)*math.factorial(N-2))+math.factorial(M)/(math.factorial(2)*math.factorial(M-2))))
    exit()
if N>=2:
    print(int(math.factorial(N)/(math.factorial(2)*math.factorial(N-2))))
elif M>1:
    print(int(math.factorial(M)/(math.factorial(2)*math.factorial(M-2))))
else:
    print(int(N//2+M//2))

Solution (Python):
inp = input().split()
N = int(inp[0])
M = int(inp[1])
result = N * (N - 1) / 2 + M * (M - 1) / 2
print(int(result))

Solution (Python):
ab=input().split()
a=int(ab[0])
b=int(ab[1])
count=0
if a<=1 and b<=1 :
  count=0

elif b>1 and a<=1 :
  count=b*(b-1)/2

elif a>1 and b<=1 :
  count=a*(a-1)/2

elif a>1 and b>1 :
  count=a*(a-1)/2+b*(b-1)/2

print(int(count))

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

Solution (Python):


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

Solution (Python):



a = input()

H,W=a.split(" ")
N=int(H)
M=int(W)
retnum=0
for i in range(N):
    retnum+=i
retnum+=M*(M-1)/2
print(int(retnum))

Solution (Python):

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

Solution (Python):
n,m = map(int,input().split())
x=(n*(n-1))//2
y=(m*(m-1))//2
print(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=map(int,input().split()) 

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

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

print(int(total))

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

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

Solution (Python):
import math

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

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

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

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

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

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

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

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

Solution (Python):
def XC2(X):
    if X <= 1:
        return 0
    else:
        return int(X*(X-1)/2)

if __name__ == '__main__':
    s = input().rstrip().split(' ')
    N = int(s[0])
    M = int(s[1])

    print(XC2(N)+XC2(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())
if n < 2 :
    n = 0
else :
    n = combinations_count(n, 2)

if m < 2 :
    m = 0
else :
    m = combinations_count(m, 2)

print(n+m)

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

N_pattern = N*(N-1)/2 if N > 1 else 0
M_pattern = M*(M-1)/2 if M > 1 else 0

print(int(N_pattern+M_pattern))

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

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

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

Solution (Python):
n,k= list(map(int, input().split()))
from math import factorial
if n>1:
    a=factorial(n)//factorial(2)//factorial(n-2)
else:
    a=0
if k>1:
    b=factorial(k)//factorial(2)//factorial(k-2)
else:
    b=0
print(a+b)

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

Solution (Python):

import math

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)
  
N, M = map(int, input().split(' '))

result = 0

if N > 1:
  result += permutations_count(N, 2)

if M > 1:
  result += permutations_count(M, 2)

print(result // 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())
print(n*(n-1)//2+m*(m-1)//2)

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

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

if N <= 1:
  N_cnt = 0
else:
  N_cnt = combinations_count(N, 2)
  
if M <= 1:
  M_cnt = 0
else:
  M_cnt = combinations_count(M, 2)
  
print(N_cnt + M_cnt)

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


def c2(x):
    return x * (x - 1) // 2


print(c2(n) + c2(m))

Solution (Python):
NM=input().split()
N=int(NM[0])
M=int(NM[1])
print(int((N*(N-1)+M*(M-1))/2))

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

ans = len(list(itertools.combinations(range(N + M), 2))) - N * M
print(ans)

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

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:
    ans1 = 0
else:
    ans1 = combinations_count(n, 2)
if m <= 1:
    ans2 = 0
else:
    ans2 = combinations_count(m, 2)
print(ans1 + ans2)

Solution (Python):
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter

n = stdin.readline().rstrip().split()
N = int(n[0])
M = int(n[1])

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

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

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

print(ans)

Solution (Python):
import sys
import numpy as np

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

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

print(int(num))

Solution (Python):
S = input().split(" ")
N = int(S[0])
M = int(S[1])
def calculate(n,m):

    s1 = (n * (n - 1)) // 2
    s2 = (m * (m - 1)) // 2

    print(s1 + s2)

calculate(N,M)

Solution (Python):
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

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

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

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

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

print(ans)

Solution (Python):
import math

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

if N>=2:
	ans += math.factorial(N)/(math.factorial(N-2)*math.factorial(2))
    
if M>=2:
	ans += math.factorial(M)/(math.factorial(M-2)*math.factorial(2))  

print(int(ans))

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

Solution (Python):
e,o=map(int,input().split())
ean=0
oan=0

if e>1:
    ean+=e*(e-1)//2
if o>1:
    oan+=o*(o-1)//2
    
print(ean+oan)

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

Solution (Python):
from itertools import combinations
def solve():
    N, M = map(int, input().split())
    print(len(list(combinations(range(N),2)) + list(combinations(range(M),2))))
if __name__ == '__main__':
    solve()

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

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

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

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

from math import factorial
if n >1:
    a = factorial(n) / factorial(2) / factorial(n - 2)
else: a= 0

if m > 1:
    b = factorial(m) / factorial(2) / factorial(m - 2)
else: b= 0

print(int(a+b))

Solution (Python):

from math import factorial as f


def c(n, r=2):
	if n <= 1:
		return 0
	else:
		return f(n) // (f(n - r) * f(r))


n, m = map(int, input().split())
print(c(n) + c(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())
ans=0
if n>1:
    ans+=combinations_count(n, 2)
if m>1:
    ans+=combinations_count(m, 2)
print(ans)

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


x = n + m
zentai = int(x*(x-1)/2)

result = zentai - n*m
print(int(result))

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

a=0
b=0

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

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

result=a+b

print(int(result))

Solution (Python):
A, B = map(int, input().split())


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

nm=list(map(int, input().split()))
n=nm[0]
m=nm[1]
answer=n*(n-1)/2+m*(m-1)/2
print(int(answer))

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

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


if __name__ == '__main__':
    a,b = map(int, input().split())
    c = 0
    d = 0
    if a > 1:
        c = cmb(a,2)
    if b > 1:
        d = cmb(b,2)
    print(c+d)

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

even_cost = 0
odd_cost = 0

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

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

print("%d"%(even_cost + odd_cost))

Solution (Python):
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n,m=map(int,input().split())

a=0

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

print(a)

Solution (Python):
m, n = list(map(int, input().split(" ")))
ans = int((m * (m - 1))/ 2) + int((n * (n - 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):
a, b = map(int, input().split())
print(a*(a-1)//2 + b*(b-1)//2)

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

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

print(result)

Solution (Python):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
x = 0
a,b = map(int, input().split())

if a == 0 or a == 1:
    pass
else:
    x += combinations_count(a,2)
if b == 0 or b == 1:
    pass
else:
    x += combinations_count(b,2)
print(x)

Solution (Python):


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

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

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

Solution (Python):


import sys
import math
sys.setrecursionlimit(10 ** 6)


def main():
	n, m = map(int, sys.stdin.readline().split())
	score = 0
	if n >= 2:
		score += math.factorial(n) // math.factorial(n-2) // math.factorial(2)
	if m >= 2:
		score += math.factorial(m) // math.factorial(m-2) // math.factorial(2)
	print(score)

main()

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] = [int(s) for s in input().rstrip().split(' ')]
def f(a:int):
  if a < 2:
    return 0
  else:
    return a*(a-1)//2
print(f(N) + f(M))

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

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

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

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

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

print(ans)

Solution (Python):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
n,m = map(int,input().split())
ans = ((m+n) * (m+n-1))//2
kisu = (n *(n-1))//2
gusu = (m*(m-1))//2
kigu = ans - kisu - gusu

print(kisu+gusu)

Solution (Python):
N, M = list(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):
N,M=map(int,input().split())
if M>=2:
    print(N*(N-1)//2+M*(M-1)//2)
else:
    print(N*(N-1)//2)

Solution (Python):
import math

def nCr(n,r):
    if n<=1:
        return 0
    f = math.factorial
    return f(n) / f(r) / f(n-r)

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



print(int(nCr(N,2)+nCr(M,2)))

Solution (Python):
import math

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

nCount = 0
mCount = 0

def comb(a):
  return math.factorial(a) // (math.factorial(a - 2) * math.factorial(2))

if n >=2:
  nCount = comb(n)

if m >=2:
  mCount = comb(m)
  
print(nCount + mCount)

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

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

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

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

Solution (Python):
import math

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

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


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

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

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

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

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

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

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

print(int(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):
e, o = map(int, input().split())
print(e*(e-1)//2 + o*(o-1)//2)

Solution (Python):
n,m=map(int,input().split())
ans=n*(n-1)/2+m*(m-1)/2
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())

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

Solution (Python):
def fact(n):
    if n == 0:
        return 1
    else:
        return n * fact(n - 1)

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

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)+m*(m-1))//2)

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

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

Solution (Python):
n, m = (int(x) for x in input().split())
ans = ((n*(n-1)) >> 1) + ((m*(m-1)) >> 1)
print(ans)

Solution (Python):

import sys


def solve(N: int, M: int):
    gusu = N * (N-1) // 2
    kisu = M * (M-1) // 2
    print(gusu + kisu)
    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 = list(map(int, input().split()))

res = 0

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

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

print(res)

Solution (Python):
import sys
input = sys.stdin.readline
N, M = map(int, input().split())

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

Solution (Python):
e,o = map(int,input().split())
print(e*(e-1)//2+o*(o-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(int(ans))

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

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

print(comb(n,2)+comb(m,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):
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

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

ans1 = 0
ans2 = 0

if N<2:
    ans1 = 0
else:
    ans1 = cmb(N,2)

if M<2:
    ans2 = 0
else:
    ans2 = cmb(M,2)

ans = ans1 + ans2
print(ans)

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

def f(p):
    if p<2:
        return 0
    else:
        return p*(p-1)//2

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

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())
a = n*(n-1)//2
b = m*(m-1)//2
print(a+b)

Solution (Python):
from math import factorial
n,m = map(int, input().split())

ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        ans += 1

for i in range(m - 1):
    for j in range(i + 1, m):
        ans += 1

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
ans2=m*(m-1)//2
print(ans+ans2)

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

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

A = int(0)

if N != 1:
    A = A + N*(N-1)/2

if M != 1:
    A = A + M*(M-1)/2
    
print(int(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())

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

Solution (Python):
N, M = map(int, input().split())
NM = N + M
print(NM * (NM - 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 = list(map(int, input().split()))


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

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

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

Solution (Python):

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

Solution (Python):
import itertools as it

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

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

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

ans = 0
if(N<2 and M<2):
    ans = 0
elif(N<2 and M>=2):
    ans = M*(M-1)/2
elif(N>=2 and M<2):
    ans = N*(N-1)/2
else:
    ans = M*(M-1)/2 + N*(N-1)/2

print(int(ans))

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

Solution (Python):
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n,m = i2()
if n == 1:
    a = 0
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):
import math
n,m=map(int,input().split())
ans = 0
if n >= 2:
    ans = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))
if m >= 2:
    ans += math.factorial(m) // (math.factorial(m-2) * math.factorial(2))
print(ans)

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

Solution (Python):

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

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


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

print(result)

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

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

ans = 0

if N == 0 or N == 1:
  ans += 0
else:
  ans += N*(N-1)/2
  
if M == 0 or M == 1:
  ans += 0
else:
  ans += M*(M-1)/2  

print(math.floor(ans))

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    N, M = input_nums()
    o = (N*N)//2 - (N//2)
    e = (M*M)//2 - (M//2)
    print(o + e)

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
n, m = map(int, input().split())
if m == 0:
    print(n*(n-1)//2)
elif n == 0:
    print(m*(m-1)//2)
else:
    print((m*(m-1) + n*(n-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):
import sys

N, M = map(int, sys.stdin.readline().strip().split())

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

Solution (Python):









import os
import sys


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


if __name__ == "__main__":
    main()

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

n_sum = 0
if n >=2:
    n_sum = n * (n-1) / 2 
    
m_sum = 0
if m >=2:
    m_sum = m * (m-1) / 2 

print(int(n_sum + m_sum))

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

print(N * max(N - 1, 0) // 2 + M * max(M - 1, 0) // 2)

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

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

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

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(int((n*(n-1)/2 ) + (m*(m-1))/2))

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

Solution (Python):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
from scipy.misc import comb

a = comb(N, 2, exact=True)
b = comb(M,2,exact=True)
print(a+b)

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

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

Solution (Python):
n, m = [int(i) for i 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())

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

Solution (Python):
import sys,math,copy,queue,itertools
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def LI(): return [int(x) for x in input().split()]
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
N,M = LI()
ans = N * (N-1) //2 + M * (M-1) // 2
print (ans)

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 m >= 2:
    ans += combinations_count(m,2)
if n >= 2:
    ans += combinations_count(n,2)

print(ans)

Solution (Python):
from sys import stdin


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


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

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

x=0

if N>=2:
  x += N*(N-1)/2
if M>=2:
  x+=M*(M-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 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 fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
odd = N * M
a = N + M
print(a * (a - 1) // 2 - odd)

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

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

Solution (Python):
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(int((n*(n-1)+m*(m-1))/2))

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

import math

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

tmp = 0 if n < 2 else combinations_count(n, 2)
tmp2 = 0 if m < 2 else combinations_count(m, 2)
print(tmp + tmp2)

Solution (Python):
n,m=[int(x) for x in 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)