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

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

public class Main {

	private final int n;
	private final List<Long> a;
	private long[][] dp;
	private long[] prefixSums;
	private long[] suffixSums;

	public N(int n, List<Long> a) {
		this.n = n;
		this.a = a;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Long> a = LongStream.range(0, n).map(i -> sc.nextLong()).boxed().collect(Collectors.toList());

		new N(n, a).solve();
	}

	private void solve() {
		dp = new long[n][n];
		prefixSums = new long[n];
		suffixSums = new long[n];
		Arrays.fill(prefixSums, -1);
		Arrays.fill(suffixSums, -1);

		for (int i = 0; i < n; i++) {
			Arrays.fill(dp[i], -1);
		}

		System.out.println(best(0, n - 1));
	}

	private long best(int from, int to) {
		if (from == to) return 0;
		if (dp[from][to] != -1) return dp[from][to];

		long best = Long.MAX_VALUE;
		for (int lastFromLeft = from; lastFromLeft < to; lastFromLeft++) {
			best = Math.min(best,
				sumBetween(from, lastFromLeft) + sumBetween(lastFromLeft + 1, to) +
							best(from, lastFromLeft) + best(lastFromLeft + 1, to));
		}
		return best;
	}

	private long sumBetween(int l, int r) {
		return prefixSum(r) - (l == 0? 0 : prefixSum(l - 1));
	}

	private long prefixSum(int lastFromLeft) {
		if (lastFromLeft == 0) return a.get(0);
		if (prefixSums[lastFromLeft] != -1) return prefixSums[lastFromLeft];
		return prefixSums[lastFromLeft] =
				a.get(lastFromLeft) + prefixSum(lastFromLeft - 1);
	}

}


Compiler output:
Main.java:18: error: invalid method declaration; return type required
	public N(int n, List<Long> a) {
	       ^
1 error
Language: C++

//Krunal_Mathukiya
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define li long int
#define pb push_back
#define mkp make_pair
#define nikalL return
#define chalavo continue
#define basHo break
#define umap unordered_map
#define fr(i,s,n) for(int i=s;i<=n;++i)
#define frr(i,s,n) for(int i=s;i>=n;--i)
#define jaldiKarNe ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
int n;
lli arr[402];
pair<lli,lli> dp[402][402];
int vis[402][402];
//umap<int,umap<int,pair<lli,lli> > >dp;
//umap<int,umap<int,int> >vis;
// {length,cost}
pair<lli,lli> fn(int i,int j) {
	if(i==j) return {arr[i],0};
	if(vis[i][j]) return dp[i][j];
	vis[i][j]=1;
	lli cost=500000000000;
	lli length=500000000000;
	fr(mid,i,j-1) {
		auto a1=fn(i,mid);
		auto a2=fn(mid+1,j);
		lli len=a1.first+a2.first;
		lli cst=a1.second+a2.second+len;
		if(cst<=cost && len<length)) {
			length=len;
			cost=cst;
		}
	}
	return dp[i][j]={length,cost};
}
int main(){
	jaldiKarNe;
	cin>>n;
	fr(i,1,n) cin>>arr[i];
	cout<<fn(1,n).second;
}

Compiler output:
a.cc: In function 'std::pair<long long int, long long int> fn(int, int)':
a.cc:34:44: error: expected primary-expression before ')' token
   34 |                 if(cst<=cost && len<length)) {
      |                                            ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Stack;
import java.util.StringTokenizer;

public class Test5 {
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		
		int N = Integer.parseInt(br.readLine());
		
		st = new StringTokenizer(br.readLine());
		long[] psa = new long[N+1];
		psa[0] = 0;
		for(int i=1; i<=N; i++) {
			psa[i] = Integer.parseInt(st.nextToken()) + psa[i-1];
		}

		long[][] dp = new long[N][N];
		for(int i=N-1; i>=0; i--) {
			for(int j=i+1; j<N; j++) {
				dp[i][j] = Long.MAX_VALUE;
				for(int k=i; k<j; k++) {
					dp[i][j] = Math.min(dp[i][j], dp[i][k]+dp[k+1][j]);
				}
				dp[i][j] += psa[j+1]-psa[i];
			}
		}
		System.out.println(dp[0][N-1]);
	}
}


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

