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

import java.util.Scanner;

public class MainClimbMountain {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < N; i++) {
			b[i] = sc.nextInt();
		}
		System.out.println(mountainSeqNum(a, b));
	}

	private static long mountainSeqNum(int[] a, int[] b) {
		int c[] = new int[a.length];
		int pre = 0;// 上一座
		int zl[] = new int[a.length];
		for (int i = 0; i < a.length; i++) {
			if (a[i] > pre) {
				c[i] = a[i];
				pre = a[i];
			} else {
				zl[i] = pre;
			}
		}
		int behind = 0;// 反序上一座
		for (int i = b.length - 1; i > 0; i--) {
			if (b[i] > behind) {
				if (c[i] == 0) {
					c[i] = b[i];
					behind = b[i];
					zl[i] = 0;
				} else {
					// 存在值
					if (c[i] != b[i]) {// 不等于当前值
						return 0;
					}
				}
			} else {
				if (c[i] == 0) {
					if (zl[i] > behind) {
						zl[i] = behind;
					}
				} else {
					// 存在值时
					if (c[i] > b[i]) {
						return 0;
					}
				}
			}
		}
		long sum = 1;
		for (int i = 0; i < zl.length; i++) {
			if (zl[i] != 0) {
				sum = sum * zl[i];
				if (sum >= 1000000007) {
					sum %= 1000000007;
				}
			}
		}
		return sum;
	}
}


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

int n;
cin >> n;
ll tm = -1, am = -1;
ll mod = 1000000007;
vector<ll> T, A;
rep(i, n) {
	ll a;
	cin >> a;
	tm = max(a, tm);
	T.push_back(a);
}
rep(i, n) {
	ll a;
	cin >> a;
	am = max(a, am);
	A.push_back(a);
}
if (tm != am) {
	P(0);
}
else {
	ll ans = 1;
	ll mini = 1e12;
	rep(i, n) {
		if (i == 0 || i == n - 1) {
			mini = T[0];
			ans *= 1;
			ans %= mod;
		}
		else {
			if ((T[i] > T[i - 1]) || (A[i] > A[i + 1])) {
				ans *= 1;
				ans %= mod;
			}
			else {
				ans = (((abs(mini - min(A[i], T[i])) + 1) % mod)* (ans%mod)) % mod;
			}
		}
	}
	ans = ans % mod;
	P(ans%mod);
}

Compiler output:
a.cc:2:1: error: 'cin' does not name a type
    2 | cin >> n;
      | ^~~
a.cc:3:1: error: 'll' does not name a type
    3 | ll tm = -1, am = -1;
      | ^~
a.cc:4:1: error: 'll' does not name a type
    4 | ll mod = 1000000007;
      | ^~
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<ll> T, A;
      | ^~~~~~
