Maximize the modulo function

Problem Name:
Maximize the modulo function
Site:HackerEarth
Links:
Tags:
Problem setters: