Harryxun/stf_run huggingface dataset:
import io,sys
sys.setrecursionlimit(10**6)
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    import bisect
    n = int(input())
    A = list(map(int,sys.stdin.readline().rstrip().split()))
    A.sort()

    ans = 0
    for i in range(n):

        if i == 0:
            if A[0] != A[1]:
                ans+=1
                continue
            else:
                continue

        a = A[i]
        a_last = A[i-1]
        if a == a_last or (i!=n-1 and a == A[i+1]):
            continue
        poi = A[:i]
        div = make_divisors(a)
        for d in div:
            if d > a_last:
                break
            k = bisect.bisect_left(poi,d)
            if poi[k]==d:
                ans-=1
                break
        ans+=1
    
    print(ans)
main()

### FIXED CODE ###

import io,sys
sys.setrecursionlimit(10**6)

def main():
    import bisect
    n = int(input())
    A = list(map(int,sys.stdin.readline().rstrip().split()))
    A.sort()

    ans = 0
    a_max = A[-1]
    note = [True]*(a_max+1)
    for j in range(n):
        a = A[j]
        if note[a]:
            if j != n-1 and A[j]==A[j+1]:
                ans-=1
            ans+=1
            # for i in range(a,a_max+1):
            #     if i%a==0:
            #         note[i] = False
            temp = a 
            while temp <= a_max:
                note[temp]=False
                temp+=a

        
    
    print(ans)
main()
#coding: UTF-8

A = int(input())
B = int(input())
C = int(input())

if sum([A, B]) > C:
    print ('Yes')
else:
    print('No')


### FIXED CODE ###

#coding: UTF-8

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

if sum([A, B]) >= C:
    print ('Yes')
else:
    print ('No')
a,b = map(int,input().split())

if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else a == b:
 print("a == b")

### FIXED CODE ###

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

