For this Question: Given an array A of size N. Find the number of pairs of elements in this array such that their sum is <b>at least L</b> and <b>at most R</b>. More formally, find the count of pairs of indices i and j such that 1 <= i < j <= N and <b>L <= A<sub>i</sub> + A<sub>j</sub> <= R</b>.First line contains a single integer N.
The second line of the input contains two integers L and R.
The third line of the input contains N space seperated integers.

Constraints:
2 <= N <= 10<sup>5</sup>
1 <= L <= R <= 10<sup>9</sup>
1 <= A<sub>i</sub> <= 10<sup>9</sup>Print the count of pairs of elements in the array such that their sum is at least L and at most R.Sample Input:
5 5 8
5 1 2 4 3

Sample Output:
7

Explaination:
The pairs of indices are as follows:
(1, 2) -> 5 + 1 = 6
(1, 3) -> 5 + 2 = 7
(1, 5) -> 5 + 3 = 8
(2, 4) -> 1 + 4 = 5
(3, 4) -> 2 + 4 = 6
(3, 5) -> 2 + 3 = 5
(4, 5) -> 4 + 3 = 7
All these sums are within range [L, R]., I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define mod 1000000007
 
 
void solve(){
    int n, l, r; cin >> n >> l >> r;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(v[i] > r) continue;
        auto it = lower_bound(v.begin(), v.end(), l - v[i]);
        auto itt = upper_bound(v.begin(), v.end(), r - v[i]);
        itt--;
        if(it == v.end()) continue;
        int l1 = it - v.begin(), r1 = itt - v.begin();
        l1 = max(l1, i + 1);
        if(l1 > i && r1 >= l1 && v[l1] + v[i] >= l && v[r1] + v[i] <= r) ans += r1 - l1 + 1;
    }
    cout << ans;
}
 
 
signed main(){
    fast
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
        if(i != t) cout << endl;
    }
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?