Language: C++

#include <iostream>
#include <vector>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int,n,k);
	VEC(int,a,n);

	vector<int> sm(n+1,0);
	vector<int> po_sm(n+1,0);
	REP(i,n){
		sm[i+1] = sm[i] + a[i];
		po_sm[i+1] = po_sm[i] + max(0LL, a[i]);
	}

	int ans = 0;
	REP(i,n){
		int tmp = 0;
		if (i+k>n) break;
		tmp += max(sm[i+k] - sm[i], 0LL);
		debug(tmp);
		tmp += po_sm[i];
		tmp += po_sm[n] - po_sm[i+k];
		debug(i);
		debug(tmp);
		chmax(ans,tmp);
	}
	OUT(ans)BR;

	
  
  return 0;
}


Compiler output:
a.cc:5:15: error: 'int_fast64_t' does not name a type
    5 | using int64 = int_fast64_t;
      |               ^~~~~~~~~~~~
a.cc:6:19: error: 'int64' was not declared in this scope; did you mean 'int64_t'?
    6 | using PAIR = pair<int64, int64>;
      |                   ^~~~~
      |                   int64_t
a.cc:6:26: error: 'int64' was not declared in this scope; did you mean 'int64_t'?
    6 | using PAIR = pair<int64, int64>;
      |                          ^~~~~
      |                          int64_t
a.cc:6:31: error: template argument 1 is invalid
    6 | using PAIR = pair<int64, int64>;
      |                               ^
a.cc:6:31: error: template argument 2 is invalid
a.cc:8:11: error: 'int64' does not name a type; did you mean 'int64_t'?
    8 | constexpr int64 LINF = 1LL << 60;
      |           ^~~~~
      |           int64_t
a.cc: In function 'int main()':
a.cc:13:13: error: 'int64' was not declared in this scope; did you mean 'int64_t'?
   13 | #define int int64
      |             ^~~~~
a.cc:15:24: note: in definition of macro 'VAR'
   15 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
      |                        ^~~~
a.cc:40:13: note: in expansion of macro 'int'
   40 |         VAR(int,n,k);
      |             ^~~
a.cc:40:17: error: 'n' was not declared in this scope
   40 |         VAR(int,n,k);
      |                 ^
a.cc:15:56: note: in definition of macro 'VAR'
   15 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
      |                                                        ^~~~~~~~~~~
a.cc:40:19: error: 'k' was not declared in this scope
   40 |         VAR(int,n,k);
      |                   ^
a.cc:15:56: note: in definition of macro 'VAR'
   15 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
      |                                                        ^~~~~~~~~~~
a.cc:18:36: error: template argument 2 is invalid
   18 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;
      |                                    ^
a.cc:41:9: note: in expansion of macro 'VEC'
   41 |         VEC(int,a,n);
      |         ^~~
a.cc:41:17: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   41 |         VEC(int,a,n);
      |                 ^
a.cc:18:56: note: in definition of macro 'VEC'
   18 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;
      |                                                        ^
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:41:17: error: 'end' was not declared in this scope; did you mean 'std::end'?
   41 |         VEC(int,a,n);
      |                 ^
a.cc:18:56: note: in definition of macro 'VEC'
   18 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;
      |                                                        ^
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc:43:19: error: template argument 2 is invalid
   43 |         vector<int> sm(n+1,0);
      |                   ^
a.cc:43:29: error: expression list treated as compound expression in initializer [-fpermissive]
   43 |         vector<int> sm(n+1,0);
      |                             ^
a.cc:44:19: error: template argument 2 is invalid
   44 |         vector<int> po_sm(n+1,0);
      |                   ^
a.cc:44:32: error: expression list treated as compound expression in initializer [-fpermissive]
   44 |         vector<int> po_sm(n+1,0);
      |                                ^
a.cc:45:13: error: expected ';' before 'i'
   45 |         REP(i,n){
      |             ^
a.cc:35:27: note: in definition of macro 'REP'
   35 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                           ^
a.cc:45:13: error: 'i' was not declared in this scope
   45 |         REP(i,n){
      |             ^
a.cc:35:31: note: in definition of macro 'REP'
   35 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                               ^
a.cc:50:13: error: expected ';' before 'ans'
   50 |         int ans = 0;
      |             ^~~
a.cc:51:13: error: expected ';' before 'i'
   51 |         REP(i,n){
      |             ^
a.cc:35:27: note: in definition of macro 'REP'
   35 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                           ^
a.cc:51:13: error: 'i' was not declared in this scope
   51 |         REP(i,n){
      |             ^
a.cc:35:31: note: in definition of macro 'REP'
   35 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                               ^
a.cc:52:21: error: expected ';' before 'tmp'
   52 |                 int tmp = 0;
      |                     ^~~
a.cc:54:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   54 |                 tmp += max(sm[i+k] - sm[i], 0LL);
      |                 ^~~
      |                 tm
a.cc:60:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   60 |                 chmax(ans,tmp);
      |                       ^~~
      |                       abs
a.cc:62:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   62 |         OUT(ans)BR;
      |             ^~~
a.cc:23:26: note: in definition of macro 'OUT'
   23 | #define OUT(dist) cout<<(dist);
      |                          ^~~~