ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057B - Gorilla and the Exam
Language: Kotlin 1.9

Previous submission (verdict: Time limit exceeded on test 6):
fun main() {
    repeat(readln().toInt()) {
        val (n, k) = readln().split(" ").map(String::toInt)
        val list = readln().split(" ").map(String::toInt)

        val histo = mutableMapOf<Int, Int>()
        for (i in list) {
            histo[i] = histo.getOrDefault(i, 0) + 1
        }

        val max = histo.maxBy { it.value }.key

        var kp = k
        while (kp != 0 && histo.size > 1) {
            val temp = HashMap(histo)
            temp.remove(max)
            val min = temp.minBy { it.value }
            if (kp >= min.value) {
                histo.remove(min.key)
                histo[max] = histo[max]!! + min.value
                kp -= min.value
            } else {
                histo[min.key] = histo[min.key]!! - kp
                kp = 0
            }
        }

        println(histo.size)
    }
}

Submission (verdict: Time limit exceeded on test 9):
fun main() {
    repeat(readln().toInt()) {
        val (n, k) = readln().split(" ").map(String::toInt)
        val list = readln().split(" ").map(String::toInt)

        val histo = hashMapOf<Int, Int>()
        for (i in list) {
            histo[i] = histo.getOrDefault(i, 0) + 1
        }

        val max = histo.maxBy { it.value }.key

        var kp = k
        while (kp != 0 && histo.size > 1) {
            val min = histo.minBy { it.value + if(it.key == max) 1_000_000_000 else 0 }
            if (kp >= min.value) {
                histo.remove(min.key)
                histo[max] = histo[max]!! + min.value
                kp -= min.value
            } else {
                histo[min.key] = histo[min.key]!! - kp
                kp = 0
            }
        }

        println(histo.size)
    }
}
Problem: 2057B - Gorilla and the Exam
Language: Kotlin 1.9


Submission (verdict: Time limit exceeded on test 6):
fun main() {
    repeat(readln().toInt()) {
        val (n, k) = readln().split(" ").map(String::toInt)
        val list = readln().split(" ").map(String::toInt)

        val histo = mutableMapOf<Int, Int>()
        for (i in list) {
            histo[i] = histo.getOrDefault(i, 0) + 1
        }

        val max = histo.maxBy { it.value }.key

        var kp = k
        while (kp != 0 && histo.size > 1) {
            val temp = HashMap(histo)
            temp.remove(max)
            val min = temp.minBy { it.value }
            if (kp >= min.value) {
                histo.remove(min.key)
                histo[max] = histo[max]!! + min.value
                kp -= min.value
            } else {
                histo[min.key] = histo[min.key]!! - kp
                kp = 0
            }
        }

        println(histo.size)
    }
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


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

void solve() {
    string s;
    cin >> s;
    map<char,int> mp;
    mp['1']=0;
    mp['2']=0;
    mp['3']=0;
    mp['4']=0;
    mp['5']=0;
    mp['6']=0;
    mp['7']=0;
    mp['8']=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1'){
            if(mp['8']>0) mp['8']--;
            else mp['1']++;
        }
        if(s[i]=='2'){
            mp['2']++;
        }if(s[i]=='4'){
            if(mp['5']>0) mp['5']--;
            else mp['4']++;
        }if(s[i]=='5'){
            if(mp['4']>0) mp['4']--;
            else mp['5']++;
        }if(s[i]=='7'){
            mp['7']++;
        }
        if(s[i]=='8'){
            if(mp['1']>0) mp['1']--;
            else mp['8']++;
        }
        if(s[i]=='6') mp['6']++;
        if(s[i]=='3') mp['3']++;
    }
    ll sum=0;
    sum += mp['1'];
    sum += 9 - ((3*mp['3']) % 9);
    sum += 9 - ((8*mp['8']) % 9);
    sum += 9 - ((7*mp['7']) % 9);
    sum += 9 - ((4*mp['4']) % 9);
    sum += 9 - ((5*mp['5']) % 9);
    sum += 9 - ((2*mp['2']) % 9);
    if(mp['6']%3 != 0) sum += 9 - ((6*mp['6']) % 9);
    int ans = (sum%9);
    if(ans==0 || ans==9){
        cout << "YES\n";
    }
    if(ans==1){
        if(mp['2']>=5){
            cout << "YES\n";
        }
        else cout << "NO\n";
    }
    if(ans==2){
        if(mp['2']>=1) cout << "YES\n";
        else cout << "NO\n";
    }
    if(ans==3){
        if(mp['2']>=6 || mp['3']>=2) cout << "YES\n";
        else cout << "NO\n";
    }
    if(ans==4){
        if(mp['2']>=2) cout << "YES\n";
        else cout << "NO\n";
    }
    if(ans==5){
        if((mp['2']>=4 && mp['3']>=1) || (mp['2']>=1 && mp['3']>=2) || (mp['2']>=7)) cout << "YES\n";
        else cout << "NO\n";
    }
    if(ans==6){
        if(mp['3']>=1 || mp['2']>=3) cout << "YES\n";
        else cout << "NO\n";
    }
    if(ans==7){
        if((mp['2']>=5 && mp['3']>=1) || (mp['2']>=1 && mp['3']>=2) || (mp['2']>=8)) cout << "YES\n";
        else cout << "NO\n";
    }
    if(ans==8){
        if(mp['2']>=4) cout << "YES\n";
        else cout << "NO\n";
    }
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

