#include<bits/stdc++.h>
using namespace std;
#define ll long long

std::vector<int> solve(
    std::vector<std::pair<int, int>> R,vector<long long> D,vector<int> S,std::vector<int> T,std::vector<bool> I){
    int n =(int) R.size() + 1;
    vector<bool> isActive(n, false);
    for(int i =0;i<n;++i)
        if(I[i]) isActive[S[i]]=true;
    vector<int> ans(n, 0);
    for(int i =0;i<n;++i){
        if(!isActive[i])continue;
        ans[i] = T[i]-S[i]+1;
    }
    return ans;
}

