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

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define __int64 long long
const ll M=1000000007;
int n,sum,pos;
int t[211];
int v[211];
int r[211];
double x[211111];


bool che(int nnow,double nnv){

	int now=nnow;
	int sum=0;
	double nv=nnv;

	for(int i=pos;i<n;i++){
		int mi;
		if(i==pos){
			if(pos==0)mi=t[i]-now;
			else mi=t[i]-now+r[i-1];
		}
		else mi=t[i];

		if(nv>v[i])return 0;
		nv-=mi*0.5;
		now=t[i];
	}
	if(nv>0)return 0;
	return 1;
}

int main(){
	cin>>n;
	rep(i,n)cin>>t[i];
	rep(i,n)t[i]*=2;
	rep(i,n)sum+=t[i];
	rep(i,n)r[i]=t[i];
	for(int i=1;i<n;i++)r[i]+=r[i-1];
	rep(i,n)cin>>v[i];
	
	int cnt=t[0];

	for(int i=1;i<sum*2;i++){

		double last=0;
		double l=-0.5,r=0.5,mid=0;
		if(i>0)last=x[i-1];
		
		rep(j,50){
			if(che(i,last+mid))l=mid;
			else r=mid;
			mid=(l+r)/2;
		}
		
		x[i]=max(0.0,last+mid);
		//cout<<i<<" "<<pos<<" "<<x[i]<<endl;
		if(i>=cnt){
			cnt+=t[++pos];
		}

	}

	


	double ans=0;
	for(int i=1;i<=2*sum;i++){
			if(x[i]==x[i-1])ans+=x[i]*0.5;
			else{
				double ma=max(x[i],x[i-1]),mi=min(x[i],x[i-1]);
				ans+=mi*0.5+(ma-mi)/2*0.5;
			}
	}

	printf("%.20lf\n",ans);

	return 0;
}

Compiler output:
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | #define ll __int64
      |            ^~~~~~~
a.cc:18:7: note: in expansion of macro 'll'
   18 | const ll M=1000000007;
      |       ^~
Language: C++

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(int i = 0; i < n; i++)
using namespace std;

double vel_max(double t, double start, double end, double limit){
  if(t<start){
    return limit + (start - t);
  }else if(t<end){
    return limit;
  }else{
    return limit + (t-end);
  }
}

int main() {
  int n;
  cin >> n;
  int t[n+1], v[n+2];
  t[0] = 0;
  ll tsum = 0;
  REP(i,n){
    int tm;
    cin >> tm;
    t[i+1] = t[i] + tm;
    tsum += tm;
  }
  v[0]=0;
  REP(i,n){
    cin >> v[i+1];
  }
  v[n+1]=0;
  double velocity[2*tsum+1];
  REP(i,2*tsum+1){
    double vmin = 20000.0;
    REP(j,n+2){
      double vj;
      if(j==0){
        vj = vel_max(i/2.0,t[j],t[j],v[j]);
      }else if(j==n+1){
        vj = vel_max(i/2.0,t[j-1],t[j-1],v[j]);
      }else{
        vj = vel_max(i/2.0,t[j-1],t[j],v[j]);
      }
      if(vj<vmin){
        vmin = vj;
      }
    }
    velocity[i]=vmin;
  }
  double distance = 0.0;
  REP(j,2*tsum){
    distance += velocity[j]+velocity[j+1];
  }
  cout<< distance/4.0 << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'll' was not declared in this scope
   26 |   ll tsum = 0;
      |   ^~
a.cc:31:5: error: 'tsum' was not declared in this scope; did you mean 'tm'?
   31 |     tsum += tm;
      |     ^~~~
      |     tm
a.cc:38:21: error: 'tsum' was not declared in this scope; did you mean 'tm'?
   38 |   double velocity[2*tsum+1];
      |                     ^~~~
      |                     tm
a.cc:54:5: error: 'velocity' was not declared in this scope
   54 |     velocity[i]=vmin;
      |     ^~~~~~~~
a.cc:58:17: error: 'velocity' was not declared in this scope
   58 |     distance += velocity[j]+velocity[j+1];
      |                 ^~~~~~~~
Language: C++

// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include<bitset>
#include <type_traits>
#include <vector>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 100000
#define INF 93193111451418101
#define MIN -933111451418101
#define EPS 1e-9
#define pb push_back
using namespace std;
typedef pair<ll, ll> P;
typedef pair<double, double> dop;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
	for (auto &i : arr) {
		fill_all(i, v);
	}
}
//------------------変数-----------------------//
ll n;
double dp[30000][309]; // [time,speed]
std::vector<ll> t, v;
ll speed[114514];//[time]=speed
//-------------------関数----------------------//

int main() {
	cin >> n;
	ll maxtime = 0;//合計の時間
	REP(i, n) {
		ll h;
		cin >> h;
		t.pb(h);
		maxtime += h;
	}
	REP(i, n - 1) { t[i + 1] += t[i]; }//imos
	REP(i, n) {
		ll h;
		cin >> h;
		v.pb(h);
	}
	ll itr = 0;
	REP(i, maxtime) {
		if (t[itr] == i) {
			itr++;
		}
		speed[i] = v[itr];//その時のspeed
	}
	fill_all(dp, (double)-1919191919);
	dp[0][0] = 0;
	REP(i, maxtime) {//time
		REP(j, 301) {//speed
			if (dp[i][j] == -1919191919) { continue; }
			for (ll k = -1; k < 2; k++) {//-1=down,0= straight,1= up
				if (j + k > speed[i + 1] || j + k < 0) {//speedが上限を超えているor0より下
					continue;
				}
				if (k == 1 && j  == speed[i]) {//上がっていく際に、
					continue;
				}
				dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] + j + k * 0.5);
			}
			if (speed[i] >= 1 + j&& speed[i+1] >= 1 + j) {
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + 0.25 + j);
			}
		}
	}
	printf("%.10f\n", dp[maxtime][0]);
}


Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include<bitset>
#include <type_traits>
#include <vector>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 100000
#define INF 93193111451418101
#define MIN -933111451418101
#define EPS 1e-9
#define pb push_back
using namespace std;
typedef pair<ll, ll> P;
typedef pair<double, double> dop;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
	for (auto &i : arr) {
		fill_all(i, v);
	}
}
//------------------変数-----------------------//
ll n;
double dp[30000][101]; // time,v
std::vector<ll> t, v;
ll speed[114514];
//-------------------関数----------------------//

