#include <queue>
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param students int整型vector 
     * @param sandwiches int整型vector 
     * @return int整型
     */
     //学生que,三明治stk,
    int countStudents(vector<int>& students, vector<int>& sandwiches) {
        // write code here
        int count[2]={0};//count[0]:喜欢0型三明治的人数,count[1]:喜欢1型三明治的人数
        //统计学生偏好
        for(auto stu:students){
            count[stu]++;
        }
        for(int sandwich:sandwiches){
            //如果没有喜欢当前三明治的学生了,就停止分发
            if(count[sandwich]==0){
                break;
            }
            count[sandwich]--;//学生拿到三明治,离开
        }
        return count[0]+count[1];//剩下的没拿到喜欢的三明治的学生
    }
};