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

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

a,b=map(int,input().split())
e_2 =  combinations_count(a,2)

Submission status: Wrong Answer

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

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

print(a)

Submission status: Wrong Answer

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

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

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    return (out)

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, raw_input().split())

    ##delete
    #n = 0
    #m = 3
    ##

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

    print(out)

Submission status: Wrong Answer

Solution code:
def main():
    #n, m = map(int, raw_input().split())

    ##delete
    n = 0
    m = 3
    ##

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

    print(out)

Submission status: Wrong Answer

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

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=(int(x) for x in input('Enter N and M:').split())
print(N)
print(M)
if not 0 <= N <= 100:
    print('N is not appropreate')
elif not 0 <= M <= 100:
    print('M is not appropreate')
elif N+M < 2:
    print('num of ball is too small')
else:
    print(int((N*(N-1)+M*(M-1))/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:
import math

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

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

if N < 2:
  N = 0
elif N == 2:
  N == 1
else:
  N = comb(N,2)

if M < 2:
  M = 0
elif M == 2:
  M = 1
  
ans = N + M

print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
#ABC159A
import sys
import itertools
n, m = map(int, sys.stdin.readline().split())
#print(n, m)
L = [0 for _ in range(n)] + [1 for _ in range(m)]
L = list(itertools.combinations(L, 2))
#print(L)
total = 0
for a, b in L:
    if (a+b)%2 ==0:
        total+=1

Submission status: Wrong Answer

Solution code:
a= str(input())
kaibun = list(a)
n = int(len(kaibun))
answer = "No"
strongn1 = int((n-1)/2)
strongn2 = int((n+3)/2)
for i in reversed(range((int((n+1)/2)),n)):
    if kaibun[i] == kaibun[n-i-1]:
        answer = "Yes"
    else:
        answer = "No"
        break;
if answer == "Yes":
    for i in range(int(strongn1/2)):
        if kaibun[i] == kaibun[strongn1-i-1]:
            answer = "Yes"
        else:
            answer="No"
            break;
if answer =="Yes":
    for i in reversed(range(strongn2,(n-strongn2)//2)):
        if kaibun[i] == kaibun[strongn2-2-i+n]:
            answer = "Yes"
        else:
            answer = "No"
print(answer)

Submission status: Wrong Answer

Solution code:
#回文であるか調べる
def kaibuncheck(S):
    N=len(S)
    N_val=N-1
    center=int((N-1)/2)
    checkpoint=0
    for i in range(center-1):
        if S[i] == S[N_val]:
            checkpoint+=1
        N_val -= 1

    if checkpoint == center-1:
        return 1
    else:
        return 0

S = list(input())
N = len(S)
N2 = int((N-1)/2)

S_start=list()
S_end=list()
for i in range(N2):
    S_start.append(S[i])
    S_end.append(S[N-1-i])

if kaibuncheck(S) == 1 and kaibuncheck(S_start) == 1 and kaibuncheck(S_end) == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

print(C1 + C2)

Submission status: Wrong Answer

Solution code:
def main():
	n, s, *a = map(int, open(0).read().split())
	ans = 0
	mod = 998244353
	dp = [0] * (s + 1)
	for i, x in enumerate(a):
		dp[0] += 1
		if x > s:continue
		ans += dp[s - x] * (n - i)
		ans %= mod
		dp = dp[:x] + [(dp[j] + dp[j - x]) % mod for j in range(x, s + 1)]
	print(ans)
	
if __name__=="__main__":
	main()

Submission status: Wrong Answer

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(com(N,2)+com(M,2))

Submission status: Wrong Answer

Solution code:
import sys

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

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: Wrong Answer

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

a = int(data[0])
b = int(data[1])

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

Submission status: Wrong Answer

Solution code:
N,M = [int(x) for x in input().split()]
def count(s):
  if s ==0:
      return 0
  elif s==1:
      return 1
  return (s-1)+count(s-1)
print(count(N)+count(M)-2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ls = list(input())
n = len(ls)
rvls = ls[::-1]

fh = int((n-1) /2)
fhls = ls[:fh]
rvfhls = fhls[::-1]

sh = int((n+3)/2-1)
shls = ls[sh:]
rvshls = shls[::-1]

if ls == rvls and fhls==rvfhls and shls == rvshls:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def a(N,M):
  if N<=1 and M<=1:
    return 0
  elif N<=1:
    return M*(M-1)/2
  elif M<=1:
    return N*(N-1)/2
  else:
    return N*(N-1)/2+M*(M-1)/2

Submission status: Wrong Answer

Solution code:
num = input()
print(num)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10 ** 6)


def main():
	pass

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

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

Submission status: Wrong Answer

Solution code:
a, b  = [int(i) for i in input().split()]
x = 0
x = a*(a-1)/2+b*(b-1)/2
print(x)

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=input()
L=A.split()

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

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

print(int(x+y))

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:
A=input()
L=A.split()

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

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

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

ans=int(x+y)
print(ans)

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:
inp = input().split(' ')

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

ncount = 0 if n < 2 else n*(n-1)/2
mcount = 0 if m < 2 else m*(m-1)/2

print(str(ncount + mcount))

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:
def factorial(n):
    if n > 1:
        return n * factorial(n - 1)
    else:
        return 1
        
m,n=map(int,input().split())
# n = 100
# m = 100
n_result = factorial(n)/(factorial(2) * factorial(n - 2))
m_result = factorial(m)/(factorial(2) * factorial(m - 2))

print(n_result + m_result)

Submission status: Wrong Answer

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

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

ans = 1
ans2 = 1

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

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

print(ans+ans2)

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

Submission status: Wrong Answer

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

ans=  0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def Grid2Graph(S):
    h = len(S)
    w = len(S[0])
    graph = [[] for _ in range(h * w)]
    for i in range(h):
        for j in range(w):
            for ni, nj in [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]:
                if 0 <= ni < h and 0 <= nj < w:
                    graph[w * i + j].append((S[ni][nj], w * ni + nj))
    return graph

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

from functools import lru_cache
print(0)

Submission status: Wrong Answer

Solution code:
from itertools import combinations
ne, no = map(int,input().split())
even, odd = [i for i in range(1,2*(ne+1)) if i % 2 == 0], [i for i in range(1,2*no) if i % 2 != 0]
lst = even + odd
c = 0
for i in combinations(lst,2):
    print(i)
    if sum(i) % 2 == 0:
        c += 1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sum = 0
n, m = (int(x) for x in input().split())
if (n != 1):
  sum = (n * (n - 1) / 2) 
if (m != 1):
  sum = sum + (m * (m - 1) / 2)
print(sum)

Submission status: Wrong Answer

Solution code:
S = list(input())
N = len(S)
S_mae = S[:int((N-1)/2)]
S_usi = S[int((N+1)/2):]

if (S_mae[:len(S_mae)] == S_mae[::-1]) and (S == S[::-1]):
    print("Yes")
else:
    print("No")
    
#print(S_mae)
#print(S_usi)

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest

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

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 1"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 3"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1 1"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """13 3"""
        output = """81"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """0 3"""
        output = """3"""
        self.assertIO(input, output)


if __name__ == "__main__":
    unittest.main()

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    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:
from sys import stdin,setrecursionlimit
n,m = map(int,stdin.readline().rstrip().split())
print(n*(n-1)+m*(m-1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

S1 = S[0:N//2]
S1_1=S1[0:len(S)//4]
S1_2=S1[len(S)//4+1:]

S2= S[N//2+1:]
S2_1=S2[0:len(S)//4]
S2_2=S2[len(S)//4+1:]


if S1_1 == S1_2 and S2_1 == S2_2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
inputText1 = "3 3"
numberTextList = inputText1.split()
gNumber = numberTextList[0]
kNumber = numberTextList[1]
gNumbers = []
for gNum in range(int(gNumber)):
    gNumbers.append(2)

kNumbers = []
for kNum in range(int(kNumber)):
    kNumbers.append(1)

# print("end")
gNumbers.extend(kNumbers)
allNumbers = gNumbers
allNumbersCount = len(allNumbers)
successCount = 0
for num1 in range(len(allNumbers)):
    for num2 in range(len(allNumbers)):
        if num1 + num2 + 1 == allNumbersCount:
                break
        # print(num1)

        if (allNumbers[num1] + allNumbers[num1 + num2 + 1]) % 2 == 0:
            successCount += 1








print(successCount)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
def cmb1(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    if n == 1:
        result = 0

    return result


def cmb2(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])


    return result


ans = (cmb2(a, 2))+(cmb1(b, 2))
if a == 1 & b == 1:
    print('0')
elif a == 0:
    print(b)
elif b == 2:
    print('1')
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
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
x = a[0]
y = a[1]
z = 1 or 0
if(x is not z):
    c = (combinations_count(x, 2))
else:
    c = 0
if(y is not z):
    d = (combinations_count(y, 2))
else:
    d = 0
print(c + d)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
def cmb1(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    if n == 1:
        result = 0

    return result


def cmb2(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])


    return result


ans = (cmb2(a, 2))+(cmb1(b, 2))
if a == 1 & b == 1:
    print('0')
elif a == 0:
    print(b)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
N = len(S)
#全体が回文である条件
S1 = S[:(N-1)//2]
S2 = S[((N+3)//2)-1:]
S2.reverse()
#半分が回文である条件
S3 = S[:(N-3)//4]
S4 = S[(N+1)//4:(N-1)//2]
S4.reverse()

S5 = S[(N+1)//2:(3*N-1)//4]
S6 = S[(3*N+3)//4:]
S6.reverse()

if S1 ==S2 and S3 ==S4 and S5 == S6:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from math import factorial

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

result = 0
# 偶数
if N == 2:
    result += 1
if N > 2:
    result += int(factorial(N) / factorial(2) / factorial(N - 2))

# 奇数
if M == 2:
    result += 1
if M > 2:
    result += int(factorial(M) / factorial(2) / factorial(M - 2))


print(result)

Submission status: Wrong Answer

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

s=N*M
m=N+M

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

print(d-s)

Submission status: Wrong Answer

Solution code:
a,b = input().split()
a = int(a)
b = int(b)
A = (a*a-1)/2
B = (b*b-1)/2
if a <= 2 and b <= 2:
  print(0)
elif a <=2 and b >= 1:
  print(B)
elif a >= 1 and b <= 2:
  print(A)
elif a>= 1 and b >=1:
  print(A+B)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
def cmb1(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    if n == 1:
        result = 0

    return result


def cmb2(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])


    return result


ans = (cmb2(a, 2))+(cmb1(b, 2))
if a == 1 & b == 1:
    print('0')
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
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
x = a[0]
y = a[1]
z = 1
if(x is not z):
    c = (combinations_count(x, 2))
else:
    c = 0
if(y is not z):
    d = (combinations_count(y, 2))
else:
    d = 0
print(c + d)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = input().split()
a = int(a)
b = int(b)
A = (a*a-1)/2
B = (b*b-1)/2
if a == 1 and b == 1:
  print(0)
elif a ==1 and b >= 1:
  print(B)
elif a >= 1 and b == 1:
  print(A)
elif a>= 1 and b >=1:
  print(A+B)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
def cmb1(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    if n == 1:
        result = 0

    return result


def cmb2(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])


    return result


ans = (cmb2(a, 2))+(cmb1(b, 2))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
o =input().split()
(n,m) = map(int,o)
a = []
b = []
count = 0
for i in range(n):
    a.append(1)
print(a)
for j in range(m):
    b.append(2)
print(b)
for k in a:
    for p in b:
        if (k + p) % 2 == 0 or (k+k) % 2 == 0 or (p+p)%2==0:
            count = count + 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
def cmb(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    if n == 1:
        result = 0

    return result


ans = (cmb(a, 2))+(cmb(b, 2))
print(ans)

Submission status: Wrong Answer

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

count = 0
for i in range(a[0]):
  count += i
 
for i in range(a[1]):
  count += i
  
print(count)

Submission status: Wrong Answer

Solution code:
from scipy.misc import comb

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

Submission status: Wrong Answer

Solution code:
S=str(input())
import sys
t=0
lista=[]
for i in range(99):
  try:
    lista.append(S[i])
    t=t+1
  except IndexError:
    break
u=t//2
v=u//2+1
p=1
for i in range(v):
  if S[i]==S[u-i-1] and S[u-i+1]==S[u+i+1] and S[u+i+1]==S[t-1-i]:
    p=p*1
  else:
    print ('No')
    sys.exit()
print ('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
list_a = []
count = 0

for i in range(0, N):
    list_a.append(S[i])

for i in range(0, N):
    if list_a[i] == list_a[N-1-i]:
        count += 1
    else:
        pass

for j in range(0, int(N//2)):
    if list_a[j] == list_a[int((N-3-j)/2)] and list_a[int((N+1+j)/2)] == list_a[N-1-j]:
        count += 1
    else:
        pass

if count > N:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math

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

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

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

print(combinations_count(a, 2) + combinations_count(b, 2))

Submission status: Wrong Answer

Solution code:
a, b=input().split()
a=int(a)
b=int(b)
if a<=1 and b<=1:
  print("0")
else:
  if a<=1:
    k=b*(b-1)//2
    print(k)
  elif b<=1:
    k=a*(a-1)//2
    print(k)
  else:
    k=a*(a-1)*b*(b-1)//4
    print(k)

Submission status: Wrong Answer

Solution code:
import math
n,m = map(int,input().split())
n2 = n*(n-1)/2
m2 = m*(m-1)/2

print((n2+m2)//1)

Submission status: Wrong Answer

Solution code:
# Program to check if a string is palindrome or not

S = str(input())

# make it suitable for caseless comparison
S = S.casefold()

# reverse the string
rev_str = reversed(S)

# check if the string is equal to its reverse
if list(S) == list(rev_str):
   print("Yes")
else:
   print("No")

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

Submission status: Wrong Answer

Solution code:
import math
H, W = map(int, input().split())

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

print(a+b)

Submission status: Wrong Answer

Solution code:
def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True
s = str(input())
if is_kaibun(s)==True:
    ku = int((len(s)-1)/2)
    news = s[:ku]
    if len(news) ==1:
        print("Yes")
    else:
        a = 0
        for a in range(len(news)//2):
            if news[a] != news[-a-1]:
                print("No")
                break
        ks = int((len(s)+1)/2)
        news = s[ks:]
        b = 0
        for b in range(len(news)//2):
            if news[b] != news[-b-1]:
                print("No")
                break
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
N,M=map(int,input().split())
def kumiawase(n):
    if n>2:
        a=math.factorial(n)
        r=math.factorial(2)
        return a / (r*math.factorial(n-2))
    return 0

print(int(kumiawase(M)+kumiawase(N)))

Submission status: Wrong Answer

Solution code:
import math
H, W = map(int, input().split())

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

Submission status: Wrong Answer

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

list1 = []
list2 = []


total1 = 0

count = 0

for i in range(1, N + 1):
    list1.append(i * 2)

for q in range(1, M + 1):
    list2.append((q * 2) - 1)

for w in list1:
    for e in list2:
        total = w + e
        if total % 2 == 0:
            count += 1

Submission status: Wrong Answer

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