Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <list>
#include <cmath>
#include <queue>
using namespace std;

#define ll long long
void sor(vector<ll> &x)
{
    sort(x.begin(), x.end());
}

ll gcd(ll x, ll y)
{
    if (y == 0)
    {
        return x;
    }
    return gcd(y, x % y);
}

list<ll> a[5];
void bfs(int src)
{
    queue<int> q;
    bool *vis = new bool[5 + 1]{0};
    q.push(src);
    vis[src] = true;
    while (!q.empty())
    {
        int node = q.front();
        cout << node << " ";
        q.pop();
        for (int n : a[node])
        {
            if (!vis[n])
            {
                q.push(n);
                vis[n] = true;
            }
        }
    }
}

ll min(ll x, ll y)
{
    if (x > y)
    {
        return y;
    }
    else
    {
        return x;
    }
}

int main()
{

    double n, x;
    cin >> n >> x;
    double ans = 2 * x + n + 3 * (gcd(n, x));
    cout << ans;
    return 0;
}

Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric: In instantiation of 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]':
a.cc:63:38:   required from here
   63 |     double ans = 2 * x + n + 3 * (gcd(n, x));
      |                                   ~~~^~~~~~
/usr/include/c++/14/numeric:175:21: error: static assertion failed: std::gcd arguments must be integers
  175 |       static_assert(is_integral_v<_Mn> && is_integral_v<_Nn>,
      |                     ^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/numeric:175:21: note: 'std::is_integral_v<double>' evaluates to false
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/type_traits: In instantiation of 'struct std::make_unsigned<double>':
/usr/include/c++/14/type_traits:2076:11:   required by substitution of 'template<class _Tp> using std::make_unsigned_t = typename std::make_unsigned::type [with _Tp = double]'
 2076 |     using make_unsigned_t = typename make_unsigned<_Tp>::type;
      |           ^~~~~~~~~~~~~~~
/usr/include/c++/14/numeric:182:24:   required from 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]'
  182 |       return __detail::__gcd<make_unsigned_t<_Ct>>(__m2, __n2);
      |              ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:63:38:   required from here
   63 |     double ans = 2 * x + n + 3 * (gcd(n, x));
      |                                   ~~~^~~~~~
/usr/include/c++/14/type_traits:1929:13: error: invalid use of incomplete type 'class std::__make_unsigned_selector<double, false, false>'
 1929 |     { using type = typename __make_unsigned_selector<_Tp>::__type; };
      |             ^~~~
/usr/include/c++/14/type_traits:1837:11: note: declaration of 'class std::__make_unsigned_selector<double, false, false>'
 1837 |     class __make_unsigned_selector;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~