Language: C++

typedef pair<long double , long double> P;

int main() {
    int n;
    cin >> n;
    P upright(0, 0);
    P upleft(0, 0);
    P loleft(0, 0);
    P loright(0, 0);
    double ans = 0.0;
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        if ((x >= 0 && y >= 0) 
                || (x >= 0 && y < 0 && (abs(x) > abs(y)))
                || (x <= 0 && y > 0 && (abs(x) < abs(y)))) {
            upright.first += x;
            upright.second += y;
        } 
        if ((x <= 0 && y >= 0) 
                || (x > 0 && y >= 0 && (abs(x) < abs(y)))
                || (x <= 0 && y < 0 && (abs(x) > abs(y)))) {
            upleft.first += x;
            upleft.second += y;
        } 
        if ((x <= 0 && y <= 0) 
                || (x > 0 && y <= 0 && (abs(x) < abs(y)))
                || (x <= 0 && y > 0 && (abs(x) > abs(y)))) {
            loleft.first += x;
            loleft.second += y;
        } 
        if ((x >= 0 && y <= 0) 
                || (x >= 0 && y > 0 && (abs(x) > abs(y)))
                || (x < 0 && y <= 0 && (abs(x) < abs(y)))) {
            loright.first += x;
            loright.second += y;
        } 

        
    }
    double dur = sqrt(upright.first * upright.first + upright.second * upright.second);
    double dul = sqrt(upleft.first * upleft.first + upleft.second * upleft.second);
    double dll = sqrt(loleft.first * loleft.first + loleft.second * loleft.second);
    double dlr = sqrt(loright.first * loright.first + loright.second * loright.second);
    ans = max({dur, dul, dll, dlr}); 
    //cout << ans << endl;
    printf("%.48lf\n", ans);

    return 0;
}



Compiler output:
a.cc:1:9: error: 'pair' does not name a type
    1 | typedef pair<long double , long double> P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> n;
      |     ^~~
a.cc:6:5: error: 'P' was not declared in this scope
    6 |     P upright(0, 0);
      |     ^
a.cc:7:6: error: expected ';' before 'upleft'
    7 |     P upleft(0, 0);
      |      ^~~~~~~
      |      ;
a.cc:8:6: error: expected ';' before 'loleft'
    8 |     P loleft(0, 0);
      |      ^~~~~~~
      |      ;
a.cc:9:6: error: expected ';' before 'loright'
    9 |     P loright(0, 0);
      |      ^~~~~~~~
      |      ;
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     rep(i, n) {
      |         ^
a.cc:11:5: error: 'rep' was not declared in this scope
   11 |     rep(i, n) {
      |     ^~~
a.cc:41:23: error: 'upright' was not declared in this scope
   41 |     double dur = sqrt(upright.first * upright.first + upright.second * upright.second);
      |                       ^~~~~~~
a.cc:41:18: error: 'sqrt' was not declared in this scope
   41 |     double dur = sqrt(upright.first * upright.first + upright.second * upright.second);
      |                  ^~~~
a.cc:42:23: error: 'upleft' was not declared in this scope
   42 |     double dul = sqrt(upleft.first * upleft.first + upleft.second * upleft.second);
      |                       ^~~~~~
a.cc:43:23: error: 'loleft' was not declared in this scope
   43 |     double dll = sqrt(loleft.first * loleft.first + loleft.second * loleft.second);
      |                       ^~~~~~
a.cc:44:23: error: 'loright' was not declared in this scope
   44 |     double dlr = sqrt(loright.first * loright.first + loright.second * loright.second);
      |                       ^~~~~~~
a.cc:45:11: error: 'max' was not declared in this scope
   45 |     ans = max({dur, dul, dll, dlr});
      |           ^~~
a.cc:47:5: error: 'printf' was not declared in this scope
   47 |     printf("%.48lf\n", ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | typedef pair<long double , long double> P;