Problem:


Score : 300 points

Problem Statement

You are given an integer N.

Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.

If there are multiple solutions, any of them will be accepted.

Constraints

It is guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500.

Inputs

Input is given from Standard Input in the following format:

N

Outputs

Print a triple of positive integers h, n and w that satisfies the condition, in the following format:

h n w

Sample Input 1

2

Sample Output 1

1 2 2

4/2 = 1/1 + 1/2 + 1/2.

Sample Input 2

3485

Sample Output 2

872 1012974 1539173474040

It is allowed to use an integer exceeding 3500 in a solution.

Sample Input 3

4664

Sample Output 3

3498 3498 3498



Sample input:
2


Sample output:
1 2 2

Submission status: Accepted

Solution code:
n=int(input())

for i in range(3500):
  for j in range(3500):
    if(4*(i+1)*(j+1)-n*(i+1)-n*(j+1)!=0):
      hoge=n*(i+1)*(j+1)/(4*(i+1)*(j+1)-n*(i+1)-n*(j+1))
      if(hoge%1==0):
        if(0<=hoge and hoge<=3500):
          print(i+1,j+1,int(hoge))
          exit()

Submission status: Accepted

Solution code:
n=int(input())
def ac():
    for h in range(1,3501):
        for w in range(1,3501):
            try:
                num=(n*h*w)/(4*h*w-n*w-n*h)
                if (num).is_integer() and num>0:
                    print("{} {} {}".format(h,w,int(num)))
                    return
            except:
                pass
ac()

Submission status: Accepted

Solution code:
from itertools import product
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        a = (4 * h * n - N * n - N * h)
        if a > 0 and (N * h * n) % a == 0:
            w = (N * h * n) / a
            int_w = int(w)
            if w == int_w:
                print(n,h,int_w)
                exit()

Submission status: Accepted

Solution code:
N = int(input())
if N%2 == 0:
    h = N//2
    n = N
    w = N
    print(h, n, w)
