ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using vll = vector<ll>;

using pii = pair<ll, ll>;

using pll = pair<ll, ll>;

#define all(v) (v).begin(), (v).end()

#define sz(v) (ll)(v).size()

#define pb push_back

#define mp make_pair

#define F first

#define S second

#define f(i, a, b) for (ll i = (a); i < (b); i++)

#define fr(i, a, b) for (ll i = (a); i >= (b); i--)

void solve() {

    ll n,l,r;

    cin>>n>>l>>r;

    vll a(n);

    f(i,0,n){cin>>a[i];}

    ll d=r-l+1;

    sort(all(a));

    ll ans=0;

    f(i,0,d){ans+=a[i];}

    cout<<ans<<endl;

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    ll t; cin >> t;

    while (t--) { solve(); }

    return 0;

}



Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
#define all(v) (v).begin(), (v).end()
#define sz(v) (ll)(v).size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define f(i, a, b) for (ll i = (a); i < (b); i++)
#define fr(i, a, b) for (ll i = (a); i >= (b); i--)
void solve() {
    ll n,l,r;
    cin>>n>>l>>r;
    vll a(n);
    f(i,0,n){cin>>a[i];}
    vll fr;vll b;
    f(i,0,l-1)
    {
      fr.pb(a[i]);
    }
    vll crr;
    f(i,l-1,r)
    {
      crr.pb(a[i]);
    }
    f(i,r,n)
    {
      b.pb(a[i]);
    }
    sort(all(crr));
    sort(all(fr));sort(all(b));
    ll x1=0;
    if(fr.size()>0)
    {
      for(int i=crr.size()-1;i>=0;i--)
      {
        if(x1==fr.size()){break;}
        if(fr[x1]<crr[i])
        {
          crr[i]=fr[x1];x1++;continue;
        }
        if(fr[x1]>crr[i]){break;}
      }
    }
    sort(all(crr));x1=0;
    if(b.size()>0)
    {
      for(int i=crr.size()-1;i>=0;i--)
      {
        if(x1==b.size()){break;}
        if(b[x1]<crr[i])
        {
          crr[i]=b[x1];x1++;continue;
        }
        if(b[x1]>crr[i]){break;}
      }
    }
    ll ans=0;
    f(i,0,crr.size())
    {
      ans+=crr[i];
    }
    cout<<ans<<endl;
    
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t; cin >> t;
    while (t--) { solve(); }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
#define all(v) (v).begin(), (v).end()
#define sz(v) (ll)(v).size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define f(i, a, b) for (ll i = (a); i < (b); i++)
#define fr(i, a, b) for (ll i = (a); i >= (b); i--)
void solve() {
    ll n,l,r;
    cin>>n>>l>>r;
    vll a(n);
    f(i,0,n){cin>>a[i];}
    vll fr;vll b;
    f(i,0,l-1)
    {
      fr.pb(a[i]);
    }
    vll crr;
    f(i,l-1,r)
    {
      crr.pb(a[i]);
    }
    f(i,r,n)
    {
      b.pb(a[i]);
    }
    sort(all(crr));
    sort(all(fr));sort(all(b));
    ll x1=0;
    if(fr.size()>0)
    {
      for(int i=crr.size()-1;i>=0;i--)
      {
        if(x1==fr.size()){break;}
        if(fr[x1]<crr[i])
        {
          crr[i]=fr[x1];x1++;continue;
        }
        if(fr[x1]>crr[i]){break;}
      }
    }
    sort(all(crr));x1=0;
    if(b.size()>0)
    {
      for(int i=crr.size()-1;i>=0;i--)
      {
        if(x1==b.size()){break;}
        if(b[x1]<crr[i])
        {
          crr[i]=b[x1];x1++;continue;
        }
        if(b[x1]>crr[i]){break;}
      }
    }
    ll ans=0;
    f(i,0,crr.size())
    {
      ans+=crr[i];
    }
    cout<<ans<<endl;
    
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t; cin >> t;
    while (t--) { solve(); }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
#define all(v) (v).begin(), (v).end()
#define sz(v) (ll)(v).size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define f(i, a, b) for (ll i = (a); i < (b); i++)
#define fr(i, a, b) for (ll i = (a); i >= (b); i--)
void solve() {
    ll n,l,r;
    cin>>n>>l>>r;
    vll a(n);
    f(i,0,n){cin>>a[i];}
    vll fr;vll b;
    f(i,0,l-1)
    {
      fr.pb(a[i]);
    }
    vll crr;
    f(i,l-1,r)
    {
      crr.pb(a[i]);
    }
    f(i,r,n)
    {
      b.pb(a[i]);
    }
    vll tou=crr;ll a1=0;ll a2=a1;
    sort(all(crr));
    sort(all(fr));sort(all(b));
    ll x1=0;
    if(fr.size()>0)
    {
      for(int i=crr.size()-1;i>=0;i--)
      {
        if(x1==fr.size()){break;}
        if(fr[x1]<crr[i])
        {
          crr[i]=fr[x1];x1++;continue;
        }
        if(fr[x1]>crr[i]){break;}
      }
    }
    f(i,0,crr.size())
    {
      a1+=crr[i];
    }
    crr=tou;
    sort(all(crr));x1=0;
    if(b.size()>0)
    {
      for(int i=crr.size()-1;i>=0;i--)
      {
        if(x1==b.size()){break;}
        if(b[x1]<crr[i])
        {
          crr[i]=b[x1];x1++;continue;
        }
        if(b[x1]>crr[i]){break;}
      }
    }
    
    f(i,0,crr.size())
    {
      a2+=crr[i];
    }
    cout<<min(a1,a2)<<endl;
    
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t; cin >> t;
    while (t--) { solve(); }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using vll = vector<ll>;

using pii = pair<ll, ll>;

using pll = pair<ll, ll>;

#define all(v) (v).begin(), (v).end()

#define sz(v) (ll)(v).size()

#define pb push_back

#define mp make_pair

#define F first

#define S second

#define f(i, a, b) for (ll i = (a); i < (b); i++)

#define fr(i, a, b) for (ll i = (a); i >= (b); i--)

void solve() {

    ll n,l,r;

    cin>>n>>l>>r;

    vll a(n);

    f(i,0,n){cin>>a[i];}

    ll d=r-l+1;

    sort(all(a));

    ll ans=0;

    f(i,0,d){ans+=a[i];}

    cout<<ans<<endl;

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    ll t; cin >> t;

    while (t--) { solve(); }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>

using namespace std;



void solve(){

    int n;

    cin >> n;

    vector<int> ans;

    for(int i = 0; i < n ; i++){

        int num;

        cin >> num;

        ans.push_back(num);

    }

    vector<int> arr;

    arr = ans;

    sort(arr.begin(),arr.end());

    if(arr == ans){

        cout << "YES" << endl;

        return;

    }

    int last = arr[n-1];

    if(ans[0] != last){

        cout << "YES" << endl;

    }

    else{

        cout << "NO" << endl;

    }

}



int main(){

    int t;

    cin >> t;

    while(t-- > 0){

        solve();

    }

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>

using namespace std;



void solve(){

    int n;

    cin >> n;

    vector<int> ans;

    for(int i = 0; i < n ; i++){

        int num;

        cin >> num;

        ans.push_back(num);

    }

    vector<int> arr;

    arr = ans;

    sort(arr.begin(),arr.end());

    if(arr == ans){

        cout << "YES" << endl;

        return;

    }

    int last = arr[n-1];

    if(ans[0] != last){

        cout << "YES" << endl;

    }

    else{

        cout << "NO" << endl;

    }

}



int main(){

    int t;

    cin >> t;

    while(t-- > 0){

        solve();

    }

}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>

using namespace std;



void solve(){

    int n;

    cin >> n;

    vector<int> ans;

    for(int i = 0; i < n ; i++){

        int num;

        cin >> num;

        ans.push_back(num);

    }

    vector<int> arr;

    arr = ans;

    sort(arr.begin(),arr.end());

    if(arr == ans){

        cout << "YES" << endl;

        return;

    }

    int last = arr[n-1];

    if(ans[0] > ans[1]){

        cout << "NO" << endl;

    }

    else if(ans[n-2] > ans[n-1]){

      cout << "NO" << endl;

    }

    else{

      cout << "YES" << endl;

    }

}



int main(){

    int t;

    cin >> t;

    while(t-- > 0){

        solve();

    }

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>

using namespace std;



void solve(){

    int n;

    cin >> n;

    vector<int> ans;

    for(int i = 0; i < n ; i++){

        int num;

        cin >> num;

        ans.push_back(num);

    }

    vector<int> arr;

    arr = ans;

    sort(arr.begin(),arr.end());

    if(arr == ans){

        cout << "YES" << endl;

        return;

    }

    int last = arr[n-1];

    if(ans[0] > ans[1]){

        cout << "NO" << endl;

    }

    else if(ans[n-2] > ans[n-1]){

      cout << "NO" << endl;

    }

    else{

      cout << "YES" << endl;

    }

}



int main(){

    int t;

    cin >> t;

    while(t-- > 0){

        solve();

    }

}

Submission (verdict: Accepted):
#include<bits/stdc++.h>

using namespace std;



void solve(){

    int n;

    cin >> n;

    vector<int> ans;

    for(int i = 0; i < n ; i++){

        int num;

        cin >> num;

        ans.push_back(num);

    }

    bool isTrue = true;

    for(int i = 1 ; i < n ; i++){

      if(ans[i-1] > ans[i]){

        isTrue = false;

        break;

      }

      else{

        ans[i] -= ans[i-1];

        ans[i-1] = 0;

      }

    }

    if(isTrue){

      cout << "YES" << endl;

    }

    else{

      cout << "NO" << endl;

    }

}



int main(){

    int t;

    cin >> t;

    while(t-- > 0){

        solve();

    }

}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<int> vec(n);

        for (int i = 0; i < n; ++i) {
            cin >> vec[i];
        }
        if(n==1){
            cout<<vec[0]<<endl;
            continue;
        }
        else if(n==2 && vec[0]>=0 && vec[1]>=0){
            cout<<vec[0]+vec[1]<<endl;
            continue;
        }
        while (vec.size() > 1) {  // Iteratively reduce the sequence
            vector<int> temp;
            for (int j = 1; j < vec.size(); ++j) {
                temp.push_back(vec[j] - vec[j - 1]);
            }
            if (is_sorted(temp.begin(), temp.end()) ) {
                int ere=-1;
                for(auto ii:temp)if(ii<0)ere=1;
                if(ere==-1){
                    int sumi = accumulate(temp.begin(), temp.end(), 0LL);
                    cout << sumi << endl;
                    break;
                }else if(ere==1 && temp.size()==1){
                    cout<<abs(temp[0])<<endl;
                }
            }
            vec = temp;  // Move to next iteration
        }
        
    }
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<int> vec(n);

        for (int i = 0; i < n; ++i) {
            cin >> vec[i];
        }
        
        if (n == 1) {
            cout << vec[0] << endl;
            continue;
        }
        else if(n==2 && vec[0]>=0 && vec[1]>=0){
            cout<<vec[0]+vec[1]<<endl;
            continue;
        }

        while (vec.size() > 1) {
            vector<int> temp;
            for (int j = 1; j < vec.size(); ++j) {
                temp.push_back(vec[j] - vec[j - 1]);
            }

            if (all_of(temp.begin(), temp.end(), [](int x) { return x >= 0; })) {
                cout << accumulate(temp.begin(), temp.end(), 0LL) << endl;
                break;
            } else if (temp.size() == 1) {
                cout << abs(temp[0]) << endl;
                break;
            }

            vec = temp;  // Move to the next iteration
        }
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<int> vec(n);

        for (int i = 0; i < n; ++i) {
            cin >> vec[i];
        }
        if(n==1){
            cout<<vec[0]<<endl;
            continue;
        }
        else if(n==2 && vec[0]>=0 && vec[1]>=0){
            cout<<vec[0]+vec[1]<<endl;
            continue;
        }

        int cnt1 = 0;
        for (int j = 0; j < n - 1; ++j) {  // Fix: Avoid out-of-bounds
            if (vec[j] > vec[j + 1]) cnt1++;
        }

        if (cnt1 > (n - 1) / 2) reverse(vec.begin(), vec.end());

        while (vec.size() >= 1) {  // Iteratively reduce the sequence
            vector<int> temp;
            for (int j = 1; j < vec.size(); ++j) {
                temp.push_back(vec[j] - vec[j - 1]);
            }
            if (is_sorted(temp.begin(), temp.end()) ) {
                int ere=-1;
                for(auto ii:temp)if(ii<0)ere=1;
                if(ere==-1){
                    int sumi = accumulate(temp.begin(), temp.end(), 0LL);
                    cout << sumi << endl;
                    break;
                }
            }

            int cnt = 0;
            for (int j = 0; j < temp.size() - 1; ++j) {  // Fix: Avoid out-of-bounds
                if (temp[j] > temp[j + 1]) cnt++;
            }

            if (cnt > (temp.size() - 1) / 2) reverse(temp.begin(), temp.end());
            
            vec = temp;  // Move to next iteration
        }
    }
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<int> vec(n);

        for (int i = 0; i < n; ++i) {
            cin >> vec[i];
        }
        if(n==1){
            cout<<vec[0]<<endl;
            continue;
        }
        else if(n==2 && vec[0]>=0 && vec[1]>=0){
            cout<<vec[0]+vec[1]<<endl;
            continue;
        }
        while (vec.size() > 1) {  // Iteratively reduce the sequence
            vector<int> temp;
            for (int j = 1; j < vec.size(); ++j) {
                temp.push_back(vec[j] - vec[j - 1]);
            }
            if (is_sorted(temp.begin(), temp.end()) ) {
                int ere=-1;
                for(auto ii:temp)if(ii<0)ere=1;
                if(ere==-1){
                    int sumi = accumulate(temp.begin(), temp.end(), 0LL);
                    cout << sumi << endl;
                    break;
                }else if(ere==1 && temp.size()==1){
                    cout<<abs(temp[0])<<endl;
                }
            }
            vec = temp;  // Move to next iteration
        }
        
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<int> vec(n);

        for (int i = 0; i < n; ++i) {
            cin >> vec[i];
        }
        
        if (n == 1) {
            cout << vec[0] << endl;
            continue;
        }
        else if(n==2 && vec[0]>=0 && vec[1]>=0){
            cout<<vec[0]+vec[1]<<endl;
            continue;
        }

        while (vec.size() > 1) {
            vector<int> temp;
            for (int j = 1; j < vec.size(); ++j) {
                temp.push_back(vec[j] - vec[j - 1]);
            }

            if (all_of(temp.begin(), temp.end(), [](int x) { return x >= 0; })) {
                cout << accumulate(temp.begin(), temp.end(), 0LL) << endl;
                break;
            } else if (temp.size() == 1) {
                cout << abs(temp[0]) << endl;
                break;
            }

            vec = temp;  // Move to the next iteration
        }
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define int long long

int solve(vector<int> vec) {
    int n = vec.size();
    if (n == 1) return vec[0];
    
    int maxSum = accumulate(vec.begin(), vec.end(), 0LL);
    queue<vector<int>> q;
    q.push(vec);
    set<vector<int>> seen;
    seen.insert(vec);
    
    while (!q.empty()) {
        vector<int> curr = q.front();
        q.pop();
        
        // Try reverse operation
        vector<int> reversed = curr;
        reverse(reversed.begin(), reversed.end());
        if (seen.find(reversed) == seen.end()) {
            int sum = accumulate(reversed.begin(), reversed.end(), 0LL);
            maxSum = max(maxSum, sum);
            if (reversed.size() > 1) {
                q.push(reversed);
                seen.insert(reversed);
            }
        }
        
        // Try difference operation
        if (curr.size() > 1) {
            vector<int> diff;
            for (int i = 1; i < curr.size(); i++) {
                diff.push_back(curr[i] - curr[i-1]);
            }
            if (seen.find(diff) == seen.end()) {
                int sum = accumulate(diff.begin(), diff.end(), 0LL);
                maxSum = max(maxSum, sum);
                if (diff.size() > 1) {
                    q.push(diff);
                    seen.insert(diff);
                }
            }
        }
    }
    return maxSum;
}

signed main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<int> vec(n);
        for (int i = 0; i < n; i++) {
            cin >> vec[i];
        }
        cout << solve(vec) << endl;
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<int> vec(n);

        for (int i = 0; i < n; ++i) {
            cin >> vec[i];
        }
        if(n==1){
            cout<<vec[0]<<endl;
            continue;
        }
        else if(n==2 && vec[0]>=0 && vec[1]>=0){
            cout<<vec[0]+vec[1]<<endl;
            continue;
        }

        int cnt1 = 0;
        for (int j = 0; j < n - 1; ++j) {  // Fix: Avoid out-of-bounds
            if (vec[j] > vec[j + 1]) cnt1++;
        }

        if (cnt1 > (n - 1) / 2) reverse(vec.begin(), vec.end());

        while (vec.size() >= 1) {  // Iteratively reduce the sequence
            vector<int> temp;
            for (int j = 1; j < vec.size(); ++j) {
                temp.push_back(vec[j] - vec[j - 1]);
            }
            if (is_sorted(temp.begin(), temp.end()) ) {
                int ere=-1;
                for(auto ii:temp)if(ii<0)ere=1;
                if(ere==-1){
                    int sumi = accumulate(temp.begin(), temp.end(), 0LL);
                    cout << sumi << endl;
                    break;
                }
            }

            int cnt = 0;
            for (int j = 0; j < temp.size() - 1; ++j) {  // Fix: Avoid out-of-bounds
                if (temp[j] > temp[j + 1]) cnt++;
            }

            if (cnt > (temp.size() - 1) / 2) reverse(temp.begin(), temp.end());
            
            vec = temp;  // Move to next iteration
        }
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

#define ll long long



void Test() {

    ll n, l, r;

    cin >> n >> l >> r;

    vector<ll> v;

    for(ll i=0; i<n; i++){

        ll x;

        cin >> x;

        v.push_back(x);

    }

    sort(v.begin(), v.end());

    ll m = r-l+1;

    ll sum = 0;

    for(ll i=0; i<m; i++){

        sum += v[i];

    }

    cout << sum << endl;

}



int main() {

   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);



    ll t;

    cin >> t;

    while(t--) {

        Test();

    }



    return 0;

}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

#define ll long long



void Test() {

    ll n, l, r;

    cin >> n >> l >> r;

    vector<pair<ll, ll> > v;

    for(ll i=1; i<=n; i++){

        ll x;

        cin >> x;

        v.push_back(make_pair(x, i));

    }

    sort(v.begin(), v.end());

    ll m = r-l+1;

    ll sum = 0;

    ll bs = 0, bc = m;

    ll ss = 0, sc = m;

    ll i = 0;

    ll flag;

    while(true){

        if(v[i].second < l){

            ss += v[i].first;

            sc--;

        }

        else if(v[i].second > r){

            bs += v[i].first;

            bc--;

        }

        else{

            sum += v[i].first;

            sc--;

            bc--;

        }

        if(!bc){

            flag = 0;

            break;

        }

        else if(!sc){

            flag = 1;

            break;

        }

        i++;

    }

    if(flag)

        sum += ss;

    else

        sum += bs;

    cout << sum << endl;

}



int main() {

   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);



    ll t;

    cin >> t;

    while(t--) {

        Test();

    }



    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

#define ll long long



void Test() {

    ll n, l, r;

    cin >> n >> l >> r;

    vector<ll> v;

    for(ll i=0; i<n; i++){

        ll x;

        cin >> x;

        v.push_back(x);

    }

    sort(v.begin(), v.end());

    ll m = r-l+1;

    ll sum = 0;

    for(ll i=0; i<m; i++){

        sum += v[i];

    }

    cout << sum << endl;

}



int main() {

   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);



    ll t;

    cin >> t;

    while(t--) {

        Test();

    }



    return 0;

}