if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else:
 print("a == b")
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(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()

from itertools import product

def main():
    N = II()
    A, G, C, T = range(4)
    def code(c0, c1, c2):
        return c0 + 4 * c1 + 16 * c2
    dp = [0] * 64
    dp[code(T, T, T)] = 1
    for _ in range(N):
        tmp = [0] * 64
        for p1, p2, p3 in product(range(4), repeat=3):
            for cur in range(4):
                if (p2, p1, cur) == (A, G, C):
                    continue
                if (p2, p1, cur) == (A, C, G):
                    continue
                if (p2, p1, cur) == (G, A, C):
                    continue
                if (p3, p1, cur) == (A, G, C):
                    continue
                if (p3, p2, cur) == (A, G, C):
                    continue
                tmp[code(cur, p1, p2)] += dp[code(p1, p2, p3)]
                tmp[code(cur, p1, p2)] %= MOD
        dp = tmp
    ans = sum(dp)

    return ans % MOD

print(main())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(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()

from itertools import accumulate

def main():
    N, Q = LI()
    S = SI()
    LR = []
    for _ in range(Q):
        LR.append(LI_())

    AC = [0] * (N + 1)
    for i in range(N - 1):
        if S[i:i + 2] == 'AC':
            AC[i] = 1
    acc = [0] + list(accumulate(AC))
    for l, r in LR:
        print(acc[r] - acc[l])

    return 0

main()
n, b, r = map(int, input().split())
# inputText1 = "8 3 4"
inputText1List = inputText1.split()
# n = int(inputText1List[0])
# b = int(inputText1List[1])
# r = int(inputText1List[2])
if b == 0:
    print(b)
else:
    # i = (count // (b + r)) + 1 # 最大繰り返し数
    baseTextCount = b + r # 7
    i = n // baseTextCount
    mod = n % baseTextCount
    # print(i * b) # あまりを除いた青のボール数
    if mod < b:
        print(i * b + mod)
    else:
        print(i * b + b)


### FIXED CODE ###

inputText1 = input()
# inputText1 = "8 3 4"
inputText1List = inputText1.split()
n = int(inputText1List[0])
b = int(inputText1List[1])
r = int(inputText1List[2])
count = 10 **100
if b == 0:
    print(b)
else:
    # i = (count // (b + r)) + 1 # 最大繰り返し数
    baseTextCount = b + r # 7
    i = n // baseTextCount
    mod = n % baseTextCount
    # print(i * b) # あまりを除いた青のボール数
    if mod < b:
        print(i * b + mod)
    else:
        print(i * b + b)
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    s = input()
    sl = [i for i in s]
    n = len(s)-1
    ans = []
    anslist = []
    sublist = [-1]*n
    for i in range(1 << n):
        for j in range(n):
            if (i>>j)&1:
                sublist[j] = "+"
        anslist.append(sl[0])
        for j in range(n):
            if sublist[j] == "+":
                anslist.append("+")
                anslist.append(sl[j+1])
            else:
                anslist.append(sl[j+1])
        ans.append(eval("".join(anslist)))
        anslist = []
        sublist = [-1]*n
    print(sum(ans))
if __name__ == "__main__":
    main() 
    
#endline===============================================
    

### FIXED CODE ###

S = input()
SL = [i for i in S]
sublist = [-1]*(len(S)-1)
anslist = []
ans = []
for i in range(1<<len(S)-1):
    for j in range(len(S)-1):
        if ((i>>j)&1)==1:
            sublist[j] = "+"
    anslist.append(SL[0])
    for j in range(len(S)-1):
        if sublist[j] == "+":
            anslist.append(sublist[j])
            anslist.append(SL[j+1])
        else:
            anslist.append(SL[j+1])
    ans.append(eval("".join(anslist)))
    anslist = []
    sublist = [-1]*(len(S)-1)
print(sum(ans))
S=input()
if S[2] == S[3] & S[4] == S[5]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S=input()
if S[2] == S[3] and S[4] == S[5]:
  print('Yes')
else:
  print('No')
n, t = map(int, input().split())
l = [int(i)for i in input().split()]

if t <= 1 or all(b >= a for a, b in zip(l, l[1:])):
    print(0)
else:
    mini = float("inf")
    maxp = 0
    maxc = 0
    for n in l:
        if n - mini > maxp:
            maxp = n - mini
            maxc = 1
        elif n - mini == maxp:
            maxp = n - mini
            maxc += 1
        mini = min(mini, n)
print(maxc)

### FIXED CODE ###

n, t = map(int, input().split())
l = [int(i)for i in input().split()]

if t <= 1 or all(a >= b for a, b in zip(l, l[1:])):
    print(0)
else:
    mini = float("inf")
    maxp = 0
    maxc = 0
    for n in l:
        if n - mini > maxp:
            maxp = n - mini
            maxc = 1
        elif n - mini == maxp:
            maxp = n - mini
            maxc += 1
        mini = min(mini, n)
    print(maxc)
import sys
N = int(input())
t = [[]for i in range(N+1)]
lines = sys.stdin.readlines()
for i in range(N-1):
    a,b,c = map(int,lines[i].split())
    t[a].append([b,c])
    t[b].append([a,c])
Q,K = map(int,lines[N-1].split())
#p is parent
#pcd is parent-child distance
d = [0 for i in range(N+1)]
def f(v,p,pcd):
    global t,d
    d[v] = pcd
    for c in t[v]:
        if c[0]!=p:
            f(c[0],v,pcd+c[1])
f(K,0,0)
for i in range(Q):
    x,y = map(int,lines[N+i].split())
    print(d[x]+d[y])

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
N = int(input())
T = [[]for i in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    T[a].append((b,c))
    T[b].append((a,c))
Q,K = map(int,input().split())
D = [0]*(N+1)
def f(v,p,cost):
    global T,K,D
    for C in T[v]:
        if C[0]!=p:
            D[C[0]] = cost+C[1]
            f(C[0],v,cost+C[1])
f(K,0,0)
for i in range(Q):
    x,y = map(int,input().split())
    print(D[x]+D[y])
c=[]
d=0
e=[]

a,b=map(int,input().split())
c=int(input().split())
if c!=null:
 for i in range(c):
  d=a-c
  e.append(abs(d))
print(min(e)) 

### FIXED CODE ###

s=[]
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
  
s=list(map(int,input().split()))
slist=sorted(s)
out=0
for i in range(0,1000):
  out=0
  for j in range(n):
    if slist[j]==x-i:
      out=1
  if out !=1:
   print(x-i)
   exit()
  out=0
  for k in range(n):
    if slist[k]==x+i:
      out=1
  if out !=1:
    print(x+i)
    exit()
a,b,c = map(int,input().split())
print(sorted[a,b,c])


### FIXED CODE ###

x=list(map(int,input().split()))
x.sort()

print(x[0],x[1],x[2])
t = [0]
x = [0]
y = [0]
N = int(input())
for i in range(N):
  ti,xi,yi = map(int,input(),split())
  t.append(ti)
  x.append(xi)
  y.append(yi)
  
flg = True
 
for i in range(1,N+1):
  if t[i]-t[i-1] <　x[i]-x[i-1] + y[i]-y[i-1]:
    flg = False
  elif (t[i]-t[i-1])%2 != (x[i]-x[i-1]+y[i]-y[i-1])%2:
    flg = False
if(flg):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

t = [0]
x = [0]
y = [0]
n = int(input())
for i in range(n):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
    
flg=True
for i in range(1, n+1):
    if((x[i]-x[i-1])+(y[i]-y[i-1])>(t[i]-t[i-1])):
        flg=False
    elif(((x[i]-x[i-1])+(y[i]-y[i-1]))%2!=(t[i]-t[i-1])%2):
        flg=False
if(flg):
    print("Yes")
else:
    print("No")
# N
num = int(input())
# A
greenNum = int(input())
# B
redNum = int(input())

# output
totalGreen = 0
while (num > 0):
  if (num <= greenNum):
    totalGreen += num
    num = 0
  else:
    totalGreen += greenNum
    num -= (greenNum + redNum)
    
print(totalGreen)

### FIXED CODE ###

# N, A, B
num, greenNum, redNum = map(lambda x: int(x), input().split(' '))

numSet = num // (greenNum+redNum)
remain = num % (greenNum+redNum)
numRest = remain if (remain < greenNum) else greenNum

totalGreen = numSet * greenNum + numRest

print(totalGreen)
N,A,B = map(int,input().split())
file = ''
while len(file) <= N+1:
  file += A*"b"
  file += B*"r"
res = file[0:N]
blue = res.count("b")
print(blue)


### FIXED CODE ###

N,A,B = map(int,input().split())
R = N%(A+B)
res = (N//(A+B))*A
if R == 0:
  print(res)
else:
  if R<A:
    print(res+R)
  else:
    print(res+A)
s = list(str(input()))
t = list(str(input()))
count = 0
for i in range(26):
    start[i] = -1
    goal[i] = -1
for i in range(0,len(s)):
    a = s[i]-'a'
    b = t[i]-'a'
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

s = input()
t = input()
start = [-1]*30
goal = [-1]*30
count = 0
for i in range(0,len(s)):
    a = ord(s[i])-ord("a")
    b = ord(t[i])-ord("a")
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
elif count == 0:
    print("Yes")
from collections import OrderedDict
#初期データ、構造
N,Q = (int(x) for x in input().split())
connection ={i:set() for i in range(1,N+1)}
for i in range(N-1):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)
#point =OrderedDict({i:0 for i in range(1,N+1)})
point ={i:0 for i in range(1,N+1)}
for i in range(Q):
    p,x = (int(x) for x in input().split())
    point[p]=x

def DFS(now,prev = -1):
    for next in connection[now]:
        if next == prev:
            continue
        point[next] +=point[now] 
        DFS(next,now)

DFS(1)
print(*point.values())

### FIXED CODE ###

from collections import OrderedDict
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
#初期データ、構造
N,Q = (int(x) for x in input().split())
connection ={i:set() for i in range(1,N+1)}
for i in range(N-1):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)
#point =OrderedDict({i:0 for i in range(1,N+1)})
point ={i:0 for i in range(1,N+1)}
for i in range(Q):
    p,x = (int(x) for x in input().split())
    point[p] +=x

def DFS(now,prev = -1):
    for next in connection[now]:
        if next == prev:
            continue
        point[next] +=point[now] 
        DFS(next,now)

DFS(1)
print(*point.values())
r=input()
r=r*r
print(r)

### FIXED CODE ###

r=int(input())
print(r**2)
a, b = map(int, input().split())
if (a*b) % 2 ==0:
    print(Even)
else:
    print(Odd)

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2 ==0:
    print("Even")
else:
    print("Odd")
import math
all ,blue = map(int,input().split())
red = all - blue

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


for i in range(1,blue+1):
    if (red+1) < i:
        print('0')
    else:
        print((combinations_count(blue-1,i-1)*combinations_count(red+1,i))%(10**9+7))





### FIXED CODE ###

S = list(input())
S.sort()
if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
    print('Yes')
else:
    print('No')
S=list(input())
print(len([i for i in S if S[i]=='1']))

### FIXED CODE ###

a,b,c=map(int,input())
print(a+b+c)
import bisect

n=int(input())
a=[int(input()) for x in range(n)]
c=[]

c.append(a[0])

for i in range(1,n):
  j=bisect.bisect_right(c,a[i])
  if c[j-1]<a[i]:
    c[j-1]=a[i]
  else:
    c.insert(j,a[i])
  print(c)
print(len(c))


### FIXED CODE ###

import bisect

N=int(input())
A=[-int(input()) for i in range(N)]

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))
# -*- coding:utf-8 -*-
import sys

