human
I found an interesting problem on https://leetcode.com/problems/four-divisors/:
Given an integer array nums, return the sum of divisors of the integers in that array that have exactly four divisors.
If there is no such integer in the array, return 0.
 
Example 1:
Input: nums = [21,4,7]
Output: 32
Explanation:
21 has 4 divisors: 1, 3, 7, 21
4 has 3 divisors: 1, 2, 4
7 has 2 divisors: 1, 7
The answer is the sum of divisors of 21 only.

 
Constraints:

1 <= nums.length <= 10^4
1 <= nums[i] <= 10^5

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is the Python program you requested.

from collections import defaultdict
from math import ceil
class Solution:
    def sumFourDivisors(self, nums: List[int]) -> int:

        count = defaultdict(set)
        for j, num in enumerate(nums):
            count[(j,num)].add(num)
            for i in range(1,ceil(num**0.5)+1):
                if num % i == 0:
                    count[(j,num)].update({i, num//i})
                    if (len(count[j,num])>4):
                        break
        total = 0 
        print(count)
        for num in count:
            if len(count[num])==4:
                total+=sum(count[num])
        return total