TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
import math
a=0
b=3
answer = 0


if a != 0:
    answer += math.factorial(a) / (math.factorial(a - 2)*2)


if b != 0:
    answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))

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

answer = 0


answer += math.factorial(a) / (math.factorial(a - 2)*2)


answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))

import math
a=4
b=3
answer = 0


if a > 1 :
    answer += math.factorial(a) / (math.factorial(a - 2)*2)


if b > 1:
    answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))

import math
a=2
b=2
answer = 0


if a > 1 :
    answer += math.factorial(a) / (math.factorial(a - 2))


if b > 1:
    answer += math.factorial(b) / (math.factorial(b - 2))

print(int(answer))

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


if a > 1 :
    answer += math.factorial(a) / (math.factorial(a - 2)*2)


if b > 1:
    answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))

import math
a,b=map(int, input().split())
answer = 0

if a > 1 :
    answer += math.factorial(a) / (math.factorial(a - 2)*2)

if b > 1:
    answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
l=int(input())
ans=0
sum=0
 
for i in range(l):
 for j in range(l-i):
   sum=i*j*(l-i-j)
   if ans<sum:
      ans=sum
print(ans)

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

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

print(str(a))
  

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
m = int(input())
sum = 0
sum = n*(n-1)/2 + m*(m-1)/2
print(sum)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

import math
character = input()
re_character = character[::-1]
 
num = int(len(character))
middle = math.ceil(num/2.0)

if (character[0:num] == re_character[0:num]):
  if (character[0:middle-1] == re_character[middle:num]):
      print("Yes")
else:
  print("No")



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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b = map(int, input().split())

k = 0

if a%2 == 0:
  k = k + a*(a-1)/2
else:
  k = k
  
if b%2 == 0:
  k = k + b*(b-1)/2
else:
  k = k
  
print(k)


a, b = map(int, input().split())
 
k = 0
 
if a != 1:
  k = k + a*(a-1)/2
else:
  k = k
  
if b != 1:
  k = k + b*(b-1)/2
else:
  k = k
  
print(int(k))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from scipy.special import comb
n, m = map(int, input().split())
print(n * m + comb(n, 1, exact=True) + comb(m, 1, exact=True))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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
  

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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
n, m = input().split(" ")
 
print(comb(n, 2) + comb(m, 2))

L = int(input())
print(L/3 * L/3 * L/3)

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

n, m = input().split(" ")

return comb(n, 2) + comb(m, 2)

import math

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

raw = input()
n, m = [int(i) for i in raw.split(" ")]
 
print(comb(n, 2) + comb(m, 2))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
c = 0
if n >= 2:
  c += n*(n-1) /2
if m >= 2:
  c += n*(n-1) /2
print(c)

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

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
c = [A.count(i + 1) for i in range(N)]
ans = [c[i] * (c[i] - 1) // 2 for i in range(N)]
s = sum(ans)

for val in A:
  m = c[val - 1] - 1
  print(s - m)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int,input().split())

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

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,m = (int(x) for x in input('').split(''))
sum = (n * (n - 1) / 2) + (m * (m - 1) / 2)
print(sum)

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

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)

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


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())
print(n*(n-1)/2+m*(m-1)/2)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
i = list(map(int, input().split()))

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

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

print(p)

i = list(map(int, input().split()))

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

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

print(int(p))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main():
 n,m = map(int,input().split())
 print(n * (n - 1) / 2 + m * (m - 1) / 2)
main()

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)


inputText1 = input()
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)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int,input().split())

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

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())

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

print(ans)

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

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

print(int(ans))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
				
def factorial(number):
	if number>2:
		return number*factorial(number-1)
	elif not number==0:
		return number
	else:
		return 1
def choose2(number):
	if number>=2:
		return number*(number-1)/2
	else:
		return 0
N = int(input())
klist = input()
k = []
for x in range(N-1):
	k.append(int(klist[:klist.index(" ")]))
	klist = klist[klist.index(" ")+1:]
k.append(int(klist))
valArr = list(set(k))
occurence = []
for i in range(len(valArr)):
	occurence.append(0)
for j in range(N):
	for x in range(len(valArr)):
		if k[j]==valArr[x]:
			occurence[x]+=1
