criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;

public class Problem2639 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int t = 0;

		if (a + b == 60) {
			System.out.println(-1);
			return;
		}
		/*
		 * 
		 * [0 << 50 >> 50] 40 [90 << 50 >> 140] 50 [190 << 5 >> 95] 40 [135 <<5>> 140] 40 [180 <<5>> 185]
		 *                 51        111

		 * [0 << 5 >> 5] 40 [45 << 5 >> 50] 40 [90 << 5 >> 95] 40 [135 <<5>> 140] 40 [180 <<5>> 185]
		 *               29                 89                                    149
		 */
		while (t < Integer.MAX_VALUE - 120) {
		
			int w1 = t;
			int w2 = t + a;
			int r = t / 60;
			int arrive = 60 * r + c;

			if (w1 <= arrive && arrive <= w2) {
				System.out.println(arrive);
				return;
			}

			t += a + b;
		}
		
		System.out.println(-1);
	}
}

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

import java.util.Scanner;

public class Problem2639 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int t = 0;

		/*
		 * 
		 * [0 << 50 >> 50] 40 [90 << 50 >> 140] 50 [190 << 5 >> 95] 40 [135 <<5>> 140] 40 [180 <<5>> 185]
		 *                 51        111

		 * [0 << 5 >> 5] 40 [45 << 5 >> 50] 40 [90 << 5 >> 95] 40 [135 <<5>> 140] 40 [180 <<5>> 185]
		 *               29                 89                                    149
		 */
		while (t < Integer.MAX_VALUE - 120) {
			int w1 = t;
			int w2 = t + a;
			int r = t / 60;
			int arrive = 60 * r + c;
//			System.out.printf("%d <--> %d, r = %d, arrive = %d\n", new Object[] { new Integer(w1), new Integer(w2), new Integer(r), new Integer(arrive) });

			if (w1 <= arrive && arrive <= w2) {
				System.out.println(arrive);
				return;
			}

			t += a + b;
		}
		
		System.out.println(-1);
	}
}

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

define rep(i,a) for(int i = 0 ; i < a ; i ++)

int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  if(a>=c){
    cout<<c<<endl;
    return 0;
  }
  int n = 10000;
  int sum = c;
  int cnt = 0;
  while(n--){
    
    //cout<<cnt<<" "<<sum<<" "<<cnt+b<<endl;
    while(cnt > sum)sum += 60;
    if(cnt <= sum && sum <= cnt + b){
      cout<<sum<<endl;
      //  break;
      return 0;
    }
    
    cnt += a + b;
  }
  cout<<-1<<endl;
}

Compiler output:
a.cc:1:1: error: 'define' does not name a type
    1 | define rep(i,a) for(int i = 0 ; i < a ; i ++)
      | ^~~~~~
a.cc:1:33: error: 'i' does not name a type
    1 | define rep(i,a) for(int i = 0 ; i < a ; i ++)
      |                                 ^
a.cc:1:41: error: 'i' does not name a type
    1 | define rep(i,a) for(int i = 0 ; i < a ; i ++)
      |                                         ^
Language: C++

#include<iostream>
int main(){
int n,m,b,c;
std::cin>>n>>m>>b;c=b;
for(int i=0;i<99;i++){
if(c%(n+m)<=n){goto a;}
c+=60;
}
c=-1;
a:
std::cout<<c<<endl;return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 | std::cout<<c<<endl;return 0;}
      |               ^~~~
      |               std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/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;
int main(){
    int n,m,b,c,d;
    bool a=false;
    cin>>n>>m>>b;c=b;
    for(int i=0;i<250000000;i++){
        if(c%(n+m)<=n && a==false){a=true;d=i;}
            c+=60;
        }
    }
    if(a==false){
        c=-1;
    }
    else{
        c=b+d*60;
    }
    cout<<c<<endl;
    return 0;
}

