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())
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):
import math

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

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

ans = 0
if N >= 2:
    ans += comb(N, 2)
if M >= 2:
    ans += comb(M, 2)

print(ans)

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

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

Solution (Python):
from scipy.misc import comb
n, m = map(int,input().split())

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

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

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

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

Solution (Python):
n, m = map(int, input().split())
print("{:.0f}".format(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 = list(map(int, input().split()))
print(int(n*(n-1)/2+m*(m-1)/2))

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

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

print(a + b)

Solution (Python):
a, b = map(int, input().split())

import itertools
ｃ = len(list(itertools.combinations(range(a), 2)))
d = len(list(itertools.combinations(range(b), 2)))

print(c + d)

Solution (Python):
import itertools

n,m = map(int,input().split())
comb = lambda x:x*(x-1)/2 if x >= 1 else 0
print(int(comb(n)+comb(m)))

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())
if N>=2:
    n = math.factorial(N)/(math.factorial(2) * math.factorial(N - 2))
else:
    n = 0
if M>=2:
    m = math.factorial(M)/(math.factorial(2) * math.factorial(M - 2))
else:
    m = 0

print(int(n+m))

Solution (Python):
import math
def com(a):
    if a == 0 or a == 1:
        return 0
    elif a == 2:
        return 1
    else:
        return math.factorial(a)/2/math.factorial(a-2)
A = list(map(int, input().split()))
result  = int(com(A[0])+com(A[1]))
print (result)

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

elif (n>=2 and m== 0):
    ans = ans + combinations_count(n, 2)
else:
    if (n!=1):
        ans = ans+ combinations_count(n, 2)
    
    if (m != 1):
        ans = ans + combinations_count(m, 2)



print(ans)

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

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

b = a[0] * (a[0] - 1) // 2 + a[1] * (a[1] - 1) // 2

print(b)

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

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

Solution (Python):
def compute_fact(n):
    global f
    if(n < 2):
        f = [1,1]
    else:
        f = [0 for i in range(n+1)]
        f[0] = 1
        f[1] = 1
        for i in range(2,n+1):
            f[i] = f[i-1]*i

def compute_c(n,r):
    compute_fact(n)
    ans = f[n]/(f[r] * f[n-r])
    return ans

n,m = [int(s) for s in input().split()]
if n >= 2 and m >= 2:
    print(int(compute_c(n,2) + compute_c(m,2)))
elif n >= 2:
    print(int(compute_c(n,2)))
elif m >= 2:
    print(int(compute_c(m,2)))
else:
    print(0)

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

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

N = input_lst[0]
M = input_lst[1]

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

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

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

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




def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))



from collections import deque

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





if __name__ == "__main__":
	main()

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

resolve()

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

Solution (Python):
import math

n, m = map(int, input().split())
if n <= 1:
    ans = 0
else:
    ans = math.factorial(n) / math.factorial(n - 2) / 2
if m <= 1:
        ans += 0
else:
    ans += math.factorial(m) / math.factorial(m - 2) / 2
print(int(ans))

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

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

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

def comb(n):
  res = (n * (n - 1)) // 2
  return res

print(comb(n) + comb(m))

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

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

Solution (Python):
if __name__ == "__main__":
    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())
if N < 1:
  n = 0
else:
  n = N*(N-1) / 2
if M < 1:
  m = 0
else:
  m = M*(M-1) / 2
