For this Question: Anya owns N triplets of integers (A<sub>i</sub>, B<sub>i</sub>, C<sub>i</sub>), for each i from 1 to N. She asks you to find a sequence of integers which satisfies the following conditions:

1. The sequence contains at least C<sub>i</sub> distinct integers from the closed interval [A<sub>i</sub>, B<sub>i</sub>], for each i from 1 to N.
2. Out of all sequences satisfying the first condition, choose a sequence with the minimum possible number of elements.

For simplicity, she asks you to just print the length of such a sequence.The first line of the input contains a single integer N denoting the number of triplets. 
Then N lines follow, where the i<sup>th</sup> line contains three integers A<sub>i</sub>, B<sub>i</sub>, C<sub>i</sub> for each i from 1 to N.

<b> Constraints: </b>
1 ≤ N ≤ 2000
1 ≤ A<sub>i</sub> ≤ B<sub>i</sub> ≤ 2000
0 ≤ C<sub>i</sub> ≤ B<sub>i</sub> - A<sub>i</sub> + 1Print a single integer — the minimum possible sequence length.Sample Input 1:
1
1 3 3
Sample Output 1:
3

Sample Explanation 1:
Since there are only 3 elements in the closed interval [1,3], and we need to take 3 of them, clearly the smallest possible length is 3.

Sample Input 2:
2
1 3 1
3 5 1
Sample Output 2:
1

Sample Explanation 2:
We can take the sequence consisting of a single element {3}., I have written this Solution Code: //Author: Xzirium
//Time and Date: 00:28:35  28 December 2021

//Optional FAST
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

template <typename T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template <typename T> using ordered_set1 = tree<T,null_type,greater<T>,rb_tree_tag,tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll b, ll e)
{
    ll r = 1ll;
    for(; e > 0; e /= 2, (b *= b) %= MOD)
        if(e % 2) (r *= b) %= MOD;
    return r;
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(N);
    vector<pair<pll,ll>> Z;
    FORI(i,0,N)
    {
        READV(a);
        READV(b);
        READV(c);
        Z.pb({{b,a},c});
    }
    sort(Z.begin(),Z.end());
    ordered_set1<ll> unused;
    FORI(i,1,2001)
    {
        unused.insert(i);
    }
    ll ans=0;
    FORI(i,0,N)
    {
        ll a=Z[i].fi.se;
        ll b=Z[i].fi.fi;
        ll c=Z[i].se;
        ll curr=b-a+1-(unused.order_of_key(a-1)-unused.order_of_key(b));
        while(curr<c)
        {
            ans++;
            curr++;
            auto it=unused.lower_bound(b);
            unused.erase(it);
        }
    }
    cout<<ans<<endl;
//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?