Compiler output:
a.cc:12:5: error: expected unqualified-id before 'if'
   12 |     if(a==false){
      |     ^~
a.cc:15:5: error: expected unqualified-id before 'else'
   15 |     else{
      |     ^~~~
a.cc:18:5: error: 'cout' does not name a type
   18 |     cout<<c<<endl;
      |     ^~~~
a.cc:19:5: error: expected unqualified-id before 'return'
   19 |     return 0;
      |     ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include<iostream>
main(){int n,m,c,i;std::cin>>n>>m>>c;for(i=0;i<99;i++){
if(c%(n+m)<=n)goto a;
c+=60;
}c=-1;
a:
std::cout<<c<<"\n"

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){int n,m,c,i;std::cin>>n>>m>>c;for(i=0;i<99;i++){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:19: error: expected ';' at end of input
    7 | std::cout<<c<<"\n"
      |                   ^
      |                   ;
a.cc:7:19: error: expected '}' at end of input
a.cc:2:7: note: to match this '{'
    2 | main(){int n,m,c,i;std::cin>>n>>m>>c;for(i=0;i<99;i++){
      |       ^
Language: C++

int n,m,c,i;
main(){scanf("%d%d%d",&n,&m,&c);for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){scanf("%d%d%d",&n,&m,&c);for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:8: error: 'scanf' was not declared in this scope
    2 | main(){scanf("%d%d%d",&n,&m,&c);for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |        ^~~~~
a.cc:2:86: error: 'printf' was not declared in this scope
    2 | main(){scanf("%d%d%d",&n,&m,&c);for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                                                                                      ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int n,m,c,i;
Language: C++

#import<iostream>
n,m,c,i;main(){std::cin<<n<<m<<c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}

Compiler output:
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<iostream>
      |  ^~~~~~
a.cc:2:1: error: 'n' does not name a type
    2 | n,m,c,i;main(){std::cin<<n<<m<<c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      | ^
a.cc:2:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | n,m,c,i;main(){std::cin<<n<<m<<c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |         ^~~~
a.cc: In function 'int main()':
a.cc:2:26: error: 'n' was not declared in this scope
    2 | n,m,c,i;main(){std::cin<<n<<m<<c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                          ^
a.cc:2:29: error: 'm' was not declared in this scope; did you mean 'tm'?
    2 | n,m,c,i;main(){std::cin<<n<<m<<c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                             ^
      |                             tm
a.cc:2:32: error: 'c' was not declared in this scope
    2 | n,m,c,i;main(){std::cin<<n<<m<<c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                                ^
a.cc:2:38: error: 'i' was not declared in this scope
    2 | n,m,c,i;main(){std::cin<<n<<m<<c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                                      ^
Language: C++

#import<iostream>
n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}

Compiler output:
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<iostream>
      |  ^~~~~~
a.cc:2:1: error: 'n' does not name a type
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      | ^
a.cc:2:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |         ^~~~
a.cc: In function 'int main()':
a.cc:2:26: error: 'n' was not declared in this scope
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                          ^
a.cc:2:29: error: 'm' was not declared in this scope; did you mean 'tm'?
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                             ^
      |                             tm
a.cc:2:32: error: 'c' was not declared in this scope
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                                ^
a.cc:2:38: error: 'i' was not declared in this scope
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                                      ^
Language: C++

#include<iostream>
n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}

Compiler output:
a.cc:2:1: error: 'n' does not name a type
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      | ^
a.cc:2:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |         ^~~~
a.cc: In function 'int main()':
a.cc:2:26: error: 'n' was not declared in this scope
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                          ^
a.cc:2:29: error: 'm' was not declared in this scope; did you mean 'tm'?
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                             ^
      |                             tm
a.cc:2:32: error: 'c' was not declared in this scope
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                                ^
a.cc:2:38: error: 'i' was not declared in this scope
    2 | n,m,c,i;main(){std::cin>>n>>m>>c;for(i=0;i<99;i++){if(c%(n+m)<=n)goto a;c+=60;}c=-1;a:printf("%d\n",c);}
      |                                      ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

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

	int a, b, c; cin >> a >> b >> c;
	int t = 1, t_ans = 0;
	int i = 1, or = 0;
	while (1)
	{
		if (a + b == 60 && t_ans > 5) 
		{
			printf("-1\n"); 
			break;
		}
		if (t == 60){ t = 0; t_ans++; }
		t++;
		if (i == a && or == 0){ i = 0; or = 1; }
		else if (i == b && or == 1){ i = 0; or = 1; }
		else if (i <= b && or == 0 && t == c)
		{ 
			printf("%d\n", (60 * t_ans) + c); 
			break;
		}
		i++;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:20: error: expected unqualified-id before 'or' token
   29 |         int i = 1, or = 0;
      |                    ^~
a.cc:39:31: error: expected primary-expression before 'or' token
   39 |                 if (i == a && or == 0){ i = 0; or = 1; }
      |                               ^~
a.cc:39:34: error: expected primary-expression before '==' token
   39 |                 if (i == a && or == 0){ i = 0; or = 1; }
      |                                  ^~
a.cc:39:48: error: expected primary-expression before 'or' token
   39 |                 if (i == a && or == 0){ i = 0; or = 1; }
      |                                                ^~
a.cc:39:51: error: expected primary-expression before '=' token
   39 |                 if (i == a && or == 0){ i = 0; or = 1; }
      |                                                   ^
a.cc:40:36: error: expected primary-expression before 'or' token
   40 |                 else if (i == b && or == 1){ i = 0; or = 1; }
      |                                    ^~
a.cc:40:39: error: expected primary-expression before '==' token
   40 |                 else if (i == b && or == 1){ i = 0; or = 1; }
      |                                       ^~
a.cc:40:53: error: expected primary-expression before 'or' token
   40 |                 else if (i == b && or == 1){ i = 0; or = 1; }
      |                                                     ^~
a.cc:40:56: error: expected primary-expression before '=' token
   40 |                 else if (i == b && or == 1){ i = 0; or = 1; }
      |                                                        ^
a.cc:41:36: error: expected primary-expression before 'or' token
   41 |                 else if (i <= b && or == 0 && t == c)
      |                                    ^~
a.cc:41:39: error: expected primary-expression before '==' token
   41 |                 else if (i <= b && or == 0 && t == c)
      |                                       ^~
Language: C++

def solve(a, b, c):
    l = 0; r = a;
    for t in range(114514):
        t = l // 60
        p = 60*t + c
        if l <= p <= r:
            print(p)
            exit()

        l = r + b
        r = l + a

    print(-1)

a, b, c = map(int, input().split())
solve(a,b,c)

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def solve(a, b, c):
      | ^~~
a.cc:2:12: error: 'r' does not name a type
    2 |     l = 0; r = a;
      |            ^
a.cc:3:5: error: expected unqualified-id before 'for'
    3 |     for t in range(114514):
      |     ^~~
Language: C++

def solve(a, b, c):
    l = 0; r = a;
    for t in range(80):
        t = l // 60
        p = 60*t + c
        if l <= p <= r:
            print(p)
            exit()

        l = r + b
        r = l + a

    print(-1)

a, b, c = map(int, input().split())
solve(a,b,c)

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def solve(a, b, c):
      | ^~~
a.cc:2:12: error: 'r' does not name a type
    2 |     l = 0; r = a;
      |            ^
a.cc:3:5: error: expected unqualified-id before 'for'
    3 |     for t in range(80):
      |     ^~~
Language: C++

// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  int b += a;
  for (int i = c; i <= b * c; i += 60) {
    if (i % b <= a) {
      cout << i << endl;
      return;
    }
  }
  cout << -1 << endl;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:43:9: error: expected initializer before '+=' token
   43 |   int b += a;
      |         ^~
Language: C++

#include<iostream>
using namespace std;

//??????????????§
int a,b,c;

//???????§?????????????
int start;

//????????£?????????
int time;

//?????????????????????????????????
bool can;

int main() {
	//??\???
	cin>>a>>b>>c;

	//?????????
	can=false;
	start=0;
	time=0;

	do {
		//????????????????????????
		if(start<=c && c<=start+a){
			time+=(c-start);
			can=true;
			break;
		}

		//??????????????????????¬???????????????????
		start+=(a+b);
		start%=60;

		time+=(a+b);
	}while(start!=0);

	//??????
	if(can)cout<<time<<endl;
	else   cout<<-1<<endl;

	return 0;
}

Compiler output:
a.cc:11:5: error: 'int time' redeclared as different kind of entity
   11 | int time;
      |     ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:23:13: error: assignment of function 'time_t time(time_t*)'
   23 |         time=0;
      |         ~~~~^~
a.cc:28:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |                         time+=(c-start);
      |                         ~~~~^~~~~~~~~~~
a.cc:28:29: error: assignment of read-only location 'time'
a.cc:37:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |                 time+=(a+b);
      |                 ~~~~^~~~~~~
a.cc:37:21: error: assignment of read-only location 'time'
Language: C++

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

#define rep(i,b) for(int i=0;i<(b);++i)
typedef pair<int,int> pii;
int h,w;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int dp[55][55][4];
vector<string> v;
bool check(int a,int b){
    if(0<=a&&a<h&&0<=b&&b<w) return true;
    return false;
}
int foo(int a,int b,int c){
    if(!check(a,b)) return 0;
    if(dp[a][b][c]>=0) return dp[a][b][c];
    dp[a][b][c]=0;
    int ret=0;
    if(v[a][b]=='G'){
        return dp[a][b][c]=1;
    }
    rep(k,4){
        int cc=(c-1+k+4)%4;
        if(v[a+dy[cc]][b+dx[cc]]!='#'){
            ret=foo(a+dy[cc],b+dx[cc],cc);
            break;
        }    
    }
    return dp[a][b][c]=ret;
}   

int main(){
    cin>>h>>w;
    v=vector<string>(h+2);
    rep(i,h) cin>>v[i+1];
    v[0]=v[h+1]=string(w+2,'#');
    reep(i,1,h+1){
        v[i]="#"+v[i]+"#";
    }
    h+=2;
    w+=2;
    char y[]="<^>v";
    pii pos;
    int vec;
    rep(i,h){
        rep(j,w){
            rep(k,4) if(v[i][j]==y[k]) pos=pii(i,j),vec=3-k,v[i][j]='.';
        }
    }
    rep(i,55) rep(j,55) rep(k,4) dp[i][j][k]=-1;
    foo(pos.first,pos.second,vec);
    set<pii> se;
    pii gg;
    rep(i,55){
        rep(j,55){
            if(check(i,j)&&v[i][j]=='G') gg=pii(i,j);
            rep(k,4){
                if(dp[i][j][k]==1) se.insert(pii(i,j));
            }
        }
    }
    if(se.find(gg)==se.end()) cout<<-1<<endl;
    else cout<<se.size()<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:10: error: 'i' was not declared in this scope
   38 |     reep(i,1,h+1){
      |          ^
a.cc:38:5: error: 'reep' was not declared in this scope; did you mean 'rep'?
   38 |     reep(i,1,h+1){
      |     ^~~~
      |     rep
Language: C++

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

constexpr int MAX_SIZE = 50;
constexpr int dx[] = {0, 1, 0, -1};
constexpr int dy[] = {-1, 0, 1, 0};

bool visited[MAX_SIZE + 2][MAX_SIZE + 2];
bool used[MAX_SIZE + 2][MAX_SIZE + 2][4];

int solve() {
	int dir[128];
	memset(dir, -1, sizeof(dir));
	dir['^'] = 0;
	dir['>'] = 1;
	dir['v'] = 2;
	dir['<'] = 3;

	int h, w;
	cin >> h >> w;

	int x, y, d;
	vector<string> field(h + 2, string(w + 2, '#'));

	for(int i = 1; i <= h; ++i) {
		string s;
		cin >> s;
		field[i] = '#' + move(s) + '#';

		for(int j = 1; j <= h; ++j) {
			if(dir[field[i][j]] != -1) {
				x = j;
				y = i;
				d = dir[field[i][j]];
			}
		}
	}

	int ans = 0;
	while(!used[y][x][d]) {
		used[y][x][d] = true;

		if(!visited[y][x]) {
			visited[y][x] = true;
			++ans;
		}

		if(field[y][x] == 'G') return ans;

		const int right = (d + 1) & 0x3;
		if(field[y + dy[right]][x + dx[right]] != '#') {
			d = right;
			x += dx[d];
			y += dy[d];
		}
		else if(field[y + dy[d]][x + dx[d]] == '#') {
			d = (d + 3) & 0x3;
		}
		else {
			x += dx[d];
			y += dy[d];
		}
	}
	return -1;
}

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

	cout << solve() << endl;

	return EXIT_SUCCESS;
}

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

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  char g[52][53];
  fill(g[0],g[52],'#');
  int y,x,d;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=M;j++){
      cin>>g[i][j];
      if(g[i][j]=='^'){
	d=0;
	y=i;
	x=j;
      }else if(g[i][j]=='>'){
	d=1;
	y=i;
	x=j;
      }else if(g[i][j]=='v'){
	d=2;
	y=i;
	x=j;
      }else if(g[i][j]=='<'){
	d=3;
	y=i;
	x=j;
      }
    }
  }
  bool u[52][52][4]={};
  for(;;){
    if(u[y][x][d]++)break;
    if(g[y][x]=='G')break;
    const static int dy[]={-1,0,1,0};
    const static int dx[]={0,1,0,-1};
    const static int rdy[]={-1,1,1,-1};
    const static int rdx[]={1,1,-1,-1};
    int ny=y+dy[d];
    int nx=x+dx[d];
    int ry=y+rdy[d];
    int rx=x+rdx[d];
    if(g[ny][nx]=='#'){
      d=(d+3)%4;
    }else if(g[ry][rx]=='#'){
      y=ny;
      x=nx;
    }else{
      u[ny][nx][d]=true;
      y=dy;
      x=dx;
      if(g[ny][nx]=='G')break;
      y=ry;
      x=rx;
      d=(d+1)%4;
    }
  }
  int ans=0;
  if(g[y][x]=='G'){
    for(int i=1;i<=N;i++){
      for(int j=1;j<=M;j++){
	ans+=find(u[i][j],u[i][j+1],true)!=u[i][j+1];
      }
    }
  }else{
    ans=-1;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   36 |     if(u[y][x][d]++)break;
      |        ~~~~~~~~~^
a.cc:53:9: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   53 |       y=dy;
      |         ^~
      |         |
      |         const int*
a.cc:54:9: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   54 |       x=dx;
      |         ^~
      |         |
      |         const int*
Language: C++

//#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<queue>
#include<set>
using namespace std;
typedef pair<int,int> XY;
struct P{
  int x,y,d;
  set<XY> s;
  P(){}
  P(int x,int y,int d,set<XY> s):x(x),y(y),d(d),s(s){}
};
 
string st[52];
int n,m;
 
int main(){
  cin >> n >> m;
  int i,j,k;
  for(j=0;j<m+2;j++){
    st[0]+="#";
    st[n+1]+="#";
  }
  P p,b;
  for(i=1;i<=n;i++){
    cin >> st[i];
    for(j=0;j<m;j++){
      if(st[i][j]=='^'){
	p.x=j+1;p.y=i;p.d=0;st[i][j]='.';
      }
      if(st[i][j]=='>'){
	p.x=j+1;p.y=i;p.d=1;st[i][j]='.';
      }
      if(st[i][j]=='v'){
	p.x=j+1;p.y=i;p.d=2;st[i][j]='.';
      }
      if(st[i][j]=='<'){
	p.x=j+1;p.y=i;p.d=3;st[i][j]='.';
      }
    }
    st[i]="#"+st[i]+"#";
  }
 
  //for(i=0;i<=n+1;i++) cout << st[i] << endl;
 
  int ax[]={0,1,0,-1};
  int ay[]={-1,0,1,0};
  
  int rx[]={1,1,-1,-1};
  int ry[]={-1,1,1,-1};
 
  bool f=false;
  int o;
  int inf = 1 << 20;
  bool used[55][55][4];
  //fill(used[0][0],used[54][54],inf);
  memset(used,false,sizeof(used));
  //priority_queue<P,vector<P>,greater<P> > q;
  queue<P> q;
  p.s.clear();
  q.push(p);
  while(!q.empty()){
    p=q.front();q.pop();    
    //cout << p.y <<":"<< p.x <<"/"<< p.d << ":"<<p.s.size()<<endl;
    //cout << used[p.y][p.x][p.d]<<":"<<p.s.size()<<endl;
    if(used[p.y][p.x][p.d]) continue;
    used[p.y][p.x][p.d]=true;

    p.s.insert(XY(p.x,p.y));
  
    if(st[p.y][p.x]=='G') {
      f=true;
      o=p.s.size();
      break;
    }
    if(st[p.y+ry[p.d]][p.x+rx[p.d]]!='#') {
      p.s.insert(XY(p.x+ax[p.d],p.y+ay[p.d]));
      q.push(P(p.x+rx[p.d],p.y+ry[p.d],(p.d+1)%4,p.s));  
    }else if(st[p.y+ay[p.d]][p.x+ax[p.d]]!='#') q.push(P(p.x+ax[p.d],p.y+ay[p.d],p.d,p.s));
    else q.push(P(p.x,p.y,(p.d+3)%4,p.s));
  }
  if(f){
    cout << o << endl;
  }
  else cout << -1 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:3: error: 'memset' was not declared in this scope
   58 |   memset(used,false,sizeof(used));
      |   ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<set>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
 
using vd=vector<double>;
using vvd=vector<vd>;
 
 
int main(){
    int h,w;
    cin>>h>>w;
    vvi f(h+2,vi(w+2,1));
    vvi walk(h+2,vi(w+2,0));
    int gy,gx,y=0,x=0,v=0;
    range(i,1,h+1)range(j,1,w+1){
        char c;
        cin>>c;
        switch(c){
            case 'G': gy=i,gx=j,f[i][j]=0; break;
            case '.': f[i][j]=0;break;
            case '#': break;
            case '^': y=i,x=j,v=0,f[i][j]=0; break;
            case '>': y=i,x=j,v=1,f[i][j]=0; break;
            case 'v': y=i,x=j,v=2,f[i][j]=0; break;
            case '<': y=i,x=j,v=3,f[i][j]=0; break;
        }
    }
    walk[y][x]=1;
    rep(loop,(2650+2660)/2){
        vvi vec={{-1,0},{0,1},{1,0},{0,-1}};
        if(f[y+vec[(v+1)%4][0]][x+vec[(v+1)%4][1]]==0){
            v=(v+1)%4;
            y+=vec[v][0], x+=vec[v][1];
            walk[y][x]=1;
        }else if(f[y+vec[v][0]][x+vec[v][1]]==1){
            v=(v+3)%4;
        }else
            //cout<<"zako";
            y+=vec[v][0],x+=vec[v][1];
            walk[y][x]=1;
        }
        if(y==gy&&x==gx){
            break;
        }
    }
    if(y==gy&&x==gx){
        int ans=0;
        rep(i,h+2)rep(j,w+2)ans+=walk[i][j];
        cout<<ans<<endl;
    }else cout<<-1<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:13: error: break statement not within loop or switch
   61 |             break;
      |             ^~~~~
a.cc: At global scope:
a.cc:64:5: error: expected unqualified-id before 'if'
   64 |     if(y==gy&&x==gx){
      |     ^~
a.cc:68:6: error: expected unqualified-id before 'else'
   68 |     }else cout<<-1<<endl;
      |      ^~~~
a.cc:69:5: error: expected unqualified-id before 'return'
   69 |     return 0;
      |     ^~~~~~
a.cc:70:1: error: expected declaration before '}' token
   70 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
 
using vd=vector<double>;
using vvd=vector<vd>;
 
 
int main(){
    int h,w;
    cin>>h>>w;
    vvi f(h+2,vi(w+2,1));
    vvi walk(h+2,vi(w+2,0));
    int gy,gx,y=0,x=0,v=0;
    range(i,1,h+1)range(j,1,w+1){
        char c;
        cin>>c;
        switch(c){
            case 'G': gy=i,gx=j,f[i][j]=0; break;
            case '.': f[i][j]=0;break;
            case '#': break;
            case '^': y=i,x=j,v=0,f[i][j]=0; break;
            case '>': y=i,x=j,v=1,f[i][j]=0; break;
            case 'v': y=i,x=j,v=2,f[i][j]=0; break;
            case '<': y=i,x=j,v=3,f[i][j]=0; break;
        }
    }
    walk[y][x]=1;
    rep(loop,(2660+2670)/2){
        vvi vec={{-1,0},{0,1},{1,0},{0,-1}};
        if(f[y+vec[(v+1)%4][0]][x+vec[(v+1)%4][1]]==0){
            v=(v+1)%4;
            y+=vec[v][0], x+=vec[v][1];
            walk[y][x]=1;
        }else if(f[y+vec[v][0]][x+vec[v][1]]==1){
            v=(v+3)%4;
        }else
            //cout<<"zako";
            y+=vec[v][0],x+=vec[v][1];
            walk[y][x]=1;
        }
        if(y==gy&&x==gx){
            break;
        }
    }
    if(y==gy&&x==gx){
        int ans=0;
        rep(i,h+2)rep(j,w+2)ans+=walk[i][j];
        cout<<ans<<endl;
    }else cout<<-1<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:13: error: break statement not within loop or switch
   61 |             break;
      |             ^~~~~
a.cc: At global scope:
a.cc:64:5: error: expected unqualified-id before 'if'
   64 |     if(y==gy&&x==gx){
      |     ^~
a.cc:68:6: error: expected unqualified-id before 'else'
   68 |     }else cout<<-1<<endl;
      |      ^~~~
a.cc:69:5: error: expected unqualified-id before 'return'
   69 |     return 0;
      |     ^~~~~~
a.cc:70:1: error: expected declaration before '}' token
   70 | }
      | ^
Language: C++

using namespace std;
typedef long long int ll;
struct Point{
  ll x,y,z;
  Point(){};
  Point(ll x,ll y,ll z):x(x),y(y),z(z){}
  Point operator+(Point p){
    return Point(x+p.x,y+p.y,z+p.z);
  }
  Point operator-(Point p){
    return Point(x-p.x,y-p.y,z-p.z);
  }
};
ll dot(Point a,Point b){
  return (a.x*b.x+a.y*b.y+a.z*b.z);
}
struct ball{
  Point p;
  ll r,l;
};
typedef Point Vector;
int check(ball ba,Point x,Point y){
  ll z=0;
  Vector v=y-x,c=ba.p-x;
  if(dot(v,c)<=0){
    if(dot(c,c)<=ba.r*ba.r) z=ba.l;
  }else{
    if(dot(v,c)>dot(v,v)){
      if(dot(ba.p-y,ba.p-y)<=ba.r*ba.r) z=ba.l;
    }else{
      if(dot(c,c)*dot(v,v)-(dot(v,c)*dot(v,c))<=ba.r*ba.r*dot(v,v))  z=ba.l;
    }
  }
  return z;
}
int main(){
  ll n,q;
  cin >> n >> q;
  ball bs[51];
  int i,j,k;
  
  ll x,y,z;
  for(i=0;i<n;i++){
    cin >>  x >>  y >>  z >> bs[i].r >> bs[i].l;
    bs[i].p=Point(x,y,z);
  }
  for(i=0;i<q;i++){
    Point p,b;
    cin >> x >> y >> z;
    p=Point(x,y,z);
    cin >> x >> y >> z;
    b=Point(x,y,z);
    ll o=0;
    for(j=0;j<n;j++){
      o+=check(bs[j],p,b);
    }
    cout << o << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:3: error: 'cin' was not declared in this scope
   38 |   cin >> n >> q;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:57:5: error: 'cout' was not declared in this scope
   57 |     cout << o << endl;
      |     ^~~~
a.cc:57:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:57:18: error: 'endl' was not declared in this scope
   57 |     cout << o << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <iostream>
using namespace std;
int n,qc,x[51],y[51],z[51],rl[51];
double dx,dy,dz,sx,sy,sz,a,b,c,p,q,r;
long long int l[51],sum;
double t,lt;
int main(){
	cin >>n >>qc;
	for(int i=0;i<n;i++){
		cin >>x[i] >>y[i] >>z[i] >>rl[i] >>l[i];
	}
	for(int i=0;i<qc;i++){
		sum=0;
		cin >>sx >>sy >>sz >>dx >>dy >>dz;
		a=dx-sx;
		b=dy-sy;
		c=dz-sz;
		for(int j=0;j<n;j++){
			p=sx-x[j];
			q=sy-y[j];
			r=sz-z[j];
			t=-(a*p+b*q+c*r)/(a*a+b*b+c*c);
			if(t>1){
				t=1;
			}else if(t<0){
				t=0
			}
			lt=(t*a+p)*(t*a+p)+(t*b+q)*(t*b+q)+(t*c+r)*(t*c+r);
			
			if(lt<=rl[j]*rl[j])sum+=l[j];
			//cout <<t <<endl;
			//cout <<lt <<endl;
			//cout <<rl[j] <<endl;
		}
		cout <<" sum is "<<sum <<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: expected ';' before '}' token
   26 |                                 t=0
      |                                    ^
      |                                    ;
   27 |                         }
      |                         ~
Language: C++

#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
ll in(int a, int b, int c, int d, int e, int f) {
	return a*d + b*e + c*f;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q;
	cin >> n >> q;
	vl x(n), y(n), z(n),r(n),l(n);
	REP(i, n)cin >> x[i] >> y[i] >> z[i] >>r[i] >>l[i];
	int sx, sy, sz, dx, dy, dz;
	REP(i, q) {
		cin >> sx >> sy >> sz >> dx >> dy >> dz;
		int vx = dx - sx, vy = dy - sy, vz = dz - sz;
		ll ans = 0;
		REP(j, n) {
			int a = sx - x[j], b = sy - y[j], c = sz - z[j];
			ll D = in(a, b, c, vx, vy, vz)*in(a, b, c, vx, vy, vz) - in(vx, vy, vz, vx, vy, vz)*(in(a, b, c, a, b, c) - r[j] * r[j]);
			if (D >=0 && (-in(a,b,c, vx, vy, vz) > EPS + sqrt(D)|| -in(a, b, c, vx, vy, vz) > EPS - sqrt(D))))ans += l[j];
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:122: error: expected primary-expression before ')' token
   50 |                         if (D >=0 && (-in(a,b,c, vx, vy, vz) > EPS + sqrt(D)|| -in(a, b, c, vx, vy, vz) > EPS - sqrt(D))))ans += l[j];
      |                                                                                                                          ^
Language: Java

import java.util.*;

public class Dinner {
	public static void main(String[] args) {
		new Dinner().solver();
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int P = sc.nextInt();
		int Q = sc.nextInt();
		int[] C = new int[N];
		for (int i = 0; i < N; i++) {
			C[i] = sc.nextInt();
		}
		int[] a = new int[N];// ?£??????§????????????????????£??????
		for (int i = 0; i < N; i++) {
			a[i] = C[i] + i * P;
		}
		Arrays.sort(a);
		for (int i = 1; i < N; i++) {
			a[i] += a[i - 1];
		}
		long ans = -(1L << 60);
		long diff = N * (N - 1) * P / 2;
		// i:?£??????§?£??????????????????°???
		for (int i = 0; i < N; i++) {
			ans = Math.max(ans, a[i] + P * (N - i) * (Q + Q + N - i - 1) / 2 - diff);
		}
		System.out.println(ans);
	}
}

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

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		new Dinner().Main();
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long P = sc.nextLong();
		long Q = sc.nextLong();
		long[] C = new long[(int)N];
		for (int i = 0; i < N; i++) {
			C[i] = sc.nextInt();
		}
		Long[] a = new Long[(int)N];
		for (int i = 0; i < N; i++) {
			a[i] = C[i] + i * P;
		}
		Arrays.sort(a, new Comparator<Long>() {
			@Override
			public int compare(Long o1, Long o2) {
				return -Long.compare(o1, o2);
			}
		});
		for (int i = 1; i < N; i++) {
			a[i] += a[i - 1];
		}
		long ans = P * N * (2 * Q + N - 1) / 2;
		long diff = N * (N - 1) * P / 2;
		// i + 1:?£??????§?£??????????????????°???
		for (int i = 0; i < N; i++) {
			ans = Math.max(ans, a[i] + P * (N - (i + 1)) * (2 * Q + 2 * (N - (i + 1) - 1)) / 2 - diff);
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:7: error: cannot find symbol
		new Dinner().Main();
		    ^
  symbol:   class Dinner
  location: class Main
1 error
Language: C

const int MAXN = 500500;
int C[MAXN];

int main() {
    int N;
    ll P, Q;
    cin >> N >> P >> Q;
    ll sum = 0;
    vector<pair<ll, int> > ps;
    for (int i = 0; i < N; i++) {
        cin >> C[i];
        sum += C[i];
        ps.emplace_back(C[i]+P*i, i);
    }
    sort(ps.begin(), ps.end());
    ll ans = -1ll<<55;
    for (int i = 0; i <= N; i++) {
        ans = max(ans, sum+P*i*(i-1)+P*Q*i);
        if (i < N) {
            sum -= C[ps[i].second] + P*ps[i].second;
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
main.c:2:5: error: variably modified 'C' at file scope
    2 | int C[MAXN];
      |     ^
main.c: In function 'main':
main.c:6:5: error: unknown type name 'll'
    6 |     ll P, Q;
      |     ^~
main.c:7:5: error: 'cin' undeclared (first use in this function)
    7 |     cin >> N >> P >> Q;
      |     ^~~
main.c:7:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:5: error: unknown type name 'll'
    8 |     ll sum = 0;
      |     ^~
main.c:9:5: error: 'vector' undeclared (first use in this function)
    9 |     vector<pair<ll, int> > ps;
      |     ^~~~~~
main.c:9:12: error: 'pair' undeclared (first use in this function)
    9 |     vector<pair<ll, int> > ps;
      |            ^~~~
main.c:9:17: error: 'll' undeclared (first use in this function)
    9 |     vector<pair<ll, int> > ps;
      |                 ^~
main.c:9:21: error: expected expression before 'int'
    9 |     vector<pair<ll, int> > ps;
      |                     ^~~
main.c:13:9: error: 'ps' undeclared (first use in this function)
   13 |         ps.emplace_back(C[i]+P*i, i);
      |         ^~
main.c:15:5: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   15 |     sort(ps.begin(), ps.end());
      |     ^~~~
main.c:16:7: error: expected ';' before 'ans'
   16 |     ll ans = -1ll<<55;
      |       ^~~~
      |       ;
main.c:18:9: error: 'ans' undeclared (first use in this function)
   18 |         ans = max(ans, sum+P*i*(i-1)+P*Q*i);
      |         ^~~
main.c:18:15: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   18 |         ans = max(ans, sum+P*i*(i-1)+P*Q*i);
      |               ^~~
main.c:23:5: error: 'cout' undeclared (first use in this function)
   23 |     cout << ans << endl;
      |     ^~~~
main.c:23:20: error: 'endl' undeclared (first use in this function)
   23 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include <iostream>
#include <functional>
#include <vector>
using namespace std;

int ans = -500000, N, P, Q;
int C[500000];
vector < pair < int, int > > pairs;

int cook_k_times(int k, int Q, int P){ //k回自炊する場合
    int H = 0; //幸福度
    int Q_buff = Q;
    bool label[500000]={}; //ラベル

    for(int i = 0; i < k; ++i) label[pairs[i].second] = true;

    for(int i = 0; i < N; ++i){
        if(label[i]){ //自炊
            H += P * Q_buff;
            Q_buff++;
        } else { //外食
            H += C[i];
            Q_buff--;
        }
    }
    return H;
}

int main(){
    cin >> N >> P >> Q;

    for(int i = 0; i < N; ++i){
        cin >> C[i];
        pairs.push_back(make_pair(C[i], i));
    }

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

    // cout << "N: " << N << ", P: " << P << ", Q: " << Q  << endl;

    // for(int i = 0; i < N; ++i) cout << "(C, index) = (" << pairs[i].first << ", " << pairs[i].second << ")" << endl;

    for(int i = 0; i <= N; ++i){
        ans = max(ans, cook_k_times(i, Q, P));
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   37 |     sort(pairs.begin(), pairs.end());
      |     ^~~~
      |     short
Language: C++

const int MAXN = 500500;
int C[MAXN];

int main() {
    int N;
    ll P, Q;
    cin >> N >> P >> Q;
    ll sum = 0;
    vector<pair<ll, int> > ps;
    for (int i = 0; i < N; i++) {
        cin >> C[i];
        sum += C[i];
        ps.emplace_back(C[i]+P*i, i);
    }
    sort(ps.begin(), ps.end());
    ll ans = -1ll<<55;
    for (int i = 0; i <= N; i++) {
        ans = max(ans, sum+P*i*(i-1)+P*Q*i);
        if (i < N) {
            sum -= C[ps[i].second] + P*ps[i].second;
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'll' was not declared in this scope
    6 |     ll P, Q;
      |     ^~
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> N >> P >> Q;
      |     ^~~
a.cc:7:17: error: 'P' was not declared in this scope
    7 |     cin >> N >> P >> Q;
      |                 ^
a.cc:7:22: error: 'Q' was not declared in this scope
    7 |     cin >> N >> P >> Q;
      |                      ^
a.cc:8:7: error: expected ';' before 'sum'
    8 |     ll sum = 0;
      |       ^~~~
      |       ;
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<pair<ll, int> > ps;
      |     ^~~~~~
a.cc:9:12: error: 'pair' was not declared in this scope
    9 |     vector<pair<ll, int> > ps;
      |            ^~~~
a.cc:9:21: error: expected primary-expression before 'int'
    9 |     vector<pair<ll, int> > ps;
      |                     ^~~
a.cc:12:9: error: 'sum' was not declared in this scope
   12 |         sum += C[i];
      |         ^~~
a.cc:13:9: error: 'ps' was not declared in this scope
   13 |         ps.emplace_back(C[i]+P*i, i);
      |         ^~
a.cc:15:10: error: 'ps' was not declared in this scope
   15 |     sort(ps.begin(), ps.end());
      |          ^~
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(ps.begin(), ps.end());
      |     ^~~~
      |     short
a.cc:16:7: error: expected ';' before 'ans'
   16 |     ll ans = -1ll<<55;
      |       ^~~~
      |       ;
a.cc:18:9: error: 'ans' was not declared in this scope
   18 |         ans = max(ans, sum+P*i*(i-1)+P*Q*i);
      |         ^~~
a.cc:18:24: error: 'sum' was not declared in this scope
   18 |         ans = max(ans, sum+P*i*(i-1)+P*Q*i);
      |                        ^~~
a.cc:18:15: error: 'max' was not declared in this scope
   18 |         ans = max(ans, sum+P*i*(i-1)+P*Q*i);
      |               ^~~
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout << ans << endl;
      |     ^~~~
a.cc:23:13: error: 'ans' was not declared in this scope
   23 |     cout << ans << endl;
      |             ^~~
a.cc:23:20: error: 'endl' was not declared in this scope
   23 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long a[900000],c[900000],x[900000],n,p,q,sum,maxn;
int main() {
    cin>>n>>p>>q;c[0]=p*q;
    for(int i=0;i<n;i++){cin>>a[i];a[i]-=(q-i)*p;sum+=b[i];}
    sort(a,a+n);maxn=sum;
    for(int i=0;i<n;i++){
        sum-=a[i];
        sum+=2*i*p;
        maxn=max(sum,maxn);
    }
    cout<<maxn<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:55: error: 'b' was not declared in this scope
    6 |     for(int i=0;i<n;i++){cin>>a[i];a[i]-=(q-i)*p;sum+=b[i];}
      |                                                       ^
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <functional>
#include <queue>
#include <tuple>
#include <cstring>
#include <iomanip>

using namespace std;

#define rep(i,n) for(int i = 0;i < n;i++)
#define each(i,n) for(auto i : n)
#define all(n) n.begin(),n.end()
#define clr(n) memset(n,0,sizeof(n))
#define mclr(n) memset(n,-1,sizeof(n))

int main() {
	int n, p, q;
	cin >> n >> p >> q;
	vector<int> c(n);
	int dif = 0, sum = 0;;
	rep(i, n) {
		cin >> c[i];
		c[i] += i * p;
		dif += i * p;
		sum += c[i];
	}
	sort(all(c));
	int ans = sum - dif;
	rep(i, n) {
		sum -= c[i];
		sum += (q + i * 2) * p;
		ans = max(ans, sum - dif);
	}
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |         sort(all(c));
      |         ^~~~
      |         short
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N, P, Q;
  int C[500000];
  cin >> N >> P >> Q;
  for(int i=0;i<N;i++) cin >> C[i];
  int x[500001]={}, y[500001]={};
  y[0]=P*Q;
  y[1]=C[0];
  
  for(int i=1;i<N;i++){
    for(int k=0;k<500001;k++) x[k]=y[k];
    y[0]=x[0]+P*(Q+i);
    for(int j=1;j<=i;j++){
      int shokudo,jisui;
      shokudo=x[j-1]+C[i];
      jisui=x[j]+P*(Q+i-j*2);
      y[j]=max(shokudo,jisui);
    }
    y[i+1]=x[i]+C[i];
  }

  sort(y,y+(N+1));
  cout << y[N] << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |   sort(y,y+(N+1));
      |   ^~~~
      |   short
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N, P, Q;
  int C[500000];
  cin >> N >> P >> Q;
  for(int i=0;i<N;i++) cin >> C[i];
  int x[500001], y[500001];
  y[0]=P*Q;
  y[1]=C[0];
  
  for(int i=1;i<N;i++){
    for(int k=0;k<500001;k++) x[k]=y[k];
    y[0]=x[0]+P*(Q+i);
    for(int j=1;j<=i;j++){
      int shokudo,jisui;
      shokudo=x[j-1]+C[i];
      jisui=x[j]+P*(Q+i-j*2);
      y[j]=max(shokudo,jisui);
    }
    y[i+1]=x[i]+C[i];
  }

  sort(y,y+(N+1));
  cout << y[N] << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |   sort(y,y+(N+1));
      |   ^~~~
      |   short
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N, P, Q;
  int C[500000];
  cin >> N >> P >> Q;
  for(int i=0;i<N;i++) cin >> C[i];
  int x[500001]={};
  int y[500001]={};
  y[0]=P*Q;
  y[1]=C[0];
  
  for(int i=1;i<N;i++){
    for(int k=0;k<500001;k++) x[k]=y[k];
    y[0]=x[0]+P*(Q+i);
    for(int j=1;j<=i;j++){
      int shokudo,jisui;
      shokudo=x[j-1]+C[i];
      jisui=x[j]+P*(Q+i-j*2);
      y[j]=max(shokudo,jisui);
    }
    y[i+1]=x[i]+C[i];
  }

  sort(y,y+(N+1));
  cout << y[N] << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |   sort(y,y+(N+1));
      |   ^~~~
      |   short
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N, P, Q;
  int C[500000];
  cin >> N >> P >> Q;
  for(int i=0;i<N;i++) cin >> C[i];
  int x[500001]={};
  int y[500001]={};
  y[0]=P*Q;
  y[1]=C[0];
  
  for(int i=1;i<N;i++){
    for(int k=0;k<500001;k++) x[k]=y[k];
    y[0]=x[0]+P*(Q+i);
    for(int j=1;j<=i;j++){
      int shokudo,jisui;
      shokudo=x[j-1]+C[i];
      jisui=x[j]+P*(Q+i-j*2);
      y[j]=jisui;
    }
    y[i+1]=x[i]+C[i];
  }

  sort(y,y+(N+1));
  cout << y[N] << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |   sort(y,y+(N+1));
      |   ^~~~
      |   short