Chelsea and Charlie love rainy days. When it's pouring outside, they get to wear their flannel pajamas all day and do some of their favorite activities – playing with teddy bears, making (and eating) cream cheese brownies, and more.
Chelsea and Charlie want to know what the weather forecast is for the month of February, so that they can plan ahead for rainy days. Let's assume it is not a leap year, so there are 28 days in February. You will be given 28 decimal values representing the probability of rain on each day of February, in order. Chelsea and Charlie will consider a day rainy if the probability of rain is greater than or equal to 0.8. How many rainy days are there?
The first and only line will contain 28 decimal values $$$a_1,...,a_{28}$$$ where the $$$a_i$$$th value represents the probability of rain on the $$$i$$$th day. ($$$0 \le a_i \le 1$$$)
Output a single integer, the number of days that are rainy ($$$a_i \ge 0.8$$$) in February.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.25 0.22 0.64 0.43 0 0.99 0.87 0.28 0.83 0.77 0.92 0.45 0.60 0.887 0.935 0.353 0.182
9
Due to the winter storm, Gabrielle was running low on water and resorted to her water bucket to collect rainwater. She decided to collect water for a total of 7 days. On the first day, she collected $$$i$$$ mL of water. She also knows that the rain is expected to increase by $$$x$$$ mL each day for the next 6 days, where $$$x$$$ is the sum of the digits of $$$i$$$. Output the total mL that Gabrielle will collect for the week.
The first and only line of input contains $$$i$$$ $$$(0 \leq i \leq 10^5)$$$.
Output the total $$$mL$$$ that Gabrielle will collect for the week.
70
637
One of Teddy's amazing cream cheese brownies As Valentine's Day is coming up, Teddy is spending some time baking cream cheese brownies to give to their friends! Since Teddy is such a nice friend, they have taken requests from each of their $$$N$$$ friends as to how large of a brownie they would like to receive. A friend will be happy to receive a brownie larger than the size that they asked for.
Unfortunately, Teddy had not expected such an overwhelming number of requests (they are very popular), and so they are not sure that they will be able to accommodate everyone with their $$$M$$$ baking tins. Each of the baking tins that Teddy has have a specific volume of brownies that they can be used to bake, and moreover, each baking tin can only be used once. Finally, Teddy can only assign (at most) one baking tin per request, so the same baking tin cannot be used to create a larger brownie that would later be split into two (or more) pieces.
With all of this in mind, Teddy would still like to make it a very special Valentine's Day for their friends, and so they would like to maximize the number of friends who receive their desired amount (in units of volume) of brownies. Your job is to assist Teddy in calculating this value by assigning the baking tins optimally. Luckily for you, it's a rainy day out, so you have plenty of time to sit inside and code up an algorithm to assist Teddy.
The input will begin with a line containing two space-separated integers, $$$N$$$ and $$$M$$$ ($$$1 \leq N, M \leq 2 \cdot 10^5$$$), representing the number of friends that requested brownies and the number of baking tins that Teddy has, respectively.
The next line will contain $$$N$$$ space-separated integers, $$$s_1, s_2, \dots, s_N$$$ ($$$1 \leq s_i \leq 2 \cdot 10^9$$$ for all $$$i \in \{1, 2, \dots, N\}$$$), where $$$s_i$$$ represents the size (in units of volume) of the brownie that Teddy's $$$i$$$-th friend requested.
The final line of input will contain $$$M$$$ space-separated integers, $$$t_1, t_2, \dots, t_M$$$ ($$$1 \leq t_i \leq 2 \cdot 10^9$$$ for all $$$i \in \{1, 2, \dots, M\}$$$), where $$$t_i$$$ represents the size (in units of volume) of the $$$i$$$-th baking tin that Teddy owns.
The output should consist of a single line containing a single integer, the maximum number of Teddy's friends that can receive their desired size (or larger) of brownie, should Teddy pair the baking tins to requests optimally.
5 3 8 12 25 3 10 1 8 20
2
Alberto loves working out. Unfortunately, he is single, and with Valentine's Day coming up, he has decided to work even harder. Each day, he will drink $$$N$$$ ($$$1 \leq N \leq 10^5$$$) new protein shakes throughout his workout, and each protein shake will give him $$$E_i$$$ units of energy ($$$1 \leq i \leq N$$$, $$$0 \leq E_i \leq 10^5$$$). Since he is superstitious, he always drinks his shakes in the order listed in the input, and once he starts drinking a shake he will finish it completely.
Today, his workout consists of doing as many sets of $$$M$$$ ($$$1 \leq M \leq 10^3$$$) pushups as possible. He needs $$$k$$$ units of energy to do the $$$kth$$$ pushup, and he will stop once he completes the current set. Once he completes a set, his energy level resets to $$$0$$$. He will continue doing sets until he runs out of protein shakes.
Given the units of energy in the protein shakes that he will drink today, how many complete sets of pushups will Alberto be able to complete?
The first line contains the integers $$$N$$$ ($$$1 \leq N \leq 10^5$$$) and $$$M$$$ ($$$1 \leq M \leq 10^3$$$).
The second line contains $$$N$$$ integers, $$$E_1, E_2, … E_N$$$ ($$$1 \leq i \leq N$$$, $$$0 \leq E_i \leq 10^5$$$).
A single integer representing the number of sets Alberto will complete.
4 5 2 20 80 4
2
3 3 20 5 2
1
In the first example, Alberto needs to use the first two energy drinks to make it through the first set (which takes $$$1+2+3+4+5$$$ units of energy), upon which his energy resets to $$$0$$$. The third energy drink gets him through the second set (which takes $$$6+7+8+9+10$$$ units of energy), and the last energy drink cannot get him through the third set.
It has started raining, so you decide to stay after school to finish your homework. You pull out your statistical analysis homework, a grid of n by n numbers. You notice a curious pattern: each cell at column $$$j$$$ and row $$$i$$$ has value $$$\left \lfloor{\frac{j}{i}}\right \rfloor$$$, (the floor of j/i), where $$$j$$$ ranges from $$$[1\cdots n]$$$ and $$$i$$$ ranges from $$$[1\cdots n]$$$. You are curious as to how many cells have the same value $$$k$$$.
The first line of input contains two integers, $$$1 \leq n \leq 100000$$$, and $$$0 \leq k \leq n$$$.
Please print an integer, the number of occurrences of value $$$k$$$.
4 2
2
A 4x4 table looks like this: $$$$$$ \begin{array}{c c} & \begin{array}{c c c c} 1 & 2 & 3 & 4 \\ \end{array} \\ \begin{array}{c|c|c|c} 1 \\ 2\\ 3\\ 4 \end{array} & \begin{array}{|c|c|c|c|} \hline 1 & 2 & 3 & 4 \cr \hline 0 & 1 & 1 & 2 \cr \hline 0 & 0 & 1 & 1 \cr \hline 0 & 0 & 0 & 1 \cr \hline \end{array} \end{array} $$$$$$
Paulina the Precipitation Princess is working on a very interesting new method of creating rain, which she has named "prime precipitation".
She has specially engineered raindrops with unique aerodynamic properties, where their fall speed depends on their height. Given a raindrop's height, every second it will fall by exactly the number of prime divisors it has. For example, a raindrop at a height of $$$12$$$ will fall to a height of $$$9$$$ (as $$$12$$$ is divisible by two twice and three once). A raindrop at a height of $$$10$$$ will fall to a height of $$$8$$$ (as $$$10$$$ is divisible by two and five).
Given that elevation $$$1$$$ is the ground, such a raindrop may fall to the ground in $$$5$$$ seconds ($$$10 \rightarrow 8 \rightarrow 5 \rightarrow 4 \rightarrow 2 \rightarrow 1$$$).
For her first rainstorm, she will be dropping one raindrop of each height $$$[1, H]$$$. She will drop a raindrop, wait for it to hit the ground, then drop the next one.
Given this maximum height $$$H$$$, help Paulina determine how much time it will take for her to complete this process.
A single integer, $$$H$$$ ($$$1 \leq H \leq 4 \cdot 10^6$$$).
A single integer, the number of seconds for Paulina to drop all the rain.
6
11
You may need 64-bit integers for this problem.
Due to time limit constraints, this may be difficult to solve in Python.