def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if 0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym:
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1, 0, 1, 0]
DY = [0, -1, 0, 1]
sys.setrecursionlimit(10000000)
while True:
	line = input()
	counter+=1
	if ' ' in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(N)] for j in range(M)]
	else:
		tile[counter-2] = list(line)
	if N is 0 and M is 0:
		break
	if counter-1 is M:
		solve()
		counter = 0

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1,0,1,0]
DY = [0,-1,0,1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	if " " in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(M)] for j in range(N)]
	else:
		tile[counter-1] = list(line)
	if N is 0 and M is 0:
		break
	counter += 1
	if counter-1 is N:
		solve()
		counter = 0
x,y = map(int,input().split().strip())
s=x*y
p=2*(x+y)
print("%d %d"%(s,p))

### FIXED CODE ###

x,y = map(int,input().split())
s=x*y
p=2*(x+y)
print("%d %d"%(s,p))
from math import factorial

def comb(n, k):
  return factorial(n)/factorial(n-k)/factorial(k)

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

for i in range(1, K+1):
  a = comb(N-K+1, i)%(10**9+7)
  b = comb(K-1, i-1)%(10**9+7)
  print(int((a*b)%(10**9+7)))

### FIXED CODE ###

from math import factorial
 
def comb(n, k):
  return int(factorial(n))//int(factorial(n-k))//int(factorial(k))
 
