This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pii pair<int, int>
#define ff first
#define ss second
#define pb push_back
#define rep(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define rep1(i, a, b) for (int i = (int)a; i >= (int)b; --i)
#define all(x) x.begin(), x.end()
#define sp(x) setprecision(x) << fixed
typedef long double db;
const int N = 1e6 + 5;
const int inf = 1e9;
pair<db, db> f[N];
db ans[N];
bool solve() {
    int n; cin >> n;
    vector<db> a(n + 1), b(n + 1);
    rep(i, 1, n) cin >> a[i] >> b[i];
    f[1] = {0.5, (a[1] - b[1]) / 2};
    rep(i, 2, n - 1) {
        f[i] = {f[i - 1].ff / 2, f[i - 1].ss / 2 + (a[i] - b[i]) / 2};
    }
    // f[n-1] = ax + b
    pair<db, db> tmp = {2, b[n] - a[n]}; // cx + d
    // x = (d - b) / (a - c)
    assert(f[n - 1].ff != tmp.ff);
    ans[n] = (tmp.ss - f[n - 1].ss) / (f[n - 1].ff - tmp.ff);
//    cout<<"ax+b="<<sp(4)<<f[n-1].ff<<' '<<f[n-1].ss<<'\n';
//    cout<<"cx+d="<<sp(4)<<tmp.ff<<' '<<tmp.ss<<'\n';
//
//    cout<<"ans[n]=" << sp(6)<<ans[n]<<'\n';
    if (ans[n] < 0 || (int)ans[n] < ans[n]) return false;
    rep(i, 1, n - 1) {
        ans[i] = f[i].ff * ans[n] + f[i].ss;
        if (ans[i] < 0 || (int)ans[i] < ans[i]) return false;
    }
    return true;
}
main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << (solve() ? "Yes" : "No");
}
Compilation message (stderr)
remittance.cpp:49:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   49 | main() {
      | ^~~~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |