Clean Python and Java
Python3:\npython\nclass Solution:\n    def splitListToParts(self, head: ListNode, k: int) -> List[ListNode]:\n        size = self.get_size(head)\n        min_le
Python3:\n```python\nclass Solution:\n    def splitListToParts(self, head: ListNode, k: int) -> List[ListNode]:\n        size = self.get_size(head)\n        min_len, one_more = divmod(size, k)\n        res = []\n        current = ListNode()\n        current.next = head\n        for i in range(k):\n            ans = current\n            for _ in range(min_len + int(i < one_more)):\n                current = current.next\n            res.append(ans.next)\n            ans.next = None\n        return res\n\n    def get_size(self, head: ListNode) -> int:\n        size = 0\n        while head is not None:\n            size += 1\n            head = head.next\n        return size\n```\n\nJava:\n```java\nclass Solution {\n    public ListNode[] splitListToParts(ListNode head, int k) {\n        final int size = getSize(head);\n        final int minLen = size / k;\n        final int oneMore = size % k;\n        final ListNode[] res = new ListNode[k];\n        ListNode current = new ListNode();\n        current.next = head;\n        ListNode ans;\n        int step;\n        for (int i = 0; i < k; i++) {\n            ans = current;\n            step = i < oneMore ? minLen + 1 : minLen;\n            for (int j = 0; j < step; j++) {\n                current = current.next;\n            }\n            res[i] = ans.next;\n            ans.next = null;\n        }\n        return res;\n    }\n\n    private static int getSize(ListNode head) {\n        int size = 0;\n        while (head != null) {\n            size++;\n            head = head.next;\n        }\n        return size;\n    }\n}\n```
['Python', 'Java', 'Python3']