Language: C++

#include <iostream> 
#include <cstdio>
#include <deque>
#include <iomanip>

using namespace std;

#define For(i , a , b) for (int i = a , _b = b ; i <= _b ; ++i)
#define Ford(i , a  ,b) for (int i = a , _b = b : i >= _b ; --i)
#define Rep(i , n) for (int i = 0 , _n = n ; i < _n ; ++i)
#define sz(A) ((int)A.size())
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)

typedef pair<int , int> pt;

int n;
int L;

void ReadData() {
	cin >> n >> L;
} 

deque<pair<long double, long long> > qu;
void Process() {
	cout << fixed << setprecision(6);

	long long sumRem = 0;
	long double sumTV = 0;
	For(i,1,n) {
		int t,v; cin >> t >> v;
		if (sz(qu) == 0) {
			qu.push_back(make_pair(t,v));
			sumRem += v;
			sumTV += 1LL * v * t;
			cout << t << "\n";
			continue;
		}
		while (sumRem + v > L) {
			auto &cur = qu.front();
			if (cur.second <= (sumRem + v) - L) {
				sumRem -= cur.second;
				sumTV -= #include <iostream> 
#include <cstdio>
#include <deque>
#include <iomanip>

using namespace std;

#define For(i , a , b) for (int i = a , _b = b ; i <= _b ; ++i)
#define Ford(i , a  ,b) for (int i = a , _b = b : i >= _b ; --i)
#define Rep(i , n) for (int i = 0 , _n = n ; i < _n ; ++i)
#define sz(A) ((int)A.size())
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)

typedef pair<int , int> pt;

int n;
int L;

void ReadData() {
	cin >> n >> L;
} 

deque<pair<long double, long long> > qu;
void Process() {
	cout << fixed << setprecision(6);

	long long sumRem = 0;
	long double sumTV = 0;
	For(i,1,n) {
		int t,v; cin >> t >> v;
		if (sz(qu) == 0) {
			qu.push_back(make_pair(t,v));
			sumRem += v;
			sumTV += 1LL * v * t;
			cout << t << "\n";
			continue;
		}
		while (sumRem + v > L) {
			auto &cur = qu.front();
			if (cur.second <= (sumRem + v) - L) {
				sumRem -= cur.second;
				sumTV -= 1LL * cur.first * cur.second;
				qu.pop_front();
			} else {
				cur.second -= ((sumRem + v) - L);
				sumTV -=  cur.first *((sumRem + v) - L);
				sumRem -= ((sumRem + v) - L);
			}
		}
		long double res = (sumTV + 1LL * v * t) / (sumRem + v);
		cout << (double) res << "\n";

		pair<long double, long long> add = make_pair(t,v);
		while (sz(qu) && qu.back().first >= add.first) {
			add = make_pair( (qu.back().first * qu.back().second 
				+ add.first * add.second) / (qu.back().second + add.second),
				qu.back().second + add.second  );
			sumRem -= qu.back().second;
			sumTV -= qu.back().first * qu.back().second;
			qu.pop_back();
		}
		qu.push_back(add);
		sumRem += add.second;
		sumTV += add.first * add.second;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	//freopen("input.inp" , "r" , stdin);
	ReadData();
	Process();

	return 0;

}			 cur.first * cur.second;
				qu.pop_back();
			} else {
				cur.second -= ((sumRem + v) - L);
				sumTV -=  cur.first *((sumRem + v) - L);
				sumRem -= ((sumRem + v) - L);
			}
		}
		long double res = (sumTV + 1LL * v * t) / (sumRem + v);
		cout << (double) res << "\n";

		pair<long double, long long> add = make_pair(t,v);
		while (sz(qu) && qu.back().first >= add.first) {
			add = make_pair( (qu.back().first * qu.back().second 
				+ add.first * add.second) / (qu.back().second + add.second),
				qu.back().second + add.second  );
			sumRem -= qu.back().second;
			sumTV -= qu.back().first * qu.back().second;
			qu.pop_back();
		}
		qu.push_back(add);
		sumRem += add.second;
		sumTV += add.first * add.second;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	//freopen("input.inp" , "r" , stdin);
	ReadData();
	Process();

	return 0;

}			

Compiler output:
a.cc:43:42: error: stray '#' in program
   43 |                                 sumTV -= #include <iostream>
      |                                          ^
a.cc: In function 'void Process()':
a.cc:43:43: error: 'include' was not declared in this scope
   43 |                                 sumTV -= #include <iostream>
      |                                           ^~~~~~~
a.cc:43:60: error: expected primary-expression before '>' token
   43 |                                 sumTV -= #include <iostream>
      |                                                            ^
a.cc:48:1: error: expected primary-expression before 'using'
   48 | using namespace std;
      | ^~~~~
a.cc:62:17: error: a function-definition is not allowed here before '{' token
   62 | void ReadData() {
      |                 ^
a.cc:67:16: error: a function-definition is not allowed here before '{' token
   67 | void Process() {
      |                ^
a.cc:111:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  111 | int main() {
      |         ^~
a.cc:111:9: note: remove parentheses to default-initialize a variable
  111 | int main() {
      |         ^~
      |         --
a.cc:111:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:111:12: error: a function-definition is not allowed here before '{' token
  111 | int main() {
      |            ^