how can we put our code inputs to given constraints, i.e, should the program give a error message when the input is out of constraint… or perform any other action?
The input given to you is adhered to these constraints. You do not have to do anything on your part.
Constraints are mainly specified to give you an idea of the time complexity that will be required for any solution to a problem.
Constraints do matter and if you don’t follow them you might get a wrong answer. Like for example if you are given some variable say N<100000000000000, then you need to see the correct data type for declaring N i.e. long long. Same goes for constraints on other variables as well. However, if you take N as int, you won’t be able to store the maximum value hence garbage will be output which would lead to wrong answer.