import typing


class Solution:
    def sortArrayByParity(self, A: typing.List[int]) -> typing.List[int]:
        # even=[]
        # odd=[]
        # for each in A:
        #     if each%2==0:
        #         even.append(each)
        #     else:
        #         odd.append(each)
        # return even+odd
        return [a for a in A if a%2==0]+[a for a in A if a%2!=0]
# Runtime: 76 ms, faster than 98.18% of Python3 online submissions for Sort Array By Parity.
# Memory Usage: 13.3 MB, less than 98.70% of Python3 online submissions for Sort Array By Parity.
if __name__ == '__main__':
    S=Solution()
    print(S.sortArrayByParity([3,1,2,4]))
8939ebfa6c4b2b8a13cbea9cffffa05a35f6efcb
<mask token>

<mask token>


class Solution:

    def sortArrayByParity(self, A: typing.List[int]) ->typing.List[int]:
        return [a for a in A if a % 2 == 0] + [a for a in A if a % 2 != 0]


<mask token>

<mask token>


class Solution:

    def sortArrayByParity(self, A: typing.List[int]) ->typing.List[int]:
        return [a for a in A if a % 2 == 0] + [a for a in A if a % 2 != 0]


if __name__ == '__main__':
    S = Solution()
    print(S.sortArrayByParity([3, 1, 2, 4]))

import typing


class Solution:

    def sortArrayByParity(self, A: typing.List[int]) ->typing.List[int]:
        return [a for a in A if a % 2 == 0] + [a for a in A if a % 2 != 0]


if __name__ == '__main__':
    S = Solution()
    print(S.sortArrayByParity([3, 1, 2, 4]))

import typing


class Solution:
    def sortArrayByParity(self, A: typing.List[int]) -> typing.List[int]:
        # even=[]
        # odd=[]
        # for each in A:
        #     if each%2==0:
        #         even.append(each)
        #     else:
        #         odd.append(each)
        # return even+odd
        return [a for a in A if a%2==0]+[a for a in A if a%2!=0]
# Runtime: 76 ms, faster than 98.18% of Python3 online submissions for Sort Array By Parity.
# Memory Usage: 13.3 MB, less than 98.70% of Python3 online submissions for Sort Array By Parity.
if __name__ == '__main__':
    S=Solution()
    print(S.sortArrayByParity([3,1,2,4]))