After a very close 13-11 victory in a Valorant ranked competitive game, Jett and Breach are arguing about which one between the two of them had a more positive impact on the game for their team. Even though there is an Average Combat Score system already in place, Breach complained about how he was always setting Jett up for success, so she would get not only all the first kills, but also the first deaths.
Their other teammates, namely Cypher, Omen, and Sova think that it is foolish to bicker about who was more "impactful" when they won the game. However, to help resolve the issue, they have come up with a more simple system. Cypher will assign a positive point value for each kill, Omen will assign a negative point value for each death, and Sova will assign a positive point value for each assist.
Given each of their point values as well as the Kills, Deaths, and Assists of both Jett and Breach, determine which one of them was more valuable by calculating the total score. The one with the higher score will have a higher impact.
The first line contains three space-separated integers $$$k (0 \le k \le 10^4), d (-10^4 \le d \le 0)$$$, and $$$a (0 \le a \le 10^4)$$$, the point assigned for a kill, a death, and an assist respectively.
The next line contains a single integer $$$n (1 \le n \le 10^3)$$$, the number of battles that follow.
For each of the next $$$n$$$ lines, there will be six space-separated integers, with the first three being $$$k_j, d_j, a_j$$$, and the last three being $$$k_b, d_b, a_b$$$ $$$(0 \le k_j, d_j, a_j, k_b, d_b, a_b \le 150)$$$, which are Jett and Breach's KDA (Kills, Deaths, and Assists), respectively.
For each of the $$$n$$$ matches, output "Jett" if Jett has more impact, and "Breach" if Breach has more impact. In case that there is a tie, output "Tie".
5 -3 1 2 24 10 0 19 10 0 24 18 0 19 5 0
Jett Breach
Kylo Ren is trying to bulk up his army in Star Wars Battlefront II in order to capture the traitorous Inferno Squad and its leader Iden Versio. His scientists have come up with a new cloning serum and wanted to administer it to a batch of $$$5$$$ current Imperial soldiers. The $$$5$$$ soldiers are lined up in the following order to start with: Ace, Bolt, Cameron, Doom, and Echo. The scientists continually take the first person in line and inject the cloning serum resulting in the chosen trooper doubling. The two troopers then go rejoin the end of the line and the process continues with the next person at the front of the line. For example, Ace gets the first serum and then the line becomes Bolt, Cameron, Doom, Echo, Ace, Ace. This task of cloning the troopers is laborious for the scientists so they decide to make it more fun by trying to predict the name of the trooper who will receive the $$$n$$$-th serum dose. Help the scientists calculate who will receive the $$$n$$$-th serum dose (Ace receives the first dose and then it continues from there as described above).
The input will contain a single integer $$$n$$$ $$$(1 \leq n \leq 10^6)$$$.
Output a single line containing the name of the clone who recieves the $$$n$$$-th dose of the cloning serum. The names must be spelled exactly as Ace, Bolt, Cameron, Doom, or Echo.
1
Ace
6
Ace
943
Cameron
In example $$$1$$$, the first serum dose goes to Ace so the answer is Ace.
In example $$$2$$$, the queue starts as Ace, Bolt, Cameron, Doom, and Echo, and after $$$5$$$ doses it looks like Ace, Ace, Bolt, Bolt, Cameron, Cameron, Doom, Doom, Echo, and Echo which means that the $$$6$$$-th dose will go to Ace.
After a long day at the arena fighting (and defeating!) Bowser, Isabelle comes home to get some rest. She looks around her house and notices her plain wooden floors and decides that they need some pizzazz. Isabelle decided she wanted to swap the wooden floors for fun colored tiles. After much internal debate, she decided on L-shaped tiles (3 across, 1 down) because they reminded her of both the Tetris piece and the move a knight makes in chess. Given the dimensions of Isabelle's rectangular room, determine whether or not these tiles will fully cover her floor.
There will be one line of input that contains 2 space-separated integers $$$N$$$ and $$$M$$$ which represent the length and width of Isabelle's room.
$$$ 1 \leq N, M \leq 1000 $$$
Output YES if L-shaped tiles will completely fill Isabelle's room and NO if they do not.
6 4
YES
9 6
NO
Sally has had some downtime recently and so to keep from boredom, she's been playing a lot of Super Smash Bros Ultimate. She has made it her goal to be the best player in the world and while watching some of the current best players, she found a special type of move combo called a kill-confirm which guarantees that you will be able to take one of your opponent's stock. In order for a combo to be a kill-confirm, she realized that the combo must be $$$n$$$ moves long and every 'sub-combo' of $$$p$$$ moves must be a palindrome. A 'sub-combo' of size $$$p$$$ is $$$p$$$ consecutive moves in the original combo and for a 'sub-combo' to be a palindrome, the list of moves must be the same when read forward and backward. For example, if the list of $$$p$$$ moves is 'Up, Down, Down, Up' this is a palindrome.
Armed with this information, Sally wants to figure out the number of distinct kill-confirm combos for a specific character in the game that has $$$m$$$ distinct moves. This number can be quite large so return the quantity modulo $$$10^9 + 7$$$.
There will be one line of input which contains $$$3$$$ space-separated integers: $$$n$$$, $$$p$$$, and $$$m$$$ ($$$1 \leq n,p,m \leq 2500$$$ and $$$p \leq n$$$).
Output a single integer, the number of possible combos that fit the desired scheme modulo $$$10^9 + 7$$$.
1 1 1
1
5 4 2
2
In the first example, there is only one move and the length of the combo is one so the only combo possible is that move itself. In the second example, there are two moves (call them $$$w$$$ and $$$s$$$ for example), and the only way for a combo to be of length $$$5$$$ with all 'sub-combos' of length $$$4$$$ being palindromes is if the combo is $$$wwwww$$$ or $$$sssss$$$.
Sidra enjoys playing her friends in the new hottest racing game, Kario Mart, where little characters race around in shopping carts inside of a grocery store. Whoever makes it around the track and back to the cash register first wins! Sidra has gotten pretty good at Kario Mart but would really like to take her strategy to the next level by optimizing the speed and maneuverability of her shopping cart selection prior to the race.
Before beginning a race in Kario Mart, players select a grocery store map that they will all race in. All grocery stores are rectangular, so the players will select some map with dimensions $$$w\times h$$$. Once this choice is made, Sidra knows that the game logic then randomly generates a rectangular racetrack for the players to race on, which will fit within the $$$w\times h$$$ grocery store map and rest on its unit grid-lines, including possibly the outer-most grid-lines.
Once the selected grocery store map and randomly generated racetrack are fixed, then players choose their shopping carts. Sidra knows the importance of a well-tuned shopping cart to winning the race, so she would like to know how much of the race will consist of making sharp turns versus speeding down straightaways. Help Sidra make the best choice she can without knowing the exact location and dimensions of the generated racetrack.
Given the dimensions $$$w$$$ and $$$h$$$ of the selected grocery store map and the fact that all unique rectangles in the grocery store are equally likely to be generated as a racetrack for the game, determine the expected value of the perimeter of the racetrack! Note that a rectangular racetrack is uniquely defined by two ordered pairs $$$(x_1,y_1)$$$ and $$$(x_2, y_2)$$$ where $$$x_1 \lt x_2$$$ and $$$y_1 \lt y_2$$$ and $$$0\leq x_1,x_2 \leq w$$$ and $$$0\leq y_1,y_2\leq h$$$.
The input consists of two space-separated integers, $$$w$$$ and $$$h$$$, representing the width and height of the selected grocery store map where $$$1\leq w,h \leq 1000$$$.
Output the expected value of the perimeter of a rectangular race track, randomly generated within the grocery store. Round your answer to the nearest integer.
2 2
5
Mateo has built a beautiful farm in Stardew Valley and now he wants to spend the rest of his days as a farmer buying salads from the villagers. Fortunately for him, Gus has introduced a bunch of new salads. There are $$$10^8$$$ different types of salads and they are creatively named 'Salad x' where $$$x$$$ is the type of the salad. Now, Gus is a little eccentric, his lucky numbers are any number which consists solely of the digits $$$3$$$ or $$$8$$$ (so $$$3$$$, $$$38$$$, $$$83$$$, and $$$88$$$ are lucky but $$$138$$$ is not). So, Gus has decided that the price of 'Salad x' is the first lucky number greater than or equal to $$$x$$$. Now, Mateo has been able to collect a lot of the salad types from other villagers but unfortunately, there is an interval of salad types that he has not been able to collect. Given the interval of salad types that Mateo is trying to buy, help calculate how much gold it will cost him to buy one of each of those types from Gus.
The first line of input will contain two integers, $$$l$$$ and $$$r$$$ (the interval of types which Mateo does not have - inclusive of the ends) where $$$1 \leq l \leq r \leq 10^8$$$.
Print a single integer (note this number may be large, so be sure to use appropriate types during your calculations) representing the amount of gold it will cost Mateo to buy one of each type of salad in the interval from Gus.
3 9
76
7 7
8
2 34
909
In the first sample, the interval is [3,9] and the cost of 'Salad 3' is $$$3$$$, 'Salad 4' is $$$8$$$, 'Salad 5' is $$$8$$$, 'Salad 6' is $$$8$$$, 'Salad 7' is $$$8$$$, 'Salad 8' is $$$8$$$, 'Salad 9' is $$$33$$$ so the total cost is $$$3 + 8 + 8 + 8 + 8 + 8 + 33 = 76$$$.
Toast is currently a crewmate on the Skeld, and unfortunately, unbeknownst to him, there has been a new task added! He's struggling a lot with this new task, so much so that Toast is a bit suspicious that the imposters might have already claimed a few crewmates. Just as he wants to give up on the task to check out his fellow crewmates, he sees Abe walk up behind him. Obviously, he does not want to fake a task. Help Toast finish his task so he can win the game!
The new task has a grid of $$$n \times m$$$ consisting of lower case English letters. Toast is allowed to remove any column of letters. The goal here is to remove the smallest number of columns required such that after all the removals, the rows are ordered from top to bottom lexicographically. Specifically, any row cannot be lexicographically smaller than a previous one, but it can be equal. Determine the minimum number of columns required to be removed to make this the case. Note that it may be the case that every column needs to be removed.
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 10^2)$$$.
The next $$$n$$$ lines each contain $$$m$$$ lowercase English letters, which are the characters in the grid.
A single integer detailing the minimum number of columns that need to be removed.
2 3 med bay
2
To help Luigi get rid of the spooky scary ghosts in the mansion, E. Gadd has created a new gadget, the Ghost Zapper '85. This gadget is able to automatically zap any ghost any distance away from it. The only catch is that zapping a ghost $$$x$$$ meters of distance away from the zapper consumes $$$x^{2}$$$ Watt-hours of energy. In addition, a zapper can zap as many ghost as necessary, but the energy requirements add up; zapping two ghosts, one distance $$$x$$$ away from the zapper and the other distance $$$z$$$ away, will consume $$$x^{2} + z^{2}$$$ Watt-hours of energy in total.
To test this out, E. Gadd will mount a Zapper unit on top of every light fixture in a very long hallway. Using another gadget, he has also determined the location of every ghost along the hallway. Calculate the amount of energy needed to zap every ghost in the hallway, mod $$$10^9 + 7$$$.
Two integers, $$$1 \leq n \le 10^5$$$, and $$$1 \leq m \le 10^5$$$, separated by spaces on the first line.
$$$n$$$ denotes the number of zappers mounted, and $$$m$$$ denotes the number of ghosts in the hallway.
$$$n$$$ lines each containing an integer $$$0 \leq z_{i} \le 10^7$$$ where $$$z_{i}$$$ represents the location of the $$$i$$$th zapper, and location is defined as meters away from the start of the hallway.
$$$m$$$ lines each containing an integer $$$0 \leq x_{j} \le 10^7$$$ where $$$x_{j}$$$ represents the location of the $$$j$$$th ghost.
The total energy required to zap every ghost in the hallway, mod $$$10^9 + 7$$$.
4 4 4 1 11 7 2 9 6 15
22
2 4 10 5 7 0 5 100
8129
In example 1, there are four zappers, at locations 4, 1, 11, and 7. The first ghost at location 2 can be zapped by the zapper at location 1, costing 1 Wh. The second ghost at location 9 can be zapped by the zapper at location 7 or the one at location 11, either costing 4 Wh. The third ghost at 6 can be zapped by the zapper at 7, costing 1 Wh. The fourth ghost at 15 can be zapped by the zapper at 11, costing 16 Wh. This yields a total of 22 Wh for all ghosts.
In example 2, The first ghost can be zapped by zapper 2 yielding a cost of $$$(7 - 5)^2 = 4$$$. The second ghost can be zapped by zapper 2 yielding a cost of $$$(5 - 0)^2 = 25$$$. The third ghost can be zapped by zapper 2 with a cost of $$$(5 - 5)^2 = 0$$$. The fourth ghost can be zapped by zapper 1, yielding a cost of $$$(100 - 10)^2 = 8100$$$. The total adds up to $$$8129$$$ Wh of energy.