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

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):
inp = str(input())
n, m = tuple(inp.split())
m_calculation = math.factorial(m)/2**(m/2)*math.factorial(m/2)
n_calculation = math.factorial(n)/2**(n/2)*math.factorial(n/2)
print(n_calculation + m_calculation)

import math
 
def combinations_count(n, r):
    if n == 1 or n == 0:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
if __name__ == '__main__':
    a,b=map(int,input().split())
    e_2 = combinations_count(a,2)

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)

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

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


a, b = input().strip().split()
a, b = [int(a), int(b)]
s1 = a * (a - 1) / 2 
s2 = b * (b - 1) / 2 

print(s1 + s2)


a, b = map(int, input().split())
s1 = a * (a - 1) 
s2 = b * (b - 1) 

print(s1 + s2)

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


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

a, b = list(map(int, input().strip().split())) 
s1 = a * (a - 1) /2 
s2 = b * (b - 1) /2 

print(s1 + s2)


a, b = map(int, input().split())
s1 = a * (a - 1) / 2 
s2 = b * (b - 1) / 2 

print(s1 + s2)

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


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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

def check_str( ss ):
  sslen = len(ss)
  
  ccnt = 0
  for c in ss:
    if( ss[0] == c ):
      ccnt+=1
  
  if( sslen == ccnt ):
    return False
  
  return (ss[:sslen//2] == ss[sslen//2+1:][::-1])
  
s = input()

slen = len(s)

if( not check_str( s ) ):
  print( "No" )
else:
#print(s[:slen//2])
#print(s[slen//2+1:][::-1])

  s1 =  s[:slen//2]
  s2 = s[slen//2+1:]
  
  
  if( (not check_str( s1 )) or (not check_str( s2 )) ):
    print( "No" )
  else:
    print( "Yes" )

#s1 = s[:len(s)-1]

#s1



elms = input().split(" ")

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


ev =N * (N-1)
ev= ev/2 

od = M*(M-1)
od = od/2

print(int(ev+od))


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

print(int(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):
import math

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


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

import math

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


n, m = [int(i) for i in input().split()]
print(combinations_count(n,2)+combinations_count(m,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):
import math
n,m = map(int, input().split())

def c(s,t):
    if s == 0 or s == 1:
        return 0
    return math.factorial(s)/(math.factorial(s-t)*math.fatorial(t))

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

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

def c(s,t):
    if s == 0 or s == 1:
        return 0
    return math.factorial(s)/(math.factorial(s-t)*math.factorial(t))

print(int(c(n,2)+c(m,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(input().split())

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

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

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

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

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


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

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

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):
import math
N = (int(input()))
items = list(map(int,input().split()))
for i in range(len(items)):    
    rest = items[:i] + items[i+1:]
    rest_unique = sorted(set(rest))
    out = 0
    for j in rest_unique:
        cnt = sum([1 for x in rest if x == j])
        if cnt >= 2:
            out = out + math.factorial(cnt)/math.factorial(cnt-2)/2
    print(int(out))

import math
e,o = map(int,input().split())
if e < 2:
    e_cases = 0
else:
    e_cases = math.factorial(e)/math.factorial(e-2)/2
if o < 2:
    o_cases = 0
else:
    o_cases = math.factorial(o)/math.factorial(o-2)/2
print(e_cases+o_cases)

import math
e,o = map(int,input().split())
if e < 2:
    e_cases = 0
else:
    e_cases = math.factorial(e)/math.factorial(e-2)/2
if o < 2:
    o_cases = 0
else:
    o_cases = math.factorial(o)/math.factorial(o-2)/2
print(int(e_cases+o_cases))

Verdicts: Runtime Error

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):
S = input()
n = len(S)
p = (n-1)//2
q = (n+3)//2 - 1
A = S[:p]
B = S[q:]
ans = 'Yes'
for i in range(len(S)):
    if S[i] != S[-i-1]:
        ans = 'No'
for i in range(len(A)):
    if A[i] != A[-i-1]:
        ans = 'No'
for i in range(len(B)):
    if B[i] != B[-i-1]:
        ans = 'No'
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().splt())
ans=((n*(n-1))/2)+(m*(m-1))/2
print(int(ans))

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

n,m=map(int,input().splt())
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(ans)

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

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

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

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

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

inp=str(input())
N= int(inp.split()[0])
M=int(inp.split()[1])
n= abs(N)
m=abs(M)
sum_N = (N-1)*N/2
sum_M=(M-1)*M/2
sum_all = sum_N + sum_M
print(int(sum_all))

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

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

print(ans)

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

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

print(ans)

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

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

print(math.floor(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):
n , m= list(map(int,input().split()))

ans=  0

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

print(ans)



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


s= n*(n-1)//2
t= m* (m-1)//2

print(s+t)




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
 
def comb(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
a_list = list(map(int, input().split()))
a_list.append(n + 100)

for i in range(len(a_list) - 1):
  tmp_list = a_list[:]
  del tmp_list[i]
  tmp_list.sort()
  count = 0
  tmp_count = 0
  for j in range(1, len(tmp_list)):
    if tmp_list[j] == tmp_list[j - 1]:
      tmp_count += 1
    else:
      if tmp_count >= 1:
      	count += comb(tmp_count + 1, 2)
      tmp_count = 0
  print(count)
 

def checkPalindrome(str1, str2):
  for i in range(len(str1) // 2):
    if str1[i] != str2[i]:
      return False
  return True
    
s = input()
rs = ''.join(list(reversed(s)))
cri1 = checkPalindrome(s, rs)

s2 = s[:len(s) // 2]
rs2 = ''.join(list(reversed(s2)))
cri2 = checkPalindrome(s2, rs2)

s3 = s[len(s) // 2 + 1:len(s)]
rs3 = ''.join(list(reversed(s3)))
cri3 = checkPalindrome(s3, rs3)

if cri1 and cri2 and cri3:
  print('Yes')
else:
  print('No')

import math

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

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

if nums[0] <= 1 and nums[1] <= 1:
  print(0)
elif nums[1] <= 1:
  print(comb(nums[0], 2))
elif nums[0] <= 1:
  print(comb(nums[1], 2))
else:
  print(comb(nums[0], 2) + comb(nums[1], 2))


Verdicts: Runtime Error

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

if __name__ == '__main__':
    n , m = map(int, input().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):
N, M = map(int, input().split())

n = 0
for i in range(0, N):
  n = n + i - 1
 

m = 0
for j in range(0, M):
  m = m + j - 1
 
return n + m

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

n = 0
for i in range(1, N):
  n = n + i
 

m = 0
for j in range(1, M):
  m = m + j
  
print("{}".format(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 = list(int, input().split())

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


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=int(input())
m=int(input())
ans = ((n*(n-1))+(m*(m-1)))//2
print(ans)

n=int(input())
m=int(input())
k =(n*(n-1))//2
j=(m*(m-1))//2
print(j+k)

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

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

Verdicts: 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):
a,b=map(int,input().split())

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

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

print(int(a*(a-1)/2+b*(b-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=input().split()
a=int(a)
b=int(b)
print(a*(a-1)/2+(b*(b-1)/2))

a,b=input().split()
a=int(a)
b=int(b)
print(int(a*(a-1)/2+(b*(b-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 = int(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())

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

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

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


print('%d' % i)

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

S = input()
flg = False
for i in range(len(S)/2-1):
    if S[i] == S[len(S)-i]:
        flg = True
    else:
        flg = False
for i in range(((len(S)-1) /2 -1)/2):
    if S[i] == S[(len(S)-1)/2-i]:
        pass
    else:
        flg = False
for i in range((len(S)-(len(S)+3)/2 -1)/2):
    if S[i] == S[(len(S)+3)/2 -i]:
        pass
    else:
        flg = False
 
if flg:
    print('Yes')
else:
    print('No')

N,M = map(int,input().split())
print(math.factorial(N) + math.factorial(M))

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


Verdicts: 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):
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
import math
input_line = input().split()

N = int(input_line[0])
M = int(input_line[1])
counter = 0 
counter += combinations_count(N,2) 
counter += combinations_count(M,2)
        
print(counter)



import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
input_line = input().split()

N = int(input_line[0])
M = int(input_line[1])
counter = 0 
if N != 0:
    counter += combinations_count(N,2) 
if M != 0:
    counter += combinations_count(M,2)
        
print(counter)


import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
input_line = input().split()

N = int(input_line[0])
M = int(input_line[1])
counter = 0 
if N > 1:
    counter += combinations_count(N,2) 
if M > 1:
    counter += combinations_count(M,2)
        
print(counter)

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):
from scipy.misc.comb() import comb
a = list(map(int,input().split()))

print(scipy.misc.comb(a[0], 2, exact=True) + scipy.misc.comb(a[1], 2, exact=True))

import itertools
a = list(map(int,input().split()))

s = [i for i in range(a[0])]
t = [i for i in range(a[1])]

n = list(itertools.combinations(s, 2))
m = list(itertools.combinations(t, 2))

print(len(n) + len(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):
from math import factorial as f
def t(x): return f(x)/(f(2)*f(x-2))
n,m = [int(i) for i in input().split()]
#if m%2==0: m-=1
if m>=2 and n>=2:
    ans = t(m)+t(n)
elif n==0 and m>=2: ans = t(m)
else: 
    if m == 1: ans =0
    else: ans=2
    
print(int(ans))


n,m = [int(i) for i in input().split()]
p = ['P']*n
k = ['I']*m
al = p+k
ans = 0
for i in range(len(al)):
    for j in range(i+1,len(al)):
        if al[i] == 'I' and al[j]=='I':ans+=1
        if al[i] == 'P' and al[j] == 'P': ans+=1
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):
import sys
import math
import collections
from collections import deque
#n = int(input())
n, m = map(int, sys.stdin.readline().split())
#s = input()
#x = list(map(int, sys.stdin.readline().split()))

a = math.factorial(n) // (math.factorial(n - 2) * 2)
b = math.factorial(m) // (math.factorial(m - 2) * 2)

print(a+b)


import sys
import math
import collections
from collections import deque
#n = int(input())
n, m = map(int, sys.stdin.readline().split())
#s = input()
#x = list(map(int, sys.stdin.readline().split()))

if n <= 1:
    a = 0
else:
    a = math.factorial(n) // (math.factorial(n - 2) * 2)

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

print(a+b)


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):
MOD = 998244353

N, S = map(int, input().split())
A = list(map(int, input().split()))

DP = [[[0] * 3 for _ in range(S + 1)] for _ in range(N + 1)]
DP[0][0][0] = 1

for i in range(N):
    DP[i + 1][0][0] = DP[i][0][0] 
    a = A[i]
    for j in range(S + 1):
        if j == 0: 
            # DP[i + 1][j][0] = DP[i][j][0] 
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1]
        elif j < a: 
            # DP[i + 1][j][0] = DP[i][j][0] 
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] 
        else: 
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] + DP[i][j - a][0] + DP[i][j - a][1]
        # DP[i + 1][j][0] %= MOD
        DP[i + 1][j][0] %= MOD
    DP[i + 1][S][2] = DP[i][S][1] + DP[i][S][2]
    if a <= S:
        DP[i + 1][S][2] += DP[i][S - a][0] + DP[i][S - a][1]
    DP[i + 1][S][2] %= MOD

print (DP[N][S][2])


#     print (DP[i])

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

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


n, m = map(int, input().split())
# combination nC2 mC2
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):
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))

import math
import sys
n, m = map(int, input().split())

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

if n == 0 and m <= 2:
    print(combinations_count(m, 2))
    sys.exit()
elif n <= 2 and m == 0:
    print(combinations_count(n, 2))
    sys.exit()
elif n == m == 1:
    print(1)
    sys.exit()
else:
    print(combinations_count(n, 2) + combinations_count(m, 2))

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 == 0 and m >= 2:
    print(combinations_count(m, 2))
    sys.exit()
elif n >= 2 and m == 0:
    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))

import math
import sys
n, m = map(int, input().split())

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

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

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(0)
    sys.exit()
elif n == m == 0:
    print(0)
    sys.exit()
else:
    print(combinations_count(n, 2) + combinations_count(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):
m, n = input("").split()
m = int(m)
n = int(n)
total = 0
if m > 1:
    total += m*(m-1)/2
if n > 1:
    total += n*(n-1)/2
print(total)

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

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


if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

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

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

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

if n==1 and m==1:
    print(0)
else:
    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):
# -*- coding: utf-8 -*-
import math


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

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

(combinations_count(b+c, 2)-b*c)

# -*- coding: utf-8 -*-
import math


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

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

print(int(combinations_count(b+c, 2)-b*c))


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

n,m =map(int, input().split())
if n==m==1:
    print(0)
elif n==1 or n==0:
    print(cmb(m,2))
elif m==1 or m==0:
    print(cmb(n,2))
else:
    print(cmb(n,2)+cmb(m,2))

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
n,m =map(int, input().split())
if n==m==1:
    print(0)
elif n==1 or n==0:
    print(cmb(m,2))
elif m==1 or m==0:
    print(cmb(n,2))
else:
    print(cmb(n,2)+cmb(m,2))

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

N = int(input())
a = (input().split())
a_str = ''.join(a)
a_str2 = a_str
sum = 0
l_dict = {}
while len(a_str)>0:
    n = a.count(a_str[0])
    sum += int(n*(n-1)/2)
    l_dict[a_str[0]] = n
    a_str = a_str.replace(a_str[0],'')
for k in range(N):
    print(sum-l_dict[a_str2[k]]+1)


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

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

def f(n):
if n == 1 or n ==0:
   return 1
else:
   return n*f(n-1)
  
print(f(even) + f(odd))

even,odd = map(int, input().split())

def f(n):
  if n == 1 or n == 0:
    return 1
  else:
    return n*f(n-1)
  
print(int(f(even)/(f(even-2)*2) + f(odd)/(f(odd-2)*2)))

even,odd = map(int, input().split())

  
print(int(even * (even-1)/2 + odd * (odd-1)/2))


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

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


print(output)

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


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

output = int( (N*(N-1))/2 + (M*(M-1))/2 )


print(output)

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


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


def main():
    n, m = map(int, input().split())
    print(combinations_count(n, 2) + combinations_count(m, 2))


if __name__ == "__main__":
    main()


import math


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


def main():
    n, m = map(int, input().split())
    if n < 2:
        even = 0
    else:
        even = combinations_count(n, 2)
    if m < 2:
        odd = 0
    else:
        odd = combinations_count(m, 2)
    print(even + odd)


if __name__ == "__main__":
    main()


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

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


import math

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

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

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

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

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

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

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

def chose(A):
    s = 0
    t = 0
    for i in range(len(A)):
        t = A.count(i+1) 
        for q in range(t):
            s += q
    print(s)

for i in range(N):
    B = C[:]
    B.pop(i)
    chose(B)

N,M = map(int,input().split())
s = t = 0
for i in range(N):
    s += i
for i in range(M):
    t += i
print(s+t)

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

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


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

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


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

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

m,n=map(int,input())
print(m*(m-1)+n*(n-1))

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

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

Verdicts: Wrong Answer

Runtime Error

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

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

n, m = map(int, input().split())
if n*m == 1:
  print(0)
else:
  print(int(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):
from scipy.special import comb

N, M = map(int, input().split())
print(comb(N, 2) + comb(M, 2))



N, M = map(int, input().split())
print(int(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, S = map(int, input().split())
A = list(map(int, input().split()))
MOD = 998244353
L = 0
R = 0
ret = 0

while R < N:
  if L > R:
    R = L
  if sum(A[L:R + 1]) < S:
    R += 1
  elif sum(A[L:R + 1]) > S:
    L += 1
  elif sum(A[L:R + 1]) == S:
    ret += (L + 1) * (N - R - 1) % MOD
    R += 1
print(ret)

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

Verdicts: Runtime Error

Accepted