void solve() {
    string s;
    cin >> s;
    map<char,int> mp;
    mp['2']=0;
    mp['3']=0;
    ll sum=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='2') mp['2']++;
        if(s[i]=='3') mp['3']++;
        sum += (s[i]-'0');
        sum %= 9;
    }
    sum = (9-sum);
    if(sum==0 || sum==9) cout << "YES\n";
    else if(sum==1){
        if(mp['2']>=5 || (mp['2']>=2 && mp['3']>=1)){
            cout << "YES\n";
        }
        else cout << "NO\n";
    }
    else if(sum==2){
        if(mp['2']>=1) cout << "YES\n";
        else cout << "NO\n";
    }
    else if(sum==6){
        if(mp['2']>=3 || mp['3']>=1) cout << "YES\n";
        else cout << "NO\n";
    }
    else if(sum==3){
        if(mp['2']>=6 || (mp['3']>=2) || (mp['3']>=1 && mp['2']>=3)) cout << "Yes\n";
        else cout << "no\n";
    }
    else if(sum==4){
        if(mp['2']>=2) cout << "yes\n";
        else cout << "no\n";
    }
    else if(sum==5){
        if(mp['2']>=7 || (mp['2']>=1 && mp['3']>=2) || (mp['2']>=4 && mp['3']>=1)) cout << "yes\n";
        else cout << "no\n";
    }
    else if(sum==7){
        if(mp['2']>=8 || (mp['2']>=5 && mp['3']>=1) || (mp['2']>=2 && mp['3']>=2)) cout << "yes\n";
        else cout << "no\n";
    }
    else if(sum==8){
        if(mp['2']>=4) cout << "yes\n";
        else cout << "no\n";
    }
}

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


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

void solve() {
    string s;
    cin >> s;
    map<char,int> mp;
    mp['2']=0;
    mp['3']=0;
    ll sum=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='2') mp['2']++;
        if(s[i]=='3') mp['3']++;
        sum += (s[i]-'0');
        sum %= 9;
    }
     for (int i = 0; i <= min(10, mp['2']); i++) {
        for (int j = 0; j <= min(10, mp['3']); j++) {
            if ((sum + i * 2 + j * 6) % 9 == 0) {
                cout << "YES" << endl;
                return;
            }
        }
    }

    cout << "NO" << endl;
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
// Thank God!

#include <bits/stdc++.h>

#include <cstdint>

#include <numeric>

using namespace std;



// Aliases for simple data types

using ll = long long;

using dd = long double;

using mpi = map<int, int>;

using mpl = map<ll, ll>;

using ull = unsigned long long;



// Constant definitions

#define PI 3.14159265358979323

#define E 2.7182818284590

#define all(x) x.begin(), x.end()



// BIG NUMBERS (MODULAR)

const ll MOD = 998244353;

const ll MOD1 = 998244353;

const ll MOD2 = (ll)1e9 + 7;



// simplified aliases for vectors,pairs

template <class T>

using v = vector<T>;

template <class T>

using p = pair<T, T>;



// overloaded instream operators

template <class T1, class T2>

istream &operator>>(istream &in, pair<T1, T2> &p)

{

in >> p.first >> p.second;

return in;

}

template <class T>

istream &operator>>(istream &in, v<T> &v)

{

for (auto &x : v)

in >> x;

return in;

}



// a^b mod MOD

ll POW(ll a, ll b)

{

ll res = 1;

ll m = a;

while (b)

{

if (b & 1)

res = (res * m) % MOD;

m *= m;

m %= MOD;

b >>= 1;

}

return res;

}



