Foobar - Test cases not passing - Disorderly escape (python) : 0/10 test cases are passing.

Here is the challenge description:

(to keep formatting nice - i put the description in a paste bin)
Link to challenge description: [https://pastebin.com/UQM4Hip9][1]


  [1]: https://pastebin.com/UQM4Hip9


Here is my trial code - PYTHON -  (0/10 test cases passed)

    from math import factorial
    from collections import Counter
    from fractions import gcd
    
    def cycle_count(c, n):
        cc=factorial(n)
        for a, b in Counter(c).items():
            cc//=(a**b)*factorial(b)
        return cc        
    
    def cycle_partitions(n, i=1):
        yield [n]
        for i in range(i, n//2 + 1):
            for p in cycle_partitions(n-i, i):
                yield [i] + p
    
    def solution(w, h, s):    
        grid=0
        for cpw in cycle_partitions(w):
            for cph in cycle_partitions(h):            
                m=cycle_count(cpw, w)*cycle_count(cph, h)
                grid+=m*(s**sum([sum([gcd(i, j) for i in cpw]) for j in cph]))
                  
        return grid//(factorial(w)*factorial(h))
    
    print(solution(2, 2, 2)) #Outputs 7

This code works in my python compiler on my computer but not on the foobar challenge??

Am I losing accuracy or something?

Thank you for any time and help you can provide.

If you downvote, can you provide a reason and not be so rude as this is a good question. I don't see anythign wrong with it.