else:
    i = 2
    flag = False
    while True:
        child = i * 4
        mother = i * N
        for j in range(1, child-1):
            for k in range(1, child-j):
                m = child - j - k
                if mother%j == 0 and mother%k==0 and mother%m == 0:
                    print(mother//j, mother//k, mother//m)
                    flag = True
                    break
            if flag:
                break
        if flag:
            break
        i += 1

Submission status: Accepted

Solution code:
n = int(input())
for a in range(1,3501):
    for b in range(1,3501):
        if 4*a*b-n*a-n*b == 0:
            continue
        if 1 <= n*a*b//(4*a*b-n*(a+b)) <= 3500 and (n*a*b)%(4*a*b-n*a-n*b) == 0:
            print(a,b,n*a*b//(4*a*b-n*(a+b)))
            exit()

Submission status: Accepted

Solution code:
N=int(input())

flag=0
for h in range(1,3501):
  for n in range(h,3501):
    if flag==0:
      val=4*h*n-n*N-h*N
      if val != 0:
        w=N*h*n/val
        if int(w)==w and w > 0:
          print(h,n,int(w))
          flag=1
    if flag==1:
      break

Submission status: Accepted

Solution code:
N=int(input())

flag=0
for h in range(1,3501):
  for n in range(h,3501):
    if flag==0:
      val=4*h*n-n*N-h*N
      if val != 0:
        w=N*h*n/val
        if int(w)==w and w > 0:
          print(h,n,int(w))
          flag=1

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1,3500):
    for j in range(1,3500):
        if 4 * i * j - N * i - N * j == 0:
            continue
        k = N * i * j / (4 * i * j - N * i - N * j)
        if k > 0 and k == int(k):
            print(i, j, int(k))
            exit()

Submission status: Accepted

Solution code:
from itertools import product

N = int(input())
for h, n in product(range(1, 3501), repeat=2):
    if 4 / N > 1 / h + 1 / n:
        numer = N * h * n
        denom = 4 * h* n - N * (n + h)
        if denom <= 0:
            continue
        w, r = divmod(numer, denom)
        if r == 0:
            print(h, n, w)
            break

Submission status: Accepted

Solution code:
N=int(input())
flag=0
for w in range(1,3501):
  if flag==1:
    break
  for n in range(1,3501):
    if 4*w*n-N*n-N*w<=0:
      continue
    if N*w*n%(4*w*n-N*n-N*w)==0:
      print(N*w*n//(4*w*n-N*n-N*w),w,n)
      flag=1
      break

Submission status: Accepted

Solution code:
N = int(input())

for w in range(1, 3501):
    for h in range(w, 3501):
        if (4/N - 1/w - 1/h) < 0:
            continue
        if (4*h*w - N*h - N*w) == 0:
            continue
        
        n = (N*h*w)/(4*h*w - N*h - N*w)
        if n == int(n) and n > 0:
            print(int(n), h, w)
            exit()

Submission status: Accepted

Solution code:
def main() :
    N = int(input())
    # N = float(input())

    # 式変形していいかんじに下ごしらえして、
    # 2変数分のループで全探索する。O(3500^2)なら間に合うはず。

    # for h in range(1,3501) :
    for h in range(1,3500) :
        # 組み合わせでみればいいので1からじゃなくてよい
        for n in range(h,3501) :
            bo = 4*h*n - N*n - N*h
            if (bo == 0) :
                continue

            omega = (N * h * n) / bo * 1.0
            if (omega > 0 and omega.is_integer() == True) :
                print(h,n,int(omega))
                return

main()

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1, 3501):
	for n in range(h, 3501):
		wb = 4*h*n - N*n - N*h
		if wb <= 0:
			continue
		w = N*h*n / wb
		if w.is_integer():
			print(h, n, int(w))
			exit()

Submission status: Accepted

Solution code:
N=int(input())
for h in range(1,3501):
  if 4*h-N!=0:
    n=(N*h)//(4*h-N)+1
    if 4*h*n-N*(h+n)>0 and (N*h*n)%(4*h*n-N*(h+n))==0:
      w=(N*h*n)//(4*h*n-N*(h+n))
      break
print(h,n,w)

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1,3501):
    for w in range(h,3501):
        if (4 * h * w - N * w - N * h) > 0 and N * h * w % (4 * h * w - N * w - N * h) == 0:
            n = N * h * w // (4 * h * w - N * w - N * h)
            print(h, w, n)
            quit()
        else:
            continue

Submission status: Accepted

Solution code:
n=int(input())

for i in range(1,3501):
    for j in range(i,3501):
        if (4*i*j-n*i-n*j)>0 and n*i*j%(4*i*j-n*i-n*j)==0:
            w=n*i*j//(4*i*j-n*i-n*j)
            print(i,j,w)
            quit()
        else:
            continue

Submission status: Accepted

Solution code:
N=int(input())
for i in range(1,3501):
  for j in range(i,3501):
    if (4*i*j-N*(i+j))>0 and N*i*j%(4*i*j-N*(i+j))==0:
      k=N*i*j//(4*i*j-N*(i+j))
      print(i,j,k)
      break
  else:
    continue
  break

Submission status: Accepted

Solution code:
n=int(input())
for i in range(1,3501):
  for j in range(i,3501):
    if (4*i*j-n*(i+j))>0 and n*i*j%(4*i*j-n*(i+j))==0:
      k=n*i*j//(4*i*j-n*(i+j))
      break
  else:
    continue
  break
print(i,j,k)

Submission status: Accepted

Solution code:
import math
N=int(input())
h_max=math.floor(3*N/4)
d=10**(-5)
for h in range(1,min(h_max+1,3501)):
     if 4/N - 1/h == 0:
          continue
     n_max=math.floor(2/(4/N - 1/h))
     for n in range(h,min(n_max+1,3501)):
          if 4/N-1/h-1/n == 0:
               continue
          w=1/(4/N-1/h-1/n)
          if w-d<round(w) and round(w)<w+d and round(w)>=n:
               print(h,n,round(w))
               break
     else:
          continue
     break

Submission status: Accepted

Solution code:
N=int(input())