a.cc:6:4: error: expected constructor, destructor, or type conversion before '(' token
    6 | rep(i, n) {
      |    ^
a.cc:12:4: error: expected constructor, destructor, or type conversion before '(' token
   12 | rep(i, n) {
      |    ^
a.cc:18:1: error: expected unqualified-id before 'if'
   18 | if (tm != am) {
      | ^~
a.cc:21:1: error: expected unqualified-id before 'else'
   21 | else {
      | ^~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int t[];
        t = new int[n];
        int a[];
        a = new int[n];
        int maxt = 0;
        int maxa = 0;
        int mint = 0;
        int mina = 0;
        int answer = 0;
        int c[];
        c = new int[n];
        for(int i = 0; i<n; i++){
		t[i] = sc.nextInt();
            if(maxt < t[i]){
                maxt = t[i];
            }
            else if(mint > t[i]){
                mint = t[i];
            }
            if(i>0 && t[i] != t[i-1]){
                c[i] = t[i];
            }
        }
        int cc = 1;
        for(int i = 0; i<n; i++){
		a[i] = sc.nextInt();
            if(maxa < a[i]){
                maxa = a[i];
            }
            else if(mina > a[i]){
                mina = a[i];
            }
            if(i>0 && a[i] != a[i-1]){
                c[i-1] = a[i-1];
            }
        }
        for(int i=0; i<c.length; i++){
            if(c[i] == null){
                if(t[i]>a[i]){
                    cc = cc * a[i];
                }
                else{
                    cc = cc * t[i];
                }
            }
        }
        if(maxa != maxt){
            System.out.println(answer);
        }
        else{

            System.out.println(cc);
        }
	}
}

Compiler output:
Main.java:43: error: bad operand types for binary operator '=='
            if(c[i] == null){
                    ^
  first type:  int
  second type: <null>
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int t[];
        t = new int[n];
        int a[];
        a = new int[n];
        int maxt = 0;
        int maxa = 0;
        int mint = 0;
        int mina = 0;
        int answer = 0;
        int c[];
        c = new int[n]
        for(int i = 0; i<n; i++){
		t[i] = sc.nextInt();
            if(maxt < t[i]){
                maxt = t[i];
            }
            else if(mint > t[i]){
                mint = t[i];
            }
            if(i>0 && t[i] != t[i-1]){
                c[i] = t[i];
            }
        }
        int cc = 1;
        for(int i = 0; i<n; i++){
		a[i] = sc.nextInt();
            if(maxa < a[i]){
                maxa = a[i];
            }
            else if(mina > a[i]){
                mina = a[i];
            }
            if(i>0 && a[i] != a[i-1]){
                c[i-1] = a[i-1];
            }
        }
        for(int i=0; i<c.length; i++){
            if(c[i] == null){
                if(t[i]>a[i]){
                    cc = cc * a[i];
                }
                else{
                    cc = cc * t[i];
                }
            }
        }
        if(maxa != maxt){
            System.out.println(answer);
        }
        else{

            System.out.println(cc);
        }
	}
}

Compiler output:
Main.java:16: error: ';' expected
        c = new int[n]
                      ^
1 error
Language: C++

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

int main() {
	int n_mountain;
	
	std::cin >> n_mountain;
	
	std::vector<long long> t_report(n_mountain), a_report(n_mountain), min_mountain(n_mountain);
	std::vector<bool> changed(n_mountain, false);
	changed[0] = changed[n_mountain - 1] = true;
	for(int i = 0; i < n_mountain; ++i){
		std::cin >> t_report[i];
		if(i > 0){
			if(t_report[i - 1] != t_report[i]){
				changed[i] = true;
			}
		}
	}
	for(int i = 0; i < n_mountain; ++i){
		std::cin >> a_report[i];
		if(i > 0){
			if(a_report[i - 1] != a_report[i]){
				changed[i - 1] = true;
			}
		}
	}
	
	if(t_report[n_mountain - 1] != a_report[0]{
		std::cout << 0 << std::endl;
		return 0;
	}
	
	for(int i = 0; i < n_mountain; ++i){
		min_mountain[i] = std::min(t_report[i], a_report[i]);
	}
	
	unsigned long long ans = 1;
	
	for(int i = 0; i < n_mountain; ++i){
		if(changed[i] == true) continue;
		ans *= min_mountain[i];
		ans %= 1000000007;
	}
	
	std::cout << ans % 1000000007 << std::endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:51: error: expected ')' before '{' token
   31 |         if(t_report[n_mountain - 1] != a_report[0]{
      |           ~                                       ^
      |                                                   )
a.cc:36:24: error: 'i' was not declared in this scope
   36 |         for(int i = 0; i < n_mountain; ++i){
      |                        ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >>n;
  long long c=1;
  vector<long long>mo((long long)n,0);
  vector< long long > a ((long long )n,0);
  vector< long long > b ((long long )n,0);
  long long am=0,bm=0,ami=10000000000,bmi=1000000000;

  for(int j=0;j<2;j++){
    for(int i=0;i<n;i++){
      if(j==0){
	cin >> a[i];
	am=max(am,a[i]);
	ami = min(ami,a[i]);
      }
      else{
	cin >> b[i];
	bm=max(bm,b[i]);
	bmi=min(bmi,b[i]);
      }
    }
  }
  for(int i=n/2+n%2;i<n;i++){
    if(b[i]>a[i]){
      cout << 0 <<endl;
      return 0;
    }
  }
  for(int i=0;i<n/2;i++){
    if(a[i]>b[i]){
      cout << 0 << endl;
      return 0;
    }
  }
  if(am!=bm){
    cout << 0 << endl;
    return 0;
  }
  for(int i=0;i<n;i++){
    if(i==0)mo[i]=a[i];
    else{
      if(a[i-1]==a[i])mo[i]=-1;
      else mo[i]=a[i];
    }
  }
  for(int i=n-1;i>=0;i--){
    if(i==n-1)mo[i]=b[i];
    else{
      if(mo[i]==-1){
	if(b[i+1]==b[i])mo[i]=-1;
	else mo[i]=b[i];
      }
    }
  }
  int ka;   
  for(int i=0;i<n;i++){
    if(mo[i]!=-1)continue;
    c*=min(a[i],b[i])
  }
  c%=(1000000000+7);
  cout << c << endl;
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:63:22: error: expected ';' before '}' token
   63 |     c*=min(a[i],b[i])
      |                      ^
      |                      ;
   64 |   }
      |   ~
Language: C++

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

using namespace std;

typedef long long ll;

int main(){
    vector<ll> T,A;
    int N;
    cin >> N;

    ll ans=1;
    for(int i=0;i<N;i++){
        ll in;
        cin >> in;
        T.push_back(in);
    }
    for(int i=0;i<N;i++){
        ll in;
        cin >> in;
        A.push_back(in);
    }
    
    if(N==1){
if(A.at(0)==T.at(0){
        cout << "1" << endl;}else{cout << "0" << endl;}
        return 0;
    }

    if((A.at(0)!=A.at(1)&&A.at(0)!=T.at(0))||T.at(0)>A.at(0)){
        cout << "0" << endl;
        return 0;
    }

    for(int i=1;i<N-1;i++){
        if(T.at(i-1)!=T.at(i)&&A.at(i)!=A.at(i+1)){
            if(T.at(i)!=A.at(i)){
                cout << "0" << endl;
                return 0;
            }
        }else if(T.at(i-1)==T.at(i)&&A.at(i)!=A.at(i+1)){
            if(T.at(i)<A.at(i)){
                cout << "0" <<endl;
                return 0;
            }
        }else if(T.at(i-1)!=T.at(i)&&A.at(i)==A.at(i+1)){
            if(T.at(i)>A.at(i)){
                cout <<"0" <<endl;
                return 0;
            }
        }else{
            if(T.at(i)<A.at(i)){
                ans*=T.at(i);
                ans%=1000000007;
            }else{
                ans*=A.at(i);
                ans%=1000000007;
            }
        }
    }

    if((T.at(N-2)!=T.at(N-1)&&T.at(N-1)!=A.at(N-1))||T.at(N-1)<A.at(N-1)){
        cout <<"0" << endl;
        return 0;
    }
    
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: expected ';' before '{' token
   27 | if(A.at(0)==T.at(0){
      |                    ^
      |                    ;
a.cc:28:30: error: expected primary-expression before 'else'
   28 |         cout << "1" << endl;}else{cout << "0" << endl;}
      |                              ^~~~
a.cc:28:30: error: expected ')' before 'else'
   28 |         cout << "1" << endl;}else{cout << "0" << endl;}
      |                              ^~~~
      |                              )
a.cc:27:3: note: to match this '('
   27 | if(A.at(0)==T.at(0){
      |   ^
Language: C++

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

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<ll> vi;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb push_back
#define fs first
#define sc second

const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()) out << v[i] << ", " ;
	return out << "}" << endl;
}
template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> p){
	return out << "(" << p.fs << ", " << p.sc << ")";
}
#define MOD 1000000007
int main(){
	int n;
	cin >> n;
	vi t(n), a(n);
	ll ans = 1;
	rep(i,n){
		cin >> t[i];
		if(i&&t[i]<t[i-1])ans=0;
	}
	rep(i,n){
		cin >> a[i];
		if(i&&a[i]>a[i-1])ams=0;
	}
	vi det(n);
	det[0]=t[0];
	det[n-1]=a[n-1];
	int tmp = 0;
	rep(i,n){
		if(i && t[i]!=t[i-1]){
			if(i==n-1&&t[i]!=a[i]) ans = 0;
			det[i]=t[i];
			if(tmp >= det[i])ans=0;
			tmp = det[i];
		}
		if(det[i]&&det[i]>a[i]) ans = 0;
	}
	tmp=0;
	rep(j,n){
		int i=n-1-j;
		if(i!=n-1 && a[i]!=a[i+1]){
			if(det[i]!=0 && a[i]!=det[i])ans=0;
			det[i] = a[i];
			if(tmp >= det[i]) ans=0;
			tmp = det[i];
		}
	}
	int m;
	rep(i,n){
		int l = max(t[i],a[i]);
		if(i&&m!=l)ans=0;
		m=l;
	}
	rep(i,n){
		if(!det[i]){
			ans *= min(t[i],a[i]);
			ans = ans % MOD;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:35: error: 'ams' was not declared in this scope; did you mean 'ans'?
   39 |                 if(i&&a[i]>a[i-1])ams=0;
      |                                   ^~~
      |                                   ans
Language: C++

int main()
{
cout << 0 << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:1: error: 'cout' was not declared in this scope
    3 | cout << 0 << endl;
      | ^~~~
a.cc:3:14: error: 'endl' was not declared in this scope
    3 | cout << 0 << endl;
      |              ^~~~
Language: C++

#include <iostream>
using namespace std;

int N;
int T[100005], A[100005];

int main() {
	int i, max = 0, maxMt = 0;
	ios_base::sync_with_stdio(0);

	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> T[i];
		if (T[i] > max) {
			max = T[i];
			maxMt = i;
		}
		if (T[i] < max) {
			cout << 0;
			return 0;
		}
	}

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

	max = 0;
	int maxMtA = 0;
	for (i = N - 1; i >= 0; i--) {
		if (max < A[i]) {
			max = A[i];
			maxMtA = i;
		}

		else if (max > A[i]) {
			cout << 0;
			return 0;
		}
	}
	if (maxMt > maxMtA) {
		cout << 0;
		return 0;
	}

	for (i = 0; i < N; i++) {
		if (A[i] < T[i]){
			cout << 0;
			return 0;
		}
	}

	__int64 sum = 1;

	max = 0;
	for (i = 0; i < maxMt; i++) {
		if (max < T[i]) {
			max = T[i];
		}
		else
			sum *= T[i];
		sum %= 1000000007;
	}

	max = 0;
	for (i = N - 1; i > maxMt; i--) {
		if (max < A[i]) {
			max = A[i];
		}
		else
			sum *= A[i];
		sum %= 1000000007;
	}

	cout << (sum % 1000000007) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   53 |         __int64 sum = 1;
      |         ^~~~~~~
      |         __int64_t
a.cc:61:25: error: 'sum' was not declared in this scope
   61 |                         sum *= T[i];
      |                         ^~~
a.cc:62:17: error: 'sum' was not declared in this scope
   62 |                 sum %= 1000000007;
      |                 ^~~
a.cc:71:25: error: 'sum' was not declared in this scope
   71 |                         sum *= A[i];
      |                         ^~~
a.cc:72:17: error: 'sum' was not declared in this scope
   72 |                 sum %= 1000000007;
      |                 ^~~
a.cc:75:18: error: 'sum' was not declared in this scope
   75 |         cout << (sum % 1000000007) << endl;
      |                  ^~~
Language: Java

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int BASE = 1000000007;
        int n = sc.nextInt();
        int taka[] = new int [n];
        int ao[] = new int [n];

        for(int i=0;i<n;i++){
            taka[i]= sc.nextInt();
        }
        for(int i=0;i<n;i++){
            ao[i]= sc.nextInt();
        }

        long pattern = 1;
        boolean flag = true;

        for(int i=0;i<n&&flag;i++){
            int max_t=0,min_t=0;
            int max_a=0,min_a=0;

            if(i==0){
                max_t = taka[0];
                min_t = taka[0];
            }
            else{
                if(taka[i]==taka[i-1]){
                    max_t = taka[i];
                    min_t = 1;
                }
                else {
                    max_t = taka[i];
                    min_t = taka[i];
                }
            }

            if(i==n-1){
                max_a = ao[n-1];
                min_a = ao[n-1];
            }
            else{
                if(ao[i+1]==ao[i]){
                    min_a =1;
                    max_a = ao[i];
                }
                else {
                    max_a = ao[i];
                    min_a = ao[i];
                }
            }

            if(max_t<min_a && max_a<min_t){
                flag = false;
            }
            else{
                int tmp = Math.min(max_a,max_t) - Math.max(min_a,min_t)+1;
                pattern *= tmp;
                pattern = pattern%BASE;
            }

        }

        //if(!flag) pattern = 0;

        System.out.println(pattern);


    }

Compiler output:
Main.java:72: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
int determine[200000] = {};
int changed[200000] = {};
int main() {
	int n;
	cin >> n;
	vector<int> a, t;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		t.push_back(tmp);
	}
	REP(i, n) {
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
	}
	determine[0] = t[0];
	for (int i = 1;i < n;++i) {
		if (t[i] != determine[i - 1]) changed[i] = true;
		determine[i] = t[i];
	}
	a.push_back(0);
	for (int i = n-1;i >= 0;--i) {
		if (a[i] != a[i + 1]) {
			changed[i] = true;
			if (a[i] > determine[i]) goto failed;
		}
		determine[i] = min(determine[i], a[i]);
	}
	long long ans = 1;
	for (int i = 1;i < n;++i) {
		if (changed[i] == false) {
			ans *= determine[i];
			ans %= MAX_MOD;
		}
	}
	cout << ans << endl;
	return 0;
failed:;
	cout << "0" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:1: error: jump to label 'failed'
   65 | failed:;
      | ^~~~~~
a.cc:52:55: note:   from here
   52 |                         if (a[i] > determine[i]) goto failed;
      |                                                       ^~~~~~
a.cc:56:19: note:   crosses initialization of 'long long int ans'
   56 |         long long ans = 1;
      |                   ^~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
using namespace std;
#define MOD 1000000007

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> T(N), A(N);
    int max = 0, max_index = 0;
    REP (i, N) {
        scanf("%d", &T[i]);
        if (max < T[i]) {
            max = T[i];
            max_index = i;
        }
    }
    REP (i, N) {
        scanf("%d", &A[i]);
    }
    if (A[max_index] != max) {
        printf("0\n");
        return 0;
    }
    if (A[0] != T[N - 1]) {
        printf("0\n");
        return 0;
    }
    if (T.size() == 1) {
        if (T[0] == A[0]) {
            printf("1\n");
            return 0:
        } else {
            printf("0\n");
            return 0;
        }
    }
    long long ans = 1;
    for (int i = 1; i < max_index; i++) {
        if (T[i] == T[i - 1]) {
            ans *= T[i] % MOD;
            ans %= MOD;
        }
    }
    for (int i = N - 2; i > max_index; i--) {
        if (A[i] == A[i + 1]) {
            ans *= A[i] % MOD;
            ans %= MOD;
        }
    }
    printf("%lld\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:21: error: expected ';' before ':' token
   35 |             return 0:
      |                     ^
      |                     ;
a.cc:35:21: error: expected primary-expression before ':' token
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#define ll __int64
using namespace std;
const ll SUB=1000000007;
int main()
{
	int n;
	cin>>n;
	int *t=new int[n];
	int *a=new int[n];
	for(int i=0;i<n;i++)cin>>t[i];
	for(int i=0;i<n;i++)cin>>a[i];
	if(t[n-1]!=a[0])
	{
		cout<<"0"<<endl;
		return 0;
	}
	ll ans=1;
	for(int i=1;i<n-1;i++)
	{
		if(t[i]!=t[i-1]||a[i]!=a[i+1])continue;
		ans*=(min(t[i],a[i])%SUB);
		ans%=SUB;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:8:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    8 | #define ll __int64
      |            ^~~~~~~
a.cc:10:7: note: in expansion of macro 'll'
   10 | const ll SUB=1000000007;
      |       ^~
a.cc: In function 'int main()':
a.cc:8:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    8 | #define ll __int64
      |            ^~~~~~~
a.cc:24:9: note: in expansion of macro 'll'
   24 |         ll ans=1;
      |         ^~
a.cc:28:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |                 ans*=(min(t[i],a[i])%SUB);
      |                 ^~~
      |                 abs
a.cc:28:38: error: 'SUB' was not declared in this scope
   28 |                 ans*=(min(t[i],a[i])%SUB);
      |                                      ^~~
a.cc:31:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: C++

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

#define clr(a,i) memset((a), (i) ,sizeof(a))



int main(){
  int n;
  std::cin >> n;
  std::vector<long long> t(n), a(n);
  long long temp=1;
  rep(i,n) std::cin >> t[i];
  rep(i,n) std::cin >> a[i];
  if(t[t.size()-1]!=a[0]) {
    std::cout << "0" << std::endl;
    return 0;
  }
  long long ma=a[0];
  bool b=false;
  rep(i,n){
    if(i==0||i==n-1) continue;
    if(t[i]==ma&&a[i]==ma) b=true;
    else if(t[i]==ma&&a[i]!=ma&&b=false){
      std::cout << "0" << std::endl;
      return 0;
    }
    if(t[i]==t[i-1]&&t[i]<=t[i+1]&&a[i]<=a[i-1]a[i]==a[i+1]){
      tmp*=min(a[i],t[i])-1;
      tmp%=1000000007;
    }
  }
  std::cout << tmp << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:31: error: lvalue required as left operand of assignment
   46 |     else if(t[i]==ma&&a[i]!=ma&&b=false){
a.cc:50:48: error: expected ')' before 'a'
   50 |     if(t[i]==t[i-1]&&t[i]<=t[i+1]&&a[i]<=a[i-1]a[i]==a[i+1]){
      |       ~                                        ^
      |                                                )
a.cc:51:7: error: 'tmp' was not declared in this scope; did you mean 'temp'?
   51 |       tmp*=min(a[i],t[i])-1;
      |       ^~~
      |       temp
a.cc:55:16: error: 'tmp' was not declared in this scope; did you mean 'temp'?
   55 |   std::cout << tmp << std::endl;
      |                ^~~
      |                temp
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL n,large=1000000007;
LL f(vector<LL>&d1,vector<LL>d2){
if(d1.back()!=d2[0])cout<<0<<endl;
LL res=1;
for(LL i=1;i<n-1;i++){
LL tmp=0;
if(d1[i]>d1[i-1])tmp=1;
else tmp=d[i];
if(d2[i]>d2[i+1]){if(tmp==1&&d2[i]!=d1[i])return 0;else tmp=1;}
else if(d1[i]>d2[i])return 0;
else tmp=min(tmp,d2[i]);
res=(res*tmp)%large;
}
return res;
}
int main(){
   while(cin>>n){
   vector<LL>d1(n),d2(n);
   for(int i=0;i<n;i++)cin>>d1[i];
   for(int i=0;i<n;i++)cin>>d2[i];
   cout<<f(d1,d2)<<endl;
}
    
}

Compiler output:
a.cc: In function 'LL f(std::vector<long long int>&, std::vector<long long int>)':
a.cc:11:10: error: 'd' was not declared in this scope
   11 | else tmp=d[i];
      |          ^
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int n;
	cin>>n;
	vi a(n),t(n);
	rep(i,n) cin>>a[i];
	rep(i, n) cin>>t[i];
	vi m(n,0), M(n, 0);
	M[0] = m[0] = a[0];
	REP(i, 1, n){
		if(a[i] == a[i-1]) m[i] = 1, M[i] = a[i];
		else M[i] = m[i] = a[i];
	}
	if(M[n-1]<t[n-1] || m[n-1] > t[i]){
		cout<<0<<endl;
		return 0;
	}
	M[n-1] = m[n-1] = t[n-1];
	for(int i = n -2; i >= 0; i--){
		if(t[i]==t[i+1]) m[i] = max(m[i], 1), M[i] = min(M[i], t[i]);
		else M[i] = m[i] = t[i];
	}
	ll ans = 1LL;
	rep(i, n) {
		(ans *= (M[i]-m[i]+1))%=MOD;
		if(M[i]-m[i]<0) ans = 0LL;
	}
	// cout<<ans<<endl;
	// rep(i, n) cout<<m[i]<<" ";
	// cout<<endl;
	// rep(i, n) cout<<M[i]<<" ";
	// cout<<endl;
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:40: error: 'i' was not declared in this scope
   57 |         if(M[n-1]<t[n-1] || m[n-1] > t[i]){
      |                                        ^
Language: C++

#include <iostream>
using namespace std;
typedef unsigned long long ull;

#define MAX_N 100000
#define MOD 1000000007
int N;
ull T[MAX_N+2], A[MAX_N+2];
bool flagT[MAX_N] = {false}, flagA[MAX_N] = {false};

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

    cin >> N;
    T[0] = 0;
    A[N+1] = 0;
    for(int i=1; i<=N; i++) cin >> T[i];
    for(int i=1; i<=N; i++) cin >> A[i];

    for(int i=0; i<N; i++){
        if(T[i+1] > T[i]) flagT[i+1] = true;
    }
    for(int i=2; i<N+2; i++){
        if(A[i-1] > A[i]) flagA[i-1] = true;
    }
    for(int i=0; i<=N+1; i++){
        cout << flagT[i] << " " << flagA[i] << endl;
    }

    ull ans = 1;
    for(int i=1; i<=N; i++){
        if(!flagT[i] && !flagA[i]) ans = (ans * min(A[i], T[i])) % MOD;


Compiler output:
a.cc: In function 'int main()':
a.cc:33:72: error: expected '}' at end of input
   33 |         if(!flagT[i] && !flagA[i]) ans = (ans * min(A[i], T[i])) % MOD;
      |                                                                        ^
a.cc:32:28: note: to match this '{'
   32 |     for(int i=1; i<=N; i++){
      |                            ^
a.cc:33:72: error: expected '}' at end of input
   33 |         if(!flagT[i] && !flagA[i]) ans = (ans * min(A[i], T[i])) % MOD;
      |                                                                        ^
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: C++

#include<iostream>
#define min(a,b) a<b?a:b
#define MAX 1000000007
using namespace std;
int a[100005][4];
int main(){
	__int64 s=1;
	int n,m=0;
	int i,j,k;
	cin>>n;
	for(i=0;i<100005;i++){
		for(j=0;j<4;j++){
			a[i][j]=MAX;
		}
	}
	for(i=0;i<n;i++){
		cin>>a[i][0];
	}
	for(i=0;i<n;i++){
		cin>>a[i][1];
	}
	a[0][2]=a[0][0];
	a[0][3]=1;
	a[n-1][2]=a[n-1][1];
	a[n-1][3]=1;
	for(i=1;i<n;i++){
		if(a[i-1][0]<a[i][0]){
			if(a[i][0]>a[i][1])m=1;
			a[i][2]=a[i][0];
			a[i][3]=1;
		}else if(a[i-1][0]==a[i][0]){
			a[i][2]=min(a[i][2],a[i][0]);
		}else{
			m=1;
		}
	}
	for(i=n-2;i>=0;i--){
		if(a[i+1][1]<a[i][1]){
			if(a[i][1]>a[i][0])m=1;
			a[i][2]=a[i][1];
			a[i][3]=1;
		}else if(a[i+1][1]==a[i][1]){
			a[i][2]=min(a[i][2],a[i][1]);
		}else{
			m=1;
		}
	}
	if(m==1){
		cout<<"0"<<endl;
		return 0;
	}
	for(i=0;i<n;i++){
		if(a[i][3]==1)continue;
		s*=a[i][2];
		s%=MAX;
	}
	cout<<s<<endl;
	return 0;
}
		


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    7 |         __int64 s=1;
      |         ^~~~~~~
      |         __int64_t
a.cc:54:17: error: 's' was not declared in this scope
   54 |                 s*=a[i][2];
      |                 ^
a.cc:57:15: error: 's' was not declared in this scope
   57 |         cout<<s<<endl;
      |               ^
Language: C++

// O(h^3 * w)
// rozwiązanie bazowane na `prog/tar.cpp`,
// ktore za wolno liczy koszty operacji
// autor: Jakub Wasilewski
#include <bits/stdc++.h>
using namespace std;

constexpr int max_h = 300, max_w = 300, none_value = -1, inf = 1e9;

int h, w, grid[max_h + 1][max_w + 1];

int solve(const int v)
{
    int dp[max_h + 1][max_h + 1];
    int cost[max_h + 1][max_h + 1];

    for (int i = 0; i <= h; ++i)
        for (int j = 0; j <= h; ++j)
            dp[i][j] = cost[i][j] = none_value;

    for (int dif = -h; dif <= h; ++dif)
        for (int i = max(0, -dif); i + dif <= h and i <= h; ++i)
        {
            if (min(i, i + dif) == 0)
                cost[i][i + dif] = 0;
            else
            {
                assert(cost[i - 1][i + dif - 1] != none_value);
                cost[i][i + dif] = 0;
                for (int j = 0; j < min(i, i + dif); ++j)
                    cost[i][i + diff] += (grid[h - i + 1 + j][v] == grid[h - (i + dif) + j][v + 1]);
            }
        }

    for (int i = 0; i <= h; ++i)
        for (int j = 0; j <= h; ++j)
        {
            dp[i][j] = inf;
            if (i == 0 and j == 0)
                dp[i][j] = 0;
            if (i > 0)
                dp[i][j] = min(dp[i][j], dp[i - 1][j] + cost[i][j]);
            if (j > 0)
                dp[i][j] = min(dp[i][j], dp[i][j - 1] + cost[i][j]);
        }

    return dp[h][h];
}

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

    cin >> h >> w;

    for (int i = h; i >= 1; --i)
    {
        string s; cin >> s;
        for (int j = 1; j <= w; ++j)
            grid[i][j] = (s[j - 1] - 'a');
    }

    int res = 0;
    for (int j = 1; j + 1 <= w; ++j)
        res += solve(j);

    cout << res << '\n';
}



Compiler output:
a.cc: In function 'int solve(int)':
a.cc:31:33: error: 'diff' was not declared in this scope; did you mean 'dif'?
   31 |                     cost[i][i + diff] += (grid[h - i + 1 + j][v] == grid[h - (i + dif) + j][v + 1]);
      |                                 ^~~~
      |                                 dif
Language: C++

#pragma gcc optimize("Ofast")

#include "bits/stdc++.h"
using namespace std;
typedef int64_t lld;
typedef pair<int,int> pii;
typedef pair<lld,lld> pll;
typedef pair<int,pll> pip;
typedef pair<pll,int> ppi;
typedef pair<lld,pll> plp;
typedef pair<pll,lld> ppl;
typedef pair<pll,pll> ppp;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define endl '\n'
#define jizz cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
inline void input(int &_x) {
    _x = 0;
    int _tmp = 1; char _tc = getchar();
    while((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
    if(_tc == '-') _tc = getchar(), _tmp = -1;
    while(_tc >= '0' && _tc <= '9') _x = _x*10+(_tc-48), _tc = getchar();
    _x *= _tmp;
}
inline void output(int _x) {
    char _buff[20]; int _f = 0;
    if(_x == 0)putchar('0');
    while(_x > 0)
    {
        _buff[_f++] = _x%10+'0';
        _x /= 10;
    }
    for(_f-=1; _f >= 0; _f--)
        putchar(_buff[_f]);
    putchar('\n');
}
template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}
template<class T1,class T2>
ostream& operator<<(ostream& out, pair<T1,T2> p) {
    return out << '(' << p.first << ", " << p.second << ')';
}
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) {
     return _out(s,c.begin(),c.end());
 }
#ifdef erd1
    #define pprint(x) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<endl
#else
    #define pprint(x)
#endif

// code starts here
const int N = 300;
int dp[N+2][N+2]={}, rep[N*2][N+1]={};
vector<string> v;
signed main(){
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        string s;
        cin >> s;
        v.pb(s);
    }
    for(int i = 0; i < h; i++)dp[h+1][i] = dp[i][h+1] = 2000000000;
    int ans = 0;
    for(int i = 0; i < w-1; i++){
        for(int diff = -h+1; diff<h; diff++){
            for(int j = max(diff, 0); j < h+min(diff, 0); j++){
                rep[diff+h][j+1] = rep[diff+h][j] + (v[j][i] == v[j-diff][i+1]);
                assert(rep[diff+h][j+1] <= );
            }
        }
        for(int l = h; l>=0; l--){
            for(int r = h; r>=0; r--){
                dp[l][r] = min(dp[l+1][r]+rep[l+1-r+h][l+1], dp[l][r+1]+rep[l-r-1+h][l]);
                assert(rep[l+1-r+h][l+1] < INT_MAX-2000000000);
                assert(rep[l-r-1+h][l]< INT_MAX-2000000000);
                assert(dp[l][r] < 2000000000);
            }
        }
        ans += dp[0][0];
    }

    cout << ans << endl;
}


Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
                 from a.cc:3:
a.cc: In function 'int main()':
a.cc:82:17: error: expected primary-expression before ')' token
   82 |                 assert(rep[diff+h][j+1] <= );
      |                 ^~~~~~
Language: C++

#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
int h,w;cin>>h>>w;
  string s[h];
  rep(i,0,h)cin>>s[i];
  ll ans=0;
  rep(i,0,w-1){
ll dp[h+1][h+1];
    rep(j,0,h+1){
rep(k,0,h+1)dp[j][k]=inf;
    }
    dp[h][h]=0;
    ll sum[h+1][h+1];
ll sum2[h+1][h+1];
    rep(j,0,h+1){
      sum[j][0]=0;
      sum2[j][0]=0;
      rep(k,1,h-j+1){
        sum[j][k]=sum[j][k-1];
        sum2[j][k]=sum2[j][k-1]
        if(s[k-1][i]==s[k-1+j][i+1])sum[j][k]++;
        if(s[k-1][i+1]==s[k-1+j][i])sum2[j][k]++;
        
      }
    }
    rrep(j,h,0){
      rrep(k,h,0){
         if(j>0){
           if(j-1<=k){
            ll sa=k-j+1;
             dp[j-1][k]=min(dp[j-1][k],dp[j][k]+sum[sa][j-1]);
           }
           else{
             ll sa=j-1-k;
             dp[j-1][k]=min(dp[j-1][k],dp[j][k]+sum2[sa][k]);
           }
         }
           if(k>0){
            if(k-1<=j){
            ll sa=j-k+1;
             dp[j][k-1]=min(dp[j][k-1],dp[j][k]+sum2[sa][k-1]);
           }
           else{
             ll sa=k-1-j;
             dp[j][k-1]=min(dp[j][k-1],dp[j][k]+sum[sa][j]);
           }
              
           }
      }
    }
    ans+=dp[0][0];
  }
  cout<<ans<<endl;

            
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:32: error: expected ';' before 'if'
   67 |         sum2[j][k]=sum2[j][k-1]
      |                                ^
      |                                ;
   68 |         if(s[k-1][i]==s[k-1+j][i+1])sum[j][k]++;
      |         ~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int inf = 1e8, Nmax = 303;

int n, m, i, j, ans;
char a[Nmax][Nmax], ch[Nmax];

int solve(char a[], char b[])
{
    int i, j, cost[Nmax][Nmax], dp[Nmax][Nmax];

    for(i=0; i<=n; ++i) dp[i][n+1] = dp[n+1][i] = inf, cost[i][0] = cost[0][i] = 0;

    for(i=1; i<=n; ++i)
    for(j=1; j<=n; ++j)
        cost[i][j] = cost[i-1][j-1] + (a[i]==b[j]);

    for(i=n; i>=0; --i)
    for(j=n; j>=0; --j)
    {
        if(i==n && j==n) dp[n][n] = 0;
        else dp[i][j] = min(dp[i][j+1] + cost[i][j+1], dp[i+1][j] + cost[i+1][j]);
    }

    return dp[0][0];
}

int main()
{
//    freopen("friction.in", "r", stdin);
  //  freopen("friction.out", "w", stdout);

    scanf("%d %d\n", &n, &m);

    for(i=1; i<=n; ++i)
    {
        gets(ch+1);
        for(j=1; j<=m; ++j)
            a[j][n-i+1] = ch[j];
    }

    for(i=1; i<m; ++i)
        ans += solve(a[i], a[i+1]);

    printf("%d\n", ans);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   39 |         gets(ch+1);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>

using namespace std;

int ans, N, M, cst[609][309], dp[309][309];
char sir[309][309], A[309], B[309];

int solve ()
{
    for (int i=0; i<=2 * N; i++)
        for (int j=0; j<=N; j++)
            cst[i][j] = 0;
    for (int i=1; i<=N; i++)
        for (int j=1; j<=N; j++)
            cst[j - i + N][N - i] += (A[i] == B[j]);
            ///trebuie ca sa fie considerat in cost[i1][i2] ca: i1 - i2 = j - i
            ///si ca i + i1 <= N-> i1 <= N - i
    for (int i=0; i<=2 * N; i++)
        for (int j=N; j>0; j--)
            cst[i][j - 1] += cst[i][j];
    ///dp[i1][i2] daca am dat de i1 in jos primul sir si de i2 in jos pe al doilea
    dp[0][0] = cst[N][0];
    for (int i=0; i<=N; i++)
        for (int j=0; j<=N; j++)
            if (i + j)
            {
                int curr = cst[i - j + N][i];
                if (i == 0) dp[i][j] = dp[i][j - 1];
                else
                if (j == 0) dp[i][j] = dp[i - 1][j];
                else dp[i][j] = min (dp[i][j - 1], dp[i - 1][j]);
                dp[i][j] += curr;
            }
    return dp[N][N];
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d\n", &N, &M);
for (int i=1; i<=N; i++)
    gets (sir[i] + 1);
for (int j=1; j<M; j++)
{
    for (int i=1; i<=N; i++)
        A[i] = sir[i][j], B[i] = sir[i][j + 1];
    ans += solve ();
}
printf ("%d\n", ans);

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   44 |     gets (sir[i] + 1);
      |     ^~~~
      |     getw
Language: C++

N,M=map(int,input().split());C=[[0]*-~N for _ in range(N+1)];D=list(map(list,C));S=[input()for _ in range(N)];r=0
for t in range(M-1):
	for i in range(1,N+1):
		for j in range(1,N+1):C[i][j]=C[i-1][j-1]+int(S[i-1][t]==S[j-1][t+1]);D[i][j]=min(D[i-1][j],D[i][j-1])+C[i][j]
	r+=D[N][N]
print(r)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,M=map(int,input().split());C=[[0]*-~N for _ in range(N+1)];D=list(map(list,C));S=[input()for _ in range(N)];r=0
      | ^
a.cc:1:30: error: 'C' does not name a type
    1 | N,M=map(int,input().split());C=[[0]*-~N for _ in range(N+1)];D=list(map(list,C));S=[input()for _ in range(N)];r=0
      |                              ^
a.cc:1:62: error: 'D' does not name a type
    1 | N,M=map(int,input().split());C=[[0]*-~N for _ in range(N+1)];D=list(map(list,C));S=[input()for _ in range(N)];r=0
      |                                                              ^
a.cc:1:82: error: 'S' does not name a type
    1 | N,M=map(int,input().split());C=[[0]*-~N for _ in range(N+1)];D=list(map(list,C));S=[input()for _ in range(N)];r=0
      |                                                                                  ^
a.cc:1:111: error: 'r' does not name a type
    1 | N,M=map(int,input().split());C=[[0]*-~N for _ in range(N+1)];D=list(map(list,C));S=[input()for _ in range(N)];r=0
      |                                                                                                               ^
a.cc:4:87: error: 'D' does not name a type
    4 |                 for j in range(1,N+1):C[i][j]=C[i-1][j-1]+int(S[i-1][t]==S[j-1][t+1]);D[i][j]=min(D[i-1][j],D[i][j-1])+C[i][j]
      |                                                                                       ^
Language: C++

#include <cmath>
#include <vector>
#include <map>
#include <functional>
#include <queue>
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int
#define ti4 tuple<int,int,int,int>
#define pii pair<ll,ll>
#define REP(x,n) for(int x = 0;x < n;x++)

struct UnionFind {
    vector<ll> data;
    UnionFind(ll size) : data(size, -1) { }
    bool unionSet(ll x, ll y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(ll x, ll y) {
        return root(x) == root(y);
    }
    ll root(ll x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    ll size(ll x) {
        return -data[root(x)];
    }
};

int cost[400][400];
int dp[400][400];

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> cs(h);
    for(int i = 0;i < h;i++)
    {
        cin >> cs[i];
    }
    ll costSum = 0;
    for(int i = 0; i < w - 1; i++){
        memset(cost, 0, sizeof(cost));
        memset(dp, 0, sizeof(dp));
        
        for(int j = 1; j <= h; j++){
            for(int k = 1; k <= h; k++){
                cost[j][k] = cost[j - 1][k - 1];
                cost[j][k] += (cs[j - 1][i] == cs[k - 1][i + 1]);
                dp[j][k] = 1e7;
            }
        }
        
        for(int j = 1; j <= h; j++){
            for(int k = 1; k <= h; k++){
                dp[j][k] = min(dp[j][k], dp[j - 1][k]);
                dp[j][k] = min(dp[j][k], dp[j][k - 1]);
                dp[j][k] += cost[j][k];
            }
        }
        
        costSum += dp[h][h];
    }
    cout << costSum << endl;
    return 0;
}

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

#include <iostream>
#include <cctype>
#include <cstdio>
#include <string>
#include <typeinfo>
#include <queue>
using namespace std;


int cost(int,int,int);
int min (int,int);

	int h,w;
	int d[301][301];
	char c[][];
	int z;
	

int main() {
	cin>>h>>w;
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			cin>>c[i][j];
			
		}
	}

	/*
	cout<<cost(0,0)<<endl;
	*/
	for (int t = 0; t < w-1; ++t)
	{
	
	
		for (int i = 0; i <= h; ++i)
			{
			for (int j = 0; j <=w; ++j)
				{
					d[i][j]=0;
			
				}
			}

		for (int i = 1; i <= h; ++i)
		{
			d[i][0]=d[i-1][0]+cost(i-1,0,t);
			d[0][i]=d[0][i-1]+cost(0,i-1,t);	
		}

			for (int i = 1; i <=h; ++i)
			{
				for (int j = 1; j <=h; ++j)
				{
					d[i][j]=min((d[i-1][j]+cost(i-1,j,t)),(d[i][j-1]+cost(i,j-1,t)));
				}
			}
				
	z = z+d[h][h];
	
	}

	cout<<z<<endl;
	return 0;
}



int cost(int x, int y,int t){
	int f=0;
				for (int j = h-1; j-x >=0 || j-y>=0 ; --j){
					if (c[j-x][t]==c[j-y][t+1])
					{
						f=f+1;
					}
				}
	return f;
}

int min(int x, int y){
	if (x<y){
		return x;
	}
	else return y;
}


Compiler output:
a.cc:15:14: error: declaration of 'c' as multidimensional array must have bounds for all dimensions except the first
   15 |         char c[][];
      |              ^
a.cc: In function 'int main()':
a.cc:25:30: error: 'c' was not declared in this scope
   25 |                         cin>>c[i][j];
      |                              ^
a.cc: In function 'int cost(int, int, int)':
a.cc:73:45: error: 'c' was not declared in this scope
   73 |                                         if (c[j-x][t]==c[j-y][t+1])
      |                                             ^
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define FOR(i,l,r) for(int i=(l);i<=(r);++i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=1e5+2;
const LL MOD=1e9+7;

int h,w;
char C[310][310];
LL val[310][310],dp[310][310];
LL cl(int a,int b) {
	for (int i=1;i<=h;i++)
		for (int j=1;j<=h;j++) {
			val[i][j]=val[i-1][j-1]+(C[i][a]==C[j][b]);
			dp[i][j]=min(dp[i-1][j],dp[i][j-1])+val[i][j];
		}

Compiler output:
a.cc: In function 'LL cl(int, int)':
a.cc:21:18: error: expected '}' at end of input
   21 |                 }
      |                  ^
a.cc:16:20: note: to match this '{'
   16 | LL cl(int a,int b) {
      |                    ^
a.cc:21:18: warning: no return statement in function returning non-void [-Wreturn-type]
   21 |                 }
      |                  ^
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#define oo 987654321
using namespace std;
string a[330];
int h, w, ans, dt[330][330], dt2[330][330];

int c(int k, int x, int y)
{
    if( x > h or y > h ) return 0;
    if( x == h or y == h ) return 0;
    if( ~dt2[x][y] ) return dt2[x][y];
    int &ret = dt2[x][y] = 0;
    for(int i = x, j = y ; i < h and j < h ; i++, j++ )
        ret += a[i][k] == a[j][k+1];
    return ret;
}

int dp(int k, int x, int y)
{
    if( x > h or y > h ) return oo;
    if( x == h or y == h ) return 0;
    if(~dt[x][y]) return dt[x][y];
    int &ret = dt[x][y] = oo;
    return ret = min(dp(k, x+1, y)+c(k, x, y), dp(k,x,y+1)+c(k, x, y));
}

int main()
{
    cin>>h>>w;
    for(int i = 0 ; i < h ; i++ ) cin>>a[i];
    for(int x = 0 ; x < w-1 ; x++ )
        memset(dt, -1, sizeof(dt)), memset(dt2, -1, sizeof(dt2)), ans += dp(x, 0, 0);
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: 'memset' was not declared in this scope
   35 |         memset(dt, -1, sizeof(dt)), memset(dt2, -1, sizeof(dt2)), ans += dp(x, 0, 0);
      |         ^~~~~~
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 | #include <string>