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=list(map(int,input().split()))
print(int((n**2+m**2-n-m)/2))

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

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

x = math.factorial(int(N))
y = math.factorial(int(M))

if N > 2 and M > 2:
    Nk = N - 2
    Mk = M - 2
    Nk2 = math.factorial(int(Nk))
    Mk2 = math.factorial(int(Mk))
    CN = x // Nk2 // 2
    CM = y // Mk2 // 2
    print(CN + CM)

elif N > 2 and M <= 2:
    Nk = N - 2
    Nk2 = math.factorial(int(Nk))
    CN = x // Nk2 // 2
    M = M // 2
    print(CN + M)

elif N <= 2 and M > 2:
    Mk = M - 2
    Mk2 = math.factorial(int(Mk))
    CM = y // Mk2 // 2
    N = N // 2
    print(CM + N)

elif N <= 2 and M <= 2:
    N = N // 2
    M = M // 2
    print(N + M)

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

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

Solution (Python):
import sys
from math import factorial

def comb(n,r):
    a = factorial(n) / factorial(r) / factorial(n - r)
    return int(a)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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

a = comb(N, 2) if N>=2 else 0
b = comb(M, 2) if M >=2 else 0
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())

su = combinations_count(n+m, 2)
mm = n*m
ans = su-mm

print(str(ans))

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

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 itertools
a=list(itertools.combinations(range(1,n+1),2))
b=list(itertools.combinations(range(1,m+1),2))
print(len(a)+len(b))

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

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

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

pick_up_from_n = n * (n - 1) // 2
pick_up_from_m = m * (m - 1) // 2

print(pick_up_from_m + pick_up_from_n)

Solution (Python):
val = input().split()

N = int(val[0])
M = int(val[1])

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 sys

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

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

odd = nC2(m)
even = nC2(n)

print(int(odd + even))

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

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

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

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

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

n = N * (N-1) // 2
m = M * (M-1) // 2

print(n + m)

Solution (Python):
N,M=list(map(int,input().split()))
from math import factorial as f
f_1,f_2=0,0
if N>1:
    f_1=f(N)/(f(2)*f(N-2))
if M>1:
    f_2=f(M)/(f(2)*f(M-2))
print(int(f_1+f_2))

Solution (Python):

"""
Created on Wed May  6 16:43:05 2020

@author: shinba
"""
N,M = map(int,input().split())

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

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

Solution (Python):


import math

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

cnt = 0
for n in range(1, N):
    cnt += n
for n in range(1, M):
    cnt += n

print(cnt)

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

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

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

if a > 0:
  a = a * (a - 1) // 2
  
if b > 0:
  b = b * (b - 1) // 2
print(a + b)

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

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

Solution (Python):
a=input().split()
N=int(a[0])
M=int(a[1])
def sum(i):
    if i==1 or i==0:
        return 0
    else:
        return i*(i-1)/2

print(int(sum(N)+sum(M)))

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

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

Solution (Python):
e,o = map(int,input().split())
cte = (e*(e-1))//2
cto = (o*(o-1))//2
print(cte+cto)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, m = MI()

    def choose2(a):
        return a * (a-1) // 2

    print(choose2(n+m) - n * m)


if __name__ == '__main__':
    solve()

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  
def Is(): return map(int, input().split())  
def LI(): return list(map(int, input().split()))  
def TI(): return tuple(map(int, input().split()))  
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  
def LS(): return list(input())  
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

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

Solution (Python):
import math

def ncr(n,r):
    if r> n: return 0;
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))

def solve(n,m):
    print(ncr(n,2)+ ncr(m,2))

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

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




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

Solution (Python):
N,M=input().split()
from math import factorial 
if int(N)>=2 and int(M)>=2:
    print('{:.0f}'.format(factorial(int(N))/2/factorial(int(N)-2)+factorial(int(M))/2/factorial(int(M)-2)))
elif int(N)<2 and int(M)>=2:
     print('{:.0f}'.format(factorial(int(M))/2/factorial(int(M)-2)))
elif int(M)<2 and int(N)>=2:
     print('{:.0f}'.format(factorial(int(N))/2/factorial(int(N)-2)))
else:
    print("0")

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

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

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

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

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

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

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

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



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


Even = n * (n-1)/2


Odd = m * (m-1)/2


print(int(Even + Odd))

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

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

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

print(ans)

Solution (Python):
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

n,m = readInts()

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

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

Solution (Python):
def Even(x):
  return  2 * x

def Odd(x):
  return 2 * x - 1

N, M = map(int, input().split())
G = list(map(Even, range(1, N+1)))
K = list(map(Odd, range(1, M+1)))

even=list()

for n in range(0, N):
  for nm in range(n+1, N):
    even.append(G[n]+G[nm])
  
for m in range(0, M):
  for mm in range(m+1, M):
    even.append(K[m]+K[mm])

print(len(even))

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

Solution (Python):
import itertools

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

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

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

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

Solution (Python):

import sys


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



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))  
    print(solve(N, M))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

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

Solution (Python):


import math

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

cnt = 0
for n in range(1, N):
    cnt += n
for n in range(1, M):
    cnt += n

print(cnt)

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):
import math
n,m=map(int,input().split())
if n>1 or m>1:
    N=n*(n-1)/2
    M=m*(m-1)/2
    print(math.floor(N+M))
else:
    print(0)

Solution (Python):

"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""


"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""



"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""


"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""

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

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

Solution (Python):


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


odd_odd = M * (M - 1) / 2


even_even = N * (N - 1) / 2

print(int(even_even + odd_odd))

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


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


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6) 
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right

from collections import deque 



from collections import Counter

from itertools import accumulate

from heapq import heapify,heappop,heappush


def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds





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




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

ans=0
if N>1:
    ans+=comb(N,2)
if M>1:
    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):
N,M = map(int, input().split())
Con_N=N*(N-1)//2
Con_M=M*(M-1)//2
print(Con_N+Con_M)

Solution (Python):
from collections import defaultdict,deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

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

Solution (Python):
class abc_159:
    
    def __init__(self):
        pass
    
    def A(self):
        NM=list(map(int,input().split()))
        print(int((NM[0]*(NM[0]-1))/2 + (NM[1]*(NM[1]-1))/2))
    
    def B(self):
       pass
    
    def C(self):
        pass
        
    def D(self):
        pass
    
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_159()
    obj.A()

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

num=0
num+=A*(A-1)//2
num+=B*(B-1)//2
print(num)

Solution (Python):
import math

N, M = map(int, input().split())
     
summa=0
if N>1:
   summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
   summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
      
print(int(summa))

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

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

Solution (Python):
import sys



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






ansN = 0
ansM = 0
if N <= 1:
    ansN = 0
for i in range(1,N):
    ansN += i
if M <= 1:
    ansM = 0
for i in range(1,M):    
    ansM += i
print(ansN+ansM)

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

ans = 0

if N >= 2:
    ans += combinations_count(N, 2)

if M >= 2:
    ans += combinations_count(M, 2)

print(ans)

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

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

e_e = N * (N - 1) / 2
o_o = M * (M - 1) / 2

print(int(e_e + o_o))

Solution (Python):
n,m = map(int, input().split())
ans = 0
for i in range(n):
    ans += i
for j in range(m):
    ans += j
print(ans)

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, M = read_ints()
    return M*(M-1)//2+N*(N-1)//2


if __name__ == '__main__':
    print(solve())

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

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

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

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

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

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

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

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

N,M = (int(x) for x in input().split())



sum = math.factorial(N + M) // (math.factorial(N + M - 2) * math.factorial(2))


print(sum - N * M)

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

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

from math import factorial
def comb2(n):
    return factorial(n)//(2*factorial(n-2))
if n>=2 and m>=2:
    print(comb2(n)+comb2(m))
elif n>=2 and m<2:
    print(comb2(n))
elif n<2 and m>=2:
    print(comb2(m))
else:
    print(0)

Solution (Python):

n,m = map(int,input().split())
c = 1
d = 1
for i in range(1,n):
    c += i

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

print("0" if n==1 and m==1 else c+d-2)

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

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

Solution (Python):

import sys

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

sum = 0

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

print(int(sum))

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())
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if N == 0:
  ans = combinations_count(M, 2)
elif M == 0:
  ans = combinations_count(N, 2)
elif N == 1 and M == 1:
  ans = 0
elif N == 1:
  ans = combinations_count(M, 2)
elif M == 1:
  ans = combinations_count(N, 2)
else:
  ans = combinations_count(N, 2) + combinations_count(M, 2)
print(ans)

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

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

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

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

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

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

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

Solution (Python):
n,m = map(int,input().split())
print(((n-1)*n + (m-1)*m)//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 = (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):
i = list(map(int, input().split()))
n = i[0]
m = i[1]

ans_n = 0
ans_m = 0
if(n == 0):
    ans_n = 0
else:
    ans_n = n*(n-1)//2
if(m == 0):
    ans_m = 0
else:
    ans_m = m*(m-1)//2

print(ans_n + ans_m)

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

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

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

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):
num_list = [int(i) for i in input().split()]
sum = 0
for i in num_list:
  if i > 1:
    sum += i*(i-1)/2

print(int(sum))

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())
def comb(x):
    return int(x*(x-1)/2)
print(comb(N)+comb(M))

Solution (Python):
import math

N,M = 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))

n = combinations_count(N, 2)
m = combinations_count(M, 2)

print(n+m)

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

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

print(combi(N)+combi(M))

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

Solution (Python):
n,m=map(int,input().split())
def nck(x,y):
	res=1
	for i in range(0,y):
		res*=(x-i)/(i+1)
	return int(res)
a=nck(n,2)
b=nck(m,2)
print(a+b)

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

print(((N+M)*(N+M-1)-2*N*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 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):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1 or N[1]==0:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1 or N[0]==0:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)

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

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

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

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

if n <= 1 and m >= 2:
    print(combinations_count(m, 2))
    sys.exit()
elif n >= 2 and m <= 1:
    print(combinations_count(n, 2))
    sys.exit()
elif n == m == 1:
    print(0)
    sys.exit()
elif n == m == 0:
    print(0)
    sys.exit()
else:
    print(combinations_count(n, 2) + combinations_count(m, 2))

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

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

if __name__ == '__main__':
    main()

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

Solution (Python):
import math
def fact(x):
  return math.factorial(x)
n, m = map(int, input().split())
ans_n = (fact(n) // (fact(n - 2) * 2)) if n > 1 else 0
ans_m = (fact(m) // (fact(m - 2) * 2)) if m > 1 else 0
print(ans_n + ans_m)

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

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

if b < 2:
    kisu = 0
else:
    kisu = b*(b-1)//2
print( gusu + kisu)

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

ki = n[0]*(n[0]-1) / 2
gu = n[1]*(n[1]-1) / 2

print(int(ki + gu))

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

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

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

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

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

Solution (Python):
from math import factorial


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

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

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

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

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

Solution (Python):
import sys
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())

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

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

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

ans=0

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

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

print(ans)

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


def comb(a):
    return int(a*(a-1)/2)

print(comb(N)+comb(M))

Solution (Python):

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

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

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

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

Solution (Python):
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=math.floor,math.ceil
from collections import deque
Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO')
is_even=lambda x:True if x%2==0 else False
s = lambda x: int(0.5*x*(x-1))

def main():
  n,m=ints()
  print(s(n)+s(m))

if __name__ == '__main__':
  main()

Solution (Python):
import  math
def C(n,r):
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
n,m=input().split()

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

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

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

c = 0
c += (N*(N-1))/2
c += (M*(M-1))/2

print(int(c))

Solution (Python):
m, n = map(int, input().split())
result = 0
if m > 1:
    for i in range(1,int(m)):
        result += i
if n > 1:
    for i in range(1,int(n)):
        result += i


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

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

print(ans)

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

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

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

n_sum = n * (n-1) //2
m_sum = m * (m-1) //2
print(n_sum + m_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):
from math import factorial

inputnum = input().split()
N = int(inputnum[0])
M = int(inputnum[1])
ans = 0
if N >= 2:
  ans+= factorial(N) / factorial(2) / factorial(N - 2)
  
if M >= 2:
  ans += factorial(M) / factorial(2) / factorial(M - 2)
  
print(int(ans))

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

num1 = math.factorial(N) // (math.factorial(N - 2) * math.factorial(2)) if N >= 2 else 0
num2 = math.factorial(M) // (math.factorial(M - 2) * math.factorial(2)) if M >= 2 else 0

print(num1 + num2)

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