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):
N,K = map(int,input().split())
num=N//K
ans=num**3
if K%2==0:
    if N%K>=K//2:
        num+=1
    ans+=num**3
print(ans)

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

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

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 = 0
for i in range(1, k + 1):
    if 2 * i % k == 0:
        ans += ((n + k - i) // k) ** 3
print(ans)

Solution (Python):
def main():
    N, K = map(int, input().split())
    if K%2 == 1:
        ans = (N//K)**3
        print(ans)
        return
    Kdiv2list = N//(K//2)
    Klist = N//K
    ans = Klist**3 + (Kdiv2list-Klist)**3
    print(ans)

if __name__ == "__main__":
    main()

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):
import sys
n, k = map(int, input().split())

if k % 2 == 1:
    print((n // k)**3)
    sys.exit()


x = (n - k // 2) // k + 1

print((n // k)**3 + x**3)

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

Solution (Python):

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

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)


from collections import Counter,deque,defaultdict





n,k=n1()

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

Solution (Python):

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

Solution (Python):
import sys

import math


from collections import deque

from fractions  import gcd

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

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

a = N // K
b = N % K
ans = a ** 3

for i in range(1, K):
    if (2 * (K - i)) % K == 0:
        if i > b:
            if K - i > b:
                ans += a ** 3
            else:
                ans += a * ((a+1)**2)
        else:
            if K - i > b:
                ans += (a + 1) * (a ** 2)
            else:
                ans += (a + 1) ** 3

print(ans)

Solution (Python):
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10
    N,K = LMIIS()
    ans = 0

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

    

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


    


    





    
main()

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

n, k = [int(x) for x in input().split()]

n_k = n // k
n_mod_k = n % k

def mod_k(x):
    res = n_k
    if x != 0 and x <= n_mod_k:
        res += 1
    elif x == 0 and n_mod_k == k:
        res += 1
    return res

ans = 0

for i in range(k):
    a_mod = i
    b_mod = -i % k
    c_mod = -i % k
    if (b_mod +c_mod) % k == 0:
        ans += mod_k(a_mod) * mod_k(b_mod) * mod_k(c_mod)

print(ans)

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*a*a if k%2==1 else a*a*a+b*b*b)

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

ans=0
for b in range(1,n+1):
    if((n+b)//k >0 and (2*b)%k==0):
        p=((n+b)//k)
        q=(-(-b//k)) if b%k!=0 else (b//k)+1
        ans+=( p - q + 1)**2





print(ans)

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

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

from collections import defaultdict
dic = defaultdict(int)
for i in range(1,n+1): 
    dic[i%k] += 1
res = 0
for a in range(k):
    
    b = (k-a)%k
    c = (k-a)%k
    if ((b+c)%k != 0):
        continue
    res += dic[a]*dic[b]*dic[c]
print(res)

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

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

if K % 2 == 0:
    if N % K >= K // 2:
        M += 1
    ans += M * (M - 1) * (M - 2) + M * (M - 1) * 3 + M

print(ans)

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

if k%2 == 0:
    q1, r1 = divmod(n, k)
    if r1 < k//2:
        q2 = q1
    else:
        q2 = q1+1
    ans = q2**3 + q1**3
else:
    q1, r1 = divmod(n, k)
    ans = q1**3

print(ans)

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

q = N//K
ans = q*q*q
if K % 2 == 1:
    print(ans)
else:
    p = (N+K//2)//K
    ans += p*p*p
    print(ans)

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

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

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

print(ans)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    ans = (N // K) ** 3
    if K % 2 == 0:
        halfK = 0
        for i in range(1, N + 1):
            if i % K == K // 2: halfK += 1
        ans += (halfK) ** 3
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

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 = list(map(int, input().split()))
ans = 0
list_n = [0]*K

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

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

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

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

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

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

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
  elif 2 * i % K == 0:
    b += 1

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

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())
a = n // k
b = (n + k//2) // k

if k % 2 == 0:
    print(a**3+b**3)
else:
    print(a**3)

Solution (Python):
n, k = map(int, input().split())
ans = 0
list_N = [0]*k
for num in range(1, n+1):
    m = num % k
    list_N[m] += 1

for a in range(k):
    b = (k-a)%k
    c = (k-a)%k
    if (b+c) % k == 0:
        ans += list_N[a]*list_N[b]*list_N[c]

print(ans)

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

if k % 2 == 1:
    p = n // k
    ans += pow(p, 3)
else:
    p = n//k
    q = (n + (k//2))//k
    ans += pow(p, 3) + pow(q, 3)

print(ans)

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

if k % 2 == 0:
    step = k // 2
    a = step
else:
    step = k
    a = step

ans = 0

while a <= n:
    b_num = c_num = (n+a)//k - a//k
    ans += b_num * c_num

    a += step

print(ans)

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

Solution (Python):
N,M=list(map(int,input().split()))
ans=0
half=0
for i in range(1,N+1):
   if i%M==0:
      ans+=1
if M%2==0:
   for i in range(1,N+1):
      if i%M==M//2:
         half+=1
   print(ans**3+half**3)
else:
   print(ans**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
result = a**3 + b**3
print(result)

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

Solution (Python):
N,K = map(int,input().split())
div = []
div2 =[]

for i in range(1,N+1):
    if (i%K == 0):
        div.append(i)
    elif (2*i%K == 0):
        div2.append(i)
    else :
        continue
l1 = len(div)
l2 = len(div2)
print(l2*l2*l2 + l1*l1*l1)

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

result=0

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

    
    if (N//K)*K+K/2<=N:
        result+=(N//K+1)**3
    else:
        result+=(N//K)**3

print(result)

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")











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

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

Solution (Python):






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)

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

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

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):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    if k%2==0:
        print((n//k)**3+((n+k//2)//k)**3)
    else:
        print((n//k)**3)
    
            

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    if k%2==0:
        print((n//k)**3+((n+k//2)//k)**3)
    else:
        print((n//k)**3)
    
            

if __name__=='__main__':
    main()

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


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

Solution (Python):


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

dp = [0] * k

for i in range(1, n + 1):
    m = i % k
    dp[m] += 1
ans = dp[0] ** 3
if k % 2 == 0:
    ans += dp[k // 2] ** 3
print(ans)

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

if K%2!=0:
  p=N//K
  ans+= p**3
else:
  z=K//2
  a=(N-z)//K+1
  ans += a**3
  p=N//K
  ans+= p**3

print(ans)

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

if K%2!=0:
  p=N//K
  ans+= p**3
else:
  z=K//2
  a=(N-z)//K+1
  ans += a**3
  p=N//K
  ans+= p**3
  
print(ans)

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

Solution (Python):



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


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


for a in range(0, K):
    b = (K - a) % K 
    c = (K - a) % K
    if not (b+c)%K==0:
        continue
    ans += nums[a] * nums[b] * nums[c]


print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k = map(int, read().split())
x, y = 0, 0
for i in range(1, n + 1):
    if i % k == 0:
        x += 1
    elif i * 2 % k == 0:
        y += 1
print(x ** 3 + y ** 3)

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):
def main():
    N, K = (int(i) for i in input().split())
    c0 = 0
    c1 = 0
    for num in range(1, N+1):
        if num % K == 0:
            c0 += 1
        elif K % 2 == 0 and num % K == K//2:
            c1 += 1
    print(c0*c0*c0 + c1*c1*c1)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N, K = (int(i) for i in input().split())
    c0 = 0
    c1 = 0
    for num in range(1, N+1):
        if num % K == 0:
            c0 += 1
        elif K % 2 == 0 and num % K == K//2:
            c1 += 1
    print(pow(c0, 3) + pow(c1, 3))


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N, K = (int(i) for i in input().split())
    cnt = 0
    for i in range(1, 2*10**5+1):
        if K*i <= N:
            cnt += 1
        else:
            break
    addcnt = 0
    if K % 2 == 0:
        for i in range(1, 2*10**5+1, 2):
            if (K//2)*i <= N:
                addcnt += 1
            else:
                break
    ans = cnt**3 + addcnt**3
    print(ans)


if __name__ == '__main__':
    main()

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

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

ks=0
k2s=0
for i in range(1,N+1):
    if K%2==0:
        if i%K==0:
            ks+=1
        elif i%(K//2)==0:
            k2s+=1
    else:
        if i%K==0:
            ks+=1
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


ans=0
if ks>=1:
    ans+=cmb(ks,1)
if ks>=2:
    ans+=cmb(ks,2)*6
if ks>=3:
    ans+=cmb(ks,3)*6

if k2s>=1:
    ans+=cmb(k2s,1)
if k2s>=2:
    ans+=cmb(k2s,2)*6
if k2s>=3:
    ans+=cmb(k2s,3)*6
print(ans)

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

Solution (Python):
import sys
def main():
    input = sys.stdin.readline
    N,K=map(int, input().split())
    z=h=0
    for i in range(1,N+1):
        if i%K==0:
            z+=1
        elif K&1==0 and i%K==K>>1:
            h+=1
    ans=z**3
    ans+=h**3
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
d = {}
q, r = divmod(n, k)
if r == 0:
    for i in range(k):
        d[i] = q
else:
    for i in range(k):
        if i == 0:
            d[i] = q
        elif 1 <= i <= r:
            d[i] = q+1
        else:
            d[i] = q

ans = 0
if k%2 != 0:
    ans = d[0]**3
else:
    ans = d[0]**3+d[k//2]**3
print(ans)

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

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

if K == 1:
    print(N**3)
    exit()

ans = 0
for k in range(K):
    if (k * 2) % K != 0:
        continue
    M = (N // K) - (1 if k == 0 else 0)
    if N % K >= k:
        M += 1
    ans += M**3
print(ans)

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

Solution (Python):
def main():
    n, k = map(int, input().split())
    r = [0 for _ in range(k)]
    for i in range(1, n + 1):
        r[i % k] += 1
    answer = 0
    for i in range(k):
        if 2 * (k - i) % k == 0:
            answer += r[i] * (r[k - i if i > 0 else 0] ** 2)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
ans=0
for a in range(1,n+1):
  m=(k-a-1)%k+1
  if (m+m)%k!=0:continue
  ans+=((n-m+k)//k)*((n-m+k)//k)
print(ans)

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

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

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

a = n//k
ans += max(0, a*(a-1)*(a-2))
ans += a*(a-1)*3
ans += a


print(ans)

Solution (Python):
N,K = map(int,input().split())
odd_count = 0
even_count = 0
ans = 0

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

if K%2 != 0:
  ans = odd_count**3
else:
  ans = odd_count**3 + even_count**3

print(ans)

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

Solution (Python):
n,k = map(int, input().split())
mod=[0]*k
for a in range(1,n+1):
    mod[a%k]+=1
ans=0
for a in range(k):
    b=(k-a)%k
    c=(k-a)%k
    if (b+c) % k == 0:
        ans+=mod[a]*mod[b]*mod[c]
print(ans)

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

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

Solution (Python):
n,k=map(int,input().split())
mods=[0]*k
mods[0]=n//k
for i in range(1,k):
    mods[i]=(n-i)//k+1

ans=0

for i in range(k):
    if (k-i)%k == i:
        ans+=mods[i]*mods[(k-i)%k]*mods[i]
print(ans)

Solution (Python):
import sys
import math  
import bisect  
import queue  


def input():
    return sys.stdin.readline().rstrip()


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

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

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

    print(res)


if __name__ == '__main__':
    main()

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

Solution (Python):
N, K = map(int, input().split())
mod_0 = 0
mod_K2 = 0
for i in range(1, N+1):
  if i % K == 0:
    mod_0 += 1
  elif i % K == K/2:
    mod_K2 += 1

ans = pow(mod_0, 3) + pow(mod_K2, 3)
print(ans)

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

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

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

ans = (n // k) ** 3

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

    ans += temp ** 3

print(ans)

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

ans = (n // k) ** 3

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

    ans += temp ** 3

print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

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

if k % 2 != 0:
    print((n//k)**3)
else:
    kk = k//2
    a = 0
    b = 0
    for i in range(1, n+1):
        if i % kk == 0 and (i//kk) % 2 == 0:
            a += 1
        elif i % kk == 0 and (i//kk) % 2 != 0:
            b += 1
    print(a**3+b**3)

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

if __name__ == '__main__':
    main()

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

def count_k():
    return (N // K) ** 3

def count_khalf():
    if K % 2 == 1:
        return 0
    b = N // K
    if N % K >= K // 2:
        b += 1
    return b ** 3


print(count_k() + count_khalf())

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

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

ans = 0
for a in range(0, K):
    b = (K - a) % K
    c = (K - a) % K
    if (b + c) % K != 0:
        continue
    ans += nums[a] * nums[b] * nums[c]

print(ans)

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

def solve(N,K):
    ans = (N//K)**3
    if K%2==0:
        ans += (N//(K//2)-N//K)**3
    return ans

print(solve(N,K))

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

if k % 2:
    print(n_mod0**3)
else:
    n_modk2 = (n+(k//2))//k
    print(n_mod0**3 + n_modk2**3)

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

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

print(ans)

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

Solution (Python):
def main():
    n,k = tuple([int(t)for t in input().split()])

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

if __name__ == "__main__":
    main()

Solution (Python):
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]



N, K = mi()

cnt_n = N // K
ans = cnt_n ** 3

if K % 2 == 0:
    h_k = K // 2
    if N >= h_k:
        ans += ((N - h_k) // K + 1)**3

print(ans)

Solution (Python):
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]



N, K = mi()
    
cnt_n = 0
ini_n = K

    
    
cnt_n = N // K

ans = cnt_n ** 3

if K % 2 == 0:
    ini_k = K // 2
    '''
    cnt_k = 0
    while ini_k <= N:
        cnt_k += 1
        ini_k += K
    ans += cnt_k ** 3
    '''
    if N >= ini_k:
        ans += ((N - ini_k) // K + 1)**3

print(ans)

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

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

Solution (Python):
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]



N, K = mi()
    
cnt_n = 0
ini_n = K
while ini_n <= N:
    cnt_n += 1
    ini_n += K

ans = cnt_n ** 3

if K % 2 == 0:
    ini_k = K // 2
    cnt_k = 0
    while ini_k <= N:
        cnt_k += 1
        ini_k += K
    ans += cnt_k ** 3

print(ans)

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

Solution (Python):
N, K = map(int,input().split())
ans1 = 0
ans2 = 0
if K % 2 == 0:
    for i in range(1,N+1):
        if i % K == 0:
            ans1 += 1
        if i % K == K//2:
            ans2 += 1
else:
    for i in range(1,N+1):
        if i % K == 0:
            ans1 += 1

print(ans1**3 + ans2**3)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
from functools import reduce
from operator import mul

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]






n,k=mii()

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

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

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    N, K = MI()
    a = []
    cur = K
    half = []
    zero = []

    dic = defaultdict(int)

    for i in range(1, N+1):
        if K % 2 == 1 and i % K == 0:
            zero.append(i)
        if K % 2 == 0 and i % K == K//2:
            half.append(i)
        if K % 2 == 0 and i % K == 0:
            zero.append(i)

    a = len(zero)
    b = len(half)

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


if __name__ == '__main__':
    main()

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

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

n = N // K
ans = n**3

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

print(ans)

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

if __name__ == '__main__':
    main()

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

"""
Kが奇数なら, a=b=c=0(mod K)のみ
Kが偶数なら, a=b=c=K/2(mod K)「も」
"""


def f(r):
    if r == 0: r = k
    return len(range(r, n + 1, k))

res = 0


res += f(0) ** 3


if k % 2 == 0:
    res += f(k // 2) ** 3

print(res)

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

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

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

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


n = N // K
ret = n ** 3


if not K % 2:
    m = K // 2
    n = len(list(range(m, N+1, K)))
    ret += n ** 3

print(ret)

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

Solution (Python):
from collections import deque
N, K = map(int, input().split())
ans = (N // K)**3
if K % 2 == 0:
  m = K // 2
  cnt = 0
  i = m
  while i <= N:
    i += K
    cnt += 1
  ans += cnt**3
print(ans)

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

s = n // k
a = n % k
h = 0

if k % 2 == 0 and a >= k/2:
    h = s+1
elif k % 2 == 0:
    h = s

print(s**3 + h**3)

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

if K % 2 == 0:
    ele1 = N // K
    ele2 = (N+K/2) // K
else:
    ele1 = N // K
    ele2 = 0

print(int(ele1**3 +ele2**3))

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