ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049B - pspspsps
Language: C++20 (GCC 13-64)

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

#ifdef LOCAL

#include "debug.h"

#else

#define dbg(x...)

void dbgEndl() {}

#endif

#if __cplusplus <= 201703L || defined(LOCAL)

#include <bits/extc++.h>

namespace pbds = __gnu_pbds;

#endif



using namespace std;

using u32 = unsigned;

using u64 = unsigned long long;

using i64 = long long;

#if __cplusplus >= 202002L

using i128 = __int128;

#endif

using f64 = long double;



constexpr int N = 1000010;

constexpr f64 eps = 1e-9; // !!!

constexpr int inf32 = 1e9;

constexpr i64 inf64 = 1e18;



inline void YES(void) { cout << "YES\n"; }

inline void Yes(void) { cout << "Yes\n"; }

inline void NO(void) { cout << "NO\n"; }

inline void No(void) { cout << "No\n"; }

inline void YES_NO(bool cond) { cond ? YES() : NO(); }

inline void Yes_No(bool cond) { cond ? Yes() : No(); }



int n, m;

inline void solve(void) {

    string s;

    cin >> n >> s;

    if (count(s.begin(), s.end(), 's') == 0) {

        return YES();

    }

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

        if (s[i] == 'p') return NO();

        if (s[i] == 's') {

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

                if (s[j] == 'p') return NO();

            }

            return YES();

        }

    }

    YES();

}



inline void optimizeIO(void) {

    ios::sync_with_stdio(false);

    cin.tie(NULL), cout.tie(NULL);

}

int main(int argc, char const *argv[]) {

    int t = 1;

    optimizeIO(), cin >> t;

    while (t--) solve();

    return 0;

}



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

#ifdef LOCAL

#include "debug.h"

#else

#define dbg(x...)

void dbgEndl() {}

#endif

#if __cplusplus <= 201703L || defined(LOCAL)

#include <bits/extc++.h>

namespace pbds = __gnu_pbds;

#endif



using namespace std;

using u32 = unsigned;

using u64 = unsigned long long;

using i64 = long long;

#if __cplusplus >= 202002L

using i128 = __int128;

#endif

using f64 = long double;



constexpr int N = 1000010;

constexpr f64 eps = 1e-9; // !!!

constexpr int inf32 = 1e9;

constexpr i64 inf64 = 1e18;



inline void YES(void) { cout << "YES\n"; }

inline void Yes(void) { cout << "Yes\n"; }

inline void NO(void) { cout << "NO\n"; }

inline void No(void) { cout << "No\n"; }

inline void YES_NO(bool cond) { cond ? YES() : NO(); }

inline void Yes_No(bool cond) { cond ? Yes() : No(); }



int n, m;

inline void solve(void) {

    string s;

    cin >> n >> s;

    if (count(s.begin() + 1, s.end(), 's') == 0) {

        return YES();

    }

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

        if (s[i] == 'p') return NO();

        if (i > 0 && s[i] == 's') {

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

                if (s[j] == 'p') return NO();

            }

            return YES();

        }

    }

    YES();

}



inline void optimizeIO(void) {

    ios::sync_with_stdio(false);

    cin.tie(NULL), cout.tie(NULL);

}

int main(int argc, char const *argv[]) {

    int t = 1;

    optimizeIO(), cin >> t;

    while (t--) solve();

    return 0;

}
Problem: 2049B - pspspsps
Language: C++20 (GCC 13-64)


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

#ifdef LOCAL

#include "debug.h"

#else

#define dbg(x...)

void dbgEndl() {}

#endif

#if __cplusplus <= 201703L || defined(LOCAL)

#include <bits/extc++.h>

namespace pbds = __gnu_pbds;

#endif



using namespace std;

using u32 = unsigned;

using u64 = unsigned long long;

using i64 = long long;

#if __cplusplus >= 202002L

using i128 = __int128;

#endif

using f64 = long double;



constexpr int N = 1000010;

constexpr f64 eps = 1e-9; // !!!

constexpr int inf32 = 1e9;

constexpr i64 inf64 = 1e18;



inline void YES(void) { cout << "YES\n"; }

inline void Yes(void) { cout << "Yes\n"; }

inline void NO(void) { cout << "NO\n"; }

inline void No(void) { cout << "No\n"; }

