Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
  const double R = 3.14159265358979323846;
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  long double x, y;
  x = 30*h+0.5*m;
  y = 6*m;
  
  long double z;
  if(x >= y) z = x-y;
  else z = y-x;
  
  if(z>180) z = z-180;
  long double ans1, ans2;
  
  
  
  long double t = cos(z*R/180);
  ans1 = a*a+b*b-2*a*b*t;

  //cout << ans1 << endl;
  ans2 = sqrt(ans1, 0.5);
  cout << fixed << setprecision(10);
  cout << ans2 << endl;
}
   
   
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: no matching function for call to 'sqrt(long double&, double)'
   27 |   ans2 = sqrt(ans1, 0.5);
      |          ~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:458:5: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_UnClos<std::_Sqrt, std::_ValArray, _Tp>, _Tp> std::sqrt(const valarray<_Tp>&)'
  458 |     _DEFINE_EXPR_UNARY_FUNCTION(sqrt, struct std::_Sqrt)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:458:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/valarray_after.h:458:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_UnClos<std::_Sqrt, std::_Expr, _Dom>, typename _Dom::value_type> std::sqrt(const _Expr<_Dom1, typename _Dom1::value_type>&)'
  458 |     _DEFINE_EXPR_UNARY_FUNCTION(sqrt, struct std::_Sqrt)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:458:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:1195:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::sqrt(const complex<_Tp>&)'
 1195 |     sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }
      |     ^~~~
/usr/include/c++/14/complex:1195:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114:
/usr/include/c++/14/cmath:454:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::sqrt(_Tp)'
  454 |     sqrt(_Tp __x)
      |     ^~~~
/usr/include/c++/14/cmath:454:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: candidate: 'double sqrt(double)'
  176 | __MATHCALL (sqrt,, (_Mdouble_ __x));
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:446:3: note: candidate: 'constexpr long double std::sqrt(long double)'
  446 |   sqrt(long double __x)
      |   ^~~~
/usr/include/c++/14/cmath:446:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:442:3: note: candidate: 'constexpr float std::sqrt(float)'
  442 |   sqrt(float __x)
      |   ^~~~
/usr/include/c++/14/cmath:442:3: note:   candidate expects 1 argument, 2 provided