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: Wrong Answer

Solution code:
N = int(input())
x = [N*3//4, -(-N*3//4)]
epsilon = 10e-6
for xi in x:
    for xj in x:
        for xk in x:
            if 1/xi + 1/xj + 1/xk - epsilon <= 4/N <= 1/xi + 1/xj + 1/xk + epsilon:
                print(xi, xj, xk)
                exit()
print("No answer found")  # ありえないけど

Submission status: Wrong Answer

Solution code:
def f(N,h,n):
    return 4/N - 1/h - 1/n

N = int(input())
for h in range(1, 3500):
    for n in range(1, 3500):
        inv_w = f(N, h, n)
        if inv_w > 0:
            w = 1/inv_w
            if w.is_integer() and 1<=w<=3500:
                print(h,n,int(w))
                exit()

Submission status: Wrong Answer

Solution code:
def f(N,h,n):
    return 4/N - 1/h - 1/n

N = int(input())
ans = []
for h in range(1, 3500):
    for n in range(1, 3500):
        inv_w = f(N, h, n)
        if inv_w > 0:
            w = 1/inv_w
            if w.is_integer() and w>0:
                ans = [h,n,int(w)]
                break
print(*ans)

Submission status: Wrong Answer

Solution code:
def f(N,h,n):
    return N*h*n / 4*h*n - N*(h+n)

N = int(input())
for h in range(1, 3500):
    for n in range(1, 3500):
        tmp = f(N, h, n)
        if tmp == int(tmp):
            w = int(tmp)
            break
print(h,n,w)

Submission status: Wrong Answer

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']
Yn=['Yes','No']
 
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
#ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True
 
ans=inf


n=I()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

# a <= b <= c を仮定できる
# a,b,c <= 3500
# 4/N >= 3/a  a >= 0.75N . b,cも。

least = int(0.75 * N)
max = 3501
for b in range(least,max):
  for a in range(least, b+1):
    res = 4/N - 1/a - 1/b
    if res<=0:
      continue
    candc = int(1/res)
    for c in range(candc-1,candc+2):
      if 4*a*b*c == N*(a*b + b*c + c*a):
        print(a,b,c)
        exit(0)

Submission status: Wrong Answer

Solution code:
x = int(input())

for h in range(1,3500):
    for n in range(1,3500):
        denom = 4/x - 1/h - 1/n
        if denom == 0:
            continue

        w = 1/denom
        if w < 0 or w > 30000:
            continue
        rounded = round(w)
        gosa = w - rounded
        if abs(gosa) < 10**-30:
            print(h,n,rounded)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for h in range(1,3500):
    for n in range(1,3500):
        denom = 4/x - 1/h - 1/n
        if denom == 0:
            continue

        w = 1/denom
        if w < 0:
            continue
        rounded = round(w)
        gosa = w - rounded
        if abs(gosa) < 10**-30:
            print(h,n,rounded)
            exit()

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
point = 0
def souatari(i,j):
    if 4*i*j-n*(i+j) == 0:
        return False
    else:
        k = (n*i*j)//(4*i*j-n*(i+j))
        if n == 4*i*j*k//(i*j+j*k+k*i):
            return True
        else:
            return False
for i in range(1,3501):
    for j in range(1,3501):
        if souatari(i,j) == True:
            point += 1
print(point)

Submission status: Wrong Answer

Solution code:
N = int(input())
for n in range(1, 3501):
    for w in range(n, 3501):

        try:
            t = (N*n*w) % (4*n*w - N*w - N*n)
        except:
            continue

        if t == 0:
            print((N*n*w) // (4*n*w - N*w - N*n), n, w)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
for n in range(1, 3501):
    for w in range(n, 3501):

        try:
            t = (N*n*w) % (4*n*w - N*w - N*n)
        except:
            continue

        if t == 0:
            print(int((N*n*w) / (4*n*w - N*w - N*n)), n, w)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
for n in range(1, 3501):
    for w in range(n, 3501):

        try:
            t = (N*n*w) % (4*n*w - N*w - N*w)
        except:
            continue
        if t == 0:
            print(int((N*n*w) / (4*n*w - N*w - N*w)), n, w)
            exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1,3501):
  for j in range(1,3501):
    if 3*i*j == n * (i+j):
      print(n,i,j)
      exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

from fractions import Fraction

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

Submission status: Wrong Answer

Solution code:
N = int(input())
n = 0
h = 0
w = 0

for i in range(1, 3501):
    for j in range(1, 3501):
        tmp1 = N * i * j
        tmp2 = (4 * i * j) - (N * j) - (N * i)
        if tmp2 != 0:
            s, m = divmod(tmp1, tmp2)
            if m == 0:
                n, h, w = i, j, s
                print(n, h, w)
                exit()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
for h in range(1, 3501)[::-1]:
    for n in range(1, 3501)[::-1]:
        if 4*h*n == N:
            continue
        w = (N*(h+n)) / (4*h*n-N)
        if w != int(w) or w <= 0:
            continue
        if N == 4*h*n*w / (h+n+w):
            print(h, n, int(w))
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())


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