print(int(n+m))

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())
def col(x):
    if x == 0:
        return(0)
    else:
        return((x * (x - 1)) // 2)
print(col(n) + col(m))

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

a = 0
n,m = map(int,input().split())
if n>=2:
    a += combinations_count(n,2)
if m>=2:
    a += combinations_count(m,2)
print(a)

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

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

Solution (Python):
N, M = map(int, input().split())
arr_n = [(i+1) * 2 for i in range(N)]
arr_m = [i+1 for i in range(0, M*2, 2)]

count = 0
for i in range(len(arr_n)):
    count += len(arr_n[i + 1:])
for j in range(len(arr_m)):
    count += len(arr_m[j + 1:])

print(count)

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

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

Solution (Python):
import itertools

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

cnt = 0
for v in itertools.combinations(a+b, 2):
    
    if (v[0]+v[1]) % 2 == 0:
        cnt += 1
print(cnt)

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

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


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

Solution (Python):
import math

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

def f(a):
    if a > 1:
        return int(math.factorial(a) / math.factorial(a-2) / 2)
    else:
        return 0

print(f(N) + f(M))

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

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

print(int(A))

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

print(int(A))

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

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

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

Solution (Python):
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0

def main():
    args = input().rstrip().split(' ')
    N, M = int(args[0]), int(args[1])
    print(comb(N) + comb(M))
    
if __name__ == "__main__":
    main()

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

Solution (Python):
N,M=map(int,input().split())
if min(M,N)<=1:
  K=max(M,N)
  print(int(K*(K-1)/2))
else:
  print(int(M*(M-1)/2+N*(N-1)/2))

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

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

Solution (Python):
n,m=map(int,input().split())
def a(n):
    if n<2: return n
    return n+a(n-1)
sum_=0
if n>1:
    sum_+=a(n-1)
if m>1:
    sum_+=a(m-1)
print(sum_)

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):
even, odd = map(int,input().split())
print((even*~-even // 2) + (odd*~-odd // 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())
t =0
if N>=2:
	t+=N*(N-1)//2
if M>=2:
    t+=M*(M-1)//2
print(t)

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

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int, read().split())
x = M * (M - 1) // 2
x += N * (N - 1) // 2
print(x)

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int, readline().split())
x = M * (M - 1) // 2
x += N * (N - 1) // 2
print(x)

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
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())
print(n*(n-1) // 2 + m*(m-1) // 2)

Solution (Python):
import math 
N,M=map(int,input().split())
def combination(n,r):
    if n<2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n=combination(N,2)
m=combination(M,2)
print(n+m)

Solution (Python):

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

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

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

print(math.floor(n * (n - 1) / 2) + math.floor(m * (m - 1)/2))

Solution (Python):
lin = input().split()
n = int(lin[0])
m = int(lin[1])
np = 0
if n >= 2:
  np = int(n * (n-1) / 2)
op = 0
if m >= 2:
  op = int(m * (m-1) / 2)
print(np+op)

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

print(a+b)

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

ans = 0

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

Solution (Python):
from math import factorial

inputted = list(map(int, input().split()))
N = inputted[0]
M = inputted[1]

nPk = lambda n, k: 0 if n - k < 0 else factorial(n) / (factorial(k) * factorial(n - k))

answer = nPk(N, 2) +  nPk(M, 2)
answer = int(answer)

print(answer)

Solution (Python):



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


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


print(result)

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):
num=input().rstrip().split(" ")
num0=int(num[0])
num1=int(num[1])
print(int(num0*(num0-1)/2+num1*(num1-1)/2))

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

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


print('%d' % i)

Solution (Python):
N,M = map(int,input().split())
s = t = 0
for i in range(N):
    s += i
for i in range(M):
    t += i
print(s+t)

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



def in_int():
    return (int(input()))


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


def in_str():
    s = input()
    return (list(s[:len(s) - 1]))


def in_ints():
    return (map(int, input().split()))


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

Solution (Python):
x = input()
s = int(x.split()[0])
t = int(x.split()[1])

s_num = s * (s-1) / (1 * 2)
t_num = t * (t-1) / (1 * 2)
sum = int(s_num + t_num)

print(sum)

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

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

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

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

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

p = 7+pow(10,9)
def cmb(n,r,p):
    numerator = 1
    for i in range(n-r+1, n+1):
        numerator = numerator * i % p
    denominator = 1
    for i in range(1, r+1):
        denominator = denominator * i % p
    return numerator * pow(denominator, p-2, p) % p

print(cmb(n, 2, p)+ cmb(m,2,p))

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
for i in range(1, n):
  ans += i

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

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

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

Solution (Python):

def main():
    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))

main()

Solution (Python):
import math


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

li = list(map(int, input().split()))
n = li[0]
m = li[1]

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

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]=[int(item) for item in input().split()]

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

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

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

Solution (Python):
N, M = map(int, input().split())
a = range(1, N, 1)
b = range(1, M, 1)
print(sum(a) + sum(b))

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

print(int(c))

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

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

Solution (Python):
even,odd= map(int,input().split())

n = 0
m = 0

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

for _ in range(1,odd):
  m += (odd -_)
  
print(m+n)

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

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

Solution (Python):


import math

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

a = 0

if N>1:
  a+= math.factorial(N)/math.factorial(N-2)/2

if M>1:
  a+= math.factorial(M)/math.factorial(M-2)/2

print(int(a))

Solution (Python):
def main():
    even, odd = map(int, input().split())
    cases = 0
    if even >= 2:
        cases += 1
        for i in range(3, even + 1):
            cases = cases - 1 + i
    if odd >= 2:
        cases += 1
        for i in range(3, odd + 1):
            cases = cases - 1 + i

    print(cases)


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

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

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


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

def kaijyou(k):
  N=1
  for i in range(k,0,-1):
    N*=i
  return N

def combinations(n,r):
  return int(kaijyou(n)/(kaijyou(r)*kaijyou(n-r)))

A=combinations(N,2)+combinations(M,2)
print(A)

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

ans = a*(a-1)//2+b*(b-1)//2
print(ans)

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

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

odd = N*M
tama = N + M

import itertools
c = list(itertools.combinations(range(tama),2))

ans = len(c) - odd
print(ans)

