vgel/INTELLECT-2-RL-Dataset-Code-Only huggingface dataset:
You are planning to travel in interstellar space in the hope of finding habitable planets. You have already identified $N$ stars that can recharge your spaceship via its solar panels. The only work left is to decide the orientation of the spaceship that maximizes the distance it can travel.

Space is modeled as a $2$D plane, with the Earth at the origin. The spaceship can be launched from the Earth in a straight line, in any direction. Star $i$ can provide enough energy to travel $T_ i$ distance if the spaceship is launched at an angle of $a_ i$ with the $x$-axis. If the angle is not perfectly aligned, then the spaceship gets less energy. Specifically, if the launch direction makes an angle of $a$ with the $x$-axis, then it gets enough energy to travel distance of\[ \max (0, T_ i - s_ i \cdot \mathrm{dist}(a_ i, a)) \]

from star $i$, where $\mathrm{dist}(a,b)$ is the minimum radians needed to go from angle $a$ to $b$. The distance that the spaceship can travel is simply the sum of the distances that each star contributes. Find the maximum distance $T$ that the starship can travel.

-----Input-----
The first line contains the value $N$, $1\le N\le 10^5$. Following this are $N$ lines each containing three real numbers $T_ i$, $s_ i$, and $a_ i$, with $0<T_ i\le 1000$, $0\le s_ i\le 100$, and $0\le a_ i < 2\pi $. All real numbers in the input have at most $6$ digits after the decimal point.

-----Output-----
On a single line output the maximum distance the spacecraft can travel. Your answer is considered correct if it has an absolute or relative error of at most $10^{-6}$.

-----Examples-----
Sample Input:
2
100 1 1
100 1 1.5
Sample Output:
199.500000

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
You are given an H × W grid.

The squares in the grid are described by H strings, S_1,...,S_H.

The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
. stands for an empty square, and # stands for a square containing a bomb.  
Dolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.

(Below, we will simply say "adjacent" for this meaning. For each square, there are at most eight adjacent squares.)

He decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.  
Print the strings after the process.  

-----Constraints-----
 - 1 \leq H,W \leq 50
 - S_i is a string of length W consisting of # and ..

-----Input-----
Input is given from Standard Input in the following format:  
H W
S_1
:
S_H

-----Output-----
Print the H strings after the process.

The i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \leq i \leq H, 1 \leq j \leq W).  

-----Sample Input-----
3 5
.....
.#.#.
.....

-----Sample Output-----
11211
1#2#1
11211

For example, let us observe the empty square at the first row from the top and first column from the left.

There is one bomb square adjacent to this empty square: the square at the second row and second column.

Thus, the . corresponding to this empty square is replaced with 1.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means that the corresponding column is black.

You think that this photo can contain a zebra. In this case the whole photo should consist of several (possibly, only one) alternating black and white stripes of equal width. For example, the photo [0, 0, 0, 1, 1, 1, 0, 0, 0] can be a photo of zebra, while the photo [0, 0, 0, 1, 1, 1, 1] can not, because the width of the black stripe is 3, while the width of the white stripe is 4. Can the given photo be a photo of zebra or not?


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 100 000) — the width of the photo.

The second line contains a sequence of integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 1) — the description of the photo. If a_{i} is zero, the i-th column is all black. If a_{i} is one, then the i-th column is all white.


-----Output-----

If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO".

You can print each letter in any case (upper or lower).


-----Examples-----
Input
9
0 0 0 1 1 1 0 0 0

Output
YES

Input
7
0 0 0 1 1 1 1

Output
NO

Input
5
1 1 1 1 1

Output
YES

Input
8
1 1 1 0 0 0 1 1

Output
NO

Input
9
1 1 0 1 1 0 1 1 0

Output
NO



-----Note-----

The first two examples are described in the statements.

In the third example all pixels are white, so the photo can be a photo of zebra.

In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is equal to two (white). Thus, not all stripes have equal length, so this photo is not a photo of zebra.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Zara, an aspiring architect and urban planner, has drawn out what she considers to be the perfect skyline. As Zara is still aspiring she must use her young daughter, Pippa, to test out her designs. In order to test out the designs Pippa must build them out of her building blocks! The building blocks Pippa has have a uniform width and depth, but come in different heights $h$. Zara’s description for Pippa will consist of a list of buildings, each with a target height $b$.

Pippa must then use some (not necessarily all) of her blocks to stack together such that the sum of the heights of the blocks in each stack corresponds to the height of the building in the skyline. Since Pippa prefers building instead of solving puzzles she wants you to determine how she must stack the blocks so that she must only do the stacking!

-----Input-----
The input consists of a single test case. The first line of this test case contains two integers $N$ and $S$ ($1 \le N \le 15$ and $1 \le S \le 15$), where $N$ is the number of blocks Pippa has and $S$ is the number of buildings in the skyline Zara made.

