#include <iostream>                                                                                                                                                                                                                           
using namespace std;                                                                                                                                                                                                                          
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                              
int main()                                                                                                                                                                                                                                    
{                                                                                                                                                                                                                                             
    int N, A, B;                                                                                                                                                                                                                              
    char S[100005];                                                                                                                                                                                                                           
                                                                                                                                                                                                                                              
    cin >> N >> A >> B;                                                                                                                                                                                                                       
    cin >> S;                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                              
    int ab_rank = 0;                                                                                                                                                                                                                          
    int b_rank = 0;                                                                                                                                                                                                                           
    for (int i = 0; i < N; i++)                                                                                                                                                                                                               
    {                                                                                                                                                                                                                                         
        bool go = false;                                                                                                                                                                                                                      
        if (S[i] == 'a') {                                                                                                                                                                                                                    
            if (ab_rank < A + B) {                                                                                                                                                                                                            
                go = true;                                                                                                                                                                                                                    
                ab_rank += 1;                                                                                                                                                                                                                 
            }                                                                                                                                                                                                                                 
        } else if (S[i] == 'b') {                                                                                                                                                                                                             
            if (ab_rank < A + B && b_rank < B) {                                                                                                                                                                                              
                go = true;                                                                                                                                                                                                                    
                ab_rank += 1;                                                                                                                                                                                                                 
                b_rank += 1;                                                                                                                                                                                                                  
            }                                                                                                                                                                                                                                 
        }                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                              
        if (go) {                                                                                                                                                                                                                             
            cout << "Yes" << endl;                                                                                                                                                                                                            
        } else {                                                                                                                                                                                                                              
            cout << "No" << endl;                                                                                                                                                                                                             
        }                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                              
        // cout << ":" << ab_rank << ":" << b_rank << ":" << S[i] << endl;                                                                                                                                                                    
                                                                                                                                                                                                                                              
    }                                                                                                                                                                                                                                         
}

Measured memory_bytes: 768