Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
// 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] + std::max(0LL, a[i]);
	}

	int ans = 0;
	REP(i,n){
		int tmp = 0;
		if (i+k>n) break;
		tmp += std::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);
	  ans = std::max(ans,tmp);
	}
	OUT(ans)BR;

	
  
  return 0;
}


Compiler output:
a.cc:6:15: error: 'int_fast64_t' does not name a type
    6 | using int64 = int_fast64_t;
      |               ^~~~~~~~~~~~
a.cc:7:19: error: 'int64' was not declared in this scope; did you mean 'int64_t'?
    7 | using PAIR = pair<int64, int64>;
      |                   ^~~~~
      |                   int64_t
a.cc:7:26: error: 'int64' was not declared in this scope; did you mean 'int64_t'?
    7 | using PAIR = pair<int64, int64>;
      |                          ^~~~~
      |                          int64_t
a.cc:7:31: error: template argument 1 is invalid
    7 | using PAIR = pair<int64, int64>;
      |                               ^
a.cc:7:31: error: template argument 2 is invalid
a.cc:9:11: error: 'int64' does not name a type; did you mean 'int64_t'?
    9 | constexpr int64 LINF = 1LL << 60;
      |           ^~~~~
      |           int64_t
a.cc: In function 'int main()':
a.cc:14:13: error: 'int64' was not declared in this scope; did you mean 'int64_t'?
   14 | #define int int64
      |             ^~~~~
a.cc:16:24: note: in definition of macro 'VAR'
   16 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
      |                        ^~~~
a.cc:41:13: note: in expansion of macro 'int'
   41 |         VAR(int,n,k);
      |             ^~~
a.cc:41:17: error: 'n' was not declared in this scope
   41 |         VAR(int,n,k);
      |                 ^
a.cc:16:56: note: in definition of macro 'VAR'
   16 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
      |                                                        ^~~~~~~~~~~
a.cc:41:19: error: 'k' was not declared in this scope
   41 |         VAR(int,n,k);
      |                   ^
a.cc:16:56: note: in definition of macro 'VAR'
   16 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
      |                                                        ^~~~~~~~~~~
a.cc:19:36: error: template argument 2 is invalid
   19 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;
      |                                    ^
a.cc:42:9: note: in expansion of macro 'VEC'
   42 |         VEC(int,a,n);
      |         ^~~
a.cc:42:17: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   42 |         VEC(int,a,n);
      |                 ^
a.cc:19:56: note: in definition of macro 'VEC'
   19 | #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:42:17: error: 'end' was not declared in this scope; did you mean 'std::end'?
   42 |         VEC(int,a,n);
      |                 ^
a.cc:19:56: note: in definition of macro 'VEC'
   19 | #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:44:19: error: template argument 2 is invalid
   44 |         vector<int> sm(n+1,0);
      |                   ^
a.cc:44:29: error: expression list treated as compound expression in initializer [-fpermissive]
   44 |         vector<int> sm(n+1,0);
      |                             ^
a.cc:45:19: error: template argument 2 is invalid
   45 |         vector<int> po_sm(n+1,0);
      |                   ^
a.cc:45:32: error: expression list treated as compound expression in initializer [-fpermissive]
   45 |         vector<int> po_sm(n+1,0);
      |                                ^
a.cc:46:13: error: expected ';' before 'i'
   46 |         REP(i,n){
      |             ^
a.cc:36:27: note: in definition of macro 'REP'
   36 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                           ^
a.cc:46:13: error: 'i' was not declared in this scope
   46 |         REP(i,n){
      |             ^
a.cc:36:31: note: in definition of macro 'REP'
   36 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                               ^
a.cc:51:13: error: expected ';' before 'ans'
   51 |         int ans = 0;
      |             ^~~
a.cc:52:13: error: expected ';' before 'i'
   52 |         REP(i,n){
      |             ^
a.cc:36:27: note: in definition of macro 'REP'
   36 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                           ^
a.cc:52:13: error: 'i' was not declared in this scope
   52 |         REP(i,n){
      |             ^
a.cc:36:31: note: in definition of macro 'REP'
   36 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                               ^
a.cc:53:21: error: expected ';' before 'tmp'
   53 |                 int tmp = 0;
      |                     ^~~
a.cc:55:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   55 |                 tmp += std::max((sm[i+k] - sm[i]), 0LL);
      |                 ^~~
      |                 tm
a.cc:61:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   61 |           ans = std::max(ans,tmp);
      |           ^~~
      |           abs
a.cc:63:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |         OUT(ans)BR;
      |             ^~~
a.cc:24:26: note: in definition of macro 'OUT'
   24 | #define OUT(dist) cout<<(dist);
      |                          ^~~~