Language: C++

#include<bits/stdc++.h>

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int n;cin>>n;
  vector<>t(n);
  vector<int>v(n);
  for(int i=0;i<n;i++)cin>>t[i];
  for(int i=0;i<n;i++)cin>>v[i];
  double ans=0;
  int now=0;
  for(int i=0;i<n-1;i++){
    if(v[i]>v[i+1]){
      if(v[i+1]-now<t[i]){
	double un=((t[i]+now+v[i+1])/2);
	ans+=(double)((un+now)*(un-now)/2)+(double)(un+v[i+1])*(v[i+1]-un)/2;
	now=v[i+1];
      }else{
	ans+=(double)((now+v[i])*(now-v[i])/2)+(double)((v[i]+v[i+1])*(v[i]-v[i+1])/2)+(double)(v[i]*(t[i]-(now-v[i])-(v[i]+v[i+1])));
	now=v[i+1];
      }
    }else{
      if(t[i]>=v[i]-now){
	ans+=(double)((v[i]-now)*(v[i]+now)/2)+(double)(t[i]-(v[i]-now))*(v[i]);
	now=v[i];
      }else{
	ans+=(double)(now+now+t[i])*t[i];
	now=now+t[i];
      }
    }
  }
  if(v[n-1]>0){
      if(now<t[n-1]){
	double un=((t[n-1]+now)/2);
	ans+=(double)((un+now)*(un-now)/2)+(double)(un)*(-un)/2;
	//	now=v[i+1];
      }else{
	ans+=(double)((now+v[n-1])*(now-v[n-1])/2)+(double)((v[n-1])*(v[n-1])/2)+(double)(v[n-1]*(t[n-1]-(now-v[n-1])-(v[n-1])));
	//now=v[i+1];
      }
    }else{
      if(t[n-1]>=v[n-1]-now){
	ans+=(double)((v[n-1]-now)*(v[n-1]+now)/2)+(double)(t[n-1]-(v[n-1]-now))*(v[n-1]);
	now=v[n-1];
      }else{
	ans+=(double)(now+now+t[n-1])*t[n-1];
	now=now+t[n-1];
      }
    }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: wrong number of template arguments (0, should be at least 1)
   14 |   vector<>t(n);
      |          ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: provided for 'template<class _Tp, class _Alloc> class std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:16:29: error: invalid types 'int[int]' for array subscript
   16 |   for(int i=0;i<n;i++)cin>>t[i];
      |                             ^
a.cc:22:22: error: invalid types 'int[int]' for array subscript
   22 |       if(v[i+1]-now<t[i]){
      |                      ^
a.cc:23:22: error: invalid types 'int[int]' for array subscript
   23 |         double un=((t[i]+now+v[i+1])/2);
      |                      ^
a.cc:27:104: error: invalid types 'int[int]' for array subscript
   27 |         ans+=(double)((now+v[i])*(now-v[i])/2)+(double)((v[i]+v[i+1])*(v[i]-v[i+1])/2)+(double)(v[i]*(t[i]-(now-v[i])-(v[i]+v[i+1])));
      |                                                                                                        ^
a.cc:31:11: error: invalid types 'int[int]' for array subscript
   31 |       if(t[i]>=v[i]-now){
      |           ^
a.cc:32:58: error: invalid types 'int[int]' for array subscript
   32 |         ans+=(double)((v[i]-now)*(v[i]+now)/2)+(double)(t[i]-(v[i]-now))*(v[i]);
      |                                                          ^
a.cc:35:32: error: invalid types 'int[int]' for array subscript
   35 |         ans+=(double)(now+now+t[i])*t[i];
      |                                ^
a.cc:35:38: error: invalid types 'int[int]' for array subscript
   35 |         ans+=(double)(now+now+t[i])*t[i];
      |                                      ^
a.cc:36:18: error: invalid types 'int[int]' for array subscript
   36 |         now=now+t[i];
      |                  ^
a.cc:41:15: error: invalid types 'int[int]' for array subscript
   41 |       if(now<t[n-1]){
      |               ^
a.cc:42:22: error: invalid types 'int[int]' for array subscript
   42 |         double un=((t[n-1]+now)/2);
      |                      ^
a.cc:46:100: error: invalid types 'int[int]' for array subscript
   46 |         ans+=(double)((now+v[n-1])*(now-v[n-1])/2)+(double)((v[n-1])*(v[n-1])/2)+(double)(v[n-1]*(t[n-1]-(now-v[n-1])-(v[n-1])));
      |                                                                                                    ^
a.cc:50:11: error: invalid types 'int[int]' for array subscript
   50 |       if(t[n-1]>=v[n-1]-now){
      |           ^
a.cc:51:62: error: invalid types 'int[int]' for array subscript
   51 |         ans+=(double)((v[n-1]-now)*(v[n-1]+now)/2)+(double)(t[n-1]-(v[n-1]-now))*(v[n-1]);
      |                                                              ^
a.cc:54:32: error: invalid types 'int[int]' for array subscript
   54 |         ans+=(double)(now+now+t[n-1])*t[n-1];
      |                                ^
a.cc:54:40: error: invalid types 'int[int]' for array subscript
   54 |         ans+=(double)(now+now+t[n-1])*t[n-1];
      |                                        ^
a.cc:55:18: error: invalid types 'int[int]' for array subscript
   55 |         now=now+t[n-1];
      |                  ^