My Java 0ms solution
\nclass Solution {\n    public int countStudents(int[] students, int[] sandwiches) {\n        int a = 0, b = 0;\n        for (int s : students) {\n            a
```\nclass Solution {\n    public int countStudents(int[] students, int[] sandwiches) {\n        int a = 0, b = 0;\n        for (int s : students) {\n            a += (s == 0 ? 1 : 0);\n            b += (s == 1 ? 1 : 0);\n        }\n        \n        for (int n : sandwiches) {\n            if ((a == 0 && n == 0) || (b == 0 && n == 1)) break;\n            if (n == 0) a--;\n            else b--;\n        }\n        return a + b;\n    }\n}\n```
[]