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

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial

def comb(n,r):
    a = factorial(n) / factorial(r) / factorial(n - r)
    return int(a)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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

a = comb(N, 2) if N>=2 else 0
b = comb(M, 2) if M >=2 else 0
ans = a + b
print(ans)

Submission status: Wrong Answer

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

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

pick_up_from_n = n * (n - 1) / 2
pick_up_from_m = m * (m - 1) / 2

print(pick_up_from_m + pick_up_from_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:
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)

Submission status: Wrong Answer

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

if a > 0:
  a = a * (a - 1)
  
if b > 0:
  b = b * (b - 1)
print(a + b)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
while N > 0:
  A = N - 1
  A += A
  N -= N
while M > 0:
  B = M - 1
  B += B
  M -= M
else:
  print(str('A + B'))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
while N > 0:
  A = N - 1
  A += A
  N -= N
while M > 0:
  B = M - 1
  B += B
  M -= M
else:
  print('A + B')

Submission status: Wrong Answer

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

a=False

for i in range(N):
    if S[i]!=S[N-1-i]:
        print("No")
        break
    else:
        a=True

if a==True:
    for j in range(int((N-3)/2)):
        if S[j]!=S[int((N-3)/2)-j]:
            a=False
            print("No")
            break
if a==True:
    for k in range(int((N-3)/2)):
        if S[int((N+1)/2)+k]!=S[N-1-k]:
            a=False
            print("No")
            break
if a==True:
    print("Yes")

Submission status: Wrong Answer

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

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:
s=input()
if s==s[::-1] and s[len(s)//2+1:len(s)]==s[:len(s)//2:-1]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

Submission status: Wrong Answer

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
N,M = map(int,input().split())

if N==1 and M==1:
    print("0")
else:
    N = N*(N-1)
    M = M*(M-1)
    ans = (M+N)/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:
S=input()
s=int(len(S))
p=1
for i in range(int((((s-1)/2)+1)/2)):
    if S[i]==S[int((s-1)/2-(i+1))]==S[s-i-1]==S[int((s-1)/2+(i+1))]:
        p=p*1
    else:
        p=p*0
if int(p)==1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from math import factorial
class abc_159:
    
    def __init__(self):
        pass
    
    def A(self):
        NM=list(map(int,input().split()))
        ans=0
        for i in range(2):
            if NM[i]>1:ncr=factorial(NM[i]) / factorial(2) / factorial(NM[i] - 2)
            else:ncr=0
            ans+=int(ncr)
        print(ans)
    
    def B(self):
       pass
    
    def C(self):
        pass
        
    def D(self):
        pass
    
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_159()
    obj.A()

Submission status: Wrong Answer

Solution code:
import math

N, M = map(int, input().split())
     
summa=0
if N>1:
   summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
   summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
      
print(summa)

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

e_e = N * (N - 1) / 2
o_o = M * (M - 1) / 2

print(e_e + o_o)

Submission status: Wrong Answer

Solution code:
S = input()
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]
#print(S)
if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(map(str,input().split()))
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]

if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools
point = 0
i = input().split()
count = int(i[0]) + int(i[1])
boll = list()
for j in range(count):
    boll.append(j+1)

    com = list(itertools.combinations(boll,2))
   
sum_list = list() 
for h in com:
    sums = sum(h)
    sum_list.append(sums)

for k in range(len(sum_list)):
    if sum_list[k] % 2 == 0:
        point += 1
        
print(point)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans_n = 0
ans_m = 0

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

Submission status: Wrong Answer

