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;

typedef long long ll;

void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    vector<int> a(n);
    for (auto& ai : a)
        cin >> ai;
    sort(a.begin(), a.end());
    int size = r - l + 1;
    cout << accumulate(a.begin(), a.begin() + size, 0ll) << endl;
}

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

    int t = 1;
    cin >> t;

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


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

typedef long long ll;

void solve() {
    int n, l, r;
    cin >> n >> l >> r;
    l -= 1;
    r -= 1;
    vector<int> a;
    vector<int> b;
    for (int i = 0; i < n; i++) {
        int ai;
        cin >> ai;
        if (i <= r)
            b.push_back(ai);
        if (i >= l)
            a.push_back(ai);
    }
    sort(b.begin(), b.end());
    sort(a.begin(), a.end());
    int size = r - l + 1;
    ll ans = min(accumulate(a.begin(), a.begin() + size, 0ll), accumulate(b.begin(), b.begin() + size, 0ll));
    cout << ans << endl;
}

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

    int t = 1;
    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;



typedef long long ll;



void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(2 * n);

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

        int ai;

        cin >> ai;

        a[i] = ai;

        a[i + n] = ai;

    }

    ll sliding = a[0];

    ll best_sofar = LLONG_MAX;

    int size = r - l + 1;

    int j = 0;

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

        if(i - j == size){

            sliding -= a[j]; 

            j += 1;

        }

        sliding += a[i];

        if(i - j + 1 == size){

            best_sofar = min(sliding, best_sofar); 

        }

    }



    cout << best_sofar << endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t = 1;

    cin >> t;



    while (t--) {

        solve();

    }

    return 0;

}



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

using namespace std;



typedef long long ll;



void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(2 * n);

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

        int ai;

        cin >> ai;

        a[i] = ai;

        a[i + n] = ai;

    }

    ll best = 0;

    int size = r - l + 1;

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

        best += a[i];

    }

    ll curr = best;

    for (int i = size; i < 2 * n; i++) {

        curr -= a[i - size];

        curr += a[i];

        best = min(curr, best);

    }

    cout << best << endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t = 1;

    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;



typedef long long ll;



void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(2 * n);

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

        int ai;

        cin >> ai;

        a[i] = ai;

        a[i + n] = ai;

    }

    ll sliding = a[0];

    ll best_sofar = LLONG_MAX;

    int size = r - l + 1;

    int j = 0;

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

        if(i - j == size){

            sliding -= a[j]; 

            j += 1;

        }

        sliding += a[i];

        if(i - j + 1 == size){

            best_sofar = min(sliding, best_sofar); 

        }

    }



    cout << best_sofar << endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t = 1;

    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;



typedef long long ll;



void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(2 * n);

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

        int ai;

        cin >> ai;

        a[i] = ai;

        a[i + n] = ai;

    }

    ll best = 0;

    int size = r - l + 1;

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

        best += a[i];

    }

    ll curr = best;

    for (int i = size; i < 2 * n; i++) {

        curr -= a[i - size];

        curr += a[i];

        best = min(curr, best);

    }

    cout << best << endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t = 1;

    cin >> t;



    while (t--) {

        solve();

    }

    return 0;

}



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

using namespace std;



typedef long long ll;



void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for (auto& ai : a)

        cin >> ai;

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

    int size = r - l + 1;

    cout << accumulate(a.begin(), a.begin() + size, 0ll) << endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t = 1;

    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;



typedef long long ll;



void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for (auto& ai : a)

        cin >> ai;

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

    int size = r - l + 1;

    cout << accumulate(a.begin(), a.begin() + size, 0ll) << endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t = 1;

    cin >> t;



    while (t--) {

        solve();

    }

    return 0;

}



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

using namespace std;



typedef long long ll;



void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    l -= 1;

    r -= 1;

    vector<int> a;

    vector<int> b;

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

        int ai;

        cin >> ai;

        if (i <= r)

            b.push_back(ai);

        if (i >= l)

            a.push_back(ai);

    }

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

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

    int size = r - l + 1;

    ll ans = min(accumulate(a.begin(), a.begin() + size, 0ll), accumulate(b.begin(), b.begin() + size, 0ll));

    cout << ans << endl;

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);



    int t = 1;

    cin >> t;



    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 28):
#include <iostream>  

#include <vector>  

#include <algorithm>  

#include <string>  

#include <cmath> 