Submission status: Wrong Answer

Solution code:
N = int(input())
w = float("inf")


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

Submission status: Wrong Answer

Solution code:
N=int(input())
M=4/N

for h in range(1,3501):
  for n in range(1,3501):
    tmp=M-1/h-1/n
    if tmp==0:
      continue
    else:
      w=1/tmp
      
    if 3501>w>0 and w.is_integer():
      print(h,n,int(w))
      exit()

Submission status: Wrong Answer

Solution code:
N=int(input())
M=4/N

for h in range(3500,0,-1):
  for n in range(3500,0,-1):
    tmp=M-1/h-1/n
    if tmp==0:
      continue
    else:
      w=1/tmp
      
    if w>0 and w.is_integer():
      print(h,n,int(w))
      exit()

Submission status: Wrong Answer

Solution code:
N=int(input())
M=4/N

for h in range(1,3501):
  for n in range(1,3501):
    tmp=M-1/h-1/n
    if tmp==0:
      continue
    else:
      w=1/tmp
      
    if w>0 and w.is_integer():
      print(h,n,int(w))
      exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

h0=3*N//4;h1=(N+3)//4
w0=(3*N+3)//4
f=False
for h in range(h0,h1-1,-1):
    if f:
        break
    for w in range(w0,3501):
        num=h*w*N
        den=4*h*w-(h+w)*N
        if num%den==0:
            n=num//den
            print(h,n,w)
            f=True
            break

Submission status: Wrong Answer

Solution code:
N=int(input())

h=3*N//4;w=(3*N+3)//4
f=False
for i in range(h):
    if f:
        break
    for j in range(i+1):
        x=4/N-1/(h-i)-1/(w+j)
        if x>0 and int(1/x)==1/x:
            print(h-i,int(1/x),w+j)
            f=True
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
  
for h in range(1, 3501):
  if 1 / h < 4 / N:
    for n in range(1, 3501):
      if 1 / h + 1 / n < 4 / N:
        w = 1 / (4 / N - 1 / h - 1 / n)
        if w.is_integer():
          print(h, n, int(w))
          exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
  
for h in range(1, 3501):
  if 1 / h < 4 / N:
    for n in range(1, h + 1):
      if 1 / h + 1 / n < 4 / N:
        w = 1 / (4 / N - 1 / h - 1 / n)
        if w.is_integer():
          print(h, n, int(w))
          exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
 
def is_integer_num(n):
  if isinstance(n, int):
    return True
  if isinstance(n, float):
    return n.is_integer()
  return False
  
for h in range(1, 3501):
  if 1 / h < 4 / N:
    for n in range(1, h):
      if 1 / h + 1 / n < 4 / N:
        w = 1 / (4 / N - 1 / h - 1 / n)
        if w.is_integer():
          print(h, n, int(w))
          exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

def is_integer_num(n):
  if isinstance(n, int):
    return True
  if isinstance(n, float):
    return n.is_integer()
  return False
  
