vgel/INTELLECT-2-RL-Dataset-Code-Only huggingface dataset:
Given a string s which represent an expression, evaluate this expression.
Integer division should truncate towards zero.
 
Example 1:
Input: s = "10*20+10"
Output: 210
Example 2:
Input: s = "16*5-5/15"
Output: 80
 
Your Task:
You don't need to read or print anyhting. Your task is to complete the function calculate() which takes s as input parameter and returns the value of the expression.
 
Expected Time Compelxity: O(|s|)
Expected Space Complexity: O(1)
 
Constraints:
1 <= |s| <= 10^{5}
^{s is a valid expression.}
Note: The answer is guaranteed to fit in a 32-bit integer.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
The followers of Psycho-Helmet religion follow a peculiar calendar – a normal year contains N days. Every K-th year is a “MOB” year. For example, if K = 4, then years 4, 8, 12, 16 \ldots are “MOB” years. A “MOB” year contains M additional days i.e. it contains N+M days. 
 
Given X, determine whether the day after (X-1) days from Day 1 of Year 1 falls in a “MOB” year.

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of a single line containing N, M, K and X — the number of days in a normal year, the number of days in a “MOB” year, the number of years between two “MOB” years and the integer X.

------ Output Format ------ 

For each test case, output YES on a new line if the day after (X-1) days from Year 1, Day 1 falls in a “MOB” year, and NO otherwise.

You may print each character of YES and NO in uppercase or lowercase (for example, yes, yEs, Yes will be considered identical).

------ Constraints ------ 

$1 ≤ T ≤ 10^{5}$
$1 ≤ N, M, K ≤ 10^{4}$
$1 ≤ X ≤ 10^{9}$

----- Sample Input 1 ------ 
3
2 1 4 17
3 7 5 50
3 7 5 61
----- Sample Output 1 ------ 
YES
NO
YES
----- explanation 1 ------ 
Test case 1: Since $N = 2$, $M = 1$ and $K = 4$, years $4, 8, 12, 16 \ldots$ are “MOB” years and:
- Year $1$ has $N = 2$ days.
- Year $2$ has $N = 2$ days.
- Year $3$ has $N = 2$ days.
- Year $4$ is a “MOB” year and has $N + M = 3$ days.
- Year $5$ has $N = 2$ days.
- Year $6$ has $N = 2$ days.
- Year $7$ has $N = 2$ days.
- Year $8$ is a “MOB” year and has $N + M = 3$ days.

The $X = 17$-th day falls on the second day of Year $8$, which is a “MOB” year. Hence the answer is YES.

Test case 2: The $X = 50$-th day falls on the third day of Year $12$, which is not a “MOB” year. Hence the answer is NO.

Test case 3: The $X = 61$-st day falls on the fifth day of Year $15$, which is a “MOB” year. Hence the answer is YES.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Title: The Way to Home

Time Limit: None seconds

Memory Limit: None megabytes

Problem Description:
A frog lives on the axis *Ox* and needs to reach home which is in the point *n*. She starts from the point 1. The frog can jump to the right at a distance not more than *d*. So, after she jumped from the point *x* she can reach the point *x*<=+<=*a*, where *a* is an integer from 1 to *d*.

For each point from 1 to *n* is known if there is a lily flower in it. The frog can jump only in points with a lilies. Guaranteed that there are lilies in the points 1 and *n*.

Determine the minimal number of jumps that the frog needs to reach home which is in the point *n* from the point 1. Consider that initially the frog is in the point 1. If the frog can not reach home, print -1.

Input Specification:
The first line contains two integers *n* and *d* (2<=≤<=*n*<=≤<=100, 1<=≤<=*d*<=≤<=*n*<=-<=1) — the point, which the frog wants to reach, and the maximal length of the frog jump.

The second line contains a string *s* of length *n*, consisting of zeros and ones. If a character of the string *s* equals to zero, then in the corresponding point there is no lily flower. In the other case, in the corresponding point there is a lily flower. Guaranteed that the first and the last characters of the string *s* equal to one.