N, K = map(int, input().split())
 
for i in range(1, K+1):
  if N-K-i+1 < 0:
    print(0)
  else:
    a = comb(N-K+1, i)%(10**9+7)
    b = comb(K-1, i-1)%(10**9+7)
    print(int((a*b)%(10**9+7)))
num = list(map(int, input().split()))
num = "".join(num)

if num % 4 == 0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

num = list(input().split())
num = int("".join(num))


if num % 4 == 0:
    print("YES")
else:
    print("NO")
X = int(input())

max_a = 128
min_a = -63

for i in range(-100,100):
    for j in range(-100,100):
      if i**5 - j **5 == X
      print(i,j)
      exit()
      






### FIXED CODE ###

X = int(input())

flg = 0
for i in range(-200,200):
  if flg == 1:
    break

  for j in range(-200,200):
      if i**5 - j **5 == X:
        print(i,j)
        flg = 1
        break
n,m=map(int,input().split())
A=[input().split()for _ in[0]*n]
b=[input()for _ in[0]*m]
for a in A:print(sum(x*y for x,y in map(int,zip(a,b))))


### FIXED CODE ###

n,m=map(int,input().split())
A=[input().split()for _ in[0]*n]
b=[input()for _ in[0]*m]
for a in A:print(sum(int(x)*int(y)for x,y in zip(a,b)))
n = int(input())
x = list(map(int, input().split()))

max_x = max(x)
min_x = min(x)

ans = []
for i in range(min_x, max_x):
  a = 0
  for xi in x:
    a += (xi - (i+1))*(xi - (i+1))
  ans.append(a)
  
print(min(ans))

### FIXED CODE ###

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

max_x = max(x)
min_x = min(x)

ans = []
for i in range(1, 101):
  a = 0
  for xi in x:
    a += (xi - i)*(xi - i)
  ans.append(a)
  