Solution (Python):
from math import factorial as f
n,m=map(int,input().split())
comb_n=f(n)//(f(2)*f(n-2)) if n>1 else 0
comb_m=f(m)//(f(2)*f(m-2)) if m>1 else 0
print(comb_n+comb_m)

Solution (Python):
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(int(count))

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

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

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

if not (N <= 1):
    a = comb(N,2)
else:
    a = 0
if not (M <= 1):
    b = comb(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):
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=map(int,input().split())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n>=2:print(cmb(n,2))
elif m>=2:print(cmb(m,2))
else:print(0)

Solution (Python):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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

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


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):
x = input().split()
n = int(x[0])
m = int(x[1])
if n == 0:
  print(int(m * (m -1) /2))
elif m == 0:
  print(int(n * (n - 1) / 2))
else:
  k = m * (m -1) /2 + n * (n - 1) / 2
  print(int(k))

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

Solution (Python):



import math

def comb_cnt(n):
    if n >= 2 : 
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
    else : 
        return 0

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

print(comb_cnt(n) + comb_cnt(m))

Solution (Python):



from sys import stdin, stdout

n, m = map(int, stdin.readline().split())
ways = (n * (n - 1) + m * (m - 1)) // 2
stdout.write("%d\n" % ways)

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

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

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

def com(x):
    return int(x * (x - 1) / 2)

result = com(N) + com(M)
print(result)

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

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

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

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

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

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

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

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

Solution (Python):
N,M=map(int,input().split())
print(N*~-N//2+M*~-M//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):
import numpy as np
from itertools import combinations as c
a,b=map(int, input().split())
a=[2*i for i in np.array(range(a))+1]
b=[i*2-1 for i in np.array(range(b))+1]
r=len(list(filter(lambda x:not x&1,np.sum(list(c(a+b, 2)),1)))) 
print(r)

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

sum_n = 0

for i in range(N):
	sum_n = sum_n + i

for i in range(M):
	sum_n = sum_n + i

print(sum_n)

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

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

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

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

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

Solution (Python):
firstInput=list(map(int,input().split()))
even=firstInput[0]
odd=firstInput[1]
evenSum=0
oddSum=0
if even>=2:
  nFactorial=1
  nMinusKFactorial=1
  for i in range(1,even+1): nFactorial*=i
  for i in range(1,even-1): nMinusKFactorial*=i
  evenSum=nFactorial/(2*nMinusKFactorial)
if odd>=2:
  nFactorial=1
  nMinusKFactorial=1
  for i in range(1,odd+1): nFactorial*=i
  for i in range(1,odd-1): nMinusKFactorial*=i
  oddSum=nFactorial/(2*nMinusKFactorial)
print(int(evenSum+oddSum))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
  
N, M = MAP()

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

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):
    if n == 2:
        return 1
    elif n == 1:
        return 0
    elif n > 0:
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
    else:
        return 0

print(comb(N)+comb(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().strip().split())
ans=n*(n-1)//2+m*(m-1)//2
print(ans)

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

Solution (Python):

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

total_choice = 0

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

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

print(int(total_choice))

Solution (Python):



from math import factorial

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

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

combination_count_in_N = combinations_count(N, 2) if N >= 2 else 0
combination_count_in_M = combinations_count(M, 2) if M >= 2 else 0

print(combination_count_in_N + combination_count_in_M)

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

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

Solution (Python):

x = input()
N = int(x[:x.index(" ")])
M = int(x[x.index(" ")+1:])
def factorial(number):
	if number>2:
		return number*factorial(number-1)
	elif not number==0:
		return number
	else:
		return 1
def choose2(number):
	if number>=2:
		return factorial(number)/(2*factorial(number-2))
	else:
		return 0

print(int(choose2(N)+choose2(M)))

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

Solution (Python):
import numpy as np



first_input = list(map(lambda x:int(x), input().split(" ")))









N = first_input[0]
M = first_input[1]

num_list = [0]*N+[1]*M

gusu_count = 0
for i in range(len(num_list)):
    for j in range(i+1,len(num_list)):
        if num_list[i]==num_list[j]:
            gusu_count = gusu_count+1

print(gusu_count)

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

Solution (Python):
X,Y = map(int,input().split())

print(int(X*(X-1)/2 + Y*(Y-1)/2))

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

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

print(int(ans))

Solution (Python):
import math
n, m = map(int,input().split())
def a(n, l):
    return math.factorial(n) // ((math.factorial(n - l) * math.factorial(l)))
if n and m >1:
    print(a(n, 2)+a(m, 2))
elif n > 1:
    print(a(n, 2))
elif m > 1:
    print(a(m, 2))
else:
    print(0)

Solution (Python):

"""
Created on Thu Mar 19 11:55:12 2020

@author: 17664
"""
even, odd = map(int, input().split())

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

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

Solution (Python):

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