int main() {
	cin >> n;
	ll maxtime = 0;
	REP(i, n) {
		ll h;
		cin >> h;
		t.pb(h);
		maxtime += h;
	}
	REP(i, n - 1) { t[i + 1] += t[i]; }
	REP(i, n) {
		ll h;
		cin >> h;
		v.pb(h);
	}
	ll itr = 0;
	REP(i, maxtime) {
		if (t[itr] == i) {
			itr++;
		}
		speed[i] = v[itr];
	}
	// REP(i, maxtime) { cout << speed[i] << " " << i << endl; }
	fill_all(dp, (double)-1919191919);
	dp[0][0] = 0;
	REP(i, maxtime) {
		REP(j, 101) {
			for (ll k = -1; k < 2; k++) {
				if (j + k > speed[i + 1] || j + k < 0) {
					continue;
				}
				if (k == 1 && j + k > speed[i]) {
					continue;
				}
				if (k == -1 && j + k > speed[i]) {
					continue;
				}
				dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] + j + k * 0.5);
			}
			if (speed[i] >= 1 + j&& speed[i+1] >= 1 + j) {
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + 0.25 + j);
			}
		}
	}
	printf("%.10f\n", dp[maxtime][0]);
}


Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

const int N_MAX = 100;
double V[N_MAX+2];
double S_T[N_MAX+2];
double E_T[N_MAX+2];

double solve(int n) {
  double ans = 0;
  double prev_v = 0;
  for (int t = 0; t <= E_T[n+1]*2; t++) { // t is 0.5 unit
    double v = INT_MAX;
    double time = t;
    time /= 2;
    for (int j = 0; j < n+2; j++) {
      if (S_T[j] > time) {
	v = min(v, V[j] + S_T[j] - time);
      }
      else if (S_T[j] <= time && time < E_T[j]) {
	v = min(v, V[j]);
      }
      else if (E_T[j] <= time) {
	v = min(v, V[j] + time - E_T[j]);
      }
    }

    ans += 0.25*(v + prev_v);
    prev_v = v;

  }
  return ans;
}

int main() {
  int N;
  cin >> N;

  S_T[0] = 0;
  E_T[0] = 0;
  for (int i = 1; i < N+1; i++) {
    int t;
    cin >> t;
    S_T[i] = E_T[i-1];
    E_T[i] = t + S_T[i];
  }
  S_T[N+1] = E_T[N];
  E_T[N+1] = S_T[N+1];

  V[0] = 0;
  for (int i = 1; i < N+1; i++) {
    cin >> V[i];
  }
  V[N+1] = 0;

  cout << solve(N) << endl;
}

Compiler output:
a.cc: In function 'double solve(int)':
a.cc:13:16: error: 'INT_MAX' was not declared in this scope
   13 |     double v = INT_MAX;
      |                ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<numeric>
#include<iomanip>
#include<climits>
using namespace std;

vector<double> makeTable(int n, int l, int r, double v, double a)
{
	vector<double> table(n, v);

	for(int i=0; i<n; i++){
		if(i < l)
			table[i] = v + a*(l - i);
		else if(i > r)
			table[i] = v + a*(i - r);
	}

	return table;
}

