Language: C++

ing namespace std;

int main() {
	long long int N;
	cin >> N;
	long double ans = 0;
	vector<long double>R( N + 2 ), Len( N + 3 );
	for( size_t i = 1; i <= N; i++ ) {
		cin >> R[i];
	}
	for( size_t i = 1; i < N + 2; i++ ) {
		long double L = R[i] + R[i - 1];
		long double X = R[i] - R[i - 1];
		long double Y = sqrtl( L*L - X*X );
		Len[i] = max( Y, max( R[i], R[i - 1] ) );
	}
	int j = 0, k = 0;
	for( size_t i = 0; i < N + 2; i++ ) {
		//cout << R[i] << " " << Len[i] << endl;
		if( ans < R[i] ) {
			ans = R[i];
			j = i;
		} else {
			ans += Len[i];
		}
		//cout << Len[i] << endl;
	}
	reverse( Len.begin(), Len.end() );
	reverse( R.begin(), R.end() );
	ans = 0;
	for( size_t i = 0; i < N + 2 - j + 1; i++ ) {
		//cout << R[i] << " " << Len[i] << endl;
		if( ans < R[i] ) {
			ans = R[i];
		} else {
			ans += Len[i];
		}
	}
	if( N == 2 && R[R.size() - 2] != R[R.size() - 1] ) {
		ans += R[R.size()-2];
	}
	cout << fixed << setprecision( 20 ) << ans << endl;
}

Compiler output:
a.cc:1:1: error: 'ing' does not name a type; did you mean 'int'?
    1 | ing namespace std;
      | ^~~
      | int
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> N;
      |         ^~~
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<long double>R( N + 2 ), Len( N + 3 );
      |         ^~~~~~
a.cc:7:16: error: expected primary-expression before 'long'
    7 |         vector<long double>R( N + 2 ), Len( N + 3 );
      |                ^~~~
a.cc:8:14: error: 'size_t' was not declared in this scope
    8 |         for( size_t i = 1; i <= N; i++ ) {
      |              ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | ing namespace std;
a.cc:8:28: error: 'i' was not declared in this scope
    8 |         for( size_t i = 1; i <= N; i++ ) {
      |                            ^
a.cc:9:24: error: 'R' was not declared in this scope
    9 |                 cin >> R[i];
      |                        ^
a.cc:11:14: error: 'size_t' was not declared in this scope
   11 |         for( size_t i = 1; i < N + 2; i++ ) {
      |              ^~~~~~
a.cc:11:14: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:11:28: error: 'i' was not declared in this scope
   11 |         for( size_t i = 1; i < N + 2; i++ ) {
      |                            ^
a.cc:12:33: error: 'R' was not declared in this scope
   12 |                 long double L = R[i] + R[i - 1];
      |                                 ^
a.cc:14:33: error: 'sqrtl' was not declared in this scope
   14 |                 long double Y = sqrtl( L*L - X*X );
      |                                 ^~~~~
a.cc:15:17: error: 'Len' was not declared in this scope
   15 |                 Len[i] = max( Y, max( R[i], R[i - 1] ) );
      |                 ^~~
a.cc:15:34: error: 'max' was not declared in this scope
   15 |                 Len[i] = max( Y, max( R[i], R[i - 1] ) );
      |                                  ^~~
a.cc:15:26: error: 'max' was not declared in this scope
   15 |                 Len[i] = max( Y, max( R[i], R[i - 1] ) );
      |                          ^~~
a.cc:18:14: error: 'size_t' was not declared in this scope
   18 |         for( size_t i = 0; i < N + 2; i++ ) {
      |              ^~~~~~
a.cc:18:14: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:18:28: error: 'i' was not declared in this scope
   18 |         for( size_t i = 0; i < N + 2; i++ ) {
      |                            ^
a.cc:20:27: error: 'R' was not declared in this scope
   20 |                 if( ans < R[i] ) {
      |                           ^
a.cc:24:32: error: 'Len' was not declared in this scope
   24 |                         ans += Len[i];
      |                                ^~~
a.cc:28:18: error: 'Len' was not declared in this scope
   28 |         reverse( Len.begin(), Len.end() );
      |                  ^~~
a.cc:28:9: error: 'reverse' was not declared in this scope
   28 |         reverse( Len.begin(), Len.end() );
      |         ^~~~~~~
a.cc:29:18: error: 'R' was not declared in this scope
   29 |         reverse( R.begin(), R.end() );
      |                  ^
a.cc:31:14: error: 'size_t' was not declared in this scope
   31 |         for( size_t i = 0; i < N + 2 - j + 1; i++ ) {
      |              ^~~~~~
a.cc:31:14: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:31:28: error: 'i' was not declared in this scope
   31 |         for( size_t i = 0; i < N + 2 - j + 1; i++ ) {
      |                            ^
a.cc:42:9: error: 'cout' was not declared in this scope
   42 |         cout << fixed << setprecision( 20 ) << ans << endl;
      |         ^~~~
a.cc:42:17: error: 'fixed' was not declared in this scope
   42 |         cout << fixed << setprecision( 20 ) << ans << endl;
      |                 ^~~~~
a.cc:42:26: error: 'setprecision' was not declared in this scope
   42 |         cout << fixed << setprecision( 20 ) << ans << endl;
      |                          ^~~~~~~~~~~~
a.cc:42:55: error: 'endl' was not declared in this scope
   42 |         cout << fixed << setprecision( 20 ) << ans << endl;
      |                                                       ^~~~