Python code: longest 1 liner | beats 98.57% (29ms)
Intuition\n Describe your first thoughts on how to solve this problem. \nthe way people generally aproach this question is to just simulate the que and get the 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nthe way people generally aproach this question is to just simulate the que and get the result which might be better than my solution (probably not).\n\nlet us first think ,when would the people go into a continuous loop ,it is when we have only `students` who prefer one type (either 1or0) and the type of burger at the top of the `sandwiches` are different.\n\nso we can have equal numbers to satisfy everyone or we can have an uneqaulity that is the type 1 can be more than the other,in which case we can get the infinite loop of `students` just standing in line.\n\nlet us take an example of the 1 being the majority in `students`,then the minority would be 0 ,if the number of 0 in `sandwiches` are more than the minority count(let us take 4 `0` in `students` and 6 `0` in `sandwiches`),when all the 4 `0` are satisfied from the `students` then only `1`\'s will be left\nand when we reach the 5 th `0` in snadwiches we wont move forward loop occurs and all the `1`\'s after the 5th `0` would not be satisfied and also all the `1`\'s left in the `students` should be counted.\nfrom the above example we can infer that the number of unsatisfied `students` would be \nthe diff of the number of majority type after the nth  minority type + the diff of the count of majority type in `students`  from the majority type of `sandwiches`\nreplace majority type with the most repeating element of `students`\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def countStudents(self, students: List[int], sandwiches: List[int]) -> int:\n        return 0 if len(sandwiches)==len(students) and sandwiches.count(1)==students.count(1) else abs(sandwiches.count(1)-students.count(1))+sandwiches[[i for i, v in enumerate(sandwiches) if v == 0][students.count(0)]:].count(1) if students.count(0)<sandwiches.count(0) else abs(sandwiches.count(0)-students.count(0))+sandwiches[[i for i, v in enumerate(sandwiches) if v == 1][students.count(1)]:].count(0) if students.count(1)<sandwiches.count(1) else -1\n```
['Python3']