int main(void)
{
	int N;
	cin >> N;

	vector<int> t(N);
	for(int i=0; i<N; i++)
		cin >> t[i];

	vector<int> v(N);
	for(int i=0; i<N; i++)
		cin >> v[i];

	const int sum_t = accumulate(t.begin(), t.end(), 0);
	int tt = 0;
	const double a = 0.5;
	vector<vector<double>> table(N+2);
	for(int i=0; i<N; i++){
		int left = 2 * tt;
		int right = left + 2 * t[i];
		table[i] = makeTable(2*sum_t+1, left, right, v[i], a);
		tt += t[i];
	}
	table[N] = makeTable(2*sum_t+1, 0, 0, 0.0, a);
	table[N+1] = makeTable(2*sum_t+1, 2*sum_t, 2*sum_t, 0.0, a);

	vector<double> graph(2*sum_t + 1, DBL_MAX);
	for(int i=0; i<table.size(); i++)
		for(int j=0; j<graph.size(); j++)
			graph[j] = min(graph[j], table[i][j]);

	double ret = 0.0;
	for(int i=0; i<graph.size()-1; i++)
		ret += (graph[i]+graph[i+1]) / 4.0;

	cout << fixed << setprecision(20) << ret << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:43: error: 'DBL_MAX' was not declared in this scope
   50 |         vector<double> graph(2*sum_t + 1, DBL_MAX);
      |                                           ^~~~~~~
a.cc:8:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
    7 | #include<climits>
  +++ |+#include <cfloat>
    8 | using namespace std;
Language: C

#include <stdio.h>

int n;
int total = 0;
int t[300] = {0};
int vs[300] = {0};

double f(double l, double r, double v, double x) {
	if(x < l) return v + l - x;
	if(l <= x && x <= r) return v;
	return v + x - r;
}

double vel(double x) {
	double minv = f(0, 0, 0, x);
	double new = f(total, total, 0, x);
	minv = minv < new ? minv : new;
	int i;
	double l = 0, r = 0;
	for(i=0;i<n;i++) {
		r += t[i];
		new = f(l, r, vs[i], x);
		minv = minv < new ? minv : new;
		l = r;
	}
	return minv;
}

int main() {
	scanf("%d", &n);
	for(i=0;i<n;i++) {
		scanf("%d", &t[i]);
		total += t[i];
	}
	for(i=0;i<n;i++) {
		scanf("%d", &vs[i]);
	}
	double area = 0;
	for(i=0;i<total;i++) {
		area += 0.25 * (vel(i) + 2 * vel(i+0.5) + vel(i+1));
	}
	printf("%f\n", area);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:13: error: 'i' undeclared (first use in this function)
   31 |         for(i=0;i<n;i++) {
      |             ^
main.c:31:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int n;
int total = 0;
int t[300] = {0};
int vs[300] = {0};

double f(double l, double r, double v, double x) {
	if(x < l) return v + l - x;
	if(l <= x && x <= r) return v;
	return v + x - r;
}

double vel(double x) {
	double minv = f(0, 0, 0, x);
	double new = f(total, total, 0, x);
	minv = minv < new ? minv : new;
	int i;
	double l = 0, r = 0;
	for(i=0;i<n;i++) {
		r += t[i];
		new = f(l, r, v[i], x);
		minv = minv < new ? minv : new;
		l = r;
	}
	return minv;
}

int main() {
	scanf("%d", &n);
	for(i=0;i<n;i++) {
		scanf("%d", &t[i]);
		total += t[i];
	}
	for(i=0;i<n;i++) {
		scanf("%d", &vs[i]);
	}
	double area = 0;
	for(i=0;i<total;i++) {
		area += 0.25 * (vel(i) + 2 * vel(i+0.5) + vel(i+1))
	}
	printf("%d\n", area);
	return 0;
}

Compiler output:
main.c: In function 'vel':
main.c:22:31: error: 'v' undeclared (first use in this function)
   22 |                 new = f(l, r, v[i], x);
      |                               ^
main.c:22:31: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:31:13: error: 'i' undeclared (first use in this function)
   31 |         for(i=0;i<n;i++) {
      |             ^
main.c:40:68: error: expected ';' before '}' token
   40 |                 area += 0.25 * (vel(i) + 2 * vel(i+0.5) + vel(i+1))
      |                                                                    ^
      |                                                                    ;
   41 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;

int N;
int t[110],v[110];
int maxV[40010];
//x,y方向に二倍
double dp[40010][240];
int endTime=0;
int tempEndTime=0;
double ans;
int main(){
  cin>>N;

  rep(i,40010)rep(j,240)dp[i][j]=-1;
  rep(i,N){
    cin>>t[i];
    t[i]*=2;
    endTime+=t[i];
  }
  rep(i,N){
    cin>>v[i];
    v[i]*=2;
  }
  for(int i=0;i<40010;i++){
    int temp=0;
    for(int j=0;j<N;j++){
      temp+=t[j];
      if(temp>=i){
        maxV[i]=v[j];
        break;
      }
    }
  }


  // //speedが増える時
  // (speed+(speed+1))*1/2
  // //speedが減る時
  // (speed+(speed-1)*1)/2
  // //speedが変わらないとき
  // (speed+speed)*1/2;
  dp[0][0]=0;
  for(int Time = 1; Time <=endTime;Time++){
    for(int speed=0;speed <=220;speed++){
      if(dp[speed][Time-1]==-1)continue;
      if(speed > maxV[Time])continue;
      for(int k=-1;k<1;k++){
        if(speed+k<0 || j+k>maxV[Time])continue;
        if(speed+k <= maxV[Time] && speed!=0 ){
          //等速か減速か加速
          dp[speed+1][Time]=max(dp[speed+1][Time],dp[speed][Time-1]+(double)(speed+(speed+1))/2.0);
          dp[speed][Time]=max(dp[speed][Time],dp[speed][Time-1]+(double)(speed+(speed))/2.0);
          dp[speed-1][Time]=max(dp[speed-1][Time],dp[speed][Time-1]+(double)(speed+(speed-1))/2.0);
        }
        else if(speed+k<= maxV[Time]){
          //等速か加速
          dp[speed+1][Time]=max(dp[speed+1][Time],dp[speed][Time-1]+(double)(speed+(speed+1))/2.0);
          dp[speed][Time]=max(dp[speed][Time],dp[speed][Time-1]+(double)(speed+(speed))/2.0);
        }
        else {
          //等速か減速
          dp[speed][Time]=max(dp[speed][Time],dp[speed][Time-1]+(double)(speed+(speed))/2.0);
          dp[speed-1][Time]=max(dp[speed-1][Time],dp[speed][Time-1]+(double)(speed+(speed-1))/2.0);
        }
      }


    }
  }


  cout<<fixed<<setprecision(20)<<dp[0][endTime]/4.0<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:25: error: 'j' was not declared in this scope
   61 |         if(speed+k<0 || j+k>maxV[Time])continue;
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;

int N;
int t[110],v[110];
int maxV[40010];
//x,y方向に二倍
double dp[40010][240];
int endTime=0;
int tempEndTime=0;
double ans;
int main(){
  cin>>N;

  rep(i,40010)rep(j,240)dp[i][j]=-1;
  rep(i,N){
    cin>>t[i];
    t[i]*=2;
    endTime+=t[i];
  }
  rep(i,N){
    cin>>v[i];
    v[i]*=2;
  }
  for(int i=0;i<40010;i++){
    int temp=0;
    for(int j=0;j<N;j++){
      temp+=t[j];
      if(temp>=i){
        maxV[i]=v[j];
        break;
      }
    }
  }


  // //speedが増える時
  // (speed+(speed+1))*1/2
  // //speedが減る時
  // (speed+(speed-1)*1)/2
  // //speedが変わらないとき
  // (speed+speed)*1/2;
  dp[0][0]=0;
  for(int Time = 1; Time <=endTime;Time++){
    for(int speed=0;speed <=220;speed++){
      if(dp[speed][Time-1]==-1)continue;
      if(speed > maxV[Time])continue;
      for(int k=-1;k<1;k++){
        if(speed+k<0 or j+k>maxV[Time])continue;
        if(speed+k <= maxV[Time] && speed!=0 ){
          //等速か減速か加速
          dp[speed+1][Time]=max(dp[speed+1][Time],dp[speed][Time-1]+(double)(speed+(speed+1))/2.0);
          dp[speed][Time]=max(dp[speed][Time],dp[speed][Time-1]+(double)(speed+(speed))/2.0);
          dp[speed-1][Time]=max(dp[speed-1][Time],dp[speed][Time-1]+(double)(speed+(speed-1))/2.0);
        }
        else if(speed+k<= maxV[Time]){
          //等速か加速
          dp[speed+1][Time]=max(dp[speed+1][Time],dp[speed][Time-1]+(double)(speed+(speed+1))/2.0);
          dp[speed][Time]=max(dp[speed][Time],dp[speed][Time-1]+(double)(speed+(speed))/2.0);
        }
        else {
          //等速か減速
          dp[speed][Time]=max(dp[speed][Time],dp[speed][Time-1]+(double)(speed+(speed))/2.0);
          dp[speed-1][Time]=max(dp[speed-1][Time],dp[speed][Time-1]+(double)(speed+(speed-1))/2.0);
        }
      }


    }
  }


  cout<<fixed<<setprecision(20)<<dp[0][endTime]/4.0<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:25: error: 'j' was not declared in this scope
   61 |         if(speed+k<0 or j+k>maxV[Time])continue;
      |                         ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int t[105];
int v[105];
double u[40005];
int main( void )
{
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  t[0] = 0;
  v[0] = 0;
  v[N+1] = 0;
  for( int i=1; i<=N; i++ ) cin >> t[i];
  for( int i=1; i<=N; i++ ) cin >> v[i];
  for( int i=1; i<=N; i++ ){
    t[i] += t[i-1];
  }
  for( int i=0; i<=t[N]*2; i++ ){
    u[i] = 0.5 * i;
  }
  for( int i=t[N]*2; i>=0; i-- ){
    u[i] = min( u[i], (t[N]*2 - i)*0.5 );
  }
  for( int i=1; i<=N; i++ ){
    for( int j=0; j<t[i-1]*2; j++ ){
      u[j] = min( u[j], v[i] + (t[i-1]*2 - j)*0.5 );
    }
    for( int j=t[i-1]; j<=t[i]; j++ ){
      u[j] = min( u[j], v[i] );
    }
    for( int j=t[i]+1; j<=t[N]; j++ ){
      u[j] = min( u[j], v[i] + (j - t[i]*2)*0.5 );
    }
  }
  double ret = 0;
  for( int i=1; i<=t[N]; i++ ){
    ret += (u[i-1] + u[i]) / 4;
  }
  printf( "%.12f\n", ret );
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:17: error: no matching function for call to 'min(double&, int&)'
   32 |       u[j] = min( u[j], v[i] );
      |              ~~~^~~~~~~~~~~~~~
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:32:17: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   32 |       u[j] = min( u[j], v[i] );
      |              ~~~^~~~~~~~~~~~~~
/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
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:32:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   32 |       u[j] = min( u[j], v[i] );
      |              ~~~^~~~~~~~~~~~~~
Language: Java

import java.util.*;
class Main{
 
public static void  main(String args[]){
int n;
int t[]= new int[102];
int v[] = new int[101];
int a[] = new int[20100];
int b[] = new int[20100];
int s;
double ans;
 
Scanner in = new Scanner (System.in);	
n = Integer.parseInt(in.next());
	for(int i=1; i<=n; ++i){
		t[i]=Integer.parseInt(in.next());
		s += t[i];
		t[i] += t[i-1];
	}
	++t[n+1];
	t[n+1] += t[n];
//	for(int i=0; i<=n+1; ++i) printf("%d\t", t[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		v[i]=Integer.parseInt(in.next());
		for(int j=t[i-1]; j<t[i]; ++j) b[j] = v[i];
	}
	for(int i=0; i<=s; ++i) a[i] = Math.min(i, s-i);
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		for(int j=t[i-1]; j<=t[i]; ++j) a[j] = Math.min(a[j], v[i]);
		for(int j=t[i-1]; j>=0; --j) a[j] = Math.min(a[j], v[i]+t[i-1]-j);
		for(int j=t[i]; j<=s; ++j) a[j] = Math.min(a[j], v[i]+j-t[i]);
	}
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<s; ++i) ans += (float)a[i];
	for(int i=1; i+3<s; ++i){
		if(a[i]+1==a[i+1] && a[i+1]==a[i+2] && a[i+2]-1==a[i+3] && b[i+1]>a[i+1] && b[i+2]>a[i+2])
			ans += 0.25;
	}
	System.out.println(ans);
//	for(int i=1; i<s; ++i) printf("%d %d\n", a[i], b[i]);
}}

Compiler output:
Main.java:17: error: variable s might not have been initialized
		s += t[i];
		^
Main.java:28: error: variable s might not have been initialized
	for(int i=0; i<=s; ++i) a[i] = Math.min(i, s-i);
	                ^
Main.java:38: error: variable ans might not have been initialized
	for(int i=1; i<s; ++i) ans += (float)a[i];
	                       ^
Main.java:41: error: variable ans might not have been initialized
			ans += 0.25;
			^
Main.java:43: error: variable ans might not have been initialized
	System.out.println(ans);
	                   ^
5 errors
Language: Java

import java.util.*;
class Main{
 
public static void  main(String args[]){
int n;
int t[]= new int[102];
int v[] = new int[101];
int a[] = new int[20100];
int b[] = new int[20100];
int s;
double ans;
 
Scanner in = new Scanner (System.in);	
n = Integer.parseInt(in.next());
	for(int i=1; i<=n; ++i){
		t[i]=Integer.parseInt(in.next());
		s += t[i];
		t[i] += t[i-1];
	}
	++t[n+1];
	t[n+1] += t[n];
//	for(int i=0; i<=n+1; ++i) printf("%d\t", t[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		v[i]=Integer.parseInt(in.next());
		for(int j=t[i-1]; j<t[i]; ++j) b[j] = v[i];
	}
	for(int i=0; i<=s; ++i) a[i] = Math.min(i, s-i);
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		for(int j=t[i-1]; j<=t[i]; ++j) a[j] = Math.min(a[j], v[i]);
		for(int j=t[i-1]; j>=0; --j) a[j] = Math.min(a[j], v[i]+t[i-1]-j);
		for(int j=t[i]; j<=s; ++j) a[j] = Math.min(a[j], v[i]+j-t[i]);
	}
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<s; ++i) ans += (float)a[i];
	for(int i=1; i+3<s; ++i){
		if(a[i]+1==a[i+1] && a[i+1]==a[i+2] && a[i+2]-1==a[i+3] && b[i+1]>a[i+1] && b[i+2]>a[i+2])
			ans += 0.25;
	}
	Sytem.out.println(ans);
//	for(int i=1; i<s; ++i) printf("%d %d\n", a[i], b[i]);
}}

Compiler output:
Main.java:43: error: package Sytem does not exist
	Sytem.out.println(ans);
	     ^
1 error
Language: Java

import java.util.*;
class Main{
 
int n;
int t[]= new int(102);
int v[] = new int(101);
int a[] = new int(20100);
int b[] = new int(20100);
int s;
double ans;
 
public static void  main(String args[]){
Scanner in = new Scanner (System.in);	
n = Integer.parseInt(in.next());
	for(int i=1; i<=n; ++i){
		t[i]=Integer.parseInt(in.next());
		s += t[i];
		t[i] += t[i-1];
	}
	++t[n+1];
	t[n+1] += t[n];
//	for(int i=0; i<=n+1; ++i) printf("%d\t", t[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		v[i]=Integer.parseInt(in.next());
		for(int j=t[i-1]; j<t[i]; ++j) b[j] = v[i];
	}
	for(int i=0; i<=s; ++i) a[i] = Math.min(i, s-i);
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		for(int j=t[i-1]; j<=t[i]; ++j) a[j] = Math.min(a[j], v[i]);
		for(int j=t[i-1]; j>=0; --j) a[j] = Math.min(a[j], v[i]+t[i-1]-j);
		for(int j=t[i]; j<=s; ++j) a[j] = Math.min(a[j], v[i]+j-t[i]);
	}
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<s; ++i) ans += (float)a[i];
	for(int i=1; i+3<s; ++i){
		if(a[i]+1==a[i+1] && a[i+1]==a[i+2] && a[i+2]-1==a[i+3] && b[i+1]>a[i+1] && b[i+2]>a[i+2])
			ans += 0.25;
	}
	Sytem.out.println(ans);
