Language: C++

//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define iinf (3000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
int n,prev=1;
int ty[105],v[105],val[20005];
double dp[20005][105];
double compute(int t,int v){
	if(t==prev){
		if(v!=0.0){
			return -inf;
		}
		else{
			return 0;
		}
	}
	if(v<0.0||v>val[t])
		return -inf;
	if(dp[t][v]!=0)
		return dp[t][v];
	return dp[t][v]=max((double)v+0.5+compute(t+1,v+1),max((double)v+compute(t+1,v),(double)v-0.5+compute(t+1,v-1)));
}
int main(){
	std::ios::sync_with_stdio(false);
	//int n,k;
	int i,j;
	cin>>n;
	rep(i,n){
		cin>>ty[i];
	}
	prev=1;
	rep(i,n){
		cin>>v[i];
		rep(j,ty[i]){
			val[j+prev]=v[i];
		}
		prev+=ty[i];
	}
	prev--;
	compute(0,0);
	cout<<dp[0][0]<<endl;
}

Compiler output:
a.cc: In function 'double compute(int, int)':
a.cc:51:15: error: reference to 'prev' is ambiguous
   51 |         if(t==prev){
      |               ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:47:7: note:                 'int prev'
   47 | int n,prev=1;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:73:9: error: reference to 'prev' is ambiguous
   73 |         prev=1;
      |         ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:47:7: note:                 'int prev'
   47 | int n,prev=1;
      |       ^~~~
a.cc:77:31: error: reference to 'prev' is ambiguous
   77 |                         val[j+prev]=v[i];
      |                               ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:47:7: note:                 'int prev'
   47 | int n,prev=1;
      |       ^~~~
a.cc:79:17: error: reference to 'prev' is ambiguous
   79 |                 prev+=ty[i];
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:47:7: note:                 'int prev'
   47 | int n,prev=1;
      |       ^~~~
a.cc:81:9: error: reference to 'prev' is ambiguous
   81 |         prev--;
      |         ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:47:7: note:                 'int prev'
   47 | int n,prev=1;
      |       ^~~~