// a^-1 mod MOD

ll INV(ll a)

{

return POW(a, MOD - 2);

}



template <typename T>

class Printer

{

private:

int sz;

vector<T> a;



public:

Printer(vector<T> &a) : a(a) {};

Printer(vector<T> &a, int &sz) : a(a), sz(sz) {};

void print(const vector<T> &arr)

{

for (auto &o : arr)

cout << o << " ";

}

void print()

{

print(a);

}

};



// MULTITEST TOGGLE

const bool test = true;

// INTERACTIVE TOGGLE

const bool fileInput = false;

/*-------------------------------------------------------------------------------*/



void solve()

{

string s;

cin >> s;

int n = s.length();

v<pair<int, int>> pairs;

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

pairs.push_back({(s[i] - '0') - i, i});

sort(all(pairs));

reverse(all(pairs));

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

{

if (i < pairs[i].second)

cout << (-(pairs[i].second - i) + (s[pairs[i].second] - '0'));

else

cout << s[pairs[i].second];

}

cout << "\n";

}

int main()

{

/*Command Line

g++ forkiespad.cpp -o forkiespad

forkiespad.exe

*/



// file input

if (fileInput)

{

freopen("input.txt", "r", stdin);

}

ios::sync_with_stdio(false);

cin.tie(0);



// testcases

int t;

if (test)

{

cin >> t;

}

else

t = 1;



while (t--)

{

solve();

}

}



/*

-try out more cases

-attack the problem creatively/at different angles

-what am i missing?

-CHECK YOUR CODE

-pay attention to BOUNDS

-errors - out of bounds, edge case(n=0, n=1?), integer overflow, etc.

-WHEN IN DOUBT, USE LONG LONG

-check the for loops

-watch out for division errors (use double and ll when needed)

*/

// Thank God!
Problem: 2050D - Digital string maximization
Language: PyPy 3-64

Previous submission (verdict: Runtime error on test 1):
for _ in range(int(input())):
    s = input()

    for i in range(10):
        for j in range(len(s)-1):
            if s[j] + 1 < s[j+1]:
                s[j], s[j+1] = s[j+1] - 1, s[j]

    print(s)


Submission (verdict: Runtime error on test 1):
for _ in range(int(input())):
    s = list(map(int,input()))
    
    for i in range(10):
        for j in range(len(s)-1):
            if s[j] + 1 < s[j+1]:
                s[j], s[j+1] = s[j+1] - 1, s[j]

    print("".join(s))
Problem: 2050D - Digital string maximization
Language: PyPy 3-64


Submission (verdict: Runtime error on test 1):
for _ in range(int(input())):
    s = input()

    for i in range(10):
        for j in range(len(s)-1):
            if s[j] + 1 < s[j+1]:
                s[j], s[j+1] = s[j+1] - 1, s[j]

    print(s)
Problem: 2050D - Digital string maximization
Language: PyPy 3-64

Previous submission (verdict: Runtime error on test 1):
for _ in range(int(input())):
    s = list(map(int,input()))
    
    for i in range(10):
        for j in range(len(s)-1):
            if s[j] + 1 < s[j+1]:
                s[j], s[j+1] = s[j+1] - 1, s[j]

    print("".join(s))


Submission (verdict: Accepted):
for _ in range(int(input())):
    s = list(map(int,input()))

    for i in range(10):
        for j in range(len(s)-1):
            if s[j] + 1 < s[j+1]:
                s[j], s[j+1] = s[j+1] - 1, s[j]

    print("".join(map(str, s)))
Problem: 2060D - Subtract Min Sort
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;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

    vector<ll> diff(n-1);

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

        diff[i] = v[i+1]-v[i];

    }

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

        if(diff[i]<0 and diff[i+1]<0){

            cout<<"NO"<<endl;

            return;

        }

    }

    if(is_sorted(v.rbegin(), v.rend())){

        cout<<"NO"<<endl;

        return;

    }

    cout<<"YES"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}





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

using namespace std;

typedef long long ll;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

    vector<ll> diff(n);

    diff[0] = v[0]-1e9;

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

        diff[i+1] = v[i+1]-v[i];

    }

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

        if(diff[i]<0 and diff[i+1]<0){

            cout<<"NO"<<endl;

            return;

        }

    }

    // if(is_sorted(v.rbegin(), v.rend())){

    //     cout<<"NO"<<endl;

    //     return;

    // }

    cout<<"YES"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}