#include <queue>  

#include <deque>

#include <stack>  

#include <utility>  

#include <map>  

#include <set>  

#include <unordered_map>  

#include <unordered_set>  

#include <chrono>

#include <pthread.h>



#define ll long long int

#define pb push_back

#define mp make_pair

#define mod 998244353

#define pi 3.141592653589793

#define N 100001



using namespace std;





void f() {

    int n, m;

    cin >> n >> m;

    vector<int> a(n), b(m);

    unordered_map<int, int> d;

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

        cin >> a[i];

        d[a[i]]++;

    }

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

        cin >> b[i];

    }



    while (!b.empty()) {

        int last = b.back();

        if (last == 0) {

            cout << "NO\n";

            return;

        }

        if (d[last]) {

            d[last]--;

            b.pop_back();

        }

        else {

            b.pop_back();

            b.pb(last - last / 2);

            b.pb(last / 2);

        }

    }



    for (auto &e : d) {

        if (e.second) {

            cout << "NO\n";

            return;

        }

    }



    cout << "YES\n";



}



int main() {

    int t;

    cin >> t;

    while (t--) {

        f();



    }

    return 0;

}







// 5

// 12 1 2

// 12 1 1

// 12 0 0

// 12 1000000000 1000000000

// 706636307 0 3
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 28):
#include <iostream>  

#include <vector>  

#include <algorithm>  

#include <string>  

#include <cmath> 

#include <queue>  

#include <deque>

#include <stack>  

#include <utility>  

#include <map>  

#include <set>  

#include <unordered_map>  

#include <unordered_set>  

#include <chrono>

#include <pthread.h>



#define ll long long int

#define pb push_back

#define mp make_pair

#define mod 998244353

#define pi 3.141592653589793

#define N 100001



using namespace std;





void f() {

    int n, m;

    cin >> n >> m;

    vector<int> a(n), b(m);

    unordered_map<int, int> d;

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

        cin >> a[i];

        d[a[i]]++;

    }

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

        cin >> b[i];

    }



    while (!b.empty()) {

        int last = b.back();

        if (last == 0) {

            cout << "NO\n";

            return;

        }

        if (d[last]) {

            d[last]--;

            b.pop_back();

        }

        else {

            b.pop_back();

            b.pb(last - last / 2);

            b.pb(last / 2);

        }

    }



    for (auto &e : d) {

        if (e.second) {

            cout << "NO\n";

            return;

        }

    }



    cout << "YES\n";



}



int main() {

    int t;

    cin >> t;

    while (t--) {

        f();



    }

    return 0;

}







// 5

// 12 1 2

// 12 1 1

// 12 0 0

// 12 1000000000 1000000000

// 706636307 0 3



Submission (verdict: Time limit exceeded on test 28):
#include <iostream>  

#include <vector>  

#include <algorithm>  

#include <string>  

#include <cmath> 

#include <queue>  

#include <deque>

#include <stack>  

#include <utility>  

#include <map>  

#include <set>  

#include <unordered_map>  

#include <unordered_set>  

#include <chrono>

#include <pthread.h>



#define ll long long int

#define pb push_back

#define mp make_pair

#define mod 998244353

#define pi 3.141592653589793

#define N 100001



using namespace std;





void f() {

    int n, m;

    cin >> n >> m;

    vector<int> a(n), b(m);

    unordered_map<int, int> d;

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

        cin >> a[i];

        d[a[i]]++;

    }

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

        cin >> b[i];

    }



    while (!b.empty() && b.size() <= n) {

        int last = b.back();

        if (last == 0) {

            cout << "NO\n";

            return;

        }

        if (d[last]) {

            d[last]--;

            b.pop_back();

        }

        else {

            b.pop_back();

            b.pb(last - last / 2);

            b.pb(last / 2);

        }

    }



    for (auto &e : d) {

        if (e.second) {

            cout << "NO\n";

            return;

        }

    }



    cout << "YES\n";



}



int main() {

    int t;

    cin >> t;

    while (t--) {

        f();



    }

    return 0;

}







// 5

// 12 1 2

// 12 1 1

// 12 0 0

// 12 1000000000 1000000000

// 706636307 0 3
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 28):
#include <iostream>  

#include <vector>  

#include <algorithm>  

#include <string>  

#include <cmath> 

#include <queue>  

#include <deque>

#include <stack>  

#include <utility>  

#include <map>  