inline void YES_NO(bool cond) { cond ? YES() : NO(); }

inline void Yes_No(bool cond) { cond ? Yes() : No(); }



int n, m;

inline void solve(void) {

    string s;

    cin >> n >> s;

    if (count(s.begin(), s.end(), 's') == 0) {

        return YES();

    }

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

        if (s[i] == 'p') return NO();

        if (s[i] == 's') {

            return YES_NO(count(s.begin() + i + 1, prev(s.end()), 'p') == 0);

        }

    }

    YES();

}



inline void optimizeIO(void) {

    ios::sync_with_stdio(false);

    cin.tie(NULL), cout.tie(NULL);

}

int main(int argc, char const *argv[]) {

    int t = 1;

    optimizeIO(), cin >> t;

    while (t--) solve();

    return 0;

}
Problem: 2049B - pspspsps
Language: C++20 (GCC 13-64)

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

#ifdef LOCAL

#include "debug.h"

#else

#define dbg(x...)

void dbgEndl() {}

#endif

#if __cplusplus <= 201703L || defined(LOCAL)

#include <bits/extc++.h>

namespace pbds = __gnu_pbds;

#endif



using namespace std;

using u32 = unsigned;

using u64 = unsigned long long;

using i64 = long long;

#if __cplusplus >= 202002L

using i128 = __int128;

#endif

using f64 = long double;



constexpr int N = 1000010;

constexpr f64 eps = 1e-9; // !!!

constexpr int inf32 = 1e9;

constexpr i64 inf64 = 1e18;



inline void YES(void) { cout << "YES\n"; }

inline void Yes(void) { cout << "Yes\n"; }

inline void NO(void) { cout << "NO\n"; }

inline void No(void) { cout << "No\n"; }

inline void YES_NO(bool cond) { cond ? YES() : NO(); }

inline void Yes_No(bool cond) { cond ? Yes() : No(); }



int n, m;

inline void solve(void) {

    string s;

    cin >> n >> s;

    if (count(s.begin(), s.end(), 's') == 0) {

        return YES();

    }

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

        if (s[i] == 'p') return NO();

        if (s[i] == 's') {

            return YES_NO(count(s.begin() + i + 1, prev(s.end()), 'p') == 0);

        }

    }

    YES();

}



inline void optimizeIO(void) {

    ios::sync_with_stdio(false);

    cin.tie(NULL), cout.tie(NULL);

}

int main(int argc, char const *argv[]) {

    int t = 1;

    optimizeIO(), cin >> t;

    while (t--) solve();

    return 0;

}



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

#ifdef LOCAL

#include "debug.h"

#else

#define dbg(x...)

void dbgEndl() {}

#endif

#if __cplusplus <= 201703L || defined(LOCAL)

#include <bits/extc++.h>

namespace pbds = __gnu_pbds;

#endif



using namespace std;

using u32 = unsigned;

using u64 = unsigned long long;

using i64 = long long;

#if __cplusplus >= 202002L

using i128 = __int128;

#endif

using f64 = long double;



constexpr int N = 1000010;

constexpr f64 eps = 1e-9; // !!!

constexpr int inf32 = 1e9;

constexpr i64 inf64 = 1e18;



inline void YES(void) { cout << "YES\n"; }

inline void Yes(void) { cout << "Yes\n"; }

inline void NO(void) { cout << "NO\n"; }

inline void No(void) { cout << "No\n"; }

inline void YES_NO(bool cond) { cond ? YES() : NO(); }

inline void Yes_No(bool cond) { cond ? Yes() : No(); }



int n, m;

inline void solve(void) {

    string s;

    cin >> n >> s;

    if (count(s.begin(), s.end(), 's') == 0) {

        return YES();

    }

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

        if (s[i] == 'p') return NO();

        if (s[i] == 's') {

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

                if (s[j] == 'p') return NO();

            }

            return YES();

        }

    }

    YES();

}



inline void optimizeIO(void) {

    ios::sync_with_stdio(false);

    cin.tie(NULL), cout.tie(NULL);

}

int main(int argc, char const *argv[]) {

    int t = 1;

    optimizeIO(), cin >> t;

    while (t--) solve();

    return 0;

}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


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

