Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Fair Distribution

By emoncse · Limits 1s, 512 MB

Mr. Forhad has X children. One day, on his way home, he bought Y chocolates for his children. He doesn’t know if he can divide these Y chocolates equally among his X children. If he can’t, then he must buy some more chocolates so that he can divide the chocolates equally among his children.

Now, you need to write a program to help Mr. Forhad determine the minimum number of additional chocolates that he needs to by so that he can make the distribution fair.


Each line will have two integers X and Y (0 < X, Y < 150) where X is the number of children that Mr. Forhad has and Y is the number of chocolates that Mr. Forhad has already bought.


You must print one integer which is the minimum number of additional chocolates that Mr. Forhad needs to buy.


3 10



97% Solution Ratio

Nasif_44thEarliest, Apr '19

Nasif_44thFastest, 0.0s

SIR.24Lightest, 0 B

touhidurShortest, 41B


Login to submit


You must know how to calculate reminder.

Related Contests

Intra Sylhet Polytechnic Institute Programming Contest 2017 Ended at 2017-09-22 14:30:00 +0000 UTC
Tough Dash, April 2019 Ended at 2019-04-04 13:10:00 +0000 UTC