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: Runtime Error

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):
            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: Runtime Error

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 d % u == 0:
            print(h, w, d//u)
            exit()

Submission status: Runtime Error

Solution code:
MOD = 10**9+7
N = int(input())
L = list(map(lambda x: bin(int(x))[2:], input().split()))
max_len = max([len(v) for v in L])
padL = ["0"*(max_len-len(v))+v for v in L]
cnt = [0]*max_len
for i in range(max_len):
    for l in padL:
        cnt[i] += 1 if l[i] == "1" else 0

ans = 0
v = 1
for i in range(max_len):
    ans += v*cnt[max_len-1-i]*(N-cnt[max_len-i-1])
    ans %= MOD
    v *= 2

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        if (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)
            break

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(1,3501):
  for j in range(1,3501):
    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: Runtime Error

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

print(*f(N))

Submission status: Runtime Error

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 ret >= 0, 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

print(*f(N))

Submission status: Runtime Error

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 ret > 0, 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

print(*f(N))

Submission status: Runtime Error

Solution code:
N=int(input())
if N%2==0:
  print(N//2,N,N)
else:
  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)).is_integer():
          print(i,j,int(w))
          exit()

Submission status: Runtime Error

Solution code:
N=int(input())
if N%2==0:
  print(N//2,N,N)
else:
  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).is_integer():
          print(i,j,int(w))
          exit()

Submission status: Runtime Error

Solution code:
N=int(input())
if N%2==0:
  print(N//2,N,N)
else:
  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).is_integer():
          print(i,j,int(w))
          exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

N = int(input())
for h in range(1, 5):
    for n in range(1, 5):
        tmp = f(N, h, n)
        if tmp != 0:
            w = 1/tmp
            if w.is_integer():
                ans = [h,n,int(w)]
                break
print(*ans)

Submission status: Runtime Error

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

n=I()
#if 4/n-(1/h+1/x+1/w)==0:
for h in range(1,3501):
    for w in range(1,3501):
        y=int(1/(4/n-1/h-1/w))
        for x in range(y-1,y+1):
            if 4*h*x*w==n*x*w+n*h*w+n*h*x:
                print(h,x,w)
                break

Submission status: Runtime Error

Solution code:
N = int(input())

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
for n in range(1, 3501):
    for w in range(i, 3501):
        t = (N*n*w) % (4*n*w - N*w - N*w)
        if t == 0:
            print(t,n,w)
            exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

from fractions import Fraction

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())


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

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/tenka1-2017/tasks/tenka1_2017_c
# 式をこねくり回せ

N = int(input())

from itertools import product

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
if N % 4 == 0:
  h, n, w = (3 * N) // 4, (3 * N) // 4, (3 * N) // 4
elif N % 4 == 2:
  h, n, w = N, N, N // 2
elif N % 4 == 3:
  s = N // 4 + 1
  h, n, w = 2 * s, 2 * s, s * N