The next line contains $N$ integers ($1 \le h_ i \le 10^{9}$) representing the heights of each of the blocks. The last line contains $S$ integers ($1 \le b_ i \le 10^{9}$) representing the heights of each of the buildings.

-----Output-----
If it is possible for Pippa to build Zara’s skyline then output $S$ lines. On each line output a single number $s_ i$ representing the number of blocks needed to build building $i$ where $i$ corresponds to the $i^{\text {th}}$ building listed in the input. This should be followed (on the same line) by $s_ i$ numbers $j$ representing the blocks of the input used in building $i$, where $j$ represents the $j^{\text {th}}$ block appearing the input.

If no combination of the blocks can build the desired skyline then output -1.

-----Examples-----
Sample Input 1:
4 3
3 3 2 1
3 3 3
Sample Output 1:
1 1
1 2
2 3 4

Sample Input 2:
4 2
3 3 2 2
6 3
Sample Output 2:
-1

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
You are given a name of a month. Output the season of the year to which it belongs (based on Northern hemisphere).

Input

The input consists of a single string containing the name of one of the twelve months (January, February, March, April, May, June, July, August, September, October, November or December). The string is capitalized as given here.

Output

Output a single string — the season of the year to which the given month belongs (winter, spring, summer or autumn). The name of the season should be in lowercase.

Examples

Input

April


Output

spring


Input

November


Output

autumn

Note

Assume that winter is December through February, spring is March through May, summer is June through August and autumn is September through November.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Title: Flag Day

Time Limit: None seconds

Memory Limit: None megabytes

Problem Description:
In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions:
 -  overall, there must be *m* dances;-  exactly three people must take part in each dance;-  each dance must have one dancer in white clothes, one dancer in red clothes and one dancer in blue clothes (these are the colors of the national flag of Berland). 
The agency has *n* dancers, and their number can be less than 3*m*. That is, some dancers will probably have to dance in more than one dance. All of your dancers must dance on the party. However, if some dance has two or more dancers from a previous dance, then the current dance stops being spectacular. Your agency cannot allow that to happen, so each dance has at most one dancer who has danced in some previous dance. 

You considered all the criteria and made the plan for the *m* dances: each dance had three dancers participating in it. Your task is to determine the clothes color for each of the *n* dancers so that the President's third condition fulfilled: each dance must have a dancer in white, a dancer in red and a dancer in blue. The dancers cannot change clothes between the dances.

Input Specification:
The first line contains two space-separated integers *n* (3<=≤<=*n*<=≤<=105) and *m* (1<=≤<=*m*<=≤<=105) — the number of dancers and the number of dances, correspondingly. Then *m* lines follow, describing the dances in the order of dancing them. The *i*-th line contains three distinct integers — the numbers of the dancers that take part in the *i*-th dance. The dancers are numbered from 1 to *n*. Each dancer takes part in at least one dance.

Output Specification:
Print *n* space-separated integers: the *i*-th number must represent the color of the *i*-th dancer's clothes (1 for white, 2 for red, 3 for blue). If there are multiple valid solutions, print any of them. It is guaranteed that at least one solution exists.

Demo Input:
['7 3\n1 2 3\n1 4 5\n4 6 7\n', '9 3\n3 6 9\n2 5 8\n1 4 7\n', '5 2\n4 1 5\n3 1 2\n']

Demo Output:
['1 2 3 3 2 2 1 \n', '1 1 1 2 2 2 3 3 3 \n', '2 3 1 1 3 \n']

Note:
none

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
# Task
 Given an array of 2^(k) integers (for some integer `k`), perform the following operations until the array contains only one element:
```
On the 1st, 3rd, 5th, etc. 
iterations (1-based) replace each pair of consecutive elements with their sum;
On the 2nd, 4th, 6th, etc. 
iterations replace each pair of consecutive elements with their product.
```
After the algorithm has finished, there will be a single element left in the array. Return that element.

# Example

 For inputArray = [1, 2, 3, 4, 5, 6, 7, 8], the output should be 186.

 We have `[1, 2, 3, 4, 5, 6, 7, 8] -> [3, 7, 11, 15] -> [21, 165] -> [186]`, so the answer is 186.

# Input/Output

 - `[input]` integer array `arr`

   Constraints: 2^(1) ≤ arr.length ≤ 2^(5), -9 ≤ arr[i] ≤ 99.

 - `[output]` an integer

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
###BACKGROUND:
Jacob recently decided to get healthy and lose some weight. He did a lot of reading and research and after focusing on steady exercise and a healthy diet for several months, was able to shed over 50 pounds! Now he wants to share his success, and has decided to tell his friends and family how much weight they could expect to lose if they used the same plan he followed.

