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

if __name__ == '__main__':
    main()

Solution (Python):
import math
N,M=map(int,input().split())
def C(x):
    if x>=2:
        return math.factorial(x)//(math.factorial(x-2)*2)
    else:
        return 0
print(C(N)+C(M))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter





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

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

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

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

Solution (Python):

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

print(int((x * (x-1)) / 2  + (y * (y - 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):
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())

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

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

Solution (Python):
inp=input().split()
n=int(inp[0])
m=int(inp[1])
arr=[]
pares=0
impares=0
count=1
nums=0

def binary(arr, menor, mayor, x): 
    if mayor >= menor: 
        med = (mayor + menor) // 2
        if arr[med] == x: 
            return med 

        elif arr[med] > x: 
            return binary(arr, menor, med - 1, x) 
  
        else: 
            return binary(arr, med + 1, mayor, x) 
    else: 
        return -1

while len(arr)<(m+n):
    if count%2==0 and pares<n:
        arr.append(count)
        pares+=1
    elif count%2!=0 and impares<m:
        arr.append(count)
        impares+=1
    count+=1
sums=[]


for x in arr:
   for y in arr:
        if(x+y)%2==0 and binary(sums, 0, len(sums)-1, [y,x])==-1 and x!=y:
            sums.append([x,y])
            nums+=1
print(nums)

Solution (Python):
a=input("")
lista=a.split()
lista2=[]
par=0
impar=-1
contador=0
for i in range (int(lista[0])):
  par+=2
  lista2.append(par)
for i in range (int(lista[1])):
  impar+=2
  lista2.append(impar)
longitud=len(lista2)-1

for i in range (0,len(lista2)):
  b=i
  while True:
    if b+1>longitud:
      break 
    else: 
      suma=lista2[i]+lista2[b+1]
      b=b+1
      if suma%2==0:
        contador+=1
      
print(contador)

Solution (Python):
a = list(map(int, input().rstrip().split()))
out=0
for i in a:
    if i > 1:
        out += i*(i-1)//2
print(out)

Solution (Python):
import numpy as np

a = list(map(int, input().rstrip().split()))
out=0
for i in a:
    if i > 1:
        out += i*(i-1)//2
print(out)

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

n,m=map(int,input().split())
if (n<=1) and (m<=1):
  ans=0
else:
  if n<=1:
    ans=comb(m,2)
  elif m<=1:
    ans=comb(n,2)
  else:
    ans=comb(n,2)+comb(m,2)
  
print(ans)

Solution (Python):
import itertools
n,m=map(int,input().split())
i = [2]*n
j = [2]*m
p = list(itertools.combinations(i, 2))
q = list(itertools.combinations(j, 2))
print(len(p)+len(q))

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

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


print(ans)

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

Solution (Python):
from math import floor
n,m = map(int,input().split())
a =(n*(n-1))/2
b =(m*(m-1))/2
print(floor(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())

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

print(int(sum))

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

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

Solution (Python):
from scipy.special import comb
N,M = input().split()
N = int(N)
M = int(M)

A = 0
B = 0
if N >= 2 :
  A = comb(N, 2, exact=True)

if M >= 2 :
  B = comb(M, 2, exact=True)
 
print(A + B)

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

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

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

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

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

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

print(int(even+odd))

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

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

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

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

print(ans)

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


main()

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


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

Solution (Python):
import math

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

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

Solution (Python):

import sys


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



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

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

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

print(int(cnt))

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

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

print(int(c))

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

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

ki = (N*(N-1))//2
gu = (M*(M-1))//2

print (ki+gu)

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

Solution (Python):
import math

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

def c(a, b):
    if a >= 2:
        return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))
    else:
        return 0
        

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

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

    e = N*(N-1)/2
    o = M*(M-1)/2

    ans = int(e + o)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import math

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

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

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

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

even = n * (n-1) / 2
odd = m * (m-1) / 2

print(int(even+odd))

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

kotae = int(N * (N - 1) / 2)
kotae2 = int(M  * (M - 1) / 2)

print(kotae + kotae2)

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())
al=math.factorial(N+M)/(math.factorial(2)*math.factorial(N+M-2))
di=N*M
print(int(al)-int(di))

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

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

Solution (Python):
import math
n, m = input().split()
n = int(n)
m = int(m)
x = 0
y = 0
if n > 1:
  x = int(math.factorial(n)/(2 * math.factorial(n-2)))
if m > 1:
  y = int(math.factorial(m)/(2 * math.factorial(m-2)))

print(x+y)

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

ans = 0

n1 = n*(n-1)/2

n2 = m*(m-1)/2

ans = int(n1 + n2)

print(ans)

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

Solution (Python):

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

if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
from scipy.special import comb

N, M = map(int, input().split())
ans = comb(N + M, 2, exact=True) - (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):
ri = lambda S: [int(v) for v in S.split()]
N, M = ri(input())

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

print(int(c))

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

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


a = comb(n, 2)
b = comb(m, 2)
print(a+b)

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

Solution (Python):
import itertools
n,m = map(int, input().split())
ball = [2*i for i in range(1,n+1)] + [(2*j)-1 for j in range(1,m+1)]

cnt = 0

for c in itertools.combinations(ball,2):
    cnt += sum(c)%2 == 0

print(cnt)

Solution (Python):

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

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

if n == 1 or n == 0 :
  n_c = 0
else :
  n_c = n * (n-1) / 2
if m == 1 or m == 0 :
  m_c = 0
else :
  m_c = m * (m-1) / 2

print(int(n_c + m_c))

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

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

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

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

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())
eve=[2*i for i in range(N)]
odd=[2*i+1 for i in range(M)]

from itertools import combinations
comb_eve=len(list(combinations(eve,2)))
comb_odd=len(list(combinations(odd,2)))

print(comb_eve+comb_odd)

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

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    def select(n,k):
        return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))
    n,m = LI()
    ans = 0
    if n>=2:
        ans += n*(n-1)//2
    if m>=2:
        ans += m*(m-1)//2

    print(ans)
main()

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

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

Solution (Python):
import math


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


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

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

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

Solution (Python):
n,m=map(int,input().split())
ans=int((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):
import math
def count(n, r):
    return math.factorial(n) // math.factorial(n - r)
def main():
  N, M = map(int, input().split())
  if (N == 0 and M == 0) or (N == 1 and M == 1):
    ans = 0
  elif N == 0 or N == 1:
    y = count(M, 2)
    ans = y
  elif M == 0 or M == 1:
    x = count(N, 2)
    ans = x
  else:
    x = count(N, 2)
    y = count(M, 2)
    ans = x + y
  print(int(ans/2))

main()

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

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

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

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

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

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

Solution (Python):
def kai(n):
    a=1
    for i in range(1,n+1):
        a=a*i
    return a

N,M=map(int,input().split())
if N==0 or N==1:
    g=0
else:
    g=kai(N)/(kai(N-2)*2)
if M==0 or M==1:
    k=0
else:
    k=kai(M)/(kai(M-2)*2)
print(int(g+k))

Solution (Python):
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

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

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

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

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

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

print(n+m)

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

Solution (Python):
from scipy.special 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())
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())
if (n < 2):
  a = 0
else:
  a = int(n*(n - 1)/2)
if (m < 2):
  b = 0
else:
  b = int(m*(m - 1)/2)
print(a + b)

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

Solution (Python):
from scipy.special import comb

N,M=map(int,input().split())
base=0
base += comb(N, 2, exact=True)
base += comb(M, 2, exact=True)
print(base)

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

if '__main__' == __name__:
    resolve()

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

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

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N, M = MI()

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

print(a + b)

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

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

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

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

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

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

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

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

ans1 = (n*(n-1))//2
ans2 = (m*(m-1))//2

print(ans1+ans2)

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

from operator import mul
from functools import reduce

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


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

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) and (b != 0):
    print(str(int(a*(a-1)/2 + b*(b-1)/2)))
elif (a == 0) and (b == 0):
    print("0")      
elif (a == 0) and (b != 0):
    print(str(int(b*(b-1)/2)))
else:
    print(str(int(a*(a-1)/2)))

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

Solution (Python):
if __name__ == '__main__':

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

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

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

Solution (Python):

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

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

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

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

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

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

print(f(n) + f(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())
x = 0
y = 0
if n >= 2:
    x = math.factorial(n) // ((math.factorial(n-2))*2)
elif n <= 1:
    x = 0
if m >= 2:
    y = math.factorial(m) // ((math.factorial(m-2))*2)
elif m <= 1:
    y = 0
print(x + y)

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

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

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

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


if __name__ == "__main__":
    main()

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

Solution (Python):
N, M = map(int, input().split())
totalN = 1/2*(N-1)*N
totalM = 1/2*(M-1)*M
import math

print(math.floor(totalN + totalM))

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

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

print(ans)

Solution (Python):


import math
n, m = map(int, input().split())
if n < 2:
    x = 0
else:
    x = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))

if m < 2:
    y = 0
else:
    y = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))

print(x+y)

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

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

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

Solution (Python):

import sys
input = lambda: sys.stdin.readline().strip()
n, m = [int(x) for x in input().split()]
def c2(n):
    return n * (n - 1) // 2
print(c2(n) + c2(m))

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

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

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())
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))+(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):
import math
n, m = [int(i) for i in input().split()]
t = 0
tt = 0
def com(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if n > 1:
    t = com(n,2)
if m > 1:
    tt = com(m,2)

print(t+tt)

Solution (Python):
N, M = map(int, input().split())
l = ['e'] * N + ['o'] * M
cnt = 0
for i in range(len(l)-1):
    for j in range(i+1, len(l)):
        if l[i] != l[j]:
            pass
        else:
            cnt += 1
print(cnt)

Solution (Python):

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

def combinations_count(N, M):
    return (math.factorial(N + M) // (math.factorial(N + M - 2) * math.factorial(2)))

ans = combinations_count(N, M) - N * M
print(ans)

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

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

if __name__ == "__main__":
    solve()

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

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

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

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

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

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

Solution (Python):
score = list(map(int,input().split()))
if score[0] == 1:
    evennum = 0
else:
    evennum = score[0]*(score[0]-1)/2
if score[1] == 1:
    oddnum = 0
else:
    oddnum = score[1]*(score[1]-1)/2
print(int(evennum+oddnum))

Solution (Python):
from scipy.special import comb
a,b=map(int,input().split())
print(int(comb(a,2)+comb(b,2)))

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

Solution (Python):
a, b = [int(x) for x in input().split()]
print(a*(a-1)//2 + b*(b-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(n*(n-1)//2 + m*(m-1)//2)

Solution (Python):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

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


if __name__=="__main__":
    main()

Solution (Python):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

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


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

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

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

    ans = choose_2(N + M) - N * M

    print(ans)


if __name__ == '__main__':
    main()

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

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

print(s)

Solution (Python):
from math import factorial

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

if N <= 1:
    combN = 0
else:
    combN = factorial(N) // (factorial(N - 2) * factorial(2))

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

print(combN + combM)

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

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

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

Solution (Python):
import sys


def resolve(in_):
    n, m = map(int, in_.readline().split())
    return n * (n - 1) // 2 + m * (m - 1) // 2


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

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

Solution (Python):
from itertools import combinations

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

cN = len(list(combinations(range(N),2)))
cM = len(list(combinations(range(M),2)))

print(cN + cM)

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