ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Compilation error):
#include<bits/stdc++.h>
using namespace std;
#define int long long int
void solve(){
  int n,l,r;
  cin>>n>>l>>r; 
  vector<int>v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  vector<int>v1,v2;
  for(int i=0;i<r;i++){
    v1.push_back(v[i]);
  }
   for(int i=l;i<n;i++){
    v2.push_back(v[i]);
  }
  sort(v1.begin(),v1.end());
   sort(v2.begin(),v2.end());
   int sum1=0,sum2=0;
   for(int i=0;i<r-l+1){
    sum1+=v1[i];
   }
   for(int i=0;i<r-l+1){
    sum2+=v2[i];
   }
   cout<<min(sum1,sum2)<<endl;
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define int long long int
void solve(){
  int n,l,r;
  cin>>n>>l>>r; 
  vector<int>v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  vector<int>v1,v2;
  for(int i=0;i<r;i++){
    v1.push_back(v[i]);
  }
   for(int i=l;i<n;i++){
    v2.push_back(v[i]);
  }
  sort(v1.begin(),v1.end());
   sort(v2.begin(),v2.end());
   int sum1=0,sum2=0;
   for(int i=0;i<r-l+1;i++){
    sum1+=v1[i];
   }
   for(int i=0;i<r-l+1;i++){
    sum2+=v2[i];
   }
   cout<<min(sum1,sum2)<<endl;
}

signed main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

using namespace std;

void Solve() {
  int l, r, k; cin >> l >> r;
  for (int i = 30; ~i; --i) {
    if ((l ^ r) & (1 << i)) {
      k = i;
      break;
    }
  }
  int a, b, c;
  a = (1 << k) - 1; b = 1 << k; c = l;
  if (a == c) c = r;
  printf("%d %d %d\n", a, b, c);
}

int main() {
  int cases; cin >> cases;
  while (cases--) {
    Solve();
  }
  return 0;
}


Submission (verdict: Compilation error):
// by iodwad
#include <bits/stdc++.h>

using namespace std;

void Solve() {
  int l, r, k; cin >> l >> r;
  for (int i = 30; ~i; --i) {
    if ((l ^ r) & (1 << i)) {
      k = i;
      break;
    }
  }
  int a, b, c;
  int tmp = (l >> k + 1) << k + 1;
  a = (1 << k) - 1 + tmp; b = a + 1; c = l;
  if (a == c) c = r;
  printf("%d %d %d\n", a, b, c);
}

int main() {
  int cases; cin >> cases;
  while (cases--) {
    Solve();
  }
  return 0;
}
/
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


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

using namespace std;

void Solve() {
  int l, r, k; cin >> l >> r;
  for (int i = 30; ~i; --i) {
    if ((l ^ r) & (1 << i)) {
      k = i;
      break;
    }
  }
  int a, b, c;
  a = (1 << k) - 1; b = 1 << k; c = l;
  printf("%d %d %d\n", a, b, c);
}

int main() {
  int cases; cin >> cases;
  while (cases--) {
    Solve();
  }
  return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

using namespace std;

void Solve() {
  int l, r, k; cin >> l >> r;
  for (int i = 30; ~i; --i) {
    if ((l ^ r) & (1 << i)) {
      k = i;
      break;
    }
  }
  int a, b, c;
  a = (1 << k) - 1; b = 1 << k; c = l;
  printf("%d %d %d\n", a, b, c);
}

int main() {
  int cases; cin >> cases;
  while (cases--) {
    Solve();
  }
  return 0;
}

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

using namespace std;

void Solve() {
  int l, r, k; cin >> l >> r;
  for (int i = 30; ~i; --i) {
    if ((l ^ r) & (1 << i)) {
      k = i;
      break;
    }
  }
  int a, b, c;
  a = (1 << k) - 1; b = 1 << k; c = l;
  if (a == c) c = r;
  printf("%d %d %d\n", a, b, c);
}

int main() {
  int cases; cin >> cases;
  while (cases--) {
    Solve();
  }
  return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
// by iodwad
#include <bits/stdc++.h>

using namespace std;

void Solve() {
  int l, r, k; cin >> l >> r;
  for (int i = 30; ~i; --i) {
    if ((l ^ r) & (1 << i)) {
      k = i;
      break;
    }
  }
  int a, b, c;
  int tmp = (l >> k + 1) << k + 1;
  a = (1 << k) - 1 + tmp; b = a + 1; c = l;
  if (a == c) c = r;
  printf("%d %d %d\n", a, b, c);
}

int main() {
  int cases; cin >> cases;
  while (cases--) {
    Solve();
  }
  return 0;
}
/

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

using namespace std;

void Solve() {
  int l, r, k; cin >> l >> r;
  for (int i = 30; ~i; --i) {
    if ((l ^ r) & (1 << i)) {
      k = i;
      break;
    }
  }
  int a, b, c;
  int tmp = (l >> k + 1) << k + 1;
  a = (1 << k) - 1 + tmp; b = a + 1; c = l;
  if (a == c) c = r;
  printf("%d %d %d\n", a, b, c);
}

int main() {
  int cases; cin >> cases;
  while (cases--) {
    Solve();
  }
  return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Memory limit exceeded on test 6):
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin >> t;
    while(t--){
        int n, m;
        cin >> n >> m;
        long long sumA = 0, sumB = 0;
        // Frequency map for sequence a.
        unordered_map<long long, long long> freq;
        vector<long long> a(n), b(m);
 
        // Read sequence a and record frequencies.
        for (int i = 0; i < n; i++){
            cin >> a[i];
            freq[a[i]]++;
            sumA += a[i];
        }
 
        // Read sequence b.
        for (int j = 0; j < m; j++){
            cin >> b[j];
            sumB += b[j];
        }
 
        // The total sum is invariant under the merging operations.
        if(sumA != sumB){
            cout << "NO\n";
            continue;
        }
 
        // Use a max-heap (priority_queue) to simulate the reverse splitting.
        priority_queue<long long> pq;
        for(auto x : b)
            pq.push(x);
 
        bool possible = true;
        // Process until the priority queue is empty.
        while(!pq.empty()){
            long long cur = pq.top();
            pq.pop();
 
            // If this number is needed (appears in a), "use" one occurrence.
            if(freq[cur] > 0){
                freq[cur]--;
            } else {
                // If the number is not needed but can be split, split it.
                // Note: The only valid split is cur -> (floor(cur/2), ceil(cur/2))
                // If cur == 1, it cannot be split further so the transformation fails.
                if(cur == 1){
                    possible = false;
                    break;
                }
                long long left = cur / 2;
                long long right = cur - left; // ensures left + right == cur
                pq.push(left);
                pq.push(right);
            }
        }
 
        // After processing, if there remains any required number (i.e. frequency > 0)
        // then the transformation is impossible.
        for(auto &p : freq){
            if(p.second != 0) {
                possible = false;
                break;
            }
        }
 
        cout << (possible ? "YES" : "NO") << "\n";
    }
 
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 2):
import collections
import decimal
import math
import random
import time
import sys
from heapq import heappop, heappush
from collections import deque
from decimal import Decimal
import queue
import os
from copy import deepcopy
from collections import Counter

mod = 10 ** 9 + 7
# mod = 998244353
INF = 1 << 90


def solve(test_case):
    l, r = map(int, sys.stdin.readline().split())

    res = 0

    for i in range(32, -1, -1):
        b, a = int((l & (1 << i)) != 0), int((r & (1 << i)) != 0)

        if a == b:
            if a == 0:
                if res + (1 << i) < r:
                    res += (1 << i)
            else:
                if res + (1 << i) - 1 > l:
                    pass
                else:
                    res = res + (1 << i)
        else:
            if a == 0:
                if res + (1 << i) < r:
                    res += (1 << i)
            else:
                if res + (1 << i) - 1 > l:
                    pass
                else:
                    res += (1 << i)

    sys.stdout.write(str(l) + ' ' + str(res) + ' ' + str(r) + '\n')

    return


if __name__ == '__main__':
    multitest = 1
    if multitest:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve(_)
    else:
        solve(0)


Submission (verdict: Wrong answer on test 1):
import collections
import decimal
import math
import random
import time
import sys
from heapq import heappop, heappush
from collections import deque
from decimal import Decimal
import queue
import os
from copy import deepcopy
from collections import Counter

mod = 10 ** 9 + 7
# mod = 998244353
INF = 1 << 90


def solve(test_case):
    l, r = map(int, sys.stdin.readline().split())

    res = 0
    fill_with = -1

    pref_a_b = False

    for i in range(32, -1, -1):
        b, a = int((l & (1 << i)) != 0), int((r & (1 << i)) != 0)

        if a == b and pref_a_b:
            if a == 0:
                res += (1 << i)
                if fill_with == -1:
                    fill_with = 0
            else:
                if fill_with == -1:
                    fill_with = 1

        if not pref_a_b:
            pref_a_b = (a != b)

    if fill_with == 1:
        for i in range(32, -1, -1):
            b, a = int((l & (1 << i)) != 0), int((r & (1 << i)) != 0)

            if a != b:
                res += (1 << i)

    if res == l:
        res = res + 1
    elif res == r:
        res = res - 1
    sys.stdout.write(str(l) + ' ' + str(res) + ' ' + str(r) + '\n')

    return


if __name__ == '__main__':
    multitest = 1
    if multitest:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve(_)
    else:
        solve(0)
Problem: 2057C - Trip to the Olympiad
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 2):
import collections
import decimal
import math
import random
import time
import sys
from heapq import heappop, heappush
from collections import deque
from decimal import Decimal
import queue
import os
from copy import deepcopy
from collections import Counter

mod = 10 ** 9 + 7
# mod = 998244353
INF = 1 << 90


def solve(test_case):
    l, r = map(int, sys.stdin.readline().split())

    res = 0

    for i in range(32, -1, -1):
        b, a = int((l & (1 << i)) != 0), int((r & (1 << i)) != 0)

        if a == b:
            if a == 0:
                if res + (1 << i) < r:
                    res += (1 << i)
            else:
                if res + (1 << i) - 1 > l:
                    pass
                else:
                    res = res + (1 << i)
        else:
            if a == 0:
                if res + (1 << i) < r:
                    res += (1 << i)
            else:
                if res + (1 << i) - 1 > l:
                    pass
                else:
                    res += (1 << i)

    sys.stdout.write(str(l) + ' ' + str(res) + ' ' + str(r) + '\n')

    return


if __name__ == '__main__':
    multitest = 1
    if multitest:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve(_)
    else:
        solve(0)
Problem: 2057C - Trip to the Olympiad
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
import collections
import decimal
import math
import random
import time
import sys
from heapq import heappop, heappush
from collections import deque
from decimal import Decimal
import queue
import os
from copy import deepcopy
from collections import Counter

mod = 10 ** 9 + 7
# mod = 998244353
INF = 1 << 90


def solve(test_case):
    l, r = map(int, sys.stdin.readline().split())

    p = 0

    for i in range(32, -1, -1):
        if ((l & (1 << i)) != 0) != ((r & (1 << i)) != 0):
            p += (1 << i)
            break

        p += int((l & (1 << i)) != 0)

    if p - 1 > l:
        res = [p, p - 1, p - 2]
    elif p - 1 == l:
        res = [p + 1, p, p - 1]
    else:
        res = [p + 2, p + 1, p]

    sys.stdout.write(' '.join(map(str, res)) + '\n')

    return


if __name__ == '__main__':
    multitest = 1
    if multitest:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve(_)
    else:
        solve(0)


Submission (verdict: Accepted):
import collections
import decimal
import math
import random
import time
import sys
from heapq import heappop, heappush
from collections import deque
from decimal import Decimal
import queue
import os
from copy import deepcopy
from collections import Counter

mod = 10 ** 9 + 7
# mod = 998244353
INF = 1 << 90


def solve(test_case):
    l, r = map(int, sys.stdin.readline().split())

    p = 0

    for i in range(32, -1, -1):
        if ((l & (1 << i)) != 0) != ((r & (1 << i)) != 0):
            p += (1 << i)
            break

        p += (1 << i) * int((l & (1 << i)) != 0)

    if p - 1 > l:
        res = [p, p - 1, p - 2]
    elif p - 1 == l:
        res = [p + 1, p, p - 1]
    else:
        res = [p + 2, p + 1, p]

    sys.stdout.write(' '.join(map(str, res)) + '\n')

    return


if __name__ == '__main__':
    multitest = 1
    if multitest:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve(_)
    else:
        solve(0)
Problem: 2057C - Trip to the Olympiad
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
import collections
import decimal
import math
import random
import time
import sys
from heapq import heappop, heappush
from collections import deque
from decimal import Decimal
import queue
import os
from copy import deepcopy
from collections import Counter

mod = 10 ** 9 + 7
# mod = 998244353
INF = 1 << 90


def solve(test_case):
    l, r = map(int, sys.stdin.readline().split())

    res = 0
    fill_with = -1

    pref_a_b = False

    for i in range(32, -1, -1):
        b, a = int((l & (1 << i)) != 0), int((r & (1 << i)) != 0)

        if a == b and pref_a_b:
            if a == 0:
                res += (1 << i)
                if fill_with == -1:
                    fill_with = 0
            else:
                if fill_with == -1:
                    fill_with = 1

        if not pref_a_b:
            pref_a_b = (a != b)

    if fill_with == 1:
        for i in range(32, -1, -1):
            b, a = int((l & (1 << i)) != 0), int((r & (1 << i)) != 0)

            if a != b:
                res += (1 << i)

    if res == l:
        res = res + 1
    elif res == r:
        res = res - 1
    sys.stdout.write(str(l) + ' ' + str(res) + ' ' + str(r) + '\n')

    return


if __name__ == '__main__':
    multitest = 1
    if multitest:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve(_)
    else:
        solve(0)


Submission (verdict: Wrong answer on test 1):
import collections
import decimal
import math
import random
import time
import sys
from heapq import heappop, heappush
from collections import deque
from decimal import Decimal
import queue
import os
from copy import deepcopy
from collections import Counter

mod = 10 ** 9 + 7
# mod = 998244353
INF = 1 << 90


def solve(test_case):
    l, r = map(int, sys.stdin.readline().split())

    p = 0

    for i in range(32, -1, -1):
        if ((l & (1 << i)) != 0) != ((r & (1 << i)) != 0):
            p += (1 << i)
            break

        p += int((l & (1 << i)) != 0)

    if p - 1 > l:
        res = [p, p - 1, p - 2]
    elif p - 1 == l:
        res = [p + 1, p, p - 1]
    else:
        res = [p + 2, p + 1, p]

    sys.stdout.write(' '.join(map(str, res)) + '\n')

    return


if __name__ == '__main__':
    multitest = 1
    if multitest:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve(_)
    else:
        solve(0)
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
/*Les do some thikr:
سُبْحَانَ ٱللَّٰهِ
ٱلْحَمْدُ لِلَّٰهِ
 الله أكبر
أَسْتَغْفِرُ ٱللَّٰهَ
سُبْحَانَ اللَّهِ وَبِحَمْدِهِ، سُبْحَانَ اللَّهِ العَظِيم
 لَا حَوْلَ وَلَا قُوَّةَ إِلَّا بِٱللَّٰهِ ٱلْعَلِيِّ ٱلْعَظِيمِ
لا إله إلا الله
and durood
اللَّهُمَّ بَارِكْ عَلَى مُحَمَّدٍ، وَعَلَى آلِ مُحَمَّدٍ، كَمَا بَارَكْتَ عَلَى إِبْرَاهِيمَ، وَعَلَى آلِ إِبْرَاهِيمَ، إِنَّكَ حَمِيدٌ مَجِيدٌ
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long

//bitset<100001>a;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t=1;
cin>>t;

    while(t--)
    {
      ll n,i,x,f=0,sum=0,mx;
      cin>>n;
     vector<ll>v,v1;
      for(i=0; i<n; i++)
      {
          cin>>x;
         v.push_back(x);
         
         sum+=x;
      }
      if(n==1)
     mx=sum;
     else
     mx=max(sum,-sum);
      while(n--)
      { sum=0,f=0;
        
          for(i=1; i<v.size(); i++)
          { x=v[i]-v[i-1];
         
          sum+=x;
              v1.push_back(x);
              f=1;
          }
          
          v=v1;
          v1.clear();
          if(f)
         mx=max({mx,sum,-sum});
      }
     // cout<<v[0]<<" ";
   
     
   cout<<mx<<"\n";
    }
    
 
 
return 0;
}

Submission (verdict: Accepted):
/*Les do some thikr:
سُبْحَانَ ٱللَّٰهِ
ٱلْحَمْدُ لِلَّٰهِ
 الله أكبر
أَسْتَغْفِرُ ٱللَّٰهَ
سُبْحَانَ اللَّهِ وَبِحَمْدِهِ، سُبْحَانَ اللَّهِ العَظِيم
 لَا حَوْلَ وَلَا قُوَّةَ إِلَّا بِٱللَّٰهِ ٱلْعَلِيِّ ٱلْعَظِيمِ
لا إله إلا الله
and durood
اللَّهُمَّ بَارِكْ عَلَى مُحَمَّدٍ، وَعَلَى آلِ مُحَمَّدٍ، كَمَا بَارَكْتَ عَلَى إِبْرَاهِيمَ، وَعَلَى آلِ إِبْرَاهِيمَ، إِنَّكَ حَمِيدٌ مَجِيدٌ
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long

//bitset<100001>a;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t=1;
cin>>t;

    while(t--)
    {
      ll n,i,x,f=0,sum=0,mx;
      cin>>n;
     vector<ll>v,v1;
      for(i=0; i<n; i++)
      {
          cin>>x;
         v.push_back(x);
         
         sum+=x;
      }
     mx=sum;
      while(n--)
      { sum=0,f=0;
        
          for(i=1; i<v.size(); i++)
          { x=v[i]-v[i-1];
         
          sum+=x;
              v1.push_back(x);
              f=1;
          }
          
          v=v1;
          v1.clear();
          if(f)
         mx=max({mx,sum,-sum});
      }
     // cout<<v[0]<<" ";
   
     
   cout<<mx<<"\n";
    }
    
 
 
return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
/*Les do some thikr:
سُبْحَانَ ٱللَّٰهِ
ٱلْحَمْدُ لِلَّٰهِ
 الله أكبر
أَسْتَغْفِرُ ٱللَّٰهَ
سُبْحَانَ اللَّهِ وَبِحَمْدِهِ، سُبْحَانَ اللَّهِ العَظِيم
 لَا حَوْلَ وَلَا قُوَّةَ إِلَّا بِٱللَّٰهِ ٱلْعَلِيِّ ٱلْعَظِيمِ
لا إله إلا الله
and durood
اللَّهُمَّ بَارِكْ عَلَى مُحَمَّدٍ، وَعَلَى آلِ مُحَمَّدٍ، كَمَا بَارَكْتَ عَلَى إِبْرَاهِيمَ، وَعَلَى آلِ إِبْرَاهِيمَ، إِنَّكَ حَمِيدٌ مَجِيدٌ
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long

//bitset<100001>a;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t=1;
cin>>t;

    while(t--)
    {
      ll n,i,x,f=0,sum=0,mx;
      cin>>n;
     vector<ll>v,v1;
      for(i=0; i<n; i++)
      {
          cin>>x;
         v.push_back(x);
         
         sum+=x;
      }
     mx=sum;
      while(n--)
      { sum=0,f=0;
          reverse(v.begin(),v.end());
          for(i=1; i<v.size(); i++)
          { x=v[i]-v[i-1];
         
          sum+=x;
              v1.push_back(x);
              f=1;
          }
          
          v=v1;
          v1.clear();
          if(f)
         mx=max(mx,sum);
      }
     // cout<<v[0]<<" ";
   
     
   cout<<mx<<"\n";
    }
    
 
 
return 0;
}

Submission (verdict: Wrong answer on test 1):
/*Les do some thikr:
سُبْحَانَ ٱللَّٰهِ
ٱلْحَمْدُ لِلَّٰهِ
 الله أكبر
أَسْتَغْفِرُ ٱللَّٰهَ
سُبْحَانَ اللَّهِ وَبِحَمْدِهِ، سُبْحَانَ اللَّهِ العَظِيم
 لَا حَوْلَ وَلَا قُوَّةَ إِلَّا بِٱللَّٰهِ ٱلْعَلِيِّ ٱلْعَظِيمِ
لا إله إلا الله
and durood
اللَّهُمَّ بَارِكْ عَلَى مُحَمَّدٍ، وَعَلَى آلِ مُحَمَّدٍ، كَمَا بَارَكْتَ عَلَى إِبْرَاهِيمَ، وَعَلَى آلِ إِبْرَاهِيمَ، إِنَّكَ حَمِيدٌ مَجِيدٌ
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long

//bitset<100001>a;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t=1;
cin>>t;

    while(t--)
    {
      ll n,i,x,f=0,sum=0,mx;
      cin>>n;
     vector<ll>v,v1;
      for(i=0; i<n; i++)
      {
          cin>>x;
         v.push_back(x);
         
         sum+=x;
      }
     mx=max(sum,-sum);
      while(n--)
      { sum=0,f=0;
        
          for(i=1; i<v.size(); i++)
          { x=v[i]-v[i-1];
         
          sum+=x;
              v1.push_back(x);
              f=1;
          }
          
          v=v1;
          v1.clear();
          if(f)
         mx=max({mx,sum,-sum});
      }
     // cout<<v[0]<<" ";
   
     
   cout<<mx<<"\n";
    }
    
 
 
return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
/*Les do some thikr:
سُبْحَانَ ٱللَّٰهِ
ٱلْحَمْدُ لِلَّٰهِ
 الله أكبر
أَسْتَغْفِرُ ٱللَّٰهَ
سُبْحَانَ اللَّهِ وَبِحَمْدِهِ، سُبْحَانَ اللَّهِ العَظِيم
 لَا حَوْلَ وَلَا قُوَّةَ إِلَّا بِٱللَّٰهِ ٱلْعَلِيِّ ٱلْعَظِيمِ
لا إله إلا الله
and durood
اللَّهُمَّ بَارِكْ عَلَى مُحَمَّدٍ، وَعَلَى آلِ مُحَمَّدٍ، كَمَا بَارَكْتَ عَلَى إِبْرَاهِيمَ، وَعَلَى آلِ إِبْرَاهِيمَ، إِنَّكَ حَمِيدٌ مَجِيدٌ
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long

//bitset<100001>a;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t=1;
cin>>t;

    while(t--)
    {
      ll n,i,x,f=0,sum=0,mx;
      cin>>n;
     vector<ll>v,v1;
      for(i=0; i<n; i++)
      {
          cin>>x;
         v.push_back(x);
         
         sum+=x;
      }
     mx=sum;
      while(n--)
      { sum=0,f=0;
          reverse(v.begin(),v.end());
          for(i=1; i<v.size(); i++)
          { x=v[i]-v[i-1];
         
          sum+=x;
              v1.push_back(x);
              f=1;
          }
          
          v=v1;
          v1.clear();
          if(f)
         mx=max(mx,sum);
      }
     // cout<<v[0]<<" ";
   
     
   cout<<mx<<"\n";
    }
    
 
 
return 0;
}