print(min(ans))
a,b=map(int,input().split())
c=input()
s=[]
for i in range(N):
    s.append(input())
s.sort()
print("".join(s))


### FIXED CODE ###

n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")
D,G = list(map(int,input().split()))
pc = [[i]+list(map(int,input().split())) for i in range(D)]

for i,row in enumerate(pc):
    s = (i+1)*row[1] * 100 + row[2]
    ave = s/row[1]
    pc[i].append(s)
    pc[i].append(ave)

out = 0
while 1:
    check=False
    i_list = []
    for i,row in enumerate(pc):
        if G<row[3]:
            check=True
            i_list.append(i)
    if check == False:
        #どれをコンプリートしても目標を超えない
        #問題数当たり平均が最高の問題セットを解く
        tmp = [row[4] for row in pc]
        i = tmp.index(max(tmp))
        out += pc[i][1]
        G -= pc[i][3]
        pc.pop(i)
    else:
        #どれかをコンプリートすると目標を達成
        #最小問題数のセット または 最高得点問題での必要数
        tmp = [pc[i][1] for i in i_list]
        m = min(tmp)
        if pc[-1][3] > G:
            m = min(m,(G-1)//((pc[-1][0]+1)*100)+1)
        out += m
        break
print(out)

### FIXED CODE ###

D,G = list(map(int,input().split()))
pc = [list(map(int,input().split())) for i in range(D)]

ans = sum([p for p,c in pc])
for i in range(2**D-1):
    score = 0
    unused_max = D-1
    sum_p = 0
    for j in range(D-1,-1,-1):
        if (i>>j)%2:
            score += pc[j][1] + pc[j][0]*(j+1)*100
            sum_p += pc[j][0]
            if unused_max == j:
                unused_max -= 1
    if G - score <= (pc[unused_max][0]-1)*(unused_max+1)*100:
        ans = min(ans,sum_p+max(0,(G-score-1)//(100*(unused_max+1))+1))
print(ans)
import copy
import sys
H, W, M= map(int,input().split())
height = [0] * H
width = [0] * W
object = []
for i in range(H):
   wi = [0] * W
   object.append(wi)
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object[h-1][w-1] = 1
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max - 1
p = len(cand_h)*len(cand_w)
if M >= p:
   for i in range(len(cand_h)):
      for j in range(len(cand_w)):
         if object[cand_h[i]][cand_w[j]] == 0:
            ans = h_max + w_max
            break
            break           
else:
   ans += 1
print(ans) 


### FIXED CODE ###

import copy
import sys
H, W, M= map(int,input().split())
height = [0]*H
width = [0]*W
object = []
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object.append([h-1, w-1])
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max
c = 0
p = len(cand_h)*len(cand_w)
cand_h = set(cand_h)
cand_w = set(cand_w)
if M >= p:
   for i in range(len(object)):
      if object[i][0] in cand_h and object[i][1] in cand_w:
         c += 1
print(ans - (c == p))
# -*- coding: utf-8 -*-
from sympy import *

x, y, z = symbols('x y z')
N, price = list(map(int, input().split()))

if N * 10000 < price or N * 1000 > price:
    li = map(str, [-1] * 3)
else:
    temp = 10000 * N
    x, y = 0, 0

    for i in range(N):
        if x < 0:
            break;
        if temp == price:
            break;
        elif temp > price:
            y += 1
            temp -= 9000
        else:
            x += 1
            y -= 1
            temp += 4000
    li = map(str, [N - x - y, x, y]) if y >= 0 else map(str, [-1] * 3)

print(" ".join(li))


### FIXED CODE ###

# -*- coding: utf-8 -*-
N, price = list(map(int, input().split()))

li = map(str, [-1] * 3)

if N * 10000 >= price and N * 1000 <= price:
    x = price // 10000
    for i in range(x + 1):
        y = (price - i * 10000) // 5000
        for j in range(y + 1):
            if N >= i + j and price == i * 10000 + j * 5000 + (N - i - j) * 1000:
                li = map(str, [i, j, N - i - j])

print(" ".join(li))
n,k = map(int,input().split())

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

print(ans)

### FIXED CODE ###

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

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