int32_t main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
	int t; cin >> t;
	while(t--){
		string a,b,c; cin >> a >> b >> c;
        int l=0,r=0;
        int n = a.length();
        int m = b.length();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        int ans = 0;
        
        vector<vector<int>> dp(n+1,vector<int>(m+1,550));
        dp[0][0] = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                if(i ==0 || j==0)dp[i][j] = i+j;
                if(i && a[i]==c[i+j])dp[i][j] = min(dp[i-1][j],dp[i][j]);
                if(j && b[j] == c[i+j])dp[i][j] = min(dp[i][j-1],dp[i][j]);
                if(i && j){
                    dp[i][j] = min(dp[i][j],min(dp[i-1][j],dp[i][j-1]) + 1);
                }
            }
        }
        cout << dp[n][m] << endl;
	}
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

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

int32_t main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
	int t; cin >> t;
	while(t--){
		string a,b,c; cin >> a >> b >> c;
        int l=0,r=0;
        int n = a.length();
        int m = b.length();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        
        vector<vector<int>> dp(n+1,vector<int>(m+1,550));
        dp[0][0] = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                if(i)dp[i][j] = min(dp[i-1][j] + (a[i] != c[i+j]),dp[i][j]);
                if(j)dp[i][j] = min(dp[i][j-1] + (b[j] != c[i+j]),dp[i][j]);
            }
        }
        cout << dp[n][m] << endl;
	}
}

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

int32_t main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
	int t; cin >> t;
	while(t--){
		string a,b,c; cin >> a >> b >> c;
        int l=0,r=0;
        int n = a.length();
        int m = b.length();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        
        vector<vector<int>> dp(n+1,vector<int>(m+1,1e9));
        dp[0][0] = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                if(i)dp[i][j] = min(dp[i-1][j] + (a[i] != c[i+j]),dp[i][j]);
                if(j)dp[i][j] = min(dp[i][j-1] + (b[j] != c[i+j]),dp[i][j]);
            }
        }
        cout << dp[n][m] << endl;
	}
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

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

int32_t main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
	int t; cin >> t;
	while(t--){
		string a,b,c; cin >> a >> b >> c;
        int l=0,r=0;
        int n = a.length();
        int m = b.length();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        int ans = 0;
        
        vector<vector<int>> dp(n+1,vector<int>(m+1,550));
        dp[0][0] = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                if(i ==0 || j==0)dp[i][j] = min(dp[i][j],i+j);
                if(i && a[i]==c[i+j])dp[i][j] = min(dp[i-1][j],dp[i][j]);
                if(j && b[j] == c[i+j])dp[i][j] = min(dp[i][j-1],dp[i][j]);
                if(i && j){
                    dp[i][j] = min(dp[i][j],min(dp[i-1][j],dp[i][j-1]) + 1);
                }
            }
        }
        cout << dp[n][m] << endl;
	}
}

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

int32_t main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
	int t; cin >> t;
	while(t--){
		string a,b,c; cin >> a >> b >> c;
        int l=0,r=0;
        int n = a.length();
        int m = b.length();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        
        vector<vector<int>> dp(n+1,vector<int>(m+1,550));
        dp[0][0] = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                if(i)dp[i][j] = min(dp[i-1][j] + (a[i] != c[i+j]),dp[i][j]);
                if(j)dp[i][j] = min(dp[i][j-1] + (b[j] != c[i+j]),dp[i][j]);
            }
        }
        cout << dp[n][m] << endl;
	}
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

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

int32_t main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
	int t; cin >> t;
	while(t--){
		string a,b,c; cin >> a >> b >> c;
        int l=0,r=0;
        int n = a.length();
        int m = b.length();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        int ans = 0;
        
        vector<vector<int>> dp(n+1,vector<int>(m+1,550));
        dp[0][0] = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                if(i ==0 || j==0)dp[i][j] = i+j;
                if(i && a[i]==c[i+j])dp[i][j] = min(dp[i-1][j],dp[i][j]);
                if(j && b[j] == c[i+j])dp[i][j] = min(dp[i][j-1],dp[i][j]);
                if(i && j){
                    dp[i][j] = min(dp[i][j],min(dp[i-1][j],dp[i][j-1]) + 1);
                }
            }
        }
        cout << dp[n][m] << endl;
	}
}

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