Lots of people are really excited about Jacob's program and they want to know how much weight they would lose if they followed his plan. Unfortunately, he's really bad at math, so he's turned to you to help write a program that will calculate the expected weight loss for a particular person, given their weight and how long they think they want to continue the plan.

###TECHNICAL DETAILS:
Jacob's weight loss protocol, if followed closely, yields loss according to a simple formulae, depending on gender. Men can expect to lose 1.5% of their current body weight each week they stay on plan. Women can expect to lose 1.2%. (Children are advised to eat whatever they want, and make sure to play outside as much as they can!)

###TASK:
Write a function that takes as input:
```
- The person's gender ('M' or 'F');
- Their current weight (in pounds);
- How long they want to stay true to the protocol (in weeks);
```
and then returns the expected weight at the end of the program.

###NOTES:
Weights (both input and output) should be decimals, rounded to the nearest tenth.
Duration (input) should be a whole number (integer). If it is not, the function should round to the nearest whole number.
When doing input parameter validity checks, evaluate them in order or your code will not pass final tests.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
The chef was not happy with the binary number system, so he designed a new machine which is having 6 different states, i.e. in binary there is a total of 2 states as 0 and 1. Now, the chef is confused about how to correlate this machine to get an interaction with Integer numbers, when N(Integer number) is provided to the system, what will be the Nth number that system will return(in Integer form), help the chef to design this system.

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, $N$. 

-----Output:-----
For each test case, output in a single line answer given by the system.

-----Constraints-----
- $1 \leq T \leq 10^5$
- $1 \leq N \leq 10^5$

-----Sample Input:-----
2
3
5

-----Sample Output:-----
7
37

-----EXPLANATION:-----
Initial numbers for system = [1, 6, 7, 36, 37, 42, 43, 216, …..
For 1) 3rd Number for the system will be 7.
For 2) 5th Number for the system will be 37.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
There is an H \times W grid (H vertical, W horizontal), where each square contains a lowercase English letter.
Specifically, the letter in the square at the i-th row and j-th column is equal to the j-th character in the string S_i.
Snuke can apply the following operation to this grid any number of times:
 - Choose two different rows and swap them. Or, choose two different columns and swap them.
Snuke wants this grid to be symmetric.
That is, for any 1 \leq i \leq H and 1 \leq j \leq W, the letter in the square at the i-th row and j-th column and the letter in the square at the (H + 1 - i)-th row and (W + 1 - j)-th column should be equal.
Determine if Snuke can achieve this objective.

-----Constraints-----
 - 1 \leq H \leq 12
 - 1 \leq W \leq 12
 - |S_i| = W
 - S_i consists of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
H W
S_1
S_2
:
S_H

-----Output-----
If Snuke can make the grid symmetric, print YES; if he cannot, print NO.

-----Sample Input-----
2 3
arc
rac

-----Sample Output-----
YES

If the second and third columns from the left are swapped, the grid becomes symmetric, as shown in the image below:

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game:  The game consists of n steps.  On the i-th step Greg removes vertex number x_{i} from the graph. As Greg removes a vertex, he also removes all the edges that go in and out of this vertex.  Before executing each step, Greg wants to know the sum of lengths of the shortest paths between all pairs of the remaining vertices. The shortest path can go through any remaining vertex. In other words, if we assume that d(i, v, u) is the shortest path between vertices v and u in the graph that formed before deleting vertex x_{i}, then Greg wants to know the value of the following sum: $\sum_{v, u, v \neq u} d(i, v, u)$. 

Help Greg, print the value of the required sum before each step.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph.

Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line a_{ij} (1 ≤ a_{ij} ≤ 10^5, a_{ii} = 0) represents the weight of the edge that goes from vertex i to vertex j.

The next line contains n distinct integers: x_1, x_2, ..., x_{n} (1 ≤ x_{i} ≤ n) — the vertices that Greg deletes.


-----Output-----

Print n integers — the i-th number equals the required sum before the i-th step.

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.


-----Examples-----
Input
1
0
1

Output
0 
Input
2
0 5
4 0
1 2

Output
9 0 
Input
4
0 3 1 1
6 0 400 1
2 4 0 1
1 1 1 0
4 1 2 3

Output
17 23 404 0

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is v_{i}. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions:  She will tell you two numbers, l and r (1 ≤ l ≤ r ≤ n), and you should tell her $\sum_{i = l}^{r} v_{i}$.  Let u_{i} be the cost of the i-th cheapest stone (the cost that will be on the i-th place if we arrange all the stone costs in non-decreasing order). This time she will tell you two numbers, l and r (1 ≤ l ≤ r ≤ n), and you should tell her $\sum_{i = l}^{r} u_{i}$. 

