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

//Jai Shree Ram
//#include <iostream>
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define loopi(stop) for(int i=0; i<stop; i++)
#define loopj(stop2) for(int j=0; j<stop2; j++)
#define loopk(stop3) for(int k=0; k<stop3; k++)
#define loopi1(stop) for(int i=1; i<=stop; i++)
#define loopj1(stop2) for(int j=1; j<=stop2; j++)
#define loopk1(stop3) for(int k=1; k<=stop3; k++)
#define loopse(kt,sstart, eend) for(int kt = sstart; kt<eend; kt++)
#define faster_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define file_io_cf freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define p_b push_back
#define pii pair<int,int>
#define fi first
#define se second
#define prec_10 << fixed << setprecision(10)
#define DEB cout<<"DEBUG"<<'\n';
#define SRAND srand(time(0));

using namespace std;

int mod = 1000000007;

template <typename T>
void O(T x) {
	cout << x << '\n';
}

///////////////////////////////////CODE STARTS HERE///////////////////////////////////////////

int32_t main()
{

	int n; cin >> n;
	list <int> l; int temp;
	loopi(n) {
		cin >> temp;
		l.p_b(temp);
	}

	int ans = 0;
	while (l.size() != 1) {
		int mini = 100000000000;
		for (list<int>::iterator i = l.begin(); i != --l.end(); i++) {
			mini = min((*i) + (*(++i)), mini); --i;
		}

		for (list<int>::iterator i = l.begin(); i != --l.end(); i++) {
			list<int>::iterator i2 = ++i;--i;

			if ((*i) + (*i2) == mini) {
				ans += mini;
				*i += *i2;
				l.erase(i2);
				break;

			}
			
		}
	}

	cout << l.top()<< '\n';


	return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:65:19: error: 'class std::__cxx11::list<long long int>' has no member named 'top'
   65 |         cout << l.top()<< '\n';
      |                   ^~~
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[500][500];
   int csum(int s , int e,int *a){
       int ans1=0;       
       forr(k,s,e+1){
       ans1+=a[k];}
       return ans1;
   } 
    
    int mixtures(int * a, int s ,int e){
        if(s>e)return 0;
        if(s==e)return a[s];
        if (dp[s][e]!=-1)return dp[s][e]; 
         dp[s][e]=INT_MAX;
        forr(i,s,e){
        dp[s][e]=min( dp[s][e], (2*mixtures(a,s,i)+2*mixtures(a,i+1,e));}
return dp[s][e];
    }
    
    signed main(){
        int n;cin>>n;
        int a[n];forr(i,0,n)cin>>a[i];
        memset(dp,-1, sizeof dp);
        cout<<mixtures(a,0,n-1);
    }

Compiler output:
a.cc: In function 'long long int mixtures(long long int*, long long int, long long int)':
a.cc:24:72: error: expected ')' before ';' token
   24 |         dp[s][e]=min( dp[s][e], (2*mixtures(a,s,i)+2*mixtures(a,i+1,e));}
      |                     ~                                                  ^
      |                                                                        )
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[500][500];
   int csum(int s , int e,int *a){
       int ans1=0;       
       forr(k,s,e+1){
       ans1+=a[k];}
       return ans1;
   } 
    
    int mixtures(int * a, int s ,int e){
        if(s>e)return 0;
        if(s==e)return a[s];
        if (dp[s][e]!=-1)return dp[s][e]; 
         dp[s][e]=INT_MAX;
        forr(i,s,e){
        dp[s][e]=min( dp[s][e], (2*mixtures(a,s,i)+2*mixtures(a,i+1,e);}
return dp[s][e];
    }
    
    signed main(){
        int n;cin>>n;
        int a[n];forr(i,0,n)cin>>a[i];
        memset(dp,-1, sizeof dp);
        cout<<mixtures(a,0,n-1);
    }

Compiler output:
a.cc: In function 'long long int mixtures(long long int*, long long int, long long int)':
a.cc:24:71: error: expected ')' before ';' token
   24 |         dp[s][e]=min( dp[s][e], (2*mixtures(a,s,i)+2*mixtures(a,i+1,e);}
      |                                 ~                                     ^
      |                                                                       )
a.cc:24:71: error: expected ')' before ';' token
   24 |         dp[s][e]=min( dp[s][e], (2*mixtures(a,s,i)+2*mixtures(a,i+1,e);}
      |                     ~                                                 ^
      |                                                                       )
Language: C++

#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 1000000000
#define INF 9223372036854775807
#define MOD 1000000007
#define mod 1000000007
#define INT_MAX_ 2147483647
#define EPS (1e-10)
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,Pll> a,pair<ll,Pll> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se.fi>b.se.fi;
}
//----------------------------------------------------------------------
ll dp[500][500];
ll sum[500];V<ll>a;
bool flag[500][500];
ll f(ll l,ll r){
    if(flag[l][r])return dp[l][r];
    flag[l][r]=1;
    ll res=INF;
    for(ll m=l;m<r;m++){
        chmin(res,sum[r]-sum[l]+a[l]+f(l,m)+f(m+1,r));
    }
    dp[l][r]=res;
    //cout<<l<<" "<<r<<" "<<dp[l][r]<<endl;
    return dp[l][r];
}
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_t=clock();
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //-------------------------------
    for(ll i=0;i<500;i++){
        for(ll j=0;j<500;j++){
            dp[i][j]=INF;
        }
        dp[i][i]=0;
    }
    cout<<f(0,n-1)<<endl;
    //-------------------------------  
    //fclose(stdin);
    //fclose(stdout);
    //ll end_t=clock();cout<<"time="<<end_t-begin_t<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------







































Compiler output:
a.cc: In function 'int main()':
a.cc:100:15: error: 'n' was not declared in this scope; did you mean 'yn'?
  100 |     cout<<f(0,n-1)<<endl;
      |               ^
      |               yn
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: expected ';' before 'long'
   14 |     v[i]+=v[i-1]
      |                 ^
      |                 ;
   15 |   long dp[n+1][n+1];
      |   ~~~~           
a.cc:19:7: error: 'dp' was not declared in this scope
   19 |       dp[i][j]=1e18;
      |       ^~
a.cc:22:5: error: 'dp' was not declared in this scope
   22 |     dp[i][i]=0;
      |     ^~
a.cc:29:9: error: 'dp' was not declared in this scope
   29 |         dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+v[j]-v[i-1]);
      |         ^~
a.cc:34:9: error: 'dp' was not declared in this scope
   34 |   cout<<dp[1][n];
      |         ^~
Language: Java

import java.util.*;
import java.io.*;
public class slimes {
    
    public static long sum(int[] arr, int i, int j) {
        int sum = 0;
        for(int k = i; k <= j; k++){
            sum += arr[k];
            
        }
        return sum;
    }

    static long solve(int[] arr, int i, int j,long[][] dp){
        if(i>= j)
            return 0;
        if(dp[i][j] != -1)
            return dp[i][j];

        long ans = Long.MAX_VALUE;
        
        for(int k = i; k < j; k++){
          ans =  Math.min(ans, solve(arr,i,k,dp) + solve(arr, k+1, j,dp) + sum(arr,i,k) + sum(arr,k+1,j));
        }

        return  dp[i][j] = ans;
        
    }
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer token;
        int n = Integer.parseInt(br.readLine().trim());
        int[] arr = new int[n];
        token = new StringTokenizer(br.readLine().trim()," ");
        for(int i = 0; i < arr.length; i++){
            arr[i] = Integer.parseInt(token.nextToken());
        }
        
        long[][] dp = new long[arr.length][arr.length];
       for(int i = 0; i < dp.length; i++)
           Arrays.fill(dp[i],-1);

       System.out.println(solve(arr, 0, arr.length-1,dp));
    }
}

