Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
 //-----------pm_12------------
 #include <algorithm>
 #include <bitset>
 #include <complex>
 #include <deque>
 #include <exception>
 #include <fstream>
 #include <functional>
 #include <iomanip>
 #include <ios>
 #include <iosfwd>
 #include <iostream>
 #include <istream>
 #include <iterator>
 #include <limits>
 #include <list>
 #include <locale>
 #include <map>
 #include <memory>
 #include <new>
 #include <numeric>
 #include <ostream>
 #include <queue>
 #include <set>
 #include <sstream>
 #include <stack>
 #include <stdexcept>
 #include <streambuf>
 #include <string>
 #include <typeinfo>
 #include <utility>
 #include <valarray>
 #include <vector>
 #include<unordered_set>
 #include<unordered_map>
 using namespace std;
 
 #define INF              INT64_MAX
 #define mod                  1000000007
 #define pb                  push_back
 #define ff                   first
 #define ss                  second
 #define mp                  make_pair
 #define sz(x)               (int)(x).size()
 #define inp(v)              for(auto &x: v) cin >> x
 #define all(x)              (x).begin(), (x).end()
  #define allr(x)             x.rbegin(),x.rend()
 #define rep(i, a, b)        for (int i = a; i < (b); ++i)
 #define fast_io             cin.tie(0)->sync_with_stdio(0);cin.exceptions(cin.failbit);
 
 using ll  = long long;
 using ull = unsigned long long;
 using lld = long double;
 using pii = pair<int,int>;
 using pll = pair<ll,ll>;
 using vll  = vector<ll>;
 using vpll  = vector<pll>;
 using vii  = vector<int>;
 
 #define yes cout<<"YES"<<endl;
 #define no cout<<"NO"<<endl;
 #define forw(i,s,n) for(auto i=s;i<n;i++)
 #define forb(i,n,e) for(auto i=n;i>=e;i--)
 /*-----------------------------------------------Number theory Starts-----------------------------------------------------------*/
 auto nCr = [](long long n, long long r) -> long long { long long ans = 1; for(long long i = n; i > max(r, n - r); i--) ans *= i; long long den = 1; for(long long i = 1; i <= min(r, n - r); i++) den *= i; ans /= den; return ans; };
 ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
 ll expo(ll a, ll b, ll md) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % md; a = (a * a) % md; b = b >> 1;} return res;}
 int digsum(ll n) { return (n == 0) ? 0 : ((n % 9 == 0) ? 9 : n % 9); }
 vector<ll> sieve(int n) {int*arr = new int[n + 1](); vector<ll> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
 /*-----------------------------------------------Number theory Ends---------------------------------------------------------------*/
 // iota(arr,arr+n,num)-->num,num+1,...num+n-1 
 
 void solve(){
  ll n,m;cin>>n>>m;
  multiset<ll> a,b;
  forw(i,0,n){ll x;cin>>x; a.insert(x);}
  forw(i,0,m){ll x;cin>>x;b.insert(x);}
  while(a.size()>0&&b.size()>0&&(a.size()>b.size())){
    ll pt1=*a.begin();
    ll pt2=*b.begin();
    if(pt1==pt2){
        a.erase(a.begin());
        b.erase(b.begin());
    }
    else if(pt1>pt2){no return;}
    else {
        a.erase(a.begin());
        ll e=*a.begin();
        a.erase(a.begin());
        if(abs(e-pt1)>1){no return;}
        a.insert(e+pt1);
    }
  }
  if(a.size()<b.size()){no return;}
  if(a.size()!=0){
    for(auto e:a){
        ll eb=*b.begin();
        if(e!=eb){no return;}
        b.erase(b.begin());
    }
  }
  yes
 } 
 
 int main() {  fast_io; int T; cin >> T; while (T--) solve(); return 0; }

Submission (verdict: Wrong answer on test 3):
 //-----------pm_12------------
 #include <algorithm>
 #include <bitset>
 #include <complex>
 #include <deque>
 #include <exception>
 #include <fstream>
 #include <functional>
 #include <iomanip>
 #include <ios>
 #include <iosfwd>
 #include <iostream>
 #include <istream>
 #include <iterator>
 #include <limits>
 #include <list>
 #include <locale>
 #include <map>
 #include <memory>
 #include <new>
 #include <numeric>
 #include <ostream>
 #include <queue>
 #include <set>
 #include <sstream>
 #include <stack>
 #include <stdexcept>
 #include <streambuf>
 #include <string>
 #include <typeinfo>
 #include <utility>
 #include <valarray>
 #include <vector>
 #include<unordered_set>
 #include<unordered_map>
 using namespace std;
 
 #define INF              INT64_MAX
 #define mod                  1000000007
 #define pb                  push_back
 #define ff                   first
 #define ss                  second
 #define mp                  make_pair
 #define sz(x)               (int)(x).size()
 #define inp(v)              for(auto &x: v) cin >> x
 #define all(x)              (x).begin(), (x).end()
  #define allr(x)             x.rbegin(),x.rend()
 #define rep(i, a, b)        for (int i = a; i < (b); ++i)
 #define fast_io             cin.tie(0)->sync_with_stdio(0);cin.exceptions(cin.failbit);
 
 using ll  = long long;
 using ull = unsigned long long;
 using lld = long double;
 using pii = pair<int,int>;
 using pll = pair<ll,ll>;
 using vll  = vector<ll>;
 using vpll  = vector<pll>;
 using vii  = vector<int>;
 
 #define yes cout<<"YES"<<endl;
 #define no cout<<"NO"<<endl;
 #define forw(i,s,n) for(auto i=s;i<n;i++)
 #define forb(i,n,e) for(auto i=n;i>=e;i--)
 /*-----------------------------------------------Number theory Starts-----------------------------------------------------------*/
 auto nCr = [](long long n, long long r) -> long long { long long ans = 1; for(long long i = n; i > max(r, n - r); i--) ans *= i; long long den = 1; for(long long i = 1; i <= min(r, n - r); i++) den *= i; ans /= den; return ans; };
 ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
 ll expo(ll a, ll b, ll md) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % md; a = (a * a) % md; b = b >> 1;} return res;}
 int digsum(ll n) { return (n == 0) ? 0 : ((n % 9 == 0) ? 9 : n % 9); }
 vector<ll> sieve(int n) {int*arr = new int[n + 1](); vector<ll> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
 /*-----------------------------------------------Number theory Ends---------------------------------------------------------------*/
 // iota(arr,arr+n,num)-->num,num+1,...num+n-1 
 
 void solve(){
  ll n,m;cin>>n>>m;
  multiset<ll> a,b;
  forw(i,0,n){ll x;cin>>x; a.insert(x);}
  forw(i,0,m){ll x;cin>>x;b.insert(x);}
  while(a.size()>0&&b.size()>0&&(a.size()>b.size())){
    ll pt1=*a.begin();
    ll pt2=*b.begin();
    auto it=a.find(pt2);
    if(it!=a.end()){
        b.erase(b.begin());
        a.erase(it);
        continue;
    }
    if(pt1==pt2){
        a.erase(a.begin());
        b.erase(b.begin());
    }
    else if(pt1>pt2){no return;}
    else {
         ll re=abs(pt2-pt1);
        if(abs(pt1-re)<=1){
            auto it=a.find(re);
            if(it!=a.end()){
                b.erase(b.begin());
                a.erase(it);
                a.erase(a.begin());
                continue;
            }
        }
         if (a.size() < 2) {
                no return;
            }
        a.erase(a.begin());
        ll e=*a.begin();
        a.erase(a.begin());
        if(abs(e-pt1)>1){no return;}
        a.insert(e+pt1);
    }
  }
   while (!a.empty() && !b.empty()) {
        ll e = *a.begin();
        ll eb = *b.begin();

        if (e != eb) {
            no return;
        }
        a.erase(a.begin());
        b.erase(b.begin());
    }
if(!a.empty()||!b.empty()){no return;}
  yes
 } 
 
 int main() {  fast_io; int T; cin >> T; while (T--) solve(); return 0; }