Problem: 2060D - Subtract Min Sort
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;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

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

        if(i>0 and (v[i]==v[i-1]+1 or v[i]==v[i-1])){

            continue;

        }

        v[i] = v[i] - min(v[i], v[i+1]);

        v[i+1] = v[i] - min(v[i], v[i+1]);

    }



    if(is_sorted(v.begin(), v.end())){

        cout<<"YES"<<endl;

    }

    else cout<<"NO"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}





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

using namespace std;

typedef long long ll;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

    vector<ll> diff(n-1);

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

        diff[i] = v[i+1]-v[i];

    }

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

        if(diff[i]<0 and diff[i+1]<0){

            cout<<"NO"<<endl;

            return;

        }

    }



    cout<<"YES"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}
Problem: 2060D - Subtract Min Sort
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;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

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

        if(i>0 and (v[i]==v[i-1]+1 or v[i]==v[i-1])){

            continue;

        }

        v[i] = v[i] - min(v[i], v[i+1]);

        v[i+1] = v[i] - min(v[i], v[i+1]);

    }



    if(is_sorted(v.begin(), v.end())){

        cout<<"YES"<<endl;

    }

    else cout<<"NO"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}
Problem: 2060D - Subtract Min Sort
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;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

    vector<ll> diff(n-1);

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

        diff[i] = v[i+1]-v[i];

    }

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

        if(diff[i]<0 and diff[i+1]<0){

            cout<<"NO"<<endl;

            return;

        }

    }



    cout<<"YES"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}





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

using namespace std;

typedef long long ll;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

    vector<ll> diff(n-1);

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

        diff[i] = v[i+1]-v[i];

    }

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

        if(diff[i]<0 and diff[i+1]<0){

            cout<<"NO"<<endl;

            return;

        }

    }

    if(is_sorted(v.rbegin(), v.rend())){

        cout<<"NO"<<endl;

        return;

    }

    cout<<"YES"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}
Problem: 2060D - Subtract Min Sort
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;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    if(is_sorted(v.begin(),v.end())){

        cout<<"YES"<<endl;

        return;

    }

    vector<ll> diff(n);

    diff[0] = v[0]-1e9;

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

        diff[i+1] = v[i+1]-v[i];

    }

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

        if(diff[i]<0 and diff[i+1]<0){

            cout<<"NO"<<endl;

            return;

        }

    }

    // if(is_sorted(v.rbegin(), v.rend())){

    //     cout<<"NO"<<endl;

    //     return;

    // }

    cout<<"YES"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}





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

using namespace std;

typedef long long ll;





void solve(){

    ll n; cin>>n;

    vector<ll> v(n);

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

    // if(is_sorted(v.begin(),v.end())){

    //     cout<<"YES"<<endl;

    //     return;

    // }

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

        ll diff = min(v[i], v[i+1]);

        v[i]-=diff;

        v[i+1]-=diff;

    }

    if(is_sorted(v.begin(), v.end())){

        cout<<"YES"<<endl;

    }

    else cout<<"NO"<<endl;

    

}