int32_t main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
	int t; cin >> t;
	while(t--){
		string a,b,c; cin >> a >> b >> c;
        int l=0,r=0;
        int n = a.length();
        int m = b.length();
        a = " " + a;
        b = " " + b;
        c = " " + c;
        int ans = 0;
        
        vector<vector<int>> dp(n+1,vector<int>(m+1,550));
        dp[0][0] = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                if(i ==0 || j==0)dp[i][j] = min(dp[i][j],i+j);
                if(i && a[i]==c[i+j])dp[i][j] = min(dp[i-1][j],dp[i][j]);
                if(j && b[j] == c[i+j])dp[i][j] = min(dp[i][j-1],dp[i][j]);
                if(i && j){
                    dp[i][j] = min(dp[i][j],min(dp[i-1][j],dp[i][j-1]) + 1);
                }
            }
        }
        cout << dp[n][m] << endl;
	}
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,q,t;
int dp[1001][1001];

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    string a,b,c;
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        for(int l=1;l<=c.length();l++){
            for(int i=0;i<=l;i++){
                int j=l-i;
                if(i>0&&j>0) dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[l-1]),dp[i][j-1]+(b[j-1]!=c[l-1]));
                if(i==0&&j>0) dp[i][j]=dp[i][j-1]+(b[j-1]!=c[l-1]);
                if(i>0&&j==0) dp[i][j]=dp[i-1][j]+(a[i-1]!=c[l-1]);
            }
        }
        cout<<dp[a.length()][b.length()]<<endl;
    }
    return 0;
}

Submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,q,t,p;
int dp[1001][1001];

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    string a,b,c;
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        for(int l=1;l<=c.length();l++){
            for(int i=0;i<=l;i++){
                int j=l-i;
                if(i>0&&j>0) dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[l-1]),dp[i][j-1]+(b[j-1]!=c[l-1]));
                if(i==0&&j>0) dp[i][j]=dp[i][j-1]+(b[j-1]!=c[l-1]);
                if(i>0&&j==0) dp[i][j]=dp[i-1][j]+(a[i-1]!=c[l-1]);
            }
        }
        cout<<dp[a.length()][b.length()]<<endl;
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,q,t,p;
int dp[1010][1010];

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    string a,b,c;
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        for(int l=1;l<=c.length();l++){
            for(int i=0;i<=l;i++){
                int j=l-i;
                if(i>0&&j>0) dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[l-1]),dp[i][j-1]+(b[j-1]!=c[l-1]));
                if(i==0&&j>0) dp[i][j]=dp[i][j-1]+(b[j-1]!=c[l-1]);
                if(i>0&&j==0) dp[i][j]=dp[i-1][j]+(a[i-1]!=c[l-1]);
            }
        }
        cout<<dp[a.length()][b.length()]<<endl;
    }
    return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,q,t,p;
int dp[1010][1010];

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    string a,b,c;
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        for(int l=1;l<=c.length();l++){
            for(int i=(l>b.length()?l-b.length():0);i<=a.length();i++){
                int j=l-i;
                if(i>0&&j>0) dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[l-1]),dp[i][j-1]+(b[j-1]!=c[l-1]));
                if(i==0&&j>0) dp[i][j]=dp[i][j-1]+(b[j-1]!=c[l-1]);
                if(i>0&&j==0) dp[i][j]=dp[i-1][j]+(a[i-1]!=c[l-1]);
            }
        }
        cout<<dp[a.length()][b.length()]<<endl;
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,q,t;
int dp[1001][1001];

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    string a,b,c;
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        for(int l=1;l<=c.length();l++){
            for(int i=0;i<=l;i++){
                int j=l-i;
                if(i>0&&j>0) dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[l-1]),dp[i][j-1]+(b[j-1]!=c[l-1]));
                if(i==0&&j>0) dp[i][j]=dp[i][j-1]+(b[j-1]!=c[l-1]);
                if(i>0&&j==0) dp[i][j]=dp[i-1][j]+(a[i-1]!=c[l-1]);
            }
        }
        cout<<dp[a.length()][b.length()]<<endl;
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,q,t,p;
int dp[1001][1001];

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    string a,b,c;
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        for(int l=1;l<=c.length();l++){
            for(int i=0;i<=l;i++){
                int j=l-i;
                if(i>0&&j>0) dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[l-1]),dp[i][j-1]+(b[j-1]!=c[l-1]));
                if(i==0&&j>0) dp[i][j]=dp[i][j-1]+(b[j-1]!=c[l-1]);
                if(i>0&&j==0) dp[i][j]=dp[i-1][j]+(a[i-1]!=c[l-1]);
            }
        }
        cout<<dp[a.length()][b.length()]<<endl;
    }
    return 0;
}

