THE DOUBT I ASKED BEFORE I FORGOT TO PASTE LINNK

as i said my code gave WA over spoj https://ide.codingblocks.com/s/260041