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((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):
def main():
    import sys
    input = sys.stdin.readline

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

Solution (Python):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

print(ans)

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

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

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

print(int(res))

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

a1=int(n*(n-1)/2)
a2=int(m*(m-1)/2)

ans=a1+a2

print(ans)

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

import sys


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



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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys

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

Solution (Python):
def nCk(n, k, m=10**9+7):
    a = b = 1
    for i in range(k):
        a = (a * (n-i)) % m
        b = (b * (i+1)) % m
    return (a * pow(b, m-2, m)) % m

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

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


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

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

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

print(n+m)

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

Solution (Python):
import math
def P(n, r):
    return math.factorial(n)//math.factorial(n-r)
def C(n, r):
    return P(n, r)//math.factorial(r)
N, M = map(int, input().split())
if N > 1:
    ans1 = C(N,2)
else:
    ans1 = 0
if M > 1:
    ans2 = C(M,2)
else:
    ans2 = 0
print(ans1+ans2)

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

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

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

N,M = map(int,input().split())
a = 0
b = 0
if N <= 1:
    a = 0
else:
    a = combination(N,2)
if M <= 1:
    b = 0
else:
    b =  combination(M,2)
print(a+b)

Solution (Python):
N,M = map(int,input().split())
print(max(N*(N-1)//2,0)+max(M*(M-1)//2,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]=[int(i) for i in input().split()]
x=N*(N-1)/2
y=M*(M-1)/2
z=x+y
print(int(z))

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

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

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

ans = 0

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

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

print(ans)

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

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

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

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

Solution (Python):



def solve(*args: str) -> str:
    n, m = map(int, args[0].split())
    return str((n*(n-1)//2) + (m*(m-1)//2))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

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

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

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):
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    n, m = list(map(int, input().strip().split()))
    print(n * max(0, n-1) // 2 + m * max(0, 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 = [int(x) for x in 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 = 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())

even_even = int(M*(M-1)/2)
odd_odd = int(N*(N-1)/2)

print(even_even+odd_odd)

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

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

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



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

n,m = input_multiple_number()

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

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

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

if __name__ == "__main__":
    main()

Solution (Python):
import sys
def main():
    n,m = [int(j) for j in sys.stdin.readline().split()]
    ans = (n+m)*(n+m-1)//2-n*m
    sys.stdout.write(str(ans))
    sys.stdout.write("\n")
    
main()

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

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

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

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




print(ans)

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

Solution (Python):

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

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

print(ret)

Solution (Python):

def getIntList(inp):
	return [int(_) for _ in inp]


from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs



def main(inputs):
	n,m=getIntList(inputs[0])
	
	ans=n*(n-1)//2+m*(m-1)//2
	print(ans)
	
	

if __name__=="__main__":
	inputs=getInputs()

	main(inputs)

Solution (Python):
import sys
import itertools
import bisect
from operator import itemgetter
 
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
def combi(n, r):
  r = min(r, n-r)
  numer = denom = 1
  for i in range(1, r+1):
    numer = numer * (n+1-i) %mod
    denom = denom * i %mod
  return numer * pow(denom, mod-2, mod) %mod

N,M = IL()

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

Solution (Python):
import sys

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

def main():
	N,M = MI()
	print(int((N+M)*(N+M-1)/2 - N*M))

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

print(ans)

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


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

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

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

mC2 = m * (m - 1) * 0.5
nC2 = n * (n - 1) * 0.5

print(int(mC2 + nC2))

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

Solution (Python):
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class v:
    def __init__(self, f):
        self.f = f
        self.v = None
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n) 


def main():
    N, M = read_values()
    print((N + M) * (N + M - 1) // 2 - N * M)


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

Solution (Python):
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, M = read_int()

def solve():
    ans = 0
    return N * (N - 1) // 2 + M * (M - 1) // 2

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

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

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

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

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

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

Solution (Python):
N_even, M_odd = map(int, input().split())

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

print(ans)

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

Solution (Python):
import sys
import math
import bisect

def solve(n, m):
    A = [0] * n + [1] * m
    ans = 0
    for i in range(len(A)):
        for j in range(i + 1, len(A)):
            if (A[i] + A[j]) % 2 == 0:
                ans += 1
    return ans

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

if __name__ == "__main__":
    main()

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

Solution (Python):
import itertools

def solve():
  n, m = map(int, input().split())
  a = len(list(itertools.combinations(range(n), 2)))
  b = len(list(itertools.combinations(range(m), 2)))
  print(a + b)
  return 0

if __name__ == "__main__":
  solve()

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

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

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

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

Solution (Python):
N,M = map(int, input().split())
print((M*(M-1)+N*(N-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, acos, atan, asin
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 STR(): return input()
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 = sys.maxsize
mod = 10 ** 9 + 7

def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod

N = 1000  
mod = pow(10, 9) + 7
fact = [1, 1]  
factinv = [1, 1]  
inv = [0, 1]  

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)

n, m = MAP()
ans = cmb(n, 2) + cmb(m, 2)
print(ans)

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




'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''




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):
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res


n,m=l_in()

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

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

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

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    N, M = MI()
    n = [2] * N
    m = [1] * M
    arr = n + m
    ans = 0

    for pair in list(itertools.combinations(arr, 2)):
        if (pair[0] + pair[1]) % 2 == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))


def conb(n,r): 
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
a,b = inpl()
res = 0
if a > 1:
    res += conb(a,2)
if b > 1:
    res += conb(b,2)
print(res)

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

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

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

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

even = nCr(n, 2)
odd = nCr(m, 2)
print(even + odd)

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

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

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

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

print(o)

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

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

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

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


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

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

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

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

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

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

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

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

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

print(ans)

Solution (Python):

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

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

Solution (Python):


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

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

Solution (Python):
import sys


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

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):

import math

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





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


t = 0
if N >= 2:
    t += C(N, 2)
if M >= 2:
    t += C(M, 2)
ans = t
print(ans)

Solution (Python):


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

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

Solution (Python):

from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    a,b = mi()
    if a == 0:
        a = 1
    if b == 0:
        b = 1
    print((a*(a-1)//2)+(b*(b-1)//2))






main()

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

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

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

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

n,m = map(int,inp)

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

print(ans)

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

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

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

print(answer)

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

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

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

Solution (Python):
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    N, M = get_inputs(int)

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




if __name__ == '__main__':
    main()

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

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

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

print(ans)

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

s = 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):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
fac = [-1] * (10**7+1)
inv = [-1] * (10**7+1)
finv = [-1] * (10**7+1)

fac[0] = fac[1] = 1
inv[1] = 1
finv[0] = finv[1] = 1

def initNCMMod(limit):
    for i in range(2, limit):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod

def NCMMod(n, k):
    if n < k:
        return 0
    if (n < 0 or k < 0):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod
initNCMMod(1000)
def main():
    N, M = LI()
    print(NCMMod(N, 2) + NCMMod(M, 2))


main()

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

Solution (Python):



from math import *
from copy import *
from string import *				
from random import *				
from bisect import *				
from sys import stdin				
from sys import maxsize
from operator import *				
from itertools import *
from collections import Counter		
from collections import defaultdict 

'''
2 1
'''

def solve(l):
	n = len(l)
	

N,M = list(map(int, stdin.readline().rstrip().split()))
ans = 0
if(N >= 2):
	ans += N*(N-1)//2
if(M >= 2):
	ans += M*(M-1)//2
print(ans)

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

def solve(n):
    if n ==1:
        return 0
    return n*(n-1)//2

print(solve(a)+ solve(b))