#include <set>  

#include <unordered_map>  

#include <unordered_set>  

#include <chrono>

#include <pthread.h>



#define ll long long int

#define pb push_back

#define mp make_pair

#define mod 998244353

#define pi 3.141592653589793

#define N 100001



using namespace std;





void f() {

    int n, m;

    cin >> n >> m;

    vector<int> a(n), b(m);

    unordered_map<int, int> d;

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

        cin >> a[i];

        d[a[i]]++;

    }

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

        cin >> b[i];

    }



    while (!b.empty() && b.size() <= n) {

        int last = b.back();

        if (last == 0) {

            cout << "NO\n";

            return;

        }

        if (d[last]) {

            d[last]--;

            b.pop_back();

        }

        else {

            b.pop_back();

            b.pb(last - last / 2);

            b.pb(last / 2);

        }

    }



    for (auto &e : d) {

        if (e.second) {

            cout << "NO\n";

            return;

        }

    }



    cout << "YES\n";



}



int main() {

    int t;

    cin >> t;

    while (t--) {

        f();



    }

    return 0;

}







// 5

// 12 1 2

// 12 1 1

// 12 0 0

// 12 1000000000 1000000000

// 706636307 0 3



Submission (verdict: Accepted):
#include <iostream>  

#include <vector>  

#include <algorithm>  

#include <string>  

#include <cmath> 

#include <queue>  

#include <deque>

#include <stack>  

#include <utility>  

#include <map>  

#include <set>  

#include <unordered_map>  

#include <unordered_set>  

#include <chrono>

#include <pthread.h>



#define ll long long int

#define pb push_back

#define mp make_pair

#define mod 998244353

#define pi 3.141592653589793

#define N 100001



using namespace std;





void f() {

    int n, m;

    cin >> n >> m;

    unordered_map<int, int> d;

    priority_queue<int> a, b;

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

        int e;

        cin >> e;

        a.push(e);

    }

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

        int e;

        cin >> e;

        b.push(e);

    }



    while (!b.empty() && b.size() <= a.size() && b.top() >= a.top()) {

        int first = b.top();

        if (first == a.top()) {

            a.pop();

            b.pop();

        }

        else {

            b.pop();

            b.push(first - first / 2);

            b.push(first / 2);

        }

    }



    if (a.empty() && b.empty()) cout << "Yes\n";

    else cout << "No\n";





}



int main() {

    int t;

    cin >> t;

    while (t--) {

        f();



    }

    return 0;

}







// 5

// 12 1 2

// 12 1 1

// 12 0 0

// 12 1000000000 1000000000

