I chose to solve this with a binary search knowing that the result of integer division x/y where y is in our control and y>x then x//y == 0 and g^0 = 1 tells us the magnitude of the flag.
Full writeup:
[https://ctf.rip/write-ups/crypto/corctf-dividing-secrets/](https://ctf.rip/write-ups/crypto/corctf-dividing-secrets/)