Output Specification:
If the frog can not reach the home, print -1.

In the other case, print the minimal number of jumps that the frog needs to reach the home which is in the point *n* from the point 1.

Demo Input:
['8 4\n10010101\n', '4 2\n1001\n', '8 4\n11100101\n', '12 3\n101111100101\n']

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

Note:
In the first example the from can reach home in two jumps: the first jump from the point 1 to the point 4 (the length of the jump is three), and the second jump from the point 4 to the point 8 (the length of the jump is four).

In the second example the frog can not reach home, because to make it she need to jump on a distance three, but the maximum length of her jump equals to two.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from $1$ to $n$ and then $3n$ times takes a random pair of different elements and swaps them. Alex envies Petr and tries to imitate him in all kind of things. Alex has also come up with a problem about random permutation. He generates a random permutation just like Petr but swaps elements $7n+1$ times instead of $3n$ times. Because it is more random, OK?!

You somehow get a test from one of these problems and now you want to know from which one.


-----Input-----

In the first line of input there is one integer $n$ ($10^{3} \le n \le 10^{6}$).

In the second line there are $n$ distinct integers between $1$ and $n$ — the permutation of size $n$ from the test.

It is guaranteed that all tests except for sample are generated this way: First we choose $n$ — the size of the permutation. Then we randomly choose a method to generate a permutation — the one of Petr or the one of Alex. Then we generate a permutation using chosen method.


-----Output-----

If the test is generated via Petr's method print "Petr" (without quotes). If the test is generated via Alex's method print "Um_nik" (without quotes).


-----Example-----
Input
5
2 4 5 1 3

Output
Petr



-----Note-----

Please note that the sample is not a valid test (because of limitations for $n$) and is given only to illustrate input/output format. Your program still has to print correct answer to this test to get AC.

Due to randomness of input hacks in this problem are forbidden.

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

Time Limit: None seconds

Memory Limit: None megabytes

Problem Description:
A word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test the output devices.

You are given a string consisting of lowercase and uppercase Latin letters. Check whether this string is a pangram. We say that the string contains a letter of the Latin alphabet if this letter occurs in the string in uppercase or lowercase.

Input Specification:
The first line contains a single integer *n* (1<=≤<=*n*<=≤<=100) — the number of characters in the string.

The second line contains the string. The string consists only of uppercase and lowercase Latin letters.

Output Specification:
Output "YES", if the string is a pangram and "NO" otherwise.

Demo Input:
['12\ntoosmallword\n', '35\nTheQuickBrownFoxJumpsOverTheLazyDog\n']

Demo Output:
['NO\n', 'YES\n']

Note:
none

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.

For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".

Note it is allowed to split the string s to the strings only of length p or to the strings only of length q (see the second sample test).


-----Input-----

The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100).

The second line contains the string s consists of lowercase and uppercase latin letters and digits.


-----Output-----

If it's impossible to split the string s to the strings of length p and q print the only number "-1".

Otherwise in the first line print integer k — the number of strings in partition of s.

Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be in order of their appearing in string s — from left to right.

If there are several solutions print any of them.


-----Examples-----
Input
5 2 3
Hello

Output
2
He
llo

Input
10 9 5
Codeforces

Output
2
Codef
orces

Input
6 4 5
Privet

Output
-1

Input
8 1 1
abacabac

Output
8
a
b
a
c
a
b
a
c

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
A (1-indexed) string S of length N is said to be anti-palindrome if, for each 1 ≤ i ≤ N, S_{i} \ne S_{(N + 1 - i)}.

You are given a string S of length N (consisting of lowercase Latin letters only). Rearrange the string to convert it into an anti-palindrome or determine that there is no rearrangement which is an anti-palindrome.

If there are multiple rearrangements of the string which are anti-palindromic, print any of them.

------ Input Format ------ 

