Language: C++

#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

template<typename T> void Show(vector<vector<T>> v) {
	for (int i = 0; i < v.size(); i++) {
		for (int j = 0; j < v[i].size(); j++) {
			cout << v[i][j];
			if (j != v[i].size() - 1) {
				cout << " ";
			} else {
				cout << endl;
			}
		}
	}
}


template<typename T> void Show(vector<T> v) {
	for (int i = 0; i < v.size(); i++) {
		cout << v[i];
		if (i != v.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}

double V_in = 0;



	//進入速度、次の区間の制限速度、現在の区間の制限速度、区間のタイム
double Move(int V_out, int Limit, int Time) {
	if (V_out > Limit) {//次の区間の制限速度が今の区間より大きい。
		if (Time > Limit - V_in) {//最高速度到達
			double d = (V_in + Limit)*(Limit - V_in) / (double)2 + Limit * (Time - (Limit - V_in));
			V_in = Limit;
			return d;
		} else {//到達前に時間切れ
			double d = (V_in + V_in+Time)*(Time) / (double)2;
			V_in += Time;
			return d;
		}
	} else if(V_out>V_in){//最高速は下がるが、今の速度よりは大きい。
		if (Time >= V_out - V_in) {//余裕あり。
			if (Time > (Limit - V_in) + (Limit - V_out)) {//何秒か最高速を維持する
				double d = (V_in + Limit)*(Limit - V_in) / (double)2
					+ Limit * (Time - (Limit - V_in) - (Limit - V_out))
					+ (V_out + Limit)*(Limit - V_out) / (double)2;
				V_in = V_out;
				return d;
			} else {//あるところで加速から減速に向かうピークを持つ。
				double v = (Time + V_in + V_out) / (double)2;
				double d = (V_in + v)*(v - V_in) / (double)2 + (V_out + v)*(v - V_out) / (double)2;
				V_in = V_out;
				return d;
			}
		} else {//V_out到達前に時間切れ
			double d = (V_in + V_out + Time)*(Time) / (double)2;
			V_in += Time;
			return d;
		}
	} else {//今の速度が次の制限速度以上。
		if (Time >= V_in - V_out) {//余裕あり。
			if (Time > (Limit - V_in) + (Limit - V_out)) {//何秒か最高速を維持する
				double d = (V_in + Limit)*(Limit - V_in) / (double)2
					+ Limit * (Time - (Limit - V_in) - (Limit - V_out))
					+ (V_out + Limit)*(Limit - V_out) / (double)2;
				V_in = V_out;
				return d;
			} else {//あるところで加速から減速に向かうピークを持つ。
				double v = (Time + V_in + V_out) / (double)2;
				double d = (V_in + v)*(v - V_in) / (double)2 + (V_out + v)*(v - V_out) / (double)2;
				V_in = V_out;
				return d;
			}
		} else {//V_out到達前に時間切れ
			throw exception("HHH");
		}
	}
}


int main() {
	int N;
	cin >> N;
	vector<int> Time = vector<int>(), Limit = vector<int>();
	Time.resize(N); Limit.resize(N + 1);
	for (int i = 0; i < N; i++) {
		cin >> Time[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> Limit[i];
	}
	Limit[N] = 0;
	double sum = 0;
	for (int i = 0; i < N; i++) {
		sum += Move(Limit[i + 1], Limit[i], Time[i]);
	}
	cout << sum << endl;
}

Compiler output:
a.cc: In function 'double Move(int, int, int)':
a.cc:90:46: error: no matching function for call to 'std::exception::exception(const char [4])'
   90 |                         throw exception("HHH");
      |                                              ^
In file included from /usr/include/c++/14/new:41,
                 from /usr/include/c++/14/bits/stl_tempbuf.h:59,
                 from /usr/include/c++/14/bits/stl_algo.h:69,
                 from /usr/include/c++/14/algorithm:61,
                 from a.cc:1:
/usr/include/c++/14/bits/exception.h:67:5: note: candidate: 'constexpr std::exception::exception(std::exception&&)'
   67 |     exception(exception&&) = default;
      |     ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:67:15: note:   no known conversion for argument 1 from 'const char [4]' to 'std::exception&&'
   67 |     exception(exception&&) = default;
      |               ^~~~~~~~~~~
/usr/include/c++/14/bits/exception.h:65:5: note: candidate: 'constexpr std::exception::exception(const std::exception&)'
   65 |     exception(const exception&) = default;
      |     ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:65:15: note:   no known conversion for argument 1 from 'const char [4]' to 'const std::exception&'
   65 |     exception(const exception&) = default;
      |               ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/exception.h:62:5: note: candidate: 'std::exception::exception()'
   62 |     exception() _GLIBCXX_NOTHROW { }
      |     ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:62:5: note:   candidate expects 0 arguments, 1 provided
a.cc:93:1: warning: control reaches end of non-void function [-Wreturn-type]
   93 | }
      | ^