Compiler output:
Main.java:3: 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>
#define ll long long int
using namespace std;
int main()
{
  ll n,x,y;
  cin>>n;
  priority_queue<int,vector<int>,greater<int>> pq;
  for(int i=0;i<n;i++)
  {
    cin>>x;
    pq.push_back(x);
  }
  ll res=0;
  while(pq.size()>1)
  {
    x=pq.top();
    pq.pop();
    y=pq.top();
    pq.push(x+y);
    res+=(x+y);
  }
  res+=pq.top();
  cout<<res<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'class std::priority_queue<int, std::vector<int>, std::greater<int> >' has no member named 'push_back'
   12 |     pq.push_back(x);
      |        ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll n,x,y;
  cin>>n;
  priority_queue<int,vector<int>,greater<int>> pq;
  for(int i=0;i<n;i++)
  {
    cin>>x;
    pq.push(x);
  }
  ll res=0;
  while(q.size()>1)
  {
    x=pq.top();
    pq.pop();
    y=pq.top();
    pq.push(x+y);
    res+=(x+y);
  }
  res+=pq.top();
  cout<<res<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'q' was not declared in this scope; did you mean 'pq'?
   15 |   while(q.size()>1)
      |         ^
      |         pq
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll n,x,y;
  cin>>n;
  priority_queue<int,vector<int>,greater<int>> pq;
  for(int i=0;i<n;i++)
  {
    cin>>x;
    pq.push_back(x);
  }
  ll res=0;
  while(q.size()>1)
  {
    x=pq.top();
    pq.pop();
    y=pq.top();
    pq.push(x+y);
    res+=(x+y);
  }
  res+=pq.top();
  cout<<res<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'class std::priority_queue<int, std::vector<int>, std::greater<int> >' has no member named 'push_back'
   12 |     pq.push_back(x);
      |        ^~~~~~~~~
a.cc:15:9: error: 'q' was not declared in this scope; did you mean 'pq'?
   15 |   while(q.size()>1)
      |         ^
      |         pq
Language: C++


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define endl "\n"
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NUint);
#define MAX 401
int inf = 1000000000005;

