ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <math.h>
#include <array>
#include <random>
#include <bitset>
#include <climits>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define endl '\n'
#define mod 1000000007
#define INF 0x3f3f3f3f

#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,sse3,sse4,avx")
#pragma GCC target("popcnt")

template <class x>
using ordered_set = tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> ipair;

static inline int read()
{
    int x = 0;char ch = getchar();
    while (ch < '0' || ch>'9') ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
    return x;
}

static inline void print(const int &x) {
    if (x > 9)print(x / 10);
    putchar('0' + x % 10);
}

int main()
{
    cin.tie(0) -> sync_with_stdio(0);

    int t;

    cin >> t;

    while(t--)
    {
        int n;

        cin >> n;

        int list[n];
        for(int i = 0;i < n;cin >> list[i++]);

        bool ans = 1;
        for(int i = 0;i < n-1;i++)
        {
            ans &= abs(list[i] - list[i + 1]);
        }

        bool f = 1;
        for(int i = 0;i < n-1;i++)
        {
            if(list[i] <= list[i + 1]) f = 0;
        }
        cout << (ans && !f ? "YES\n" : "NO\n");
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
/* Bismillahir Rahmanir Rahim. */
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int N = 2e5 + 9, mod = 998244353, inf = 1e17 + 5;

void test() {
    int n; cin >> n;
    vector<int>a(n);
    for(auto &i: a) {
        cin >> i;
    }
    if(n==1) {
        cout << 0 << endl;
        return;
    }
    vector<pair<int,int>>ans;
    for(int i = 0; i < n - 1; i++) {
        int last = a[n-1];
        for(int j = n-2; j >= i; j--) {
            ans.push_back({a[j],last});
            a[j+1] = a[j];
        }
        a[i] = last;
    }
    // for(auto &i: a) {
    //     cout << i <<" ";
    // } cout << endl;
    ans.push_back({a[n-2],a[n-1]});
    cout << ans.size() << endl;
    for(auto i: ans) {
        cout << i.first <<" "<< i.second<<endl;
    }
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1;
    //cin >> tt;
    while (tt--) {
        test();
    }

    return 0;
}

Submission (verdict: Wrong answer on test 1):
/* Bismillahir Rahmanir Rahim. */
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int N = 2e5 + 9, mod = 998244353, inf = 1e17 + 5;

void test() {
    int n; cin >> n;
    vector<int>a(n);
    for(auto &i: a) {
        cin >> i;
    }
    if(n==1) {
        cout << 0 << endl;
        return;
    }
    reverse(a.begin(),a.end());
    vector<pair<int,int>>ans;
    for(int i = 0; i < n - 1; i++) {
        int last = a[n-1];
        for(int j = n-2; j >= i; j--) {
            ans.push_back({a[j],last});
            a[j+1] = a[j];
        }
        a[i] = last;
    }
    // for(auto &i: a) {
    //     cout << i <<" ";
    // } cout << endl;
    ans.push_back({a[n-2],a[n-1]});
    cout << ans.size() << endl;
    for(auto i: ans) {
        cout << i.first <<" "<< i.second<<endl;
    }
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1;
    //cin >> tt;
    while (tt--) {
        test();
    }

    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
/* Bismillahir Rahmanir Rahim. */
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int N = 2e5 + 9, mod = 998244353, inf = 1e17 + 5;

void test() {
    int n; cin >> n;
    vector<int>a(n);
    for(auto &i: a) {
        cin >> i;
    }
    if(n==1) {
        cout << 0 << endl;
        return;
    }
    vector<pair<int,int>>ans;
    for(int i = 0; i < n - 1; i++) {
        int last = a[n-1];
        for(int j = n-2; j >= i; j--) {
            ans.push_back({a[j],last});
            a[j+1] = a[j];
        }
        a[i] = last;
    }
    // for(auto &i: a) {
    //     cout << i <<" ";
    // } cout << endl;
    ans.push_back({a[n-2],a[n-1]});
    cout << ans.size() << endl;
    for(auto i: ans) {
        cout << i.first <<" "<< i.second<<endl;
    }
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1;
    //cin >> tt;
    while (tt--) {
        test();
    }

    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
/* Bismillahir Rahmanir Rahim. */
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int N = 2e5 + 9, mod = 998244353, inf = 1e17 + 5;

void test() {
    int n; cin >> n;
    vector<int>a(n);
    for(auto &i: a) {
        cin >> i;
    }
    if(n==1) {
        cout << 0 << endl;
        return;
    }
    reverse(a.begin(),a.end());
    vector<pair<int,int>>ans;
    for(int i = 0; i < n - 1; i++) {
        int last = a[n-1];
        for(int j = n-2; j >= i; j--) {
            ans.push_back({a[j],last});
            a[j+1] = a[j];
        }
        a[i] = last;
    }
    // for(auto &i: a) {
    //     cout << i <<" ";
    // } cout << endl;
    ans.push_back({a[n-2],a[n-1]});
    cout << ans.size() << endl;
    for(auto i: ans) {
        cout << i.first <<" "<< i.second<<endl;
    }
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1;
    //cin >> tt;
    while (tt--) {
        test();
    }

    return 0;
}

Submission (verdict: Accepted):
/* Bismillahir Rahmanir Rahim. */
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int N = 2e5 + 9, mod = 998244353, inf = 1e17 + 5;

void test() {
    int n; cin >> n;
    vector<int>a(n);
    for(auto &i: a) {
        cin >> i;
    }
    if(n==1) {
        cout << 0 << endl;
        return;
    }
    //reverse(a.begin(),a.end());
    vector<pair<int,int>>ans;
    for(int i = 0; i < n; i++) {
        for(int j = 0 ; j < n-i-1; j++) {
            if(a[j] < a[j+1]) {
                ans.push_back({a[j],a[j+1]});
                swap(a[j+1],a[j]);
            }
        }
    }
    
    for(int i = 0; i < n; i++) {
        for(int j = 0 ; j < n-i-1; j++) {
            if(a[j] > a[j+1]) {
                ans.push_back({a[j],a[j+1]});
                swap(a[j+1],a[j]);
            }
        }
    }
    // for(auto i: a) {
    //     cout << i <<" ";
    // } cout << endl;
    reverse(ans.begin(),ans.end());
    cout << ans.size() << endl;
    for(auto i: ans) {
        cout << i.first <<" "<< i.second <<endl;
    }
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1;
    //cin >> tt;
    while (tt--) {
        test();
    }

    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 2):
t = int(input())



l = []



for _ in range(t):

    n = int(input())

    a = list(map(int, input().split()))

    l = sorted(a)

    i = 0

    s = True

    while i < len(a)-1:

        if a[i] > a[i+1]:

            print("NO")

            s = False

            break

        i += 2

    if s:

        print("YES")

Submission (verdict: Wrong answer on test 2):
t = int(input())



l = []



for _ in range(t):

    n = int(input())

    a = list(map(int, input().split()))

    l = sorted(a)

    i = 0

    s = True

    while i < len(a)-1:

        if a[i] >= a[i+1]:

            print("NO")

            s = False

            break

        i += 2

    if s:

        print("YES")
Problem: 2060D - Subtract Min Sort
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 2):
t = int(input())



l = []



for _ in range(t):

    n = int(input())

    a = list(map(int, input().split()))

    l = sorted(a)

    i = 0

    s = True

    while i < len(a)-1:

        if a[i] > a[i+1]:

            print("NO")

            s = False

            break

        i += 2

    if s:

        print("YES")
Problem: 2060D - Subtract Min Sort
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 2):
t = int(input())



l = []



for _ in range(t):

    n = int(input())

    a = list(map(int, input().split()))

    l = sorted(a)

    i = 0

    s = True

    while i < len(a)-1:

        if a[i] >= a[i+1]:

            print("NO")

            s = False

            break

        i += 2

    if s:

        print("YES")

Submission (verdict: Accepted):
t = int(input())



for _ in range(t):

    n = int(input())

    a = list(map(int, input().split()))

    j = 0 

    i = 1

    while i < n:

        if a[i-1] > a[i]:

            j = i 

        i += 1

    if j == 0:

        print("YES")

        continue

    for i in range(0, j):

        minN = min(a[i], a[i+1])

        a[i] -= minN

        a[i+1] -= minN

    if a == sorted(a):

        print("YES")

    else:

        print("NO")
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
using i64 = long long;

void solve()
{
    Q_INIT_RESOURCE
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int T;
    std::cin >> T;

    while(T--) solve();

    return 0;
}


Submission (verdict: Compilation error):
#include <bits/stdc++.h>
// using i64 = long long;

void solve()
{
    int l, r;
    std::cin >> l >> r;

    int a = 0; b = 0; c = 0;
    for(int i = 29; i >= 0; i--)
    {
        if((l ^ r) >> 1 & 1)
        {
            a |= (1 << i) - 1;
            b |= 1 << i;
            break;
        } else
        {
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }

    c = l;
    while(a == c | b == c)
    {
        c++;
    }

    std::cout << a << ' ' << b << ' ' << c << '\n';
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int T;
    std::cin >> T;

    while(T--) solve();

    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
// using i64 = long long;

void solve()
{
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--)
    {
        if((l ^ r) >> 1 & 1)
        {
            a |= (1 << i) - 1;
            b |= 1 << i;
            break;
        } else
        {
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }

    c = l;
    while(a == c | b == c)
    {
        c++;
    }

    std::cout << a << ' ' << b << ' ' << c << '\n';
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int T;
    std::cin >> T;

    while(T--) solve();

    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
// using i64 = long long;

void solve()
{
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--)
    {
        if((l ^ r) >> i & 1)
        {
            a |= (1 << i) - 1;
            b |= 1 << i;
            break;
        } else
        {
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }

    c = l;
    while(a == c | b == c)
    {
        c++;
    }

    std::cout << a << ' ' << b << ' ' << c << '\n';
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int T;
    std::cin >> T;

    while(T--) solve();

    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
// using i64 = long long;

void solve()
{
    int l, r;
    std::cin >> l >> r;

    int a = 0; b = 0; c = 0;
    for(int i = 29; i >= 0; i--)
    {
        if((l ^ r) >> 1 & 1)
        {
            a |= (1 << i) - 1;
            b |= 1 << i;
            break;
        } else
        {
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }

    c = l;
    while(a == c | b == c)
    {
        c++;
    }

    std::cout << a << ' ' << b << ' ' << c << '\n';
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int T;
    std::cin >> T;

    while(T--) solve();

    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
// using i64 = long long;

void solve()
{
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--)
    {
        if((l ^ r) >> 1 & 1)
        {
            a |= (1 << i) - 1;
            b |= 1 << i;
            break;
        } else
        {
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }

    c = l;
    while(a == c | b == c)
    {
        c++;
    }

    std::cout << a << ' ' << b << ' ' << c << '\n';
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int T;
    std::cin >> T;

    while(T--) solve();

    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Compilation error):
#include <bits/stdc++.h>
using i64 = long long;

void solve()
{
    Q_INIT_RESOURCE
}


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int T;
    std::cin >> T;

    while(T--) solve();

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

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

using namespace std;


int main()
{

    int t;
    cin >> t;
    while(t--){

        int n , l , r;
        cin >> n >> l >> r;
        long long sum = 0 ;



        vector < int > v( n + 1 ) ;
        vector < int > L , R ;

        for( int i = 1 ; i <= n ; i ++ ){
            cin >> v[i];
            if(  i >= l && i <= r ){
                sum += v[i];
            }
            if( i < r )L.push_back(v[i]);
            else if( i > l )R.push_back(v[i]);
        }

        if( l == 1 && r == n ){
            cout << sum << endl;

        }

        sort(L.begin(),L.end());
        sort(R.begin(),R.end());


        long long mn = sum;
        int range_sum = 0 , l_sum = 0 , r_sum = 0 ;
        int idx = 0 ;



        for( int i = 0 ; i < L.size() ; i++ ){
            if( i > r - l )break;
            l_sum += L[i];
            range_sum += v[l+i];
            mn = min( mn , sum - range_sum + l_sum );
        }

        range_sum = 0 ;

        for( int i = 0 ; i < R.size()  ; i++ ){
              if( i > r - l )break;
            r_sum += R[i];
            range_sum += v[ r - i ];
            mn = min( mn , sum - range_sum + r_sum );

        }

        cout << mn << endl;



    }
    return 0;
}


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

using namespace std;


int main()
{

    int t;
    cin >> t;
    while(t--){

        int n , l , r;
        cin >> n >> l >> r;
        long long sum = 0 ;

        vector < int > v( n + 1 ) ;
        vector < int > L , R ;

        for( int i = 1 ; i <= n ; i ++ ){
            cin >> v[i];
            if(  i >= l && i <= r ){
                sum += v[i];
            }
            if( i <= r )L.push_back(v[i]);
            else if( i >= l )R.push_back(v[i]);
        }

        if( l == 1 && r == n ){
            cout << sum << endl;
            continue;
        }

        sort(L.begin(),L.end());
        sort(R.begin(),R.end());


        long long mn = sum;
        long long range_sum = 0 , l_sum = 0 , r_sum = 0 ;
        int idx = 0 ;

        for( int i = 0 ; i < L.size() ; i++ ){
            if( l + i > n || i > r - l )break;
            l_sum += L[i];
            range_sum += v[l+i];
            mn = min( mn , sum - range_sum + l_sum );
        }

        range_sum = 0 ;

        for( int i = 0 ; i < R.size() ; i++ ){
            if( r - i < 0  || i > r - l )break;
            r_sum += R[i];
            range_sum += v[ r - i ];
            mn = min( mn , sum - range_sum + r_sum );

        }

        cout << mn << endl;



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

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

using namespace std;


int main()
{

    int t;
    cin >> t;
    while(t--){

        int n , l , r;
        cin >> n >> l >> r;
        long long sum = 0 ;

        vector < int > v( n + 1 ) ;
        vector < int > L , R ;

        for( int i = 1 ; i <= n ; i ++ ){
            cin >> v[i];
            if(  i >= l && i <= r ){
                sum += v[i];
            }
            if( i <= r )L.push_back(v[i]);
            else if( i >= l )R.push_back(v[i]);
        }

        if( l == 1 && r == n ){
            cout << sum << endl;
            continue;
        }

        sort(L.begin(),L.end());
        sort(R.begin(),R.end());


        long long mn = sum;
        long long range_sum = 0 , l_sum = 0 , r_sum = 0 ;
        int idx = 0 ;

        for( int i = 0 ; i < L.size() ; i++ ){
            l_sum += L[i];
            range_sum += v[l+i];
            mn = min( mn , sum - range_sum + l_sum );
        }

        range_sum = 0 ;

        for( int i = 0 ; i < R.size() ; i++ ){
            r_sum += R[i];
            range_sum += v[ r - i ];
            mn = min( mn , sum - range_sum + r_sum );

        }

        cout << mn << endl;



    }
    return 0;
}


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

using namespace std;


int main()
{

    int t;
    cin >> t;
    while(t--){

        int n , l , r;
        cin >> n >> l >> r;
        long long sum = 0 ;



        vector < int > v( n + 1 ) ;
        vector < int > L , R ;

        for( int i = 1 ; i <= n ; i ++ ){
            cin >> v[i];
            if(  i >= l && i <= r ){
                sum += v[i];
            }
            if( i < r )L.push_back(v[i]);
            else if( i > l )R.push_back(v[i]);
        }

        if( l == 1 && r == n ){
            cout << sum << endl;

        }

        sort(L.begin(),L.end());
        sort(R.begin(),R.end());


        long long mn = sum;
        int range_sum = 0 , l_sum = 0 , r_sum = 0 ;
        int idx = 0 ;



        for( int i = 0 ; i < L.size() ; i++ ){
            if( i > r - l )break;
            l_sum += L[i];
            range_sum += v[l+i];
            mn = min( mn , sum - range_sum + l_sum );
        }

        range_sum = 0 ;

        for( int i = 0 ; i < R.size()  ; i++ ){
              if( i > r - l )break;
            r_sum += R[i];
            range_sum += v[ r - i ];
            mn = min( mn , sum - range_sum + r_sum );

        }

        cout << mn << endl;



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


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

using namespace std;


int main()
{

    int t;
    cin >> t;
    while(t--){

        int n , l , r;
        cin >> n >> l >> r;
        long long sum = 0 ;



        vector < int > v( n + 1 ) ;
        vector < int > L , R ;

        for( int i = 1 ; i <= n ; i ++ ){
            cin >> v[i];
            if(  i >= l && i <= r ){
                sum += v[i];
            }
            if( i < r )L.push_back(v[i]);
            else if( i > l )R.push_back(v[i]);
        }

        if( l == 1 && r == n ){
            cout << sum << endl;
            continue;
        }

        sort(L.begin(),L.end());
        sort(R.begin(),R.end());


        long long mn = sum;
        long long range_sum = 0 , l_sum = 0 , r_sum = 0 ;
        int idx = 0 ;

        for( int i = 0 ; i < L.size() ; i++ ){
            l_sum += L[i];
            range_sum += v[l+i];
            mn = min( mn , sum - range_sum + l_sum );
        }

        range_sum = 0 ;

        for( int i = 0 ; i < R.size() ; i++ ){
            r_sum += R[i];
            range_sum += v[ r - i ];
            mn = min( mn , sum - range_sum + r_sum );

        }

        cout << mn << endl;



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

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

using namespace std;


int main()
{

    int t;
    cin >> t;
    while(t--){

        int n , l , r;
        cin >> n >> l >> r;
        long long sum = 0 ;

        vector < int > v( n + 1 ) ;
        vector < int > L , R ;

        for( int i = 1 ; i <= n ; i ++ ){
            cin >> v[i];
            if(  i >= l && i <= r ){
                sum += v[i];
            }
            if( i <= r )L.push_back(v[i]);
            else if( i >= l )R.push_back(v[i]);
        }

        if( l == 1 && r == n ){
            cout << sum << endl;
            continue;
        }

        sort(L.begin(),L.end());
        sort(R.begin(),R.end());


        long long mn = sum;
        long long range_sum = 0 , l_sum = 0 , r_sum = 0 ;
        int idx = 0 ;

        for( int i = 0 ; i < L.size() ; i++ ){
            if( l + i > n || i > r - l )break;
            l_sum += L[i];
            range_sum += v[l+i];
            mn = min( mn , sum - range_sum + l_sum );
        }

        range_sum = 0 ;

        for( int i = 0 ; i < R.size() ; i++ ){
            if( r - i < 0  || i > r - l )break;
            r_sum += R[i];
            range_sum += v[ r - i ];
            mn = min( mn , sum - range_sum + r_sum );

        }

        cout << mn << endl;



    }
    return 0;
}


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

using namespace std;


int main()
{

    int t;
    cin >> t;
    while(t--){

        int n , l , r;
        cin >> n >> l >> r;
        long long sum = 0 ;
        vector < int > L , R;

        vector < int > v( n + 1 ) ;

        for( int i = 1 ; i <= n ; i ++ ){
            cin >> v[i];
            if( i >= 1 && i <= r )R.push_back(v[i]);
            if( i >= l && i <= n )L.push_back(v[i]);

        }
        sort(L.begin(),L.end());
        sort(R.begin(),R.end());

        long long sum1 = 0 , cnt = 0 ;
        while( cnt != r - l + 1 ){
            sum1 += L[cnt];
            cnt++;
        }

        long long sum2 = 0 ;
        cnt = 0 ;
        while(cnt != r-l+1){
            sum2+= R[cnt];
            cnt++;
        }

        cout << min( sum1,sum2 ) << endl;


    }
    return 0;
}