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;

// 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);
		ans = max(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:38:13: note: in expansion of macro 'int'
   38 |         VAR(int,n,k);
      |             ^~~
a.cc:38:17: error: 'n' was not declared in this scope
   38 |         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:38:19: error: 'k' was not declared in this scope
   38 |         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:39:9: note: in expansion of macro 'VEC'
   39 |         VEC(int,a,n);
      |         ^~~
a.cc:39:17: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   39 |         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:39:17: error: 'end' was not declared in this scope; did you mean 'std::end'?
   39 |         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:41:19: error: template argument 2 is invalid
   41 |         vector<int> sm(n+1,0);
      |                   ^
a.cc:41:29: error: expression list treated as compound expression in initializer [-fpermissive]
   41 |         vector<int> sm(n+1,0);
      |                             ^
a.cc:42:19: error: template argument 2 is invalid
   42 |         vector<int> po_sm(n+1,0);
      |                   ^
a.cc:42:32: error: expression list treated as compound expression in initializer [-fpermissive]
   42 |         vector<int> po_sm(n+1,0);
      |                                ^
a.cc:43:13: error: expected ';' before 'i'
   43 |         REP(i,n){
      |             ^
a.cc:33:27: note: in definition of macro 'REP'
   33 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                           ^
a.cc:43:13: error: 'i' was not declared in this scope
   43 |         REP(i,n){
      |             ^
a.cc:33:31: note: in definition of macro 'REP'
   33 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                               ^
a.cc:48:13: error: expected ';' before 'ans'
   48 |         int ans = 0;
      |             ^~~
a.cc:49:13: error: expected ';' before 'i'
   49 |         REP(i,n){
      |             ^
a.cc:33:27: note: in definition of macro 'REP'
   33 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                           ^
a.cc:49:13: error: 'i' was not declared in this scope
   49 |         REP(i,n){
      |             ^
a.cc:33:31: note: in definition of macro 'REP'
   33 | #define REP(i, n) for(int i=0;i<(n);++i)
      |                               ^
a.cc:50:21: error: expected ';' before 'tmp'
   50 |                 int tmp = 0;
      |                     ^~~
a.cc:52:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   52 |                 tmp += max(sm[i+k] - sm[i], 0LL);
      |                 ^~~
      |                 tm
a.cc:58:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   58 |                 ans = max(ans,tmp);
      |                 ^~~
      |                 abs
a.cc:60:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   60 |         OUT(ans)BR;
      |             ^~~
a.cc:21:26: note: in definition of macro 'OUT'
   21 | #define OUT(dist) cout<<(dist);
      |                          ^~~~