for h in range(1, 3501):
  if 1 / h < 4 / N:
    for n in range(1, h):
      if 1 / h + 1 / n < 4 / N:
        w = 1 / (4 / N - 1 / h - 1 / n)
        if w.is_integer():
          print(h, n, int(w))
          exit()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    # 4/n - 1/a = 1/b + 1/c
    # (4a-n)/an = 1/p のとき、b=p+1,c=p(p+1)とすればよい
    for a in range(1,100001):
        if(4*a-n<=0): continue
        if((a*n)%(4*a-n)==0):
            p=(a*n)//(4*a-n)
            b=p+1
            c=p*(p+1)
            print(a,b,c)
            return
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    # 4/n - 1/a = 1/b + 1/c
    # (4a-n)/an = 1/p のとき、b=p+1,c=p(p+1)とすればよい
    for a in range(1,100001):
        if(4*a-n<=0): continue
        if((a*n)%(4*a-n)==0):
            p=(a*n)//(4*a-n)
            b=p+1
            c=p*(p+1)
            print(a,b,c)
            print(4/n,1/a+1/b+1/c)
            return
resolve()

Submission status: Wrong Answer

Solution code:
# おなじみ Nを両辺にかけた形からみる
# なんかふつうにやったら浮動小数点のなにかでWAになったのでceilする
from math import ceil

N = int(input())
for n in range(1, 3501):
    for h in range(1, 3501):
        t = 4 - (N / n + N / h)
        if t == 0 or t < 0:
            continue
        w = ceil(N / t)
        if int(w) == w:
            w = int(w)
            print(h, n, w)
            exit()

Submission status: Wrong Answer

Solution code:
# おなじみ Nを両辺にかけた形からみる
N = int(input())
for n in range(1, 3501):
    for h in range(1, 3501):
        t = 4 - (N / n + N / h)
        if t == 0 or t < 0:
            continue
        w = N / t
        if int(w) == w:
            w = int(w)
            print(h, n, w)
            exit()

Submission status: Wrong Answer