#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}
const int siz=401;
vector <ll> v(siz,0);
ll solve(ll i, ll j)
{
    if(i>=j)
        return 0;
    ll ans=100000000000`;
    for(ll k=i;k<j;k++)
    {
        ll sum=0;
        for(ll x=i;x<=j;x++)
            sum+=v[x];
        ll temp_ans=sum+solve(i,k)+solve(k+1,j);
        ans=min(ans,temp_ans);
    }
    return ans;
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("inputh.txt", "r", stdin);
    freopen("outputh.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    //cin>>test;
    while(test--)
    {

            ll n;
            cin>>n;
            fo(i,n)
            cin>>v[i];
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
           cout<< solve(0,n-1);
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not





Compiler output:
a.cc:110:24: error: stray '`' in program
  110 |     ll ans=100000000000`;
      |                        ^
Language: C++

#include <bits/stdc++.h>
#include<iostream>

using namespace std;

#define ll                    long long
#define ull                   unsigned long long
#define io                 ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                 push_back

ll dp[1000][1000];

void solve(vector<int> &v,int n ){
    int d=(2*n)-1;
    //cout<<k<<"\n";
    for(int i=0;i<d;i++)
        for(int j=0;j<d;j++){
            if(i==j)    dp[i][j]=0;
            else dp[i][j]=-1;}


    ll x,ans1=LONG_MAX;
    for(int k=2;k<=n;k++){
        for(int p=0;p<n;p++){
            ll ans=LONG_MAX;
            for(int q=p;q<p+k-1;q++){
                ans=min(ans,dp[p][q%n]+dp[(q+1)%n][(p+k-1)%n]);
            }
            x=0;
            for(int q=p;q<=p+k-1;q++){
                x+=v[q%n];
            }
            dp[p][(p+k-1)%n]=ans+x;
            if(k==n)
                ans1=min(ans1,dp[p][(p+k-1)%n]);

        }
    }

    cout<<ans1<<"\n";


}


int main(){
    io;
    int q;
    //cin>>q;
    q=1;
    while(q--){
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    }
    solve(v,n);
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:11: error: 'v' was not declared in this scope
   58 |     solve(v,n);
      |           ^
a.cc:58:13: error: 'n' was not declared in this scope
   58 |     solve(v,n);
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
//long long int a[410];
long long int dp[405][405];
long long sum[405];
int n;

    long long getSum(int l,int r)
    {
        if(l<=r)
        {
            return sum[r]-(l==0?0:sum[l-1]);
        }
     
        return sum[n-1]-sum[l-1]+sum[r];
    }
     

int main(){
      
      cin>>n;
      vector<long long int>a(n);
      for(int i=0; i<n; i++)
            cin>>a[i];
      
      for(int i=0; i<n; i++){
            for(int j=0; j<n; j++)
                  dp[i][j]=1000000000000;
      }
      
      sum[0]=a[0];
      for(int i=1; i<n; i++)
            sum[i]=sum[i-1]+a[i];
      
      for(int i=0; i<n; i++){
            int j=(i+1)%n;
            dp[i][j]=a[i]+a[j];
            dp[i][i]=0;
      }
      for(int size=2;size<=n;size++)
            {
                for(int i=0;i<n;i++)
                {
                   int l=i,r=(i+size-1)%n;
     
                   for(int j=l;j!=r;j=(j+1)%n)
                   {
                       dp[l][r]=min(dp[l][r],dp[l][j]+dp[(j+1)%n][r]+getSum(l,r));
                   }
                }
            }
      /*for(int l=2; l<n; l++){
            for(int i=0; i<n; i++){
                  int j=(i+l)%n;
                  
                  for(int k=i; ; k=(k+1)%n){
                        k=k%n;
                        if(k==j)break;
                        dp[i][j]=min(dp[i][j], dp[i][k]+dp[(k+1)%n][j]+getSum(i, j));
                  }*/
/*
                  if(i<j){
                        if(i>0)
                        dp[i][j]+=(sum[j]-sum[i-1]);
                        else dp[i][j]+=sum[j];
                  }
                  else {
                        dp[i][j]+=(sum[n]-sum[i-1]+sum[j]);
                  }*/
                  
            }
      }
      long long int ans=LONG_LONG_MAX;
      for(int i=0; i<n; i++){
            int j=(i+n-1)%n;
            //cout<<dp[i][j]<<'\n';
            ans=min(ans, dp[i][j]);
      }

      cout<<ans<<'\n';
}

Compiler output:
a.cc:72:7: error: expected declaration before '}' token
   72 |       }
      |       ^
a.cc:74:7: error: expected unqualified-id before 'for'
   74 |       for(int i=0; i<n; i++){
      |       ^~~
a.cc:74:20: error: 'i' does not name a type
   74 |       for(int i=0; i<n; i++){
      |                    ^
a.cc:74:25: error: 'i' does not name a type
   74 |       for(int i=0; i<n; i++){
      |                         ^
a.cc:80:7: error: 'cout' does not name a type
   80 |       cout<<ans<<'\n';
      |       ^~~~
a.cc:81:1: error: expected declaration before '}' token
   81 | }
      | ^
Language: C++

int n;
vector<long int> sum;
long int dp[1000][1000];

long int solve(vector<long int>& a,int i, int j) {
  if (i==j) return 0;
  if (dp[i][j]!=-1) return dp[i][j];
  long int soln = LONG_MAX;
  for (int k=i;k<j;k++) {
    long int temp = (0ll + solve(a,i,k) + solve(a,k+1,j) + sum[j+1] - sum[i+1] +a[i]);
    
    soln = min(soln, temp);
  }
  return dp[i][j] = soln;
}


int main() {
  cin>>n;
  vector<long int> a(n);
  sum = vector<long int>(n+1,0);
  for (int i=0;i<n;i++) {
    cin>>a[i];
    sum[i+1] = sum[i]+a[i];
  }
  
  memset(dp,-1,sizeof(dp));
  cout<<solve(a,0,n-1);
  
  return 0;
}


Compiler output:
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<long int> sum;
      | ^~~~~~
a.cc:5:16: error: 'vector' was not declared in this scope
    5 | long int solve(vector<long int>& a,int i, int j) {
      |                ^~~~~~
a.cc:5:23: error: expected primary-expression before 'long'
    5 | long int solve(vector<long int>& a,int i, int j) {
      |                       ^~~~
a.cc:5:36: error: expected primary-expression before 'int'
    5 | long int solve(vector<long int>& a,int i, int j) {
      |                                    ^~~
a.cc:5:43: error: expected primary-expression before 'int'
    5 | long int solve(vector<long int>& a,int i, int j) {
      |                                           ^~~
a.cc:5:48: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | long int solve(vector<long int>& a,int i, int j) {
      |                                                ^
a.cc: In function 'int main()':
a.cc:19:3: error: 'cin' was not declared in this scope
   19 |   cin>>n;
      |   ^~~
a.cc:20:3: error: 'vector' was not declared in this scope
   20 |   vector<long int> a(n);
      |   ^~~~~~
a.cc:20:10: error: expected primary-expression before 'long'
   20 |   vector<long int> a(n);
      |          ^~~~
a.cc:21:3: error: 'sum' was not declared in this scope
   21 |   sum = vector<long int>(n+1,0);
      |   ^~~
a.cc:21:16: error: expected primary-expression before 'long'
   21 |   sum = vector<long int>(n+1,0);
      |                ^~~~
a.cc:23:10: error: 'a' was not declared in this scope
   23 |     cin>>a[i];
      |          ^
a.cc:27:3: error: 'memset' was not declared in this scope
   27 |   memset(dp,-1,sizeof(dp));
      |   ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int n;
a.cc:28:3: error: 'cout' was not declared in this scope
   28 |   cout<<solve(a,0,n-1);
      |   ^~~~
a.cc:28:15: error: 'a' was not declared in this scope
   28 |   cout<<solve(a,0,n-1);
      |               ^
a.cc:28:14: error: 'solve' cannot be used as a function
   28 |   cout<<solve(a,0,n-1);
      |         ~~~~~^~~~~~~~~
Language: C++

int n;
vector<long int> sum;
long int dp[1000][1000];

long int solve(vector<int>& a,int i, int j) {
  if (i==j) return 0;
  if (dp[i][j]!=-1) return dp[i][j];
  long int soln = LONG_MAX;
  for (int k=i;k<j;k++) {
    long int temp = (0ll + solve(a,i,k) + solve(a,k+1,j) + sum[j+1] - sum[i+1] +a[i]);
    
    soln = min(soln, temp);
  }
  return dp[i][j] = soln;
}


int main() {
  cin>>n;
  vector<int> a(n);
  sum = vector<long int>(n+1,0);
  for (int i=0;i<n;i++) {
    cin>>a[i];
    sum[i+1] = sum[i]+a[i];
  }
  
  memset(dp,-1,sizeof(dp));
  cout<<solve(a,0,n-1);
  
  return 0;
}


Compiler output:
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<long int> sum;
      | ^~~~~~
a.cc:5:16: error: 'vector' was not declared in this scope
    5 | long int solve(vector<int>& a,int i, int j) {
      |                ^~~~~~
a.cc:5:23: error: expected primary-expression before 'int'
    5 | long int solve(vector<int>& a,int i, int j) {
      |                       ^~~
a.cc:5:31: error: expected primary-expression before 'int'
    5 | long int solve(vector<int>& a,int i, int j) {
      |                               ^~~
a.cc:5:38: error: expected primary-expression before 'int'
    5 | long int solve(vector<int>& a,int i, int j) {
      |                                      ^~~
a.cc:5:43: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | long int solve(vector<int>& a,int i, int j) {
      |                                           ^
a.cc: In function 'int main()':
a.cc:19:3: error: 'cin' was not declared in this scope
   19 |   cin>>n;
      |   ^~~
a.cc:20:3: error: 'vector' was not declared in this scope
   20 |   vector<int> a(n);
      |   ^~~~~~
a.cc:20:10: error: expected primary-expression before 'int'
   20 |   vector<int> a(n);
      |          ^~~
a.cc:21:3: error: 'sum' was not declared in this scope
   21 |   sum = vector<long int>(n+1,0);
      |   ^~~
a.cc:21:16: error: expected primary-expression before 'long'
   21 |   sum = vector<long int>(n+1,0);
      |                ^~~~
a.cc:23:10: error: 'a' was not declared in this scope
   23 |     cin>>a[i];
      |          ^
a.cc:27:3: error: 'memset' was not declared in this scope
   27 |   memset(dp,-1,sizeof(dp));
      |   ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int n;
a.cc:28:3: error: 'cout' was not declared in this scope
   28 |   cout<<solve(a,0,n-1);
      |   ^~~~
a.cc:28:15: error: 'a' was not declared in this scope
   28 |   cout<<solve(a,0,n-1);
      |               ^
a.cc:28:14: error: 'solve' cannot be used as a function
   28 |   cout<<solve(a,0,n-1);
      |         ~~~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> sum;
int solve(vector<int>&a,int i, int j,int dp[n][n]) {
  if (i==j) return a[i];
  if (dp[i][j]!=-1) return dp[i][j];
  int soln = INT_MAX;
  for (int k=i;k<j;k++) {
    int temp = solve(a,i,k,dp) + solve(a,k+1,j,dp) + sum[j+1] - sum[i+1] +a[i];
    soln = min(soln, temp);
  }
  return dp[i][j] = soln;
}


int main() {
  cin>>n;
  vector<int> a(n);
  sum = vector<int>(n+1,0);
  for (int i=0;i<n;i++) {
    cin>>a[i];
    sum[i+1] = sum[i]+a[i];
  }
  int dp[n][n];
  memset(dp,-1,sizeof(dp));
  
  int soln = INT_MAX;
  cout<<solve(a,0,n-1,dp);
  return 0;
}


Compiler output:
a.cc:5:48: error: size of array 'dp' is not an integral constant-expression
    5 | int solve(vector<int>&a,int i, int j,int dp[n][n]) {
      |                                                ^
a.cc:5:45: error: size of array 'dp' is not an integral constant-expression
    5 | int solve(vector<int>&a,int i, int j,int dp[n][n]) {
      |                                             ^
a.cc: In function 'int main()':
a.cc:29:23: error: cannot convert 'int (*)[n]' to 'int (*)[1]'
   29 |   cout<<solve(a,0,n-1,dp);
      |                       ^~
      |                       |
      |                       int (*)[n]
a.cc:5:42: note:   initializing argument 4 of 'int solve(std::vector<int>&, int, int, int (*)[1])'
    5 | int solve(vector<int>&a,int i, int j,int dp[n][n]) {
      |                                      ~~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> sum;
int solve(vector<int>&a,int i, int j) {
  if (i==j) return a[i];
  if (dp[i][j]!=-1) return dp[i][j];
  int soln = INT_MAX;
  for (int k=i;k<j;k++) {
    int temp = solve(a,i,k) + solve(a,k+1,j) + sum[j+1] - sum[i+1] +a[i];
    soln = min(soln, temp);
  }
  return dp[i][j] = soln;
}


int main() {
  cin>>n;
  vector<int> a(n);
  sum = vector<int>(n+1,0);
  for (int i=0;i<n;i++) {
    cin>>a[i];
    sum[i+1] = sum[i]+a[i];
  }
    
  int soln = INT_MAX;
  cout<<solve(a,0,n-1);
  return 0;
}

Compiler output:
a.cc: In function 'int solve(std::vector<int>&, int, int)':
a.cc:7:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
    7 |   if (dp[i][j]!=-1) return dp[i][j];
      |       ^~
      |       dup
a.cc:13:10: error: 'dp' was not declared in this scope; did you mean 'dup'?
   13 |   return dp[i][j] = soln;
      |          ^~
      |          dup
Language: Java

import java.util.*;
import java.io.*;

public class Slimes {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        ArrayList<Long> sizes = new ArrayList<>();
        for (int i = 0; i < n; i++) sizes.add(in.nextLong());
        long cost = 0;
        for (int i = 0; i < n - 1; i++) {
            long cur = sizes.get(0) + sizes.get(1);
            int idx = 0;
            for (int j = 0; j < sizes.size() - 1; j++) {
                if (sizes.get(j) + sizes.get(j + 1) < cur) {
                    cur = sizes.get(j) + sizes.get(j + 1);
                    idx = j;
                }
            }
            sizes.remove(idx);
            sizes.remove(idx);
            sizes.add(idx, cur);
            cost += cur;
        }

        out.println(cost);
        out.close();

    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream i) {
            br = new BufferedReader(new InputStreamReader(i));
            st = new StringTokenizer("");
        }
        public String next() throws IOException {
            if (st.hasMoreTokens()) {
                return st.nextToken();
            }
            else
                st = new StringTokenizer(br.readLine());
            return next();
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public String nextLine() throws IOException {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
                return nextLine();
            }

            String ret = "";
            while (st.hasMoreTokens()) {
                ret += st.nextToken();
            }
            return ret;
        }
        public int[] nextIntArr(int size) throws IOException {
            int[] arr = new int[size];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
        public long[] nextLongArr(int size) throws IOException {
            long[] arr = new long[size];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
        public double[] nextDoubleArr(int size) throws IOException {
            double[] arr = new double[size];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }
    }
}

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

#include<bits/stdc++.h>
using namespace std;
#define int long long int
signed main()
{ int n;
 cin>>nl;
 int arr[n];
 for(int i=0;i<n;i++)
     cin>>arr[i];
 int dp[n][n]={0};
 for(int i=0;i<n;i++)
 dp[i][i]=arr[i];
 for(int i=2;i<=n;i++)
 { for(int j=0;j<=n-i;j++)
 { int e=j+i-1;
  dp[j][e]=INT_MAX;
  for(int k=j+1;k<=e;k++)
  {
    dp[j][e]=min(dp[j][e],dp[j][k-1]+dp[k][e]);
  }
 }
 }
 cout<<dp[0][n-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: 'nl' was not declared in this scope; did you mean 'n'?
    6 |  cin>>nl;
      |       ^~
      |       n
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) (1e18
#define mod (ll) (1e9 + 7)
#define endl "\n"
#define tt ll testcase; cin>>testcase; while(testcase--)
 
const int mxn = 1*(1e5) + 5;
ll n, m;
 
void solve(){
	cin >> n;
	ll a[n];
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
	ll pref[n+1] = {};
	//// sum [l][r] = pref[r] - pref[l-1]
	for(int i=0; i<n; i++) {
		pref[i+1] = pref[i] + a[i];
	}
	// ll dp[n][n] = {};
	vector<vector<ll>>dp(n, vector<ll>(n, INF));
	for(int l=n-1; l>=0; l--) {
		dp[l][l] = 0;
		for(int r = l; r<n; r++) {
			// if(r-l == 1) {
			// 	dp[l][r] = a[r] + a[l];
			// } else {
				// dp[l][r] = min(a[l] + dp[l+1][r] + pref[r+1]-pref[l+1], a[r] + dp[l][r-1] + pref[r]-pref[l]);
				for(int i = l; i<r; i++) {
					dp[l][r] = min(dp[l][i] + dp[i+1][r] - pref[l] + pref[r+1], dp[l][r]);	
				}
				// if((r-l) == 1) dp[l][r] = a[r] + a[l];
			// }
		}
	}
	// for(int i=0; i<n; i++) {
	// 	for(int j=0; j<n; j++) {
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	cout << dp[0][n-1];
}
 
int main(){
    fast;

     // tt
        solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:52: error: expected ')' before ';' token
   29 |         vector<vector<ll>>dp(n, vector<ll>(n, INF));
      |                             ~                      ^
      |                                                    )
Language: C

#include<bits/stdc++.h>
using namespace std;
 
#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define mod 1000000007
#define MOD 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
#define dd double
#define fori(x,n) for(ll i=x;i<n;i++)
#define modd 998244353
#define umap unordered_map<ll,ll>


ll dp[402][402];
ll sum[402][402];

ll fun(ll i,ll j){
  if(i==j)return 0;        // cost will be 0 for single element to form single slime
  if(dp[i][j]!=-1)return dp[i][j];
   
  ll mini = 1e12;

  for(int r=i;r<=j-1;r++)
    mini=min(mini,sum[i][j]+fun(i,r)+fun(r+1,j));    // finding minimum cost for combining two slimes into one 

  return dp[i][j]= mini;
}

//percomputating sum from i to j

void precompute(ll a[],ll n){
  for(int i=0;i<n;i++)
    for(int j=i;j<n;j++)
      sum[i][j]=a[j]+ (i==j?0:sum[i][j-1]);

    return;
}

int32_t main() 
{ 
  
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    ll n;
    cin>>n;
    ll a[n];
    fori(0,n)cin>>a[i];

    memset(dp,-1,sizeof dp);
    precompute(a,n);

    cout<<fun(0,n-1);

    
    


    
    
 
return 0;
}    

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int func(int i, int j)
{
  if(i==j) return 0;
  int k=dp2[i][j];
  return dp[i][k]+dp[k+1][j]+func(i,k)+func(k+1,j);
}
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  int dp[n][n], dp2[n][n];
  for(int i=0;i<n;i++) dp[i][i]=a[i];
  for(int i=1;i<n;i++)
  {
    for(int j=0;j+i<n;j++)
    {
      dp[j][j+i]=INT_MAX;
      for(int k=j;k<j+i;k++)
      {
        if(dp[j][j+i]>dp[j][k]+dp[k+1][j+i])
        {
            dp[j][j+i]=dp[j][k]+dp[k+1][j+i];
            dp2[j][j+i]=k;
        }
      }
    }
  }
  cout<<func(0,n-1);
}

Compiler output:
a.cc: In function 'int func(int, int)':
a.cc:6:9: error: 'dp2' was not declared in this scope; did you mean 'dup2'?
    6 |   int k=dp2[i][j];
      |         ^~~
      |         dup2
a.cc:7:10: error: 'dp' was not declared in this scope; did you mean 'dup'?
    7 |   return dp[i][k]+dp[k+1][j]+func(i,k)+func(k+1,j);
      |          ^~
      |          dup
Language: C++

from sys import setrecursionlimit
setrecursionlimit(1<<30)
def f(i,j,d):
  if i>=j:
    return 0
  if z[i][j]==-1:
    q=1<<64
    for k in xrange(i,j+1):
      q=min(q,s[j+1]-s[i]+f(i,k,d)+f(k+1,j,d))
    z[i][j]=q
  return z[i][j]
n=input()
a=map(int,raw_input().split())
s=[0]
for i in a:
  s.append(s[-1]+i)
z=[[-1]*n for i in xrange(n)]
print f(0,n-1,{})


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from sys import setrecursionlimit
      | ^~~~
a.cc:18:17: error: expected unqualified-id before ')' token
   18 | print f(0,n-1,{})
      |                 ^
Language: C++

#include<bits/stdc++.h>
//#define Mx 1000000000005 
#define ll long long  
#define pi 3.141592653
#define vi vector<ll>
#define Mo 1000000007
#define mp make_pair
#define M map<ll,ll>
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define vii vector<pair<ll,ll> > 
#define fi first
#define se second
#define pb push_back
#define ld long double
#define fill(a,x) memset(a,x,sizeof(a))
using namespace std;
bool comp(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
  return a.second<b.second;
}
/*vi b=v;
   sort(b.begin(), b.end());
  b.resize(unique(b.begin(), b.end()) - b.begin());
  ll t; cin>>t; fr(f,0,t){ 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
 */

const long long inf = 1e15 + 7;

int main()
{
  ll n; cin>>n;
  ll a[n];
  fr(i,0,n)
    cin>>a[i];

  ll dp[n][n],p[n+1]={0};
  fill(dp,0);

  fr(i,1,n+1)
    p[i]=a[i-1]+p[i-1];

  fr(l,2,n+1)
  {
    fr(i,0,n-l+1)
    {
      ll j=i+l-1,ans=Mx;

      if(l==2)  { dp[i][j]=a[i]+a[j]; continue; }

      fr(k,i,j)
        ans=min(ans,dp[i][k]+dp[k+1][j]+p[j+1]-p[i]);
      dp[i][j]=ans;

    }
  }

  cout<<dp[0][n-1];


}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:22: error: 'Mx' was not declared in this scope; did you mean 'Mo'?
   48 |       ll j=i+l-1,ans=Mx;
      |                      ^~
      |                      Mo
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll sum[401];
ll solve(vector<int> &slimes,int i,int j){
	if(i==j)
      return 0;
  	ll cost=LONG_MAX;
  	for(int p=i;p<j;p++)
      cost=min(cost,solve(slimes,i,p)+solve(slimes,p+1,j)+sum[j]-sum[i-1]);
  	return cost;
}
int main(){
	int n;
  	cin>>n;
  	vector<int> slimes(n+1);
  	for(int i=1;i<=n;i++)
      	cin>>slimes[i];
  	memset(slimes,0,sizeof slimes);
  	for(int i=1;i<=n;i++)
      sum[i]=sum[i-1]+slimes[i];
  	cout<<solve(slimes,1,n);
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: cannot convert 'std::vector<int>' to 'void*'
   19 |         memset(slimes,0,sizeof slimes);
      |                ^~~~~~
      |                |
      |                std::vector<int>
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C

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

int main()
{
	int n;
	cin>>n;
	vector<long long> v(n+1,0);
	for(int i=1;i<=n;i++)
	{
		cin>>v[i],v[i]+=v[i-1];
	}
	vector< vector<long long> >dp;
	dp.assign(n+1,vector<long long>(n+1,1e16) );
	for(int i=1;i<=n;i++) dp[i][i]=0;		
	for(int i=1,j=2;i<=n,j<=n;j++,i++) dp[i][j]=v[j]-v[i-1];
	for(int len=3;len<=n;len++)
	for(int i=1, j=len; j<=n; i++, j++)
	{
		long long tot=v[j]-v[i-1];
		for(int k=i;k<j;k++)
		{
			dp[i][j] = min(dp[i][j], tot+dp[i][k]+dp[k+1][j]);
		}
	}
	cout<<dp[1][n]<<endl;
} 

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

typedef long long ll;

const ll mod=1e9+7;

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

#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define rc(x)  return cout<<x<<"\n",0
#define sz(s)  (int) s.size()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;

ll t;
const int nax = 405;
const ll INF = 1e18;
ll dp[nax][nax];
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	vector<int>a(n);
	for (int& x: a) {
		scanf("%d", &x);
	}
	auto sum = [&](int L, int R) {
		ll s=0;
		for (int i=L; i<=R; i++) {
			s+=a[i];
		}
		return s;
	};
	for (int L = n-1; L>=0; L--) {
		for (int R=L; R<n; R++) {
			if (L==R) {
				dp[L][R]=0;
			}
			else {
				dp[L][R]=INF;
				ll s=sum(L,R);
				for (int i= L; i<=R-1; i++) {
					dp[L][R]=min(dp[L][R], dp[L][i] + dp[i+1][R] + s);
				}
			}
		}
	}
	cout << dp[0][n-1] << "\n
	";
}

Compiler output:
a.cc:55:31: warning: missing terminating " character
   55 |         cout << dp[0][n-1] << "\n
      |                               ^
a.cc:55:31: error: missing terminating " character
   55 |         cout << dp[0][n-1] << "\n
      |                               ^~~
a.cc:56:9: warning: missing terminating " character
   56 |         ";
      |         ^
a.cc:56:9: error: missing terminating " character
   56 |         ";
      |         ^~
a.cc: In function 'int main()':
a.cc:57:1: error: expected primary-expression before '}' token
   57 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<cstring>
#define ll long long
#define inf (1LL<<60)
using namespace std;
ll dp[3001][3001];
ll sum[3001][3001];
ll solve(vector<int> &v,int i,int j)
{
    if(i==j) return 0;
    if(dp[i][j]!=-1)
    {
        return dp[i][j];
    }
    int minC=inf;
    for(int k=i;k<j;k++)
    {
        minC=min(minC,sum[i][j]+solve(v,i,k)+solve(v,k+1,j));
    }
    return dp[i][j]=minC;
}
void pre(vector<int> &v,int n)
{
    for(int i=1;i<=n;i++)
    {
        for(int j=i;j<=n;j++)
        {
            sum[i][j]=v[j]+(i==j)?0:sum[i][j-1];
        }
    }
}
int main()
{
    int n;cin>>n;
    vector<int> v(n+1);
    memset(dp,-1,sizeof(dp));
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    pre(v,n);
    cout<<solve(v,1,n);
    return 0;
}

Compiler output:
a.cc: In function 'long long int solve(std::vector<int>&, int, int)':
a.cc:5:17: warning: overflow in conversion from 'long long int' to 'int' changes value from '1152921504606846976' to '0' [-Woverflow]
    5 | #define inf (1LL<<60)
      |             ~~~~^~~~~
a.cc:16:14: note: in expansion of macro 'inf'
   16 |     int minC=inf;
      |              ^~~
a.cc:19:17: error: no matching function for call to 'min(int&, long long int)'
   19 |         minC=min(minC,sum[i][j]+solve(v,i,k)+solve(v,k+1,j));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:19:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   19 |         minC=min(minC,sum[i][j]+solve(v,i,k)+solve(v,k+1,j));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <algorithm>
#include <iostream>
#include <climits>
#include <vector>
#include <cmath>
#include <stack>
#define int long long
using namespace std;

int main()
{
    int N;

    cin >> N;

    vector<int> arr(N);

    for (int &e : arr)
        cin >> e;
    
    vector<int> sum(N + 1);
    for (int i = 0; i < N; i++) {
        sum[i + 1] = sum[i] + arr[i];
    }

    vector<vector<int>> dp(N, vector<int>(N + 1));
    for (int len = 2; len <= N; len++) {
        for (int l = 0; l + len <= N; l++) {
            int r = l + len;
            dp[l][r] = 2e18;
            for (int m = l + 1; m < r; m++) {
                dp[l][r] = min(dp[l][r], dp[l][m] + dp[m][r] + sum[r] - sum[l]);
            }
        }
    }
    cout << dp[0][N] << endl;
}

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

#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int nax = 405;
const ll INF = 1e18L + 5; // 10^18+5
ll dp[nax][nax];
// dp[i][j] - the minimum total cost of combining interval [i,j] into one vertex

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for(int& x : a) {
        scanf("%d", &x);
    }
    auto sum = [&](int L, int R) {
        ll s = 0;
        for(int i = L; i <= R; ++i) {
            s += a[i];
        }
        return s;
    };
    for(int L = n - 1; L >= 0; --L) {
        for(int R = L; R < n; ++R) {
            if(L == R) {
                dp[L][R] = 0;
            }
            else {
                dp[L][R] = INF;
              	dp[L][R] = min(dp[L+1][R] + a[L], dp[L][R-1] + a[R];
                //ll s = sum(L, R);
                //for(int i = L; i <= R - 1; ++i) {
               //     dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R] + s);
                //}
            }
        }
    }
    
    printf("%lld\n", dp[0][n-1]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:68: error: expected ')' before ';' token
   60 |                 dp[L][R] = min(dp[L+1][R] + a[L], dp[L][R-1] + a[R];
      |                               ~                                    ^
      |                                                                    )
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int nax = 405;
const ll INF = 1e18L + 5; // 10^18+5
ll dp[nax][nax];
// dp[i][j] - the minimum total cost of combining interval [i,j] into one vertex

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for(int& x : a) {
        scanf("%d", &x);
    }
    auto sum = [&](int L, int R) {
        ll s = 0;
        for(int i = L; i <= R; ++i) {
            s += a[i];
        }
        return s;
    };
    for(int L = n - 1; L >= 0; --L) {
        for(int R = L; R < n; ++R) {
            if(L == R) {
                dp[L][R] = 0;
            }
            else {
                dp[L][R] = INF;
              	dp[L][R] = min(dp[L+1][R] + a[L], dp[L][R-1] + a[R];
                //ll s = sum(L, R);
                //for(int i = L; i <= R - 1; ++i) {
               //     dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R] + s);
                }
            }
        }
    }
    
    printf("%lld\n", dp[0][n-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:68: error: expected ')' before ';' token
   60 |                 dp[L][R] = min(dp[L+1][R] + a[L], dp[L][R-1] + a[R];
      |                               ~                                    ^
      |                                                                    )
a.cc: At global scope:
a.cc:69:11: error: expected constructor, destructor, or type conversion before '(' token
   69 |     printf("%lld\n", dp[0][n-1]);
      |           ^
a.cc:70:1: error: expected declaration before '}' token
   70 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
// #define endl "\n"

ll recurse(ll i, ll j, const vector<ll>& arr, const vector<ll>& prefix, vector<vector<ll>>& dp) {
    if (i >= j) {
        return 0;
    }
    if (i == j-1) {
        return arr[i] + arr[j];
    }

    if (dp[i][j] != -1) {
        return dp[i][j];
    }

    ll cost = prefix[j];
    if (i > 0) {
        cost = cost - prefix[i-1];
    }
    ll added = LLONG_MAX
    for (ll k = i; k < j; k++) {
        ll temp = recurse(i, k, arr, prefix, dp) + recurse(k+1, j, arr, prefix, dp);
        added = min(added, temp);
    }
    return dp[i][j] = cost + added;
}

int main(void) {
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ll n;
    cin >> n;
    vector<ll> arr (n);
    ll summ = 0;
    vector<ll> prefix (n);
    for (ll i = 0; i < n; i++) {
        cin >> arr[i];
        prefix[i] = summ + arr[i];
        summ = prefix[i];
    }
    vector<vector<ll>> dp (n, vector<ll> (n, -1));
    cout << recurse(0, n-1, arr, prefix, dp) << endl;

    
    return 0;
}

    

Compiler output:
a.cc: In function 'll recurse(ll, ll, const std::vector<long long int>&, const std::vector<long long int>&, std::vector<std::vector<long long int> >&)':
a.cc:23:5: error: expected ',' or ';' before 'for'
   23 |     for (ll k = i; k < j; k++) {
      |     ^~~
a.cc:23:20: error: 'k' was not declared in this scope
   23 |     for (ll k = i; k < j; k++) {
      |                    ^
Language: Java

import java.io.*;
import java.util.*;
 
class Main {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		long[] arr = new long[n];
		for(long i=0; i< n; i++)
			arr[i] = in.nextLong();
		long[][] dp = new  long[n][n];

		for(int i = n-1; i>=0; i--){
			for(int j = i; j<n; j++) {
				if(i==j){
					dp[i][j]=0;
				} else {
					dp[i][j] = Long.MAX_VALUE;
					for(int k=i; k<=j-1; k++){
						dp[i][j] = Math.min(dp[i][j],
							dp[i][k]+dp[k+1][j]+getSum(i,j,arr));
					}
				}
			}
		}

		System.out.println(dp[0][n-1]);

	}

	static long getSum(int l, int r, long[] arr){
     long s =0;
     for(int i =l; i<=r; i++){
     	s+=a[i];
     }
     return s;
	}
}

Compiler output:
Main.java:8: error: incompatible types: possible lossy conversion from long to int
		long[] arr = new long[n];
		                      ^
Main.java:10: error: incompatible types: possible lossy conversion from long to int
			arr[i] = in.nextLong();
			    ^
Main.java:11: error: incompatible types: possible lossy conversion from long to int
		long[][] dp = new  long[n][n];
		                        ^
Main.java:11: error: incompatible types: possible lossy conversion from long to int
		long[][] dp = new  long[n][n];
		                           ^
Main.java:13: error: incompatible types: possible lossy conversion from long to int
		for(int i = n-1; i>=0; i--){
		             ^
Main.java:27: error: incompatible types: possible lossy conversion from long to int
		System.out.println(dp[0][n-1]);
		                          ^
Main.java:34: error: cannot find symbol
     	s+=a[i];
     	   ^
  symbol:   variable a
  location: class Main
7 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1e12
#include <math.h> /* M_PI */
vector<ll> A(2000);
vector<vector<ll>> done(3000, vector<ll>(3000));
vector<vector<ll>> memo(3000, vector<ll>(3000));
vector<vector<ll>> value(3000, vector<ll>(3000));

ll dp(ll r, ll l)
{
    if (r + 1 == l)
    {
        value[r][l] = (A[r] + A[l]);
        return value[r][l];
    }
    if (r == l)
    {
        value[r][l] = A[r];
        return 0;
    }
    if (r > l)
    {
        return 0;
    }
    if (done[r][l] != 0)
    {
        return memo[r][l];
    }
    ll res = INF;
    ll index = -1; //最大値
    for (int i = 0; r + i < l; i++)
    {
        ll ans = dp(r, r + i) + dp(r + i + 1, l); //dpが答えを持つとした方が楽。
        ans += value[r][r + i] + value[r + i + 1][l];
        if (res > ans)
        {
            res = ans;
            index = r + i;
        }
    }
    value[r][l] = value[r][index] + value[index + 1][l];
    memo[r][l] = res;
    done[r][l] = 1;
    return res;
}
int main()
{
    ll n;
    cin >> n;
    cot = 0;
    rep(i, n)
    {
        cin >> A[i];
    }
    ll u = dp(0, n - 1);

    cout << u << endl; //それらを1つにした時の値はなんでしょう
    //cout << value[0][n - 1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:5: error: 'cot' was not declared in this scope; did you mean 'cos'?
   53 |     cot = 0;
      |     ^~~
      |     cos
Language: C++

/*
    author : Divyansh Gupta
*/

#include <iostream>
#include <iomanip>
#include <cstring>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <utility>
#include <map>

using namespace std;

void print_err() {
	cerr<<"\n";
}

template <class T,class... Arg>
void print_err(T x,Arg&&... args) {
	cerr<<x<<" ";
	print_err(args...);
}

#ifdef local
#define debug(...) print_err(__VA_ARGS__)
#else
#define debug(...)
#endif

#define test_case int test_cases;\
                cin>>test_cases;\
                while(test_cases--)
#define lu(var,l,r) for(var=l;var<r;var++)
#define ld(var,r,l) for(var=r;var>=l;var--)
#define ll long long
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vvi vector<vector<int> >
#define vll vector<ll>
#define vvll vector<vector<ll> >;               	
#define pii pair<int,int>                	
#define br cout<<"\n"
#define sp cout<<" "
#define pr cout<<
#define in cin>>
#define f first
#define s second                    
#define mod 1000000007
            
void solve(){
	int n,i,j,k;
	ll A[401],ans;

	ll dp[401][401];

	A[0] = 0;

	in n;

	lu(i , 1 , n + 1) {
		in A[i];
	}

	//Taking prefix sum
	lu(i , 2 , n + 1) {
		A[i] = A[i - 1] + A[i];
	}

	//Setting diagonals of dp as 0
	lu(i , 1 , n + 1) {
		dp[i][i] = 0;
	}

	//Filling up dp
	lu(i , 2 , n + 1) {
		ld(j , i - 1 , 1) {
			ans = LONG_MAX;
			lu(k , j , i) {
				ans = min(ans , 0ll + A[i] - A[j - 1] + dp[j][k] + dp[k + 1][i]);
			}
			dp[j][i] = ans;
		}
	}
	pr dp[1][n];
	br;
}

int main(){
    // test_case
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:81:31: error: 'LONG_MAX' was not declared in this scope
   81 |                         ans = LONG_MAX;
      |                               ^~~~~~~~
a.cc:14:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include <map>
  +++ |+#include <climits>
   14 |