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:
x = int(input())

for ch in range(1, 3501):
    for cn in range(1, 3501):
        a = ch*cn
        b = 4*ch*cn//x - cn - ch
        if b > 0 and a % b == 0:
            print(ch, cn, a//b)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from math import ceil,floor
N=int(input())
b=3501

for h in range(ceil(3*N/4),b):
  for w in range(1,floor(3*N/4)+1,4):
    if 4*h*w-N*h-N*w>0:
      if N*h*w % (4*h*w-N*h-N*w)==0:
        n=N*h*w//(4*h*w-N*h-N*w)
        print(h,n,w)
        sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
from math import ceil,floor
N=int(input())
b=3501

for h in range(ceil(3*N/4),b):
  for w in range(1,floor(3*N/4)+1,4):
    if 4*h*w-N*h-N*w:
      if N*h*w % (4*h*w-N*h-N*w)==0:
        print(h,N*h*w//(4*h*w-N*h-N*w),w)
        sys.exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N=int(input())
nn=4/N
w=0

for h in range(1,3501):
    for n in range(1,3501):
        if nn - 1/h - 1/n!=0 and nn > (1/h + 1/n):
            w=1/(nn - 1/h - 1/n)
            if nn==(1/h + 1/n + 1/w):
                print(h,n,int(w))
                exit()

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for h in range(1,3501):
    for n in range(1,h):
        d = N*n+N*h-4*h*n
        if d!=0:
            w = N*h*n/d
            if w.is_integer(): 
                w = int(max(w,-w))
                ans = [h,n,w]
print(ans[0],ans[1],ans[2])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for h in range(1,3501):
    for n in range(1,h):
        d = N*n+N*h-4*h*n
        if d!=0:
            w = N*h*n/d
            if w.is_integer(): 
                w = int(max(w,-w))
                ans = [h,n,w]
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=4/n
b=a/3
#print(a/3)
"""
print(a/3)
print(1/3498)
print(1/3498 +1/3498 +1/3498)
"""
#print(3485%4)

if n%4==0:
    for i in range(3):
        print(n//4*3,end= " ")
else:
    print(n//2,n,n)
    #print(4/n)
    #print(1/(n//2)+1/n+1/n)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=4/n
b=a/3
#print(a/3)
"""
print(a/3)
print(1/3498)
print(1/3498 +1/3498 +1/3498)
"""
#print(3485%4)

if n%4==0:
    for i in range(3):
        print(n//4*3,end= " ")
else:
    #print(n//2,n,n)
    #print(4/n)
    print(1/(n//2)+1/n+1/n)

"""
count=1

sumb=0
while sumb<1:
    count+=1
    sumb=b*count
if sumb==1:
    print(count,count,count)
else:
    """

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

Submission status: Wrong Answer

Solution code:
x=int(input())
for h in range(1,3501):
	for n in range(h,3501):
		b=4*h*n-n*x-h*x
		s=x*h*n
		if b>0 and s%b==0:
			print('{} {} {}'.format(h,n,s//b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = 0
x = 0
y = 0
z = 0
for h in range(1,3501):
    for n in range(1,3501):
        a = N*h*n
        b = 4*h*n-N*(h+n)
        if b!=0 and a%b==0:
            x = h
            y = n
            z = a//b
            flag=1
            break
    if flag==1:break
print(x,y,z)

Submission status: Wrong Answer

Solution code:
n=int(input())
for h in range(1,3500):
 for n in range(1,3500):
  if h+n>=3500:
   continue
  w=3500-h-n
  if 4/n == 1/h+1/n+1/w:
   print(h,n,w)
   exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

for x in range(1, 3501):
    for y in range(1, 3501):
        tmp = 4/n - 1/x - 1/y
        if tmp > 0 and int(1/tmp) == 1/tmp: 
            print(x, y, int(1/tmp))
            exit()

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:
            continue
        w=1/(4/N-1/h-1/n)
        if w==int(w) and w>=1:
            print(h,n,int(w))
            exit()

Submission status: Wrong Answer

Solution code:
n=4/int(input())
h=nn=w=1
while 1/h>=n:h+=1
n-=1/h
while 1/nn>=n:nn+=1
n-=1/nn
print(h,nn,int(1/n))

Submission status: Wrong Answer

Solution code:
N = int(input())
w = 1
try:
    for h in range(1,3501):
        for n in range(1,3501):
            if 4*h*n != N*(n+h):
                if N*h*n//(4*h*n-N*(h+n)) == N*h*n/(4*h*n-N*(h+n)):
                    w = N*h*n//(4*h*n-N*(h+n))
                    print(h,n,w)
                    raise Exception
except Exception:
    pass

Submission status: Wrong Answer

Solution code:
n = int(input())
w = 1
try:
    for h in range(3501):
        for n in range(3501):
            if 4*h*n != N*(n+h):
                if N*h*n//(4*h*n-N*(h+n)) == N*h*n/(4*h*n-N*(h+n)):
                    w = N*h*n//(4*h*n-N*(h+n))
                    print(h,n,w)
                    raise Exception
except Exception:
    pass

Submission status: Wrong Answer

Solution code:
n = int(input())
w = 1
try:
    for h in range(3501):
        for n in range(3501):
            if 4*h*n != N*(n+h):
                w = N*h*n//(4*h*n-N*(h+n))
                print(h,n,w)
                raise Exception
except Exception:
    pass

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

for x in range(1, 3500 + 1):
    for y in range(1, 3500 + 1):
        p = n * x * y
        q = 4 * x * y - n * (x + y)

        if q == 0: continue
        
        if p % q == 0:
            print(x, y, p // q)
            exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
for a in range(1,3501):
    for b in range(a,3501):
        if 4/n <= 1/a + 1/b:
            continue
        if 4/n > 1/a + 2/b:
            break
        c = 1/(4/n - 1/a - 1/b)
        if c == int(c):
                print(a,b,int(c))
                exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

maxh = int(3 * N / 4)

for h in range(1, 3501):
    for n in range(h, 3501):
        if (4 / N) - (1 / h) - (1 / n) > 0:
            w = 1 / ((4 / N) - (1 / h) - (1 / n))
            if w.is_integer() and n <= w and w <= 3500:
                w = int(w)
                print(h, n, w, sep = ' ')
                exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

for h in range(1, 3501):
    for n in range(h, 3501):
        w_reciprocal = (4 / N) - (1 / h) - (1 / n)
        if w_reciprocal > 0:
            w = 1 / w_reciprocal
            if int(w) == w:
                w = int(w)
                print(h, n, w, sep = ' ')
                exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

maxhnw = int(3 * N / 4)
for h in range(1, 3500):
    for n in range(h, 3500):
        w_reciprocal = (4 / N) - (1 / h) - (1 / n)
        if w_reciprocal > 0:
            w = 1 / w_reciprocal
            if int(w) == w:
                w = int(w)
                print(h, n, w, sep = ' ')
                exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

maxh = int(3 * N / 4)
for h in range(2, maxh + 1):
    if not (4/N) - (1/h) == 0:
        maxn = int(2/((4/N) - (1/h)))
        for n in range(h, maxn + 1):
            if not (4/N) - (1/h) - (1/n) == 0:
                w = 1/((4/N) - (1/h) - (1/n))
                if w > 0 and int(w) == w:
                    print(h, n, int(w), sep = ' ')
                    exit()

Submission status: Wrong Answer

Solution code:
N=int(input())
for i in range(1,min(3*N//4+3,3501)):
    for j in range(i,min(3*N//4+3,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:
N=int(input())
for i in range(1,min(3*N//4+2,3500)):
    for j in range(i,min(3*N//4+2,3500)):
        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:
n=int(input())
if n%2==0:
    print(n//2,n,n)
else:
    print(n//2+3,(n*(n//2+3)+1)//2,n*(n//2+3)*(n*(n//2+3)+1)//2)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=False
for i in range(1,3501):
    for j in range(1,3501):
        if (4*i*j-N*i-N*j)==0:
            continue
        else:
            w=(N*i*j)/(4*i*j-N*i-N*j)
            if w%1==0:
                p=i
                q=j
                s=True
                break
            else:
                continue
    if s==True:
        break

print("{} {} {}".format(p,q,int(w)))

Submission status: Wrong Answer

Solution code:
N=int(input())
s=False
for i in range(1,3501):
    for j in range(1,3501):
        if (4*i*j-N*i-N*j)==0:
            continue
        else:
            w=(N*i*j)/(4*i*j-N*i-N*j)
            flag=w.is_integer()
            if flag==True:
                p=i
                q=j
                s=True
                break
            else:
                continue
    if s==True:
        break

print("{} {} {}".format(p,q,int(w)))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
def gcd(x, y):
    while y!=0:
        x, y = y, x%y
    return x

def process():
    n = int(raw_input().strip())
    if n%2 == 0:
        print str(n)+' '+str(n)+' '+str(n>>1)
    for x in xrange(max(n>>2, 1), 3501):
        for y in xrange(x, 3501):
            b = x*y/gcd(x, y)
            b = b*n/gcd(b, n)
            a = b*4/n
            a -= b/x
            a -= b/y
            r = gcd(a, b)
            a /= r
            b /= r
            if a==1:
                print str(x)+' '+str(y)+' '+str(b)
                return

process()

Submission status: Wrong Answer

Solution code:
N = int(input())
# h,n,w
flag = False
for i in range(1,3501):
    for j in range(1,3501):
        if((4*i*j - N*i - N*j)==0):
            break
        w = (N*i*j)/(4*i*j - N*i - N*j)
        if(w == int(w)):
            w = int(w)
            h = i
            n = j
            flag = True
            break
    
    if flag:
        break

print(h,n,w)

Submission status: Wrong Answer

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

for h in range(3500):
    for n in range(3500):
        c= N*h*n 
        b= 4*n*h-N*n-N*h
        if b!=0 and c!=0:
            if c%b ==0:
                print(h,n,int(c/b))
                exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

        c1 = N*i*j
        if c1/c2 == c1//c2 :
            w = c1//c2
            h = i
            n = j
            print(h,n,w)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
N = float(N)
result = 4/N
 
def output2():
    for i in range(3500):
        for j in range(3500):
            h = float(i+1)
            n = float(j+1)
            
            sum_ = 1/h + 1/n
            
            sum2 = result - sum_
            
            if(sum2 <= 0):
                continue
            
            w =  1/sum2
            
            if(w == int(w)):
                return('{} {} {}'.format(int(h),int(n),int(w)))
 
print(output2())

Submission status: Wrong Answer

Solution code:
N = raw_input()
N = float(N)
result = 4/N

def output2():
    for i in range(3500):
        for j in range(i,3500):
            h = float(i+1)
            n = float(j+1)

            if(result - 1/h - 1/3500.0 <= 0):
                break

            sum_ = 1/h + 1/n
            
            sum2 = result - sum_
            
            if(sum2 <= 0):
                continue
            
            w =  1/sum2
            
            if(w == int(w)):
                return('{} {} {}'.format(int(h),int(n),int(w)))

print(output2())

Submission status: Wrong Answer

Solution code:
N = raw_input()
N = float(N)
result = 4/N

def output2():
    for i in range(3500):
        for j in range(i,3500):
            h = float(i+1)
            n = float(j+1)

            if(result - 1/h + 1/3500.0 <= 0):
                break

            sum_ = 1/h + 1/n
            
            sum2 = result - sum_
            
            if(sum2 <= 0):
                continue
            
            w =  1/sum2
            
            if(w == int(w)):
                return('{} {} {}'.format(int(h),int(n),int(w)))

print(output2())

Submission status: Wrong Answer

Solution code:
N = raw_input()
N = float(N)
result = 4/N

def output2():
    for i in range(3500):
        for j in range(3500):
            h = float(i+1)
            n = float(j+1)

            if(result - 1/h + 1/3500.0 <= 0):
                break

            sum_ = 1/h + 1/n
            
            sum2 = result - sum_
            
            if(sum2 <= 0):
                continue
            
            w =  1/sum2
            
            if(w == int(w)):
                return('{} {} {}'.format(int(h),int(n),int(w)))

print(output2())

Submission status: Wrong Answer

Solution code:
N = raw_input()
N = float(N)
result = 4/N

def output2():
    for i in range(3500):
        for j in range(3500):
            h = float(i+1)
            n = float(j+1)
            
            sum_ = 1/h + 1/n
            
            sum2 = result - sum_
            
            if(sum2 <= 0):
                continue
            
            w =  1/sum2
            
            if(w == int(w)):
                return('{} {} {}'.format(int(h),int(n),int(w)))

print(output2())

Submission status: Wrong Answer

Solution code:
def main():
    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: continue
            w, mod_ = divmod(1, x)
            if round(mod_, ndigits=8) == 0:
                print(h, n, int(w))
                return

main()

Submission status: Wrong Answer

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

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

main()

Submission status: Wrong Answer

Solution code:
N = int(input())
i = 1
while i<=7000:
    if N/i >= 4:
        i += 100
        continue
    i -= 100
    for x in range(i,3501):
        for y in range(i,3501):
            a = (4*x*y - N*y - N*x)
            if a == 0:
                continue
            z = N*x*y/a
            if z == int(z) and z >= 1:
                print(x,y,int(z))
                exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
for a in range(1, 3501,-1):
    for b in range(a, 3501,-1):
        c2 = 4 * a * b - b * N - a * N
        if c2 <= 0:continue
        c1 = a * b * N
        if c1/c2 == c1//c2:
            print(a,b,c1//c2)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    """
    入力: 正の整数N．
    出力: 条件を満たす正の整数h,n,wを空白区切りで出力．
    Returns: None
    """
    N = int(input())
    for h in range(1, 3501):
        for n in range(h, 3501):
            if (4*h*n) > (N*h + N*n) and (N*h+n) % (4*h*n - N*h - N*n) == 0:
                print("{} {} {}".format(str(h), str(n), str((N*h+n) // (4*h*n - N*h - N*n))))
                sys.exit()
    return None

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
# N=5
flag = False
memo = {}
for a in range(1,3501)[::-1]:
    for b in range(1,3501)[::-1]:
        if (a,b) not in memo:
            memo[(b,a)] = True
            if (N*a*b)%(4*a*b -N*a - N*b) == 0:
                c = int((N*a*b)/(4*a*b -N*a - N*b))
                flag = True
                break
        else:
            continue
    if flag:
        break
print(a,b,c)

Submission status: Wrong Answer

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

for h in range(1, 3501):
    for n in range(1, 3501):
        un = N * (n + h) - 4 * h * n
        un2 = -N*h*n
        if un:
            w = (un2) / (un)
            if w >= 0 and int(w) == w:
                print(n, h, w)
                __import__("sys").exit()

Submission status: Wrong Answer

Solution code:
import sys

def solution():
	N = int(input())
	l = 3500
	for i in range(1,l+1):
		for j in range(1,l+1):
			ii = float(i)
			jj = float(j)
			val = 4.0/N - 1/ii -1/jj
			if val ==  0:
				continue
			k = 1/val
			if k<0:
				continue
			if k -int(k)<sys.float_info.epsilon:
				return str(i)+' '+str(j)+' '+str(int(k))


	return ""


print(solution())

Submission status: Wrong Answer

Solution code:
import sys

def solution():
	N = int(input())
	l = 3500
	for i in range(1,l+1):
		for j in range(1,l+1):
			ii = float(i)
			jj = float(j)
			val = 4.0/N - 1/ii -1/jj
			if val ==  0:
				break
			k = 1/val
			if k<0:
				continue
			if k -int(k)<sys.float_info.epsilon:
				return [str(i)+' '+str(j)+' '+str(int(k))]


	return ""


print(solution())

Submission status: Wrong Answer

Solution code:
#!usr/bim/python
#! -*- coding: utf-8 -*-
import math

nyu = raw_input()
nyu = int(nyu)

h = 0
n = 0
w = 0

if nyu % 2 == 0:
    h = nyu
    n = nyu
    w = nyu / 2

elif nyu % 4 == 1:
    h = nyu / 4.0
    h = math.ceil(h)
    h = int(h)
    if h % 3 == 0:
        n = nyu*h/3*2
        w = nyu*h/3*2
    elif h % 2 == 0:
        n = nyu*h/2
        w = nyu*h
    else:
        i = 1
        status = 0
        while 1:
            h += 1
            x = h * nyu
            if x % (4*i+3) == 0:
                n = x*2/(4*i+3)
                w = x*2/(4*i+3)
                status = 1
            else:
                for j in range(2*i+1):
                    if x % ((j+1)*(4*i+2-j)) == 0:
                        n = x/(4*(i+1)-j)
                        w = x/(j+1)
                        status = 1
                        break
            if status == 1:
                break
            else:
                i += 1

else:
    h = nyu / 4.0
    h = math.ceil(h)
    h = int(h)
    n = nyu*h*2
    w = nyu*h*2

print h,n,w

Submission status: Wrong Answer

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

if N % 2 == 0:
    print(N // 2, N, N)
else:
    print(N*(N-1), 2 * (N-1), 2 * (N-1))

Submission status: Wrong Answer

Solution code:
def solution():
	N = int(input())
	l = 3500
	for _x in range(1,l):
		x = l-_x+1
		if 4*x-N == 0:
			continue
		y = int(N*x/(4*x-N))
		while True:
			y += 1
			if N*x*y < (4*x*y-N*(x+y)) or (4*x*y-N*(x+y))<=0:
				break
			if (N*x*y)%(4*x*y-N*(x+y)) == 0:
				ans =  [x,y,(N*x*y)/(4*x*y-N*(x+y))]
				ans.sort()
				return str(ans[0])+' '+str(ans[1])+' '+str(int(ans[2]))


	return ""


print(solution())

Submission status: Wrong Answer

Solution code:
def function() :
    N = int(input())
    for i in range(1, 301) :
        for j in range(1, 301) :
            if(i > j) :
                continue
            for k in range(1, 341) :
                if(j > k) : 
                    continue
                if (4/N == 1/i + 1/j + 1/k) :
                    print(i ,end=" ")
                    print(j ,end=" ")
                    print(k)
                    return
function()

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 4 == 0:
    out = n/4*3
    print(out,out,out)

elif n % 2 == 0:
    print(n/2,n,n)

else:
    pass

Submission status: Wrong Answer

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

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

main()

Submission status: Wrong Answer

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

    for h in range(N, 0, -1):
        for n in range(N, 0, -1):
            w = (4 - N // h - N // n) * N
            if w < 1:
                continue
            elif N / h + N / n + N / w == 4:
                print(h, n, w)
                return

main()

Submission status: Wrong Answer

Solution code:
#! -*- coding:utf-8 -*-
import sys

n = int(input())

if n % 4 == 0:
    print(3*n,3*n,3*n)
elif n % 4 == 2:
    print(2*(n//4)+1,2*(2*(n//4)+1),2*(2*(n//4)+1))
else:
    for i in range(1,3501):
        for j in range(1,i+1):
            for k in range(1,j+1):
                if 4/n == 1/i + 1/j + 1/k:
                    print(i,j,k)
                    sys.exit()

Submission status: Wrong Answer

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

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

main()

Submission status: Wrong Answer

Solution code:
from math import ceil
N = int(input())
max_w = 3*N/4
if max_w % 1 == 0:
    max_w += 1
ans = ""
for w in range(min(3500,ceil(max_w)-1),0,-1):
    if 4/N - 1/w == 0:
        continue
    max_n = 2/(4/N - 1/w)
    if max_n % 1 == 0:
        max_n += 1
    for n in range(min(3500,ceil(max_n))-1,0,-1):
        if 4/N - 1/n - 1/w == 0:
            continue
        h = 1/(4/N - 1/n - 1/w)
        if h % 1 == 0:
            if h > 0:
                ans = str(int(h)) + " " + str(n) + " " + str(w)
                break
    if ans:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math

num = int(input())
ans = [0,0,0]
value = 4 / num
limit = [math.ceil(num/4),0.0,0.0]
flag = 0
# print(limit)
if num % 4 == 0:
    a = int(num*3 / 4)
    print(a,a,a)
    flag = 1
a = limit[0]
remain = value - 1/a
if remain != 0:
    b = math.ceil(1/remain)
    remain = value - 1/a - 1/b
    if remain != 0:
        c = math.ceil(1/remain)
        if(value == 1/a + 1/b + 1/c):
            print(a,b,c)
            flag = 1
for a in range(limit[0],3500):
    if(flag):
        break
    remain = value - 1/a
    if remain <= 0:
        continue
    limit[1] = math.ceil(1/remain)
    if limit[1]>3500:
        continue
    for b in range(limit[1],3500):
        # print(a,b,remain,limit)
        if(flag):
            break
        remain = value - 1/a - 1/b
        if remain <= 0:
            continue
        limit[2] = math.ceil(1/remain)
        if limit[2]>3500:
            continue
        pos_up = limit[2]
        pos_low = limit[2]-1
        if value == 1/a + 1/b + 1/pos_up:
            print(a,b,pos_up)
            flag=1
            break
        if pos_low != 0 and value == 1/a + 1/b + 1/pos_low:
            print(a,b,pos_low)
            flag=1
            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):
        M = (4*a*b - N*a - N*b)
        C = N*a*b
        if M < 0 :
            continue
        elif M != 0:
            print("(a,b,M,C)",a,b,M,C,C//M,C/M,C//M==C/M)
            if C//M == C/M:
                c = C//M
                print(a,b,c)
                flag = 1
                break

Submission status: Wrong Answer

Solution code:
def solution():
	N = int(input())
	l = 10
	for x in range(1,int((3/4)*N)):

		if 4*x-N == 0:
			continue
		y = int(N*x/(4*x-N))
		while True:
			y += 1
			if N*x*y < (4*x*y-N*(x+y)) or (4*x*y-N*(x+y))<=0:
				break
			if (N*x*y)%(4*x*y-N*(x+y)) == 0:
				ans =  [x,y,(N*x*y)/(4*x*y-N*(x+y))]
				ans.sort()
				return str(ans[0])+' '+str(ans[1])+' '+str(int(ans[2]))


	return ""


print(solution())

Submission status: Wrong Answer

Solution code:
from math import ceil
N = int(input())
max_w = 3*N/4
if max_w % 1 == 0:
    max_w += 1
ans = ""
for w in range(ceil(max_w)-1,0,-1):
    if 4/N - 1/w == 0:
        continue
    max_n = 2/(4/N - 1/w)
    if max_n % 1 == 0:
        max_n += 1
    for n in range(ceil(max_n)-1,0,-1):
        if 4/N - 1/n - 1/w == 0:
            continue
        h = 1/(4/N - 1/n - 1/w)
        if h % 1 == 0:
            if h > 0:
                ans = str(int(h)) + " " + str(n) + " " + str(w)
                break
    if ans:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())


def four_over_n(t):
    h, n, w = [1, 1, 1]
    for x in range(10500):
        if t != 4 * h * n * w /(h*n + h*w + w*h):
            if x % 3 == 0:
                h += 1
            elif x % 3 == 1:
                n += 1
            else:
                w += 1
        else:
            print('{0} {1} {2}'.format(h,n,w))
            break


four_over_n(N)

Submission status: Wrong Answer

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

if N%2 == 0:
    h = N//2
    n = N
    w = N
    print(h,n,w)

else:
    pass

Submission status: Wrong Answer

Solution code:
inputs = input()

N = int(inputs)

print('3 %s 1' % str(N - 1))

Submission status: Wrong Answer

Solution code:
import math

num = int(input())
ans = [0,0,0]
value = 4 / num
limit = [math.ceil(num/4),0.0,0.0]
flag = 0
# print(limit)
if num % 4 == 0:
    a = int(num*3 / 4)
    print(a,a,a)
    flag = 1
for a in range(limit[0],limit[0]+3500):
    if(flag):
        break
    remain = value - 1/a
    if remain <= 0:
        continue
    limit[1] = math.ceil(1/remain)
    if limit[1]>3500:
        continue
    for b in range(limit[1],limit[1]+3500):
        print(a,b,remain,limit)
        if(flag):
            break
        remain = value - 1/a - 1/b
        if remain <= 0:
            continue
        limit[2] = math.ceil(1/remain)
        if limit[2]>3500:
            continue
        pos_up = limit[2]
        pos_low = limit[2]-1
        if value == 1/a + 1/b + 1/pos_up:
            print(a,b,pos_up)
            flag=1
            break
        if pos_low != 0 and value == 1/a + 1/b + 1/pos_low:
            print(a,b,pos_low)
            flag=1
            break

Submission status: Wrong Answer

Solution code:
inputs = input()

N = int(inputs)

print('%s 3 1' % str(N - 1))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
N = int(input())

w = 0
for h in range(1 , int(3*N/4 )+ 1) : 
    if w != 0 : 
        h -= 1
        break
    x = 4 / N - 1 / h
    if x <= 0 : continue
    for n in range(1 , int(2/(4/N - 1/h)) + 1) : 
        y = x - 1/n
        if y <= 0 : continue
        if n % (x*n - 1)  == 0 : 
            w = int(n / (n*x - 1))
            break
        
print(h ,n,w)

Submission status: Wrong Answer

Solution code:
from math import ceil
N = int(input())
max_w = 3*N/4
if max_w % 1 == 0:
    max_w += 1
ans = ""
for w in range(1,ceil(max_w)):
    if 4/N - 1/w == 0:
        continue
    max_n = 2/(4/N - 1/w)
    if max_n % 1 == 0:
        max_n += 1
    for n in range(1,ceil(max_n)):
        if 4/N - 1/n - 1/w == 0:
            continue
        h = 1/(4/N - 1/n - 1/w)
        if h % 1 == 0:
            if h > 0:
                ans = str(int(h)) + " " + str(n) + " " + str(w)
                break
    if ans:
        break
print(ans)