void start(){
	ios_base::sync_with_stdio(false);
	cin.tie(NUint);

	#ifndef ONLINE_JUDGE
		freopen("in.txt","r",stdin);
		freopen("out.txt","w",stdout);
	#endif

}

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;
    cin>>n;
    vector<int> a(n);
    for(int& x : a) {
        cin>>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]<<endl;
}

Compiler output:
a.cc:10:11: warning: overflow in conversion from 'long int' to 'int' changes value from '1000000000005' to '-727379963' [-Woverflow]
   10 | int inf = 1000000000005;
      |           ^~~~~~~~~~~~~
a.cc: In function 'void start()':
a.cc:14:17: error: 'NUint' was not declared in this scope
   14 |         cin.tie(NUint);
      |                 ^~~~~
a.cc: At global scope:
a.cc:6:12: error: expected nested-name-specifier before 'long'
    6 | #define ll long long
      |            ^~~~
a.cc:23:7: note: in expansion of macro 'll'
   23 | using ll = long long;
      |       ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long;
 
#define INF  1e18 ;
ll dp[500][500];
 
ll sum(int *arr,int s,int e) {
    ll sum1 = 0;
    for(int i = s; i <=e; i++) {
        sum1 += arr[i];
    }
    return sum1;
};
 
int main() {
	int n;
    cin>>n;
    int arr[n];
    
    for(int i=0; i<n; i++) cin>>arr[i];
    
    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] = INF;
                ll s = sum(ar, i, j);
                for(int k = i; k <= j-1; k++) {
                    dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + s);
                }
            }
        }
    } 
    cout<<dp[0][n-1];
   
}

Compiler output:
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long;
      |                 ^~~~
a.cc:6:1: note: in expansion of macro 'll'
    6 | ll dp[500][500];
      | ^~
a.cc:6:4: error: 'dp' does not name a type
    6 | ll dp[500][500];
      |    ^~
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long;
      |                 ^~~~
a.cc:8:1: note: in expansion of macro 'll'
    8 | ll sum(int *arr,int s,int e) {
      | ^~
a.cc:8:4: error: ISO C++ forbids declaration of 'sum' with no type [-fpermissive]
    8 | ll sum(int *arr,int s,int e) {
      |    ^~~
a.cc: In function 'int sum(int*, int, int)':
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long;
      |                 ^~~~
a.cc:9:5: note: in expansion of macro 'll'
    9 |     ll sum1 = 0;
      |     ^~
a.cc:9:8: error: 'sum1' was not declared in this scope; did you mean 'sum'?
    9 |     ll sum1 = 0;
      |        ^~~~
      |        sum
a.cc: In function 'int main()':
a.cc:26:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   26 |                 dp[i][j] = 0;
      |                 ^~
      |                 dup
a.cc:29:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |                 dp[i][j] = INF;
      |                 ^~
      |                 dup
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long;
      |                 ^~~~
a.cc:30:17: note: in expansion of macro 'll'
   30 |                 ll s = sum(ar, i, j);
      |                 ^~
a.cc:30:20: error: 's' was not declared in this scope
   30 |                 ll s = sum(ar, i, j);
      |                    ^
a.cc:30:28: error: 'ar' was not declared in this scope; did you mean 'arr'?
   30 |                 ll s = sum(ar, i, j);
      |                            ^~
      |                            arr
a.cc:37:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   37 |     cout<<dp[0][n-1];
      |           ^~
      |           dup
Language: C++

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

ll INF = 1e18L + 5;
ll dp[500][500];
 
ll sum(vector<int>& ar, int Left, int Right) {
    ll sum = 0;
    for(int i = Left; i <= Right; i++) {
        sum += ar[i];
    }
    return sum;
};
 
int main() {
	int n;
    cin>>n;
    vector<int> ar(n);
    
    for(int i=0; i<n; i++) cin>>ar[i];
    
    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] = INF;
                ll s = sum(ar, i, j);
                for(int k = i; k <= j-1; k++) {
                    dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + s);
                }
            }
        }
    } 
    cout<<dp[0][n-1];
    return 0;
}


