Language: C++

#include <iostream>
using namespace std;

int main() {
    int n;
    std::cin >> n;

    int l, m,  i = 0;
    double a[n], b[n];
    //double c[n][2];
    vector< vector<double> > c (n, vector<double>(2) );

    while (std::cin >> l && std::cin >> m) {
        a[i] = (double)l;
        b[i] =  (double)m;
        c[i][1] = sqrt(a[i]*a[i]+b[i]*b[i]);
        if(0==l && 0==m){
          c[i][0] = 0.0;
          c[i][1] = 0.0;
        }else{
          double theta = acos(((double)a[i])/sqrt(a[i]*a[i]+b[i]*b[i]));
          if(b[i]>=0.0){
            c[i][0] = theta;
          }else{
            c[i][0] = -1.0*theta + 2.0*M_PI;
          }
        }
        cout << '{' << c[i][0] << ',' << c[i][1] << "} ";
        i++;
        if (i >= n) {
            break;
        }
    }
    sort(c.begin(), c.end());

    for ( int i = 0;  i< n; ++i ) {
      cout << '{' << c[i][0] << ',' << c[i][1] << "} ";
    }

    for ( int i = 0;  i< n; ++i ) {
      double xsum=0.0;
      double ysum=0.0;
      double theta_begin = c[i][0];
      double theta_end = theta_begin + M_PI;
      for(int j=0; j<n; j++){
        if((c[j][0]>= theta_begin && theta_end<= c[j][0]) || (c[j][0]+2.0*M_PI>= theta_begin && theta_end<= c[j][0]+2.0*M_PI)){
          xsum+=c[j][1]*cos(c[j][0]);
          ysum+=c[j][1]*sin(c[j][0]);
        }
      }

      cout <<  sqrt(xsum*xsum + ysum*ysum) << endl;

    }


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'vector' was not declared in this scope
   11 |     vector< vector<double> > c (n, vector<double>(2) );
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:11:20: error: expected primary-expression before 'double'
   11 |     vector< vector<double> > c (n, vector<double>(2) );
      |                    ^~~~~~
a.cc:16:9: error: 'c' was not declared in this scope
   16 |         c[i][1] = sqrt(a[i]*a[i]+b[i]*b[i]);
      |         ^
a.cc:16:19: error: 'sqrt' was not declared in this scope
   16 |         c[i][1] = sqrt(a[i]*a[i]+b[i]*b[i]);
      |                   ^~~~
a.cc:21:26: error: 'acos' was not declared in this scope
   21 |           double theta = acos(((double)a[i])/sqrt(a[i]*a[i]+b[i]*b[i]));
      |                          ^~~~
a.cc:25:40: error: 'M_PI' was not declared in this scope
   25 |             c[i][0] = -1.0*theta + 2.0*M_PI;
      |                                        ^~~~
a.cc:34:10: error: 'c' was not declared in this scope
   34 |     sort(c.begin(), c.end());
      |          ^
a.cc:34:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   34 |     sort(c.begin(), c.end());
      |     ^~~~
      |     short
a.cc:44:40: error: 'M_PI' was not declared in this scope
   44 |       double theta_end = theta_begin + M_PI;
      |                                        ^~~~
a.cc:47:25: error: 'cos' was not declared in this scope
   47 |           xsum+=c[j][1]*cos(c[j][0]);
      |                         ^~~
a.cc:48:25: error: 'sin' was not declared in this scope
   48 |           ysum+=c[j][1]*sin(c[j][0]);
      |                         ^~~
a.cc:52:16: error: 'sqrt' was not declared in this scope
   52 |       cout <<  sqrt(xsum*xsum + ysum*ysum) << endl;
      |                ^~~~