Security bouncer

The security bouncer at a bar needs to keep track of the age. It’s a European bar, so the entrance is allowed for everyone 18 and older.
For each visitor below 18, the program should tell them You are not allowed to get in. And for others, the program should welcome them telling Welcome to the best bar! Enjoy!.
For each allowed visitor, the program will also get a number - how much they spent that day in the bar. The program should print the total revenue of the bar that night.
The first line of the input contains a single number n - the number of visitors in the line. The next two lines contain the age of the visitor, and their spending if they are allowed to the bar.
For each customer, the program should print the appropriate message and how much the visitors spent in total at the very end.
3 19 400 7 20 200
Welcome to the best bar! Enjoy! You are not allowed to get in Welcome to the best bar! Enjoy! Total: 600
  1. First visitor - 19 years old spends 400 euros
  1. Second visitor - 7 years old is not allowed
  1. Third visitor - 20 years old spends 200 euros


Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue