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: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())

sum = 0

if n > 1:
    sum += 2 ** (n // 2)
else:
    sum += 1

if m > 1:
    sum += 2 ** (m // 2)
else:
    sum += 1

print(sum)

Submission status: Runtime Error

Solution code:
import math
def combinations(n ,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
n, m = map(int, input().split())
print(combinations(n, 2) + combinations(m , 2))

Submission status: Runtime Error

Solution code:
from scipy.special import comb

n, m = map(int, input().split())
print(comb(n, 2, exact=True) + comb(m , 2, exact=True))

Submission status: Runtime Error

Solution code:
import math
N,M = map(int, input().split())
def combinations_count(n,r):
	return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))
print(combinations_count(N,2) + combinations_count(M,2))

Submission status: Runtime Error

Solution code:
import math
N,M = map(int, input().split())
def combinations_count(n,r):
	return math.fractorial(n) / (math.fractorial(n-r)*math.fractorial(r))
print(combinations_count(N,2) + combinations_count(M,2))

Submission status: Runtime Error

Solution code:
L = float(input())

ans = float((L/3)**3)

print(ans)

Submission status: Runtime Error

Solution code:
from math import factorial
N, M = map(int,input().split())
combination = factorial(N) / factorial(2) / factorial(N-2) + factorial(M) / factorial(2) / factorial(M-2)
print(int(combination))

Submission status: Runtime Error

Solution code:
from scipy.special import comb

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

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())

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

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
sum_N = (N-1)*N/2
sum_M=(M-1)*M/2
sum_all = sum_N + sum_M
print(int(sum_all))

Submission status: Runtime Error

Solution code:
from math import factorial

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


def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))


n_cmb = combinations_count(n, 2)
m_cmb = combinations_count(m, 2)

print(n_cmb + m_cmb)

Submission status: Runtime Error

Solution code:
from operator import mul
from functools import reduce

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


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


a = cmb(n, 2)
b = cmb(m, 2)

print(a + b)

Submission status: Runtime Error

Solution code:
from scipy.special import comb

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*n
for i in a:
    cnt[i] += 1
total = 0
for i in cnt:
    total += i * (i-1) // 2
