Language: C++

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5;
const double eps=1e-8;

int dcmp(double x)
{
    if(fabs(x)<eps) return 0;
    return x>0?1:-1;
}

int main()
{
    double n;
    while(scanf("%lf",&n)!=EOF)
    {
        bool flag=false;
        for(double i=1;i<=3500;i++)
        {
            for(double j=1;j<=3500;j++)
            {
                double tar=4/n;
                double L=1.0,R=3500.0,M;
                while(dcmp(R-L)>0)
                {
                    M=(L+R)/2;
                    double tmp=4.0/n-1.0/i-1.0/j-1.0/M;
                    int op=dcmp(tmp);
                    if(op==0)
                    {
                        int ti=(int)i,tj=(int)j,tm=(int)M;
                        printf("%d %d %d\n",ti,tj,tm);
                        flag=true;
                        break;
                    }else if(op>0)
                    {
                        R=M;
                    }else
                    {
                        L=M;
                    }
                }
                if(flag) break;
            }
            if(flag) break;
        }
    }
    return 0;
}
//49 14 102 2499
/*
if(n==49) printf("14 102 2499\n");
        else
        {
            printf("%lld",n/4+1);
            bool flag=false;
            if(n%4==0)
            {
                for(LL i=1;i<=3500;i++)
                {
                    for(LL j=1;j<=3500;j++)
                    {
                        if((16*i*j-n*(n+4)*(i+j))==0)
                        {
                            printf(" %lld %lld\n",i,j);
                            flag=true;
                        }
                    }
                    if(flag) break;
                }
            }else if(n%4==1)
            {
                for(LL i=1;i<=3500;i++)
                {
                    for(LL j=1;j<=3500;j++)
                    {
                        if((12*i*j-n*(n+3)*(i+j))==0)
                        {
                            printf(" %lld %lld\n",i,j);
                            flag=true;
                        }
                    }
                    if(flag) break;
                }
            }else if(n%4==2)
            {
                for(LL i=1;i<=3500;i++)
                {
                    for(LL j=1;j<=3500;j++)
                    {
                        if((8*i*j-n*(n+2)*(i+j))==0)
                        {
                            printf(" %lld %lld\n",i,j);
                            flag=true;
                        }
                    }
                    if(flag) break;
                }
            }else if(n%4==3)
            {
                for(LL i=1;i<=3500;i++)
                {
                    for(LL j=1;j<=3500;j++)
                    {
                        if((4*i*j-n*(n+1)*(i+j))==0)
                        {
                            printf(" %lld %lld\n",i,j);
                            flag=true;
                        }
                    }
                    if(flag) break;
                }
            }
        }
*/


Compiler output:
a.cc: In function 'int dcmp(double)':
a.cc:12:8: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   12 |     if(fabs(x)<eps) return 0;
      |        ^~~~
      |        labs