Compiler output:
a.cc:5:1: error: expected initializer before 'll'
    5 | ll INF = 1e18L + 5;
      | ^~
a.cc:6:1: error: 'll' does not name a type
    6 | ll dp[500][500];
      | ^~
a.cc:8:1: error: 'll' does not name a type
    8 | ll sum(vector<int>& ar, int Left, int Right) {
      | ^~
a.cc: In function 'int main()':
a.cc:26:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   26 |                 dp[i][j] = 0;
      |                 ^~
      |                 dup
a.cc:29:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |                 dp[i][j] = INF;
      |                 ^~
      |                 dup
a.cc:29:28: error: 'INF' was not declared in this scope
   29 |                 dp[i][j] = INF;
      |                            ^~~
a.cc:30:17: error: 'll' was not declared in this scope
   30 |                 ll s = sum(ar, i, j);
      |                 ^~
a.cc:32:70: error: 's' was not declared in this scope
   32 |                     dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + s);
      |                                                                      ^
a.cc:37:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   37 |     cout<<dp[0][n-1];
      |           ^~
      |           dup
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long 
//=================================================================//
int dp[3001][3001];
int sum[3001][3001];
int solve(vector<int>&v, int i, int j) {
    if(i==j) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    int minCost = inf;
    for(int k = i;k<j;k++) {
        minCost = min(minCost,sum[i][j]+solve(v,i,k)+solve(v,k+1,j));
    }
    return dp[i][j] = minCost;
}

void preprocess(vector<int>&v, int n) {
    for(int i = 1;i<n;i++) {
        for(int j = i;j<n;j++) {
            sum[i][j] = v[j] + (j==i) ? 0 :sum[i][j-1];
        }
    }
}

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

Compiler output:
a.cc: In function 'long long int solve(std::vector<long long int>&, long long int, long long int)':
a.cc:10:19: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   10 |     int minCost = inf;
      |                   ^~~
      |                   ynf
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
 
ll dp[401][401];
vector<int> a;
ll slime(int left,int right){
	ll &ans = dp[left][right];
	if(ans!=-1)
		return dp[left][right];
	if(right==left)
		return 0;
	ans = 1e15;
	ll right = 0,left = 0;
	for(int k=right;k>=left;--k)
		right+=a[k];
	for(int k=left;k<right;++k){
		left+=a[k];
		right-=a[k];
		ans = min(slime(left,k)+slime(k+1,right)+left+right,ans);
	}
	return ans;
}
 
int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	int n;
	cin>>n;
	memset(dp,-1,sizeof dp);
	a.resize(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	cout<<slime(0,n-1);
	return 0;
}

Compiler output:
a.cc: In function 'long long int slime(int, int)':
a.cc:15:12: error: declaration of 'long long int right' shadows a parameter
   15 |         ll right = 0,left = 0;
      |            ^~~~~
