Language: C++

#include <iostream>
#include <complex>
#include <cmath>
#include <vector>
#include <numeric>
#include <functional>
#include <algorithm>
using namespace std;

typedef complex<double> pt;
const double pi = atan(1) * 4;

double f(double m, double s){
	return (s - m) * (s - m);
}

int main(){
	int n;
	while(cin >> n && n){
		vector<double> vec(n);
		for(int i=0;i<n;i++)cin >> vec[i];

		double sum = accumulate(vec.begin(), vec.end(), 0);
		double m = sum / n;

		transform(vec.begin(), vec.end(), vec.begin(), bind(f, m));

		double alpha2 = accumulate(vec.begin(), vec.end(), 0) / n;
		double alpha = sqrt(alpha2);

		printf("%.10f\n", alpha);
	}
	return 0;
}

Compiler output:
In file included from a.cc:6:
/usr/include/c++/14/functional: In instantiation of 'struct std::_Bind_check_arity<double (*)(double, double), double&>':
/usr/include/c++/14/functional:866:12:   required from 'struct std::_Bind_helper<false, double (&)(double, double), double&>'
  866 |     struct _Bind_helper
      |            ^~~~~~~~~~~~
/usr/include/c++/14/functional:888:5:   required by substitution of 'template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...) [with _Func = double (&)(double, double); _BoundArgs = {double&}]'
  888 |     bind(_Func&& __f, _BoundArgs&&... __args)
      |     ^~~~
a.cc:26:54:   required from here
   26 |                 transform(vec.begin(), vec.end(), vec.begin(), bind(f, m));
      |                                                                ~~~~^~~~~~
/usr/include/c++/14/functional:837:43: error: static assertion failed: Wrong number of arguments for function
  837 |       static_assert(sizeof...(_BoundArgs) == sizeof...(_Args),
      |                     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/functional:837:43: note: the comparison reduces to '(1 == 2)'
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation) [with _IIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _OIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _UnaryOperation = _Bind<double (*(double))(double, double)>]':
a.cc:26:12:   required from here
   26 |                 transform(vec.begin(), vec.end(), vec.begin(), bind(f, m));
      |                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4220:31: error: no match for call to '(std::_Bind<double (*(double))(double, double)>) (double&)'
 4220 |         *__result = __unary_op(*__first);
      |                     ~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/functional:596:9: note: candidate: 'template<class ... _Args, class _Result> _Result std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) [with _Args = {_Args ...}; _Functor = double (*)(double, double); _Bound_args = {double}]'
  596 |         operator()(_Args&&... __args)
      |         ^~~~~~~~
/usr/include/c++/14/functional:596:9: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/type_traits: In substitution of 'template<class _Fn, class ... _Args> using std::__invoke_result_t = typename std::__invoke_result::type [with _Fn = double (*&)(double, double); _Args = {double&}]':
/usr/include/c++/14/functional:559:8:   required by substitution of 'template<class _Functor, class ... _Bound_args> template<class _Fn, class _CallArgs, class ... _BArgs> using std::_Bind<_Functor(_Bound_args ...)>::_Res_type_impl = std::__invoke_result_t<_Fn&, decltype (std::_Mu<typename std::remove_cv<_BArgs>::type, std::is_bind_expression<typename std::remove_cv<_BArgs>::type>::value, (std::is_placeholder<typename std::remove_cv<_BArgs>::type>::value > 0)>()(declval<_BArgs&>(), declval<_CallArgs&>()))&& ...> [with _Fn = double (*)(double, double); _CallArgs = std::tuple<double&>; _BArgs = {double}; _Functor = double (*)(double, double); _Bound_args = {double}]'
  559 |         using _Res_type_impl
      |               ^~~~~~~~~~~~~~
/usr/include/c++/14/functional:563:8:   required by substitution of 'template<class _Functor, class ... _Bound_args> template<class _CallArgs> using std::_Bind<_Functor(_Bound_args ...)>::_Res_type = std::_Bind<_Functor(_Bound_args ...)>::_Res_type_impl<_Functor, _CallArgs, _Bound_args ...> [with _CallArgs = std::tuple<double&>; _Functor = double (*)(double, double); _Bound_args = {double}]'
  563 |         using _Res_type = _Res_type_impl<_Functor, _CallArgs, _Bound_args...>;
      |               ^~~~~~~~~
/usr/include/c++/14/functional:593:9:   required from '_OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation) [with _IIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _OIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _UnaryOperation = _Bind<double (*(double))(double, double)>]'
  593 |                typename _Result = _Res_type<tuple<_Args...>>>
      |                ^~~~~~~~