Rose woke up in a mystical flower field. Since her name is Rose, she wants to collect as many of the $$$N$$$ roses in the field with her $$$E$$$ energy level (convince yourself that Rose can keep track of her energy quantitatively). Rose also enjoys running and moves at a speed of $$$1$$$ rosemeters/second. However, once a rose $$$i$$$ is picked from the field, the other roses disappear, and a rain monster will appear a distance $$$r_i$$$ rosemeters away from the rose and is restricted to moving along the perimeter with radius $$$r_i$$$ (centered at the rose).
Unfortunately for Rose, the rain monster has been spending lots of time at ✨ Rainy Day Monster Running and Fitness Center ✨ and will move $$$k_i$$$ times faster than Rose and does its best to catch Rose. For each rose, Rose has two options. Rose can move directly away from the rose. Alternatively, she can run along a circle of radius $$$e$$$ rosemeters centered at the rose, but she can only do this once for the current rose, which costs her $$$\lceil e\rceil$$$ energy, and she can choose to run along this circle forever if she wants to. Once she escapes the clutches of the monster, all the other roses reappear.
What is the maximum number of roses Rose can collect with her $$$E$$$ energy, given that she can choose to collect the Roses in any order she wants? Note that Rose can choose not to collect certain roses if she does not want to.
A diagram of the field is shown below (as well as two separate possible paths Rose could take assuming that the monster cannot catch her–note that path 2 will cost some $$$e$$$ energy):