// 706636307 0 3
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;
#define long long ll

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int> a(n);
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        if(a[1]<a[0])
        {
            cout<<"NO"<<endl;
            continue;
        }
        if(n==2)
        {
            cout<<"YES";
            continue;
        }
        bool ans = false;
        for(int i=1;i<n-1;i++)
        {
            if(a[i]-min(a[i],a[i-1])<a[i+1])
            {
                a[i] = a[i] - min(a[i],a[i-1]);
                ans = true;
                continue;
            }
            else{
                ans = false;
                break;
            }
        }
        if(ans)
        {
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}
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;
#define long long ll

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int> a(n);
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        if(a[1]<a[0])
        {
            cout<<"NO"<<endl;
            continue;
        }
        if(n==2)
        {
            cout<<"YES"<<endl;
            continue;
        }
        bool ans = false;
        for(int i=1;i<n-1;i++)
        {
            if(a[i]-min(a[i],a[i-1])<a[i+1])
            {
                a[i] = a[i] - min(a[i],a[i-1]);
                ans = true;
                continue;
            }
            else{
                ans = false;
                break;
            }
        }
        if(ans)
        {
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}

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

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int> a(n);
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        if(a[1]<a[0])
        {
            cout<<"NO"<<endl;
            continue;
        }
        if(n==2)
        {
            cout<<"YES"<<endl;
            continue;
        }
        bool ans = false;
        for(int i=1;i<n-1;i++)
        {
            if(a[i]-min(a[i],a[i-1])<=a[i+1])
            {
                a[i] = a[i] - min(a[i],a[i-1]);
                ans = true;
                continue;
            }
            else{
                ans = false;
                break;
            }
        }
        if(ans)
        {
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}
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;
#define long long ll

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int> a(n);
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        if(a[1]<a[0])
        {
            cout<<"NO"<<endl;
            continue;
        }
        if(n==2)
        {
            cout<<"YES";
            continue;
        }
        bool ans = false;
        for(int i=1;i<n-1;i++)
        {
            if(a[i]-min(a[i],a[i-1])<a[i+1])
            {
                a[i] = a[i] - min(a[i],a[i-1]);
                ans = true;
                continue;
            }
            else{
                ans = false;
                break;
            }
        }
        if(ans)
        {
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}

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

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<int> a(n);
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        if(a[1]<a[0])
        {
            cout<<"NO"<<endl;
            continue;
        }
        if(n==2)
        {
            cout<<"YES"<<endl;
            continue;
        }
        bool ans = false;
        for(int i=1;i<n-1;i++)
        {
            if(a[i]-min(a[i],a[i-1])<a[i+1])
            {
                a[i] = a[i] - min(a[i],a[i-1]);
                ans = true;
                continue;
            }
            else{
                ans = false;
                break;
            }
        }
        if(ans)
        {
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


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

int main(){
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        int a[n];
        int ans =INT_MIN;
        int sum=0;

        for (int i = 0; i < n; i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        ans=max(ans,sum);
        for (int j = 0; j < n-1; j++)
        {
                a[j]=a[j+1]-a[j];
        }
        int now=n-1;
        for (int i = 1; i < n; i++)
        {
            sum=0;
            for (int j = 0; j < now; j++)
            {
                sum+=a[j];
            }
            cout<<sum<<endl; 
            ans=max(ans,abs(sum));
            for (int j = 0; j < now; j++)
            {
                a[j]=a[j+1]-a[j];
            }
            now--;
        }
        cout<<ans<<endl;

        
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

int main(){
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        int a[n];
        int ans =INT_MIN;
        int sum=0;

        for (int i = 0; i < n; i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        ans=max(ans,sum);
        for (int j = 0; j < n-1; j++)
        {
                a[j]=a[j+1]-a[j];
        }
        int now=n-1;
        for (int i = 1; i < n; i++)
        {
            sum=0;
            for (int j = 0; j < now; j++)
            {
                sum+=a[j];
            }
            cout<<sum<<endl; 
            ans=max(ans,abs(sum));
            for (int j = 0; j < now; j++)
            {
                a[j]=a[j+1]-a[j];
            }
            now--;
        }
        cout<<ans<<endl;

        
    }
}


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

int main(){
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        int a[n];
        int ans =INT_MIN;
        int sum=0;

        for (int i = 0; i < n; i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        ans=max(ans,sum);
        for (int j = 0; j < n-1; j++)
        {
                a[j]=a[j+1]-a[j];
        }
        int now=n-1;
        for (int i = 1; i < n; i++)
        {
            sum=0;
            for (int j = 0; j < now; j++)
            {
                sum+=a[j];
            }
            
            ans=max(ans,abs(sum));
            for (int j = 0; j < now; j++)
            {
                a[j]=a[j+1]-a[j];
            }
            now--;
        }
        cout<<ans<<endl;

        
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

int main(){
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        int a[n];
        int ans =INT_MIN;
        int sum=0;

        for (int i = 0; i < n; i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        ans=max(ans,sum);
        for (int j = 0; j < n-1; j++)
        {
                a[j]=a[j+1]-a[j];
        }
        int now=n-1;
        for (int i = 1; i < n; i++)
        {
            sum=0;
            for (int j = 0; j < now; j++)
            {
                sum+=a[j];
            }
            
            ans=max(ans,abs(sum));
            for (int j = 0; j < now; j++)
            {
                a[j]=a[j+1]-a[j];
            }
            now--;
        }
        cout<<ans<<endl;

        
    }
}

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

int main(){
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        int a[n];
        long long int ans =INT_MIN;
        long long int sum=0;

        for (int i = 0; i < n; i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        ans=max(ans,sum);
        for (int j = 0; j < n-1; j++)
        {
                a[j]=a[j+1]-a[j];
        }
        int now=n-1;
        for (int i = 1; i < n; i++)
        {
            sum=0;
            for (int j = 0; j < now; j++)
            {
                sum+=a[j];
            }
            
            ans=max(ans,abs(sum));
            for (int j = 0; j < now; j++)
            {
                a[j]=a[j+1]-a[j];
            }
            now--;
        }
        cout<<ans<<endl;

        
    }
}