for i in a:
    print(total - (cnt[i] - 1)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
def choose2(n):
    return n * (n - 1) // 2
total = 0
for i in range(1,n+1):
    total += choose2(a.count(i))
for i in range(n):
    ans[i] = total
    ans[i] -= a.count(a[i]) - 1
print(*ans[:], sep='\n')

Submission status: Runtime Error

Solution code:
s = input()
ans = True
def isPalindrome(string):
    return s == s[::-1]
if not isPalindrome(s):
    ans = Flase
if not isPalindrome(s[:len(s)//2]):
    ans = False
if not isPalindrome(s[len(s)//2+1:]):
    ans = False
if ans:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

else:
    print(int(math.factorial(N)/math.factorial(2)/math.factorial(N-2) +  math.factorial(M)/math.factorial(2)/math.factorial(M-2)))

Submission status: Runtime Error

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

ans=n*(n-1)/2#nC2の順列を利用（n個の球から2個の玉を選択）
ans+=m*(m-1)/2

print(int(ans))

Submission status: Runtime Error

Solution code:
from scipy.special import comb

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

print(comb(N,2, exact=True) + comb(M,2,exact=True))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

# 各数字の個数を格納
dict = {}
for a in A:
    if a in dict:
        dict[a] += 1
    else:
        dict[a] = 1

# k番目の値を除いたlistで同じ数字を引く回数を出力
memo = {}
for k in range(N):
    ans = 0
    m = A[k]
    if m in memo.keys():
        ans = memo[m]
    else:
        dict_work = dict.copy()
        dict_work[m] -= 1
        for d in dict_work.values():
            if d > 1:
                ans += (d * (d - 1)) // 2
        memo[m] = ans
    print(ans)

Submission status: Runtime Error

Solution code:
str1 = input()
n = len(str1)

 
 
if str1 != str1[::-1]:
	print("No")
else:
  	if str1[:((n-1)/2)] != str1[:((n-1)/2)][::-1]:
    	print("No")
    else:
    	if str1[((n+3)/2):n] != str1[((n+3)/2):n][::-1]:
        	print("No")
        else:
        	print("Yes")

Submission status: Runtime Error

Solution code:
str1 = input()
n = len(str1)
m = (n-1)/2
o = (n+3)/2


if str1 != str1[::-1]:
	print("No")
else:
  	if str1[:m] != str1[:m][::-1]:
    	print("No")
    else:
    	if str1[o:n] != str1[o:n][::-1]:
        	print("No")
        else:
        	print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M = int(input().split())  ##Nが偶数　Mが奇数
all = N+M
ans = (N-1)*N/2
ans =ans + (M-1)*M/2
print(ans)

Submission status: Runtime Error

Solution code:
from scipy.special import comb
n,m = map(int,input().split())
r = 2
if m >=2:
    a = comb(n, r, exact=True)
    print(a+m)
else:
    a = comb(n, r, exact=True)
    print(a)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = [0]*(n+1)
count = 0
for el in set(a):
    temp = d[el] = a.count(el)
    count += temp*(temp-1)
count //= 2
for el in a:
    print(count - d[el] + 1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
for el in a:
    count += a.count(el)-1
count //= 2
for el in a:
    print(count - a.count(el)+1)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
L = len(a)
for el in a:
    count += a.count(el)-1
count //= 2
for el in a:
    print(count - a.count(el)+1)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(len(a)):
    count += a.count(a[i])
count /= 2
for i in range(len(a)):
    print(count - a.count(a[i])+1)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import collections

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

for k in range(n):
    # print(balls[ : k])
    # print(balls[ k + 1: ])
    arr = balls[ : k] + balls[ k + 1 : ]

    dic = collections.Counter(arr)
    total = 0
    for v in dic.values():
        total += int(v * (v - 1) / 2)
    print(total)

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;
int fact(int n)
{
  int facto=1;
  for (int i = 1; i < n+1;i++)
  {
    facto = facto * i;
  }
  return facto;
}


int main()
{
	int x,y, result;
	cin >> x >> y;
	result = (fact(x)/(2*fact(x-2))) + (fact(y)/(2*fact(y-2)));
	cout << result << endl;
	return 0;
}

Submission status: Runtime Error

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


x,y = input().split()
return ((fact(x)/(2*fact(x-2)) + (fact(y)/(2*fact(y-2)))

Submission status: Runtime Error

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


x,y = input().split()
return ((fact(x)/(2*fact(x-2)) + (fact(y)/(2*fact(y-2)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
from math import factorial

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


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

Submission status: Runtime Error

Solution code:
from math import factorial
def combination(n, r):
    return factorial(n) / (factorial(r) * factorial(n - r))

n, m = input().split()
N = int(n)
M = int(m)
if (N > 1 and M > 1):
    result = combination(N, 2) + combination(M, 2)
elif (N == 1 and M == 1):
    result = 0
elif (N == 1):
    result = combination(M, 2)
elif (M == 1):
    result = combination(N, 2)
r = int(result)
print(r)

Submission status: Runtime Error

Solution code:
from math import factorial
def combination(n, r):
    return factorial(n) / (factorial(r) * factorial(n - r))

n, m = input().split()
N = int(n)
M = int(m)
if (N > 1 and M > 1):
    result = combination(N, 2) + combination(M, 2)
elif (N <= 1):
    result = combination(M, 2)
else:
    result = combination(N, 2)
r = int(result)
print(r)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math
# スペース区切りの整数の入力
n, m = map(int, input().split())


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


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


if n >1 and m > 1:
    gu = combinations_count(n, 2)
    ki = combinations_count(m, 2)

elif n > 1 and m <= 1 :
    gu = combinations_count(n, 2)
    ki = 0

elif n <= 1 and m > 1 :
    gu = 0
    ki = combinations_count(m, 2)
    

# 出力
print("{}".format(gu+ki))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
#Nは偶数。偶数２つの場合
n = 0
for i in range(0, N):
  n = n + i - 1
 
#Mは奇数。奇数２つの場合
m = 0
for j in range(0, M):
  m = m + j - 1
 
return n + m

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

return(int(N(N-1)//2 + M(M-1)//2))

Submission status: Runtime Error

Solution code:
m, n= (int(x) for x in input().split())

from scipy.special import comb
a = comb(m, 2, exact=True)
b= comb(n,2,exact=True)

print(a+b)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from EmurateInput import input
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)
)

Submission status: Runtime Error

Solution code:
n,m = input("")
N = int(n)
M = int(m)
a = N*(N-1) if N*(N-1) >= 0 else 0
b = M*(M-1) if M*(M-1) >= 0 else 0
print(a + b)

Submission status: Runtime Error

Solution code:
n = input("")
m = input("")
N = int(n)
M = int(m)
a = N*(N-1) if N*(N-1) >= 0 else 0
b = M*(M-1) if M*(M-1) >= 0 else 0
print(a + b)

Submission status: Runtime Error

Solution code:
N = int(input(""))
M = int(input(""))
ans = 0
if N == 1 :
  if M != 1 :
    ans = M * (M - 1)
else :
  if M == 1 :
    ans = N * (N - 1)
  else :
    ans = M * (M - 1) + N * (N - 1)
print(ans)

Submission status: Runtime Error

Solution code:
L = int(input())
print(L/3 * L/3 * L/3)

Submission status: Runtime Error

Solution code:
import scipy.optimize

L = int(input())

func = lambda x: -1 * (x[0] * x[1] * (L - x[0] - x[1]))

res = scipy.optimize.minimize(func, (0.1 ,0.2), bounds = ((0, None), (0, None)), tol=1e-6)

print(-1 * res.fun)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h> 
using namespace std;
 
int main() {
	int n, m;
	cin >> n >> m;
	cout << (n*(n-1) / 2) + (m * (m-1) / 2) << "\n";
	return 0;
}

Submission status: Runtime Error

Solution code:
#200322D
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            count += 1
All = (count - N) / 2
#print(int(All))

for i in range(N):
    count = 0
    for j in range(N):
        if A[i] == A[j]:
            count += 1
    print(int(All - count + 1))

Submission status: Runtime Error

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


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

Submission status: Runtime Error

Solution code:
def combination(n, k):
	return fact(n) / ( fact(n-k) * fact(k) )

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

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

Submission status: Runtime Error

Solution code:
import numpy as np
import itertools

H, W, K = map(int, input().split())
choco = []
for i in range(H):
    choco.append([int(x) for x in list(input())])

arr = np.array(choco)

# W方向にGREEDY
count = (H-1) + (W-1)

for k in range(H):
    
    # この時点で同じ回数以上切ることが確定なら終了
    if count <= k:
        break

    # H 方向に切り込み
    for comb in itertools.combinations(range(1,H),k):

        # スライスを作っておく
        t = (None,) + comb + (None,)
        s = [slice(t[j],t[j+1],) for j in range(len(t)-1)]
        
        # print(t)
        
        sum_p = [0] * (k+1)
        
        cut = k
        
        for col in zip(*choco):
                        
            # 全 H で成立するか？
            sum_a = [sum(col[b]) for b in s]
            # print(sum_a)
            
            if any(map(K.__lt__, sum_a)):
                # 不成立
                break
            
            sum_b = [x+y for x,y in zip(sum_p, sum_a)]

            if any(map(K.__lt__, sum_b)):
                cut += 1
                sum_p = [0] * (k+1)
            else:
                sum_p = sum_b
                
                # 割った位置を記録
        
        else:
            count = min(count,cut)

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
from math import factorial

N, M = (int(s) for s in sys.stdin.split(' '))

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

Submission status: Runtime Error

Solution code:
import math

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

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)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int factorial(int n) {
  if (n == 0) {
    return 1;
  }
  return factorial(n-1)*n;
}

int combination(int n, int r) {
  if (n<r) {
    return 0;
  }
  return factorial(n)/factorial(n-r)/factorial(r);
}

int main() {
  int N,M;
  cin >> N >> M;
  
  cout << combination(N,2) + combination(M,2) << endl;
}

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import math

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

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

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

Submission status: Runtime Error

Solution code:
from math import factorial
n, m = int(input().split())
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))
print(combinations_count(n, 2)+combinations_count(m, 2))

Submission status: Runtime Error

Solution code:
from scipy.special import comb
n, m = map(int, input().split())
# nC2+mC2を求めればよい
print(comb(n, 2, exact=True) + comb(m, 2, exact=True))

Submission status: Runtime Error

Solution code:
import math
def comb(n, r):
    if(n>=r):
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
    else:
        return 0

f = open("input.txt", "r")
sys.stdin = f

m,n = map(int, input().split())
ans = comb(m, 2) + comb(n, 2)
print(ans)

Submission status: Runtime Error

Solution code:
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(m,2) if n>=2 else 0
M=cmb(n,2) if m>=2 eles 0
print(N+M)

Submission status: Runtime Error

Solution code:
import fractions

N,M=map(int,input().split())
def answer(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n=answer(N, 2)
m=answer(M, 2)
print(n+m)

Submission status: Runtime Error

Solution code:
import math

N,M=map(int,input().split())
def answer(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n=answer(N, 2)
m=answer(M, 2)
print(n+m)

Submission status: Runtime Error

Solution code:
# coding: utf-8
import itertools
A = [0]
N, S = list(map(int, input().split()))
A = A + list(map(int, input().split()))   
val = 0
for L in range(1, N+1):
  for R in range(L, N+1):
    A_ = A[L:R+1]
    lists = []
    for n in range(len(A_)):
      for comb in itertools.combinations(A_, n+1):
        lists.append(list(comb))
    for lis in lists:
      _sum = sum(lis)
      if _sum == S:
        val += 1
      if val == 998244353:
        val = 0
print(val)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l = input()
m = l[0]
n = l[1]
print(m*(m-1)/2+n*(n-1))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-2 1
import math
    
N,M=(int(x) for x in input().split())

k = N + M

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

Submission status: Runtime Error

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

k = N + M

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
N = int(input())
A = input().split()
for k in range(N):
  A_ = A.copy()
  del A_[k]
  ans = 0
  while len(A_) > 0:
    val = A_[0]
    counts = A_.count(val)
    ans += int(counts * (counts - 1) / 2)
    while True:
      try:
        A_.remove(val)
      except:
        break

  print('{}'.format(ans))

Submission status: Runtime Error

Solution code:
L=int(input())
print((L/3)**3)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n=input()
m=input()

print(n+m)

Submission status: Runtime Error

Solution code:
L = int(input())
print((L/3)**3)

Submission status: Runtime Error

Solution code:
import itertools

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

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

odd = [i for i in range(1, 100, 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)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
l = int(input())

from decimal import *
n = Decimal(l/3).quantize(Decimal('.001'))

print((l-2*n)*n*n)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
list = input().split()
n = len(list)

mae = [list[m] for m < n/2 ]

ushiro = [list[m] for m > n/2 ]

ema = [mae[n/2 - p] for p < n/2 ]

oroshi = [ushiro[-n/2 + p] for p > n/2 ]

if mae = ema and ushiro = oroshi:
  print(Yes)
  
else:
  print(No)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
li = input().split()

li[0](li[0]-1)/2 + li[1](li[1]-1)/2

Submission status: Runtime Error

Solution code:
inp = str(input())
n, m = tuple(inp.split())
m_calculation = math.factorial(m)/2**(m/2)*math.factorial(m/2)
n_calculation = math.factorial(n)/2**(n/2)*math.factorial(n/2)
print(n_calculation + m_calculation)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import math
 
N, M = map(int, input().split())
 
def comb(n, r):
    return int(math.factorial(n) / (math.factorial(n - r) * math.factorial(r)))
  
print(comb(N, 2)+comb(M, 2))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def out(m, n):
  a = m*(m-1)%2 + n*(n-1)%2
  return a

m, n = list(input())
a = out(m,n)

print(a)

Submission status: Runtime Error

Solution code:
def out(m, n):
  a = m*(m-1)%2 + n*(n-1)%2
  return a

m, n = int(input())
a = out(m,n)

print(a)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import math

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

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
print(comb(N, 2)+comb(M, 2))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import math

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
ans=0

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

Submission status: Runtime Error

Solution code:
from scipy.misc import comb
A,B=map(int,input().split())
print(int(round(comb(A,2))+round(comb(B,2))))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)
  
m, n = map(int, input().split())
print(permutations_count(m,2)+permutations_count(n,2))

Submission status: Runtime Error

Solution code:
n,m = map(int, raw_input().split())
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(int(out))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l = float(input())
print((l/3)**3)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input().split()
from scipy.special import comb
C1 = comb(s[0], 2, exact=True)
C2 = comb(s[1], 2, exact=True)

print(C1 + C2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

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

def com(n,r):
    ans1 = 1
    ans2 = 1
    tmp = r
    while r != 0:
        ans1 = ans1 * (n)
        ans2 = ans2 * r
        n -= 1
        r -= 1

    return ans1/ans2

print(int(com(N,2)+com(M,2))

Submission status: Runtime Error

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

import numpy as np

A = np.asarray(range(N))
B = np.asarray(range(M))
A = A.cumsum()
B = B.cumsum()

print(A[-1] + B[-1])

Submission status: Runtime Error

Solution code:
import sys

N = int(input()) #偶数の球の数
M = int(input()) #奇数の球の数

def combination(n,r):
    if n == 1:
        ans = 0

    if r != 1:
        ans = n/r * combination(n-1,r-1)
    elif r == 1:
        ans = n/r

    return ans

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

Submission status: Runtime Error

Solution code:
import sys

N = int(sys.argv[1]) #偶数の球の数
M = int(sys.argv[2]) #奇数の球の数

def combination(n,r):
    if n == 1:
        ans = 0

    if r != 1:
        ans = n/r * combination(n-1,r-1)
    elif r == 1:
        ans = n/r

    return ans

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

Submission status: Runtime Error

Solution code:
N,M=list(map(int,input().split()))
import math
def answer(n,r):
  return math.factorial(n)//(math.factorial(n - r) * math.factorial(r))
A=(answer(N,2))
B=(answer(M,2))
print(A+B)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

H,W,K = map(int,input().split())
choco = [input() for _ in range(H)]
num =(2**(H-1))

white_count = list()
min_div_count =10**6
for i in range(num):
    bin_str = format(i, 'b')
    zero = str()
    if H != len(bin_str):
        for i in range(H-len(bin_str)):
            zero += "0"
        bin_str = zero + bin_str
    white_count = [0 for s in bin_str if s == "1"]
    white_count.append(0)
    div_count=len(white_count)-1
    j = 0
    while j < W:
        block_count = 0
        for k in range(len(bin_str)):
            if bin_str[k] == "1":
                block_count += 1
            white_count[block_count] += int(choco[k][j])
            if white_count[block_count] > K:
                div_count +=1
                white_count = [0 for s in bin_str if s == "1"]
                white_count.append(0)
                break
        else:
            j+=1
    if min_div_count > div_count:
        min_div_count = div_count
print(min_div_count)

Submission status: Runtime Error

Solution code:
L = input(input())

print(pow(L/3,3))

Submission status: Runtime Error

Solution code:
from collections import defaultdict
from itertools import product
 
H,W,K = map(int,input().split())
S = [input() for i in range(H)]
 
C = [[int(S[i][k]) for i in range(H)] for k in range(W)]
answer = H*W #出力がこれを超えることはない
for X in product([False,True],repeat = H-1):
  M = [[0]]
  ans = sum(X)
  if ans > answer:#初期値がanswerよりも大きかったら考える必要がない
    continue
  for i,x in enumerate(X):#配列Mの作成
    if x:
      M.append([])
    M[-1].append(i+1)
  D = [0]*len(M)
  for c in C:
    for k,m in enumerate(M):
      D[k] += sum(c[i] for i in m)#k番目の要素に足していく
      #Dにどんどん代入することによってどの列まで足すことができるか算出することができる
    if any(d>K for d in D):#一つでもKを超えていたら
      ans += 1
      if ans >answer:
        break
      D = [sum(c[i] for i in m) for m in M]#超えた行について再び調査
      if any(d>K for d in D):
        ans = answer + 1
        #デフォルトanswerの結果より高い値にしてこの結果が出力にならないように設定する
        break
  answer = min(answer,ans)#あるXに対してanswerを算出(更新)
print(answer)

Submission status: Runtime Error

Solution code:
import numpy as np
N,S = map(int,input().split())
list = list(map(int,input().split()))
A = np.zeros((N+1,S+1,3),dtype=np.int16)
A[0][0][0] = 1