for h in range(1,3501):
    if (4*h <= N):
        continue
    nn = int (N*h / (4*h-N))
    for n in range(max(1,nn),3501):
        t = 4*h*n - N*h - N*n
        if t <= 0:
            continue
        s = N*h*n
        if s % t == 0:
            print(h, n, int(s/t))
            quit()

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1, 3501):
    a = 4 * h - N
    if a <= 0:
        continue
    for n in range(max(h, N * h // a + 1), 3501):
        q = 4 * h * n - N * h - N * n
        if q <= 0:
            continue
        p = N * h * n
        if p % q == 0:
            print(h, n, int(p / q))
            quit()

Submission status: Accepted

Solution code:
N=int(input())
for h in range(1,3501):
    for n in range(1,3501):
        #print(n,h)
        if 4*n*h-N*h-N*n<=0:
            continue
        w=(N*n*h)/(4*n*h-N*h-N*n)
        if int(w)==w:
            print(h,n,int(w))
            exit()

Submission status: Accepted

Solution code:
N = int(input())
ans = []
n = 4/N
for i in range(1,3501):
    flag = True
    for j in range(1,3501):
        if(4*i*j-N*j-N*i==0):
            continue
        k = N*i*j/(4*i*j-N*j-N*i)
        if(int(k)==k and k>0):
            ans=[i,j,int(k)]
            flag = False
            break
    if(not flag):
        break
print(ans[0],ans[1],ans[2])

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1,3501):
    for n in range(1,3501):
        d = 4 * h * n - N * (n + h)
        if d <= 0:
            continue
        if (N * h * n)%d == 0:
            print(h,n,(N * h * n)//d)
            exit()

Submission status: Accepted

Solution code:
N = int(input())

num = 3505

for i in range(1, num):
    if N / 4 < i:
        for j in range(1, num):
            if N / 4 < (i * j) / (i + j):
                w = (N * i * j) / (4 * i * j - i * N - j * N)
                if w.is_integer():
                    print(i, j, int(w))
                    exit()

Submission status: Accepted

Solution code:
N = int(input())

num = 3505

for i in range(1, num):
    if 4 / N > 1 / i:
        for j in range(1, num):
            if 4 / N > 1 / i + 1 / j:
                w = (N * i * j) / (4 * i * j - i * N - j * N)
                if w.is_integer():
                    print(i, j, int(w))
                    exit()

Submission status: Accepted

Solution code:
N = int(input())

num = 3505

for i in range(1, num):
    if 4 / N > 1 / i:
        for j in range(1, num):
            if 4 / N > 1 / i + 1 / j:
                w = (N * i * j) / (4 * i * j - i * N - j * N)
                if w.is_integer():
                    print(i, j, int(w))
                    exit()

Submission status: Accepted

Solution code:
N = int(input())
for i in range(1, 3501):
    for j in range(1, 3501):
        if 4 * i * j - N * i - N * j > 0 and (N * i * j) % (4 * i * j - N * i - N * j) == 0:
            print(i, j, (N * i * j) // (4 * i * j - N * i - N * j))
            exit()

Submission status: Accepted

Solution code:
def main():
    buf = input()
    N = int(buf)
    if N % 2 == 0:
        print(N // 2, N, N)
        return
    else:
        divisor = N
        mult = 1
        while True:
            factor = factorization(divisor)
            for h in factor:
                for n in factor:
                    for w in factor:
                        if h + n + w == 4 * mult:
                            print(divisor // h, divisor // n, divisor // w)
                            return
            divisor += N
            mult += 1

def factorization(number):
    i = 2
    factor = {1, number}
    while i * i <= number:
        if number % i == 0:
            factor.add(i)
            factor.add(number // i)
        i += 1
    return factor

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (4 * h * n - N * (h + n)) != 0:
            if (N * h * n) / (4 * h * n - N * (h + n)) == (N * h * n) // (4 * h * n - N * (h + n)):
                w = (N * h * n) // (4 * h * n - N * (h + n))
                if w > 0:
                    print(h, n, w)
                    exit()

Submission status: Accepted

Solution code:
N = int(input())
is_exist = False
for h in range(1, 3501):
  for n in range(1, 3501):
    if (4*h*n-N*n-N*h) > 0 and (N*h*n) % (4*h*n-N*n-N*h) == 0:
      print(h, n, (N*h*n) // (4*h*n-N*n-N*h))
      is_exist = True
      break
  if is_exist:
    break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

flag = False
for h in range(1,3500):
    for n in range(h,3500):
        if 4 * h * n - N * h - N * n == 0:
            continue
        if (N * n * h) % (4 * h * n - N * h - N * n) != 0:
            continue
        w = int((N * n * h) / (4 * h * n - N * h - N * n))
        if w <= 0:
            continue
        print(n,h,w)
        flag = True
        break
    if flag:
        break

Submission status: Accepted

Solution code:
n = int(input())
for i in range(1,3501):
    for j in range(1,3501):
        if 4*i*j -n * (i+j) > 0:
            if n*i*j % (4*i*j-n*(i+j)) == 0:
                print(i,j,n*i*j // (4*i*j-n*(i+j)))
                exit()

Submission status: Accepted

Solution code:
N = int(input())

for h in range(3501):
    for n in range(1,3501):
        a = 4*h*n - N*(h+n)
        if a>0:
            w = N*h*n / a
            if w==int(w):
                print("{} {} {}".format(int(w),n,h))
                exit()

Submission status: Accepted

Solution code:
N=int(input())

for a in range(1,3501):
    for b in range(1,3501):
        if (4*a*b-N*a-N*b)>0:
            c=N*a*b/(4*a*b-N*a-N*b)
            if c==int(c):
                if 4*a*b*c==N*(a*b+b*c+c*a):
                    print(a,b,int(c))
                    exit()

Submission status: Accepted

Solution code:
def solve(N):
    for h in range(1, 3501):
        for n in range(1, 3501):
            d = 4*h*n - N*h - N*n
            if d <= 0: continue
            w = N*h*n / d
            if w == int(w):
                print(h, n, int(w))
                return

N = int(input())

solve(N)

Submission status: Accepted

Solution code:
def solve(N):
    for h in range(1, 3501):
        for n in range(1, 3501):
            d = 4*h*n - N*h - N*n
            if d == 0: continue
            w = N*h*n / d
            if 0 < w and w == int(w):
                print(h, n, int(w))
                return

N = int(input())

solve(N)

Submission status: Accepted

Solution code:
import sys

n = int(input())

for a in range(1,3501):
  for b in range(1,3501):
    if((4*a*b - n*b - n*a) > 0):
      c = (n*a*b) / (4*a*b - n*b - n*a)
      if(c.is_integer()):
        print('%d %d %d' % (a, b, c))
        sys.exit()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    w1 = 10**5
    w2 = 1
    try:
        for h in range(1,3501):
            for n in range(1,3501):
                if (4*h*n-N*(h+n))>0:
                    w1 = (N*h*n)//(4*h*n-N*(h+n))
                    w2 = (N*h*n)/(4*h*n-N*(h+n))
                if w1==w2 and w1>0:
                    raise(Exception)
    except Exception:
        print(h,n,w1)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())

for h in range(N//4 +1, min(3501, 3*N//4 +1)):
  for n in range((N*h)//(4*h-N), min(3501, ((2*N*h)//(4*h-N))+1)):
    #print(h,n)
    x = 4*h*n - N*n - N*h
    y = N*h*n
    if x>0 and not y%x:
      print('{} {} {}'.format(h,n,y//x))
      exit()

Submission status: Accepted

Solution code:
N=int(input())

if N==2:
  print('1 2 2')
  exit()

for h in range(N//4 +1, min(3501, 3*N//4 +1)):
  for n in range((N*h)//(4*h-N), min(3501, (2*N*h)//(4*h-N))):
    x = 4*h*n - N*n - N*h
    y = N*h*n
    if x>0 and not y%x:
      print('{} {} {}'.format(h,n,y//x))
      exit()

Submission status: Accepted

Solution code:
N=int(input())
l=[]
for h in range(1,3501):
  for n in range(1,3501):
    try:
      final=N*h*n/(4*h*n-N*n-N*h)
      if final.is_integer()==True and final>0:
        w=int(final)
        l.append([h,n,w])
    except:
      pass
print("{0} {1} {2}".format(l[0][0],l[0][1],l[0][2]))

Submission status: Accepted

Solution code:
import sys
MOD = 10 ** 9+7
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


N = ii()
for h in range(1, 3500):
    for n in range(1, 3500):
        if (4 * h * n - N * n - N * h) > 0 and (N * h * n) % (4 * h * n - N * n - N * h) == 0:
            print(h, n, (N * h * n)//(4 * h * n - N * n - N * h))
            exit()

Submission status: Accepted

Solution code:
N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    if 4*n*h-N*h-N*n>0 and N*h*n%(4*n*h-N*h-N*n)==0:print(h,n,N*h*n//(4*n*h-N*h-N*n));exit()

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1, 3501):

    for n in range(1, 3501):

        if (4*h*n - N*n - N*h)<=0:
            continue

        w = N*h*n/(4*h*n - N*n - N*h)
        flag = w.is_integer()
        # print(flag)
        
        if flag and w>0:
            print(h, n, int(w))
            exit()

Submission status: Accepted

Solution code:
N = int(input())
w1 = 10**5
w2 = 1
try:
    for h in range(1,3501):
        for n in range(1,3501):
            if (4*h*n-N*(h+n))>0:
                w1 = (N*h*n)//(4*h*n-N*(h+n))
                w2 = (N*h*n)/(4*h*n-N*(h+n))
            if w1==w2 and w1>0:
                raise(Exception)
except Exception:
    print(h,n,w1)

Submission status: Accepted

Solution code:
n=int(input())
flag=True
for a in range(1,3501):
    for b in range(1,3501):
        if 4*a*b-n*(a+b)>0 and (n*a*b)%(4*a*b-n*(a+b))==0:
            print(a,b,n*a*b//(4*a*b-n*(a+b)))
            exit()

Submission status: Accepted

Solution code:
N = int(input())
flag = True
for h in range(1,3501):
    for n in range(1,3501):
        if 4*h*n-N*(n+h) <= 0:
            continue
        if N*h*n < (4*h*n-N*(n+h)):
            continue
        if flag and (N*n*h) % (4*h*n-N*(n+h)) == 0:
            print(str(h)+' '+str(N*n*h //(4*h*n-N*(n+h)))+' '+str(n))
            flag = False
        if not flag:
            break
    if not flag:
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8-*-
def f(N):
    for i in range(1, 3501):
        a = 4 * i - N
        b = N * i
        if a <= 0:
            continue
        for j in range(i, 3501):
            c = a * j - b
            d = b * j
            if c <= 0:
                continue
            if d % c == 0:
                return (i, j, d//c)


if __name__ == '__main__':
    N = int(input())
    h, n, w = f(N)
    print(h, n, w)

Submission status: Accepted

Solution code:
import sys
MOD = 10 ** 9+7
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


N = ii()
for h in range(1, 3500):
    for n in range(1, 3500):
        if (4 * h * n - N * n - N * h) > 0 and (N * h * n) % (4 * h * n - N * n - N * h) == 0:
            print(h, n, (N * h * n)//(4 * h * n - N * n - N * h))
            exit()

Submission status: Accepted

Solution code:
import sys

n = int(input())

def main():
    for i in range(1, 3500):
        for j in range(1, 3500):
            z = 4 * i * j - n * i - n * j
            if z > 0:
                x = n * i * j / z
                if x == int(x):
                    print(i, j, int(x))
                    sys.exit()


main()

Submission status: Accepted

Solution code:
n = int(input())
if n%2 == 0:
  print(n,n,n//2)
else:
  for h in range(max(2, n//4),3501):
    for l in range(max(2, n//4),3501):
      m = n*h*l
      c = 4*h*l - n*(h+l)
      if c > 0 and m%c == 0:
        w = m//c
        print(h,l,w)
        exit()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        if (4 * h * n - N * n - N * h) != 0:
            w = (N * h * n)/(4 * h * n - N * n - N * h)
            if w == w // 1 and w > 0:
                w = int(w)
                print(h, n, w)
                exit()

Submission status: Accepted

Solution code:
N = int(input())
flag = 0
for i in range(1, 3501):
    for j in range(1, 3501):
        if 4*i*j - i*N - j*N > 0:
            if (N*i*j) % (4*i*j - i*N - j*N) == 0:
                print(i, j, (N*i*j) // (4*i*j - i*N - j*N))
                flag = 1
                break
    if flag == 1:
        break

Submission status: Accepted

Solution code:
from itertools import product
n = int(input())
if n%2 == 0:
  print(n,n,n//2)
else:
  for h,l in product(range(max(2, n//4),3501),repeat=2):
    m = n*h*l
    c = 4*h*l - n*(h+l)
    if c > 0 and m%c == 0:
      w = m//c
      break
  print(h,l,w)

Submission status: Accepted

Solution code:
N = int(input())
for n in range(1,3501):
  for w in range(n,3501):
    if (4*n*w-w*N-n*N) > 0:
      h = n*w*N/(4*n*w-w*N-n*N)
      if h == int(h) and h > 0:
        print(int(h),n,w)
        exit()

Submission status: Accepted

Solution code:
s=int(input());
for n in range(s//4,3501):
 for h in range(3501):
  x=4*h*n-s*n-s*h
  if x>0:
   if ((s*h*n)/x).is_integer():
    print(int((s*h*n)/x),h,n)
    exit()

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1,3501):
    for j in range(i,3501):
        if 4*j*i-n*i-n*j != 0 and (n*i*j)%(4*j*i-n*i-n*j) == 0:
            R = (n*i*j)//(4*j*i-n*i-n*j)
            if R > 0:
                print(i,j,R)
                exit()

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (4 * h * n - N * n - N * h) != 0:
            if (N * h * n) % (4 * h * n - N * n - N * h) == 0:
                w = N * h * n // (4 * h * n - N * n - N * h)
                if w > 0:
                    res1 = h
                    res2 = n
                    res3 = w
                
print(res1, res2, res3)

Submission status: Accepted

Solution code:
n=int(input())
import sys
for a in range(1,3501):
    for b in range(1,3501):
        if 4*a*b -n*a -n*b<=0:
            continue
        c=n*a*b/(4*a*b -n*a -n*b)
        if not 0<c<=3500:
            continue
        if c==int(c):
            print(a,b,int(c))
            sys.exit()

Submission status: Accepted

Solution code:
import sys
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if 4*h*n -N*h -N*n <= 0: continue
        w = N*h*n/(4*h*n -N*h -N*n)
        if not 0<w<=3500: continue 
        if w==int(w):
            print(h,n,int(w))
            sys.exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

for n in range(1,3500+1):
    for h in range(1,3500+1):
        if (4*h*n-N*n-N*h)>0 and (N*h*n)%(4*h*n-N*n-N*h)==0:
            w = (N*h*n)//(4*h*n-N*n-N*h)
            print(h,n,w)
            exit()

Submission status: Accepted

Solution code:
s=int(input())
for i in range(s//4,3501):
    for j in range(1,3501):
        t=4*i*j-i*s-j*s
        y=s*i*j
        if t>0 and s*i*j%t==0:
            print(s*i*j//t,i,j)
            exit()

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1, 3501):
    for j in range(1, 3501):
        if (4 * i * j - N * i - N * j) <= 0:
            continue
        if (N * i * j) % (4 * i * j - N * j - N * i) == 0:
            print(i, j, (N * i * j) // (4 * i * j - N * j - N * i))
            exit()

Submission status: Accepted

Solution code:
n = int(input())
imin = n // 4
flag = False
for i in range(imin, 3501):
    num = i * n
    den = 4 * i - n
    if den <= 0:
        continue
    jmin = num // den
    for j in range(jmin, 3501):
        num = i * j * n
        den = 4 * i * j - i * n - j * n
        if den > 0 and num % den == 0:
            k = num // den
            print("{} {} {}".format(i, j, k))
            flag = True
            break
    if flag:
        break

Submission status: Accepted

Solution code:
import sys
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if  4*n*h-N*(n+h) > 0:
            if N*h*n % (4*n*h-N*(n+h)) == 0:
                print(n,h,int(N*h*n // (4*n*h-N*(n+h))))
                sys.exit()

Submission status: Accepted

Solution code:
n = int(input())
for i in range(1,3501):
    for j in range(i, 3501):
        top = n*i*j
        bot = 4*i*j - n*(i+j)
        if bot > 0 and top%bot == 0:
            w = top//bot
            if w > 0:
                print(i, j, w)
                exit()

Submission status: Accepted

Solution code:
N=int(input())
for i in range(1,3501):
    for j in range(i,3501):
        bw=4*i*j-N*i-N*j
        if bw<=0:
            continue
        if (N*i*j)%bw==0:
            print(i,j,(N*i*j)//bw)
            exit()

Submission status: Accepted

Solution code:
N = int(input())

for h in range(1,3501):
    if 4*h != N:
        n_min = max(N*h //(4*h - N), 1)
    else:
        n_min = 1
#    print(n_min)
    for n in range(n_min,3501):
        nume = N*h*n
        enum = 4*h*n - N*n - N*h

        if enum > 0 and nume%enum == 0:
            w = nume//enum
            print(h,n,w)
            exit()

Submission status: Accepted

Solution code:
N = int(input())
Ans = []
for h in range(1, 3501):
    for n in range(h, 3501):
        if 4 * h * n > N * (h + n) and N*h*n % (4*h*n - N*(h+n)) == 0:
            w = N*h*n // (4*h*n - N*(h+n))
            Ans = [h, n, w]
            break
    if Ans:
        break
print(" ".join(map(str, Ans)))

Submission status: Accepted

Solution code:
N = int(input())

for n in range(1,3501):
    for h in range(1,3501):
        if 4*h*n-N*(n+h) > 0:
            if (N*h*n)%(4*h*n-N*(n+h)) == 0:
                w = (N*h*n)//(4*h*n-N*(n+h))
                print(h,n,w)
                exit(0)

Submission status: Accepted

Solution code:
N = int(input())
def check():
    for h in range(1,3500):
        for n in range(1,3500):
            div = 4 * n * h - N * h - N * n
            if div > 0 and N * h * n % div == 0:
                print(h, n, N * h * n // div)
                return 0
check()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(1, 3501):
    for n in range(h, 3501):
        waru = 4 * h * n - N * n - N * h
        if waru > 0 and (N * h * n) % waru == 0:
                print("{} {} {}".format(h, n, (N * h * n) // waru))
                exit()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        waru = 4 * h * n - N * n - N * h
        if waru != 0:
            w = (N * h * n) / waru
            if w > 0 and int(w) / w == 1:
                print("{} {} {}".format(h, n, int(w)))
                exit()

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1, 3501):
    for j in range(i, 3501):
        if (4 * i * j - N * i - N * j) <= 0:
            continue
        if N * i * j % (4 * i * j - N * i - N * j) == 0:
            print(i, j, N * i * j // (4 * i * j - N * i - N * j))
            exit()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(3501):
    for w in range(3501):
        if 4*h*w-N*h-N*w <= 0:
            continue
        n = N*h*w/(4*h*w-N*h-N*w)
        if int(n) == n:
            print(h,int(n),w)
            exit()

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())



N = ni()
MAX = 3500
EPS = 10**(-6)
ha,wa,na = 0,0,0

for h in range(MAX+1):
    for w in range(MAX+1):
        if 4*h*w - N*w - N*h > 0:            
            if abs((N*h*w) / (4*h*w - N*w - N*h)) - ((N*h*w) // (4*h*w - N*w - N*h)) == 0:
                ha = h
                wa = w
                na = (N*h*w) // (4*h*w - N*w - N*h)
                
print(ha,na,wa)

Submission status: Accepted

Solution code:
N = int(input())
h_limit = N * 3 // 4
ok = False

for h in range(1, 3501):
	for n in range(1, 3501):
			if 1 / h + 1 / n < 4 / N:
				w = 1 / (4 / N - 1 / h - 1 / n)
				if 0 < w < 10 ** 16 and abs(w - int(w)) < 10 ** (-7):
					print(h, n, int(w))
					ok = True
					break

	if ok:
		break

Submission status: Accepted

Solution code:
N=int(input())
 
for h in range(1,3501):
  for n in range(1,3501):
    #divが負数ならwは負数になる
    if (4*h*n)-(N*n)-(N*h)>0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w.is_integer():
        print(h,n,int(w))
        exit()

Submission status: Accepted

Solution code:
N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    if (4*h*n-N*n-N*h)>0:
      w=(N*h*n)/(4*h*n-N*n-N*h)
      if w==int(w) and w>0:
        print(h,n,int(w))
        exit()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(1, 3500):
    for n in range(1, 3500):
        if (4*h*n - N*h - N*n) == 0:
            continue
        w = N*h*n / (4*h*n - N*h - N*n)
        if w.is_integer() and 1 <= w <= 3500:
            print(h, n, int(w))
            exit()

Submission status: Accepted

Solution code:
N = int(input())
h = 0
n = 0
w = 0
for i in range(1,3501):
    if h !=0:
        break
    else:
        for j in range(1,3501):
            if 4*i*j-N*(i+j) > 0:
                if (N*i*j)%(4*i*j-N*(i+j)) == 0:
                    h = i
                    n = j
                    w = (N*i*j)//(4*i*j-N*(i+j))
                    break
print(h,n,w)

Submission status: Accepted

Solution code:
def main():
    N = int(input())

    h, n, w = -1, -1, -1
    for i in range(1, 3501):
        for j in range(i, 3501):
            if 4*i*j > N*i+N*j:
                if N*i*j % (4*i*j-N*i-N*j) == 0:
                    h, n = i, j
                    w = N*i*j // (4*i*j-N*i-N*j)
                    break

        else:
            continue
        break

    print(h, n, w)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#%%time
N = int(input())

isok=False
for h in range(1,3501):
    bunsi = 4*h - N
    bunbo = N*h
    if bunsi>0:
        n = (bunbo//bunsi) + 1
        bunsi = 4*h*n - N*(h+n)
        bunbo = N*h*n
        if bunsi>0 and bunbo%bunsi==0:
            w = bunbo//bunsi
            isok = True
            break
        
if isok:
    print(h,n,w)
else:
    print("ここ来たらマジでヤバいが")

Submission status: Accepted

Solution code:
N=int(input())
for h in range(2,3501,2):
  for n in range(2,3501,2):
    if (4*h*n-N*n-N*h) != 0 and (N*h*n)%(4*h*n-N*n-N*h) == 0:
      if 0 < (N*h*n)//(4*h*n-N*n-N*h):
        print(h,n,(N*h*n)//(4*h*n-N*n-N*h))
        exit()

Submission status: Accepted

Solution code:
import sys
import math
import itertools

N=int(input())
if(N%4==0):
    x=3*N//4
    print(x,x,x)
    exit()
for x in range(3501):
    if(4*x-2*N>0 and (N*x)%(4*x-2*N)==0):
        h=(N*x)//(4*x-2*N)
        print(h,x,x)
        exit()
if(N>2000):st=-1
else:st=1
for h,n in itertools.product(range(1,3501)[::st],range(1,3501)[::st]):
    x=N*h*n
    y=4*n*h-N*n-N*h
    if(y>0 and x%y==0):
        print(h,n,x//y)
        break
"""
4/N=1/h+1/n+1/w
4/N=(nw+hw+hn)/nhw
4nhw/N=nw+hw+hn
4nhw=Nnw+Nhw+Nhn
(4nh-Nn-Nh)w=Nhn
w=Nhn/(4nh-Nn-Nh)

4/N=3/x
4x/N=3
4x=3N
h,n,w=3N/4  (N%4==0)

4/N=1/h+2/x
4/N-2/x=1/h
(4x-2N)/Nx=1/h
h=Nx/(4x-2N)
"""

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 0:
    print(N // 2, N, N)
    quit()
for h in range(1, 3500+1):
    hN = h * N
    for n in range(h, 3500+1):
        b = (4 * h * n - n * N - hN)
        if b <= 0:
            continue
        a = (n * hN)
        if a % b == 0:
            print(h, n, a // b)
            quit()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(1, 3500 + 1):
    for n in range(h, 3500 + 1):
        if (4 * h * n - N * n - N * h) <= 0:
            continue
        if N * h * n % (4 * h * n - N * n - N * h) == 0:
            w = N * h * n // (4 * h * n - N * n - N * h)
            print("{} {} {}".format(h, n, w))
            exit()