Language: C++

#include <iostream>                                                                                                  #include <cstdlib>                                                                                                   #include <algorithm>                                                                                                 using namespace std;                                                                                                                                                                                                                      int main()                                                                                                           {                                                                                                                            int n, a[200005];                                                                                                    long long min_ = int(1e18), sum[200005];                                                                                                                                                                                                  cin >> n;                                                                                                            for (int i = 0; i < n; ++i) {                                                                                                cin >> a[i];                                                                                                         if (i > 0) sum[i] += sum[i - 1] + a[i];                                                                              else sum[i] = a[i];                                                                                          }                                                                                                                                                                                                                                         for (int i = 0; i < n-1; ++i ) {                                                                                             min_ = min(min_, abs(sum[i] - (sum[n-1] - sum[i])));                                                         }                                                                                                                                                                                                                                         cout << min_ << endl;                                                                                                                                                                                                                 return 0;                                                                                                        }                                                                                                                           

Compiler output:
a.cc:1:118: warning: extra tokens at end of #include directive
    1 | #include <iostream>                                                                                                  #include <cstdlib>                                                                                                   #include <algorithm>                                                                                                 using namespace std;                                                                                                                                                                                                                      int main()                                                                                                           {                                                                                                                            int n, a[200005];                                                                                                    long long min_ = int(1e18), sum[200005];                                                                                                                                                                                                  cin >> n;                                                                                                            for (int i = 0; i < n; ++i) {                                                                                                cin >> a[i];                                                                                                         if (i > 0) sum[i] += sum[i - 1] + a[i];                                                                              else sum[i] = a[i];                                                                                          }                                                                                                                                                                                                                                         for (int i = 0; i < n-1; ++i ) {                                                                                             min_ = min(min_, abs(sum[i] - (sum[n-1] - sum[i])));                                                         }                                                                                                                                                                                                                                         cout << min_ << endl;                                                                                                                                                                                                                 return 0;                                                                                                        }
      |                                                                                                                      ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status