a.cc:8:23: note: 'int right' previously declared here
    8 | ll slime(int left,int right){
      |                   ~~~~^~~~~
a.cc:15:22: error: declaration of 'long long int left' shadows a parameter
   15 |         ll right = 0,left = 0;
      |                      ^~~~
a.cc:8:14: note: 'int left' previously declared here
    8 | ll slime(int left,int right){
      |          ~~~~^~~~
Language: C++

//n - slimes
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define mod 1000000007

ll dp[100000][100000] = {0};
ll n;
ll solve(vector<ll> &A) {



	ll sum1[1000000];
	for (ll i = 0; i < n; i++)
	{
		sum1[i] += ((i > 0) ? sum1[i - 1] : 0) + A[i];

	}


	for (ll d = 1; d < n; d++) {

		ll i = 0, j = d;

		while (j < n) {
			ll ans = 1e15;
			for (ll k = i; k < j; k++)
			{
				ans = min ( ans, dp[i][k] + dp[k + 1][j] + (sum1[j] - ((i > 0) ? sum1[i - 1] : 0 )));
			}


			dp[i][j] = ans;
			i++; j++;
		}
	}
	return dp[0][n - 1];
}


int main() {



	cin >> n;
	vector<ll> A;
	for (ll i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		A.push_back(a);
	}
	cout << solve(A);
	return 0;
}



Compiler output:
/tmp/cczD7c5z.o: in function `solve(std::vector<long long, std::allocator<long long> >&)':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczD7c5z.o
a.cc:(.text+0x1b8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczD7c5z.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczD7c5z.o
a.cc:(.text+0x1df): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczD7c5z.o
/tmp/cczD7c5z.o: in function `main':
a.cc:(.text+0x20c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczD7c5z.o
a.cc:(.text+0x269): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczD7c5z.o
collect2: error: ld returned 1 exit status
Language: C++

//n - slimes
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define mod 1000000007

ll dp[100000][100000] = {0};
ll n;
ll solve(vector<ll> &A) {



	ll sum1[1000000] = {0};
	for (ll i = 0; i < n; i++)
	{
		sum1[i] += ((i > 0) ? sum1[i - 1] : 0) + A[i];

	}


	for (ll d = 1; d < n; d++) {
		ll i = 0, j = d;
		while (j < n) {
			ll ans = INT_MAX;
			for (ll k = i; k < j; k++) {
				ans = min ( ans, dp[i][k] + dp[k + 1][j] + sum1[j] - ((i > 0) ? sum1[i - 1] : 0 ));
				//cout << ans << " ";


			}

			//cout << ans << " ";
			dp[i][j] = ans;
			i++; j++;
		}
	}
	return dp[0][n - 1];
}


int main() {



	cin >> n;
	vector<ll> A;
	for (ll i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		A.push_back(a);
	}
	cout << solve(A);
	return 0;
}



Compiler output:
/tmp/ccz5JxEZ.o: in function `solve(std::vector<long long, std::allocator<long long> >&)':
a.cc:(.text+0x94): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccz5JxEZ.o
a.cc:(.text+0x1c9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccz5JxEZ.o
a.cc:(.text+0x1df): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccz5JxEZ.o
a.cc:(.text+0x1f0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccz5JxEZ.o
/tmp/ccz5JxEZ.o: in function `main':
a.cc:(.text+0x21d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccz5JxEZ.o
a.cc:(.text+0x27a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccz5JxEZ.o
collect2: error: ld returned 1 exit status
Language: C++

//n - slimes
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define mod 1000000007

ll dp[100000][100000] = {0};
ll n;
ll solve(vector<ll> &A) {



	ll sum1[1000000] = {0};
	for (ll i = 0; i < n; i++)
	{
		sum1[i] += ((i > 0) ? sum1[i - 1] : 0) + A[i];

	}


	for (ll d = 1; d < n; d++) {
		ll i = 0, j = d;
		while (j < n) {
			ll ans = INT_MAX;
			for (ll k = i; k < j; k++) {
				ans = min ( ans, dp[i][k] + dp[k + 1][j] + sum1[j] - ((i > 0) ? sum1[i - 1] : 0 ));
				//cout << ans << " ";


			}

			//cout << ans << " ";
			dp[i][j] = ans;
			i++; j++;
		}
	}
	return dp[0][n - 1];
}


int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	cin >> n;
	vector<ll> A;
	for (ll i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		A.push_back(a);
	}
	cout << solve(A);
	return 0;
}



Compiler output:
/tmp/ccABa703.o: in function `solve(std::vector<long long, std::allocator<long long> >&)':
a.cc:(.text+0x94): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccABa703.o
a.cc:(.text+0x1c9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccABa703.o
a.cc:(.text+0x1df): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccABa703.o
a.cc:(.text+0x1f0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccABa703.o
/tmp/ccABa703.o: in function `main':
a.cc:(.text+0x263): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccABa703.o
a.cc:(.text+0x2c0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccABa703.o
collect2: error: ld returned 1 exit status
Language: C++

#include "bits/stdc++.h"

typedef long long int lli;
using namespace std;

lli answer;
int N, combined;

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

    cin >> N;

    vector<lli> sizes(N);
    for (lli &s : sizes) cin >> s;

    while (combined != N - 1) {
        int sOne(0), sTwo(1);

        for (int i = 1; i < N - 1 - combined; i++) {
            if (sizes[i] + sizes[i + 1] < sizes[sOne] + sizes[sTwo])
                sOne = i, sTwo = i + 1;
        }

        lli newValue = sizes[sOne] + sizes[sTwo];
        answer += newValue;
        combined++;

        sizes[sTwo] = LONG_LONG_INT_MAX;
        sizes[sOne] = newValue;

        sort(sizes.begin(), sizes.end());
    }

    cout << answer << "\n";

    // --------------------
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:23: error: 'LONG_LONG_INT_MAX' was not declared in this scope; did you mean 'LONG_LONG_MAX'?
   31 |         sizes[sTwo] = LONG_LONG_INT_MAX;
      |                       ^~~~~~~~~~~~~~~~~
      |                       LONG_LONG_MAX
Language: C++

/*

This question is nice application of Matrix Chain Multiplication.
because here we have to partition the range into two parts like we do in MCM
and after that calculate the answer on those parts which will be furthur used 
to find the answer.

created by sanyam singhal
*/

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

#define pb push_back
#define mp make_pair
#define ll long long int
#define mod 1000000007
#define w(t) int t;	cin>>t while(t--)
#define triplet pair<int,pair<int,int>>
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define fastIO ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
#define loop(i, k, n) for(ll i=k; i<n; i+=1)
#define loop2(i, k, n) for(ll i=k; i>=n; i--)

const ll inf = 1e18;
const int N = 500;

ll dp[N][N];
ll sumij[N][N];

// void take_fileIO(){
//   #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
//   #endif
//   return;
// }

ll solve_by_dp(vector<ll> &a, ll i, ll j){
  if(j==i){ // if the size is 1 then we dont need to combine it with anything
    return 0;
  }
  else if(dp[i][j]!=-1)
    return dp[i][j];
  else{
    ll ans = LLONG_MAX;
    for(ll k=i+1; k<=j; k++){
      ll part1 = solve_by_dp(a, i, k-1);  //solving for range (i, k-1)
      ll part2 = solve_by_dp(a, k, j);    //solving for range (k, j)

      //after we have calculated cost for combining the slimes in separate parts
      //then our answer will be sum of cost for those parts and
      //cost which will be incurred when we combine these two slimes which is nothing but sum of elements in this range.
      ll curr_ans = part1 + part2 + sumij[i][j];
      // cout<<curr_ans<<endl;
      if(curr_ans < ans){
        ans = curr_ans;
      }
    }
    return dp[i][j] = ans;
  }
}

void solve(){
  ll n; cin>>n;
  vector<ll>a(n);
  loop(i, 0, n) 
    cin>>a[i];

  memset(dp, -1, sizeof(dp));
  // loop(i, 0, n)
  //   cout<<a[i]<<" ";

  for(int i=0; i<n; i++){
    for(int j=i; j<n; j++){
      if(i==j){
        sumij[i][j] = a[j];
        continue;
      }
      sumij[i][j] = a[j] + sumij[i][k-1] + sumij[k][j];
    }
  }

  // for(int i=0; i<n; i++){
  //   for(int j=0; j<n; j++){
  //     cout<<sumij[i][j]<<" ";
  //   }
  //   cout<<endl;
  // }

  cout<<solve_by_dp(a, 0, n-1)<<endl;
  return;
}

int main(){

  fastIO;
  // take_fileIO();
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:83:37: error: 'k' was not declared in this scope
   83 |       sumij[i][j] = a[j] + sumij[i][k-1] + sumij[k][j];
      |                                     ^
Language: C++

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

typedef long long ll;
const ll mod = 1e9+7;

const ll INF = 1e18 + 7;
ll sum(int i,int j,int * a){
	ll res = 0;
	for(auto k = i;k<=j;++k)
		res += a[k];
	return res;
}
int main(int argc, const char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;


	int n,i,j,k;
	cin>>n;
	int a[n];
	for(i=0;i<n;++i)
		cin>>a[i];

	ll dp[n][n];

	for(i=n-1;i>=0;--i){
		for(j=i;j<n;++j){
			if(i == j)
				dp[i][j] = 0;
			else{
				dp[i][j] = INF;
				ll s = sum(i,j);
				for(k=i;k<j;++k){
					dp[i][j] = min(dp[i][j],dp[i][k] + dp[k+1][j] + s);
				}
			}
		}
	}
    cout<<dp[0][n-1]<<"\n";
#ifndef LOCAL_DEFINE
    cerr << "Time elapsed: "<< 1e1 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif // LOCAL_DEFINE
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:42:43: error: too few arguments to function 'll sum(int, int, int*)'
   42 |                                 ll s = sum(i,j);
      |                                        ~~~^~~~~
a.cc:15:4: note: declared here
   15 | ll sum(int i,int j,int * a){
      |    ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int N =1000;

typedef long long ll;

ll f[N][N];
int a[N],s[N]; 

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)	{
		cin>>a[i];
		s[i]+=s[i-1]+a[i];	
	}
	memset(f,0,sizeof(f));
	for(int len=2;len<n;len++)
	{
		for(int i=1;i+len-1<=n;i++)
		{
			int j=i+len-1;
			f[i][j]=2e18;
			for(int k=i;k<j;k++)
			f[i][j]=min(f[i][j],f[i][k]+f[k+1][j]+s[j]-s[i-1]);
		}
	}
	cout<<f[1][n]<<endl;
}#include<bits/stdc++.h>

using namespace std;

const int N =1000;

typedef long long ll;

ll f[N][N];
int a[N],s[N]; 

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)	{
		cin>>a[i];
		s[i]+=s[i-1]+a[i];	
	}
	memset(f,0,sizeof(f));
	for(int len=2;len<n;len++)
	{
		for(int i=1;i+len-1<=n;i++)
		{
			int j=i+len-1;
			f[i][j]=2e18;
			for(int k=i;k<j;k++)
			f[i][j]=min(f[i][j],f[i][k]+f[k+1][j]+s[j]-s[i-1]);
		}
	}
	cout<<f[1][n]<<endl;
}

Compiler output:
a.cc:32:2: error: stray '#' in program
   32 | }#include<bits/stdc++.h>
      |  ^
a.cc:32:3: error: 'include' does not name a type
   32 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:36:11: error: redefinition of 'const int N'
   36 | const int N =1000;
      |           ^
a.cc:5:11: note: 'const int N' previously defined here
    5 | const int N =1000;
      |           ^
a.cc:40:4: error: redefinition of 'll f [1000][1000]'
   40 | ll f[N][N];
      |    ^
a.cc:9:4: note: 'll f [1000][1000]' previously declared here
    9 | ll f[N][N];
      |    ^
a.cc:41:5: error: redefinition of 'int a [1000]'
   41 | int a[N],s[N];
      |     ^
a.cc:10:5: note: 'int a [1000]' previously declared here
   10 | int a[N],s[N];
      |     ^
a.cc:41:10: error: redefinition of 'int s [1000]'
   41 | int a[N],s[N];
      |          ^
a.cc:10:10: note: 'int s [1000]' previously declared here
   10 | int a[N],s[N];
      |          ^
a.cc:43:5: error: redefinition of 'int main()'
   43 | int main()
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
#define ll long long
ll dp[405][405];
#define MAX=1e18+5;
int main()
{
  fin;
  int n,i;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  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]=MAX;
        ll s=sum(l,r);
        for(i=l;i<=r;i++)
          dp[l][r]=min(dp[l][r],dp[l][i]+dp[i+1][r]+s);
      }
    }
  }
  cout<<dp[0][n-1];
}


