Problem:
 Score : 300 points    Problem Statement 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.      Constraints  1 \leq N,K \leq 2\times 10^5  N and K are integers.         Input Input is given from Standard Input in the following format:  N  K       Output Print 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 .        Sample Input 1 3 2      Sample Output 1 9  (1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.       Sample Input 2 5 3      Sample Output 2 1       Sample Input 3 31415 9265      Sample Output 3 27       Sample Input 4 35897 932      Sample Output 4 114191

Solution (Python):


import sys


INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, k = LI()

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

Solution (Python):
N,K = (int(i) for i in input().split())

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

Solution (Python):
N,K = map(int,input().split())

a = 0
for i in range(1,N+1):
    if i % K == 0:
        a += 1

if K % 2 == 0:
    b = 0
    for i in range(1,N+1):
        if i % K == (K/2):
            b += 1
    print(a**3 + b**3)
else:
    print(a**3)

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

Solution (Python):
S = list(map(int,input().split()))
N = S[0]
K = S[1]
if K % 2 == 1 :
    x = N // K
    answer = x**3
else:
    x = N // K
    y = (N + K//2) // K
    answer = x**3 + y**3
print(answer)

Solution (Python):
n, k = map(int, input().split())

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

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

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

Solution (Python):
N,K = [int(s) for s in input().split()]
temp = 0
if K % 2 == 0 :
  a = int(N//K)
  b = 0
  temp = int(K/2)
  while True:
    if temp > N:
      break
    b += 1
    temp += K
  print(a**3+b**3)
else:
  a = int(N//K)
  print(a**3)

Solution (Python):
N, K = map(int, input().split())

if K % 2 == 0:
	cnt1 = 0
	cnt2 = 0
	for i in range(1, N+1):
		if i % K == 0: cnt1 += 1
		elif i % (K/2) == 0: cnt2 += 1
	print(cnt1**3 + cnt2**3)

else:
	cnt = 0
	for i in range(1, N+1):
		if i % K == 0: cnt += 1
	print(cnt**3)

Solution (Python):
n, k = map(int, input().split())

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

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

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
n,k = map(int, input().split())
a = n // k
b = 0
if k % 2 == 0:
  b = (n - k // 2) // k + 1
print(a**3+b**3)

Solution (Python):
n,k=map(int,input().split())
if k % 2 == 0:
    a=int(n//k)
    b=int(n//(k/2)-a)
    print(a**3 + b**3)
else:
    a=int(n//k)
    print(a**3)

Solution (Python):
n, k = [int(i) for i in input().split()]

odd_cnt, even_cnt = 0, 0
for i in range(1, n + 1):
    if i % k == 0:
        odd_cnt += 1
if k % 2 == 0:
    for i in range(1, n + 1):
        if i % k == k / 2:
            even_cnt += 1

print(odd_cnt ** 3 + even_cnt ** 3)

Solution (Python):
import math
n,k = map(int,input().split())
count=0

for a in range(1,n+1):
    modk = (k-a)%k
    if((modk*2)%k == 0):
        nums = math.floor((n-(k-a)%k)/k)-math.ceil((1-(k-a)%k)/k)+1
        count+=(nums*nums)
    
print(count)

Solution (Python):
import itertools as it
N,K = [int(i) for i in input().split()]

candidates = []
even = []
odd = []
for i in range(1,N+1) :
	i = int(i)
	if (i % K == 0) :
		
		even.append(i)
		continue
	
	if (K % 2 == 0 and i % (K/2) == 0) :
		
		odd.append(i)
		continue


count = len(even) * len(even) * len(even)



if (K % 2 == 0) :
	count += (len(odd) * len(odd) * len(odd))

print(count)

Solution (Python):
def main():
    n, k = map(int, input().split())
    if k % 2 != 0:
        print((n // k) ** 3)
    else:
        q = n // k
        print(q ** 3 + (n // (k // 2) - q) ** 3)


if __name__ == '__main__':
    main()

Solution (Python):
N,K = map(int,input().split())
if K % 2 == 0:
    a = int(N // K)
    b = int(N // (K / 2) - a)
    print(a**3 + b**3)
else:
    a = int(N // K)
    print(a**3)

Solution (Python):
N,K = map(int,input().split())
sum = 0
for i in range(1,N+1):
    if 2*i%K != 0:continue
    minx = i//K
    maxx = (i + N)//K
    sum += (maxx - minx)**2
print(sum)

Solution (Python):
N, K = map(int, input().split())

g_count = 0
k_count = 0

for i in range(1, N+1):
    if i % K == 0:
        g_count += 1
    
    elif i % K == K/2:
        k_count += 1

print(g_count**3 + k_count**3)

Solution (Python):
N, K = map(int, input().split())

mod = [i for i in range(K, N+1, K)]
ans = len(mod) ** 3

if K % 2 == 0:
    items = [i for i in range(K//2, N+1, K)]
    ans += len(items) ** 3

print(ans)

Solution (Python):
n, k = map(int, input().split())
print(sum([1 if v % k == 0 else 0 for v in range(1, n+1)])**3 +
      sum([1 if v % k == k/2 else 0 for v in range(1, n+1)])**3)

Solution (Python):
n,k = map(int,input().split())
a = 0
b = 0
for i in range(1,n+1):
    if i%k == 0:
        a += 1
    elif i%k == k/2:
        b += 1

print(a**3+b**3)

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

Solution (Python):
n, k = map(int, input().split())

if k % 2 != 0:
    ans = (n // k) ** 3
else:
    a = (n // k)
    b = (n // (k // 2) - a)
    ans = a ** 3 + b ** 3
    
print(ans)

Solution (Python):
import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
 
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)
 

def f(b,n):
	if n < b:
		return n
	return f(b, n//b) + n%b
 
N,K = map(int,input().split())

if(K%2==0):
    cnt1=0
    cnt2=0
    for a in range(1,N+1):
        if(a%K==0):
            cnt1+=1
        elif(a%K==K/2):
            cnt2+=1

    print(cnt1**3+cnt2**3)

else:
    cnt=0
    for a in range(1,N+1):
        if(a%K==0):
            cnt+=1
    print(cnt**3)

Solution (Python):
N,K = list(map(int, input().split()))

c1 = N // K

cnt = c1
if c1 >= 2:
  cnt += c1 * (c1 - 1) * 3
  if c1 >= 3:
    cnt += c1 * (c1 - 1) * (c1 - 2)

if K % 2 == 0:
  c2 = (N + K // 2) // K
  cnt += c2
  if c2 >= 2:
    cnt += c2 * (c2 - 1) * 3
    if c2 >= 3:
      cnt += c2 * (c2 - 1) * (c2 - 2)
    
print(cnt)

Solution (Python):
n, k = map(int, input().split())

if k % 2 != 0:
    x1 = n // k
    print(x1 ** 3)
else:
    x1 = n // k
    x2 = n // (k // 2)
    print(x1 ** 3 + (x2 - x1) ** 3)

Solution (Python):
from itertools import product

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

"""
i%K == 0 ならその数同士で条件に合う数列を作れる
i%K == K//2 ならその数同士で条件に合う数列を作れる(Kが偶数の場合)
これらは条件によって導ける
"""

count = (N//K)**3
if K%2 == 0:
	count += (N//K + (N%K >= K//2))**3
print(count)

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

Solution (Python):
import math
n,k=map(int,input().split())
size=math.floor(n/k)
cnt=size*(size-1)*(size-2)+size*(size-1)*3+size
if k%2==0:
    size=math.floor(2*n/k)-size
    cnt+=size*(size-1)*(size-2)+size*(size-1)*3+size

print(cnt)

Solution (Python):
N, K = map(int, input().split())

if K % 2 == 0:
    num = N // K
    num2 = N // (K // 2) - num
    ans = num ** 3 + num2 ** 3
    
else:
    num3 = N // K
    ans = num3 ** 3

print(ans)

Solution (Python):
N,K = list(map(int,input().split()))
if K % 2 == 0:
    num = N//K
    num2 = N//(K//2) - num
    print(num**3+num2**3)
else:
    num = N//K
    print(num**3)

Solution (Python):
n,k=[int(i) for i in input().split()]
ans=int(n/k)**3+int((n+k/2)/k)**3 if k%2==0 else int(n/k)**3
print(ans)

Solution (Python):
n, k = map(int, input().split())

a = []

for i in range(1, n + 1):
    if k % 2 != 0:
        if i % k == 0:
            a.append(i)
    if k % 2 == 0:
        if i % int(k/2) == 0:
            a.append(i)

e = []
f = []
if k % 2 == 0:
    for j in range(len(a)):
        if a[j] % 2 != 0:
            e.append(a[j])
        if a[j] % 2 == 0:
            f.append(a[j])

if k % 2 != 0:
    print(len(a)**3)

if k % 2 == 0:
    if len(a) % 2 != 0:
        print(int(((len(a) + 1)/2) ** 3 + ((len(a) - 1)/2) ** 3))
    else:
        print(int((len(a)/2) ** 3 + (len(a)/2) ** 3))

Solution (Python):
N, K = map(int, input().split())

if K % 2 != 0:
    t = N // K
    ans = t ** 3
else:
    t = N // K
    s = (N + K // 2) // K
    ans = t ** 3 + s ** 3
print(ans)

Solution (Python):
def main():
    N, K = map(int, input().split())
    even = True if K % 2 == 0 else False
    if even:
        a1 = N//K
        a2 = N//(K//2) - a1
        print(a1**3 + a2**3)
    else:
        print((N//K) ** 3)


if __name__ == "__main__":
    main()

Solution (Python):
from itertools import product

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

zero = n // k
c = zero * zero * zero

if k % 2 == 0:
    half = k // 2
    d = 0
    for i in range(1, n+1):
        if i % k == half:
            d += 1
    c += (d * d * d)

print(c)

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,k = li()

kk = 0
k2 = 0

for i in range(1,n+1):
    if i%k == 0:
        kk += 1
    elif i%(k/2) == 0:
        k2 += 1
        
print(kk**3 + k2**3)

Solution (Python):
N,K = map(int,input().split())

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

Solution (Python):
def main():
    n, k = map(int, input().split())
    
    l = []
    l.append(n//k)

    if k % 2 == 0:
        l.append((n+k//2)//k)

    ans = 0
    for i in l:
        ans += i**3

    print(ans)

if __name__ == "__main__":
    main()

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

Solution (Python):
N,K = map(int,input().split())

n_1 = N//K
if K%2 == 0:
    if N%K < K/2:
        n = (N//K)
    else:
        n = (N//K) +1
    count = n_1 + n_1*(n_1-1)*3 + n_1*(n_1-1)*(n_1-2)
else:
    n = N//K
    count = 0
count += n + n*(n-1)*3 + n*(n-1)*(n-2)

print(count)

Solution (Python):
n,k=map(int,input().split())
o=n//k
p=0
if (k%2==0): p=(n+(k//2))//k
print(o**3+p**3)

Solution (Python):
N, K = [int(_) for _ in input().split()]
count = (N // K) ** 3
if K % 2 == 0:
    count += ((N + (K // 2)) // K) ** 3
print(count)

Solution (Python):
n, k = map(int,input().split())
a, b = 0, 0
for i in range(1,n+1):
  if i % k == 0:
    a += 1
for i in range(1, n+1):
  if i % k == k // 2:
    b += 1
if k % 2 == 0:
  print(a**3 + b**3)
else:
  print(a**3)

Solution (Python):
N, K = map(int, input().split())
cnt = 0

candidates = [i for i in range(K, N + 1, K)]
size = len(candidates)
cnt += size ** 3

if K % 2 == 0:
    for_even_k = [i for i in range(K // 2, N + 1, K)]
    size_for_even = len(for_even_k)
    cnt += size_for_even ** 3

print(cnt)

Solution (Python):
n,k = map(int,input().split())

if k % 2 != 0:
	dev = n // k
	ans = dev ** 3
else:
	dev = n // k 
	if n % k >= k/2:
		ans = dev**3 + (dev + 1)**3
	else:
		ans = 2 * (dev**3)

print(ans)

Solution (Python):
import sys
input=sys.stdin.readline

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

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

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N, K = map(int, input().split())

    m = defaultdict(int)
    for i in range(1, N + 1):
        m[i % K] += 1

    ans = 0
    for a in range(1, N + 1):
        if (a + a) % K == 0:
            ans += m[a % K] ** 2

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N,K = map(int,input().split())
ans = (N//K)**3
if K%2==0:
    ans += ((N+K//2)//K)**3
print(ans)

Solution (Python):
n,k=map(int,input().split())

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

Solution (Python):
(n, k) = map(int, input().split())
a = n // k
ans = a ** 3

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

Solution (Python):
n, k = map(int, raw_input().split())
num1 = n / k
num2 = 0
if k % 2 == 0:
    if n % k >= k / 2:
        num2 = num1 + 1
    else:
        num2 = num1
print num1**3+num2**3

Solution (Python):
N, K = map(int, input().split())
result = (N//K)**3
if K % 2 == 0:
    if N-K*(N//K) < K/2:
        result += (N//K)**3
    else:
        result += ((N//K)+1)**3

print(result)

Solution (Python):
N, K = map(int, input().split(' '))
a=N//K
if K%2==0:
    b=((N-K//2)//K)+1
    print((a**3) +(b**3))
else:
    print(a**3)

Solution (Python):
N, K = map(int, raw_input().split())

c = 0
d = 0
for i in range(1, N + 1):
	if i % K == 0:
		c += 1
	elif K % 2 == 0 and i % K == K / 2:
		d += 1
print c ** 3 + d ** 3

Solution (Python):
def m():
    n, k = map(int, input().split())
    half = k // 2
    odd = 0
    even = 0
    even_half = 0
    for i in range(1, n+1):
        if k % 2 == 0:
            if i % k == 0:
                even += 1
            if i % k == half:
                even_half += 1
        else:
            if i % k == 0:
                odd += 1
    ans = max(odd ** 3, even ** 3 + even_half ** 3)
    return ans
print(m())

Solution (Python):
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)

Solution (Python):
N, K = map(int, input().split())

tmp = N // K

if K % 2 == 0:
    a = N // (K // 2) - tmp
    print(tmp ** 3 + a ** 3)
else:
    print(tmp ** 3)

Solution (Python):
N, K = map(int, input().split( ))
ans = (N//K)**3
if K % 2 == 0:
	c = -(N//K)
	for i in range(N):
		if (i + 1) % (K // 2) == 0:
			c += 1
	ans += c**3
print(ans)

Solution (Python):
import math

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

x=N//K
if K%2:
    print(x**3)
else:
    y=math.floor(N/K+1/2)
    print(x**3+y**3)

Solution (Python):
n,k = map(int,input().split())

if k%2 ==1:
  print(int(n//k)**3)
else:
  print(int((n//k)**3 + ((n+(k/2))//k)**3))

Solution (Python):
n,k = map(int,input().split())

if k%2 ==1:
  print(int(n//k)**3)
else:
  print(int((n//k)**3 + ((n+(k/2))//k)**3))

Solution (Python):




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):
    b = (K - a) % K
    c = (K - a) % K
    
    if (b + c) % K == 0:
        
        ans += num[a] * num[b] * num[c]
print(ans)

Solution (Python):
import itertools
n,k=map(int,input().split())
aa=k/2
a=[]
b=[]
if k%2==0:
    for i in range(1,n+1):
        if i%k==0:
            a.append(i)
        elif i%k==aa:
            b.append(i)
else:
    for i in range(1,n+1):
        if i%k==0:
            a.append(i)
tot=len(set(a))**3+len(set(b))**3
print(tot)

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

Solution (Python):
import sys
from fractions import gcd


def main():
    n, k = map(int, input().split())

    ans = 0

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys

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

count = 0

count = int(N / K) ** 3

if K % 2 == 0:
    c = int((N - (K / 2)) / K + 1)
    count += c**3

print(count)

sys.exit(0)

Solution (Python):
N, K = map(int, input().split())
if(K%2 != 0):
    odd = (N // K)**3 
    print(int(odd))
else:
    c= N//(K/2)
    d= N//K
    e=c-d
    print(int(e**3 + d**3))

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

Solution (Python):
n, k = [int(_) for _ in input().split()]
ans = 0
for i in range(0, min(k, n+1)):
    if (2 * i) % k == 0:
        if i == 0:
            m = n // k
            ans += m + 3*m*(m-1) + m*(m-1)*(m-2)
        else:
            m = ((n-i) // k) + 1
            ans += m + 3*m*(m-1) + m*(m-1)*(m-2)
print(ans)

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

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

Solution (Python):
n,k = map(int,input().split())
s = (n//k)**3
if k%2 == 0:
  l = k//2
  s += ((n//l+1)//2)**3
print(s)

Solution (Python):
n,k=map(int,input().split())

if k%2==1:
    c=int(n//k)
    print(c*c*c) 
else:
    c=int(n//(k/2))
    d=int(n//k)
    e=c-d
    print(e*e*e+d*d*d)

Solution (Python):
N,K=map(int,input().split())

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

Solution (Python):
N, K = map(int, input().split())

def counter(N, K):
    if K % 2 == 1:
        return (int(N/K))**3
    if K % 2 == 0:
        A = (int(N/K))**3
        B = (int(2*N/K)-int(N/K))**3
        return A+B
            
print(counter(N,K))

Solution (Python):
N, K = map(int, input().split())

p1 = N // K
p2 = (N + K // 2) // K

if K % 2 == 1:
    print(p1 ** 3)
else:
    print(p1 ** 3 + p2 ** 3)

Solution (Python):
a = input()
N = int(a.split(" ")[0])
K = int(a.split(" ")[1])
count = 0
if K%2 == 1:
    count = int(N/K)**3
else:
    count = int(N/K)*int(N/K)*int(N/K)*2
    if int(N/K)*K + K/2 <= N:
        count = int(count/2) + (int(N/K)+1)**3
print(count)

Solution (Python):
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)

Solution (Python):
n, k = [int(v) for v in input().split()]

cnt = n // k
ans = cnt * cnt * cnt
if k % 2 == 0:
    k //= 2
    cnt = n // k - cnt
    ans += cnt * cnt * cnt

print(ans)

Solution (Python):
N,K=map(int,input().split())
if K%2==1:
    n=N//K
    print(n**3)
else:
    n=N//K
    m=0
    for i in range(1,N+1):
        if i%K==K//2:
            m+=1
    print(n**3+m**3)

Solution (Python):
n,k = map(int,input().split())

"""
まずはn+nまでの数の中で、kの倍数が何個あるのか？何か？を調べる
足してそれになる組み合わせを調べる（このとき、２つの数字は同じor 違うときがある）
"""
"""
kが奇数の時,abcは全てkの倍数出ないと無理
kが奇数の時、abcはk/2の倍数でないと無理
"""

if k%2 == 1:
	ans = (n//k)**3
else:
	ans = (n//k)**3 + ((n + k//2) //k) ** 3

print(ans)

Solution (Python):
N, K = map(int, input().split())

v = 0
t = (2*N) // K
s = N // K

if K % 2 == 0:
    if t % 2 == 0:
        v = 2*((t/2)**3)
    else:
        v = (((t+1)/2)**3) + (((t-1)/2)**3)
else:
    v = s**3

v = int(v)
print(v)

Solution (Python):
N, K = map(int, input().split())

if K % 2 == 0:
    ns1 = [i for i in range(1, N+1) if i % K == 0]
    ns2 = [i for i in range(1, N+1) if i % K == K//2]
    print(len(ns1)**3 + len(ns2)**3)
else:
    ns = [i for i in range(1, N+1) if i % K == 0]
    print(len(ns)**3)

Solution (Python):
n, k = map(int, input().split())

ks = [x for x in range(1, n+1) if x % k == 0]

if k % 2 == 0: 
    k2s = [x for x in range(1, n+1) if x % (k//2) == 0 and x % k != 0] 
    print(len(ks) ** 3 + len(k2s) ** 3)
else:
    print(len(ks) ** 3)

Solution (Python):
n,k = map(int,input().split())

if 2*n<k:
    print(0)
elif k%2 == 1:
    m = int(n/k)
    print(m**3)
else:
    m = int(n/k)
    l = int((n+k/2)/k)
    print(m**3+l**3)

Solution (Python):
n,m=map(int,input().split())
print((n//m)**3+(((n+m//2)//m)*int(m%2==0))**3)

Solution (Python):
N, K = map(int, input().split())
nK = (N // K)
if K % 2 == 0:
    if (K//2) <= (N % K):
        rnK = nK + 1
    else:
        rnK = nK
else:
    rnK = 0
print(nK**3 + rnK**3)

Solution (Python):
def solve(string):
    n, k = map(int, string.split(" "))
    ans = 0
    """
    for a in range(1, n + 1):
        for b in range(1, n + 1):
            for c in range(1, n + 1):
                if (a + b) % k == 0 and (b + c) % k == 0 and (c + a) % k == 0:
                    ans.append((a, b, c))
    """
    if k % 2 == 1:
        ans = (n // k)**3
    else:
        ans = (n // k)**3 + ((n // k) + 1)**3 if n % k >= (k // 2) else 2 * ((n // k)**3)
    return str(ans)


if __name__ == '__main__':
    print(solve(input()))

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

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

Solution (Python):
N, K = map(int, input().split())
print(sum(((N+a%K)//K)**2 for a in range(1,N+1) if (2*a)%K==0))

Solution (Python):
N, K = map(int, input().split())
print(sum(
    ((N + a % K) // K)**2
    for a in range(1, N + 1)
    if (2 * a) % K == 0
))

Solution (Python):
N, K = map(int, input().split())
if K % 2:
    cnt = 0
    for i in range(1, N + 1):
        if i % K == 0:
            cnt += 1
    print(cnt ** 3)
else:
    cnt = [0, 0]
    for i in range(1, N + 1):
        if i % (K // 2) == 0:
            cnt[(i // (K // 2)) % 2] += 1
    print(cnt[0] ** 3 + cnt[1] ** 3)

Solution (Python):
N, K = map(int, input().split())
num = [0] * K
for i in range(1, N + 1):
    num[i % K] += 1
ans = 0
for ma in range(K):
    mb = (K - ma) % K
    mc = (K - ma) % K
    if (mb + mc) % K == 0:
        ans += num[ma] * num[mb] * num[mc]
print(ans)

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

Solution (Python):
N,K = map(int, input().split())
x = len(range(K, N+1, K))
if K%2 == 0:
    y = len(range(K//2, N+1, K//2)) - x
    print(x**3 + y**3)
else:
    print(x**3)

Solution (Python):
n,k = map(int,input().split())

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

Solution (Python):
from sys import stdin

N, K = [int(i) for i in stdin.readline().rstrip().split()]

ans = 0
for a in range(1, N + 1):
    r = a % K
    if 2 * r % K == 0:
        ans += ((N + r) // K)**2

print(ans)

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

Solution (Python):
N, K = map(int, input().split(" "))
if K % 2 == 1:
    print ((int(N/K))**3)

else:
    tmp = (int(N/K))**3
    e=0
    t = K
    while t % 2 == 0:
        t /= 2
        e += 1
    
    m = K / 2
    cnt = 0
    for i in range(2 ** (e-1), N+1, 2 ** e):
        if i % m == 0:
            cnt += 1
    n = int((N+1) / 2)

    print ((int(N/K))**3 + (int(cnt))**3)

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

Solution (Python):
ddd = list(map(int, input().split()))
n = ddd[0]
k = ddd[1]
count = 0

for i in range(n):
    a = i + 1
    if k % 2 == 1:
        if a % k != 0:
            bccount = 0
        else:
            bccount = (n // k) ** 2
    else:
        if a % k == 0:
            bccount = (n // k) ** 2
        elif a % k == k // 2:
            if n % k < k // 2:
                bccount = ((n // (k // 2)) // 2) ** 2
            else:
                bccount = ((n // (k // 2)) // 2 + 1) ** 2
        else:
            bccount = 0
    count = count + bccount

print(count)

Solution (Python):
from math import ceil, floor
N, K = map(int, input().split())
r = floor((2 * N) / K)
ans = floor(N / K)**3 if K % 2 == 1 \
    else ceil(r / 2) * (floor((2 * N - K) / (2 * K)) + 1)**2 + floor(r / 2) * floor(N / K)**2
print(ans)

Solution (Python):
n, k = map(int, input().split())
arr = [i for i in range(k, n+1, k)]
ans = len(arr) ** 3
if k % 2 == 0:
    arr = [i for i in range(k//2, n+1, k)]
    ans += len(arr) ** 3
print(ans)

Solution (Python):
inp = [int(x) for x in input().split()]
n = inp[0]
k = inp[1]

num = [x for x in range(0, n+1, k)]
ans = (len(num)-1) ** 3

if k % 2 == 0:
    c = 0
    for i in range(1, n+1):
        if i % k == k / 2:
             c += 1
    ans += c ** 3
    

print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = sum(((N + a % K) // K)**2 for a in range(1, N + 1) if (2 * a) % K == 0)
print(ans)

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

Solution (Python):

N, K = [int(x) for x in input().split()]

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

Solution (Python):

import itertools

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

Nlst = []
Nlst_gu = []



if K % 2 == 0:
    for i in range(1,N+1):
        if i % K == 0:
            Nlst.append(i)
        elif i % (K/2) == 0:
            Nlst_gu.append(i)
else:
    for i in range(1,N+1):
        if i % K == 0:
            Nlst.append(i)




ans = len(Nlst)
ans_gu = len(Nlst_gu)

print(ans * ans * ans + ans_gu * ans_gu * ans_gu)

Solution (Python):
n,k = map(int,input().split())

if k%2 == 1:
    s = n//k
    print(s**3)

else:
    s = n//k
    t = (n+k//2)//k
    print(s**3+t**3)

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

Solution (Python):
N, K = map(int, input().split())

x = N // K
ans = x ** 3
if K % 2 == 0:
    y = (N + (K // 2)) // K
    ans += y ** 3
print(ans)

Solution (Python):
N, K = map(int, input().split())

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

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

Solution (Python):

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

ans = 0
for a in range(1, N + 1):
    
    
    
    
    
    
    
    
    
    
    if (K - 2 * a) % K: continue
    b = K - (a % K)
    c = K - b            
    
    b_min = K - (K - b) % K
    c_min = K - (K - c) % K
    
    b_max = N - (N - b_min) % K
    c_max = N - (N - c_min) % K
    
    
    ans += ((b_max - b_min) // K + 1) * ((c_max - c_min) // K + 1)

print(ans)

Solution (Python):

iN , iK = [int(x) for x in input().split()]

if iK % 2 == 0 :
    iFK = int(iK / 2)
    
    iULimit = int(iN /iFK)
    if iULimit % 2 == 0:
        print (int(iULimit / 2 ) ** 3 * 2 )
    else:
        print( int((iULimit + 1 )/ 2) ** 3 + int((iULimit - 1)/2) ** 3)
else:
    
    iULimit = int( iN / iK )
    print(iULimit ** 3)

Solution (Python):
n,k = list(map(int,input().split()))

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

print(ans)

Solution (Python):
def main():
    """
    1 <= N, K <= 2 * 10^5

    a,b,c (ok: a=b=c)

    """
    N, K = map(int, input().split())
    ans = f(N, K)
    assert ans == loop(N, K)
    
    print(ans)


def f(N, K):
    """
    1: a + b = l * K
    2: b + c = n * K
    3: c + a = m * K

    1 + 2 = c + a + 2b = (l + n) * K, 2b = (l + n - m) * K
    2 + 3 = a + b + 2c = (n + m) * K, 2c = (n + m - l) * K
    3 + 1 = b + c + 2a = (m + l) * K, 2a = (m + l - n) * K

    K % 2 == 0
        b = (l + n - m) * K / 2 = 整数
        Kの倍数 or K / 2 の倍数
    K % 2 == 1
        b = (l + n - m) * K / 2 = not 整数
        Kの倍数
    """
    if K % 2 == 1:
        
        x = N // K
        ans = x ** 3
    else:
        x1 = N // K
        x2 = (N + K // 2) // K
        ans = x1 ** 3 + x2 ** 3

    return ans


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

    res = 0
    for a in range(K):
        
        b = (K - a) % K
        c = (K - a) % K

        if (b + c) % K == 0:
            res += x[a] * x[b] * x[c]

    return res


def TLE(N, K):
    ans = 0
    for a in range(1, N+1):
        for b in range(1, N+1):
            for c in range(1, N+1):
                if (a + b) % K == 0 and \
                    (b + c) % K == 0 and \
                        (c + a) % K == 0:
                    ans += 1
    return ans


if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())

def main():
  a = N//K
  if K%2 == 1:
    print(a**3)
  else:
    if N%K >= K//2:
      print(a**3 + (a + 1)**3)
    else:
      print(a**3*2)
    
main()

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

Solution (Python):
import numpy as np
import math


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

p = int(math.floor(N / K))
total = p * p * p



if K % 2 == 0:
    q = int(math.floor((N + K/2) / K))
    total += q * q * q

print(total)

Solution (Python):

if __name__ == '__main__':
    n,k = [int(x) for x in input().split()]

    ans = 0
    for i in range(1,k//2+1):
        a=i
        b=k-i
        if (a+a)%k == 0:
            ans += ((n-a)//k+1)*((n-b)//k+1)*((n-a)//k+1)
        if a==b:
            continue
        if (b+b)%k == 0:
            ans += ((n-a)//k+1)*((n-b)//k+1)*((n-b)//k+1)
    ans += (n//k)*(n//k)*(n//k)
    print(ans)

Solution (Python):
N, K = map(int, input().split())
 
count1 = 0
count2 = 0
for a in range(1,N+1):
    if a%K == 0:
        count1 += 1
if K%2 == 0:
    for a in range(1,N+1):
        if a%K == K//2:
            count2 += 1
print(count1**3 + count2**3)

Solution (Python):
N, K = map(int, input().strip().split())
result = 0
num = N // K
result += num
if num == 2:
    result += num * (num - 1) * 3
elif num > 2:
    result += num * (num - 1) * 3
    result += num * (num - 1) * (num - 2)


if K % 2 == 1:
    print(result)
else:
    start = K // 2
    num = (N - start) // K + 1
    result += num
    if num == 2:
        result += num * (num - 1) * 3
    elif num > 2:
        result += num * (num - 1) * 3
        result += num * (num - 1) * (num - 2)
    print(result)