Load Balancer Code

my code is correct but its showing time limit exceeded
here is my code:https://ide.codingblocks.com/s/353228

hello @jatinupadhyay786

u r never giving termination condition in ur input.
as per ur code , it will stop when it will read -1 but in input u r never giving -1.

yaa you are right but sir ne video mai nahi dia tha -1 input mai but unka chal raha tha code patani kaise

bhaiya is taking input from console na . so the program will not show tle . it will keep taking input from user till we enter -1.

but in urs case u r giving input in file where u need to give all input before hand.
thats why giving -1 is important

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.