Language: C++

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
const int size=405;
using namespace std;
int a[size]={0};
int pref[size]={0};
int dp[size][size];
int calc(int ini,int fin){
	if(dp[ini][fin]!=-1)
		return dp[ini][fin];
	if(ini+1==fin)
		return dp[ini][fin]=a[ini]+a[fin];
	if(ini==fin)
		return dp[ini][fin]=0;
	int mn=1e18+5;
	for(int i=ini;i<fin;i++){
		int ans=calc(ini,i)+calc(i+1,fin)+pref[fin]-pref[ini-1];
		mn=min(ans,mn);
	}
	dp[ini][fin]=mn;
	return dp[ini][fin];
}
int solve()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		pref[i]=pref[i-1]+a[i];
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++)
			dp[i][j]=-1;
	}
	cout<<calc(1,n);
}
signed main()
{
	fastio;
	solve();
}



Compiler output:
a.cc:25:7: error: reference to 'size' is ambiguous
   25 | int a[size]={0};
      |       ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:2:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:23:11: note:                 'const long long int size'
   23 | const int size=405;
      |           ^~~~
a.cc:26:10: error: reference to 'size' is ambiguous
   26 | int pref[size]={0};
      |          ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:23:11: note:                 'const long long int size'
   23 | const int size=405;
      |           ^~~~
a.cc:27:8: error: reference to 'size' is ambiguous
   27 | int dp[size][size];
      |        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:23:11: note:                 'const long long int size'
   23 | const int size=405;
      |           ^~~~
a.cc:27:14: error: reference to 'size' is ambiguous
   27 | int dp[size][size];
      |              ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:23:11: note:                 'const long long int size'
   23 | const int size=405;
      |           ^~~~
a.cc: In function 'long long int calc(long long int, long long int)':
a.cc:29:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |         if(dp[ini][fin]!=-1)
      |            ^~
      |            dup
a.cc:32:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   32 |                 return dp[ini][fin]=a[ini]+a[fin];
      |                        ^~
      |                        dup
a.cc:32:37: error: 'a' was not declared in this scope
   32 |                 return dp[ini][fin]=a[ini]+a[fin];
      |                                     ^
a.cc:34:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   34 |                 return dp[ini][fin]=0;
      |                        ^~
      |                        dup
a.cc:37:51: error: 'pref' was not declared in this scope
   37 |                 int ans=calc(ini,i)+calc(i+1,fin)+pref[fin]-pref[ini-1];
      |                                                   ^~~~
a.cc:40:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   40 |         dp[ini][fin]=mn;
      |         ^~
      |         dup
a.cc: In function 'long long int solve()':
a.cc:48:22: error: 'a' was not declared in this scope
   48 |                 cin>>a[i];
      |                      ^
a.cc:49:17: error: 'pref' was not declared in this scope
   49 |                 pref[i]=pref[i-1]+a[i];
      |                 ^~~~
a.cc:53:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   53 |                         dp[i][j]=-1;
      |                         ^~
      |                         dup
a.cc:56:1: warning: no return statement in function returning non-void [-Wreturn-type]
   56 | }
      | ^