ADIGIT WA cant find error

I tried to solve this problem(Contest Page | CodeChef) with same logic as given in Editorial still getting WA plz explain flaw in my code

Description of code

1)Take an structure array

2)find the frequency of each digit occurring before index i

3)arr[i].greater[j] meaning frequency of digit j before the element i in the array

code link Q5Ax7b - Online C++ Compiler & Debugging Tool -

please help

See my code same logic… I hope this can solve your problem.
ideone link