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



Sample input:
2 1


Sample output:
1

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
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()  # ignore trailing spaces

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

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
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()  # ignore trailing spaces

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())

f1 = s == list(reversed(s))
f2 = s[:(len(s)-1)//2] == list(reversed(s[:(len(s)-1)//2]))
f3 = s[(len(s)+2)//2:] == list(reversed(s[(len(s)+2)//2:]))
print("Yes" if all([f1, f2, f3]) else "No")

Submission status: Wrong Answer

Solution code:
s = list(input())

f1 = s == list(reversed(s))
f2 = s[:(len(s)-1)//2] == list(reversed(s[:(len(s)-1)//2]))
f3 = s[(len(s)+2)//2:] == list(reversed(s[(len(s)+2)//2:]))

print("Yes" if all([f1, f2, f3]) else "No")

Submission status: Wrong Answer

Solution code:
S = input()

flag = 0
for i in range(0, len(S), 1):
	if S[i] != S[len(S)-1-i]:
		flag = 1

for i in range(0, (len(S) + 1) //2, 1):
	if S[i] != S[len(S)//2-1-i]:
		flag = 1

if flag == 0:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#A
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from scipy.special import comb
n, m = map(int, input().split())
print(n * m + comb(n, 1, exact=True) + comb(m, 1, exact=True))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
print(M//2+N)

Submission status: Wrong Answer

Solution code:
M,N=map(int,input().split())
print(M//2+N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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(g + k)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
flag = True

if S!=S[::-1]:
    flag=False
if S[:int((N-1)/2)]!=S[:int((N-1)/2)][::-1]:
    flag=False
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ans = 0
for x in range(N):
    for y in range(M):
        if x * 2 + y % 2 == 0:
            ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
tmp = input().split(" ")
N = int(tmp[0])
M = int(tmp[1])

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

Submission status: Wrong Answer

Solution code:
# abc159_a.py
# https://atcoder.jp/contests/abc159/tasks/abc159_a

# A - The Number of Even Pairs /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# N+M個のボールがあります。各ボールには整数が 1つ書かれています。
# これらのボールに書かれている数について、
#     N個のボールに書かれている数は偶数
#     M個のボールに書かれている数は奇数
# であることがわかっています。

# これらの N+M個のボールの中から 2つ選んで、書かれた数の和が偶数になる方法の数を求めてください。
# 選ぶ順序は考慮しません。
# なお、この方法の数はボールに書かれている整数の実際の値によらないことが示せます。

# 制約
#     0≤N,M≤100
#     2≤N+M
#     入力はすべて整数である。

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N M

# 出力
# 答えを出力せよ。

# 入力例 1
# 2 1

# 出力例 1
# 1

# 例えば 3つのボールに書かれている数がそれぞれ 1,2,4であるとすると、
#     1が書かれたボールと 2が書かれたボールを選ぶと、和は奇数
#     1が書かれたボールと 4が書かれたボールを選ぶと、和は奇数
#     2が書かれたボールと 4が書かれたボールを選ぶと、和は偶数
# であるので、答えは 1です。

# 入力例 2
# 4 3

# 出力例 2
# 9

# 入力例 3
# 1 1

# 出力例 3
# 0

# 入力例 4
# 13 3

# 出力例 4
# 81

# 入力例 5
# 0 3

# 出力例 5
# 3


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = 0

    # 偶数二つ
    if N > 1:
        result += N*(N-1)/2
    # 奇数二つ
    if M > 1:
        result += M*(M-1)/2
    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2 1']
        lines_export = [1]
    if pattern == 2:
        lines_input = ['4 3']
        lines_export = [9]
    if pattern == 3:
        lines_input = ['1 1']
        lines_export = [0]
    if pattern == 4:
        lines_input = ['13 3']
        lines_export = [81]
    if pattern == 5:
        lines_input = ['0 3']
        lines_export = [3]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
print((N//2)+(M//2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
L=len(S)
ans=0
if S[:int((L-1)/2)]==S[int((L-1)/2-1)::-1] and S[int((L+3)/2-1):]==S[:int((L+3)/2-2):-1]:
    ans='Yes'
else:
    ans='No'
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#Macで実行する時
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	#print(name)
	sys.stdin = open(name)

from math import factorial

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

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

#print(combinations_count(n,2))
#print(combinations_count(m,2))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

N,M = map(int,input().split())
#Nは偶数
#Mは奇数

#偶数偶数
if N >= 2:
  Nf = math.factorial(N)//(math.factorial(N-2)*2)
else:
  Nf = 0
#奇数奇数
if M >= 2:
  Mf = math.factorial(M)//(math.factorial(M-2)*2)
else:
  Mf = 0
ans = int(Nf + Mf)

Submission status: Wrong Answer

Solution code:
s = input()
t = s[::-1]
n = len(s)

if n == 1 or n == 5:
    print('No')
    exit()
    
elif s != t:
    print('No')
    exit()

else:
    for i in range(0, (n - 1)//2, 2):
        if s[i] != t[i]:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from itertools import *


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)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
# ue,sita,uee,sitaa = 0,0,0,0
# tmpN,tmpM = 0,0
# if N != 2:
#     for i in range(N+1):
#         ue *= N-i
#         sita *= N-2-i
#     tmpN = ue/sita
# if M != 2:
#     for i in range(M+1):
#         uee *= N-i
#         sitaa *= N-2-i
#     tmpM = uee/sitaa

# print(tmpN+tmpM)

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
# ue,sita,uee,sitaa = 0,0,0,0
# tmpN,tmpM = 0,0
# if N != 2:
#     for i in range(N+1):
#         ue *= N-i
#         sita *= N-2-i
#     tmpN = ue/sita
# if M != 2:
#     for i in range(M+1):
#         uee *= N-i
#         sitaa *= N-2-i
#     tmpM = uee/sitaa

# print(tmpN+tmpM)

ans = N/2 + M/2
print(int(ans))

Submission status: Wrong Answer

Solution code:
S=list(input())
countA=0
countB=0
for i in range(3):
    if S[i]=="A":
        countA+=1
    else:
        countB+=1
if countA!=0 and countB!=0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
print(N*M-M)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
if(s==s[::-1] and s[:(n-1)//2]==s[:(n-1)//2][::-1]): print('Yes')
else: print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from math import factorial as f
def t(x): return f(x)/(f(2)*f(x-2))
n,m = [int(i) for i in input().split()]
#if m%2==0: m-=1
if m>=2 and n>=2:
    ans = t(m)+t(n)
elif n==0 and m>=2: ans = t(m)
else: #os dois iguais
    if m == 1: ans =0
    else: ans=2
    
print(int(ans))

Submission status: Wrong Answer

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

print((n//2)+(m//2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

print(floor(N*(N-1)*0.5 + M))

Submission status: Wrong Answer

Solution code:
from math import floor

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

print(floor(N*(N-1)*0.5 + M))

Submission status: Wrong Answer

Solution code:
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(even + odd)

Submission status: Wrong Answer

Solution code:
from math import factorial

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

def comb(n, k):
    return int(factorial(n) / factorial(k) / factorial(n-k))

res = 0
if M >= 2:
    res += comb(M, 2)

if N >= 2:
    res += comb(N, 2)

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
print(n*n+m*m)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(even + odd)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(a + b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
n=(a*(a-1))//2
m=(b*(b-1))//2
if b<2 and b<2:
  print(0)
elif b<2:
  print(n)
else:
  print(n+m)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#A
n,m=map(int,input().split())
if n<=1:
    n_ans=0
else:
    n_ans=n*(n-1)/2

if m<=1:
    m_ans=0
else:
    m_ans=m*(m-1)/2
    

print(n_ans+m_ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = 0

while n > 0:
    a = a + n
    n = n - 1

while m > 0:
    a = a + m
    m = m - 1

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(int(n//2 + m//2))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from scipy.misc import comb
print(int(sum(comb(list(map(int,input().split())),2, exact = False))))

Submission status: Wrong Answer

Solution code:
from scipy.misc import comb
print(sum(comb(list(map(int,input().split())),2, exact = False)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
ans1 = 0
ans2 = 0

if(N >= 2):    
    ans1 = (N*(N-1))/2
if(M >= 2):
    ans2 = (M*(M-1))/2

print(ans1+ans2)

Submission status: Wrong Answer

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

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

print(cnt)

Submission status: Wrong Answer

Solution code:
N,M = input().split()

N = int(N)
M = int(M)

even = int
odd = int
final = int

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

Submission status: Wrong Answer

Solution code:
N,M = input().split()

N = int(N)
M = int(M)

even = 0
odd = 0
final = 0

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

Submission status: Wrong Answer

Solution code:
import math
n,k = input().split()
n = int(n) 
k = int(k)
se = 0

if k > 1:
    if n > 1:
        se = math.factorial(k)//(math.factorial(k-2)*2) + math.factorial(n)//(math.factorial(n-2)*2)
    else:
        se= math.factorial(k)//(math.factorial(k-2)*2)
else:
    if n > 1:
        se =  math.factorial(n)//math.factorial(n-2)*2
    else:
        se = 0
print(se)

Submission status: Wrong Answer

Solution code:
import math
n,k = input().split()
n = int(n) 
k = int(k)
se = 0

if k > 1:
    if n > 1:
        se = math.factorial(k)//2 + math.factorial(n-1)
    else:
        se= math.factorial(k)//2
else:
    if n > 1:
        se =  math.factorial(n-1)
    else:
        se = 0
print(se)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
 
c = 0

if n!=0:
  c+= n*(n-1)/2
if m!=0:
  c+= m*(m-1)/2
print(c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
 
ln = [2*i for i in range(1, n+1)]
lm = [2*i+1 for i in range(m)]
 
c = 0
for i in ln:
  for j in lm:
    if (i+j)%2==0:
      c+=1
c+= n*(n-1)/2
c+= m*(m-1)/2
print(c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
 
ln = [2*i for i in range(1, n+1)]
lm = [2*i+1 for i in range(m)]
 
c = 0
for i in ln:
  for j in lm:
    if (i+j)%2==0:
      c+=1
for i in lm:
  for j in lm:
    if (i+j)%2==0:
      c+=1
for i in ln:
  for j in ln:
    if (i+j)%2==0:
      c+=1
print(c)

Submission status: Wrong Answer

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

ln = [2*i for i in range(1, n+1)]
lm = [2*i+1 for i in range(m)]

c = 0
for i in ln:
  for j in lm:
    if (i+j)%2==0:
      c+=1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m%2:
	print('0')
else	:
	print('1')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
result=0
n1=1
m1=1
for i in range(n-1,n+1):
    n1*=i
for k in range(m-1,m+1):
    m1*=k
print((n1+m1)/2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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