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:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')
AtoZ = "abcdefghijklmnopqrstuvwxyz"

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  divisors.sort()
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
N = I()

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

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 > 0:
            w = (N * h * n) / (4 * h * n - N * n - N * h)
            if w % 1 == 0:
                print(h, n ,w)
                exit()

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())


for i in range(1, 3500):
    for j in range(1, 3500):
        rest = 4 / n - 1 / i - 1 / j
        if rest > 0:
            if (1 / rest).is_integer():
                print(i, j, int(1 / rest))
                sys.exit()

Submission status: Wrong Answer

Solution code:
def solve(N):
    for h in range(1, 3501):
        for n in range(1, 3501):
            v1 = 4*h*n-N*(h+n)
            v2 = h*n
            if v1>0 and v2>0 and v2%v1==0:
                return h, n, v2//v1

N = int(input())
print(*solve(N))

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())

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

Solution code:
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if 2 * h * n - N:
            w = (h + n) // (2 * h * n - N)
            if 0 < w <= 3500:
                print(h, n, w)
                exit()

Submission status: Wrong Answer

Solution code:
import math
N = int(input())

jdg = True
for h in range(math.ceil(N/4), 3501):
    if jdg:
        for n in range(h, 3501):
            num = 4*h*n - N*h - N*n
            if num > 0:
                if (N * n * h) % num == 0:
                    jdg = False
                    break
    else: break
w = N*h*n//(num)
print(*[h, n, w])

Submission status: Wrong Answer

