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:
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    for a in range(1, 3501):
        for b in range(1, 3501):
            numerator = a * b * n
            denominator = 4 * a * b - (a * n + b * n)
            if denominator == 0:
                continue
            if numerator % denominator != 0:
                continue
            c = numerator // denominator
            if (a * b + b * a + c * a) == 0:
                continue
            if n == (4 * a * b * c) // (a * b + b * a + c * a):
                print(a, b, c)
                return
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    for a in range(1, 3501):
        for b in range(1, 3501):
            numerator = a * b * n
            denominator = a * n + b * n - 4 * a * b
            if denominator == 0:
                continue
            if numerator % denominator != 0:
                continue
            c = numerator // denominator
            if (a * b + b * a + c * a) == 0:
                continue
            if n == (4 * a * b * c) // (a * b + b * a + c * a):
                print(a, b, c)
                return
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
ran = int(0.75 * N)
for i in range(int(N // 4 + 1) , ran + 1):
  b = int(2 // (4/N - 1/i))
  for j in range(1 , min(3501,b + 1)):
    if  (4/N - 1/i - 1 /j) == 0:
      c = -10*10
    else:  
      c = 1 / (4/N - 1/i - 1 /j)
    if 0 < c and c == int(c):
      print(i,j,int(c))
      exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
for TA in range(1,3501):
    for TB in range(1,3501):
        Denom = 4*TA*TB-N*(TA+TB)
        Numer = N*TA*TB
        if Denom!=0 and Numer%Denom==0:
            A = TA
            B = TB
            C = Numer//Denom
print('{} {} {}'.format(A,B,C))

Submission status: Wrong Answer

Solution code:
from math import ceil
from math import floor
n = int(input())
for x in range(2,3501):
    for y in range(2,3501):
        z = (n*x*y)/(4*x*n-n*x-n*y)
        if z >= 0 and floor(z) == ceil(z):
            print(x,y,int(z))
            exit(0)

Submission status: Wrong Answer

Solution code:
from math import ceil
from math import floor
n = int(input())
for x in range(1,3501):
    for y in range(1,3501):
        flg = False
        try:
            z = (n*x*y)/(4*x*y-n*y-n*y)
            if floor(z) == ceil(z):
                flg = True
        except:
            pass
        if flg:
            print(x,y,floor(z))
            exit(0)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
def s_bunkai(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
if n%2==0:
    print(n,n,n//2)
else:
    num=s_bunkai(n)
    num2=num[0][0]
    if (num2+1)%4==0:
        num3=(num2*2+2)//4
        num4=n*num3
        print(num4//2,num4//num2,num4//num2)
    else:
        yn=0
        for i in range(len(num)):
            if num[i][0]%4==3:
                num2=num[i][0]
                yn=1
                break
        if yn==1:
            num3=(num2*2+2)//4
            num4=n*num3
            print(num4//2,num4//num2,num4//num2)
        else:
            n*=2
            print(n,n,n)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N % 2 == 0:
  print(N//2, N, N)
else:
  for i in range(1, N):
    if N < 4*i:
      n = 4*i - N
      break
  if n == 1:
    j, k = 2*N*i, 2*N*i
  else:
    if i % 3 == 0:
      j, k = 2*N*i//3, 2*N*i//3
    else:
      j, k = N*i//2, N*i
  print(i, j, k)

Submission status: Wrong Answer

Solution code:
N = int(input())
mx = 3503
found = False
for i in range(1, mx):
    for j in range(1, mx):
        num = N*i*j
        den = (i*j*4 - N*i - N*j)
        if den != 0 and num%den == 0 and num/den > 0:
            print(i,j,num/den)
            found = True
            break
    if found:
        break

Submission status: Wrong Answer

Solution code:
import sys, math
from functools import lru_cache
from collections import defaultdict
from decimal import Decimal
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    for h in range(1, 3501):
        for n in range(1, 3501):
            if 4/N - 1/h - 1/n == 0:
                continue
            w = 1/(4/N - 1/h - 1/n)
            if w.is_integer() and w > 0:
                print(h, n, int(w))
                return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
import sys
for i in range(1, 3501):
    for j in range(1, 3501):
        w_t = n*i*j
        w_u = 4*i*j - i*n -j*n
        if w_u != 0:
            w = w_t/w_u
            if w.is_integer():
                print("%s %s %s" % (i, j, int(w)))
                sys.exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
import sys
for i in range(1, 3501):
    for j in range(1, 3501):
        w_t = n*i*j
        w_u = 4*i*j - i*n -j*n
        if w_u != 0:
            w = w_t/w_u
            if w == int(w):
                print("%s %s %s" % (i, j, int(w)))
                sys.exit()

Submission status: Wrong Answer

Solution code:
N=int(input())
a=3500
ans=[0,0,0]    
    
for i in range(1,a):
    for j in range(1,a):
        b=4*i*j-N*j-N*i
        if b==0:
            continue
        else:
            w=(N*i*j)/b
            if w == int(w):
                ans=[i,j,int(w)]
                break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = None
for i in range(1, 3501):
    for j in range(1, 3501):
        try:
            w = i*j / (4/n*i*j - i -j)
            if w == int(w):
                ans = "%s %s %s" % (i, j, int(w))
                break
        except:
            pass
    if ans is not None:
        break
print(ans)

Submission status: Wrong Answer

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

for h in range(1,3501):
  for n in range(1,3501):
    bb=(4*h*n-N*n-N*h)
    bs=(N*h*n)
    if bb==0:
      continue

    if bs%bb and 1<=bs//bb:
      print(h,n,bs//bb)
      sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = 0

for h in range(1,3500):
    for n in range(1,3500):
        x = 4*h*n
        y = N*(h+n)
        if x<=y:
            continue
        tmp = (N*h*n)/(x-y)
        if tmp-int(tmp) == 0:
            print(h,n,int(tmp))
            flag = 1
    if flag == 1:
        break

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

ls = 4 / n

for i in range(1, 3501):
    for j in range(1, 3501):
        rest = ls - 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:
N = int(input())

for a in range(1,3501):
    for b in range(1,3501):
        x = a*b*N
        y = 4*a*b - b*N - a*N
        if y != 0 and x/y > 0:
            if int(x/y) == x//y:
                print(a,b,x//y)
                exit()

Submission status: Wrong Answer

Solution code:
N=int(input())

for h in range(1,3500+1):
    for n in range(1,3500+1):
        try:
            if (N*h*n)%(4*h*n-N*(h+n))==0:
                H,N,W=h,n,(N*h*n)//(4*h*n-N*(h+n))
        except:
            pass
print(H,N,W)

Submission status: Wrong Answer

Solution code:
N=int(input())

for h in range(1,3500+1):
    for n in range(1,3500+1):
        if  (N*h*n)&(4*h*n-N*(h+n))==0:
            try:
                H,N,W=h,n,(N*h*n)//(4*h*n-N*(h+n))
            except:
                pass
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 and 1/(4/n-1/i-1/j)%1==0:
      print(i,j,int(1/(4/n-1/i-1/j)))
      exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

#4/N = 1/h + 1/n + 1/w
#4hnw/N = nw+hw+hn
#w(4hn/N) = w(n+h)+hn
#w{4hn/N -(n+h)} = hn
#w = hn/{4hn/N -(n+h)}

def get_ans(N):
    for h in range(1,3501):
        for n in range(1,351):
            if (4*h*n)%N == 0 and (4*h*n//N - n - h) != 0 and (h*n)%(4*h*n//N - n - h) == 0 and 4*h*n//N - n - h > 0:
                w = (h*n)//(4*h*n//N - n - h)
                print(h,n,w)
                return
            
get_ans(N)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
N = N*60

from functools import reduce

def factors(n):    
	return set(reduce(list.__add__, 
		([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

D = factors(N)
D = sorted(D)
L = len(D)

for i in range (0, L):
	for j in range (0, L):
		for k in range (0, L):
			if D[i]+D[j]+D[k] == 240:
				print(D[i],D[j],D[k])
				exit()

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
for ai in range(1,3500):
    for bi in range(1,3500):
        try:
            ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
            if ci == int(ci) and ci > 0:
                print(ai,bi,int(ci))
                exit()
        except:
            continue

Submission status: Wrong Answer

Solution code:
N = int(input())
if N%2==0:
    a=N//2
    b=N
    c=N
    print(a,b,c)
else:
    for ai in range(1,3500):
        for bi in range(1,3500):
            try:
                ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
                if ci == int(ci) and ci > 0:
                    print(ai,bi,int(ci))
                    exit()
            except:
                continue

Submission status: Wrong Answer

Solution code:
N = int(input())
if N%2==0:
    a=N//2
    b=N
    c=N
    print(a,b,c)
else:
    for ai in range(N//4,3500):
        for bi in range(N//4,3500):
            try:
                ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
                if ci == int(ci) and ci > 0:
                    print(ai,bi,int(ci))
                    exit()
            except:
                continue

Submission status: Wrong Answer

Solution code:
n = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        for w in range(1, 3501):
            if 4*(h*n*w) == n*(n*w + h*w + h*n):
                ans = [h, n, w]
                print(' '.join(map(str, ans)))
                exit()

Submission status: Wrong Answer

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    h, n, w <= 3500
    4*h*n*w/(h*n+n*w+h*w) = N
    n*w+h*w = (n+h)*w = k*h*n  => k = (n+h)*w/(h*n)

    4hnw/(k+1)hn=4w/(k+1) = N
    """
    N = read_int()
    for w in range(1, 3501):
        if (4*w)%N == 0:
            k = (4*w)//N-1
            for n in range(1, 3501):
                if k*n-w > 0 and (n*w)%(k*n-w) == 0:
                    h = n*w//(k*n-w)
                    if h > 0:
                        return h, n, w
    return 1, 1, 1


if __name__ == '__main__':
    print(*solve())

Submission status: Wrong Answer

Solution code:
N = int(input())
# 4/n = 1/h+1/n+1/w
for h in range(1,3501):
  for n in range(h,3501):
    l1 = 4*n*h
    l2 = 4*n*h*2
    r1 = N*(h*n+n+h)
    r2 = N*(h*n+2*n+2*h)
    if l1 == r1:
      print(h,n,1)
      exit()
    elif l2 == r2:
      print(h,n,2)
      exit()
    else:
      sub1 = l1-r1
      sub2 = l2-r2
      if sub1 - sub2 != 0:
        if sub1%(sub1-sub2) == 0:
          w = sub1//(sub1-sub2)
          if w > 0:
            print(h,n,w)
            exit()

Submission status: Wrong Answer

Solution code:
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()

for h in range(1, 3501):
    for m in range(h, 3501):
        try:
            w = 1/(4/n-1/h-1/m)
        except:
            continue
        if w > 0 and floor(w) == ceil(w):
            print(h, m, floor(w))
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

for h in range(1,3501):
  for n in range(1,3501):
    w = 4/N - 1/h -1/n
    if w > 0:
      w = w/(w**2)
    else:
      continue
    if w == int(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,3501):
    w = 4/N - 1/h -1/n
    if w > 0:
      if 1/w == int(1/w):
        print(h,n,int(1/w))
        exit()

Submission status: Wrong Answer

Solution code:

n = int(input())
if n %2 == 0:
  ans1 = str(n)
  ans2 = str(n//2)
  print(ans1 + " " + ans1 + " " + ans2)
  quit()
  
if n % 3 == 0:
  ans1 = str(n*2)
  ans2 = str(n//3)
  print(ans1 + " " + ans1 + " " + ans2)
  quit()
  
for i in range(1, 3501):
  for j in range(1, 3501):
      if 4/n-1/i-1/j == 0:
        continue
      k = int(1/(4/n-1/i-1/j))
      if k>0 and 4/n==1/i+1/j+1/k:
        print(str(i)+" "+str(j)+" "+str(k))
        quit()

Submission status: Wrong Answer

Solution code:

n = int(input())
if n %2 == 0:
  ans1 = str(n)
  ans2 = str(n//2)
  print(ans1 + " " + ans1 + " " + ans2)
  quit()
if n % 3 == 0:
  ans1 = str(n*2)
  ans2 = str(n//3)
  print(ans1 + " " + ans1 + " " + ans2)
  quit()
for i in range(1, 876):
  for j in range(1, 876):
      k = int(1/(4/n-1/(4*i)-1/(4*j)))
      if k>0 and 4/n==1/(4*i)+1/(4*j)+1/k:
        print(str(i*4)+" "+str(j*4)+" "+str(k))
        quit()

Submission status: Wrong Answer

Solution code:

n = int(input())
#if n %2 == 0:
#  ans1 = str(n)
#  ans2 = str(n//2)
#  print(ans1 + " " + ans1 + " " + ans2)
#  quit()
for i in range(1, 876):
  for j in range(1, 876):
      k = int(1/(4/n-1/(4*i)-1/(4*j)))
      if k>0 and 4/n==1/(4*i)+1/(4*j)+1/k:
        print(str(i*4)+" "+str(j*4)+" "+str(k))
        quit()

Submission status: Wrong Answer

Solution code:
n = int(input())

if n %2 == 0:
  ans1 = str(n)
  ans2 = str(n//2)
  print(ans1 + " " + ans1 + " " + ans2)
  quit()

for i in range(1, 876):
  for j in range(1, 876):
      k = int(1/(4/n-1/(4*i)-1/(4*j)))
      if k>0 and 4/n==1/(4*i)+1/(4*j)+1/k:
        print(str(i*4)+" "+str(j*4)+" "+str(k))
        quit()

Submission status: Wrong Answer

Solution code:
n = int(input())
if n %2 == 0:
  ans1 = str(n)
  ans2 = str(n//2)
  print(ans1 + " " + ans1 + " " + ans2)
  quit()

print(1)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    for h in range(1, 3501):
        if 1 / h >= 4 / N:
            continue
        for n in range(h, 3501):
            if 1 / h + 1 / n >= 4 / N:
                continue
            l = 1
            r = 3501
            # print(h, n)
            while l + 1 < r:
                m = (l + r) // 2
                p = N * ((n * m + h * m + h * n) / (h * n * m))
                if p == 4:
                    print(h, n, m)
                    return True
                elif p < 4:
                    r = m
                else:
                    l = m
            else:
                p = N * ((n * l + h * l + h * n) / (h * n * l))
                if p == 4:
                    print(h, n, l)
                    break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    for h in range(1, 3501):
        if 1 / h >= 4 / N:
            continue
        for n in range(h, 3501):
            if 1 / h + 1 / n >= 4 / N:
                continue
            l = 1
            r = 3501
            # print(h, n)
            while l + 1 < r:
                m = (l + r) // 2
                p = N * ((n * m + h * m + h * n) / (h * n * m))
                if p == 4:
                    print(h, n, m)
                    return True
                elif p < 4:
                    r = m
                else:
                    l = m
            else:
                p = N * ((n * l + h * l + h * n) / (h * n * l))
                if p == 4:
                    print(h, n, l)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    for h in range(1, 3501):
        if 1 / h >= 4 / N:
            continue
        for n in range(h, 3501):
            if 1 / h + 1 / n >= 4 / N:
                continue
            l = 1
            r = 3501
            # print(h, n)
            while l + 1 < r:
                m = (l + r) // 2
                p = N * ((n * m + h * m + h * n) / (h * n * m))
                if p == 4:
                    print(h, n, m)
                    return True
                elif p < 4:
                    r = m
                else:
                    l = m
            else:
                p = N * ((n * m + h * m + h * n) / (h * n * m))
                if p == 4:
                    print(h, n, l)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    for h in range(1, 3501):
        if 1 / h >= 4 / N:
            continue
        for n in range(h, 3501):
            if 1 / h + 1 / n >= 4 / N:
                continue
            l = 1
            r = 3500
            # print(h, n)
            while l + 1 < r:
                m = (l + r) // 2
                p = N * ((n * m + h * m + h * n) / (h * n * m))
                if p == 4:
                    print(h, n, m)
                    return True
                elif p < 4:
                    r = m
                else:
                    l = m
            else:
                print(h, n, l)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    for h in range(1, 3501):
        if 1 / h > 4 / N:
            continue
        for n in range(h, 3501):
            if 1 / h + 1 / n > 4 / N:
                continue
            l = 1
            r = 3500
            # print(h, n)
            while l + 1 < r:
                m = (l + r) // 2
                p = N * ((n * m + h * m + h * n) / (h * n * m))
                if p == 4:
                    print(h, n, m)
                    return True
                elif p < 4:
                    r = m
                else:
                    l = m

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from math import floor
from sys import exit

def isinteger(n):
    if isinstance(n,int):
        return True
    if isinstance(n,float):
        return n.is_integer()
    return False

n = int(input())
for i in range(floor(1700*n/(7000-n)-1),floor(3*n/4)+2):
    if 14000*i != (3500+i)*n and 4*i != n:
        mini = 3500*n*i/(14000*i-(3500+i)*n)
        maxi = 2*n*i/(4*i-n)
        for j in range(floor(mini)-1,floor(maxi)+2):
            if i!=0 and j!=0 and 4/n != 1/i+1/j:
                w = 1/(4/n-1/i-1/j)
                if abs(w-round(w))<=10**(-8) and w>=1 and j >= 1 and i >= 1:
                    exit(print(i,j,round(w)))
            else:
                continue
    else:
        continue

Submission status: Wrong Answer

Solution code:
from math import floor
from sys import exit

def isinteger(n):
    if isinstance(n,int):
        return True
    if isinstance(n,float):
        return n.is_integer()
    return False

n = int(input())
for i in range(floor(1700*n/(7000-n))-1,floor(3*n/4)+2):
    if 14000*i != (3500+i)*n and 4*i != n:
        mini = 3500*n*i/(14000*i-(3500+i)*n)
        maxi = 2*n*i/(4*i-n)
        for j in range(floor(mini)-1,floor(maxi)+2):
            if i!=0 and j!=0 and 4/n != 1/i+1/j:
                w = 1/(4/n-1/i-1/j)
                if abs(w-round(w))<=10**(-8):
                    exit(print(i,j,round(w)))
            else:
                continue
    else:
        continue

Submission status: Wrong Answer

Solution code:
N=int(input())
'''
4hnw=N(hn+nw+wh)
=(n+w)Nh + nwN
0=(Nw+Nn-4nw)h + nwN
h = -(nwN)/(Nw+Nn-4nw)
'''
for w in range(1,3501):
	for n in range(1,3501):
		if (N*w+N*n!= 4*n*w) :
			h = -(n*w*N)/(N*w+N*n-4*n*w)
			if  h==int(h):
			  print(int(h),n,w)
			  exit(0)

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()

    for a in range(1, 3500):
        for b in range(a, 3500):
            t1 = N * a * b
            t2 = 4 * a * b - N * (a + b)
            if t2 == 0:
                continue
            else:
                c = t1 / t2
                if c.is_integer():
                    print(a, b, int(c))
                    exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
for h in range(3501):
    for n in range(3501):
        a = 4 * h * n - N * n - N * h
        b = N * n * n
        if a > 0 and b % a == 0:  # 余りがでない -> 整数
            w = b // a
            print(h, n, w)
            exit()
        else:
            continue

Submission status: Wrong Answer

Solution code:
ESP = 1e-8
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        rev_w = 4 / N - 1 / h - 1 / n
        if rev_w > 0:
            w = int(pow(rev_w, -1))
            if abs((4 / N) - (1 / h) - (1 / n) - (1 / w)) < ESP:
                print(h, n, w)
                exit()

Submission status: Wrong Answer

Solution code:
ESP = 1e-14
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        rev_w = 4 / N - 1 / h - 1 / n
        if rev_w > 0:
            w = int(pow(rev_w, -1))
            if w < 3501 and abs((4 / N) - (1 / h) - (1 / n) - (1 / w)) < ESP:
                print(h, n, w)
                exit()

Submission status: Wrong Answer

Solution code:
ESP = 1e-10
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        rev_w = 4 / N - 1 / h - 1 / n
        if rev_w > 0:
            w = int(pow(rev_w, -1))
            if w < 3501 and abs((4 / N) - (1 / h) - (1 / n) - (1 / w)) < ESP:
                print(h, n, w)
                exit()

Submission status: Wrong Answer

Solution code:
ESP = 1e-6
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        rev_w = 4 / N - 1 / h - 1 / n
        if rev_w > 0:
            w = int(pow(rev_w, -1))
            if w < 3501 and abs((4 / N) - (1 / h) - (1 / n) - (1 / w)) < ESP:
                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):
        rev_w = 4 / N - 1 / h - 1 / n
        if rev_w > 0:
            w = int(pow(rev_w, -1))
            if w < 3501 and 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):
        rev_w = 4 / N - 1 / h - 1 / n
        if rev_w > 0:
            w = int(pow(rev_w, -1))
            if 4 / N == (1 / h) + (1 / n) + (1 / w):
                print(h, n, w)
                exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
for a in range(1,3501):
  for b in range(1,3501):
    s = n*a*b
    #s=4
    t = 4*a*b-n*b-n*a
    #t=8-4-2
    if t!=0 and s%t==0:
      c = s/t
      print(a,b,c)
      exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
for a in range(1,3501):
  for b in range(1,3501):
    s = n*a*b
    t = 4*a*b-n*b-n*a
    if t!=0 and s%t==0:
      c = s/t
      print(a,b,s)
      exit()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()

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)
		if 0 < w and w.is_integer() == 0:
			print(h, n, int(w))
			exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2 ==0:
	print(N, N, int(N/2))
	exit()

for i in range (1, 10000):
	for j in range (1, 10000):
		if 4*i*j == 0.5*N*j+N*i+1:
			print(2*i, j, N*i*j)
			exit()

Submission status: Wrong Answer

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

if N%2 ==0:
	print(N, N, int(N/2))
	exit()

for i in range (1, 5000000):
	P = N/(2-N/(2*i))
	if P.is_integer() == True and P> 0 :
		print(int(P), int(P), i)
		exit()

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/tenka1-2017/tasks/tenka1_2017_c
def main():
    N = int(input())

    for h in range(1, 3500 + 1):
        for n 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)
                return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
ok = False

for i in range(1, 3501):
    for j in range(1, 3501):
        if N*(i+j) < 4*i*j:
            w = 1 / (4/N - 1/i - 1/j)
            if int(w) == w:
                print(i, j, int(w))
                ok = True
                break
    if ok:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
ok = False

for i in range(1, 3501):
    for j in range(1, 3501):
        if 4/N - 1/i - 1/j <= 0:
            break
        w = (4/N - 1/i - 1/j)**-1
        if abs(int(w) - w) < 10**-7:
            print(i, j, int(w))
            ok = True
            break
    if ok:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
ok = False

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 == int((4/N - 1/i - 1/j)**-1) and int((4/N - 1/i - 1/j)**-1) <= 3500:
            print(i, j, int((4/N - 1/i - 1/j)**-1))
            ok = True
            break
    if ok:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
ok = False

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 == int((4/N - 1/i - 1/j)**-1):
            print(i, j, int((4/N - 1/i - 1/j)**-1))
            ok = True
            break
    if ok:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
def calc(n, h):
    return 4/n - 1/h

for i in range(1, 3501):
    for j in range(i, 3501):
        if (4/N - 1/i - 1/j) > 0 and (4/N - 1/i - 1/j)**-1 == int((4/N - 1/i - 1/j)**-1):
            print(i, j, int((4/N - 1/i - 1/j)**-1))
            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*h-N*n!=0:
            if (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()