a.cc:26:12:   required from here
   26 |                 transform(vec.begin(), vec.end(), vec.begin(), bind(f, m));
      |                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:2685:11: error: no type named 'type' in 'struct std::__invoke_result<double (*&)(double, double), double&>'
 2685 |     using __invoke_result_t = typename __invoke_result<_Fn, _Args...>::type;
      |           ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation) [with _IIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _OIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _UnaryOperation = _Bind<double (*(double))(double, double)>]':
a.cc:26:12:   required from here
   26 |                 transform(vec.begin(), vec.end(), vec.begin(), bind(f, m));
      |                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/functional:608:9: note: candidate: 'template<class ... _Args, class _Result> _Result std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) const [with _Args = {_Args ...}; _Functor = double (*)(double, double); _Bound_args = {double}]'
  608 |         operator()(_Args&&... __args) const
      |         ^~~~~~~~
/usr/include/c++/14/functional:608:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/type_traits: In substitution of 'template<class _Fn, class ... _Args> using std::__invoke_result_t = typename std::__invoke_result::type [with _Fn = double (* const&)(double, double); _Args = {const double&}]':
/usr/include/c++/14/functional:559:8:   required by substitution of 'template<class _Functor, class ... _Bound_args> template<class _Fn, class _CallArgs, class ... _BArgs> using std::_Bind<_Functor(_Bound_args ...)>::_Res_type_impl = std::__invoke_result_t<_Fn&, decltype (std::_Mu<typename std::remove_cv<_BArgs>::type, std::is_bind_expression<typename std::remove_cv<_BArgs>::type>::value, (std::is_placeholder<typename std::remove_cv<_BArgs>::type>::value > 0)>()(declval<_BArgs&>(), declval<_CallArgs&>()))&& ...> [with _Fn = double (* const)(double, double); _CallArgs = std::tuple<double&>; _BArgs = {const double}; _Functor = double (*)(double, double); _Bound_args = {double}]'
  559 |         using _Res_type_impl
      |               ^~~~~~~~~~~~~~
/usr/include/c++/14/functional:570:8:   required by substitution of 'template<class _Functor, class ... _Bound_args> template<class _CallArgs, template<class _CallArgs, template<class> class __cv_quals> template<class _Functor, class ... _Bound_args> template<class> class __cv_quals> using std::_Bind<_Functor(_Bound_args ...)>::_Res_type_cv = std::_Bind<_Functor(_Bound_args ...)>::_Res_type_impl<typename __cv_quals<typename std::enable_if<(bool)((std::tuple_size<_Tuple>::value + 1)), _Functor>::type>::type, _CallArgs, typename __cv_quals<_Bound_args>::type ...> [with _CallArgs = std::tuple<double&>; __cv_quals = std::add_const; _Functor = double (*)(double, double); _Bound_args = {double}]'
  570 |         using _Res_type_cv = _Res_type_impl<
      |               ^~~~~~~~~~~~
/usr/include/c++/14/functional:605:9:   required from '_OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation) [with _IIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _OIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _UnaryOperation = _Bind<double (*(double))(double, double)>]'
  605 |                typename _Result = _Res_type_cv<tuple<_Args...>, add_const>>
      |                ^~~~~~~~
a.cc:26:12:   required from here
   26 |                 transform(vec.begin(), vec.end(), vec.begin(), bind(f, m));
      |                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:2685:11: error: no type named 'type' in 'struct std::__invoke_result<double (* const&)(double, double), const double&>'
 2685 |     using __invoke_result_t = typename __invoke_result<_Fn, _Args...>::type;
      |           ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation) [with _IIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _OIter = __gnu_cxx::__normal_iterator<double*, vector<double> >; _UnaryOperation = _Bind<double (*(double))(double, double)>]':
a.cc:26:12:   required from here
   26 |                 transform(vec.begin(), vec.end(), vec.begin(), bind(f, m));
      |                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/functional:621:9: note: candidate: 'template<class ... _Args, class _Result> _Result std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) volatile [with _Args = {_Args ...}; _Functor = double (*)(double, double); _Bound_args = {double}]'
  621 |         operator()(_Args&&... __args) volatile
      |         ^~~~~~~~
/usr/include/c++/14/functional:621:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/type_traits: In substitution of 'template<class _Fn, class ... _Args> using std::__invoke_result_t = typename std::__invoke_result::type [with _Fn = double (* volatile&)(double, double); _Args = {volatile double&}]':
/usr/include/c++/14/functional:559:8:   required by substitution of 'template<class _Functor, class ... _Bound_args> template<class _Fn, class _CallArg