Language: C++

#include <bits/stdc++.h>
using namespace std;

long long N;

long long lr(int x, int y, int xx, int yy){
    return x*yy-y*xx;
}

struct data{
    long long x, y;
}arr[50000004];
struct dat{
    long long x, y, num;

    bool operator<(const dat&r)const{
        return lr(x, y, r.x, r.y)>0 || (lr(x, y, r.x, r.y) == 0 && x*x+y*y<r.x*r.x+r.y+r.y);
    }
}startFar[50000004];
long long stk[50000004];
long long top;

int main(){
    int M; scanf("%d", &M);
    N = 1; arr[1].x = 0, arr[1].y = 0;
    while(M--){
        int a, b; scanf("%d %d", &a, &b);
        for(long long i=0;i<N;i++) arr[i + N].x = arr[i].x + a, arr[i + N].y = arr[i].y + b;
        N *= 2;
        if(N > 2){
            long long minNum = 0;
            for(long long i=1;i<N;i++){
                if(arr[i].y<arr[minNum].y||(arr[i].y==arr[minNum].y&&arr[i].x<arr[minNum].x)) minNum = i;
            }
            swap(arr[minNum], arr[0]);
            for(long long i=1;i<N;i++){
                startFar[i].num = i;
                startFar[i].x = arr[i].x-arr[0].x;
                startFar[i].y = arr[i].y-arr[0].y;
            }
            sort(startFar+1, startFar+N);
            stk[0] = 0;
            stk[1] = startFar[1].num;
            top = 2;
            for(long long i=2;i<N;i++){
                if(startFar[i].x == startFar[i - 1].x && startFar[i].y == startFar[i - 1].y){
                    continue;
                }
                while(top > 1){
                    long long gap = lr(arr[stk[top-1]].x-arr[stk[top-2]].x, arr[stk[top-1]].y-arr[stk[top-2]].y, arr[startFar[i].num].x-arr[stk[top-2]].x, arr[startFar[i].num].y-arr[stk[top-2]].y);
                    if(gap < 0 || (gap == 0 && (arr[stk[top-1]].x-arr[stk[top-2]].x)*(arr[stk[top-1]].x-arr[stk[top-2]].x)+
                                   (arr[stk[top-1]].y-arr[stk[top-2]].y)*(arr[stk[top-1]].y-arr[stk[top-2]].y)<
                                   (arr[startFar[i].num].x-arr[stk[top-2]].x)*(arr[startFar[i].num].x-arr[stk[top-2]].x)+
                                   (arr[startFar[i].num].y-arr[stk[top-2]].y)*(arr[startFar[i].num].y-arr[stk[top-2]].y))){
                                    --top;
                                   }
                                   else break;
                }
                stk[top++] = startFar[i].num;
            }
            sort(stk, stk + top);
            for(int i=0;i<top;++i){
                arr[i] = arr[stk[i]];
            }
            N = top;
        }
    }
    double ans = 0;
    for(int i=0;i<N;++i){
        ans = max(ans, sqrt(arr[i].x*arr[i].x+arr[i].y*arr[i].y));
    }
    printf("%lf", ans);
    return 0;
}


Compiler output:
/tmp/ccH4b9q3.o: in function `main':
a.cc:(.text+0x35b): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x441): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x4ac): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x4e4): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x516): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x54e): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x581): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x5db): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x60b): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x641): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccH4b9q3.o
a.cc:(.text+0x671): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status