Solution code:
n= int(input())
for i in range(1,3501):
    for j in range(1,3500):
        if (4*i*j-n*i-n*j)!=0:
         w= (n*i*j)/(4*i*j-n*i-n*j)
         if w.is_integer():
            print(str(i)+" "+str(j)+" "+str(int(w)))
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):

        # 4/N - 1/h - 1/n = 1/w
        # (4hn - Nn - Nh) / nhN = 1/w
        # w = nhN / (4hn - Nn - Nh)

        if (4*h*n - N*(n - h)) != 0 and n*h*N % (4*h*n - N*(n - h)) == 0:
            w = int(4*h*n - N*n - N*h)
            if w > 0:
                print(h, n, w)
                exit(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
for h in range(1, 3500+1):
    for n in range(1, 3501):

        # 4/N - 1/h - 1/n = 1/w
        # 4hw - Nn - Nh / nhN = 1/w
        # w = nhN / 4hw - Nn - Nh

        if (4*h*n - N*n - N*h) != 0 and n*h*N % (4*h*n - N*n - N*h) == 0:
            w = int(4*h*n - N*n - N*h)
            if w > 0:
                print(h, n, w)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
print(N//2,N,N)

Submission status: Wrong Answer

Solution code:
N=int(input())
print(2*N,N,N)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=4/N
h_st=max(int(N*(1/4))-1,1)
#h_st=1
for h in range(h_st,3501):
    H=1/h
    for n in range(h,3501):
        flag=0
        if a-H-1/n-1/n<=0 and a-H-1/n-1/3500>=0:

            st,end=n,3500
            for w in [st,end]:
                B=4*h*n*w-(n*w+h*w+h*n)*N
                if B==0:
                    flag=1
                    break
            while st!=end:
                #print(h,n,st,end)
                w=int((st+end)/2)
                if end-st==1:
                    end=w
                    st=w
                B=4*h*n*w-(n*w+h*w+h*n)*N
                if B==0:
                    flag=1
                    break
                elif B>0:
                    end=w
                else:
                    st=w

        if flag:
            break
    if flag:
        break

print(h,n,w)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=4/N
h_st=max(int(N*(1/4)),1)
for h in range(h_st,3501):
    H=1/h
    for n in range(h,3501):
        flag=0
        if a-H-1/n-1/n<=0 and a-H-1/n-1/3500>=0:

            st,end=h,3500
            for w in [st,end]:
                B=4*h*n*w-(n*w+h*w+h*n)*N
                if B==0:
                    break
            while st!=end:
                #print(h,n,st,end)
                w=int((st+end)/2)
                if end-st==1:
                    end=w
                    st=w
                B=4*h*n*w-(n*w+h*w+h*n)*N
                if B==0:
                    flag=1
                    break
                elif B>0:
                    end=w
                else:
                    st=w

        if flag:
            break
    if flag:
        break

print(h,n,w)

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(1,3501):
	for j in range(1,3501):
		if 4/n-1/i-1/j==0:
			continue
		if abs((1/(4/n-1/i-1/j)-int(1/(4/n-1/i-1/j))))<10**-12:
			if (1/(4/n-1/i-1/j))>0:
				print(i,j,int(1/(4/n-1/i-1/j)))
				exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(1,3501):
	for j in range(1,3501):
		if 4/n-1/i-1/j==0:
			continue
		if abs((1/(4/n-1/i-1/j)-int(1/(4/n-1/i-1/j))))<10**-7:
			if (1/(4/n-1/i-1/j))>0:
				print(i,j,int(1/(4/n-1/i-1/j)))
				exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

N = int(input())

con = True
for h in range(1,3500):
    for n in range(h,3500):
        memo1 = N*h*n
        memo2 = 4*h*n-N*n-N*h
        if memo2 != 0:
            memo3 = memo1/memo2
            memo4 = memo1%memo2
            if (memo4==0) and (memo3>=1):
                print(h,n,memo3)
                con = False
                break
    if not(con):
        break

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N=int(input())


for a in range(1,3501):
    for b in range(1,3501):
        c_n=(4/N*a*b-a-b)/(a*b)
        if c_n==0:
            continue
        c=(1/c_n)
        if c<=0:
            continue
        elif c%1==0:
            print(a,b,int(c))
            exit()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N=int(input())


for a in range(1,3501):
    for b in range(1,3501):
        c=(4/N-1/a-1/b)
        if c<=0:
            continue
        elif c%1==0:
            print(a,b,int(c))
            exit()

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
for i in range(1,3501):
    for j in range(1,3501):
        if not 4/n - 1/i - 1/j:
            continue
        tmp = 1/(4/n - 1/i - 1/j)
        if tmp.is_integer() and tmp > 0:
            if 1/i + 1/j + 1/tmp == 4/n:
                print(i,j,int(tmp))
                quit()

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
for i in range(1,3501):
    for j in range(1,3501):
        if not (4/n - 1/i - 1/j):
            continue
        tmp = 1/(4/n - 1/i - 1/j)
        if tmp.is_integer() and tmp > 0:
            print(i,j,int(tmp))
            quit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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):
      w=(N*h*n)//((4*h*n)-(N*n)-(N*h))
      if 4*h*n*w==N*(n*w+h*w+n*h):
        break
  else:
    continue
  break
print(h,n,w)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
f = True
for h in range(1,3501):
  for n in range(1,3501):
    if n%2 != 1:#時間短縮用…
      break
    w_ = (-(h+n)/(h*n) + 4/N)
    if w_ > 0:
      w = (1/w_)
      if w%1 < 10E-8:
        print(h,n,int(w))
        f = False
        break
  if not f:
    break

Submission status: Wrong Answer

Solution code:
N = int(input())
f = True
for h in range(1,3501):
  for n in range(1,3501):
    w_ = (-(h+n)/(h*n) + 4/N)
    if w_ > 0:
      w = (1/w_)
      if w%1 < 10E-6:
        print(h,n,int(w))
        f = False
        break
  if not f:
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
def solve(n):
    if n%2==0:
        return n//2,n,n
    for a in range(1,3501):
        for b in range(1,3501):
            den=4*a*b-n*a-n*b
            if den<=0:
                continue
            c=n*a*b/den
            if c.is_integer:
                return a,b,int(c)
    
n=int(input())
print(*solve(n))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#Tenka1 Programmer Contest

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

N = I()
for h in range(1,3500+1):
    for n in range(1,3500+1):
        if 4*h*n - h*N - n*N <= 0:
            continue
        w = (n*h*N)/(4*h*n - h*N - n*N)
        if 4/N == 1/h + 1/n + 1/w:
            print(h,n,int(w))
            quit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#Tenka1 Programmer Contest

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

N = I()
for h in range(1,3500+1):
    for n in range(1,3500+1):
        if 4*h*n - h*N - n*N != 0:
            w = (n*h*N)/(4*h*n - h*N - n*N)
            if 4/N == 1/h + 1/n + 1/w:
                print(h,n,int(w))
                quit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#Tenka1 Programmer Contest

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

N = I()
h = 3500
for n in range(1,3500+1):
    for w in range(1,3500+1):
        if 4/N == 1/h + 1/n + 1/w:
            print(h,n,w)
            quit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#Tenka1 Programmer Contest

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

N = I()
h = 3500
for n in range(1,3500+1):
    for w in range(1,3500+1):
        if 4/n == 1/h + 1/n + 1/w:
            print(h,n,w)
            quit()

Submission status: Wrong Answer

Solution code:
def factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors


def calc(a,b,c,d): #a/b - c/dを計算する
    up = a*d - c*b
    bottom = b*d
    tempup = factors(up)
    tempbottom = factors(bottom)
    for i in range(len(tempup)):
        if tempup[i] in tempbottom:
            up = up//tempup[i]
            bottom = bottom//tempup[i]
    return up,bottom
    
up = 4
bottom = int(input())
h = bottom//up + 1
up,bottom = calc(up,bottom,1,h)
n = bottom//up + 1
up,bottom = calc(up,bottom,1,n)
print(h,n,bottom)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1, 3501):
  for j in range(1, 3501):
    seed = 4 * i * j - n * (i + j) 
    if seed != 0:
      k, md = divmod((n * i * j) / seed, 1) 
      if md == 0:
        print(i, j, int(k))
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