Submission (verdict: Runtime error on test 13):
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
int n,q,t,p;
int dp[1010][1010];

int gcd(int a,int b){
    return b? gcd(b,a%b):a;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    string a,b,c;
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        for(int l=1;l<=c.length();l++){
            for(int i=0;i<=l;i++){
                int j=l-i;
                if(i>0&&j>0) dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[l-1]),dp[i][j-1]+(b[j-1]!=c[l-1]));
                if(i==0&&j>0) dp[i][j]=dp[i][j-1]+(b[j-1]!=c[l-1]);
                if(i>0&&j==0) dp[i][j]=dp[i-1][j]+(a[i-1]!=c[l-1]);
            }
        }
        cout<<dp[a.length()][b.length()]<<endl;
    }
    return 0;
}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#pragma region usual_defs
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cmath>

// this is the only reason I like C++ (sorry, java, try to be more fun next time):
#define meow cin
#define murr cout
#define lol long long
#define lmao unsigned long long
#define el '\n'
#define none \
    {        \
    }
#define kaput return
#define kill break
#define nah continue
using namespace std;
#pragma endregion usual_defs
// #define SYNC
#define i_like_cats

int n;
string str;
bool l, _s, _p;
void cat()
{
    meow >> n;
    meow.ignore();
    getline(meow, str);
    _s = false;
    _p = false;
    for (int i = 0; i < n; i++)
    {
        if (str[i] == 's')
            _s = true;
        else if (str[i] == 'p')
            _p = true;
    }
    if (!(_s && _p))
    {
        murr << "YES\n";
        kaput;
    }

    if (str[0] != '.' || str[n - 1] != '.')
    {
        l = false;
        for (int i = 0; i < n; i++)
        {
            if (str[i] != '.')
            {
                if (str[i] == 's')
                {
                    if (l)
                    {
                        murr << "NO\n";
                        kaput;
                    }
                }
                else
                    l = true;
            }
        }
        murr << "YES\n";
    }
    else
        murr << "NO\n";
}

#pragma region main
#ifdef i_like_cats
int INPUT_SETS_COUNT;
#endif
int main()
{
    ios_base::sync_with_stdio(false);
#ifndef SYNC
    meow.tie(NULL);
#endif
#ifdef i_like_cats
    meow >> INPUT_SETS_COUNT;
    meow.ignore();
    while (INPUT_SETS_COUNT--)
        cat();
#endif
#ifndef i_like_cats
    cat();
#endif
}
#pragma endregion main
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;



typedef long long ll;

typedef pair<ll, ll>PLL;



ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lowbit(ll x) { return x & -x; }



const int N = 1e6 + 10;

const int M = 5010;



ll t;



int main()

{

   cin>>t;

   while(t--) {

      ll n,l,r;

      cin>>n>>l>>r;

      vector<ll>a(n);

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

         cin>>a[i];

      }

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

      ll sum=r-l;

      ll ans=0;

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

         ans+=a[i];

      }

      cout<<ans<<endl;

   }



}



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

typedef long long ll;
typedef pair<ll, ll>PLL;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lowbit(ll x) { return x & -x; }

const int N = 1e6 + 10;
const int M = 5010;

ll t;

int main()
{
   cin>>t;
   while(t--) {
      ll n,l,r;
      cin>>n>>l>>r;
      vector<ll>a(n);
      for(ll i=0;i<n;i++) {
         cin>>a[i];
      }
      sort(a.begin(),a.end());
      ll sum=r-l+1;
      ll ans=0;
      for(ll i=0;i<sum;i++) {
         ans+=a[i];
      }
      cout<<ans<<endl;
   }

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;



typedef long long ll;

typedef pair<ll, ll>PLL;



ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lowbit(ll x) { return x & -x; }



const int N = 1e6 + 10;

const int M = 5010;



ll t;



int main()

{

   cin>>t;

   while(t--) {

      ll n,l,r;

      cin>>n>>l>>r;

      vector<ll>a(n);

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

         cin>>a[i];

      }

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

      ll sum=r-l;

      ll ans=0;

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

         ans+=a[i];

      }

      cout<<ans<<endl;

   }



}