GIRLSNBS  Girls and Boys
There are G girl students and B boy students in a class that is about to graduate. You need to arrange them in a single row for the graduation. To give a better impression of diversity, you want to avoid having too many girls or too many boys seating consecutively. You decided to arrange the students in order to minimize the gender regularity. The gender regularity of an arrangement is the maximum number of students of the same gender (all girls or all boys) that appear consecutively. Given G and B, calculate the minimum gender regularity among all possible arrangements.
Input
Each test case is described using a single line. The line contains two integers G and B representing the number of girls and boys in the class, respectively (0 ≤ G, B ≤ 1000). The end of input is indicated with a line containing the number −1 twice.
Output
For each test case, output a single line with a single integer representing the minimum gender regularity that an arrangement of G girls and B boys can have.
Example
Input:
10 10
5 1
0 1000
1 1
Output:
1
3
1000
hide comments
suyashky:
20181110 09:40:15
Need to find smaller and larger among B and G , and normal division and modulus..


prachij:
20181003 21:35:22
AC in one go!! 2nd one today :) :) 

aanchalsingh:
20180705 22:05:13
My 100th.Easy one:) 

trupti18:
20180627 06:29:47
i liked this problem. it teaches a new concept. big things come in small packages 

mayank1208_:
20180623 19:15:46
very easy...not to think much.. 

masterchef2209:
20180622 16:46:07
figured it out using test cases...simple one :) 

ajayc1007:
20180617 15:06:26
Lots of paper work needed. Try on your own !!! 

wrzoboo:
20180606 11:58:58
18 lines in python3 

sharmajatin741:
20180522 17:17:27
AC in one go without knowing pigeonhole principle ! 

kkislay20:
20180313 18:21:55
Pigeonhole and some thinking gives it away. 
Added by:  Pablo Ariel Heiber 
Date:  20100927 
Time limit:  2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 NODEJS OBJC VB.NET 
Resource:  FCEyN UBA ICPC Selection 2010 