TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
N,K = map(int,input().split())
numbers = [x for x in range(1,N+1)]
a = 0
for i in numbers:
    yaba = []
    for j in range((N+i)//K):
        yaba.append((j*K)-i)
    for j in yaba:
        for k in yaba:
            if j+k % K == 0:
                a += 1
            else:
                pass
print(a)

n,k = map(int,input().split())
num = (n // k) ** 3
if k % 2 == 0:
    if n - ((n // k) * k) < k // 2:
        print(num * 2)
    else:
        print(num + ((n // k + 1) ** 3))
else:
    print(num)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n, k = map(int, input())
candidOdd = 0
candidEven = 0
candidEven2 = 0
for i in range(1, n+1):
    if k % 2 == 1:
        if i % k == 0:
            candidOdd += 1
    else:
        if i % k == 0:
            candidEven += 1
        elif i % k == (k/2):
            candidEven2 += 1
print(candidOdd**3 + candidEven**3 + candidEven2**3)


n, k = 5,  2

for a in range(1, n+1):
    for b in range(a, n+1):
        if (a+b) % k != 0:
            continue
        for c in range(b, n+1):
            if (c+a) % k == 0 and (b+a) % k == 0:
                print (a, b, c)

n, k = map(int, input().split())
candidOdd = 0
candidEven = 0
candidEven2 = 0
for i in range(1, n+1):
    if k % 2 == 1:
        if i % k == 0:
            candidOdd += 1
    else:
        if i % k == 0:
            candidEven += 1
        elif i % k == (k/2):
            candidEven2 += 1
print(candidOdd**3 + candidEven**3 + candidEven2**3)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
from sys import stdin
from itertools import product

n,k = [int(x) for x in stdin.readline().rstrip().split()]

f = n//k

li = [0]*f


from itertools import product
lin = list(product(li, repeat=3))

print(len(lin))

from sys import stdin
from math import factorial

n,k = [int(x) for x in stdin.readline().rstrip().split()]
point = 0
point2 = 0
if k % 2 == 1:
    for i in range(1,n+1):
        if i%k == 0:
            point += 1
else:
    for i in range(1,n+1):
        if i % k == 0:
            point += 1
        elif i%k == k//2:
            point2 += 1

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

print(point**3+point2**3)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
N, K = map(int, input().split())
ret = 0
for x in range(1, N + 1):
    for y in [y for y in range(K - x, N + 1, K) if y > 0]:
        for z in [z for z in range(K - y, N + 1, K) if z > 0]:
            cnt += 1     
            if  (z + x) % K == 0:
                ret += 1
print(ret)

N, K = map(int, input().split())
ret = 0
for x in range(1, N + 1):
    for y in [y for y in range(K - x, N + 1, K) if y > 0]:
        for z in [z for z in range(K - y, N + 1, K) if z > 0]:
            cnt += 1     
            if  (z + x) % K == 0:
                ret += 1
print(ret)

N, K = map(int, input().split())
n = sum([1 for x in range(K, N + 1, K)])
if K % 2 == 1:
    print(n ** 3)
else:
    m = sum([1 for x in range(K // 2, N + 1, K)])
    print(n ** 3 + m ** 3)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
N,K=map(int,input().split())
u1, u2=divmod(N,K)
ans=u1*3

A=[u1]*K
for i in range(u2):
    A[i+1]+=1
if K%2==0:
    ans+=A[K//2+1]*3
print(ans)

N,K=map(int,input().split())
u1, u2=divmod(N,K)
ans=u1**3

A=[u1]*K
for i in range(u2):
    A[i+1]+=1
if K%2==0:
    ans+=A[K//2+1]**3
print(ans)

N,K=map(int,input().split())
u1, u2=divmod(N,K)
ans=u1*3

A=[u1]*K
for i in range(u2):
    A[i+1]+=1
if K%2==0:
    ans+=A[K//2+1]*3
print(ans)

N,K=map(int,input().split())
u1=N//K
u2=N%K
ans=u1**3

A=[u1]*K
for i in range(u2):
    A[i+1]+=1
if K%2==0:
    ans+=A[K//2]**3
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

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

cntMod = N//K


if K%2==0:
    if K*cntMod+(N/(K//2)) <= N:
        cntMid = cntMod + 1
    else:
        cntMid = cntMod
else:
    cntMid = 0
print(cntMid**3+cntMod**3)


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

cntMod = N//K


if K%2==0:
    if K*cntMod+K//2 <= N:
        cntMid = cntMod + 1
    else:
        cntMid = cntMod
else:
    cntMid = 0
print(cntMid**3+cntMod**3)


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
import bisect
import math
import sys
from collections import Counter, defaultdict, deque
from copy import copy, deepcopy
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from queue import Queue

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

def SI():
    return int(readline())
def MI():
    return map(int, readline().split())
def MLI():
    return map(int, open(0).read().split())

inf = float("inf")


def main():
    N, K = MI()
    num_factor_K = N // K
    ret = num_factor_K ** 3
    print(ret)
    
    if K % 2 == 0:
        num_factor_half_K = N // K
        if N % K >= K // 2:
            num_factor_half_K += 1
        ret += num_factor_half_K ** 3
        
    print(ret)
    

if __name__ == "__main__":
    main()

import bisect
import math
import sys
from collections import Counter, defaultdict, deque
from copy import copy, deepcopy
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from queue import Queue

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

def SI():
    return int(readline())
def MI():
    return map(int, readline().split())
def MLI():
    return map(int, open(0).read().split())

inf = float("inf")


def main():
    N, K = MI()
    num_factor_K = N // K
    ret = num_factor_K ** 3
    
    if K % 2 == 0:
        num_factor_half_K = N // K
        if N % K >= K // 2:
            num_factor_half_K += 1
        ret += num_factor_half_K ** 3
        
    print(ret)
    

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

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

if K % 2 == 1:
    tmp = N // K
    ans = tmp ** 3
    print (ans)0

else:
    tmp = N // K
    ans = tmp ** 3

    tmp = N // (K // 2) - tmp
    ans += tmp ** 3

    print (ans)


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

if K % 2 == 1:
    tmp = N // K
    ans = tmp ** 3
    print (ans)

else:
    tmp = N // K
    ans = tmp ** 3

    tmp = N // (K // 2) - tmp
    ans += tmp ** 3

    print (ans)


Verdicts: Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
N, K = map(int, input().split())
c = 0
for i in range(1,K+1):
  for j in range(0,N+1):
    b = i*K + j*K
    if b <= N and (i*K+b)%K == (b+b)%K == 0:
      c = i
      print(c, i*K)
    elif b != 0:
      break
print(c**3)

N, K = map(int, input().split())
c = 0
for i in range(1,N+1):
    b = i*K
    if b <= N:
      c += 1
    else:
      break
e = 0
if K%2 ==0:
  for i in range(1,N+1):
    d = i*K/2
    if d <= N and d%K != 0:
      e += 1 
  print(c**3 + e**3)
else:
  print(c**3)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
K,N = list(map(int, input().split()))
MAX = K+N+3
mod = 998244353

fac = [1]*(MAX+1)
for i in range(1,MAX+1):
	fac[i] = (fac[i-1]*i)%mod

rev_m = [1]*(MAX+1)
rev_m[MAX] = pow(fac[MAX],mod-2,mod)
for i in range(MAX,0,-1):
	rev_m[i-1] = (rev_m[i]*i)%mod

def Comb(n,k):#nCk
	return (fac[n]*rev_m[k]*rev_m[n-k])%mod


def f(n,k,i):
	if i == 2:
		if n < 0 or (k==1 and n>=2): 
			return 0
		elif n == 0:
			return 1
		else:
			return (Comb(k-2+n,n)+Comb(k-2+n-1,n-1)) % mod
	else: #i>2
		Sp = i//2-1
		ans = 0
		for p in range(Sp+1):
			ans += g(n,k,i,p)
		return ans % mod

def g(n,k,i,p):
	Sp = i//2-1
	if p == 0:
		return f(n-Sp,k-Sp,2) * pow(2,Sp,mod) % mod
	else: #p>0
		return g(n,k-2*p,i-2*p,0) * Comb(Sp,p)

ans = []
for i in range(2,K+2):
	if i%2 == 0:
		tmp = f(N,K,i)
	ans.append(tmp)
	print(tmp)

ans = ans[::-1]
for i in range(1,K):
	print(ans[i])


from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 998244353
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

K,N = inpl()

MAX = 20000
fac = [1]*(MAX+1)
for i in range(1,MAX+1):
	fac[i] = (fac[i-1]*i)%mod

gyakugen = [1]*(MAX+1)
gyakugen[MAX] = pow(fac[MAX],mod-2,mod)
for i in range(MAX,0,-1):
	gyakugen[i-1] = (gyakugen[i]*i)%mod

def Comb(n,k):#nCk
	return (fac[n]*gyakugen[k]*gyakugen[n-k])%mod


def calc(k,n,i):
	x = (i-2)//2
	k -= x
	n -= x
	if k == 1:
		if n <= 1:
			return n
		else:
			return 0
	elif k < 1:
		return 0
	tmp = 0
	for j in range(2):
		zb = n-j
		zm = k-2
		tmp += Comb(zb+zm,min(zb,zm))%mod
	tmp %= mod
	tmp *= pow(2,x,mod)
	return tmp

ans = []
for i in range(2,K+2):
	if i%2 == 0:
		pairs = (i-2)//2
		tmp = 0
		for p0 in range(pairs+1):
			tmp += calc(K-p0*2,N,i-p0*2)*Comb(pairs,p0)%mod
			tmp %= mod
	ans.append(tmp)
	print(tmp)

ans = ans[::-1]

for i in range(1,K):
	print(ans[i])


from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,K = inpl()

if K%2 == 1:
	print((N//K)**3)
else:
	ans = (N//K)**3
	tmp = N//K
	if N%K >= K//2:
		tmp += 1
	ans += tmp**3
	print(ans)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
# coding: utf-8
# Your code here!

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

if(k%2==0):
    k//=2

count=0

for a in range(k,n,k):
    for b in range(k,n,k):
        for c in range(k,n,k):
            if (a+b)%k==0 and (c+b)%k==0 and (a+c)%k==0:
                count+=1

print(count)


# coding: utf-8
# Your code here!

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

hk = 0

ans = (n//k)**3

if k%2==0:
    n -= k//2
    ans += (n//k +1)**3
    
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n,k=map(int,input().split())
if k%2==0:
    x=(n+k/2)//k
    y=n//k
    print(x**3+y**3)
else:
    x=n//k
    print(x**3)


n,k=map(int,input().split())
if k%2==0:
    x=(n+k/2)//k
    y=n//k
    print(int(x**3+y**3))
else:
    x=n//k
    print(int(x**3))


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n,k=map(int,input().split())
if k%2==1:
  print((n//k)**3)
else:
  j=n//(k//2)
  print(j)
  if j %2==0:
    print(2*((j//2)**3))
  else:
    print(((j//2)**3)+((j//2+1)**3))
          


n,k=map(int,input().split())
if k%2==1:
  print((n//k)**3)
else:
  j=n//(k//2)
  if j %2==0:
    print(2*((j//2)**3))
  else:
    print(((j//2)**3)+((j//2+1)**3))
          


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):

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

N, K = getIntList()

res = 0
c1 ==0
c2 ==0
if K %2 ==0:
    t = K//2
else:
    t= -1

if True:
    for i in range(1,N+1):
        if i%K == t:
            c1+=1
        if i%K ==0:
            c2+=1
res =  c1 **3 + c2** 3
print(res)

def getIntList():
    return list(map(int, input().split()))    
 
N, K = getIntList()
 
res = 0
c1 =0
c2 =0
if K %2 ==0:
    t = K//2
else:
    t= -1
 
if True:
    for i in range(1,N+1):
        if i%K == t:
            c1+=1
        if i%K ==0:
            c2+=1
res =  c1 **3 + c2** 3
print(res)


Verdicts: Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
l = int(input())
edge = []
for i in range(1, 19):
    edge.append((i, i + 1, 1 << (i - 1)))
    edge.append((i, i + 1, 0))
sm = 0
for i in range(19, 0, -1):
    v = 1 << (i - 1)
    while l >= v:
        edge.append((i, 20, sm))
        sm += v
        l -= v
print(20, len(edge))
for x, y, z in edge:
    print(x, y, z)

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

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):






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

if K % 2 != 0:
    n = N // K 
    print(n ** 3)

else:
    n = N // K
    half_n = N // (K//2)
    print(half_n)
    print(n ** 3 + (half_n - n)** 3)







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

if K % 2 != 0:
    n = N // K 
    print(n ** 3)

else:
    n = N // K
    half_n = N // (K//2)
    print(n ** 3 + (half_n - n)** 3)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n,k=map(int,input().split())
if k%2==1:
  print((n//k)**3)
else:
  print((n//(k//2))**3+(n//k-n//(k//2))**3)

n,k=map(int,input().split())
if k%2==1:
  print((n//k)**3)
else:
  print((n//k)**3+(n//(k//2)-n//k)**3)


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n,k=list(map(int,input().split()))
r=0
r+=(n//k)**3
if k%2==0:
  r+=((n-k//2)//k)**3
print(r)

n,k=list(map(int,input().split()))
r=0
r+=(n//k)**3
if k%2==0:
  r+=((n+k//2)//k)**3
print(r)


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n,k=map(int,input().split())
if k%2:
  print((n//k)**3)
else:
  l=k//2
  if l%2:
    print(((n+l)//k)**3)
  else:
    print(((n+l)//k)**3 + (n//k)**3)

n,k=map(int,input())
if k%2:
  print((n//k)**3)
else:
  l=k//2
  if l%2:
    print(((n+l)//k)**3)
  else:
    print(((n+l)//k)**3 + (n//k)**3)

n,k=map(int,input().split())
print((n//k)**3+~-k%2*((n+k//2)//k)**3)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
a, b=map(int, input().split())
try:
	c = a // (b // 2)
	c = c //2 + c% 2
except Exception:
  c = 0
try:
    d = a // b
except Exception:
  d = 0
    print(c**3 + d **3)

a, b=map(int, input().split())
try:
    c = a // (b // 2)
    c = c //2 + c% 2
except Exception as  e:
    c = 0
try:
    d = a // b
except Exception as e:
    d = 0
    print(c**3 + d **3)

a, b=map(int, input().split())
try:
    c = a // (b // 2)
    c = c //2 + c%2
except Exception as  e:
    c = 0
if b % 2 == 1:
    c = 0
try:
    d = a // b
except Exception as e:
    d = 0
print(c**3 + d**3)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
N, K = map(int, input().split())
if K%2==1:
  print((N//K)**3)
else:
  print((N//K)**3 + (((N//2)//K) - (N//K))**3)

N, K = map(int, input().split())
if K%2==1:
  print((N//K)**3)
else:
  print((N//K)**3 + ((N//(K//2)) - (N//K))**3)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

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


num = [0]*(K)  
for i in range(1, N+1):
    num[i % K] += 1  

ans = 0
for a in range(K+1):  
    b = (K-a) % K
    c = (K-a) % K
    if (b + c) % K == 0:
        ans += num[a] * num[b] * num[c]

print(ans)


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


num = [0]*(K+1)  
for i in range(1, N+1):
    num[i % K] += 1  

ans = 0
for a in range(K+1):  
    b = (K-a) % K
    c = (K-a) % K
    if (b + c) % K == 0:
        ans += num[a] * num[b] * num[c]

print(ans)


Verdicts: Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
def base3(K):
    tmp=K
    S=""
    while(True):
        S=str(tmp%3)+S
        tmp=tmp//3
        if tmp==0:
            break
    return S
L=int(input())
T=base3(L)[::-1]
N=len(T)
A=[]
for i in range(N-1):
    tmp=3**i
    for k in range(3):
        A.append((i+1,i+2,k*tmp))
bef=0
for i in range(N)[::-1]:
    tmp=3**i
    for k in range(int(T[i])):
        A.append((i+1,N+1,bef+k*tmp))
    bef+=int(T[i])*tmp
print(N+1,len(A))
for p in A:
    print(p[0],p[1],p[2])ans=(n//k)**3


    def base3(K):
        tmp=K
        S=""
        while(True):
            S=str(tmp%3)+S
            tmp=tmp//3
            if tmp==0:
                break
        return S
    L=int(input())
    T=base3(L)[::-1]
    N=len(T)
    A=[]
    for i in range(N-1):
        tmp=3**i
        for k in range(3):
            A.append((i+1,i+2,k*tmp))
    bef=0
    for i in range(N)[::-1]:
        tmp=3**i
        for k in range(int(T[i])):
            A.append((i+1,N+1,bef+k*tmp))
        bef+=int(T[i])*tmp
    print(N+1,len(A))
    for p in A:
        print(p[0],p[1],p[2])

n,k=map(int,input().split())
ans=(n//k)**3
if(k%2==0):
    ans+=(n//(k//2)-n//k)**3
print(ans)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//a),3))


a,b = map(int,input().split())
c = a//b
d = a//(b//2)
if b % 2 == 0:
	print(c**3 + d**3)
else:
	print(c**3)

a,b = map(int,input().split())
c = a//b-1
d = a//(b//2)
if b % 2 == 0:
	print(c**3+d**3)
else:
	print(c**3)

a,b = map(int,input().split())
c = a//b
d = a//(b//2)
if b % 2 == 0:
	print(d**3)
else:
	print(c**3)

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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print((a//b)**3 + +((a+b//2)//a)**3)


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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//a),3)


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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//b),3))


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):

import math
 
n, k = map(int, input().split())
c = 0
 
if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))



import math
 
n, k = map(int, input().split())
c = 0
 
if k%2==0:
    if math.floor(2*n/k)%2==0:
        d=math.floor(2*n/k)/2
        c=2*d*d*d
    else:
        d=(math.floor(2*n/k)+1)/2
        c=d*d*d+(d-1)*(d-1)*(d-1)
    print(int(c))
else:
    d=math.floor(n/k)
    c=d*d*d
    print(int(c))


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

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

if K%3 == 0:
    ans = N//K
else:
    ans = N//K*3
print(ans)

n,k=map(int,input().split())
print((n//k)**3 if k%2==1 else (n//k)**3+((n+k//2)//k)**3)


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n,k=map(int,input().split())
ans=0
for i in range(1,n//k+1):
  i*=k
  if i%2==0:
    i//=2
  ans+=(n//i)**3
print(ans)

n,k=map(int,input().split())
ans=0
for i in range(1,2):
  i*=k
  if i%2==0:
    ans+=(n//(i//2)-n//i)**3
  ans+=(n//i)**3
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

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

if K <=2:
  print(N*N*N)
else:
  if K%2 == 0:
    div = N//(K//2)
    if div%2 > 0:
      div = div//2
      print((div*div*div) + (div+1)*(div+1)*(div+1))
    else:
      print(div*div*div)
  else:
    div = N//K
    print(div*div*div)

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

if K <=2:
  print(N*N*N)
else:
  if K%2 == 0:
    div = N//(K//2)
    if div%2 > 0:
      div = div//2
      print((div*div*div) + (div+1)*(div+1)*(div+1))
    else:
      div = div//2
      print(div*div*div*2)
  else:
    div = N//K
    print(div*div*div)

N,K=map(int,input().split())
 
if K%2 == 0:
  div = N//(K//2)
  if div%2 > 0:
    div = div//2
    print((div*div*div) + (div+1)*(div+1)*(div+1))
  else:
    div = div//2
    print(div*div*div*2)
else:
  div = N//K
  print(div*div*div)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
n,k=map(int, input().split())
if k%2==0:
    x=0
    y=0
    for i in range(1,n+1):
        if i%k==k//2:
            x+=1
        if i%k==0:
            y+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    if y>=1:
        ans+=com(y,1)
    if y>=2:
        ans+=6*com(y,2)
    if y>=3:
        ans+=6*com(y,3)
    print(ans)
else:
    x=0
    for i in range(1,n+1):
        if i%k==0:
            x+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    print(ans)
def com(a,b):
    r=1
    for i in range(b):
        r*=(a-i)
        r//=i+1
    return r

n,k=map(int, input().split())
if k%2==0:
    x=0
    y=0
    for i in range(1,n+1):
        if i%k==k//2:
            x+=1
        if i%k==0:
            y+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    if y>=1:
        ans+=com(y,1)
    if y>=2:
        ans+=6*com(y,2)
    if y>=3:
        ans+=6*com(y,3)
    print(ans)
else:
    x=0
    for i in range(1,n+1):
        if i%k==0:
            x+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    print(ans)
    
def com(a,b):
    r=1
    for i in range(b):
        r*=(a-i)
        r//=i+1
    return r

n,k=map(int, input().split())
def com(a,b):
    r=1
    for i in range(b):
        r*=(a-i)
        r//=i+1
    return r
if k%2==0:
    x=0
    y=0
    for i in range(1,n+1):
        if i%k==k//2:
            x+=1
        if i%k==0:
            y+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    if y>=1:
        ans+=com(y,1)
    if y>=2:
        ans+=6*com(y,2)
    if y>=3:
        ans+=6*com(y,3)
    print(ans)
else:
    x=0
    for i in range(1,n+1):
        if i%k==0:
            x+=1
    ans=0
    if x>=1:
        ans+=com(x,1)
    if x>=2:
        ans+=6*com(x,2)
    if x>=3:
        ans+=6*com(x,3)
    print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.

Submission attempts (in order):
N,M=input().split()
N=int(N)
M=int(M)
if M%2==0:
  print((N/M)**3+((N+M/2)/M)**3)
else:
  print((N/M)**3)

N,M=input().split()
N=int(N)
M=int(M)
if M%2==0:
  print(int(N/M)**3+int((N+M/2)/M)**3)
else:
  print(int(N/M)**3)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable. For each i=2,3,...,2K, find the following value modulo 998244353:    * The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.  Note that the dice are NOT distinguishable, that is, two combinations are considered different when there exists an integer k such that the number of dice showing k is different in those two.

Submission attempts (in order):
MOD = 998244353

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


inv = [0] * (K + N + 1)
inv[1] = 1
for x in range(2, K + N + 1):
    inv[x] = (-(MOD // x) * inv[MOD % x]) % MOD

# nCr[n][r]: C(n, r) % MOD
nCr = [[0] * (K + N + 1) for i in range(K + N + 1)]
for n in range(K + N + 1):
    nCr[n][0] = 1
    for r in range(1, n + 1):
        nCr[n][r] = (nCr[n][r - 1] * (n - r + 1) * inv[r]) % MOD


def nHr(n, r):
    return nCr[n + r - 1][r]


for i in range(2, 2 * K + 1):
    print(nHr(K, N))


def solve():
    MOD = 998244353
    maxNK = 2000

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

    def getInvs(n, MOD):
        invs = [1] * (n+1)
        for x in range(2, n+1):
            invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
        return invs

    def getCombss(n, k, invs, MOD):
        def getCombNs(n, k, invs, MOD):
            combNs = [1] * (n//2+1)
            for x in range(1, n//2+1):
                combNs[x] = (combNs[x-1] * (n-x+1) * invs[x]) % MOD
            return (combNs + combNs[:(n+1)//2][::-1])[:k+1]
        combss = [[] for n in range(n+1)]
        for x in range(n+1):
            combss[x] = getCombNs(x, k, invs, MOD)
            combss[x] += [0] * (k+1-len(combss[x]))
        return combss

    invs = getInvs(2*maxNK, MOD)
    combss = getCombss(2*maxNK, maxNK, invs, MOD)

    def getPows(base, n, MOD):
        pows = [1] * (n+1)
        for x in range(1, n+1):
            pows[x] = (pows[x-1] * base) % MOD
        return pows
    pow2s = getPows(2, N, MOD)

    anss = []
    for i in range(2, K+2, 2):
        ans = 0
        numFree = abs(K+1-i)
        numPair = (K-numFree+1)//2
        numPair -= 1
        for x in range(min(numPair, N)+1):
            ans += combss[numPair][x] * pow2s[x] * combss[N+numFree-1][N-x] % MOD
            ans %= MOD
        for x in range(min(numPair, N)+1):
            ans += combss[numPair][x] * pow2s[x] * combss[N+numFree-2][N-x-1] % MOD
            ans %= MOD
        anss.append(ans)
        if i+1 <= K+1:
            anss.append(ans)

    anss = anss + anss[:-1][::-1]
    print('\n'.join(map(str, anss)))


solve()


Verdicts: Wrong Answer

Accepted
Problem: Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable. For each i=2,3,...,2K, find the following value modulo 998244353:    * The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.  Note that the dice are NOT distinguishable, that is, two combinations are considered different when there exists an integer k such that the number of dice showing k is different in those two.

Submission attempts (in order):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 998244353
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

K,N = inpl()

MAX = 10000
fac = [1]*(MAX+1)
for i in range(1,MAX+1):
	fac[i] = (fac[i-1]*i)%mod

gyakugen = [1]*(MAX+1)
gyakugen[MAX] = pow(fac[MAX],mod-2,mod)
for i in range(MAX,0,-1):
	gyakugen[i-1] = (gyakugen[i]*i)%mod

def Comb(n,k):#nCk
	return (fac[n]*gyakugen[k]*gyakugen[n-k])%mod


def calc(k,n,i):
	x = (i-2)//2
	k -= x
	n -= x
	if k == 1 and n==1:
		return 1
	elif k < 1 or n < 0:
		return 0
		
	tmp = 0
	for j in range(2):
		zb = n-j
		zm = k-2
		tmp += Comb(zb+zm,min(zb,zm))%mod
	tmp %= mod
	tmp *= pow(2,x,mod)
	return tmp

ans = []
for i in range(2,K+2):
	if i%2 == 0:
		pairs = (i-2)//2
		tmp = 0
		for p0 in range(pairs+1):
			tmp += calc(K-p0*2,N,i-p0*2)*Comb(pairs,p0)%mod
			tmp %= mod
	tmp %= mod
	ans.append(tmp)
	print(tmp)

ans = ans[::-1]

for i in range(1,K):
	print(ans[i])


K,N = list(map(int, input().split()))
MAX = K+N+3
mod = 998244353

fac = [1]*(MAX+1)
for i in range(1,MAX+1):
	fac[i] = (fac[i-1]*i)%mod

rev_m = [1]*(MAX+1)
rev_m[MAX] = pow(fac[MAX],mod-2,mod)
for i in range(MAX,0,-1):
	rev_m[i-1] = (rev_m[i]*i)%mod

def Comb(n,k):#nCk
	return (fac[n]*rev_m[k]*rev_m[n-k])%mod


def f(n,k,i):
	if i == 2:
		if n < 0 or (k==1 and n>=2): 
			return 0
		elif n == 0:
			return 1
		else:
			return (Comb(k-2+n,n)+Comb(k-2+n-1,n-1)) % mod
	else: #i>2
		Sp = i//2-1
		ans = 0
		for p in range(Sp+1):
			ans += g(n,k,i,p)
		return ans % mod

def g(n,k,i,p):
	Sp = i//2-1
	if p == 0:
		return f(n-Sp,k-Sp,2) * pow(2,Sp,mod) % mod
	else: #p>0
		return g(n,k-2*p,i-2*p,0) * Comb(Sp,p)

ans = []
for i in range(2,K+2):
	if i%2 == 0:
		tmp = f(N,K,i)
	ans.append(tmp)
	print(tmp)

ans = ans[::-1]
for i in range(1,K):
	print(ans[i])


Verdicts: Wrong Answer

Accepted
Problem: Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable. For each i=2,3,...,2K, find the following value modulo 998244353:    * The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.  Note that the dice are NOT distinguishable, that is, two combinations are considered different when there exists an integer k such that the number of dice showing k is different in those two.

Submission attempts (in order):
k,n = list(map(int,input().split()))
mod = 998244353
fact = [1]*(n+k+1)
rfact = [1]*(n+k+1)
for i in range(1, n+k):
    fact[i] = r = (i * fact[i-1]) % mod
    rfact[i] = pow(r, mod-2, mod)

save = []
for p in range(1,int((k+3)/2)):
    i = 2 * p + 1
    temp = 0
    for t in range(p+1):
        if k-i+t<0:continue
        res = (fact[p] * rfact[t] * rfact[p-t]) % mod
        res *= (fact[n+k-i] * rfact[k-i+t] * rfact[n-t]) % mod
        res *= pow(2,t,mod)
        temp = (temp+res) % mod
    save.append(temp)

output = save+[save[-1]]+save[::-1]
for x in output:
    print(x)

k,n = list(map(int,input().split()))
mod = 998244353
fact = [1]*(n+k+1)
rfact = [1]*(n+k+1)
for i in range(1, n+k):
    fact[i] = r = (i * fact[i-1]) % mod
    rfact[i] = pow(r, mod-2, mod)

save = []
for p in range(1,int((k+3)/2)):
    i = 2 * p + 1
    temp = 0
    for t in range(min(p+1,n+1)):
        if k-i+t<0:continue
        res = (fact[p] * rfact[t] * rfact[p-t]) % mod
        res *= (fact[n+k-i] * rfact[k-i+t] * rfact[n-t]) % mod
        res *= pow(2,t,mod)
        temp = (temp+res) % mod
    save.append(temp)
output = []
i = 1
while i<k:
    output.append(save[(i-1)//2])
    i+=1

for x in output+[save[-1]]+output[::-1]:
    print(x)



Verdicts: Wrong Answer

Accepted
Problem: Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable. For each i=2,3,...,2K, find the following value modulo 998244353:    * The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.  Note that the dice are NOT distinguishable, that is, two combinations are considered different when there exists an integer k such that the number of dice showing k is different in those two.

Submission attempts (in order):
def cmb(n,r):
  if r==0:
    return 1
  elif r==n:
    return 1
  else:
    return A[n]*B[r]*B[n-r]%mod
mod=998244353
A=[1,1]
B=[1,1]
for i in range(2,4005):
  A.append(A[-1]*i%mod)
  B.append(B[-1]*pow(i,mod-2,mod)%mod)
k,n=map(int,input().split())
if k==1:
  print(0)
  exit()
ans=[0]*(2*k+1)
for i in range(2,k+3):
  if i%2==0:
    i=i+1
    ans[i-1]=sum(cmb(n+k-i,k-i+j)*cmb(i//2,j)*pow(2,j,mod) for j in range(min(n+1,i//2+1)))%mod
  else:
    ans[i]=ans[i-1]
for i in range(k+2,2*k+1):
  ans[i]=ans[2*k+2-i]
for i in range(2,2*k+1):
  print(ans[i])

def cmb(n,r):
  if n<0:
    return 0
  if n==1:
    return 1
  elif r<0:
    return 0
  elif r>n:
    return 0
  elif r==0:
    return 1
  elif r==n:
    return 1
  else:
    return A[n]*B[r]*B[n-r]%mod
mod=998244353
A=[1,1]
B=[1,1]
for i in range(2,4005):
  A.append(A[-1]*i%mod)
  B.append(B[-1]*pow(i,mod-2,mod)%mod)
k,n=map(int,input().split())
if k==1:
  print(0)
  exit()
ans=[0]*(2*k+1)
for i in range(2,k+3):
  if i%2==0:
    i=i+1
    for j in range(min(n+1,i//2+1)):
      ans[i-1]=(ans[i-1]+cmb(n+k-i,k-i+j)*cmb(i//2,j)*pow(2,j,mod))%mod
  else:
    ans[i]=ans[i-1]
for i in range(k+2,2*k+1):
  ans[i]=ans[2*k+2-i]
for i in range(2,2*k+1):
  print(ans[i])

def cmb(n,r):
  if n<0:
    return 0
  if n==0:
    if r!=0:
      return 0
    else:
      return 1
  elif r<0:
    return 0
  elif r>n:
    return 0
  elif r==0:
    return 1
  elif r==n:
    return 1
  else:
    return A[n]*B[r]*B[n-r]%mod
mod=998244353
A=[1,1]
B=[1,1]
for i in range(2,4005):
  A.append(A[-1]*i%mod)
  B.append(B[-1]*pow(i,mod-2,mod)%mod)
k,n=map(int,input().split())
if k==1:
  print(0)
  exit()
ans=[0]*(2*k+1)
for i in range(2,k+3):
  if i%2==0:
    i=i+1
    for j in range(min(n+1,i//2+1)):
      ans[i-1]=(ans[i-1]+cmb(n+k-i,k-i+j)*cmb(i//2,j)*pow(2,j,mod))%mod
  else:
    ans[i]=ans[i-1]
for i in range(k+2,2*k+1):
  ans[i]=ans[2*k+2-i]
for i in range(2,2*k+1):
  print(ans[i])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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

N,i=map(int,input.split())
print((N-i)+1)

a,b=map(int,input.split())
print(a+1-b)

a,b=int(input.split())
print(a-b+1)

N,i=map(int,input().split())
print(N+1-i)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
There is an N-car train.

You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

n, i = map(int, input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
print(sum([int(i) for i in input().split()])+1)

N,i = input().split(" ")
N,i = int(N),int(i)
print(N - i + 1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
x= input()
x = x.split()
x = list(map(int, x))
if x[0] == x[1]:
    print(x)
else:
    print(x[1] - x[0] + 1)


n =int(input("enter number of car_train. "))
i = int(input("enter ith from the front  of train . "))

if n == i:
    print (1)
else :
    print ((n-i)+1)




N=int(input())
i=int(input())
j=o

j=N-i+1

print(j)



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


print(inputs[0]-inputs[1]+1)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N,i = int(input().split())
print(N-i+1)


N,i = map(int,input().split())
print(N-i+1)


Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i=map(int,input())
print(n+1-i)

n,i=map(int,input().split())
print(n+1-i)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, i = map(int.input().split(' '))
print(N-i+1)

N, i = map(int,input().spkit(' '))
print(N-i+1)

N, i = map(int,input().split(' '))
print(N-i+1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, i = map(int, input())
print(N-i+1)

N, i = map(int, input().split())
print(N-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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


N, i = list(map(int,input().split()))
print(N+1 -i)


Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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

def ABC107_A():
    n,i=map(int,input().split())
    print(n-i+1)

ABC107_A()

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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

a,b=map(int,input().split());print(a-b+1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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

answer = N - i + 1

print(answer)

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

answer = N - i + 1

print(answer)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i = map(int, input())
print(n - i + 1)

n,i = map(int, input().split())
print(n - i + 1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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

print(n-i)

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

print(n-i+1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
x = int(input())
y = int(input())
if x == y:
    print(y)
else:
    print(y - x + 1)

n,a=map(int , input().split())
print(n-a+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N= int(input())
i= int(input())
j=0

j=N-i+1

print (j)
    


N,i=int(input ("enter the number of cars and car ))
X=N-i+1
Print(x)

N , i = map( int input( ) )
x = N - i + 1
print ( x )


N,i=map(int,input().split())
if 1<=n<=100:
if 1<=i<=n:
print(N-i+1)
    


N , i = map( int input( ) )
x = (N - i) + 1
print ( x )


N,i=map(int,input().split())
list1=[x+1 for x in range(0,1000)]
list2=[y for y in range(1,N+1)]
if N in list1 and i in list2:
     x=(N-i)+1 
     print(x)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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

n, i = [int(_) for _ in input().split()]
print(n - i + 1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):

n,i = map(int(input().split()))
print((n-i)+1)



n,i = map(int,input().split())
print((n-i)+1)


Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N = int(input())
i = int(input())

print(N-i+1)

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


num = N-i+1
print(num)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n, i = map(int,input().aplit())

print(n - i + 1)

n, i = map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n, i = map(int, input())
print(n - i + 1)

n, i = map(int, input().split())
print(n - i + 1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, i = map(int, intput().split())
print(N-i+1)

N, i = map(int, input().split())
print(N-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
A,B = list(map(int,input()))

print(A-B+1)

A,B = list(map(int,input().split()))

print(A-B+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i = list(map,int(input().split()))
print(n-i+1)

n,i = list(map(int,input().split()))
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

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

a,b=map(int,input().split())
print(b-a+1)

a,b=map(int,input().split())
print(a-b+1)

Verdicts: Wrong Answer

Wrong Answer

Accepted