- The first line of input contains a single integer T — the number of test cases. The description of T test cases follows.
- The first line of each test case contains an integer N — the length of the string S.
- The second line of each test case contains the string S.

------ Output Format ------ 

For each test case, if it is possible to rearrange S to convert it into an anti-palindrome, print YES in the first line and print the rearranged string in the second line. Otherwise, print NO.

You may print each character of YES and NO in uppercase or lowercase (for e.g. yes, yEs, Yes will be considered identical).

If there are multiple rearrangements of the string which are anti-palindromic, print any of them.

------ Constraints ------ 

$1 ≤ T ≤ 10^{4}$
$1 ≤ N ≤ 10^{5}$
$S$ contains only lowercase Latin letters
- It is guaranteed that the sum of $N$ over all test cases does not exceed $2 \cdot 10^{5}$.

----- Sample Input 1 ------ 
4
3
abc
8
abccccdd
4
xyyx
6
ppppqr

----- Sample Output 1 ------ 
NO
YES
abddcccc
YES
xxyy
NO

----- explanation 1 ------ 
Test case $1$: No matter how the string is rearranged, the condition $S_{i} \ne S_{(N + 1 - i)}$ will not be satisfied for $i = 2$.

Test case $2$: One possible rearrangement of the string which is anti-palindromic is abddcccc. Other answers, such as ccdaccdb, will also be accepted.

Test case $3$: One possible rearrangement of the string which is anti-palindromic is xxyy.

Test case $4$: It can be shown that none of the rearrangements of $A$ is anti-palindromic.

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

Time Limit: None seconds

Memory Limit: None megabytes

Problem Description:
You are given two multisets *A* and *B*. Each multiset has exactly *n* integers each between 1 and *n* inclusive. Multisets may contain multiple copies of the same number.

You would like to find a nonempty subset of *A* and a nonempty subset of *B* such that the sum of elements in these subsets are equal. Subsets are also multisets, i.e. they can contain elements with equal values.

If no solution exists, print <=-<=1. Otherwise, print the indices of elements in any such subsets of *A* and *B* that have the same sum.

Input Specification:
The first line of the input contains a single integer *n* (1<=≤<=*n*<=≤<=1<=000<=000) — the size of both multisets.

The second line contains *n* integers, denoting the elements of *A*. Each element will be between 1 and *n* inclusive.

The third line contains *n* integers, denoting the elements of *B*. Each element will be between 1 and *n* inclusive.

Output Specification:
If there is no solution, print a single integer <=-<=1. Otherwise, your solution should be printed on four lines.

The first line should contain a single integer *k**a*, the size of the corresponding subset of *A*. The second line should contain *k**a* distinct integers, the indices of the subset of *A*.

The third line should contain a single integer *k**b*, the size of the corresponding subset of *B*. The fourth line should contain *k**b* distinct integers, the indices of the subset of *B*.

Elements in both sets are numbered from 1 to *n*. If there are multiple possible solutions, print any of them.

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

Demo Output:
['1\n2\n3\n5 8 10\n', '2\n2 3\n2\n3 5\n']

Note:
none

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

Time Limit: None seconds

Memory Limit: None megabytes

Problem Description:
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.

Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels.

Two lines rhyme if their suffixes that start from the *k*-th vowels (counting from the end) match. If a line has less than *k* vowels, then such line can't rhyme with any other line. For example, if *k*<==<=1, lines *commit* and *hermit* rhyme (the corresponding suffixes equal *it*), and if *k*<==<=2, they do not rhyme (*ommit*<=≠<=*ermit*).

Today on a literature lesson Vera learned that quatrains can contain four different schemes of rhymes, namely the following ones (the same letters stand for rhyming lines): 
 -  Clerihew (*aabb*); -  Alternating (*abab*); -  Enclosed (*abba*). 
If all lines of a quatrain pairwise rhyme, then the quatrain can belong to any rhyme scheme (this situation is represented by *aaaa*).

