criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(nullptr);
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
//const int mod=1e9+7;
//const int N=1e6+7;

int main(){
    fast;
    int t=1;
    //cin>>t;
    while(t--){
        ll x,y,ans=LLONG_MAX;
        cin>>x>>y;
        if(x>=0 and y>=0){
            if(x<=y) ans=y-x+1;
            else ans=y+x+1;
        }else if(x>=0 and y<0){
            if(x>=abs(y)) ans=y+x+1;
            else ans=abs(y)-x+1;
        }else if(x<0 and y>=0){
            if(abs(x)<=y) ans=y-abs(x)+1;
            else ans=abs(x)-y+1;
        }else if(x<0 and y<0){
            if(x<=y) ans=y-x;
            else ans=abs(y)-abs(x)+2;
        }
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:20: error: 'LLONG_MAX' was not declared in this scope
   37 |         ll x,y,ans=LLONG_MAX;
      |                    ^~~~~~~~~
a.cc:16:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   15 | #include <numeric>
  +++ |+#include <climits>
   16 |
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define INF 999999999
#define MOD 1000000007

int main()
{
	int x,y;
	cin >> x;
	cin >> y;
	if((x < y) && (x >= 0 || y <= 0)){
		cout << y-x;
	}else if((y < x) && (x < 0 || y > 0)){
		cout << x-y+2;
	}else if((y < x) && (x == 0 || y == 0){
		cout << x-y+1;
	}else{
		cout << abs(x+y)+1;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:47: error: expected ')' before '{' token
   18 |         }else if((y < x) && (x == 0 || y == 0){
      |                 ~                             ^
      |                                               )
a.cc:23:1: error: expected primary-expression before '}' token
   23 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main(void){
	ll x, y; cin >> x >> y;
	if(x >= 0 && y >= 0 && x <= y){
		printf("%lld\n", y - x);
	}else if(x >= 0 && y < 0 && x >= abs(y)){
		printf("%lld\n", x - abs(y) + 1);
	}else if(x >= 0 && y < 0 && x < abs(y)){
		printf("%lld\n", abs(y) - x + 1);
	}else if(x < 0 && y >= 0 && abs(x) >= y){
		printf("%lld\n", abs(x) - y + 1);
	}else if(x < 0 && y >= 0 && abs(x) < y){
		printf("%lld\n", y - abs(x) + 1);
	}else if(x < 0 && y < 0 && x <= y){
		printf("%lld\n", y - x);
	}else if(x < 0 && y < 0 && x > y){
		printf("%lld\n", x - y + 2);
	}else if(x >= 0 && y >= 0 && x > y){
		printf("%lld\n", y + x + 1);
	}else{
		int p++;
		rep(i, 1000000000000000){
			p++;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:22: error: expected initializer before '++' token
   39 |                 int p++;
      |                      ^~
a.cc:41:25: error: 'p' was not declared in this scope
   41 |                         p++;
      |                         ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#define INT long long
#define MOD 1000000007
#define oo 987654321
#define OO 999999987654321ll
using namespace std;

INT x, y, ans;
queue<int> q;
int main()
{
    cin>>x>>y;
    ans = (y-x)>=0?(y-x):OO;
    ans = min(ans, (-y-x)+1>=0?(-y-x)+1:OO);
    ans = min(ans, (y+x)+1>=0?(y+x)+1:OO);
    ans = min(ans, (-y+x)+2>=0?(-y+x)+2:OO)
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:44: error: expected ';' before 'cout'
   23 |     ans = min(ans, (-y+x)+2>=0?(-y+x)+2:OO)
      |                                            ^
      |                                            ;
   24 |     cout<<ans<<endl;
      |     ~~~~
Language: C++

#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

long long abs(long long a){
	return (a>0)?a:-a;
}

int main(){
	long long x,y,cnt=0;
	cin>>x>>y;
	if((y<0 && x>0)||(y>0 && x<0)){x*=-1;cnt++;}
	cout<<cnt+((y<x)?2:0)+abs(y-x)<<endl;
	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:34: error: call of overloaded 'abs(long long int)' is ambiguous
   14 |         cout<<cnt+((y<x)?2:0)+abs(y-x)<<endl;
      |                               ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:6:11: note: candidate: 'long long int abs(long long int)'
    6 | long long abs(long long a){
      |           ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

#include<iostream>
using namespace std;

int main(){
    int x,y;
    cin>>x>>y;
    if(x>=0^y>=0){
        cout<<fabs(x-y)+1<<endl;
    }else{
        cout<<fabs(x-y)<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'fabs' was not declared in this scope; did you mean 'labs'?
    8 |         cout<<fabs(x-y)+1<<endl;
      |               ^~~~
      |               labs
a.cc:10:15: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   10 |         cout<<fabs(x-y)<<endl;
      |               ^~~~
      |               labs
Language: C++

# include <iostream>
using namespace std;

long long N;
long long K;
long long a[100005];
long long prefixsum[100005];
long long pprefixsum[100005];
long long tempsum;
long long ans=0;
long long totalsum;

long long psum(long long left, long long right) //sum from left to right indexes//
{
    return prefixsum[right]-prefixsum[left-1];
}

long long ppsum(long long left, long long right)
{
    return pprefixsum[right]-pprefixsum[left-1];
}

long long main()
{
    cin>>N>>K;

    for (long long i=1; i<=N; i++)
    {
        cin>>a[i];
        totalsum=totalsum+a[i];
    }

    for (long long i=1; i<=N; i++)
    {
        prefixsum[i]=prefixsum[i-1]+a[i];
    }

    for (long long i=1; i<=N; i++)
    {
        pprefixsum[i]=pprefixsum[i-1];
        if (a[i]>0)
        {
            pprefixsum[i]=pprefixsum[i]+a[i];
        }
    }

    for (long long i=1; i<=N-K+1; i++)
    {
        tempsum=psum(i, i+K-1);

        if (tempsum>=0)
        {
            tempsum=tempsum+ppsum(1, i-1)+ppsum(i+K, N);
            ans=max(ans, tempsum);
        }

        else
        {
            ans=max(ans, ppsum(1, i-1)+ppsum(i+K, N));
        }
    }

    cout<<ans;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    vector<long long> csum_a(n + 1,0), csum_b(n + 1,0);
    for (int i = 1; i <= n; ++i) {
        long long tmp;
        cin >> tmp;
        csum_a[i] = csum_a[i - 1] + tmp;
        csum_b[i] = csum_b[i - 1] + max(tmp, 0LL);
    }

    auto ans = INT64_MIN;
    for (int i = 1; i + k - 1 <= n; ++i) {
        auto left = csum_b[i - 1];
        auto center = max(csum_a[i + k - 1] - csum_a[i - 1], 0LL);
        auto right = csum_b[n] - csum_b[i + k - 1];
        ans = max(ans, left + center + right);
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: no matching function for call to 'max(long int&, long long int)'
   22 |         ans = max(ans, left + center + right);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:22:18: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   22 |         ans = max(ans, left + center + right);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:22:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   22 |         ans = max(ans, left + center + right);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    vector<long long> csum_a(n + 1), csum_b(n + 1);
    for (int i = 1; i <= n; ++i) {
        long long tmp;
        cin >> tmp;
        csum_a[i] = csum_a[i - 1] + tmp;
        csum_b[i] = csum_b[i - 1] + max(tmp, 0LL);
    }

    auto ans = INT64_MIN;
    for (int i = 1; i + k - 1 <= n; ++i) {
        auto left = csum_b[i - 1];
        auto center = max(csum_a[i + k - 1] - csum_a[i - 1], 0LL);
        auto right = csum_b[n] - csum_b[i + k - 1];
        ans = max(ans, left + center + right);
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: no matching function for call to 'max(long int&, long long int)'
   22 |         ans = max(ans, left + center + right);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:22:18: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   22 |         ans = max(ans, left + center + right);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:22:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   22 |         ans = max(ans, left + center + right);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

eval"N,K,*A="+`dd`.split*?,
*r=(*q=b=c=i=0)
p A.flat_map{|a|q<<c+=a*-1[a];r<<b+=a;q[K]?[q[~K]-c+[b-r[~K],0].max]:[]}.max+c

Compiler output:
a.cc:1:15: error: stray '`' in program
    1 | eval"N,K,*A="+`dd`.split*?,
      |               ^
a.cc:1:18: error: stray '`' in program
    1 | eval"N,K,*A="+`dd`.split*?,
      |                  ^
a.cc:1:1: error: 'eval' does not name a type
    1 | eval"N,K,*A="+`dd`.split*?,
      | ^~~~
a.cc:3:73: error: expected unqualified-id before '.' token
    3 | p A.flat_map{|a|q<<c+=a*-1[a];r<<b+=a;q[K]?[q[~K]-c+[b-r[~K],0].max]:[]}.max+c
      |                                                                         ^
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
 
long long N, K, a[100000], parsum1[100001], parsum2[100001];
long long ans = -(1LL<<60);;
 
int main(){
	cin >> N >> K;
	for(int i = 0; i < N; ++i) cin >> a[i];
	
	long long sum1 = 0, sum2 = 0;
	for(long long i = 1; i <= N; ++i){
		sum1 += a[i-1]; parsum1[i] = sum1;
		if(a[i-1] >= 0) sum2 += a[i-1];
		parsum2[i] = sum2;
	}
	
	long long lsum = 0, csum = 0, rsum = 0;
	for(long long i = 0; i < N - K; ++i){
		csum = max(0, parsum1[i+K] - parsum1[i+1]);
		lsum = parsum2[i];
		rsum = parsum2[N] - parsum2[i+K];
		ans = max(ans, lsum + csum + rsum);
		cout << lsum << "+" << csum << "+" << rsum << "=" << lsum + csum + rsum << endl;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:27: error: no matching function for call to 'max(int, long long int)'
   21 |                 csum = max(0, parsum1[i+K] - parsum1[i+1]);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:21:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   21 |                 csum = max(0, parsum1[i+K] - parsum1[i+1]);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:21:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |                 csum = max(0, parsum1[i+K] - parsum1[i+1]);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

package main

import (
	"fmt"
	"math"
)

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	s := make([]int64, n+1)
	w := make([]int64, n+1)
	for i := 0; i < n; i++ {
		s[i+1] = s[i] + int64(a[i])
		w[i+1] = w[i] + int64(max(a[i], 0))
	}
	ans := int64(math.MinInt64)
	for i := 0; i <= n-k; i++ {
		x := w[n] - (w[i+k] - w[i])
		x += max64(s[i+k]-s[i], 0)
		ans = max64(ans, x)
	}
	fmt.Println(ans)
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:15:1: error: 'func' does not name a type
   15 | func max64(a, b int64) int64 {
      | ^~~~
a.cc:22:1: error: 'func' does not name a type
   22 | func main() {
      | ^~~~
Language: C++

#include <algorithm>
#include <cstdint>
#include <iostream>
#include <limits>
#include <vector>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int64_t> s(n + 1);
  vector<int64_t> w(n + 1);
  for (int i = 0; i < n; i++) {
    s[i + 1] = s[i] + (int64_t)a[i];
    w[i + 1] = w[i] + (int64_t)max(a[i], 0);
  }
  int64_t ans = numeric_limits<int64_t>::lowest();
  for (int i = 0; i <= n - k; i++) {
    int64_t sum = w[n] - (w[i + k] - w[i]);
    sum += max(s[i + k] - s[i], 0LL);
    ans = max(ans, sum);
  }
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type, long long int)'
   25 |     sum += max(s[i + k] - s[i], 0LL);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:25:15: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   25 |     sum += max(s[i + k] - s[i], 0LL);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:25:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   25 |     sum += max(s[i + k] - s[i], 0LL);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <cstdint>
#include <iostream>
#include <limits>
#include <vector>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int64_t> s(n + 1);
  vector<int64_t> w(n + 1);
  for (int i = 0; i < n; i++) {
    s[i + 1] = s[i] + (int64_t)a[i];
    w[i + 1] = w[i] + (int64_t)max(a[i], 0);
  }
  int64_t ans = numeric_limits<int64_t>::lowest();
  for (int i = 0; i <= n - k; i++) {
    int64_t sum = w[n] - (w[i + k] - w[i]);
    sum += max(s[i + k] - s[i], 0LL);
    ans = max(ans, sum);
  }
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type, long long int)'
   24 |     sum += max(s[i + k] - s[i], 0LL);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:24:15: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   24 |     sum += max(s[i + k] - s[i], 0LL);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <vector>

int main()
{
    // input
    int N, K;
    std::cin >> N >> K;
    std::vector<long long> a(N);
    for(int i=0; i<N; i++) scanf(" %lld", &a[i]);

    std::vector<long long> sum_l(N), sum_r(N);
    sum_l[0] = a[0] > 0 ? a[0] : 0;
    sum_r[N-1] = a[N-1] > 0 ? a[N-1] : 0;
    for(int i=1; i<N; i++){
        sum_l[i] = sum_l[i-1];
        sum_r[N-1-i] = sum_r[N-i];
        if(a[i] > 0) sum_l[i] += a[i];
        if(a[N-1-i] > 0) sum_r[N-1-i] += a[N-1-i];
    }
    std::vector<long long> sum_K(N, 0);
    for(int i=0; i<K; i++) sum_K[0] += a[i];
    for(int i=1; i+K-1<N; i++) sum_K[i] = sum_K[i-1] - a[i-1] + a[i+K-1];

    long long max = 0;
    for(int i=0; i+K+1<N; i++){
        long long tmp = sum_l[i] + sum_r[i+K+1];
        if(sum_K[i+1] > 0) tmp += sum_K[i+1];
        if(max < tmp) max = tmp;
    }
    if(K<N && max < sum_r[K]) max = sum_r[K];
    if(K<N && max < sum_K[0] + sum_r[K]) max = sum_K[0] + sum_r[K];
    if(K<N && max < sum_l[N-1-K]) max = sum_l[N-1-K];
    if(K<N && max < sum_l[N-1-K] + sum_K[N-K]) max = sum_l[N-1-K] + sum_K[N-K];
    if(K==N && max < sum_K[0]) max = sum_K[0]; 

    // output
    std::cout << max << std::endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:38:35: error: expected '}' at end of input
   38 |     std::cout << max << std::endl;
      |                                   ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#pragma once

#include "Macro.h"

namespace AGC008B
{
	void Run(void)
	{
		ll n, k; cin >> n >> k;
		vector<ll> a(n);
		rep(i, 0, n)
			cin >> a[i];

		ll l = 0;
		ll r = k - 1;
		vector<ll> ans_w(1);
		rep(i, 1, n)
			ans_w[0] += (0 < a[i] && k <= i) ? a[i] : 0;
		while (1)
		{	// 白く塗ったKマスをスライドさせて累積
			l++; r++;
			if (r == n)
				break;

			ans_w.push_back(ans_w.back());
			ans_w.back() += (0 < a[l - 1]) ? a[l - 1] : 0;
			ans_w.back() += (0 < a[r]) ? -a[r] : 0;
		}

		l = 0;
		r = k - 1;
		vector<ll> ans_b(1);
		rep(i, 0, n)
			ans_b[0] += (i < k) ? a[i] : (k <= i && 0 < a[i]) ? a[i] : 0;
		while (1)
		{	// 黒く塗ったKマスをスライドさせて累積
			l++; r++;
			if (r == n)
				break;

			ans_b.push_back(ans_b.back());
			ans_b.back() += (0 < a[l - 1]) ? 0 : -a[l - 1];
			ans_b.back() += (0 < a[r]) ? 0 : a[r];
		}

		cout << max(*max_element(all(ans_w)), *max_element(all(ans_b)));
	}
};

int main(void)
{
	AGC008B::Run();
	return 0;
}


Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc:3:10: fatal error: Macro.h: No such file or directory
    3 | #include "Macro.h"
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n,k;
	cin>>n>>k;

	lli flag=0;
	vector<lli> a(n);
	REP(i,0,n){
		cin>>a[i];
		if(a[i]>=0)flag++;
	}

	/*data[i], a0からaiまでのプラスのみ足し合わせた数*/
	vector<lli> data(n+1,0);
	data[0] = max(0LL,a[0]);

	REP(i,1,n)data[i] = data[i-1] + max(0LL,a[i]);

	lli sum = 0;
	lli flag=0;
	/*先頭k個を黒にしたときの尺取りを行う*/
	REP(i,0,k)sum += a[i];
	if(DEBUG)cout<<"first sum ="<<sum<<endl;

	data[n] = data[n-1];
	lli ans = -INF;
	if(flag==n)ans = data[n];
	/*黒で塗った時*/
	ans = max(ans,sum + data[n-1]-data[k]);
	if(DEBUG)cout<<"BALL ans="<<ans<<endl;
	/*白で塗った時*/
	ans = max(ans,data[n-1]-data[k-1]);
	if(DEBUG)cout<<"WALL ans="<<ans<<endl;

	if(DEBUG){
		for(lli i=0;i<n;i++){
			cout<<data[i]<<endl;
		}
	}

	if(DEBUG)cout<<"ans="<<ans<<endl;
	for(lli i=k;i<n;i++){
		if(DEBUG)cout<<"i="<<i<<endl;
		sum += a[i];
		sum -= a[i-k];
		if(DEBUG)cout<<"sum="<<sum<<endl;
		lli next = sum + data[n-1] - data[i+1];
		if(i-k-1>=0)next += data[i-k-1];
		ans = max(ans,next);
		if(DEBUG)cout<<"BALL ans="<<ans<<endl;
		ans = max(ans,data[n-1] - data[i] + data[i-k]);
		if(DEBUG)cout<<"WALL ans="<<ans<<endl;
	}

	cout<<ans<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: redeclaration of 'long long int flag'
   30 |         lli flag=0;
      |             ^~~~
a.cc:16:13: note: 'long long int flag' previously declared here
   16 |         lli flag=0;
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+18;

int main() {
    ios::sync_with_stdio(false);
    Int n, k;
    cin >> n >> k;
    vector<Int> a(n);
    vector<Int> b(n + 1, 0);
    vector<Int> c(n + 1, 0);
    Int sum = 0;
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] > 0) sum += a[i];
    }
    for (Int i = 0; i < n; i++) b[i + 1] += b[i] + a[i];
    for (Int i = 0; i < n; i++) {
        if (a[i] > 0) c[i + 1] += a[i];
        c[i + 1] += c[i];
    }
    Int res = 0;
    for (Int i = 0; i <= n - k; i++) {
        Int ma = max(0LL, b[i + k] - b[i]);
        res = max(res, ma + sum - (c[i + k] - c[i]));
    }
    dump(res);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)'
   27 |         Int ma = max(0LL, b[i + k] - b[i]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:27:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
   27 |         Int ma = max(0LL, b[i + k] - b[i]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:27:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |         Int ma = max(0LL, b[i + k] - b[i]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define z (ll)
int main(){
  ll n,k,d=0,e=0,r=0,s=0,t=0,u=0;
  cin>>n>>k;
  ll a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(i<k){
      s+=a[i];
      r+=max(z 0,a[i]);
      t=s;
      u=r;
    }else{
      s-=a[i-k];
      s+=a[i];
      r-=max(z 0,a[i-k]);
      r+=max(z 0,a[i]);
      if(t<s){
        t=s;
        d=i-k+1;
      }
      if(u>r){
        u=r;
        e=i-k+1;
    }
  }
  if(t<=0){
    u=0;
    for(int i=0;i<e;i++) u+=max(z 0,a[i]);
    for(int i=e+k;i<n;i++) u+=max(z 0,a[i]);
    cout<<u;
    return 0;
  }
  for(int i=0;i<d;i++) t+=max(z 0,a[i]);
  for(int i=d+k;i<n;i++) t+=max(z 0,a[i]);
  cout<<t;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define z (ll)
int main(){
  ll n,k,d=0,e=0,r=0,s=0,t=0,u=0;
  cin>>n>>k;
  ll a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(i<k){
      s+=a[i];
      r+=max(z 0,a[i]);
      t=s;
      u=r;
    }else{
      s-=a[i-k];
      s+=a[i];
      r-=max(z0,a[i-k]);
      r+=max(z0,a[i]);
      if(t<s){
        t=s;
        d=i-k+1;
      }
      if(u>r){
        u=r;
        e=i-k+1;
    }
  }
  if(t<=0){
    u=0;
    for(int i=0;i<e;i++) u+=max(z0,a[i]);
    for(int i=e+k;i<n;i++) u+=max(z0,a[i]);
    cout<<u;
    return 0;
  }
  for(int i=0;i<d;i++) t+=max(z0,a[i]);
  for(int i=d+k;i<n;i++) t+=max(z0,a[i]);
  cout<<t;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: 'z0' was not declared in this scope; did you mean 'y0'?
   19 |       r-=max(z0,a[i-k]);
      |              ^~
      |              y0
a.cc:32:33: error: 'z0' was not declared in this scope; did you mean 'y0'?
   32 |     for(int i=0;i<e;i++) u+=max(z0,a[i]);
      |                                 ^~
      |                                 y0
a.cc:33:35: error: 'z0' was not declared in this scope; did you mean 'y0'?
   33 |     for(int i=e+k;i<n;i++) u+=max(z0,a[i]);
      |                                   ^~
      |                                   y0
a.cc:37:31: error: 'z0' was not declared in this scope; did you mean 'y0'?
   37 |   for(int i=0;i<d;i++) t+=max(z0,a[i]);
      |                               ^~
      |                               y0
a.cc:38:33: error: 'z0' was not declared in this scope; did you mean 'y0'?
   38 |   for(int i=d+k;i<n;i++) t+=max(z0,a[i]);
      |                                 ^~
      |                                 y0
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define z (ll)
int main(){
  ll n,k,d=0,e=0,r=0,s=0,t=0,u=0;
  cin>>n>>k;
  ll a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(i<k){
      s+=a[i];
      r+=max(z0,a[i]);
      t=s;
      u=r;
    }else{
      s-=a[i-k];
      s+=a[i];
      r-=max(z0,a[i-k]);
      r+=max(z0,a[i]);
      if(t<s){
        t=s;
        d=i-k+1;
      }
      if(u>r){
        u=r;
        e=i-k+1;
    }
  }
  if(t<=0){
    u=0;
    for(int i=0;i<e;i++) u+=max(z0,a[i]);
    for(int i=e+k;i<n;i++) u+=max(z0,a[i]);
    cout<<u;
    return 0;
  }
  for(int i=0;i<d;i++) t+=max(z0,a[i]);
  for(int i=d+k;i<n;i++) t+=max(z0,a[i]);
  cout<<t;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'z0' was not declared in this scope; did you mean 'y0'?
   13 |       r+=max(z0,a[i]);
      |              ^~
      |              y0
a.cc:19:14: error: 'z0' was not declared in this scope; did you mean 'y0'?
   19 |       r-=max(z0,a[i-k]);
      |              ^~
      |              y0
a.cc:32:33: error: 'z0' was not declared in this scope; did you mean 'y0'?
   32 |     for(int i=0;i<e;i++) u+=max(z0,a[i]);
      |                                 ^~
      |                                 y0
a.cc:33:35: error: 'z0' was not declared in this scope; did you mean 'y0'?
   33 |     for(int i=e+k;i<n;i++) u+=max(z0,a[i]);
      |                                   ^~
      |                                   y0
a.cc:37:31: error: 'z0' was not declared in this scope; did you mean 'y0'?
   37 |   for(int i=0;i<d;i++) t+=max(z0,a[i]);
      |                               ^~
      |                               y0
a.cc:38:33: error: 'z0' was not declared in this scope; did you mean 'y0'?
   38 |   for(int i=d+k;i<n;i++) t+=max(z0,a[i]);
      |                                 ^~
      |                                 y0
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define fi first
#define se second

typedef long long ll;

using namespace std;
const int MAXN = 1e5 + 5 * 1e2;

ll n, k, a[MAXN];
ll pref[MAXN], dp1[MAXN], dp2[MAXN];

int main(){

cin >> n >> k;
for(int i=1;i<=n;i++){
    cin >> a[i];
    pref[i] += pref[i - 1] + a[i];
    /**/
    dp1[i] += dp1[i - 1];
    if(a[i] > 0){
        dp1[i] += a[i];
    }

}
for(int i=n;i>=1;i--){
    dp2[i] += dp2[i + 1];
    if(a[i] > 0){
        dp2[i] += a[i];
    }
}
int ans = 0;
for(int i=1;i<=n-k+1;i++){
    ans = max(ans, dp1[i - 1] + dp2[i + k] + max(0ll, pref[i + k - 1] - pref[i]));
}
cout << ans;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:14: error: no matching function for call to 'max(int&, ll)'
   38 |     ans = max(ans, dp1[i - 1] + dp2[i + k] + max(0ll, pref[i + k - 1] - pref[i]));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:38:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   38 |     ans = max(ans, dp1[i - 1] + dp2[i + k] + max(0ll, pref[i + k - 1] - pref[i]));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:38:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |     ans = max(ans, dp1[i - 1] + dp2[i + k] + max(0ll, pref[i + k - 1] - pref[i]));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)

int main(){
  ll n,k,a[100010],s[100010],m[100010],t=0;
  cin>>n>>k;
  fr(i,n) cin>>a[i];
  fr(i,n){
    s[i+1]=s[i]+a[i];
    m[i+1]=m[i]+max(a[i],0);
  }
  fr(i,n-k+1){
    t=max(t,m[i]+m[n]-m[i+k]+max(0,s[i+k]-s[i]));
  }
  cout<<t<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: no matching function for call to 'max(ll&, int)'
   12 |     m[i+1]=m[i]+max(a[i],0);
      |                 ~~~^~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:12:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   12 |     m[i+1]=m[i]+max(a[i],0);
      |                 ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
a.cc:15:33: error: no matching function for call to 'max(int, ll)'
   15 |     t=max(t,m[i]+m[n]-m[i+k]+max(0,s[i+k]-s[i]));
      |                              ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:15:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   15 |     t=max(t,m[i]+m[n]-m[i+k]+max(0,s[i+k]-s[i]));
      |                              ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef long long ll;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    vector<ll> a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        b[i] = max(a[i], 0);
    }
    vector<ll> sum1(n + 1), sum2(n + 1);
    sum1[0] = 0;
    sum2[0] = 0;
    for (int i = 0; i < n; i++)
    {
        sum2[i + 1] = sum2[i] + b[i];
        sum1[i + 1] = sum1[i] + a[i];
    }
    ll ans = 0;
    for (int i = 0; i + k <= n; i++)
    {
        ll tmp1 = max((ll)0, sum1[i + k] - sum1[i]);
        ll tmp2 = sum2[i] + sum2[n] - sum2[i + k];
        ans = max(ans, tmp1 + tmp2);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int)'
   17 |         b[i] = max(a[i], 0);
      |                ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:17:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |         b[i] = max(a[i], 0);
      |                ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:17:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |         b[i] = max(a[i], 0);
      |                ~~~^~~~~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<MAP>
#include<unordered_MAP>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define rep(i,n) FOR(i,0,n)

struct edge{int to,cost;};

void dump(ll *b,int n){
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << "\n";
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n,k;
	cin >> n >> k;

	int a[n];
	ll rui[n+1]={};
	ll seirui[n+1]={};
	rep(i,n){
		cin >> a[i];
		rui[i+1]=rui[i]+a[i];
		if(a[i]>0) seirui[i+1]=seirui[i]+a[i];
		else	seirui[i+1]=seirui[i];
	}
	ll ans=0;
	for(int i=1;i<=n-k+1;i++){
//		cout << seirui[n]-seirui[i+k-1]+seirui[i-1]+max(0LL,rui[i+k-1]-rui[i-1]) << "\n";
		ans = max(ans,seirui[n]-seirui[i+k-1]+seirui[i-1]+max(0LL,rui[i+k-1]-rui[i-1]));
	}
	cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc:8:9: fatal error: MAP: No such file or directory
    8 | #include<MAP>
      |         ^~~~~
compilation terminated.
Language: C++

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

int N, K;
long long res, sub;

int main() {
  cin >> N >> K;
  for(int i = 0; i < N; ++i) {
    int a; cin >> a;
    if(i < K && (N - i) <= K) sub += a;
    else res += min(0, a);
  }
  res += min(0, sub);
  cout << res;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: no matching function for call to 'min(int, long long int&)'
   14 |   res += min(0, sub);
      |          ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:14:13: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   14 |   res += min(0, sub);
      |          ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:14:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |   res += min(0, sub);
      |          ~~~^~~~~~~~