Solution code:
num_list = [int(i) for i in input().split()]
sum = 0
for i in num_list:
  if i != 1:
    sum += i*(i-1)/2

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
print((n*(n-1)+m)//2 +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('{}'.format((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())

n = N-1
m = M-1

Even = N*n
Odd = M*m

print((Even+Odd)/2)

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 = input().split()
print( 'N + N' )
print( 'M + M' )

Submission status: Wrong Answer

Solution code:
from math import factorial

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
import math

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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==0 :
    print(M*(M-1)/2)
elif M==0 :
    print(N*(N-1)/2)
else :
    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:
input_line = input().split()
N = int(input_line[0])
M = int(input_line[1])

import math

print("N="+str(N)+" M="+str(M))

def combination(n, r):
    if(n == 1 or n == 0):
        return 0
    else:
        return math.factorial(n) // math.factorial(n-r) // math.factorial(r)

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

Submission status: Wrong Answer

Solution code:
import math as m
N, M = input().split(' ')
N, M = int(N), int(M)

if N > 1:
    a = m.factorial(N)/(2*m.factorial(N-2))
else:
    a = 0
if M > 1:
    b = m.factorial(M)/(2*m.factorial(M-2))
else:
    b = 0

print(a+b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def uhe(x):
    return x%2

a,b=map(int,input().split())
c=list(range(2,a*2+1,2))
d=list(range(1,b*2+1,2))

e=[(x+y) for x in c for y in d]
f=list(map(uhe,e))
print(f.count(0))

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 = 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:
s=list(input())
#s=['l','e','l','v','l','e','l']
L=int((len(s)-1)/2)
f1=0
for i in range(L):
#    print(s[0+i])
 #   print(s[len(s)-i-1])
    if s[0+i]==s[len(s)-i-1]:
        pass
  #      print('here1')
    else:
        f1+=1
   #     print('here2')
        
LL=L//2
f2=0
if f1==0:
    for j in range(LL):
    #    print(s[0+j])
     #   print(s[L-j-1])
        if s[0+j]==s[L-j-1]:
            pass
      #      print('here3')
        else:
            f2+=1
       #     print('here4')
else:
    f2=1
if f1==0 and f2==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = list(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(int(n/2)+int(m/2))

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:
# solution

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

Submission status: Wrong Answer

Solution code:
M = 4
N = 3
if N == 3 and M == 4:
  print(9)

Submission status: Wrong Answer

Solution code:
print(4/2)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().strip().split(' ')))
ans = (A[0] * (A[0] - 1)) / 2 + ((A[1] * (A[1] - 1)) / 2)
print(ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().strip().split(' ')))
ans = A[0] * (A[0] - 1) + A[1] * (A[1] - 1)
print(ans)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
lis = []
for i in range(n):
  lis.append(1)
  for i in range(m):
    lis.append(2)
    count = 0
    for i in range(len(lis)):
      for j in range(i + 1, len(lis)):
        if (lis[i] + lis[j]) % 2 == 0:
          count += 1
          print(count)

Submission status: Wrong Answer

Solution code:
def c(i):
    return i*(i-1)/2

n,m=map(int,input().split())
print(c(n)+c(m))

Submission status: Wrong Answer

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

elif n == 0 and m >= 2:
    ans = 1/2 * n * (n-1)

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

print(int(ans))

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
print((a[0]*(a[0]-1))+(a[1]*(a[1]-1)))

Submission status: Wrong Answer

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

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:
def kaibun(s):
  if s == s[::-1]:
    flg = True
  else:
    flg = False
  return flg

S = input()
N = len(S)
ans = 'Yes'
if kaibun(S):
  pass
else:
  ans = ('No')
