ADIGIT WA cant find error

I tried to solve this problem( 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

please help

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