int main(){

    int t; 

    cin>>t;

    while(t--){

        solve();

    }

    // solve();

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>

typedef long long ll;

using namespace std;

int main() {

	ll t;

	cin >> t;

	while (t--) {

		int n,count=0,i,j;

		cin >> n;

		string s;

		cin >> s;

		if (n == 1) {

			cout << "Yes" << endl;

			continue;

		}

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

			if (s[i] == '.')count++;

		if(count==n){

			cout << "Yes" << endl;

			continue;

		}

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

			if (s[i] == 's')break;

		if (i == n ) {

			cout << "Yes" << endl;

			continue;

		}

		for (j = n - 1; j >= 0; j--)

			if (s[j] == 'p')	break;

		if (j == -1) {

			cout << "Yes" << endl;

			continue;

		}

		if (i < j) {

			if (-i + j + 1 < j + 1 && -i + j + 1 < n - i) {

				cout << "No" << endl;

					continue;

			}

			count = 0;

			for (int k = 0; k < i; k++)

				if (s[k] == 'p') count++;

			if(count){

					cout << "No" << endl;

					continue;

			}

			count = 0;

			for (int k = j + 1; k < n; k++)

				if (s[k] == 's')count++;

			if(count){

					cout << "No" << endl;

					continue;

			}

			cout << "Yes" << endl;

			continue;

		}

		

		else

		  cout << "No" << endl;

	}

	return 0;

}

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

typedef long long ll;

using namespace std;

int main() {

	ll t;

	cin >> t;

	while (t--) {

		int n,count=0,i,j;

		cin >> n;

		string s;

		cin >> s;

		if (n == 1) {

			cout << "Yes" << endl;

			continue;

		}

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

			if (s[i] == '.')count++;

		if(count==n){

			cout << "Yes" << endl;

			continue;

		}

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

			if (s[i] == 'p')break;

		if (i == n ) {

			cout << "Yes" << endl;

			continue;

		}

		for (j = n - 1; j >= 0; j--)

			if (s[j] == 's')	break;

		if (j == -1) {

			cout << "Yes" << endl;

			continue;

		}

		if(i<j) {

			cout << "No" << endl;

			continue;

		}

		if(i==n-1||j==0){

			cout << "Yes" << endl;

			continue;

		}

		/*

		if (i < j) {

			if (-i + j + 1 < j + 1 && -i + j + 1 < n - i) {

				cout << "No" << endl;

					continue;

			}

			count = 0;

			for (int k = 0; k < i; k++)

				if (s[k] == 'p') count++;

			if(count){

					cout << "No" << endl;

					continue;

			}

			count = 0;

			for (int k = j + 1; k < n; k++)

				if (s[k] == 's')count++;

			if(count){

					cout << "No" << endl;

					continue;

			}

			cout << "Yes" << endl;

			continue;

		}*/

		/*for (j = 0; j < i; j++)

			if (s[j] == '.')count++;

		if(s[n-1]=='p'){

			cout << "Yes" << endl;

			continue;

		}

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

			cout << "Yes" << endl;

			continue;

		}

		for ( i = n - 1; i >= 0; i--)

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

				break;

		count = 0;

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

			if (s[j] == '.')count++;

		if (count >= n - i - 1){

			cout << "Yes" << endl;

			continue;

		}

		count = 0;

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

			if (s[i] == 's')break;

		for (int j = 0; j < i; j++)

			if (s[j] == '.')count++;

		if (count >= i) {

			cout << "Yes" << endl;

			continue;

		}*/

		  cout << "No" << endl;

	}

	return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<iostream>

typedef long long ll;

using namespace std;

int main() {

	ll t;

	cin >> t;

	while (t--) {

		int n,count=0;

		cin >> n;

		string s;

		cin >> s;

		if (n == 1) {

			cout << "Yes" << endl;

			continue;

		}

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

			if (s[i] == '.')count++;

		if(count==n){

			cout << "Yes" << endl;

			continue;

		}

		if(s[n-1]=='p'){

			cout << "Yes" << endl;

			continue;

		}

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

			cout << "Yes" << endl;

			continue;

		}

		cout << "No" << endl;

	}

	return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>

typedef long long ll;

using namespace std;

int main() {

	ll t;

	cin >> t;

	while (t--) {

		int n,count=0;

		cin >> n;

		string s;

		cin >> s;

		if (n == 1) {

			cout << "Yes" << endl;

			continue;

		}

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

			if (s[i] == '.')count++;

		if(count==n){

			cout << "Yes" << endl;

			continue;

		}

		if(s[n-1]=='p'){

			cout << "Yes" << endl;

			continue;

		}

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

			cout << "Yes" << endl;

			continue;

		}

		cout << "No" << endl;

	}

	return 0;

}



Submission (verdict: Wrong answer on test 1):
#include<iostream>

typedef long long ll;

using namespace std;

int main() {

	ll t;

	cin >> t;

	while (t--) {

		int n,count=0,i;

		cin >> n;

		string s;

		cin >> s;

		if (n == 1) {

			cout << "Yes" << endl;

			continue;

		}

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

			if (s[i] == '.')count++;

		if(count==n){

			cout << "Yes" << endl;

			continue;

		}

		if(s[n-1]=='p'){

			cout << "Yes" << endl;

			continue;

		}

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

			cout << "Yes" << endl;

			continue;

		}

		for ( i = n - 1; i >= 0; i--)

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

				break;

		count = 0;

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

			if (s[j] == '.')count++;

		if (count >= n - i - 1){

			cout << "Yes" << endl;

			continue;

		}

		count = 0;

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

			if (s[i] == 's')break;

		for (int j = 0; j < i; j++)

			if (s[j] == '.')count++;

		if (count >= i) {

			cout << "Yes" << endl;

			continue;

		}

		cout << "No" << endl;

	}

	return 0;

}