//	for(int i=1; i<s; ++i) printf("%d %d\n", a[i], b[i]);
}}

Compiler output:
Main.java:5: error: '[' expected
int t[]= new int(102);
                ^
Main.java:5: error: ']' expected
int t[]= new int(102);
                     ^
Main.java:6: error: '[' expected
int v[] = new int(101);
                 ^
Main.java:6: error: ']' expected
int v[] = new int(101);
                      ^
Main.java:7: error: '[' expected
int a[] = new int(20100);
                 ^
Main.java:7: error: ']' expected
int a[] = new int(20100);
                        ^
Main.java:8: error: '[' expected
int b[] = new int(20100);
                 ^
Main.java:8: error: ']' expected
int b[] = new int(20100);
                        ^
8 errors
Language: Java

import java.util.*;
class Main{
 
 
public static void  main(String args[]){
int n;
int t[102];
int v[101];
int a[20100];
int b[20100];
int s;
double ans;
Scanner in = new Scanner (System.in);	
n = Integer.parseInt(in.next());
	for(int i=1; i<=n; ++i){
		t[i]=Integer.parseInt(in.next());
		s += t[i];
		t[i] += t[i-1];
	}
	++t[n+1];
	t[n+1] += t[n];
//	for(int i=0; i<=n+1; ++i) printf("%d\t", t[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		v[i]=Integer.parseInt(in.next());
		for(int j=t[i-1]; j<t[i]; ++j) b[j] = v[i];
	}
	for(int i=0; i<=s; ++i) a[i] = Math.min(i, s-i);
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<=n; ++i){
		for(int j=t[i-1]; j<=t[i]; ++j) a[j] = Math.min(a[j], v[i]);
		for(int j=t[i-1]; j>=0; --j) a[j] = Math.min(a[j], v[i]+t[i-1]-j);
		for(int j=t[i]; j<=s; ++j) a[j] = Math.min(a[j], v[i]+j-t[i]);
	}
