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

#include <iostream>
#include <cstdio>
#include <algorithm>

#define ini 0
using namespace std;

int rlay[100001];

int main (){

while (1){

memset(rlay ,0 ,sizeof(rlay));
int n,k,input,ansmax=0;
cin>>n>>k;
if (n==0 && k==0)break;

rlay[0]=ini;
for (int i=1;i<=n;i++){
        cin>>input;
        rlay[i]=input+rlay[i-1];
}

for (int i=n;i-k>0;i--){
        ansmax = max ( rlay[i]-rlay[i-k] ,ansmax );
}

cout<<ansmax<<endl;
}

return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:1: error: 'memset' was not declared in this scope
   14 | memset(rlay ,0 ,sizeof(rlay));
      | ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  long long n,k;

  while(1) {
    ans=-1000000000;
    cin>>n>>k;
    if(n == 0 and k == 0) break;
    long long a[n];for(int i=0;i<n;i++)cin>>a[i];

    for(int i=0;i<n-k+1;i++){
      long long temp=0;
      for(int j=i;j<i+k;j++){
        temp+=a[j];
      }
      ans=max(temp,ans);
    }
    cout<<ans<<endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     ans=-1000000000;
      |     ^~~
      |     abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, k;
    cin >> N >> k;
    vector<int> a(N);
    for(int i = 0; i < N; i++){
        cin >> a.at(i);
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
    	if(i < 3) total += a[i];
	    else total = total + a[i] - a[i-3];
	    if(ans < total) ans = total;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'total' was not declared in this scope
   12 |         if(i < 3) total += a[i];
      |                   ^~~~~
a.cc:13:18: error: 'total' was not declared in this scope
   13 |             else total = total + a[i] - a[i-3];
      |                  ^~~~~
a.cc:14:22: error: 'total' was not declared in this scope
   14 |             if(ans < total) ans = total;
      |                      ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, k;
    cin >> N >> k;
    vector<int> a(N);
    for(int i = 0; i < N; i++){
        cin >> a.at(i);
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
    	if(i < 3){
    	    total += a[i];
    	}else{
    	    total = total + a[i] - a[i-3];
    	}
	    if(ans < total){
	        ans = total;
	    }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'total' was not declared in this scope
   13 |             total += a[i];
      |             ^~~~~
a.cc:15:13: error: 'total' was not declared in this scope
   15 |             total = total + a[i] - a[i-3];
      |             ^~~~~
a.cc:17:22: error: 'total' was not declared in this scope
   17 |             if(ans < total){
      |                      ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    vector<int> ans(0);x
    while(1){
        cin>>n>>k;
        if(n==0&&k==0){
            break;
        }
        vector<int> vec(n);
        for(int i=0;i<n;i++){
            cin>>vec.at(i);
        }
        vector<int> rsw(n+1);
        rsw.at(0)=0;
        for(int i=1;i<n+1;i++){
            rsw.at(i) = rsw.at(i-1) + vec.at(i-1);
        }
        ans.push_back(0);
        for(int i=k;i<n+1;i++){
            if(ans.at(ans.size()) < rsw.at(i) - rsw.at(i-k)){
                ans.at(ans.size()) = rsw.at(i) - rsw.at(i-k);
            }
        }
        cout << ans.at(ans.size()) << endl;
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: 'x' was not declared in this scope
    5 |     vector<int> ans(0);x
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int count = 0;  count < 5; count++){
	    int none(2);
	    int N, k;
	    cin >> N >> k;
	    vector<int> a(N);
	    for(int i = 0; i < N; i++){
		cin >> a.at(i);
	    }
	    int ans = 0;
	    int total = 0;
	    for(int i = 0; i < N; i++){
	    	if(i < k) total += a[i];
		else total = total + a[i] - a[i-k];
		if(ans < total) ans = total;
	    }
	    cout << ans << endl;
	    cin >> none.at(0) >> none.at(1);
　　}
}


Compiler output:
a.cc:21:1: error: extended character 　 is not valid in an identifier
   21 | 　　}
      | ^
a.cc:21:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:20:25: error: request for member 'at' in 'none', which is of non-class type 'int'
   20 |             cin >> none.at(0) >> none.at(1);
      |                         ^~
a.cc:20:39: error: request for member 'at' in 'none', which is of non-class type 'int'
   20 |             cin >> none.at(0) >> none.at(1);
      |                                       ^~
a.cc:21:1: error: '\U00003000\U00003000' was not declared in this scope
   21 | 　　}
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int count = 0;  count < 5; count++){
	    int none(2);
	    int N, k;
	    cin >> N >> k;
	    vector<int> a(N);
	    for(int i = 0; i < N; i++){
		cin >> a.at(i);
	    }
	    int ans = 0;
	    int total = 0;
	    for(int i = 0; i < N; i++){
	    	if(i < k) total += a[i];
		else total = total + a[i] - a[i-k];
		if(ans < total) ans = total;
	    }
	    cout << ans << endl;
	    cin >> none[0] >> none[1];
　　}
}


Compiler output:
a.cc:21:1: error: extended character 　 is not valid in an identifier
   21 | 　　}
      | ^
a.cc:21:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:20:24: error: invalid types 'int[int]' for array subscript
   20 |             cin >> none[0] >> none[1];
      |                        ^
a.cc:20:35: error: invalid types 'int[int]' for array subscript
   20 |             cin >> none[0] >> none[1];
      |                                   ^
a.cc:21:1: error: '\U00003000\U00003000' was not declared in this scope
   21 | 　　}
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int count = 0;  count < 5; count++){
	    int none(2);
	    int N, k;
	    cin >> N >> k;
	    vector<int> a(N);
	    for(int i = 0; i < N; i++){
		cin >> a.at(i);
	    }
	    int ans = 0;
	    int total = 0;
	    for(int i = 0; i < N; i++){
	    	if(i < k) total += a[i];
		else total = total + a[i] - a[i-k];
		if(ans < total) ans = total;
	    }
	    cout << ans << endl;
	    for(int i = 0; i < 2; i++){
    	    cin >> none.at(i);
	    }
　　}
}


Compiler output:
a.cc:23:1: error: extended character 　 is not valid in an identifier
   23 | 　　}
      | ^
a.cc:23:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:21:25: error: request for member 'at' in 'none', which is of non-class type 'int'
   21 |             cin >> none.at(i);
      |                         ^~
a.cc:23:1: error: '\U00003000\U00003000' was not declared in this scope
   23 | 　　}
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(N);
        cin >> a;
        S[0]=0;
        for(int i=1;i==n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        int x=S[k]
        for(int l=1;l==n-k;l++){
            if(x<S[k+l]-S[l]){
                x==S[k+l]-S[l];
            }
        }
            cout << x;
            cin >> n >> k;
        }

    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(N);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(N);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
a.cc:15:21: error: 'l' was not declared in this scope
   15 |         for(int l=1;l==n-k;l++){
      |                     ^
a.cc: At global scope:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int count = 0;  count < 5; count++){
	    vecotor<int> none(2);
	    int N, k;
	    cin >> N >> k;
	    vector<int> a(N);
	    for(int i = 0; i < N; i++){
		cin >> a.at(i);
	    }
	    int ans = 0;
	    int total = 0;
	    for(int i = 0; i < N; i++){
	    	if(i < k) total += a[i];
		else total = total + a[i] - a[i-k];
		if(ans < total) ans = total;
	    }
	    cout << ans << endl;
	    for(int i = 0; i < 2; i++){
    	    cin >> none.at(i);
	    }
　　}
}


Compiler output:
a.cc:23:1: error: extended character 　 is not valid in an identifier
   23 | 　　}
      | ^
a.cc:23:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:5:13: error: 'vecotor' was not declared in this scope
    5 |             vecotor<int> none(2);
      |             ^~~~~~~
a.cc:5:21: error: expected primary-expression before 'int'
    5 |             vecotor<int> none(2);
      |                     ^~~
a.cc:21:20: error: 'none' was not declared in this scope
   21 |             cin >> none.at(i);
      |                    ^~~~
a.cc:21:20: note: suggested alternatives:
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:276:7: note:   'std::filesystem::directory_options::none'
  276 |       none = 0, follow_directory_symlink = 1, skip_permission_denied = 2
      |       ^~~~
/usr/include/c++/14/bits/fs_fwd.h:145:7: note:   'std::filesystem::perms::none'
  145 |       none              =  0,
      |       ^~~~
/usr/include/c++/14/bits/fs_fwd.h:85:7: note:   'std::filesystem::copy_options::none'
   85 |       none = 0,
      |       ^~~~
/usr/include/c++/14/bits/fs_fwd.h:79:7: note:   'std::filesystem::file_type::none'
   79 |       none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3,
      |       ^~~~
a.cc:23:1: error: '\U00003000\U00003000' was not declared in this scope
   23 | 　　}
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int count = 0;  count < 5; count++){
	    vector<int> none(2);
	    int N, k;
	    cin >> N >> k;
	    vector<int> a(N);
	    for(int i = 0; i < N; i++){
		cin >> a.at(i);
	    }
	    int ans = 0;
	    int total = 0;
	    for(int i = 0; i < N; i++){
	    	if(i < k) total += a[i];
		else total = total + a[i] - a[i-k];
		if(ans < total) ans = total;
	    }
	    cout << ans << endl;
	    for(int i = 0; i < 2; i++){
    	    cin >> none.at(i);
	    }
　　}
}


Compiler output:
a.cc:23:1: error: extended character 　 is not valid in an identifier
   23 | 　　}
      | ^
a.cc:23:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:23:1: error: '\U00003000\U00003000' was not declared in this scope
   23 | 　　}
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(N);
        cin >> a;
        S[0]=0;
        for(int i=1;i==n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        int x=S[k];
        for(int l=1;l==n-k;l++){
            if(x<S[k+l]-S[l]){
                x==S[k+l]-S[l];
            }
        }
            cout << x << endl;;
            cin >> n >> k;
        }

    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(N);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(N);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
a.cc: At global scope:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(n);
        cin >> a;
        S[0]=0;
        for(int i=1;i==n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        int x=S[k];
        for(int l=1;l==n-k;l++){
            if(x<S[k+l]-S[l]){
                x==S[k+l]-S[l];
            }
        }
            cout << x << endl;;
            cin >> n >> k;
        }

    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(n);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(n);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
a.cc: At global scope:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(n);
        cin >> a;
        S[0]=0;
        for(int i=1;i==n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        int x=S[k];
        for(int l=1;l==n-k;l++){
            if(x<S[k+l]-S[l]){
                x==S[k+l]-S[l];
            }
        }
            cout << x << endl;
            cin >> n >> k;
        }

    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(n);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(n);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
a.cc: At global scope:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int count = 0;  count < 5; count++){
        vector<int> none(2);
        int N, k;
        cin >> N >> k;
        vector<int> a(N);
        for(int i = 0; i < N; i++){
		cin >> a.at(i);
            
        }
        int ans = 0;
        int total = 0;
        for(int i = 0; i < N; i++){
            if(i < k) total += a[i];
		else total = total + a[i] - a[i-k];
		if(ans < total) ans = total;
            
        }
        cout << ans << endl;
        for(int i = 0; i < 2; i++){
            cin >> none.at(i);
            
        }
　　}
}


Compiler output:
a.cc:26:1: error: extended character 　 is not valid in an identifier
   26 | 　　}
      | ^
