peterverebics/CodeNet_Python_118 huggingface dataset:
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)
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(res)
N,M = map(int,input().split())
print((N*(N-1))/2+(M*(M-1))/2)
a,b=map(int,input().split())
print(a*(a-1)/2+b*(b-1)/2)
n, m = map(int, input().split())
print((n*(n-1)+m)//2 +2)
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 int(factorial(n) / factorial(r) / factorial(n-r))


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

print(
    c(N, 2) + c(M, 2)
)
n, m = map(int, input().split())
print(n*(n-1)/2 + m*(m-1)/2)
n,m = map(int,input().split())
oddsum = n*(n-1)/2 + m*(m-1)/2
print(oddsum)
N,M=list(map(int,input().split()))
print(N*(N-1)/2+M*(M-1)/2)
N, M = map(int, input().split())

print((N * (N - 1) / 2) + (M * (M - 1) / 2))
N, M = map(int, input().split())
if N >=2:
    odd = (N*(N-1))/2
else:
    odd = 0
if M >= 2:
    even = (M*(M-1))/2
else:
    even = 0
print(odd+even)
#abc159 a
n,m=map(int,input().split())
ans=n*(n-1)/2+(m-1)/2
print(ans)
N,M=map(int,input().split())
if N < 1:
  n = 0
else:
  n = N*(N-1) / 2
if M < 1:
  m = 0
else:
  m = M*(M-1) / 2
print(n+m)
N,M = map(int, input().split())

print(N*(N-1)+M*(M-1)//2)
N, M = (int(x) for x in input().split())
A = N * (N - 1) / 2
B = M * (M - 1) / 2
print(A+B)
n,m = map(int,input().split())
print(n*(n-1)/2 + m*(m-1)/2)
n,m=map(int,input().split())
if(n+m>=2 and n>=0 and n<=100 and m<=100 and m>=0):

    print((n*(n-1)/2)+(m*(m-1)/2))
N, M = map(int, input().split())
print(int(N * (N - 1) + M * (M-1)) / 2)
n, m = map(int, input().split())
print((n+m)*(n+m-1)/2-n*m)
# スペース区切りの整数の入力
a, b = map(int, input().split())
s1 = a * (a - 1) / 2 #偶どうし
s2 = b * (b - 1) / 2 #奇どうし
# 出力
print(s1 + s2)
import math
H, W = map(int, input().split())

a = (H * (H-1))/2
b = (W * (W-1))/2

print(a+b)
N,M=input().split( )
N=int(N)
M=int(M)

M2=(M*(M-1))/2 #MC2
N2=(N*(N-1))/2
A=M2+N2
A
n, m = [int(i) for i in input().split()]
print((n*(n-1)+m*(m-1))/2)
n, m = (int(i) for i in input().split());
res = (n * (n - 1) + m * (m - 1)) / 2;
print(res);
def out(m, n):
  a = (m+n)*(m+n-1) % 2
  b = a - m*n
  return b
n,m = map(int,input().split())
method = n*(n-1)/2 + m*(m-1)/2
print(method)
from heapq import heappop,heappush
n=input()
h=[]
heappush(h,10)
from math import *


N,M = list(map(int,input().split(" ")))
A = (N*(N-1))/2+(M*(M-1))/2
print (A)
N, M = map(int, input().split())

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

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

ans=  0

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

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

def nCr(n, r):
    if n < r or r == 0:
        return 1
    ans = 1
    for i in range (r):
        ans *= (n-r+i+1)
        ans = ans // (i+1)

    return ans

print(nCr(n, 2) + nCr(m, 2))
import math

a, b = map(int, input().split())

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

if a <= 1 & b <= 1:
    print("0")
    exit()
if a <= 1:
    print(combinations_count(b, 2))
    exit()
if b <= 1:
    print(combinations_count(a, 2))
    exit()

print(combinations_count(a, 2) + combinations_count(b, 2))
from scipy.misc import comb
N, M = map(int, input().split())
print(comb(N, 2) + comb(M, 2))
m,n=map(int,input().split())
print(m*(m-1)/2+n*(n-1)/2)
a = list(map(int, input().split()))


def a1():
    if a[0] == 1 or a[0] == 0:
        a[0] = 1
        return a[0]
    else:
        return a[0] * (a[0] - 1) / 2


def b1():
    if a[1] == 1 or a[1] == 0:
        a[1] = 1
        return a[1]
    else:
        return a[1] * (a[1] - 1) / 2


print(a1() * b1())
N,M=map(int,input().split())
if N>1 and M>1:
  print((N*(N-1)/2)+(M*(M-1)/2))
elif N<=1:
    if M<=1:
      print(0)
    print(M*(M-1)/2)
else:
  print(N*(N-1)/2)
N, M = map(int, input().split())

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

print(ans)
N,M=map(int,input().split())
ans=(N*N-1)/2+(M*M-1)/2
print(ans)
import math
import sys
n, m = map(int, input().split())

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

if n <= 1 and m >= 2:
    print(combinations_count(m, 2))
    sys.exit()
elif n >= 2 and m <= 10:
    print(combinations_count(n, 2))
    sys.exit()
elif n == m == 1:
    print(1)
    sys.exit()
elif n == m == 0:
    print(0)
    sys.exit()
else:
    print(combinations_count(n, 2) + combinations_count(m, 2))
guu, ki = map(int, input().split())

print(guu*(guu-1)/2 + ki*(ki-1)/2)
import math
def combinations_count(n, r):
 return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
A=0
N,M=map(int,input().split())
if N<=2:
 A+=0
else:
 A+=combinations_count(N, 2)
if M<=2:
 A+=0
else:
 A+=combinations_count(M, 2)
print(A)
n,m = map(int,input().split())

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

print(ans)
def main():
    n, m = map(int, input().split())
    n -= 1
    e = 0
    while n > 0:
        e += n
        n -= 1
    if m <= 1:
        print(e)
    else:
        print(e + m)


main()
N,M=input().split()
from math import factorial 
if int(N)>=2 and int(M)>=2:
    print(factorial(int(N))/2/factorial(int(N)-2)+factorial(int(M))/2/factorial(int(M)-2))
elif int(N)<2 and int(M)>=2:
     print(factorial(int(M))/2/factorial(int(M)-2))
elif int(M)<2 and int(N)>=2:
     print(factorial(int(N))/2/factorial(int(N)-2))
else:
    print("0")
a, b = map(int, input().split())
print((a * (a + 1) // 2) + b)
n,m=map(int,input().split())
s=0
if(n>=2):
  for i in range(n):
    s+=i
    
if(m>=2):
  s+=m
  
print(s)
import math
from scipy.misc import comb

N, M = map(int, input().split())
print(math.ceil(comb(N, 2))+math.ceil(comb(M, 2)))
n,m = map(int,input().split())
print((n**2 - n + m**2 - m)/2)
def is_kaibun(st):
  f = True
  for x,y in zip(st, st[::-1]):
    if x != y:
      f = False
      break
  return f
 
S = input()
ans = False
if is_kaibun(S):
  if is_kaibun(S[:(len(S)-1)//2]):
    ans = is_kaibun(S[(len(S)+3)//2-1:])
if ans:
  print('Yes')
else:
  print('No')
S = input()
N = len(S)
a = S[1:(N-1)//2]
b = S[(N+3)//2:]

def kaibun(l):
    for i in range(len(l)):
        if l[i] != l[len(l)-1-i]:
            return(False)
    return(True)

print(kaibun(S))
print(kaibun(a))
print(kaibun(b))
  
if kaibun(S) & kaibun(a) & kaibun(b):
    print("Yes")
else:
    print("No")
m, n=map(int,input().split())
print((m-1)*m/2+(n-1)*n/2)
N,M=map(int,input().split())
print((N//2)+(M//2))
N, M = map(int, input().split())

print(N*(N-1)/2+M*(M-1)/2)
N, M = map(int,input().split())
a = (N*(N-1))/2
b = (M*(M-1))/2
print(a+b)
n, m = map(int, input().split())
print(int(n * (n - 1) / 2 + m * (m + 1) / 2))
N, M = map(int, raw_input() .split())
i = 1
sum = 0
while N-1 >= i:
    sum = sum + i
    i += 1
if sum == 1:
    print M
else:
    print sum + M
N,M=map(int,input().split())
ans=(N*N-1)/2+(M*M-1)/2
print(int(ans))
N,M = [int(x) for x in input().split()] 

if N == 1 and M == 1:
    print(0)
    
N = (N * (N - 1)) / 2
M = (M * (M - 1)) / 2

X = N + M 

print(int(X))
from math import floor

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

print(floor(N*(N-1)*0.5 + M))
N,M=map(int,input().split())
a=M+N
print(a*(a-1)/2-M*N)
N, M = map(int, input().split())

if N==0 or N ==1:
  if M ==0 or M == 1:
    print(0)
  else:
    print(M*(M-1)/2)
else:
  if M ==0 or M == 1:
    print(N*(N-1))
  else:
    print(0)
def factorial(n):
    if n > 1:
        return n * factorial(n - 1)
    else:
        return 1
        
m,n=map(int,input().split())
# n = 100
# m = 100
n_result = factorial(n)/(factorial(2) * factorial(n - 2))
m_result = factorial(m)/(factorial(2) * factorial(m - 2))

print(n_result + m_result)
#我が偶数になるのは、(偶数, 偶数)か(奇数, 奇数)の時
N, M = map(int, input().split())
print(N * (N - 1) / 2 + M * (M - 1) / 2)
N, M = map(int, input().split())

even = N*(N-1)/2
odd = M*(M-1)/2

ans = even + odd

print(ans)
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def main():
    N,M = map(int, input().split())
    ans = combinations_count(M,2) + combinations_count(N,2)
    print(ans)

main()
n , m = map(int,input().split())
print(n*(n-1)/2 + m*(m-1)/2)
s=input()
l=s[:(len(s)-1)//2]
r=s[(len(s)+3)//2-1:]
#print(l)
#print(r)
for i in range((len(s)-1)//2):
  if s[i]==s[-i-1] and l[i]==r[i]:
    if i==(len(s)-1)//2-1:
      print("Yes")
      exit()
    continue
  else:
    print("No")
    break
n, m = map(int, input().split())
print((n * (n - 1) / 2) + (m * (m - 1) / 2))
n,m=map(int,input().split())
 
print(n*(n-1)/2+m*(m-1)/2)
N,M=map(int,input().split())

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

print(c)
A=input()
L=A.split()

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

x=1
for n in range(1,N+1):
  x*=n
x/=2

y=1
for m in range(1,M+1):
  y*=m
y/=2

ans=int(x+y)
print(ans)
n, m = map(int, input().split())

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

print(ans)
N, M = map(int, input().split())
a = (N//2) * (M//2)
b = (N - (N//2)) * (M - (M//2))
print(a + b)
a,b=map(int,input().split())
c=0
while a>1 :
  a=a-2
  c=c+1 
while b>1:  
  b=b-2
  c=c+1
print(c)
n,m = map(int,input().split())

print(n * m - m)
n, m = map(int, input().split())
ans = n * (n - 1) / 2 + m * (m - 1) / 2
print(ans)
from scipy.misc import comb

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

n_comb = comb(N, 2)
m_comb = comb(M, 2)

output = int(n_comb) + int(m_comb)

print(output)
N, M = map(int, input().split(' '))

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

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

s=N*M
m=N+M

d=(m*(m-1))/2

print(d-s)
N, M = map(int, input().split())
a, b = (N//2)+1, (M//2)+1
print(a*b+(N-a)*(M-b))
N,M=map(int,input().split())
s=N*(N-1)*0.5+M*(M-1)*0.5
print(s)
S=input()
N=len(S)
S1=S[:int((N-1)/2)]
S2=S[int((N+1)/2):]
if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:
  print("Yes")
else:
  print("No")
n=list(input())
def kaibun(l):
  flg=False
  for i in range(int((len(l)-1)/2)):
    
    if l[i] != l[len(l)-1-i]:
      flg=True
  return(int(flg))

c=kaibun(n)
m=n[:int((len(n)-1)/2)]
d=kaibun(m)
p=n[int((len(n)+1)/2):]
e=kaibun(p)
if c+d+e == 0:
  print('Yes')
else:
  print('No')
N,M=input().split( )
N=int(N)
M=int(M)

M2=(M*(M-1))/2 #MC2
N2=(N*(N-1))/2
A=M2+N2
A=int(A)
from scipy.misc import comb
 
n,m = map(int, input().split())
 
if n>1:
  even = comb(n,2)
else:
  even = 0
 
if m>1:
  odd = comb(m,2)
else:
  odd = 0
 
ans = even + odd
print(str(int(ans)))
N,M = map(int, input().split())
if N <= 1:
	answer = 0
else:
	answer = int(N/2)

print(answer)
# N Mを受け取って

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

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

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

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

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

if m >= 2:
    b = m * (m - 1) / 2
else:
    b = 0
    
print(a + b)
import math
n,m = map(int,input().split())
n2 = n*(n-1)/2
m2 = m*(m-1)/2

print((n2+m2)//1)
n, m = map(int, input().split())

print(n*(n-1)/2 + m*(m-1)/2)
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

N, M = map(int, input().split())
print(int(ncr(N,2)+ncr(M,2)))
from itertools import combinations


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

n = 2
m = 1

n_obj = [n*2 for n in range(1, N+1)]
m_obj = [m+1 for m in range(M)]

n_cnt = list(combinations(n_obj,2))
n_len = len(n_cnt)

m_len = len(m_obj)

if N <= 1 and M <= 1:
    print('0')

else:
    print(n_len + m_len)
N,M=map(int,input().split())
print((N*(N-1)/2)+(M*(M-1)/2))
s= input()
l = list(s)
ans= "Yes"
for i in range(0,len(s)//2):
  if(l[i]!=l[-1-i]):
    ans = "No"
print(ans)
N,M=input().split()
n=int(N)
m=int(M)
a=(n*(n-1))/2
b=(m*(m-1))/2
print(a+b)
a,b = map(int,input().split())
if (a != 0) and (b != 0):
    print(str(a*(a-1)/2 + b*(b-1)/2))
elif (a == 0) and (b == 0):
    print("0")      
elif (a == 0) and (b != 0):
    print(str(b*(b-1)/2))
else:
    print(str(a*(a-1)/2))
i = list(map(int, input().split()))

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

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

print(p)
N, M = (int(x) for x in input().split())
A = N * (N-1)/2 + M*(M-1)/2
print(A)
# -*- coding: utf-8 -*-
"""
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(ans)
N,M=map(int,input().split())

print(N*(N-1)/2 + M*(M-1)/2)
import math
def combi(n,r):
    if n < r:
        return 0
    return math.factorial(n) // math.factorial(r) * math.factorial(n-r)

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

if __name__ == '__main__':
    main()
from scipy.misc import comb

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

print(int(comb(N, 2) + comb(M, 2)))
import sys

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


print(n*(n-1) + m*(m-1))
def main():
    #n, m = map(int, raw_input().split())

    ##delete
    n = 0
    m = 3
    ##

    out = 0
    for i in range(1,n):
        for j in range(1,n-i+1):
            out+=1
        
    for i in range(1,m):
        for j in range(1,m-i+1):
            out+=1

    print(out)
m,n = map(int,input().split())
out = m * (m-1) /2 + n * (n - 1) / 2
print(out)
N = list(map(int,input().split()))
ans = 0
for i in range(2):
    if N[i] == 0:
        pass
    else:
        ans += N[i]*(N[i]-1)/2
print(ans)
S = input()
N = len(S)
a = S[1:(N-1)//2+1]
b = S[(N+3)//2:]

def kaibun(l):
    for i in range(len(l)):
        if l[i] != l[len(l)-1-i]:
            return(False)
    return(True)

print(kaibun("abccba"))

if kaibun(S) & kaibun(a) & kaibun(b):
    print("Yes")
else:
    print("No")
a,b=input().split()
a=int(a)
b=int(b)
print(a*(a-1)/2+(b*(b-1)/2))
import math
H, W = map(int, input().split())

a = (H * H-1)/2
b = (W * W-1)/2
print(a+b)
n,m=map(int,input().split())
print((n*(n-1)/2)+(m*(m-1)/2))
from math import floor

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

print(floor(N*(N-1)*0.5 + M))
n, m = map(int, input().split())

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

f = math.factorial


def comb(n, r):
    if n - r < 0:
        return 0
    else:
        return int(f(n) / f(r) / f(n - r))


N, M = map(int, input().split())
print(comb(N, 2) + comb(M, 2))
S = input()
N = int(len(S))
a = 0
for i in range(0,int((N-1)/2)): #全体が回文か確認
    if S[i] == S[-i-1]:
        a += 1

left = []
for i in range(0,int((N-1)/2)):#(N-1)/2までが回文か確認
  left += S[i]
if left == left.reverse():
        a += 1

right = []
for i in range(0,int((N-1)/2)):#(N+3)/2までが回文か確認
  right += S[-i-1]
if right == right.reverse():
        a += 1

if a == 3:
	print('Yes')
else :
    print('No')
s = input()
n = len(s)
t = s[:n // 2]
k = s[-n//2+1:]
if s == s[::-1]:
    print('Yes')
else:
    print('No')
n,m=map(int,input().split())
a=0
if n>=2:
    a+=(n*(n-1))/2
if m>=2:
    a+=(m*(m-1))/2

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

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

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

sum = (N*(N-1))/2 + (M*(M-1))/2
print(sum)
A=input()
L=A.split()

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

x=1
for n in range(1,N+1):
  x*=n
x /= 2
  
y=1
for m in range(1,M+1):
  y*=m
y /= 2

print(int(x+y))
n, m = map(int,input().split())
if n==0:
  c=m*(m-1)
elif m==0:
  c=n*(n-1)
else:
  c=n*(n-1)+m*(m-1)

print(c)
s = input()
n = len(s)
t = s[0:(n+3)//2]
u = s[-1:-(n+1)//2]
if t == u:
  print('Yes')
else:
  print('No')
# -*- coding: utf-8 -*-

# スペース区切りの整数の入力
N, M = map(int, input().split())
# 組み合わせ

if N < 2:
  print("0")
elif N == 2:
  print("1")
else:
  A = ((N*(N-1))/2)+M
  print("{}".format(int(A)))
n,m=list(map(int,input().split()))
x=0

x==m*(m-1)/2+n*(n-1)/2
print(x)
N, M=map(int,input().split())
print(N*(N-1)/2 + M*(M-1)/2)
S = input().split()
N = int(S[0])
M = int(S[1])

print(N * (N-1)/2 + M * (M-1)/2)
from sys import stdin
N, M = map(int, input().split()) 

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

print(total - odd)
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)
A = list(map(int, input().strip().split(' ')))
ans = (A[0] * (A[0] - 1)) / 2 + ((A[1] * (A[1] - 1)) / 2)
print(ans)
N,M=map(int,input().split())

print((N*(N-1)+M*(M-1))/2)
from scipy.misc import comb
n, m = map(int, input().split())
print(int(comb(n,2)+comb(m,2)))
n,m=map(int,input().split())

print(n*(n-1)+m*(m-1))
s=input()
n=len(s)

flag=True

for i in range(n):
  if(s[i]!=s[n-1-i]):
    flag=False

for i in range((n-1)//2):
  if(s[i]!=s[(n-1)//2-1-i]):
    flag=False
  if(s[(n-1)//2+1+i]!=s[n-1-i]):
    flag=False
    
if(flag):
  print("Yes")
else:
  print("No")
N, M = map(int, input().split())

even = N*(N-1)/2
odd = M*(M-1)/2

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

ans = N*M + M*(M-1)//2
print(ans)
n, m = map(int, input().split())
if m >= 2:
  if n < 2:
    print(m * (m - 1) / 2)
    quit()
  else:
    print(m*(m-1)/2 + n*(n-1)/2)
    quit()
    
if m < 2:
  if n< 2:
    print(0)
  else:
    print(n*(n-1)/2)
N,M = map(int,input().split())

ans = 0

if N > 1 and M > 1:
  ans = N*(N-1)//2 + M*(M-1)//2
elif N == 0 and M > 1:
  ans = M*(M-1)//2
elif N > 1 and M == 0:
  ans = N*(N-1)//2
  
print(ans)
N,M=map(int,input().split())
n=N*(N-1)
m=M*(M-1)
print((n+m)/2)
N,M=input().split()
n=int(N)
m=int(M)
a=n*(n-1)
b=m*(m-1)
print(a+b)
n,m = map(int,input().split())
print(n*n+m*m)
n,m = (int(x) for x in input().split())
N = n*(n-1)/2
M = m*(m-1)/2
print(N+M)
n,m = map(int,input().split())

if n>=1 & m>=1:
    print(int(n*(n-1)/2 + m*(m-1)/2))
else:
    print(0)
n, m = map(int, input().split())
print(n//2+m//2)
N,M=map(int,input().split())
if N<=1 and M<=1:
  print(0)
elif N<=1:
  print(M*(M-1)/2)
elif M<=1:
  print(N*(N-1)/2)
else:
  print(N*(N-1)/2+M*(M-1)/2)
nm = input().split()
n = int(nm[0])
m = int(nm[1])

ans = 0

n1 = n*(n-1)/2

n2 = m*(m-1)/2

ans = n1 + n2

print(ans)
N,M = map(int , input().split())
result = N+M
if result % 2 == 1:
    print(result)
tmp = input().split(" ")
N = int(tmp[0])
M = int(tmp[1])

print(N * (N - 1) / 2 + M * (M - 1) / 2)
a,b=list(map(int,input().split()))
x=a/2*(a-1)+b/2*(b-1)
print(x)
import math
n,m=map(int,input().split())
if n-2>0:
    a=math.factorial(n)//(math.factorial(2)*math.factorial(n-2))
else:
    a=0
if m-2>0:
    b=math.factorial(m)//(math.factorial(2)*math.factorial(m-2))
else:
    b=0
print(a+b)
import math

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

if M % 2 != 0:  
    print(int(math.factorial(N + M) / (math.factorial(2) * math.factorial(N + M - 2))) - N * M)
else:
    print(int(math.factorial(N + M) / (math.factorial(2) * math.factorial(N + M - 2))))
N, M = map(int,input().split())

print(N*(N-1)/2 + M*(M-1)/2)
str = list(input())

def isKaibun(src):
  rev = src[:]
  rev.reverse()

  return src == rev


N = len(str)

def num(N):
  return N-1

s1 = num(1)
e1 = (num(N)-1) // 2 + 1
s2 = (num(N) + 3) // 2
e2 = num(N) + 1

if isKaibun(str) and isKaibun(str[s1:e1]) and isKaibun(str[s2:e2]):
  print('Yes')
else:
  print('No')
n,m=input().split()
n=int(n)
m=int(m)
a=n*(n-1)+m*(m-1)
print(a)
a, b = map(int, input().split())

if a > 0:
  a = a * (a - 1)
  
if b > 0:
  b = b * (b - 1)
print(a + b)
n, m = map(int,input().split())

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

ans = 1
ans2 = 1

if n == 1:
  ans = 0
elif n>2:
  ans = kaijou(n)//(2*kaijou(n-2))
elif n==2:
  ans = kaijou(n)//2

if m ==1:
  ans2 = 0
elif m>2:
  ans2 = kaijou(m)//(2*kaijou(m-2))
elif m==2:
  ans2 = kaijou(m)//2

print(ans+ans2)
from scipy.misc import comb

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

ans = comb(N,2) + comb(M,2)


print(int(ans))
N, M = map(int, input().split())
num = 1
num2 = 1
num3 = 1
num4 = 1
if N > 1:
  for i in range(1, N-1):
    num *= i
  for i in range(1, N+1):
    num2 *= i
  num *= 2
  num = int(num2 / num)
elif N == 1:
  num = 0
else:
  num = 0
if M > 1:
  for i in range(1, M-1):
  	num *= i
  for i in range(1, M+1):
    num4 *= i
  num3 *= 2
  num3 = int(num4 / num3)
else:
  num3 = 0
print(num + num3)
N, M = map(int, input().split(' '))
print(N*(N-1)/2 + M*(M-1)/2)
a = list(map(int, input().split()))


def a1():
    if a[0] == 1 or a[0] == 0:
        a[0] = 1
        return a[0]
    else:
        return a[0] * (a[0] - 1) / 2


def b1():
    if a[1] == 1 or a[1] == 0:
        a[1] = 1
        return a[1]
    else:
        return a[1] * (a[1] - 1) / 2


print(int(a1() + b1()))
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(ans)
import math

def comb(n, r):
    if r >= n:
        return 0
    else:        
        return math.factorial(n) // (math.factorial(r)*math.factorial(n - r))
  
n, m = map(int, input().split())
print(int(comb(n,2) + comb(m,2)))
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(g,k)
n,m= map(int, input().split())
 
print(((n*(n-1))+m*(m-1))/2)
def factorial(n):
    if n == 0 or n == 1 or n < 0:
        return 1
    return n * factorial(n-1)

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

combination = int(factorial(N) / (2 * (factorial(N-2)))) + M
print(combination)
N, M = map(int,input().split())
answer = 0
answer += (N ** 2 - N) / 2
answer += (M ** 2 - M) / 2
print(answer)
from sys import stdin,setrecursionlimit
n,m = map(int,stdin.readline().rstrip().split())
print(n*(n-1)+m*(m-1))
# number of even balls, number of odd balls
N, M = list(map(int, input().split()))

total_choice = 0
if N == 1:
    total_choice += 1

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

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

print(int(total_choice))
n,m = map(int,input().split())
a = [0]*n
b = [1]*m
ans = a+b
count = 0
for i in range(0,n+m):
    for j in range(i+1,n+m):
        if (ans[i]+ans[j])%2==0:
            count += 1
            print(ans[i],ans[j],i,j)
print(count)
s=input()
n=len(s)
 
flag=True
 
for i in range(n):
  if(s[i]!=s[n-1-i]):
    flag=False
 
for i in range((n-1)//2):
  if(s[i]!=s[(n-1)//2-1-i]):
    flag=False
  if(s[(n-1)//2+1+i]!=s[n-1-i]):
    flag=False
    
if(flag==True):
  print("Yes")
else:
  print("No")
N, M = map(int,input().split())
X = N*(N-1)/2 + M*(M-1)/2
print(X)
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
  
N, M = map(int, input().split())

if N == 0:
	if M ==0:
		print(0)
	else:
		print(M)
elif M == 0:
	print(N)
else:
	print(int(ncr(N,2)+ncr(M,2)))
li=list(input())
li_rev=li
li_rev.reverse()
n=len(li)
li_slice=li[0:int((n-1)/2)]
li_slrev=li_slice
li_slrev.reverse()
n=len(li)
if li==li_rev:
    if li_slice==li_slrev:
        print('Yes')
    else:
        print('No')
else:
    print('No')
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))
n,m = [int(x) for x in input().split()]
print((n * (n-1) / 2) + (m * (m-1) / 2))
A = list(map(int, input().strip().split(' ')))
ans = A[0] * (A[0] - 1) + A[1] * (A[1] - 1)
print(ans)
n, m = map(int, input().split())
a = n * (n - 1) // 2
b = m*(m-1)//2
print(a*b)
n,m=map(int,input().split())
s=n*(n-1)*0.5+m*(m-1)*0.5
print(s)
data = input().split()
N = int(data[0])
M = int(data[1])

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