for ball in range(len(k)):
	ans = 0
	kArray = occurence[:len(occurence)]
	for index in range(len(valArr)):
		if valArr[index]==k[ball]:
			kArray[index]-=1
			break;
	for time in kArray:
		ans+=choose2(time)
	print(int(ans))



x = input()
N = int(x[:x.index(" ")])
M = int(x[x.index(" ")+1:])
def factorial(number):
	if number>2:
		return number*factorial(number-1)
	elif not number==0:
		return number
	else:
		return 1
def choose2(number):
	if number>=2:
		return factorial(number)/(2*factorial(number-2))
	else:
		return 0

print(int(choose2(N)+choose2(M)))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
print((N*(N-1)/2) + (M*(M-1)/2))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split(' '))

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

print(cnt)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
import itertools as it


i = input().split()



n = i[0]
m = i[1]
nc = it.combinations(range(n),2)
mc = it.combinations(range(m),2)

print(len(list(nc) + list(mc)))

import math
import itertools as it


i = input().split()



n = int(i[0])
m = int(i[1])
nc = it.combinations(range(n),2)
mc = it.combinations(range(m),2)

print(len(list(nc) + list(mc)))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

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




if N >= 2:
  Nf = math.factorial(N)//(math.factorial(N-2)*2)
else:
  Nf = 0

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



import math

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




Nf = math.factorial(N)/math.factorial(N-2)/2


Mf = math.factorial(M)/math.factorial(M-2)/2

ans = int(Nf + Mf)

print(ans)

import math

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




if N >= 2:
  Nf = math.factorial(N)//(math.factorial(N-2)*2)
else:
  Nf = 0

if M >= 2:
  Mf = math.factorial(M)//(math.factorial(M-2)*2)
else:
  Mf = 0
ans = int(Nf + Mf)
print(ans)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,input().split())
s=N*(N-1)/2+M*(M-1)/2
print(s)

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
m, n = map(int,input().split())
print( m*(m-1)/2 + n*(n-1)/2 )


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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N,M=map(int,input().split())
if N==0:
  a=0
else:
  a = comb(N,2)
if M==0:
  b=0
else:
  b = comb(M,2)
print(a+b)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,input().split())

pattern_even=(N-1)*N/2
pattern_odd=(M-1)*M/2

return (pattern_even+pattern_odd)

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

pattern_o=(N-1)*N/2
pattern_e=(M-1)*M/2

print(int(pattern_o+pattern_e))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())

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

print(ans)

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

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

print(int(ans))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = (int(i) for i in input().split());
res = (n * (n - 1) + m * (m - 1)) / 2;
print(res);

n, m = (int(i) for i in input().split());
res = (n * (n - 1) + m * (m - 1)) // 2;
print(res);

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

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

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)

print('a')

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

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

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)

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)

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


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

i = list(map(int, input().split()))
n = i[0]
m = i[1]

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

print(ans_n + ans_m)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from sys import stdin,setrecursionlimit
n,m = map(int,stdin.readline().rstrip().split())
print(n*(n-1)+m*(m-1))

from sys import stdin,setrecursionlimit
n,m = map(int,stdin.readline().rstrip().split())
print(n*(n-1)//2+m*(m-1)//2)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# ABC159
# A The Number of Even Pairs
import math
n, m = map(int, input().split())
if n < 2:
    x = 0
else:
    x = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))

if m < 0:
    y = 0
else:
    y = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))

print(x+y)


# ABC159
# A The Number of Even Pairs
import math
n, m = map(int, input().split())
if n < 2:
    x = 0
else:
    x = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))

if m < 2:
    y = 0
else:
    y = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))

print(x+y)
  

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from scipy.misc import comb

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

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


print(int(ans))

import math

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

def comb(n, r):
    if n <= 1:
        return 0
    return perm(n, r)//math.factorial(r)

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

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


print(int(ans))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m =map(int,input().split())
ans=n*(n-1)+m*(m-1)
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
ans = N*(N-1)/2 + M*(M-1)/2
print(ans)


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input())
ans = n*(n-1)/2 + m*(m-1)/2
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M = map(int,input().split())

ans = 0

if N > 1 and M > 1:
  ans = N*(N-1)//2 + M*(M-1)//2
elif N == 0 and M > 1:
  ans = M*(M-1)//2