If all quatrains of a poem belong to the same rhyme scheme, then we can assume that the whole poem belongs to this rhyme scheme. If in each quatrain all lines pairwise rhyme, then the rhyme scheme of the poem is *aaaa*. Let us note that it doesn't matter whether lines from different quatrains rhyme with each other or not. In other words, it is possible that different quatrains aren't connected by a rhyme.

Vera got a long poem as a home task. The girl has to analyse it and find the poem rhyme scheme. Help Vera cope with the task.

Input Specification:
The first line contains two integers *n* and *k* (1<=≤<=*n*<=≤<=2500, 1<=≤<=*k*<=≤<=5) — the number of quatrains in the poem and the vowel's number, correspondingly. Next 4*n* lines contain the poem. Each line is not empty and only consists of small Latin letters. The total length of the lines does not exceed 104.

If we assume that the lines are numbered starting from 1, then the first quatrain contains lines number 1, 2, 3, 4; the second one contains lines number 5, 6, 7, 8; and so on.

Output Specification:
Print the rhyme scheme of the poem as "aabb", "abab", "abba", "aaaa"; or "NO" if the poem does not belong to any of the above mentioned schemes.

Demo Input:
['1 1\nday\nmay\nsun\nfun\n', '1 1\nday\nmay\ngray\nway\n', '2 1\na\na\na\na\na\na\ne\ne\n', '2 1\nday\nmay\nsun\nfun\ntest\nhill\nfest\nthrill\n']

Demo Output:
['aabb\n', 'aaaa\n', 'aabb\n', 'NO\n']

Note:
In the last sample both quatrains have rhymes but finding the common scheme is impossible, so the answer is "NO".

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
During the quarantine, Sicromoft has more free time to create the new functions in "Celex-2021". The developers made a new function GAZ-GIZ, which infinitely fills an infinite table to the right and down from the upper left corner as follows:

 [Image]  The cell with coordinates $(x, y)$ is at the intersection of $x$-th row and $y$-th column. Upper left cell $(1,1)$ contains an integer $1$.

The developers of the SUM function don't sleep either. Because of the boredom, they teamed up with the developers of the RAND function, so they added the ability to calculate the sum on an arbitrary path from one cell to another, moving down or right. Formally, from the cell $(x,y)$ in one step you can move to the cell $(x+1, y)$ or $(x, y+1)$. 

After another Dinwows update, Levian started to study "Celex-2021" (because he wants to be an accountant!). After filling in the table with the GAZ-GIZ function, he asked you to calculate the quantity of possible different amounts on the path from a given cell $(x_1, y_1)$ to another given cell $(x_2, y_2$), if you can only move one cell down or right.

Formally, consider all the paths from the cell $(x_1, y_1)$ to cell $(x_2, y_2)$ such that each next cell in the path is located either to the down or to the right of the previous one. Calculate the number of different sums of elements for all such paths.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 57179$) — the number of test cases.

Each of the following $t$ lines contains four natural numbers $x_1$, $y_1$, $x_2$, $y_2$ ($1 \le x_1 \le x_2 \le 10^9$, $1 \le y_1 \le y_2 \le 10^9$) — coordinates of the start and the end cells. 


-----Output-----

For each test case, in a separate line, print the number of possible different sums on the way from the start cell to the end cell.


-----Example-----
Input
4
1 1 2 2
1 2 2 4
179 1 179 100000
5 7 5 7

Output
2
3
1
1



-----Note-----

In the first test case there are two possible sums: $1+2+5=8$ and $1+3+5=9$. [Image]

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
On the way to Lanka, Ram and co encountered another interesting path. The path was laid with numbered rocks which were to be jumped over. The number denoted the maximum jump length that could be made by the person standing on that rock. For instance, if Ram was standing on a rock numbered 2, he could either make a jump of 1 and move to its immediate rock ahead of it or make a jump of 2 and move to the rock located 2 rocks ahead.
Since, they were running out of time, Hanuman wanted to find out the minimum number of jumps they would have to make to reach the end of the path, given a list of numbers labeled on the rocks. Let us help Hanuman find the number.

