sample_inputs stringlengths 5 384 | input_specification stringlengths 48 911 | src_uid stringlengths 32 32 | source_code stringlengths 29 6.77k | sample_outputs stringlengths 5 393 | lang_cluster stringclasses 4
values | notes stringlengths 30 1.52k β | output_specification stringlengths 25 681 | description stringlengths 140 2.49k | human_testcases stringlengths 243 50.8k | human_pass_rate float64 100 100 | human_line_coverage float64 100 100 | human_branch_coverage float64 100 100 | human_sample_testcases_1 stringlengths 190 3.11k | human_sample_testcases_2 stringlengths 190 3.11k | human_sample_testcases_3 stringlengths 190 3.11k | human_sample_testcases_4 stringlengths 190 3.11k | human_sample_testcases_5 stringlengths 190 3.11k | human_sample_pass_rate_1 float64 100 100 | human_sample_pass_rate_2 float64 100 100 | human_sample_pass_rate_3 float64 100 100 | human_sample_pass_rate_4 float64 100 100 | human_sample_pass_rate_5 float64 100 100 | human_sample_line_coverage_1 float64 52.2 100 | human_sample_line_coverage_2 float64 60 100 | human_sample_line_coverage_3 float64 50 100 | human_sample_line_coverage_4 float64 43.5 100 | human_sample_line_coverage_5 float64 21.7 100 | human_sample_branch_coverage_1 float64 45.5 100 | human_sample_branch_coverage_2 float64 45.8 100 | human_sample_branch_coverage_3 float64 16.7 100 | human_sample_branch_coverage_4 float64 36.4 100 | human_sample_branch_coverage_5 float64 18.2 100 | id int64 1 400 | human_sample_pass_rate float64 100 100 | human_sample_line_coverage float64 47 100 | human_sample_branch_coverage float64 41.8 100 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
["6 3\n1 1 1 0 1 0", "5 2\n0 0 0 1 0"] | The first line of the input contains two integers n and a (1ββ€βaββ€βnββ€β100)Β β the number of cities and the index of city where Limak lives. The second line contains n integers t1,βt2,β...,βtn (0ββ€βtiββ€β1). There are ti criminals in the i-th city. | 4840d571d4ce6e1096bb678b6c100ae5 | #include<stdio.h>
int main()
{
int n,i,j,pos,counter;
int criminals[100];
counter=0;
scanf("%d%d",&n,&pos);
for(i=0;i<n;i++)
scanf("%d",&criminals[i]);
if(criminals[pos-1]==1)
counter+=1;
for(j=1;j<=i;j++)
{
if((pos-1-j>=0)&&(pos-1+j<n)&&((criminals[pos-1-j]&criminals[pos-1+j])==1))
counter+=2;
else if((pos-1-j>=0)&&(p... | ["3", "1"] | C | NoteIn the first sample, there are six cities and Limak lives in the third one (blue arrow below). Criminals are in cities marked red. Using the BCD gives Limak the following information: There is one criminal at distance 0 from the third cityΒ β Limak is sure that this criminal is exactly in the third city. There is... | Print the number of criminals Limak will catch. | There are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance between cities i and j is equal to |iβ-βj|.Limak is a police officer. He lives in a city a. His job is to catch criminals. It's hard because he doesn't know in which cities criminals are. Though, he knows that there ... | [{"input": "6 3\r\n1 1 1 0 1 0\r\n", "output": ["3"]}, {"input": "5 2\r\n0 0 0 1 0\r\n", "output": ["1"]}, {"input": "1 1\r\n1\r\n", "output": ["1"]}, {"input": "1 1\r\n0\r\n", "output": ["0"]}, {"input": "9 3\r\n1 1 1 1 1 1 1 1 0\r\n", "output": ["8"]}, {"input": "9 5\r\n1 0 1 0 1 0 1 0 1\r\n", "output": ["5"]}, {"inp... | 100 | 100 | 100 | [{'input': '6 3\r\n1 1 1 0 1 0\r\n', 'output': ['3']}, {'input': '98 24\r\n0 0 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1\r\n', 'output': ['39']}, {'input': '8 1\r\n1 0 1 ... | [{'input': '99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['24']}, {'input': '99 70\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... | [{'input': '6 3\r\n1 1 1 0 1 0\r\n', 'output': ['3']}, {'input': '1 1\r\n0\r\n', 'output': ['0']}, {'input': '100 60\r\n1 1 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 1 0 0\... | [{'input': '100 38\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['1']}, {'input': '100 1\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... | [{'input': '19 10\r\n0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1\r\n', 'output': ['4']}, {'input': '99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['2... | 100 | 100 | 100 | 100 | 100 | 93.75 | 100 | 93.75 | 93.75 | 100 | 83.33 | 100 | 95.83 | 83.33 | 95.83 | 1 | 100 | 96.25 | 91.664 |
["9 7 3 8", "2 7 3 7", "30 6 17 19"] | The only line contains four integer numbers $$$n$$$, $$$m$$$, $$$a$$$ and $$$b$$$ ($$$1 \le n, m \le 10^{12}$$$, $$$1 \le a, b \le 100$$$), where $$$n$$$ is the initial number of the commentary boxes, $$$m$$$ is the number of delegations to come, $$$a$$$ is the fee to build a box and $$$b$$$ is the fee to demolish a bo... | c05d753b35545176ad468b99ff13aa39 | #include<stdio.h>
int main()
{
long long int c,a,n,m,b,d,e,f;
scanf("%lld%lld%lld%lld",&n,&m,&a,&b);
c=n%m;
d=m-n%m;
b=b*c;
a=a*d;
if(a>b)
printf("%lld\n",b);
else
printf("%lld\n",a);
return 0;
}
| ["15", "14", "0"] | C | NoteIn the first example organizers can build $$$5$$$ boxes to make the total of $$$14$$$ paying $$$3$$$ burles for the each of them.In the second example organizers can demolish $$$2$$$ boxes to make the total of $$$0$$$ paying $$$7$$$ burles for the each of them.In the third example organizers are already able to dis... | Output the minimal amount of burles organizers should pay to satisfy all the delegations (i.e. to make the number of the boxes be divisible by $$$m$$$). It is allowed that the final number of the boxes is equal to $$$0$$$. | Berland Football Cup starts really soon! Commentators from all over the world come to the event.Organizers have already built $$$n$$$ commentary boxes. $$$m$$$ regional delegations will come to the Cup. Every delegation should get the same number of the commentary boxes. If any box is left unoccupied then the delegatio... | [{"input": "9 7 3 8\r\n", "output": ["15"]}, {"input": "2 7 3 7\r\n", "output": ["14"]}, {"input": "30 6 17 19\r\n", "output": ["0"]}, {"input": "500000000001 1000000000000 100 100\r\n", "output": ["49999999999900"]}, {"input": "1000000000000 750000000001 10 100\r\n", "output": ["5000000000020"]}, {"input": "1000000000... | 100 | 100 | 100 | [{'input': '7 3 100 1\r\n', 'output': ['1']}, {'input': '7 2 1 2\r\n', 'output': ['1']}, {'input': '100000000000 3 1 1\r\n', 'output': ['1']}, {'input': '957747787 424238336 87 93\r\n', 'output': ['10162213695']}, {'input': '10 12 2 1\r\n', 'output': ['4']}] | [{'input': '1 1 1 1\r\n', 'output': ['0']}, {'input': '100 3 2 5\r\n', 'output': ['4']}, {'input': '10000000001 2 1 1\r\n', 'output': ['1']}, {'input': '5 5 2 3\r\n', 'output': ['0']}, {'input': '30 6 17 19\r\n', 'output': ['0']}] | [{'input': '100 7 1 1\r\n', 'output': ['2']}, {'input': '29 5 4 9\r\n', 'output': ['4']}, {'input': '25 7 100 1\r\n', 'output': ['4']}, {'input': '100 3 5 2\r\n', 'output': ['2']}, {'input': '70 4 1 1\r\n', 'output': ['2']}] | [{'input': '7 2 100 5\r\n', 'output': ['5']}, {'input': '7 3 100 1\r\n', 'output': ['1']}, {'input': '70 4 1 1\r\n', 'output': ['2']}, {'input': '100 7 1 1\r\n', 'output': ['2']}, {'input': '999999999999 10000000007 100 100\r\n', 'output': ['70100']}] | [{'input': '1000000000000 3 99 99\r\n', 'output': ['99']}, {'input': '15 4 4 10\r\n', 'output': ['4']}, {'input': '1000000000000 2 1 1\r\n', 'output': ['0']}, {'input': '3205261341 718648876 58 11\r\n', 'output': ['3637324207']}, {'input': '10000000001 2 1 1\r\n', 'output': ['1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 2 | 100 | 100 | 100 |
["3000"] | The only line of the input contains one integer n (1ββ€βnββ€β1018) β the prediction on the number of people who will buy the game. | 8551308e5ff435e0fc507b89a912408a | #include<stdio.h>
int main()
{
long long int i,j,n,l,a,k;
scanf("%lld",&n);
k=2520;
a=n/k;
printf("%lld\n",a);
return 0;
} | ["1"] | C | null | Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10. | IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer ... | [{"input": "3000\r\n", "output": ["1"]}, {"input": "2520\r\n", "output": ["1"]}, {"input": "2519\r\n", "output": ["0"]}, {"input": "2521\r\n", "output": ["1"]}, {"input": "1\r\n", "output": ["0"]}, {"input": "314159265\r\n", "output": ["124666"]}, {"input": "718281828459045235\r\n", "output": ["285032471610732"]}, {"in... | 100 | 100 | 100 | [{'input': '2521\r\n', 'output': ['1']}, {'input': '2520\r\n', 'output': ['1']}, {'input': '3628800\r\n', 'output': ['1440']}, {'input': '2519\r\n', 'output': ['0']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}] | [{'input': '3000\r\n', 'output': ['1']}, {'input': '2519\r\n', 'output': ['0']}, {'input': '987654321234567890\r\n', 'output': ['391926317950225']}, {'input': '1\r\n', 'output': ['0']}, {'input': '1000000000000000000\r\n', 'output': ['396825396825396']}] | [{'input': '504000000000000000\r\n', 'output': ['200000000000000']}, {'input': '2521\r\n', 'output': ['1']}, {'input': '3000\r\n', 'output': ['1']}, {'input': '1\r\n', 'output': ['0']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}] | [{'input': '1000000000000000000\r\n', 'output': ['396825396825396']}, {'input': '987654321234567890\r\n', 'output': ['391926317950225']}, {'input': '3628800\r\n', 'output': ['1440']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}, {'input': '314159265\r\n', 'output': ['124666']}] | [{'input': '2520\r\n', 'output': ['1']}, {'input': '1000000000000000000\r\n', 'output': ['396825396825396']}, {'input': '1\r\n', 'output': ['0']}, {'input': '3000\r\n', 'output': ['1']}, {'input': '3628800\r\n', 'output': ['1440']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 3 | 100 | 100 | 100 |
["2 6 2 2", "1 9 1 2"] | The first line of the input contains four integers d, L, v1, v2 (1ββ€βd,βL,βv1,βv2ββ€β10β000,βdβ<βL)Β β Luke's width, the initial position of the second press and the speed of the first and second presses, respectively. | f34f3f974a21144b9f6e8615c41830f5 | #include<stdio.h>
main(){
double d,l,v1,v2;
scanf("%lf %lf %lf %lf",&d,&l,&v1,&v2);
printf("%0.10lf",(l-d)/(v1+v2));
}
| ["1.00000000000000000000", "2.66666666666666650000"] | C | NoteIn the first sample Luke should stay exactly in the middle of the segment, that is at coordinates [2;4], as the presses move with the same speed.In the second sample he needs to occupy the position . In this case both presses move to his edges at the same time. | Print a single real valueΒ β the maximum period of time Luke can stay alive for. Your answer will be considered correct if its absolute or relative error does not exceed 10β-β6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if . | Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a straight line, the presses are initially at coordinates 0 and L, and they move towards each other wi... | [{"input": "2 6 2 2\r\n", "output": ["1.0000000", "1.000000", "1.0", "1.00000000000000000000", "1.0000000000"]}, {"input": "1 9 1 2\r\n", "output": ["2.66666666666666666674", "2.66666666667", "2.6666666666666665", "2.6666667", "2.66666666666666650000", "2.666667", "2.6666666667", "2.66666666666666651864"]}, {"input": "... | 100 | 100 | 100 | [{'input': '6612 9565 3380 2288\r\n', 'output': ['0.52099505998588567399', '0.52099505998588568900', '0.520995', '0.5209950599858857', '0.520995059986', '0.5209951', '0.5209950600', '0.52099505998588569000']}, {'input': '2255 7902 8891 429\r\n', 'output': ['0.605901', '0.6059012876', '0.605901287553648', '0.6059013']},... | [{'input': '1854 3280 1481 2140\r\n', 'output': ['0.393814', '0.3938139', '0.39381386357359843000', '0.393813863574', '0.39381386357359843', '0.39381386357359845346', '0.3938138636', '0.39381386357359843275']}, {'input': '4600 9696 5634 8248\r\n', 'output': ['0.36709407866301685000', '0.3670941', '0.367094', '0.3670940... | [{'input': '6745 9881 2149 9907\r\n', 'output': ['0.2601194426011944', '0.2601194426', '0.2601194', '0.260119']}, {'input': '5526 6455 197 4191\r\n', 'output': ['0.2117137648131267', '0.21171376481312670359', '0.2117137648', '0.211713764813', '0.2117138', '0.21171376481312670000', '0.211714', '0.21171376481312670920']}... | [{'input': '4400 8021 6895 2089\r\n', 'output': ['0.403049866429', '0.40304986642920748000', '0.40304986642920748174', '0.4030498664292075', '0.40304986642920747995', '0.403050', '0.4030498664', '0.4030499']}, {'input': '8957 9525 8634 107\r\n', 'output': ['0.064981', '0.0649811', '0.06498112344125385', '0.064981123441... | [{'input': '1 10000 1 1\r\n', 'output': ['4999.50000000000000000000', '4999.500000', '4999.5', '4999.5000000', '4999.5000000000']}, {'input': '1 9 1 2\r\n', 'output': ['2.66666666666666666674', '2.66666666667', '2.6666666666666665', '2.6666667', '2.66666666666666650000', '2.666667', '2.6666666667', '2.66666666666666651... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 4 | 100 | 100 | 100 |
["2"] | The only line of the input contains a single integer n (2ββ€βnββ€β2Β·1018) β the power in which you need to raise number 5. | dcaff75492eafaf61d598779d6202c9d | #include <stdio.h>
#include <math.h>
int main(){
int i;
scanf("%d",&i);
printf("25");
return 0;
}
| ["25"] | C | null | Output the last two digits of 5n without spaces between them. | The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" β the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of course, n can be rather big, and one cannot find the power using ... | [{"input": "2\r\n", "output": ["25"]}, {"input": "7\r\n", "output": ["25"]}, {"input": "1000000000000000000\r\n", "output": ["25"]}, {"input": "2000000000000000000\r\n", "output": ["25"]}, {"input": "987654321012345678\r\n", "output": ["25"]}] | 100 | 100 | 100 | [{'input': '7\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}] | [{'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}] | [{'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}] | [{'input': '7\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}] | [{'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 5 | 100 | 100 | 100 |
["5\n()))()", "3\n(()", "2\n((("] | The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) β the half-length of the resulting regular bracket sequences (the resulting sequences must have length equal to $$$2n$$$). The second line of the input contains one string $$$s$$$ ($$$1 \le |s| \le 200$$$) β the string $$$s$$$ that should ... | 590a49a7af0eb83376ed911ed488d7e5 | #include <stdio.h>
#include <string.h>
enum { BIG = 1000000007 };
int n;
char s[240];
int slen;
int dp[201][101];
int next[201][2];
int fail[201];
void nextstep(int eo) {
int i, j;
for (i = 0; i <= slen; i++) {
int lp = next[i][0];
int rp = next[i][1];
for (j = eo; j <= n; j+=2) {
... | ["5", "4", "0"] | C | NoteAll regular bracket sequences satisfying the conditions above for the first example: "(((()))())"; "((()()))()"; "((()))()()"; "(()(()))()"; "()((()))()". All regular bracket sequences satisfying the conditions above for the second example: "((()))"; "(()())"; "(())()"; "()(())". And there is no regular ... | Print only one integer β the number of regular bracket sequences containing the given bracket sequence $$$s$$$ as a substring. Since this number can be huge, print it modulo $$$10^9+7$$$ ($$$1000000007$$$). | You are given a bracket sequence $$$s$$$ (not necessarily a regular one). A bracket sequence is a string containing only characters '(' and ')'.A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1' and '+' between the original character... | [{"input": "5\r\n()))()\r\n", "output": ["5"]}, {"input": "3\r\n(()\r\n", "output": ["4"]}, {"input": "2\r\n(((\r\n", "output": ["0"]}, {"input": "100\r\n()(()))))(()((((()())()))(()))()()))(((()))))))))(\r\n", "output": ["979898526"]}, {"input": "100\r\n()(()(()((()(()(()()()(()((()))())())))()))())()()\r\n", "output"... | 100 | 100 | 100 | [{'input': '20\r\n()(()()())\r\n', 'output': ['296672330']}, {'input': '100\r\n()()()(((((()(()((((()((((((()()()((()()(()()()(((()()((()()((()()()))()()()))()))))())()())()()()())()()()())())())))())()())())))())()))))()()()()()\r\n', 'output': ['264738339']}, {'input': '100\r\n()(()())()(())))()())()(())((()(()()((()... | [{'input': '100\r\n(()))(()())()()((())(()((()()))(())()(((((()(((()()))())))))(())((((()()()()()))(()))(())(())(()))((\r\n', 'output': ['599470552']}, {'input': '20\r\n()(()()())\r\n', 'output': ['296672330']}, {'input': '1\r\n(((\r\n', 'output': ['0']}, {'input': '8\r\n(\r\n', 'output': ['1430']}, {'input': '100\r\n(... | [{'input': '18\r\n)\r\n', 'output': ['477638700']}, {'input': '2\r\n)\r\n', 'output': ['2']}, {'input': '20\r\n()(()()())\r\n', 'output': ['296672330']}, {'input': '14\r\n)\r\n', 'output': ['2674440']}, {'input': '15\r\n(\r\n', 'output': ['9694845']}] | [{'input': '100\r\n))\r\n', 'output': ['558488486']}, {'input': '100\r\n()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()\r\n', 'output': ['1']}, {'input': '100\r\n()(()... | [{'input': '100\r\n()(()(()((()(()(()()()(()((()))())())))()))())()()\r\n', 'output': ['711757760']}, {'input': '32\r\n()((()()()())())\r\n', 'output': ['468509380']}, {'input': '100\r\n((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((... | 100 | 100 | 100 | 100 | 100 | 94.87 | 94.87 | 100 | 100 | 100 | 95.45 | 95.45 | 100 | 100 | 100 | 6 | 100 | 97.948 | 98.18 |
["8 1 1", "8 1 10"] | The only line contains three integers n, x and y (1ββ€βnββ€β107, 1ββ€βx,βyββ€β109) β the number of letters 'a' in the input file and the parameters from the problem statement. | 0f270af00be2a523515d5e7bd66800f6 | #include<stdio.h>
#include<stdlib.h>
int main()
{
unsigned long long n, x, y;
unsigned long nl, xl, yl;
fscanf(stdin, "%ld %ld %ld", &nl, &xl, &yl);
n = (unsigned long long)nl;
x = (unsigned long long)xl;
y = (unsigned long long)yl;
unsigned long long* f = malloc(10000001*sizeof(unsigned... | ["4", "8"] | C | null | Print the only integer t β the minimum amount of time needed to generate the input file. | zscoder wants to generate an input file for some programming competition problem.His input is a string consisting of n letters 'a'. He is too lazy to write a generator so he will manually generate the input in a text editor.Initially, the text editor is empty. It takes him x seconds to insert or delete a letter 'a' fro... | [{"input": "8 1 1\r\n", "output": ["4"]}, {"input": "8 1 10\r\n", "output": ["8"]}, {"input": "10 62 99\r\n", "output": ["384"]}, {"input": "88 417 591\r\n", "output": ["4623"]}, {"input": "57 5289 8444\r\n", "output": ["60221"]}, {"input": "382 81437847 324871127\r\n", "output": ["2519291691"]}, {"input": "244 5751543... | 100 | 100 | 100 | [{'input': '11478 29358 26962\r\n', 'output': ['556012']}, {'input': '57 5289 8444\r\n', 'output': ['60221']}, {'input': '382 81437847 324871127\r\n', 'output': ['2519291691']}, {'input': '10000000 1 100\r\n', 'output': ['1757']}, {'input': '10000000 998 998\r\n', 'output': ['30938']}] | [{'input': '9917781 1 1\r\n', 'output': ['35']}, {'input': '382 81437847 324871127\r\n', 'output': ['2519291691']}, {'input': '85 902510038 553915152\r\n', 'output': ['6933531064']}, {'input': '8 1 10\r\n', 'output': ['8']}, {'input': '10000000 1 1000000000\r\n', 'output': ['10000000']}] | [{'input': '7186329 608148870 290497442\r\n', 'output': ['12762929866']}, {'input': '4528217 187553422 956731625\r\n', 'output': ['21178755627']}, {'input': '9999999 1 2\r\n', 'output': ['54']}, {'input': '88 417 591\r\n', 'output': ['4623']}, {'input': '1926 84641582 820814219\r\n', 'output': ['7184606427']}] | [{'input': '483867 138842067 556741142\r\n', 'output': ['10712805143']}, {'input': '8 1 10\r\n', 'output': ['8']}, {'input': '10000000 1 1000\r\n', 'output': ['14224']}, {'input': '4314870 1000000000 1\r\n', 'output': ['7000000022']}, {'input': '9917781 1 1\r\n', 'output': ['35']}] | [{'input': '483867 138842067 556741142\r\n', 'output': ['10712805143']}, {'input': '10000000 1 10\r\n', 'output': ['214']}, {'input': '85 902510038 553915152\r\n', 'output': ['6933531064']}, {'input': '3768 561740421 232937477\r\n', 'output': ['5042211408']}, {'input': '10000000 1 1\r\n', 'output': ['31']}] | 100 | 100 | 100 | 100 | 100 | 86.67 | 86.67 | 86.67 | 100 | 100 | 75 | 81.25 | 75 | 100 | 93.75 | 7 | 100 | 92.002 | 85 |
["047", "16", "472747"] | The single line contains a non-empty string s whose length can range from 1 to 50, inclusive. The string only contains digits. The string can contain leading zeroes. | 639b8b8d0dc42df46b139f0aeb3a7a0a | #include <stdio.h>
# include <string.h>
int main()
{
char ch[100];
scanf("%s",&ch);
int i,c1=0,c2=0;
for(i=0;i<strlen(ch);i++)
{
if(ch[i]==4+48)
c1++;
else if(ch[i]==7+48)
c2++;
}
if(c1==0 && c2==0)
printf("-1\n");
else if(c1>... | ["4", "-1", "7"] | C | NoteThe lexicographical comparison of strings is performed by the < operator in the modern programming languages. String x is lexicographically less than string y either if x is a prefix of y, or exists such i (1ββ€βiββ€βmin(|x|,β|y|)), that xiβ<βyi and for any j (1ββ€βjβ<βi) xjβ=βyj. Here |a| denotes the length ... | In the only line print the answer to Petya's problem. If the sought string does not exist, print "-1" (without quotes). | Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya was delivered a string s, containing only digits. He needs to find a string that represe... | [{"input": "047\r\n", "output": ["4"]}, {"input": "16\r\n", "output": ["-1"]}, {"input": "472747\r\n", "output": ["7"]}, {"input": "1925\r\n", "output": ["-1"]}, {"input": "5486846414848445484\r\n", "output": ["4"]}, {"input": "516160414\r\n", "output": ["4"]}, {"input": "9458569865994896\r\n", "output": ["4"]}, {"inpu... | 100 | 100 | 100 | [{'input': '74747474747474747474747474747474747474747474747474\r\n', 'output': ['4']}, {'input': '290732082244359495795943967215788554387079\r\n', 'output': ['7']}, {'input': '0000000000000000000000000000000000000047\r\n', 'output': ['4']}, {'input': '00000000000000000000000000000000000000000000000000\r\n', 'output': [... | [{'input': '40\r\n', 'output': ['4']}, {'input': '047\r\n', 'output': ['4']}, {'input': '637789221789855555993957058\r\n', 'output': ['7']}, {'input': '44\r\n', 'output': ['4']}, {'input': '0445460407410702955646485\r\n', 'output': ['4']}] | [{'input': '9589\r\n', 'output': ['-1']}, {'input': '74747474747474747474747474747474747474747474747474\r\n', 'output': ['4']}, {'input': '44101164480392494025995467\r\n', 'output': ['4']}, {'input': '0445460407410702955646485\r\n', 'output': ['4']}, {'input': '5486846414848445484\r\n', 'output': ['4']}] | [{'input': '0445460407410702955646485\r\n', 'output': ['4']}, {'input': '538772857\r\n', 'output': ['7']}, {'input': '472747\r\n', 'output': ['7']}, {'input': '11536708648794535307468278326553811\r\n', 'output': ['7']}, {'input': '637789221789855555993957058\r\n', 'output': ['7']}] | [{'input': '07\r\n', 'output': ['7']}, {'input': '538772857\r\n', 'output': ['7']}, {'input': '74\r\n', 'output': ['4']}, {'input': '637789221789855555993957058\r\n', 'output': ['7']}, {'input': '23607019991994\r\n', 'output': ['4']}] | 100 | 100 | 100 | 100 | 100 | 100 | 92.86 | 92.86 | 92.86 | 92.86 | 91.67 | 91.67 | 83.33 | 91.67 | 91.67 | 8 | 100 | 94.288 | 90.002 |
["2 2\nRU", "1 2\nRU", "-1 1000000000\nLRRLU", "0 0\nD"] | The first line contains two integers a and b, (β-β109ββ€βa,βbββ€β109). The second line contains a string s (1ββ€β|s|ββ€β100, s only contains characters 'U', 'D', 'L', 'R') β the command. | 5d6212e28c7942e9ff4d096938b782bf | #include <stdio.h>
#include <string.h>
int a,b,l;
int x,y,xl,yl;
char s[105];
int w[105][2];
int al,bl;
int p(int a1,int b1,int x1,int y1)
{
if ((a1<0&&x1>0)||(a1>0&&x1<0))return 0;
if ((b1<0&&y1>0)||(b1>0&&y1<0))return 0;
return 1;
}
int main()
{
int i,j;
scanf ("%d%d",&a,&b);
scanf ... | ["Yes", "No", "Yes", "Yes"] | C | NoteIn the first and second test case, command string is "RU", so the robot will go right, then go up, then right, and then up and so on.The locations of its moves are (0, 0) βββ (1, 0) βββ (1, 1) βββ (2, 1) βββ (2, 2) βββ ...So it can reach (2, 2) but not (1, 2). | Print "Yes" if the robot will be located at (a,βb), and "No" otherwise. | Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all: 'U': go up, (x, y) βββ (x, y+1); 'D': go down, (x, y) βββ (x, y-1); 'L': go left, (x, y) βββ... | [{"input": "2 2\r\nRU\r\n", "output": ["Yes"]}, {"input": "1 2\r\nRU\r\n", "output": ["No"]}, {"input": "-1 1000000000\r\nLRRLU\r\n", "output": ["Yes"]}, {"input": "0 0\r\nD\r\n", "output": ["Yes"]}, {"input": "0 0\r\nUURRDL\r\n", "output": ["Yes"]}, {"input": "987654321 987654321\r\nUURRDL\r\n", "output": ["Yes"]}, {"... | 100 | 100 | 100 | [{'input': '485940814 728911221\r\nURURU\r\n', 'output': ['Yes']}, {'input': '1000000000 1000000000\r\nUURRDL\r\n', 'output': ['Yes']}, {'input': '-261597957 418556728\r\nLLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL\r\n', 'output': ['Yes']}, {'input': '-1000000000 -1000000000\r\nD... | [{'input': '4 7\r\nUURRDL\r\n', 'output': ['No']}, {'input': '999999999 -999999999\r\nRRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU\r\n', 'output': ['Yes']}, {'input': '4 4\r\nUURRDL\r\n', 'output': ['Yes']}, {'input': '1 1\r\nURDLDL\r\n', 'output': ['Yes']}, {'input':... | [{'input': '0 1\r\nUDLR\r\n', 'output': ['Yes']}, {'input': '-261597957 418556728\r\nLLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL\r\n', 'output': ['Yes']}, {'input': '-2 -2\r\nUURR\r\n', 'output': ['No']}, {'input': '987654321 987654321\r\nUURRDL\r\n', 'output': ['Yes']}, {'input'... | [{'input': '-843450986 632588242\r\nLURLULULRUDUDULRDDLUL\r\n', 'output': ['Yes']}, {'input': '-100 -100\r\nRU\r\n', 'output': ['No']}, {'input': '4 6\r\nUURRDL\r\n', 'output': ['Yes']}, {'input': '3 3\r\nUURR\r\n', 'output': ['No']}, {'input': '-2 -2\r\nUURR\r\n', 'output': ['No']}] | [{'input': '999999999 0\r\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\r\n', 'output': ['Yes']}, {'input': '-1 0\r\nR\r\n', 'output': ['No']}, {'input': '100 100\r\nRUL\r\n', 'output': ['No']}, {'input': '-1 1000000000\r\nLRRLU\r\n', 'output': ['Yes']}, {'input':... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 59.09 | 62.12 | 71.21 | 57.58 | 80.3 | 9 | 100 | 100 | 66.06 |
["5 3\n0 4 5 6 7", "1 0\n0", "5 0\n1 2 3 4 5"] | The first line contains two integers n and x (1ββ€βnββ€β100, 0ββ€βxββ€β100)Β β the size of the set Dr. Evil owns, and the desired MEX. The second line contains n distinct non-negative integers not exceeding 100 that represent the set. | 21f579ba807face432a7664091581cd8 | #include <stdio.h>
int main(){
int n,x,i,t;
scanf("%d %d", &n,&x);
int ans = x;
for(i = 0; i < n; i++){
scanf("%d", &t);
if(t < x) ans--;
else if(t==x)ans++;
}
printf("%d\n", ans);
return 0;
} | ["2", "1", "0"] | C | NoteFor the first test case Dr. Evil should add 1 and 2 to the set performing 2 operations.For the second test case Dr. Evil should erase 0 from the set. After that, the set becomes empty, so the MEX of it is 0.In the third test case the set is already evil. | The only line should contain one integerΒ β the minimal number of operations Dr. Evil should perform. | Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.Dr. Evil is interested in sets, He has a set of n integers. Dr. Evil calls a set of integers evil if the MEX of it is exactly x. the MEX of a ... | [{"input": "5 3\r\n0 4 5 6 7\r\n", "output": ["2"]}, {"input": "1 0\r\n0\r\n", "output": ["1"]}, {"input": "5 0\r\n1 2 3 4 5\r\n", "output": ["0"]}, {"input": "10 5\r\n57 1 47 9 93 37 76 70 78 15\r\n", "output": ["4"]}, {"input": "10 5\r\n99 98 93 97 95 100 92 94 91 96\r\n", "output": ["5"]}, {"input": "10 5\r\n1 2 3 4... | 100 | 100 | 100 | [{'input': '5 5\r\n1 2 3 4 5\r\n', 'output': ['2']}, {'input': '77 0\r\n38 76 24 74 42 88 29 75 96 46 90 32 59 97 98 60 41 57 80 37 100 49 25 63 95 31 61 68 53 78 27 66 84 48 94 83 30 26 36 99 71 62 45 47 70 28 35 54 34 85 79 43 91 72 86 33 67 92 77 65 69 52 82 55 87 64 56 40 50 44 51 73 89 81 58 93 39\r\n', 'output': ... | [{'input': '100 100\r\n79 13 21 11 3 87 28 40 29 4 96 34 8 78 61 46 33 45 99 30 92 67 22 97 39 86 73 31 74 44 62 55 57 2 54 63 80 69 25 48 77 98 17 93 15 16 89 12 43 23 37 95 14 38 83 90 49 56 72 10 20 0 50 71 70 88 19 1 76 81 52 41 82 68 85 47 6 7 35 60 18 64 75 84 27 9 65 91 94 42 53 24 66 26 59 36 51 32 5 58\r\n', '... | [{'input': '5 2\r\n1 2 3 4 5\r\n', 'output': ['2']}, {'input': '77 0\r\n51 5 81 62 30 22 11 0 83 16 79 85 52 70 69 10 8 47 58 3 24 34 44 14 82 66 99 17 28 31 64 67 23 49 94 45 4 12 27 15 21 6 43 72 87 2 63 92 35 39 59 9 90 78 93 20 65 36 60 89 50 41 61 84 77 86 76 100 38 68 53 97 96 95 7 19 88\r\n', 'output': ['1']}, {... | [{'input': '100 100\r\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54 39 15 26 83 44\r\n', ... | [{'input': '77 0\r\n12 75 31 71 44 8 3 82 21 77 50 29 57 74 40 10 15 42 84 2 100 9 28 72 92 0 49 11 90 55 17 36 19 54 68 52 4 69 97 91 5 39 59 45 89 62 53 83 16 94 76 60 95 47 30 51 7 48 20 70 67 32 58 78 63 34 56 93 99 88 24 1 66 22 25 14 13\r\n', 'output': ['1']}, {'input': '100 70\r\n91 82 8 85 26 25 95 97 40 87 81 ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 10 | 100 | 100 | 100 |
["1\n2\n1\n1\n10", "1\n2\n1\n1\n8"] | The input data contains integers vp,βvd,βt,βf and c, one per line (1ββ€βvp,βvdββ€β100, 1ββ€βt,βfββ€β10, 1ββ€βcββ€β1000). | c9c03666278acec35f0e273691fe0fff | #include<stdio.h>
int main(){
float vp,vd,t,f,c;
float phm,d=0,time=0;
int bijous=0;
scanf("%f%f%f%f%f",&vp,&vd,&t,&f,&c);
for(phm=t*vp;;){
//printf("%f\n",phm);
if(vd<=vp)
break;
phm+=phm*vp/(vd-vp);
if(phm>=c)
break;
else{
phm+=f*vp+(phm/vd)*vp;
bijous++;
}
... | ["2", "1"] | C | NoteIn the first case one hour after the escape the dragon will discover it, and the princess will be 1 mile away from the cave. In two hours the dragon will overtake the princess 2 miles away from the cave, and she will need to drop the first bijou. Return to the cave and fixing the treasury will take the dragon two m... | Output the minimal number of bijous required for the escape to succeed. | The princess is going to escape the dragon's cave, and she needs to plan it carefully.The princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover the escape after t hours and will chase the princess immediately. Looks like there's no chance to success, but the princess no... | [{"input": "1\r\n2\r\n1\r\n1\r\n10\r\n", "output": ["2"]}, {"input": "1\r\n2\r\n1\r\n1\r\n8\r\n", "output": ["1"]}, {"input": "5\r\n8\r\n1\r\n2\r\n100\r\n", "output": ["2"]}, {"input": "2\r\n100\r\n10\r\n10\r\n739\r\n", "output": ["22"]}, {"input": "17\r\n99\r\n2\r\n3\r\n293\r\n", "output": ["3"]}, {"input": "5\r\n5\r\... | 100 | 100 | 100 | [{'input': '30\r\n28\r\n4\r\n6\r\n9\r\n', 'output': ['0']}, {'input': '5\r\n8\r\n1\r\n2\r\n100\r\n', 'output': ['2']}, {'input': '49\r\n7\r\n2\r\n5\r\n326\r\n', 'output': ['0']}, {'input': '2\r\n100\r\n10\r\n10\r\n739\r\n', 'output': ['22']}, {'input': '87\r\n32\r\n3\r\n8\r\n754\r\n', 'output': ['0']}] | [{'input': '50\r\n15\r\n1\r\n3\r\n216\r\n', 'output': ['0']}, {'input': '13\r\n14\r\n3\r\n3\r\n79\r\n', 'output': ['0']}, {'input': '85\r\n45\r\n2\r\n1\r\n682\r\n', 'output': ['0']}, {'input': '35\r\n37\r\n9\r\n5\r\n792\r\n', 'output': ['0']}, {'input': '2\r\n1\r\n1\r\n1\r\n1000\r\n', 'output': ['0']}] | [{'input': '2\r\n1\r\n1\r\n1\r\n1000\r\n', 'output': ['0']}, {'input': '2\r\n1\r\n1\r\n1\r\n100\r\n', 'output': ['0']}, {'input': '13\r\n14\r\n3\r\n3\r\n79\r\n', 'output': ['0']}, {'input': '63\r\n4\r\n7\r\n1\r\n48\r\n', 'output': ['0']}, {'input': '2\r\n12\r\n6\r\n4\r\n907\r\n', 'output': ['10']}] | [{'input': '93\r\n19\r\n3\r\n3\r\n82\r\n', 'output': ['0']}, {'input': '1\r\n2\r\n1\r\n1\r\n8\r\n', 'output': ['1']}, {'input': '31\r\n40\r\n6\r\n1\r\n397\r\n', 'output': ['0']}, {'input': '51\r\n42\r\n10\r\n4\r\n901\r\n', 'output': ['0']}, {'input': '50\r\n15\r\n1\r\n3\r\n216\r\n', 'output': ['0']}] | [{'input': '38\r\n50\r\n1\r\n8\r\n761\r\n', 'output': ['1']}, {'input': '67\r\n34\r\n7\r\n4\r\n954\r\n', 'output': ['0']}, {'input': '79\r\n11\r\n2\r\n1\r\n144\r\n', 'output': ['0']}, {'input': '1\r\n100\r\n1\r\n1\r\n1000\r\n', 'output': ['152']}, {'input': '79\r\n10\r\n4\r\n6\r\n3\r\n', 'output': ['0']}] | 100 | 100 | 100 | 100 | 100 | 100 | 85.71 | 100 | 100 | 100 | 100 | 75 | 100 | 100 | 100 | 11 | 100 | 97.142 | 95 |
["3 2 8", "1 2 -18", "2 2 -1"] | The first line contains three space-separated integers: a,βb,βc (1ββ€βaββ€β5;Β 1ββ€βbββ€β10000;Β β-β10000ββ€βcββ€β10000). | e477185b94f93006d7ae84c8f0817009 | #include <stdio.h>
#include <math.h>
int chk(long long x)
{
int ret = 0;
while(x)
{
ret += (x%10);
x/=10;
}
return ret;
}
long long po(long long int a,long long x)
{
if(x == 0)
return 1;
long long temp;
temp = po(a,x/2);
temp *= temp;
if(x%2)
temp *= a;
return temp;
}
int main()
{
long long int a... | ["3\n10 2008 13726", "0", "4\n1 31 337 967"] | C | null | Print integer n β the number of the solutions that you've found. Next print n integers in the increasing order β the solutions of the given equation. Print only integer solutions that are larger than zero and strictly less than 109. | Little Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following problem as a punishment. Find all integer solutions x (0β<βxβ<β109) of the equation:xβ=βbΒ·s(x)aβ+βc,β where a, b, c are some predetermined constant values and function s(x) determines the sum of all digits i... | [{"input": "3 2 8\r\n", "output": ["3\r\n10 2008 13726"]}, {"input": "1 2 -18\r\n", "output": ["0"]}, {"input": "2 2 -1\r\n", "output": ["4\r\n1 31 337 967"]}, {"input": "1 1 0\r\n", "output": ["9\r\n1 2 3 4 5 6 7 8 9"]}, {"input": "1 37 963\r\n", "output": ["16\r\n1000 1111 1222 1333 1370 1407 1444 1481 1518 1555 1592... | 100 | 100 | 100 | [{'input': '1 1 -6708\r\n', 'output': ['0']}, {'input': '5 7698 5337\r\n', 'output': ['0']}, {'input': '2 28 12\r\n', 'output': ['2\r\n4044 7180']}, {'input': '1 1 0\r\n', 'output': ['9\r\n1 2 3 4 5 6 7 8 9']}, {'input': '3 1727 4771\r\n', 'output': ['1\r\n42124574']}] | [{'input': '4 1870 9912\r\n', 'output': ['0']}, {'input': '2 6828 -39\r\n', 'output': ['2\r\n7435653 17759589']}, {'input': '5 65 352\r\n', 'output': ['1\r\n208000352']}, {'input': '2 28 12\r\n', 'output': ['2\r\n4044 7180']}, {'input': '5 7698 5337\r\n', 'output': ['0']}] | [{'input': '3 1727 4771\r\n', 'output': ['1\r\n42124574']}, {'input': '5 3903 -9847\r\n', 'output': ['0']}, {'input': '1 37 963\r\n', 'output': ['16\r\n1000 1111 1222 1333 1370 1407 1444 1481 1518 1555 1592 1629 1666 1777 1888 1999']}, {'input': '5 5 -865\r\n', 'output': ['0']}, {'input': '2 8468 -3666\r\n', 'output': ... | [{'input': '5 36 -46\r\n', 'output': ['0']}, {'input': '4 1870 9912\r\n', 'output': ['0']}, {'input': '5 10000 10000\r\n', 'output': ['0']}, {'input': '4 9359 -3039\r\n', 'output': ['0']}, {'input': '5 5 13\r\n', 'output': ['1\r\n579281018']}] | [{'input': '3 1139 6335\r\n', 'output': ['2\r\n12134407 499999999']}, {'input': '2 6828 -39\r\n', 'output': ['2\r\n7435653 17759589']}, {'input': '5 5 -865\r\n', 'output': ['0']}, {'input': '1 2 -18\r\n', 'output': ['0']}, {'input': '3 1727 4771\r\n', 'output': ['1\r\n42124574']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 93.75 | 100 | 100 | 100 | 12 | 100 | 100 | 98.75 |
["1 6 1 2 1 6", "6 5 4 3 2 1", "10 10 1 1 10 10"] | The first line contains six integers n, m, x1, y1, x2, y2 β the board sizes and the coordinates of the first and second chips, correspondingly (1ββ€βn,βmββ€β100; 2ββ€βnβΓβm; 1ββ€βx1,βx2ββ€βn; 1ββ€βy1,βy2ββ€βm). The numbers in the line are separated by single spaces. It is guaranteed that the chips are located in different squ... | 41f6f90b7307d2383495441114fa8ea2 | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i, j, n, m, x1, y1, x2, y2;
scanf("%d %d %d %d %d %d", &n, &m, &x1, &y1, &x2, &y2);
i = abs(x1 - x2);
j = abs(y1 - y2);
if (i > j) {
int aux = i;
i = j;
j = aux;
}
if ((i <= 2 && j <= 4) || (i == 3 && j == 3... | ["First", "First", "Second"] | C | null | If the first player wins, print "First" without the quotes. Otherwise, print "Second" without the quotes. | Two players play a game. The game is played on a rectangular board with nβΓβm squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player aims to stop the first one with a tube of superglue.We'll describe th... | [{"input": "1 6 1 2 1 6\r\n", "output": ["First"]}, {"input": "6 5 4 3 2 1\r\n", "output": ["First"]}, {"input": "10 10 1 1 10 10\r\n", "output": ["Second"]}, {"input": "1 2 1 1 1 2\r\n", "output": ["First"]}, {"input": "4 4 1 4 4 1\r\n", "output": ["First"]}, {"input": "25 32 17 18 20 19\r\n", "output": ["First"]}, {"... | 100 | 100 | 100 | [{'input': '10 10 1 1 10 10\r\n', 'output': ['Second']}, {'input': '13 62 10 13 5 15\r\n', 'output': ['Second']}, {'input': '48 53 24 37 21 42\r\n', 'output': ['Second']}, {'input': '64 91 52 64 49 67\r\n', 'output': ['First']}, {'input': '25 68 3 39 20 41\r\n', 'output': ['Second']}] | [{'input': '1 2 1 1 1 2\r\n', 'output': ['First']}, {'input': '60 100 28 80 26 85\r\n', 'output': ['Second']}, {'input': '89 100 54 1 55 100\r\n', 'output': ['Second']}, {'input': '73 27 40 8 45 13\r\n', 'output': ['Second']}, {'input': '3 5 1 1 3 5\r\n', 'output': ['First']}] | [{'input': '50 50 1 1 5 4\r\n', 'output': ['Second']}, {'input': '16 97 7 4 15 94\r\n', 'output': ['Second']}, {'input': '10 10 1 1 1 6\r\n', 'output': ['Second']}, {'input': '63 22 54 16 58 19\r\n', 'output': ['Second']}, {'input': '48 53 24 37 21 42\r\n', 'output': ['Second']}] | [{'input': '5 5 1 1 4 5\r\n', 'output': ['Second']}, {'input': '47 91 36 61 32 63\r\n', 'output': ['First']}, {'input': '95 28 50 12 50 13\r\n', 'output': ['First']}, {'input': '10 10 1 1 6 2\r\n', 'output': ['Second']}, {'input': '100 100 1 1 3 5\r\n', 'output': ['First']}] | [{'input': '7 41 3 5 3 6\r\n', 'output': ['First']}, {'input': '61 39 14 30 14 37\r\n', 'output': ['Second']}, {'input': '47 95 27 70 23 70\r\n', 'output': ['First']}, {'input': '4 4 1 4 4 1\r\n', 'output': ['First']}, {'input': '100 100 1 1 3 5\r\n', 'output': ['First']}] | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 91.67 | 100 | 100 | 90 | 60 | 80 | 90 | 90 | 13 | 100 | 93.334 | 82 |
["2 3", "8 2"] | The first line of the input contains two integers, given in the decimal notation, n and m (1ββ€βn,βmββ€β109)Β β the number of hours in one day and the number of minutes in one hour, respectively. | 0930c75f57dd88a858ba7bb0f11f1b1c | #include <stdlib.h>
#include <stdio.h>
int main() {
int n, m, d;
scanf("%d%d", &n, &m);
int dn = 1, dm = 1;
for(int k = 7 ; k < n ; k *= 7) dn++;
for(int k = 7 ; k < m ; k *= 7) dm++;
d = dn + dm;
if(d > 7) {
printf("0\n");
return 0;
}
int r = 0;
for(int i=0 ; i<n ; i++) {
for(int j=0 ; j<m ; j++) {
... | ["4", "5"] | C | NoteIn the first sample, possible pairs are: (0:β1), (0:β2), (1:β0), (1:β2).In the second sample, possible pairs are: (02:β1), (03:β1), (04:β1), (05:β1), (06:β1). | Print one integer in decimal notationΒ β the number of different pairs of hour and minute, such that all digits displayed on the watches are distinct. | Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches.First, as they know that kingdom police is bad at math, robbers use the positional numeral system with base 7. Second, they divide one day in n hours,... | [{"input": "2 3\r\n", "output": ["4"]}, {"input": "8 2\r\n", "output": ["5"]}, {"input": "1 1\r\n", "output": ["0"]}, {"input": "1 2\r\n", "output": ["1"]}, {"input": "8 8\r\n", "output": ["0"]}, {"input": "50 50\r\n", "output": ["0"]}, {"input": "344 344\r\n", "output": ["0"]}, {"input": "282475250 282475250\r\n", "ou... | 100 | 100 | 100 | [{'input': '2402 50\r\n', 'output': ['0']}, {'input': '3 16808\r\n', 'output': ['240']}, {'input': '50 7\r\n', 'output': ['120']}, {'input': '16808 41\r\n', 'output': ['0']}, {'input': '8 282475250\r\n', 'output': ['0']}] | [{'input': '8 8\r\n', 'output': ['0']}, {'input': '50 7\r\n', 'output': ['120']}, {'input': '2402 49\r\n', 'output': ['720']}, {'input': '1 1\r\n', 'output': ['0']}, {'input': '2 3\r\n', 'output': ['4']}] | [{'input': '3 823544\r\n', 'output': ['0']}, {'input': '282475250 282475250\r\n', 'output': ['0']}, {'input': '8 8\r\n', 'output': ['0']}, {'input': '2402 343\r\n', 'output': ['0']}, {'input': '1 2\r\n', 'output': ['1']}] | [{'input': '8 2\r\n', 'output': ['5']}, {'input': '8 8\r\n', 'output': ['0']}, {'input': '2402 49\r\n', 'output': ['720']}, {'input': '117650 5\r\n', 'output': ['0']}, {'input': '343 2401\r\n', 'output': ['5040']}] | [{'input': '7 117649\r\n', 'output': ['5040']}, {'input': '282475250 8\r\n', 'output': ['0']}, {'input': '343 2401\r\n', 'output': ['5040']}, {'input': '50 7\r\n', 'output': ['120']}, {'input': '344 344\r\n', 'output': ['0']}] | 100 | 100 | 100 | 100 | 100 | 100 | 92.59 | 100 | 100 | 100 | 100 | 94.44 | 100 | 100 | 100 | 14 | 100 | 98.518 | 98.888 |
["500 1000 20 30", "1000 1000 1 1", "1500 1000 176 177"] | The first line contains four integers a, b, c, d (250ββ€βa,βbββ€β3500, 0ββ€βc,βdββ€β180). It is guaranteed that numbers a and b are divisible by 250 (just like on any real Codeforces round). | 95b19d7569d6b70bd97d46a8541060d0 | #include <stdio.h>
int max(int a, int b){
int maxim;
return maxim=(a>=b)?a:b;
}
int main(void)
{
int a,b,c,d, misha, vasya;
scanf("%d %d %d %d", &a,&b,&c,&d);
misha = max((3*a)/10 ,a- ((a*c)/250));
vasya = max((3*b)/10 ,b-((b*d)/250));
if(misha>vasya) printf("Misha");
else if(misha<vasy... | ["Vasya", "Tie", "Misha"] | C | null | Output on a single line: "Misha" (without the quotes), if Misha got more points than Vasya. "Vasya" (without the quotes), if Vasya got more points than Misha. "Tie" (without the quotes), if both of them got the same number of points. | Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully submitted it at the first attempt. Misha solved the problem that costs a points and Vasya solved the problem that costs b points. Besides, Misha submitted the problem c minutes after the contes... | [{"input": "500 1000 20 30\r\n", "output": ["Vasya"]}, {"input": "1000 1000 1 1\r\n", "output": ["Tie"]}, {"input": "1500 1000 176 177\r\n", "output": ["Misha"]}, {"input": "1500 1000 74 177\r\n", "output": ["Misha"]}, {"input": "750 2500 175 178\r\n", "output": ["Vasya"]}, {"input": "750 1000 54 103\r\n", "output": ["... | 100 | 100 | 100 | [{'input': '500 500 170 176\r\n', 'output': ['Misha']}, {'input': '1250 2000 101 180\r\n', 'output': ['Misha']}, {'input': '750 2500 175 178\r\n', 'output': ['Vasya']}, {'input': '1000 1000 1 1\r\n', 'output': ['Tie']}, {'input': '750 1000 54 103\r\n', 'output': ['Tie']}] | [{'input': '1750 500 166 177\r\n', 'output': ['Misha']}, {'input': '1000 500 7 162\r\n', 'output': ['Misha']}, {'input': '2750 1750 134 147\r\n', 'output': ['Misha']}, {'input': '1500 1250 180 160\r\n', 'output': ['Tie']}, {'input': '2000 1250 176 130\r\n', 'output': ['Tie']}] | [{'input': '250 3500 0 0\r\n', 'output': ['Vasya']}, {'input': '2750 1750 134 147\r\n', 'output': ['Misha']}, {'input': '500 1500 179 71\r\n', 'output': ['Vasya']}, {'input': '1250 2000 101 180\r\n', 'output': ['Misha']}, {'input': '1750 1250 179 180\r\n', 'output': ['Misha']}] | [{'input': '1000 1000 1 1\r\n', 'output': ['Tie']}, {'input': '750 1000 54 103\r\n', 'output': ['Tie']}, {'input': '3000 3000 176 78\r\n', 'output': ['Vasya']}, {'input': '500 1500 179 71\r\n', 'output': ['Vasya']}, {'input': '2000 2000 176 179\r\n', 'output': ['Tie']}] | [{'input': '500 1000 20 30\r\n', 'output': ['Vasya']}, {'input': '250 3500 0 180\r\n', 'output': ['Vasya']}, {'input': '250 250 0 0\r\n', 'output': ['Tie']}, {'input': '1000 3500 178 175\r\n', 'output': ['Vasya']}, {'input': '2750 1750 134 147\r\n', 'output': ['Misha']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 90 | 100 | 100 | 100 | 75 | 75 | 75 | 100 | 15 | 100 | 98 | 85 |
["4 2 4\n3 4\n1 1", "5 4 0\n1 2\n3 1"] | The first line contains three integers s, x1 and x2 (2ββ€βsββ€β1000, 0ββ€βx1,βx2ββ€βs, x1ββ βx2)Β β the maximum coordinate of the point to which the tram goes, the point Igor is at, and the point he should come to. The second line contains two integers t1 and t2 (1ββ€βt1,βt2ββ€β1000)Β β the time in seconds in which the tram pas... | fb3aca6eba3a952e9d5736c5d8566821 | #include<stdio.h>
int t,T1,T2,s,f,x1,x2,p,d,t1,t2,i;///T2 οΏ½οΏ½ T1 οΏ½οΏ½
int main()
{
scanf("%d %d %d %d %d %d %d",&s,&x1,&x2,&t1,&t2,&p,&d);
if(x2-x1>0) f=1;
else f=-1;
T2=(x2-x1)*t2*f;
if(t1<t2){
if((x1<x2&&x2<=p&&d<0)||(x1<=p&&p<=x2&&d<0)||(p<=x1&&x1<x2)||(x1<=p&&x1>x2&&d<0)){
... | ["8", "7"] | C | NoteIn the first example it is profitable for Igor to go by foot and not to wait the tram. Thus, he has to pass 2 meters and it takes 8 seconds in total, because he passes 1 meter per 4 seconds. In the second example Igor can, for example, go towards the point x2 and get to the point 1 in 6 seconds (because he has to p... | Print the minimum time in seconds which Igor needs to get from the point x1 to the point x2. | The tram in Berland goes along a straight line from the point 0 to the point s and back, passing 1 meter per t1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, instantly turning around at points xβ=β0 and xβ=βs.Igor is at the point x1. He should reach the point x... | [{"input": "4 2 4\r\n3 4\r\n1 1\r\n", "output": ["8"]}, {"input": "5 4 0\r\n1 2\r\n3 1\r\n", "output": ["7"]}, {"input": "5 4 0\r\n5 14\r\n1 -1\r\n", "output": ["55"]}, {"input": "10 7 2\r\n7 9\r\n9 -1\r\n", "output": ["45"]}, {"input": "20 5 19\r\n163 174\r\n4 1\r\n", "output": ["2436"]}, {"input": "1000 610 733\r\n22... | 100 | 100 | 100 | [{'input': '10 3 6\r\n1 2\r\n3 1\r\n', 'output': ['3']}, {'input': '100 9 6\r\n3 100\r\n5 1\r\n', 'output': ['300']}, {'input': '1000 876 884\r\n299 1000\r\n825 1\r\n', 'output': ['8000']}, {'input': '10 7 2\r\n7 9\r\n9 -1\r\n', 'output': ['45']}, {'input': '1000 812 761\r\n230 1000\r\n696 -1\r\n', 'output': ['51000']}... | [{'input': '10 0 5\r\n1 100\r\n7 1\r\n', 'output': ['18']}, {'input': '5 3 0\r\n1 2\r\n4 -1\r\n', 'output': ['4']}, {'input': '200 10 100\r\n1 100\r\n20 1\r\n', 'output': ['480']}, {'input': '20 15 10\r\n5 2\r\n3 1\r\n', 'output': ['10']}, {'input': '500 397 440\r\n202 1000\r\n75 1\r\n', 'output': ['43000']}] | [{'input': '5 4 0\r\n5 14\r\n1 -1\r\n', 'output': ['55']}, {'input': '2 2 0\r\n7 3\r\n1 1\r\n', 'output': ['6']}, {'input': '3 1 3\r\n1 2\r\n1 1\r\n', 'output': ['2']}, {'input': '500 397 440\r\n202 1000\r\n75 1\r\n', 'output': ['43000']}, {'input': '999 951 297\r\n62 106\r\n574 1\r\n', 'output': ['69324']}] | [{'input': '999 951 297\r\n62 106\r\n574 1\r\n', 'output': ['69324']}, {'input': '40 31 14\r\n628 1000\r\n36 1\r\n', 'output': ['17000']}, {'input': '600 443 587\r\n260 1000\r\n548 -1\r\n', 'output': ['144000']}, {'input': '100 20 83\r\n186 434\r\n64 -1\r\n', 'output': ['27342']}, {'input': '200 10 100\r\n1 100\r\n20 1... | [{'input': '5 4 0\r\n5 14\r\n1 -1\r\n', 'output': ['55']}, {'input': '10 1 9\r\n1 10\r\n1 1\r\n', 'output': ['8']}, {'input': '1000 711 437\r\n42 126\r\n745 1\r\n', 'output': ['34356']}, {'input': '5 3 0\r\n1 2\r\n4 -1\r\n', 'output': ['4']}, {'input': '100 9 6\r\n3 100\r\n5 1\r\n', 'output': ['300']}] | 100 | 100 | 100 | 100 | 100 | 83.33 | 100 | 100 | 83.33 | 88.89 | 56 | 74 | 56 | 60 | 78 | 16 | 100 | 91.11 | 64.8 |
["4\n1 3\n2 3\n1 4\n5 3", "5\n1 2\n2 3\n3 4\n4 5\n5 1"] | The first line contains an integer m (0ββ€βmββ€β10), which is the number of relations of acquaintances among the five friends of Igor's. Each of the following m lines contains two integers ai and bi (1ββ€βai,βbiββ€β5;aiββ βbi), where (ai,βbi) is a pair of acquainted people. It is guaranteed that each pair of the acquaintanc... | 2bc18799c85ecaba87564a86a94e0322 | #include<stdio.h>
int main()
{
int i,j,k,a[100][100],n,x,y,flag=0;
scanf("%d",&n);
for(i=0;i<=5;i++)
for(j=0;j<=5;j++)
a[i][j]=0;
for(i=0;i<n;i++)
{
scanf("%d%d",&x,&y);
a[x][y]=1;
a[y][x]=1;
}
for(i=1;i<=5;i++)
for(j=i+1;j<=5;j++)
for(k=j+1;k<=5;k++)
{
if(a[i][j]==1 && a[i][k]=... | ["WIN", "FAIL"] | C | null | Print "FAIL", if among those five people there are no either three pairwise acquainted or three pairwise unacquainted people. Otherwise print "WIN". | One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something. The following statement caught his attention: "Among any six people there are either three pairwise acquainted people or three pairwise unacquainted people"Igor just could... | [{"input": "4\r\n1 3\r\n2 3\r\n1 4\r\n5 3\r\n", "output": ["WIN"]}, {"input": "5\r\n1 2\r\n2 3\r\n3 4\r\n4 5\r\n5 1\r\n", "output": ["FAIL"]}, {"input": "1\r\n4 3\r\n", "output": ["WIN"]}, {"input": "6\r\n1 3\r\n2 3\r\n1 2\r\n5 3\r\n4 2\r\n4 5\r\n", "output": ["WIN"]}, {"input": "2\r\n1 3\r\n2 5\r\n", "output": ["WIN"]... | 100 | 100 | 100 | [{'input': '7\r\n2 3\r\n2 1\r\n4 5\r\n5 2\r\n3 4\r\n3 1\r\n4 1\r\n', 'output': ['WIN']}, {'input': '4\r\n1 2\r\n5 2\r\n3 5\r\n1 5\r\n', 'output': ['WIN']}, {'input': '9\r\n3 2\r\n5 1\r\n5 2\r\n2 1\r\n1 4\r\n1 3\r\n2 4\r\n5 3\r\n5 4\r\n', 'output': ['WIN']}, {'input': '4\r\n4 2\r\n2 5\r\n1 4\r\n4 5\r\n', 'output': ['WIN... | [{'input': '5\r\n1 2\r\n2 5\r\n5 4\r\n4 3\r\n3 1\r\n', 'output': ['FAIL']}, {'input': '1\r\n4 3\r\n', 'output': ['WIN']}, {'input': '5\r\n1 2\r\n2 5\r\n4 2\r\n4 3\r\n3 1\r\n', 'output': ['WIN']}, {'input': '3\r\n5 1\r\n5 3\r\n2 5\r\n', 'output': ['WIN']}, {'input': '6\r\n4 3\r\n5 3\r\n4 1\r\n1 3\r\n1 2\r\n2 4\r\n', 'ou... | [{'input': '9\r\n2 4\r\n3 2\r\n2 5\r\n4 5\r\n3 5\r\n1 3\r\n5 1\r\n1 2\r\n4 3\r\n', 'output': ['WIN']}, {'input': '7\r\n3 1\r\n4 5\r\n3 5\r\n5 1\r\n2 4\r\n1 2\r\n1 4\r\n', 'output': ['WIN']}, {'input': '8\r\n1 5\r\n3 1\r\n2 5\r\n4 2\r\n2 1\r\n4 5\r\n4 3\r\n4 1\r\n', 'output': ['WIN']}, {'input': '5\r\n3 5\r\n4 2\r\n1 3\... | [{'input': '5\r\n3 5\r\n4 2\r\n1 4\r\n3 4\r\n5 2\r\n', 'output': ['WIN']}, {'input': '6\r\n5 1\r\n5 4\r\n3 4\r\n1 3\r\n1 4\r\n4 2\r\n', 'output': ['WIN']}, {'input': '3\r\n5 1\r\n3 1\r\n1 2\r\n', 'output': ['WIN']}, {'input': '4\r\n5 4\r\n2 3\r\n1 5\r\n5 2\r\n', 'output': ['WIN']}, {'input': '4\r\n5 2\r\n2 4\r\n5 3\r\n... | [{'input': '5\r\n1 4\r\n4 2\r\n2 5\r\n3 1\r\n5 3\r\n', 'output': ['FAIL']}, {'input': '6\r\n3 1\r\n1 4\r\n5 4\r\n2 1\r\n4 2\r\n1 5\r\n', 'output': ['WIN']}, {'input': '5\r\n3 5\r\n1 4\r\n5 1\r\n2 3\r\n4 2\r\n', 'output': ['FAIL']}, {'input': '5\r\n2 3\r\n1 4\r\n3 5\r\n1 5\r\n5 4\r\n', 'output': ['WIN']}, {'input': '5\r... | 100 | 100 | 100 | 100 | 100 | 94.44 | 100 | 100 | 94.44 | 100 | 96.15 | 100 | 100 | 96.15 | 100 | 17 | 100 | 97.776 | 98.46 |
["100\n15 20 20 15 10 30 45", "2\n1 0 0 0 0 0 0"] | The first input line contains the single integer n (1ββ€βnββ€β1000) β the number of pages in the book. The second line contains seven non-negative space-separated integers that do not exceed 1000 β those integers represent how many pages Petr can read on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday c... | 007a779d966e2e9219789d6d9da7002c | #include<stdio.h>
int main()
{
int i,j,t,a,b,page, sum =0;
int day[8];
scanf ("%d",&page);
for(i=1; i<8; i++){
scanf("%d", &day[i]);
}
j = 0;
while(1){
j++;
sum = sum + day[j];
if(sum >= page){
printf("%d\n", j);
break;
}
... | ["6", "1"] | C | NoteNote to the first sample:By the end of Monday and therefore, by the beginning of Tuesday Petr has 85 pages left. He has 65 pages left by Wednesday, 45 by Thursday, 30 by Friday, 20 by Saturday and on Saturday Petr finishes reading the book (and he also has time to read 10 pages of something else).Note to the second... | Print a single number β the number of the day of the week, when Petr will finish reading the book. The days of the week are numbered starting with one in the natural order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday. | One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages.Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. Some ... | [{"input": "100\r\n15 20 20 15 10 30 45\r\n", "output": ["6"]}, {"input": "2\r\n1 0 0 0 0 0 0\r\n", "output": ["1"]}, {"input": "100\r\n100 200 100 200 300 400 500\r\n", "output": ["1"]}, {"input": "3\r\n1 1 1 1 1 1 1\r\n", "output": ["3"]}, {"input": "1\r\n1 1 1 1 1 1 1\r\n", "output": ["1"]}, {"input": "20\r\n5 3 7 2... | 100 | 100 | 100 | [{'input': '3\r\n0 1 0 0 0 0 0\r\n', 'output': ['2']}, {'input': '997\r\n1 1 0 0 1 0 1\r\n', 'output': ['1']}, {'input': '3\r\n1 1 1 1 1 1 1\r\n', 'output': ['3']}, {'input': '4\r\n0 1 1 0 0 0 0\r\n', 'output': ['3']}, {'input': '5\r\n1 0 1 0 1 0 1\r\n', 'output': ['1']}] | [{'input': '5\r\n0 0 0 0 0 0 10\r\n', 'output': ['7']}, {'input': '28\r\n1 2 3 4 5 6 7\r\n', 'output': ['7']}, {'input': '5\r\n1 1 1 0 0 1 1\r\n', 'output': ['7']}, {'input': '1\r\n1000 1000 1000 1000 1000 1000 1000\r\n', 'output': ['1']}, {'input': '10\r\n0 0 0 0 0 0 10\r\n', 'output': ['7']}] | [{'input': '5\r\n0 0 0 1 0 0 0\r\n', 'output': ['4']}, {'input': '6\r\n1 1 1 1 1 1 0\r\n', 'output': ['6']}, {'input': '2\r\n0 0 0 0 0 0 1\r\n', 'output': ['7']}, {'input': '70\r\n10 10 10 10 10 10 10\r\n', 'output': ['7']}, {'input': '1000\r\n1 1 1 1 1 1 1\r\n', 'output': ['6']}] | [{'input': '4\r\n1 0 0 0 0 0 1\r\n', 'output': ['7']}, {'input': '2\r\n0 0 1 1 0 0 0\r\n', 'output': ['4']}, {'input': '433\r\n109 58 77 10 39 125 15\r\n', 'output': ['7']}, {'input': '7\r\n1 1 1 1 1 1 1\r\n', 'output': ['7']}, {'input': '2\r\n1 0 0 0 0 0 0\r\n', 'output': ['1']}] | [{'input': '999\r\n10 20 10 20 30 20 10\r\n', 'output': ['3']}, {'input': '10\r\n0 0 0 0 0 0 1\r\n', 'output': ['7']}, {'input': '3\r\n0 1 0 0 0 0 0\r\n', 'output': ['2']}, {'input': '433\r\n109 58 77 10 39 125 15\r\n', 'output': ['7']}, {'input': '1000\r\n0 0 0 0 0 0 1\r\n', 'output': ['7']}] | 100 | 100 | 100 | 100 | 100 | 100 | 92.31 | 100 | 100 | 100 | 100 | 83.33 | 100 | 100 | 100 | 18 | 100 | 98.462 | 96.666 |
["2 2", "9 3"] | The single line contains two integers n and m (1ββ€βnββ€β100;Β 2ββ€βmββ€β100), separated by a space. | 42b25b7335ec01794fbb1d4086aa9dd0 | #include<stdio.h>
int main()
{
int n,m,sum,d;
scanf("%d %d",&n,&m);
sum=n;
rich:
d=n/m;
if(d>0)
{
sum=sum+d;
if(((n%m)+d)>=m)
{
n=(n%m)+d;
goto rich;
}
}
printf("%d",sum);
return 0;
}
| ["3", "13"] | C | NoteIn the first sample Vasya spends the first two days wearing the socks that he had initially. Then on day three he puts on the socks that were bought on day two.In the second sample Vasya spends the first nine days wearing the socks that he had initially. Then he spends three days wearing the socks that were bought ... | Print a single integer β the answer to the problem. | Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (at days with numbers m,β2m,β3m,β...) mom buys a pair of socks to Vasya. She does it late in the eve... | [{"input": "2 2\r\n", "output": ["3"]}, {"input": "9 3\r\n", "output": ["13"]}, {"input": "1 2\r\n", "output": ["1"]}, {"input": "2 3\r\n", "output": ["2"]}, {"input": "1 99\r\n", "output": ["1"]}, {"input": "4 4\r\n", "output": ["5"]}, {"input": "10 2\r\n", "output": ["19"]}, {"input": "10 9\r\n", "output": ["11"]}, {... | 100 | 100 | 100 | [{'input': '98 3\r\n', 'output': ['146']}, {'input': '62 4\r\n', 'output': ['82']}, {'input': '1 99\r\n', 'output': ['1']}, {'input': '99 100\r\n', 'output': ['99']}, {'input': '2 3\r\n', 'output': ['2']}] | [{'input': '99 2\r\n', 'output': ['197']}, {'input': '99 74\r\n', 'output': ['100']}, {'input': '2 2\r\n', 'output': ['3']}, {'input': '2 3\r\n', 'output': ['2']}, {'input': '100 2\r\n', 'output': ['199']}] | [{'input': '20 21\r\n', 'output': ['20']}, {'input': '99 10\r\n', 'output': ['109']}, {'input': '99 74\r\n', 'output': ['100']}, {'input': '10 2\r\n', 'output': ['19']}, {'input': '100 3\r\n', 'output': ['149']}] | [{'input': '62 4\r\n', 'output': ['82']}, {'input': '98 3\r\n', 'output': ['146']}, {'input': '1 2\r\n', 'output': ['1']}, {'input': '99 74\r\n', 'output': ['100']}, {'input': '100 100\r\n', 'output': ['101']}] | [{'input': '2 3\r\n', 'output': ['2']}, {'input': '100 2\r\n', 'output': ['199']}, {'input': '2 27\r\n', 'output': ['2']}, {'input': '75 16\r\n', 'output': ['79']}, {'input': '100 100\r\n', 'output': ['101']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 19 | 100 | 100 | 100 |
["0 1 1\n1 0 1\n1 1 0", "0 3 6\n5 0 5\n4 7 0"] | The first three lines of the input contain the Little Elephant's notes. The first line contains elements of the first row of the magic square. The second line contains the elements of the second row, the third line is for the third row. The main diagonal elements that have been forgotten by the Elephant are represented... | 0c42eafb73d1e30f168958a06a0f9bca | #include<stdio.h>
int main()
{
int x,y,z,i,j;
int a[3][3];
for(i=0;i<=2;i++)
for(j=0;j<=2;j++)
scanf("%d",&a[i][j]);
y=(a[2][0]+a[2][1]+a[0][1]+a[0][2]-a[1][0]-a[1][2])/2;
x=a[2][0]+a[2][1]-y;
z=a[1][0]+a[1][2]-x;
a[0][0]=x;
a[1][1]=y;
a[2][2]=z;
for(i=0;i<=2;i++)
{
... | ["1 1 1\n1 1 1\n1 1 1", "6 3 6\n5 5 5\n4 7 4"] | C | null | Print three lines, in each line print three integers β the Little Elephant's magic square. If there are multiple magic squares, you are allowed to print any of them. Note that all numbers you print must be positive and not exceed 105. It is guaranteed that there exists at least one magic square that meets the condition... | Little Elephant loves magic squares very much.A magic square is a 3βΓβ3 table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table are equal. The figure below shows the magic square, the sum of integers in all its rows, columns and diagonals equals 15. ... | [{"input": "0 1 1\r\n1 0 1\r\n1 1 0\r\n", "output": ["1 1 1 \r\n1 1 1 \r\n1 1 1", "1 1 1\r\n 1 1 1\r\n 1 1 1", "1 1 1\r\n1 1 1\r\n1 1 1"]}, {"input": "0 3 6\r\n5 0 5\r\n4 7 0\r\n", "output": ["6 3 6\r\n 5 5 5\r\n 4 7 4", "6 3 6\r\n5 5 5\r\n4 7 4", "6 3 6 \r\n5 5 5 \r\n4 7 4"]}, {"input": "0 4 4\r\n4 0 4\r\n4 4 0\r\n", ... | 100 | 100 | 100 | [{'input': '0 9 2\r\n3 0 7\r\n8 1 0\r\n', 'output': ['4 9 2 \r\n3 5 7 \r\n8 1 6', '4 9 2\r\n3 5 7\r\n8 1 6', '4 9 2\r\n 3 5 7\r\n 8 1 6']}, {'input': '0 120 83\r\n98 0 90\r\n105 68 0\r\n', 'output': ['79 120 83\r\n98 94 90\r\n105 68 109', '79 120 83\r\n 98 94 90\r\n 105 68 109', '79 120 83 \r\n98 94 90 \r\n105 68 109']... | [{'input': '0 99978 99920\r\n99950 0 99918\r\n99948 99890 0\r\n', 'output': ['99904 99978 99920\r\n99950 99934 99918\r\n99948 99890 99964', '99904 99978 99920\r\n 99950 99934 99918\r\n 99948 99890 99964', '99904 99978 99920 \r\n99950 99934 99918 \r\n99948 99890 99964']}, {'input': '0 120 83\r\n98 0 90\r\n105 68 0\r\n',... | [{'input': '0 28 10\r\n12 0 24\r\n26 8 0\r\n', 'output': ['16 28 10 \r\n12 18 24 \r\n26 8 20', '16 28 10\r\n12 18 24\r\n26 8 20', '16 28 10\r\n 12 18 24\r\n 26 8 20']}, {'input': '0 1 1\r\n1 0 1\r\n1 1 0\r\n', 'output': ['1 1 1 \r\n1 1 1 \r\n1 1 1', '1 1 1\r\n 1 1 1\r\n 1 1 1', '1 1 1\r\n1 1 1\r\n1 1 1']}, {'input': '0... | [{'input': '0 97 56\r\n69 0 71\r\n84 43 0\r\n', 'output': ['57 97 56\r\n69 70 71\r\n84 43 83', '57 97 56\r\n 69 70 71\r\n 84 43 83', '57 97 56 \r\n69 70 71 \r\n84 43 83']}, {'input': '0 98721 99776\r\n99575 0 99123\r\n98922 99977 0\r\n', 'output': ['99550 98721 99776\r\n99575 99349 99123\r\n98922 99977 99148', '99550 9... | [{'input': '0 1 43\r\n13 0 61\r\n31 73 0\r\n', 'output': ['67 1 43\r\n 13 37 61\r\n 31 73 7', '67 1 43\r\n13 37 61\r\n31 73 7', '67 1 43 \r\n13 37 61 \r\n31 73 7']}, {'input': '0 9 2\r\n3 0 7\r\n8 1 0\r\n', 'output': ['4 9 2 \r\n3 5 7 \r\n8 1 6', '4 9 2\r\n3 5 7\r\n8 1 6', '4 9 2\r\n 3 5 7\r\n 8 1 6']}, {'input': '0 7 ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 20 | 100 | 100 | 100 |
["8 5\n10 9 8 7 7 7 5 5", "4 2\n0 0 0 0"] | The first line of the input contains two integers n and k (1ββ€βkββ€βnββ€β50) separated by a single space. The second line contains n space-separated integers a1,βa2,β...,βan (0ββ€βaiββ€β100), where ai is the score earned by the participant who got the i-th place. The given sequence is non-increasing (that is, for all i fro... | 193ec1226ffe07522caf63e84a7d007f | #include<stdio.h>
int main()
{
int n, k;
int i, s = 0, a[101];
while (scanf("%d%d", &n, &k) != EOF)
{
for (i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (i = 1; i <= n; i++)
{
if (a[i] >= a[k] && a[i] != 0)
s++;
}
printf("%d\n", s);
}
return 0;
}
| ["6", "0"] | C | NoteIn the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.In the second example nobody got a positive score. | Output the number of participants who advance to the next round. | "Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score..." β an excerpt from contest rules.A total of n participants took part in the contest (nββ₯βk), and you already know their scores. Calculate how many pa... | [{"input": "8 5\r\n10 9 8 7 7 7 5 5\r\n", "output": ["6"]}, {"input": "4 2\r\n0 0 0 0\r\n", "output": ["0"]}, {"input": "5 1\r\n1 1 1 1 1\r\n", "output": ["5"]}, {"input": "5 5\r\n1 1 1 1 1\r\n", "output": ["5"]}, {"input": "1 1\r\n10\r\n", "output": ["1"]}, {"input": "17 14\r\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0\... | 100 | 100 | 100 | [{'input': '8 4\r\n10 9 8 7 7 7 5 5\r\n', 'output': ['6']}, {'input': '10 3\r\n5 5 5 3 3 3 0 0 0 0\r\n', 'output': ['3']}, {'input': '49 34\r\n99 98 96 96 93 92 90 89 88 86 85 85 82 76 73 69 66 64 63 63 60 59 57 57 56 55 54 54 51 48 47 44 42 42 40 39 38 36 33 26 24 23 19 17 17 14 12 7 4\r\n', 'output': ['34']}, {'input... | [{'input': '5 5\r\n1 1 1 1 1\r\n', 'output': ['5']}, {'input': '2 1\r\n10 2\r\n', 'output': ['1']}, {'input': '11 5\r\n100 99 98 97 96 95 94 93 92 91 90\r\n', 'output': ['5']}, {'input': '50 30\r\n100 98 96 94 91 89 88 81 81 81 81 81 76 73 72 71 70 69 66 64 61 59 59 56 52 50 49 48 43 39 36 35 34 34 31 29 27 26 24 22 16... | [{'input': '2 2\r\n10 10\r\n', 'output': ['2']}, {'input': '50 50\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['0']}, {'input': '49 29\r\n100 98 98 96 96 96 95 87 85 84 81 76 74 70 63 63 63 62 57 57 56 54 53 52 50 47 45 41 41 39 38 31 30 28 27 2... | [{'input': '50 13\r\n99 95 94 94 88 87 81 79 78 76 74 72 72 69 68 67 67 67 66 63 62 61 58 57 55 55 54 51 50 50 48 48 42 41 38 35 34 32 31 30 26 24 13 13 12 6 5 4 3 3\r\n', 'output': ['13']}, {'input': '50 25\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'ou... | [{'input': '5 1\r\n1 1 1 1 1\r\n', 'output': ['5']}, {'input': '20 3\r\n98 98 96 89 87 82 82 80 76 74 74 68 61 60 43 32 30 22 4 2\r\n', 'output': ['3']}, {'input': '2 2\r\n10 1\r\n', 'output': ['2']}, {'input': '2 1\r\n10 10\r\n', 'output': ['2']}, {'input': '50 13\r\n99 95 94 94 88 87 81 79 78 76 74 72 72 69 68 67 67 ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 90 | 90 | 100 | 100 | 90 | 21 | 100 | 100 | 94 |
["10 3 2", "7 1 2"] | The first line of the input contains three integers t, w and b (1ββ€βt,βw,βbββ€β5Β·1018) β the maximum possible length of the racetrack, the length of Willman's steps and the length of Bolt's steps respectively. | 7a1d8ca25bce0073c4eb5297b94501b5 | #include <stdio.h>
#include <stdlib.h>
unsigned long long int pgcd(unsigned long long int x,unsigned long long int y)
{
if (x==0) return y;
if (y==0) return x;
if ((x==1) || (y==1)) return 1;
if (x==y) return x;
if (x<y) return pgcd(x,y%x);
return pgcd(x%y,y);
}
... | ["3/10", "3/7"] | C | NoteIn the first sample Willman and Bolt will tie in case 1, 6 or 7 are chosen as the length of the racetrack. | Print the answer to the problem as an irreducible fraction . Follow the format of the samples output. The fraction (p and q are integers, and both pββ₯β0 and qβ>β0 holds) is called irreducible, if there is no such integer dβ>β1, that both p and q are divisible by d. | Vector Willman and Array Bolt are the two most famous athletes of Byteforces. They are going to compete in a race with a distance of L meters today. Willman and Bolt have exactly the same speed, so when they compete the result is always a tie. That is a problem for the organizers because they want a winner. While watc... | [{"input": "10 3 2\r\n", "output": ["3/10"]}, {"input": "7 1 2\r\n", "output": ["3/7"]}, {"input": "1 1 1\r\n", "output": ["1/1"]}, {"input": "5814 31 7\r\n", "output": ["94/2907"]}, {"input": "94268 813 766\r\n", "output": ["765/94268"]}, {"input": "262610 5583 4717\r\n", "output": ["2358/131305"]}, {"input": "3898439... | 100 | 100 | 100 | [{'input': '555555555555555555 555555555555555083 555555555555555229\r\n', 'output': ['50505050505050462/50505050505050505']}, {'input': '573003994959686829 275856334120822851 1319886766128339\r\n', 'output': ['3959660298385016/573003994959686829']}, {'input': '370330636048898430 61721772674816405 6\r\n', 'output': ['1... | [{'input': '40525189 6365 12730\r\n', 'output': ['20265394/40525189']}, {'input': '917148533938841535 47 344459175789842163\r\n', 'output': ['28/183429706787768307']}, {'input': '9 6 1\r\n', 'output': ['1/9']}, {'input': '462643382718281828 462643382718281507 462643382718281701\r\n', 'output': ['33045955908448679/33045... | [{'input': '1000000000 123123 654\r\n', 'output': ['24851/1000000000']}, {'input': '1000000000 1000000000 1000000000\r\n', 'output': ['1/1']}, {'input': '404 63 441\r\n', 'output': ['31/202']}, {'input': '812312312312312222 812312312312311897 812312312312312029\r\n', 'output': ['406156156156155948/406156156156156111']}... | [{'input': '391554751752251913 625743359 1877230077\r\n', 'output': ['130518250652782079/391554751752251913']}, {'input': '123456 1234567 123\r\n', 'output': ['61/61728']}, {'input': '1000000000000000000 1000000000 2000000000\r\n', 'output': ['1/2']}, {'input': '5814 31 7\r\n', 'output': ['94/2907']}, {'input': '10 3 2... | [{'input': '11071994 4231 1324\r\n', 'output': ['2647/11071994']}, {'input': '683705963104411677 89876390 116741460012229240\r\n', 'output': ['539258339/683705963104411677']}, {'input': '3 1 4\r\n', 'output': ['0/1']}, {'input': '763 358 358\r\n', 'output': ['1/1']}, {'input': '2 1000000000000000000 1000000000000000001... | 100 | 100 | 100 | 100 | 100 | 88.57 | 88.57 | 94.29 | 88.57 | 94.29 | 86.36 | 86.36 | 95.45 | 86.36 | 95.45 | 22 | 100 | 90.858 | 89.996 |
["2", "3", "4", "10"] | The only line of the input contains a single integer n (2ββ€βnββ€β1018)Β β the number of players to participate in the tournament. | 3d3432b4f7c6a3b901161fa24b415b14 | #include <stdio.h>
int main()
{
long long int n;
long long ans = 0, a = 2, b = 1, c = 0;
scanf("%lld", &n);
if(n == 2) {printf("1\n");return 0;}
else if(n == 3) {printf("2\n");return 0;}
else
while(1)
{
if(a > n) break;
ans++;
c = b;
b = a;
a += c;
}
printf(... | ["1", "2", "2", "4"] | C | NoteIn all samples we consider that player number 1 is the winner.In the first sample, there would be only one game so the answer is 1.In the second sample, player 1 can consequently beat players 2 and 3. In the third sample, player 1 can't play with each other player as after he plays with players 2 and 3 he can't pla... | Print the maximum number of games in which the winner of the tournament can take part. | Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. That means, that if someone loses a game he leaves the tournament immediately.Organizers are still ... | [{"input": "2\r\n", "output": ["1"]}, {"input": "3\r\n", "output": ["2"]}, {"input": "4\r\n", "output": ["2"]}, {"input": "10\r\n", "output": ["4"]}, {"input": "1000\r\n", "output": ["14"]}, {"input": "2500\r\n", "output": ["15"]}, {"input": "690000\r\n", "output": ["27"]}, {"input": "3000000000\r\n", "output": ["45"]}... | 100 | 100 | 100 | [{'input': '62735129403\r\n', 'output': ['51']}, {'input': '8902353464851212\r\n', 'output': ['75']}, {'input': '145\r\n', 'output': ['10']}, {'input': '19204385325853\r\n', 'output': ['63']}, {'input': '679891637638612257\r\n', 'output': ['84']}] | [{'input': '902353283921\r\n', 'output': ['56']}, {'input': '3000000000\r\n', 'output': ['45']}, {'input': '618473717761\r\n', 'output': ['56']}, {'input': '10235439547\r\n', 'output': ['47']}, {'input': '126743950353465\r\n', 'output': ['67']}] | [{'input': '262406072477\r\n', 'output': ['54']}, {'input': '19\r\n', 'output': ['5']}, {'input': '18\r\n', 'output': ['5']}, {'input': '15\r\n', 'output': ['5']}, {'input': '902353283921\r\n', 'output': ['56']}] | [{'input': '92353046212453\r\n', 'output': ['66']}, {'input': '22\r\n', 'output': ['6']}, {'input': '3000000000\r\n', 'output': ['45']}, {'input': '6\r\n', 'output': ['3']}, {'input': '10238439257768\r\n', 'output': ['61']}] | [{'input': '20\r\n', 'output': ['5']}, {'input': '92353046212453\r\n', 'output': ['66']}, {'input': '192403205846532\r\n', 'output': ['68']}, {'input': '690000\r\n', 'output': ['27']}, {'input': '5\r\n', 'output': ['3']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 66.67 | 66.67 | 66.67 | 66.67 | 66.67 | 23 | 100 | 100 | 66.67 |
["2 3\nPPW\nW.P", "3 3\nP.W\n.P.\nW.P"] | The first line contains integers n and m (1ββ€βn,βmββ€β10) which denotes the number of rows and columns in our two-dimensional grid, respectively. Then follow n lines containing m characters each β that is the grid description. "." means that this cell is empty. "P" means that this cell contains a little pig. "W" means t... | 969b24ed98d916184821b2b2f8fd3aac | #include <stdio.h>
int n, m;
char map[10][11];
int wolf(int i, int j)
{
return (i >= 0 && i < n && j >= 0 && j < m && map[i][j] == 'W');
}
int main(int argc, char *argv[])
{
int i, j, c = 0;
scanf("%d %d", &n, &m);
for(i = 0; i < n; i ++)
scanf("%s", map[i]);
for(i = 0; i < ... | ["2", "0"] | C | NoteIn the first example, one possible scenario in which two little pigs get eaten by the wolves is as follows. | Print a single number β the maximal number of little pigs that may be eaten by the wolves. | Once upon a time there were several little pigs and several wolves on a two-dimensional grid of size nβΓβm. Each cell in this grid was either empty, containing one little pig, or containing one wolf.A little pig and a wolf are adjacent if the cells that they are located at share a side. The little pigs are afraid of wo... | [{"input": "2 3\r\nPPW\r\nW.P\r\n", "output": ["2"]}, {"input": "3 3\r\nP.W\r\n.P.\r\nW.P\r\n", "output": ["0"]}, {"input": "6 5\r\n.....\r\n..PW.\r\n.....\r\n.WP..\r\n.....\r\n.....\r\n", "output": ["2"]}, {"input": "5 5\r\n.....\r\n..P..\r\n.W.W.\r\n..P..\r\n.....\r\n", "output": ["0"]}, {"input": "5 5\r\n.....\r\n..... | 100 | 100 | 100 | [{'input': '1 5\r\nPW...\r\n', 'output': ['1']}, {'input': '2 3\r\nWWP\r\nPPP\r\n', 'output': ['2']}, {'input': '3 3\r\nPWP\r\n...\r\nW..\r\n', 'output': ['1']}, {'input': '10 10\r\nPP..PPWPPW\r\nPPPPPPPP..\r\n.PPPPPPP.P\r\nPPPPPPPPPP\r\nPWP.PPP.PP\r\nPW.PP.PPPP\r\nPPPPPP.PPW\r\n..PPWPPP.P\r\nWPPPPPPPPP\r\nWP.WPPPWPP\r... | [{'input': '3 3\r\nPWP\r\n...\r\nW..\r\n', 'output': ['1']}, {'input': '6 5\r\n..WP.\r\nWP..W\r\nW.PP.\r\n.PWW.\r\nP.PPP\r\nWP..W\r\n', 'output': ['6']}, {'input': '10 1\r\nP\r\nP\r\nW\r\nW\r\n.\r\nP\r\n.\r\n.\r\n.\r\nW\r\n', 'output': ['1']}, {'input': '10 10\r\nW..W..W...\r\nW..P..W...\r\n..W.....WW\r\n....WW....\r\n... | [{'input': '2 3\r\nPPW\r\nW.P\r\n', 'output': ['2']}, {'input': '10 10\r\nPPPPPPPPWP\r\nPPPWPPPPPP\r\nPPPPPPPPPP\r\nPWWPPWPPPP\r\nPPPPPPPPPP\r\nPPPPWPPPPP\r\nPPPPPPPPPP\r\nPPPPPPWPPW\r\nPPPPPPPPPP\r\nPPWPPPPPWP\r\n', 'output': ['10']}, {'input': '10 10\r\n.PWWP..W..\r\n.....W...W\r\nWP........\r\nW...WP....\r\nP.W..P..... | [{'input': '10 10\r\nW....W...W\r\nW....W....\r\n..WW...WW.\r\n..........\r\n.....W...W\r\n.....W....\r\nWW........\r\n........WW\r\n..W...W...\r\nW...W.....\r\n', 'output': ['0']}, {'input': '9 8\r\nPP..W..W\r\n.PP.W..W\r\n..W...PP\r\nWP.P.WW.\r\nW..W.P..\r\nP.PP..P.\r\n...PW.PP\r\n.WPPW..W\r\nPWP.PPPP\r\n', 'output':... | [{'input': '10 10\r\n.........P\r\n...P.W....\r\nPP...WP.WP\r\n.W........\r\n..........\r\n.....WP.W.\r\n........WP\r\n...P......\r\n.......W..\r\n.PW..W....\r\n', 'output': ['6']}, {'input': '8 8\r\nWP.W...P\r\nW.P..WW.\r\nP.W.P.P.\r\nPPPPPPPP\r\nWW..WP.W\r\nP.P.PP..\r\n..WW..W.\r\nPP....W.\r\n', 'output': ['9']}, {'i... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 24 | 100 | 100 | 100 |
["1 3 2", "3 2 1"] | The first line contains three integers r, g and b (0ββ€βr,βg,βbββ€β100). It is guaranteed that rβ+βgβ+βbβ>β0, it means that the group consists of at least one student. | a45daac108076102da54e07e1e2a37d7 | #include <stdio.h>
int main()
{
int n, sum = 0, i;
int a[3];
scanf("%d %d %d", &a[0], &a[1], &a[2]);
n = a[0] + a[1] + a[2];
for (i = 0; ; i++) {
if (a[i % 3] >= 2) {
a[i % 3] -= 2;
n -= 2;
} else if (a[i % 3] == 1) {
a[i % 3]--;
n--;
}
if (n == ... | ["34", "33"] | C | NoteLet's analyze the first sample.At the moment of time 0 a red cablecar comes and one student from the r group get on it and ascends to the top at the moment of time 30.At the moment of time 1 a green cablecar arrives and two students from the g group get on it; they get to the top at the moment of time 31.At the mom... | Print a single number β the minimal time the students need for the whole group to ascend to the top of the mountain. | A group of university students wants to get to the top of a mountain to have a picnic there. For that they decided to use a cableway.A cableway is represented by some cablecars, hanged onto some cable stations by a cable. A cable is scrolled cyclically between the first and the last cable stations (the first of them is... | [{"input": "1 3 2\r\n", "output": ["34"]}, {"input": "3 2 1\r\n", "output": ["33"]}, {"input": "3 5 2\r\n", "output": ["37"]}, {"input": "10 10 10\r\n", "output": ["44"]}, {"input": "29 7 24\r\n", "output": ["72"]}, {"input": "28 94 13\r\n", "output": ["169"]}, {"input": "90 89 73\r\n", "output": ["163"]}, {"input": "0... | 100 | 100 | 100 | [{'input': '2 2 1\r\n', 'output': ['32']}, {'input': '29 28 30\r\n', 'output': ['74']}, {'input': '99 97 98\r\n', 'output': ['177']}, {'input': '0 2 0\r\n', 'output': ['31']}, {'input': '100 0 100\r\n', 'output': ['179']}] | [{'input': '95 2 3\r\n', 'output': ['171']}, {'input': '2 0 1\r\n', 'output': ['32']}, {'input': '0 0 100\r\n', 'output': ['179']}, {'input': '1 2 0\r\n', 'output': ['31']}, {'input': '100 100 100\r\n', 'output': ['179']}] | [{'input': '89 97 2\r\n', 'output': ['175']}, {'input': '1 1 0\r\n', 'output': ['31']}, {'input': '10 10 10\r\n', 'output': ['44']}, {'input': '2 1 2\r\n', 'output': ['32']}, {'input': '2 0 2\r\n', 'output': ['32']}] | [{'input': '0 1 1\r\n', 'output': ['32']}, {'input': '95 2 3\r\n', 'output': ['171']}, {'input': '2 2 2\r\n', 'output': ['32']}, {'input': '0 0 2\r\n', 'output': ['32']}, {'input': '99 97 98\r\n', 'output': ['177']}] | [{'input': '1 2 1\r\n', 'output': ['32']}, {'input': '2 0 1\r\n', 'output': ['32']}, {'input': '89 97 2\r\n', 'output': ['175']}, {'input': '1 3 2\r\n', 'output': ['34']}, {'input': '1 2 0\r\n', 'output': ['31']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 25 | 100 | 100 | 100 |
["3", "4"] | A single line contains one non-negative integer $$$n$$$ ($$$0 \le n \leq 10^{18}$$$)Β β the number of Shiro's friends. The circular pizza has to be sliced into $$$n + 1$$$ pieces. | 236177ff30dafe68295b5d33dc501828 | #include <stdio.h>
int main()
{
long long int n;
scanf("%lld", &n);
n = n+1;
if(n%2==0||n-1==0)
printf("%lld",n/2);
else
printf("%lld",n);
} | ["2", "5"] | C | NoteTo cut the round pizza into quarters one has to make two cuts through the center with angle $$$90^{\circ}$$$ between them.To cut the round pizza into five equal parts one has to make five cuts. | A single integerΒ β the number of straight cuts Shiro needs. | Katie, Kuro and Shiro are best friends. They have known each other since kindergarten. That's why they often share everything with each other and work together on some very hard problems.Today is Shiro's birthday. She really loves pizza so she wants to invite her friends to the pizza restaurant near her house to celebr... | [{"input": "3\r\n", "output": ["2"]}, {"input": "4\r\n", "output": ["5"]}, {"input": "10\r\n", "output": ["11"]}, {"input": "10000000000\r\n", "output": ["10000000001"]}, {"input": "1234567891\r\n", "output": ["617283946"]}, {"input": "7509213957\r\n", "output": ["3754606979"]}, {"input": "99999999999999999\r\n", "outp... | 100 | 100 | 100 | [{'input': '712394453192\r\n', 'output': ['712394453193']}, {'input': '148049062628894320\r\n', 'output': ['148049062628894321']}, {'input': '172212168\r\n', 'output': ['172212169']}, {'input': '63\r\n', 'output': ['32']}, {'input': '10\r\n', 'output': ['11']}] | [{'input': '563324731189330734\r\n', 'output': ['563324731189330735']}, {'input': '7\r\n', 'output': ['4']}, {'input': '21\r\n', 'output': ['11']}, {'input': '666729339802329204\r\n', 'output': ['666729339802329205']}, {'input': '615812229161735895\r\n', 'output': ['307906114580867948']}] | [{'input': '615812229161735895\r\n', 'output': ['307906114580867948']}, {'input': '856674611404539671\r\n', 'output': ['428337305702269836']}, {'input': '252509054433933439\r\n', 'output': ['126254527216966720']}, {'input': '645762258982631926\r\n', 'output': ['645762258982631927']}, {'input': '0\r\n', 'output': ['0']}... | [{'input': '354979173822804781\r\n', 'output': ['177489586911402391']}, {'input': '563324731189330734\r\n', 'output': ['563324731189330735']}, {'input': '0\r\n', 'output': ['0']}, {'input': '99999999999999999\r\n', 'output': ['50000000000000000']}, {'input': '15\r\n', 'output': ['8']}] | [{'input': '21\r\n', 'output': ['11']}, {'input': '615812229161735895\r\n', 'output': ['307906114580867948']}, {'input': '711066337317063338\r\n', 'output': ['711066337317063339']}, {'input': '791809296303238499\r\n', 'output': ['395904648151619250']}, {'input': '666729339802329204\r\n', 'output': ['666729339802329205'... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 75 | 100 | 100 | 75 | 26 | 100 | 100 | 85 |
["7 2", "59 9"] | The input consists of two integers n and k, separated by spaces β the size of the program in lines and the productivity reduction coefficient, 1ββ€βnββ€β109, 2ββ€βkββ€β10. | 41dfc86d341082dd96e089ac5433dc04 | #include<stdio.h>
typedef long long int L;
int k;
L i,s,n;
int check(L m)
{
s=0;
for(i=m;i>0;i=i/k)
{
s=s+i;
if(s>=n) return 1;
}
return 0;
}
int main()
{
L low=1,high,mid;
scanf("%I64d%d",&n,&k);
high=n;
while(low<high)
{
mid=(low+high)/2;
if(chec... | ["4", "54"] | C | NoteIn the first sample the answer is vβ=β4. Vasya writes the code in the following portions: first 4 lines, then 2, then 1, and then Vasya falls asleep. Thus, he manages to write 4β+β2β+β1β=β7 lines in a night and complete the task.In the second sample the answer is vβ=β54. Vasya writes the code in the following porti... | Print the only integer β the minimum value of v that lets Vasya write the program in one night. | One day a highly important task was commissioned to Vasya β writing a program in a night. The program consists of n lines of code. Vasya is already exhausted, so he works like that: first he writes v lines of code, drinks a cup of tea, then he writes as much as lines, drinks another cup of tea, then he writes lines a... | [{"input": "7 2\r\n", "output": ["4"]}, {"input": "59 9\r\n", "output": ["54"]}, {"input": "1 9\r\n", "output": ["1"]}, {"input": "11 2\r\n", "output": ["7"]}, {"input": "747 2\r\n", "output": ["376"]}, {"input": "6578 2\r\n", "output": ["3293"]}, {"input": "37212 2\r\n", "output": ["18609"]}, {"input": "12357 2\r\n", ... | 100 | 100 | 100 | [{'input': '1000000000 5\r\n', 'output': ['800000003']}, {'input': '35648 10\r\n', 'output': ['32085']}, {'input': '92153348 9\r\n', 'output': ['81914089']}, {'input': '7 2\r\n', 'output': ['4']}, {'input': '37212 2\r\n', 'output': ['18609']}] | [{'input': '12357 2\r\n', 'output': ['6181']}, {'input': '177583558 10\r\n', 'output': ['159825206']}, {'input': '747 2\r\n', 'output': ['376']}, {'input': '1000000000 3\r\n', 'output': ['666666672']}, {'input': '689973 7\r\n', 'output': ['591408']}] | [{'input': '999999999 10\r\n', 'output': ['900000000']}, {'input': '246 10\r\n', 'output': ['222']}, {'input': '1000000000 5\r\n', 'output': ['800000003']}, {'input': '3018012 8\r\n', 'output': ['2640764']}, {'input': '19 6\r\n', 'output': ['17']}] | [{'input': '8 9\r\n', 'output': ['8']}, {'input': '1000000000 8\r\n', 'output': ['875000004']}, {'input': '1 2\r\n', 'output': ['1']}, {'input': '1000000000 5\r\n', 'output': ['800000003']}, {'input': '6 8\r\n', 'output': ['6']}] | [{'input': '67127156 6\r\n', 'output': ['55939302']}, {'input': '11 2\r\n', 'output': ['7']}, {'input': '3024524 5\r\n', 'output': ['2419624']}, {'input': '2 5\r\n', 'output': ['2']}, {'input': '92153348 9\r\n', 'output': ['81914089']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 27 | 100 | 100 | 100 |
["5 2 1 4 10", "5 2 1 4 5"] | The first line contains 5 positive integers d,βk,βa,βb,βt (1ββ€βdββ€β1012; 1ββ€βk,βa,βb,βtββ€β106; aβ<βb), where: d β the distance from home to the post office; k β the distance, which car is able to drive before breaking; a β the time, which Vasiliy spends to drive 1 kilometer on his car; b β the time, which Vasil... | 359ddf1f1aed9b3256836e5856fe3466 | #include <stdio.h>
int main() {
long long d, ans, k, a, b, t;
scanf("%lld%lld%lld%lld%lld", &d, &k, &a, &b, &t);
if (d < k)
ans = d * a;
else {
ans = k * a + (d - k) * b;
if (ans > (d / k) * (k * a + t) - t + (d % k) * b)
ans = (d / k) * (k * a + t) - t + (d % k) * b;
if (ans > (d / k) * (k * a + t) + ... | ["14", "13"] | C | NoteIn the first example Vasiliy needs to drive the first 2 kilometers on the car (in 2 seconds) and then to walk on foot 3 kilometers (in 12 seconds). So the answer equals to 14 seconds.In the second example Vasiliy needs to drive the first 2 kilometers on the car (in 2 seconds), then repair his car (in 5 seconds) and... | Print the minimal time after which Vasiliy will be able to reach the post office. | Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d kilometers.Vasiliy's car is not new β it breaks after driven every k kilometers and Vasiliy needs t seconds to repair it. After repairing his car Vasiliy can drive again (but after k kilometers it will br... | [{"input": "5 2 1 4 10\r\n", "output": ["14"]}, {"input": "5 2 1 4 5\r\n", "output": ["13"]}, {"input": "1 1 1 2 1\r\n", "output": ["1"]}, {"input": "1000000000000 1000000 999999 1000000 1000000\r\n", "output": ["999999999999000000"]}, {"input": "997167959139 199252 232602 952690 802746\r\n", "output": ["23194727901896... | 100 | 100 | 100 | [{'input': '1 1 1 2 1\r\n', 'output': ['1']}, {'input': '100 120 1 2 507\r\n', 'output': ['100']}, {'input': '2 100 1 2 10\r\n', 'output': ['2']}, {'input': '5 2 1 4 10\r\n', 'output': ['14']}, {'input': '1 10 10 11 12\r\n', 'output': ['10']}] | [{'input': '5 6 1 2 10000\r\n', 'output': ['5']}, {'input': '28 32 37 38 180\r\n', 'output': ['1036']}, {'input': '9 1 1 2 1\r\n', 'output': ['17']}, {'input': '1 10 10 11 12\r\n', 'output': ['10']}, {'input': '100 125 1 2 300\r\n', 'output': ['100']}] | [{'input': '100 120 1 2 525\r\n', 'output': ['100']}, {'input': '2 3 1 4 10\r\n', 'output': ['2']}, {'input': '100 120 1 2 513\r\n', 'output': ['100']}, {'input': '2 100 1 2 10\r\n', 'output': ['2']}, {'input': '11 12 3 4 5\r\n', 'output': ['33']}] | [{'input': '100 5 20 21 50\r\n', 'output': ['2095']}, {'input': '1 17 9 10 6\r\n', 'output': ['9']}, {'input': '100 120 1 2 306\r\n', 'output': ['100']}, {'input': '5 10 1 2000 100000\r\n', 'output': ['5']}, {'input': '5 17 2 3 8\r\n', 'output': ['10']}] | [{'input': '2 1 3 8 14\r\n', 'output': ['11']}, {'input': '15 5 11 20 15\r\n', 'output': ['195']}, {'input': '501 47 789 798 250\r\n', 'output': ['397789']}, {'input': '100 5 20 21 50\r\n', 'output': ['2095']}, {'input': '100 120 1 2 516\r\n', 'output': ['100']}] | 100 | 100 | 100 | 100 | 100 | 81.82 | 81.82 | 54.55 | 81.82 | 100 | 66.67 | 66.67 | 16.67 | 66.67 | 100 | 28 | 100 | 80.002 | 63.336 |
["5 3 2\nto head\n0001001", "3 2 1\nto tail\n0001"] | The first line contains three integers n, m and k. They represent the number of wagons in the train, the stowaway's and the controller's initial positions correspondingly (2ββ€βnββ€β50, 1ββ€βm,βkββ€βn, mββ βk). The second line contains the direction in which a controller moves. "to head" means that the controller moves to t... | 2222ce16926fdc697384add731819f75 | #include <stdio.h>
int main() {
int n,m,k;
int i;
char a[3],b[5];
char c[201];
char *p;
// 1-> -1<-
int d;
scanf("%d %d %d", &n, &m, &k);
scanf("%s %s",a,b);
scanf("%s", c);
if(b[0] == 'h')
d = -1;
else
d = 1;
for(p=c,i=1; *p!='\0'; p++,i++) {
if(*p=='0') {
// move stowaway
if(d == 1 && m... | ["Stowaway", "Controller 2"] | C | null | If the stowaway wins, print "Stowaway" without quotes. Otherwise, print "Controller" again without quotes, then, separated by a space, print the number of a minute, at which the stowaway will be caught. | A stowaway and a controller play the following game. The train is represented by n wagons which are numbered with positive integers from 1 to n from the head to the tail. The stowaway and the controller are initially in some two different wagons. Every minute the train can be in one of two conditions β moving or idle. ... | [{"input": "5 3 2\r\nto head\r\n0001001\r\n", "output": ["Stowaway"]}, {"input": "3 2 1\r\nto tail\r\n0001\r\n", "output": ["Controller 2"]}, {"input": "4 2 1\r\nto tail\r\n1000001\r\n", "output": ["Controller 6"]}, {"input": "2 1 2\r\nto head\r\n111111\r\n", "output": ["Stowaway"]}, {"input": "4 1 4\r\nto head\r\n0100... | 100 | 100 | 100 | [{'input': '3 2 3\r\nto head\r\n0000000000000000001\r\n', 'output': ['Controller 2']}, {'input': '13 9 8\r\nto tail\r\n000000000000000000000000000010011100000000000100100000000010000100000000000000000000000000000000000000010000011\r\n', 'output': ['Controller 5']}, {'input': '31 7 15\r\nto tail\r\n001000000000000010000... | [{'input': '5 1 4\r\nto head\r\n1000000000001\r\n', 'output': ['Controller 7']}, {'input': '3 1 3\r\nto head\r\n11111111101111101111011011001011101100101101111111111011011111110011110101010111111101101010010111110110111111011111111111111111111110011111011011101110111111111111100111001110111110111011100111111111\r\n', '... | [{'input': '50 9 39\r\nto tail\r\n00000000000000001000000000000000000000000000000000000000000010000000100000000000000001000100000000000000010000000001000000000000000000000000010000000000000000000000000000000000001000000000000000000101\r\n', 'output': ['Stowaway']}, {'input': '2 2 1\r\nto tail\r\n1101\r\n', 'output': ['... | [{'input': '42 24 17\r\nto head\r\n00000000000000000000100010000000000000000000001000100000000000000000001000000000000010000100100000100000001000000010010000000000101000000000000000010000000000000000000000000011001\r\n', 'output': ['Stowaway']}, {'input': '2 2 1\r\nto tail\r\n1011111111111111111011101111111111111111111... | [{'input': '10 3 6\r\nto head\r\n0000001001010100000001010001000110001100011100000100100001100000001100000000000010000001000100100011\r\n', 'output': ['Controller 5']}, {'input': '4 1 4\r\nto head\r\n010001\r\n', 'output': ['Stowaway']}, {'input': '5 3 2\r\nto head\r\n0001001\r\n', 'output': ['Stowaway']}, {'input': '6... | 100 | 100 | 100 | 100 | 100 | 94.87 | 92.31 | 97.44 | 94.87 | 94.87 | 94.74 | 92.11 | 94.74 | 89.47 | 92.11 | 29 | 100 | 94.872 | 92.634 |
["1 1 1", "1 2 2", "1 3 5", "6 2 9"] | The first and only line of input contains three space-separated integers a, b and c (1ββ€βa,βb,βcββ€β5β000)Β β the number of islands in the red, blue and purple clusters, respectively. | b6dc5533fbf285d5ef4cf60ef6300383 | #include <stdio.h>
long long dp[5001][5001],a,b,c;
int main()
{
scanf("%I64d%I64d%I64d",&a,&b,&c);
for(int i=0;i<=5000;i++) dp[i][0]=dp[0][i]=1;
for(int i=1;i<=5000;i++)
for(int j=1;j<=5000;j++)
dp[i][j]=(dp[i-1][j]+(dp[i-1][j-1]*j)%998244353)%998244353;
printf("%I64d\n",(dp[a][b]*dp... | ["8", "63", "3264", "813023575"] | C | NoteIn the first example, there are 3 bridges that can possibly be built, and no setup of bridges violates the restrictions. Thus the answer is 23β=β8.In the second example, the upper two structures in the figure below are instances of valid ones, while the lower two are invalid due to the blue and purple clusters, res... | Output one line containing an integerΒ β the number of different ways to build bridges, modulo 998β244β353. | β This is not playing but duty as allies of justice, Nii-chan!β Not allies but justice itself, Onii-chan!With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire SistersΒ β Karen and TsukihiΒ β is heading for somewhere they've never reachedΒ β water-surrounded islands!There are three clust... | [{"input": "1 1 1\r\n", "output": ["8"]}, {"input": "1 2 2\r\n", "output": ["63"]}, {"input": "1 3 5\r\n", "output": ["3264"]}, {"input": "6 2 9\r\n", "output": ["813023575"]}, {"input": "7 3 7\r\n", "output": ["807577560"]}, {"input": "135 14 39\r\n", "output": ["414849507"]}, {"input": "5000 5000 5000\r\n", "output":... | 100 | 100 | 100 | [{'input': '16 8 29\r\n', 'output': ['349763770']}, {'input': '2048 4096 1024\r\n', 'output': ['445542375']}, {'input': '28 47 1\r\n', 'output': ['517406193']}, {'input': '1171 2989 2853\r\n', 'output': ['234725427']}, {'input': '4998 4998 4998\r\n', 'output': ['259368717']}] | [{'input': '1158 506 4676\r\n', 'output': ['6109065']}, {'input': '179 856 377\r\n', 'output': ['518957210']}, {'input': '4756 775 3187\r\n', 'output': ['56242066']}, {'input': '4996 1 5000\r\n', 'output': ['196902859']}, {'input': '1 1 1\r\n', 'output': ['8']}] | [{'input': '1171 2989 2853\r\n', 'output': ['234725427']}, {'input': '7 3 7\r\n', 'output': ['807577560']}, {'input': '28 47 1\r\n', 'output': ['517406193']}, {'input': '4 2 5\r\n', 'output': ['326151']}, {'input': '3238 2923 4661\r\n', 'output': ['636587126']}] | [{'input': '1 2 2\r\n', 'output': ['63']}, {'input': '7 3 7\r\n', 'output': ['807577560']}, {'input': '4998 4998 4998\r\n', 'output': ['259368717']}, {'input': '4 2 5\r\n', 'output': ['326151']}, {'input': '135 14 39\r\n', 'output': ['414849507']}] | [{'input': '1158 506 4676\r\n', 'output': ['6109065']}, {'input': '84 29 61\r\n', 'output': ['391253501']}, {'input': '4539 2805 2702\r\n', 'output': ['356944655']}, {'input': '1 1 1\r\n', 'output': ['8']}, {'input': '4756 775 3187\r\n', 'output': ['56242066']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 30 | 100 | 100 | 100 |
["a1\nb2", "a8\nd4"] | The first input line contains the description of the rook's position on the board. This description is a line which is 2 in length. Its first symbol is a lower-case Latin letter from a to h, and its second symbol is a number from 1 to 8. The second line contains the description of the knight's position in a similar way... | 073023c6b72ce923df2afd6130719cfc | #include<stdio.h>
int board[191][119];
int main(){
int a,b,c,d,e;
char input[50];
char input1[50];
int i; int cnt=0;
scanf("%s%s",input,input1);
board[input[0]-'a'][(input[1]-'0')-1]=1;
board[input1[0]-'a'][(input1[1]-'0')-1]=1;
int rook=input[0]-'a'; int rook1=(input[1]-'0')-1;
for... | ["44", "38"] | C | null | Print a single number which is the required number of ways. | Two chess pieces, a rook and a knight, stand on a standard chessboard 8βΓβ8 in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other one.Your task is to find the number of ways to place another knight on the board so that none of the three pieces on the board beat ... | [{"input": "a1\r\nb2\r\n", "output": ["44"]}, {"input": "a8\r\nd4\r\n", "output": ["38"]}, {"input": "a8\r\nf1\r\n", "output": ["42"]}, {"input": "f8\r\nh3\r\n", "output": ["42"]}, {"input": "g8\r\nb7\r\n", "output": ["42"]}, {"input": "h1\r\ng5\r\n", "output": ["42"]}, {"input": "c6\r\nb5\r\n", "output": ["39"]}, {"in... | 100 | 100 | 100 | [{'input': 'e1\r\nd6\r\n', 'output': ['38']}, {'input': 'h8\r\ng2\r\n', 'output': ['43']}, {'input': 'e1\r\na7\r\n', 'output': ['41']}, {'input': 'a8\r\nb7\r\n', 'output': ['44']}, {'input': 'g1\r\ne6\r\n', 'output': ['39']}] | [{'input': 'a3\r\nc8\r\n', 'output': ['41']}, {'input': 'a1\r\nb2\r\n', 'output': ['44']}, {'input': 'a1\r\nb7\r\n', 'output': ['43']}, {'input': 'g2\r\nb7\r\n', 'output': ['40']}, {'input': 'a3\r\nd6\r\n', 'output': ['38']}] | [{'input': 'b5\r\nh8\r\n', 'output': ['40']}, {'input': 'h6\r\na8\r\n', 'output': ['43']}, {'input': 'a1\r\nb2\r\n', 'output': ['44']}, {'input': 'e1\r\nd6\r\n', 'output': ['38']}, {'input': 'h1\r\ng5\r\n', 'output': ['42']}] | [{'input': 'g2\r\nb7\r\n', 'output': ['40']}, {'input': 'e6\r\nf2\r\n', 'output': ['35']}, {'input': 'h6\r\na1\r\n', 'output': ['42']}, {'input': 'b5\r\nc1\r\n', 'output': ['39']}, {'input': 'f8\r\na3\r\n', 'output': ['40']}] | [{'input': 'c6\r\nb5\r\n', 'output': ['39']}, {'input': 'a8\r\nf1\r\n', 'output': ['42']}, {'input': 'b5\r\nc1\r\n', 'output': ['39']}, {'input': 'g8\r\nb7\r\n', 'output': ['42']}, {'input': 'f8\r\nh3\r\n', 'output': ['42']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 31 | 100 | 100 | 100 |
["1 1 1", "3 1 4"] | The first line will contain three integers integer k,βpa,βpb (1ββ€βkββ€β1β000, 1ββ€βpa,βpbββ€β1β000β000). | 0dc9f5d75143a2bc744480de859188b4 | #include <stdio.h>
#define MOD 1000000007
int K;
long long PA,PB,ans;
long long INV1,INV2;
long long f[1010][2010];
long long power(long long a,int b)
{
long long y = 1;
for(;b;b>>=1)
{
if(b&1) y = y * a % MOD;
a = a * a % MOD;
}
return y;
}
int main()
{
int i,j;
long lon... | ["2", "370000006"] | C | NoteThe first sample, we will keep appending to our sequence until we get the subsequence 'ab' at least once. For instance, we get the sequence 'ab' with probability 1/4, 'bbab' with probability 1/16, and 'aab' with probability 1/8. Note, it's impossible for us to end with a sequence like 'aabab', since we would have s... | Print a single integer, the answer to the problem. | You are given three integers k, pa and pb.You will construct a sequence with the following algorithm: Initially, start with the empty sequence. Each second, you do the following. With probability paβ/β(paβ+βpb), add 'a' to the end of the sequence. Otherwise (with probability pbβ/β(paβ+βpb)), add 'b' to the end of the s... | [{"input": "1 1 1\r\n", "output": ["2"]}, {"input": "3 1 4\r\n", "output": ["370000006"]}, {"input": "1000 123456 654321\r\n", "output": ["977760856"]}, {"input": "305 337309 378395\r\n", "output": ["174667130"]}, {"input": "108 531040 908573\r\n", "output": ["145579983"]}, {"input": "575 39377 68346\r\n", "output": ["... | 100 | 100 | 100 | [{'input': '57 339480 774350\r\n', 'output': ['622654301']}, {'input': '270 967166 795005\r\n', 'output': ['530539317']}, {'input': '97 119368 2062\r\n', 'output': ['2436614']}, {'input': '305 337309 378395\r\n', 'output': ['174667130']}, {'input': '3 1 4\r\n', 'output': ['370000006']}] | [{'input': '575 39377 68346\r\n', 'output': ['899189133']}, {'input': '270 967166 795005\r\n', 'output': ['530539317']}, {'input': '177 2501 570142\r\n', 'output': ['779148936']}, {'input': '305 337309 378395\r\n', 'output': ['174667130']}, {'input': '3 1 4\r\n', 'output': ['370000006']}] | [{'input': '781 817338 452871\r\n', 'output': ['711597307']}, {'input': '192 42070 61266\r\n', 'output': ['904814024']}, {'input': '892 777143 664073\r\n', 'output': ['527873013']}, {'input': '270 967166 795005\r\n', 'output': ['530539317']}, {'input': '3 1 4\r\n', 'output': ['370000006']}] | [{'input': '757 869978 224540\r\n', 'output': ['921904658']}, {'input': '3 1 4\r\n', 'output': ['370000006']}, {'input': '1000 1000000 1\r\n', 'output': ['478180868']}, {'input': '57 339480 774350\r\n', 'output': ['622654301']}, {'input': '97 119368 2062\r\n', 'output': ['2436614']}] | [{'input': '38 592277 400426\r\n', 'output': ['499077928']}, {'input': '305 337309 378395\r\n', 'output': ['174667130']}, {'input': '177 2501 570142\r\n', 'output': ['779148936']}, {'input': '781 817338 452871\r\n', 'output': ['711597307']}, {'input': '99 534023 117289\r\n', 'output': ['29694885']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 32 | 100 | 100 | 100 |
["10", "4", "3"] | The first and only line contains an integer n (1ββ€βnββ€β106) which represents the denomination of the most expensive coin. | 2fc946bb72f56b6d86eabfaf60f9fa63 | #include <stdio.h>
int main()
{
int i = 2, num;
scanf("%d", &num);
printf("%d ", num);
while(num > 1){
for(i = 2; i < num && num % i != 0; i++){}
num /= i;
printf("%d ", num);
}
return 0;
}
| ["10 5 1", "4 2 1", "3 1"] | C | null | Print the denominations of all the coins in the order of decreasing. The number of coins must be the largest possible (with the given denomination n of the most expensive coin). Also, the denomination of every coin must be divisible by the denomination of any cheaper coin. Naturally, the denominations of all the coins ... | In Berland a money reform is being prepared. New coins are being introduced. After long economic calculations was decided that the most expensive coin should possess the denomination of exactly n Berland dollars. Also the following restriction has been introduced for comfort: the denomination of each coin should be div... | [{"input": "10\r\n", "output": ["10 5 1", "10\r\n5\r\n1"]}, {"input": "4\r\n", "output": ["4\r\n2\r\n1", "4 2 1"]}, {"input": "3\r\n", "output": ["3 1", "3\r\n1"]}, {"input": "2\r\n", "output": ["2 1", "2\r\n1"]}, {"input": "5\r\n", "output": ["5\r\n1", "5 1"]}, {"input": "6\r\n", "output": ["6\r\n3\r\n1", "6 3 1"]}, {... | 100 | 100 | 100 | [{'input': '1000\r\n', 'output': ['1000 500 250 125 25 5 1', '1000\r\n500\r\n250\r\n125\r\n25\r\n5\r\n1']}, {'input': '3\r\n', 'output': ['3 1', '3\r\n1']}, {'input': '537000\r\n', 'output': ['537000 268500 134250 67125 22375 4475 895 179 1', '537000\r\n268500\r\n134250\r\n67125\r\n22375\r\n4475\r\n895\r\n179\r\n1']}, ... | [{'input': '120\r\n', 'output': ['120\r\n60\r\n30\r\n15\r\n5\r\n1', '120 60 30 15 5 1']}, {'input': '6\r\n', 'output': ['6\r\n3\r\n1', '6 3 1']}, {'input': '784653\r\n', 'output': ['784653 261551 9019 311 1', '784653\r\n261551\r\n9019\r\n311\r\n1']}, {'input': '5\r\n', 'output': ['5\r\n1', '5 1']}, {'input': '2430\r\n'... | [{'input': '572877\r\n', 'output': ['572877\r\n190959\r\n63653\r\n1201\r\n1', '572877 190959 63653 1201 1']}, {'input': '4\r\n', 'output': ['4\r\n2\r\n1', '4 2 1']}, {'input': '10\r\n', 'output': ['10 5 1', '10\r\n5\r\n1']}, {'input': '7\r\n', 'output': ['7 1', '7\r\n1']}, {'input': '1\r\n', 'output': ['1']}] | [{'input': '9\r\n', 'output': ['9 3 1', '9\r\n3\r\n1']}, {'input': '473273\r\n', 'output': ['473273\r\n2243\r\n1', '473273 2243 1']}, {'input': '999999\r\n', 'output': ['999999\r\n333333\r\n111111\r\n37037\r\n5291\r\n481\r\n37\r\n1', '999999 333333 111111 37037 5291 481 37 1']}, {'input': '25\r\n', 'output': ['25 5 1',... | [{'input': '15\r\n', 'output': ['15\r\n5\r\n1', '15 5 1']}, {'input': '36\r\n', 'output': ['36 18 9 3 1', '36\r\n18\r\n9\r\n3\r\n1']}, {'input': '473273\r\n', 'output': ['473273\r\n2243\r\n1', '473273 2243 1']}, {'input': '25\r\n', 'output': ['25 5 1', '25\r\n5\r\n1']}, {'input': '119070\r\n', 'output': ['119070\r\n595... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 33 | 100 | 100 | 100 |
["7 1 4", "30 20 10"] | The first line of the input contains three distinct integers x1, x2 and x3 (1ββ€βx1,βx2,βx3ββ€β100)Β β the coordinates of the houses of the first, the second and the third friends respectively. | 7bffa6e8d2d21bbb3b7f4aec109b3319 | #include <stdio.h>
#include <stdlib.h>
int main(){
int a[3];
int b;
scanf("%d%d%d", &a[0], &a[1], &a[2]);
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j ++)
if (a[i] < a[j])
{
b = a[i];
a[i] = a[j];
a[j] = b;
}
printf("%d", a... | ["6", "20"] | C | NoteIn the first sample, friends should meet at the point 4. Thus, the first friend has to travel the distance of 3 (from the point 7 to the point 4), the second friend also has to travel the distance of 3 (from the point 1 to the point 4), while the third friend should not go anywhere because he lives at the point 4. | Print one integerΒ β the minimum total distance the friends need to travel in order to meet together. | There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the New Year together, so they need to meet at one point. What is the minimum total distance they have to... | [{"input": "7 1 4\r\n", "output": ["6"]}, {"input": "30 20 10\r\n", "output": ["20"]}, {"input": "1 4 100\r\n", "output": ["99"]}, {"input": "100 1 91\r\n", "output": ["99"]}, {"input": "1 45 100\r\n", "output": ["99"]}, {"input": "1 2 3\r\n", "output": ["2"]}, {"input": "71 85 88\r\n", "output": ["17"]}, {"input": "30... | 100 | 100 | 100 | [{'input': '30 38 99\r\n', 'output': ['69']}, {'input': '86 97 68\r\n', 'output': ['29']}, {'input': '4 2 6\r\n', 'output': ['4']}, {'input': '42 53 51\r\n', 'output': ['11']}, {'input': '1 100 2\r\n', 'output': ['99']}] | [{'input': '84 61 35\r\n', 'output': ['49']}, {'input': '1 3 2\r\n', 'output': ['2']}, {'input': '50 13 75\r\n', 'output': ['62']}, {'input': '30 38 99\r\n', 'output': ['69']}, {'input': '25 97 93\r\n', 'output': ['72']}] | [{'input': '41 28 98\r\n', 'output': ['70']}, {'input': '43 92 30\r\n', 'output': ['62']}, {'input': '15 10 5\r\n', 'output': ['10']}, {'input': '7 1 4\r\n', 'output': ['6']}, {'input': '75 8 35\r\n', 'output': ['67']}] | [{'input': '23 82 95\r\n', 'output': ['72']}, {'input': '30 38 99\r\n', 'output': ['69']}, {'input': '76 50 9\r\n', 'output': ['67']}, {'input': '9 94 77\r\n', 'output': ['85']}, {'input': '30 20 10\r\n', 'output': ['20']}] | [{'input': '1 45 100\r\n', 'output': ['99']}, {'input': '1 2 3\r\n', 'output': ['2']}, {'input': '95 37 34\r\n', 'output': ['61']}, {'input': '15 10 5\r\n', 'output': ['10']}, {'input': '1 4 6\r\n', 'output': ['5']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 34 | 100 | 100 | 100 |
["... ... ...\n... ... ...\n... ... ...\n\n... ... ...\n... ... ...\n... x.. ...\n\n... ... ...\n... ... ...\n... ... ...\n6 4", "xoo x.. x..\nooo ... ...\nooo ... ...\n\nx.. x.. x..\n... ... ...\n... ... ...\n\nx.. x.. x..\n... ... ...\n... ... ...\n7 4", "o.. ... ...\n... ... ...\n... ... ...\n\n... xxx ...\n... xox ... | First 11 lines contains descriptions of table with 9 rows and 9 columns which are divided into 9 small fields by spaces and empty lines. Each small field is described by 9 characters without spaces and empty lines. character "x" (ASCII-code 120) means that the cell is occupied with chip of the first player, character "... | 8f0fad22f629332868c39969492264d3 | #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define eps 1e-4
#define PI acos(-1.0)
char s[10][15];
int sti[4]={0,1,4,7},eni[4]={0,3,6,9};
int stj[4]={0,0,4,8},enj[4]={0,2,6,10};
void printall2()
{
for (int i=1;i<=9;i++)
{
for (int j=0;j<=10;j++)
if (s[i][j]=='.') printf("!");
... | ["... ... ... \n... ... ... \n... ... ... \n\n... ... ... \n... ... ... \n... x.. ... \n\n!!! ... ... \n!!! ... ... \n!!! ... ...", "xoo x!! x!! \nooo !!! !!! \nooo !!! !!! \n\nx!! x!! x!! \n!!! !!! !!! \n!!! !!! !!! \n\nx!! x!! x!! \n!!! !!! !!! \n!!! !!! !!!", "o!! !!! !!! \n!!! !!! !!! \n!!! !!! !!! \n\n!!! xxx !!! ... | C | NoteIn the first test case the first player made a move to lower left cell of central field, so the second player can put a chip only to cells of lower left field.In the second test case the last move was done to upper left cell of lower central field, however all cells in upper left field are occupied, so the second p... | Output the field in same format with characters "!" (ASCII-code 33) on positions where the current player can put his chip. All other cells should not be modified. | Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.The game is played on the following field. Players are making moves by turns. At first move a player can put his chip in any cell of any small field. ... | [{"input": "... ... ...\r\n... ... ...\r\n... ... ...\r\n\r\n... ... ...\r\n... ... ...\r\n... x.. ...\r\n\r\n... ... ...\r\n... ... ...\r\n... ... ...\r\n6 4\r\n", "output": ["... ... ...\r\n ... ... ...\r\n ... ... ...\r\n\r\n ... ... ...\r\n ... ... ...\r\n ... x.. ...\r\n\r\n !!! ... ...\r\n !!! ... ...\r\n !!! ...... | 100 | 100 | 100 | [{'input': 'oxo xoo ox.\r\nxxx xoo xxo\r\nxoo xxx xox\r\n\r\nxxx xxx xoo\r\nooo o.o oxx\r\nxxo ooo xxx\r\n\r\nooo oox ooo\r\nooo oxo xxx\r\nxxo xox xxo\r\n6 1\r\n', 'output': ['oxo xoo ox!\r\n xxx xoo xxo\r\n xoo xxx xox\r\n\r\n xxx xxx xoo\r\n ooo o!o oxx\r\n xxo ooo xxx\r\n\r\n ooo oox ooo\r\n ooo oxo xxx\r\n xxo xox... | [{'input': '... xo. o..\r\noo. ..o xx.\r\n..x x.. ..o\r\n\r\n.ox .xx ...\r\no.x xox xo.\r\nxox .xo ..o\r\n\r\n..o ... xxo\r\no.. .o. oxo\r\n..o x.. ..x\r\n8 9\r\n', 'output': ['... xo. o.. \r\noo. ..o xx. \r\n..x x.. ..o \r\n\r\n.ox .xx !!! \r\no.x xox xo! \r\nxox .xo !!o \r\n\r\n..o ... xxo \r\no.. .o. oxo \r\n..o x..... | [{'input': 'ooo xxx .x.\r\nxxo oox ooo\r\n.o. oox xxx\r\n\r\nxox oxx xxo\r\nxxx oxx oxx\r\noxx ooo ooo\r\n\r\n.oo xoo xo.\r\nxxo oox ooo\r\nxox xxx xxo\r\n5 1\r\n', 'output': ['ooo xxx !x! \r\nxxo oox ooo \r\n!o! oox xxx \r\n\r\nxox oxx xxo \r\nxxx oxx oxx \r\noxx ooo ooo \r\n\r\n!oo xoo xo! \r\nxxo oox ooo \r\nxox xxx... | [{'input': 'oxo xox ooo\r\n.xo xxo oxx\r\nxxx oxo xxx\r\n\r\nxxo oxx .xx\r\nxo. xoo oxx\r\noxo oxx xox\r\n\r\nxoo ooo oox\r\nooo ooo xxo\r\nxxx x.o oxo\r\n2 2\r\n', 'output': ['oxo xox ooo \r\n!xo xxo oxx \r\nxxx oxo xxx \r\n\r\nxxo oxx !xx \r\nxo! xoo oxx \r\noxo oxx xox \r\n\r\nxoo ooo oox \r\nooo ooo xxo \r\nxxx x!o... | [{'input': 'xxo xoo xxo\r\nooo ooo xxx\r\noox oxo oxx\r\n\r\noxo oxo xxx\r\nxoo oxx oxo\r\nxxx oxx ooo\r\n\r\noxx xoo xxo\r\nxxx oox xox\r\nxxo o.o oxo\r\n9 6\r\n', 'output': ['xxo xoo xxo\r\n ooo ooo xxx\r\n oox oxo oxx\r\n\r\n oxo oxo xxx\r\n xoo oxx oxo\r\n xxx oxx ooo\r\n\r\n oxx xoo xxo\r\n xxx oox xox\r\n xxo o!o... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 35 | 100 | 100 | 100 |
["6\nxxxiii", "5\nxxoxx", "10\nxxxxxxxxxx"] | The first line contains integer $$$n$$$ $$$(3 \le n \le 100)$$$ β the length of the file name. The second line contains a string of length $$$n$$$ consisting of lowercase Latin letters only β the file name. | 8de14db41d0acee116bd5d8079cb2b02 | #include<stdio.h>
int main()
{
char str[100];
int i, count = 0, n;
scanf("%d", &n);
scanf("%s", str);
for(i = 0; i < n; i++)
{
if(str[i] == 'x' && str[i+1] == 'x' && str[i+2] == 'x')
count++;
}
printf("%d", count);
}
| ["1", "0", "8"] | C | NoteIn the first example Polycarp tried to send a file with name contains number $$$33$$$, written in Roman numerals. But he can not just send the file, because it name contains three letters "x" in a row. To send the file he needs to remove any one of this letters. | Print the minimum number of characters to remove from the file name so after that the name does not contain "xxx" as a substring. If initially the file name dost not contain a forbidden substring "xxx", print 0. | You can not just take the file and send it. When Polycarp trying to send a file in the social network "Codehorses", he encountered an unexpected problem. If the name of the file contains three or more "x" (lowercase Latin letters "x") in a row, the system considers that the file content does not correspond to the socia... | [{"input": "6\r\nxxxiii\r\n", "output": ["1\r\n", "1", "1\n"]}, {"input": "5\r\nxxoxx\r\n", "output": ["0\r\n", "0\n", "0"]}, {"input": "10\r\nxxxxxxxxxx\r\n", "output": ["8\n", "8", "8\r\n"]}, {"input": "100\r\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n", "... | 100 | 100 | 100 | [{'input': '10\r\nxxxxxxxxxx\r\n', 'output': ['8\n', '8', '8\r\n']}, {'input': '100\r\nuxxxxxlmexxxxxxxwnxxexxxxxcxxfydxxxxxxvmdxxxxxxisxxxxxxxxidkxxxpxxxxxxxxmnuxxxxjxxxqcxxwmxxxxxwxxxxx\r\n', 'output': ['41', '41\r\n', '41\n']}, {'input': '3\r\nxxx\r\n', 'output': ['1\r\n', '1', '1\n']}, {'input': '100\r\nihygyvdvyei... | [{'input': '100\r\nihygyvdvyeifomhxhkhdkimquvgallbqharcyriyqkidnwykozuhvkwdldlztpabgyuflikychqpdenwzgtlzotyumjgdsrbxxxx\r\n', 'output': ['2', '2\n', '2\r\n']}, {'input': '100\r\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n', 'output': ['98', '98\n', '98\r\n']}... | [{'input': '34\r\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n', 'output': ['0\r\n', '0\n', '0']}, {'input': '5\r\nfcyju\r\n', 'output': ['0\r\n', '0\n', '0']}, {'input': '10\r\nxxxxxxxxxx\r\n', 'output': ['8\n', '8', '8\r\n']}, {'input': '99\r\nxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxxaxx... | [{'input': '100\r\nxxxxxxxxxxxjtxxxxxxxxcxxxxxxcfxxxxzxxxxxxgxxxxxbxxxxbxxxxxxxxdycxxxxokixxxkizxxgcxxxxxxxxexxxxxfxxxc\r\n', 'output': ['49', '49\n', '49\r\n']}, {'input': '77\r\naaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxyyyzzz\r\n', 'output': ['0\r\n', '0\n', '0']}, {'input': '99\r\nxxaxx... | [{'input': '100\r\nuxxxxxlmexxxxxxxwnxxexxxxxcxxfydxxxxxxvmdxxxxxxisxxxxxxxxidkxxxpxxxxxxxxmnuxxxxjxxxqcxxwmxxxxxwxxxxx\r\n', 'output': ['41', '41\r\n', '41\n']}, {'input': '100\r\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n', 'output': ['98', '98\n', '98\r\n... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 36 | 100 | 100 | 100 |
["1 50\n50", "3 100\n50 50 100", "2 50\n50 50"] | The first line contains two integers n, k (1ββ€βnββ€β50,β1ββ€βkββ€β5000) β the number of people, including Greg, and the boat's weight limit. The next line contains n integers β the people's weights. A person's weight is either 50 kilos or 100 kilos. You can consider Greg and his friends indexed in some way. | ebb0323a854e19794c79ab559792a1f7 | #include <stdio.h>
#define mod 1000000007
long long dp[55][55][205]={};
long long c[55][55]={};
int n,lim,A=0,B=0,i,j,k,ii,jj;
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a<b?b:a;}
int main(){
scanf("%d %d",&n,&lim);
for(i=0;i<n;i++){
int fk; scanf("%d",&fk);
if(fk==50) A++;
else B++;
}
... | ["1\n1", "5\n2", "-1\n0"] | C | NoteIn the first test Greg walks alone and consequently, he needs only one ride across the river.In the second test you should follow the plan: transport two 50 kg. people; transport one 50 kg. person back; transport one 100 kg. person; transport one 50 kg. person back; transport two 50 kg. people. That totals to ... | In the first line print an integer β the minimum number of rides. If transporting everyone to the other bank is impossible, print an integer -1. In the second line print the remainder after dividing the number of ways to transport the people in the minimum number of rides by number 1000000007 (109β+β7). If transporting... | One day Greg and his friends were walking in the forest. Overall there were n people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there was a boat by the river bank, just where the guys were standing. We know that the boat can hold pe... | [{"input": "1 50\r\n50\r\n", "output": ["1\r\n1"]}, {"input": "3 100\r\n50 50 100\r\n", "output": ["5\r\n2"]}, {"input": "2 50\r\n50 50\r\n", "output": ["-1\r\n0"]}, {"input": "5 258\r\n100 100 50 50 50\r\n", "output": ["3\r\n72"]}, {"input": "8 191\r\n50 100 50 100 50 100 100 50\r\n", "output": ["11\r\n19318272"]}, {"... | 100 | 100 | 100 | [{'input': '5 258\r\n100 100 50 50 50\r\n', 'output': ['3\r\n72']}, {'input': '3 121\r\n100 100 50\r\n', 'output': ['-1\r\n0']}, {'input': '27 200\r\n50 50 50 50 100 100 50 50 100 100 100 50 100 50 100 50 50 100 100 100 50 100 100 50 50 50 100\r\n', 'output': ['25\r\n271877303']}, {'input': '28 183\r\n50 100 100 50 100... | [{'input': '8 271\r\n100 50 100 50 50 50 100 50\r\n', 'output': ['5\r\n78090']}, {'input': '32 121\r\n100 100 100 100 100 50 100 100 50 100 50 100 50 100 50 100 50 50 50 100 100 50 100 100 100 100 50 100 50 100 100 50\r\n', 'output': ['101\r\n245361086']}, {'input': '49 290\r\n100 100 100 100 100 100 100 100 50 100 50 ... | [{'input': '31 291\r\n50 100 100 50 100 100 100 50 100 100 100 100 50 50 50 100 100 100 50 100 100 50 50 50 50 100 100 50 50 100 100\r\n', 'output': ['23\r\n393964729']}, {'input': '2 153\r\n100 50\r\n', 'output': ['1\r\n1']}, {'input': '50 2263\r\n50 100 50 100 50 100 100 100 50 50 50 100 100 100 100 100 100 50 50 100... | [{'input': '36 250\r\n50 100 100 50 100 100 100 50 50 100 50 50 50 50 50 50 100 50 100 100 100 100 100 100 100 50 50 100 50 50 100 100 100 100 100 50\r\n', 'output': ['27\r\n77447096']}, {'input': '33 123\r\n50 100 100 100 50 100 50 50 50 50 50 100 100 50 100 50 100 50 50 50 50 50 50 50 100 100 50 50 100 100 100 100 10... | [{'input': '23 100\r\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\r\n', 'output': ['43\r\n689584957']}, {'input': '43 178\r\n50 50 100 100 100 50 100 100 50 100 100 100 50 100 50 100 50 50 100 100 50 100 100 50 50 50 100 50 50 50 100 50 100 100 100 50 100 50 50 50 50 100 100\r\n', 'output': ['6... | 100 | 100 | 100 | 100 | 100 | 100 | 97.56 | 97.56 | 97.56 | 97.56 | 100 | 97.37 | 97.37 | 97.37 | 97.37 | 37 | 100 | 98.048 | 97.896 |
["7 3 7 3 20", "7 9 3 1 8", "10 10 10 10 10"] | The only line of the input contains five integers t1, t2, t3, t4 and t5 (1ββ€βtiββ€β100)Β β numbers written on cards. | a9c17ce5fd5f39ffd70917127ce3408a | #include<stdio.h>
int minimo(int a, int b);
int main(){
int v[5], i, j, k, total = 0, min;
for(i = 0; i < 5; i++){
scanf("%d", &v[i]);
total = total + v[i];
}
min = total;
for(i = 0; i < 5; i++){
for(j = i + 1; j < 5; j++){
if(v[i] == v[j]){
if(tot... | ["26", "28", "20"] | C | NoteIn the first sample, Limak has cards with numbers 7, 3, 7, 3 and 20. Limak can do one of the following. Do nothing and the sum would be 7β+β3β+β7β+β3β+β20β=β40. Remove two cards with a number 7. The remaining sum would be 3β+β3β+β20β=β26. Remove two cards with a number 3. The remaining sum would be 7β+β7β+β20β=β... | Print the minimum possible sum of numbers written on remaining cards. | A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a positive integer.Limak can discard (throw out) some cards. His goal is to minimize the sum of numbers written on remaining (not discarded) cards.He is allowed to at most once discard two or three cards with t... | [{"input": "7 3 7 3 20\r\n", "output": ["26"]}, {"input": "7 9 3 1 8\r\n", "output": ["28"]}, {"input": "10 10 10 10 10\r\n", "output": ["20"]}, {"input": "8 7 1 8 7\r\n", "output": ["15"]}, {"input": "7 7 7 8 8\r\n", "output": ["16"]}, {"input": "8 8 8 2 2\r\n", "output": ["4"]}, {"input": "8 8 2 2 2\r\n", "output": [... | 100 | 100 | 100 | [{'input': '20 20 20 30 30\r\n', 'output': ['60']}, {'input': '100 99 98 97 96\r\n', 'output': ['490']}, {'input': '1 3 3 3 1\r\n', 'output': ['2']}, {'input': '20 21 22 23 24\r\n', 'output': ['110']}, {'input': '1 9 9 9 10\r\n', 'output': ['11']}] | [{'input': '20 21 22 23 24\r\n', 'output': ['110']}, {'input': '60 1 75 1 92\r\n', 'output': ['227']}, {'input': '2 2 3 3 3\r\n', 'output': ['4']}, {'input': '1 3 3 3 1\r\n', 'output': ['2']}, {'input': '1 1 2 2 5\r\n', 'output': ['7']}] | [{'input': '8 1 8 8 8\r\n', 'output': ['9']}, {'input': '7 7 7 8 8\r\n', 'output': ['16']}, {'input': '2 2 2 10 10\r\n', 'output': ['6']}, {'input': '2 2 5 10 10\r\n', 'output': ['9']}, {'input': '8 8 8 2 2\r\n', 'output': ['4']}] | [{'input': '8 8 2 2 2\r\n', 'output': ['6']}, {'input': '1 2 3 4 5\r\n', 'output': ['15']}, {'input': '7 7 7 8 8\r\n', 'output': ['16']}, {'input': '7 9 3 1 8\r\n', 'output': ['28']}, {'input': '8 1 8 8 8\r\n', 'output': ['9']}] | [{'input': '1 2 3 4 5\r\n', 'output': ['15']}, {'input': '7 9 3 1 8\r\n', 'output': ['28']}, {'input': '7 7 7 8 8\r\n', 'output': ['16']}, {'input': '100 99 98 97 96\r\n', 'output': ['490']}, {'input': '10 10 10 10 10\r\n', 'output': ['20']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 95.45 | 100 | 100 | 100 | 38 | 100 | 100 | 99.09 |
["0 2 0 4", "0 2 1 1", "0 2 0 1"] | The first line contains four space-separated integers β x1, x2, a and b (x1ββ βx2, aββ€βb, β-β109ββ€βx1,βx2,βa,βbββ€β109) β coordinates of the points where the first and the second participant start, and the numbers that determine the players' moves, correspondingly. | 4ea8cc3305a0ee2c1e580b43e5bc46c6 | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main(){
int i,j,k,l,m,n;
int x1, x2, a, b, fg, fgg;
int mod;
int stone;
while(scanf("%d%d%d%d",&x1,&x2,&a,&b)==4){
stone = x2 - x1;
fg = 0;
if(stone < 0) s... | ["FIRST\n2", "SECOND", "DRAW"] | C | NoteIn the first sample the first player can win in one move.In the second sample the first participant must go to point 1, where the second participant immediately goes and wins. In the third sample changing the position isn't profitable to either participant, so nobody wins. | On the first line print the outcome of the battle as "FIRST" (without the quotes), if both players play optimally and the first player wins. Print "SECOND" (without the quotes) if the second player wins and print "DRAW" (without the quotes), if nobody is able to secure the victory. If the first player wins, print on th... | The King of Flatland will organize a knights' tournament! The winner will get half the kingdom and the favor of the princess of legendary beauty and wisdom. The final test of the applicants' courage and strength will be a fencing tournament. The tournament is held by the following rules: the participants fight one on o... | [{"input": "0 2 0 4\r\n", "output": ["FIRST\r\n2"]}, {"input": "0 2 1 1\r\n", "output": ["SECOND"]}, {"input": "0 2 0 1\r\n", "output": ["DRAW"]}, {"input": "3 1 -2 2\r\n", "output": ["FIRST\r\n1"]}, {"input": "3 10 1 6\r\n", "output": ["SECOND"]}, {"input": "1 2 2 2\r\n", "output": ["DRAW"]}, {"input": "0 10 -1 1\r\n"... | 100 | 100 | 100 | [{'input': '402211447 260733897 -52 275\r\n', 'output': ['DRAW']}, {'input': '-44 -17 12 13\r\n', 'output': ['DRAW']}, {'input': '1000000000 999999999 -1000000000 -2\r\n', 'output': ['DRAW']}, {'input': '-1000000000 1000000000 1 999999999\r\n', 'output': ['SECOND']}, {'input': '434676805 434676075 -878 345\r\n', 'outpu... | [{'input': '0 2 1 1\r\n', 'output': ['SECOND']}, {'input': '0 2 0 1\r\n', 'output': ['DRAW']}, {'input': '2062 4167 2 2\r\n', 'output': ['DRAW']}, {'input': '775517456 -869957101 -1 -1\r\n', 'output': ['FIRST\r\n775517455']}, {'input': '45390 21963 -2047 -1023\r\n', 'output': ['FIRST\r\n43453']}] | [{'input': '3 10 1 6\r\n', 'output': ['SECOND']}, {'input': '-730305467 -514687698 2 7\r\n', 'output': ['DRAW']}, {'input': '3 1 -2 2\r\n', 'output': ['FIRST\r\n1']}, {'input': '31 39 0 8\r\n', 'output': ['FIRST\r\n39']}, {'input': '775517456 -869957101 -1 -1\r\n', 'output': ['FIRST\r\n775517455']}] | [{'input': '-1000000000 1000000000 0 1000000000\r\n', 'output': ['DRAW']}, {'input': '61190539 -40142693 -666666 -666666\r\n', 'output': ['SECOND']}, {'input': '25882413 -80674370 -999999 -9\r\n', 'output': ['FIRST\r\n25326478']}, {'input': '35406031 214492689 -307333182 -305473200\r\n', 'output': ['DRAW']}, {'input': ... | [{'input': '434676805 434676075 -878 345\r\n', 'output': ['FIRST\r\n434676075']}, {'input': '0 1 -1000000000 1000000000\r\n', 'output': ['FIRST\r\n1']}, {'input': '1621 733 -732 -156\r\n', 'output': ['SECOND']}, {'input': '402211447 260733897 -52 275\r\n', 'output': ['DRAW']}, {'input': '-1000000000 1000000000 1 999999... | 100 | 100 | 100 | 100 | 100 | 100 | 91.3 | 91.3 | 91.3 | 91.3 | 77.27 | 77.27 | 81.82 | 77.27 | 77.27 | 39 | 100 | 93.04 | 78.18 |
["1 5", "3 6"] | The first line contains two integers a and m (1ββ€βa,βmββ€β105). | f726133018e2149ec57e113860ec498a | #include <stdio.h>
int a,m,k,r;
int main() {
scanf("%d",&a);
scanf("%d",&m);
r=a%m;
while(k<20) {
if(r%m==0) {
printf("Yes\n");
return 0;
}
else {
r*=2;
++k;
}
}
printf("No\n");
return 0;
} | ["No", "Yes"] | C | null | Print "Yes" (without quotes) if the production will eventually stop, otherwise print "No". | One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce (remainder after dividing x by m) more details. Unfortunately, no customer... | [{"input": "1 5\r\n", "output": ["No"]}, {"input": "3 6\r\n", "output": ["Yes"]}, {"input": "1 8\r\n", "output": ["Yes"]}, {"input": "2 3\r\n", "output": ["No"]}, {"input": "3 24\r\n", "output": ["Yes"]}, {"input": "1 1\r\n", "output": ["Yes"]}, {"input": "100000 100000\r\n", "output": ["Yes"]}, {"input": "1 99989\r\n"... | 100 | 100 | 100 | [{'input': '65535 65536\r\n', 'output': ['Yes']}, {'input': '1 1\r\n', 'output': ['Yes']}, {'input': '100000 100000\r\n', 'output': ['Yes']}, {'input': '3 24\r\n', 'output': ['Yes']}, {'input': '10 5\r\n', 'output': ['Yes']}] | [{'input': '1 65535\r\n', 'output': ['No']}, {'input': '3 65536\r\n', 'output': ['Yes']}, {'input': '4 65536\r\n', 'output': ['Yes']}, {'input': '3 6\r\n', 'output': ['Yes']}, {'input': '3 99929\r\n', 'output': ['No']}] | [{'input': '100000 1\r\n', 'output': ['Yes']}, {'input': '1 99989\r\n', 'output': ['No']}, {'input': '98812 100000\r\n', 'output': ['No']}, {'input': '3 99929\r\n', 'output': ['No']}, {'input': '1 8\r\n', 'output': ['Yes']}] | [{'input': '4 65536\r\n', 'output': ['Yes']}, {'input': '6 8\r\n', 'output': ['Yes']}, {'input': '512 2\r\n', 'output': ['Yes']}, {'input': '1 99989\r\n', 'output': ['No']}, {'input': '1 100000\r\n', 'output': ['No']}] | [{'input': '10 5\r\n', 'output': ['Yes']}, {'input': '512 2\r\n', 'output': ['Yes']}, {'input': '1 65535\r\n', 'output': ['No']}, {'input': '4 65536\r\n', 'output': ['Yes']}, {'input': '100000 100000\r\n', 'output': ['Yes']}] | 100 | 100 | 100 | 100 | 100 | 83.33 | 100 | 100 | 100 | 100 | 75 | 100 | 100 | 100 | 100 | 40 | 100 | 96.666 | 95 |
["5", "1"] | The input contains the only integer n (1ββ€βnββ€β106). | 75739f77378b21c331b46b1427226fa1 | #include <stdio.h>
int gcm(int a, int b) // a<=bγ§γγγγ¨οΌ
{
if(a == 0)
return b;
else
return gcm(b%a, a);
}
int rec(int a, int b) // a<bγ§γγγγ¨οΌ
{
if(a == 1)
return b-1;
return b/a + rec(b%a, a);
}
int main (int argc, const char * argv[]) {
int i, a, b, min;
scanf("%d", &a)... | ["3", "0"] | C | NoteThe pair (1,1) can be transformed into a pair containing 5 in three moves: (1,1) βββ (1,2) βββ (3,2) βββ (5,2). | Print the only integer k. | Let's assume that we have a pair of numbers (a,βb). We can get a new pair (aβ+βb,βb) or (a,βaβ+βb) from the given pair in a single step.Let the initial pair of numbers be (1,1). Your task is to find number k, that is, the least number of steps needed to transform (1,1) into the pair where at least one number equals n. | [{"input": "5\r\n", "output": ["3"]}, {"input": "1\r\n", "output": ["0"]}, {"input": "2\r\n", "output": ["1"]}, {"input": "3\r\n", "output": ["2"]}, {"input": "4\r\n", "output": ["3"]}, {"input": "10\r\n", "output": ["5"]}, {"input": "1009\r\n", "output": ["15"]}, {"input": "2009\r\n", "output": ["17"]}, {"input": "700... | 100 | 100 | 100 | [{'input': '98989\r\n', 'output': ['25']}, {'input': '29009\r\n', 'output': ['22']}, {'input': '123756\r\n', 'output': ['26']}, {'input': '342342\r\n', 'output': ['28']}, {'input': '1009\r\n', 'output': ['15']}] | [{'input': '434563\r\n', 'output': ['28']}, {'input': '100000\r\n', 'output': ['25']}, {'input': '12434\r\n', 'output': ['21']}, {'input': '623423\r\n', 'output': ['29']}, {'input': '1000000\r\n', 'output': ['30']}] | [{'input': '999997\r\n', 'output': ['30']}, {'input': '6\r\n', 'output': ['5']}, {'input': '100000\r\n', 'output': ['25']}, {'input': '89\r\n', 'output': ['9']}, {'input': '978235\r\n', 'output': ['30']}] | [{'input': '10000\r\n', 'output': ['20']}, {'input': '98989\r\n', 'output': ['25']}, {'input': '2009\r\n', 'output': ['17']}, {'input': '123456\r\n', 'output': ['26']}, {'input': '777777\r\n', 'output': ['30']}] | [{'input': '999989\r\n', 'output': ['30']}, {'input': '10000\r\n', 'output': ['20']}, {'input': '999999\r\n', 'output': ['30']}, {'input': '978235\r\n', 'output': ['30']}, {'input': '123756\r\n', 'output': ['26']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 41 | 100 | 100 | 100 |
["3 7 6", "7 2 4"] | A single line contains three integers x,βy,βn (1ββ€βx,βy,βnββ€β105). | 827bc6f120aff6a6f04271bc84e863ee | #include <math.h>
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
int main (void) {
int x, y, n, a = 0, b = 1, i, j;
double t;
scanf ("%d %d %d", &x, &y, &n);
t = (double)x / y;
for (j = 1; j <= n; ++j) {
double A[] = {floor (t*j), ceil (t*j)};
for (i = 0; (unsigned)i < sizeof A / sizeof *A; ++i) {
... | ["2/5", "7/2"] | C | null | Print the required fraction in the format "a/b" (without quotes). | You are given three positive integers x,βy,βn. Your task is to find the nearest fraction to fraction whose denominator is no more than n. Formally, you should find such pair of integers a,βb (1ββ€βbββ€βn;Β 0ββ€βa) that the value is as minimal as possible.If there are multiple "nearest" fractions, choose the one with the ... | [{"input": "3 7 6\r\n", "output": ["2/5"]}, {"input": "7 2 4\r\n", "output": ["7/2"]}, {"input": "1 1 1\r\n", "output": ["1/1"]}, {"input": "1 2 1\r\n", "output": ["0/1"]}, {"input": "1 2 2\r\n", "output": ["1/2"]}, {"input": "17708 35362 1558\r\n", "output": ["328/655"]}, {"input": "72657 93778 50943\r\n", "output": [... | 100 | 100 | 100 | [{'input': '60489 34395 34632\r\n', 'output': ['20163/11465']}, {'input': '17708 35362 1558\r\n', 'output': ['328/655']}, {'input': '20648 86305 73795\r\n', 'output': ['15543/64967']}, {'input': '100000 2 100000\r\n', 'output': ['50000/1']}, {'input': '43003 70913 71178\r\n', 'output': ['43003/70913']}] | [{'input': '99999 2 1\r\n', 'output': ['49999/1']}, {'input': '29842 2171 245\r\n', 'output': ['811/59']}, {'input': '1000 11 20\r\n', 'output': ['1000/11']}, {'input': '35646 27334 23417\r\n', 'output': ['17823/13667']}, {'input': '44247 27883 24673\r\n', 'output': ['34667/21846']}] | [{'input': '75486 2177 1983\r\n', 'output': ['58877/1698']}, {'input': '7 2 4\r\n', 'output': ['7/2']}, {'input': '89781 34400 19222\r\n', 'output': ['49972/19147']}, {'input': '1000 11 20\r\n', 'output': ['1000/11']}, {'input': '7 6 3\r\n', 'output': ['1/1']}] | [{'input': '1 1 1\r\n', 'output': ['1/1']}, {'input': '1 2 2\r\n', 'output': ['1/2']}, {'input': '1000 11 20\r\n', 'output': ['1000/11']}, {'input': '1000 7 3\r\n', 'output': ['143/1']}, {'input': '36890 92817 22772\r\n', 'output': ['5951/14973']}] | [{'input': '14304 96625 53803\r\n', 'output': ['7934/53595']}, {'input': '90002 86785 57380\r\n', 'output': ['23109/22283']}, {'input': '46084 75979 30535\r\n', 'output': ['11637/19186']}, {'input': '100000 2 100000\r\n', 'output': ['50000/1']}, {'input': '29842 2171 245\r\n', 'output': ['811/59']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 42 | 100 | 100 | 100 |
["13\n12", "16\n11311", "20\n999", "17\n2016"] | The first line contains the integer n (2ββ€βnββ€β109). The second line contains the integer k (0ββ€βkβ<β1060), it is guaranteed that the number k contains no more than 60 symbols. All digits in the second line are strictly less than n. Alexander guarantees that the answer exists and does not exceed 1018. The number k d... | be66399c558c96566a6bb0a63d2503e5 | #include <stdio.h>
#include <string.h>
#define INF ((long long) 1e18)
int main() {
static char s[128];
static long long dp[128][128];
int n, h, i, j, l;
long long min;
scanf("%d", &n);
scanf("%s", s);
l = strlen(s);
for (i = 0; i <= l; i++)
for (j = 0; j <= l; j++)
dp[i][j] = INF;
dp[0][0] = 0;
for (i... | ["12", "475", "3789", "594"] | C | NoteIn the first example 12 could be obtained by converting two numbers to the system with base 13: 12β=β12Β·130 or 15β=β1Β·131β+β2Β·130. | Print the number x (0ββ€βxββ€β1018)Β β the answer to the problem. | Alexander is learning how to convert numbers from the decimal system to any other, however, he doesn't know English letters, so he writes any number only as a decimal number, it means that instead of the letter A he will write the number 10. Thus, by converting the number 475 from decimal to hexadecimal system, he gets... | [{"input": "13\r\n12\r\n", "output": ["12"]}, {"input": "16\r\n11311\r\n", "output": ["475"]}, {"input": "20\r\n999\r\n", "output": ["3789"]}, {"input": "17\r\n2016\r\n", "output": ["594"]}, {"input": "1000\r\n1001\r\n", "output": ["100001"]}, {"input": "1000\r\n1000\r\n", "output": ["100000"]}, {"input": "2\r\n1101111... | 100 | 100 | 100 | [{'input': '2\r\n10000000000000000000000000000\r\n', 'output': ['268435456']}, {'input': '130\r\n100\r\n', 'output': ['100']}, {'input': '7501\r\n2542549323761022905\r\n', 'output': ['805176557484307547']}, {'input': '11\r\n1107835458761401923\r\n', 'output': ['997343614685146644']}, {'input': '50\r\n303521849112318129... | [{'input': '124849\r\n6172319\r\n', 'output': ['7688108']}, {'input': '215467\r\n2082791630100848\r\n', 'output': ['966934630351661']}, {'input': '13\r\n41\r\n', 'output': ['53']}, {'input': '5\r\n22011100004310232330\r\n', 'output': ['45965585242840']}, {'input': '315464878\r\n113635473256292967\r\n', 'output': ['3584... | [{'input': '7501\r\n2542549323761022905\r\n', 'output': ['805176557484307547']}, {'input': '7014809\r\n73084644\r\n', 'output': ['52188307']}, {'input': '2\r\n1110110101111000010001011110101001011001110000000010111010\r\n', 'output': ['267367244641009850']}, {'input': '13\r\n12\r\n', 'output': ['12']}, {'input': '16572... | [{'input': '9\r\n78\r\n', 'output': ['71']}, {'input': '9\r\n1733607167155630041\r\n', 'output': ['273150934002691930']}, {'input': '2\r\n100000000000000000000000\r\n', 'output': ['8388608']}, {'input': '25\r\n71610\r\n', 'output': ['4785']}, {'input': '7014809\r\n73084644\r\n', 'output': ['52188307']}] | [{'input': '67\r\n29\r\n', 'output': ['29']}, {'input': '6\r\n5543321344052\r\n', 'output': ['12975669536']}, {'input': '10849219\r\n65200749\r\n', 'output': ['70296063']}, {'input': '4\r\n32323300000100133222012211322\r\n', 'output': ['269019726702209402']}, {'input': '25\r\n2172214240\r\n', 'output': ['26524975']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 96.43 | 100 | 43 | 100 | 100 | 99.286 |
["1 1", "1 2", "2 1"] | The single line contains two integers r,βh (1ββ€βr,βhββ€β107). | ae883bf16842c181ea4bd123dee12ef9 | #include<stdio.h>
#include<math.h>
int r,h,vol;
int main()
{
scanf(" %d %d",&r,&h);
vol = h / r * 2;
h %= r;
if (2*h<r)
vol++;
else if(h*2 >= sqrt(3)*r)
vol += 3;
else
vol += 2;
printf("%d",vol);
return 0;
}
| ["3", "5", "2"] | C | null | Print a single integer β the maximum number of balloons Xenia can put in the cupboard. | A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height hβ+βr from the sides. The figure below shows what... | [{"input": "1 1\r\n", "output": ["3"]}, {"input": "1 2\r\n", "output": ["5"]}, {"input": "2 1\r\n", "output": ["2"]}, {"input": "2 2\r\n", "output": ["3"]}, {"input": "2 3\r\n", "output": ["4"]}, {"input": "4 1\r\n", "output": ["1"]}, {"input": "5 1\r\n", "output": ["1"]}, {"input": "5 2\r\n", "output": ["1"]}, {"input... | 100 | 100 | 100 | [{'input': '100 50\r\n', 'output': ['2']}, {'input': '100 199\r\n', 'output': ['5']}, {'input': '5 11\r\n', 'output': ['5']}, {'input': '2 3\r\n', 'output': ['4']}, {'input': '10000000 8660255\r\n', 'output': ['3']}] | [{'input': '5 11\r\n', 'output': ['5']}, {'input': '667586 5534221\r\n', 'output': ['17']}, {'input': '2000000 1999999\r\n', 'output': ['3']}, {'input': '1000000 1999999\r\n', 'output': ['5']}, {'input': '2 2\r\n', 'output': ['3']}] | [{'input': '5 2\r\n', 'output': ['1']}, {'input': '2377906 4774524\r\n', 'output': ['5']}, {'input': '5 5\r\n', 'output': ['3']}, {'input': '5 10\r\n', 'output': ['5']}, {'input': '3983458 7761504\r\n', 'output': ['5']}] | [{'input': '874 9131511\r\n', 'output': ['20897']}, {'input': '1000000 1999999\r\n', 'output': ['5']}, {'input': '10 19\r\n', 'output': ['5']}, {'input': '5 11\r\n', 'output': ['5']}, {'input': '2 2\r\n', 'output': ['3']}] | [{'input': '10000000 866254\r\n', 'output': ['1']}, {'input': '667586 5534221\r\n', 'output': ['17']}, {'input': '874 9131511\r\n', 'output': ['20897']}, {'input': '1 1\r\n', 'output': ['3']}, {'input': '5 1\r\n', 'output': ['1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 90.91 | 90.91 | 90.91 | 90.91 | 100 | 75 | 75 | 75 | 75 | 44 | 100 | 92.728 | 80 |
["10 30\n10 35\n05:20", "60 120\n24 100\n13:00"] | The first line contains two integers a,βta (1ββ€βa,βtaββ€β120) β the frequency of the buses from the city A to the city B and the travel time. Both values are given in minutes. The second line contains two integers b,βtb (1ββ€βb,βtbββ€β120) β the frequency of the buses from the city B to the city A and the travel time. Bot... | 1c4cf1c3cb464a483511a8a61f8685a7 | #include<stdio.h>
int main()
{
int a,ta;
scanf("%d%d",&a,&ta);
int b,tb;
scanf("%d%d",&b,&tb);
int h,m;
scanf("%d:%d",&h,&m);
int x,y,w=0,z=300;
x=60*h+m;
y=60*h+m+ta;
jump:
if(z+tb<x)
{
z=z+b;
goto jump;
}
else if(z+tb>x && z<y && z<1440)
{
w+=1;
z=z+b;
goto jump;
}
else if(z>y)
... | ["5", "9"] | C | NoteIn the first example Simion departs form the city A at 05:20 AM and arrives to the city B at 05:50 AM. He will meet the first 5 buses from the city B that departed in the period [05:00 AM - 05:40 AM]. Also Simion will meet a bus in the city B at 05:50 AM, but he will not count it.Also note that the first encounter ... | Print the only integer z β the number of buses Simion will meet on the way. Note that you should not count the encounters in cities A and B. | Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a minutes and arrives to the city B in a ta minutes, and a bus from the city B departs every b minutes and arrives to the city A in a tb minutes.The driver Simion w... | [{"input": "10 30\r\n10 35\r\n05:20\r\n", "output": ["5"]}, {"input": "60 120\r\n24 100\r\n13:00\r\n", "output": ["9"]}, {"input": "30 60\r\n60 60\r\n22:30\r\n", "output": ["2"]}, {"input": "30 60\r\n10 60\r\n23:30\r\n", "output": ["8"]}, {"input": "5 45\r\n4 60\r\n21:00\r\n", "output": ["26"]}, {"input": "1 1\r\n1 1\r... | 100 | 100 | 100 | [{'input': '30 60\r\n60 60\r\n22:30\r\n', 'output': ['2']}, {'input': '18 69\r\n62 54\r\n08:00\r\n', 'output': ['2']}, {'input': '5 45\r\n4 60\r\n21:00\r\n', 'output': ['26']}, {'input': '66 75\r\n1 82\r\n06:06\r\n', 'output': ['141']}, {'input': '24 3\r\n54 9\r\n18:12\r\n', 'output': ['0']}] | [{'input': '3 88\r\n17 38\r\n22:33\r\n', 'output': ['8']}, {'input': '24 3\r\n54 9\r\n18:12\r\n', 'output': ['0']}, {'input': '1 120\r\n1 100\r\n23:59\r\n', 'output': ['100']}, {'input': '20 4\r\n1 20\r\n06:20\r\n', 'output': ['23']}, {'input': '8 8\r\n1 1\r\n13:24\r\n', 'output': ['8']}] | [{'input': '1 1\r\n1 1\r\n23:59\r\n', 'output': ['1']}, {'input': '1 1\r\n3 2\r\n08:44\r\n', 'output': ['0']}, {'input': '24 3\r\n54 9\r\n18:12\r\n', 'output': ['0']}, {'input': '60 120\r\n17 120\r\n23:00\r\n', 'output': ['11']}, {'input': '15 24\r\n23 6\r\n21:15\r\n', 'output': ['1']}] | [{'input': '68 34\r\n84 78\r\n10:40\r\n', 'output': ['1']}, {'input': '1 1\r\n1 1\r\n10:28\r\n', 'output': ['1']}, {'input': '30 60\r\n60 60\r\n22:30\r\n', 'output': ['2']}, {'input': '31 15\r\n36 25\r\n07:04\r\n', 'output': ['1']}, {'input': '30 19\r\n21 4\r\n10:30\r\n', 'output': ['1']}] | [{'input': '1 1\r\n1 1\r\n10:28\r\n', 'output': ['1']}, {'input': '33 58\r\n70 78\r\n22:36\r\n', 'output': ['2']}, {'input': '30 60\r\n60 60\r\n22:30\r\n', 'output': ['2']}, {'input': '1 1\r\n3 2\r\n08:44\r\n', 'output': ['0']}, {'input': '3 88\r\n17 38\r\n22:33\r\n', 'output': ['8']}] | 100 | 100 | 100 | 100 | 100 | 95.65 | 100 | 100 | 95.65 | 95.65 | 85.71 | 100 | 100 | 85.71 | 85.71 | 45 | 100 | 97.39 | 91.426 |
["........\n........\n.B....B.\n....W...\n........\n..W.....\n........\n........", "..B.....\n..W.....\n......B.\n........\n.....W..\n......B.\n........\n........"] | The input consists of the board description given in eight lines, each line contains eight characters. Character 'B' is used to denote a black pawn, and character 'W' represents a white pawn. Empty cell is marked with '.'. It's guaranteed that there will not be white pawns on the first row neither black pawns on the l... | 0ddc839e17dee20e1a954c1289de7fbd | #include<stdio.h>
typedef unsigned u;
u A[8],B[8];
int main()
{
u i,j,a,b;char c;
for(a=b=i=-1;++i<8;)A[i]=B[i]=-1;
for(i=-1;++i<8;)for(j=-1;++j<8;)
{
while((c=getchar())<=' ');
if(c=='B')B[j]=i;
if(c=='W'&&A[j]==-1u)
{
if(B[j]==-1u)A[j]=i;
else B[j]=-1u;
}
}
for(i=-1;++i<8;)
{
if(a>A[i])a=A[i]... | ["A", "B"] | C | NoteIn the first sample player A is able to complete his goal in 3 steps by always moving a pawn initially located at (4,β5). Player B needs at least 5 steps for any of his pawns to reach the row 8. Hence, player A will be the winner. | Print 'A' if player A wins the game on the given board, and 'B' if player B will claim the victory. Again, it's guaranteed that there will always be a winner on the given board. | Galois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named Β«PawnChessΒ».This new game is played on a board consisting of 8 rows and 8 columns. At the beginning of every game some black and white pawns are placed on the board. The number of black pawns placed i... | [{"input": "........\r\n........\r\n.B....B.\r\n....W...\r\n........\r\n..W.....\r\n........\r\n........\r\n", "output": ["A"]}, {"input": "..B.....\r\n..W.....\r\n......B.\r\n........\r\n.....W..\r\n......B.\r\n........\r\n........\r\n", "output": ["B"]}, {"input": ".BB.B.B.\r\nB..B..B.\r\n.B.BB...\r\nBB.....B\r\nBBB.... | 100 | 100 | 100 | [{'input': '........\r\n.B.B....\r\n...B..BB\r\n........\r\n........\r\nW...W...\r\nW...W...\r\nW.WW.W..\r\n', 'output': ['A']}, {'input': 'B.BBBBBB\r\nB..BBB.B\r\nW.BB.W.B\r\nB.BWBB.B\r\nBWBWBBBB\r\n...BBBBB\r\nB.B...BB\r\nWW..WW.W\r\n', 'output': ['B']}, {'input': '....BB..\r\nBB......\r\n.B.....B\r\nWW..WWW.\r\n...B... | [{'input': 'BBBB.BBB\r\nBBBB.B.B\r\nB.B..BBB\r\nB.BB.BWW\r\nB.BB.BBB\r\nB.BB.BBB\r\n..BW.BB.\r\nW.WWWWWW\r\n', 'output': ['B']}, {'input': '...BB.BB\r\nBB...B..\r\n........\r\n........\r\n........\r\n........\r\n..W..W..\r\n......W.\r\n', 'output': ['A']}, {'input': '........\r\n........\r\n.W......\r\n........\r\n....... | [{'input': '..BB....\r\n........\r\nWW.W..WW\r\nW...W...\r\n.W...W..\r\n.W..W.WW\r\nW.....WW\r\nWW......\r\n', 'output': ['A']}, {'input': '........\r\n........\r\n........\r\n.W......\r\n......B.\r\n........\r\n........\r\n........\r\n', 'output': ['A']}, {'input': '........\r\n.B......\r\n.W......\r\n........\r\n....... | [{'input': '...B.B..\r\n........\r\n........\r\n........\r\n........\r\n........\r\n........\r\nWWW...WW\r\n', 'output': ['A']}, {'input': 'B.B...B.\r\n........\r\n.......B\r\n.BB....B\r\n.....W..\r\n.W.WW.W.\r\n...W.WW.\r\nW..WW..W\r\n', 'output': ['A']}, {'input': 'BBBB.BBB\r\nBBBB.B.B\r\nB.B..BBB\r\nB.BB.BWW\r\nB.BB... | [{'input': 'B..BB...\r\n..B...B.\r\n.WBB...B\r\nBW......\r\nW.B...W.\r\n..BBW.B.\r\nBW..BB..\r\n......W.\r\n', 'output': ['B']}, {'input': 'B....BB.\r\n...B...B\r\n.B......\r\n........\r\n........\r\n........\r\n........\r\n....W..W\r\n', 'output': ['B']}, {'input': '........\r\nW.......\r\n........\r\n........\r\n....... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 96.15 | 100 | 100 | 100 | 46 | 100 | 100 | 99.23 |
["3\n141 592 653", "5\n10 21 10 21 10"] | Input will begin with an integer N (1ββ€βNββ€β50), the number of slices of pie. Following this is a line with N integers indicating the sizes of the slices (each between 1 and 100000, inclusive), in the order in which they must be handed out. | 414540223db9d4cfcec6a973179a0216 | #include<stdio.h>
int max(int a,int b)
{
if(a>=b)return a;
else return b;
}
int main()
{
int ca[52];
int n;scanf("%d",&n);
int sumi[52];
int sum=0;
int dp[52]={-1};
int i=0;
for(i=0;i<n;i++)
{
scanf("%d",&ca[i]);
sum += ca[i];
sumi[i] = sum;
}
dp[n-1]=ca[n-1];
for(i=n-2;i>=0;i--)
{
dp[i]=max((ca[i]+(sumi[n-1]-dp[i+1... | ["653 733", "31 41"] | C | NoteIn the first example, Bob takes the size 141 slice for himself and gives the decider token to Alice. Then Alice gives the size 592 slice to Bob and keeps the decider token for herself, so that she can then give the size 653 slice to herself. | Print two integers. First, the sum of the sizes of slices eaten by Alice, then the sum of the sizes of the slices eaten by Bob, assuming both players make their decisions optimally. | You may have heard of the pie rule before. It states that if two people wish to fairly share a slice of pie, one person should cut the slice in half, and the other person should choose who gets which slice. Alice and Bob have many slices of pie, and rather than cutting the slices in half, each individual slice will be ... | [{"input": "3\r\n141 592 653\r\n", "output": ["653 733"]}, {"input": "5\r\n10 21 10 21 10\r\n", "output": ["31 41"]}, {"input": "1\r\n100000\r\n", "output": ["0 100000"]}, {"input": "50\r\n100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 10000... | 100 | 100 | 100 | [{'input': '47\r\n53046 58090 55185 8100 43578 1253 7226 13049 75567 73065 19920 48836 28243 45633 75475 74628 11853 68351 90922 89500 81315 71161 34816 49875 82337 2727 27746 37878 79833 24423 75618 82065 95614 82618 34391 1850 94056 57092 73115 70214 46067 29071 75947 46802 95807 42600 11211\r\n', 'output': ['1214201... | [{'input': '49\r\n19894 55779 73188 99759 17893 50295 8089 81025 76582 81429 73503 35619 61128 41603 40313 3166 31490 87660 19662 59197 8812 75229 25642 65938 42755 31656 16188 87599 51562 91460 38262 11118 90596 69482 71313 66858 87707 17242 14886 93539 35164 32596 83317 72606 12185 21664 80642 72099 7525\r\n', 'outpu... | [{'input': '30\r\n2351 14876 66138 87327 29940 73204 19925 50198 13441 54751 1383 92120 90236 13525 3920 16669 80637 94428 54890 71321 77670 57080 82145 39778 69967 38722 46902 82127 1142 21792\r\n', 'output': ['724302 724303']}, {'input': '25\r\n87969 76030 78041 616 13694 11522 84038 25090 16869 14975 61226 96124 204... | [{'input': '8\r\n8515 51563 5451 94713 9537 30709 63343 41819\r\n', 'output': ['138409 167241']}, {'input': '9\r\n91939 407 10197 24191 58791 9486 68030 25807 11\r\n', 'output': ['102429 186430']}, {'input': '40\r\n3670 5779 20621 87964 12595 34136 98063 92429 38366 43789 88330 52934 19100 22776 43342 82312 74404 64756... | [{'input': '45\r\n53494 93105 37182 24953 1967 43700 39068 12369 7256 64700 31744 62052 84959 49662 34829 78793 51000 16339 29478 52506 96922 75606 52501 1109 21919 6503 72007 63964 75400 24682 45678 18420 67928 87241 73278 69545 24596 29646 65936 55401 89673 49738 35873 45189 3622\r\n', 'output': ['1052557 1068976']},... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 47 | 100 | 100 | 100 |
["4\n1 3 2 0", "7\n1 3 3 2 1 2 3", "2\n2 2"] | The first line contains a positive integer n (1ββ€βnββ€β100) β the number of days of Vasya's vacations. The second line contains the sequence of integers a1,βa2,β...,βan (0ββ€βaiββ€β3) separated by space, where: ai equals 0, if on the i-th day of vacations the gym is closed and the contest is not carried out; ai equals... | 08f1ba79ced688958695a7cfcfdda035 | //DURING CONTEST: http://www.codeforces.com/contest/699/submission/19246509
#include <stdio.h>
#include <stdint.h>
int main() {
/**
* Variables are stored as follows:
* whatWeCouldDoYesterday -- data & 0b11
* whatWeCanDoToday -- (data & 0b1100) >> 2
* answer -- (data & 0xf... | ["2", "0", "1"] | C | NoteIn the first test Vasya can write the contest on the day number 1 and do sport on the day number 3. Thus, he will have a rest for only 2 days.In the second test Vasya should write contests on days number 1, 3, 5 and 7, in other days do sport. Thus, he will not have a rest for a single day.In the third test Vasya ca... | Print the minimum possible number of days on which Vasya will have a rest. Remember that Vasya refuses: to do sport on any two consecutive days, to write the contest on any two consecutive days. | Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Internet on that day. For the i-th day there are four options: on this day the gym is closed and the ... | [{"input": "4\r\n1 3 2 0\r\n", "output": ["2"]}, {"input": "7\r\n1 3 3 2 1 2 3\r\n", "output": ["0"]}, {"input": "2\r\n2 2\r\n", "output": ["1"]}, {"input": "1\r\n0\r\n", "output": ["1"]}, {"input": "10\r\n0 0 1 1 0 0 0 0 1 0\r\n", "output": ["8"]}, {"input": "100\r\n3 2 3 3 3 2 3 1 3 2 2 3 2 3 3 3 3 3 3 1 2 2 3 1 3 3 ... | 100 | 100 | 100 | [{'input': '100\r\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\r\n', 'output': ['0']}, {'input': '85\r\n1 2 1 2 3 2 3 3 3 3 3 3 3 2 1 3 2 3 3 3 3 2 3 3 3 1 3 3 3 3 ... | [{'input': '25\r\n0 0 1 0 0 1 0 0 1 0 0 1 0 2 0 0 2 0 0 1 0 2 0 1 1\r\n', 'output': ['16']}, {'input': '75\r\n1 0 0 1 1 0 0 1 0 1 2 0 0 2 1 1 0 0 0 0 0 0 2 1 1 0 0 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 1 2 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0\r\n', 'output': ['51']}, {'input': '90\r\n2 3 2 3 2 2 3 3 2 ... | [{'input': '55\r\n3 3 1 3 2 3 2 3 2 2 3 3 3 3 3 1 1 3 3 2 3 2 3 2 0 1 3 3 3 3 2 3 2 3 1 1 2 2 2 3 3 3 3 3 2 2 2 3 2 3 3 3 3 1 3\r\n', 'output': ['7']}, {'input': '2\r\n1 1\r\n', 'output': ['1']}, {'input': '20\r\n2 3 2 3 3 3 3 2 0 3 1 1 2 3 0 3 2 3 0 3\r\n', 'output': ['5']}, {'input': '2\r\n2 2\r\n', 'output': ['1']},... | [{'input': '4\r\n1 3 2 0\r\n', 'output': ['2']}, {'input': '95\r\n2 3 3 2 3 2 2 1 3 1 2 1 2 3 1 2 3 3 1 3 3 3 1 2 3 2 2 2 2 3 3 3 2 2 3 3 3 3 3 1 2 2 3 3 3 3 2 3 2 2 2 3 3 2 3 3 3 3 3 3 3 0 3 2 0 3 3 1 3 3 3 2 3 2 3 2 3 3 3 3 2 2 1 1 3 3 3 3 3 1 3 3 3 3 2\r\n', 'output': ['14']}, {'input': '2\r\n3 3\r\n', 'output': ['0... | [{'input': '10\r\n0 0 1 1 0 0 0 0 1 0\r\n', 'output': ['8']}, {'input': '100\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['50']}, {'input': '2\r\... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 48 | 100 | 100 | 100 |
["1990 1", "300 0", "1034 2", "9090000078001234 6"] | The single line contains two integers a and k (1ββ€βaββ€β1018;Β 0ββ€βkββ€β100). | e56f6c343167745821f0b18dcf0d0cde | #include<stdio.h>
#include<string.h>
int main()
{
char a[500],temp,max;
int c,n,i,j,k,x,f=1,h=4,m;
scanf("%s",a);
scanf("%d",&k);
c=0;
n=strlen(a);
while(c!=n)
{
max='0';
for(j=c;j<k+c+1;j++)
{
if(j==n)
break;
if(a[j]>max)
{
max=a[j];
x=j;
}
}
for(j=x;j>c;j--)
{
/*if(c==x) ... | ["9190", "300", "3104", "9907000008001234"] | C | null | Print the maximum number that Pasha can get if he makes at most k swaps. | Pasha has a positive integer a without leading zeroes. Today he decided that the number is too small and he should make it larger. Unfortunately, the only operation Pasha can do is to swap two adjacent decimal digits of the integer.Help Pasha count the maximum number he can get if he has the time to make at most k swap... | [{"input": "1990 1\r\n", "output": ["9190"]}, {"input": "300 0\r\n", "output": ["300"]}, {"input": "1034 2\r\n", "output": ["3104"]}, {"input": "9090000078001234 6\r\n", "output": ["9907000008001234"]}, {"input": "1234 3\r\n", "output": ["4123"]}, {"input": "5 100\r\n", "output": ["5"]}, {"input": "1234 5\r\n", "output... | 100 | 100 | 100 | [{'input': '92153348 6\r\n', 'output': ['98215334']}, {'input': '801211288881101019 22\r\n', 'output': ['982111028888110101']}, {'input': '66838 4\r\n', 'output': ['86863']}, {'input': '620737553540689123 2\r\n', 'output': ['672037553540689123']}, {'input': '10120921290110921 20\r\n', 'output': ['99221010120110921']}] | [{'input': '10120921290110921 20\r\n', 'output': ['99221010120110921']}, {'input': '901000000954321789 70\r\n', 'output': ['999875410000300021']}, {'input': '5846059 3\r\n', 'output': ['8654059']}, {'input': '11223344556677889 47\r\n', 'output': ['98821213344556677']}, {'input': '1034 2\r\n', 'output': ['3104']}] | [{'input': '901000000954321789 40\r\n', 'output': ['999810000050043217']}, {'input': '901000000954321789 5\r\n', 'output': ['910009000054321789']}, {'input': '1034 2\r\n', 'output': ['3104']}, {'input': '15603712376708 28\r\n', 'output': ['87761503123670']}, {'input': '5 100\r\n', 'output': ['5']}] | [{'input': '801211288881101019 22\r\n', 'output': ['982111028888110101']}, {'input': '4529 8\r\n', 'output': ['9542']}, {'input': '5314 4\r\n', 'output': ['5431']}, {'input': '11223344556677889 47\r\n', 'output': ['98821213344556677']}, {'input': '10120921290110921 20\r\n', 'output': ['99221010120110921']}] | [{'input': '300 0\r\n', 'output': ['300']}, {'input': '74604713975 29\r\n', 'output': ['97776544310']}, {'input': '77172428736634377 29\r\n', 'output': ['87777764122363437']}, {'input': '784069392990841 0\r\n', 'output': ['784069392990841']}, {'input': '15603712376708 28\r\n', 'output': ['87761503123670']}] | 100 | 100 | 100 | 100 | 100 | 88.89 | 100 | 100 | 88.89 | 88.89 | 85.71 | 100 | 100 | 85.71 | 85.71 | 49 | 100 | 93.334 | 91.426 |
["5 2", "7 4"] | The single line contains two space-separated integers n and k (1ββ€βnββ€β1000,β1ββ€βkββ€βmin(8,βn)) β the number of the houses and the number k from the statement. | cc838bc14408f14f984a349fea9e9694 | #include<stdio.h>
main()
{
long long i=1000000007;
long long n,k,j;
scanf("%lld%lld",&n,&k);
long long x=n-k,m=1,y=1;
for(j=1;j<=x;j++)
m=(m*x)%i;
for(j=1;j<k;j++)
y=(y*k)%i;
m=(m*y)%i;
printf("%I64d",m);
return 0;
}
| ["54", "1728"] | C | null | In a single line print a single integer β the answer to the problem modulo 1000000007 (109β+β7). | Little penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer pi (1ββ€βpiββ€βn).Little penguin Polo loves walking around this village. The walk looks like that. First he stands by a house... | [{"input": "5 2\r\n", "output": ["54"]}, {"input": "7 4\r\n", "output": ["1728"]}, {"input": "8 5\r\n", "output": ["16875"]}, {"input": "8 1\r\n", "output": ["823543"]}, {"input": "10 7\r\n", "output": ["3176523"]}, {"input": "12 8\r\n", "output": ["536870912"]}, {"input": "50 2\r\n", "output": ["628702797"]}, {"input"... | 100 | 100 | 100 | [{'input': '1000 6\r\n', 'output': ['834332109']}, {'input': '1000 3\r\n', 'output': ['330155123']}, {'input': '8 8\r\n', 'output': ['2097152']}, {'input': '1000 4\r\n', 'output': ['660270610']}, {'input': '3 3\r\n', 'output': ['9']}] | [{'input': '657 3\r\n', 'output': ['771999480']}, {'input': '685 7\r\n', 'output': ['840866481']}, {'input': '876 8\r\n', 'output': ['703293724']}, {'input': '10 7\r\n', 'output': ['3176523']}, {'input': '1000 5\r\n', 'output': ['583047503']}] | [{'input': '1000 6\r\n', 'output': ['834332109']}, {'input': '137 5\r\n', 'output': ['160909830']}, {'input': '10 7\r\n', 'output': ['3176523']}, {'input': '1000 4\r\n', 'output': ['660270610']}, {'input': '12 8\r\n', 'output': ['536870912']}] | [{'input': '8 8\r\n', 'output': ['2097152']}, {'input': '1 1\r\n', 'output': ['1']}, {'input': '3 3\r\n', 'output': ['9']}, {'input': '137 5\r\n', 'output': ['160909830']}, {'input': '1000 6\r\n', 'output': ['834332109']}] | [{'input': '1000 3\r\n', 'output': ['330155123']}, {'input': '1000 6\r\n', 'output': ['834332109']}, {'input': '1 1\r\n', 'output': ['1']}, {'input': '8 8\r\n', 'output': ['2097152']}, {'input': '999 7\r\n', 'output': ['490075342']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 50 | 100 | 100 | 100 |
["1 3 8 1 1", "4 2 9 4 2", "5 5 25 4 3", "100 100 1000000000000000000 100 100"] | The first and the only line contains five integers n, m, k, x and y (1ββ€βn,βmββ€β100,β1ββ€βkββ€β1018,β1ββ€βxββ€βn,β1ββ€βyββ€βm). | e61debcad37eaa9a6e21d7a2122b8b21 | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define MAX 1000010
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
long long len, n, m, k, x, y;
long long X[MAX], Y[MAX], counter[1010][1010];
int main(){
long long i, j, v, min_v, max_v;
while (scanf("%lld... | ["3 2 3", "2 1 1", "1 1 1", "101010101010101 50505050505051 50505050505051"] | C | NoteThe order of asking pupils in the first test: the pupil from the first row who seats at the first table, it means it is Sergei; the pupil from the first row who seats at the second table; the pupil from the first row who seats at the third table; the pupil from the first row who seats at the first table, it me... | Print three integers: the maximum number of questions a particular pupil is asked, the minimum number of questions a particular pupil is asked, how many times the teacher asked Sergei. | On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others.Seating in the class looks like a rectangle, where n rows with m pupils in each. The teacher asks pupils in the following order: at first, she asks all pupils from the first row in the order of their... | [{"input": "1 3 8 1 1\r\n", "output": ["3 2 3", "3 2 3"]}, {"input": "4 2 9 4 2\r\n", "output": ["2 1 1"]}, {"input": "5 5 25 4 3\r\n", "output": ["1 1 1"]}, {"input": "100 100 1000000000000000000 100 100\r\n", "output": ["101010101010101 50505050505051 50505050505051"]}, {"input": "3 2 15 2 2\r\n", "output": ["4 2 3"... | 100 | 100 | 100 | [{'input': '4 2 9 4 1\r\n', 'output': ['2 1 1']}, {'input': '17 5 370710486 2 1\r\n', 'output': ['4633882 2316941 4633881']}, {'input': '27 34 77794947 24 4\r\n', 'output': ['88004 44002 88004']}, {'input': '92 10 551902461 1 6\r\n', 'output': ['606487 303243 303244']}, {'input': '2 3 4 2 3\r\n', 'output': ['1 0 0']}] | [{'input': '4 1 8 3 1\r\n', 'output': ['3 1 2']}, {'input': '5 2 9 5 1\r\n', 'output': ['1 0 1']}, {'input': '63 22 1321 61 15\r\n', 'output': ['1 0 0']}, {'input': '1 3 8 1 1\r\n', 'output': ['3 2 3', '3 2 3']}, {'input': '1 100 1000000000000 1 100\r\n', 'output': ['10000000000 10000000000 10000000000', '10000000000 ... | [{'input': '1 3 7 1 1\r\n', 'output': ['3 2 3', '3 2 3']}, {'input': '5 2 81 5 1\r\n', 'output': ['10 5 5']}, {'input': '100 1 1000000000000 100 1\r\n', 'output': ['10101010101 5050505051 5050505051']}, {'input': '3 8 134010 3 4\r\n', 'output': ['8376 4188 4188']}, {'input': '1 1 1000000000000000000 1 1\r\n', 'output'... | [{'input': '1 3 7 1 1\r\n', 'output': ['3 2 3', '3 2 3']}, {'input': '4 3 1 3 3\r\n', 'output': ['1 0 0']}, {'input': '3 5 1 2 1\r\n', 'output': ['1 0 0']}, {'input': '5 3 100 2 1\r\n', 'output': ['9 4 9']}, {'input': '1 3 8 1 1\r\n', 'output': ['3 2 3', '3 2 3']}] | [{'input': '5 2 9 5 1\r\n', 'output': ['1 0 1']}, {'input': '85 53 576663715 13 1\r\n', 'output': ['129530 64765 129529']}, {'input': '1 1 1 1 1\r\n', 'output': ['1 1 1', '1 1 1']}, {'input': '5 6 30 5 4\r\n', 'output': ['1 1 1']}, {'input': '1 100 1000000000000000000 1 35\r\n', 'output': ['10000000000000000 10000000... | 100 | 100 | 100 | 100 | 100 | 95.45 | 100 | 100 | 100 | 100 | 88.46 | 100 | 100 | 100 | 100 | 51 | 100 | 99.09 | 97.692 |
["3 5 6 1\n1 2 3", "4 40 50 10\n10 20 30 25", "5 25 35 10\n10 10 20 10 20"] | The first line contains four integers n, l, r, x (1ββ€βnββ€β15, 1ββ€βlββ€βrββ€β109, 1ββ€βxββ€β106) β the number of problems you have, the minimum and maximum value of total difficulty of the problemset and the minimum difference in difficulty between the hardest problem in the pack and the easiest one, respectively. The secon... | 0d43104a0de924cdcf8e4aced5aa825d | #include <stdio.h>
int main()
{
char n,i;
long l,r,x,j;
long min,max,sum,count=0;
char s;
scanf("%d%ld%ld%ld",&n,&l,&r,&x);
long c[n];
for(i=0;i<n;i++)
scanf("%ld",c+i);
long a=1L<<n;
for(j=1;j<a;j++){
min=1000000;
max=1;
sum=0;
s=0;
f... | ["2", "2", "6"] | C | NoteIn the first example two sets are suitable, one consisting of the second and third problem, another one consisting of all three problems.In the second example, two sets of problems are suitable β the set of problems with difficulties 10 and 30 as well as the set of problems with difficulties 20 and 30.In the third ... | Print the number of ways to choose a suitable problemset for the contest. | You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made.A problemset for the contest must consist of at least two problems. You think that the total difficulty of the problems of the contest must be ... | [{"input": "3 5 6 1\r\n1 2 3\r\n", "output": ["2"]}, {"input": "4 40 50 10\r\n10 20 30 25\r\n", "output": ["2"]}, {"input": "5 25 35 10\r\n10 10 20 10 20\r\n", "output": ["6"]}, {"input": "4 15 60 10\r\n10 20 30 25\r\n", "output": ["6"]}, {"input": "1 10 20 1\r\n15\r\n", "output": ["0"]}, {"input": "10 626451 11471247 ... | 100 | 100 | 100 | [{'input': '15 6558665 6558665 1\r\n572491 435494 916457 775918 823435 78552 501843 331498 71141 844935 636557 992666 570344 831188 715447\r\n', 'output': ['1']}, {'input': '15 2572491 5084070 823435\r\n570344 78552 775918 501843 844935 71141 331498 636557 435494 715447 992666 831188 28969 171046 989614\r\n', 'output':... | [{'input': '1 10 20 1\r\n15\r\n', 'output': ['0']}, {'input': '15 1 1000000000 1\r\n10 20 30 40 50 60 70 80 90 100 110 120 130 140 150\r\n', 'output': ['32752']}, {'input': '3 390224 390224 1\r\n264237 125987 288891\r\n', 'output': ['1']}, {'input': '6 20 70 1\r\n10 10 20 20 30 30\r\n', 'output': ['35']}, {'input': '15... | [{'input': '3 390224 390224 1\r\n264237 125987 288891\r\n', 'output': ['1']}, {'input': '7 1652707 1652707 1\r\n492387 684636 235422 332532 924898 499872 192988\r\n', 'output': ['1']}, {'input': '6 30 40 1\r\n19 20 21 14 15 16\r\n', 'output': ['13']}, {'input': '4 40 50 10\r\n10 20 30 25\r\n', 'output': ['2']}, {'input... | [{'input': '4 40 50 10\r\n10 20 30 25\r\n', 'output': ['2']}, {'input': '2 10 20 5\r\n5 10\r\n', 'output': ['1']}, {'input': '10 626451 11471247 246428\r\n369649 684428 303821 287098 422756 301599 720377 177567 515216 750602\r\n', 'output': ['914']}, {'input': '4 15 60 10\r\n10 20 30 25\r\n', 'output': ['6']}, {'input'... | [{'input': '4 5 234 2\r\n10 9 12 11\r\n', 'output': ['8']}, {'input': '6 30 40 1\r\n19 20 21 14 15 16\r\n', 'output': ['13']}, {'input': '5 1098816 3969849 167639\r\n85627 615007 794045 530104 7091\r\n', 'output': ['15']}, {'input': '7 1652707 1652707 1\r\n492387 684636 235422 332532 924898 499872 192988\r\n', 'output'... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 52 | 100 | 100 | 100 |
["2 2", "1 2"] | The first line contains two integers w and h (1ββ€βw,βhββ€β4000) β the rectangle's sizes. | 42454dcf7d073bf12030367eb094eb8c | #include<stdio.h>
int main()
{
long long int c=0,w,h,n,m;
scanf("%lld %lld",&w,&h);
if(w<2 || h<2)
{
printf("0\n");
return 0;
}
for(n=2;w>=n;n=n+2)
{
for(m=2;h>=m;m=m+2)
c=c+(h-(m-1))*(w-(n-1));
}
printf("%lld\n",c);
return 0;
}
| ["1", "0"] | C | NoteIn the first example there exists only one such rhombus. Its vertices are located at points (1,β0), (2,β1), (1,β2), (0,β1). | Print a single number β the number of sought rhombi. Please do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is preferred to use cin, cout streams or the %I64d specifier. | You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: Have positive area. With vertices at integer points. All vertices of the rhombi are located inside or on the border of the rectangle with vertices at points (0,β0), (w,β0), (w,βh), (0,βh). In othe... | [{"input": "2 2\r\n", "output": ["1"]}, {"input": "1 2\r\n", "output": ["0"]}, {"input": "1 4000\r\n", "output": ["0"]}, {"input": "4000 1\r\n", "output": ["0"]}, {"input": "4000 4000\r\n", "output": ["16000000000000"]}, {"input": "15 10\r\n", "output": ["1400"]}, {"input": "7 9\r\n", "output": ["240"]}, {"input": "17 ... | 100 | 100 | 100 | [{'input': '2541 25\r\n', 'output': ['251810520']}, {'input': '2437 460\r\n', 'output': ['78542851800']}, {'input': '1665 27\r\n', 'output': ['126136192']}, {'input': '4 6\r\n', 'output': ['36']}, {'input': '1913 3980\r\n', 'output': ['3623063809200']}] | [{'input': '13 1402\r\n', 'output': ['20638842']}, {'input': '25 2986\r\n', 'output': ['347731644']}, {'input': '14 1274\r\n', 'output': ['19882681']}, {'input': '4000 4000\r\n', 'output': ['16000000000000']}, {'input': '7 13\r\n', 'output': ['504']}] | [{'input': '2955 21\r\n', 'output': ['240130660']}, {'input': '9 14\r\n', 'output': ['980']}, {'input': '25 2986\r\n', 'output': ['347731644']}, {'input': '2437 460\r\n', 'output': ['78542851800']}, {'input': '3727 2044\r\n', 'output': ['3627108561888']}] | [{'input': '1913 3980\r\n', 'output': ['3623063809200']}, {'input': '1499 2172\r\n', 'output': ['662525703000']}, {'input': '18 2858\r\n', 'output': ['165405321']}, {'input': '9 14\r\n', 'output': ['980']}, {'input': '25 2986\r\n', 'output': ['347731644']}] | [{'input': '2541 25\r\n', 'output': ['251810520']}, {'input': '25 2986\r\n', 'output': ['347731644']}, {'input': '13 1402\r\n', 'output': ['20638842']}, {'input': '4000 1\r\n', 'output': ['0']}, {'input': '7 13\r\n', 'output': ['504']}] | 100 | 100 | 100 | 100 | 100 | 81.82 | 81.82 | 81.82 | 81.82 | 100 | 75 | 75 | 75 | 75 | 87.5 | 53 | 100 | 85.456 | 77.5 |
["10 3 5 2 3"] | The single line contains five integers C,βHr,βHb,βWr,βWb (1ββ€βC,βHr,βHb,βWr,βWbββ€β109). | eb052ca12ca293479992680581452399 | #include <stdio.h>
#define max(a, b) (((a) > (b)) ? (a) : (b))
int main(void) {
int i;
int c, wr, wb;
long long hr, hb;
long long ans;
scanf("%d %lld %lld %d %d", &c, &hr, &hb, &wr, &wb);
ans = 0;
for (i = 0; i <= c / wr && i * i <= c; i++)
ans = max(ans, hr * i + (c - wr * i) / ... | ["16"] | C | NoteIn the sample test Om Nom can eat two candies of each type and thus get 16 joy units. | Print a single integer β the maximum number of joy units that Om Nom can get. | A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you were on his place? One day, when he came to his friend Evan, Om Nom didn't find him at home but h... | [{"input": "10 3 5 2 3\r\n", "output": ["16"]}, {"input": "5 3 1 6 7\r\n", "output": ["0"]}, {"input": "982068341 55 57 106 109\r\n", "output": ["513558662"]}, {"input": "930064129 32726326 25428197 83013449 64501049\r\n", "output": ["363523396"]}, {"input": "927155987 21197 15994 54746 41309\r\n", "output": ["35898371... | 100 | 100 | 100 | [{'input': '977983517 9009 9108 1001 1012\r\n', 'output': ['8801851608']}, {'input': '962693577 967217455 967217455 2 2\r\n', 'output': ['465567015261784540']}, {'input': '983935533 33986 27367 59737 48104\r\n', 'output': ['559787479']}, {'input': '200000001 100000002 1 100000001 1\r\n', 'output': ['200000002']}, {'inp... | [{'input': '995503930 29205027 18903616 51333090 33226507\r\n', 'output': ['565303099']}, {'input': '1000000000 1 1 1 1000000000\r\n', 'output': ['1000000000']}, {'input': '901769477 367425909 220455545 5 3\r\n', 'output': ['66266693959035917']}, {'input': '903796108 270891702 270891702 1 1\r\n', 'output': ['2448308659... | [{'input': '910943911 38162 31949 67084 56162\r\n', 'output': ['518210503']}, {'input': '942733698 9180 9072 1020 1008\r\n', 'output': ['8484603228']}, {'input': '1000000000 2 1 3 4\r\n', 'output': ['666666666']}, {'input': '200000001 100000002 1 100000001 1\r\n', 'output': ['200000002']}, {'input': '983935533 115 108 ... | [{'input': '911525551 740437472 740437472 3 3\r\n', 'output': ['224975891301803200']}, {'input': '1000000000 1000 999 100 1000000000\r\n', 'output': ['10000000000']}, {'input': '1000000000 1000 1000 1 1\r\n', 'output': ['1000000000000']}, {'input': '977983517 9009 9108 1001 1012\r\n', 'output': ['8801851608']}, {'input... | [{'input': '1000000000 1 1 11 11\r\n', 'output': ['90909090']}, {'input': '949164751 36679609 23634069 64467968 41539167\r\n', 'output': ['537909080']}, {'input': '911525551 740437472 740437472 3 3\r\n', 'output': ['224975891301803200']}, {'input': '910943911 107 105 60 59\r\n', 'output': ['1624516635']}, {'input': '90... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 87.5 | 100 | 54 | 100 | 100 | 97.5 |
["1", "2", "3", "8"] | The first line of the input will contain a single integer, n (1ββ€βnββ€β100β000). | 757cd804aba01dc4bc108cb0722f68dc | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d",&n);
int a[110]={0};
int i;
for(i=1;;i++)
{
if(n==1) {break;}
int yushu,deshu;
yushu=n%2;
n=n/2;
a[i]=yushu;
if(n==1) {i++;break;}
}
printf("%d",i);
i--;
for(;i>... | ["1", "2", "2 1", "4"] | C | NoteIn the first sample, we only have a single slime with value 1. The final state of the board is just a single slime with value 1.In the second sample, we perform the following steps:Initially we place a single slime in a row by itself. Thus, row is initially 1.Then, we will add another slime. The row is now 1 1. Sin... | Output a single line with k integers, where k is the number of slimes in the row after you've finished the procedure described in the problem statement. The i-th of these numbers should be the value of the i-th slime from the left. | Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1.You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other nβ-β1 slimes one by one. When you add a slime, you place it at the right of all alr... | [{"input": "1\r\n", "output": ["1"]}, {"input": "2\r\n", "output": ["2"]}, {"input": "3\r\n", "output": ["2 1", "2 1"]}, {"input": "8\r\n", "output": ["4"]}, {"input": "100000\r\n", "output": ["17 16 11 10 8 6", "17 16 11 10 8 6"]}, {"input": "12345\r\n", "output": ["14 13 6 5 4 1", "14 13 6 5 4 1"]}, {"inpu... | 100 | 100 | 100 | [{'input': '4974\r\n', 'output': ['13 10 9 7 6 4 3 2', '13 10 9 7 6 4 3 2']}, {'input': '70958\r\n', 'output': ['17 13 11 9 6 4 3 2', '17 13 11 9 6 4 3 2']}, {'input': '32\r\n', 'output': ['6']}, {'input': '3\r\n', 'output': ['2 1', '2 1']}, {'input': '8192\r\n', 'output': ['14']}] | [{'input': '97593\r\n', 'output': ['17 15 14 13 12 11 9 6 5 4 1', '17 15 14 13 12 11 9 6 5 4 1']}, {'input': '32\r\n', 'output': ['6']}, {'input': '3\r\n', 'output': ['2 1', '2 1']}, {'input': '4096\r\n', 'output': ['13']}, {'input': '33301\r\n', 'output': ['16 10 5 3 1', '16 10 5 3 1']}] | [{'input': '100000\r\n', 'output': ['17 16 11 10 8 6', '17 16 11 10 8 6']}, {'input': '2\r\n', 'output': ['2']}, {'input': '32\r\n', 'output': ['6']}, {'input': '97205\r\n', 'output': ['17 15 14 13 12 10 9 8 6 5 3 1', '17 15 14 13 12 10 9 8 6 5 3 1']}, {'input': '4096\r\n', 'output': ['13']}] | [{'input': '1\r\n', 'output': ['1']}, {'input': '85371\r\n', 'output': ['17 15 12 11 9 7 6 5 4 2 1', '17 15 12 11 9 7 6 5 4 2 1']}, {'input': '34768\r\n', 'output': ['16 11 10 9 8 7 5', '16 11 10 9 8 7 5']}, {'input': '16277\r\n', 'output': ['14 13 12 11 10 9 8 5 3 1', '14 13 12 11 10 9 8 5 3 1... | [{'input': '3\r\n', 'output': ['2 1', '2 1']}, {'input': '100000\r\n', 'output': ['17 16 11 10 8 6', '17 16 11 10 8 6']}, {'input': '12705\r\n', 'output': ['14 13 9 8 6 1', '14 13 9 8 6 1']}, {'input': '30151\r\n', 'output': ['15 14 13 11 9 8 7 3 2 1', '15 14 13 11 9 8 7 3 2 1']}, {'input': '34768\r... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 87.5 | 87.5 | 87.5 | 100 | 87.5 | 55 | 100 | 100 | 90 |
["2 3", "3 1"] | In the only line you are given two integers a, b (0ββ€βa,βbββ€β100) β the number of even and odd steps, accordingly. | ec5e3b3f5ee6a13eaf01b9a9a66ff037 | #include <stdio.h>
int main(void) {
// your code goes here
int i,j;
scanf("%d%d",&i,&j);
if(i==0&&j==0)
{
printf("NO");
}
else
{
if((i-j)==1||(j-i)==1||i==j)
{
printf("YES");
}
else
{
printf("NO");
}
}
return 0;
}
| ["YES", "NO"] | C | NoteIn the first example one of suitable intervals is from 1 to 5. The interval contains two even stepsΒ β 2 and 4, and three odd: 1, 3 and 5. | In the only line print "YES", if the interval of steps described above exists, and "NO" otherwise. | On her way to programming school tiger Dasha faced her first test β a huge staircase! The steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that it has something to do with their color. So on some interval of her way she calculated two values β the number ... | [{"input": "2 3\r\n", "output": ["YES"]}, {"input": "3 1\r\n", "output": ["NO"]}, {"input": "5 4\r\n", "output": ["YES"]}, {"input": "9 9\r\n", "output": ["YES"]}, {"input": "85 95\r\n", "output": ["NO"]}, {"input": "0 1\r\n", "output": ["YES"]}, {"input": "89 25\r\n", "output": ["NO"]}, {"input": "74 73\r\n", "output"... | 100 | 100 | 100 | [{'input': '85 95\r\n', 'output': ['NO']}, {'input': '100 0\r\n', 'output': ['NO']}, {'input': '100 100\r\n', 'output': ['YES']}, {'input': '5 4\r\n', 'output': ['YES']}, {'input': '2 3\r\n', 'output': ['YES']}] | [{'input': '9 9\r\n', 'output': ['YES']}, {'input': '100 0\r\n', 'output': ['NO']}, {'input': '99 100\r\n', 'output': ['YES']}, {'input': '0 1\r\n', 'output': ['YES']}, {'input': '5 4\r\n', 'output': ['YES']}] | [{'input': '100 100\r\n', 'output': ['YES']}, {'input': '62 39\r\n', 'output': ['NO']}, {'input': '2 2\r\n', 'output': ['YES']}, {'input': '100 0\r\n', 'output': ['NO']}, {'input': '99 100\r\n', 'output': ['YES']}] | [{'input': '0 0\r\n', 'output': ['NO']}, {'input': '2 2\r\n', 'output': ['YES']}, {'input': '89 25\r\n', 'output': ['NO']}, {'input': '1 0\r\n', 'output': ['YES']}, {'input': '57 57\r\n', 'output': ['YES']}] | [{'input': '2 3\r\n', 'output': ['YES']}, {'input': '9 9\r\n', 'output': ['YES']}, {'input': '99 100\r\n', 'output': ['YES']}, {'input': '0 0\r\n', 'output': ['NO']}, {'input': '85 95\r\n', 'output': ['NO']}] | 100 | 100 | 100 | 100 | 100 | 87.5 | 87.5 | 87.5 | 100 | 100 | 70 | 90 | 60 | 80 | 80 | 56 | 100 | 92.5 | 76 |
["27", "4545"] | The first line contains a single integer x (1ββ€βxββ€β1018) β the number that Luke Skywalker gave to Chewbacca. | d5de5052b4e9bbdb5359ac6e05a18b61 | #include<stdio.h>
#include<string.h>
int main()
{
int i;
char arr[20];
int c=0,b[20];
scanf("%s",arr);
for(i=0;i<strlen(arr);i++)
{
b[i]=arr[i];
if(b[i]>=53)
{
b[i]=57-b[i];
if(b[0]==0)
b[0]=9;
}
else
{b[i]=b[i]-48;}
printf("%d",b[i]);
}
//printf("1");
return 0;
}
| ["22", "4444"] | C | null | Print the minimum possible positive number that Chewbacca can obtain after inverting some digits. The number shouldn't contain leading zeroes. | Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9β-βt. Help Chewbacca to transform the initial number x to the minimum possible positive number by inverting some (possibly, zero) digits. The decimal... | [{"input": "27\r\n", "output": ["22"]}, {"input": "4545\r\n", "output": ["4444"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "9\r\n", "output": ["9"]}, {"input": "8772\r\n", "output": ["1222"]}, {"input": "81\r\n", "output": ["11"]}, {"input": "71723447\r\n", "output": ["21223442"]}, {"input": "91730629\r\n", "out... | 100 | 100 | 100 | [{'input': '99\r\n', 'output': ['90']}, {'input': '81\r\n', 'output': ['11']}, {'input': '5902\r\n', 'output': ['4002']}, {'input': '71723447\r\n', 'output': ['21223442']}, {'input': '429325660016\r\n', 'output': ['420324330013']}] | [{'input': '384979173822804784\r\n', 'output': ['314020123122104214']}, {'input': '270739\r\n', 'output': ['220230']}, {'input': '4237951492601449\r\n', 'output': ['4232041402301440']}, {'input': '8464062628894325\r\n', 'output': ['1434032321104324']}, {'input': '10279211\r\n', 'output': ['10220211']}] | [{'input': '5902\r\n', 'output': ['4002']}, {'input': '8537\r\n', 'output': ['1432']}, {'input': '545203238506\r\n', 'output': ['444203231403']}, {'input': '1000000000000000000\r\n', 'output': ['1000000000000000000']}, {'input': '1932\r\n', 'output': ['1032']}] | [{'input': '9\r\n', 'output': ['9']}, {'input': '857373361868\r\n', 'output': ['142323331131']}, {'input': '10279211\r\n', 'output': ['10220211']}, {'input': '420062703497\r\n', 'output': ['420032203402']}, {'input': '9991\r\n', 'output': ['9001']}] | [{'input': '3395184971407775\r\n', 'output': ['3304114021402224']}, {'input': '55403857\r\n', 'output': ['44403142']}, {'input': '429325660016\r\n', 'output': ['420324330013']}, {'input': '164324828731963982\r\n', 'output': ['134324121231033012']}, {'input': '9999\r\n', 'output': ['9000']}] | 100 | 100 | 100 | 100 | 100 | 100 | 91.67 | 91.67 | 100 | 100 | 100 | 83.33 | 83.33 | 100 | 100 | 57 | 100 | 96.668 | 93.332 |
["3 7", "100 99", "100 50"] | The first line contains two integers w,βm (2ββ€βwββ€β109, 1ββ€βmββ€β109) β the number defining the masses of the weights and the mass of the item. | a74adcf0314692f8ac95f54d165d9582 | #include<stdio.h>
typedef unsigned u;
u w,m;
int main()
{
scanf("%u%u",&w,&m);
while(m)
{
if(m%w==1)--m;
if(m%w==w-1)++m;
if(m%w==0)m/=w;
else{printf("NO\n");return 0;}
}
printf("YES\n");
return 0;
}
| ["YES", "YES", "NO"] | C | NoteNote to the first sample test. One pan can have an item of mass 7 and a weight of mass 3, and the second pan can have two weights of masses 9 and 1, correspondingly. Then 7β+β3β=β9β+β1.Note to the second sample test. One pan of the scales can have an item of mass 99 and the weight of mass 1, and the second pan can ... | Print word 'YES' if the item can be weighted and 'NO' if it cannot. | Vanya has a scales for weighing loads and weights of masses w0,βw1,βw2,β...,βw100 grams where w is some integer not less than 2 (exactly one weight of each nominal value). Vanya wonders whether he can weight an item with mass m using the given weights, if the weights can be put on both pans of the scales. Formally spea... | [{"input": "3 7\r\n", "output": ["YES"]}, {"input": "100 99\r\n", "output": ["YES"]}, {"input": "100 50\r\n", "output": ["NO"]}, {"input": "1000000000 1\r\n", "output": ["YES"]}, {"input": "100 10002\r\n", "output": ["NO"]}, {"input": "4 7\r\n", "output": ["NO"]}, {"input": "4 11\r\n", "output": ["YES"]}, {"input": "5 ... | 100 | 100 | 100 | [{'input': '22787 519292944\r\n', 'output': ['NO']}, {'input': '100 99\r\n', 'output': ['YES']}, {'input': '3716 13816089\r\n', 'output': ['NO']}, {'input': '3 8\r\n', 'output': ['YES']}, {'input': '4 7134\r\n', 'output': ['NO']}] | [{'input': '58 11316496\r\n', 'output': ['YES']}, {'input': '7 898367507\r\n', 'output': ['NO']}, {'input': '3 100000000\r\n', 'output': ['YES']}, {'input': '29245 855299270\r\n', 'output': ['YES']}, {'input': '1000 999999998\r\n', 'output': ['NO']}] | [{'input': '5 782\r\n', 'output': ['NO']}, {'input': '4 31\r\n', 'output': ['NO']}, {'input': '44 89146\r\n', 'output': ['NO']}, {'input': '2 9596\r\n', 'output': ['YES']}, {'input': '6 114457122\r\n', 'output': ['NO']}] | [{'input': '27 14329927\r\n', 'output': ['YES']}, {'input': '401739553 401739553\r\n', 'output': ['YES']}, {'input': '32 33586176\r\n', 'output': ['YES']}, {'input': '4 31\r\n', 'output': ['NO']}, {'input': '939 938\r\n', 'output': ['YES']}] | [{'input': '100000000 100000001\r\n', 'output': ['YES']}, {'input': '33562 33564\r\n', 'output': ['NO']}, {'input': '6 688005966\r\n', 'output': ['NO']}, {'input': '5 90332031\r\n', 'output': ['NO']}, {'input': '3 100000003\r\n', 'output': ['YES']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 58 | 100 | 100 | 100 |
["3"] | The first line contains a single integer n (0ββ€βnββ€β1000). | 1a335a9638523ca0315282a67e18eec7 | #include<stdio.h>
#define MOD 1000003
int power(int x,int y)
{
if(y==0)
return 1;
int temp=x;
while(--y)
{
x*=temp;
x%=MOD;
}
return x;
}
int main()
{
int y;
scanf("%d",&y);
if(y==0)
{
printf("%d",1);
return 0;
}
int res=power(3,y-1);
pri... | ["9"] | C | NoteIf the box possesses the base of 23βΓβ23 (as in the example), then the cookies will be put there in the following manner: | Print the single number, equal to the number of empty cells in the box. The answer should be printed modulo 106β+β3. | Fangy collects cookies. Once he decided to take a box and put cookies into it in some way. If we take a square kβΓβk in size, divided into blocks 1βΓβ1 in size and paint there the main diagonal together with cells, which lie above it, then the painted area will be equal to the area occupied by one cookie k in size. Fan... | [{"input": "3\r\n", "output": ["9"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "2\r\n", "output": ["3"]}, {"input": "4\r\n", "output": ["27"]}, {"input": "6\r\n", "output": ["243"]}, {"input": "11\r\n", "output": ["59049"]}, {"input": "14\r\n", "output": ["594320"]}, {"input": "15\r\n", "output": ["782957"]}, {"i... | 100 | 100 | 100 | [{'input': '1000\r\n', 'output': ['691074']}, {'input': '0\r\n', 'output': ['1']}, {'input': '11\r\n', 'output': ['59049']}, {'input': '226\r\n', 'output': ['376094']}, {'input': '617\r\n', 'output': ['247876']}] | [{'input': '226\r\n', 'output': ['376094']}, {'input': '617\r\n', 'output': ['247876']}, {'input': '857\r\n', 'output': ['562128']}, {'input': '15\r\n', 'output': ['782957']}, {'input': '1000\r\n', 'output': ['691074']}] | [{'input': '6\r\n', 'output': ['243']}, {'input': '1\r\n', 'output': ['1']}, {'input': '823\r\n', 'output': ['858672']}, {'input': '928\r\n', 'output': ['794863']}, {'input': '589\r\n', 'output': ['889192']}] | [{'input': '589\r\n', 'output': ['889192']}, {'input': '14\r\n', 'output': ['594320']}, {'input': '910\r\n', 'output': ['678945']}, {'input': '823\r\n', 'output': ['858672']}, {'input': '4\r\n', 'output': ['27']}] | [{'input': '15\r\n', 'output': ['782957']}, {'input': '823\r\n', 'output': ['858672']}, {'input': '857\r\n', 'output': ['562128']}, {'input': '696\r\n', 'output': ['695035']}, {'input': '226\r\n', 'output': ['376094']}] | 100 | 100 | 100 | 100 | 100 | 93.75 | 81.25 | 87.5 | 81.25 | 81.25 | 83.33 | 66.67 | 83.33 | 66.67 | 66.67 | 59 | 100 | 85 | 73.334 |
["2 3\n1 3", "2 4\n2 2", "3 5\n1 3 2"] | The first line of input contains two space-separated integers n and s (1ββ€βnββ€β20, 0ββ€βsββ€β1014). The second line contains n space-separated integers f1,βf2,β... fn (0ββ€βfiββ€β1012). | 8b883011eba9d15d284e54c7a85fcf74 | #include<stdio.h>
long long f[23],n,s,sum,inv[25];
int c[23];
int function(){
int i,t1,j=0;
i=1;
while(1){
if(c[i]==0){
c[i]=1;
break;
}else{
c[i]=0;
i++;
}
}
}
long long power(long long a, long long b, long long MOD) {
long long x = 1, y = a;
while(b > 0) {
if(b%2 == 1) {
... | ["2", "1", "3"] | C | NoteSample 1. There are two ways of selecting 3 flowers: {1,β2} and {0,β3}.Sample 2. There is only one way of selecting 4 flowers: {2,β2}.Sample 3. There are three ways of selecting 5 flowers: {1,β2,β2}, {0,β3,β2}, and {1,β3,β1}. | Output a single integer β the number of ways in which Devu can select the flowers modulo (109β+β7). | Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no two boxes have flowers of the same color.Now Devu wants to select exactly s flowers from the boxes to decorate ... | [{"input": "2 3\r\n1 3\r\n", "output": ["2"]}, {"input": "2 4\r\n2 2\r\n", "output": ["1"]}, {"input": "3 5\r\n1 3 2\r\n", "output": ["3"]}, {"input": "2 270030023747\r\n891135146290 437305641972\r\n", "output": ["30021858"]}, {"input": "20 4385085334307\r\n273634411136 208521328637 450482376435 844118010709 1972412858... | 100 | 100 | 100 | [{'input': '20 17054536210144\r\n1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000\r\n', '... | [{'input': '17 2309534620849\r\n148175936589 240636871234 113493896003 95560047639 15296143483 397180766738 530942609090 847353647933 503654197846 828548726146 36290540095 711771765248 184075122329 350456373063 419236331263 152256813920 755146994664\r\n', 'output': ['379054730']}, {'input': '17 9007952448244\r\n2821181... | [{'input': '20 1048455\r\n0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287\r\n', 'output': ['461657829']}, {'input': '2 270030023747\r\n891135146290 437305641972\r\n', 'output': ['30021858']}, {'input': '7 2053179920110\r\n674709576219 593363932330 454736686317 330887483693 391367... | [{'input': '3 5\r\n1 3 2\r\n', 'output': ['3']}, {'input': '3 850878851187\r\n599705086316 802990808570 221067397125\r\n', 'output': ['334902111']}, {'input': '6 2640586287988\r\n845646867385 315776128746 214078463847 838768025119 708835459344 934321520813\r\n', 'output': ['795903668']}, {'input': '20 14017821532816\r\... | [{'input': '17 2309534620849\r\n148175936589 240636871234 113493896003 95560047639 15296143483 397180766738 530942609090 847353647933 503654197846 828548726146 36290540095 711771765248 184075122329 350456373063 419236331263 152256813920 755146994664\r\n', 'output': ['379054730']}, {'input': '5 1199105497223\r\n12549999... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 96.15 | 100 | 100 | 96.15 | 60 | 100 | 100 | 98.46 |
["1 5", "2 3"] | The first line of input contains two space-separated integers m and b (1ββ€βmββ€β1000, 1ββ€βbββ€β10000). | 9300f1c07dd36e0cf7e6cb7911df4cf2 | #include <stdio.h>
#include <limits.h>
int main(void){
long long int m, b;
scanf("%lld%lld", &m, &b);
long long int i;
long long int max = INT_MIN;
for(i=b; i>=0; i--){
long long int x = (b-i)*m;
long long int w = x*(x+1)/2;
long long int p = i*(i+1)/2;
long long int val = w*(i+1)+p*(x+1);
if(val > max)... | ["30", "25"] | C | Note The graph above corresponds to sample test 1. The optimal rectangle is shown in red and has 30 bananas. | Print the maximum number of bananas Okabe can get from the trees he cuts. | Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.Consider the point (x,βy) in the 2D plane such that x and y are integers and 0ββ€βx,βy. There is a tree in such a point, and it has xβ+βy bananas. There are no trees nor bananas in other points.... | [{"input": "1 5\r\n", "output": ["30"]}, {"input": "2 3\r\n", "output": ["25"]}, {"input": "4 6\r\n", "output": ["459"]}, {"input": "6 3\r\n", "output": ["171"]}, {"input": "1 1\r\n", "output": ["1"]}, {"input": "10 1\r\n", "output": ["55"]}, {"input": "20 10\r\n", "output": ["40326"]}, {"input": "1000 10000\r\n", "out... | 100 | 100 | 100 | [{'input': '515 1563\r\n', 'output': ['75233740231341']}, {'input': '918 7704\r\n', 'output': ['28569727339126165']}, {'input': '446 5030\r\n', 'output': ['1878390629993745']}, {'input': '945 2563\r\n', 'output': ['1115613396515835']}, {'input': '494 6155\r\n', 'output': ['4221391613846823']}] | [{'input': '515 1563\r\n', 'output': ['75233740231341']}, {'input': '4 6\r\n', 'output': ['459']}, {'input': '259 770\r\n', 'output': ['2281741798549']}, {'input': '555 3594\r\n', 'output': ['1061060598862891']}, {'input': '387 5422\r\n', 'output': ['1771610559998400']}] | [{'input': '393 4874\r\n', 'output': ['1327174123029975']}, {'input': '1 1\r\n', 'output': ['1']}, {'input': '417 1045\r\n', 'output': ['14758909519725']}, {'input': '539 9221\r\n', 'output': ['16893595018603386']}, {'input': '70 7311\r\n', 'output': ['142915220249910']}] | [{'input': '1000 10000\r\n', 'output': ['74133360011484445']}, {'input': '10 1\r\n', 'output': ['55']}, {'input': '2 3\r\n', 'output': ['25']}, {'input': '894 4637\r\n', 'output': ['5909849585253250']}, {'input': '539 9221\r\n', 'output': ['16893595018603386']}] | [{'input': '22 3481\r\n', 'output': ['1548544125646']}, {'input': '20 10\r\n', 'output': ['40326']}, {'input': '446 5030\r\n', 'output': ['1878390629993745']}, {'input': '841 7185\r\n', 'output': ['19452619774222875']}, {'input': '945 2563\r\n', 'output': ['1115613396515835']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 61 | 100 | 100 | 100 |
["1 1 2", "3 4 5", "4 1 1"] | The single line of the input contains three space-separated integers a, b and c (1ββ€βa,βb,βcββ€β106) β the valence numbers of the given atoms. | b3b986fddc3770fed64b878fa42ab1bc | #include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int K = (a+b-c)/2;
int K2 = (b+c-a)/2;
if(K >= 0 && K2>= 0 && a- K >=0 && 2*(K + K2 + (a - K)) == (a + b + c))
{
printf("%d %d %d\n",K,K2,a-K);
}
else
{
printf("Impossible\n");... | ["0 1 1", "1 3 2", "Impossible"] | C | NoteThe first sample corresponds to the first figure. There are no bonds between atoms 1 and 2 in this case.The second sample corresponds to the second figure. There is one or more bonds between each pair of atoms.The third sample corresponds to the third figure. There is no solution, because an atom cannot form bonds ... | If such a molecule can be built, print three space-separated integers β the number of bonds between the 1-st and the 2-nd, the 2-nd and the 3-rd, the 3-rd and the 1-st atoms, correspondingly. If there are multiple solutions, output any of them. If there is no solution, print "Impossible" (without the quotes). | Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.A molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each atom has a valence number β the number of bonds the atom must form with other atoms. An atom can form one o... | [{"input": "1 1 2\r\n", "output": ["0 1 1"]}, {"input": "3 4 5\r\n", "output": ["1 3 2"]}, {"input": "4 1 1\r\n", "output": ["Impossible"]}, {"input": "1 1 1\r\n", "output": ["Impossible"]}, {"input": "1000000 1000000 1000000\r\n", "output": ["500000 500000 500000"]}, {"input": "3 11 8\r\n", "output": ["3 8 0"]}, {"inp... | 100 | 100 | 100 | [{'input': '1000000 1000000 1000000\r\n', 'output': ['500000 500000 500000']}, {'input': '3 3 3\r\n', 'output': ['Impossible']}, {'input': '1 1 3\r\n', 'output': ['Impossible']}, {'input': '246 137 940\r\n', 'output': ['Impossible']}, {'input': '6 1 5\r\n', 'output': ['1 0 5']}] | [{'input': '5 1 4\r\n', 'output': ['1 0 4']}, {'input': '4 1 1\r\n', 'output': ['Impossible']}, {'input': '3 3 3\r\n', 'output': ['Impossible']}, {'input': '1 1 2\r\n', 'output': ['0 1 1']}, {'input': '602752 645534 784262\r\n', 'output': ['232012 413522 370740']}] | [{'input': '1000000 1000000 1000000\r\n', 'output': ['500000 500000 500000']}, {'input': '3 5 8\r\n', 'output': ['0 5 3']}, {'input': '8 5 12\r\n', 'output': ['Impossible']}, {'input': '4 4 4\r\n', 'output': ['2 2 2']}, {'input': '2 4 2\r\n', 'output': ['2 2 0']}] | [{'input': '5 1 4\r\n', 'output': ['1 0 4']}, {'input': '2 2 2\r\n', 'output': ['1 1 1']}, {'input': '4 1 1\r\n', 'output': ['Impossible']}, {'input': '8 5 12\r\n', 'output': ['Impossible']}, {'input': '3 3 3\r\n', 'output': ['Impossible']}] | [{'input': '10 5 14\r\n', 'output': ['Impossible']}, {'input': '5 8 13\r\n', 'output': ['0 8 5']}, {'input': '8 5 12\r\n', 'output': ['Impossible']}, {'input': '5 1 4\r\n', 'output': ['1 0 4']}, {'input': '310703 820961 326806\r\n', 'output': ['Impossible']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 75 | 62.5 | 75 | 75 | 62 | 100 | 100 | 72.5 |
["12\ntoosmallword", "35\nTheQuickBrownFoxJumpsOverTheLazyDog"] | 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. | f13eba0a0fb86e20495d218fc4ad532d | #include<stdio.h>
int main(void)
{
int i,j,n,m=0,k=0;
char a[101];
while((scanf("%d",&n))!=EOF)
{
m=0;
for(i=0;i<n;i++)
{
scanf(" %c",&a[i]);
}
for(i='a';i<='z';i++)
{
for(j=0;j<n;j++)
{
if(i==a[j]||(i-32)==a[j])
{
m=1;
}
}
if(m==1)
{
k+... | ["NO", "YES"] | C | null | Output "YES", if the string is a pangram and "NO" otherwise. | 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 ... | [{"input": "12\r\ntoosmallword\r\n", "output": ["No", "NO", "no"]}, {"input": "35\r\nTheQuickBrownFoxJumpsOverTheLazyDog\r\n", "output": ["YES", "Yes", "yes"]}, {"input": "1\r\na\r\n", "output": ["No", "NO", "no"]}, {"input": "26\r\nqwertyuiopasdfghjklzxcvbnm\r\n", "output": ["YES", "Yes", "yes"]}, {"input": "26\r\nABC... | 100 | 100 | 100 | [{'input': '26\r\ncTUpqjPmANrdbzSFhlWIoKxgVY\r\n', 'output': ['No', 'NO', 'no']}, {'input': '30\r\nABCDEFGHTYRIOPLabcdefghtyriopl\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nqwertyuiopasdfghjklzxcvbnm\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '50\r\nabcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXY\r... | [{'input': '26\r\nEoqxUbsLjPytUHMiFnvcGWZdRK\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nEKWJqCFLRmstxVBdYuinpbhaOg\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nEjDWsVxfKTqGXRnUMOLYcIzPba\r\n', 'output': ['No', 'NO', 'no']}, {'input': '25\r\nqwertyuiopasdfghjklxcvbnm\r\n', 'output': ['No', 'NO', 'no'... | [{'input': '1\r\na\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nnRYUQsTwCPLZkgshfEXvBdoiMa\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nHNCQPfJutyAlDGsvRxZWMEbIdO\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nxKwzRMpunYaqsdfaBgJcVElTHo\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nhlrv... | [{'input': '66\r\nBovdMlDzTaqKllZILFVfxbLGsRnzmtVVTmqiIDTYrossLEPlmsPrkUYtWEsGHVOnFj\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nDqspXZJTuONYieKgaHLMBwfVSC\r\n', 'output': ['No', 'NO', 'no']}, {'input': '31\r\nTHEFIVEBOXINGWIZARDSJUMPQUICKLY\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '26\r\nWtrPuaHdXLK... | [{'input': '25\r\nbcdefghijklmnopqrstuvwxyz\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nvCUFRKElZOnjmXGylWQaHDiPst\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nEoqxUbsLjPytUHMiFnvcGWZdRK\r\n', 'output': ['No', 'NO', 'no']}, {'input': '26\r\nhlrvgdwsIOyjcmUZXtAKEqoBpF\r\n', 'output': ['No', 'NO', 'no'... | 100 | 100 | 100 | 100 | 100 | 100 | 94.44 | 94.44 | 100 | 100 | 100 | 93.75 | 93.75 | 100 | 100 | 63 | 100 | 97.776 | 97.5 |
["5 2 3", "8 2 4"] | The only line contains three integers n,βb,βp (1ββ€βn,βb,βpββ€β500) β the number of participants and the parameters described in the problem statement. | eb815f35e9f29793a120d120968cfe34 | #include<stdio.h>
int main()
{
int n,b,p,nb,np,temp,count=0,r;
scanf("%d %d %d",&n,&b,&p);
printf("%d %d",(n-1)*(2*b+1),n*p);
return 0;
}
| ["20 15", "35 32"] | C | NoteIn the first example will be three rounds: in the first round will be two matches and for each match 5 bottles of water are needed (two for each of the participants and one for the judge), in the second round will be only one match, so we need another 5 bottles of water, in the third round will also be only one ... | Print two integers x and y β the number of bottles and towels need for the tournament. | A tennis tournament with n participants is running. The participants are playing by an olympic system, so the winners move on and the losers drop out.The tournament takes place in the following way (below, m is the number of the participants of the current round): let k be the maximal power of the number 2 such that k... | [{"input": "5 2 3\r\n", "output": ["20\r\n15", "20 15"]}, {"input": "8 2 4\r\n", "output": ["35\r\n32", "35 32"]}, {"input": "10 1 500\r\n", "output": ["27 5000", "27\r\n5000"]}, {"input": "20 500 1\r\n", "output": ["19019\r\n20", "19019 20"]}, {"input": "100 123 99\r\n", "output": ["24453\r\n9900", "24453 9900"]}, {"i... | 100 | 100 | 100 | [{'input': '1 100 90\r\n', 'output': ['0 90', '0\r\n90']}, {'input': '1 2 100\r\n', 'output': ['0 100', '0\r\n100']}, {'input': '1 2 3\r\n', 'output': ['0\r\n3', '0 3']}, {'input': '10 10 10\r\n', 'output': ['189\r\n100', '189 100']}, {'input': '1 345 345\r\n', 'output': ['0 345', '0\r\n345']}] | [{'input': '7 12 13\r\n', 'output': ['150\r\n91', '150 91']}, {'input': '1 500 500\r\n', 'output': ['0\r\n500', '0 500']}, {'input': '10 1 500\r\n', 'output': ['27 5000', '27\r\n5000']}, {'input': '1 2 5\r\n', 'output': ['0 5', '0\r\n5']}, {'input': '1 100 90\r\n', 'output': ['0 90', '0\r\n90']}] | [{'input': '1 345 345\r\n', 'output': ['0 345', '0\r\n345']}, {'input': '20 500 1\r\n', 'output': ['19019\r\n20', '19019 20']}, {'input': '7 12 13\r\n', 'output': ['150\r\n91', '150 91']}, {'input': '1 2 100\r\n', 'output': ['0 100', '0\r\n100']}, {'input': '1 3 4\r\n', 'output': ['0\r\n4', '0 4']}] | [{'input': '500 500 500\r\n', 'output': ['499499\r\n250000', '499499 250000']}, {'input': '5 2 3\r\n', 'output': ['20\r\n15', '20 15']}, {'input': '1 2 5\r\n', 'output': ['0 5', '0\r\n5']}, {'input': '13 1 1\r\n', 'output': ['36 13', '36\r\n13']}, {'input': '73 73 73\r\n', 'output': ['10584 5329', '10584\r\n5329']}] | [{'input': '1 2 1\r\n', 'output': ['0 1', '0\r\n1']}, {'input': '1 100 90\r\n', 'output': ['0 90', '0\r\n90']}, {'input': '59 1 1\r\n', 'output': ['174\r\n59', '174 59']}, {'input': '349 2 5\r\n', 'output': ['1740\r\n1745', '1740 1745']}, {'input': '1 500 500\r\n', 'output': ['0\r\n500', '0 500']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 64 | 100 | 100 | 100 |
["1 1 1 2", "1 2 3 1", "10 2 1 7"] | The single line contains 4 integers a,βb,βc,βl (1ββ€βa,βb,βcββ€β3Β·105, 0ββ€βlββ€β3Β·105). | 185ff90a8b0ae0e2b75605f772589410 | #include<stdio.h>
#define min(a,b) ((a<b)?a:b)
long long cal(long long a,long long b,long long c,long long la,long long l)
{
long long x,val=a-b-c+la;
if(val<=-1)
return 0;
x=min(val,l-la);
return (x+1)*(x+2)/2;
}
int main()
{
long long int i,a,b,c,l;
scanf("%lld %lld %lld %lld",&a,&b,&c,&l);
unsigned... | ["4", "2", "0"] | C | NoteIn the first sample test you can either not increase any stick or increase any two sticks by 1 centimeter.In the second sample test you can increase either the first or the second stick by one centimeter. Note that the triangle made from the initial sticks is degenerate and thus, doesn't meet the conditions. | Print a single integer β the number of ways to increase the sizes of the sticks by the total of at most l centimeters, so that you can make a non-degenerate triangle from it. | You are given three sticks with positive integer lengths of a,βb, and c centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by a different length), but in total by at most l centimeters. In particular, it is allowed not to increase the l... | [{"input": "1 1 1 2\r\n", "output": ["4"]}, {"input": "1 2 3 1\r\n", "output": ["2"]}, {"input": "10 2 1 7\r\n", "output": ["0"]}, {"input": "1 2 1 5\r\n", "output": ["20"]}, {"input": "10 15 17 10\r\n", "output": ["281"]}, {"input": "5 5 5 10000\r\n", "output": ["41841675001"]}, {"input": "5 7 30 100\r\n", "output": [... | 100 | 100 | 100 | [{'input': '300000 300000 300000 300000\r\n', 'output': ['4500090000549998']}, {'input': '1 1 1 2\r\n', 'output': ['4']}, {'input': '552 250082 77579 278985\r\n', 'output': ['596240712378446']}, {'input': '300000 200000 100000 1\r\n', 'output': ['2']}, {'input': '5 7 30 100\r\n', 'output': ['71696']}] | [{'input': '100000 300000 199999 0\r\n', 'output': ['0']}, {'input': '98406 37723 3 257918\r\n', 'output': ['1154347569149860']}, {'input': '63 5 52 78\r\n', 'output': ['46502']}, {'input': '1 1 300000 300000\r\n', 'output': ['599999']}, {'input': '30 918 702 591\r\n', 'output': ['14315560']}] | [{'input': '1 2 1 5\r\n', 'output': ['20']}, {'input': '63 5 52 78\r\n', 'output': ['46502']}, {'input': '1 1 300000 300000\r\n', 'output': ['599999']}, {'input': '30 918 702 591\r\n', 'output': ['14315560']}, {'input': '1 2 3 1\r\n', 'output': ['2']}] | [{'input': '2 42 49 93\r\n', 'output': ['72542']}, {'input': '2 7 8 4\r\n', 'output': ['25']}, {'input': '81780 54799 231699 808\r\n', 'output': ['0']}, {'input': '61 100 3 8502\r\n', 'output': ['27050809786']}, {'input': '300000 300000 1 24234\r\n', 'output': ['1186319275394']}] | [{'input': '61 100 3 8502\r\n', 'output': ['27050809786']}, {'input': '300000 200000 100000 1\r\n', 'output': ['2']}, {'input': '5 7 30 100\r\n', 'output': ['71696']}, {'input': '1 2 3 1\r\n', 'output': ['2']}, {'input': '30 918 702 591\r\n', 'output': ['14315560']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 65 | 100 | 100 | 100 |
["4 1", "4 2", "4 3", "4 0"] | The only line contains two integers n,βk (1ββ€βnββ€β109,β0ββ€βkββ€β106). | 6f6fc42a367cdce60d76fd1914e73f0c | #include <stdio.h>
#define M 1000000007
int n,k,i,c,d;
long long y,z,u,v,r;
int F(int a,int b){
int r=1;
for (;b;b>>=1,a=(long long)a*a%M){
if (b&1)r=(long long)r*a%M;
}
return r;
}
int main(){
scanf("%d%d",&n,&k);
if (!k)r=n;
else{
if (n<=++k){for(i=1;i<=n;i++)r+=F(i,k-1);}
... | ["10", "30", "100", "4"] | C | null | Print the only integer a β the remainder after dividing the value of the sum by the value 109β+β7. | There are well-known formulas: , , . Also mathematicians found similar formulas for higher degrees.Find the value of the sum modulo 109β+β7 (so you should find the remainder after dividing the answer by the value 109β+β7). | [{"input": "4 1\r\n", "output": ["10"]}, {"input": "4 2\r\n", "output": ["30"]}, {"input": "4 3\r\n", "output": ["100"]}, {"input": "4 0\r\n", "output": ["4"]}, {"input": "10 0\r\n", "output": ["10"]}, {"input": "1 1\r\n", "output": ["1"]}, {"input": "1 0\r\n", "output": ["1"]}, {"input": "1 1000000\r\n", "output": ["1... | 100 | 100 | 100 | [{'input': '1 1000000\r\n', 'output': ['1']}, {'input': '100 10000\r\n', 'output': ['859998022']}, {'input': '10 0\r\n', 'output': ['10']}, {'input': '4 0\r\n', 'output': ['4']}, {'input': '203702132 355473\r\n', 'output': ['229710810']}] | [{'input': '1000000000 999935\r\n', 'output': ['729344740']}, {'input': '4 3\r\n', 'output': ['100']}, {'input': '333312494 795258\r\n', 'output': ['393290476']}, {'input': '1 1000000\r\n', 'output': ['1']}, {'input': '4 1\r\n', 'output': ['10']}] | [{'input': '4 2\r\n', 'output': ['30']}, {'input': '761637147 673329\r\n', 'output': ['223778667']}, {'input': '1000000000 999935\r\n', 'output': ['729344740']}, {'input': '4 3\r\n', 'output': ['100']}, {'input': '10 0\r\n', 'output': ['10']}] | [{'input': '761637147 673329\r\n', 'output': ['223778667']}, {'input': '1 0\r\n', 'output': ['1']}, {'input': '1000000000 999935\r\n', 'output': ['729344740']}, {'input': '77674473 447444\r\n', 'output': ['838207299']}, {'input': '4 1\r\n', 'output': ['10']}] | [{'input': '100 100\r\n', 'output': ['568830579']}, {'input': '1000000000 1000000\r\n', 'output': ['617381606']}, {'input': '4 2\r\n', 'output': ['30']}, {'input': '203702132 355473\r\n', 'output': ['229710810']}, {'input': '100 10000\r\n', 'output': ['859998022']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 94.44 | 100 | 83.33 | 94.44 | 66 | 100 | 100 | 94.442 |
["4 5\n2 3 1 4 4", "3 3\n3 1 2"] | The first line contains two integer numbers n, m (1ββ€βn,βmββ€β100). The second line contains m integer numbers l1,βl2,β...,βlm (1ββ€βliββ€βn) β indices of leaders in the beginning of each step. | 4a7c959ca279d0a9bd9bbf0ce88cf72b | #include<stdio.h>
int arr[101],no[101],l[100];
int main()
{
int n,m,source,desti,temp,flag,k,i;
scanf("%d %d",&n,&m);
for(i=0;i<m;i++)
scanf("%d",&l[i]);
for(i=0;i<=n;i++)
{
arr[i]=0;
no[i]=0;
}
flag=0;
for(i=0;i<(m-1);i++)
{
source=l[i];
desti=l[i+1];
if(desti<=source)
desti=desti+n;
temp=desti... | ["3 1 2 4", "-1"] | C | NoteLet's follow leadership in the first example: Child 2 starts. Leadership goes from 2 to 2β+βa2β=β3. Leadership goes from 3 to 3β+βa3β=β5. As it's greater than 4, it's going in a circle to 1. Leadership goes from 1 to 1β+βa1β=β4. Leadership goes from 4 to 4β+βa4β=β8. Thus in circle it still remains at 4. | Print such permutation of n numbers a1,βa2,β...,βan that leaders in the game will be exactly l1,βl2,β...,βlm if all the rules are followed. If there are multiple solutions print any of them. If there is no permutation which satisfies all described conditions print -1. | n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1,βa2,β...,βan of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it.The game consists of m steps. On each step the current leader with index i counts out ai p... | [{"input": "4 5\r\n2 3 1 4 4\r\n", "output": ["3 1 2 4"]}, {"input": "3 3\r\n3 1 2\r\n", "output": ["-1"]}, {"input": "1 100\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | 100 | 100 | 100 | [{'input': '3 3\r\n1 1 3\r\n', 'output': ['-1']}, {'input': '9 4\r\n8 2 8 3\r\n', 'output': ['-1']}, {'input': '100 100\r\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 ... | [{'input': '6 6\r\n1 2 1 1 3 6\r\n', 'output': ['-1']}, {'input': '4 4\r\n1 4 1 1\r\n', 'output': ['-1']}, {'input': '6 8\r\n2 5 4 2 5 4 2 5\r\n', 'output': ['1 3 2 4 5 6']}, {'input': '5 7\r\n4 3 4 3 3 4 5\r\n', 'output': ['-1']}, {'input': '10 4\r\n5 6 5 7\r\n', 'output': ['-1']}] | [{'input': '4 4\r\n2 4 2 3\r\n', 'output': ['-1']}, {'input': '66 67\r\n19 9 60 40 19 48 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5\r\n', 'output': ['-1']}, {'input': '100 100\r\n1 99 2 98 3 97 4 96 5 95 6 94 7 ... | [{'input': '2 5\r\n1 2 2 1 1\r\n', 'output': ['-1']}, {'input': '4 3\r\n1 1 2\r\n', 'output': ['-1']}, {'input': '2 2\r\n2 2\r\n', 'output': ['1 2']}, {'input': '66 67\r\n19 9 60 40 19 48 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 58 5 ... | [{'input': '100 100\r\n96 73 23 74 35 44 75 13 62 50 76 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 63 29 45 24 ... | 100 | 100 | 100 | 100 | 100 | 80.56 | 94.44 | 97.22 | 91.67 | 94.44 | 83.33 | 95.83 | 91.67 | 87.5 | 95.83 | 67 | 100 | 91.666 | 90.832 |
["5\n1 1 1 1 2 2 3 2 2 1 1 1", "0\n0 0 0 0 0 0 0 1 1 2 3 0", "11\n1 1 4 1 1 5 1 1 4 1 1 1"] | The first line contains exactly one integer k (0ββ€βkββ€β100). The next line contains twelve space-separated integers: the i-th (1ββ€βiββ€β12) number in the line represents ai (0ββ€βaiββ€β100). | 59dfa7a4988375febc5dccc27aca90a8 | #include<stdio.h>
#include<stdlib.h>
int compare(const void *a,const void *b)
{
return ( *(int*)a - *(int *)b );
}
int main()
{
int n,i,s=0,p=0,j=0;
scanf("%d",&n);
int a[12];
for(i=0;i<12;i++)
scanf("%d",&a[i]);
qsort(a,12,sizeof(int),compare);
if(n!=0)
{ for(i=11;i>=0;i--... | ["2", "0", "3"] | C | NoteLet's consider the first sample test. There it is enough to water the flower during the seventh and the ninth month. Then the flower grows by exactly five centimeters.In the second sample Petya's parents will believe him even if the flower doesn't grow at all (kβ=β0). So, it is possible for Petya not to water the f... | Print the only integer β the minimum number of months when Petya has to water the flower so that the flower grows no less than by k centimeters. If the flower can't grow by k centimeters in a year, print -1. | What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until... Today Petya opened the cupboard and found a scary note there. His parents had left him with duties: he should water t... | [{"input": "5\r\n1 1 1 1 2 2 3 2 2 1 1 1\r\n", "output": ["2"]}, {"input": "0\r\n0 0 0 0 0 0 0 1 1 2 3 0\r\n", "output": ["0"]}, {"input": "11\r\n1 1 4 1 1 5 1 1 4 1 1 1\r\n", "output": ["3"]}, {"input": "15\r\n20 1 1 1 1 2 2 1 2 2 1 1\r\n", "output": ["1"]}, {"input": "7\r\n8 9 100 12 14 17 21 10 11 100 23 10\r\n", "o... | 100 | 100 | 100 | [{'input': '13\r\n1 1 1 1 1 1 1 1 1 1 1 2\r\n', 'output': ['12']}, {'input': '15\r\n20 1 1 1 1 2 2 1 2 2 1 1\r\n', 'output': ['1']}, {'input': '0\r\n0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['0']}, {'input': '47\r\n8 2 2 4 3 1 9 4 2 7 7 8\r\n', 'output': ['7']}, {'input': '76\r\n2 16 11 10 12 0 20 4 4 14 11 14\r\n', 'ou... | [{'input': '5\r\n1 1 1 1 2 2 3 2 2 1 1 1\r\n', 'output': ['2']}, {'input': '96\r\n8 4 12 15 8 0 4 10 6 6 12 11\r\n', 'output': ['11']}, {'input': '100\r\n6 3 2 0 4 1 2 2 2 2 1 1\r\n', 'output': ['-1']}, {'input': '100\r\n100 100 100 100 100 100 100 100 100 100 100 100\r\n', 'output': ['1']}, {'input': '97\r\n0 5 3 12 1... | [{'input': '0\r\n0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['0']}, {'input': '47\r\n8 2 2 4 3 1 9 4 2 7 7 8\r\n', 'output': ['7']}, {'input': '15\r\n20 1 1 1 1 2 2 1 2 2 1 1\r\n', 'output': ['1']}, {'input': '41\r\n2 1 7 7 4 2 4 4 9 3 10 0\r\n', 'output': ['6']}, {'input': '7\r\n8 9 100 12 14 17 21 10 11 100 23 10\r\n', ... | [{'input': '11\r\n1 1 4 1 1 5 1 1 4 1 1 1\r\n', 'output': ['3']}, {'input': '100\r\n21 21 0 0 4 13 0 26 0 0 0 15\r\n', 'output': ['6']}, {'input': '31\r\n6 1 0 4 4 5 1 0 5 3 2 0\r\n', 'output': ['9']}, {'input': '100\r\n6 3 2 0 4 1 2 2 2 2 1 1\r\n', 'output': ['-1']}, {'input': '100\r\n0 0 16 5 22 0 5 0 25 0 14 13\r\n'... | [{'input': '15\r\n20 1 1 1 1 2 2 1 2 2 1 1\r\n', 'output': ['1']}, {'input': '0\r\n55 81 28 48 99 20 67 95 6 19 10 93\r\n', 'output': ['0']}, {'input': '50\r\n2 2 3 4 5 4 4 5 7 3 2 7\r\n', 'output': ['-1']}, {'input': '99\r\n19 17 0 1 18 11 29 9 29 22 0 8\r\n', 'output': ['4']}, {'input': '100\r\n6 3 2 0 4 1 2 2 2 2 1 ... | 100 | 100 | 100 | 100 | 100 | 95 | 95 | 95 | 95 | 100 | 80 | 90 | 80 | 90 | 100 | 68 | 100 | 96 | 88 |
["1 10\n7 2\n1", "2 2\n2 1\n2"] | The first line contains two integers c and d (1ββ€βc,βdββ€β100)Β β the number of problems in the main and additional rounds, correspondingly. The second line contains two integers n and m (1ββ€βn,βmββ€β100). Finally, the third line contains an integer k (1ββ€βkββ€β100)Β β the number of the pre-chosen winners. | c6ec932b852e0e8c30c822a226ef7bcb | /*!
* @file a.c
* @version 1.0
* @date 17/04/2014
* @author Anton Leontiev <bunder@t-25.ru>
*
* @copyright
*
* Copyright (c) 2014, Anton Leontiev
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* ... | ["2", "0"] | C | null | In the first line, print a single integer β the minimum number of problems the jury needs to prepare. | The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds.The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of c problems, the winners of the round are the first n people in the rating list. Each ... | [{"input": "1 10\r\n7 2\r\n1\r\n", "output": ["2"]}, {"input": "2 2\r\n2 1\r\n2\r\n", "output": ["0"]}, {"input": "8 9\r\n2 2\r\n3\r\n", "output": ["8"]}, {"input": "5 5\r\n8 8\r\n7\r\n", "output": ["40"]}, {"input": "1 8\r\n8 10\r\n8\r\n", "output": ["9"]}, {"input": "5 7\r\n9 1\r\n8\r\n", "output": ["5"]}, {"input": ... | 100 | 100 | 100 | [{'input': '100 1\r\n2 3\r\n1\r\n', 'output': ['5']}, {'input': '10 100\r\n100 100\r\n99\r\n', 'output': ['1000']}, {'input': '35 28\r\n35 60\r\n44\r\n', 'output': ['2065']}, {'input': '40 80\r\n4 31\r\n63\r\n', 'output': ['640']}, {'input': '3 1\r\n9 10\r\n80\r\n', 'output': ['4']}] | [{'input': '100 100\r\n100 100\r\n100\r\n', 'output': ['9900']}, {'input': '20 38\r\n38 70\r\n58\r\n', 'output': ['1380']}, {'input': '10 2\r\n7 2\r\n3\r\n', 'output': ['18']}, {'input': '2 2\r\n2 1\r\n2\r\n', 'output': ['0']}, {'input': '5 25\r\n13 76\r\n86\r\n', 'output': ['350']}] | [{'input': '10 9\r\n10 10\r\n9\r\n', 'output': ['99']}, {'input': '5 25\r\n13 76\r\n86\r\n', 'output': ['350']}, {'input': '2 78\r\n21 24\r\n88\r\n', 'output': ['40']}, {'input': '2 2\r\n2 1\r\n2\r\n', 'output': ['0']}, {'input': '10 2\r\n1 11\r\n1\r\n', 'output': ['20']}] | [{'input': '5 1\r\n6 3\r\n5\r\n', 'output': ['11']}, {'input': '10 1\r\n1 100\r\n1\r\n', 'output': ['99']}, {'input': '2 1\r\n3 4\r\n2\r\n', 'output': ['7']}, {'input': '1 8\r\n8 10\r\n8\r\n', 'output': ['9']}, {'input': '35 28\r\n35 60\r\n44\r\n', 'output': ['2065']}] | [{'input': '8 9\r\n2 2\r\n3\r\n', 'output': ['8']}, {'input': '5 1\r\n6 3\r\n5\r\n', 'output': ['11']}, {'input': '100 100\r\n100 100\r\n100\r\n', 'output': ['9900']}, {'input': '10 2\r\n7 2\r\n3\r\n', 'output': ['18']}, {'input': '2 1\r\n3 4\r\n2\r\n', 'output': ['7']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 69 | 100 | 100 | 100 |
["15 20", "14 8", "6 6"] | The first line contains two space-separated integers a and b (1ββ€βa,βbββ€β109). | 75a97f4d85d50ea0e1af0d46f7565b49 | #include<stdio.h>
typedef long long ll;
ll fox(ll a,ll b);
ll gcd(ll a,ll b);
int main()
{
ll a,b,c,d;
scanf("%lld%lld",&a,&b);
d = (a>b)?gcd(a,b):gcd(b,a);
c = fox(a/d,b/d);
printf("%lld",c);
return 0;
}
ll gcd(ll a,ll b)
{
if(b==(ll)0)
return a;
return gcd(b,a%b);
}
ll f... | ["3", "-1", "0"] | C | null | If the fox is lying to the little bears and it is impossible to make the pieces equal, print -1. Otherwise, print the required minimum number of operations. If the pieces of the cheese are initially equal, the required number is 0. | Two little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The bears are so greedy that they are ready to fight for the larger piece. That's where the fox comes in and starts the dialog: "Little bears, wait a little, I want to make your pieces equal" "Come off it fox... | [{"input": "15 20\r\n", "output": ["3"]}, {"input": "14 8\r\n", "output": ["-1"]}, {"input": "6 6\r\n", "output": ["0"]}, {"input": "1 1\r\n", "output": ["0"]}, {"input": "1 1024\r\n", "output": ["10"]}, {"input": "1024 729\r\n", "output": ["16"]}, {"input": "1024 1048576\r\n", "output": ["10"]}, {"input": "36 30\r\n",... | 100 | 100 | 100 | [{'input': '900000011 999900017\r\n', 'output': ['-1']}, {'input': '1000000000 2\r\n', 'output': ['17']}, {'input': '15 20\r\n', 'output': ['3']}, {'input': '720212000 864254400\r\n', 'output': ['3']}, {'input': '1024 729\r\n', 'output': ['16']}] | [{'input': '673067520 807681024\r\n', 'output': ['3']}, {'input': '36 30\r\n', 'output': ['3']}, {'input': '7920 9900\r\n', 'output': ['3']}, {'input': '607500 506250\r\n', 'output': ['3']}, {'input': '900000011 800000011\r\n', 'output': ['-1']}] | [{'input': '100000007 800000011\r\n', 'output': ['-1']}, {'input': '4812500 7577955\r\n', 'output': ['16']}, {'input': '3 1000000000\r\n', 'output': ['19']}, {'input': '2 1000000000\r\n', 'output': ['17']}, {'input': '720212000 864254400\r\n', 'output': ['3']}] | [{'input': '1 1000000000\r\n', 'output': ['18']}, {'input': '1 1\r\n', 'output': ['0']}, {'input': '21 35\r\n', 'output': ['2']}, {'input': '1000000000 7\r\n', 'output': ['-1']}, {'input': '445906944 528482304\r\n', 'output': ['8']}] | [{'input': '691200 583200\r\n', 'output': ['8']}, {'input': '100 10\r\n', 'output': ['2']}, {'input': '3303936 3097440\r\n', 'output': ['6']}, {'input': '119144448 423624704\r\n', 'output': ['7']}, {'input': '100000007 800000011\r\n', 'output': ['-1']}] | 100 | 100 | 100 | 100 | 100 | 96.97 | 100 | 100 | 96.97 | 100 | 95 | 100 | 95 | 95 | 100 | 70 | 100 | 98.788 | 97 |
["12"] | The only line of the input contains one integer n (1ββ€βnββ€β1018) β the prediction on the number of people who will buy the game. | e392be5411ffccc1df50e65ec1f5c589 | #include<stdio.h>
int main()
{
long long int n;
scanf("%lld",&n);
n=n-n/2-n/3-n/5-n/7+n/6+n/10+n/14+n/15+n/21+n/35-n/30-n/105-n/42-n/70+n/210;
printf("%lld\n",n);
return 0;
}
| ["2"] | C | null | Output one integer showing how many numbers from 1 to n are not divisible by any number from 2 to 10. | IT City company developing computer games decided to upgrade its way to reward its employees. Now it looks the following way. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is not divisible ... | [{"input": "12\r\n", "output": ["2"]}, {"input": "2519\r\n", "output": ["576"]}, {"input": "2521\r\n", "output": ["577"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "314159265\r\n", "output": ["71807832"]}, {"input": "718281828459045235\r\n", "output": ["164178703647781768"]}, {"input": "1000000000000000000\r\n", ... | 100 | 100 | 100 | [{'input': '12\r\n', 'output': ['2']}, {'input': '1\r\n', 'output': ['1']}, {'input': '718281828459045235\r\n', 'output': ['164178703647781768']}, {'input': '2519\r\n', 'output': ['576']}, {'input': '2521\r\n', 'output': ['577']}] | [{'input': '314159265\r\n', 'output': ['71807832']}, {'input': '1000000000000000000\r\n', 'output': ['228571428571428571']}, {'input': '12\r\n', 'output': ['2']}, {'input': '1\r\n', 'output': ['1']}, {'input': '3628800\r\n', 'output': ['829440']}] | [{'input': '1\r\n', 'output': ['1']}, {'input': '718281828459045235\r\n', 'output': ['164178703647781768']}, {'input': '987654321234567890\r\n', 'output': ['225749559139329804']}, {'input': '504000000000000000\r\n', 'output': ['115200000000000000']}, {'input': '314159265\r\n', 'output': ['71807832']}] | [{'input': '2521\r\n', 'output': ['577']}, {'input': '2519\r\n', 'output': ['576']}, {'input': '504000000000000000\r\n', 'output': ['115200000000000000']}, {'input': '3628800\r\n', 'output': ['829440']}, {'input': '314159265\r\n', 'output': ['71807832']}] | [{'input': '718281828459045235\r\n', 'output': ['164178703647781768']}, {'input': '987654321234567890\r\n', 'output': ['225749559139329804']}, {'input': '3628800\r\n', 'output': ['829440']}, {'input': '1000000000000000000\r\n', 'output': ['228571428571428571']}, {'input': '2519\r\n', 'output': ['576']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 71 | 100 | 100 | 100 |
["21 5", "9435152 272", "10 10"] | In the only line of the input two space-separated integers a and b (0ββ€βa,βbββ€β109) are given. | 6e0715f9239787e085b294139abb2475 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int a, b, c, i, ans = 0;
scanf("%d%d", &a, &b);
c = a - b;
if (c == 0)
{
printf("infinity");
return 0;
}
for (i = 1; i * i <= c; i++)
{
if (c % i == 0)
{
if (i > b)
... | ["2", "282", "infinity"] | C | NoteIn the first sample the answers of the Modular Equation are 8 and 16 since | If there is an infinite number of answers to our equation, print "infinity" (without the quotes). Otherwise print the number of solutions of the Modular Equation . | Last week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define i modulo j as the remainder of division of i by j and denote it by . A Modular Equation, as Hamed's teacher described, is an equation of the form in which a and b are two non-negative integers and x is a vari... | [{"input": "21 5\r\n", "output": ["2"]}, {"input": "9435152 272\r\n", "output": ["282"]}, {"input": "10 10\r\n", "output": ["infinity"]}, {"input": "0 1000000000\r\n", "output": ["0"]}, {"input": "11 2\r\n", "output": ["2"]}, {"input": "1 0\r\n", "output": ["1"]}, {"input": "0 0\r\n", "output": ["infinity"]}, {"input":... | 100 | 100 | 100 | [{'input': '1000000000 333333300\r\n', 'output': ['2']}, {'input': '223094728 1858\r\n', 'output': ['371']}, {'input': '223092887 17\r\n', 'output': ['500']}, {'input': '997920 0\r\n', 'output': ['240']}, {'input': '11 2\r\n', 'output': ['2']}] | [{'input': '997920 0\r\n', 'output': ['240']}, {'input': '325508499 119510657\r\n', 'output': ['1']}, {'input': '11 2\r\n', 'output': ['2']}, {'input': '887043 3\r\n', 'output': ['213']}, {'input': '223093836 966\r\n', 'output': ['399']}] | [{'input': '982901 101\r\n', 'output': ['193']}, {'input': '223092899 29\r\n', 'output': ['495']}, {'input': '0 1000000000\r\n', 'output': ['0']}, {'input': '1 0\r\n', 'output': ['1']}, {'input': '15 3\r\n', 'output': ['3']}] | [{'input': '9435152 272\r\n', 'output': ['282']}, {'input': '223092899 29\r\n', 'output': ['495']}, {'input': '923456789 3\r\n', 'output': ['14']}, {'input': '77 75\r\n', 'output': ['0']}, {'input': '89768760 885778845\r\n', 'output': ['0']}] | [{'input': '9435152 272\r\n', 'output': ['282']}, {'input': '5 2\r\n', 'output': ['1']}, {'input': '223094728 1858\r\n', 'output': ['371']}, {'input': '295138437 589952171\r\n', 'output': ['0']}, {'input': '1000000000 1\r\n', 'output': ['19']}] | 100 | 100 | 100 | 100 | 100 | 86.67 | 86.67 | 86.67 | 86.67 | 86.67 | 91.67 | 91.67 | 83.33 | 83.33 | 75 | 72 | 100 | 86.67 | 85 |
["1", "10"] | A single line contains a single integer x (1ββ€βxββ€β109). | ada94770281765f54ab264b4a1ef766e | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
int x_digit[10], d_digit[10], count;
void find_digits(int *digit, int num) {
int i;
for (i = 0; i < 10; i++)
digit[i] = 0;
while (num > 0) {
digit[num%10] = 1;
num /= 10;
}
}
void check(int d) {
int i;
find_digits(d_digit, d);
for (i = 0; i < 10... | ["1", "2"] | C | null | In a single line print an integer β the answer to the problem. | The Little Elephant loves numbers. He has a positive integer x. The Little Elephant wants to find the number of positive integers d, such that d is the divisor of x, and x and d have at least one common (the same) digit in their decimal representations. Help the Little Elephant to find the described number. | [{"input": "1\r\n", "output": ["1"]}, {"input": "10\r\n", "output": ["2"]}, {"input": "47\r\n", "output": ["1"]}, {"input": "100\r\n", "output": ["5"]}, {"input": "128\r\n", "output": ["6"]}, {"input": "2\r\n", "output": ["1"]}, {"input": "17\r\n", "output": ["2"]}, {"input": "1000000\r\n", "output": ["41"]}, {"input":... | 100 | 100 | 100 | [{'input': '17\r\n', 'output': ['2']}, {'input': '1000000\r\n', 'output': ['41']}, {'input': '960690025\r\n', 'output': ['8']}, {'input': '111111111\r\n', 'output': ['5']}, {'input': '999000011\r\n', 'output': ['2']}] | [{'input': '3\r\n', 'output': ['1']}, {'input': '999999937\r\n', 'output': ['1']}, {'input': '536870912\r\n', 'output': ['29']}, {'input': '901800900\r\n', 'output': ['639']}, {'input': '2\r\n', 'output': ['1']}] | [{'input': '999000011\r\n', 'output': ['2']}, {'input': '999999997\r\n', 'output': ['6']}, {'input': '20\r\n', 'output': ['3']}, {'input': '901800900\r\n', 'output': ['639']}, {'input': '999999666\r\n', 'output': ['8']}] | [{'input': '879541\r\n', 'output': ['7']}, {'input': '17\r\n', 'output': ['2']}, {'input': '47\r\n', 'output': ['1']}, {'input': '48\r\n', 'output': ['4']}, {'input': '111111111\r\n', 'output': ['5']}] | [{'input': '2\r\n', 'output': ['1']}, {'input': '211768200\r\n', 'output': ['244']}, {'input': '999999666\r\n', 'output': ['8']}, {'input': '17\r\n', 'output': ['2']}, {'input': '999999998\r\n', 'output': ['6']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 93.75 | 93.75 | 73 | 100 | 100 | 97.5 |
["abcd", "ababa", "zzz"] | The first input line contains the string. It's guaranteed, that the string is non-empty, consists of lower-case Latin letters, and its length doesn't exceed 100. | 13b5cf94f2fabd053375a5ccf3fd44c7 | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char s[100];
scanf("%s",s);
int l = strlen(s);
int len = 0;
for(int i = 0; i<l; i++)
{
for(int j = i+1; j<l; j++)
{
int n = 0;
while(s[i+n] == s[j+n])
n++;
... | ["0", "3", "2"] | C | null | Output one number β length of the longest substring that can be met in the string at least twice. | You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2). | [{"input": "abcd\r\n", "output": ["0"]}, {"input": "ababa\r\n", "output": ["3"]}, {"input": "zzz\r\n", "output": ["2"]}, {"input": "kmmm\r\n", "output": ["2"]}, {"input": "wzznz\r\n", "output": ["1"]}, {"input": "qlzazaaqll\r\n", "output": ["2"]}, {"input": "lzggglgpep\r\n", "output": ["2"]}, {"input": "iegdlraaidefgeg... | 100 | 100 | 100 | [{'input': 'fmubmfwefikoxtqvmaavwjxmoqltapexkqxcsztpezfcltqavuicefxovuswmqimuikoppgqpiapqutkczgcvxzutavkujxvpklv\r\n', 'output': ['3']}, {'input': 'ttketfkefktfztezzkzfkkeetkkfktftzktezekkeezkeeetteeteefetefkzzzetekfftkeffzkktffzkzzeftfeezfefzffeef\r\n', 'output': ['4']}, {'input': 'qqqmqqqsbteqqopsuqiqumrqzpqnqgqeniqq... | [{'input': 'mlhsyijxeydqxhtkmpdeqwzogjvxahmssyhfhqessbxzvydbrxdmlhsyijxeydqxhtkmpdeqwzogjvxahmssyhfhqessbxzvydik\r\n', 'output': ['47']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasaaaavaaaaaaauaaeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n', 'output': ['44']}, {'input': 'abcabcabc\r\n', 'output': ['6']}, ... | [{'input': 'garvpaimjdjiivamusjdwfcaoswuhxyyxvrxzajoyihggvuxumaadycfphrzbprraicvjjlsdhojihaw\r\n', 'output': ['2']}, {'input': 'ipsrjylhpkjvlzncfixipstwcicxqygqcfrawpzzvckoveyqhathglblhpkjvlzncfixipfajaqobtzvthmhgbuawoxoknirclxg\r\n', 'output': ['15']}, {'input': 'txbciieycswqpniwvzipwlottivvnfsysgzvzxwbctcchfpvlbcjikd... | [{'input': 'abcd\r\n', 'output': ['0']}, {'input': 'ababa\r\n', 'output': ['3']}, {'input': 'kcnjsntjzcbgzjscrsrjkrbytqsrptzspzctjrorsyggrtkcnjsntjzcbgzjscrsrjyqbrtpcgqirsrrjbbbrnyqstnrozcoztt\r\n', 'output': ['20']}, {'input': 'ttketfkefktfztezzkzfkkeetkkfktftzktezekkeezkeeetteeteefetefkzzzetekfftkeffzkktffzkzzeftfeez... | [{'input': 'rrrrrrrrrrrrrrrrrrrlhbrrrrrrrrurrrrrrrfrrqrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrewrrrrrrryrrxrrrrrrrrrrr\r\n', 'output': ['33']}, {'input': 'fmubmfwefikoxtqvmaavwjxmoqltapexkqxcsztpezfcltqavuicefxovuswmqimuikoppgqpiapqutkczgcvxzutavkujxvpklv\r\n', 'output': ['3']}, {'input': 'qlzazaaqll\r\n', 'output': ['2']}, ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 74 | 100 | 100 | 100 |
["7 3\n3 5 7 1 6 2 8\n1 2 7", "4 4\n3 4 1 0\n0 1 7 9"] | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 10$$$) representing the number of digits in the sequence you have and the number of keys on the keypad that have fingerprints. The next line contains $$$n$$$ distinct space-separated integers $$$x_1, x_2, \ldots, x_n$$$ ($$$0 \le x_i \le 9$$$) ... | f9044a4b4c3a0c2751217d9b31cd0c72 | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n1,n2,a1[100],a2[100];
scanf("%d%d",&n1,&n2);
for(int i=0;i<n1;i++)
{
scanf("%d",&a1[i]);
}
for(int i=0;i<n2;i++)
{
scanf("%d",&a2[i]);
}
for(int i=0;i<n1;i++)
{
for(int j=0;j<n2;j++)
{
if(a1[i]==a2[j]) printf("%d ... | ["7 1 2", "1 0"] | C | NoteIn the first example, the only digits with fingerprints are $$$1$$$, $$$2$$$ and $$$7$$$. All three of them appear in the sequence you know, $$$7$$$ first, then $$$1$$$ and then $$$2$$$. Therefore the output is 7 1 2. Note that the order is important, and shall be the same as the order in the original sequence.In t... | In a single line print a space-separated sequence of integers representing the code. If the resulting sequence is empty, both printing nothing and printing a single line break is acceptable. | You are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, you need to enter a correct code. You also have a sequence of digits.Some keys on the keypad have fingerprints. You believe the correct code is the longest not necessarily contiguous subsequ... | [{"input": "7 3\r\n3 5 7 1 6 2 8\r\n1 2 7\r\n", "output": ["7 1 2"]}, {"input": "4 4\r\n3 4 1 0\r\n0 1 7 9\r\n", "output": ["1 0"]}, {"input": "9 4\r\n9 8 7 6 5 4 3 2 1\r\n2 4 6 8\r\n", "output": ["8 6 4 2"]}, {"input": "10 5\r\n3 7 1 2 4 6 9 0 5 8\r\n4 3 0 7 9\r\n", "output": ["3 7 4 9 0"]}, {"input": "5 5\r\n1 2 3 4 ... | 100 | 100 | 100 | [{'input': '4 10\r\n8 3 9 6\r\n4 9 6 2 7 0 8 1 3 5\r\n', 'output': ['8 3 9 6']}, {'input': '3 6\r\n1 2 3\r\n4 5 6 1 2 3\r\n', 'output': ['1 2 3']}, {'input': '5 10\r\n6 0 3 8 1\r\n3 1 0 5 4 7 2 8 9 6\r\n', 'output': ['6 0 3 8 1']}, {'input': '1 2\r\n2\r\n1 2\r\n', 'output': ['2']}, {'input': '8 2\r\n7 4 8 9 2 5 6 1\r\n... | [{'input': '9 4\r\n9 8 7 6 5 4 3 2 1\r\n2 4 6 8\r\n', 'output': ['8 6 4 2']}, {'input': '10 1\r\n9 6 2 0 1 8 3 4 7 5\r\n6\r\n', 'output': ['6']}, {'input': '1 8\r\n0\r\n9 2 4 8 1 5 0 7\r\n', 'output': ['0']}, {'input': '10 5\r\n3 7 1 2 4 6 9 0 5 8\r\n4 3 0 7 9\r\n', 'output': ['3 7 4 9 0']}, {'input': '6 9\r\n7 3 9 4 1... | [{'input': '1 6\r\n3\r\n6 8 2 4 5 3\r\n', 'output': ['3']}, {'input': '8 2\r\n7 2 9 6 1 0 3 4\r\n6 3\r\n', 'output': ['6 3']}, {'input': '7 3\r\n3 5 7 1 6 2 8\r\n1 2 7\r\n', 'output': ['7 1 2']}, {'input': '1 2\r\n1\r\n1 0\r\n', 'output': ['1']}, {'input': '3 6\r\n1 2 3\r\n4 5 6 1 2 3\r\n', 'output': ['1 2 3']}] | [{'input': '10 10\r\n1 2 3 4 5 6 7 8 9 0\r\n4 5 6 7 1 2 3 0 9 8\r\n', 'output': ['1 2 3 4 5 6 7 8 9 0']}, {'input': '5 10\r\n6 0 3 8 1\r\n3 1 0 5 4 7 2 8 9 6\r\n', 'output': ['6 0 3 8 1']}, {'input': '8 2\r\n7 4 8 9 2 5 6 1\r\n6 4\r\n', 'output': ['4 6']}, {'input': '8 2\r\n7 2 9 6 1 0 3 4\r\n6 3\r\n', 'output': ['6 3'... | [{'input': '10 1\r\n9 0 8 1 7 4 6 5 2 3\r\n0\r\n', 'output': ['0']}, {'input': '5 5\r\n1 2 3 4 5\r\n6 7 8 9 0\r\n', 'output': ['']}, {'input': '7 6\r\n9 2 8 6 1 3 7\r\n4 2 0 3 1 8\r\n', 'output': ['2 8 1 3']}, {'input': '10 5\r\n3 7 1 2 4 6 9 0 5 8\r\n4 3 0 7 9\r\n', 'output': ['3 7 4 9 0']}, {'input': '6 3\r\n8 3 9 2 ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 100 | 100 | 100 |
["4\n1 1 0 1", "6\n0 1 0 0 1 0", "1\n0"] | The first line contains one integer number n (1ββ€βnββ€β100). The second line contains n space-separated integer numbers s1,βs2,β...,βsn (0ββ€βsiββ€β1). 0 corresponds to an unsuccessful game, 1 β to a successful one. | c7b1f0b40e310f99936d1c33e4816b95 | #include <stdio.h>
int countzeroes(int x, int s[])
{
int count=0;
for(int j=0;j<=x;j++){
if(s[j]==0)
count++;
}
return count;
}
int countones(int x, int s[])
{
int count=0;
for(int j=0;j<=x;j++){
if(s[j]==1)
count++;
}
return count;
}
int main(void) {
int n,i; //n is the total number of games.
s... | ["3", "4", "1"] | C | null | Print one integer β the maximum number of games Hideo can leave in his CV so that no unsuccessful game comes after a successful one. | Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero) f... | [{"input": "4\r\n1 1 0 1\r\n", "output": ["3"]}, {"input": "6\r\n0 1 0 0 1 0\r\n", "output": ["4"]}, {"input": "1\r\n0\r\n", "output": ["1"]}, {"input": "100\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | 100 | 100 | 100 | [{'input': '1\r\n1\r\n', 'output': ['1']}, {'input': '4\r\n1 1 0 1\r\n', 'output': ['3']}, {'input': '3\r\n1 0 1\r\n', 'output': ['2']}, {'input': '100\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | [{'input': '100\r\n1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 0 0 1 0 0 1 0 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 1\r\n', 'output': ['53']}, {'input': '100\r\n0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 ... | [{'input': '100\r\n1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 0 0 1 0 0 1 0 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 1\r\n', 'output': ['53']}, {'input': '6\r\n0 1 0 0 1 0\r\n', 'output': ['4']}, {'input': '3\r\n1 0 1\r\... | [{'input': '90\r\n1 0 0 1 1 0 0 1 0 0 0 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 0 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 0 0 1 0\r\n', 'output': ['52']}, {'input': '100\r\n0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0... | [{'input': '3\r\n1 1 0\r\n', 'output': ['2']}, {'input': '6\r\n0 1 0 0 1 0\r\n', 'output': ['4']}, {'input': '16\r\n1 1 1 1 1 0 0 0 0 0 1 0 1 0 0 1\r\n', 'output': ['9']}, {'input': '2\r\n0 1\r\n', 'output': ['2']}, {'input': '3\r\n1 0 0\r\n', 'output': ['2']}] | 100 | 100 | 100 | 100 | 100 | 97.06 | 100 | 100 | 100 | 100 | 95 | 100 | 100 | 100 | 100 | 76 | 100 | 99.412 | 99 |
["1", "3"] | The only line contains single integer: 1ββ€βnββ€β1000 β number of hassocks. | 4bd174a997707ed3a368bd0f2424590f | #include <stdio.h>
#include <stdlib.h>
//#include <string.h>
int main()
{
int n,i,j,f=0;
scanf("%d",&n);
int *a=(int *)calloc(n+1,sizeof(int));
a[1]=1;
j=1;
for(i=1;i<n;i++)
{
if((i+j)<=n)
{
a[i+j]=1;
j=j+i;
}
else
{
a[i+j-n]=1;... | ["YES", "NO"] | C | null | Output "YES" if all the hassocks will be visited and "NO" otherwise. | A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through kβ-β1 hassoΡks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You should answer: will the flea visit all the hassocks or not. We assume that flea has... | [{"input": "1\r\n", "output": ["YES"]}, {"input": "3\r\n", "output": ["NO"]}, {"input": "2\r\n", "output": ["YES"]}, {"input": "4\r\n", "output": ["YES"]}, {"input": "5\r\n", "output": ["NO"]}, {"input": "6\r\n", "output": ["NO"]}, {"input": "7\r\n", "output": ["NO"]}, {"input": "8\r\n", "output": ["YES"]}, {"input": "... | 100 | 100 | 100 | [{'input': '27\r\n', 'output': ['NO']}, {'input': '32\r\n', 'output': ['YES']}, {'input': '3\r\n', 'output': ['NO']}, {'input': '14\r\n', 'output': ['NO']}, {'input': '41\r\n', 'output': ['NO']}] | [{'input': '840\r\n', 'output': ['NO']}, {'input': '37\r\n', 'output': ['NO']}, {'input': '29\r\n', 'output': ['NO']}, {'input': '116\r\n', 'output': ['NO']}, {'input': '13\r\n', 'output': ['NO']}] | [{'input': '45\r\n', 'output': ['NO']}, {'input': '12\r\n', 'output': ['NO']}, {'input': '25\r\n', 'output': ['NO']}, {'input': '897\r\n', 'output': ['NO']}, {'input': '665\r\n', 'output': ['NO']}] | [{'input': '613\r\n', 'output': ['NO']}, {'input': '373\r\n', 'output': ['NO']}, {'input': '23\r\n', 'output': ['NO']}, {'input': '19\r\n', 'output': ['NO']}, {'input': '170\r\n', 'output': ['NO']}] | [{'input': '24\r\n', 'output': ['NO']}, {'input': '44\r\n', 'output': ['NO']}, {'input': '42\r\n', 'output': ['NO']}, {'input': '383\r\n', 'output': ['NO']}, {'input': '15\r\n', 'output': ['NO']}] | 100 | 100 | 100 | 100 | 100 | 100 | 94.74 | 94.74 | 94.74 | 94.74 | 100 | 80 | 80 | 80 | 80 | 77 | 100 | 95.792 | 84 |
["5 4 3", "1 1 1", "2 3 3"] | The single line contains three integers r, g and b (0ββ€βr,βg,βbββ€β2Β·109) β the number of red, green and blue baloons respectively. The numbers are separated by exactly one space. | bae7cbcde19114451b8712d6361d2b01 | #include <stdio.h>
int main(void)
{
int r, g, bb;
long long int a, b, c;
for (;;) {
if (scanf(" %d %d %d", &r, &g, &bb) != 3)
return 0;
if (r >= g && r >= bb) {
a = r;
if (g >= bb) {
b = g;
c = bb;
} else {... | ["4", "1", "2"] | C | NoteIn the first sample you can decorate the tables with the following balloon sets: "rgg", "gbb", "brr", "rrg", where "r", "g" and "b" represent the red, green and blue balls, respectively. | Print a single integer t β the maximum number of tables that can be decorated in the required manner. | You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know number of balloons of each color?Your task is to write a program that ... | [{"input": "5 4 3\r\n", "output": ["4"]}, {"input": "1 1 1\r\n", "output": ["1"]}, {"input": "2 3 3\r\n", "output": ["2"]}, {"input": "0 1 0\r\n", "output": ["0"]}, {"input": "0 3 3\r\n", "output": ["2"]}, {"input": "4 0 4\r\n", "output": ["2"]}, {"input": "1000000000 1000000000 1000000000\r\n", "output": ["1000000000"... | 100 | 100 | 100 | [{'input': '500000000 1000000000 500000000\r\n', 'output': ['666666666']}, {'input': '1234567890 123456789 987654321\r\n', 'output': ['781893000']}, {'input': '100500 100500 3\r\n', 'output': ['67001']}, {'input': '999288131 55884921 109298382\r\n', 'output': ['165183303']}, {'input': '0 1 0\r\n', 'output': ['0']}] | [{'input': '6 1 1\r\n', 'output': ['2']}, {'input': '3 5 2\r\n', 'output': ['3']}, {'input': '1 1 1\r\n', 'output': ['1']}, {'input': '0 1 1000000000\r\n', 'output': ['1']}, {'input': '1 2000000000 1000000000\r\n', 'output': ['1000000000']}] | [{'input': '999288131 55884921 109298382\r\n', 'output': ['165183303']}, {'input': '82728372 939848 100139442\r\n', 'output': ['61269220']}, {'input': '520000000 1000000033 501000000\r\n', 'output': ['673666677']}, {'input': '3 0 0\r\n', 'output': ['0']}, {'input': '1000000000 2000000000 1000000000\r\n', 'output': ['13... | [{'input': '2000000000 500000000 499999999\r\n', 'output': ['999999999']}, {'input': '150000 75000 75000\r\n', 'output': ['100000']}, {'input': '1000000000 2000000000 1000000000\r\n', 'output': ['1333333333']}, {'input': '2000000000 2000000000 2000000000\r\n', 'output': ['2000000000']}, {'input': '82728372 939848 10013... | [{'input': '0 0 0\r\n', 'output': ['0']}, {'input': '1 2000000000 1000000000\r\n', 'output': ['1000000000']}, {'input': '1000 1000 1002\r\n', 'output': ['1000']}, {'input': '520000000 1000000033 501000000\r\n', 'output': ['673666677']}, {'input': '1585222789 1889821127 2000000000\r\n', 'output': ['1825014638']}] | 100 | 100 | 100 | 100 | 100 | 69.23 | 84.62 | 84.62 | 76.92 | 92.31 | 68.75 | 81.25 | 87.5 | 81.25 | 93.75 | 78 | 100 | 81.54 | 82.5 |
["5 5 3 2", "7 5 5 2"] | The first line contains four space-separated integers n, a, b and c (1ββ€βn,βa,βb,βcββ€β4000) β the length of the original ribbon and the acceptable lengths of the ribbon pieces after the cutting, correspondingly. The numbers a, b and c can coincide. | 062a171cc3ea717ea95ede9d7a1c3a43 | #include <stdio.h>
int main()
{
int n,a[3],i;
scanf("%d %d %d %d",&n,&a[0],&a[1],&a[2]);
int dp[n];
for(i=0;i<n;i++){dp[i] = -1;}
int j,c;
for(i=0;i<3;i++)
{
j = 1;
while(a[i]*j <= n)
{
if(dp[a[i]*j - 1]==(-1)){dp[a[i]*j - 1] = j;}
for(c=0;... | ["2", "2"] | C | NoteIn the first example Polycarpus can cut the ribbon in such way: the first piece has length 2, the second piece has length 3.In the second example Polycarpus can cut the ribbon in such way: the first piece has length 5, the second piece has length 2. | Print a single number β the maximum possible number of ribbon pieces. It is guaranteed that at least one correct ribbon cutting exists. | Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two conditions: After the cutting each ribbon piece should have length a, b or c. After the cutting the number of ribbon pieces should be maximum. Help Polycarpus and find the number of ribbon pieces after the re... | [{"input": "5 5 3 2\r\n", "output": ["2"]}, {"input": "7 5 5 2\r\n", "output": ["2"]}, {"input": "4 4 4 4\r\n", "output": ["1"]}, {"input": "1 1 1 1\r\n", "output": ["1"]}, {"input": "4000 1 2 3\r\n", "output": ["4000"]}, {"input": "4000 3 4 5\r\n", "output": ["1333"]}, {"input": "10 3 4 5\r\n", "output": ["3"]}, {"inp... | 100 | 100 | 100 | [{'input': '6 2 4 1\r\n', 'output': ['6']}, {'input': '3999 2 2 3\r\n', 'output': ['1999']}, {'input': '3964 4 2916 176\r\n', 'output': ['991']}, {'input': '8 3 8 4\r\n', 'output': ['2']}, {'input': '100 100 1 1\r\n', 'output': ['100']}] | [{'input': '734 12 6 2\r\n', 'output': ['367']}, {'input': '6 2 4 1\r\n', 'output': ['6']}, {'input': '14 6 2 17\r\n', 'output': ['7']}, {'input': '100 23 15 50\r\n', 'output': ['2']}, {'input': '4000 33 7 3333\r\n', 'output': ['564']}] | [{'input': '4000 5 2 2\r\n', 'output': ['2000']}, {'input': '5 5 3 2\r\n', 'output': ['2']}, {'input': '3399 2035 2 3334\r\n', 'output': ['683']}, {'input': '728 412 789 158\r\n', 'output': ['3']}, {'input': '3119 3515 1021 7\r\n', 'output': ['11']}] | [{'input': '3043 317 1141 2438\r\n', 'output': ['7']}, {'input': '10 6 2 9\r\n', 'output': ['5']}, {'input': '4000 2 3 4\r\n', 'output': ['2000']}, {'input': '3999 2 2 3\r\n', 'output': ['1999']}, {'input': '25 6 8 11\r\n', 'output': ['3']}] | [{'input': '3399 2035 2 3334\r\n', 'output': ['683']}, {'input': '9 1 10 3\r\n', 'output': ['9']}, {'input': '3999 2 3 3\r\n', 'output': ['1999']}, {'input': '100 3 17 22\r\n', 'output': ['27']}, {'input': '918 102 1327 1733\r\n', 'output': ['9']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 79 | 100 | 100 | 100 |
["6", "20"] | The first line of the input contains a positive integer n (1ββ€βnββ€β2Β·109) β the length of Pasha's stick. | 32b59d23f71800bc29da74a3fe2e2b37 | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(void)
{
long int n;
scanf("%ld",&n);
if(n<=3)
printf("0");
else
{
if(n%2==0)
{
n=n/2;
if(n%2==0)
printf("%d",(n-2)/2);
else
printf("%d",(n-1)/2);
}
else
printf("0");
}
}
| ["1", "4"] | C | NoteThere is only one way to divide the stick in the first sample {1, 1, 2, 2}.Four ways to divide the stick in the second sample are {1, 1, 9, 9}, {2, 2, 8, 8}, {3, 3, 7, 7} and {4, 4, 6, 6}. Note that {5, 5, 5, 5} doesn't work. | The output should contain a single integerΒ β the number of ways to split Pasha's stick into four parts of positive integer length so that it's possible to make a rectangle by connecting the ends of these parts, but is impossible to form a square. | Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be n. Pasha likes rectangles but hates squares, so he wonders, how many ways are there to split ... | [{"input": "6\r\n", "output": ["1"]}, {"input": "20\r\n", "output": ["4"]}, {"input": "1\r\n", "output": ["0"]}, {"input": "2\r\n", "output": ["0"]}, {"input": "3\r\n", "output": ["0"]}, {"input": "4\r\n", "output": ["0"]}, {"input": "2000000000\r\n", "output": ["499999999"]}, {"input": "1924704072\r\n", "output": ["48... | 100 | 100 | 100 | [{'input': '1873025522\r\n', 'output': ['468256380']}, {'input': '27379344\r\n', 'output': ['6844835']}, {'input': '25\r\n', 'output': ['0']}, {'input': '593070992\r\n', 'output': ['148267747']}, {'input': '1925088820\r\n', 'output': ['481272204']}] | [{'input': '17\r\n', 'output': ['0']}, {'input': '854000\r\n', 'output': ['213499']}, {'input': '111\r\n', 'output': ['0']}, {'input': '2\r\n', 'output': ['0']}, {'input': '27\r\n', 'output': ['0']}] | [{'input': '30\r\n', 'output': ['7']}, {'input': '1980253780\r\n', 'output': ['495063444']}, {'input': '27\r\n', 'output': ['0']}, {'input': '176409698\r\n', 'output': ['44102424']}, {'input': '10330019\r\n', 'output': ['0']}] | [{'input': '14\r\n', 'output': ['3']}, {'input': '151\r\n', 'output': ['0']}, {'input': '42549941\r\n', 'output': ['0']}, {'input': '168305294\r\n', 'output': ['42076323']}, {'input': '1996459740\r\n', 'output': ['499114934']}] | [{'input': '10330019\r\n', 'output': ['0']}, {'input': '22\r\n', 'output': ['5']}, {'input': '25\r\n', 'output': ['0']}, {'input': '168305294\r\n', 'output': ['42076323']}, {'input': '1925473570\r\n', 'output': ['481368392']}] | 100 | 100 | 100 | 100 | 100 | 90 | 90 | 90 | 90 | 80 | 83.33 | 83.33 | 83.33 | 83.33 | 66.67 | 80 | 100 | 88 | 79.998 |
["1 0.50 1", "1 0.50 4", "4 0.20 2"] | The first line of the input contains three numbers n,βp,βt (1ββ€βn,βtββ€β2000, 0ββ€βpββ€β1). Numbers n and t are integers, number p is real, given with exactly two digits after the decimal point. | 20873b1e802c7aa0e409d9f430516c1e | #include<stdio.h>
double prob[2005][2005];
int main()
{
int n,t,i,j;
double p,cp;
double tmp;
scanf("%d",&n);
scanf("%lf",&p);
scanf("%d",&t);
cp = 1.0-p;
prob[0][0] = 1.0;
for(i=1;i<=t;i++)
prob[0][i] = 0.0;
for(i=1;i<=t;i++)
prob[i][0] = prob[i-1... | ["0.5", "0.9375", "0.4"] | C | null | Print a single real number β the expected number of people who will be standing on the escalator after t seconds. The absolute or relative error mustn't exceed 10β-β6. | Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. Let's assume that n people stand in the queue for the escalator. At each second one of the two following possibilities takes place: either the first person in the queue enters... | [{"input": "1 0.50 1\r\n", "output": ["0.500000", "0.5000000", "0.5", "0.500000000000", "0.50000000000000000000"]}, {"input": "1 0.50 4\r\n", "output": ["0.9375", "0.9375000", "0.937500000000", "0.937500", "0.93750000000000000000"]}, {"input": "4 0.20 2\r\n", "output": ["0.4", "0.400000", "0.40000000000000002220", "0.4... | 100 | 100 | 100 | [{'input': '100 1.00 200\r\n', 'output': ['100.00000000000000000000', '100.0000000', '100.0', '100.000000', '100.000000000000', '100']}, {'input': '818 0.99 1472\r\n', 'output': ['818.000000000000', '818.000000', '818', '818.0', '818.00000000000022737368', '818.0000000']}, {'input': '415 0.72 747\r\n', 'output': ['415.... | [{'input': '1400 0.02 200\r\n', 'output': ['4.00000000000000000000', '4.000000000000', '4.0000000', '4', '4.0', '4.000000']}, {'input': '211 0.78 379\r\n', 'output': ['211.0000000', '211.000000000000', '211.00000000000000000000', '211', '211.000000', '211.0']}, {'input': '246 0.98 442\r\n', 'output': ['246', '246.00000... | [{'input': '439 0.83 790\r\n', 'output': ['439.00000000000005684342', '439', '439.000000000000', '439.0', '439.000000', '439.0000000']}, {'input': '539 0.54 970\r\n', 'output': ['522.4592966', '522.45929661603338445275', '522.459296616034', '522.4593', '522.459297', '522.459296616']}, {'input': '984 0.19 1565\r\n', 'ou... | [{'input': '1400 0.02 200\r\n', 'output': ['4.00000000000000000000', '4.000000000000', '4.0000000', '4', '4.0', '4.000000']}, {'input': '2000 0.00 2000\r\n', 'output': ['0.000000000000', '0', '0.0000000', '0.00000000000000000000', '0.0', '0.000000']}, {'input': '300 0.99 1000\r\n', 'output': ['300.000000000000', '300',... | [{'input': '1 0.50 1\r\n', 'output': ['0.500000', '0.5000000', '0.5', '0.500000000000', '0.50000000000000000000']}, {'input': '100 0.01 53\r\n', 'output': ['0.53000000000000002665', '0.530000', '0.53', '0.530000000000', '0.5300000']}, {'input': '132 0.34 241\r\n', 'output': ['81.940000', '81.94', '81.939999999978', '81... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 81 | 100 | 100 | 100 |
["2 2 1", "2 2 2", "3 2 2"] | The first line contains space-separated integers n, m and k (1ββ€βn,βmββ€β1000,β1ββ€βkββ€β106) β the board's vertical and horizontal sizes and the number of colors respectively. | f22f28e2d8933f4199ba5ccfc0de8cda | #include <stdio.h>
#define mod 1000000007
int f[1001],c[1001][1001],r1[1001],r2[2001];
int mi(int a,long long b)
{
int t;
if (!b)
return 1;
t=mi(a,b>>1);
t=(long long)t*t%mod;
if (b&1)
t=(long long)t*a%mod;
return t;
}
int main()
{
int i,j,n,m,k,x,s=0,t=1;
scanf("%d%d%d",&n,&m,&k)... | ["1", "8", "40"] | C | null | Print the answer to the problem. As the answer can be quite a large number, you should print it modulo 109β+β7 (1000000007). | Little Petya loves counting. He wants to count the number of ways to paint a rectangular checkered board of size nβΓβm (n rows, m columns) in k colors. Besides, the coloring should have the following property: for any vertical line that passes along the grid lines and divides the board in two non-empty parts the number... | [{"input": "2 2 1\r\n", "output": ["1"]}, {"input": "2 2 2\r\n", "output": ["8"]}, {"input": "3 2 2\r\n", "output": ["40"]}, {"input": "7 8 15\r\n", "output": ["422409918"]}, {"input": "5 3 1\r\n", "output": ["1"]}, {"input": "5 100 1\r\n", "output": ["1"]}, {"input": "5 20 25\r\n", "output": ["375284458"]}, {"input": ... | 100 | 100 | 100 | [{'input': '2 1000 100202\r\n', 'output': ['648728052']}, {'input': '922 109 71587\r\n', 'output': ['433271191']}, {'input': '1000 1 992929\r\n', 'output': ['466214417']}, {'input': '777 777 777777\r\n', 'output': ['874869916']}, {'input': '1 1000 298298\r\n', 'output': ['298298']}] | [{'input': '990 800 43771\r\n', 'output': ['959043509']}, {'input': '89 955 984094\r\n', 'output': ['559468061']}, {'input': '385 978 699604\r\n', 'output': ['207434967']}, {'input': '5 3 1\r\n', 'output': ['1']}, {'input': '2 1000 100202\r\n', 'output': ['648728052']}] | [{'input': '385 978 699604\r\n', 'output': ['207434967']}, {'input': '105 3 3\r\n', 'output': ['481254277']}, {'input': '991 301 743241\r\n', 'output': ['583160905']}, {'input': '777 777 777777\r\n', 'output': ['874869916']}, {'input': '595 881 798832\r\n', 'output': ['551206173']}] | [{'input': '3 997 999997\r\n', 'output': ['291903372']}, {'input': '552 36 701031\r\n', 'output': ['203545141']}, {'input': '991 301 743241\r\n', 'output': ['583160905']}, {'input': '777 777 777777\r\n', 'output': ['874869916']}, {'input': '694 685 739154\r\n', 'output': ['621135202']}] | [{'input': '994 2 999999\r\n', 'output': ['273778994']}, {'input': '663 904 329049\r\n', 'output': ['599285820']}, {'input': '126 125 440715\r\n', 'output': ['387326012']}, {'input': '755 51 70160\r\n', 'output': ['188325679']}, {'input': '5 3 1\r\n', 'output': ['1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 96.88 | 96.88 | 96.88 | 96.88 | 92.31 | 96.15 | 96.15 | 88.46 | 96.15 | 82 | 100 | 97.504 | 93.844 |
["8 6 4 5", "8 6 4 6", "10 3 11 4", "4 2 1 4"] | The only line contains four integers n, t, k, d (1ββ€βn,βt,βk,βdββ€β1β000)Β β the number of cakes needed, the time needed for one oven to bake k cakes, the number of cakes baked at the same time, the time needed to build the second oven. | 32c866d3d394e269724b4930df5e4407 | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,t,k,d;
scanf("%d%d%d%d",&n,&t,&k,&d);
int ans=((d/t)+1)*k;
if(ans<n)
printf("YES");
else
printf("NO");
return 0;
}
| ["YES", "NO", "NO", "YES"] | C | NoteIn the first example it is possible to get 8 cakes in 12 minutes using one oven. The second oven can be built in 5 minutes, so after 6 minutes the first oven bakes 4 cakes, the second oven bakes 4 more ovens after 11 minutes. Thus, it is reasonable to build the second oven. In the second example it doesn't matter w... | If it is reasonable to build the second oven, print "YES". Otherwise print "NO". | In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minutes after they started baking. Arkady needs at least n cakes to complete a task, but he currently don't have any. However, he has infinitely many ingredients and one oven. Moreover, Arkady can bui... | [{"input": "8 6 4 5\r\n", "output": ["YES", "Yes", "yes"]}, {"input": "8 6 4 6\r\n", "output": ["No", "NO", "no"]}, {"input": "10 3 11 4\r\n", "output": ["No", "NO", "no"]}, {"input": "4 2 1 4\r\n", "output": ["YES", "Yes", "yes"]}, {"input": "28 17 16 26\r\n", "output": ["No", "NO", "no"]}, {"input": "60 69 9 438\r\n"... | 100 | 100 | 100 | [{'input': '5 1 1 3\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '3 4 3 3\r\n', 'output': ['No', 'NO', 'no']}, {'input': '3 1 2 1\r\n', 'output': ['No', 'NO', 'no']}, {'input': '4 2 1 4\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '4 1 1 3\r\n', 'output': ['No', 'NO', 'no']}] | [{'input': '4 2 1 4\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '7 2 3 3\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '4 1 1 3\r\n', 'output': ['No', 'NO', 'no']}, {'input': '3 1 2 1\r\n', 'output': ['No', 'NO', 'no']}, {'input': '128 18 2 169\r\n', 'output': ['YES', 'Yes', 'yes']}] | [{'input': '6 2 5 1\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '128 18 2 169\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '1 1 1 2\r\n', 'output': ['No', 'NO', 'no']}, {'input': '1 1 1 1\r\n', 'output': ['No', 'NO', 'no']}, {'input': '882 2 21 219\r\n', 'output': ['No', 'NO', 'no']}] | [{'input': '30 21 2 250\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '5 10 5 5\r\n', 'output': ['No', 'NO', 'no']}, {'input': '599 97 54 992\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '1 13 22 11\r\n', 'output': ['No', 'NO', 'no']}, {'input': '4 2 1 4\r\n', 'output': ['YES', 'Yes', 'yes']}] | [{'input': '982 13 5 198\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '1 2 2 1\r\n', 'output': ['No', 'NO', 'no']}, {'input': '19 1 7 1\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '77 33 18 31\r\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '28 17 16 26\r\n', 'output': ['No', 'NO', 'no']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 83 | 100 | 100 | 100 |
["2 2 2\n1 1 1\n1 2 3 4 5 6", "0 0 10\n3 2 3\n1 2 3 4 5 6"] | The fist input line contains three space-separated integers x, y and z (|x|,β|y|,β|z|ββ€β106) β the coordinates of Vasya's position in space. The second line contains three space-separated integers x1, y1, z1 (1ββ€βx1,βy1,βz1ββ€β106) β the coordinates of the box's vertex that is opposite to the vertex at point (0,β0,β0). ... | c7889a8f64c57cf7be4df870f68f749e | #include<stdio.h>
int main(void){
int x,y,z,x0,y0,z0;
int a[6],*p=a-1;
int i,j,k,num=0;
scanf("%d%d%d",&x,&y,&z);
scanf("%d%d%d",&x0,&y0,&z0);
for(i=1;i<=6;i++) scanf("%d",p+i);
if(y<0) num+=p[1];
else if(y>y0) num+=p[2];
if(z<0) num+=p[3];
else if(z>z0) num+=p[4];
if(x<0) num+=p[5];
else... | ["12", "4"] | C | NoteThe first sample corresponds to perspective, depicted on the picture. Vasya sees numbers a2 (on the top face that is the darkest), a6 (on the right face that is the lightest) and a4 (on the left visible face).In the second sample Vasya can only see number a4. | Print a single integer β the sum of all numbers on the box faces that Vasya sees. | One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the coordinate axes, one of its vertices is at point (0,β0,β0), and the opposite one is at point (x1,βy1... | [{"input": "2 2 2\r\n1 1 1\r\n1 2 3 4 5 6\r\n", "output": ["12"]}, {"input": "0 0 10\r\n3 2 3\r\n1 2 3 4 5 6\r\n", "output": ["4"]}, {"input": "0 1 2\r\n1 1 1\r\n634728 627299 454463 927148 298618 186257\r\n", "output": ["927148"]}, {"input": "5 2 -4\r\n1 1 1\r\n279519 704273 181008 670653 198973 996401\r\n", "output":... | 100 | 100 | 100 | [{'input': '381718 587052 14730\r\n290055 960762 231879\r\n646112 249417 451908 49140 819134 575870\r\n', 'output': ['575870']}, {'input': '701521 392984 524392\r\n462491 968267 126043\r\n328074 993331 895443 352976 984911 318865\r\n', 'output': ['671841']}, {'input': '298742 556311 628232\r\n360973 607625 301540\r\n27... | [{'input': '-263980 -876063 613611\r\n2 3 14\r\n63640 300066 460766 222639 51956 412622\r\n', 'output': ['338235']}, {'input': '0 1 2\r\n1 1 1\r\n634728 627299 454463 927148 298618 186257\r\n', 'output': ['927148']}, {'input': '30 68 72\r\n51 54 95\r\n480054 561470 308678 472768 90393 992511\r\n', 'output': ['561470']}... | [{'input': '0 1 2\r\n1 1 1\r\n634728 627299 454463 927148 298618 186257\r\n', 'output': ['927148']}, {'input': '7412 -524 9621\r\n8748 8870 1521\r\n1043 894084 881852 56954 415764 946495\r\n', 'output': ['57997']}, {'input': '-263980 -876063 613611\r\n2 3 14\r\n63640 300066 460766 222639 51956 412622\r\n', 'output': ['... | [{'input': '366317 904079 468911\r\n819427 99580 451147\r\n291702 801137 380674 646951 890909 998554\r\n', 'output': ['1448088']}, {'input': '5 2 -4\r\n1 1 1\r\n279519 704273 181008 670653 198973 996401\r\n', 'output': ['1881682']}, {'input': '3 10 3\r\n6 6 6\r\n2 4 8 16 32 64\r\n', 'output': ['4']}, {'input': '1 1 3\r... | [{'input': '19 60 75\r\n11 64 92\r\n768641 208726 47379 514231 858941 959876\r\n', 'output': ['959876']}, {'input': '58224 94433 40185\r\n55683 99614 33295\r\n137430 61976 671256 929825 499631 90071\r\n', 'output': ['1019896']}, {'input': '95892 79497 69936\r\n7 4 6\r\n873850 132840 469930 271591 257864 626722\r\n', 'o... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 92.86 | 100 | 92.86 | 85.71 | 78.57 | 84 | 100 | 100 | 90 |
["6\n1 2 6", "10\n1 2 3 4 5"] | The first line of the input contains one integer n (2ββ€βnββ€β100, n is even) β the size of the chessboard. The second line of the input contains integer numbers (1ββ€βpiββ€βn) β initial positions of the pieces. It is guaranteed that all the positions are distinct. | 0efe9afd8e6be9e00f7949be93f0ca1a | #include <stdio.h>
int v[51];
int main(){
int n, i, aux, f, cn, s, s2;
s=s2=0;
scanf("%d", &n);
cn=n/2;
for(i=0; i<cn; i++)
scanf("%d", &v[i]);
f=0;
while(f==0){
f=1;
for(i=0; i<cn-1; i++)
if(v[i]>v[i+1]){
aux=v[i];
v[i]=v[i+1];
v[i+1]=... | ["2", "10"] | C | NoteIn the first example the only possible strategy is to move the piece at the position 6 to the position 5 and move the piece at the position 2 to the position 3. Notice that if you decide to place the pieces in the white cells the minimum number of moves will be 3.In the second example the possible strategy is to mo... | Print one integer β the minimum number of moves you have to make to place all the pieces in the cells of the same color. | You are given a chessboard of size 1βΓβn. It is guaranteed that n is even. The chessboard is painted like this: "BWBW...BW".Some cells of the board are occupied by the chess pieces. Each cell contains no more than one chess piece. It is known that the total number of pieces equals to .In one step you can move one of th... | [{"input": "6\r\n1 2 6\r\n", "output": ["2"]}, {"input": "10\r\n1 2 3 4 5\r\n", "output": ["10"]}, {"input": "2\r\n2\r\n", "output": ["0"]}, {"input": "100\r\n2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100\r\n", "output"... | 100 | 100 | 100 | [{'input': '10\r\n6 7 8 9 10\r\n', 'output': ['10']}, {'input': '10\r\n10 9 8 1 5\r\n', 'output': ['5']}, {'input': '100\r\n84 10 26 79 58 93 67 85 7 2 99 4 47 45 75 22 32 82 65 53 63 49 42 52 12 69 86 46 25 76 40 15 13 78 8 81 62 28 60 21 27 80 98 56 3 36 54 16 50 43\r\n', 'output': ['104']}, {'input': '24\r\n10 21 15... | [{'input': '6\r\n1 2 6\r\n', 'output': ['2']}, {'input': '80\r\n41 70 18 53 32 79 51 49 21 27 47 65 50 15 62 60 5 40 14 25 64 9 19 58 38 76 66 52 17 34 13 2 80 43 3 42 33 36 6 72\r\n', 'output': ['47']}, {'input': '2\r\n2\r\n', 'output': ['0']}, {'input': '6\r\n1 4 5\r\n', 'output': ['1']}, {'input': '100\r\n93 54 57 6... | [{'input': '10\r\n1 2 3 4 5\r\n', 'output': ['10']}, {'input': '100\r\n2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100\r\n', 'output': ['0']}, {'input': '96\r\n12 58 70 19 65 61 41 46 15 92 64 72 9 26 53 37 2 3 1 40 10 8 ... | [{'input': '2\r\n2\r\n', 'output': ['0']}, {'input': '10\r\n1 2 3 4 5\r\n', 'output': ['10']}, {'input': '10\r\n10 9 8 1 5\r\n', 'output': ['5']}, {'input': '10\r\n1 4 6 8 10\r\n', 'output': ['1']}, {'input': '6\r\n3 5 6\r\n', 'output': ['2']}] | [{'input': '50\r\n27 42 41 4 10 45 44 26 49 50 17 28 2 36 18 39 23 12 21 24 19 29 22 40 37\r\n', 'output': ['59']}, {'input': '6\r\n3 4 5\r\n', 'output': ['2']}, {'input': '2\r\n2\r\n', 'output': ['0']}, {'input': '10\r\n1 7 8 9 10\r\n', 'output': ['7']}, {'input': '10\r\n2 3 4 5 6\r\n', 'output': ['7']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 85 | 100 | 100 | 100 |
["6 1", "4 2"] | The first line contains a pair of integers n and t (3ββ€βnββ€β20, 1ββ€βtββ€β10). | 6d67559744583229455c5eafe68f7952 | #include <stdio.h>
int dp[21][12][5][5];
int main() {
int i,j,k,l,x,n,t;;
scanf("%d %d\n",&n,&t);
for (i=1;i<4;i++)
for (j=i+1;j<=4;j++)
dp[2][0][i][j]=1;
for (x=3;x<=n;x++)
for (i=1;i<=4;i++)
for (j=1;j<=4;j++)
if (i!=j) for (k=1;k<=4;k++)
if (j!=k) for (l=0;l<=t;l++)
if (i<j&&j>k) dp[x]... | ["6", "0"] | C | NoteIn the first sample test sequences of y-coordinates for six camels are: 123421, 123431, 123432, 124321, 134321 ΠΈ 234321 (each digit corresponds to one value of yi). | Output the required amount of camels with t humps. | Bob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting points on a coordinate plane. Now he's drawing camels with t humps, representing them as polylines in the plane. Each polyline consists of n vertices with coordinates (x1,βy1), (x2,βy2), ..., (xn,βyn). The first ve... | [{"input": "6 1\r\n", "output": ["6"]}, {"input": "4 2\r\n", "output": ["0"]}, {"input": "3 1\r\n", "output": ["14"]}, {"input": "3 2\r\n", "output": ["0"]}, {"input": "3 3\r\n", "output": ["0"]}, {"input": "3 10\r\n", "output": ["0"]}, {"input": "4 1\r\n", "output": ["22"]}, {"input": "4 3\r\n", "output": ["0"]}, {"in... | 100 | 100 | 100 | [{'input': '20 9\r\n', 'output': ['90700276']}, {'input': '4 3\r\n', 'output': ['0']}, {'input': '20 8\r\n', 'output': ['503245466']}, {'input': '19 7\r\n', 'output': ['197939352']}, {'input': '4 2\r\n', 'output': ['0']}] | [{'input': '19 7\r\n', 'output': ['197939352']}, {'input': '20 8\r\n', 'output': ['503245466']}, {'input': '5 9\r\n', 'output': ['0']}, {'input': '6 1\r\n', 'output': ['6']}, {'input': '5 1\r\n', 'output': ['16']}] | [{'input': '20 5\r\n', 'output': ['3715462']}, {'input': '19 8\r\n', 'output': ['109824208']}, {'input': '6 2\r\n', 'output': ['232']}, {'input': '19 4\r\n', 'output': ['32632']}, {'input': '6 3\r\n', 'output': ['0']}] | [{'input': '20 3\r\n', 'output': ['0']}, {'input': '20 10\r\n', 'output': ['0']}, {'input': '19 10\r\n', 'output': ['0']}, {'input': '6 4\r\n', 'output': ['0']}, {'input': '6 2\r\n', 'output': ['232']}] | [{'input': '6 1\r\n', 'output': ['6']}, {'input': '19 1\r\n', 'output': ['0']}, {'input': '20 3\r\n', 'output': ['0']}, {'input': '6 10\r\n', 'output': ['0']}, {'input': '19 6\r\n', 'output': ['69183464']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 86 | 100 | 100 | 100 |
["3 6 9", "4 4 4", "0 0 0"] | The first line contains three integers r, g and b (0ββ€βr,βg,βbββ€β109) β the number of red, green and blue flowers. | acddc9b0db312b363910a84bd4f14d8e | #include<stdio.h>
int main()
{
int r,b,g,mix,a[10],i;
scanf("%d %d %d",&r,&b,&g);
if(r==0 || b==0 || g==0)
{
printf("%d",(r/3+g/3+b/3));
return 0;
}
for(i=0;i<=2;i++)
{
a[i]=(i+((r-i)/3+(b-i)/3+(g-i)/3));
}
int max=0;
for(i=0;i<=2;i++)
{
if(a[i]>max)
max=a[i];
}
printf("%d",max);
return 0;
}... | ["6", "4", "0"] | C | NoteIn test case 1, we can make 1 red bouquet, 2 green bouquets and 3 blue bouquets.In test case 2, we can make 1 red, 1 green, 1 blue and 1 mixing bouquet. | Print the maximal number of bouquets Fox Ciel can make. | Fox Ciel has some flowers: r red flowers, g green flowers and b blue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets: To make a "red bouquet", it needs 3 red flowers. To make a "green bouquet", it needs 3 green flowers. To make a "blue bouquet", it needs 3 blue flowers... | [{"input": "3 6 9\r\n", "output": ["6"]}, {"input": "4 4 4\r\n", "output": ["4"]}, {"input": "0 0 0\r\n", "output": ["0"]}, {"input": "0 3 6\r\n", "output": ["3"]}, {"input": "7 8 9\r\n", "output": ["7"]}, {"input": "8 8 9\r\n", "output": ["8"]}, {"input": "15 3 999\r\n", "output": ["339"]}, {"input": "32 62 92\r\n", "... | 100 | 100 | 100 | [{'input': '835108464 525983528 452876698\r\n', 'output': ['604656229']}, {'input': '0 1 1\r\n', 'output': ['0']}, {'input': '0 1 0\r\n', 'output': ['0']}, {'input': '952726009 629846517 972974334\r\n', 'output': ['851848953']}, {'input': '0 5 5\r\n', 'output': ['2']}] | [{'input': '952726009 629846517 972974334\r\n', 'output': ['851848953']}, {'input': '0 1 1\r\n', 'output': ['0']}, {'input': '3 3 5\r\n', 'output': ['3']}, {'input': '597790453 720437830 855459575\r\n', 'output': ['724562619']}, {'input': '1000000000 999999999 999999998\r\n', 'output': ['999999998']}] | [{'input': '242854896 442432924 180395753\r\n', 'output': ['288561190']}, {'input': '0 0 0\r\n', 'output': ['0']}, {'input': '0 5 5\r\n', 'output': ['2']}, {'input': '1000000000 999999999 999999998\r\n', 'output': ['999999998']}, {'input': '3 5 5\r\n', 'output': ['4']}] | [{'input': '0 2 2\r\n', 'output': ['0']}, {'input': '952726009 629846517 972974334\r\n', 'output': ['851848953']}, {'input': '999999998 999999998 999999999\r\n', 'output': ['999999998']}, {'input': '0 0 0\r\n', 'output': ['0']}, {'input': '123456789 123456789 123456789\r\n', 'output': ['123456789']}] | [{'input': '0 1000000000 0\r\n', 'output': ['333333333']}, {'input': '3 6 9\r\n', 'output': ['6']}, {'input': '32 62 92\r\n', 'output': ['62']}, {'input': '0 2 2\r\n', 'output': ['0']}, {'input': '139978911 5123031 935395222\r\n', 'output': ['360165721']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 83.33 | 83.33 | 83.33 | 83.33 | 83.33 | 87 | 100 | 100 | 83.33 |
["QAQAQYSYIOIWIN", "QAQQQZZYNOIWIN"] | The only line contains a string of length n (1ββ€βnββ€β100). It's guaranteed that the string only contains uppercase English letters. | 8aef4947322438664bd8610632fe0947 | #include<stdio.h>
int main()
{
char myarray[1000];
scanf("%s",&myarray);
int i,cnt=0,j,k,l,len=0;
len=strlen(myarray);
for(i=0; i<len; i++)
{
if(myarray[i]=='Q')
{
for(j=i+1; j<len; j++)
{
if(myarray[j]=='A')
{
... | ["4", "3"] | C | NoteIn the first example there are 4 subsequences "QAQ": "QAQAQYSYIOIWIN", "QAQAQYSYIOIWIN", "QAQAQYSYIOIWIN", "QAQAQYSYIOIWIN". | Print a single integerΒ β the number of subsequences "QAQ" in the string. | "QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth.Now Diamond has given Bort a string consisting of only uppercase English letters of length n. There is a great number of "QAQ" in the string (Diamond is so cute!). illustration by η«ε± https://twitter.com/nekoyaliu Bort ... | [{"input": "QAQAQYSYIOIWIN\r\n", "output": ["4"]}, {"input": "QAQQQZZYNOIWIN\r\n", "output": ["3"]}, {"input": "QA\r\n", "output": ["0"]}, {"input": "IAQVAQZLQBQVQFTQQQADAQJA\r\n", "output": ["24"]}, {"input": "QQAAQASGAYAAAAKAKAQIQEAQAIAAIAQQQQQ\r\n", "output": ["378"]}, {"input": "AMVFNFJIAVNQJWIVONQOAOOQSNQSONOASONA... | 100 | 100 | 100 | [{'input': 'QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ\r\n', 'output': ['0']}, {'input': 'AMQQAAQAAQAAAAAAQQQBOAAANAAKQJCYQAE\r\n', 'output': ['254']}, {'input': 'QORZOYAQ\r\n', 'output': ['1']}, {'input': 'QQQQQAQAAQQAQAQAAAAAAAAAQAQAAAAAQAQAQQQAQQQAAAQQQAAAAAA... | [{'input': 'MAQQWAQOYQMAAAQAQPQZAOAAQAUAQNAAQAAAITQSAQAKAQKAQQWSQAAQQAGUCDQMQWKQUXKWQQAAQQAAQQZQDQQQAABXQUUXQOA\r\n', 'output': ['5422']}, {'input': 'AAQQAXBQQBQQXBNQRJAQKQNAQNQVDQASAGGANQQQQTJFFQQQTQQA\r\n', 'output': ['568']}, {'input': 'AQEGQHQQKQAQQPQKAQQQAAAAQQQAQEQAAQAAQAQFSLAAQQAQOQQAVQAAAPQQAWAQAQAFQAXAQQQQTRLO... | [{'input': 'QQQQQAQAAQQAQAQAAAAAAAAAQAQAAAAAQAQAQQQAQQQAAAQQQAAAAAAAQAAAAQQQQQQQAQQQQAQAAAQAAAAAQAQAAAAAQAQAA\r\n', 'output': ['15296']}, {'input': 'AQQQQAQAAQQAQAQAAAAAAAAAQAQAAAAAQAQAQQQAQQQAAAQQQAAAAAAAQAAAAQQQQQQQAQQQQAQAAAQAAAAAQAQAAAAAQAQAAAA\r\n', 'output': ['14270']}, {'input': 'LQMAQQARQAQBJQQQAGAAZQQXALQQAARQ... | [{'input': 'AAAAAA\r\n', 'output': ['0']}, {'input': 'DBA\r\n', 'output': ['0']}, {'input': 'Q\r\n', 'output': ['0']}, {'input': 'QQAAQASGAYAAAAKAKAQIQEAQAIAAIAQQQQQ\r\n', 'output': ['378']}, {'input': 'AQQQQAQAAQQAQAQAAAAAAAAAQAQAAAAAQAQAQQQAQQQAAAQQQAAAAAAAQAAAAQQQQQQQAQQQQAQAAAQAAAAAQAQAAAAAQAQAA\r\n', 'output': ['1... | [{'input': 'Q\r\n', 'output': ['0']}, {'input': 'KAZXAVLPJQBQVQQQQQAPAQQGQTQVZQAAAOYA\r\n', 'output': ['70']}, {'input': 'QAQQQZZYNOIWIN\r\n', 'output': ['3']}, {'input': 'AQQQQAQAAQQAQAQAAAAAAAAAQAQAAAAAQAQAQQQAQQQAAAQQQAAAAAAAQAAAAQQQQQQQAQQQQAQAAAQAAAAAQAQAAAAAQAQAAAA\r\n', 'output': ['14270']}, {'input': 'QCQAQAGAW... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 88 | 100 | 100 | 100 |
["1 7", "100 47"] | The only line contains two integers a and b (1ββ€βa,βbββ€β105). It is guaranteed that number b is lucky. | e5e4ea7a5bf785e059e10407b25d73fb | #include<stdio.h>
int b;
int check(int i){
int temp=0,t=0;
while(i>0){
if(i%10==4||i%10==7) temp=temp*10+i%10;
i/=10;
}
while(temp>0){
t=t*10+temp%10;
temp/=10;
}
return t==b;
}
int main(){
int a,i;
scanf("%d%d",&a,&b);
for(i=a+1;;i++){
if(chec... | ["7", "147"] | C | null | In the only line print a single number β the number c that is sought by Petya. | Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Petya calls a mask of a positive integer n the number that is obtained after successive writing of a... | [{"input": "1 7\r\n", "output": ["7"]}, {"input": "100 47\r\n", "output": ["147"]}, {"input": "458 47\r\n", "output": ["467"]}, {"input": "7 7\r\n", "output": ["17"]}, {"input": "547 47\r\n", "output": ["647"]}, {"input": "77 77\r\n", "output": ["177"]}, {"input": "44 4\r\n", "output": ["45"]}, {"input": "740 4\r\n", "... | 100 | 100 | 100 | [{'input': '1 7\r\n', 'output': ['7']}, {'input': '59765 4774\r\n', 'output': ['64774']}, {'input': '31975 74\r\n', 'output': ['32074']}, {'input': '100000 77777\r\n', 'output': ['177777']}, {'input': '74 77\r\n', 'output': ['77']}] | [{'input': '69700 77477\r\n', 'output': ['77477']}, {'input': '10 77777\r\n', 'output': ['77777']}, {'input': '99997 47\r\n', 'output': ['100047']}, {'input': '39999 4774\r\n', 'output': ['40774']}, {'input': '100 47\r\n', 'output': ['147']}] | [{'input': '40007 74444\r\n', 'output': ['74444']}, {'input': '46 7\r\n', 'output': ['57']}, {'input': '47744 7\r\n', 'output': ['50007']}, {'input': '474 74\r\n', 'output': ['574']}, {'input': '10 77777\r\n', 'output': ['77777']}] | [{'input': '100000 7\r\n', 'output': ['100007']}, {'input': '98545 7474\r\n', 'output': ['107474']}, {'input': '10 77777\r\n', 'output': ['77777']}, {'input': '47774 774\r\n', 'output': ['50774']}, {'input': '7 7\r\n', 'output': ['17']}] | [{'input': '74 77\r\n', 'output': ['77']}, {'input': '31975 74\r\n', 'output': ['32074']}, {'input': '474 74\r\n', 'output': ['574']}, {'input': '458 47\r\n', 'output': ['467']}, {'input': '700 74\r\n', 'output': ['704']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 89 | 100 | 100 | 100 |
["2\n1 2", "3\n2 4 6", "2\n12 18", "5\n45 12 27 30 18"] | The first line contains an integer n (2ββ€βnββ€β100). Then the second line contains n integers: x1, x2, ..., xn (1ββ€βxiββ€β100). | 042cf938dc4a0f46ff33d47b97dc6ad4 | #include <stdio.h>
int main(){
int n,m,a[100],i,j,tr=1,min;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
while(tr){
tr=0;
min=a[0];
for(i=1;i<n;i++)if(min>a[i])min=a[i];
for(i=0;i<n;i++)if(a[i]>min){
... | ["2", "6", "12", "15"] | C | NoteIn the first example the optimal way is to do the assignment: x2 = x2 - x1.In the second example the optimal sequence of operations is: x3 = x3 - x2, x2 = x2 - x1. | Output a single integer β the required minimal sum. | Fox Ciel is playing a game with numbers now. Ciel has n positive integers: x1, x2, ..., xn. She can do the following operation as many times as needed: select two different indexes i and j such that xi > xj hold, and then apply assignment xi = xi - xj. The goal is to make the sum of all numbers as small as possible.... | [{"input": "2\r\n1 2\r\n", "output": ["2"]}, {"input": "3\r\n2 4 6\r\n", "output": ["6"]}, {"input": "2\r\n12 18\r\n", "output": ["12"]}, {"input": "5\r\n45 12 27 30 18\r\n", "output": ["15"]}, {"input": "2\r\n1 1\r\n", "output": ["2"]}, {"input": "2\r\n100 100\r\n", "output": ["200"]}, {"input": "2\r\n87 58\r\n", "out... | 100 | 100 | 100 | [{'input': '2\r\n1 10\r\n', 'output': ['2']}, {'input': '2\r\n87 58\r\n', 'output': ['58']}, {'input': '2\r\n3 5\r\n', 'output': ['2']}, {'input': '10\r\n60 12 96 48 60 24 60 36 60 60\r\n', 'output': ['120']}, {'input': '2\r\n100 1\r\n', 'output': ['2']}] | [{'input': '100\r\n82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82\r... | [{'input': '2\r\n1 2\r\n', 'output': ['2']}, {'input': '46\r\n71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71\r\n', 'output': ['3266']}, {'input': '3\r\n6 10 15\r\n', 'output': ['3']}, {'input': '2\r\n12 18\r\n', 'output': ['12']}... | [{'input': '100\r\n11 87 77 93 3 54 21 93 9 71 37 23 69 85 74 3 48 99 51 31 56 19 21 96 39 6 4 4 29 69 100 42 1 22 81 53 48 49 81 61 10 7 40 61 7 71 51 59 79 44 50 35 95 80 83 8 98 40 18 94 84 49 52 74 66 69 39 37 100 44 38 62 2 80 46 31 35 53 5 60 21 49 63 55 20 53 80 53 66 34 23 92 77 50 86 63 65 24 12 70\r\n', 'outp... | [{'input': '2\r\n1 10\r\n', 'output': ['2']}, {'input': '18\r\n18 18 18 36 36 36 54 72 54 36 72 54 36 36 36 36 18 36\r\n', 'output': ['324']}, {'input': '2\r\n1 1\r\n', 'output': ['2']}, {'input': '2\r\n3 5\r\n', 'output': ['2']}, {'input': '98\r\n70 60 100 30 70 20 30 50 50 30 90 40 30 40 60 80 60 60 80 50 10 80 20 10... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 90 | 100 | 100 | 100 |
["2", "3"] | A single line contains integer n (1ββ€βnββ€β2000) β the number of buttons the lock has. | 6df251ac8bf27427a24bc23d64cb9884 | #include<stdio.h>
int main()
{
int n,i,l=0;
scanf("%d",&n);
for(i=1;i<n;i++) l=l+(n-i)*i;
printf("%d",l+n);
}
| ["3", "7"] | C | NoteConsider the first test sample. Manao can fail his first push and push the wrong button. In this case he will already be able to guess the right one with his second push. And his third push will push the second right button. Thus, in the worst-case scenario he will only need 3 pushes. | In a single line print the number of times Manao has to push a button in the worst-case scenario. | Manao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either stays pressed into the lock (that means that you've guessed correctly and pushed the button that goes next in the sequenc... | [{"input": "2\r\n", "output": ["3"]}, {"input": "3\r\n", "output": ["7"]}, {"input": "4\r\n", "output": ["14"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "10\r\n", "output": ["175"]}, {"input": "2000\r\n", "output": ["1333335000"]}, {"input": "1747\r\n", "output": ["888644743"]}, {"input": "889\r\n", "output": ["... | 100 | 100 | 100 | [{'input': '92\r\n', 'output': ['129858']}, {'input': '889\r\n', 'output': ['117099969']}, {'input': '256\r\n', 'output': ['2796416']}, {'input': '914\r\n', 'output': ['127259419']}, {'input': '17\r\n', 'output': ['833']}] | [{'input': '256\r\n', 'output': ['2796416']}, {'input': '10\r\n', 'output': ['175']}, {'input': '314\r\n', 'output': ['5160119']}, {'input': '2\r\n', 'output': ['3']}, {'input': '2000\r\n', 'output': ['1333335000']}] | [{'input': '1837\r\n', 'output': ['1033182073']}, {'input': '996\r\n', 'output': ['164675486']}, {'input': '1999\r\n', 'output': ['1331335999']}, {'input': '92\r\n', 'output': ['129858']}, {'input': '1241\r\n', 'output': ['318541121']}] | [{'input': '4\r\n', 'output': ['14']}, {'input': '92\r\n', 'output': ['129858']}, {'input': '2000\r\n', 'output': ['1333335000']}, {'input': '914\r\n', 'output': ['127259419']}, {'input': '889\r\n', 'output': ['117099969']}] | [{'input': '3\r\n', 'output': ['7']}, {'input': '1000\r\n', 'output': ['166667500']}, {'input': '914\r\n', 'output': ['127259419']}, {'input': '2000\r\n', 'output': ['1333335000']}, {'input': '2\r\n', 'output': ['3']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 91 | 100 | 100 | 100 |
["LLUUUR", "RRUULLDD"] | The first line of the input file contains the recording of the robot's movements. This recording is a non-empty string, consisting of uppercase Latin letters L, R, U and D, standing for movements left, right, up and down respectively. The length of the string does not exceed 100. | bb7805cc9d1cc907b64371b209c564b3 | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAXN 210
int main ()
{
static char data[MAXN];
static int a[MAXN][MAXN];
memset(a,0,sizeof(a));
scanf("%s",data);
int N = strlen(data);
int x = 105;
int y = 105;
a[x][y] = 1;
int i;
for (i = 2; i <= (N+1); i++)
... | ["OK", "BUG"] | C | null | In the first line output the only word OK (if the above described map exists), or BUG (if such a map does not exist). | The whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path from one point to another, to record all its movements, but like in many Draude's programs, there was a ... | [{"input": "LLUUUR\r\n", "output": ["OK"]}, {"input": "RRUULLDD\r\n", "output": ["BUG"]}, {"input": "L\r\n", "output": ["OK"]}, {"input": "R\r\n", "output": ["OK"]}, {"input": "RR\r\n", "output": ["OK"]}, {"input": "DL\r\n", "output": ["OK"]}, {"input": "LD\r\n", "output": ["OK"]}, {"input": "RUL\r\n", "output": ["BUG"... | 100 | 100 | 100 | [{'input': 'RURRRRLURRRURRUURRRRRRRRDDULULRRURRRDRRRRRRRRRRLDR\r\n', 'output': ['BUG']}, {'input': 'LULU\r\n', 'output': ['OK']}, {'input': 'DDLDRRR\r\n', 'output': ['BUG']}, {'input': 'LLLLLLLLLLLLLLLLLLLLLLLLLLRUUUUUUUUUUUUUUUUUUUUUUUUU\r\n', 'output': ['BUG']}, {'input': 'RRLR\r\n', 'output': ['BUG']}] | [{'input': 'RDRLL\r\n', 'output': ['BUG']}, {'input': 'LLLLLLLLLLLLLLLLLLLLLLLLLLRUUUUUUUUUUUUUUUUUUUUUUUUU\r\n', 'output': ['BUG']}, {'input': 'LUUUULLLLDDDDRRRD\r\n', 'output': ['BUG']}, {'input': 'UUUURDLLLL\r\n', 'output': ['BUG']}, {'input': 'DDR\r\n', 'output': ['OK']}] | [{'input': 'RRDD\r\n', 'output': ['OK']}, {'input': 'RRRRRRRRRRRDDDDDDDDDDDDDDDDDDDRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUULLLLLLLLLLLLLLLLLLUUUUUUUUUUU\r\n', 'output': ['BUG']}, {'input': 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLLLDDDDRRRRUUURRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\r\n', 'output': ['BUG']}, {'input': 'LULULL\r\n', ... | [{'input': 'DDR\r\n', 'output': ['OK']}, {'input': 'DDDDDDDLLDDRRURRRRRRR\r\n', 'output': ['BUG']}, {'input': 'DLURUUU\r\n', 'output': ['BUG']}, {'input': 'RDRDDD\r\n', 'output': ['OK']}, {'input': 'DDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUUUUUUU\r\n', 'output': ['BU... | [{'input': 'LD\r\n', 'output': ['OK']}, {'input': 'LLUUUR\r\n', 'output': ['OK']}, {'input': 'RR\r\n', 'output': ['OK']}, {'input': 'DLURUUU\r\n', 'output': ['BUG']}, {'input': 'RDRDDD\r\n', 'output': ['OK']}] | 100 | 100 | 100 | 100 | 100 | 88.24 | 88.24 | 82.35 | 82.35 | 76.47 | 92.31 | 92.31 | 88.46 | 88.46 | 84.62 | 92 | 100 | 83.53 | 89.232 |
["2 4", "3 3"] | In a single line you are given two integers M and N β board sizes in squares (1ββ€βMββ€βNββ€β16). | e840e7bfe83764bee6186fcf92a1b5cd | #include<stdio.h>
#include<math.h>
int main ()
{
int M,N,X;
scanf("%d %d", &M, &N);
X=((M*N)/2);
printf("%d\n", X);
return 0;
}
/* 1490302257089 */
| ["4", "4"] | C | null | Output one number β the maximal number of dominoes, which can be placed. | You are given a rectangular board of MβΓβN squares. Also you are given an unlimited number of standard domino pieces of 2βΓβ1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so as to meet the following conditions:1. Each domino completely covers two square... | [{"input": "2 4\r\n", "output": ["4"]}, {"input": "3 3\r\n", "output": ["4"]}, {"input": "1 5\r\n", "output": ["2"]}, {"input": "1 6\r\n", "output": ["3"]}, {"input": "1 15\r\n", "output": ["7"]}, {"input": "1 16\r\n", "output": ["8"]}, {"input": "2 5\r\n", "output": ["5"]}, {"input": "2 6\r\n", "output": ["6"]}, {"inp... | 100 | 100 | 100 | [{'input': '2 4\r\n', 'output': ['4']}, {'input': '3 10\r\n', 'output': ['15']}, {'input': '14 15\r\n', 'output': ['105']}, {'input': '2 5\r\n', 'output': ['5']}, {'input': '2 7\r\n', 'output': ['7']}] | [{'input': '2 5\r\n', 'output': ['5']}, {'input': '1 6\r\n', 'output': ['3']}, {'input': '3 5\r\n', 'output': ['7']}, {'input': '8 15\r\n', 'output': ['60']}, {'input': '3 6\r\n', 'output': ['9']}] | [{'input': '1 16\r\n', 'output': ['8']}, {'input': '15 15\r\n', 'output': ['112']}, {'input': '3 5\r\n', 'output': ['7']}, {'input': '1 15\r\n', 'output': ['7']}, {'input': '3 14\r\n', 'output': ['21']}] | [{'input': '11 13\r\n', 'output': ['71']}, {'input': '4 4\r\n', 'output': ['8']}, {'input': '2 5\r\n', 'output': ['5']}, {'input': '2 14\r\n', 'output': ['14']}, {'input': '5 7\r\n', 'output': ['17']}] | [{'input': '15 16\r\n', 'output': ['120']}, {'input': '2 2\r\n', 'output': ['2']}, {'input': '16 16\r\n', 'output': ['128']}, {'input': '1 2\r\n', 'output': ['1']}, {'input': '5 16\r\n', 'output': ['40']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 93 | 100 | 100 | 100 |
["5 7 1 3 2 2", "5 5 2 3 1 1"] | The first line of the input contains six integers n,βm,βi,βj,βa,βb (1ββ€βn,βmββ€β106;Β 1ββ€βiββ€βn;Β 1ββ€βjββ€βm;Β 1ββ€βa,βbββ€β106). You can assume that the chessboard rows are numbered from 1 to n from top to bottom and the columns are numbered from 1 to m from left to right. Position (i,βj) in the statement is a chessboard cel... | 51155e9bfa90e0ff29d049cedc3e1862 | #include<stdio.h>
long long int n,m,i,j,a,b;
int ab(int a)
{
if(a<0)
return -a;
return a;
}
int max(int a,int b)
{
if(a<b)
return b;
return a;
}
int min(int a,int b)
{
if(a>b)
return b;
return a;
}
int func(int u,int v)
{
if(i==u&&j==v)
return 0;
if(i+a>n&&i-a<=0)
return -1;
if(j+b>m&&j-b<=0)
ret... | ["2", "Poor Inna and pony!"] | C | NoteNote to sample 1:Inna and the pony can move the candy to position (1β+β2,β3β+β2)β=β(3,β5), from there they can move it to positions (3β-β2,β5β+β2)β=β(1,β7) and (3β+β2,β5β+β2)β=β(5,β7). These positions correspond to the corner squares of the chess board. Thus, the answer to the test sample equals two. | In a single line print a single integer β the minimum number of moves needed to get the candy. If Inna and the pony cannot get the candy playing by Dima's rules, print on a single line "Poor Inna and pony!" without the quotes. | Dima and Inna are doing so great! At the moment, Inna is sitting on the magic lawn playing with a pink pony. Dima wanted to play too. He brought an nβΓβm chessboard, a very tasty candy and two numbers a and b.Dima put the chessboard in front of Inna and placed the candy in position (i,βj) on the board. The boy said he ... | [{"input": "5 7 1 3 2 2\r\n", "output": ["2"]}, {"input": "5 5 2 3 1 1\r\n", "output": ["Poor Inna and pony!"]}, {"input": "1 1 1 1 1 1\r\n", "output": ["0"]}, {"input": "23000 15500 100 333 9 1\r\n", "output": ["15167"]}, {"input": "33999 99333 33000 99000 3 9\r\n", "output": ["333"]}, {"input": "5 7 1 3 1 2\r\n", "ou... | 100 | 100 | 100 | [{'input': '4 4 3 4 1 5\r\n', 'output': ['Poor Inna and pony!']}, {'input': '23000 15500 100 333 9 1\r\n', 'output': ['15167']}, {'input': '304 400 12 20 4 4\r\n', 'output': ['95']}, {'input': '1000000 99999 12345 23456 23 54\r\n', 'output': ['Poor Inna and pony!']}, {'input': '1000000 1000000 500000 500000 1 1\r\n', '... | [{'input': '5 5 4 4 1 1\r\n', 'output': ['1']}, {'input': '100 100 50 50 500 500\r\n', 'output': ['Poor Inna and pony!']}, {'input': '1000 1 1 1 1 500\r\n', 'output': ['0']}, {'input': '2 8 1 2 1 3\r\n', 'output': ['2']}, {'input': '5 5 4 3 1 2\r\n', 'output': ['1']}] | [{'input': '1000000 99999 12345 23456 23 54\r\n', 'output': ['Poor Inna and pony!']}, {'input': '1004 999004 4 4 5 5\r\n', 'output': ['199800']}, {'input': '2 8 1 2 1 3\r\n', 'output': ['2']}, {'input': '11 11 3 3 4 4\r\n', 'output': ['2']}, {'input': '3 3 2 2 2 2\r\n', 'output': ['Poor Inna and pony!']}] | [{'input': '11 11 3 3 4 4\r\n', 'output': ['2']}, {'input': '50000 100000 500 1000 500 500\r\n', 'output': ['Poor Inna and pony!']}, {'input': '7 1 5 1 2 2\r\n', 'output': ['Poor Inna and pony!']}, {'input': '1 100 1 50 1 50\r\n', 'output': ['Poor Inna and pony!']}, {'input': '500000 100000 400 80000 2 2\r\n', 'output'... | [{'input': '5 7 1 3 1 2\r\n', 'output': ['2']}, {'input': '1000000 1000000 1000000 1000000 1000000 1000000\r\n', 'output': ['0']}, {'input': '5 5 4 2 1 1\r\n', 'output': ['1']}, {'input': '23000 15500 100 333 9 1\r\n', 'output': ['15167']}, {'input': '3 3 2 2 2 2\r\n', 'output': ['Poor Inna and pony!']}] | 100 | 100 | 100 | 100 | 100 | 93.48 | 100 | 89.13 | 86.96 | 97.83 | 76.47 | 91.18 | 76.47 | 76.47 | 85.29 | 94 | 100 | 93.48 | 81.176 |
["42", "5"] | The only line contains an integer n (1ββ€βnββ€β10000). | 5d4f38ffd1849862623325fdbe06cd00 | #include<stdio.h>
int main()
{
int n,feet,tmp,inch;
scanf("%d",&n);
inch=n/3;
if(n%3==2)
{
inch++;
}
feet=inch/12;
inch=inch%12;
printf("%d %d\n",feet,inch);
return 0;
} | ["1 2", "0 2"] | C | null | Print two non-negative space-separated integers a and b, where a is the numbers of feet and b is the number of inches. | Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.You are given a length equal to n centimeters. Your task is to convert it to feet and inches so that the number of feet was maximum. The resu... | [{"input": "42\r\n", "output": ["1 2"]}, {"input": "5\r\n", "output": ["0 2"]}, {"input": "24\r\n", "output": ["0 8"]}, {"input": "1\r\n", "output": ["0 0"]}, {"input": "2\r\n", "output": ["0 1"]}, {"input": "3\r\n", "output": ["0 1"]}, {"input": "4\r\n", "output": ["0 1"]}, {"input": "8\r\n", "output": ["0 3"]}, {"inp... | 100 | 100 | 100 | [{'input': '100\r\n', 'output': ['2 9']}, {'input': '8\r\n', 'output': ['0 3']}, {'input': '1233\r\n', 'output': ['34 3']}, {'input': '1000\r\n', 'output': ['27 9']}, {'input': '10000\r\n', 'output': ['277 9']}] | [{'input': '501\r\n', 'output': ['13 11']}, {'input': '1000\r\n', 'output': ['27 9']}, {'input': '10\r\n', 'output': ['0 3']}, {'input': '3\r\n', 'output': ['0 1']}, {'input': '24\r\n', 'output': ['0 8']}] | [{'input': '199\r\n', 'output': ['5 6']}, {'input': '100\r\n', 'output': ['2 9']}, {'input': '1\r\n', 'output': ['0 0']}, {'input': '4\r\n', 'output': ['0 1']}, {'input': '8\r\n', 'output': ['0 3']}] | [{'input': '120\r\n', 'output': ['3 4']}, {'input': '9999\r\n', 'output': ['277 9']}, {'input': '4\r\n', 'output': ['0 1']}, {'input': '71\r\n', 'output': ['2 0']}, {'input': '9876\r\n', 'output': ['274 4']}] | [{'input': '9999\r\n', 'output': ['277 9']}, {'input': '120\r\n', 'output': ['3 4']}, {'input': '10000\r\n', 'output': ['277 9']}, {'input': '10\r\n', 'output': ['0 3']}, {'input': '4\r\n', 'output': ['0 1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 88.89 | 100 | 100 | 88.89 | 100 | 50 | 100 | 100 | 50 | 95 | 100 | 95.556 | 80 |
["0 0 0 0 9\n0 0 0 0 0\n0 0 0 0 0\n0 0 0 0 0\n7 0 0 0 0", "0 43 21 18 2\n3 0 21 11 65\n5 2 0 1 4\n54 62 12 0 99\n87 64 81 33 0"] | The input consists of five lines, each line contains five space-separated integers: the j-th number in the i-th line shows gij (0ββ€βgijββ€β105). It is guaranteed that giiβ=β0 for all i. Assume that the students are numbered from 1 to 5. | be6d4df20e9a48d183dd8f34531df246 | #include<stdio.h>
int main()
{
int x[6][6];
int i,j,k,l,m;
for(i=0;i<5;++i)
{
for(j=0;j<5;++j)
scanf("%d",&x[i][j]);
}
int max=0;
for(i=0;i<5;++i)
{
for(j=0;j<5;++j)
{
if(i==j)
continue;
for(k=0;k<5;++k)
... | ["32", "620"] | C | NoteIn the first sample, the optimal arrangement of the line is 23154. In this case, the total happiness equals:(g23β+βg32β+βg15β+βg51)β+β(g13β+βg31β+βg54β+βg45)β+β(g15β+βg51)β+β(g54β+βg45)β=β32. | Print a single integer β the maximum possible total happiness of the students. | Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. That's why every morning there is a line of five people in front of the dormitory s... | [{"input": "0 0 0 0 9\r\n0 0 0 0 0\r\n0 0 0 0 0\r\n0 0 0 0 0\r\n7 0 0 0 0\r\n", "output": ["32"]}, {"input": "0 43 21 18 2\r\n3 0 21 11 65\r\n5 2 0 1 4\r\n54 62 12 0 99\r\n87 64 81 33 0\r\n", "output": ["620"]}, {"input": "0 4 2 4 9\r\n6 0 2 5 0\r\n2 5 0 6 3\r\n6 3 3 0 10\r\n0 3 1 3 0\r\n", "output": ["63"]}, {"input":... | 100 | 100 | 100 | [{'input': '0 27677 88187 87515 82582\r\n98177 0 22852 28214 99977\r\n52662 14066 0 79760 68188\r\n56883 30561 91843 0 79777\r\n12461 14821 29284 54372 0\r\n', 'output': ['878207']}, {'input': '0 5271 65319 64976 13673\r\n80352 0 41169 66004 47397\r\n33603 44407 0 55079 36122\r\n4277 9834 92810 0 80276\r\n1391 1145 921... | [{'input': '0 28287 52158 19163 10096\r\n93438 0 19260 88892 12429\r\n22525 60034 0 78163 18126\r\n11594 8506 56066 0 17732\r\n59561 82486 23419 57406 0\r\n', 'output': ['654636']}, {'input': '0 1 1 1 0\r\n1 0 0 1 0\r\n0 1 0 0 1\r\n1 1 0 0 0\r\n1 0 0 1 0\r\n', 'output': ['10']}, {'input': '0 90479 71577 33797 88848\r\n... | [{'input': '0 0 0 0 0\r\n0 0 0 0 0\r\n0 0 0 0 0\r\n0 0 0 0 0\r\n0 0 0 0 0\r\n', 'output': ['0']}, {'input': '0 46183 30304 63049 13191\r\n37244 0 23076 12594 43885\r\n98470 1788 0 37335 7775\r\n33822 50804 27921 0 56734\r\n38313 67579 77714 46687 0\r\n', 'output': ['666175']}, {'input': '0 28287 52158 19163 10096\r\n93... | [{'input': '0 1 1 1 0\r\n1 0 0 1 0\r\n0 1 0 0 1\r\n1 1 0 0 0\r\n1 0 0 1 0\r\n', 'output': ['10']}, {'input': '0 39037 87960 13497 38526\r\n5528 0 44220 23338 92550\r\n87887 86544 0 30269 82845\r\n24590 60325 90979 0 20186\r\n64959 69875 93564 68355 0\r\n', 'output': ['950600']}, {'input': '0 97 67 53 6\r\n96 0 100 57 1... | [{'input': '0 4109 129 1340 7124\r\n7815 0 8991 2828 909\r\n5634 799 0 5691 9604\r\n3261 7013 8062 0 5160\r\n2433 4742 694 4786 0\r\n', 'output': ['69867']}, {'input': '0 670 904 349 56\r\n446 0 941 590 993\r\n654 888 0 423 752\r\n16 424 837 0 433\r\n418 655 459 897 0\r\n', 'output': ['9752']}, {'input': '0 65 90 2 32\... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 96 | 100 | 100 | 100 |
["1 2", "0 5", "2 2"] | The input file consists of a single line containing two space-separated numbers n and m (0ββ€βn,βmββ€β105) β the number of the grown-ups and the number of the children in the bus, correspondingly. | 1e865eda33afe09302bda9077d613763 | #include<stdio.h>
int main() {
int M,N,min,max;
scanf("%d%d",&N,&M);
if(M==0 && N==0)
printf("0 0\n");
else if(N==0)
printf("Impossible\n");
else {
if(M==0) {
min=N;
max=N;
}
else {
if(N>=M) {
min=N;
max=N+M-1;
}
else {
min=M;
max=N+M-1;
}
}
printf("%d %d\n",min,max)... | ["2 2", "Impossible", "2 3"] | C | NoteIn the first sample a grown-up rides with two children and pays two rubles.In the second sample there are only children in the bus, so the situation is impossible. In the third sample there are two cases: Each of the two grown-ups rides with one children and pays one ruble for the tickets. In this case the passeng... | If n grown-ups and m children could have ridden in the bus, then print on a single line two space-separated integers β the minimum and the maximum possible total bus fare, correspondingly. Otherwise, print "Impossible" (without the quotes). | One day Vasya heard a story: "In the city of High Bertown a bus number 62 left from the bus station. It had n grown-ups and m kids..."The latter events happen to be of no importance to us. Vasya is an accountant and he loves counting money. So he wondered what maximum and minimum sum of money these passengers could hav... | [{"input": "1 2\r\n", "output": ["2 2"]}, {"input": "0 5\r\n", "output": ["Impossible"]}, {"input": "2 2\r\n", "output": ["2 3"]}, {"input": "2 7\r\n", "output": ["7 8"]}, {"input": "4 10\r\n", "output": ["10 13"]}, {"input": "6 0\r\n", "output": ["6 6"]}, {"input": "7 1\r\n", "output": ["7 7"]}, {"input": "0 0\r\n", "... | 100 | 100 | 100 | [{'input': '99227 53323\r\n', 'output': ['99227 152549']}, {'input': '1 100000\r\n', 'output': ['100000 100000']}, {'input': '63028 63028\r\n', 'output': ['63028 126055']}, {'input': '0 100000\r\n', 'output': ['Impossible']}, {'input': '71 24\r\n', 'output': ['71 94']}] | [{'input': '26666 52747\r\n', 'output': ['52747 79412']}, {'input': '1 0\r\n', 'output': ['1 1']}, {'input': '73415 4445\r\n', 'output': ['73415 77859']}, {'input': '63 82\r\n', 'output': ['82 144']}, {'input': '1 100000\r\n', 'output': ['100000 100000']}] | [{'input': '21 27\r\n', 'output': ['27 47']}, {'input': '45657 29028\r\n', 'output': ['45657 74684']}, {'input': '63 82\r\n', 'output': ['82 144']}, {'input': '100000 1\r\n', 'output': ['100000 100000']}, {'input': '63028 63028\r\n', 'output': ['63028 126055']}] | [{'input': '4 10\r\n', 'output': ['10 13']}, {'input': '42246 94024\r\n', 'output': ['94024 136269']}, {'input': '1 2\r\n', 'output': ['2 2']}, {'input': '59617 59617\r\n', 'output': ['59617 119233']}, {'input': '25038 4786\r\n', 'output': ['25038 29823']}] | [{'input': '23256 15156\r\n', 'output': ['23256 38411']}, {'input': '100000 1\r\n', 'output': ['100000 100000']}, {'input': '80236 14868\r\n', 'output': ['80236 95103']}, {'input': '80236 0\r\n', 'output': ['80236 80236']}, {'input': '63028 63028\r\n', 'output': ['63028 126055']}] | 100 | 100 | 100 | 100 | 100 | 81.25 | 87.5 | 75 | 75 | 75 | 60 | 80 | 50 | 50 | 70 | 97 | 100 | 78.75 | 62 |
["1 1 1", "5 2 4"] | The first and only line contains three integers: n, m and k (1ββ€βn,βm,βkββ€β2000). | 1f9107e8d1d8aebb1f4a1707a6cdeb6d | #include <stdio.h>
const long long int base = 1000000007;
long long int sq(int x, int y) {
long long int i, a;
a = 1;
for (i = 0; i < y; i++) {
a = (a * x) % base;
}
return a;
}
int main() {
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
if (k == 1 || k > n) printf("%I64d", sq(m, n));
else if ... | ["1", "2"] | C | NoteIn the first sample only one string is valid: "a" (let's denote the only letter of our alphabet as "a").In the second sample (if we denote the alphabet letters as "a" and "b") the following strings are valid: "aaaaa" and "bbbbb". | Print a single integer β the number of strings of the described type modulo 1000000007 (109β+β7). | Just in case somebody missed it: this winter is totally cold in Nvodsk! It is so cold that one gets funny thoughts. For example, let's say there are strings with the length exactly n, based on the alphabet of size m. Any its substring with length equal to k is a palindrome. How many such strings exist? Your task is to ... | [{"input": "1 1 1\r\n", "output": ["1"]}, {"input": "5 2 4\r\n", "output": ["2"]}, {"input": "7 4 20\r\n", "output": ["16384"]}, {"input": "8 13 9\r\n", "output": ["815730721"]}, {"input": "10 23 9\r\n", "output": ["529"]}, {"input": "10 25 8\r\n", "output": ["25"]}, {"input": "997 1752 1000\r\n", "output": ["184834849... | 100 | 100 | 100 | [{'input': '7 4 20\r\n', 'output': ['16384']}, {'input': '1 1 1\r\n', 'output': ['1']}, {'input': '8 13 9\r\n', 'output': ['815730721']}, {'input': '10 5 1\r\n', 'output': ['9765625']}, {'input': '10 10 10\r\n', 'output': ['100000']}] | [{'input': '1321 95 2\r\n', 'output': ['95']}, {'input': '1451 239 1451\r\n', 'output': ['968856942']}, {'input': '1 1 1\r\n', 'output': ['1']}, {'input': '1000 2 1001\r\n', 'output': ['688423210']}, {'input': '2000 2 10\r\n', 'output': ['2']}] | [{'input': '3 1000 3\r\n', 'output': ['1000000']}, {'input': '1000 1000 1\r\n', 'output': ['524700271']}, {'input': '1230 987 1\r\n', 'output': ['890209975']}, {'input': '1678 1999 1234\r\n', 'output': ['1999']}, {'input': '10 10 10\r\n', 'output': ['100000']}] | [{'input': '4 4 4\r\n', 'output': ['16']}, {'input': '1501 893 1501\r\n', 'output': ['889854713']}, {'input': '15 1 15\r\n', 'output': ['1']}, {'input': '2000 1000 3\r\n', 'output': ['1000000']}, {'input': '4 256 1\r\n', 'output': ['294967268']}] | [{'input': '777 1 777\r\n', 'output': ['1']}, {'input': '5 2 4\r\n', 'output': ['2']}, {'input': '1 1 1\r\n', 'output': ['1']}, {'input': '200 200 200\r\n', 'output': ['104842676']}, {'input': '239 123 239\r\n', 'output': ['221051222']}] | 100 | 100 | 100 | 100 | 100 | 83.33 | 100 | 100 | 91.67 | 100 | 70 | 90 | 80 | 80 | 80 | 98 | 100 | 95 | 80 |
["4"] | The only line contains an integer n (2ββ€βnββ€β1012), the number of vertices in the graph. | a98f0d924ea52cafe0048f213f075891 | #include<stdio.h>
int main()
{
long long int i=0,n,count=0,temp,mod,M=1;
scanf("%lld",&n);
while(1)
{
// printf("%lld\n", i);
M=M*2;
mod=n%M;
temp=n/M;
// printf("%lld %lld %lld\n",temp , mod,M);
if(mod>M/2)
count+=(M/2)*(temp+1);
else... | ["4"] | C | NoteIn the first sample: The weight of the minimum spanning tree is 1+2+1=4. | The only line contains an integer x, the weight of the graph's minimum spanning tree. | Ehab is interested in the bitwise-xor operation and the special graphs. Mahmoud gave him a problem that combines both. He has a complete graph consisting of n vertices numbered from 0 to nβ-β1. For all 0ββ€βuβ<βvβ<βn, vertex u and vertex v are connected with an undirected edge that has weight (where is the bitwi... | [{"input": "4\r\n", "output": ["4"]}, {"input": "10\r\n", "output": ["21"]}, {"input": "2\r\n", "output": ["1"]}, {"input": "1000000000000\r\n", "output": ["20140978692096"]}, {"input": "999999999999\r\n", "output": ["20140978692095"]}, {"input": "23131234\r\n", "output": ["293058929"]}, {"input": "100000\r\n", "output... | 100 | 100 | 100 | [{'input': '65536\r\n', 'output': ['524288']}, {'input': '999999999999\r\n', 'output': ['20140978692095']}, {'input': '123456789\r\n', 'output': ['1680249144']}, {'input': '200\r\n', 'output': ['844']}, {'input': '549755813889\r\n', 'output': ['11269994184704']}] | [{'input': '23131234\r\n', 'output': ['293058929']}, {'input': '2\r\n', 'output': ['1']}, {'input': '7\r\n', 'output': ['11']}, {'input': '8\r\n', 'output': ['12']}, {'input': '536870912\r\n', 'output': ['7784628224']}] | [{'input': '5\r\n', 'output': ['8']}, {'input': '1048576\r\n', 'output': ['10485760']}, {'input': '200\r\n', 'output': ['844']}, {'input': '12000\r\n', 'output': ['84624']}, {'input': '1000\r\n', 'output': ['5052']}] | [{'input': '1048576\r\n', 'output': ['10485760']}, {'input': '1000000000000\r\n', 'output': ['20140978692096']}, {'input': '5\r\n', 'output': ['8']}, {'input': '123456789\r\n', 'output': ['1680249144']}, {'input': '2\r\n', 'output': ['1']}] | [{'input': '999999999999\r\n', 'output': ['20140978692095']}, {'input': '123456789\r\n', 'output': ['1680249144']}, {'input': '2\r\n', 'output': ['1']}, {'input': '10\r\n', 'output': ['21']}, {'input': '6\r\n', 'output': ['9']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 99 | 100 | 100 | 100 |
["5 1", "2 2", "3 2", "11 5", "37 63"] | The first line contains two space-separated integers n and C, 1ββ€βnββ€β500000, 1ββ€βCββ€β200000. | e63c70a9c96a94bce99618f2e695f83a | #include <stdio.h>
int mod_inv(int a, int p){
int y = p-2;
int res = 1;
while(y!=0){
if(y&1){
res = ((long long)res * a)%p;
}
a = ((long long)a*a)%p;
y = y>>1;
}
return res;
}
int main(void) {
// your code goes here
int n,c,i;
scanf("%d %d",&n,&c);
int res = c;
int prev = c;
int p = 1000003;
fo... | ["5", "5", "9", "4367", "230574"] | C | NoteThe number 106β+β3 is prime.In the second sample case, the five walls are: B BB., .B, BB, B., and .BIn the third sample case, the nine walls are the five as in the second sample case and in addition the following four: B BB B B BB., .B, BB, and BB | Print the number of different walls that Heidi could build, modulo 106β+β3. | Heidi the Cow is aghast: cracks in the northern Wall? Zombies gathering outside, forming groups, preparing their assault? This must not happen! Quickly, she fetches her HC2 (Handbook of Crazy Constructions) and looks for the right chapter:How to build a wall: Take a set of bricks. Select one of the possible wall desi... | [{"input": "5 1\r\n", "output": ["5"]}, {"input": "2 2\r\n", "output": ["5"]}, {"input": "3 2\r\n", "output": ["9"]}, {"input": "11 5\r\n", "output": ["4367"]}, {"input": "37 63\r\n", "output": ["230574"]}, {"input": "1 1\r\n", "output": ["1"]}, {"input": "350000 140000\r\n", "output": ["453366"]}, {"input": "350000 16... | 100 | 100 | 100 | [{'input': '400000 200000\r\n', 'output': ['388234']}, {'input': '350000 180000\r\n', 'output': ['708073']}, {'input': '500000 140000\r\n', 'output': ['775486']}, {'input': '2 2\r\n', 'output': ['5']}, {'input': '350000 160000\r\n', 'output': ['155549']}] | [{'input': '450000 180000\r\n', 'output': ['135727']}, {'input': '3 2\r\n', 'output': ['9']}, {'input': '350000 180000\r\n', 'output': ['708073']}, {'input': '500000 160000\r\n', 'output': ['298591']}, {'input': '37 63\r\n', 'output': ['230574']}] | [{'input': '5 1\r\n', 'output': ['5']}, {'input': '2 2\r\n', 'output': ['5']}, {'input': '450000 160000\r\n', 'output': ['926957']}, {'input': '450000 200000\r\n', 'output': ['997315']}, {'input': '500000 180000\r\n', 'output': ['901135']}] | [{'input': '500000 160000\r\n', 'output': ['298591']}, {'input': '3 2\r\n', 'output': ['9']}, {'input': '5 1\r\n', 'output': ['5']}, {'input': '2 2\r\n', 'output': ['5']}, {'input': '11 5\r\n', 'output': ['4367']}] | [{'input': '450000 160000\r\n', 'output': ['926957']}, {'input': '350000 180000\r\n', 'output': ['708073']}, {'input': '450000 180000\r\n', 'output': ['135727']}, {'input': '350000 140000\r\n', 'output': ['453366']}, {'input': '11 5\r\n', 'output': ['4367']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.