The first line contains $$$N$$$ ($$$1\leq N\leq 500$$$), the number of roses and her energy level $$$E$$$ ($$$1 \leq E \leq 10^5$$$).
The next $$$N$$$ lines will contain two real numbers, the distance the monster spawns away from Rose $$$r_i$$$ ($$$1\leq r_i\leq 500$$$), and its speed factor compared to Rose $$$k_i$$$ ($$$1\leq k_i\leq 10^9$$$).
A single integer, the maximum number of roses Rose can collect with her $$$E$$$ energy.
4 5 5.00 4.00 1.00 2.00 1.15 3.15 6.00 5.00
3
Bob wants to create the most beautiful painting ever. The painting must be enormous, so he has purchased a grid of width $$$10^9$$$ and height $$$10^9$$$. Bob decided that today would be the best day to make the painting, but unfortunately it turned out to be a very rainy day. As a result, there are $$$M$$$ columns in the painting which have been completely washed out by the rain.
Before the rain began, Bob managed to paint $$$N$$$ rectangles on the painting. Rectangles are Bob's favorite shape, but if one rectangle is covered up by another, he would be very sad, so he made sure that none of the rectangles overlap.
Bob wants to know how many cells of paint on the original painting will remain after water washes away $$$M$$$ of the columns.
The first line of input contains integers $$$N$$$ and $$$M$$$ ($$$1 \le N, M \le 2 \cdot 10^5$$$).
The following $$$N$$$ lines each contain four integers $$$r_{1_i}$$$, $$$c_{1_i}$$$, $$$r_{2_i}$$$, and $$$c_{2_i}$$$ ($$$1 \leq r_{1_i}, c_{1_i}, r_{2_i}, c_{2_i} \leq 10^9$$$, $$$r_{1_i} \leq r_{2_i}$$$, $$$c_{1_i} \leq c_{2_i}$$$). These represent the bottom-left and top-right cells of the $$$i$$$-th rectangle of paint respectively. It is guaranteed that none of these rectangles will intersect.
The last $$$M$$$ lines of input each contain one integer $$$w_j$$$, indicating the $$$j$$$-th column of the painting which has been washed out by water. ($$$1 \le w_j \le 10^9$$$). Each $$$w_j$$$ is distinct.
Output the number of cells in the painting which contain paint but haven't been washed away.
4 3 3 1 5 4 1 5 4 6 1 2 1 3 5 5 5 5 2 4 5
11
3 3 1 5 3 7 1 8 2 8 4 6 5 8 1 3 10
17
Test 1:
As shown in the diagram on the left, there are four rectangles, occupying a total area of $$$23$$$. After the rain washes away some of the columns, there are four rectangles, occupying an area of $$$1 + 4 + 3 + 3 = 11$$$.
Test 2:
In this case, all of the water avoids the paint, so the answer is just the total amount of paint originally: $$$17$$$.
As a Valentine's Day surprise, you want to deliver chocolate to all of your friends. You have $$$N$$$ friends, each living in their own house labeled from $$$1$$$ to $$$N$$$. There are a series of $$$M$$$ one-way roads which connect houses together.
Unfortunately, it is storming heavily outside, so you resort to driving on the one-way roads instead of walking. Assuming you can start at any friend's house and can traverse through roads/houses more than once, what is the maximum number of unique friends you can deliver chocolate to?
The first line of input contains the integers $$$N$$$ and $$$M (1 \leq N \leq 10^3, 1 \leq M \leq 2N)$$$.
The next $$$M$$$ lines contain two integers $$$A$$$ and $$$B$$$, indicating that there is a one-way road pointing from house $$$A$$$ to house $$$B$$$. $$$(A \neq B, 1 \leq A, B \leq N)$$$
Please output an integer $$$K$$$, the maximum number of houses you can visit.
3 2 1 2 2 3
3
3 1 1 2
2
5 5 3 5 3 2 2 3 4 5 5 1
4