INPUT:
an integer T (1 ≤ T ≤ 1000) : number of testcases
Each test case is represented by a number N(2 ≤ N ≤ 1000) denoting the number of rocks followed by an array of numbers rockNum[] labeled on those N rocks.
The elements in the array rockNum[] will be less than or equal to N and greater than 0.

OUTPUT:
For each test case, output the minimum number of jumps required to reach the goal(the last element of the array) from the starting position(first element of the array). 

SAMPLE INPUT
2
5
2 3 1 1 4
11
1 3 5 8 9 2 6 7 6 8 9

SAMPLE OUTPUT
2
3

Explanation
In the first test case, Ram could make a jump as such (0,2,3,4 : jump 2 to index 2,jump 1 to index 3 and then jump 1 to index 4) or a jump as such (0,1,4 : jump 1 to index 1, jump 3 to index 4). Since the latter one involves the least number of jumps, the answer is 2.
In the second test case, the optimal jump is (1,3,8,9). So the answer is 3 .

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

Time Limit: None seconds

Memory Limit: None megabytes

Problem Description:
Unary is a minimalistic Brainfuck dialect in which programs are written using only one token. 

Brainfuck programs use 8 commands: "+", "-", "[", "]", "&lt;", "&gt;", "." and "," (their meaning is not important for the purposes of this problem). Unary programs are created from Brainfuck programs using the following algorithm. First, replace each command with a corresponding binary code, using the following conversion table: 
 -  "&gt;" <=→<= 1000, -  "&lt;" <=→<= 1001, -  "+" <=→<= 1010, -  "-" <=→<= 1011, -  "." <=→<= 1100, -  "," <=→<= 1101, -  "[" <=→<= 1110, -  "]" <=→<= 1111. 
Next, concatenate the resulting binary codes into one binary number in the same order as in the program. Finally, write this number using unary numeral system — this is the Unary program equivalent to the original Brainfuck one.

You are given a Brainfuck program. Your task is to calculate the size of the equivalent Unary program, and print it modulo 1000003 (106<=+<=3).

Input Specification:
The input will consist of a single line *p* which gives a Brainfuck program. String *p* will contain between 1 and 100 characters, inclusive. Each character of *p* will be "+", "-", "[", "]", "&lt;", "&gt;", "." or ",".

Output Specification:
Output the size of the equivalent Unary program modulo 1000003 (106<=+<=3).

Demo Input:
[',.\n', '++++[&gt;,.&lt;-]\n']

Demo Output:
['220\n', '61425\n']

Note:
To write a number *n* in unary numeral system, one simply has to write 1 *n* times. For example, 5 written in unary system will be 11111.

In the first example replacing Brainfuck commands with binary code will give us 1101 1100. After we concatenate the codes, we'll get 11011100 in binary system, or 220 in decimal. That's exactly the number of tokens in the equivalent Unary program.

Write Python code to solve the problem. Present the code in 
```python
Your code
```
at the end.
Passer ratings are the generally accepted standard for evaluating NFL quarterbacks.
I knew a rating of 100 is pretty good, but never knew what makes up the rating.
So out of curiosity I took a look at the wikipedia page and had an idea or my first kata: https://en.wikipedia.org/wiki/Passer_rating

## Formula

There are four parts to the NFL formula:
```python
A = ((Completions / Attempts) - .3) * 5
B = ((Yards / Attempts) - 3) * .25
C = (Touchdowns / Attempt) * 20
D = 2.375 - ((Interceptions / Attempts) * 25)
```
However, if the result of any calculation is greater than `2.375`, it is set to `2.375`. If the result is a negative number, it is set to zero.

Finally the passer rating is: `((A + B + C + D) / 6) * 100`

Return the rating rounded to the nearest tenth.

## Example

Last year Tom Brady had 432 attempts, 3554 yards, 291 completions, 28 touchdowns, and 2 interceptions.
His passer rating was 112.2

Happy coding!

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