For every question you should give the correct answer, or Kuriyama Mirai will say "fuyukai desu" and then become unhappy.


-----Input-----

The first line contains an integer n (1 ≤ n ≤ 10^5). The second line contains n integers: v_1, v_2, ..., v_{n} (1 ≤ v_{i} ≤ 10^9) — costs of the stones. 

The third line contains an integer m (1 ≤ m ≤ 10^5) — the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and r (1 ≤ l ≤ r ≤ n; 1 ≤ type ≤ 2), describing a question. If type equal to 1, then you should output the answer for the first question, else you should output the answer for the second one.


-----Output-----

Print m lines. Each line must contain an integer — the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input.


-----Examples-----
Input
6
6 4 2 7 2 7
3
2 3 6
1 3 4
1 1 6

Output
24
9
28

Input
4
5 5 2 3
10
1 2 4
2 1 4
1 1 1
2 1 4
2 1 2
1 1 1
1 3 3
1 1 3
1 4 4
1 2 2

Output
10
15
5
15
5
5
2
12
3
5



-----Note-----

Please note that the answers to the questions may overflow 32-bit integer type.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
You are given two integers $a$ and $b$. Print $a+b$.


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases in the input. Then $t$ test cases follow.

Each test case is given as a line of two integers $a$ and $b$ ($-1000 \le a, b \le 1000$).


-----Output-----

Print $t$ integers — the required numbers $a+b$.


-----Example-----
Input
4
1 5
314 15
-99 99
123 987

Output
6
329
0
1110

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
A road network in a country consists of $N$ cities and $M$ one-way roads. The cities are numbered $1$ through $N$. For each road we know the origin and destination cities, as well as its length.

We say that the road $F$ is a continuation of road $E$ if the destination city of road $E$ is the same as the origin city of road $F$. A path from city $A$ to city $B$ is a sequence of road such that origin of the first road is city $A$, each other road is a continuation of the one before it, and the destination of the last road is city $B$. The length of the path is the sum of lengths of all roads in it.

A path from $A$ to $B$ is a shortest path if there is no other path from $A$ to $B$ that is shorter in length.

Your task is to, for each road, output how many different shortest paths contain that road, modulo $1000000007$.

-----Input-----
The first line contains two integers $N$ and $M$ $(1 \le N \le 1500, 1 \le M \le 5000)$, the number of cities and roads.

Each of the following $M$ lines contains three positive integers $O$, $D$ and $L$. These represent a one-way road from city $O$ to city $D$ of length $L$. The numbers $O$ and $D$ will be different and $L$ will be at most $10000$.

-----Output-----
Output $M$ integers each on its own line – for each road, the number of different shortest paths containing it, modulo $1000000007$. The order of these numbers should match the order of roads in the input.

-----Examples-----
Sample Input 1:
4 3
1 2 5
2 3 5
3 4 5
Sample Output 1:
3
4
3

Sample Input 2:
4 4
1 2 5
2 3 5
3 4 5
1 4 8
Sample Output 2:
2
3
2
1

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Chef taught his brother Chefu about right angled triangle and its properties. Chefu says that he has understood everything about right angled triangles. Chef wants to check learning of his brother by asking the following question "Can you find a right angled triangle whose length of hypotenuse  is H and its area is S?"
Chefu is confused how to solve it. I hope you are not. Please solve this by finding a right angled triangle with hypotenuse H and area S. If it not possible to do so, then output -1.

-----Input-----
The first line of the input contains a single integer T denoting the number of test-cases. T test cases follow.
For each test case, there will be a single line containing two space separated integers H and S.

-----Output-----
Output the answer for each test-case in a single line. If it is not possible to find such a triangle, output -1. Otherwise print 3 real numbers corresponding to the lengths of the sides of the triangle sorted in non-decreasing order. Please note that the length of the triangle sides should not differ by more than 0.01 in absolute value from the correct lengths.

-----Constraints-----
- 1 ≤ T ≤ 105
- 1 ≤ H ≤ 106
- 1 ≤ S ≤ 1012

-----Example-----
Input:4
5 6
6 10
258303 89837245228
616153 77878145466
Output:3.00000 4.00000 5.00000
-1
-1
285168.817674 546189.769984 616153.000000

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Harsh and Akshara are playing the Game of Strings. This game is a simple one and is played as a team. Both the players of a team will be given a string respectively. At the end of this game, every team is required find out the length of the longest string S such that the strings given to each of the team members is a subsequence of S and S contains no vowels. Help Harsh and Akshara in finding out the required length.

Input: 
Input consists of a single line containing two space separated strings.

Output: 
The length of the longest string that satisfy the given conditions.

Constraints:
1 ≤ length of string ≤ 5000

SAMPLE INPUT
singh king

SAMPLE OUTPUT
2

Explanation

The required string is "ng".

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.