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

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

Solution (Python):

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

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

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

if(N>1):
    A=(N*(N-1)//2)
else:
    A=0

if(M>1):
    B=(M*(M-1)//2)
else:
    B=0

print(A+B)

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, readline().split()))
    print((n * (n - 1) // 2 + (m * (m - 1)) // 2))


if __name__ == '__main__':
    solve()

Solution (Python):
def comb(a, b):
  if a < b:
    return 0
  c = fact(a)
  d = fact(b)
  e = fact(a-b)
  return c//(d*e)

def fact(a):
  if a == 0:
    return 1
  return a*fact(a-1)

a, b = map(int, input().split())
res1 = comb(a, 2)
res2 = comb(b, 2)
print(res1 + res2)

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

x=0
y=0
if N>=2:
    x=combinations_count(N, 2)
if M>=2:
    y=combinations_count(M, 2)

print(x+y)

Solution (Python):


'''
2 1
'''


n1, n2 = map(int, input().split())


print(int(n1 * (n1-1) / 2 + (n2 * (n2-1))/2))

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


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

Solution (Python):
str = input().split()
n = int(str[0])
m = int(str[1])
print(n*(n-1)//2 + m*(m-1)//2)

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

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):
A = list(map(int, input().split()))
N = A[0]
M = A[1]
 

pattern_1 = N*(N-1)/2
 

pattern_2 = M*(M-1)/2
 
print(int(pattern_1 + pattern_2))

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


pattern_1 = N*(N-1)/2


pattern_2 = M*(M-1)/2

print(int(pattern_1 + pattern_2))

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

Solution (Python):
n,m=map(int,raw_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):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,m = LI()

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


print(main())

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

N = a[0]
M = a[1]

N_combi = N*(N-1)/2
M_combi = M*(M-1)/2

print(int(N_combi+M_combi))

Solution (Python):
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,m=n1()

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

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

Solution (Python):
S = open(0).read().strip('\n').split(' ')
S = [int(s) for s in S]
even = 0 if  S[0]==1 else S[0]*(S[0]-1)/2
odd = 0 if  S[0]==1 else S[1]*(S[1]-1)/2
print(int(even+odd))

Solution (Python):
m,n=(int(x) for x in input().split());
even = m*(m-1)/2;
odd = n*(n-1)/2;

result = int(even + odd);
print(result);

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

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

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

Solution (Python):

"""
Created on Sat Apr  4 19:20:51 2020

@author: Kanaru Sato
"""

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

if n <= 1:
    ans1 = 0
else:
    ans1 = n*(n-1)/2

if m <= 1:
    ans2 = 0
else:
    ans2 = m*(m-1)/2
    
ans = ans1+ans2
print(int(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)) + m*(m-1))//2)

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

guusuu = (N * (N-1)) // 2
kisuu = (M * (M-1)) // 2

print(guusuu + kisuu)

Solution (Python):
"""
A-The Number of Even Pairs
"""

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 rC2(r):
    return int(r*(r-1)//2)

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

print(num_N + num_M)

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

def comb_num(a, b):
    if a - b < b: b = a - b
    if b == 0: return 1
    if b == 1: return a

    numerator = [a - b + k + 1 for k in range(b)]
    denominator = [k + 1 for k in range(b)]

    for p in range(2,b+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (a - b) % p
            for k in range(p-1,b,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(b):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

if N >= 2:
    num_n = comb_num(N,2)
else:
    num_n = 0

if M >= 2:
    num_m = comb_num(M,2)
else:
    num_m = 0

print(num_n + num_m)

Solution (Python):
def comb_2(x):
    if x < 2:
        return 0
    return x * (x - 1) // 2


a, b = map(int, input().split())
print(comb_2(a) + comb_2(b))

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

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

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

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

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

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

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

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

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

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

s = n + m
print(combinations_count(s,2) - (combinations_count(n,1)*combinations_count(m,1)))

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

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

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

print(int(result))

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

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

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

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

P = 0

if N >= 2:
    for i in range(N - 1):
        for j in range(N - 1 - i):
            P = P + 1

if M >= 2:
    for i in range(M - 1):
        for j in range(M - 1 - i):
            P = P + 1

print(P)

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):
num = input().split()
n = int(num[0])
m = int(num[1])

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

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

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

Solution (Python):

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

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

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

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

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

print(int(ans))

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

Solution (Python):
from itertools import combinations
N, M = map(int, input().split())
n = [c for c in combinations(range(N), 2)]
m = [c for c in combinations(range(M), 2)]
print(len(n) + len(m))

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

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

print(c)

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

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

print(c)

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

Solution (Python):
from scipy.misc import comb
 
n,m = map(int, input().split())
 
if n>1:
  even = comb(n,2, exact=True)
else:
  even = 0
 
if m>1:
  odd = comb(m,2, exact=True)
else:
  odd = 0
 
ans = even + odd
print(str(int(ans)))

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

Solution (Python):
import math


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


N, M = map(int, input().split())
ans = comb(N, 2) + comb(M, 2)
print(ans)

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

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

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

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

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

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

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

print(int(ans))

Solution (Python):
import math
N,M=map(int,input().split())
n=0
m=0
def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if N>1:
	n=combinations_count(N, 2)
if M>1:
	m=combinations_count(M, 2)
print(n+m)

Solution (Python):
inp=str(input())
N= int(inp.split()[0])
M=int(inp.split()[1])
n= abs(N)
m=abs(M)
sum_N = (N-1)*N/2
sum_M=(M-1)*M/2
sum_all = sum_N + sum_M
print(int(sum_all))

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

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

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

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

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

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

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

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

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

Solution (Python):
def even_count(N):
    if N == 0:
        return 0
    elif N == 1:
        return 0
    else:
        return N * (N-1) // 2

def odd_count(M):
    if M == 0:
        return 0
    elif M == 1:
        return 0
    else:
        return M * (M-1) // 2

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

num_even = even_count(N)
num_odd = odd_count(M)
amount = num_even + num_odd
print(amount)

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

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

print(int(choose2(m)+choose2(n)))

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


import math
def combinations_count(a, b):
    return math.factorial(a) // (math.factorial(a - b) * math.factorial(b))

if n >= 2:
    ans1 = combinations_count(n, 2)
else:
    ans1 = 0

if m >= 2: 
    ans2 = combinations_count(m, 2)
else:
    ans2 = 0
    
print(ans1 + ans2)

Solution (Python):
n, m = list(map(int, input().split()))
def factorial(x):
    f = 1
    for i in range(1, x+1):
        f *= i
    return f
ans = 0
if n < 2 and m < 2:
    ans = 0
    print(ans)
elif n < 2:
    ans = int(factorial(m) / (factorial(2) * factorial(m - 2)))
    print(ans)
elif m < 2:
    ans = int(factorial(n) / (factorial(2) * factorial(n - 2)))
    print(ans)
else:
    ans = int(factorial(m) / (factorial(2) * factorial(m - 2)) + factorial(n) / (factorial(2) * factorial(n - 2)))
    print(ans)

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

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

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

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

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

Solution (Python):
import math
N, M = list(map(int, input().split()))
if N==M==1:
    print(0)
elif M < 2:
    print(int(math.factorial(N)/math.factorial(2)/math.factorial(N-2)))
elif N==0:
    print(int(math.factorial(M)/math.factorial(2)/math.factorial(M-2)))
else:
    print(int(math.factorial(N)/math.factorial(2)/math.factorial(N-2) +  math.factorial(M)/math.factorial(2)/math.factorial(M-2)))

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

nout =n* (n-1)//2
mout =m* (m-1)//2

print(nout+mout)

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

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

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())
p, q = 0, 0
for i in range(n):
    p = p + i
for i in range(m):
    q = q + i
print(p + q)

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

print(int(ans))

Solution (Python):
n, m = map(int, input().split(' '))
ans_n = n * (n - 1) // 2 if n > 1 else 0
ans_m = m * (m - 1) // 2 if m > 1 else 0
ans = ans_n + ans_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())
n = 0
m = 0
for i in range(N-1):
    n += N

for j in range(M-1):
    m += M
    
Nans = n//2
Mans = m//2
print(Nans + Mans)

Solution (Python):
inp=list(map(int,input().strip().split()))[:2]
print((inp[0]*(inp[0]-1))//2+(inp[1]*(inp[1]-1))//2)

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

Solution (Python):
import math as m

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


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


print(int((comb(n[0], 2)+comb(n[1], 2))))

Solution (Python):
o=input().rstrip().split(' ')
a=int(o[0])
b=int(o[1])
c=(a*(a-1))//2;
d=(b*(b-1))//2;


print(c+d)

Solution (Python):
from functools import reduce
mod=10**9+7
def f(A,B):
 if B==0:
  den=1
  num=1
 else:
  den=reduce(lambda x,y:x*y%mod,range(A,A-B,-1))
  num=reduce(lambda x,y:x*y%mod,range(1,B+1))

 return den*pow(num,mod-2,mod)%mod
n,m=map(int,input().split())
print(f(n,2)+f(m,2))

Solution (Python):

from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product

s = input().split()
t = [int(p) for p in s]


N = t[0] 
M = t[1]

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

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

print(int(ans))

Solution (Python):
import sys

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

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

def main():
    res = choose2(n) + choose2(m)
    print(res)

if __name__ ==  '__main__':
    main()

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

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

Solution (Python):

"""
Created on Mon Mar 30 23:58:42 2020

@author: black
"""


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

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

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

pattern = 0

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

for i in range(m):
    pattern = pattern + m - (i+1)
    
print(pattern)

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

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 LLI(rows_number): return [LI() for _ in range(rows_number)]

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

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

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

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

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

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

nm = input().split(" ")
print(bikkuri(int(nm[0])) // (bikkuri(int(nm[0]) - 2) * 2) * (0 if int(nm[0]) < 2 else 1) + bikkuri(int(nm[1])) // (bikkuri(int(nm[1]) - 2) * 2) * (0 if int(nm[1]) < 2 else 1))

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

Solution (Python):
str1 =str(input())
s1 = str1.split(' ')
m = int(s1[0])
n = int(s1[1])
x = (m*(m-1))/2
y = (n*(n-1))/2
print(int(x+y))

Solution (Python):
def solve(string):
    n, m = map(int, string.split())
    return str((n + m) * (n + m - 1) // 2 - n * m)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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(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())
if a<=1 and b<=1:
    print(0)
if a<=1 and 1<b:
    print((b*(b-1))//2)
if 1<a and b<=1:
    print((a*(a-1))//2)
if 1<a and 1<b:
    print(((a*(a-1))//2)+((b*(b-1))//2))

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

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

print(int(ans))

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

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

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

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

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

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

Solution (Python):

N_gu,M_ki = map(int, input().split())



from math import factorial

def kumiawase_num(n, r):
    if  n<r:
        return 0
    return factorial(n) // (factorial(n - r) * factorial(r))
def kumiawase_jufuku(n, r):
    if  n<r:
        return 0
    else:
        return kumiawase_num(n + r - 1, r)

gu_gu = kumiawase_num(N_gu , 2) 
ki_ki = kumiawase_num(M_ki, 2)
print(gu_gu + ki_ki)

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

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

Solution (Python):
arr=input().split()
n=int(arr[0])
m=int(arr[1])
print((n*(n-1)+m*(m-1))//2)

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

n = int(st[0])
m = int(st[1])
print(int(n * (n - 1) / 2 + m * (m - 1) / 2))

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

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

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

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

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

Solution (Python):
i = list(map(int, input().split()))
N = i[0]
M = i[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 math

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

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



print(combi(n) + combi(m))

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

Solution (Python):
import math

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

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

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

for i in range(N):
  even.append(2)

for i in range(M):
  odd.append(1)
  
lst = even + odd

ans = 0
for v in itertools.combinations(lst, 2):
  x = v[0] + v[1]
  if x % 2 == 0:
    ans += 1
print(ans)

Solution (Python):
import sys

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

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

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

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

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

print(int(ans))

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



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

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

Solution (Python):


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

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

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

answer1 = N * (N - 1) / 2
answer2 = M * (M - 1) / 2

print(int(answer1 + answer2))

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







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

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

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

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

Solution (Python):

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

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

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

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