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

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

N_M_list=[2]*N+[1]*M

c = list(itertools.combinations(N_M_list, 2))

cnt=0

for i in c:
    if sum(i)%2==0:
        cnt+=1

print(cnt)

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

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

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

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

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


eeCount = n * (n - 1) / 2


ooCount = m * (m - 1) / 2

print(int(eeCount + ooCount))

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

list = []
for i in range(x):
  list.append('n')
for i in range(y):
  list.append('m')
  
result = []
for i in range(len(list)):
  for j in range(i + 1, len(list)):
      result.append([list[i], list[j]])
      
count = 0
for i in range(len(result)):
  if result[i][0] == result[i][1]:
    count += 1

print(count)

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


x,y = input().split()
x = int(x)
y = int(y)
print((fact(x)//(2*fact(x-2))) + (fact(y)//(2*fact(y-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):
a,b = map(int,input().split())

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

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

ans = round((a * (a - 1) / 2) + (b * (b - 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(i) for i in input().split()]
print(N*(N-1)//2 + M*(M-1)//2)

Solution (Python):
from math import factorial

def conb2(a):
    if a == 1:
        return 0
    else:
        return int(a*(a-1)/2)


if __name__ == "__main__":
    M, N = list(map(int, input().split()))
    print(conb2(M)+conb2(N))

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

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

Solution (Python):


import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


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


if __name__ == "__main__":
    
    main()

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

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

Solution (Python):
import sys
import math
import itertools
from collections import deque

N=200005
inf=(1<<30)

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

for case in range(t):
    solve()

Solution (Python):
def saiki(n):

    if n == 0:
        return 0
    else:
        return n + saiki(n - 1)

def number(n , m):

    ans = saiki(n) + saiki(m) - n - m

    return ans

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

if __name__ == '__main__':
    main()

Solution (Python):
def saiki(n):

    if n == 0:
        return 0
    else:
        return n + saiki(n - 1)

def number(n , m):

    ans = saiki(n) + saiki(m) - n - m

    return ans

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

if __name__ == '__main__':
    main()

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

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

m = 0
for j in range(1, M):
  m = m + j
  
print("{}".format(n + m))

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

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

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

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

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

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

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

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

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

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

Solution (Python):
def resolve():
    '''
    code here
    '''
    N, M = [int(item) for item in input().split()]
    res = N*(N-1)//2 + M*(M-1)//2
    print(res)



if __name__ == "__main__":
    resolve()

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

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

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

else:
  m = M*(M-1)/2

print(int(n + m))

Solution (Python):
import functools

@functools.lru_cache(maxsize=None)
def factorial(N):
    if N == 0:
        return 1
    if N == 1:
        return 1
    else:
        return N * factorial(N - 1)


def c(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(r) * factorial(n-r))


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

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

Solution (Python):
def choose(n, r):
    x, y = 1, 1
    for i in range(r):
        x *= n - i
        y *= i + 1
    return x // y


N, M = map(int, input().split())
ret = choose(N, 2) + choose(M, 2)
print(ret)

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

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

print(ans)

Solution (Python):
def combination(n, a, mod):
    x = 1
    y = 1
    for i in range(a):
        x = x * (n-i)%mod
        y = y * (a-i)%mod

        
        
        
        
    return x * pow(y, mod-2, mod)%mod

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

ans = combination(n,2,pow(10,9)+7) + combination(m, 2, pow(10,9)+7)
print(ans)

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

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

ans=0

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

print(int(ans))

Solution (Python):
def Conv(x):
    return x * (x - 1) // 2

N, M = map(int, input().split())
print(Conv(N) + Conv(M))

Solution (Python):

N,M = map(int,input().split())
ans=0
if N>1:
    ans+=int(N*(N-1)/2)
if M>1:
    ans+=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):
from math import factorial

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

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

Solution (Python):
num = input("")
num = num.split(" ")
N = int(num[0])
M = int(num[1])
a = int(N*(N-1)/2) if N*(N-1) >= 0 else 0
b = int(M*(M-1)/2) if M*(M-1) >= 0 else 0
print(a + b)

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

def comb(n):
    return factorial(n) // (factorial(n - 2) * factorial(2))

if n > 1:
    ans += comb(n)
if m > 1:
    ans += comb(m)
print(ans)

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

Solution (Python):


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

ans = 0

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

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

print(int(ans))

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

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

Solution (Python):



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

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

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

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

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

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

Solution (Python):


import sys
import math
from math import sqrt
input = sys.stdin.readline

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

Solution (Python):
import math

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

def tmp(a):
  if a == 0 or a == 1:
    return 0
  a = math.floor((a * (a - 1)) / 2)
  return a
print(tmp(N) + tmp(M))

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

sum = 0

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

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

print(int(sum))

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

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


sum = N*(N-1)/2

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

print(int(sum))

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

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

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

def combination(n, k):
    if n < k:
        return 0
    return fact(n) / ( fact(n-k) * fact(k))

n, m = [int(x) for x in input().split()]
answer = int(combination(n, 2) + combination(m, 2))
print(answer)

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

Solution (Python):
inp = input().split()
res = 0
for i in inp:
  res += int(i)*(int(i)-1)/2
print(int(res))

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline

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

Solution (Python):
q=input()
w,e=map(int,q.split())
y=w*(w-1)//2;
u=e*(e-1)//2;
print (y+u)

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

Solution (Python):
"""
Author: guiferviz
Time: 2020-03-27 14:59:20
"""

import math


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


def main():
    n, m = map(int, input().split())
    print(int(c(n, 2) + c(m, 2)))


if __name__ == "__main__":
    main()

Solution (Python):
import sys
from math import factorial

line = input()
N, M = (int(s) for s in line.split(' '))

total = 0
if N > 1:
  total += factorial(N) / factorial(N - 2) / 2
if M > 1:
  total += factorial(M) / factorial(M - 2) / 2

print(int(total))

Solution (Python):
def ols(): return input()
def oli(): return map(int, input().split())
def olai(): return list(map(int, input().split()))
def olas(): return list(input().split())
def mlai(L): return [int(input()) for _ in range(L)]
def mlas(L): return [input() for _ in range(L)]

n, m = oli()
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())

if not 0 <= n <= 100 and 0 <= m <= 100 and 2 <= n + m:
    print('Unsupported...')  
if n >= 2:
    n_comb = combinations_count(n, 2)
else:
    n_comb = 0
if m >= 2:
    m_comb = combinations_count(m, 2)
else:
    m_comb = 0
    
print(n_comb + m_comb)

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

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

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

print(int(ans))

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

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

all_pattern = math.factorial(n+m) // (math.factorial(n+m - 2) * math.factorial(2))
print(all_pattern - n*m)

Solution (Python):


from sys import stdin, stdout

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

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

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

Solution (Python):
import math

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

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

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

Solution (Python):
import sys

readline = sys.stdin.buffer.readline
readints = lambda: list(map(int, sys.stdin.buffer.read().split()))

n, m = readints()

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

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

Solution (Python):

NM = input().split(' ')
N = int(NM[0])
M = int(NM[1])
print(int((N+M)*(N+M-1)/2 - N*M))

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

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

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

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

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

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

def main():
  
  ans1 = ans12(N)
  
  ans2 = ans12(M)
  ans = int(ans1 + ans2)
  print(ans)

def ans12(x):
  if x > 1:
    return (x * (x - 1)) / 2
  else:
    return 0

if __name__ == '__main__':
	main()

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

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

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

Solution (Python):
def cmb(n,k):
  x,y=n,k
  for i in range(1,k):
    x*=n-i
    y*=k-i
  return x//y

n,m=[int(x) for x in input().split()]
N=cmb(n,2) if n>=2 else 0
M=cmb(m,2) if m>=2 else 0
print(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())

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

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

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

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

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

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

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

k = N + M

if N >= 0 and M <=100 and N+M >=2: 
    int((N + M) * (N + M - 1) / 2 - (N * M))
    print(int(k * (k - 1) / 2 - (N * M)))

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

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

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

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

Solution (Python):
from sys import stdin
r = stdin.readline

def fact(n):
    ans = 1
    for i in range(1,n+1): ans*=i
    return ans

def main():
    n, m = map(int, r().strip().split())
    print((fact(n)//(2*fact(n-2)))+(fact(m)//(2*fact(m-2))))

main()

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

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

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

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

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

print(brojac)

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



def main():
    import sys
    input = sys.stdin.readline

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import itertools

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

even = [i for i in range(2, 333, 2)]

odd = [i for i in range(1, 333, 2)]


seq = []


for i in range(n):
    seq.append(even[i])

for i in range(m):
    seq.append(odd[i])



cnt = 0

for v1, v2 in itertools.combinations(seq,2):
    tmp = int(v1) + int(v2)
    if tmp % 2 == 0:
        cnt += 1

print(cnt)

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

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

Solution (Python):
t=list(map(int,input().split()))
n=t[0]
m=t[1]

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

print(Rt)

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

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

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

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

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

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

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

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

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

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

print(ans)

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

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

Solution (Python):
s = input()

N, M= [int(si) for si in s.split()]

def func(N, M):
    a = 0

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

    if M>1:
        a += M*(M-1)/2
    print(int(a))
    
func(N, M)

Solution (Python):
import sys

try:
	nums = list(map(int, input().split()))
	N, M = nums[0], nums[1]
except:
	print("整数を入力")
	sys.exit()

if (N < 0 or 100 < N) or (M < 0 or 100 < M):
	print("NとMはそれぞれ0以上100以下")
	sys.exit()
if N + M < 2:
	print("N + Mは2以上")
	sys.exit()


def keisan(num):
	
	cnt = 0
	while not num == 0:
		copy_num = num
		while not (copy_num - 1) == 0:
			copy_num -= 1
			cnt += 1
		num -= 1
	return cnt

sum = keisan(N) + keisan(M)
print(sum)

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

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

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

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

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

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

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

Solution (Python):
n, m = [int(i) for i 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())
ans = N*(N-1)//2
ans += M*(M-1)//2
print(ans)

Solution (Python):
def main():
  inputNumEven, inputNumOdd = map(int, input().split())
  
  
  if inputNumEven < 0:
    inputNumEven = 0
  if inputNumOdd > 100:
    inputNumOdd = 100
    
  result = inputNumEven*(inputNumEven-1)/2 + inputNumOdd*(inputNumOdd-1)/2
    
  
  return print(int(result))

if __name__ == '__main__':
  main()

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

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

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

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

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

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

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

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

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

print(int(a*(a-1)/2 + b*(b-1)/2))

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

ans = 0
ans += N * (N-1) // 2 if N!=1 else 0
ans += M * (M-1) // 2 if M!=1 else 0

print(ans)

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

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

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

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

if ans < 0:
    print(ans)
else:
    print(ans)

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

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):
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 > 1:
    num_1 = combinations_count(n, 2)
else:
    num_1 = 0

if m > 1:
    num_2 = combinations_count(m, 2)
else:
    num_2 = 0

print(num_1 + num_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_combi=n*(n-1)/2
m_combi=m*(m-1)/2
ans=n_combi+m_combi
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):
n,m = map(int,input().split())

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

Solution (Python):
import math


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

if __name__ == '__main__':
    a,b=map(int,input().split())
    
    e_2 =  combinations_count(a,2)
    
    o_2 = combinations_count(b, 2)
    print(e_2 + o_2)

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

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

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

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

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

X2 = int(X) * (int(X)-1) / 2
Y2 = int(Y) * (int(Y)-1) / 2

answer = X2 + Y2

print(int(answer))

Solution (Python):
import sys

n, m = input().strip().split()
n, m = [int(n), int(m)]
ans = n * (n-1) // 2 + m * (m-1) // 2

print(ans)

Solution (Python):

import numpy as np
import math
 
N, M = map(int, input().split())
 
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):


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

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

def c(s,t):
    if s == 0 or s == 1:
        return 0
    return math.factorial(s)/(math.factorial(s-t)*math.factorial(t))

print(int(c(n,2)+c(m,2)))

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


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

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

Solution (Python):

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


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

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

Solution (Python):
ans=0

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

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

print(ans)

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

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


S = a*(a-1)/2
F = b*(b-1)/2
if a<1.9 and b<1.9:
  print(0)
elif a<1.9 and b>1.9:
  print(int(F))
elif a>1.9 and b<1.9:
  print(int(S))
elif a>1.9 and b>1.9:
  print(int(S+F))

Solution (Python):
a,b = input().split()
a = int(a)
b = int(b)
A = a-1
B = b-1

S = a*A/2
F = b*B/2
if a<1.9 and b<1.9:
  print(0)
elif a<1.9 and b>1.9:
  print(int(F))
elif a>1.9 and b<1.9:
  print(int(S))
elif a>1.9 and b>1.9:
  print(int(S+F))

Solution (Python):
a,b = input().split()
a = int(a)
b = int(b)
A = a-1
B = b-1
X = a*A
Y = b*B
S = X/2
F = Y/2
if a<1.9 and b<1.9:
  print(0)
elif a<1.9 and b>1.9:
  print(int(F))
elif a>1.9 and b<1.9:
  print(int(S))
elif a>1.9 and b>1.9:
  print(int(S+F))

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

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

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

Solution (Python):
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

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

print(num1 * (num1 - 1) // 2 + num2 * (num2 - 1) // 2)

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

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

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

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



if N < 2:
  k = 0
else:
  k = math.factorial(N) / (math.factorial(N-2) * 2 )

if M < 2:
  g = 0
else:
  g = math.factorial(M) / (math.factorial(M-2) * 2 )


print(int(k+g))