output_description: 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.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
attempt: import math
  
  s = input().split()
  N = int(s[0])
  K = int(s[1])
  
  ct = 0
  
  u = math.ceil(2 * N / K)
  
  
  def cond_e(a, b, c):
      if (
          a + b - c > 0
          and a - b + c > 0
          and -a + b + c > 0
          and a + b - c <= 2 * N / K
          and a - b + c <= 2 * N / K
          and -a + b + c <= 2 * N / K
      ):
          return True
      else:
          return False
  
  
  def cond_o(a, b, c):
      if (
          a + b - c > 0
          and a - b + c > 0
          and -a + b + c > 0
          and a + b - c <= 2 * N / K
          and a - b + c <= 2 * N / K
          and -a + b + c <= 2 * N / K
          and (a + b - c) % 2 == 0
          and (a - b + c) % 2 == 0
          and (-a + b + c) % 2 == 0
      ):
          return True
      else:
          return False
  
  
  print(u)
  for a in range(1, u + 1):
      for b in range(1, u + 1):
          for c in range(1, u + 1):
              if K % 2 == 0 and cond_e(a, b, c):
                  ct += 1
              elif K % 2 != 0 and cond_o(a, b, c):
                  ct += 1
  
  print(str(ct))
  
problem_description: 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.
samples: [{"input": "3 2", "output": "9\n    \n\n(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)\nsatisfy the condition.\n\n* * *"}, {"input": "5 3", "output": "1\n    \n\n* * *"}, {"input": "31415 9265", "output": "27\n    \n\n* * *"}, {"input": "35897 932", "output": "114191"}]