Language: C

 <stdio.h>

int min(int a, int b);

int sub_child(int c1, int m1, int c2, int m2);

int gcd(int a, int b);

int main(void){
  int N, h, i, j, tmp1, tmp2, tmp3, c1, m1, n=0, w=0, not_found = 1;

  scanf("%d", &N);

  if(!(N%2)) printf("%d %d %d\n", N, N, N/2);
  else{
    
    if(N%4 == 3){
      h = (N+1)/4;
      printf("%d %d %d\n", h, 2*N*h, 2*N*h);
    }
    else{
      h = (N+3)/4;
      if(!(h%2)) printf("%d %d %d\n", h, N*h, N*h/2);
      else{
	for(i=h;i<min(N*3/4 + 1, 3500) && !w && not_found;i++){
	  tmp1 = sub_child(1, N, 1, i);
	  tmp2 = N*i;
	  if(!(tmp2%tmp1)){
	    h=i;
	    n=2*tmp2/tmp3;
	    w=n;
	    break;
	  }
	  else if(!(tmp1%2) && !(tmp2%(tmp1/2))){
	    h=i;
	    n=tmp2/(tmp1/2);
	    w=n;
	    break;
	  }
	  else{
	    for(j=tmp2/tmp1 + 1; j<min(2*tmp2/tmp1 + 1, 3500);j++){
	      //if tmp1/tmp2 - 1/j is in the form of 1/k 
	      if(!(tmp2*j % (tmp3=sub_child(tmp1, tmp2, 1, j)))){
		h=i;
		n=j;
		w=tmp2*j/tmp3;
		not_found=0;
		break;
	      }
	    }
	  }
	}
      }
    }
  }
  if(n) printf("%d %d %d\n", h, n, w);

  return 0;
}

  int min(int a, int b){
    if(a < b) return a;
    else return b;
  }

  /*c1/m1 - c2/m2を計算する。
    =(c1m2 - c2m1) / m1m2 */
  
int sub_child(int c1, int m1, int c2, int m2){
    return c1*m2 - c2*m1;
  }


Compiler output:
main.c:1:2: error: expected identifier or '(' before '<' token
    1 |  <stdio.h>
      |  ^
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d", &N);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 |  <stdio.h>
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d", &N);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:14: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   14 |   if(!(N%2)) printf("%d %d %d\n", N, N, N/2);
      |              ^~~~~~
main.c:14:14: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:14: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:14:14: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   19 |       printf("%d %d %d\n", h, 2*N*h, 2*N*h);
      |       ^~~~~~
main.c:19:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:18: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |       if(!(h%2)) printf("%d %d %d\n", h, N*h, N*h/2);
      |                  ^~~~~~
main.c:23:18: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:25:19: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
   25 |         for(i=h;i<min(N*3/4 + 1, 3500) && !w && not_found;i++){
      |                   ^~~
      |                   main
main.c:56:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   56 |   if(n) printf("%d %d %d\n", h, n, w);
      |         ^~~~~~
main.c:56:9: note: include '<stdio.h>' or provide a declaration of 'printf'