a.cc:26:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:26:1: error: '\U00003000\U00003000' was not declared in this scope
   26 | 　　}
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(n);
        cin >> a;
        S[0]=0;
        for(int i=1;i==n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        int x=S[k];
        for(int l=1;l==n-k;l++){
            if(x<S[k+l]-S[l]){
                x==S[k+l]-S[l];
            }
             cout << x << endl;
            cin >> n >> k;
        }

    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(n);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(n);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(n);
        cin >> a;
        S[0]=0;
        for(int i=1;i<n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        int x=S[k];
        for(int l=1;l<n-k;l++){
            if(x<S[k+l]-S[l]){
                x=S[k+l]-S[l];
            }
             cout << x << endl;
            cin >> n >> k;
        }

    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(n);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(n);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(n);
        cin >> a;
        S[0]=0;
        for(int i=1;i<n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        int x=S[k];
        for(int l=1;l<n-k;l++){
            if(x<S[k+l]-S[l]){
                x=S[k+l]-S[l];
            }
        }
        cout << x << endl;
        cin >> n >> k;
        

    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(n);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(n);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,k,x;
    cin >> n >> k;
    while(n!=0||k!=0){
       vector<int> a(n);
        cin >> a;
        S[0]=0;
        for(int i=1;i<n;i++){
            S[i]=S[i-1]+a.at(i-1);
        }
        x=S[k];
        for(int l=1;l<n-k;l++){
            if(x<S[k+l]-S[l]){
                x=S[k+l]-S[l];
            }
        }
        cout << x << endl;
        cin >> n >> k;
        

    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' was not declared in this scope
    8 |        vector<int> a(n);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |        vector<int> a(n);
      |               ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a;
      |                ^
a.cc:10:9: error: 'S' was not declared in this scope
   10 |         S[0]=0;
      |         ^
Language: C++

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

int main() {
    int n,k,i,ans=0;
    cin >> n >> k;
    while(n!=0 || k!=0){
        int a,sum[1000000],S;
        sum[0]=0;
    
        for(i=0;i<n;++i){
            cin >> a;
            sum[i+1] = sum[i] + a;
        }
    
        for(i=0;i<n-k;++i){
            S=sum[i+k]-sum[i];
            ans = max(ans,S[i]);
        }
    
        cout << ans << endl;
        cin >> n >> k;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:28: error: invalid types 'int[int]' for array subscript
   18 |             ans = max(ans,S[i]);
      |                            ^
Language: C++

// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;

int main() {
    int n,k;
    cin >> n >> k;
    int max = 0;
    vector<int> a(100005, 0);
    vector<int> s(100005,0);
    while (n != 0 || k != 0) {
        int b;
        s[0] = 0
        for(int i = 0; i < n; i++) {
            cin >> b;
            s[i+1] = s[i] + b;
        }
        for (int j = 0; j < n-k; j++) {
            if(max < s[i+k] - s[i]) {
                max = s[i+k] - s[i];
            }
        }
        cout << max << endl;
        cin >> n >> k;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: expected ';' before 'for'
   15 |         s[0] = 0
      |                 ^
      |                 ;
   16 |         for(int i = 0; i < n; i++) {
      |         ~~~      
a.cc:16:24: error: 'i' was not declared in this scope
   16 |         for(int i = 0; i < n; i++) {
      |                        ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vec> vec2;
typedef map<ll,ll> MPll;
typedef set<ll> setl;

const ll INF = 1ll << 60;
const ld EPS = 1e-10;



signed main(){
    ll n,k;
    bool flag = true;
    while(flag) {
        cin >> n;
        cin >> k;
        if(n == 0 and k == 0){
            return 0;
        }
        vec A(n + 1, 0);
        ll a;
        for (ll i = 1; i < n + 1; i++) {
            cin >> a;
            A[i] = A[i - 1] + a;
        };

        ll max = -9223372036854775808;
        ll temp;
        for (int j = k+1; j < n + 1; ++j) {
            temp = A[j] - A[j - k];
            amax(max, temp);
        }

        cout << max<<endl;
    }

}



Compiler output:
a.cc:55:19: warning: integer constant is so large that it is unsigned
   55 |         ll max = -9223372036854775808;
      |                   ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:59:13: error: 'amax' was not declared in this scope; did you mean 'max'?
   59 |             amax(max, temp);
      |             ^~~~
      |             max
Language: C++

#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	while(1){
	int k,n,s=0,cn=0;
	cin>>k>>n;
	if(k==0 && n==0){
		break;
	}
	int dat[1000];
	for(int i=0;i<k;i++){
		cin>>S>>dat[i];
	}
	for(int j=0;j<k-n+1;j++){
		cn=0;
		for(int k=0;k<n;k++){
			cn+=dat[j+k];
		}
		s=max(s,cn);
	}
	cout<<s<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:22: error: 'S' was not declared in this scope
   28 |                 cin>>S>>dat[i];
      |                      ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int main () {
    int n, k, a[100000], i, S[100000],m;
    cin >> n >> k;
    for(I=0;i<n;i++) {
        cin >> a[i];
    }
    for(i=0;i<n-k+1) {
        S[i]=S[i-1] - a[i-1] + a[i+k];
        m = max(m,s[i]);
    }
    cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'I' was not declared in this scope
    8 |     for(I=0;i<n;i++) {
      |         ^
a.cc:11:20: error: expected ';' before ')' token
   11 |     for(i=0;i<n-k+1) {
      |                    ^
      |                    ;
a.cc:13:19: error: 's' was not declared in this scope
   13 |         m = max(m,s[i]);
      |                   ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int main () {
    int n, k, a[100000], i, S[100000],m;
    cin >> n >> k;
    for(i=0;i<n;i++) {
        cin >> a[i];
    }
    for(i=0;i<n-k+1) {
        S[i]=S[i-1] - a[i-1] + a[i+k];
        m = max(m,S[i]);
    }
    cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: expected ';' before ')' token
   11 |     for(i=0;i<n-k+1) {
      |                    ^
      |                    ;
Language: C++

#include<cstdio>

int main()
{
    int n,m,a[100008];
    while(~scanf("%d%d",&n,&m))
    {
        if(!n&&!m) break;
        for(int i=0;i<n;i++) scanf("%d",&a[i]);
        for(int i=0;i<m;i++) temp += a[i];
        int sum = 0,cap = 0;
        for(int i=0;i<n;i++){
            if(cap!=m){ sum += a[i]; cap++; }
            else sum += a[i]-a[i-3];
            if(sum>temp) temp=sum;
        }
        printf("%d\n",temp);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: 'temp' was not declared in this scope
   10 |         for(int i=0;i<m;i++) temp += a[i];
      |                              ^~~~
a.cc:15:20: error: 'temp' was not declared in this scope
   15 |             if(sum>temp) temp=sum;
      |                    ^~~~
a.cc:17:23: error: 'temp' was not declared in this scope
   17 |         printf("%d\n",temp);
      |                       ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
	int n, k;
	int a[100000];
	int sum = 0;
	int Max = 0;
	
	while(true){
		cin >> n >> k;
		if(n + k == 0){
			for(int i = 0; i < n; i++){
			cin >> a[i];
		}
	
		for(int i = 0; i < n-k+1; i++){
			sum = 0;
			for(int j = i; j < i+k; j++){
				sum += a[j];
			}
			Max = max(Max, sum);
		}
	
		cout << Max << endl;
	}
	return 0;
}

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

int main(){
  int n,k;
  int sum1=0 , max = 0;
  int now = 0, nextdata, next;
  int* s;
  while(1){
    sum1 = 0;
    max = 0;
    cin >>n >>k;

    if(n == 0) break;

    s = (int*)malloc(sizeof(int) * n);

    int data;
    for(int i = 0; i<k; i++){
      cin >>data;
      s[i] = data;
      sum1 += data;
    }
    max = sum1;
    now = n-1;

    for(int i = 0; i<n-k; i++){
      cin >>data;
      if(now+1 == n) {
	next = 0;
	nextdata = s[0];
      } else{
	next = now + 1;
	nextdata = s[next];
      }

      sum1 = sum1- nextdata + data;
      if( sum1 > max) max = sum1;
      now = next;
    }

    cout << max << endl;
    }
  return 0;
}
    
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >>n >>k;
      |     ^~~
a.cc:13:15: error: 'malloc' was not declared in this scope
   13 |     s = (int*)malloc(sizeof(int) * n);
      |               ^~~~~~
a.cc:1:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | int main(){
a.cc:39:5: error: 'cout' was not declared in this scope
   39 |     cout << max << endl;
      |     ^~~~
a.cc:39:20: error: 'endl' was not declared in this scope
   39 |     cout << max << endl;
      |                    ^~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
		int n, k;
		double a[100001] = {}, b[100001] = {}, ans;
		cin >> n >> k;
		if (n == 0 || k == 0)	break;
		for (int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for (int i = 1; i <= n; i++){
			for (int x = 0; x<k; x++){
				if (a[i + k] == 0) break;
				b[i] = a[i + x];
			}
			if (b[i]>b[i - 1]){
				ans = b[i];
			}
		}
		cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:41: error: break statement not within loop or switch
    7 |                 if (n == 0 || k == 0)   break;
      |                                         ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	int a[100000];int n,m;int b[100000];int p=0;
	cin >> n >> m;
	for(int i = 0;i<n;i++){
		cin >> a[i];
	}
	for(int i = 0;i<100000;i++){
		b[i]=0;
	}
	for(int i = 0;i<n-m;i++){
		if(a[i]>a[i+m]){
			for(int k = i;k<i+m;k++){
				b[p]+=a[k];
			}
			p++;
		}
	}
	for(int k = n-m;k<n;k++){
				b[p]+=a[k];
	}
	for(int i = 1;i<100000;i++){
		if(b[0]<b[i]){b[0]=b[i];}
	}
	cout << b[0]<<endl;
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: expected '}' at end of input
   28 |         return 0;
      |                  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <stdio.h>

int a[100000],e[100000];
int main(){
	int b,c,d,f,g=-100000000;
	while(1){
		scanf("%d %d",&c,&b);
		if(c==0){
			return 0;
		}
		for(d=0;d<c;d++){
			scanf("%d",a[i]);
		}
		for(d=0;d<c-b;d++){
			for(f=0;f<b;f++){
				e[d]+=a[f];
			}
		}
		for(d=0;d<c-b;d++){
			if(g<=e[d]){
				g=e[d];
			}
		}
		printf("%d\n",g);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:38: error: 'i' was not declared in this scope
   12 |                         scanf("%d",a[i]);
      |                                      ^
Language: C++

#include<cstdio>

int N,K;
int a[100000];


int main()
{
    scanf("%d%d",&N,&K);
    for(int i=0;i<N;i++)scanf("%d",&a[i]);
    
    int sum=0;
    for(int i=0;i<K;i++)sum+=a[i];
    
    int ma=sum;
    for(int i=K;i<N;i++){
        sum-=a[i-K];
        sum+=a[i];
        ma=max(ma,sum);
    }
    printf("%d\n",ma);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'max' was not declared in this scope; did you mean 'ma'?
   19 |         ma=max(ma,sum);
      |            ^~~
      |            ma
Language: C++

#include<iostream>
using namespace std;
int num[100100];
int main(){
int n,m;
int ans=0;
while(1){
         for(int i=0;i<100100;i++)num[i]=0;
         cin>>n>>m;
         if(n==0&&m==0)break;
         for(int i=0;i<n;i++) cin>>num[i];
         for(int i=0;i<m-n;i++){
              int min=num[i]+num[i+1]+num[i+2];
              if(ans<min)ans=0;
         }
         count<<ans<<endl;
         ans=0;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'count' was not declared in this scope
   16 |          count<<ans<<endl;
      |          ^~~~~
Language: C++

#include<iostream>
using namespace std;
int num[100100];
int main(){
int n,m;
int ans=0;
while(1){
         for(int i=0;i<100001;i++){
              num[i]=0;
              if(num[i+1]==0)braek;
         }
         cin>>n>>m;
         if(n==0&&m==0)break;
         for(int i=0;i<n;i++) cin>>num[i];
         for(int i=0;i<n-m;i++){
              int min=0;
              for(int j=i;j<i+m;j++)min+=num[j];
              if(ans<min)ans=min;
         }
         cout<<ans<<endl;
         ans=0;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: 'braek' was not declared in this scope
   10 |               if(num[i+1]==0)braek;
      |                              ^~~~~
Language: C++

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

int main(){

  int n, k;
  
  while(cin >> n >> k, n|k){
    
    int ans, = 0, data[111111] = {};
    for(int i=0;i<n;i++) cin >> data[i];
    for(int i=1;i<n;i++) data[i] += data[i-1];
    
    for(int i=0;i<n-k;i++) ans = max(ans, data[i+k] - data[i]);
    
    cout << ans << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: expected unqualified-id before '=' token
   10 |     int ans, = 0, data[111111] = {};
      |              ^
a.cc:11:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |     for(int i=0;i<n;i++) cin >> data[i];
      |                                     ^
a.cc:12:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     for(int i=1;i<n;i++) data[i] += data[i-1];
      |                              ^
a.cc:12:41: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     for(int i=1;i<n;i++) data[i] += data[i-1];
      |                                         ^
a.cc:14:47: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   14 |     for(int i=0;i<n-k;i++) ans = max(ans, data[i+k] - data[i]);
      |                                               ^
a.cc:14:59: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   14 |     for(int i=0;i<n-k;i++) ans = max(ans, data[i+k] - data[i]);
      |                                                           ^
Language: C++

#include <iostream>
#include <algorithm>

int N = 1 << 17;
int seg[N * 2];

void update(int x, int v) {
    x += N - 1;
    seg[x] = v;
    while (x) {
        x = (x - 1) / 2;
        seg[x] = seg[x + x + 1] + seg[x + x + 2];
    }
}
int query(int a, int b, int x, int l, int r) {
    if (b <= l || r <= a) return 0;
    if (l <= a && b <= r) return seg[x];
    return query(a, b, x + x + 1, l, (l + r) / 2) + query(a, b, x + x + 2, (l + r) / 2, r);
}
int Q(int a, int b) { return query(a, b, 0, 0, N); }

int in() { int x; scanf("%d", &x); return x;}

int main(void)
{
    int n = in(), K = in();
    for (int i = 0; i < n; i++) update(i, in());
    int mini = 1 << 30;
    for (int i = 0; i < n - K; i++) mini = min(mini, Q(i, i + K));
    cout << mini << endl;
    return 0;
}

Compiler output:
a.cc:5:11: error: size of array 'seg' is not an integral constant-expression
    5 | int seg[N * 2];
      |         ~~^~~
a.cc: In function 'int main()':
a.cc:29:44: error: 'min' was not declared in this scope; did you mean 'std::min'?
   29 |     for (int i = 0; i < n - K; i++) mini = min(mini, Q(i, i + K));
      |                                            ^~~
      |                                            std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:30:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 |     cout << mini << endl;
      |     ^~~~
      |     std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:30:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   30 |     cout << mini << endl;
      |                     ^~~~
      |                     std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;

#define MAX_N 100010
int N, K;
int S[MAX_N];

int main() {
  while (true) {
  cin >> N >> K;
  if (N == 0 && K == 0) break;
  int ans = INT_MIN;
  for (int i=0; i<N; i++) cin >> S[i];

  for (int i=0; i<=N-K; i++) {
    int t = 0;
    for (int j=0; j<K; j++) t += S[i+j];
    ans = max(ans, t);
  }
  cout << ans << "\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'INT_MIN' was not declared in this scope
   12 |   int ans = INT_MIN;
      |             ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <cstdlib>
using namespace std;

#define MAX_N 100010
int N, K;
int S[MAX_N];

int main() {
  while (true) {
  cin >> N >> K;
  if (N == 0 && K == 0) break;
  int ans = INT_MIN;
  for (int i=0; i<N; i++) cin >> S[i];

  for (int i=0; i<=N-K; i++) {
    int t = 0;
    for (int j=0; j<K; j++) t += S[i+j];
    ans = max(ans, t);
  }
  cout << ans << "\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'INT_MIN' was not declared in this scope
   13 |   int ans = INT_MIN;
      |             ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdlib>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
using namespace std;
const int INF = 1 << 30;
int main(){
	int n, k;
	for (cin >> n >> k, n) {
		vector<int> a(n);
		for (int &x : a)cin >> x;
		int pos = 0;
		int sum = 0;
		for (int i = 0; i < k; i++) {
			sum += a[i];
		}
		int max = sum;
		for (int i = 0; i < n - k; i++) {
			sum += a[i + k] - a[i];
			max = std::max(max, sum);
		}
		cout << max << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: expected ';' before ')' token
   14 |         for (cin >> n >> k, n) {
      |                              ^
      |                              ;
a.cc:29:9: error: expected primary-expression before 'return'
   29 |         return 0;
      |         ^~~~~~
a.cc:28:10: error: expected ';' before 'return'
   28 |         }
      |          ^
      |          ;
   29 |         return 0;
      |         ~~~~~~
a.cc:29:9: error: expected primary-expression before 'return'
   29 |         return 0;
      |         ^~~~~~
a.cc:28:10: error: expected ')' before 'return'
   28 |         }
      |          ^
      |          )
   29 |         return 0;
      |         ~~~~~~
a.cc:14:13: note: to match this '('
   14 |         for (cin >> n >> k, n) {
      |             ^
Language: C++

#include <iostream>
using namespace std;

int n;
int a[100000];

int main() {
	cin >> n;

	static int ra[100001];	//ra[i] = a[0] + ??? + a[i-1]
	ra[0] = 0;
	for (int i = 0; i < n; i++) {
		ra[i+1] = ra[i] + a[i];
	}

	int ans = -1000000001;
	for (int i = 0; i < n - k; i++) {
		//a[i] + ??? + a[i+k-1]
		ans = max(ans, ra[i+k] - ra[i]);
	}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:33: error: 'k' was not declared in this scope
   17 |         for (int i = 0; i < n - k; i++) {
      |                                 ^
Language: C++

#include<cstdio>
#include<utility>
#include<algorithm>
#define INF INT_MAX/2-1
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int a[100000];
int main(){
	int n, k;
	while (scanf("%d%d", &n, &k), n){
		rep(i, n)
			scanf("%d", &a[i]);
		int Max = -INF;
		rep(i, n - k + 1){
			int sum = 0;
			rep(j, k){
				sum += a[i + j];
			}
			Max = max(Max, sum);
		}
		printf("%d\n", Max);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:13: error: 'INT_MAX' was not declared in this scope
    4 | #define INF INT_MAX/2-1
      |             ^~~~~~~
a.cc:15:28: note: in expansion of macro 'INF'
   15 |                 int Max = -INF;
      |                            ^~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<algorithm>
  +++ |+#include <climits>
    4 | #define INF INT_MAX/2-1
Language: C++

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

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

  int a[101010] = {0};

  cin >> a[1];
  for (int i = 2; i < n + 1; i++){
    cin >> a[i];
      a[i] += a[i - 1];
  }

  int max_n = -1e9;
  for (int i = 0; i < n - k; i++){
    max_n = max(max_n, a[k + i] - a[i]);
  }

  cout << max_n << endl;
}
#include <bits/stdc++.h>
using namespace std;

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

  int a[101010] = {0};

  cin >> a[1];
  for (int i = 2; i < n + 1; i++){
    cin >> a[i];
      a[i] += a[i - 1];
  }

  int max_n = -1e9;
  for (int i = 0; i < n - k; i++){
    max_n = max(max_n, a[k + i] - a[i]);
  }

  cout << max_n << endl;
}

Compiler output:
a.cc:27:5: error: redefinition of 'int main()'
   27 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int a,b
  while(cin>>a>>b,a){
    int c[a],w=0;
    r(i,a)cin>>c[i];
    r(i,a-2)w=max(w,c[i]+c[i+2]+c[i+1];
    cout<<w<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'while'
    6 |   while(cin>>a>>b,a){
      |   ^~~~~
Language: C++

#include<iostream>
using namespace std;
int a[1000000]
int main(){
	int i,i2,n,k,a[5001],max=-100000000,sum;
	cin>>n>>k;
	while(n!=0){
		for(i=1;i<=n;i++)cin>>a[i];
		for(i=1;i<=n-k+1;i++){
			sum=0;
			for(i2=i;i2<i+k;i2++)sum+=a[i2];
			if(sum>max){
				max=sum;
			}
		}
		cout<<max<<endl;
		cin>>n>>k;
	}
}
/*#include <stdio.h>
 
int a[100000];
 
int main() {
  int i, j, n, m, k, t;
  while (1) {
    scanf("%d%d", &n, &k);
    if (!n && !k) break;
    for (i = 0; i < n; i++) ~scanf("%d",a+i);
    for (i = m = 0; i < n - k; i++) {
      for (j = t = 0; j < k; j++) t += a[i+j];
      if (t > m) m = t;
    }
    printf("%d\n", m);
  }
  return 0;
}*/

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int main(){
      | ^~~
Language: C++

#include<iostream>
using namespace std;
int a[1000000]
int main(){
	int i,i2,n,k,max=-100000000,sum;
	cin>>n>>k;
	while(n!=0){
		for(i=1;i<=n;i++)cin>>a[i];
		for(i=1;i<=n-k+1;i++){
			sum=0;
			for(i2=i;i2<i+k;i2++)sum+=a[i2];
			if(sum>max){
				max=sum;
			}
		}
		cout<<max<<endl;
		cin>>n>>k;
	}
}
/*#include <stdio.h>
 
int a[100000];
 
int main() {
  int i, j, n, m, k, t;
  while (1) {
    scanf("%d%d", &n, &k);
    if (!n && !k) break;
    for (i = 0; i < n; i++) ~scanf("%d",a+i);
    for (i = m = 0; i < n - k; i++) {
      for (j = t = 0; j < k; j++) t += a[i+j];
      if (t > m) m = t;
    }
    printf("%d\n", m);
  }
  return 0;
}*/

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int main(){
      | ^~~
Language: C++

#include <string>
#include <stdio.h>
#include <queue>
#include <stack>
#include <math.h>
using namespace std;
int main(void)
{
	for (;;)
	{
		int a,b,c,d,max=0;
		scanf("%d %d",&a,&b);
		int e[a];
		if (a==0&&b==0) break;
		for (c=0;c<a;c++){
			scanf("%d",&d);
			e[c]=d;
		}
		for (int f=0;f<=a-b;f++){
			for (int g=1;g<b;g++){
				e[f]=e[f]+e[f+g];
			}
			if (e[f]>=max) max=e[f];
		}
		printf("%d\n",max);
	return 0;
}

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

while 1:
    n,k = [int(i) for i in input().split()]
    if not n and k:
        break
    a = [int(input()) for i in range(n)]
    b = [0]*len(a)

    for i in range(n):
        b[i] = b[i-1] + a[i]
    b = b + [0]

    c = [b[i + k - 1] - b[i - 1] for i in range(n - k + 1)]

    print(max(c))


Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while 1:
      | ^~~~~
Language: C++

#include<iostream>
using namespace std;
int suretu[100000];
int cont = 0, max_sum = 0;

int ret_maxsum(int n, int k, int wa )
{
	int temp = 0;
	int i;
	/*
	if(isBegin == 1){
		for(i = 0; i < k; i++){
			temp += suretu[cont+i];
		}
	}
	*/
	else{temp += wa + suretu[cont+k-1];}
	wa = temp - suretu[cont];
	cont++;
	if(max_sum < temp){max_sum = temp;}
	if(cont == n-k+1){return max_sum;}
	else{return ret_maxsum(n, k, wa, 0);}
}
main()
{
	for(;;){
		int n,k;
		cin >> n;
		cin >> k;
		if(n == 0 && k == 0){
			break;
		}
		for(int i = 0; i < n; i++){
			cin >> suretu[i];
		}
		printf("%d\n",ret_maxsum(n, k, 0));
	}
}

Compiler output:
a.cc: In function 'int ret_maxsum(int, int, int)':
a.cc:17:9: error: 'else' without a previous 'if'
   17 |         else{temp += wa + suretu[cont+k-1];}
      |         ^~~~
a.cc:22:31: error: too many arguments to function 'int ret_maxsum(int, int, int)'
   22 |         else{return ret_maxsum(n, k, wa, 0);}
      |                     ~~~~~~~~~~^~~~~~~~~~~~~
a.cc:6:5: note: declared here
    6 | int ret_maxsum(int n, int k, int wa )
      |     ^~~~~~~~~~
a.cc: At global scope:
a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   24 | main()
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
int suretu[100000];
int cont = 0, max_sum = 0;

int ret_maxsum(int n, int k, int wa )
{
	int temp = 0;
	int i;
	/*
	if(isBegin == 1){
		for(i = 0; i < k; i++){
			temp += suretu[cont+i];
		}
	}
	*/
	else{temp += wa + suretu[cont+k-1];}
	wa = temp - suretu[cont];
	cont++;
	if(max_sum < temp){max_sum = temp;}
	if(cont == n-k+1){return max_sum;}
	else{return ret_maxsum(n, k, wa);}
}
main()
{
	for(;;){
		int n,k;
		cin >> n;
		cin >> k;
		if(n == 0 && k == 0){
			break;
		}
		for(int i = 0; i < n; i++){
			cin >> suretu[i];
		}
		printf("%d\n",ret_maxsum(n, k, 0));
	}
}

Compiler output:
a.cc: In function 'int ret_maxsum(int, int, int)':
a.cc:17:9: error: 'else' without a previous 'if'
   17 |         else{temp += wa + suretu[cont+k-1];}
      |         ^~~~
a.cc: At global scope:
a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   24 | main()
      | ^~~~