N = int(input())

"""
4xyz = N(xy+xz+yz)
(4xy-Nx-Ny)z = Nxy
"""

U = 3500
x = np.arange(U+1,dtype=np.int32).reshape(U+1,1)
y = np.arange(U+1,dtype=np.int32).reshape(1,U+1)

den = 4*x*y - N*x - N*y
num = N*x*y

x,y = np.where((num % den == 0) & (num != 0) & (den > 0))
x,y = x[0],y[0]

z = (N*x*y) // (4*x*y - N*x - N*y)
print(x,y,z)

Submission status: Wrong Answer

Solution code:
N = int(input())

def solve(n,h,N):
    if 4*n*h-N*(n+h) == 0:
        return 1.5
    else:
        return (N*n*h)/(4*n*h-N*(n+h))

for n in range(1,3501):
    for h in range(1,3501):
        ans = solve(n,h,N)
        if ans == int(ans):
            print(h,n,int(ans))
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

H = int(3*N/4)
if N % 4 == 0:
    W = int(3*N/4)
else:
    W = int(3*N/4) + 1

m = int(N/4)

flag = 0
for h in range(H, m-1, -1):
    #print(h)
    if flag == 1:
        break
    for w in range(W, 3501):
        #print(w)
        if flag == 1:
            break
        for n in range(H, W+1):
            if 4*n*h*w == N*(n*h + h*w + w*n):
                print('{} {} {}'.format(h, n, w))
                flag = 1
                break

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
from itertools import *

N = int(input())

for x,y in product(range(1,3501), range(1,3501)):
    temp = (4/N) - (1/x) - (1/y)
    if temp > 0:
        z = 1/temp
        int_z = int(z)
        if int_z == z:
            print(x, y, int_z)
            exit()

Submission status: Wrong Answer

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 j * k * m == mother:
                    print(j, k, m)
                    flag = True
                    break
            if flag:
                break
        if flag:
            break
        i += 1

Submission status: Wrong Answer

Solution code:
N = int(input())

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