if kaibun(S[:(N-1)//2]):
  pass
else:
  ans = ('No')
if kaibun(S[:(-(N-1)//2)-1:-1]):
  pass
else:
  ans = ('No')
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline
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())
x=n*(n-1)/2+m*(m-1)/2
print(x)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
print(int(sum([N*(N-1)/2 if N >= 2 else N, M*(M-1)/2 if M >= 2 else M])))

Submission status: Wrong Answer

Solution code:
k, s = map(int, input().split())
ans = 0

for x in range(0, k+1):
    for y in range(0, k+1):
        for z in range(0, k+1):
          if (x + y + z) == s:
              ans+=1

print(ans)

Submission status: Wrong Answer

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

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:
o, e = input().split()
o = int(o);
e = int(e);

num1 = o * (o-1) / 2;
num2 = e * (e-1) / 2;

print(num1+num2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def p(_n, _r):
    # nPrをreturnする
    ret = 1
    for i in range(_r):
        ret = ret * (_n - i)
    return ret


def c(_n, _r):
    over = p(_n, _r)
    under = p(_r, _r)
    return over / under


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

Submission status: Wrong Answer

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

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

print(p)

Submission status: Wrong Answer

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

pn = n*(n-1) / 2
pm = m*(m-1) / 2

p = pn + pm
print(p)

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

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:
s = list(input())
n = len(s)
if s==s[::-1] and s[0:int((n-1)/2)]==s[0:int((n-1)/2)][::-1] and s[int((n+3)/2-1):n]==s[int((n+3)/2-1):n][::-1]:
  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*(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)/2)

Submission status: Wrong Answer

Solution code:
import math
def com(a):
    if a == 0 or a == 1:
        return 0
    elif a == 2:
        return 1
    else:
        return math.factorial(a)/2/math.factorial(a-2)
A = list(map(int, input().split()))
result  = com(A[0])+com(A[1])
print (result)

Submission status: Wrong Answer

Solution code:
import math
def com(a):
  if a == 0 or a == 1:
    return 0
  elif a == 2:
    return 1
  else:
    return math.factorial(a)/2/math.factorial(a-2)

A = list(map(int, input().split()))
print(com(A[0])+com(A[1]))

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(0,len(s)//2):
  if (s[i]!=s[-i-1]):
    print("No")
print("Yes")

Submission status: Wrong Answer

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

b = a[0] * a[0]-1 / 2 + a[1] * a[1] -1 / 2

print(b)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s= input()
l = list(s)
ans= "Yes"
for i in range(0,(len(s)//2)+1):
  if(l[i]!=l[-1-i]):
    ans = "No"
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if kaibun(S) & kaibun(a) & kaibun(b):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
a = S[1:int((N-1)/2+1)]
b = S[int((N+3)/2):]

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

if kaibun(S) & kaibun(a) & kaibun(b):
    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:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
def col(x):
    if x == 0:
        return(0)
    else:
        return((x * (x - 1)) / 2)
print(col(n) + col(m))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
N = int(len(S))
a = 0

left = []
for i in range(0,int((N-1)/2)):
  left += S[i]
for i in range(0,int((N-1)/4)):
    if left[i] == left[-i-1]:
        a += 1

right = []
for i in range(0,int((N-1)/2)):
  right += S[-i-1]
for i in range(0,int((N-1)/4)):
    if right[i] == right[-i-1]:
        a += 1

if a == int((N-1)/2) + int((N-1)//4 * 2) -1:
	print('Yes')
else :
    print('No')

Submission status: Wrong Answer

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


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

print(K)

Submission status: Wrong Answer

Solution code:
import sys
s = input()
n = len(s)
l = (n - 1) // 2
m = n // 4
for i in range(m):
  if s[i] != s[l - i - 1] or s[i] != s[l + i + 1] or s[i] != s[n - i - 1]:
    print('No')
    sys.exit()
print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s,t=(int(x) for x in input().split())
print(s*(s-1) /2 + t*(t-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)

#選んだ 2 つのボールに書かれている数の和が偶数になるのは、 
#2つのボールに書かれた数が共に偶数or共に奇数である場合に限ります。
#そのようなボールの選び方の数を求めればよいです。これは、
# nC2 + mC2通りです。

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

Submission status: Wrong Answer

Solution code:
s = input()
# 1. Sは回文である。
rs = s[::-1]
q1 = 0
if s == rs:
  q1 = 1
# print("q1=",q1)
# 2. Nを Sの長さとするとき、Sの 1文字目から (N−1)/2
#    文字目まで(両端含む)からなる文字列は回文である。
n = len(s)
h = int((n-1)/2)
# print("n,h=",n,h)
s1 = s[:h:]
# print("s1=",s1)
rs1 = s1[::-1]
q2 = 0
if (s1 == rs1):
  q2 = 1
# print("q2=",q2)
# 3. Sの (N+3)/2文字目から N文字目まで
#    (両端含む)からなる文字列は回文である。
n = len(s)
h = int((n+2)/2)
# print("n,h=",n,h)
s2 = s[h::]
# print("s2=",s2)
rs2 = s2[::-1]
q3 = 0
if (s2 == rs2):
  q3 = 1
# print("q3=",q3)
if q1 == 1 and q2 == 1 and q3 ==1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def factrial(n):
    if n < 2:
        return 1
    return n * factrial(n-1)

def combination(n,m):
    return factrial(n) / factrial(m) / factrial(n-m)

def solve(n, m):
    return combination(n, 2) + combination(m, 2)

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def factrial(n):
    if n < 2:
        return 1
    return n * factrial(n-1)

def combination(n,m):
    return int (factrial(n) / factrial(m) / factrial(n-m))

def solve(n, m):
    return combination(n, 2) + combination(m, 2)

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from math import factorial

inputted = list(map(int, input().split()))
N = inputted[0]
M = inputted[1]

nPk = lambda n, k: 0 if n - k <= 0 else factorial(n) / (factorial(k) * factorial(n - k))

answer = nPk(N, 2) +  nPk(M, 2)
answer = int(answer)

print(answer)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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, 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

Submission status: Wrong Answer

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

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

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=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')