https://www.codechef.com/viewsolution/30721988
my approach was i was trying to make every element of array a multiple of k so considered the previous and next multiple of k and took the minimum to check which operation is the minimum and added all such minimum to ans.