Abdelalem noticed that people don't appreciate the importance of problem-solving skills. They seem to prioritize other things and overlook the significance of these skills. He believed that improving their problem-solving skills would enhance their overall thinking process. That's why he wanted his colleagues to organize a training sessions for the new batch at Shorouk Academy. They would provide them with training starting from the basics of programming to reaching a good level of problem-solving. To motivate people even more, he decided to create a simple system where mentors could award additional points to students during the training. In each session, the instructor would ask a question, and whoever answered correctly would receive a bonus. He would record this information in an Excel sheet. However, some individuals were tampering with the sheet, removing points from some students and adding points to others. Therefore, he decided to change this system and implement something simpler that wouldn't take much time to manage.
The new system would have two options. The first option would show the scoreboard, while the second option would allow instructors to add bonuses to someone. To protect the system, he would implement a password so that no one could tamper with the bonuses. However, upon further thought, he decided to let people attempt to implement the system themselves first. Can you do it? Keep in mind that he would test the system to ensure you've implemented it correctly using $$$q$$$ commands.
First, you will be provided with the number of students in the training followed by the password you're supposed to create for this system. Then, the list contains the names of the students, each on a new line. After that, you will be provided with the number of commands you're supposed to try on your system. Each command should be on a new line and fall into one of two types: scoreboard or bonus. The scoreboard command should print the current scoreboard and the ranking of each student. The bonus command is followed by the student's ID, the bonus they received, and the password. You should adjust the student's points if the password is correct and print "Updated successfully." If the password is incorrect, print "Wrong password please try again."
The first line contains one integer: $$$n$$$ ($$$1 \leq n \leq 100$$$), the number of students in the training, and $$$P$$$, the password for the system.
followed by $$$n$$$ lines, the $$$i$$$-th line containing the name of the student that have $$$id = i$$$ , each consisting of at most $$$100$$$ characters.
The next line contains an integer $$$q$$$ $$$(1 \leq q \leq 100)$$$, the number of commands to execute.
The following $$$q$$$ lines contain the commands. Each command is either:
"scoreboard" or "bonus id s pass", where $$$id$$$ ($$$1 \leq id \leq n$$$) is the student's ID, $$$s$$$ ($$$1 \leq s \leq 100$$$) is the bonus amount, and $$$pass$$$ is the password for the system.
it's guaranteed that the first command is bonus type
For each "scoreboard" command, print the current standings and ranks of each non-zero points student. Each line should display the rank, followed by the student's ID, name, and total points, separated by spaces. Students should be sorted in descending order of points, with ties broken by the student's ID in ascending order.
For each "bonus" command:
- If the password is correct, adjust the student's points according to the bonus amount and print "Updated successfully".
- If the password is incorrect, print "Wrong password please try again".
after each command outputs three dashes, see the sample output.
6 ShACAbdelaleemMohamedMostafaSamyYousefWalidMohamedSaraGamal10bonus 3 12 ShACbonus 1 8 ShACbonus 3 80 ShaCbonus 6 12 ShACscoreboardbonus 5 8 ShACbonus 2 3 ShACscoreboardbonus 1 10 ShACscoreboard
Updated successfully --- Updated successfully --- Wrong password please try again --- Updated successfully --- 1 3 MostafaSamy 12 1 6 SaraGamal 12 2 1 Abdelaleem 8 --- Updated successfully --- Updated successfully --- 1 3 MostafaSamy 12 1 6 SaraGamal 12 2 1 Abdelaleem 8 2 5 WalidMohamed 8 3 2 Mohamed 3 --- Updated successfully --- 1 1 Abdelaleem 18 2 3 MostafaSamy 12 2 6 SaraGamal 12 3 5 WalidMohamed 8 4 2 Mohamed 3 ---
3 DragonEmanGamalNourAbdulMalekZarzur8bonus 3 10 850bonus 1 8 Dragonbonus 2 3 Dragonscoreboardbonus 1 5 Dragonscoreboardbonus 3 50 Dragonscoreboard
Wrong password please try again --- Updated successfully --- Updated successfully --- 1 1 EmanGamal 8 2 2 Nour 3 --- Updated successfully --- 1 1 EmanGamal 13 2 2 Nour 3 --- Updated successfully --- 1 3 AbdulMalekZarzur 50 2 1 EmanGamal 13 3 2 Nour 3 ---
| Name |
|---|