Compiler output:
a.cc:6:9: warning: ISO C++11 requires whitespace after the macro name
    6 | #define MAX=1e18+5;
      |         ^~~
a.cc: In function 'int main()':
a.cc:6:12: error: expected primary-expression before '=' token
    6 | #define MAX=1e18+5;
      |            ^
a.cc:30:18: note: in expansion of macro 'MAX'
   30 |         dp[l][r]=MAX;
      |                  ^~~
Language: Java

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

public class Slimes {
    public static long INF = Long.MAX_VALUE/2;
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(f.readLine());
        long[] arr = new long[n];
        StringTokenizer st = new StringTokenizer(f.readLine());
        for(int i = 0; i < arr.length; i++){
            arr[i] = Long.parseLong(st.nextToken());
        }
        long[][] dp = new long[n][n];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                dp[i][j] = INF;
                if(i == j) dp[i][j] = 0;
            }
        }
        for(int j = 1; j < n; j++){
            for(int i = 0; i < n; i++){
                if(i+j < n){
                    long sum = 0;
                    for(int k = i; k <= i+j; k++) sum+=arr[k];
                    for(int k = i; k < i+j; k++){
                        dp[i][i+j] = Math.min(dp[i][i+j], sum+dp[i][k]+dp[k+1][i+j]);
                    }
                }
            }
        }
        out.println(dp[0][n-1]);
        out.close();
    }
}


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 <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  int n; cin >> n;
  vector<long long> v(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  long long ans = 0;
  for(int len = 0;v.size() > 1; ++len) {
    vector<long long> new_v;
    int best = INT_MAX, best_index = 0;
    for(int j = 0; j + 1< v.size(); ++j) {
      if(v[j] + v[j + 1] < best) {
        best = v[j] + v[j + 1];
        best_index = j;
      }
    }
    for(int j = 0; j < v.size(); ++j) {
      if(j == best_index) {
        new_v.push_back(v[j] + v[j + 1]);
        ans += v[j] + v[j + 1];
        ++j;
      }else {
        new_v.push_back(v[j]);
      }
    }
    swap(new_v, v);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: 'INT_MAX' was not declared in this scope
   17 |     int best = INT_MAX, best_index = 0;
      |                ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cmath>
  +++ |+#include <climits>
    7 | 
a.cc:21:9: error: 'best_index' was not declared in this scope
   21 |         best_index = j;
      |         ^~~~~~~~~~
a.cc:25:15: error: 'best_index' was not declared in this scope
   25 |       if(j == best_index) {
      |               ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios :: sync_with_studio(false);
	cin.tie(0);
	long long n;
	cin >> n;
	long long sum[n+1],j,l,q,i,k,a[n+1];
	long long dp[n+1][n+1]={ };
	a[0] = 0;
	sum[0] = 0;
	for(i=1;i<=n;i++)
	{
		cin >> a[i];
		sum[i]=a[i]+sum[i-1];
	}
	//matrix multiplication idea
	for(l=2;l<=n;l++)
	{
		for(i=1;i<=(n-l+1);i++)
		{
			j=i+l-1;
			dp[i][j] = INT_MAX;
			for(k=i;k<j;k++)
			{
				q = dp[i][k]+dp[k+1][j]+sum[j]-sum[i-1];
				if(q<dp[i][j])
				{
					dp[i][j] = q;
				}
			}
		}
	}
	cout << dp[1][n] <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: 'sync_with_studio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
    5 |         ios :: sync_with_studio(false);
      |                ^~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll in_max = 1e18;

int main()
{
  int n;
  cin >> n;
  ll arr[n];
  for(int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr+n);
  vector<ll> vec(n-1);
  ll sm = arr[0]
  for(int i = 1; i < n; i++) {sm += arr[i]; vec.push_back(sm);}
  ll res = 0;
  for(ll u : vec) res += u;
  cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: expected ',' or ';' before 'for'
   15 |   for(int i = 1; i < n; i++) {sm += arr[i]; vec.push_back(sm);}
      |   ^~~
a.cc:15:18: error: 'i' was not declared in this scope
   15 |   for(int i = 1; i < n; i++) {sm += arr[i]; vec.push_back(sm);}
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll in_max = 1e18;

int main()
{
  int n;
  cin >> n;
  int arr[n];
  for(int i = 0; i < n; i++) cin >> arr[i];
  ll dp[n][n];
  for(int i = 0; i < n; i++) for(j = 0; j < n; j++) dp[i][j] = in_max;
  for(int i = 0; i < n; i++) dp[i][i] = arr[i]*1LL;
  
  for(int i = n - 2; i >= 0; --i)
  {
    for(int j = i+1; j < n; j++)
    {
      if(j - i == 1) dp[i][j] = (arr[i]+arr[j])*1LL;
      for(int k = i+1; k < j; k++)
      {
        dp[i][j] = min(dp[i][j], dp[i][k]+ dp[k][j]);
      }
    }
  }
  cout << dp[1][n-1] << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:13:34: error: 'j' was not declared in this scope
   13 |   for(int i = 0; i < n; i++) for(j = 0; j < n; j++) dp[i][j] = in_max;
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator sl
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v,u;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>o;
        v.PSB(o);
    }
    s=0;
    while(v.SZ!=1)
    {
        q=0;
        z=999999999999;
        m=v.SZ-1
        for(j=0; j<m; j++)
        {
            if(v[j]+v[j+1]<z)
            {
                z=v[j]+v[j+1];
                q=j;
            }
        }
        k=v[q]+v[q+1];
        v[q]=k;
        v.erase(v.B+q+1);
        s+=k;
    }
    cout<<s<<endl;


    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:53:17: error: expected ';' before 'for'
   53 |         m=v.SZ-1
      |                 ^
      |                 ;
   54 |         for(j=0; j<m; j++)
      |         ~~~      
a.cc:54:26: error: expected ';' before ')' token
   54 |         for(j=0; j<m; j++)
      |                          ^
      |                          ;
Language: C++

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

int main()
{
	long long int n,i;
	cin>>n;
	long long int a[n],ans=0;
	for(i=0;i<n;i++)
		cin>>a[i];
	
	priority_queue<long long int,vector<long long int>,greater<long long int>> pq(a,a+n);
	while(pq.size()!=1)
	{
		long long int first,second;
		first=pq.top();
		pq.pop();
		second=pq.top();
		pq.pop();
		
		ans+=first+second;
		pq.push(first+second);
	}
	
	cout<<ans<<endl;
	
	
}

Compiler output:
a.cc:2:15: error: stray '#' in program
    2 |   using namesp#include<bits/stdc++.h>
      |               ^
a.cc:2:9: error: expected nested-name-specifier before 'namesp'
    2 |   using namesp#include<bits/stdc++.h>
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:13:9: error: 'priority_queue' was not declared in this scope; did you mean 'std::priority_queue'?
   13 |         priority_queue<long long int,vector<long long int>,greater<long long int>> pq(a,a+n);
      |         ^~~~~~~~~~~~~~
      |         std::priority_queue
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157:
/usr/include/c++/14/bits/stl_queue.h:496:11: note: 'std::priority_queue' declared here
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
a.cc:13:24: error: expected primary-expression before 'long'
   13 |         priority_queue<long long int,vector<long long int>,greater<long long int>> pq(a,a+n);
      |                        ^~~~
a.cc:14:15: error: 'pq' was not declared in this scope
   14 |         while(pq.size()!=1)
      |               ^~
a.cc:26:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |         cout<<ans<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:26:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   26 |         cout<<ans<<endl;
      |                    ^~~~
      |                    std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~