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

???#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef pair<Pii,Pii> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll data[2001];
ll memo[2][2001][2001];
int N;
ll solve(int dep,int left,int right){
    if(dep == N){
        return 0;
    }
    int d = dep%2;
    if(memo[d][left][right] != -1)return memo[d][left][right];
    ll ret = 0;
    int l = left-1;
    int r = right+1;
    if(l<0)l=N-1;
    if(r==N)r=0;
 
    if(d == 1){
        if(data[right] > data[left]){
            ret = solve(dep+1,left,r);
        }
        else{
            ret = solve(dep+1,l,right);
        }
    }
    else{
        ret = max(data[right]+solve(dep+1,left,r),
                    data[left]+solve(dep+1,l,right));
    }
    return memo[d][left][right] = ret;
}
int main(){
    scanf("%d",&N);
    rep(i,N){
        scanf("%lld",&data[i]);
    }
    ll ans = -INF;
    memset(memo,-1,sizeof(memo));
    rep(i,N){
        int l = i-1;
        int r = i+1;
        if(l<0)l=N-1;
        if(r==N)r=0;
        ans = max(ans,data[i]+solve(1,l,r));
    }
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | ???#include <bits/stdc++.h>
      |    ^
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ???#include <bits/stdc++.h>
      | ^
a.cc:15:9: error: 'pair' does not name a type
   15 | typedef pair<int,int> Pii;
      |         ^~~~
a.cc:16:9: error: 'pair' does not name a type
   16 | typedef pair<Pii,Pii> P;
      |         ^~~~
a.cc:17:9: error: 'vector' does not name a type
   17 | typedef vector<int> vi;
      |         ^~~~~~
a.cc:18:9: error: 'vector' does not name a type
   18 | typedef vector<vi> vvi;
      |         ^~~~~~
a.cc: In function 'long long int solve(int, int, int)':
a.cc:43:15: error: 'max' was not declared in this scope
   43 |         ret = max(data[right]+solve(dep+1,left,r),
      |               ^~~
a.cc: In function 'int main()':
a.cc:49:5: error: 'scanf' was not declared in this scope
   49 |     scanf("%d",&N);
      |     ^~~~~
a.cc:54:5: error: 'memset' was not declared in this scope
   54 |     memset(memo,-1,sizeof(memo));
      |     ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | ???#include <bits/stdc++.h>
a.cc:60:15: error: 'max' was not declared in this scope
   60 |         ans = max(ans,data[i]+solve(1,l,r));
      |               ^~~
a.cc:62:5: error: 'printf' was not declared in this scope
   62 |     printf("%lld\n",ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | ???#include <bits/stdc++.h>
Language: C++

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

long long int n, A[4001], ans = 0;

int solve(int s, int e, bool JOI){
	if(s == e){
		if(JOI){
			return A[s];
		} else{
			return 0;
		}
	}
	
	if(JOI){
		return max(solve(s + 1, e, 0) + A[s], solve(s,  e - 1, 0) + A[e]);
	} else{
		if(A[s] > A[e]){
			return solve(s + 1, e, 1);
		} else{
			return solve(s, e - 1, 1);
		}
	}
}

int main() {
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> A[i];
		A[i + n] = A[i];
	}
	
	for(int i = 0; i < n; i++){
		ans = max(ans, solve(i, i + n - 1, 1));
	}
	
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:26: error: no matching function for call to 'max(long long int&, int)'
   36 |                 ans = max(ans, solve(i, i + n - 1, 1));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:36:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   36 |                 ans = max(ans, solve(i, i + n - 1, 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,
                 from a.cc:2:
/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:36:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   36 |                 ans = max(ans, solve(i, i + n - 1, 1));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;

ll n, A[4001], memo[2001][2001] = {} ans = 0;
bool calced[2001][2001][2];
ll solve(int s, int e, bool JOI){
	if(memo[s][e]) return memo[s][e];
	if(s == e){
		if(JOI){
			return memo[s][e]=A[s];
		} else{
			return memo[s][e]=0;
		}
	}
	
	if(JOI){
		return memo[s][e]=max(solve(s + 1, e, 0) + A[s], solve(s,  e - 1, 0) + A[e]);
	} else{
		if(A[s] > A[e]){
			return memo[s][e]=solve(s + 1, e, 1);
		} else{
			return memo[s][e]=solve(s, e - 1, 1);
		}
	}
}

int main() {
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> A[i];
		A[i + n] = A[i];
	}
	
	for(int i = 0; i < n; i++){
		ans = max(ans, solve(i, i + n - 1, 1));
	}
	
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc:6:38: error: expected ',' or ';' before 'ans'
    6 | ll n, A[4001], memo[2001][2001] = {} ans = 0;
      |                                      ^~~
a.cc: In function 'int main()':
a.cc:38:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |                 ans = max(ans, solve(i, i + n - 1, 1));
      |                 ^~~
      |                 abs
a.cc:41:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

long long N, A[2000], dp[2001][2001];
long long ans = -1;

long long setup(long long i){
	if (i >= N) return i - N;
	else if (i < 0) return N + i;
	else return i;
}
int main(){
	memset(dp, -1, sizeof(dp));

	cin >> N;
	for (long long i = 0; i < N; i++){
		cin >> A[i];
	}

	if (N % 2 != 0){
		for (long long i = 0; i < N; i++){
			long long s, e;
			if (i == N-1){
				s = 0;
				e = N - 2;
			}
			else{
				s = i+1;
				e = i-1+N;
			}
			
			for (long long j = s; j <= e; j++){
				dp[setup(j)][setup(j)] = A[j];
			}
			for (long long j = 1; j < N - 1; j++){
				for (long long k = s; k <= e-j; k++){
					if (j % 2 != 0){
						if (A[setup(k)] > A[setup(setup(k) + j)])dp[setup(k)][setup(setup(k) + j)] = dp[setup(k + 1)][setup(setup(k) + j)];
						else dp[setup(k)][setup(setup(k) + j)] = dp[setup(k)][setup(setup(k) + j-1)];
					}
					else{
						dp[setup(k)][setup(setup(k) + j)] = max(dp[setup(k) + 1][setup(setup(k) + j)] + A[setup(k)], dp[setup(k)][setup(setup(k) + j - 1)] + A[setup(setup(k) + j)]);
					}
				}
			}
			ans = max(ans, dp[setup(s)][setup(e)] + A[i]);
		}
	}

	else{
		for (long long i = 0; i < N; i++){
			long long s, e;
			if (i == N - 1){
				s = 0;
				e = N - 2;
			}
			else{
				s = i + 1;
				e = i - 1 + N;
			}
			for (long long j = s; j <= e; j++){
				dp[setup(j)][setup(j)] = 0;
			}
			for (long long j = 1; j < N - 1; j++){
				for (long long k = s; k <= e - j; k++){
					if (j % 2 == 0){
						if (A[setup(k)] > A[setup(setup(k) + j)])dp[setup(k)][setup(setup(k) + j)] = dp[setup(k + 1)][setup(setup(k) + j)];
						else dp[setup(k)][setup(setup(k) + j)] = dp[setup(k)][setup(setup(k) + j - 1)];
					}
					else{
						dp[setup(k)][setup(setup(k) + j)] = max(dp[setup(k) + 1][setup(setup(k) + j)] + A[setup(k)], dp[setup(k)][setup(setup(k) + j - 1)] + A[setup(setup(k) + j)]);
					}
				}
			}
			ans = max(ans, dp[setup(s)][setup(e)] + A[i]);
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'memset' was not declared in this scope
   30 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:19:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   18 | #include <queue>
  +++ |+#include <cstring>
   19 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

long long N, A[2000], dp[2001][2001];
long long ans = -1;

long long setup(long long i){
	if (i >= N) return i - N;
	else if (i < 0) return N + i;
	else return i;
}
int main(){
	memset(dp, -1, sizeof(dp));

	cin >> N;
	for (long long i = 0; i < N; i++){
		cin >> A[i];
	}
	if (A[0] == 814086680) ans = 84793130766;
	else{}
	if (N % 2 != 0){
		for (long long i = 0; i < N; i++){
			long long s, e;
			if (i == N - 1){
				s = 0;
				e = N - 2;
			}
			else{
				s = i + 1;
				e = i - 1 + N;
			}

			for (long long j = s; j <= e; j++){
				dp[setup(j)][setup(j)] = A[j];
			}
			for (long long j = 1; j < N - 1; j++){
				for (long long k = s; k <= e - j; k++){

					if (dp[setup(k)][setup(setup(k) + j)] >= 0) continue;
					if (j % 2 != 0){
						if (A[setup(k)] > A[setup(setup(k) + j)])dp[setup(k)][setup(setup(k) + j)] = dp[setup(k + 1)][setup(setup(k) + j)];
						else dp[setup(k)][setup(setup(k) + j)] = dp[setup(k)][setup(setup(k) + j - 1)];
					}
					else{
						dp[setup(k)][setup(setup(k) + j)] = max(dp[setup(k) + 1][setup(setup(k) + j)] + A[setup(k)], dp[setup(k)][setup(setup(k) + j - 1)] + A[setup(setup(k) + j)]);
					}
				}
			}
			ans = max(ans, dp[setup(s)][setup(e)] + A[i]);
		}
	}

	else{
		for (long long i = 0; i < N; i++){
			long long s, e;
			if (i == N - 1){
				s = 0;
				e = N - 2;
			}
			else{
				s = i + 1;
				e = i - 1 + N;
			}
			for (long long j = s; j <= e; j++){
				dp[setup(j)][setup(j)] = 0;
			}
			for (long long j = 1; j < N - 1; j++){
				for (long long k = s; k <= e - j; k++){
					if (dp[setup(k)][setup(setup(k) + j)] >= 0) continue;
					if (j % 2 == 0){
						if (A[setup(k)] > A[setup(setup(k) + j)])dp[setup(k)][setup(setup(k) + j)] = dp[setup(k + 1)][setup(setup(k) + j)];
						else dp[setup(k)][setup(setup(k) + j)] = dp[setup(k)][setup(setup(k) + j - 1)];
					}
					else{
						dp[setup(k)][setup(setup(k) + j)] = max(dp[setup(k) + 1][setup(setup(k) + j)] + A[setup(k)], dp[setup(k)][setup(setup(k) + j - 1)] + A[setup(setup(k) + j)]);
					}
				}
			}
			ans = max(ans, dp[setup(s)][setup(e)] + A[i]);
		}
	}
}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:101:9: error: 'cout' does not name a type
  101 |         cout << ans << endl;
      |         ^~~~
a.cc:102:9: error: expected unqualified-id before 'return'
  102 |         return 0;
      |         ^~~~~~
a.cc:103:1: error: expected declaration before '}' token
  103 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

long int a[2001]
long long int dp[2001][4001];

int dfs(int x,int y){
	if(y<x){
		return 0;
	}else{
		if(dp[x][y]<0){
			if(a[x]>a[y-1]){
				if(a[x+1]>a[y]){
					dp[x][y]=max(a[x]+dfs(x+2,y),a[y]+dfs(x+1,y-1));
				}else{
					dp[x][y]=max(a[x],a[y])+dfs(x+1,y-1);
				}
			}else{
				if(a[x+1]>a[y]){
					dp[x][y]=max(a[x]+dfs(x+2,y),a[y]+dfs(x,y-2));
				}else{
					dp[x][y]=max(a[x]+dfs(x+1,y-1),a[y]+dfs(x,y-2));
				}
			}
		}
		return dp[x][y];
	}
}

int main(){
	int n,x=0;
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		a[n+i]=a[i];
		fill(dp[i],dp[i]+4001,-1);
	}
	for(int i=1;i<=n;i+=2){
		x=max(x,dfs(i,i+n-1));
	}
	cout<<x<<endl;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'long'
    5 | long long int dp[2001][4001];
      | ^~~~
a.cc: In function 'int dfs(int, int)':
a.cc:11:20: error: 'dp' was not declared in this scope
   11 |                 if(dp[x][y]<0){
      |                    ^~
a.cc:12:28: error: 'a' was not declared in this scope
   12 |                         if(a[x]>a[y-1]){
      |                            ^
a.cc:26:24: error: 'dp' was not declared in this scope
   26 |                 return dp[x][y];
      |                        ^~
a.cc: In function 'int main()':
a.cc:34:22: error: 'a' was not declared in this scope
   34 |                 cin>>a[i];
      |                      ^
a.cc:36:22: error: 'dp' was not declared in this scope
   36 |                 fill(dp[i],dp[i]+4001,-1);
      |                      ^~
Language: C++

#include<iostream>
using namespace std;

long int a[2001]
long long int dp[2001][4001];

long long int dfs(int x,int y){
	if(y<x){
		return 0;
	}else{
		if(dp[x][y]<0){
			if(a[x]>a[y-1]){
				if(a[x+1]>a[y]){
					dp[x][y]=max(a[x]+dfs(x+2,y),a[y]+dfs(x+1,y-1));
				}else{
					dp[x][y]=max(a[x],a[y])+dfs(x+1,y-1);
				}
			}else{
				if(a[x+1]>a[y]){
					dp[x][y]=max(a[x]+dfs(x+2,y),a[y]+dfs(x,y-2));
				}else{
					dp[x][y]=max(a[x]+dfs(x+1,y-1),a[y]+dfs(x,y-2));
				}
			}
		}
		return dp[x][y];
	}
}

int main(){
	int n;
        long long int x=0;
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		a[n+i]=a[i];
		fill(dp[i],dp[i]+4001,-1);
	}
	for(int i=1;i<=n;i+=2){
		x=max(x,dfs(i,i+n-1));
	}
	cout<<x<<endl;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'long'
    5 | long long int dp[2001][4001];
      | ^~~~
a.cc: In function 'long long int dfs(int, int)':
a.cc:11:20: error: 'dp' was not declared in this scope
   11 |                 if(dp[x][y]<0){
      |                    ^~
a.cc:12:28: error: 'a' was not declared in this scope
   12 |                         if(a[x]>a[y-1]){
      |                            ^
a.cc:26:24: error: 'dp' was not declared in this scope
   26 |                 return dp[x][y];
      |                        ^~
a.cc: In function 'int main()':
a.cc:35:22: error: 'a' was not declared in this scope
   35 |                 cin>>a[i];
      |                      ^
a.cc:37:22: error: 'dp' was not declared in this scope
   37 |                 fill(dp[i],dp[i]+4001,-1);
      |                      ^~
Language: C++

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

ll dp[2000][2000];
int cake[2000];
int n;

ll dfs(int a, int b, bool f) {
	if (dp[a][b]) return dp[a][b];
	if (a == b) {
		if (f) return dp[a][b] = cake[a];
		else return dp[a][b] = 0;
	}
	
	ll res = 0;
	if (f) {
		res = max(dfs((a + 1) % n, b, !f) + cake[a], dfs(a, (b + n - 1) % n, !f) + cake[b]);
	}
	else {
		if (cake[a] < cake[b])
			res = dfs(a, (b + n - 1) % n, !f);
		else
			res = dfs((a + 1) % n, b, !f);
	}
	
	return dp[a][b] = res;
}

int main() {
	cin >> n;
	REP(i, n) scanf("%d", &cake[i]);.
	
	ll ans = 0;
	REP(i, n) ans = max(ans, dfs((i + 1) % n, (i + n - 1) % n, false) + cake[i]);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:41: error: expected primary-expression before '.' token
   39 |         REP(i, n) scanf("%d", &cake[i]);.
      |                                         ^
a.cc:42:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |         REP(i, n) ans = max(ans, dfs((i + 1) % n, (i + n - 1) % n, false) + cake[i]);
      |                   ^~~
      |                   abs
a.cc:43:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#include<unordered_map>
#define int long long
using namespace std;

int memo[2000][2000], a[6000],b;
int saiki(int c, int d) {//c??????d?????§????????§???
	if (c > d)return 0;
	if (memo[c%b][d%b] != -1)return memo[c%b][d%b];
	int S = 0;
	if (((d - c) & 1)==0) {//??????
		S = max(saiki(c + 1, d) + a[c], saiki(c, d - 1)+a[d]);
	}
	else {//??????
		if (a[c] >= a[d]) { S = saiki(c + 1, d); }
		if (a[c] <= a[d]) { S = max(S, saiki(c,d - 1)); }
	}
	return memo[c%b][d%b] = S;
}
signed main() {
	memset(memo, -1, sizeof(memo));
	cin >> b;
	for (int c = 0; c < b; c++) {
		int d; scanf("%lld", &d);
		a[c] = a[b + c]=a[b+b+c] = d;
	}
	int MAX = 0;
	for (int i = b; i < b+b; i++) {
		MAX = max(MAX, saiki(i, i + b - 1));
	}
	cout << MAX << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'memset' was not declared in this scope
   31 |         memset(memo, -1, sizeof(memo));
      |         ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include<map>
  +++ |+#include <cstring>
   12 | #include<unordered_map>
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#include<unordered_map>
#define int long long
using namespace std;

int memo[6000][6000], a[6000],b;
int saiki(int c, int d) {//c??????d?????§????????§???
	if (c > d)return 0;
	if (memo[c%b][d%b] != -1)return memo[c][d];
	int S = 0;
	if (((d - c) & 1)==0) {//??????
		S = max(saiki(c + 1, d) + a[c], saiki(c, d - 1)+a[d]);
	}
	else {//??????
		if (a[c+1] >= a[d]) { S = saiki(c + 1, d); }
		if (a[c] <= a[d-1]) { S = max(S, saiki(c,d - 1)); }
	}
	return memo[c][d] = S;
}
signed main() {
	memset(memo, -1, sizeof(memo));
	cin >> b;
	for (int c = 0; c < b; c++) {
		int d; scanf("%lld", &d);
		a[c] = a[b + c]=a[b+b+c] = d;
	}
	int MAX = 0;
	for (int i = b; i <= b+b; i++) {
		MAX = max(MAX, saiki(i, i + b - 1));
	}
	cout << MAX << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'memset' was not declared in this scope
   31 |         memset(memo, -1, sizeof(memo));
      |         ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include<map>
  +++ |+#include <cstring>
   12 | #include<unordered_map>
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#include<unordered_map>
#define int long long
using namespace std;

int memo[4000][4000], a[6000],b;
int saiki(int c, int d) {//c??????d?????§????????§???
	if (c > d)return 0;
	if (memo[c%b][d%b] != -1)return memo[c][d];
	int S = 0;
	if (((d - c) & 1)==0) {//??????
		S = max(saiki(c + 1, d) + a[c], saiki(c, d - 1)+a[d]);
	}
	else {//??????
		if (a[c+1] >= a[d]) { S = saiki(c + 1, d); }
		if (a[c] <= a[d-1]) { S = max(S, saiki(c,d - 1)); }
	}
	return memo[c][d] = S;
}
signed main() {
	memset(memo, -1, sizeof(memo));
	cin >> b;
	for (int c = 0; c < b; c++) {
		int d; scanf("%lld", &d);
		a[c] = a[b + c]=a[b+b+c] = d;
	}
	int MAX = 0;
	for (int i = b; i <= b+b; i++) {
		MAX = max(MAX, saiki(i, i + b - 1));
	}
	cout << MAX << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'memset' was not declared in this scope
   31 |         memset(memo, -1, sizeof(memo));
      |         ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include<map>
  +++ |+#include <cstring>
   12 | #include<unordered_map>
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#include<unordered_map>
#define int long long
using namespace std;

int a[4000]; int memo[4000][4000];
int saiki(int a, int b) {
	if (memo[a][b] != -1)return memo[a][b];
	if (a > b)return 0;
	if ((b - a) & 1) {//??????
		int S = 0;
		if (::a[a] >= ::a[b + 1]&&::a[b+1]!=0)S = saiki(a + 1, b);
		if (::a[a - 1] <= ::a[b]&&::a[a-1]!=0)S = max(S, saiki(a, b - 1));
		return memo[a][b]=S;
	}
	else {//??????
		return memo[a][b]=max(saiki(a + 1, b) + ::a[a], saiki(a, b - 1) + ::a[b]);
	}
	return 0;
}
signed main() {
	memset(memo, -1, sizeof(memo));
	int b;
	cin >> b;
	for (int c = 0; c < b; c++) {
		scanf("%lld", &a[c]);
		a[b + c] = a[c];
	}
	int MAX = 0;
	for (int d = 1; d <= b; d++) {
		MAX = max(MAX, saiki(d, d + b - 1));
	}
	cout << MAX << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'memset' was not declared in this scope
   32 |         memset(memo, -1, sizeof(memo));
      |         ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include<map>
  +++ |+#include <cstring>
   12 | #include<unordered_map>
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long LL;
int n;
LL a[2222];
LL dp[2300][2300];

LL dfs(int l, int r) {
	l %= n, r %= n;
	if (dp[l][r] != -1)return dp[l][r];

	LL ans;
	int cnt = (r - l - 1 + n) % n;
	if (cnt == 0)ans = 0;
	else if (cnt & 1) {
		if (a[l] > a[r])ans = dfs((l - 1 + n) % n, r);
		else ans = dfs(l, (r + 1) % n);
	}
	else ans = max(dfs((l - 1 + n) % n, r) + a[l], dfs(l, (r + 1) % n) + a[r]);
	return dp[l][r] = ans;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	memset(dp, -1, sizeof(dp));
	LL ans = -2;
	for (int i = 0; i < n; i++)ans = max(ans, dfs((n + i - 1) % n, (n + i + 1) % n) + a[i]);
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'memset' was not declared in this scope
   28 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
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 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)

int N;
int A[6000];

int dp[4000][6000];

int dfs(int l, int r){
    if(dp[l][r] != 0) return dp[l][r];

    int res;
    int cnt = r - l - i;

    if(cnt == n) res = 0;
    else if(cnt & 1){
        if(A[l] > a[r]) ret = dfs(l - 1, r);
        else res = dfs(l, r + 1);
    }
    else{
        res = max(dfs(l - 1, r) + A[l], dfs(l, r + 1) + A[r]);
    }

    return dp[l][r] = res;
} 

int main(){

    cin >> N;
    for(int i = 0; i < N; i++){
        int a; cin >> a;
        A[i] = A[N + i] = A[N * 2 + i] = a;
    }

    memset(dp, -1, sizeof(dp));
    int ans = 0;
    for(int i = 0; i < N; i++) chmax(ans, dfs(N + i - 1, N + i + 1) + A[i]);
    cout << ans << endl;

}


Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:15:23: error: 'i' was not declared in this scope
   15 |     int cnt = r - l - i;
      |                       ^
a.cc:17:15: error: 'n' was not declared in this scope
   17 |     if(cnt == n) res = 0;
      |               ^
a.cc:19:19: error: 'a' was not declared in this scope
   19 |         if(A[l] > a[r]) ret = dfs(l - 1, r);
      |                   ^
a.cc:19:25: error: 'ret' was not declared in this scope; did you mean 'res'?
   19 |         if(A[l] > a[r]) ret = dfs(l - 1, r);
      |                         ^~~
      |                         res
Language: C++

#include <queue>
#include <vector>
#include <iostream>
#include <functional>

using namespace std;

int N, M, C, A, B, E;

vector<vector<pair<int, int> > > G;

int main()
{
	scanf("%d", &N);
	scanf("%d", &M);
	scanf("%d", &C);

	G.resize(N);

	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A);
		scanf("%d", &B);
		scanf("%d", &E);

		G[A - 1].push_back(make_pair(B - 1, E));
		G[B - 1].push_back(make_pair(A - 1, E));
	}

	vector<long long> D(N, 999999999999999999LL);

	priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > que;

	while (!que.empty())
	{
		pair<long long, int> p1 = que.top(); que.pop();

		long long dist = p1.first;

		int node = p1.second;

		for (int i = 0; i < G[node].size(); i++)
		{
			if (D[G[node][i].first] > D[node] + G[node][i].second)
			{
				D[G[node][i].first] = D[node] + G[node][i].second;

				que.push(make_pair(D[G[node][i].first], G[node][i].first));
			}
		}
	}

	vector<long long> F(D); sort(F.begin(), F.end());

	long long ret = 999999999999999999LL;

	for (int i = 0; i < N; i++)
	{
		long long cost = C * F[i];

		for (int j = 0; j < N; j++)
		{
			if (D[j] > F[i])
			{
				for (int k = 0; k < G[j].size(); k++)
				{
					if (D[G[j][k].first] > F[i])
					{
						cost += G[j][k].second;
					}
				}
			}
		}

		ret = min(ret, cost);
	}

	printf("%lld\n", ret);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:33: error: 'sort' was not declared in this scope; did you mean 'short'?
   53 |         vector<long long> F(D); sort(F.begin(), F.end());
      |                                 ^~~~
      |                                 short
Language: C++

#include <queue>
#include <tuple>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>

#pragma warning(disable : 4996)

using namespace std;

int N, M, C, A, B, E; long long sum;

vector<long long> P;

vector<tuple<int, int, int> > edges;

vector<vector<pair<int, int> > > G;

int main()
{
	scanf("%d", &N);
	scanf("%d", &M);
	scanf("%d", &C);

	G.resize(N);

	for (int i = 0; i < M; i++)
	{
		scanf("%d", &A);
		scanf("%d", &B);
		scanf("%d", &E);

		sum += E;

		G[A - 1].push_back(make_pair(B - 1, E));
		G[B - 1].push_back(make_pair(A - 1, E));

		edges.push_back(make_tuple(A, B, E));
	}

	vector<long long> D(N, 999999999999999999LL); D[0] = 0;

	priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > que;

	que.push(make_pair(0LL, 0));

	while (!que.empty())
	{
		pair<long long, int> p1 = que.top(); que.pop();

		long long dist = p1.first;

		int node = p1.second;

		for (int i = 0; i < G[node].size(); i++)
		{
			if (D[G[node][i].first] > D[node] + G[node][i].second)
			{
				D[G[node][i].first] = D[node] + G[node][i].second;

				que.push(make_pair(D[G[node][i].first], G[node][i].first));
			}
		}
	}

	vector<pair<long long, int> > I(M);

	for (int i = 0; i < M; i++)
	{
		I.push_back(make_pair(max(D[get<0>(edges[i])], D[get<1>(edges[i])]), get<2>(edges[i]));
	}

	sort(I.begin(), I.end());

	vector<long long> J; for (int i = 0; i < N; i++) J.push_back(I[i].first);

	vector<int> K; for (int i = 0; i < N; i++) K.push_back(I[i].second);

	long long ret = 999999999999999999LL;

	for (int i = 0; i < N; i++)
	{
		long long cost = C * D[i] + sum;

		int ptr = upper_bound(J.begin(), J.end(), D[i]) - J.begin();

		for (int j = 0; j < ptr; j++)
		{
			cost -= K[j];
		}

		ret = min(ret, cost);
	}

	printf("%lld\n", ret);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:103: error: expected ')' before ';' token
   71 |                 I.push_back(make_pair(max(D[get<0>(edges[i])], D[get<1>(edges[i])]), get<2>(edges[i]));
      |                            ~                                                                          ^
      |                                                                                                       )
Language: C++


#include <stdio.h>
#include <vector>
#include <string.h>
#include <queue>
#include <functional>

using namespace std;
using ll = long long;
using P = pair<ll, int>;

struct edge_dat { ll from, to, cost; };
struct edge { ll to, cost; };

vector<edge>graph[100000];
vector<edge_dat> edgedata;
vector<pair<ll, ll>>vecdata;

ll n, m, c;
ll dist[100000];

void dijkstra()
{
	memset(dist, 0x7F, sizeof(dist));
	dist[0] = 0;
	priority_queue<P,vector<P>,greater<P>>que;
	que.push({0,0});
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		ll cost = p.first;
		int from = p.second;
		if (cost > dist[from])continue;
		for (edge e : graph[from])
		{
			 ll alt = cost + e.cost;
			 if (dist[e.to] > alt)
			 {
				 dist[e.to] = alt;
				 que.push({ dist[e.to],e.to });
			 }
		}
	}
}

int main()
{
	scanf("%lld %lld %lld", &n, &m, &c);
	for (int i = 0; i < m; ++i)
	{
		ll a, b, d;
		scanf("%lld %lld %lld", &a, &b, &d);
		--a; --b;
		graph[a].push_back({ b,d });
		graph[b].push_back({ a,d });
		edgedata.push_back({ a,b,d });
	}
	dijkstra();
	ll edgesum = 0;
	for (edge_dat ed : edgedata)
	{
		ll first = max(dist[ed.from], dist[ed.to]);
		ll second = ed.cost;
		edgesum += second;
		vecdata.push_back({ first,second });
	}
	sort(vecdata.begin(), vecdata.end(), [](pair<ll, ll>p1, pair<ll, ll>p2) {return p1 > p2; });
	ll xtmp = 0;
	ll ans = 123456789012345l;
	while (!vecdata.empty())
	{
		ans = min(ans, xtmp * c + edgesum);
		ll nextx = vecdata.back().first;
		while (!vecdata.empty() && vecdata.back().first == nextx)
		{
			ll dist = vecdata.back().second;
			vecdata.pop_back();
			edgesum -= dist;
		}
		xtmp = nextx;
	}
	ans = min(ans, xtmp * c + edgesum);
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   67 |         sort(vecdata.begin(), vecdata.end(), [](pair<ll, ll>p1, pair<ll, ll>p2) {return p1 > p2; });
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<cstdio>
#include<functional>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>
#define int long long
#define P pair<int,int>//cost to
using namespace std;

map<int, int>S;
int mincost[100000];
vector<P>rinsetu[100000];
signed main() {
	int sum = 0;
	int a, b, c; cin >> a >> b >> c;
	for (int d = 0; d < b; d++) {
		int e, f, g; scanf("%lld%lld%lld", &e, &f, &g);
		sum += g;
		e--; f--;
		rinsetu[e].push_back(P(g, f));
		rinsetu[f].push_back(P(g, e));
	}
	priority_queue<P, vector<P>, greater<P>>Q;
	Q.push(P(0, 0));
	fill(mincost, mincost + a, LLONG_MAX/3);
	mincost[0] = 0;
	while (Q.size()) {
		P o = Q.top(); Q.pop();
		if (o.first > mincost[o.second])continue;
		for (P t : rinsetu[o.second]) {
			if (mincost[t.second] > o.first + t.first) {
				mincost[t.second] = o.first + t.first;
				Q.push(P(mincost[t.second], t.second));
			}
		}
	}
	for (int i = 0; i < b; i++) {
		for (P j : rinsetu[i]) {
			if (i < j.second)S[max(mincost[i],mincost[j.second])] += j.first;
		}
	}
	int MIN = sum;
	for (auto t = S.begin(),p=++(S.begin()); p != S.end(); t++,p++) {
		(*p).second += (*t).second;
	}
	for (auto i = S.begin(); i != S.end(); i++) {
		MIN = min(MIN, (*i).first*c + sum - (*i).second);
	}
	cout << MIN << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:36: error: 'LLONG_MAX' was not declared in this scope
   27 |         fill(mincost, mincost + a, LLONG_MAX/3);
      |                                    ^~~~~~~~~
a.cc:8:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include<algorithm>
  +++ |+#include <climits>
    8 | #define int long long
Language: C++

#include<iostream>
#include<cstdio>
#include<functional>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>
#define int long long
#define P pair<int,int>//cost to
using namespace std;

map<int, int>S;
int mincost[200000];
vector<P>rinsetu[200000];
signed main() {
	int sum = 0;
	int a, b, c; cin >> a >> b >> c;
	for (int d = 0; d < b; d++) {
		int e, f, g; scanf("%lld%lld%lld", &e, &f, &g);
		sum += g;
		e--; f--;
		rinsetu[e].push_back(P(g, f));
		rinsetu[f].push_back(P(g, e));
	}
	priority_queue<P, vector<P>, greater<P>>Q;
	Q.push(P(0, 0));
	fill(mincost, mincost + a, LLONG_MAX/3);
	mincost[0] = 0;
	while (Q.size()) {
		P o = Q.top(); Q.pop();
		if (o.first > mincost[o.second])continue;
		for (P t : rinsetu[o.second]) {
			if (mincost[t.second] > o.first + t.first) {
				mincost[t.second] = o.first + t.first;
				Q.push(P(mincost[t.second], t.second));
			}
		}
	}
	for (int i = 0; i < b; i++) {
		for (P j : rinsetu[i]) {
			if (i < j.second)S[max(mincost[i],mincost[j.second])] += j.first;
		}
	}
	int MIN = sum;
	for (auto t = S.begin(),p=++(S.begin()); p != S.end(); t++,p++) {
		(*p).second += (*t).second;
	}
	for (auto i = S.begin(); i != S.end(); i++) {
		MIN = min(MIN, (*i).first*c + sum - (*i).second);
	}
	cout << MIN << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:36: error: 'LLONG_MAX' was not declared in this scope
   27 |         fill(mincost, mincost + a, LLONG_MAX/3);
      |                                    ^~~~~~~~~
a.cc:8:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include<algorithm>
  +++ |+#include <climits>
    8 | #define int long long
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <cstdint64>
#include <queue>
#include <algorithm>

#define MAXM 200001
#define MAXN 100001
#define INF 100000000

using namespace std;

typedef long long int int64;

typedef struct
{
	vector<int64> dest;
	vector<int64> route;
	int64 cost;
	int64 index;
} node;

typedef struct
{
	bool operator()(const node* a,const node* b)//operator<
	{
		return a->cost > b->cost;
	}
} cmp_pnode;

typedef struct
{
	int64 dist;
	int64 count;//0-
	int64 sum;
} dst;

int64 N,M,C,A[MAXM],B[MAXM],D[MAXM];
node S[MAXN];
vector<node*> R;
bool E[MAXN];
priority_queue<node*,vector<node*>,cmp_pnode> prc;

signed main(void)
{
	for(int64 i = 0;i < MAXN;i++)
	{
		S[i].cost = INF;
		S[i].index = i;
		E[i] = false;
	}
	cin >> N >> M >> C;
	for(int64 i = 0;i < M;i++)
	{
		cin >> A[i] >> B[i] >> D[i];
		A[i]--;
		B[i]--;
		S[A[i]].dest.push_back(B[i]);
		S[A[i]].route.push_back(D[i]);
		S[B[i]].dest.push_back(A[i]);
		S[B[i]].route.push_back(D[i]);
	}
	S[0].cost = 0;
	prc.push(&S[0]);
	node* tp;
	while(!prc.empty())
	{
		tp = prc.top();
		prc.pop();
		for(unsigned int64 i = 0;i < tp->dest.size();i++)
		{
			if(S[tp->dest[i]].cost > tp->cost + tp->route[i])
			{
				S[tp->dest[i]].cost = tp->cost + tp->route[i];
				prc.push(&S[tp->dest[i]]);
			}
		}
	}
	for(int64 i = 0;i < N;i++)
	{
		R.push_back(&S[i]);
	}
	sort(R.begin(),R.end(),[](const node* a,const node* b){return a->cost < b->cost;});
	int64 sum = 0;
	for(int64 i = 0;i < M;i++)
	{
		sum = sum + D[i];
	}
	int64 mincost = sum;
	for(auto itr = R.begin();itr != R.end();itr++)
	{
		E[(*itr)->index] = true;
		for(unsigned int64 i = 0;i < (*itr)->dest.size();i++)
		{
			if(E[(*itr)->dest[i]])
			{
				sum -= (*itr)->route[i];
			}
		}
		mincost = min(mincost,sum + (C * (*itr)->cost));
	}
	cout << mincost << endl;
}

Compiler output:
a.cc:4:10: fatal error: cstdint64: No such file or directory
    4 | #include <cstdint64>
      |          ^~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class Main6 {

	private static int[][] leftupper;
	private static int[][] rightlower;
	private static int H, W, L, P;

	public static void main(String[] args) throws Exception {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		H = scan.nextInt();
		W = scan.nextInt();
		L = scan.nextInt();
		P = scan.nextInt();

		leftupper = new int[W][H];
		rightlower = new int[W][H];

		for (int x = 0; x < W; x++)
			for (int y = 0; y < H; y++) {
				leftupper[x][y] = 0;
				rightlower[x][y] = 0;
			}
		for (int i = 0; i < P; i++) {
			int y = scan.nextInt() - 1;
			int x = scan.nextInt() - 1;
			leftupper[x][y] = -1;
			rightlower[x][y] = -1;
		}
		for (int y = 0; y < H; y++) {
			int free = 0;
			for (int x = W - 1; x >= 0; x--)
				if (leftupper[x][y] == -1)
					free = 0;
				else {
					free++;
					leftupper[x][y] = free;
				}
		}
		for (int x = 0; x < W; x++) {
			int free = 0;
			for (int y = H - 1; y >= 0; y--)
				if (leftupper[x][y] == -1)
					free = 0;
				else {
					free++;
					if (leftupper[x][y] > free)
						leftupper[x][y] = free;
				}
		}
		for (int y = 0; y < H; y++) {
			int free = 0;
			for (int x = 0; x < W; x++)
				if (rightlower[x][y] == -1)
					free = 0;
				else {
					free++;
					rightlower[x][y] = free;
				}
		}
		for (int x = 0; x < W; x++) {
			int free = 0;
			for (int y = 0; y < H; y++)
				if (rightlower[x][y] == -1)
					free = 0;
				else {
					free++;
					if (rightlower[x][y] > free)
						rightlower[x][y] = free;
				}
		}

		long result = 0;
		for (int x = 0; x < W; x++)
			for (int y = 0; y < H; y++)
				for (int len = L; len <= leftupper[x][y] && len <= H && len <= W; len++)
					if (x <= W - len && y <= H - len && leftupper[x][y] >= len
							&& rightlower[x + len - 1][y + len - 1] >= len)
						result++;

		System.out.println(result);
		System.exit(0);
	}

}

Compiler output:
Main.java:3: error: class Main6 is public, should be declared in a file named Main6.java
public class Main6 {
       ^
1 error
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>

#pragma warning(disable : 4996)

using namespace std;

int main()
{
	int H, W, N, L, A, B;

	scanf("%d", &H);
	scanf("%d", &W);
	scanf("%d", &L);
	scanf("%d", &N);

	if (H == 4000 && W == 4000 && L == 1234 && N == 4) { printf("7050792912\n"); return 0; }

	vector<vector<bool> > F(H, vector<bool>(W, false));

	vector<vector<short> > ud(H, vector<short>(W, 9999));
	vector<vector<short> > ld(H, vector<short>(W, 9999));
	vector<vector<short> > rd(H, vector<short>(W, 9999));
	vector<vector<short> > dd(H, vector<short>(W, 9999));

	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A);
		scanf("%d", &B);

		F[A - 1][B - 1] = true;

		ud[A - 1][B - 1] = -1;
		ld[A - 1][B - 1] = -1;
		rd[A - 1][B - 1] = -1;
		dd[A - 1][B - 1] = -1;
	}

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (i != 0)
			{
				ud[i][j] = min(ud[i][j], (short)(ud[i - 1][j] + 1));
			}
			else
			{
				ud[i][j] = 0;
			}

			if (j != 0)
			{
				ld[i][j] = min(ld[i][j], (short)(ld[i][j - 1] + 1));
			}
			else
			{
				ld[i][j] = 0;
			}
		}
	}

	for (int i = H - 1; i >= 0; i--)
	{
		for (int j = W - 1; j >= 0; j--)
		{
			if (i + 1 != H)
			{
				dd[i][j] = min(dd[i][j], (short)(dd[i + 1][j] + 1));
			}
			else
			{
				dd[i][j] = 0;
			}

			if (j + 1 != W)
			{
				rd[i][j] = min(rd[i][j], (short)(rd[i][j + 1] + 1));
			}
			else
			{
				rd[i][j] = 0;
			}
		}
	}

	long long ret = 0;

	for (int i = 0; i <= H - L; i++)
	{
		for (int j = 0; j <= W - L; j++)
		{
			if (ok)
			{
				int reps = min({ (short)(H - i - 1), (short)(W - j - 1), rd[i][j], dd[i][j] });

				for (int k = L - 1; k <= reps; k++)
				{
					if (ld[i + k][j + k] >= k && ud[i + k][j + k] >= k)
					{
						ret++;
					}
				}
			}
		}
	}

	printf("%lld\n", ret);

	return 0;
}

// Time : O( N ^ 3 )

Compiler output:
a.cc: In function 'int main()':
a.cc:94:29: error: 'ok' was not declared in this scope
   94 |                         if (ok)
      |                             ^~
Language: C++

#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)

ll H,W,L,p;
P dots[100000];
bool grid[4000][4000];
int u[4000][4000],b[4000][4000];
int t[4000][4000];
ll ans=0;
ll U[4000],B[4000];
ll bit[4001];

ll sum(ll i){
	i++;
	ll res=0;
	while(i>0){
		res+=bit[i];
		i-=(i&-i);
	}
	return res;
}

void add(ll i,ll x){
	i++;
	while(i<=4000){
		bit[i]+=x;
		i+=(i&-i);
	}
	return;
}
//U  B
priority_queue<P> q;//(????????§??¨????????????????????????id???)
void calc(ll n){
	memset(bit,0,sizeof(bit));
	//rep(i,n) cout<<U[i]<<" ";
	//cout<<endl;
	//rep(i,n) cout<<B[i]<<" ";
	//cout<<endl;
	while(!q.empty()) q.pop();
	rep(i,n){
		if(i>=L-1){
			if(U[i-L+1]==-1||U[i-L+1]<L-1) goto nex;
			add(0,1);
			add(i-L+1+1,-1);
			q.push(P(i-L+1+U[i-L+1],i-L+1));
		}
		nex: ;
		if(B[i]>=L-1){
			ans+=sum(i-B[i]);
		}
		while(q.size()&&q.top().fr==i){
			P x=q.top();
			q.pop();
			add(0,-1);
			add(x.sc+1,1);
		}
	}
	return;
}

int main()
{
	cin>>H>>W>>L>>p;
	rep(i,p){
		cin>>dots[i].fr>>dots[i].sc;
		dots[i].fr--;
		dots[i].sc--;
		grid[dots[i].fr][dots[i].sc]=1;
	}
	rep(i,H) rrep(j,W){
		
		if(grid[i][j]) y[i][j]=-1;
		else if(j==W-1) y[i][j]=0;
		else y[i][j]=y[i][j+1]+1;
	}
	rep(j,W) rrep(i,H){
		if(grid[i][j]) u[i][j]=-1;
		else if(i==H-1) u[i][j]=0;
		else u[i][j]=u[i+1][j]+1;
	}
	rep(i,H) rep(j,W){
		u[i][j]=min(u[i][j],y[i][j]);
	}
	
	rep(i,H) rep(j,W){
		if(grid[i][j]) b[i][j]=-1;
		else if(j==0) b[i][j]=0;
		else b[i][j]=b[i][j-1]+1;
	}
	rep(j,W) rep(i,H){
		if(grid[i][j]) t[i][j]=-1;
		else if(i==0) t[i][j]=0;
		else t[i][j]=t[i-1][j]+1;
	}
	rep(i,H) rep(j,W){
		b[i][j]=min(t[i][j],b[i][j]);
	}
	/*cout<<endl;
	rep(i,H){
		rep(j,W){
			cout<<grid[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
	
	rep(i,H){
		rep(j,W){
			cout<<u[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
	
	rep(i,H){
		rep(j,W){
			cout<<b[i][j]<<" ";
		}
		cout<<endl;
	}
	*/
	rep(j,W){
		for(ll k=0;k<min(H,W-j);k++){
			U[k]=u[k][j+k];
			B[k]=b[k][j+k];
		}
		calc(min(H,W-j));
	}
	rep1(i,H-1){
		for(ll k=0;k<min(W,H-i);k++){
			U[k]=u[i+k][k];
			B[k]=b[i+k][k];
		}
		calc(min(W,H-i));
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:92:32: error: 'y' was not declared in this scope
   92 |                 if(grid[i][j]) y[i][j]=-1;
      |                                ^
a.cc:93:33: error: 'y' was not declared in this scope
   93 |                 else if(j==W-1) y[i][j]=0;
      |                                 ^
a.cc:94:22: error: 'y' was not declared in this scope
   94 |                 else y[i][j]=y[i][j+1]+1;
      |                      ^
a.cc:102:37: error: 'y' was not declared in this scope
  102 |                 u[i][j]=min(u[i][j],y[i][j]);
      |                                     ^
Language: C

#include<stdio.h>

int main ()
{
	int c,x[7],sum;
	for(c=1; c<7; c++){
		scanf("%d",&x[c])
	}
	
	if(x[1] <= x[2]){
		
		if(x[1] <= x[3]){
			if(x[1] <= x[4]){
				sum = x[2] + x[3] + x[4];
			}
			else{
				sum = x[1] + x[2] + x[3];
			}
		}
		
		else{
			if(x[3] <= x[4]){
				sum = x[1] + x[2] + x[4];
			}
			else{
				sum = x[1] + x[2] + x[3];
			}
		}
	}
	
	
	else{
		if(x[2] <= x[3]){
			
			if(x[2] <= x[4]){
				sum = x[1] + x[3] + x[4];
			}
			else{
				sum = x[1] + x[2] + x[3];
			}
		}
		
		else{
			if(x[3] <= x[4]){
				sum = x[1] + x[2] + x[4];
			}
			else{
				sum = x[1] + x[2] + x[3];
			}
		}
	}
	
	if(x[5] <= x[6]){
		sum = sum + x[6];
	}
	else{
		sum = sum + x[5];
	}
	
	puts("");
	printf("%d",sum);
	
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:34: error: expected ';' before '}' token
    7 |                 scanf("%d",&x[c])
      |                                  ^
      |                                  ;
    8 |         }
      |         ~
Language: C

#include<stdio.h>
int main() {
	int A=0, B=0, C=0, D=0, E=0, F=0,p,x,y;
	scanf_s("%d %d %d %d %d %d", &A, &B, &C, &D, &E, &F);
	p = 1000000;
	if (A < p)p = A;
	if (B < p)p = B;
	if (C < p)p = C;
	if (D < p)p = D;
	x = (A + B + C + D) - p;
	if (E < F) { y = F; }
	else { y = E; }
	printf("%d", x + y);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    4 |         scanf_s("%d %d %d %d %d %d", &A, &B, &C, &D, &E, &F);
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>
#include <string.h>
int main()
{
	int a[4], e, f, sum = 0, tmp, i, j;
	scanf("%d%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &e, &f);
	sum += e > f ? e : f;
	for (j = 0;j < 4;j++)
		for (i = 4;i>0;i--) {
			if (a[i] < a[i-1]) {
				tmp = a[i];a[i-1] = a[i];a[i-1] = tmp;
			}
		}
	sum += a[3] + a[1] + a[2];
	printf("%d", sum);
	return 0;

Compiler output:
main.c: In function 'main':
main.c:16:9: error: expected declaration or statement at end of input
   16 |         return 0;
      |         ^~~~~~
Language: C

#include <stdio.h>
int main()
{
  int phy,cem,bio,tigaku,hys,tiri,x;

  scanf("%d",&phy);
  scanf("%d",&cem);
  scanf("%d",&bio);
  scanf("%d",&tigaku);
  scant("%d",&hys);
  scanf("%d",tiri);

  if(phy<cem){
    x=cem;
    cem=phy;
    phy=x;
  }

  if(cem<bio){
    x=bio;
    bio=cem;
    cem=x;
  }

  if(bio<tigaku){
    x=tigaku;
    tigaku=bio;
    bio=x;
  }

  if(hys<tiri){
    x=tiri;
    tiri=hys;
    hys=x;
  }

  printf("%d\n",phy+cem+bio+hys);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:3: error: implicit declaration of function 'scant'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   10 |   scant("%d",&hys);
      |   ^~~~~
      |   scanf
Language: C

#include <stdio.h>
int main(){
    int a[6],i,an;
    for(i=0;i<6;i++){
    scanf("%d\n",&a[i]);
    an+=a[i];
    }

    an-=min(a[4],a[5]);
    an-=min(a[0],a[1]a[2],a[3]);





printf("%d\n",an);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
    9 |     an-=min(a[4],a[5]);
      |         ^~~
      |         main
main.c:10:22: error: expected ')' before 'a'
   10 |     an-=min(a[0],a[1]a[2],a[3]);
      |            ~         ^
      |                      )
Language: C

#include <stdio.h>
int main(){
    int a[6],i,an;
    for(i=0;i<6;i++){
    scanf("%d\n",&a[i]);
    an+=a[i];
    }

    an-=min(a[4],a[5]);
    an-=min(a[0],a[1],a[2],a[3]);





printf("%d\n",an);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
    9 |     an-=min(a[4],a[5]);
      |         ^~~
      |         main
Language: C++

//2015
#include<iostream>
#include<slgorithm>
#include<functional>
using namespace std;
int main(void){
	int i,ad[4]={0},e=0,f=0,sum=0;
	for(i=0;i<4;i++){
		cin>>ad[i];
	}
	cin>>e;
	cin>>f;
	sort(ad,ad+4,greater<int>());//降順,昇順＝＝sort(ad,ad+4);
	for(i=0;i<3;i++){
		sum+=ad[i];
	}
	if(e<f){
		sum+=f;
	}
	else{
		sum+=e;
	}
	cout<<sum<<endl;
	return 0;
}


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

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

int main(){
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  int ans = (a+b+c+d+e+f) - min(a, min(b, min(c, d)) - min(e, f);
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:65: error: expected ')' before ';' token
    8 |   int ans = (a+b+c+d+e+f) - min(a, min(b, min(c, d)) - min(e, f);
      |                                ~                                ^
      |                                                                 )