elif N > 1 and M == 0:
  ans = N*(N-1)//2
  
print(ans)

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

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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=list(map,int().split())
print(n*(n-1)//2+m*(m-1)//2)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
n,k = input().split()
n = int(n) 
k = int(k)
se = 0

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

import math
def fac(k):
    return(math.factorial(k)//(math.factorial(k-2)*2))


n,k = input().split()
n = int(n) 
k = int(k)
se = 0

if k > 1:
    if n > 1:
        se = fac(k) + fac(n)
    else:
        se= fac(k)
else:
    if n > 1:
        se =  fac(n)
    else:
        se = 0
print(se)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M=list(map(int,input().split()))
print(N*(N-1)/2+M*(M-1)/2)

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

Verdicts: Wrong Answer

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
a=int(input())
c=len(a)
b=a[:(c-1)//2]
d=a[(c+3)//2:]
if a==a[::-1] and b==b[::-1] and d==d[::-1]:
  print("Yes")
else:
  print("No")

a=input()
c=len(a)
b=a[:(c-1)//2]
d=a[(c+3)//2-1:]
if a==a[::-1] and b==b[::-1] and d==d[::-1]:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
inp=input()
if inp[2]==inp[3] and inp[4]==inp[5]:
  print("Yes")
else:
  print("No")

n = int(input())
l=[]
for i in range(n): 
    if ((i%3)!=0)  and ((i%5)!=0):
        l.append(i)
print(sum(l))

import sys
X=input()
n=len(X)
if n%2==0:
    print("No")
    sys.exit()
ans="No"
def check(s): 
    return s == s[::-1] 
ans="No"
if check(X):
    if check(X[0:int((n-1)/2)]):
        if check(X[int(((n+3)/2)-1):]):
            ans="Yes"
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
akasaka

# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s, )


def solve(s, ):

    n = len(s)
    ma = (n - 1) // 2 
    mb = (n + 3) // 2

    def test_text(text):
        if debug:
            log("text=%s" % text)
        n = len(text) 
        m = (n - 1) // 2
        result = True
        for i in range(m+1):
            if debug:
                log('(s[%d], s[%d])=(%s, %s)' % (i, -(i+1), s[i], s[-(i+1)]))
            if text[i] != text[-(i+1)]:
                result = False
                break

        return result

    if debug:
        log("s =%s" % s)
        log("ma=%d, sa=%s" % (ma, s[:ma]))
        log("mb=%d, sb=%s" % (mb, s[mb-1:]))

    result1 = test_text(s) 
    result2 = test_text(s[:ma]) 
    result3 = test_text(s[mb-1:]) 
    if debug:
        log('result1=%s, result2=%s, result3=%s' % (result1, result2, result3))

    result  = 'No'
    if result1 and result2 and result3:
        result = 'Yes'


    
    return result
    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Verdicts: Runtime Error

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
"""
"""


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


def read_int(): return int(input())


def read_array(): return list(map(int, input().split(' ')))


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


def solve(string):
    if string != string[::-1]:
        return False
    first = string[0:(len(string) - 1) // 2]
    if first != first[::-1]:
        return False
    second = string[0:(len(string) + 3) // 2]
    if second != second[::-1]:
        return False
    return True


string = input()
if solve(string):
    print('Yes')
else:
    print('No')


"""
"""


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


def read_int(): return int(input())


def read_array(): return list(map(int, input().split(' ')))


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


def solve(string):
    if string != string[::-1]:
        return False
    first = string[0:(len(string) - 1) // 2]
    if first != first[::-1]:
        return False
    second = string[(len(string) + 2) // 2:]
    if second != second[::-1]:
        return False
    return True


string = input()
if solve(string):
    print('Yes')
else:
    print('No')


Verdicts: Wrong Answer

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
s = list(input())
a = (len(s) - 1)/2
b = s[:a]
c = b[::-1]
if b == c:
  print('Yes')
else:
  print('No')

s = list(input())
s_reverse = s[::-1]
a = int((len(s) - 1)/2)
b = s[:a]
c = b[::-1]
if b == c and s == s_reverse:
  print('Yes')
else:
  print('No')

Verdicts: Runtime Error

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
def main():
    S = input()
    N = len(S)

    if check(S[:(N-1)//2]) and check(S[(N+3)//2-1:]):
        print("Yes")
    else:
        print("No")


def check(s):
    print(s)
    for i in range(len(s) // 2):
        c1 = s[i]
        c2 = s[-(i+1)]
        if c1 != c2:
            return False
    return True

main()

def main():
    S = input()
    N = len(S)

    if check(S) and check(S[:(N-1)//2]) and check(S[(N+3)//2-1:]):
        print("Yes")
    else:
        print("No")


def check(s):
    #print(s)
    for i in range(len(s) // 2):
        c1 = s[i]
        c2 = s[-(i+1)]
        if c1 != c2:
            return False
    return True

main()

Verdicts: Wrong Answer

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
s=input()
n=len(s)
def p(s):
  return s==s[::-1]
if p(s[:(n-1)//2]):
  if p(s[(n+1)//2:]):
    print('Yes')
   else:
    print('No')
print('No')

s=input()
n=len(s)
def p(s):
  return s==s[::-1]
if p(s[:(n-1)//2]):
  if p(s[(n+1)//2:]):
    print('Yes')
    exit()
   else:
    print('No')
    exit()
print('No')

s=input()
n=len(s)
def p(s):
  return s==s[::-1]
if p(s):
  if p(s[:(n-1)//2]):
    if p(s[(n+1)//2:]):
      print('Yes')
      exit()
    else:
      print('No')
      exit()
print('No')

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
s = list(input())
x = len(s)
a = s[:x//2]
b = s[x//2+1:]
b.reverse()
y = len(a)

c = a[:y//2]
d = a[y//2+1:]
d.reverse()
e = b[y//2+1:]
e.reverse()
f = b[:y//2]

print(c, d)
print(e,f)
ans = "No"
if (x+1)%4 == 0:
    if a == b:
        if c == d:
            if a == b:
                ans = "Yes"

print(ans)


s = list(input())
l = len(s)
ans = "No"
if s == s[::-1] and s[:(l-1)//2] == s[:(l-1)//2][::-1] and s[(l-1)//2+1:] == s[(l-1)//2+1:][::-1]:
    ans = "Yes"
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
S=input()
i=0
kot=[]
for a in S:
    kot.append(a)
tok=list(reversed(kot))


for a in range(len(kot)):
    if kot[a]==tok[a]:
        i=0
    else:
        print("No")
        i=1
        break
if i==0:
    for a in range(int((len(kot)-1)/2)):
        if kot[a]==tok[int((len(kot)-1)/2)-a-1]:
            i=0
        else:
            print("No")
            i=1
            break
print(i)
if i==0:
        for a in range(int((len(kot)-1)/2)):
            if kot[int((len(kot)+3)/2)+a-1]==tok[-a-1]:
                i=0

            else:
                print("No")
                i=1
                break
print(i)
if i==0:
    print("Yes")


S=input()
i=0
kot=[]
for a in S:
    kot.append(a)
tok=list(reversed(kot))

print(tok)
print(kot)
for a in range(len(kot)):
    if kot[a]==tok[a]:
        i=0
    else:
        print("No")
        i=1
        break
if i==0:
    for a in range(int((len(kot)-1)/2)):
        if kot[a]==tok[int((len(kot)-1)/2)-a-1]:
            i=0
        else:
            print("No")
            i=1
            break
print(i)
if i==0:
        for a in range(int((len(kot)-1)/2)):
            if kot[int((len(kot)+3)/2)+a-1]==tok[-a-1]:
                i=0

            else:
                print("No")
                i=1
                break
print(i)
if i==0:
    print("Yes")


S=input()
i=0
kot=[]
for a in S:
    kot.append(a)
tok=list(reversed(kot))

for a in range(len(kot)):
    if kot[a]==tok[a]:
        i=0
    else:
        print("No")
        i=1
        break
if i==0:
    for a in range(int((len(kot)-1)/2)):
        if kot[a]==tok[int((len(kot)-1)/2)-a-1]:
            i=0
        else:
            print("No")
            i=1
            break

if i==0:
        for a in range(int((len(kot)-1)/2)):
            if kot[int((len(kot)+3)/2)+a-1]==tok[-a-1]:
                i=0

            else:
                print("No")
                i=1
                break

if i==0:
    print("Yes")


Verdicts: Wrong Answer

Wrong Answer

Accepted