Solution code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    N = ni()
    lim = 3500

    for h in range(1, lim + 1):
        for n in range(1, lim + 1):
            up = n * h * n
            down = 4 * h * n - N * n - N * h
            if down != 0:
                if up % down == 0:
                    if 0 < up // down:
                        print(h, n, up // down)
                        exit(0)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    N = ni()
    lim = 3500

    for h in range(1, lim + 1):
        for n in range(1, lim + 1):
            up = n * h * n
            down = 4 * h * n - N * n - N * h
            if down != 0:
                if up % down == 0:
                    if 0 < up // down < lim + 1:
                        print(h, n, up // down)
                        exit(0)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#Tenka1 Programmer Contest-C 4/N
"""
nが与えられるので、
4/n = 1/a + 1/b + 1/c　となるa,b,cを出力せよ
なお、a,b,c<=3500となる中で1つは解があることが保証される。

多分半分全列挙のような解法になると思う

"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
flag = 0
for a in range(1,3501):
    for b in range(1,3501):
        try:
            c = int(a*b*n/(4*a*b-n*b-n*a))
            if 4*a*b*c//(b*c+c*a+a*b)==n:
                print(a,b,c)
                flag = 1
        except:
            pass
        if flag:
            exit()

Submission status: Wrong Answer

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

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
A=int(input())
for i in range(0,3501):
   for j in range(0,3501):
      try:
         if(A*i*j) %(4*i*j-A*i-A*j) == 0:
            print(i,j,(A*i*j) //(4*i*j-A*i-A*j))
            exit()
      except ZeroDivisionError:
         pass

Submission status: Wrong Answer

Solution code:
A=int(input())
for i in range(1,3501):
   for j in range(1,3501):
      try:
         if(A*i*j) %(4*i*j-A*i-A*j) == 0:
            print(i,j,(A*i*j) //(4*i*j-A*i-A*j))
            exit()
      except ZeroDivisionError:
         pass

Submission status: Wrong Answer

Solution code:
import sys

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))).is_integer()):
                print(i, j, int((N*i*j/(4*i*j-N*(i+j)))))
                sys.exit()

Submission status: Wrong Answer

Solution code:
import math
const=3500+1
N = int(input())
ans=4/N
flg=False
for h in range(1,const):
    for n in range(1,const):
        tmp=4*h*n-N*n-N*h
        if tmp != 0:
            w = tmp
            if w == int(w) and w>0:
                print(h,n,int(w) )
                flg=True
                break
    if flg==True:
        break

Submission status: Wrong Answer

Solution code:
import math
const=3500+1
N = int(input())
ans=4/N
flg=False
for h in range(1,const):
    for n in range(1,const):
        if 4/N-1/h-1/n != 0:
            w = 1/(4/N-1/h-1/n)
            if w == int(w) and w>0:
                print(h,n,int(w) )
                flg=True
                break
    if flg==True:
        break

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
const=3500+1

total=4/N
tmp=0
h = math.ceil(1/total)
if 1/h == total:
    h+=1
tmp+=1/h

n = math.ceil(1/(total-tmp) )
#print(n)
if 1/n + 1/h == total:
    n+=1
tmp+=1/n
w=int( 1/(total-tmp) )

#print(h,n,w,4/( 1/h+1/n+1/w) )
print(h,n,w )


#test
#print(4/(1/872))

Submission status: Wrong Answer

Solution code:
def main(n):
  if n%2==0:
    print(n,n,n//2)
    exit()
  if n==3:
    print(2,2,3)
    exit()
  s=n//4
  for i in range(2*s,3500*2):
    for a in range(s,i-3):
      b=i-a
      c=a*b*n/(4*a*b-4*b-4*a)
      if float.is_integer(c) and c>0:
        print(a,b,int(c))
        exit()

if __name__=='__main__':
  import sys
  input = sys.stdin.readline
  n=int(input())
  main(n)

Submission status: Wrong Answer

Solution code:
def main(n):
  if n%2==0:
    print(n,n,n//2)
    exit()
  if n==3:
    print(2,2,3)
    exit()
  s=n//4
  for i in range(2*s,3500*2):
    for a in range(s,i-3):
      b=i-a
      c=a*b*n/(4*a*b-4*b-4*a)
      if float.is_integer(c):
        print(a,b,int(c))
        exit()

if __name__=='__main__':
  import sys
  input = sys.stdin.readline
  n=int(input())
  main(n)

Submission status: Wrong Answer

Solution code:
def main(n):
  if n%2==0:
    print(n,n,n//2)
    exit()
  if n==3:
    print(2,2,3)
    exit()
  s=1+n//4
  for i in range(2*s,3500*2):
    for a in range(s,i-3):
      b=i-a
      c=n/4*(1/a+1/b+1)
      if float.is_integer(c):
        print(a,b,int(c))
        exit()

if __name__=='__main__':
  import sys
  input = sys.stdin.readline
  n=int(input())
  main(n)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=int(input())
        flag=False
        for x in range(1,3501):
            for y in range(1,3501):
                a=n*x*y
                b=4*x*y-n*(x+y)
                if b>0:
                    if a%b==0:
                        flag=True
                        print(x,y,a//b)
                        break
            if flag:
                break
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=int(input())
        val=4/n
        while True:
            for i in range(1,3501):
                for j in range(i,3501):
                    temp=val-(1/i)-(1/j)
                    if temp<=0:
                        continue
                    elif (1/temp).is_integer():
                        return [i,j,int(1/temp)]

    for i in main():
        print(i,end=' ')


resolve()

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2 == 0:
  print(N, N, N//2)
else:
  for h in range(3500, -1, -1):
    num = N*h*3501; diff_num = N*h
    dem = 4*h*3501 - N*(h+3051); diff_dem = 4*h - N
    for n in range(3500, -1, -1):
      num -= diff_num
      dem -= diff_dem
      if dem <= 0:
        break
      if num%dem == 0:
        print(h, n, num//dem)
        quit()

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2 == 0:
  print(N, N, N//2)
else:
  for h in range(1, 3501):
    for n in range(1, 3501):
      num = N*h*n
      dem = 4*h*n - N*(h+n)
      if dem <= 0:
        break
      if dem > 0 and num%dem == 0:
        print(h, n, num//dem)
        quit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from fractions import Fraction
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        print(h, n)
        w1 = 4 / N - (1 / h + 1 / n)
        w = Fraction(w1)
        de = w.denominator
        nu = w.numerator
        if w1 > 0 and de % nu == 0:
            print(h, n, de // nu)
            exit()

Submission status: Wrong Answer

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()
  for h in range(1,3501):
    for n in range(1,3501):
      a=4*h*n-N*n-N*h
      b=N*h*n
      x=a//b

      if x>0 and a%b==0:
        return str(h)+' '+str(n)+' '+str(a//b)

# main()
print(main())

Submission status: Wrong Answer

Solution code:
N = int(input())
flg = False
N = 4/N
for h in range(1,3501):
    if not flg:
        for n in range(h,3501):
            if N*h*n == (n+h) + 1:
                print(h,n,n*h)
                flg = True
                break
    else:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
flg = False
for h in range(1,3501):
    if not flg:
        for n in range(h,3501):
            if N*h*n == (n+h) + 1:
                print(h,n,n*h)
                flg = True
                break
    else:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())

h_max = 3 * N // 4
h_min = N // 4 + 1

for h in reversed((range(h_min,h_max+1))):
    n_max = (2*h*N) // (4*h-N)
    n_min = (h*N) // (4*h-N) + 1
    for n in reversed((range(n_min,n_max+1))):
        if((n*h*N) % (4*h*n-n*h-h*N) == 0):
            w = (n*h*N) // (4*h*n-n*h-h*N)
            print(h,n,w,end =" ")
            print()
            
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
N = int(input())

h_max = 3 * N // 4
h_min = N // 4 + 1

for h in reversed((range(h_min,h_max+1))):
    n_max = (2*h*N) // (4*h-N)
    n_min = (h*N) // (4*h-N) + 1
    for n in reversed((range(n_min,n_max+1))):
        if((n*h*N) % (4*h*n-n*h-h*N) == 0):
            w = (n*h*N) // (4*h*n-n*h-h*N)
            print(h,n,w,end =" ")
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
for i in range(1, 3501):
    for j in range(1, 3501):
        if 4 * i * j - n == 0:
            continue
        k = n * (i + j) // (4 * i * j - n)
        if k > 0 and 4 * i * j * k == n * (i + j + k):
            print(i, j, k)
            exit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    N = II()
    for h in range(1, 3501):
        for w in range(1, 3501):
            if (4 * h * w - N * w - N * h) == 0:
                continue
            n = N * h * w / (4 * h * w - N * w - N * h)
            if n.is_integer():
                print(h, w, int(n))
                return
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    N = II()
    for h in range(1, 3501):
        for w in range(1, 3501):
            if (4 * h * w - N * w - N * h) == 0:
                continue
            n = N * h * w / (4 * h * w - N * w - N * h)
            if n.is_integer():
                print(h, w, n)
                return
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    N = II()
    for h in range(1, 3500):
        for w in range(1, 3500):
            if (4 * h * w - N * w - N * h) == 0:
                continue
            n = N * h * w / (4 * h * w - N * w - N * h)
            if n.is_integer():
                print(h, w, n)
                return
    return


#main
if __name__ == '__main__':
    solve()

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*h-N*n)>0 and (h*n)%(4*h*n-N*h-N*n)==0:
            print(h,n,h*n//(4*h*n-N*h-N*n))
            exit()

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
for h in range(1, 3501):
    for w in range(1, 3501):
        u = 4*h*w-N*w-N*h
        d = N*h*w
        if u == 0:
            continue
        if d % u == 0:
            print(h, w, d//u)
            exit()
assert 1 == 2

Submission status: Wrong Answer

Solution code:
N = int(input())
for h in range(1, 3501):
    for w in range(1, 3501):
        u = 4*h*w-N*w-N*h
        d = N*h*w
        if u == 0 or d == 0:
            continue
        if d % u == 0:
            print(h, w, d//u)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
# 2 <= N < 4500　くらいが保証されている

for h in range(3501):
    for w in range(3501):
        if 4*h*w-N*w-N*h <= 0:continue
        if N*h*w % (4*h*w-N*w-N*h) == 0:
            print(h,w,N*h*w // (4*h*w-N*w-N*h))

Submission status: Wrong Answer

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

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    for i in range(1, 3501):
        for j in range(i, 3501):
            # dN, di, dj = Decimal(N), Decimal(i), Decimal(j)
            z = 4*i*j - N*j - N*i
            if z != 0:
                h, r = divmod((N*i*j), z)
                if 0 <= h:
                    print(h, i, j)
                    exit()
            

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    for i in range(1, 3501):
        for j in range(1, 3501):
            z = 4*i*j - N*j - N*i
            if z == 0:
                continue
            h = (N*i*j)//z
            if 0 <= h <= 3500:
                print(h, i, j)
                exit()
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    # from decimal import Decimal
    for i in range(1, 3501):
        for j in range(1, 3501):
            # dN, di, dj = Decimal(N), Decimal(i), Decimal(j)
            z = 4*i*j - N*j - N*i
            if z == 0:
                continue
            h = (N*i*j)//z
            if 0 <= h <= 3500:
                print(h, i, j)
                exit()
            

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    from decimal import Decimal
    for i in range(1, 3501):
        for j in range(1, 3501):
            # dN, di, dj = Decimal(N), Decimal(i), Decimal(j)
            z = 4*i*j - N*j - N*i
            if z == 0:
                continue
            h = (N*i*j)//z
            if 0 <= h <= 3500:
                print(h, i, j)
                exit()
            

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    from decimal import Decimal
    for i in range(1, 3501):
        for j in range(1, 3501):
            dn, di, dj = Decimal(N), Decimal(i), Decimal(j)
            k = 4/dn - 1/di - i/dj
            if 1 <= k <= 3500:
                print(i, j, k//1)
                exit()
            

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
if N%2 == 0:
    print(N, N, int(N/2))
else:
    for a in range(1,3501):
        for b in range(1,3501):
            if 3*a*b == (a+b) * N:
                print(a, b, N)
                break

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = 0
for a in range(1, 3501):
    if flag ==1:
        break
    for b in range(1, 3501):
        if flag == 1:
            break
        for c in range(1, 3501):
            if 4*a*b*c == (a + b + c) * N:
                print(a, b, c)
                flag = 1
                break

Submission status: Wrong Answer

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

left_term = 4 / N

for h in range(1, 3500+1):
    for w in range(1, 3500 + 1):
        # (h+w) / (h*w)
        l = left_term - (1/h) - (1/w)
        if l > 0:
            n = 1/l

            if 0 < n <= 3500 and int(n) == n:
                print(int(h), int(n), int(w))
                exit()

Submission status: Wrong Answer

Solution code:
def calc(N, h, n):
    base = 4/N - 1/h - 1/n
    if base == 0:
        return False, 0
    ret = 1/base
    return ret == int(ret) and 0 <= ret <= 3500, int(ret)

N = int(input())

def f(N):
    for h in range(1, 3501):
        for n in range(1, 3501):
            judge, ret = calc(N,h,n)
            if judge:
                return h, n, ret
    return -1, -1, -1

print(*f(N))

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [N*3//4, -(-N*3//4)]
epsilon = 10e-9
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()