//	for(int i=0; i<=s; ++i) printf("%d\t", a[i]);
//	printf("\n");
	for(int i=1; i<s; ++i) ans += (float)a[i];
	for(int i=1; i+3<s; ++i){
		if(a[i]+1==a[i+1] && a[i+1]==a[i+2] && a[i+2]-1==a[i+3] && b[i+1]>a[i+1] && b[i+2]>a[i+2])
			ans += 0.25;
	}
	Sytem.out.println(ans);
//	for(int i=1; i<s; ++i) printf("%d %d\n", a[i], b[i]);
}}

Compiler output:
Main.java:7: error: ']' expected
int t[102];
      ^
Main.java:8: error: ']' expected
int v[101];
      ^
Main.java:9: error: ']' expected
int a[20100];
      ^
Main.java:10: error: ']' expected
int b[20100];
      ^
4 errors
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;
using vi=vector<double>;
#define all(a) a.begin(),a.end()
int main(void){
    int n;
    cin>>n;
    vi t(n+2,0),v(n+2,0),cv(n+2),dp(n+1);
    for(int i=0;i<n;i++)cin>>t[i+1];
    for(int i=0;i<n;i++)cin>>v[i+1];
    cv=v;v.back()=0;
    double ans=0.0;
    for(int i=1;i<=n;i++){
        dp[i]=min({cv[i],cv[i+1],dp[i-1]+t[i]});
        double dv=(dp[i]==dp[i-1]&&dp[i]==v[i]?dp[i]:(t[i]-fabs(dp[i]-dp[i-1]))/2+max(dp[i],dp[i-1]));
        //cout<<"<"<<(t[i]-fabs(dp[i]-dp[i-1]))/2<<","<<max(dp[i],dp[i-1])<<">";
        double dt=dv-v[i-1];
        double h=max(dv-max(cv[i],cv[i-1]),0.0);
        //cout<<dp[i-1]<<"-"<<dp[i]<<" "<<t[i]<<" "<<dv<<" "<<dt<<" "<<h<<" ";
        ans+=((dp[i-1]+dv)*dt/2)+((dp[i]+dv)*(t[i]-dt)/2)-h*h;
        //cout<<((dp[i-1]+dv)*dt/2)+((dp[i]+dv)*(t[i]-dt)/2)-h*h<<endl;
    }
    cout<<fixed<<setprecision(17)<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:60: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   18 |         double dv=(dp[i]==dp[i-1]&&dp[i]==v[i]?dp[i]:(t[i]-fabs(dp[i]-dp[i-1]))/2+max(dp[i],dp[i-1]));
      |                                                            ^~~~
      |                                                            labs
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n,i,j;
    double dt=0.5;
    cin>>n;
    vector<int> timetable = {0};
    vector<int> v_max;
    vector<double> v_table;
    for(i=0;i<n;i++){
        int tmp;
        cin>>tmp;
        timetable.push_back(tmp+timetable[i]);
    }
    for(i=0;i<n;i++){
        int tmp;
        cin>>tmp;
        v_max.push_back(tmp);
    }
    for(i=0;i<timetable.back()*2;i++){
        v_table.push_back((i<timetable.back())?(double)i*0.5:(double)(timetable.back()*2-i)*0.5);
    }
    for(i=0;i<n;i++){
        double t_s=timetable[i], t_e=timetable[i+1], v;
        for(j=0;j<v_table.size();j++){
            if(j*dt<t_s) v=v_max[i]+(t_s-(double)j*dt);
            else if(t_s<=j*dt && j*dt<=t_e) v=v_max[i];
            else v=v_max[i]+(j*dt-t_e);
            v_table[j]=min(v_table[j],v);
        }
    }
    cout<<accumulate(v_table.begin(), v_table.end(), 0.0)*dt<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:11: error: 'accumulate' was not declared in this scope
   34 |     cout<<accumulate(v_table.begin(), v_table.end(), 0.0)*dt<<endl;
      |           ^~~~~~~~~~
Language: C++

#include <iostream>

#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N;
long double t[112], v[112];
long double sp, ans;

int main()
{
	in >> N;
	rep(i, N) { in >> t[i]; }
	rep(i, N) { in >> v[i]; }

	rep(i, N)
	{
		if (v[i] <= v[i + 1])
		{
			long double plus;
			auto sp_ = sp;
			if (v[i] - sp <= t[i])
			{
				plus = v[i] - sp;
				sp = v[i];
				ans += sp*(t[i] - plus);
			}
			else
			{
				sp += t[i];
				plus = t[i];
			}
			ans += sp_*plus + plus*plus / 2;
		}
		else
		{
			long double plus, minu;
			if (sp <= v[i + 1])
			{
				auto dis = t[i] - (v[i + 1] - sp);
				if ((v[i] - sp) + (v[i] - v[i + 1]) <= t[i])
				{
					ans += v[i] * ((t[i]) - ((v[i] - sp) + (v[i] - v[i + 1])));
					dis -= (t[i]) - ((v[i] - sp) + (v[i] - v[i + 1]));
				}
				plus = dis / 2 + (v[i + 1] - sp);
				minu = dis / 2;
			}
			else
			{
				auto dis = t[i] - (sp - v[i + 1]);
				if ((v[i] - sp) + (v[i] - v[i + 1]) <= t[i])
				{
					ans += v[i] * ((t[i]) - ((v[i] - sp) + (v[i] - v[i + 1])));
					dis -= (t[i]) - ((v[i] - sp) + (v[i] - v[i + 1]));
				}
				plus = dis / 2;
				minu = dis / 2 + (sp - v[i + 1]);
			}
			ans += sp*plus + plus*plus / 2 + v[i + 1] * minu + minu*minu / 2;
			sp = v[i + 1];
		}
	}

	out << std::fixed << std::setprecision(15);
	out << ans << std::endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:35: error: 'setprecision' is not a member of 'std'
   67 |         out << std::fixed << std::setprecision(15);
      |                                   ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include <iostream>
  +++ |+#include <iomanip>
    2 |
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

#define INF 100100100

using namespace std;

int main()
{
    int N;
    vector<int> t;
    vector<int> cumt;
    vector<int> v;
    t.push_back(0);
    cumt.push_back(0);
    cumt.push_back(0);
    v.push_back(0);
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int ti;
        cin >> ti;
        ti *= 2;
        t.push_back(ti);
        cumt.push_back(cumt[i + 1] + ti);
    }
    for (int i = 0; i < N; i++)
    {
        int vi;
        cin >> vi;
        v.push_back(vi * 2);
    }
    t.push_back(0);
    v.push_back(0);
    cumt.push_back(*(cumt.end() - 1));

    int T = *(cumt.end() - 2);

    int vs = 0.0;
    int ve;
    int ans = 0;
    for (int i = 0; i < T; i++)
    {
        int minv = INF;
        for (int j = 0; j < N + 3; j++)
        {
            int limv;
            int curt = i + 1;
            if (curt <= cumt[j])
            {
                limv = v[j] + cumt[j] - curt;
            }
            else if (cumt[j] <= curt && curt <= cumt[j + 1])
            {
                limv = v[j];
            }
            else if (cumt[j + 1] <= curt)
            {
                limv = v[j] + curt - cumt[j + 1];
            }

            minv = min(minv, limv);
        }
        if (vs + 1 <= minv)
        {
            ve = vs + 1;
        }
        else if (vs == minv)
        {
            ve = vs;
        }
        else
        {
            ve = vs - 1;
        }
        ans += vs + ve;
        vs = ve;
    }

    cout << setprecision(15) << ans / 8.0 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:13: error: 'setprecision' was not declared in this scope
   81 |     cout << setprecision(15) << ans / 8.0 << endl;
      |             ^~~~~~~~~~~~
a.cc:4:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    3 | #include <algorithm>
  +++ |+#include <iomanip>
    4 |
Language: C++

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
using namespace std;
 
const int MAX = 107;
double t[MAX];
double v[MAX];
int main() {
	int N;
	while(scanf("%d",&N)!=EOF)
	{
		rep(i,1,N+1)scanf("%lf",&t[i]);
		rep(i,1,N+1)scanf("%lf",&v[i]);
		v[0]=0;v[N+1]=0;
		rep(i,0,N)v[N-i]=min(v[N-i],v[N+1-i]+t[N-i]);
		double nowspd=0;
		double ans=0; 
		rep(i,1,N+1)
		{
			double acc=min(min(v[i]-nowspd,(t[i]+abs(nowspd-v[i+1]))/2.0),t[i])*1.0;
			double dec=max(nowspd+acc-v[i+1],0.0);
			double con=t[i]-acc-dec;
			//printf("acc=%.1lf,dec=%.1lf,con=%.1lf\n",acc,dec,con);
			ans+=(nowspd*2+acc)*acc/2.0+(nowspd+acc)*con+(nowspd*2.0+acc*2.0-dec)*dec/2;
			nowspd+=acc-dec;
		}
		printf("%.10lf",ans);
	}
	return 0;
}#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
using namespace std;
 
const int MAX = 107;
double t[MAX];
double v[MAX];
int main() {
	int N;
	while(scanf("%d",&N)!=EOF)
	{
		rep(i,1,N+1)scanf("%lf",&t[i]);
		rep(i,1,N+1)scanf("%lf",&v[i]);
		v[0]=0;v[N+1]=0;
		rep(i,0,N)v[N-i]=min(v[N-i],v[N+1-i]+t[N-i]);
		double nowspd=0;
		double ans=0; 
		rep(i,1,N+1)
		{
			double acc=min(min(v[i]-nowspd,(t[i]+abs(nowspd-v[i+1]))/2.0),t[i])*1.0;
			double dec=max(nowspd+acc-v[i+1],0.0);
			double con=t[i]-acc-dec;
			//printf("acc=%.1lf,dec=%.1lf,con=%.1lf\n",acc,dec,con);
			ans+=(nowspd*2+acc)*acc/2.0+(nowspd+acc)*con+(nowspd*2.0+acc*2.0-dec)*dec/2;
			nowspd+=acc-dec;
		}
		printf("%.10lf",ans);
	}
	return 0;
}

Compiler output:
a.cc:30:2: error: stray '#' in program
   30 | }#include<bits/stdc++.h>
      |  ^
a.cc:30:3: error: 'include' does not name a type
   30 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:34:11: error: redefinition of 'const int MAX'
   34 | const int MAX = 107;
      |           ^~~
a.cc:5:11: note: 'const int MAX' previously defined here
    5 | const int MAX = 107;
      |           ^~~
a.cc:35:8: error: redefinition of 'double t [107]'
   35 | double t[MAX];
      |        ^
a.cc:6:8: note: 'double t [107]' previously declared here
    6 | double t[MAX];
      |        ^
a.cc:36:8: error: redefinition of 'double v [107]'
   36 | double v[MAX];
      |        ^
a.cc:7:8: note: 'double v [107]' previously declared here
    7 | double v[MAX];
      |        ^
a.cc:37:5: error: redefinition of 'int main()'
   37 | int main() {
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  int n;
  while (cin >> n) {
    int t[n];
    int v[n];
    for (int i = 0; i < n; ++i) {
      cin >> t[i];
    }
    for (int i = 0; i < n; ++i) {
      cin >> v[i];
    }

    vector<pair<int, int>> range;
    int acc = 0;
    for (int i = 0; i < n; ++i) {
      range.push_back(make_pair(acc, acc + t[i]));
      acc += t[i];
    }
    
    const int N = (200 * 100 + 5) * 2;
    const double inf = 1e100;
    double x[N];
    fill(x, x + N, inf);
    for (int i = 0; i < n; ++i) {
      for (int j = range[i].first * 2; j <= range[i].second * 2; ++j) {
        x[j] = min<double>(x[j], v[i]);
      }
    }
    const int k = range.back().second * 2 + 1;
    assert(k < N);
    x[0] = 0;
    x[k - 1] = 0;
      
    for (int i = 0; i + 1 < N; ++i) {
      if (x[i] == N) {
        if (x[i - 1] == x[i + 1]) x[i] = x[i + 1];
        else x[i] = min(x[i - 1] + 0.5, x[i + 1] + 0.5);
      }
    }
    
    for (int i = 1; i - 1 < k; ++i) {
      x[i] = min({x[i - 1] + 0.5, x[i], x[i + 1] + 0.5});
    }
    for (int i = k - 2; 0 < i; --i) {
      x[i] = min({x[i - 1] + 0.5, x[i], x[i + 1] + 0.5});
    }
   
    double sum = 0;
    for (int i = 1; i < k; ++i) {
      if (x[i - 1] == x[i]) {
        sum += x[i - 1] * 0.5;
      } else {
        if (x[i - 1] < x[i]) {
          sum += (x[i - 1] * 0.5) + (0.5 * 0.5 * 0.5);
          type = 1;
        } else {
          sum += (x[i - 1] * 0.5) - (0.5 * 0.5 * 0.5);
          type = 2;
        }
      }
    }
    printf("%.10lf\n", sum);
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:74:11: error: 'type' was not declared in this scope; did you mean 'wctype'?
   74 |           type = 1;
      |           ^~~~
      |           wctype
a.cc:77:11: error: 'type' was not declared in this scope; did you mean 'wctype'?
   77 |           type = 2;
      |           ^~~~
      |           wctype
Language: C++

#include<bits/stdc++.h>
#define up(j,k,i) for(ld i=j;i<k;i+=0.5)
#define down(j,k,i) for(ld i=j;i>k;i-=0.5)
#define M 1000000007
#define pp(n) printf("%lld\n",ll(n))
#define ps(n) printf("%lld ",ll(n))
#define pd(x,y) printf("%lld %lld\n",ll(x),ll(y))
#define is(n) scanf("%lld",&n)
#define inf LLONG_MAX
#define id(n,m) scanf("%lld%lld",&n,&m)
#define it(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define pb push_back
#define F first
#define S second
#define pll pair<ll,ll> 
#define db cout<<"######\n"
#define null(a) memset(a,0,sizeof(a))
#define neg(a) memset(a,255,sizeof(a))
typedef long double ld;
typedef long long int ll;
using namespace std;
ll i,j,k,z,n,m,sum,ans,x,y,maxm=0,minm=inf; bool flag;
map<ld,ld> lim,a; ll t[20005];ld v[20005];
int main()
{
	is(n); ld ans=0;
	
	for(int i=1;i<=n;i++)
	cin>>t[i],t[i]+=t[i-1];
	
	for(int i=1;i<=n;i++)
	cin>>v[i];
	neg(lim);
	for(int i=1;i<=n;i++)
	{
	
		up(t[i-1],t[i]+0.5,j)
		lim[j]=min(lim[j],v[i]);
		
		
	}
	
	up(0.5,t[n]+0.5,i)
	{
		a[i]=min(a[i-0.5]+0.5,lim[i]);
	}
	
	a[t[n]]=0;
	
	down(t[n]-0.5,0,i)
	{
		a[i]=min(a[i+0.5]+0.5,a[i]);
	}
	
	
	
	up(0.5,t[n]+0.5,i)
	{
		ans+=a[i]/2;
		
		//cout<<i<<" "<<a[i]<<" "<<ans<<endl;
	}
	
	printf("%0.9LF",ans);
		
		}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:13: error: cannot convert 'std::map<long double, long double>' to 'void*'
   33 |         neg(lim);
      |             ^~~
      |             |
      |             std::map<long double, long double>
a.cc:18:23: note: in definition of macro 'neg'
   18 | #define neg(a) memset(a,255,sizeof(a))
      |                       ^
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<bits/stdc++.h>
#define up(j,k,i) for(ld i=j;i<k;i+=0.5)
#define down(j,k,i) for(ld i=j;i>k;i-=0.5)
#define M 1000000007
#define pp(n) printf("%lld\n",ll(n))
#define ps(n) printf("%lld ",ll(n))
#define pd(x,y) printf("%lld %lld\n",ll(x),ll(y))
#define is(n) scanf("%lld",&n)
#define inf LLONG_MAX
#define id(n,m) scanf("%lld%lld",&n,&m)
#define it(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define pb push_back
#define F first
#define S second
#define pll pair<ll,ll> 
#define db cout<<"######\n"
#define null(a) memset(a,0,sizeof(a))
#define neg(a) memset(a,255,sizeof(a))
typedef long double ld;
typedef long long int ll;
using namespace std;
ll i,j,k,z,n,m,sum,ans,x,y,maxm=0,minm=inf; bool flag;
map<ld,ld> lim,a; ll t[20005];ld v[20005];
int main()
{
	is(n); ld ans=0;
	
	for(int i=1;i<=n;i++)
	cin>>t[i],t[i]+=t[i-1];
	
	for(int i=1;i<=n;i++)
	cin>>v[i];
	neg(lim);
	for(int i=1;i<=n;i++)
	{
	
		up(t[i-1],t[i]+0.5,j)
		lim[j]=min(lim[j],v[i]);
		
		
	}
	
	up(0.5,t[n]+0.5,i)
	{
		a[i]=min(a[i-0.5]+0.5,lim[i]);
	}
	
	a[t[n]]=0;
	
	down(t[n]-0.5,0,i)
	{
		a[i]=min(a[i+0.5]+0.5,a[i]);
	}
	
	
	
	up(0.5,t[n]+0.5,i)
	{
		ans+=a[i]/2;
		
		//cout<<i<<" "<<a[i]<<" "<<ans<<endl;
	}
	
	printf("%0.9LF",ans);
		
		

Compiler output:
a.cc: In function 'int main()':
a.cc:33:13: error: cannot convert 'std::map<long double, long double>' to 'void*'
   33 |         neg(lim);
      |             ^~~
      |             |
      |             std::map<long double, long double>
a.cc:18:23: note: in definition of macro 'neg'
   18 | #define neg(a) memset(a,255,sizeof(a))
      |                       ^
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));
      |                      ~~~~~~^~~
a.cc:64:30: error: expected '}' at end of input
   64 |         printf("%0.9LF",ans);
      |                              ^
a.cc:25:1: note: to match this '{'
   25 | {
      | ^
Language: C++

#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>


class section {
	private:
		double t;
		double start_v, max_v, next_v;
		double last_v;
		double dist;
		void calc_dist();
	public:
		section(double t, double start_v, double max_v, double next_v);
		double get_dist();
		double get_last_v();
};

section::section(double t, double start_v, double max_v, double next_v)
	:t(t),start_v(start_v),max_v(max_v),next_v(next_v)
{
	calc_dist();
}

double section::get_dist() {
	return dist;
}

double section::get_last_v() {
	return last_v;
}

void section::calc_dist() {
	double acc_t, dcc_t;
	double const_t;
	if (start_v < max_v) {
		acc_t = max_v - start_v;
	} 
	else {
		acc_t = 0;
	}

	if (max_v <= next_v) {
		dcc_t = 0;
	}
	else {
		dcc_t = max_v - next_v;
	}

	if (t >= acc_t + dcc_t){
		const_t = t -(acc_t + dcc_t);
		dist = 0.0;
		dist += (acc_t * (max_v - start_v)) / 2.0 + start_v * acc_t;
		dist += const_t * max_v;
		dist += (dcc_t *(max_v - next_v)) / 2.0 + next_v * dcc_t;
	
		last_v = fmin(max_v, next_v);
	}
	else {
		double new_max_v = fmin((start_v + next_v + t) / 2.0, t + start_v);

		double new_acc_t = new_max_v  - start_v;
		double new_dcc_t = fmax(t - new_acc_t, 0.0);

		dist = 0.0;
		dist += (new_acc_t * (new_max_v - start_v)) / 2.0 + start_v * new_acc_t;
		dist += (new_dcc_t *(new_max_v - next_v)) / 2.0 + next_v * new_dcc_t;
		last_v = fmax(t + start_v, next_v);
	}

}

int main() {
	int N;
	std::vector<double> V;
	std::vector<double>	T;
	std::string v_str, t_str, v, t;
	
	std::cin >> N;
	for (int i= 0; i < N; i++) {
		std::cin >> t_str;
		T.push_back(std::stod(t_str));
	}
	for (int i = 0; i < N; i++) {
		std::cin >> v_str;
		V.push_back(std::stod(v_str));
	}


	double start_v = 0.0;
	double dist = 0.0;
	for (int i = 0; i < V.size(); i++) {
		double next_v;
		if (i + 1 < V.size()) {
			next_v = V[i + 1];
		}
		else {
			next_v = 0.0;
		}
		section s(T[i], start_v, V[i], next_v);
		dist += s.get_dist();
		start_v = s.get_last_v();
	}
	std::cout << dist << "\n";
}

Compiler output:
a.cc: In member function 'void section::calc_dist()':
a.cc:59:26: error: 'fmin' was not declared in this scope
   59 |                 last_v = fmin(max_v, next_v);
      |                          ^~~~
a.cc:62:36: error: 'fmin' was not declared in this scope
   62 |                 double new_max_v = fmin((start_v + next_v + t) / 2.0, t + start_v);
      |                                    ^~~~
a.cc:65:36: error: 'fmax' was not declared in this scope
   65 |                 double new_dcc_t = fmax(t - new_acc_t, 0.0);
      |                                    ^~~~
Language: C++

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((V).begin(), (V).end(), (n)) != (V).end())
#define SORT(v) sort((V).begin(), (V).end())
#define RSORT(v) sort((V).rbegin(), (V).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (V.erase(remove((V).begin(), (V).end(), (a)), (V).end()))
#define REVERSE(v) (reverse((V).begin(), (V).end()))
#define LOWER_BOUND(v,a) (lower_bound((V).begin(), (V).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((V).begin(), (V).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

int N;
int T[100];
int V[100];

signed main()
{
	cin >> N;
	REP(i, N)
	{
		cin >> T[i];
		if (i > 0)
		{
			T[i] += T[i - 1];
		}
	}
	REP(i, N) cin >> V[i];



	double len = 0;
	double v = 0.0;
	for (int i = 0; i < N; i++)
	{
		double tc = i == 0 ? 0 : T[i - 1];
		double ca = v - tc;
		double tflat = V[i] - ca;

		double ta = DBL_MAX;
		double tb = DBL_MAX;

		for (int j = i; j < N; j++)
		{
			int vv = j < N - 1 ? V[j + 1] : 0;
			double ci = vv + T[j];

			double taa = (-ca + ci) / 2.0;
			double tbb = ci - V[i];
			ta = MIN(ta, taa);
			tb = MIN(tb, tbb);
		}

		if (tflat < T[i] && tflat < ta)
		{
			if (tb < T[i]) // /-\'
			{
				len += v * (tflat - tc) + (tflat - tc) * (tflat - tc) / 2.0;
				v = v + (tflat - tc);

				len += v * (tb - tflat);

				v = v - (T[i] - tb);
				len += v * (T[i] - tb) + (T[i] - tb) * (T[i] - tb) / 2.0;
			}
			else // /--'
			{
				len += v * (tflat - tc) + (tflat - tc) * (tflat - tc) / 2.0;
				v = v + (tflat - tc);

				len += v * (T[i] - tflat);
			}
		}
		else
		{
			if (ta < T[i]) // /\'
			{
				len += v * (ta - tc) + (ta - tc) * (ta - tc) / 2.0;
				v = v + (ta - tc);

				v = v - (T[i] - ta);
				len += v * (T[i] - ta) + (T[i] - ta) * (T[i] - ta) / 2.0;
			}
			else // /'
			{
				len += v * (T[i] - tc) + (T[i] - tc) * (T[i] - tc) / 2.0;
				v = v + (T[i] - tc);
			}
		}
	}

	cout << fixed << setprecision(5);
	cout << len;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:57:29: error: 'DBL_MAX' was not declared in this scope
   57 |                 double ta = DBL_MAX;
      |                             ^~~~~~~
a.cc:15:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
   14 | #include <functional>
  +++ |+#include <cfloat>
   15 |