elif N % 4 == 1:
  s = (N // 4) + 1
  if s % 3 == 0:
    h = s
    n = 2 * (s // 3) * (4 * s - 3)
    w = 2 * (s // 3) * (4 * s - 3)
  elif s % 3 == 2:
    h = N
    n = 4 * (s // 3) + 2
    w = (4 * (s // 3) + 2) * (12 * (s // 3) + 5)
  elif s % 3 == 1:
    h = 
print(h, n, w)

Submission status: Runtime Error

Solution code:
N = int(input())
if N % 4 == 0:
  h, n, w = (3 * N) // 4, (3 * N) // 4, (3 * N) // 4
elif N % 4 == 2:
  h, n, w = N, N, N // 2
elif N % 4 == 3:
  h, n, w = 2 * ((N // 4) + 1), 2 * ((N // 4) + 1), (2 * ((N // 4) + 1)) * N
elif N % 4 == 1:
  s = (N // 4) + 1
  if s % 3 == 0:
    h = s
    n = 2 * (s // 3) * (4 * s - 3)
    w = 2 * (s // 3) * (4 * s - 3)
  elif s % 3 == 2:
    h = N
    n = 4 * (s // 3) + 2
    w = (4 * (s // 3) + 2) * (12 * (s // 3) + 5)
print(h, n, w)

Submission status: Runtime Error

Solution code:
#N=3485
#A=[ 32, 1, 87, 25, 36]
N=int(input())


for i in range(1,3501):
    for j in range(1,3501):
        u=-N*i*j
        d=N*i+N*j-4*i*j
        if(u%d==0 and (u*d > 0)):
            k=u//d
            if(N*(i*j+j*k+k*i)==4*i*j*k):
                print(i,j,k)
                exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

for x in range(1, 3501):
    for y in range(1, 3501):
        if N*x*y/(4*x*y-N*(x+y)) == int(N*x*y/(4*x*y-N*(x+y))) and int(N*x*y/(4*x*y-N*(x+y))) > 0:
            print(x, y, int(N*x*y/(4*x*y-N*(x+y))))
            break
    else:
        continue
    break

Submission status: Runtime Error

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

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

        if flag:
            break
    if flag:
        break

print(h,n,w)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
def abc(N,a,b,c):
    return 4*a*b*c-N*(a*b+b*c+c*a)
for i in range(1,3501):
    flag=0
    if (1/i)>=(4/n):
        continue
    for j in range(i,3501):
        k=int((n*i*j)/(4*i*j-n*i-n*j))
        if k>0:
            if abc(n,i,j,k)==0:
                print(i,j,k)
                flag=1
                break
    if flag>0:
        break

Submission status: Runtime Error

Solution code:
N = int(input())
flg = False
for a in range(1,3501):
  for b in range(a,3501):
    A = 4*a*b - N*(a+b)
    B = N*a*b
    if B%A==0 and A//B>0:
      c = B//A
      flg = True
      break
  if flg:break
print(a,b,c)

Submission status: Runtime Error

Solution code:
# 2019/07/02
# Tenka1 Programmer Contest - C

# 4/N-1/h-1/n=1/w
# 1/(4/N-1/h-1/n)=w

# Input
n = int(input())

eflg = False
for i in range(1, 3501):
    for j in range(1, 3501):
        w = (n * i * j) / (4 * i * j - n * i - n * j)
        if w > 0:
            if int(w) == w:
                ans = [i, j, int(w)]
                eflg = True
                break
    if eflg == True:
        break

# Output
print(ans[0], ans[1], ans[2])

Submission status: Runtime Error

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

for h in range(1, 3501):
	for n in range(1, 3501):
		tmp = 4 * n * h - N * n - N * h
		if tmp > 0:
			if (N * h * n) % tmp == 0:
				sys.exit(h, n, (N * h * n) // tmp)

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
N=int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
n=int(input())

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

Submission status: Runtime Error

Solution code:
n=int(input())

for i in range(1,3501):
    for j in range(1,3501):
        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)
            break
        else:
            continue

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

N = int(input())

for h in range(math.ceil(N/4),3501):
    for n in range(math.ceil(1/(4/N-1/h)),3501):
        a = 4/N - 1/h - 1/n
        if a!= 0:
            w = 1/a
            if 4*h*n*w == N*(h*n+n*w+w*h):
                break
    else:
        continue
    break

print(h,n,int(w))

Submission status: Runtime Error

Solution code:
import math

N = int(input())

for h in range(math.ceil(N/4),3501):
    for n in range(math.ceil(1/(4/N-1/h)),3501):
        a = 4/N - 1/h - 1/n
        print(h,n,a)
        if a!= 0:
            w = 1/a
            if 4*h*n*w == N*(h*n+n*w+w*h):
                break
    else:
        continue
    break

print(h,n,int(w))

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()
onlyb = 0
onlyw = 0
twotn = 0
flag = 0
ch =0
for i in range(N):
    if S[i] == ".":
        onlyb += 1
        ch = 0
        if flag != 0:
            twotn +=1
    else:
        onlyw += 1
        ch +=1
        flag = 1

print(min(onlyb,onlyw-ch,twotn))

Submission status: Runtime Error

Solution code:
from math import floor
import sys
ns = int(input())
for h in range(1, 3501):
    for n in range(h, 3501):
        w = float(ns / (4 - ns / h - ns / n) )
        if(w.is_integer() and w > 0):
            print("{} {} {}".format(h, n, int(w)))
            exit()

Submission status: Runtime Error

Solution code:
from math import floor

ns = int(input())
start = floor(ns / 4)
if(start == 0): start = 1
for h in range(start, 3501):
    for n in range(h, 3501):
        w = float(ns / (4 - ns / h - ns / n) )
        if(w.is_integer() and w > 0):
            print(f"{h} {n} {int(w)}")
            exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
h = N
n = max(N//3,1)
w = 1
while True:
    if (N*n)//(3*n-N) == (N*n)/(3*n-N):
        print(h,n,(N*n)//(3*n-N))
        break
    n += 1

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())

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

Submission status: Runtime Error

Solution code:
N=int(input())

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

Submission status: Runtime Error

Solution code:
import sys

n = int(input())

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


main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
ans=[]
for a in range(1,3501):
    for b in range(1,3501):
        if (4/n-1/a-1/b)==0:
            continue
        c=1/(4/n-1/a-1/b)
        if c==int(c) and c>0:
            ans.append([str(a),str(b),str(int(c))])
            break
print(" ".join(ans[0]))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        aw=(N*n*h)
        bw=4*n*h-N*h-N*n
        if bw!=0 and bw/aw==bw//aw:
            h=i
            n=j
            break
print(h,n,bw//aw)

Submission status: Runtime Error

Solution code:
N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        aw=(N*n*h)
        bw=4*n*h-N*h-N*n
        if bw!=0 and bw/aw=bw//aw:
            h=i
            n=j
            break
print(h,n,bw//aw)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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==0:
			print(h,n,A//B)
			exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from sys import stdin

gets = stdin.readline

@profile
def main():
    n = int(gets())
    flag = False
    for h in range(3500, 1, -1):
        nh = n*h
        for w in range(1, h+1):
            y = (4 * h * w - nh - n*w)
            if y > 0 and (nh % y == 0 or w % y == 0):
                print(h, w, (nh*w)//y)
                flag = True
                break
        if flag:
            break
    return


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import math

def is_prime(q):
    if q == 2:
        return (True, 0)
    if q < 2:
        return (False, 1)
    if q&1 == 0:
        return (False, 2)

    i = 3
    end = int(math.sqrt(q))
    while i <= end:
        if q%i is 0:
            return (False, i)
        i += 2
    return (True, 0)

def split22(n, k):
	if n % k != 0:
		return None
	ml = int(n / k)
	ret = is_prime(ml)
	if ret[0] is True:
		return None
	return (int(n/2), int(ret[1]), int(ml/ret[1]))

def split13(n):
	# n = (3 - m) * l
	if n&1 == 0:
		l = n / 2
		if math.gcd(l, 2) == n:
			return (n, l, 2)
	# l^2 - 3l + n = 0
	tmp = 3**2 - 4 * n
	if tmp < 0:
		return None
	_x = math.sqrt(tmp)
	if _x - int(_x) == _x:
		x = (-1) * _x - b
		if x > 0:
			x = _x - b
		return (n, x, 3-x)
	return None

n = int(input())
ans = None

ans = split13(n)
k = 1
while ans is None:
	if n&1 == 0:
		ans = split22(n, k)
	n *= 2
	k *= 2

print(" ".join(map(str, ans)))